Merge ../YAPDroid/yap
This commit is contained in:
commit
f6c8e204c7
19
C/alloc.c
19
C/alloc.c
@ -76,12 +76,13 @@ void *my_malloc(size_t sz) {
|
||||
|
||||
p = malloc(sz);
|
||||
// Yap_DebugPuts(stderr,"gof\n");
|
||||
if (Yap_do_low_level_trace)
|
||||
if (Yap_do_low_level_trace) {
|
||||
#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
|
||||
fprintf(stderr, "+s %p\n @%p %ld\n", p, TR, LCL0 - (CELL *)LCL0);
|
||||
#endif
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
@ -89,12 +90,12 @@ void *my_realloc(void *ptr, size_t sz) {
|
||||
void *p;
|
||||
|
||||
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);
|
||||
// Yap_DebugPuts(stderr,"gof\n");
|
||||
if (sz > 500 && write_malloc++ > 0)
|
||||
__android_log_print(ANDROID_LOG_ERROR, "YAPDroid ", "* %d %p",
|
||||
write_malloc, p);
|
||||
// if (sz > 500 && write_malloc++ > 0)
|
||||
// __android_log_print(ANDROID_LOG_ERROR, "YAPDroid ", "* %d %p",
|
||||
// write_malloc, p);
|
||||
return p;
|
||||
}
|
||||
|
||||
@ -102,9 +103,9 @@ void my_free(void *p) {
|
||||
// printf("f %p\n",p);
|
||||
if (Yap_do_low_level_trace)
|
||||
fprintf(stderr, "- %p\n @%p %ld\n", p, TR, (long int)(LCL0 - (CELL *)B) );
|
||||
if (write_malloc && write_malloc++ > 0)
|
||||
__android_log_print(ANDROID_LOG_ERROR, "YAPDroid ", "- %d %p", write_malloc,
|
||||
p);
|
||||
//if (write_malloc && write_malloc++ > 0)
|
||||
// __android_log_print(ANDROID_LOG_ERROR, "YAPDroid ", "- %d %p", write_malloc,
|
||||
// p);
|
||||
|
||||
free(p);
|
||||
// Yap_DebugPuts(stderr,"gof\n");
|
||||
|
12
C/errors.c
12
C/errors.c
@ -321,6 +321,8 @@ bool Yap_PrintWarning(Term twarning) {
|
||||
CACHE_REGS
|
||||
PredEntry *pred = RepPredProp(PredPropByFunc(
|
||||
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);
|
||||
bool rc;
|
||||
Term ts[2], err;
|
||||
@ -334,7 +336,6 @@ bool Yap_PrintWarning(Term twarning) {
|
||||
return false;
|
||||
}
|
||||
LOCAL_PrologMode |= InErrorMode;
|
||||
LOCAL_DoingUndefp = true;
|
||||
if (pred->OpcodeOfPred == UNDEF_OPCODE || pred->OpcodeOfPred == FAIL_OPCODE) {
|
||||
fprintf(stderr, "warning message:\n");
|
||||
Yap_DebugPlWrite(twarning);
|
||||
@ -854,6 +855,7 @@ yamop *Yap_Error__(bool throw, const char *file, const char *function,
|
||||
if (LOCAL_delay)
|
||||
return P;
|
||||
if (LOCAL_DoingUndefp) {
|
||||
LOCAL_DoingUndefp = false;
|
||||
LOCAL_Signals = 0;
|
||||
Yap_PrintWarning(MkErrorTerm(Yap_GetException(LOCAL_ActiveError)));
|
||||
return P;
|
||||
@ -1069,6 +1071,14 @@ yap_error_descriptor_t *Yap_UserError(Term t, yap_error_descriptor_t *i) {
|
||||
Yap_errorClassName(Yap_errorClass(THROW_EVENT));
|
||||
LOCAL_ActiveError->errorRawTerm = Yap_SaveTerm(t);
|
||||
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 {
|
||||
Term t1, t2;
|
||||
t1 = ArgOfTerm(1, t);
|
||||
|
8
C/exec.c
8
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 */
|
||||
// LOCAL_ActiveError = err_info;
|
||||
LOCAL_PrologMode = UserMode;
|
||||
LOCAL_DoingUndefp = false;
|
||||
/* find out where to cut to */
|
||||
/* siglongjmp resets the TR hardware register */
|
||||
/* 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));
|
||||
P = (yamop *)FAILCODE;
|
||||
LOCAL_PrologMode = UserMode;
|
||||
LOCAL_DoingUndefp = false;
|
||||
Yap_CloseSlots(sls);
|
||||
} break;
|
||||
case 3: { /* saved state */
|
||||
@ -1472,6 +1474,7 @@ static bool exec_absmi(bool top, yap_reset_t reset_mode USES_REGS) {
|
||||
LOCAL_CBorder = OldBorder;
|
||||
LOCAL_RestartEnv = sighold;
|
||||
LOCAL_PrologMode = UserMode;
|
||||
LOCAL_DoingUndefp = false;
|
||||
Yap_CloseSlots(sls);
|
||||
return false;
|
||||
}
|
||||
@ -1487,6 +1490,7 @@ static bool exec_absmi(bool top, yap_reset_t reset_mode USES_REGS) {
|
||||
Yap_JumpToEnv();
|
||||
}
|
||||
LOCAL_PrologMode = UserMode;
|
||||
LOCAL_DoingUndefp = false;
|
||||
P = (yamop *)FAILCODE;
|
||||
LOCAL_RestartEnv = sighold;
|
||||
Yap_CloseSlots(sls);
|
||||
@ -2092,6 +2096,7 @@ static Int JumpToEnv(USES_REGS1) {
|
||||
|
||||
B = handler;
|
||||
P = FAILCODE;
|
||||
LOCAL_DoingUndefp = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2110,6 +2115,9 @@ static Int jump_env(USES_REGS1) {
|
||||
"throw/1 must be called instantiated");
|
||||
}
|
||||
// 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);
|
||||
bool out = JumpToEnv(PASS_REGS1);
|
||||
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));
|
||||
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,
|
||||
"~s should be either true (on) or false (off)", s);
|
||||
return false;
|
||||
|
4
C/text.c
4
C/text.c
@ -437,10 +437,10 @@ unsigned char *Yap_readText(seq_tv_t *inp USES_REGS) {
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -604,14 +604,12 @@ InitReverseLookupOpcode(void)
|
||||
int hash_size_mask = OP_HASH_SIZE-1;
|
||||
UInt sz = OP_HASH_SIZE*sizeof(struct opcode_tab_entry);
|
||||
|
||||
while (OP_RTABLE == NULL) {
|
||||
if ((OP_RTABLE = (op_entry *)Yap_AllocCodeSpace(sz)) == NULL) {
|
||||
if (!Yap_growheap(FALSE, sz, NULL)) {
|
||||
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil,
|
||||
"Couldn't obtain space for the reverse translation opcode table");
|
||||
}
|
||||
}
|
||||
}
|
||||
memset(OP_RTABLE, 0, sz);
|
||||
opeptr = OP_RTABLE;
|
||||
/* clear up table */
|
||||
|
15
CXX/yapi.cpp
15
CXX/yapi.cpp
@ -47,6 +47,17 @@ static void YAPCatchError()
|
||||
YAP_RunGoalOnce(Yap_MkApplTerm(f, 2, es));
|
||||
// Yap_PopTermFromDB(info->errorTerm);
|
||||
// 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(), );
|
||||
}
|
||||
}
|
||||
|
||||
@ -549,7 +560,7 @@ bool YAPEngine::mgoal(Term t, Term tmod, bool release) {
|
||||
bool result;
|
||||
// allow Prolog style exception handling
|
||||
// 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);
|
||||
YAP_LeaveGoal(result && !release, &q);
|
||||
@ -611,7 +622,7 @@ Term YAPEngine::fun(Term t) {
|
||||
q.cp = CP;
|
||||
// make sure this is safe
|
||||
// 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);
|
||||
YAPCatchError();
|
||||
|
218
H/YapGFlagInfo.h
218
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),
|
||||
|
||||
/**< how to present answers, default is `~p`. */
|
||||
#if __ANDROID__
|
||||
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 */
|
||||
#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), /**<
|
||||
`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.
|
||||
*/
|
||||
|
||||
YAP_FLAG(ARGV_FLAG, "argv", false, argv, "@boot", NULL),
|
||||
YAP_FLAG(ARITHMETIC_EXCEPTIONS_FLAG, "arithmetic_exceptions", true,
|
||||
booleanFlag, "true", NULL),
|
||||
/**< `arithmetic_exceptions`
|
||||
|
||||
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
|
||||
ProbLog.
|
||||
*/
|
||||
YAP_FLAG(ARITHMETIC_EXCEPTIONS_FLAG, "arithmetic_exceptions", true,
|
||||
booleanFlag, "true", NULL),
|
||||
YAP_FLAG(BACK_QUOTES_FLAG, "back_quotes", true, isatom, "true", NULL),
|
||||
/**>
|
||||
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,
|
||||
`codes`, or to a single atom, `atom`. If _Value_ is bound, set to
|
||||
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
|
||||
|
||||
Read-only flag telling whether integers are bounded. The value depends
|
||||
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_CFLAGS_FLAG, "c_cflags", false, isatom, C_CFLAGS, 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_LIBS_FLAG, "c_libs", false, isatom, C_LIBS, NULL),
|
||||
YAP_FLAG(CHAR_CONVERSION_FLAG, "char_conversion", true, booleanFlag,
|
||||
"false", NULL),
|
||||
/**< `char_conversion is iso`
|
||||
|
||||
Writable flag telling whether a character conversion table is used when
|
||||
reading terms. The default value for this flag is `off` except in
|
||||
`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,
|
||||
"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 `
|
||||
|
||||
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.
|
||||
*/
|
||||
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),
|
||||
/**< `debug is iso `
|
||||
YAP_FLAG(DEBUG_FLAG, "debug", true, booleanFlag, "false", NULL),
|
||||
/**<
|
||||
|
||||
If _Value_ is unbound, tell whether debugging is `true` or
|
||||
`false`. If _Value_ is bound to `true` enable debugging, and if
|
||||
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_ON_ERROR_FLAG, "debug_on_error", true, booleanFlag, "true",
|
||||
NULL),
|
||||
@ -160,12 +159,14 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
||||
NULL),
|
||||
YAP_FLAG(DEBUGGER_SHOW_CONTEXT_FLAG, "debugger_show_context", true,
|
||||
booleanFlag, "false", NULL),
|
||||
/**< `dialect `
|
||||
YAP_FLAG(DIALECT_FLAG, "dialect", false, ro, "yap", NULL),
|
||||
/**<
|
||||
|
||||
Read-only flag that always returns `yap`.
|
||||
*/
|
||||
YAP_FLAG(DIALECT_FLAG, "dialect", false, ro, "yap", NULL),
|
||||
/**< `discontiguous_warnings `
|
||||
YAP_FLAG(DISCONTIGUOUS_WARNINGS_FLAG, "discontiguous_warnings", true,
|
||||
booleanFlag, "true", NULL),
|
||||
/**<
|
||||
|
||||
If `true` (default `true`) YAP checks for definitions of the same predicate
|
||||
that are separated by clauses for other predicates. This may indicate that
|
||||
@ -175,38 +176,36 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
||||
predicates.
|
||||
|
||||
*/
|
||||
YAP_FLAG(DISCONTIGUOUS_WARNINGS_FLAG, "discontiguous_warnings", true,
|
||||
booleanFlag, "true", NULL),
|
||||
/**< `dollar_as_lower_case `
|
||||
|
||||
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
|
||||
`on` consider `$` a lower case character.
|
||||
*/
|
||||
YAP_FLAG(DOLLAR_AS_LOWER_CASE_FLAG, "dollar_as_lower_case", true,
|
||||
booleanFlag, "false", NULL),
|
||||
/**< `double_quotes is iso `
|
||||
YAP_FLAG(DOUBLE_QUOTES_FLAG, "double_quotes", true, isatom, "codes", dqs),
|
||||
/**< iso
|
||||
|
||||
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,
|
||||
`codes`, or to a single atom, `atom`. If _Value_ is bound, set to
|
||||
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),
|
||||
/**< `executable `
|
||||
YAP_FLAG(EXECUTABLE_FLAG, "executable", false, executable, "@boot", NULL),
|
||||
/**<
|
||||
|
||||
Read-only flag. It unifies with an atom that gives the
|
||||
original program path.
|
||||
*/
|
||||
YAP_FLAG(EXECUTABLE_FLAG, "executable", false, executable, "@boot", NULL),
|
||||
/**< `fast `
|
||||
YAP_FLAG(FAST_FLAG, "fast", true, booleanFlag, "false", NULL),
|
||||
/**<
|
||||
|
||||
If `on` allow fast machine code, if `off` (default) disable it. Only
|
||||
available in experimental implementations.
|
||||
*/
|
||||
YAP_FLAG(FAST_FLAG, "fast", true, booleanFlag, "false", NULL),
|
||||
YAP_FLAG(FILE_NAME_VARIABLES_FLAG, "file_name_variables", true, booleanFlag,
|
||||
"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
|
||||
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
|
||||
default 15.
|
||||
*/
|
||||
YAP_FLAG(FLOAT_FORMAT_FLAG, "float_format", true, isatom, "%.16f", NULL),
|
||||
YAP_FLAG(GC_FLAG, "gc", true, booleanFlag, "on", NULL),
|
||||
/**< `gc`
|
||||
|
||||
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 `
|
||||
|
||||
Set or show the minimum free stack before starting garbage
|
||||
collection. The default depends on total stack size.
|
||||
|
||||
*/
|
||||
YAP_FLAG(GC_MARGIN_FLAG, "gc_margin", true, nat, "0", gc_margin),
|
||||
/**< `gc_trace `
|
||||
|
||||
YAP_FLAG(GC_TRACE_FLAG, "gc_trace", true, isatom, "off", NULL),
|
||||
/**<
|
||||
*
|
||||
If `off` (default) do not show information on garbage collection
|
||||
and stack shifts, if `on` inform when a garbage collection or stack
|
||||
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
|
||||
process, namely, on choice-points.
|
||||
*/
|
||||
YAP_FLAG(GC_TRACE_FLAG, "gc_trace", true, isatom, "off", NULL),
|
||||
/**< `generate_debug_info `
|
||||
YAP_FLAG(GENERATE_DEBUGGING_INFO_FLAG, "generate_debug_info", true,
|
||||
booleanFlag, "true", NULL),
|
||||
/**< `
|
||||
|
||||
If `true` (default) generate debugging information for
|
||||
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.
|
||||
|
||||
*/
|
||||
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(HALT_AFTER_CONSULT_FLAG, "halt_after_consult", false, booleanFlag,
|
||||
"false", NULL),
|
||||
YAP_FLAG(HOME_FLAG, "home", false, isatom, YAP_ROOTDIR, NULL),
|
||||
/**< home `
|
||||
|
||||
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
|
||||
*/
|
||||
YAP_FLAG(HOME_FLAG, "home", false, isatom, YAP_ROOTDIR, NULL),
|
||||
YAP_FLAG(HOST_TYPE_FLAG, "host_type", false, isatom, HOST_ALIAS, NULL),
|
||||
/**< host_type `
|
||||
|
||||
Return `configure` system information, including the machine-id
|
||||
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 `
|
||||
|
||||
If `on` allow indexing (default), if `off` disable it, if
|
||||
`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",
|
||||
true, nat, "0", NULL),
|
||||
/**< `Index_sub_term_search_depth `
|
||||
|
||||
Maximum bound on searching sub-terms for indexing, if `0` (default) no
|
||||
bound.
|
||||
*/
|
||||
YAP_FLAG(INDEX_SUB_TERM_SEARCH_DEPTH_FLAG, "index_sub_term_search_depth",
|
||||
true, nat, "0", NULL),
|
||||
YAP_FLAG(INFORMATIONAL_MESSAGES_FLAG, "informational_messages", true,
|
||||
isatom, "normal", NULL),
|
||||
/**< `informational_messages `
|
||||
|
||||
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
|
||||
the `-L` flag.
|
||||
*/
|
||||
YAP_FLAG(INFORMATIONAL_MESSAGES_FLAG, "informational_messages", true,
|
||||
isatom, "normal", NULL),
|
||||
YAP_FLAG(INTEGER_ROUNDING_FUNCTION_FLAG, "integer_rounding_function", true,
|
||||
isatom, "toward_zero", NULL),
|
||||
/**< `integer_rounding_function is iso `
|
||||
|
||||
Read-only flag telling the rounding function used for integers. Takes the
|
||||
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(LANGUAGE_FLAG, "language", true, isatom, "yap", NULL),
|
||||
/**< `language `
|
||||
|
||||
Choose whether YAP follows native, closer to C-Prolog, `yap`, iso-prolog,
|
||||
@ -302,23 +301,21 @@ 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 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,
|
||||
isatom, "", NULL),
|
||||
|
||||
/**< 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,
|
||||
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 `
|
||||
YAP_FLAG(MAX_ARITY_FLAG, "max_arity", false, isatom, "unbounded", NULL),
|
||||
|
||||
Read-only flag telling the maximum arity of a functor. Takes the value
|
||||
`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,
|
||||
"INT_MAX", NULL),
|
||||
YAP_FLAG(MAX_THREADS_FLAG, "max_threads", false, at2n, "MAX_THREADS", NULL),
|
||||
@ -329,36 +326,37 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
||||
"256", NULL),
|
||||
YAP_FLAG(OCCURS_CHECK_FLAG, "occurs_check", true, booleanFlag, "false",
|
||||
NULL),
|
||||
YAP_FLAG(OPEN_EXPANDS_FILENAME_FLAG, "open_expands_filename", true,
|
||||
booleanFlag, "false", NULL),
|
||||
/**< `open_expands_filename `
|
||||
|
||||
If `true` the open/3 builtin performs filename-expansion
|
||||
before opening a file (SICStus Prolog like). If `false` it does not
|
||||
(SWI-Prolog like).
|
||||
*/
|
||||
YAP_FLAG(OPEN_EXPANDS_FILENAME_FLAG, "open_expands_filename", true,
|
||||
booleanFlag, "false", NULL),
|
||||
YAP_FLAG(OPEN_SHARED_OBJECT_FLAG, "open_shared_object", true, booleanFlag,
|
||||
"true", 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,
|
||||
"true", NULL),
|
||||
/**< `module_independent_operators `
|
||||
|
||||
If `true` an operator declaration will be valid for every module in the
|
||||
program. This is for compatibility with old software that
|
||||
might expect module-independent operators.
|
||||
*/
|
||||
// YAP_FLAG(MODULE_INDEPENDENT_OPERATORS_FLAG,
|
||||
// "module_independent_operators", true, booleanFlag,
|
||||
// "false", NULL),
|
||||
YAP_FLAG(MODULE_INDEPENDENT_OPERATORS_FLAG,
|
||||
"module_independent_operators", 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(PID_FLAG, "pid", false, sys_pid, "@boot", NULL),
|
||||
YAP_FLAG(PIPE_FLAG, "pipe", true, booleanFlag, "true", NULL),
|
||||
YAP_FLAG(PROFILING_FLAG, "profiling", true, booleanFlag, "false", NULL),
|
||||
/**< `profiling `
|
||||
|
||||
If `off` (default) do not compile call counting information for
|
||||
@ -366,7 +364,8 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
||||
retries to the predicate may be counted. Profiling data can be read through
|
||||
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,
|
||||
isatom, "determinism", NULL),
|
||||
/**< `prompt_alternatives_on(atom,
|
||||
changeable) `
|
||||
|
||||
@ -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
|
||||
SWI-Prolog is <tt>determinism</tt> which implies the system prompts for
|
||||
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,
|
||||
"true", NULL),
|
||||
YAP_FLAG(READLINE_FLAG, "readline", true, booleanFlag, "false",
|
||||
Yap_InitReadline),
|
||||
/**< `readline(boolean, changeable)`
|
||||
}
|
||||
|
||||
enable the use of the readline library for console interactions, true by
|
||||
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",
|
||||
NULL),
|
||||
YAP_FLAG(RESOURCE_DATABASE_FLAG, "resource_database", false, isatom,
|
||||
YAP_BOOTSTRAP, NULL),
|
||||
|
||||
/**<`resource_database`
|
||||
Name of the resource file (saved-state or Prolog file) used to construct
|
||||
the YAP
|
||||
run-time environment.
|
||||
*/
|
||||
YAP_FLAG(RESOURCE_DATABASE_FLAG, "resource_database", false, isatom,
|
||||
YAP_BOOTSTRAP, NULL),
|
||||
|
||||
YAP_FLAG(SAVED_PROGRAM_FLAG, "saved_program", false, booleanFlag, "false",
|
||||
NULL),
|
||||
/**<`saved_program`
|
||||
if `true` YAP booted from a `yss` file, usually `startup.yss'. If
|
||||
`false`, YAP booted from a Prolog file, by default `boot.yap`.
|
||||
*/
|
||||
YAP_FLAG(SAVED_PROGRAM_FLAG, "saved_program", false, booleanFlag, "false",
|
||||
NULL),
|
||||
YAP_FLAG(SHARED_OBJECT_EXTENSION_FLAG, "shared_object_extension", false,
|
||||
isatom, SO_EXT, NULL),
|
||||
|
||||
/**< `shared_object_extension `
|
||||
|
||||
Suffix associated with loadable code.
|
||||
*/
|
||||
YAP_FLAG(SHARED_OBJECT_EXTENSION_FLAG, "shared_object_extension", false,
|
||||
isatom, SO_EXT, NULL),
|
||||
YAP_FLAG(SHARED_OBJECT_SEARCH_PATH_FLAG, "shared_object_search_path", true,
|
||||
isatom, SO_PATH, 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,
|
||||
isatom, SO_PATH, NULL),
|
||||
YAP_FLAG(SINGLE_QUOTES_FLAG, "single_quotes", true, isatom, "atom", sqf),
|
||||
/**< `single_quoted text is usuallly interpreted as atoms. This flagTerm
|
||||
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`
|
||||
|
||||
If `true` (default) YAP handles Signals such as `^C`
|
||||
(`SIGINT`).
|
||||
|
||||
*/
|
||||
YAP_FLAG(SIGNALS_FLAG, "signals", true, booleanFlag, "true", NULL),
|
||||
YAP_FLAG(SOURCE_FLAG, "source", true, booleanFlag, "true", NULL),
|
||||
/**< `source`
|
||||
|
||||
If `true` maintain the source for all clauses. Notice that this is trivially
|
||||
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 `
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
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 `
|
||||
|
||||
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`,
|
||||
`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,
|
||||
"@boot", NULL),
|
||||
YAP_FLAG(TABLING_MODE_FLAG, "tabling_mode", true, isatom, "[]", NULL),
|
||||
/**< `tabling_mode`
|
||||
|
||||
Sets or reads the tabling mode for all tabled predicates. Please
|
||||
(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(TIMEZONE_FLAG, "timezone", false, ro, "18000", NULL),
|
||||
YAP_FLAG(TOPLEVEL_PRINT_ANON_FLAG, "toplevel_print_anon", true, booleanFlag,
|
||||
"true", NULL),
|
||||
YAP_FLAG(TOPLEVEL_HOOK_FLAG, "toplevel_hook", true,
|
||||
booleanFlag, "true",
|
||||
NULL),
|
||||
/**< `toplevel_hook `
|
||||
|
||||
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, "?- ",
|
||||
mkprompt),
|
||||
YAP_FLAG(TTY_CONTROL_FLAG, "tty_control", true, booleanFlag, "true", NULL),
|
||||
YAP_FLAG(UNIX_FLAG, "unix", false, ro, "true", NULL),
|
||||
/**< `unix`
|
||||
|
||||
Read-only BooleanFlag flag that unifies with `true` if YAP is
|
||||
running on an Unix system. Defined if the C-compiler used to compile
|
||||
this version of YAP either defines `__unix__` or `unix`.
|
||||
*/
|
||||
YAP_FLAG(UNIX_FLAG, "unix", false, ro, "true", NULL),
|
||||
/**< `update_semantics `
|
||||
|
||||
Define whether YAP should follow `immediate` update
|
||||
@ -513,6 +513,7 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
||||
*/
|
||||
YAP_FLAG(UPDATE_SEMANTICS_FLAG, "update_semantics", true, isatom, "logical",
|
||||
NULL),
|
||||
YAP_FLAG(USER_FLAGS_FLAG, "user_flags", true, isatom, "error", NULL),
|
||||
/**<
|
||||
`user_flags `
|
||||
|
||||
@ -524,17 +525,17 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
||||
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(UNKNOWN_FLAG, "unknown", true, isatom, "error", Yap_unknown),
|
||||
/**< `unknown is iso`
|
||||
|
||||
Corresponds to calling the unknown/2 built-in. Possible ISO values
|
||||
are `error`, `fail`, and `warning`. Yap includes the following extensions:
|
||||
`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,
|
||||
"variable_names_may_end_with_quotes", true, booleanFlag, "false",
|
||||
NULL),
|
||||
YAP_FLAG(VERBOSE_FLAG, "verbose", true, isatom, "normal", NULL),
|
||||
/**< `verbose `
|
||||
|
||||
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_FLAG(VERBOSE_FLAG, "verbose", true, isatom, "normal", NULL),
|
||||
YAP_FLAG(VERBOSE_AUTOLOAD_FLAG, "verbose_autoload", true, booleanFlag,
|
||||
YAP_FLAG(VERBOSE_FILE_SEARCH_FLAG, "verbose_file_search", true, booleanFlag,
|
||||
"false", NULL),
|
||||
/**< `verbose_file_search `
|
||||
|
||||
@ -553,22 +553,13 @@ 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`
|
||||
flag.
|
||||
*/
|
||||
YAP_FLAG(VERBOSE_FILE_SEARCH_FLAG, "verbose_file_search", true, booleanFlag,
|
||||
"false", NULL),
|
||||
YAP_FLAG(VERBOSE_LOAD_FLAG, "verbose_load", true, isatom, "normal", NULL),
|
||||
/**< `verbose_load `
|
||||
|
||||
If `true` allow printing of informational messages when
|
||||
consulting files. If `false` disable printing these messages. It
|
||||
is `normal` by default except if YAP is booted with the `-L`
|
||||
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),
|
||||
/**<
|
||||
@ -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),
|
||||
/**< `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 `
|
||||
`
|
||||
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.
|
||||
*/
|
||||
YAP_FLAG(VERSION_GIT_FLAG, "version_git", false, isatom, YAP_GIT_HEAD,
|
||||
NULL),
|
||||
YAP_FLAG(WRITE_ATTRIBUTES_FLAG, "write_attributes", true, isatom, "ignore",
|
||||
NULL),
|
||||
#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),
|
||||
#endif
|
||||
YAP_FLAG(WRITE_STRINGS_FLAG, "write_strings", true, booleanFlag, "false",
|
||||
NULL),
|
||||
|
||||
/**< `write_strings `
|
||||
|
||||
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
|
||||
this flag is `off`.
|
||||
*/
|
||||
YAP_FLAG(WRITE_STRINGS_FLAG, "write_strings", true, booleanFlag, "false",
|
||||
NULL),
|
||||
|
||||
END_GLOBAL_FLAGS
|
||||
|
||||
//! @}
|
||||
|
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;
|
||||
|
||||
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')) {
|
||||
mode = AASSET_MODE_BUFFER;
|
||||
} else {
|
||||
@ -78,10 +78,9 @@ open_asset(VFS_t *me, const char *fname, const char *io_mode, int sno) {
|
||||
// strcpy(dir, fname);
|
||||
// char *d = basename(dir);
|
||||
am = AAssetManager_open(Yap_assetManager(), fname, mode);
|
||||
if (am==NULL)
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "failed open %s <%s>", fname, strerror(errno) );
|
||||
//if (am==NULL)
|
||||
// __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) {
|
||||
// char *f = AAssetDir_getNextFileName(dp);
|
||||
// __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)
|
||||
return false;
|
||||
(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;
|
||||
}
|
||||
@ -199,7 +198,7 @@ bool exists_a(VFS_t *me, const char *dirName) {
|
||||
dirName += strlen(me->prefix) + 1;
|
||||
// try not to use it as an asset
|
||||
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)
|
||||
return false;
|
||||
AAsset_close(d);
|
||||
@ -219,7 +218,7 @@ static bool set_cwd(VFS_t *me, const char *dirName) {
|
||||
dirName = dirname(dirName);
|
||||
GLOBAL_cwd = malloc(strlen(dirName)+1);
|
||||
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;
|
||||
}
|
||||
|
||||
|
18
os/iopreds.c
18
os/iopreds.c
@ -1130,6 +1130,8 @@ bool Yap_initStream(int sno, FILE *fd, const char *name, const char *io_mode,
|
||||
Term file_name, encoding_t encoding, stream_flags_t flags,
|
||||
void *vfs) {
|
||||
StreamDesc *st = &GLOBAL_Stream[sno];
|
||||
__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),
|
||||
"File opened with NULL Permissions");
|
||||
@ -1167,7 +1169,6 @@ bool Yap_initStream(int sno, FILE *fd, const char *name, const char *io_mode,
|
||||
st->user_name = file_name;
|
||||
st->file = fd;
|
||||
st->linepos = 0;
|
||||
Yap_DefaultStreamOps(st);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -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,
|
||||
st->status, vfsp);
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "exists %s <%d>", fname,
|
||||
sno);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1469,7 +1468,6 @@ if (args[OPEN_BOM].used) {
|
||||
// interactive streams do not have a start, so they probably don't have
|
||||
// a BOM
|
||||
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)) {
|
||||
return false;
|
||||
} else if (open_mode == AtomRead && !avoid_bom) {
|
||||
@ -1865,17 +1863,13 @@ static Int always_prompt_user(USES_REGS1) {
|
||||
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
|
||||
currently opened an error is reported. The streams user_input,
|
||||
user_output, and user_error can never be closed.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
(USES_REGS1) { /* '$close'(+GLOBAL_Stream) */
|
||||
static Int close1(USES_REGS1) { /* '$close'(+GLOBAL_Stream) */
|
||||
int sno = CheckStream(
|
||||
ARG1, (Input_Stream_f | Output_Stream_f | Socket_Stream_f), "close/2");
|
||||
if (sno < 0)
|
||||
@ -2057,13 +2051,13 @@ void Yap_InitPlIO(struct yap_boot_params *argi) {
|
||||
Int i;
|
||||
if (argi->inp > 0)
|
||||
Yap_stdin = fdopen(argi->inp - 1, "r");
|
||||
else if (argi->inp)
|
||||
else if (argi->inp < 0)
|
||||
Yap_stdin = NULL;
|
||||
else
|
||||
Yap_stdin = stdin;
|
||||
if (argi->out > 0)
|
||||
Yap_stdout = fdopen(argi->out - 1, "a");
|
||||
else if (argi->out)
|
||||
else if (argi->out < 0)
|
||||
Yap_stdout = NULL;
|
||||
else
|
||||
Yap_stdout = stdout;
|
||||
|
@ -1545,8 +1545,8 @@ static Int read_term_from_string(USES_REGS1) {
|
||||
static Int atomic_to_term(USES_REGS1) {
|
||||
Term t1 = Deref(ARG1);
|
||||
int l = push_text_stack();
|
||||
const char *s = Yap_TextToUTF8Buffer(t1 PASS_REGS);
|
||||
Int rc = Yap_BufferToTerm(s, add_output(ARG2, add_names(ARG3, TermNil)));
|
||||
const unsigned char *s = Yap_TextToUTF8Buffer(t1 PASS_REGS);
|
||||
Int rc = Yap_UBufferToTerm(s, add_output(ARG2, add_names(ARG3, TermNil)));
|
||||
pop_text_stack(l);
|
||||
return rc;
|
||||
}
|
||||
|
@ -995,6 +995,8 @@ static void CloseStream(int sno) {
|
||||
CACHE_REGS
|
||||
|
||||
// fflush(NULL);
|
||||
// __android_log_print(ANDROID_LOG_INFO, "YAPDroid", "close stream <%d>",
|
||||
// sno);
|
||||
VFS_t *me;
|
||||
if ((me = GLOBAL_Stream[sno].vfs) != NULL &&
|
||||
GLOBAL_Stream[sno].file == NULL) {
|
||||
@ -1034,6 +1036,7 @@ static void CloseStream(int sno) {
|
||||
GLOBAL_Stream[sno].vfs = NULL;
|
||||
GLOBAL_Stream[sno].file = NULL;
|
||||
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) {
|
||||
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();
|
||||
|
||||
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;
|
||||
if ((v = vfs_owner(qpath))) {
|
||||
rc = v->chdir(v, (qpath));
|
||||
@ -398,7 +398,7 @@ static char *clean_path(const char *path) {
|
||||
const char *p, *p0;
|
||||
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;
|
||||
int ch;
|
||||
char *b0 = Malloc(FILENAME_MAX + 1), *b = b0;
|
||||
@ -423,8 +423,8 @@ static char *clean_path(const char *path) {
|
||||
if (o == o0)
|
||||
*o++ = '/';
|
||||
*o = '\0';
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid ", " %s at %s, %p-%p", p0, o0,
|
||||
o, o0);
|
||||
// __android_log_print(ANDROID_LOG_INFO, "YAPDroid ", " %s at %s, %p-%p", p0, o0,
|
||||
// o, o0);
|
||||
return pop_output_text_stack(lvl, o0);
|
||||
}
|
||||
|
||||
@ -1146,7 +1146,7 @@ const char *Yap_getcwd(char *cwd, size_t cwdlen) {
|
||||
return (char *)cwd;
|
||||
#endif
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -127,9 +127,7 @@
|
||||
%% SWI end
|
||||
:- use_module(library(dialect/hprolog)).
|
||||
:- use_module(pairlist).
|
||||
:- start_low_level_trace.
|
||||
:- include(chr_op).
|
||||
:- stop_low_level_trace.
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%
|
||||
|
@ -15,7 +15,7 @@
|
||||
* *
|
||||
*************************************************************************/
|
||||
|
||||
//:- load_foreign_files([myddas], [], init_myddas).
|
||||
%%:- load_foreign_files([myddas], [], init_myddas).
|
||||
|
||||
/* Initialize MYDDAS GLOBAL STRUCTURES */
|
||||
:- c_db_initialize_myddas.
|
||||
|
@ -673,13 +673,13 @@ static void Yap_InitBackMYDDAS_SQLITE3Preds(void) {
|
||||
|
||||
X_API void init_sqlite3(void) {
|
||||
Term cm = CurrentModule;
|
||||
CurrentModule = MkAtomTerm(Yap_LookupAtom("myddas_sqlite3"));
|
||||
//CurrentModule = MkAtomTerm(Yap_LookupAtom("myddas_sqlite3"));
|
||||
|
||||
Yap_InitMYDDAS_SQLITE3Preds();
|
||||
|
||||
Yap_InitBackMYDDAS_SQLITE3Preds();
|
||||
|
||||
CurrentModule = cm;
|
||||
//CurrentModule = cm;
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@ main_ .
|
||||
|
||||
init :-
|
||||
|
||||
start_low_level_trace,
|
||||
%start_low_level_trace,
|
||||
db_open(sqlite3, '/data/user/0/pt.up.yap.yapdroid/files/Yap/chinook.db', _, _),
|
||||
writeln('chinook has landed').
|
||||
|
||||
|
@ -59,10 +59,9 @@ and_close(int sno) {
|
||||
static int
|
||||
and_put(int sno, int ch) {
|
||||
buff0 += ch;
|
||||
if (ch=='\n' || buff0.length() == 128) { //buff0+= '\0';
|
||||
streamerInstance->display(buff0);
|
||||
buff0.clear();
|
||||
}
|
||||
|
||||
return ch;
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
:- module(system('$messages'),
|
||||
[system_message/4,
|
||||
prefix/6,
|
||||
prefix/2,
|
||||
prefix/5,
|
||||
file_location/3]).
|
||||
|
||||
@ -827,6 +827,12 @@ prefix(help, '~N'-[]).
|
||||
prefix(query, '~N'-[]).
|
||||
prefix(debug, '~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) },
|
||||
( { Id == main }
|
||||
-> [ 'warning, ' - [] ]
|
||||
@ -835,7 +841,7 @@ prefix(warning, '~N'-[]).
|
||||
; ['warning [Thread ~d ], ' - [Id] ]
|
||||
).
|
||||
*/
|
||||
prefix(error, '~N'-[]).
|
||||
|
||||
/*
|
||||
{ thread_self(Id) },
|
||||
( { Id == main }
|
||||
@ -853,11 +859,7 @@ prefix(error, '', user_error) -->
|
||||
; [ '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) :-
|
||||
|
Reference in New Issue
Block a user