ismall bugs && docs

This commit is contained in:
Vitor Santos Costa 2018-11-14 09:35:24 +00:00
parent cb5dc1313a
commit 4fed99c0aa
9 changed files with 330 additions and 254 deletions

View File

@ -348,9 +348,10 @@ bool Yap_PrintWarning(Term twarning) {
} }
LOCAL_PrologMode |= InErrorMode; LOCAL_PrologMode |= InErrorMode;
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, "%s:%ld/* d:%d warning */:\n",
Yap_DebugPlWrite(twarning); LOCAL_ActiveError->errorFile,
fprintf(stderr, "\n"); LOCAL_ActiveError->errorLine, 0 );
Yap_DebugPlWriteln(twarning);
LOCAL_DoingUndefp = false; LOCAL_DoingUndefp = false;
LOCAL_PrologMode &= ~InErrorMode; LOCAL_PrologMode &= ~InErrorMode;
CurrentModule = cmod; CurrentModule = cmod;
@ -1059,6 +1060,26 @@ static Int query_exception(USES_REGS1) {
// } // }
} }
static Int set_exception(USES_REGS1) {
const char *query = NULL;
Term t;
if (IsAtomTerm((t = Deref(ARG1))))
query = RepAtom(AtomOfTerm(t))->StrOfAE;
if (IsStringTerm(t))
query = StringOfTerm(t);
if (!IsAddressTerm(Deref(ARG2)))
return false;
yap_error_descriptor_t *y = AddressOfTerm(Deref(ARG2));
Term t3 = Deref(ARG3);
if (IsVarTerm(t3)) {
return false;
} else {
return setErr(query, y, t3);
}
}
static Int drop_exception(USES_REGS1) { static Int drop_exception(USES_REGS1) {
yap_error_descriptor_t *t = AddressOfTerm(Deref(ARG1)); yap_error_descriptor_t *t = AddressOfTerm(Deref(ARG1));
@ -1270,6 +1291,7 @@ void Yap_InitErrorPreds(void) {
Yap_InitCPred("$reset_exception", 1, reset_exception, 0); Yap_InitCPred("$reset_exception", 1, reset_exception, 0);
Yap_InitCPred("$new_exception", 1, new_exception, 0); Yap_InitCPred("$new_exception", 1, new_exception, 0);
Yap_InitCPred("$get_exception", 1, get_exception, 0); Yap_InitCPred("$get_exception", 1, get_exception, 0);
Yap_InitCPred("$set_exception", 3, set_exception, 0);
Yap_InitCPred("$read_exception", 2, read_exception, 0); Yap_InitCPred("$read_exception", 2, read_exception, 0);
Yap_InitCPred("$query_exception", 3, query_exception, 0); Yap_InitCPred("$query_exception", 3, query_exception, 0);
Yap_InitCPred("$drop_exception", 1, drop_exception, 0); Yap_InitCPred("$drop_exception", 1, drop_exception, 0);

View File

@ -25,10 +25,12 @@
*/ */
/** /**
@{
@defgroup YAPFlags_Impl C-code to handle Prolog flags. @defgroup YAPFlags C-code to handle Prolog flags.
@ingroup YAPFlags @ingroup YAPFlags
@{
@brief Low-level code to support flags. @brief Low-level code to support flags.
Prolog Flags can be: Prolog Flags can be:
@ -1797,10 +1799,6 @@ void Yap_InitFlags(bool bootstrap) {
Yap_InitCPredBack("current_prolog_flag", 2, 1, current_prolog_flag, Yap_InitCPredBack("current_prolog_flag", 2, 1, current_prolog_flag,
cont_yap_flag, 0); cont_yap_flag, 0);
TR = tr0; TR = tr0;
/** @pred prolog_flag( ?Flag, - Value)
Obtain the value for a YAP Prolog flag, same as current_prolog_flag/2.
*/
Yap_InitCPredBack("prolog_flag", 3, 1, prolog_flag, cont_yap_flag, Yap_InitCPredBack("prolog_flag", 3, 1, prolog_flag, cont_yap_flag,
0); 0);
Yap_InitCPredBack("yap_flag", 3, 1, yap_flag, cont_yap_flag, 0); Yap_InitCPredBack("yap_flag", 3, 1, yap_flag, cont_yap_flag, 0);

View File

@ -1469,6 +1469,7 @@ int Yap_SavedInfo(const char *FileName, CELL *ATrail,
mode = OpenRestore(FileName, &MyState, &MyTrail, &MyStack, &MyHeap, mode = OpenRestore(FileName, &MyState, &MyTrail, &MyStack, &MyHeap,
NULL); NULL);
if (mode == FAIL_RESTORE) { if (mode == FAIL_RESTORE) {
fprintf(stderr, "restore failed to open %s as a valid state\n", FileName);
return -1; return -1;
} }
close_file(); close_file();

View File

@ -2643,7 +2643,7 @@ static Term free_vars_in_complex_term(register CELL *pt0, register CELL *pt0_end
clean_tr(TR0 PASS_REGS); clean_tr(TR0 PASS_REGS);
Yap_ReleasePreAllocCodeSpace((ADDR)to_visit0); Yap_ReleasePreAllocCodeSpace((ADDR)to_visit0);
if (HR != InitialH+1) { if (HR != InitialH) {
InitialH[0] = (CELL)Yap_MkFunctor(AtomDollar, (HR-InitialH)-1); InitialH[0] = (CELL)Yap_MkFunctor(AtomDollar, (HR-InitialH)-1);
return AbsAppl(InitialH); return AbsAppl(InitialH);
} else { } else {
@ -2983,24 +2983,28 @@ static Term non_singletons_in_complex_term(register CELL *pt0, register CELL *pt
} }
/* Do we still have compound terms to visit */ /* Do we still have compound terms to visit */
if (to_visit > to_visit0) { if (to_visit > to_visit0) {
#ifdef RATIONAL_TREES
to_visit -= 3; to_visit -= 3;
pt0 = to_visit[0]; pt0 = to_visit[0];
pt0_end = to_visit[1]; pt0_end = to_visit[1];
*pt0 = (CELL)to_visit[2]; *pt0 = (CELL)to_visit[2];
#else
to_visit -= 2;
pt0 = to_visit[0];
pt0_end = to_visit[1];
#endif
goto loop; goto loop;
} }
clean_tr(TR0 PASS_REGS); clean_tr(TR0 PASS_REGS);
if (HR != InitialH) {
CELL *pt0 = InitialH, *pt1 = pt0;
while (pt0 < InitialH) {
if(Deref(pt0[0]) == TermFoundVar) {
pt1[0] = pt0[0];
pt1[1] = AbsAppl(pt1+2);
pt1 += 2;
}
pt0 += 2;
}
}
if (HR != InitialH) { if (HR != InitialH) {
/* close the list */ /* close the list */
RESET_VARIABLE(HR-2); HR[-1] = Deref(ARG2);
Yap_unify((CELL)(HR-2),ARG2);
return output; return output;
} else { } else {
return ARG2; return ARG2;

View File

@ -24,28 +24,29 @@
START_GLOBAL_FLAGS START_GLOBAL_FLAGS
YAP_FLAG(ADDRESS_BITS_FLAG, "address_bits", false, nat, BITNESS, NULL), /**< /**<
Number of address bits in the machine, either 64 or 32 bits. Number of address bits in the machine, either 64 or 32 bits.
*/ */
YAP_FLAG(ADDRESS_BITS_FLAG, "address_bits", false, nat, BITNESS, NULL),
YAP_FLAG(AGC_MARGIN_FLAG, "agc_margin", true, nat, "10000", /**<
agc_threshold), /**<
An integer: if this amount of atoms has been created since the last An integer: if this amount of atoms has been created since the last
atom-garbage collection, perform atom garbage collection at the first atom-garbage collection, perform atom garbage collection at the first
opportunity. Initial value is 10,000. May be changed. A value of 0 opportunity. Initial value is 10,000. May be changed. A value of 0
(zero) disables atom garbage collection. (zero) disables atom garbage collection.
*/ */
YAP_FLAG(AGC_MARGIN_FLAG, "agc_margin", true, nat, "10000",
agc_threshold),
YAP_FLAG(ALLOW_ASSERT_FOR_STATIC_PREDICATES, /**<
"allow_assert_for_static_predicates", true, booleanFlag, "true",
NULL), /**<
boolean: allow asserting and retracting clauses of static boolean: allow asserting and retracting clauses of static
predicates. */ predicates. */
YAP_FLAG(ALLOW_ASSERT_FOR_STATIC_PREDICATES,
"allow_assert_for_static_predicates", true, booleanFlag, "true",
NULL),
YAP_FLAG(ALLOW_VARIABLE_NAME_AS_FUNCTOR_FLAG, /**<
"allow_variable_name_as_functor", false, booleanFlag, "false",
NULL), /**<
boolean flag allows syntax such boolean flag allows syntax such
as as
@ -55,26 +56,31 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
Tree(R). Tree(R).
~~~ ~~~
*/ */
YAP_FLAG(ALLOW_VARIABLE_NAME_AS_FUNCTOR_FLAG,
"allow_variable_name_as_functor", false, booleanFlag, "false",
NULL),
YAP_FLAG(ANSWER_FORMAT_FLAG, "answer_format", true, isatom, "~p", NULL),
/**< how to present answers, default is `~p`. */ /**< how to present answers, default is `~p`. */
YAP_FLAG(ANSWER_FORMAT_FLAG, "answer_format", true, isatom, "~p", NULL),
#if __ANDROID__ #if __ANDROID__
YAP_FLAG(ANDROID_FLAG, "android", false, booleanFlag, "true", NULL), /**< /**<
read-only boolean, a machine running an Google's Android version of the read-only boolean, a machine running an Google's Android version of the
Linux Operating System */ Linux Operating System */
YAP_FLAG(ANDROID_FLAG, "android", false, booleanFlag, "true", NULL),
#endif #endif
#if __APPLE__ #if __APPLE__
YAP_FLAG(APPLE_FLAG, "apple", false, booleanFlag, "true", NULL), /**< /**<
read-only boolean, a machine running an Apple Operating System */ read-only boolean, a machine running an Apple Operating System */
YAP_FLAG(APPLE_FLAG, "apple", false, booleanFlag, "true", NULL),
#endif #endif
YAP_FLAG(ARCH_FLAG, "arch", false, isatom, YAP_ARCH, NULL), /**< /**<
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_ARCH. Available from YAP_ARCH.
*/ */
YAP_FLAG(ARCH_FLAG, "arch", false, isatom, YAP_ARCH, NULL),
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),
/**< /**<
Read-write flag telling whether arithmetic exceptions generate Read-write flag telling whether arithmetic exceptions generate
@ -95,71 +101,79 @@ 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(BACK_QUOTES_FLAG, "back_quotes", true, isatom, "true", bqs), YAP_FLAG(ARITHMETIC_EXCEPTIONS_FLAG, "arithmetic_exceptions", true,
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(BOUNDED_FLAG, "bounded", false, booleanFlag, "false", NULL), YAP_FLAG(BACK_QUOTES_FLAG, "back_quotes", true, isatom, "true", bqs),
/**< `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(CHARACTER_ESCAPES_FLAG, "character_escapes", true, booleanFlag, YAP_FLAG(CHAR_CONVERSION_FLAG, "char_conversion", true, booleanFlag,
"true", NULL), "false", NULL),
/**< ` /**< `
Writable flag telling whether a character escapes are enabled, Writable flag telling whether a character escapes are enabled,
`true`, or disabled, `false`. The default value for this flag is `true`, or disabled, `false`. The default value for this flag is
`true`. */ `true`. */
YAP_FLAG(COLON_SETS_CALLING_CONTEXT_FLAG, "colon_sets_calling_context", YAP_FLAG(CHARACTER_ESCAPES_FLAG, "character_escapes", true, booleanFlag,
true, booleanFlag, "true", NULL), "true", NULL),
/**< `compiled_at ` /**< `compiled_at `
Read-only flag that gives the time when the main YAP binary was compiled. 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. It is obtained staight from the __TIME__ macro, as defined in the C99.
*/ */
YAP_FLAG(COLON_SETS_CALLING_CONTEXT_FLAG, "colon_sets_calling_context",
true, booleanFlag, "true", NULL),
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),
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",
NULL),
/**< /**<
If bound, set the argument to the `write_term/3` options the If bound, set the argument to the `write_term/3` options the
debugger uses to write terms. If unbound, show the current options. debugger uses to write terms. If unbound, show the current options.
*/ */
YAP_FLAG(DEBUG_ON_ERROR_FLAG, "debug_on_error", true, booleanFlag, "true",
NULL),
YAP_FLAG(DEBUGGER_PRINT_OPTIONS_FLAG, "debugger_print_options", true, YAP_FLAG(DEBUGGER_PRINT_OPTIONS_FLAG, "debugger_print_options", true,
list_option, list_option,
"[quoted(true),numbervars(true),portrayed(true),max_depth(10)]", "[quoted(true),numbervars(true),portrayed(true),max_depth(10)]",
NULL), NULL),
YAP_FLAG(DEBUGGER_SHOW_CONTEXT_FLAG, "debugger_show_context", true, YAP_FLAG(DEBUGGER_SHOW_CONTEXT_FLAG, "debugger_show_context", true,
booleanFlag, "false", NULL), booleanFlag, "false", NULL),
YAP_FLAG(DEFAULT_PARENT_MODULE_FLAG, "default_parent_module", true, isatom,
"user", NULL),
/**< /**<
* A module to be inherited by all other modules. Default is user that * A module to be inherited by all other modules. Default is user that
* reexports prolog. * reexports prolog.
@ -167,13 +181,15 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
* Set it to `prolog` for SICStus Prolog like resolution, to `user` for * Set it to `prolog` for SICStus Prolog like resolution, to `user` for
* SWI-like. * SWI-like.
*/ */
YAP_FLAG(DIALECT_FLAG, "dialect", false, ro, "yap", NULL), YAP_FLAG(DEFAULT_PARENT_MODULE_FLAG, "default_parent_module", true, isatom,
"user", NULL),
/**< /**<
Read-only flag that always returns `yap`. Read-only flag that always returns `yap`.
*/ */
YAP_FLAG(DISCONTIGUOUS_WARNINGS_FLAG, "discontiguous_warnings", true, YAP_FLAG(DIALECT_FLAG, "dialect", false, ro, "yap", NULL),
booleanFlag, "true", NULL),
/**< /**<
If `true` (default `true`) YAP checks for definitions of the same predicate If `true` (default `true`) YAP checks for definitions of the same predicate
@ -184,35 +200,41 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
predicates. predicates.
*/ */
YAP_FLAG(DOLLAR_AS_LOWER_CASE_FLAG, "dollar_as_lower_case", true, YAP_FLAG(DISCONTIGUOUS_WARNINGS_FLAG, "discontiguous_warnings", true,
booleanFlag, "false", NULL), booleanFlag, "true", NULL),
/**< /**<
If `off` (default) consider the character `$` a control character, if If `off` (default) consider the character `$` a control character, if
vxu `on` consider `$` a lower case character. vxu `on` consider `$` a lower case character.
*/ */
YAP_FLAG(DOUBLE_QUOTES_FLAG, "double_quotes", true, isatom, "codes", dqs), YAP_FLAG(DOLLAR_AS_LOWER_CASE_FLAG, "dollar_as_lower_case", true,
booleanFlag, "false", NULL),
/**< iso /**< 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),
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(FAST_FLAG, "fast", true, booleanFlag, "false", NULL), YAP_FLAG(EXECUTABLE_FLAG, "executable", false, executable, "@boot", NULL),
/**< /**<
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),
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
@ -222,19 +244,22 @@ vxu `on` consider `$` a lower case character.
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(GC_FLAG, "gc", true, booleanFlag, "on", NULL), YAP_FLAG(FLOAT_FORMAT_FLAG, "float_format", true, isatom, "%.16f", 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_MARGIN_FLAG, "gc_margin", true, nat, "0", gc_margin), YAP_FLAG(GC_FLAG, "gc", true, booleanFlag, "on", NULL),
/**< `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_TRACE_FLAG, "gc_trace", true, isatom, "off", NULL), YAP_FLAG(GC_MARGIN_FLAG, "gc_margin", true, nat, "0", gc_margin),
/**< /**<
* *
If `off` (default) do not show information on garbage collection If `off` (default) do not show information on garbage collection
@ -244,8 +269,8 @@ vxu `on` consider `$` a lower case character.
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(GENERATE_DEBUGGING_INFO_FLAG, "generate_debug_info", true, YAP_FLAG(GC_TRACE_FLAG, "gc_trace", true, isatom, "off", NULL),
booleanFlag, "true", NULL),
/**< ` /**< `
If `true` (default) generate debugging information for If `true` (default) generate debugging information for
@ -254,36 +279,41 @@ vxu `on` consider `$` a lower case character.
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(HOST_TYPE_FLAG, "host_type", false, isatom, HOST_ALIAS, NULL), YAP_FLAG(HOME_FLAG, "home", false, isatom, YAP_ROOTDIR, 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(INDEX_FLAG, "index", true, indexer, "multi", NULL), YAP_FLAG(HOST_TYPE_FLAG, "host_type", false, isatom, HOST_ALIAS, 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_SUB_TERM_SEARCH_DEPTH_FLAG, "index_sub_term_search_depth", YAP_FLAG(INDEX_FLAG, "index", true, indexer, "multi", NULL),
true, nat, "0", NULL),
/**< `Index_sub_term_search_depth ` /**< `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(INFORMATIONAL_MESSAGES_FLAG, "informational_messages", true, YAP_FLAG(INDEX_SUB_TERM_SEARCH_DEPTH_FLAG, "index_sub_term_search_depth",
isatom, "normal", NULL), true, nat, "0", 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
@ -291,17 +321,21 @@ vxu `on` consider `$` a lower case character.
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(INTEGER_ROUNDING_FUNCTION_FLAG, "integer_rounding_function", true, YAP_FLAG(INFORMATIONAL_MESSAGES_FLAG, "informational_messages", true,
isatom, "toward_zero", NULL), isatom, "normal", 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(JUPYTER_FLAG, "jupyter", false, booleanFlag, "true", NULL), /**< /**<
read-only boolean, a machine running Jupyter */ read-only boolean, a machine running Jupyter */
YAP_FLAG(LANGUAGE_FLAG, "language", true, isatom, "yap", NULL), YAP_FLAG(JUPYTER_FLAG, "jupyter", false, booleanFlag, "true", 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,
@ -311,21 +345,26 @@ vxu `on` consider `$` a lower case character.
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(PROLOG_LIBRARY_DIRECTORY_FLAG, "prolog_library_directory", true, YAP_FLAG(LANGUAGE_FLAG, "language", true, isatom, "yap", 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
library. Takes precedence over library_directory */ library. Takes precedence over library_directory */
YAP_FLAG(PROLOG_FOREIGN_DIRECTORY_FLAG, "prolog_foreign_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. */ 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), 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(PROLOG_FOREIGN_DIRECTORY_FLAG, "prolog_foreign_directory", true,
isatom, "", 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),
@ -336,16 +375,15 @@ vxu `on` consider `$` a lower case character.
"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_SHARED_OBJECT_FLAG, "open_shared_object", true, booleanFlag, YAP_FLAG(OPEN_EXPANDS_FILENAME_FLAG, "open_expands_filename", true,
"true", NULL), booleanFlag, "false", NULL),
/**< `open_shared_object ` /**< `open_shared_object `
If true, `open_shared_object/2` and friends are implemented, If true, `open_shared_object/2` and friends are implemented,
@ -358,6 +396,10 @@ vxu `on` consider `$` a lower case character.
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(OPEN_SHARED_OBJECT_FLAG, "open_shared_object", true, booleanFlag,
"true", NULL),
YAP_FLAG(MODULE_INDEPENDENT_OPERATORS_FLAG, "module_independent_operators", YAP_FLAG(MODULE_INDEPENDENT_OPERATORS_FLAG, "module_independent_operators",
true, booleanFlag, "false", NULL), true, booleanFlag, "false", NULL),
@ -365,7 +407,6 @@ vxu `on` consider `$` a lower case character.
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
@ -373,8 +414,8 @@ vxu `on` consider `$` a lower case character.
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(PROMPT_ALTERNATIVES_ON_FLAG, "prompt_alternatives_on", true, YAP_FLAG(PROFILING_FLAG, "profiling", true, booleanFlag, "false", NULL),
isatom, "determinism", NULL),
/**< `prompt_alternatives_on(atom, /**< `prompt_alternatives_on(atom,
changeable) ` changeable) `
@ -383,17 +424,20 @@ vxu `on` consider `$` a lower case character.
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(REDEFINE_WARNINGS_FLAG, "redefine_warnings", true, booleanFlag, YAP_FLAG(READLINE_FLAG, "readline", true, booleanFlag, "false",
"true", NULL), /**< Yap_InitReadline),
/**<
If _Value_ is unbound, tell whether warnings for procedures defined If _Value_ is unbound, tell whether warnings for procedures defined
in several different files are `on` or in several different files are `on` or
@ -401,43 +445,50 @@ in several different files are `on` or
and if it is bound to `off` disable them. The default for YAP is and if it is bound to `off` disable them. The default for YAP is
`off`, unless we are in `sicstus` or `iso` mode. `off`, unless we are in `sicstus` or `iso` mode.
*/ */
YAP_FLAG(REDEFINE_WARNINGS_FLAG, "redefine_warnings", true, booleanFlag,
"true", NULL),
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(SAVED_PROGRAM_FLAG, "saved_program", false, booleanFlag, "false", YAP_FLAG(RESOURCE_DATABASE_FLAG, "resource_database", false, isatom,
NULL),
YAP_BOOTSTRAP, 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(SHARED_OBJECT_EXTENSION_FLAG, "shared_object_extension", false, YAP_FLAG(SAVED_PROGRAM_FLAG, "saved_program", false, booleanFlag, "false",
isatom, SO_EXT, NULL), NULL),
/**< `shared_object_extension ` /**< `shared_object_extension `
Suffix associated with loadable code. Suffix associated with loadable code.
*/ */
YAP_FLAG(SHARED_OBJECT_SEARCH_PATH_FLAG, "shared_object_search_path", true, YAP_FLAG(SHARED_OBJECT_EXTENSION_FLAG, "shared_object_extension", false,
isatom, SO_PATH, NULL), isatom, SO_EXT, NULL),
/**< `shared_object_search_path `
/**<
Name of the environment variable used by the system to search for shared Name of the environment variable used by the system to search for shared
objects. objects.
*/ */
YAP_FLAG(SINGLE_QUOTES_FLAG, "single_quotes", true, isatom, "atom", sqf), YAP_FLAG(SHARED_OBJECT_SEARCH_PATH_FLAG, "shared_object_search_path", true,
/**< `single_quoted text is usuallly interpreted as atoms. This flagTerm isatom, SO_PATH, NULL),
allows other inerpretations such as strings_contains_strings */
YAP_FLAG(SINGLE_VAR_WARNINGS_FLAG, "single_var_warnings", true, booleanFlag, /**< single_quoted text is usuallly interpreted as atoms. This flag
"true", NULL), /**< allows other interpretations such as strings */
YAP_FLAG(SINGLE_QUOTES_FLAG, "single_quotes", true, isatom, "atom", sqf),
/**<
If `true` (default `true`) YAP checks for singleton If `true` (default `true`) YAP checks for singleton
variables when loading files. A singleton variable is a variables when loading files. A singleton variable is a
variable that appears ony once in a clause. The name variable that appears ony once in a clause. The name
@ -445,21 +496,24 @@ and if it is bound to `off` disable them. The default for YAP is
starts with underscore are never considered singleton. starts with underscore are never considered singleton.
*/ */
YAP_FLAG(SIGNALS_FLAG, "signals", true, booleanFlag, "true", NULL), YAP_FLAG(SINGLE_VAR_WARNINGS_FLAG, "single_var_warnings", true, booleanFlag,
/**< `signals` "true", NULL),
/**<
If `true` (default) YAP handles Signals such as `^C` If `true` (default) YAP handles Signals such as `^C`
(`SIGINT`). (`SIGINT`).
*/ */
YAP_FLAG(SOURCE_FLAG, "source", true, booleanFlag, "true", NULL), YAP_FLAG(SIGNALS_FLAG, "signals", true, booleanFlag, "true", NULL),
/**< `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(STRICT_ISO_FLAG, "strict_iso", true, booleanFlag, "false", NULL), YAP_FLAG(SOURCE_FLAG, "source", true, booleanFlag, "true", 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
@ -482,8 +536,8 @@ and if it is bound to `off` disable them. The default for YAP is
depends on a Prolog's platform specific features. depends on a Prolog's platform specific features.
*/ */
YAP_FLAG(SYSTEM_OPTIONS_FLAG, "system_options", false, options, YAP_FLAG(STRICT_ISO_FLAG, "strict_iso", true, booleanFlag, "false", NULL),
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
@ -492,19 +546,21 @@ and if it is bound to `off` disable them. The default for YAP is
`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_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
@ -513,6 +569,9 @@ and if it is bound to `off` disable them. The default for YAP is
backtracked into. backtracked into.
*/ */
YAP_FLAG(TOPLEVEL_HOOK_FLAG, "toplevel_hook", true, booleanFlag, "true",
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_PRINT_OPTIONS_FLAG, "toplevel_print_options", true, YAP_FLAG(TOPLEVEL_PRINT_OPTIONS_FLAG, "toplevel_print_options", true,
@ -521,7 +580,6 @@ and if it is bound to `off` disable them. The default for YAP is
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
@ -537,9 +595,11 @@ and if it is bound to `off` disable them. The default for YAP is
procedures follow logical semantics but the internal data base still procedures follow logical semantics but the internal data base still
follows immediate semantics. follows immediate semantics.
*/ */
YAP_FLAG(UNIX_FLAG, "unix", false, ro, "true", NULL),
YAP_FLAG(UPDATE_SEMANTICS_FLAG, "update_semantics", true, isatom, "logical", YAP_FLAG(UPDATE_SEMANTICS_FLAG, "update_semantics", true, isatom, "logical",
NULL), NULL),
YAP_FLAG(USER_FLAGS_FLAG, "user_flags", true, isatom, "error", NULL),
/**< /**<
`user_flags ` `user_flags `
@ -551,18 +611,20 @@ and if it is bound to `off` disable them. The default for YAP is
developers are encouraged to use `create_prolog_flag/3` to create flags for developers are encouraged to use `create_prolog_flag/3` to create flags for
their library. their library.
*/ */
YAP_FLAG(UNKNOWN_FLAG, "unknown", true, isatom, "error", Yap_unknown), YAP_FLAG(USER_FLAGS_FLAG, "user_flags", true, isatom, "error", NULL),
/**< `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 `
If `normal` allow printing of informational and banner messages, If `normal` allow printing of informational and banner messages,
such as the ones that are printed when consulting. If `silent` such as the ones that are printed when consulting. If `silent`
@ -570,66 +632,75 @@ and if it is bound to `off` disable them. The default for YAP is
YAP is booted with the `-q` or `-L` flag. YAP is booted with the `-q` or `-L` flag.
*/ */
YAP_FLAG(VERBOSE_FILE_SEARCH_FLAG, "verbose_file_search", true, booleanFlag, YAP_FLAG(VERBOSE_FLAG, "verbose", true, isatom, "normal", NULL),
"false", NULL),
/**< `verbose_file_search ` /**<
If `true` allow printing of informational messages when If `true` allow printing of informational messages when
searching for file names. If `false` disable printing these messages. It searching for file names. If `false` disable printing these messages. It
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_LOAD_FLAG, "verbose_load", true, booleanFlag, "true", NULL), YAP_FLAG(VERBOSE_FILE_SEARCH_FLAG, "verbose_file_search", true, booleanFlag,
/**< `verbose_load ` "false", NULL),
/**<
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 `true` by default except if YAP is booted with the `-L` is `true` by default except if YAP is booted with the `-L`
flag. flag.
*/ */
YAP_FLAG(VERSION_FLAG, "version", false, nat, YAP_NUMERIC_VERSION, NULL), YAP_FLAG(VERBOSE_LOAD_FLAG, "verbose_load", true, booleanFlag, "true", NULL),
/**< /**<
`version ` Read-only flag that returns a compound term with the Read-only flag that returns a compound term with the
current version of YAP. The term will have the name `yap` and arity 4, the current version of YAP. The term will have the name `yap` and arity 4, the
first argument will be the major version, the second the minor version, the first argument will be the major version, the second the minor version, the
third the patch number, and the last one is reserved. third the patch number, and the last one is reserved.
*/ */
YAP_FLAG(VERSION_DATA_FLAG, "version_data", false, ro, YAP_TVERSION, NULL), YAP_FLAG(VERSION_FLAG, "version", false, nat, YAP_NUMERIC_VERSION, NULL),
/**< `version_data `
/**<
Read-only flag that unifies with a number of the form Read-only flag that unifies with a number of the form
`_Major_ * 100000 + _Minor_ *100 + _Patch_`, where `_Major_ * 100000 + _Minor_ *100 + _Patch_`, where
_Major_ is the major version, _Minor_ is the minor version, _Major_ is the major version, _Minor_ is the minor version,
and _Patch_ is the patch number. and _Patch_ is the patch number.
*/ */
YAP_FLAG(VERSION_GIT_FLAG, "version_git", false, isatom, YAP_GIT_HEAD, YAP_FLAG(VERSION_DATA_FLAG, "version_data", false, ro, YAP_TVERSION, NULL),
NULL),
/**< `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(WRITE_ATTRIBUTES_FLAG, "write_attributes", true, isatom, "ignore", YAP_FLAG(VERSION_GIT_FLAG, "version_git", false, isatom, YAP_GIT_HEAD,
NULL), NULL),
#if __WINDOWS__
/**< `windows` /**<
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 Windows machine. running on an Windows machine.
*/ */
YAP_FLAG(WRITE_ATTRIBUTES_FLAG, "write_attributes", true, isatom, "ignore",
NULL),
#if __WINDOWS__
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 `
Writable flag telling whether the system should write lists of Writable flag telling whether the system should write lists of
integers that are writable character codes using the list notation. It integers that are writable character codes using the list notation. It
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

@ -1,5 +1,3 @@
/************************************************************************* /*************************************************************************
* * * *
* YAP Prolog * * YAP Prolog *
@ -28,14 +26,13 @@
START_LOCAL_FLAGS START_LOCAL_FLAGS
/** + `autoload`: set the system to look for undefined procedures */ /**< set the system to look for undefined procedures */
YAP_FLAG(AUTOLOAD_FLAG, "autoload", true, booleanFlag, "false", NULL), YAP_FLAG(AUTOLOAD_FLAG, "autoload", true, booleanFlag, "false", NULL),
/** + `read-only flag, that tells if Prolog is in an inner top-level */ /**<`read-only flag, that tells if Prolog is in an inner top-level */
YAP_FLAG(BREAK_LEVEL_FLAG, "break_level", true, nat, "0", NULL), YAP_FLAG(BREAK_LEVEL_FLAG, "break_level", true, nat, "0", NULL),
/** + `call_counting` /**<
Predicates compiled with this flag set maintain a counter Predicates compiled with this flag set maintain a counter
on the numbers of proceduree calls and of retries. These counters on the numbers of proceduree calls and of retries. These counters
are decreasing counters, and they can be used as timers. Three are decreasing counters, and they can be used as timers. Three
@ -55,7 +52,7 @@ YAP_FLAG(AUTOLOAD_FLAG, "autoload", true, booleanFlag, "false", NULL),
YAP_FLAG(CALL_COUNTING_FLAG, "call_counting", true, booleanFlag, "true", YAP_FLAG(CALL_COUNTING_FLAG, "call_counting", true, booleanFlag, "true",
NULL), NULL),
/** + support for coding systens, YAP relies on UTF-8 internally. /**< support for coding systens, YAP relies on UTF-8 internally.
*/ */
YAP_FLAG(ENCODING_FLAG, "encoding", true, isatom, "utf-8", getenc), YAP_FLAG(ENCODING_FLAG, "encoding", true, isatom, "utf-8", getenc),
@ -63,28 +60,25 @@ YAP_FLAG(AUTOLOAD_FLAG, "autoload", true, booleanFlag, "false", NULL),
*/ */
YAP_FLAG(FILEERRORS_FLAG, "fileerrors", true, booleanFlag, "true", YAP_FLAG(FILEERRORS_FLAG, "fileerrors", true, booleanFlag, "true",
NULL), /** + `fileerrors` NULL),
If `on` `fileerrors` is `on`, if `off` (default) /**<
`fileerrors` is disabled.
*/
/** + `language_mode`
wweter native mode or trying to emulate a different whether native mode or trying to emulate a different
Prolog. Prolog.
*/ */
YAP_FLAG(LANGUAGE_MODE_FLAG, "language_mode", true, isatom, "yap", YAP_FLAG(LANGUAGE_MODE_FLAG, "language_mode", true, isatom, "yap",
NULL), NULL),
YAP_FLAG(STACK_DUMP_ON_ERROR_FLAG, "stack_dump_on_error", true, booleanFlag, YAP_FLAG(STACK_DUMP_ON_ERROR_FLAG, "stack_dump_on_error", true, booleanFlag,
"true", NULL), /** + `stack_dump_on_error ` "true", NULL),
/**<`
If `true` show a stack dump when YAP finds an error. The default is If `true` show a stack dump when YAP finds an error. The default is
`off`. `off`.
*/ */
YAP_FLAG(STREAM_TYPE_CHECK_FLAG, "stream_type_check", true, isatom, "loose", YAP_FLAG(STREAM_TYPE_CHECK_FLAG, "stream_type_check", true, isatom, "loose",
NULL), NULL),
YAP_FLAG(SYNTAX_ERRORS_FLAG, "syntax_errors", true, synerr, "error", /** + `syntax_errors`
NULL), /** + `syntax_errors`
Control action to be taken after syntax errors while executing read/1, Control action to be taken after syntax errors while executing read/1,
`read/2`, or `read_term/3`: `read/2`, or `read_term/3`:
@ -97,16 +91,18 @@ Report the syntax error and generate an error (default).
+ `quiet` + `quiet`
Just fail Just fail
*/ */
YAP_FLAG(TYPEIN_MODULE_FLAG, "typein_module", true, isatom, "user", YAP_FLAG(SYNTAX_ERRORS_FLAG, "syntax_errors", true, synerr, "error",
typein), /** + `typein_module ` NULL),
/**<
If bound, set the current working or type-in module to the argument, If bound, set the current working or type-in module to the argument,
which must be an atom. If unbound, unify the argument with the current which must be an atom. If unbound, unify the argument with the current
working module. working module.
*/ */
YAP_FLAG(TYPEIN_MODULE_FLAG, "typein_module", true, isatom, "user",
typein),
YAP_FLAG(USER_ERROR_FLAG, "user_error", true, stream, "user_error", YAP_FLAG(USER_ERROR_FLAG, "user_error", true, stream, "user_error",
set_error_stream), /** + `user_error1` set_error_stream), /**<
If the second argument is bound to a stream, set user_error to If the second argument is bound to a stream, set user_error to
this stream. If the second argument is unbound, unify the argument with this stream. If the second argument is unbound, unify the argument with
@ -140,7 +136,7 @@ automatically redirects the user_error alias to the original
YAP_FLAG(USER_INPUT_FLAG, "user_input", true, stream, "user_input", YAP_FLAG(USER_INPUT_FLAG, "user_input", true, stream, "user_input",
set_input_stream), set_input_stream),
YAP_FLAG(USER_OUTPUT_FLAG, "user_output", true, stream, "user_output", YAP_FLAG(USER_OUTPUT_FLAG, "user_output", true, stream, "user_output",
set_output_stream), set_output_stream)
END_LOCAL_FLAGS END_LOCAL_FLAGS

View File

@ -146,20 +146,6 @@
<files visible="yes" title=""/> <files visible="yes" title=""/>
<namespaces visible="yes" title=""/> <namespaces visible="yes" title=""/>
<classes visible="no" title=""/> <classes visible="no" title=""/>
<defines title=""/>
<typedefs title=""/>
<enums title=""/>
<enumvalues title=""/>
<functions title=""/>
<variables title=""/>
<signals title=""/>
<publicslots title=""/>
<protectedslots title=""/>
<privateslots title=""/>
<events title=""/>
<properties title=""/>
<friends title=""/>
<membergroups visible="yes"/>
</memberdecl> </memberdecl>
<memberdef> <memberdef>
<pagedocs/> <pagedocs/>
@ -177,7 +163,23 @@
<events title=""/> <events title=""/>
<properties title=""/> <properties title=""/>
<friends title=""/> <friends title=""/>
<membergroups visible="yes"/>
</memberdef> </memberdef>
<memberdecl>
<defines title=""/>
<typedefs title=""/>
<enums title=""/>
<enumvalues title=""/>
<functions title=""/>
<variables title=""/>
<signals title=""/>
<publicslots title=""/>
<protectedslots title=""/>
<privateslots title=""/>
<events title=""/>
<properties title=""/>
<friends title=""/>
</memberdecl>
<authorsection visible="yes"/> <authorsection visible="yes"/>
</group> </group>

View File

@ -31,20 +31,3 @@
portray_clause/2, % +Stream, +Clause portray_clause/2, % +Stream, +Clause
portray_clause/3 % +Stream, +Clause, +Options portray_clause/3 % +Stream, +Clause, +Options
]). ]).
/*
* @defgroup swi_listing SWI Prolog listing emulation
* @ingroup library
emulates listing.pl, but just the interface for now.
*/
:- meta_predicate portray_clause( +, + , : ).
portray_clause(Stream, Term, M:Options) :-
portray_clause( Stream, Term ).

View File

@ -318,7 +318,6 @@ portray_clause(Clause) :-
'$beautify_vs'(T) :- '$beautify_vs'(T) :-
'$non_singletons_in_term'(T,[],Fs), '$non_singletons_in_term'(T,[],Fs),
writeln(Fs),
'$vv_transform'(Fs,1), '$vv_transform'(Fs,1),
term_variables(T, NFs), term_variables(T, NFs),
'$v_transform'(NFs). '$v_transform'(NFs).