Merge /home/vsc/yap
This commit is contained in:
commit
1caeb168e9
21
C/alloc.c
21
C/alloc.c
@ -76,12 +76,13 @@ void *my_malloc(size_t sz) {
|
|||||||
|
|
||||||
p = malloc(sz);
|
p = malloc(sz);
|
||||||
// Yap_DebugPuts(stderr,"gof\n");
|
// Yap_DebugPuts(stderr,"gof\n");
|
||||||
if (Yap_do_low_level_trace)
|
if (Yap_do_low_level_trace) {
|
||||||
#if __ANDROID__
|
#if __ANDROID__
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "YAPDroid ", "+ %d %p", write_malloc,p);
|
// __android_log_print(ANDROID_LOG_ERROR, "YAPDroid ", "+ %d %p", write_malloc,p);
|
||||||
#else
|
#else
|
||||||
fprintf(stderr, "+s %p\n @%p %ld\n", p, TR, LCL0 - (CELL *)LCL0);
|
fprintf(stderr, "+s %p\n @%p %ld\n", p, TR, LCL0 - (CELL *)LCL0);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,12 +90,12 @@ void *my_realloc(void *ptr, size_t sz) {
|
|||||||
void *p;
|
void *p;
|
||||||
|
|
||||||
p = realloc(ptr, sz);
|
p = realloc(ptr, sz);
|
||||||
if (Yap_do_low_level_trace)
|
//if (Yap_do_low_level_trace)
|
||||||
// fprintf(stderr, "+ %p -> %p : " Sizet_F "\n", ptr, p, sz);
|
// fprintf(stderr, "+ %p -> %p : " Sizet_F "\n", ptr, p, sz);
|
||||||
// Yap_DebugPuts(stderr,"gof\n");
|
// Yap_DebugPuts(stderr,"gof\n");
|
||||||
if (sz > 500 && write_malloc++ > 0)
|
// if (sz > 500 && write_malloc++ > 0)
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "YAPDroid ", "* %d %p",
|
// __android_log_print(ANDROID_LOG_ERROR, "YAPDroid ", "* %d %p",
|
||||||
write_malloc, p);
|
// write_malloc, p);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,9 +103,9 @@ void my_free(void *p) {
|
|||||||
// printf("f %p\n",p);
|
// printf("f %p\n",p);
|
||||||
if (Yap_do_low_level_trace)
|
if (Yap_do_low_level_trace)
|
||||||
fprintf(stderr, "- %p\n @%p %ld\n", p, TR, (long int)(LCL0 - (CELL *)B) );
|
fprintf(stderr, "- %p\n @%p %ld\n", p, TR, (long int)(LCL0 - (CELL *)B) );
|
||||||
if (write_malloc && write_malloc++ > 0)
|
//if (write_malloc && write_malloc++ > 0)
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "YAPDroid ", "- %d %p", write_malloc,
|
// __android_log_print(ANDROID_LOG_ERROR, "YAPDroid ", "- %d %p", write_malloc,
|
||||||
p);
|
// p);
|
||||||
|
|
||||||
free(p);
|
free(p);
|
||||||
// Yap_DebugPuts(stderr,"gof\n");
|
// Yap_DebugPuts(stderr,"gof\n");
|
||||||
|
@ -2105,7 +2105,7 @@ X_API int YAP_InitConsult(int mode, const char *fname, char **full, int *osnop)
|
|||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
int sno;
|
int sno;
|
||||||
BACKUP_MACHINE_REGS();
|
BACKUP_MACHINE_REGS();
|
||||||
char *fl = NULL;
|
const char *fl = NULL;
|
||||||
int lvl = push_text_stack();
|
int lvl = push_text_stack();
|
||||||
if (mode == YAP_BOOT_MODE) {
|
if (mode == YAP_BOOT_MODE) {
|
||||||
mode = YAP_CONSULT_MODE; }
|
mode = YAP_CONSULT_MODE; }
|
||||||
@ -2124,12 +2124,14 @@ X_API int YAP_InitConsult(int mode, const char *fname, char **full, int *osnop)
|
|||||||
} else {
|
} else {
|
||||||
pop_text_stack(lvl);
|
pop_text_stack(lvl);
|
||||||
}
|
}
|
||||||
|
|
||||||
lvl = push_text_stack();
|
lvl = push_text_stack();
|
||||||
bool consulted = (mode == YAP_CONSULT_MODE);
|
char *d = Malloc(strlen(fl)+1);
|
||||||
|
strcpy(d,fl);
|
||||||
|
bool consulted = (mode == YAP_CONSULT_MODE);
|
||||||
sno = Yap_OpenStream(MkStringTerm(fl), "r", MkAtomTerm(Yap_LookupAtom(fl)), LOCAL_encoding);
|
sno = Yap_OpenStream(MkStringTerm(fl), "r", MkAtomTerm(Yap_LookupAtom(fl)), LOCAL_encoding);
|
||||||
if (sno < 0 ||
|
if (sno < 0 ||
|
||||||
!Yap_ChDir(dirname((char *)fl))) {
|
!Yap_ChDir(dirname((char *)d))) {
|
||||||
pop_text_stack(lvl);
|
pop_text_stack(lvl);
|
||||||
*full = NULL;
|
*full = NULL;
|
||||||
return -1;
|
return -1;
|
||||||
@ -2167,12 +2169,16 @@ X_API FILE *YAP_TermToStream(Term t) {
|
|||||||
X_API void YAP_EndConsult(int sno, int *osnop, const char *full) {
|
X_API void YAP_EndConsult(int sno, int *osnop, const char *full) {
|
||||||
BACKUP_MACHINE_REGS();
|
BACKUP_MACHINE_REGS();
|
||||||
Yap_CloseStream(sno);
|
Yap_CloseStream(sno);
|
||||||
Yap_ChDir(dirname(full));
|
int lvl = push_text_stack();
|
||||||
|
char *d = Malloc(strlen(full)+1);
|
||||||
|
strcpy(d,full);
|
||||||
|
Yap_ChDir(dirname(d));
|
||||||
if (osnop >= 0)
|
if (osnop >= 0)
|
||||||
Yap_AddAlias(AtomLoopStream, *osnop);
|
Yap_AddAlias(AtomLoopStream, *osnop);
|
||||||
Yap_end_consult();
|
Yap_end_consult();
|
||||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid ", " closing %s(%d), %d", full, *osnop, sno);
|
__android_log_print(ANDROID_LOG_INFO, "YAPDroid ", " closing %s(%d), %d", full, *osnop, sno);
|
||||||
// LOCAL_CurSlot);
|
// LOCAL_CurSlot);
|
||||||
|
pop_text_stack(lvl);
|
||||||
RECOVER_MACHINE_REGS();
|
RECOVER_MACHINE_REGS();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2043,7 +2043,7 @@ static Int p_compile(USES_REGS1) { /* '$compile'(+C,+Flags,+C0,-Ref) */
|
|||||||
Yap_addclause(t, code_adr, t1, mod, &ARG5);
|
Yap_addclause(t, code_adr, t1, mod, &ARG5);
|
||||||
YAPLeaveCriticalSection();
|
YAPLeaveCriticalSection();
|
||||||
}
|
}
|
||||||
if (LOCAL_ErrorMessage) {
|
if (LOCAL_ErrorMessage ) {
|
||||||
Yap_Error(LOCAL_Error_TYPE, ARG1, LOCAL_ErrorMessage);
|
Yap_Error(LOCAL_Error_TYPE, ARG1, LOCAL_ErrorMessage);
|
||||||
YAPLeaveCriticalSection();
|
YAPLeaveCriticalSection();
|
||||||
return false;
|
return false;
|
||||||
|
@ -3575,7 +3575,7 @@ yamop *Yap_cclause(volatile Term inp_clause, Int NOfArgs, Term mod,
|
|||||||
cglobs.space_op->rnd1 = cglobs.space_used;
|
cglobs.space_op->rnd1 = cglobs.space_used;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (GLOBAL_Option['g' - 96])
|
if (GLOBAL_Option['g' - 96] )
|
||||||
Yap_ShowCode(&cglobs.cint);
|
Yap_ShowCode(&cglobs.cint);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
30
C/errors.c
30
C/errors.c
@ -321,6 +321,8 @@ bool Yap_PrintWarning(Term twarning) {
|
|||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
PredEntry *pred = RepPredProp(PredPropByFunc(
|
PredEntry *pred = RepPredProp(PredPropByFunc(
|
||||||
FunctorPrintMessage, PROLOG_MODULE)); // PROCEDURE_print_message2;
|
FunctorPrintMessage, PROLOG_MODULE)); // PROCEDURE_print_message2;
|
||||||
|
__android_log_print(ANDROID_LOG_INFO, "YAPDroid ", " warning(%s)",
|
||||||
|
Yap_TermToBuffer(twarning, ENC_ISO_UTF8,Quote_illegal_f | Ignore_ops_f | Unfold_cyclics_f));
|
||||||
Term cmod = (CurrentModule == PROLOG_MODULE ? TermProlog : CurrentModule);
|
Term cmod = (CurrentModule == PROLOG_MODULE ? TermProlog : CurrentModule);
|
||||||
bool rc;
|
bool rc;
|
||||||
Term ts[2], err;
|
Term ts[2], err;
|
||||||
@ -334,7 +336,6 @@ bool Yap_PrintWarning(Term twarning) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LOCAL_PrologMode |= InErrorMode;
|
LOCAL_PrologMode |= InErrorMode;
|
||||||
LOCAL_DoingUndefp = true;
|
|
||||||
if (pred->OpcodeOfPred == UNDEF_OPCODE || pred->OpcodeOfPred == FAIL_OPCODE) {
|
if (pred->OpcodeOfPred == UNDEF_OPCODE || pred->OpcodeOfPred == FAIL_OPCODE) {
|
||||||
fprintf(stderr, "warning message:\n");
|
fprintf(stderr, "warning message:\n");
|
||||||
Yap_DebugPlWrite(twarning);
|
Yap_DebugPlWrite(twarning);
|
||||||
@ -854,6 +855,7 @@ yamop *Yap_Error__(bool throw, const char *file, const char *function,
|
|||||||
if (LOCAL_delay)
|
if (LOCAL_delay)
|
||||||
return P;
|
return P;
|
||||||
if (LOCAL_DoingUndefp) {
|
if (LOCAL_DoingUndefp) {
|
||||||
|
LOCAL_DoingUndefp = false;
|
||||||
LOCAL_Signals = 0;
|
LOCAL_Signals = 0;
|
||||||
Yap_PrintWarning(MkErrorTerm(Yap_GetException(LOCAL_ActiveError)));
|
Yap_PrintWarning(MkErrorTerm(Yap_GetException(LOCAL_ActiveError)));
|
||||||
return P;
|
return P;
|
||||||
@ -872,6 +874,7 @@ static Int close_error(USES_REGS1) {
|
|||||||
if (!LOCAL_CommittedError)
|
if (!LOCAL_CommittedError)
|
||||||
return true;
|
return true;
|
||||||
LOCAL_CommittedError->errorNo = YAP_NO_ERROR;
|
LOCAL_CommittedError->errorNo = YAP_NO_ERROR;
|
||||||
|
LOCAL_ErrorMessage = NULL;
|
||||||
free(LOCAL_CommittedError);
|
free(LOCAL_CommittedError);
|
||||||
LOCAL_CommittedError = NULL;
|
LOCAL_CommittedError = NULL;
|
||||||
return true;
|
return true;
|
||||||
@ -967,6 +970,7 @@ bool Yap_RaiseException(void) {
|
|||||||
LOCAL_ActiveError->errorNo == YAP_NO_ERROR)
|
LOCAL_ActiveError->errorNo == YAP_NO_ERROR)
|
||||||
return false;
|
return false;
|
||||||
Yap_RestartYap(5);
|
Yap_RestartYap(5);
|
||||||
|
return false;
|
||||||
//return Yap_JumpToEnv();
|
//return Yap_JumpToEnv();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1061,14 +1065,22 @@ yap_error_descriptor_t *event(Term t, yap_error_descriptor_t *i) {
|
|||||||
yap_error_descriptor_t *Yap_UserError(Term t, yap_error_descriptor_t *i) {
|
yap_error_descriptor_t *Yap_UserError(Term t, yap_error_descriptor_t *i) {
|
||||||
Term n = t;
|
Term n = t;
|
||||||
bool found = false, wellformed = true;
|
bool found = false, wellformed = true;
|
||||||
if (!IsApplTerm(t) || FunctorOfTerm(t) != FunctorError) {
|
if (!IsApplTerm(t) || FunctorOfTerm(t) != FunctorError) {
|
||||||
LOCAL_Error_TYPE = THROW_EVENT;
|
LOCAL_Error_TYPE = THROW_EVENT;
|
||||||
LOCAL_ActiveError->errorClass = EVENT;
|
LOCAL_ActiveError->errorClass = EVENT;
|
||||||
LOCAL_ActiveError->errorAsText = Yap_errorName(THROW_EVENT);
|
LOCAL_ActiveError->errorAsText = Yap_errorName(THROW_EVENT);
|
||||||
LOCAL_ActiveError->classAsText =
|
LOCAL_ActiveError->classAsText =
|
||||||
Yap_errorClassName(Yap_errorClass(THROW_EVENT));
|
Yap_errorClassName(Yap_errorClass(THROW_EVENT));
|
||||||
LOCAL_ActiveError->errorRawTerm = Yap_SaveTerm(t);
|
LOCAL_ActiveError->errorRawTerm = Yap_SaveTerm(t);
|
||||||
LOCAL_ActiveError->culprit = NULL;
|
LOCAL_ActiveError->culprit = NULL;
|
||||||
|
} else if (i->errorNo != YAP_NO_ERROR && i->errorNo != ERROR_EVENT) {
|
||||||
|
LOCAL_Error_TYPE = i->errorNo;
|
||||||
|
LOCAL_ActiveError->errorClass = Yap_errorClass(i->errorNo);
|
||||||
|
LOCAL_ActiveError->errorAsText = Yap_errorName(i->errorNo);
|
||||||
|
LOCAL_ActiveError->classAsText =
|
||||||
|
Yap_errorClassName(Yap_errorClass(i->errorNo));
|
||||||
|
LOCAL_ActiveError->errorRawTerm = Yap_SaveTerm(t);
|
||||||
|
LOCAL_ActiveError->culprit = NULL;
|
||||||
} else {
|
} else {
|
||||||
Term t1, t2;
|
Term t1, t2;
|
||||||
t1 = ArgOfTerm(1, t);
|
t1 = ArgOfTerm(1, t);
|
||||||
|
12
C/exec.c
12
C/exec.c
@ -1435,6 +1435,7 @@ static bool exec_absmi(bool top, yap_reset_t reset_mode USES_REGS) {
|
|||||||
/* otherwise, SetDBForThrow will fail entering critical mode */
|
/* otherwise, SetDBForThrow will fail entering critical mode */
|
||||||
// LOCAL_ActiveError = err_info;
|
// LOCAL_ActiveError = err_info;
|
||||||
LOCAL_PrologMode = UserMode;
|
LOCAL_PrologMode = UserMode;
|
||||||
|
LOCAL_DoingUndefp = false;
|
||||||
/* find out where to cut to */
|
/* find out where to cut to */
|
||||||
/* siglongjmp resets the TR hardware register */
|
/* siglongjmp resets the TR hardware register */
|
||||||
/* TR and B are crucial, they might have been changed, or not */
|
/* TR and B are crucial, they might have been changed, or not */
|
||||||
@ -1464,6 +1465,7 @@ static bool exec_absmi(bool top, yap_reset_t reset_mode USES_REGS) {
|
|||||||
getAtomicGlobalPrologFlag(ARITHMETIC_EXCEPTIONS_FLAG));
|
getAtomicGlobalPrologFlag(ARITHMETIC_EXCEPTIONS_FLAG));
|
||||||
P = (yamop *)FAILCODE;
|
P = (yamop *)FAILCODE;
|
||||||
LOCAL_PrologMode = UserMode;
|
LOCAL_PrologMode = UserMode;
|
||||||
|
LOCAL_DoingUndefp = false;
|
||||||
Yap_CloseSlots(sls);
|
Yap_CloseSlots(sls);
|
||||||
} break;
|
} break;
|
||||||
case 3: { /* saved state */
|
case 3: { /* saved state */
|
||||||
@ -1472,7 +1474,8 @@ static bool exec_absmi(bool top, yap_reset_t reset_mode USES_REGS) {
|
|||||||
LOCAL_CBorder = OldBorder;
|
LOCAL_CBorder = OldBorder;
|
||||||
LOCAL_RestartEnv = sighold;
|
LOCAL_RestartEnv = sighold;
|
||||||
LOCAL_PrologMode = UserMode;
|
LOCAL_PrologMode = UserMode;
|
||||||
Yap_CloseSlots(sls);
|
LOCAL_DoingUndefp = false;
|
||||||
|
Yap_CloseSlots(sls);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
case 4:
|
case 4:
|
||||||
@ -1487,7 +1490,8 @@ static bool exec_absmi(bool top, yap_reset_t reset_mode USES_REGS) {
|
|||||||
Yap_JumpToEnv();
|
Yap_JumpToEnv();
|
||||||
}
|
}
|
||||||
LOCAL_PrologMode = UserMode;
|
LOCAL_PrologMode = UserMode;
|
||||||
P = (yamop *)FAILCODE;
|
LOCAL_DoingUndefp = false;
|
||||||
|
P = (yamop *)FAILCODE;
|
||||||
LOCAL_RestartEnv = sighold;
|
LOCAL_RestartEnv = sighold;
|
||||||
Yap_CloseSlots(sls);
|
Yap_CloseSlots(sls);
|
||||||
pop_text_stack(i+1);
|
pop_text_stack(i+1);
|
||||||
@ -2092,6 +2096,7 @@ static Int JumpToEnv(USES_REGS1) {
|
|||||||
|
|
||||||
B = handler;
|
B = handler;
|
||||||
P = FAILCODE;
|
P = FAILCODE;
|
||||||
|
LOCAL_DoingUndefp = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2110,6 +2115,9 @@ static Int jump_env(USES_REGS1) {
|
|||||||
"throw/1 must be called instantiated");
|
"throw/1 must be called instantiated");
|
||||||
}
|
}
|
||||||
// Yap_DebugPlWriteln(t);
|
// Yap_DebugPlWriteln(t);
|
||||||
|
// char *buf = Yap_TermToBuffer(t, ENC_ISO_UTF8,
|
||||||
|
// Quote_illegal_f | Ignore_ops_f | Unfold_cyclics_f);
|
||||||
|
// __android_log_print(ANDROID_LOG_INFO, "YAPDroid ", " throw(%s)", buf);
|
||||||
LOCAL_ActiveError = Yap_UserError(t0, LOCAL_ActiveError);
|
LOCAL_ActiveError = Yap_UserError(t0, LOCAL_ActiveError);
|
||||||
bool out = JumpToEnv(PASS_REGS1);
|
bool out = JumpToEnv(PASS_REGS1);
|
||||||
if (B != NULL && P == FAILCODE && B->cp_ap == NOCODE &&
|
if (B != NULL && P == FAILCODE && B->cp_ap == NOCODE &&
|
||||||
|
@ -1327,10 +1327,6 @@ static bool setInitialValue(bool bootstrap, flag_func f, const char *s,
|
|||||||
tarr->at = MkIntTerm(atol(YAP_NUMERIC_VERSION));
|
tarr->at = MkIntTerm(atol(YAP_NUMERIC_VERSION));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!strcmp(ss, "YAP_NUMERIC_VERSION")) {
|
|
||||||
tarr->at = MkIntTerm(atol(YAP_NUMERIC_VERSION));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
Yap_Error(DOMAIN_ERROR_OUT_OF_RANGE, TermNil,
|
Yap_Error(DOMAIN_ERROR_OUT_OF_RANGE, TermNil,
|
||||||
"~s should be either true (on) or false (off)", s);
|
"~s should be either true (on) or false (off)", s);
|
||||||
return false;
|
return false;
|
||||||
|
46
C/globals.c
46
C/globals.c
@ -22,10 +22,10 @@ static char SccsId[] = "%W% %G%";
|
|||||||
* @file globals.c
|
* @file globals.c
|
||||||
* @author VITOR SANTOS COSTA <vsc@VITORs-MBP.lan>
|
* @author VITOR SANTOS COSTA <vsc@VITORs-MBP.lan>
|
||||||
* @date Tue Nov 17 23:16:17 2015
|
* @date Tue Nov 17 23:16:17 2015
|
||||||
*
|
*
|
||||||
* @brief support for backtrable and non-backtrackable variables in Prolog.
|
* @brief support for backtrable and non-backtrackable variables in Prolog.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -351,6 +351,11 @@ static inline void clean_dirty_tr(tr_fr_ptr TR0 USES_REGS) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define expand_stack(S0,SP,SF,TYPE) \
|
||||||
|
size_t sz = SF-S0, used = SP-S0; \
|
||||||
|
S0 = Realloc(S0, (1024+sz)*sizeof(TYPE) PASS_REGS); \
|
||||||
|
SP = S0+used; SF = S0+sz;
|
||||||
|
|
||||||
static int copy_complex_term(register CELL *pt0, register CELL *pt0_end,
|
static int copy_complex_term(register CELL *pt0, register CELL *pt0_end,
|
||||||
int share, int copy_att_vars, CELL *ptf,
|
int share, int copy_att_vars, CELL *ptf,
|
||||||
CELL *HLow USES_REGS) {
|
CELL *HLow USES_REGS) {
|
||||||
@ -365,6 +370,7 @@ static int copy_complex_term(register CELL *pt0, register CELL *pt0_end,
|
|||||||
|
|
||||||
HB = HLow;
|
HB = HLow;
|
||||||
to_visit0 = to_visit;
|
to_visit0 = to_visit;
|
||||||
|
to_visit_max = to_visit+1024;
|
||||||
loop:
|
loop:
|
||||||
while (pt0 < pt0_end) {
|
while (pt0 < pt0_end) {
|
||||||
register CELL d0;
|
register CELL d0;
|
||||||
@ -384,8 +390,8 @@ loop:
|
|||||||
*ptf = AbsPair(HR);
|
*ptf = AbsPair(HR);
|
||||||
ptf++;
|
ptf++;
|
||||||
#ifdef RATIONAL_TREES
|
#ifdef RATIONAL_TREES
|
||||||
if (to_visit >= to_visit_max) {
|
if (to_visit >= to_visit_max-32) {
|
||||||
goto heap_overflow;
|
expand_stack(to_visit0, to_visit, to_visit_max, struct cp_frame);
|
||||||
}
|
}
|
||||||
to_visit->start_cp = pt0;
|
to_visit->start_cp = pt0;
|
||||||
to_visit->end_cp = pt0_end;
|
to_visit->end_cp = pt0_end;
|
||||||
@ -397,8 +403,9 @@ loop:
|
|||||||
to_visit++;
|
to_visit++;
|
||||||
#else
|
#else
|
||||||
if (pt0 < pt0_end) {
|
if (pt0 < pt0_end) {
|
||||||
if (to_visit + 1 >= (CELL **)AuxSp) {
|
if (to_visit + 32 >= to_visit_max - 32) {
|
||||||
goto heap_overflow;
|
expand_stack(to_visit0, to_visit, to_visit_max, struct cp_frame);
|
||||||
|
|
||||||
}
|
}
|
||||||
to_visit->start_cp = pt0;
|
to_visit->start_cp = pt0;
|
||||||
to_visit->end_cp = pt0_end;
|
to_visit->end_cp = pt0_end;
|
||||||
@ -496,7 +503,7 @@ loop:
|
|||||||
/* store the terms to visit */
|
/* store the terms to visit */
|
||||||
#ifdef RATIONAL_TREES
|
#ifdef RATIONAL_TREES
|
||||||
if (to_visit + 1 >= to_visit_max) {
|
if (to_visit + 1 >= to_visit_max) {
|
||||||
goto heap_overflow;
|
expand_stack(to_visit0, to_visit, to_visit_max, struct cp_frame);
|
||||||
}
|
}
|
||||||
to_visit->start_cp = pt0;
|
to_visit->start_cp = pt0;
|
||||||
to_visit->end_cp = pt0_end;
|
to_visit->end_cp = pt0_end;
|
||||||
@ -509,7 +516,7 @@ loop:
|
|||||||
#else
|
#else
|
||||||
if (pt0 < pt0_end) {
|
if (pt0 < pt0_end) {
|
||||||
if (to_visit++ >= (CELL **)AuxSp) {
|
if (to_visit++ >= (CELL **)AuxSp) {
|
||||||
goto heap_overflow;
|
expand_stack(to_visit0, to_visit, to_visit_max, struct cp_frame);
|
||||||
}
|
}
|
||||||
to_visit->start_cp = pt0;
|
to_visit->start_cp = pt0;
|
||||||
to_visit->end_cp = pt0_end;
|
to_visit->end_cp = pt0_end;
|
||||||
@ -617,25 +624,6 @@ overflow:
|
|||||||
pop_text_stack(lvl);
|
pop_text_stack(lvl);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
heap_overflow:
|
|
||||||
/* oops, we're in trouble */
|
|
||||||
HR = HLow;
|
|
||||||
/* we've done it */
|
|
||||||
/* restore our nice, friendly, term to its original state */
|
|
||||||
HB = HB0;
|
|
||||||
#ifdef RATIONAL_TREES
|
|
||||||
while (to_visit > to_visit0) {
|
|
||||||
to_visit--;
|
|
||||||
pt0 = to_visit->start_cp;
|
|
||||||
pt0_end = to_visit->end_cp;
|
|
||||||
ptf = to_visit->to;
|
|
||||||
*pt0 = to_visit->oldv;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
reset_trail(TR0);
|
|
||||||
pop_text_stack(lvl);
|
|
||||||
return -2;
|
|
||||||
|
|
||||||
trail_overflow:
|
trail_overflow:
|
||||||
/* oops, we're in trouble */
|
/* oops, we're in trouble */
|
||||||
HR = HLow;
|
HR = HLow;
|
||||||
@ -2790,7 +2778,7 @@ void Yap_InitGlobals(void) {
|
|||||||
Yap_InitCPred("nb_create", 4, p_nb_create2, 0L);
|
Yap_InitCPred("nb_create", 4, p_nb_create2, 0L);
|
||||||
Yap_InitCPredBack("$nb_current", 1, 1, init_current_nb, cont_current_nb,
|
Yap_InitCPredBack("$nb_current", 1, 1, init_current_nb, cont_current_nb,
|
||||||
SafePredFlag);
|
SafePredFlag);
|
||||||
/// @{
|
/// @{
|
||||||
/// @addtogroup nb
|
/// @addtogroup nb
|
||||||
CurrentModule = GLOBALS_MODULE;
|
CurrentModule = GLOBALS_MODULE;
|
||||||
Yap_InitCPred("nb_queue", 1, p_nb_queue, 0L);
|
Yap_InitCPred("nb_queue", 1, p_nb_queue, 0L);
|
||||||
|
@ -656,7 +656,7 @@ static Int code_in_pred(PredEntry *pp, Atom *pat, UInt *parity,
|
|||||||
|
|
||||||
PELOCK(40, pp);
|
PELOCK(40, pp);
|
||||||
/* check if the codeptr comes from the indexing code */
|
/* check if the codeptr comes from the indexing code */
|
||||||
if (pp->PredFlags & IndexedPredFlag) {
|
if (pp->PredFlags & IndexedPredFlag && pp->OpcodeOfPred != INDEX_OPCODE) {
|
||||||
if (pp->PredFlags & LogUpdatePredFlag) {
|
if (pp->PredFlags & LogUpdatePredFlag) {
|
||||||
if (code_in_pred_lu_index(
|
if (code_in_pred_lu_index(
|
||||||
ClauseCodeToLogUpdIndex(pp->cs.p_code.TrueCodeOfPred), codeptr,
|
ClauseCodeToLogUpdIndex(pp->cs.p_code.TrueCodeOfPred), codeptr,
|
||||||
|
7
C/text.c
7
C/text.c
@ -92,7 +92,7 @@ void *pop_output_text_stack__(int i, const void *export) {
|
|||||||
struct mblock *np = p->next;
|
struct mblock *np = p->next;
|
||||||
if (p + 1 == export) {
|
if (p + 1 == export) {
|
||||||
size_t sz = p->sz - sizeof(struct mblock);
|
size_t sz = p->sz - sizeof(struct mblock);
|
||||||
memcpy(p, p + 1, sz);
|
memmove(p, p + 1, sz);
|
||||||
export = p;
|
export = p;
|
||||||
} else {
|
} else {
|
||||||
free(p);
|
free(p);
|
||||||
@ -437,10 +437,10 @@ unsigned char *Yap_readText(seq_tv_t *inp USES_REGS) {
|
|||||||
LOCAL_Error_TYPE = TYPE_ERROR_TEXT;
|
LOCAL_Error_TYPE = TYPE_ERROR_TEXT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOCAL_ActiveError->errorRawTerm = inp->val.t;
|
LOCAL_ActiveError->errorRawTerm = MkUStringTerm(inp->val.uc);
|
||||||
}
|
}
|
||||||
if (LOCAL_Error_TYPE != YAP_NO_ERROR) {
|
if (LOCAL_Error_TYPE != YAP_NO_ERROR) {
|
||||||
Yap_ThrowError(LOCAL_Error_TYPE, inp->val.t, "Converting to text from term ");
|
Yap_ThrowError(LOCAL_Error_TYPE, LOCAL_ActiveError->errorRawTerm, "Converting to text from term ");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -458,7 +458,6 @@ unsigned char *Yap_readText(seq_tv_t *inp USES_REGS) {
|
|||||||
return at->UStrOfAE;
|
return at->UStrOfAE;
|
||||||
}
|
}
|
||||||
size_t sz = strlen(at->StrOfAE);
|
size_t sz = strlen(at->StrOfAE);
|
||||||
inp->type |= YAP_STRING_IN_TMP;
|
|
||||||
void *o = Malloc(sz + 1);
|
void *o = Malloc(sz + 1);
|
||||||
strcpy(o, at->StrOfAE);
|
strcpy(o, at->StrOfAE);
|
||||||
return pop_output_text_stack(lvl, o);
|
return pop_output_text_stack(lvl, o);
|
||||||
|
@ -604,12 +604,10 @@ InitReverseLookupOpcode(void)
|
|||||||
int hash_size_mask = OP_HASH_SIZE-1;
|
int hash_size_mask = OP_HASH_SIZE-1;
|
||||||
UInt sz = OP_HASH_SIZE*sizeof(struct opcode_tab_entry);
|
UInt sz = OP_HASH_SIZE*sizeof(struct opcode_tab_entry);
|
||||||
|
|
||||||
while (OP_RTABLE == NULL) {
|
|
||||||
if ((OP_RTABLE = (op_entry *)Yap_AllocCodeSpace(sz)) == NULL) {
|
if ((OP_RTABLE = (op_entry *)Yap_AllocCodeSpace(sz)) == NULL) {
|
||||||
if (!Yap_growheap(FALSE, sz, NULL)) {
|
if (!Yap_growheap(FALSE, sz, NULL)) {
|
||||||
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil,
|
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil,
|
||||||
"Couldn't obtain space for the reverse translation opcode table");
|
"Couldn't obtain space for the reverse translation opcode table");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
memset(OP_RTABLE, 0, sz);
|
memset(OP_RTABLE, 0, sz);
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* *
|
* *
|
||||||
* Yap Prolog *
|
* Yap Prolog *
|
||||||
@ -15,7 +16,6 @@
|
|||||||
* *
|
* *
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
/* static char SccsId[] = "X 4.3.3"; */
|
/* static char SccsId[] = "X 4.3.3"; */
|
||||||
#include "config.h"
|
|
||||||
#include "Yap.h"
|
#include "Yap.h"
|
||||||
#include "YapHeap.h"
|
#include "YapHeap.h"
|
||||||
#include "YapInterface.h"
|
#include "YapInterface.h"
|
||||||
@ -1038,6 +1038,7 @@ X_API void YAP_Init(YAP_init_args *yap_init) {
|
|||||||
init_globals(yap_init);
|
init_globals(yap_init);
|
||||||
|
|
||||||
start_modules();
|
start_modules();
|
||||||
|
CurrentModule = PROLOG_MODULE;
|
||||||
TermEof = MkAtomTerm( Yap_LookupAtom("end_of_file"));
|
TermEof = MkAtomTerm( Yap_LookupAtom("end_of_file"));
|
||||||
consult(Yap_BOOTSTRAP PASS_REGS);
|
consult(Yap_BOOTSTRAP PASS_REGS);
|
||||||
setAtomicGlobalPrologFlag(RESOURCE_DATABASE_FLAG,
|
setAtomicGlobalPrologFlag(RESOURCE_DATABASE_FLAG,
|
||||||
|
19
CXX/yapi.cpp
19
CXX/yapi.cpp
@ -37,7 +37,7 @@ X_API bool do_init_python(void);
|
|||||||
static void YAPCatchError()
|
static void YAPCatchError()
|
||||||
{
|
{
|
||||||
if (LOCAL_CommittedError != nullptr &&
|
if (LOCAL_CommittedError != nullptr &&
|
||||||
LOCAL_CommittedError->errorNo != YAP_NO_ERROR ) {
|
LOCAL_CommittedError->errorNo != YAP_NO_ERROR ) {
|
||||||
// Yap_PopTermFromDB(info->errorTerm);
|
// Yap_PopTermFromDB(info->errorTerm);
|
||||||
// throw throw YAPError( );
|
// throw throw YAPError( );
|
||||||
Term es[2];
|
Term es[2];
|
||||||
@ -47,7 +47,18 @@ static void YAPCatchError()
|
|||||||
YAP_RunGoalOnce(Yap_MkApplTerm(f, 2, es));
|
YAP_RunGoalOnce(Yap_MkApplTerm(f, 2, es));
|
||||||
// Yap_PopTermFromDB(info->errorTerm);
|
// Yap_PopTermFromDB(info->errorTerm);
|
||||||
// throw throw YAPError( SOURCE(), );
|
// throw throw YAPError( SOURCE(), );
|
||||||
}
|
} else if (LOCAL_ActiveError != nullptr &&
|
||||||
|
LOCAL_ActiveError->errorNo != YAP_NO_ERROR ) {
|
||||||
|
// Yap_PopTermFromDB(info->errorTerm);
|
||||||
|
// throw throw YAPError( );
|
||||||
|
Term es[2];
|
||||||
|
es[0] = TermError;
|
||||||
|
es[1] = MkErrorTerm(LOCAL_ActiveError);
|
||||||
|
Functor f = Yap_MkFunctor(Yap_LookupAtom("print_message"), 2);
|
||||||
|
YAP_RunGoalOnce(Yap_MkApplTerm(f, 2, es));
|
||||||
|
// Yap_PopTermFromDB(info->errorTerm);
|
||||||
|
// throw throw YAPError( SOURCE(), );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
YAPPredicate::YAPPredicate(Term &t, Term &tmod, CELL *&ts, const char *pname) {
|
YAPPredicate::YAPPredicate(Term &t, Term &tmod, CELL *&ts, const char *pname) {
|
||||||
@ -549,7 +560,7 @@ bool YAPEngine::mgoal(Term t, Term tmod, bool release) {
|
|||||||
bool result;
|
bool result;
|
||||||
// allow Prolog style exception handling
|
// allow Prolog style exception handling
|
||||||
// don't forget, on success these guys may create slots
|
// don't forget, on success these guys may create slots
|
||||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "exec ");
|
//__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "exec ");
|
||||||
|
|
||||||
result = (bool)YAP_EnterGoal(ap, nullptr, &q);
|
result = (bool)YAP_EnterGoal(ap, nullptr, &q);
|
||||||
YAP_LeaveGoal(result && !release, &q);
|
YAP_LeaveGoal(result && !release, &q);
|
||||||
@ -611,7 +622,7 @@ Term YAPEngine::fun(Term t) {
|
|||||||
q.cp = CP;
|
q.cp = CP;
|
||||||
// make sure this is safe
|
// make sure this is safe
|
||||||
// allow Prolog style exception handling
|
// allow Prolog style exception handling
|
||||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "exec ");
|
//__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "exec ");
|
||||||
|
|
||||||
bool result = (bool)YAP_EnterGoal(ap, nullptr, &q);
|
bool result = (bool)YAP_EnterGoal(ap, nullptr, &q);
|
||||||
YAPCatchError();
|
YAPCatchError();
|
||||||
|
@ -114,7 +114,7 @@ public:
|
|||||||
/// It i;
|
/// It i;
|
||||||
///};
|
///};
|
||||||
/// build a query from a term
|
/// build a query from a term
|
||||||
YAPQuery(YAPTerm t) : YAPPredicate((goal = t.term()), nts) {
|
YAPQuery(YAPTerm t) : YAPPredicate((goal = t.term()), (nts = &ARG1)) {
|
||||||
BACKUP_MACHINE_REGS();
|
BACKUP_MACHINE_REGS();
|
||||||
openQuery();
|
openQuery();
|
||||||
names = YAPPairTerm(TermNil) ;
|
names = YAPPairTerm(TermNil) ;
|
||||||
|
310
H/YapGFlagInfo.h
310
H/YapGFlagInfo.h
@ -56,26 +56,28 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
|||||||
~~~
|
~~~
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if __APPLE__
|
|
||||||
YAP_FLAG(APPLE_FLAG, "apple", false, booleanFlag, "true", NULL), /**<
|
|
||||||
read-only boolean, a machine running an Apple Operating System */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/**< `answer_format` how to present answers, default is `~p`. */
|
|
||||||
YAP_FLAG(ANSWER_FORMAT_FLAG, "answer_format", true, isatom, "~p", NULL),
|
YAP_FLAG(ANSWER_FORMAT_FLAG, "answer_format", true, isatom, "~p", NULL),
|
||||||
|
/**< how to present answers, default is `~p`. */
|
||||||
#if __ANDROID__
|
#if __ANDROID__
|
||||||
YAP_FLAG(ANDROID_FLAG, "android", false, booleanFlag, "true", NULL), /**<
|
YAP_FLAG(ANDROID_FLAG, "android", false, booleanFlag, "true", NULL), /**<
|
||||||
read-only boolean, a machine running an Google's Android version of the Linux Operating System */
|
read-only boolean, a machine running an Google's Android version of the Linux Operating System */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if __APPLE__
|
||||||
|
YAP_FLAG(APPLE_FLAG, "apple", false, booleanFlag, "true", NULL), /**<
|
||||||
|
read-only boolean, a machine running an Apple Operating System */
|
||||||
|
#endif
|
||||||
YAP_FLAG(ARCH_FLAG, "arch", false, isatom, YAP_ARCH, NULL), /**<
|
YAP_FLAG(ARCH_FLAG, "arch", false, isatom, YAP_ARCH, NULL), /**<
|
||||||
`apple`: read-only atom, it describes the ISA used in this version of YAP.
|
read-only atom, it describes the ISA used in this version of YAP.
|
||||||
Available from YAP_AEH.
|
Available from YAP_AEH.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
YAP_FLAG(ARGV_FLAG, "argv", false, argv, "@boot", NULL),
|
YAP_FLAG(ARGV_FLAG, "argv", false, argv, "@boot", NULL),
|
||||||
|
YAP_FLAG(ARITHMETIC_EXCEPTIONS_FLAG, "arithmetic_exceptions", true,
|
||||||
|
booleanFlag, "true", NULL),
|
||||||
/**< `arithmetic_exceptions`
|
/**< `arithmetic_exceptions`
|
||||||
|
|
||||||
Read-write flag telling whether arithmetic exceptions generate
|
Read-write flag telling whether arithmetic exceptions generate
|
||||||
@ -96,117 +98,114 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
|||||||
It is `true` by default, but it is disabled by packages like CLP(BN) and
|
It is `true` by default, but it is disabled by packages like CLP(BN) and
|
||||||
ProbLog.
|
ProbLog.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(ARITHMETIC_EXCEPTIONS_FLAG, "arithmetic_exceptions", true,
|
YAP_FLAG(BACK_QUOTES_FLAG, "back_quotes", true, isatom, "true", NULL),
|
||||||
booleanFlag, "true", NULL),
|
|
||||||
/**>
|
/**>
|
||||||
If _Value_ is unbound, tell whether a back quoted list of characters
|
If _Value_ is unbound, tell whether a back quoted list of characters
|
||||||
token is converted to a list of atoms, `chars`, to a list of integers,
|
token is converted to a list of atoms, `chars`, to a list of integers,
|
||||||
`codes`, or to a single atom, `atom`. If _Value_ is bound, set to
|
`codes`, or to a single atom, `atom`. If _Value_ is bound, set to
|
||||||
the corresponding behavior. The default value is `string`
|
the corresponding behavior. The default value is `string`
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(BACK_QUOTES_FLAG, "back_quotes", true, isatom, "true", NULL),
|
YAP_FLAG(BOUNDED_FLAG, "bounded", false, booleanFlag, "false", NULL),
|
||||||
/**< `bounded` is iso
|
/**< `bounded` is iso
|
||||||
|
|
||||||
Read-only flag telling whether integers are bounded. The value depends
|
Read-only flag telling whether integers are bounded. The value depends
|
||||||
on whether YAP uses the GMP library or not.
|
on whether YAP uses the GMP library or not.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
YAP_FLAG(BOUNDED_FLAG, "bounded", false, booleanFlag, "false", NULL),
|
|
||||||
YAP_FLAG(C_CC_FLAG, "c_cc", false, isatom, C_CC, NULL),
|
YAP_FLAG(C_CC_FLAG, "c_cc", false, isatom, C_CC, NULL),
|
||||||
YAP_FLAG(C_CFLAGS_FLAG, "c_cflags", false, isatom, C_CFLAGS, NULL),
|
YAP_FLAG(C_CFLAGS_FLAG, "c_cflags", false, isatom, C_CFLAGS, NULL),
|
||||||
YAP_FLAG(C_LDFLAGS_FLAG, "c_ldflags", false, isatom, C_LDFLAGS, NULL),
|
YAP_FLAG(C_LDFLAGS_FLAG, "c_ldflags", false, isatom, C_LDFLAGS, NULL),
|
||||||
YAP_FLAG(C_LIBPLSO_FLAG, "c_libplso", false, isatom, C_LIBPLSO, NULL),
|
YAP_FLAG(C_LIBPLSO_FLAG, "c_libplso", false, isatom, C_LIBPLSO, NULL),
|
||||||
YAP_FLAG(C_LIBS_FLAG, "c_libs", false, isatom, C_LIBS, NULL),
|
YAP_FLAG(C_LIBS_FLAG, "c_libs", false, isatom, C_LIBS, NULL),
|
||||||
|
YAP_FLAG(CHAR_CONVERSION_FLAG, "char_conversion", true, booleanFlag,
|
||||||
|
"false", NULL),
|
||||||
/**< `char_conversion is iso`
|
/**< `char_conversion is iso`
|
||||||
|
|
||||||
Writable flag telling whether a character conversion table is used when
|
Writable flag telling whether a character conversion table is used when
|
||||||
reading terms. The default value for this flag is `off` except in
|
reading terms. The default value for this flag is `off` except in
|
||||||
`sicstus` and `iso` language modes, where it is `on`.
|
`sicstus` and `iso` language modes, where it is `on`.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(CHAR_CONVERSION_FLAG, "char_conversion", true, booleanFlag,
|
|
||||||
"false", NULL),
|
|
||||||
/**< `character_escapes is iso `
|
|
||||||
|
|
||||||
Writable flag telling whether a character escapes are enables,
|
|
||||||
`true`, or disabled, `false`. The default value for this flag is
|
|
||||||
`true`. */
|
|
||||||
YAP_FLAG(CHARACTER_ESCAPES_FLAG, "character_escapes", true, booleanFlag,
|
YAP_FLAG(CHARACTER_ESCAPES_FLAG, "character_escapes", true, booleanFlag,
|
||||||
"true", NULL),
|
"true", NULL),
|
||||||
YAP_FLAG(COLON_SETS_CALLING_CONTEXT_FLAG, "colon_sets_calling_context", true, booleanFlag, "true", NULL),
|
/**< `
|
||||||
|
|
||||||
|
Writable flag telling whether a character escapes are enabled,
|
||||||
|
`true`, or disabled, `false`. The default value for this flag is
|
||||||
|
`true`. */
|
||||||
|
YAP_FLAG(COLON_SETS_CALLING_CONTEXT_FLAG, "colon_sets_calling_context", true, booleanFlag, "true", NULL),
|
||||||
/**< `compiled_at `
|
/**< `compiled_at `
|
||||||
|
|
||||||
Read-only flag that gives the time when the main YAP binary was compiled. It
|
Read-only flag that gives the time when the main YAP binary was compiled. It
|
||||||
is obtained staight from the __TIME__ macro, as defined in the C99.
|
is obtained staight from the __TIME__ macro, as defined in the C99.
|
||||||
*/
|
*/ YAP_FLAG(COMPILED_AT_FLAG, "compiled_at", false, isatom, YAP_COMPILED_AT,
|
||||||
YAP_FLAG(COMPILED_AT_FLAG, "compiled_at", false, isatom, YAP_COMPILED_AT,
|
|
||||||
NULL),
|
NULL),
|
||||||
/**< `debug is iso `
|
YAP_FLAG(DEBUG_FLAG, "debug", true, booleanFlag, "false", NULL),
|
||||||
|
/**<
|
||||||
|
|
||||||
If _Value_ is unbound, tell whether debugging is `true` or
|
If _Value_ is unbound, tell whether debugging is `true` or
|
||||||
`false`. If _Value_ is bound to `true` enable debugging, and if
|
`false`. If _Value_ is bound to `true` enable debugging, and if
|
||||||
it is bound to `false` disable debugging.
|
it is bound to `false` disable debugging.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(DEBUG_FLAG, "debug", true, booleanFlag, "false", NULL),
|
|
||||||
YAP_FLAG(DEBUG_INFO_FLAG, "debug_info", true, booleanFlag, "true", NULL),
|
YAP_FLAG(DEBUG_INFO_FLAG, "debug_info", true, booleanFlag, "true", NULL),
|
||||||
YAP_FLAG(DEBUG_ON_ERROR_FLAG, "debug_on_error", true, booleanFlag, "true",
|
YAP_FLAG(DEBUG_ON_ERROR_FLAG, "debug_on_error", true, booleanFlag, "true",
|
||||||
NULL),
|
NULL),
|
||||||
/**<
|
/**<
|
||||||
If bound, set the argument to the `write_term/3` options the
|
If bound, set the argument to the `write_term/3` options the
|
||||||
debugger uses to write terms. If unbound, show the current options.
|
debugger uses to write terms. If unbound, show the current options.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(DEBUGGER_PRINT_OPTIONS_FLAG, "debugger_print_options", true,
|
YAP_FLAG(DEBUGGER_PRINT_OPTIONS_FLAG, "debugger_print_options", true,
|
||||||
list_option,
|
list_option,
|
||||||
"[quoted(true),numbervars(true),portrayed(true),max_depth(10)]",
|
"[quoted(true),numbervars(true),portrayed(true),max_depth(10)]",
|
||||||
NULL),
|
NULL),
|
||||||
YAP_FLAG(DEBUGGER_SHOW_CONTEXT_FLAG, "debugger_show_context", true,
|
YAP_FLAG(DEBUGGER_SHOW_CONTEXT_FLAG, "debugger_show_context", true,
|
||||||
booleanFlag, "false", NULL),
|
booleanFlag, "false", NULL),
|
||||||
/**< `dialect `
|
YAP_FLAG(DIALECT_FLAG, "dialect", false, ro, "yap", NULL),
|
||||||
|
/**<
|
||||||
|
|
||||||
Read-only flag that always returns `yap`.
|
Read-only flag that always returns `yap`.
|
||||||
*/
|
|
||||||
YAP_FLAG(DIALECT_FLAG, "dialect", false, ro, "yap", NULL),
|
|
||||||
/**< `discontiguous_warnings `
|
|
||||||
|
|
||||||
If `true` (default `true`) YAP checks for definitions of the same predicate
|
|
||||||
that are separated by clauses for other predicates. This may indicate that
|
|
||||||
different procedures have the same name.
|
|
||||||
|
|
||||||
The declaration discontiguous/1 disables this warning for user-specified
|
|
||||||
predicates.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(DISCONTIGUOUS_WARNINGS_FLAG, "discontiguous_warnings", true,
|
YAP_FLAG(DISCONTIGUOUS_WARNINGS_FLAG, "discontiguous_warnings", true,
|
||||||
booleanFlag, "true", NULL),
|
booleanFlag, "true", NULL),
|
||||||
/**< `dollar_as_lower_case `
|
/**<
|
||||||
|
|
||||||
|
If `true` (default `true`) YAP checks for definitions of the same predicate
|
||||||
|
that are separated by clauses for other predicates. This may indicate that
|
||||||
|
different procedures have the same name.
|
||||||
|
|
||||||
|
The declaration discontiguous/1 disables this warning for user-specified
|
||||||
|
predicates.
|
||||||
|
|
||||||
|
*/
|
||||||
|
YAP_FLAG(DOLLAR_AS_LOWER_CASE_FLAG, "dollar_as_lower_case", true,
|
||||||
|
booleanFlag, "false", NULL),
|
||||||
|
/**<
|
||||||
If `off` (default) consider the character `$` a control character, if
|
If `off` (default) consider the character `$` a control character, if
|
||||||
`on` consider `$` a lower case character.
|
`on` consider `$` a lower case character.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(DOLLAR_AS_LOWER_CASE_FLAG, "dollar_as_lower_case", true,
|
YAP_FLAG(DOUBLE_QUOTES_FLAG, "double_quotes", true, isatom, "codes", dqs),
|
||||||
booleanFlag, "false", NULL),
|
/**< iso
|
||||||
/**< `double_quotes is iso `
|
|
||||||
|
|
||||||
If _Value_ is unbound, tell whether a double quoted list of characters
|
If _Value_ is unbound, tell whether a double quoted list of characters
|
||||||
token is converted to a list of atoms, `chars`, to a list of integers,
|
token is converted to a list of atoms, `chars`, to a list of integers,
|
||||||
`codes`, or to a single atom, `atom`. If _Value_ is bound, set to
|
`codes`, or to a single atom, `atom`. If _Value_ is bound, set to
|
||||||
the corresponding behavior. The default value is `codes`. */
|
the corresponding behavior. The default value is `codes`. */
|
||||||
YAP_FLAG(DOUBLE_QUOTES_FLAG, "double_quotes", true, isatom, "codes", dqs),
|
|
||||||
YAP_FLAG(EDITOR_FLAG, "editor", true, isatom, "$EDITOR", NULL),
|
YAP_FLAG(EDITOR_FLAG, "editor", true, isatom, "$EDITOR", NULL),
|
||||||
/**< `executable `
|
YAP_FLAG(EXECUTABLE_FLAG, "executable", false, executable, "@boot", NULL),
|
||||||
|
/**<
|
||||||
|
|
||||||
Read-only flag. It unifies with an atom that gives the
|
Read-only flag. It unifies with an atom that gives the
|
||||||
original program path.
|
original program path.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(EXECUTABLE_FLAG, "executable", false, executable, "@boot", NULL),
|
YAP_FLAG(FAST_FLAG, "fast", true, booleanFlag, "false", NULL),
|
||||||
/**< `fast `
|
/**<
|
||||||
|
|
||||||
If `on` allow fast machine code, if `off` (default) disable it. Only
|
If `on` allow fast machine code, if `off` (default) disable it. Only
|
||||||
available in experimental implementations.
|
available in experimental implementations.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(FAST_FLAG, "fast", true, booleanFlag, "false", NULL),
|
|
||||||
YAP_FLAG(FILE_NAME_VARIABLES_FLAG, "file_name_variables", true, booleanFlag,
|
YAP_FLAG(FILE_NAME_VARIABLES_FLAG, "file_name_variables", true, booleanFlag,
|
||||||
"true", NULL),
|
"true", NULL),
|
||||||
/**< + `float_format `
|
YAP_FLAG(FLOAT_FORMAT_FLAG, "float_format", true, isatom, "%.16f", NULL),
|
||||||
|
/**<
|
||||||
|
|
||||||
C-library `printf()` format specification used by write/1 and
|
C-library `printf()` format specification used by write/1 and
|
||||||
friends to determine how floating point numbers are printed. The
|
friends to determine how floating point numbers are printed. The
|
||||||
@ -215,21 +214,21 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
|||||||
printed, `%g` will print all floats using 6 digits instead of the
|
printed, `%g` will print all floats using 6 digits instead of the
|
||||||
default 15.
|
default 15.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(FLOAT_FORMAT_FLAG, "float_format", true, isatom, "%.16f", NULL),
|
YAP_FLAG(GC_FLAG, "gc", true, booleanFlag, "on", NULL),
|
||||||
/**< `gc`
|
/**< `gc`
|
||||||
|
|
||||||
If `on` allow garbage collection (default), if `off` disable it.
|
If `on` allow garbage collection (default), if `off` disable it.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(GC_FLAG, "gc", true, booleanFlag, "on", NULL),
|
YAP_FLAG(GC_MARGIN_FLAG, "gc_margin", true, nat, "0", gc_margin),
|
||||||
/**< `gc_margin `
|
/**< `gc_margin `
|
||||||
|
|
||||||
Set or show the minimum free stack before starting garbage
|
Set or show the minimum free stack before starting garbage
|
||||||
collection. The default depends on total stack size.
|
collection. The default depends on total stack size.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(GC_MARGIN_FLAG, "gc_margin", true, nat, "0", gc_margin),
|
YAP_FLAG(GC_TRACE_FLAG, "gc_trace", true, isatom, "off", NULL),
|
||||||
/**< `gc_trace `
|
/**<
|
||||||
|
*
|
||||||
If `off` (default) do not show information on garbage collection
|
If `off` (default) do not show information on garbage collection
|
||||||
and stack shifts, if `on` inform when a garbage collection or stack
|
and stack shifts, if `on` inform when a garbage collection or stack
|
||||||
shift happened, if verbose give detailed information on garbage
|
shift happened, if verbose give detailed information on garbage
|
||||||
@ -237,8 +236,9 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
|||||||
information on data-structures found during the garbage collection
|
information on data-structures found during the garbage collection
|
||||||
process, namely, on choice-points.
|
process, namely, on choice-points.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(GC_TRACE_FLAG, "gc_trace", true, isatom, "off", NULL),
|
YAP_FLAG(GENERATE_DEBUGGING_INFO_FLAG, "generate_debug_info", true,
|
||||||
/**< `generate_debug_info `
|
booleanFlag, "true", NULL),
|
||||||
|
/**< `
|
||||||
|
|
||||||
If `true` (default) generate debugging information for
|
If `true` (default) generate debugging information for
|
||||||
procedures, including source mode. If `false` predicates no
|
procedures, including source mode. If `false` predicates no
|
||||||
@ -246,36 +246,36 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
|||||||
source mode is disabled.
|
source mode is disabled.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(GENERATE_DEBUGGING_INFO_FLAG, "generate_debug_info", true,
|
|
||||||
booleanFlag, "true", NULL),
|
|
||||||
YAP_FLAG(GMP_VERSION_FLAG, "gmp_version", false, isatom, "4.8.12", NULL),
|
YAP_FLAG(GMP_VERSION_FLAG, "gmp_version", false, isatom, "4.8.12", NULL),
|
||||||
YAP_FLAG(HALT_AFTER_CONSULT_FLAG, "halt_after_consult", false, booleanFlag,
|
YAP_FLAG(HALT_AFTER_CONSULT_FLAG, "halt_after_consult", false, booleanFlag,
|
||||||
"false", NULL),
|
"false", NULL),
|
||||||
|
YAP_FLAG(HOME_FLAG, "home", false, isatom, YAP_ROOTDIR, NULL),
|
||||||
/**< home `
|
/**< home `
|
||||||
|
|
||||||
the root of the YAP installation, by default `/usr/local` in Unix or
|
the root of the YAP installation, by default `/usr/local` in Unix or
|
||||||
`c:\Yap` in Windows system. Can only be set at configure time
|
`c:\Yap` in Windows system. Can only be set at configure time
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(HOME_FLAG, "home", false, isatom, YAP_ROOTDIR, NULL),
|
YAP_FLAG(HOST_TYPE_FLAG, "host_type", false, isatom, HOST_ALIAS, NULL),
|
||||||
/**< host_type `
|
/**< host_type `
|
||||||
|
|
||||||
Return `configure` system information, including the machine-id
|
Return `configure` system information, including the machine-id
|
||||||
for which YAP was compiled and Operating System information.
|
for which YAP was compiled and Operating System information.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(HOST_TYPE_FLAG, "host_type", false, isatom, HOST_ALIAS, NULL),
|
YAP_FLAG(INDEX_FLAG, "index", true, indexer, "multi", NULL),
|
||||||
/**< `index `
|
/**< `index `
|
||||||
|
|
||||||
If `on` allow indexing (default), if `off` disable it, if
|
If `on` allow indexing (default), if `off` disable it, if
|
||||||
`single` allow on first argument only.
|
`single` allow on first argument only.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(INDEX_FLAG, "index", true, indexer, "multi", NULL),
|
YAP_FLAG(INDEX_SUB_TERM_SEARCH_DEPTH_FLAG, "index_sub_term_search_depth",
|
||||||
/**< `Index_sub_term_search_depth `
|
true, nat, "0", NULL),
|
||||||
|
/**< `Index_sub_term_search_depth `
|
||||||
|
|
||||||
Maximum bound on searching sub-terms for indexing, if `0` (default) no
|
Maximum bound on searching sub-terms for indexing, if `0` (default) no
|
||||||
bound.
|
bound.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(INDEX_SUB_TERM_SEARCH_DEPTH_FLAG, "index_sub_term_search_depth",
|
YAP_FLAG(INFORMATIONAL_MESSAGES_FLAG, "informational_messages", true,
|
||||||
true, nat, "0", NULL),
|
isatom, "normal", NULL),
|
||||||
/**< `informational_messages `
|
/**< `informational_messages `
|
||||||
|
|
||||||
If `on` allow printing of informational messages, such as the ones
|
If `on` allow printing of informational messages, such as the ones
|
||||||
@ -283,16 +283,15 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
|||||||
these messages. It is `on` by default except if YAP is booted with
|
these messages. It is `on` by default except if YAP is booted with
|
||||||
the `-L` flag.
|
the `-L` flag.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(INFORMATIONAL_MESSAGES_FLAG, "informational_messages", true,
|
YAP_FLAG(INTEGER_ROUNDING_FUNCTION_FLAG, "integer_rounding_function", true,
|
||||||
isatom, "normal", NULL),
|
isatom, "toward_zero", NULL),
|
||||||
/**< `integer_rounding_function is iso `
|
/**< `integer_rounding_function is iso `
|
||||||
|
|
||||||
Read-only flag telling the rounding function used for integers. Takes the
|
Read-only flag telling the rounding function used for integers. Takes the
|
||||||
value `toward_zero` for the current version of YAP.
|
value `toward_zero` for the current version of YAP.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(INTEGER_ROUNDING_FUNCTION_FLAG, "integer_rounding_function", true,
|
|
||||||
isatom, "toward_zero", NULL),
|
|
||||||
YAP_FLAG(ISO_FLAG, "iso", true, booleanFlag, "false", NULL),
|
YAP_FLAG(ISO_FLAG, "iso", true, booleanFlag, "false", NULL),
|
||||||
|
YAP_FLAG(LANGUAGE_FLAG, "language", true, isatom, "yap", NULL),
|
||||||
/**< `language `
|
/**< `language `
|
||||||
|
|
||||||
Choose whether YAP follows native, closer to C-Prolog, `yap`, iso-prolog,
|
Choose whether YAP follows native, closer to C-Prolog, `yap`, iso-prolog,
|
||||||
@ -302,24 +301,22 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
|||||||
are interpreted, when to use dynamic, character escapes, and how files
|
are interpreted, when to use dynamic, character escapes, and how files
|
||||||
are consulted. Also check the `dialect` option.
|
are consulted. Also check the `dialect` option.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(LANGUAGE_FLAG, "language", true, isatom, "yap", NULL),
|
|
||||||
/**< if defined, first location where YAP expects to find the YAP Prolog
|
|
||||||
library. Takes precedence over library_directory */
|
|
||||||
YAP_FLAG(PROLOG_LIBRARY_DIRECTORY_FLAG, "prolog_library_directory", true,
|
YAP_FLAG(PROLOG_LIBRARY_DIRECTORY_FLAG, "prolog_library_directory", true,
|
||||||
isatom, "", NULL),
|
isatom, "", NULL),
|
||||||
|
|
||||||
/**< if defined, first location where YAP expects to find the YAP Prolog
|
/**< if defined, first location where YAP expects to find the YAP Prolog
|
||||||
shared libraries (DLLS). Takes precedence over executable_directory/2. */
|
library. Takes precedence over library_directory */
|
||||||
YAP_FLAG(PROLOG_FOREIGN_DIRECTORY_FLAG, "prolog_foreign_directory", true,
|
YAP_FLAG(PROLOG_FOREIGN_DIRECTORY_FLAG, "prolog_foreign_directory", true,
|
||||||
isatom, "", NULL),
|
isatom, "", NULL),
|
||||||
|
/**< if defined, first location where YAP expects to find the YAP Prolog
|
||||||
|
shared libraries (DLLS). Takes precedence over executable_directory/2. */
|
||||||
|
|
||||||
/**< `max_arity is iso `
|
/**< `max_arity is iso `
|
||||||
|
YAP_FLAG(MAX_ARITY_FLAG, "max_arity", false, isatom, "unbounded", NULL),
|
||||||
|
|
||||||
Read-only flag telling the maximum arity of a functor. Takes the value
|
Read-only flag telling the maximum arity of a functor. Takes the value
|
||||||
`unbounded` for the current version of YAP.
|
`unbounded` for the current version of YAP.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(MAX_ARITY_FLAG, "max_arity", false, isatom, "unbounded", NULL),
|
YAP_FLAG(MAX_TAGGED_INTEGER_FLAG, "max_tagged_integer", false, at2n,
|
||||||
YAP_FLAG(MAX_TAGGED_INTEGER_FLAG, "max_tagged_integer", false, at2n,
|
|
||||||
"INT_MAX", NULL),
|
"INT_MAX", NULL),
|
||||||
YAP_FLAG(MAX_THREADS_FLAG, "max_threads", false, at2n, "MAX_THREADS", NULL),
|
YAP_FLAG(MAX_THREADS_FLAG, "max_threads", false, at2n, "MAX_THREADS", NULL),
|
||||||
YAP_FLAG(MAX_WORKERS_FLAG, "max_workers", false, at2n, "MAX_WORKERS", NULL),
|
YAP_FLAG(MAX_WORKERS_FLAG, "max_workers", false, at2n, "MAX_WORKERS", NULL),
|
||||||
@ -329,45 +326,47 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
|||||||
"256", NULL),
|
"256", NULL),
|
||||||
YAP_FLAG(OCCURS_CHECK_FLAG, "occurs_check", true, booleanFlag, "false",
|
YAP_FLAG(OCCURS_CHECK_FLAG, "occurs_check", true, booleanFlag, "false",
|
||||||
NULL),
|
NULL),
|
||||||
|
YAP_FLAG(OPEN_EXPANDS_FILENAME_FLAG, "open_expands_filename", true,
|
||||||
|
booleanFlag, "false", NULL),
|
||||||
/**< `open_expands_filename `
|
/**< `open_expands_filename `
|
||||||
|
|
||||||
If `true` the open/3 builtin performs filename-expansion
|
If `true` the open/3 builtin performs filename-expansion
|
||||||
before opening a file (SICStus Prolog like). If `false` it does not
|
before opening a file (SICStus Prolog like). If `false` it does not
|
||||||
(SWI-Prolog like).
|
(SWI-Prolog like).
|
||||||
*/
|
|
||||||
YAP_FLAG(OPEN_EXPANDS_FILENAME_FLAG, "open_expands_filename", true,
|
|
||||||
booleanFlag, "false", NULL),
|
|
||||||
/**< `open_shared_object `
|
|
||||||
|
|
||||||
If true, `open_shared_object/2` and friends are implemented,
|
|
||||||
providing access to shared libraries (`.so` files) or to dynamic link
|
|
||||||
libraries (`.DLL` files).
|
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(OPEN_SHARED_OBJECT_FLAG, "open_shared_object", true, booleanFlag,
|
YAP_FLAG(OPEN_SHARED_OBJECT_FLAG, "open_shared_object", true, booleanFlag,
|
||||||
"true", NULL),
|
"true", NULL),
|
||||||
/**< `module_independent_operators `
|
/**< `open_shared_object `
|
||||||
|
|
||||||
|
If true, `open_shared_object/2` and friends are implemented,
|
||||||
|
providing access to shared libraries (`.so` files) or to dynamic link
|
||||||
|
libraries (`.DLL` files).
|
||||||
|
*/
|
||||||
|
/**< `module_independent_operators `
|
||||||
|
|
||||||
If `true` an operator declaration will be valid for every module in the
|
If `true` an operator declaration will be valid for every module in the
|
||||||
program. This is for compatibility with old software that
|
program. This is for compatibility with old software that
|
||||||
might expect module-independent operators.
|
might expect module-independent operators.
|
||||||
*/
|
*/
|
||||||
// YAP_FLAG(MODULE_INDEPENDENT_OPERATORS_FLAG,
|
YAP_FLAG(MODULE_INDEPENDENT_OPERATORS_FLAG,
|
||||||
// "module_independent_operators", true, booleanFlag,
|
"module_independent_operators", true, booleanFlag,
|
||||||
// "false", NULL),
|
"false", NULL),
|
||||||
|
|
||||||
YAP_FLAG(OPTIMISE_FLAG, "optimise", true, booleanFlag, "false", NULL),
|
YAP_FLAG(OPTIMISE_FLAG, "optimise", true, booleanFlag, "false", NULL),
|
||||||
YAP_FLAG(OS_ARGV_FLAG, "os_argv", false, os_argv, "@boot", NULL),
|
YAP_FLAG(OS_ARGV_FLAG, "os_argv", false, os_argv, "@boot", NULL),
|
||||||
YAP_FLAG(PID_FLAG, "pid", false, sys_pid, "@boot", NULL),
|
YAP_FLAG(PID_FLAG, "pid", false, sys_pid, "@boot", NULL),
|
||||||
YAP_FLAG(PIPE_FLAG, "pipe", true, booleanFlag, "true", NULL),
|
YAP_FLAG(PIPE_FLAG, "pipe", true, booleanFlag, "true", NULL),
|
||||||
|
YAP_FLAG(PROFILING_FLAG, "profiling", true, booleanFlag, "false", NULL),
|
||||||
/**< `profiling `
|
/**< `profiling `
|
||||||
|
|
||||||
If `off` (default) do not compile call counting information for
|
If `off` (default) do not compile call counting information for
|
||||||
procedures. If `on` compile predicates so that they calls and
|
procedures. If `on` compile predicates so that they calls and
|
||||||
retries to the predicate may be counted. Profiling data can be read through
|
retries to the predicate may be counted. Profiling data can be read through
|
||||||
the call_count_data/3 built-in.
|
the call_count_data/3 built-in.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(PROFILING_FLAG, "profiling", true, booleanFlag, "false", NULL),
|
YAP_FLAG(PROMPT_ALTERNATIVES_ON_FLAG, "prompt_alternatives_on", true,
|
||||||
/**< `prompt_alternatives_on(atom,
|
isatom, "determinism", NULL),
|
||||||
|
/**< `prompt_alternatives_on(atom,
|
||||||
changeable) `
|
changeable) `
|
||||||
|
|
||||||
SWI-Compatible option, determines prompting for alternatives in the Prolog
|
SWI-Compatible option, determines prompting for alternatives in the Prolog
|
||||||
@ -375,66 +374,65 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
|||||||
and only if the query contains variables. The alternative, default in
|
and only if the query contains variables. The alternative, default in
|
||||||
SWI-Prolog is <tt>determinism</tt> which implies the system prompts for
|
SWI-Prolog is <tt>determinism</tt> which implies the system prompts for
|
||||||
alternatives if the goal succeeded while leaving choicepoints. */
|
alternatives if the goal succeeded while leaving choicepoints. */
|
||||||
YAP_FLAG(PROMPT_ALTERNATIVES_ON_FLAG, "prompt_alternatives_on", true,
|
|
||||||
isatom, "determinism", NULL),
|
|
||||||
YAP_FLAG(QUASI_QUOTATIONS_FLAG, "quasi_quotations", true, booleanFlag,
|
YAP_FLAG(QUASI_QUOTATIONS_FLAG, "quasi_quotations", true, booleanFlag,
|
||||||
"true", NULL),
|
"true", NULL),
|
||||||
|
YAP_FLAG(READLINE_FLAG, "readline", true, booleanFlag, "false",
|
||||||
|
Yap_InitReadline),
|
||||||
/**< `readline(boolean, changeable)`
|
/**< `readline(boolean, changeable)`
|
||||||
}
|
}
|
||||||
|
|
||||||
enable the use of the readline library for console interactions, true by
|
enable the use of the readline library for console interactions, true by
|
||||||
default if readline was found. */
|
default if readline was found. */
|
||||||
YAP_FLAG(READLINE_FLAG, "readline", true, booleanFlag, "false",
|
|
||||||
Yap_InitReadline),
|
|
||||||
YAP_FLAG(REPORT_ERROR_FLAG, "report_error", true, booleanFlag, "true",
|
YAP_FLAG(REPORT_ERROR_FLAG, "report_error", true, booleanFlag, "true",
|
||||||
NULL),
|
NULL),
|
||||||
|
YAP_FLAG(RESOURCE_DATABASE_FLAG, "resource_database", false, isatom,
|
||||||
|
YAP_BOOTSTRAP, NULL),
|
||||||
|
|
||||||
/**<`resource_database`
|
/**<`resource_database`
|
||||||
Name of the resource file (saved-state or Prolog file) used to construct
|
Name of the resource file (saved-state or Prolog file) used to construct
|
||||||
the YAP
|
the YAP
|
||||||
run-time environment.
|
run-time environment.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(RESOURCE_DATABASE_FLAG, "resource_database", false, isatom,
|
YAP_FLAG(SAVED_PROGRAM_FLAG, "saved_program", false, booleanFlag, "false",
|
||||||
YAP_BOOTSTRAP, NULL),
|
NULL),
|
||||||
|
|
||||||
/**<`saved_program`
|
/**<`saved_program`
|
||||||
if `true` YAP booted from a `yss` file, usually `startup.yss'. If
|
if `true` YAP booted from a `yss` file, usually `startup.yss'. If
|
||||||
`false`, YAP booted from a Prolog file, by default `boot.yap`.
|
`false`, YAP booted from a Prolog file, by default `boot.yap`.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(SAVED_PROGRAM_FLAG, "saved_program", false, booleanFlag, "false",
|
YAP_FLAG(SHARED_OBJECT_EXTENSION_FLAG, "shared_object_extension", false,
|
||||||
NULL),
|
isatom, SO_EXT, NULL),
|
||||||
|
|
||||||
/**< `shared_object_extension `
|
/**< `shared_object_extension `
|
||||||
|
|
||||||
Suffix associated with loadable code.
|
Suffix associated with loadable code.
|
||||||
*/
|
|
||||||
YAP_FLAG(SHARED_OBJECT_EXTENSION_FLAG, "shared_object_extension", false,
|
|
||||||
isatom, SO_EXT, NULL),
|
|
||||||
/**< `shared_object_search_path `
|
|
||||||
|
|
||||||
Name of the environment variable used by the system to search for shared
|
|
||||||
objects.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(SHARED_OBJECT_SEARCH_PATH_FLAG, "shared_object_search_path", true,
|
YAP_FLAG(SHARED_OBJECT_SEARCH_PATH_FLAG, "shared_object_search_path", true,
|
||||||
isatom, SO_PATH, NULL),
|
isatom, SO_PATH, NULL),
|
||||||
|
/**< `shared_object_search_path `
|
||||||
|
|
||||||
|
Name of the environment variable used by the system to search for shared
|
||||||
|
objects.
|
||||||
|
|
||||||
|
*/
|
||||||
|
YAP_FLAG(SINGLE_QUOTES_FLAG, "single_quotes", true, isatom, "atom", sqf),
|
||||||
/**< `single_quoted text is usuallly interpreted as atoms. This flagTerm
|
/**< `single_quoted text is usuallly interpreted as atoms. This flagTerm
|
||||||
allows other inerpretations such as strings_contains_strings */
|
allows other inerpretations such as strings_contains_strings */
|
||||||
YAP_FLAG(SINGLE_QUOTES_FLAG, "single_quotes", true, isatom, "atom", sqf),
|
|
||||||
|
|
||||||
|
YAP_FLAG(SIGNALS_FLAG, "signals", true, booleanFlag, "true", NULL),
|
||||||
/**< `signals`
|
/**< `signals`
|
||||||
|
|
||||||
If `true` (default) YAP handles Signals such as `^C`
|
If `true` (default) YAP handles Signals such as `^C`
|
||||||
(`SIGINT`).
|
(`SIGINT`).
|
||||||
|
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(SIGNALS_FLAG, "signals", true, booleanFlag, "true", NULL),
|
YAP_FLAG(SOURCE_FLAG, "source", true, booleanFlag, "true", NULL),
|
||||||
/**< `source`
|
/**< `source`
|
||||||
|
|
||||||
If `true` maintain the source for all clauses. Notice that this is trivially
|
If `true` maintain the source for all clauses. Notice that this is trivially
|
||||||
supported for facts, and always supported for dynamic code.
|
supported for facts, and always supported for dynamic code.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(SOURCE_FLAG, "source", true, booleanFlag, "true", NULL),
|
YAP_FLAG(STRICT_ISO_FLAG, "strict_iso", true, booleanFlag, "false", NULL),
|
||||||
/**< `strict_iso `
|
/**< `strict_iso `
|
||||||
|
|
||||||
If _Value_ is unbound, tell whether strict ISO compatibility mode
|
If _Value_ is unbound, tell whether strict ISO compatibility mode
|
||||||
@ -457,7 +455,8 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
|||||||
depends on a Prolog's platform specific features.
|
depends on a Prolog's platform specific features.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(STRICT_ISO_FLAG, "strict_iso", true, booleanFlag, "false", NULL),
|
YAP_FLAG(SYSTEM_OPTIONS_FLAG, "system_options", false, options,
|
||||||
|
SYSTEM_OPTIONS, NULL),
|
||||||
/**< `system_options `
|
/**< `system_options `
|
||||||
|
|
||||||
This read only flag tells which options were used to compile
|
This read only flag tells which options were used to compile
|
||||||
@ -466,21 +465,22 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
|||||||
`or-parallelism`, `rational_trees`, `readline`, `tabling`,
|
`or-parallelism`, `rational_trees`, `readline`, `tabling`,
|
||||||
`threads`, or the `wam_profiler`.
|
`threads`, or the `wam_profiler`.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(SYSTEM_OPTIONS_FLAG, "system_options", false, options,
|
|
||||||
SYSTEM_OPTIONS, NULL),
|
|
||||||
YAP_FLAG(SYSTEM_THREAD_ID_FLAG, "system_thread_id", false, sys_thread_id,
|
YAP_FLAG(SYSTEM_THREAD_ID_FLAG, "system_thread_id", false, sys_thread_id,
|
||||||
"@boot", NULL),
|
"@boot", NULL),
|
||||||
|
YAP_FLAG(TABLING_MODE_FLAG, "tabling_mode", true, isatom, "[]", NULL),
|
||||||
/**< `tabling_mode`
|
/**< `tabling_mode`
|
||||||
|
|
||||||
Sets or reads the tabling mode for all tabled predicates. Please
|
Sets or reads the tabling mode for all tabled predicates. Please
|
||||||
(see Tabling) for the list of options.
|
(see Tabling) for the list of options.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(TABLING_MODE_FLAG, "tabling_mode", true, isatom, "[]", NULL),
|
|
||||||
YAP_FLAG(THREADS_FLAG, "threads", false, ro, "MAX_THREADS", NULL),
|
YAP_FLAG(THREADS_FLAG, "threads", false, ro, "MAX_THREADS", NULL),
|
||||||
YAP_FLAG(TIMEZONE_FLAG, "timezone", false, ro, "18000", NULL),
|
YAP_FLAG(TIMEZONE_FLAG, "timezone", false, ro, "18000", NULL),
|
||||||
YAP_FLAG(TOPLEVEL_PRINT_ANON_FLAG, "toplevel_print_anon", true, booleanFlag,
|
YAP_FLAG(TOPLEVEL_PRINT_ANON_FLAG, "toplevel_print_anon", true, booleanFlag,
|
||||||
"true", NULL),
|
"true", NULL),
|
||||||
|
YAP_FLAG(TOPLEVEL_HOOK_FLAG, "toplevel_hook", true,
|
||||||
|
booleanFlag, "true",
|
||||||
|
NULL),
|
||||||
/**< `toplevel_hook `
|
/**< `toplevel_hook `
|
||||||
|
|
||||||
If bound, set the argument to a goal to be executed before entering the
|
If bound, set the argument to a goal to be executed before entering the
|
||||||
@ -495,13 +495,13 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
|||||||
YAP_FLAG(TOPLEVEL_PROMPT_FLAG, "toplevel_prompt", true, isatom, "?- ",
|
YAP_FLAG(TOPLEVEL_PROMPT_FLAG, "toplevel_prompt", true, isatom, "?- ",
|
||||||
mkprompt),
|
mkprompt),
|
||||||
YAP_FLAG(TTY_CONTROL_FLAG, "tty_control", true, booleanFlag, "true", NULL),
|
YAP_FLAG(TTY_CONTROL_FLAG, "tty_control", true, booleanFlag, "true", NULL),
|
||||||
|
YAP_FLAG(UNIX_FLAG, "unix", false, ro, "true", NULL),
|
||||||
/**< `unix`
|
/**< `unix`
|
||||||
|
|
||||||
Read-only BooleanFlag flag that unifies with `true` if YAP is
|
Read-only BooleanFlag flag that unifies with `true` if YAP is
|
||||||
running on an Unix system. Defined if the C-compiler used to compile
|
running on an Unix system. Defined if the C-compiler used to compile
|
||||||
this version of YAP either defines `__unix__` or `unix`.
|
this version of YAP either defines `__unix__` or `unix`.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(UNIX_FLAG, "unix", false, ro, "true", NULL),
|
|
||||||
/**< `update_semantics `
|
/**< `update_semantics `
|
||||||
|
|
||||||
Define whether YAP should follow `immediate` update
|
Define whether YAP should follow `immediate` update
|
||||||
@ -513,28 +513,29 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
|||||||
*/
|
*/
|
||||||
YAP_FLAG(UPDATE_SEMANTICS_FLAG, "update_semantics", true, isatom, "logical",
|
YAP_FLAG(UPDATE_SEMANTICS_FLAG, "update_semantics", true, isatom, "logical",
|
||||||
NULL),
|
NULL),
|
||||||
/**<
|
|
||||||
`user_flags `
|
|
||||||
|
|
||||||
Define the behaviour of set_prolog_flag/2 if the flag is not known. Values
|
|
||||||
are `silent`, `warning` and `error`. The first two create the flag
|
|
||||||
on-the-fly, with `warning` printing a message. The value `error` is
|
|
||||||
consistent with ISO: it raises an existence error and does not create the
|
|
||||||
flag. See also `create_prolog_flag/3`. The default is`error`, and developers
|
|
||||||
are encouraged to use `create_prolog_flag/3` to create flags for their
|
|
||||||
library.
|
|
||||||
*/
|
|
||||||
YAP_FLAG(USER_FLAGS_FLAG, "user_flags", true, isatom, "error", NULL),
|
YAP_FLAG(USER_FLAGS_FLAG, "user_flags", true, isatom, "error", NULL),
|
||||||
|
/**<
|
||||||
|
`user_flags `
|
||||||
|
|
||||||
|
Define the behaviour of set_prolog_flag/2 if the flag is not known. Values
|
||||||
|
are `silent`, `warning` and `error`. The first two create the flag
|
||||||
|
on-the-fly, with `warning` printing a message. The value `error` is
|
||||||
|
consistent with ISO: it raises an existence error and does not create the
|
||||||
|
flag. See also `create_prolog_flag/3`. The default is`error`, and developers
|
||||||
|
are encouraged to use `create_prolog_flag/3` to create flags for their
|
||||||
|
library.
|
||||||
|
*/
|
||||||
|
YAP_FLAG(UNKNOWN_FLAG, "unknown", true, isatom, "error", Yap_unknown),
|
||||||
/**< `unknown is iso`
|
/**< `unknown is iso`
|
||||||
|
|
||||||
Corresponds to calling the unknown/2 built-in. Possible ISO values
|
Corresponds to calling the unknown/2 built-in. Possible ISO values
|
||||||
are `error`, `fail`, and `warning`. Yap includes the following extensions:
|
are `error`, `fail`, and `warning`. Yap includes the following extensions:
|
||||||
`fast_fail` does not invoke any handler.
|
`fast_fail` does not invoke any handler.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(UNKNOWN_FLAG, "unknown", true, isatom, "error", Yap_unknown),
|
|
||||||
YAP_FLAG(VARIABLE_NAMES_MAY_END_WITH_QUOTES_FLAG,
|
YAP_FLAG(VARIABLE_NAMES_MAY_END_WITH_QUOTES_FLAG,
|
||||||
"variable_names_may_end_with_quotes", true, booleanFlag, "false",
|
"variable_names_may_end_with_quotes", true, booleanFlag, "false",
|
||||||
NULL),
|
NULL),
|
||||||
|
YAP_FLAG(VERBOSE_FLAG, "verbose", true, isatom, "normal", NULL),
|
||||||
/**< `verbose `
|
/**< `verbose `
|
||||||
|
|
||||||
If `normal` allow printing of informational and banner messages,
|
If `normal` allow printing of informational and banner messages,
|
||||||
@ -543,8 +544,7 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
|||||||
YAP is booted with the `-q` or `-L` flag.
|
YAP is booted with the `-q` or `-L` flag.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(VERBOSE_FLAG, "verbose", true, isatom, "normal", NULL),
|
YAP_FLAG(VERBOSE_FILE_SEARCH_FLAG, "verbose_file_search", true, booleanFlag,
|
||||||
YAP_FLAG(VERBOSE_AUTOLOAD_FLAG, "verbose_autoload", true, booleanFlag,
|
|
||||||
"false", NULL),
|
"false", NULL),
|
||||||
/**< `verbose_file_search `
|
/**< `verbose_file_search `
|
||||||
|
|
||||||
@ -553,23 +553,14 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
|||||||
is `false` by default except if YAP is booted with the `-L`
|
is `false` by default except if YAP is booted with the `-L`
|
||||||
flag.
|
flag.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(VERBOSE_FILE_SEARCH_FLAG, "verbose_file_search", true, booleanFlag,
|
YAP_FLAG(VERBOSE_LOAD_FLAG, "verbose_load", true, isatom, "normal", NULL),
|
||||||
"false", NULL),
|
|
||||||
/**< `verbose_load `
|
/**< `verbose_load `
|
||||||
|
|
||||||
If `true` allow printing of informational messages when
|
If `true` allow printing of informational messages when
|
||||||
consulting files. If `false` disable printing these messages. It
|
consulting files. If `false` disable printing these messages. It
|
||||||
is `normal` by default except if YAP is booted with the `-L`
|
is `normal` by default except if YAP is booted with the `-L`
|
||||||
flag.
|
flag.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(VERBOSE_LOAD_FLAG, "verbose_load", true, isatom, "normal", NULL),
|
|
||||||
/**< `version_data `
|
|
||||||
|
|
||||||
Read-only flag that unifies with a number of the form
|
|
||||||
`_Major_ * 100000 + _Minor_ *100 + _Patch_`, where
|
|
||||||
_Major_ is the major version, _Minor_ is the minor version,
|
|
||||||
and _Patch_ is the patch number.
|
|
||||||
*/
|
|
||||||
YAP_FLAG(VERSION_FLAG, "version", false, nat, YAP_NUMERIC_VERSION, NULL),
|
YAP_FLAG(VERSION_FLAG, "version", false, nat, YAP_NUMERIC_VERSION, NULL),
|
||||||
/**<
|
/**<
|
||||||
`version ` Read-only flag that returns a compound term with the
|
`version ` Read-only flag that returns a compound term with the
|
||||||
@ -579,13 +570,20 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(VERSION_DATA_FLAG, "version_data", false, ro, YAP_TVERSION, NULL),
|
YAP_FLAG(VERSION_DATA_FLAG, "version_data", false, ro, YAP_TVERSION, NULL),
|
||||||
|
/**< `version_data `
|
||||||
|
|
||||||
|
Read-only flag that unifies with a number of the form
|
||||||
|
`_Major_ * 100000 + _Minor_ *100 + _Patch_`, where
|
||||||
|
_Major_ is the major version, _Minor_ is the minor version,
|
||||||
|
and _Patch_ is the patch number.
|
||||||
|
*/
|
||||||
|
YAP_FLAG(VERSION_GIT_FLAG, "version_git", false, isatom, YAP_GIT_HEAD,
|
||||||
|
NULL),
|
||||||
/**< `version_git `
|
/**< `version_git `
|
||||||
`
|
`
|
||||||
this is the unique identifier for the last commit of the current GIT HEAD,
|
this is the unique identifier for the last commit of the current GIT HEAD,
|
||||||
it xan be used to identify versions that differ on small (or large) updates.
|
it xan be used to identify versions that differ on small (or large) updates.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(VERSION_GIT_FLAG, "version_git", false, isatom, YAP_GIT_HEAD,
|
|
||||||
NULL),
|
|
||||||
YAP_FLAG(WRITE_ATTRIBUTES_FLAG, "write_attributes", true, isatom, "ignore",
|
YAP_FLAG(WRITE_ATTRIBUTES_FLAG, "write_attributes", true, isatom, "ignore",
|
||||||
NULL),
|
NULL),
|
||||||
#if __WINDOWS__
|
#if __WINDOWS__
|
||||||
@ -596,6 +594,9 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
|||||||
*/
|
*/
|
||||||
YAP_FLAG(WINDOWS_FLAG, "windows", false, ro, "true", NULL),
|
YAP_FLAG(WINDOWS_FLAG, "windows", false, ro, "true", NULL),
|
||||||
#endif
|
#endif
|
||||||
|
YAP_FLAG(WRITE_STRINGS_FLAG, "write_strings", true, booleanFlag, "false",
|
||||||
|
NULL),
|
||||||
|
|
||||||
/**< `write_strings `
|
/**< `write_strings `
|
||||||
|
|
||||||
Writable flag telling whether the system should write lists of
|
Writable flag telling whether the system should write lists of
|
||||||
@ -603,9 +604,6 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
|||||||
is `on` if enables or `off` if disabled. The default value for
|
is `on` if enables or `off` if disabled. The default value for
|
||||||
this flag is `off`.
|
this flag is `off`.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(WRITE_STRINGS_FLAG, "write_strings", true, booleanFlag, "false",
|
|
||||||
NULL),
|
|
||||||
|
|
||||||
END_GLOBAL_FLAGS
|
END_GLOBAL_FLAGS
|
||||||
|
|
||||||
//! @}
|
//! @}
|
||||||
|
@ -1345,9 +1345,9 @@ static inline const unsigned char *Yap_TextToUTF8Buffer(Term t0 USES_REGS) {
|
|||||||
|
|
||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type = YAP_STRING_ATOM | YAP_STRING_STRING | YAP_STRING_CODES |
|
inp.type = YAP_STRING_ATOM | YAP_STRING_STRING | YAP_STRING_CODES |
|
||||||
YAP_STRING_ATOMS_CODES | YAP_STRING_MALLOC;
|
YAP_STRING_ATOMS_CODES;
|
||||||
out.val.uc = NULL;
|
out.val.uc = NULL;
|
||||||
out.type = YAP_STRING_CHARS;
|
out.type = YAP_STRING_CHARS | YAP_STRING_MALLOC;
|
||||||
out.enc = ENC_ISO_UTF8;
|
out.enc = ENC_ISO_UTF8;
|
||||||
|
|
||||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||||
|
13
os/assets.c
13
os/assets.c
@ -65,7 +65,7 @@ open_asset(VFS_t *me, const char *fname, const char *io_mode, int sno) {
|
|||||||
const void *buf;
|
const void *buf;
|
||||||
|
|
||||||
AAsset *am = NULL;
|
AAsset *am = NULL;
|
||||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "open %s-%s <%s>", fname, me->prefix,io_mode);
|
//__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "open %s-%s <%s>", fname, me->prefix,io_mode);
|
||||||
if (strchr(io_mode, 'B')) {
|
if (strchr(io_mode, 'B')) {
|
||||||
mode = AASSET_MODE_BUFFER;
|
mode = AASSET_MODE_BUFFER;
|
||||||
} else {
|
} else {
|
||||||
@ -78,10 +78,9 @@ open_asset(VFS_t *me, const char *fname, const char *io_mode, int sno) {
|
|||||||
// strcpy(dir, fname);
|
// strcpy(dir, fname);
|
||||||
// char *d = basename(dir);
|
// char *d = basename(dir);
|
||||||
am = AAssetManager_open(Yap_assetManager(), fname, mode);
|
am = AAssetManager_open(Yap_assetManager(), fname, mode);
|
||||||
if (am==NULL)
|
//if (am==NULL)
|
||||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "failed open %s <%s>", fname, strerror(errno) );
|
// __android_log_print(ANDROID_LOG_INFO, "YAPDroid", "failed open %s <%s>", fname, strerror(errno) );
|
||||||
|
|
||||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "open %s <%s>", fname, io_mode );
|
|
||||||
// while (dp) {
|
// while (dp) {
|
||||||
// char *f = AAssetDir_getNextFileName(dp);
|
// char *f = AAssetDir_getNextFileName(dp);
|
||||||
// __android_log_print(ANDROID_LOG_INFO, "YAPDroid", "open %s <%s>", f, d);
|
// __android_log_print(ANDROID_LOG_INFO, "YAPDroid", "open %s <%s>", f, d);
|
||||||
@ -189,7 +188,7 @@ bool is_dir_a(VFS_t *me, const char *dirName) {
|
|||||||
if (d == NULL || AAssetDir_getNextFileName(d) == NULL)
|
if (d == NULL || AAssetDir_getNextFileName(d) == NULL)
|
||||||
return false;
|
return false;
|
||||||
(AAssetDir_close(d));
|
(AAssetDir_close(d));
|
||||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "isdir %s <%p>", dirName, d);
|
//__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "isdir %s <%p>", dirName, d);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -199,7 +198,7 @@ bool exists_a(VFS_t *me, const char *dirName) {
|
|||||||
dirName += strlen(me->prefix) + 1;
|
dirName += strlen(me->prefix) + 1;
|
||||||
// try not to use it as an asset
|
// try not to use it as an asset
|
||||||
AAsset *d = AAssetManager_open(Yap_assetManager(), dirName, AASSET_MODE_UNKNOWN);
|
AAsset *d = AAssetManager_open(Yap_assetManager(), dirName, AASSET_MODE_UNKNOWN);
|
||||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "exists %s <%p>", dirName, d);
|
//__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "exists %s <%p>", dirName, d);
|
||||||
if (d == NULL)
|
if (d == NULL)
|
||||||
return false;
|
return false;
|
||||||
AAsset_close(d);
|
AAsset_close(d);
|
||||||
@ -219,7 +218,7 @@ static bool set_cwd(VFS_t *me, const char *dirName) {
|
|||||||
dirName = dirname(dirName);
|
dirName = dirname(dirName);
|
||||||
GLOBAL_cwd = malloc(strlen(dirName)+1);
|
GLOBAL_cwd = malloc(strlen(dirName)+1);
|
||||||
strcpy(GLOBAL_cwd, dirName);
|
strcpy(GLOBAL_cwd, dirName);
|
||||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "chdir %s", GLOBAL_cwd);
|
//__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "chdir %s", GLOBAL_cwd);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
23
os/iopreds.c
23
os/iopreds.c
@ -1130,7 +1130,9 @@ bool Yap_initStream(int sno, FILE *fd, const char *name, const char *io_mode,
|
|||||||
Term file_name, encoding_t encoding, stream_flags_t flags,
|
Term file_name, encoding_t encoding, stream_flags_t flags,
|
||||||
void *vfs) {
|
void *vfs) {
|
||||||
StreamDesc *st = &GLOBAL_Stream[sno];
|
StreamDesc *st = &GLOBAL_Stream[sno];
|
||||||
if (io_mode == NULL)
|
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "init %s %s stream <%d>",io_mode,name,
|
||||||
|
sno);
|
||||||
|
if (io_mode == NULL)
|
||||||
Yap_Error(PERMISSION_ERROR_NEW_ALIAS_FOR_STREAM, MkIntegerTerm(sno),
|
Yap_Error(PERMISSION_ERROR_NEW_ALIAS_FOR_STREAM, MkIntegerTerm(sno),
|
||||||
"File opened with NULL Permissions");
|
"File opened with NULL Permissions");
|
||||||
if (strchr(io_mode, 'a')) {
|
if (strchr(io_mode, 'a')) {
|
||||||
@ -1315,8 +1317,6 @@ static bool fill_stream(int sno, StreamDesc *st, Term tin, const char *io_mode,
|
|||||||
}
|
}
|
||||||
Yap_initStream(sno, st->file, fname, io_mode, user_name, LOCAL_encoding,
|
Yap_initStream(sno, st->file, fname, io_mode, user_name, LOCAL_encoding,
|
||||||
st->status, vfsp);
|
st->status, vfsp);
|
||||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "exists %s <%d>", fname,
|
|
||||||
sno);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1469,7 +1469,6 @@ if (args[OPEN_BOM].used) {
|
|||||||
// interactive streams do not have a start, so they probably don't have
|
// interactive streams do not have a start, so they probably don't have
|
||||||
// a BOM
|
// a BOM
|
||||||
avoid_bom = avoid_bom || (st->status & Tty_Stream_f);
|
avoid_bom = avoid_bom || (st->status & Tty_Stream_f);
|
||||||
// __android_log_print(ANDROID_LOG_INFO, "YAPDroid", "open %s", fname);
|
|
||||||
if (needs_bom && !write_bom(sno, st)) {
|
if (needs_bom && !write_bom(sno, st)) {
|
||||||
return false;
|
return false;
|
||||||
} else if (open_mode == AtomRead && !avoid_bom) {
|
} else if (open_mode == AtomRead && !avoid_bom) {
|
||||||
@ -1669,7 +1668,7 @@ int Yap_OpenStream(Term tin, const char *io_mode, Term user_name,
|
|||||||
// fname = Yap_VF(fname);
|
// fname = Yap_VF(fname);
|
||||||
|
|
||||||
|
|
||||||
if (fill_stream(sno, st, tin,io_mode,user_name,enc))
|
if (fill_stream(sno, st, tin,io_mode,user_name,enc))
|
||||||
return sno;
|
return sno;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1865,17 +1864,13 @@ static Int always_prompt_user(USES_REGS1) {
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int close1 /** @pred close(+ _S_) is iso
|
/** @pred close(+ _S_) is iso
|
||||||
|
|
||||||
|
|
||||||
Closes the stream _S_. If _S_ does not stand for a stream
|
Closes the stream _S_. If _S_ does not stand for a stream
|
||||||
currently opened an error is reported. The streams user_input,
|
currently opened an error is reported. The streams user_input,
|
||||||
user_output, and user_error can never be closed.
|
user_output, and user_error can never be closed.
|
||||||
|
*/
|
||||||
|
static Int close1(USES_REGS1) { /* '$close'(+GLOBAL_Stream) */
|
||||||
*/
|
|
||||||
|
|
||||||
(USES_REGS1) { /* '$close'(+GLOBAL_Stream) */
|
|
||||||
int sno = CheckStream(
|
int sno = CheckStream(
|
||||||
ARG1, (Input_Stream_f | Output_Stream_f | Socket_Stream_f), "close/2");
|
ARG1, (Input_Stream_f | Output_Stream_f | Socket_Stream_f), "close/2");
|
||||||
if (sno < 0)
|
if (sno < 0)
|
||||||
@ -2057,13 +2052,13 @@ void Yap_InitPlIO(struct yap_boot_params *argi) {
|
|||||||
Int i;
|
Int i;
|
||||||
if (argi->inp > 0)
|
if (argi->inp > 0)
|
||||||
Yap_stdin = fdopen(argi->inp - 1, "r");
|
Yap_stdin = fdopen(argi->inp - 1, "r");
|
||||||
else if (argi->inp)
|
else if (argi->inp < 0)
|
||||||
Yap_stdin = NULL;
|
Yap_stdin = NULL;
|
||||||
else
|
else
|
||||||
Yap_stdin = stdin;
|
Yap_stdin = stdin;
|
||||||
if (argi->out > 0)
|
if (argi->out > 0)
|
||||||
Yap_stdout = fdopen(argi->out - 1, "a");
|
Yap_stdout = fdopen(argi->out - 1, "a");
|
||||||
else if (argi->out)
|
else if (argi->out < 0)
|
||||||
Yap_stdout = NULL;
|
Yap_stdout = NULL;
|
||||||
else
|
else
|
||||||
Yap_stdout = stdout;
|
Yap_stdout = stdout;
|
||||||
|
@ -1545,8 +1545,8 @@ static Int read_term_from_string(USES_REGS1) {
|
|||||||
static Int atomic_to_term(USES_REGS1) {
|
static Int atomic_to_term(USES_REGS1) {
|
||||||
Term t1 = Deref(ARG1);
|
Term t1 = Deref(ARG1);
|
||||||
int l = push_text_stack();
|
int l = push_text_stack();
|
||||||
const char *s = Yap_TextToUTF8Buffer(t1 PASS_REGS);
|
const unsigned char *s = Yap_TextToUTF8Buffer(t1 PASS_REGS);
|
||||||
Int rc = Yap_BufferToTerm(s, add_output(ARG2, add_names(ARG3, TermNil)));
|
Int rc = Yap_UBufferToTerm(s, add_output(ARG2, add_names(ARG3, TermNil)));
|
||||||
pop_text_stack(l);
|
pop_text_stack(l);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -995,6 +995,8 @@ static void CloseStream(int sno) {
|
|||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
|
|
||||||
// fflush(NULL);
|
// fflush(NULL);
|
||||||
|
// __android_log_print(ANDROID_LOG_INFO, "YAPDroid", "close stream <%d>",
|
||||||
|
// sno);
|
||||||
VFS_t *me;
|
VFS_t *me;
|
||||||
if ((me = GLOBAL_Stream[sno].vfs) != NULL &&
|
if ((me = GLOBAL_Stream[sno].vfs) != NULL &&
|
||||||
GLOBAL_Stream[sno].file == NULL) {
|
GLOBAL_Stream[sno].file == NULL) {
|
||||||
@ -1034,6 +1036,7 @@ static void CloseStream(int sno) {
|
|||||||
GLOBAL_Stream[sno].vfs = NULL;
|
GLOBAL_Stream[sno].vfs = NULL;
|
||||||
GLOBAL_Stream[sno].file = NULL;
|
GLOBAL_Stream[sno].file = NULL;
|
||||||
GLOBAL_Stream[sno].status = Free_Stream_f;
|
GLOBAL_Stream[sno].status = Free_Stream_f;
|
||||||
|
// __android_log_print(ANDROID_LOG_INFO, "YAPDroid", "close stream <%d>", sno);
|
||||||
|
|
||||||
/* if (st->status == Socket_Stream_f|Input_Stream_f|Output_Stream_f) {
|
/* if (st->status == Socket_Stream_f|Input_Stream_f|Output_Stream_f) {
|
||||||
Yap_CloseSocket();
|
Yap_CloseSocket();
|
||||||
|
10
os/sysbits.c
10
os/sysbits.c
@ -355,7 +355,7 @@ bool Yap_ChDir(const char *path) {
|
|||||||
int lvl = push_text_stack();
|
int lvl = push_text_stack();
|
||||||
|
|
||||||
const char *qpath = Yap_AbsoluteFile(path, true);
|
const char *qpath = Yap_AbsoluteFile(path, true);
|
||||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "chdir %s", path);
|
//__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "chdir %s", path);
|
||||||
VFS_t *v;
|
VFS_t *v;
|
||||||
if ((v = vfs_owner(qpath))) {
|
if ((v = vfs_owner(qpath))) {
|
||||||
rc = v->chdir(v, (qpath));
|
rc = v->chdir(v, (qpath));
|
||||||
@ -398,7 +398,7 @@ static char *clean_path(const char *path) {
|
|||||||
const char *p, *p0;
|
const char *p, *p0;
|
||||||
int lvl = push_text_stack();
|
int lvl = push_text_stack();
|
||||||
|
|
||||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid ", " looking at %s", path);
|
//__android_log_print(ANDROID_LOG_INFO, "YAPDroid ", " looking at %s", path);
|
||||||
char *o0 = Malloc(FILENAME_MAX + 1), *o = o0;
|
char *o0 = Malloc(FILENAME_MAX + 1), *o = o0;
|
||||||
int ch;
|
int ch;
|
||||||
char *b0 = Malloc(FILENAME_MAX + 1), *b = b0;
|
char *b0 = Malloc(FILENAME_MAX + 1), *b = b0;
|
||||||
@ -423,8 +423,8 @@ static char *clean_path(const char *path) {
|
|||||||
if (o == o0)
|
if (o == o0)
|
||||||
*o++ = '/';
|
*o++ = '/';
|
||||||
*o = '\0';
|
*o = '\0';
|
||||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid ", " %s at %s, %p-%p", p0, o0,
|
// __android_log_print(ANDROID_LOG_INFO, "YAPDroid ", " %s at %s, %p-%p", p0, o0,
|
||||||
o, o0);
|
// o, o0);
|
||||||
return pop_output_text_stack(lvl, o0);
|
return pop_output_text_stack(lvl, o0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1146,7 +1146,7 @@ const char *Yap_getcwd(char *cwd, size_t cwdlen) {
|
|||||||
return (char *)cwd;
|
return (char *)cwd;
|
||||||
#endif
|
#endif
|
||||||
const char *rc = getcwd(cwd, FILENAME_MAX);
|
const char *rc = getcwd(cwd, FILENAME_MAX);
|
||||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "chdir %s", rc);
|
// __android_log_print(ANDROID_LOG_INFO, "YAPDroid", "chdir %s", rc);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,9 +127,7 @@
|
|||||||
%% SWI end
|
%% SWI end
|
||||||
:- use_module(library(dialect/hprolog)).
|
:- use_module(library(dialect/hprolog)).
|
||||||
:- use_module(pairlist).
|
:- use_module(pairlist).
|
||||||
:- start_low_level_trace.
|
|
||||||
:- include(chr_op).
|
:- include(chr_op).
|
||||||
:- stop_low_level_trace.
|
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
%%
|
%%
|
||||||
|
@ -72,7 +72,7 @@ foreach (driver ${MYDDAS_DBMS})
|
|||||||
cpp_driver(MYDDAS_YAP ${driver} myddas_driver.ypp)
|
cpp_driver(MYDDAS_YAP ${driver} myddas_driver.ypp)
|
||||||
endforeach ()
|
endforeach ()
|
||||||
|
|
||||||
list (APPEND MYDDAS_YAP ${CMAKE_CURRENT_SOURCE_DIR}/../sqlite3/test.yap ${CMAKE_CURRENT_SOURCE_DIR}/../sqlite3/chinook.db)
|
list (APPEND MYDDAS_YAP ${CMAKE_CURRENT_SOURCE_DIR}/../sqlite3/sqlitest.yap ${CMAKE_CURRENT_SOURCE_DIR}/../sqlite3/chinook.db)
|
||||||
add_to_group(MYDDAS_YAP pl_library )
|
add_to_group(MYDDAS_YAP pl_library )
|
||||||
|
|
||||||
add_custom_target(plmyddas ALL DEPENDS ${MYDDAS_YAP} )
|
add_custom_target(plmyddas ALL DEPENDS ${MYDDAS_YAP} )
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* *
|
* *
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
//:- load_foreign_files([myddas], [], init_myddas).
|
%%:- load_foreign_files([myddas], [], init_myddas).
|
||||||
|
|
||||||
/* Initialize MYDDAS GLOBAL STRUCTURES */
|
/* Initialize MYDDAS GLOBAL STRUCTURES */
|
||||||
:- c_db_initialize_myddas.
|
:- c_db_initialize_myddas.
|
||||||
@ -135,12 +135,12 @@
|
|||||||
|
|
||||||
:- use_module(myddas_sqlite3,[
|
:- use_module(myddas_sqlite3,[
|
||||||
% myddas_mysql.ypp
|
% myddas_mysql.ypp
|
||||||
c_sqlite3_connect/4,
|
%c_sqlite3_connect/4,
|
||||||
c_sqlite3_disconnect/1,
|
%c_sqlite3_disconnect/1,
|
||||||
c_sqlite3_query/5,
|
%c_sqlite3_query/5,
|
||||||
sqlite3_result_set/1,
|
sqlite3_result_set/1,
|
||||||
c_sqlite3_number_of_fields/3,
|
%c_sqlite3_number_of_fields/3,
|
||||||
c_sqlite3_get_attributes_types/3,
|
%c_sqlite3_get_attributes_types/3,
|
||||||
sqlite3_describe/3,
|
sqlite3_describe/3,
|
||||||
sqlite3_show_tables/2,
|
sqlite3_show_tables/2,
|
||||||
sqlite3_row/3
|
sqlite3_row/3
|
||||||
@ -188,7 +188,6 @@
|
|||||||
%
|
%
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%% @pred db_open(+Interface,-Handle,+HostDb,+User,+Password)
|
%% @pred db_open(+Interface,-Handle,+HostDb,+User,+Password)
|
||||||
%% @pred db_open(+Interface,+HostDb,+User,+Password)
|
%% @pred db_open(+Interface,+HostDb,+User,+Password)
|
||||||
%
|
%
|
||||||
@ -369,7 +368,7 @@ db_sql_(ConType, Con, SQL,LA):-
|
|||||||
c_postgres_query(SQL,ResultSet,Con,Mode,Arity)
|
c_postgres_query(SQL,ResultSet,Con,Mode,Arity)
|
||||||
;ConType == sqlite3 ->
|
;ConType == sqlite3 ->
|
||||||
sqlite3_result_set(Mode),
|
sqlite3_result_set(Mode),
|
||||||
c_sqlite3_query(SQL,ResultSet,Con,Mode,Arity)
|
myddas_myddas_sqlite3:c_sqlite3_query(SQL,ResultSet,Con,Mode,Arity)
|
||||||
;
|
;
|
||||||
c_odbc_query(SQL,ResultSet,Arity,LA,Con),
|
c_odbc_query(SQL,ResultSet,Arity,LA,Con),
|
||||||
c_odbc_number_of_fields_in_query(SQL,Con,Arity)
|
c_odbc_number_of_fields_in_query(SQL,Con,Arity)
|
||||||
@ -459,7 +458,7 @@ db_assert(Connection,PredName):-
|
|||||||
c_postgres_query(SQL,_,Con,Mode,_)
|
c_postgres_query(SQL,_,Con,Mode,_)
|
||||||
;ConType == sqlite3 ->
|
;ConType == sqlite3 ->
|
||||||
sqlite3_result_set(Mode),
|
sqlite3_result_set(Mode),
|
||||||
c_sqlite3_query(SQL,_,Con,Mode,_)
|
myddas_myddas_sqlite3:c_sqlite3_query(SQL,_,Con,Mode,_)
|
||||||
;
|
;
|
||||||
c_odbc_query(SQL,_,_,_,Con)
|
c_odbc_query(SQL,_,_,_,Con)
|
||||||
).
|
).
|
||||||
@ -488,7 +487,7 @@ db_create_table(Connection,TableName,FieldsInf):-
|
|||||||
c_postsgres_query(FinalSQL,_,Con,Mode,_)
|
c_postsgres_query(FinalSQL,_,Con,Mode,_)
|
||||||
;ConType == sqlite3 ->
|
;ConType == sqlite3 ->
|
||||||
sqlite3_result_set(Mode),
|
sqlite3_result_set(Mode),
|
||||||
c_sqlite3_query(FinalSQL,_,Con,Mode,_)
|
myddas_myddas_sqlite3:c_sqlite3_query(FinalSQL,_,Con,Mode,_)
|
||||||
;
|
;
|
||||||
c_odbc_query(FinalSQL,_,_,_,Con)
|
c_odbc_query(FinalSQL,_,_,_,Con)
|
||||||
).
|
).
|
||||||
@ -565,7 +564,7 @@ db_update(Connection,WherePred-SetPred):-
|
|||||||
;
|
;
|
||||||
ConType == sqlite3 ->
|
ConType == sqlite3 ->
|
||||||
sqlite3_result_set(Mode),
|
sqlite3_result_set(Mode),
|
||||||
c_sqlite3_query(SQL,_,Conn,Mode,_)
|
myddas_sqlite3:c_sqlite3_query(SQL,_,Conn,Mode,_)
|
||||||
;
|
;
|
||||||
ConType == odbc ->
|
ConType == odbc ->
|
||||||
odbc_result_set(Mode),
|
odbc_result_set(Mode),
|
||||||
|
@ -19,27 +19,28 @@
|
|||||||
#define DBMS(x) sqlite3_##x
|
#define DBMS(x) sqlite3_##x
|
||||||
#define c_DBMS(x) c_sqlite3_##x
|
#define c_DBMS(x) c_sqlite3_##x
|
||||||
#define NAME() 'libYapsqlite3'
|
#define NAME() 'libYapsqlite3'
|
||||||
#define MODULE() myddas_sqlite3
|
#define MODULE() user
|
||||||
#define INIT() init_sqlite3
|
#define INIT() init_sqlite3
|
||||||
#elif defined( odbc )
|
#elif defined( odbc )
|
||||||
#undef odbc
|
#undef odbc
|
||||||
#define DBMS(x) odbc_##x
|
#define DBMS(x) odbc_##x
|
||||||
#define c_DBMS(x) c_odbc_##x
|
#define c_DBMS(x) c_odbc_##x
|
||||||
#define NAME() 'libYapodbc'
|
#define NAME() 'libYapodbc'
|
||||||
#define MODULE() myddas_odbc
|
#define MODULE() user
|
||||||
#define INIT() init_odbc
|
#define INIT() init_odbc
|
||||||
#elif defined( postgres )
|
#elif defined( postgres )
|
||||||
#undef postgres
|
#undef postgres
|
||||||
#define DBMS(x) postgres_##x
|
#define DBMS(x) postgres_##x
|
||||||
#define c_DBMS(x) c_postgres_##x
|
#define c_DBMS(x) c_postgres_##x
|
||||||
#define NAME() 'libYappostgres'
|
#define NAME() 'libYappostgres'
|
||||||
#define MODULE() myddas_postgres
|
#define MODULE() user
|
||||||
#define INIT() init_odbc
|
#define INIT() init_odbc
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(DBMS)
|
#if defined(DBMS)
|
||||||
|
|
||||||
:- module(MODULE(),[
|
:- module(MODULE(),[
|
||||||
|
/*
|
||||||
c_DBMS(change_database)/2,
|
c_DBMS(change_database)/2,
|
||||||
c_DBMS(connect)/4,
|
c_DBMS(connect)/4,
|
||||||
c_DBMS(disconnect)/1,
|
c_DBMS(disconnect)/1,
|
||||||
@ -49,6 +50,7 @@
|
|||||||
c_DBMS(get_next_result_set)/3,
|
c_DBMS(get_next_result_set)/3,
|
||||||
c_DBMS(query)/5,
|
c_DBMS(query)/5,
|
||||||
c_DBMS(number_of_fields)/3,
|
c_DBMS(number_of_fields)/3,
|
||||||
|
*/
|
||||||
DBMS(describe)/3,
|
DBMS(describe)/3,
|
||||||
DBMS(show_tables)/2,
|
DBMS(show_tables)/2,
|
||||||
DBMS(row)/3
|
DBMS(row)/3
|
||||||
@ -69,7 +71,7 @@
|
|||||||
'$make_a_list'/2,
|
'$make_a_list'/2,
|
||||||
'$write_or_not'/1
|
'$write_or_not'/1
|
||||||
]).
|
]).
|
||||||
:- load_foreign_files( [NAME()], [], INIT()).
|
% :- load_foreign_files( [NAME()], [], INIT()).
|
||||||
|
|
||||||
%--------------------------------------------------------
|
%--------------------------------------------------------
|
||||||
% Public Predicates
|
% Public Predicates
|
||||||
|
@ -2,7 +2,7 @@ message( " * Sqlite3 Data-Base (http://www.sqlite3ql.org), distributed with MY
|
|||||||
|
|
||||||
set (SQLITE_EXTRA
|
set (SQLITE_EXTRA
|
||||||
chinook.db
|
chinook.db
|
||||||
test.yap)
|
sqlitest.yap)
|
||||||
|
|
||||||
set( YAPSQLITE3_SOURCES
|
set( YAPSQLITE3_SOURCES
|
||||||
myddas_sqlite3.c
|
myddas_sqlite3.c
|
||||||
@ -61,5 +61,3 @@ endif()
|
|||||||
install(FILES ${SQLITE_EXTRA}
|
install(FILES ${SQLITE_EXTRA}
|
||||||
DESTINATION ${libpl}
|
DESTINATION ${libpl}
|
||||||
)
|
)
|
||||||
|
|
||||||
# file (INSTALL chinook.db test.yap DESTINATION ${libpl})
|
|
||||||
|
@ -672,14 +672,13 @@ static void Yap_InitBackMYDDAS_SQLITE3Preds(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
X_API void init_sqlite3(void) {
|
X_API void init_sqlite3(void) {
|
||||||
Term cm = CurrentModule;
|
Term cm = CurrentModule;
|
||||||
CurrentModule = MkAtomTerm(Yap_LookupAtom("myddas_sqlite3"));
|
CurrentModule = MkAtomTerm(Yap_LookupAtom("myddas_sqlite3"));
|
||||||
|
|
||||||
Yap_InitMYDDAS_SQLITE3Preds();
|
Yap_InitMYDDAS_SQLITE3Preds();
|
||||||
|
|
||||||
Yap_InitBackMYDDAS_SQLITE3Preds();
|
Yap_InitBackMYDDAS_SQLITE3Preds();
|
||||||
|
CurrentModule = cm;
|
||||||
CurrentModule = cm;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
92
packages/myddas/sqlite3/sqlitest.yap
Normal file
92
packages/myddas/sqlite3/sqlitest.yap
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
:- stop_low_level_trace.
|
||||||
|
:- use_module(library(maplist)).
|
||||||
|
:- use_module(library(myddas)).
|
||||||
|
|
||||||
|
main :-
|
||||||
|
init,
|
||||||
|
main_,
|
||||||
|
close.
|
||||||
|
main_ :-
|
||||||
|
go,
|
||||||
|
fail.
|
||||||
|
main_ .
|
||||||
|
|
||||||
|
init :-
|
||||||
|
db_open(sqlite3, '/data/user/0/pt.up.yap.yapdroid/files/Yap/chinook.db', _, _),
|
||||||
|
writeln('chinook has landed').
|
||||||
|
|
||||||
|
go :-
|
||||||
|
writeln(('db_import')),
|
||||||
|
db_import('artists', artists),
|
||||||
|
writeln(('artist -> artists')),
|
||||||
|
db_import('albums', albums),
|
||||||
|
writeln(('albums -> albums')),
|
||||||
|
db_import('tracks', tracks),
|
||||||
|
writeln(('tracks -> tracks')).
|
||||||
|
|
||||||
|
go :-
|
||||||
|
start_low_level_trace,
|
||||||
|
writeln(db_get_attributes_types),
|
||||||
|
db_get_attributes_types(albums,Als),
|
||||||
|
format('~w -> ~w~n',[albums,Als]),
|
||||||
|
db_get_attributes_types(tracks,Ts),
|
||||||
|
format('~w -> ~w~n',[tracks,Ts]),
|
||||||
|
db_get_attributes_types(artists,As),
|
||||||
|
format('~w -> ~w~n',[artists,As]).
|
||||||
|
go :-
|
||||||
|
writeln(db_number_of_fields),
|
||||||
|
db_number_of_fields(albums,Als),
|
||||||
|
db_number_of_fields(tracks,Ts),
|
||||||
|
db_number_of_fields(artists,As),
|
||||||
|
writeln(As:Als:Ts).
|
||||||
|
|
||||||
|
go :-
|
||||||
|
db_describe(albums, Desc), writeln(albums:Desc).
|
||||||
|
go :-
|
||||||
|
db_describe(tracks, Desc), writeln(tracks:Desc).
|
||||||
|
go :-
|
||||||
|
db_describe(artists, Desc), writeln(artists:Desc).
|
||||||
|
go :-
|
||||||
|
db_show_tables(Desc), writeln(tables:Desc).
|
||||||
|
go :-
|
||||||
|
db_show_tables(table(T)),
|
||||||
|
db_describe(T,tableinfo(FieldID,Type,Null,Primary,Default,'')),
|
||||||
|
writeln(T:tableinfo(FieldID,Type,Null,Primary,Default,'')).
|
||||||
|
|
||||||
|
go :-
|
||||||
|
go_cut0.
|
||||||
|
|
||||||
|
|
||||||
|
go :-
|
||||||
|
%stop_low_level_trace,
|
||||||
|
findall(X:Y,artists(X,Y),Ls),
|
||||||
|
length(Ls,Total),
|
||||||
|
sort(Ls, LLs),
|
||||||
|
length(LLs, T),
|
||||||
|
writeln(T:Total).
|
||||||
|
|
||||||
|
go :-
|
||||||
|
go_cut1.
|
||||||
|
|
||||||
|
go :-
|
||||||
|
X=1,
|
||||||
|
artists(X,Y),
|
||||||
|
writeln(X:Y).
|
||||||
|
|
||||||
|
go_cut0 :-
|
||||||
|
% start_low_level_trace,
|
||||||
|
artists(X,Y),
|
||||||
|
writeln(X:Y),
|
||||||
|
!.
|
||||||
|
|
||||||
|
|
||||||
|
go_cut1 :-
|
||||||
|
X=1,
|
||||||
|
artists(X,Y),
|
||||||
|
writeln(X:Y),
|
||||||
|
!.
|
||||||
|
|
||||||
|
close :-
|
||||||
|
db_close.
|
||||||
|
|
||||||
|
:- main.
|
@ -1,85 +0,0 @@
|
|||||||
|
|
||||||
:- compile(library(maplist)).
|
|
||||||
:- use_module(library(myddas)).
|
|
||||||
|
|
||||||
main :-
|
|
||||||
init,
|
|
||||||
main_,
|
|
||||||
close.
|
|
||||||
main_ :-
|
|
||||||
go,
|
|
||||||
fail.
|
|
||||||
main_ .
|
|
||||||
|
|
||||||
%init :-
|
|
||||||
db_open(sqlite3, '/data/user/0/pt.up.yap.yapdroid/files/Yap/chinook.db', _, _),
|
|
||||||
writeln('chinook has landed'),
|
|
||||||
db_import('Artist', artist),
|
|
||||||
writeln('Artist -> artist'),
|
|
||||||
db_import('Album', album),
|
|
||||||
writeln('Album -> album'),
|
|
||||||
db_import('Track', track).
|
|
||||||
writeln('Track -> track').
|
|
||||||
|
|
||||||
go :-
|
|
||||||
db_get_attributes_types(album,Als),
|
|
||||||
format('~w -> ~w~n'.[album,Als]),
|
|
||||||
db_get_attributes_types(track,Ts),
|
|
||||||
format('~w -> ~w~n'.[track,Ts]),
|
|
||||||
db_get_attributes_types(artist,As),
|
|
||||||
format('~w -> ~w~n'.[artist,As]).
|
|
||||||
go :-
|
|
||||||
db_number_of_fields(album,Als),
|
|
||||||
db_number_of_fields(track,Ts),
|
|
||||||
db_number_of_fields(artist,As),
|
|
||||||
writeln(As:Als:Ts).
|
|
||||||
|
|
||||||
go :-
|
|
||||||
db_describe(album, Desc), writeln(album:Desc) ;
|
|
||||||
db_describe(track, Desc), writeln(track:Desc) ;
|
|
||||||
db_describe(artist, Desc), writeln(artist:Desc).
|
|
||||||
go :-
|
|
||||||
db_show_tables(Desc), writeln(tables:Desc).
|
|
||||||
go :-
|
|
||||||
db_show_tables(table(T)),
|
|
||||||
db_describe(T,tableinfo(FieldID,Type,Null,Primary,Default,'')),
|
|
||||||
writeln(T:tableinfo(FieldID,Type,Null,Primary,Default,'')).
|
|
||||||
|
|
||||||
go :-
|
|
||||||
go_cut0.
|
|
||||||
|
|
||||||
|
|
||||||
go :-
|
|
||||||
%stop_low_level_trace,
|
|
||||||
findall(X:Y,artist(X,Y),Ls),
|
|
||||||
length(Ls,Total),
|
|
||||||
sort(Ls, LLs),
|
|
||||||
length(LLs, T),
|
|
||||||
writeln(T:Total).
|
|
||||||
|
|
||||||
go :-
|
|
||||||
go_cut1.
|
|
||||||
|
|
||||||
go :-
|
|
||||||
X=1,
|
|
||||||
artist(X,Y),
|
|
||||||
writeln(X:Y).
|
|
||||||
|
|
||||||
go_cut0 :-
|
|
||||||
% start_low_level_trace,
|
|
||||||
artist(X,Y),
|
|
||||||
writeln(X:Y),
|
|
||||||
!.
|
|
||||||
|
|
||||||
|
|
||||||
go_cut1 :-
|
|
||||||
X=1,
|
|
||||||
artist(X,Y),
|
|
||||||
writeln(X:Y),
|
|
||||||
!.
|
|
||||||
|
|
||||||
close :-
|
|
||||||
db_close.
|
|
||||||
|
|
||||||
:- main.
|
|
||||||
|
|
@ -59,10 +59,9 @@ and_close(int sno) {
|
|||||||
static int
|
static int
|
||||||
and_put(int sno, int ch) {
|
and_put(int sno, int ch) {
|
||||||
buff0 += ch;
|
buff0 += ch;
|
||||||
if (ch=='\n' || buff0.length() == 128) { //buff0+= '\0';
|
|
||||||
streamerInstance->display(buff0);
|
streamerInstance->display(buff0);
|
||||||
buff0.clear();
|
buff0.clear();
|
||||||
}
|
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,7 +323,6 @@ version(yap,[6,4]).
|
|||||||
:- dynamic 'extensions_to_present_answer'/1.
|
:- dynamic 'extensions_to_present_answer'/1.
|
||||||
|
|
||||||
:- ['arrays.yap'].
|
:- ['arrays.yap'].
|
||||||
%:- start_low_level_trace.
|
|
||||||
|
|
||||||
:- multifile user:portray_message/2.
|
:- multifile user:portray_message/2.
|
||||||
|
|
||||||
@ -482,5 +481,4 @@ If this hook preodicate succeeds it must instantiate the _Action_ argument to t
|
|||||||
:- ensure_loaded('../pl/pathconf.yap').
|
:- ensure_loaded('../pl/pathconf.yap').
|
||||||
|
|
||||||
:- yap_flag(user:unknown,error).
|
:- yap_flag(user:unknown,error).
|
||||||
|
|
||||||
%% @}
|
%% @}
|
||||||
|
@ -740,6 +740,7 @@ db_files(Fs) :-
|
|||||||
true
|
true
|
||||||
),
|
),
|
||||||
'$loop'(Stream,Reconsult),
|
'$loop'(Stream,Reconsult),
|
||||||
|
|
||||||
'$lf_opt'(imports, TOpts, Imports),
|
'$lf_opt'(imports, TOpts, Imports),
|
||||||
'$import_to_current_module'(File, ContextModule, Imports, _, TOpts),
|
'$import_to_current_module'(File, ContextModule, Imports, _, TOpts),
|
||||||
'$current_module'(Mod, SourceModule),
|
'$current_module'(Mod, SourceModule),
|
||||||
|
@ -26,11 +26,10 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
:- module(system('$messages',[]),
|
||||||
:- module(system('$messages'),
|
|
||||||
[system_message/4,
|
[system_message/4,
|
||||||
prefix/6,
|
prefix/2,
|
||||||
prefix/5,
|
%prefix/5,
|
||||||
file_location/3]).
|
file_location/3]).
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -221,7 +220,7 @@ compose_message( loaded(included,AbsFileName,Mod,Time,Space), _Level) --> !,
|
|||||||
[ '~a included in module ~a, ~d msec ~d bytes' -
|
[ '~a included in module ~a, ~d msec ~d bytes' -
|
||||||
[AbsFileName,Mod,Time,Space] ].
|
[AbsFileName,Mod,Time,Space] ].
|
||||||
compose_message( loaded(What,AbsoluteFileName,Mod,Time,Space), _Level) --> !,
|
compose_message( loaded(What,AbsoluteFileName,Mod,Time,Space), _Level) --> !,
|
||||||
[ '~a ~a in module ~a, ~d msec ~d bytes' -
|
[ '~a ~a in module ~a, ~d msec ~g bytes' -
|
||||||
[What, AbsoluteFileName,Mod,Time,Space] ].
|
[What, AbsoluteFileName,Mod,Time,Space] ].
|
||||||
compose_message(signal(SIG,_), _) -->
|
compose_message(signal(SIG,_), _) -->
|
||||||
!,
|
!,
|
||||||
@ -252,9 +251,9 @@ compose_message(Throw, _Leve) -->
|
|||||||
location(error(syntax_error(_),info(between(_,LN,_), FileName, _ChrPos, _Err)), _ , _) -->
|
location(error(syntax_error(_),info(between(_,LN,_), FileName, _ChrPos, _Err)), _ , _) -->
|
||||||
!,
|
!,
|
||||||
[ '~a:~d:~d ' - [FileName,LN,0] ] .
|
[ '~a:~d:~d ' - [FileName,LN,0] ] .
|
||||||
location(style_check(_,LN,FileName,_ ), Level , LC) -->
|
location(style_check(A,LN,FileName,B ), Level , LC) -->
|
||||||
!,
|
!,
|
||||||
display_consulting( FileName, Level, LC ),
|
display_consulting( FileName, Level,style_check(A,LN,FileName,B ), LC ),
|
||||||
[ '~a:~d:0 ~a ' - [FileName,LN,Level] ] .
|
[ '~a:~d:0 ~a ' - [FileName,LN,Level] ] .
|
||||||
location( error(_,Info), Level, LC ) -->
|
location( error(_,Info), Level, LC ) -->
|
||||||
{ '$error_descriptor'(Info, Desc) },
|
{ '$error_descriptor'(Info, Desc) },
|
||||||
@ -266,7 +265,7 @@ location( error(_,Info), Level, LC ) -->
|
|||||||
'$query_exception'(prologPredArity, Desc, Ar)
|
'$query_exception'(prologPredArity, Desc, Ar)
|
||||||
},
|
},
|
||||||
!,
|
!,
|
||||||
display_consulting( File, Level, LC ),
|
display_consulting( File, Level, Info, LC ),
|
||||||
[ '~s:~d:0 ~a in ~s:~s/~d:'-[File, FilePos,Level,M,Na,Ar] ].
|
[ '~s:~d:0 ~a in ~s:~s/~d:'-[File, FilePos,Level,M,Na,Ar] ].
|
||||||
location( error(_,Info), Level, LC ) -->
|
location( error(_,Info), Level, LC ) -->
|
||||||
{ '$error_descriptor'(Info, Desc) },
|
{ '$error_descriptor'(Info, Desc) },
|
||||||
@ -827,6 +826,15 @@ prefix(help, '~N'-[]).
|
|||||||
prefix(query, '~N'-[]).
|
prefix(query, '~N'-[]).
|
||||||
prefix(debug, '~N'-[]).
|
prefix(debug, '~N'-[]).
|
||||||
prefix(warning, '~N'-[]).
|
prefix(warning, '~N'-[]).
|
||||||
|
prefix(error, '~N'-[]).
|
||||||
|
prefix(banner, '~N'-[]).
|
||||||
|
prefix(informational, '~N~*|% '-[LC]) :-
|
||||||
|
'$show_consult_level'(LC),
|
||||||
|
LC > 0,
|
||||||
|
!.
|
||||||
|
prefix(informational, '~N'-[]).
|
||||||
|
prefix(debug(_), '~N'-[]).
|
||||||
|
|
||||||
/* { thread_self(Id) },
|
/* { thread_self(Id) },
|
||||||
( { Id == main }
|
( { Id == main }
|
||||||
-> [ 'warning, ' - [] ]
|
-> [ 'warning, ' - [] ]
|
||||||
@ -835,7 +843,7 @@ prefix(warning, '~N'-[]).
|
|||||||
; ['warning [Thread ~d ], ' - [Id] ]
|
; ['warning [Thread ~d ], ' - [Id] ]
|
||||||
).
|
).
|
||||||
*/
|
*/
|
||||||
prefix(error, '~N'-[]).
|
|
||||||
/*
|
/*
|
||||||
{ thread_self(Id) },
|
{ thread_self(Id) },
|
||||||
( { Id == main }
|
( { Id == main }
|
||||||
@ -853,11 +861,7 @@ prefix(error, '', user_error) -->
|
|||||||
; [ 'error [ Thread ~d ] ' - [Id], nl ]
|
; [ 'error [ Thread ~d ] ' - [Id], nl ]
|
||||||
).
|
).
|
||||||
*/
|
*/
|
||||||
prefix(banner, '~N'-[]).
|
|
||||||
prefix(informational, '~N~*|% '-[LC]) :-
|
|
||||||
'$show_consult_level'(LC).
|
|
||||||
prefix(debug(_), '~N% '-[]).
|
|
||||||
prefix(information, '~N% '-[]).
|
|
||||||
|
|
||||||
|
|
||||||
clause_to_indicator(T, MNameArity) :-
|
clause_to_indicator(T, MNameArity) :-
|
||||||
@ -1015,15 +1019,15 @@ prolog:print_message(force(_Severity), Msg) :- !,
|
|||||||
print(user_error,Msg).
|
print(user_error,Msg).
|
||||||
% This predicate has more hooks than a pirate ship!
|
% This predicate has more hooks than a pirate ship!
|
||||||
prolog:print_message(Severity, Term) :-
|
prolog:print_message(Severity, Term) :-
|
||||||
prolog:message( Term,Lines0, [ end(Id)]),
|
message( Term,Lines0, [ end(Id)]),
|
||||||
Lines = [begin(Severity, Id)| Lines0],
|
Lines = [begin(Severity, Id)| Lines0],
|
||||||
(
|
(
|
||||||
user:message_hook(Term, Severity, Lines)
|
user:message_hook(Term, Severity, Lines)
|
||||||
->
|
->
|
||||||
true
|
true
|
||||||
;
|
;
|
||||||
prefix( Severity, Prefix ),
|
ignore((prefix( Severity, Prefix ),
|
||||||
prolog:print_message_lines(user_error, Prefix, Lines)
|
prolog:print_message_lines(user_error, Prefix, Lines)))
|
||||||
),
|
),
|
||||||
!.
|
!.
|
||||||
prolog:print_message(Severity, Term) :-
|
prolog:print_message(Severity, Term) :-
|
||||||
@ -1034,12 +1038,16 @@ prolog:print_message(Severity, Term) :-
|
|||||||
->
|
->
|
||||||
true
|
true
|
||||||
;
|
;
|
||||||
prefix( Severity, Prefix ),
|
ignore(( prefix( Severity, Prefix ),
|
||||||
prolog:print_message_lines(user_error, Prefix, Lines)
|
prolog:print_message_lines(user_error, Prefix, Lines)))
|
||||||
),
|
),
|
||||||
!.
|
!.
|
||||||
|
prolog:print_message(_Severity, _Term) :-
|
||||||
|
format(user_error,'failed to print ~w: ~w~n' ,[ _Severity, _Term]).
|
||||||
|
|
||||||
'$error_descriptor'( Info, Info ).
|
'$error_descriptor'( Info, Info ).
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@}
|
@}
|
||||||
*/
|
*/
|
||||||
|
@ -309,6 +309,13 @@ meta_predicate(P) :-
|
|||||||
'$expand_goals'(\+A,\+A1,(AO-> false;true),HM,SM,BM,HVars) :- !,
|
'$expand_goals'(\+A,\+A1,(AO-> false;true),HM,SM,BM,HVars) :- !,
|
||||||
'$expand_goals'(A,A1,AOO,HM,SM,BM,HVars),
|
'$expand_goals'(A,A1,AOO,HM,SM,BM,HVars),
|
||||||
'$clean_cuts'(AOO, AO).
|
'$clean_cuts'(AOO, AO).
|
||||||
|
'$expand_goals'(not(G),not(G),A\=B,_HM,_BM,_SM,_HVars) :-
|
||||||
|
nonvar(G),
|
||||||
|
G = (A = B),
|
||||||
|
!.
|
||||||
|
'$expand_goals'(not(A),not(A1),(AO-> false;true),HM,SM,BM,HVars) :- !,
|
||||||
|
'$expand_goals'(A,A1,AOO,HM,SM,BM,HVars),
|
||||||
|
'$clean_cuts'(AOO, AO).
|
||||||
'$expand_goals'(once(A),once(A1),
|
'$expand_goals'(once(A),once(A1),
|
||||||
('$current_choice_point'(CP),AO,'$$cut_by'(CP)),HM,SM,BM,HVars) :- !,
|
('$current_choice_point'(CP),AO,'$$cut_by'(CP)),HM,SM,BM,HVars) :- !,
|
||||||
'$expand_goals'(A,A1,AO0,HM,SM,BM,HVars),
|
'$expand_goals'(A,A1,AO0,HM,SM,BM,HVars),
|
||||||
|
Reference in New Issue
Block a user