Merge ../YAPDroid/yap

This commit is contained in:
Vitor Santos Costa 2018-06-26 10:21:06 +01:00
commit f6c8e204c7
19 changed files with 249 additions and 232 deletions

View File

@ -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");

View File

@ -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;
@ -1061,14 +1063,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);

View File

@ -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 &&

View File

@ -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;

View File

@ -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 = MkStringTerm(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;
} }

View File

@ -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);

View File

@ -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();

View File

@ -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,57 +98,54 @@ 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),
@ -160,53 +159,53 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
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
//! @} //! @}

View File

@ -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;
} }

View File

@ -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')) {
@ -1167,8 +1169,7 @@ bool Yap_initStream(int sno, FILE *fd, const char *name, const char *io_mode,
st->user_name = file_name; st->user_name = file_name;
st->file = fd; st->file = fd;
st->linepos = 0; st->linepos = 0;
Yap_DefaultStreamOps(st); return true;
return true;
} }
static bool open_header(int sno, Atom open_mode) { static bool open_header(int sno, Atom open_mode) {
@ -1315,8 +1316,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 +1468,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) {
@ -1865,17 +1863,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 +2051,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;

View File

@ -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;
} }

View File

@ -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();

View File

@ -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;
} }

View File

@ -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.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%

View File

@ -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.

View File

@ -673,13 +673,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;
} }

View File

@ -13,7 +13,7 @@ main_ .
init :- init :-
start_low_level_trace, %start_low_level_trace,
db_open(sqlite3, '/data/user/0/pt.up.yap.yapdroid/files/Yap/chinook.db', _, _), db_open(sqlite3, '/data/user/0/pt.up.yap.yapdroid/files/Yap/chinook.db', _, _),
writeln('chinook has landed'). writeln('chinook has landed').

View File

@ -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;
} }

View File

@ -29,7 +29,7 @@
:- 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]).
@ -827,6 +827,12 @@ 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~*| '-[]) :-
('$show_consult_level'(LC) -> true ; LC = 0).
prefix(debug(_), '~N'-[]).
/* { thread_self(Id) }, /* { thread_self(Id) },
( { Id == main } ( { Id == main }
-> [ 'warning, ' - [] ] -> [ 'warning, ' - [] ]
@ -835,7 +841,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 +859,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) :-