Errors in C++
This commit is contained in:
parent
9ea75834ff
commit
8607aee725
59
CXX/yapi.cpp
59
CXX/yapi.cpp
@ -29,6 +29,25 @@ X_API void YAP_UserBackCPredicate(const char *, YAP_UserCPred, YAP_UserCPred,
|
|||||||
#if YAP_PYTHON
|
#if YAP_PYTHON
|
||||||
X_API bool do_init_python(void);
|
X_API bool do_init_python(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void YAPCatchError()
|
||||||
|
{
|
||||||
|
if (LOCAL_CommittedError != nullptr &&
|
||||||
|
LOCAL_CommittedError->errorNo != YAP_NO_ERROR ) {
|
||||||
|
// Yap_PopTermFromDB(info->errorTerm);
|
||||||
|
// throw throw YAPError( );
|
||||||
|
Term es[2];
|
||||||
|
es[0] = TermError;
|
||||||
|
es[1] = MkErrorTerm(LOCAL_CommittedError);
|
||||||
|
LOCAL_CommittedError = nullptr;
|
||||||
|
Functor f = Yap_MkFunctor(Yap_LookupAtom("print_message"), 2);
|
||||||
|
YAP_RunGoalOnce(Yap_MkApplTerm(f, 2, es));
|
||||||
|
// Yap_PopTermFromDB(info->errorTerm);
|
||||||
|
// throw throw YAPError( SOURCE(), );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
YAPPredicate::YAPPredicate(Term &t, Term &tmod, CELL *&ts, const char *pname) {
|
YAPPredicate::YAPPredicate(Term &t, Term &tmod, CELL *&ts, const char *pname) {
|
||||||
@ -486,13 +505,8 @@ bool YAPEngine::call(YAPPredicate ap, YAPTerm ts[]) {
|
|||||||
// don't forget, on success these bindings will still be there);
|
// don't forget, on success these bindings will still be there);
|
||||||
result = YAP_LeaveGoal(false, &q);
|
result = YAP_LeaveGoal(false, &q);
|
||||||
|
|
||||||
if (LOCAL_CommittedError != nullptr) {
|
YAPCatchError();
|
||||||
std::cerr << "Exception received by " << __func__ << "( "
|
|
||||||
<< YAPError(LOCAL_CommittedError).text()
|
|
||||||
<< ").\n Forwarded...\n\n";
|
|
||||||
// Yap_PopTermFromDB(info->errorTerm);
|
|
||||||
// throw throw YAPError( SOURCE(), );
|
|
||||||
}
|
|
||||||
Yap_CloseHandles(q.CurSlot);
|
Yap_CloseHandles(q.CurSlot);
|
||||||
RECOVER_MACHINE_REGS();
|
RECOVER_MACHINE_REGS();
|
||||||
return result;
|
return result;
|
||||||
@ -551,17 +565,11 @@ bool YAPEngine::mgoal(Term t, Term tmod) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
if (LOCAL_CommittedError != nullptr &&
|
YAPCatchError();
|
||||||
LOCAL_CommittedError->errorNo != YAP_NO_ERROR) {
|
|
||||||
std::cerr << "Exception received by " << __func__ << "( "
|
|
||||||
<< YAPError(LOCAL_CommittedError).text()
|
|
||||||
<< ").\n Forwarded...\n\n";
|
|
||||||
YAP_LeaveGoal(result, &q);
|
|
||||||
|
|
||||||
// free(LOCAL_CommittedError);
|
// free(LOCAL_CommittedError);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void YAPEngine::release() {
|
void YAPEngine::release() {
|
||||||
@ -617,13 +625,7 @@ Term YAPEngine::fun(Term t) {
|
|||||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "exec ");
|
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "exec ");
|
||||||
|
|
||||||
bool result = (bool)YAP_EnterGoal(ap, nullptr, &q);
|
bool result = (bool)YAP_EnterGoal(ap, nullptr, &q);
|
||||||
if (LOCAL_CommittedError != nullptr) {
|
YAPCatchError();
|
||||||
std::cerr << "Exception received by " << __func__ << "( "
|
|
||||||
<< YAPError(LOCAL_CommittedError).text()
|
|
||||||
<< ").\n Forwarded...\n\n";
|
|
||||||
// Yap_PopTermFromDB(info->errorTerm);
|
|
||||||
// throw throw YAPError( SOURCE(), );
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
YAP_LeaveGoal(result, &q);
|
YAP_LeaveGoal(result, &q);
|
||||||
// PyEval_RestoreThread(_save);
|
// PyEval_RestoreThread(_save);
|
||||||
@ -739,17 +741,7 @@ bool YAPQuery::next() {
|
|||||||
YAP_LeaveGoal(false, &q_h);
|
YAP_LeaveGoal(false, &q_h);
|
||||||
Yap_CloseHandles(q_handles);
|
Yap_CloseHandles(q_handles);
|
||||||
q_open = false;
|
q_open = false;
|
||||||
if (LOCAL_CommittedError != nullptr) {
|
YAPCatchError();
|
||||||
// Yap_PopTermFromDB(info->errorTerm);
|
|
||||||
// throw throw YAPError( );
|
|
||||||
Term es[2];
|
|
||||||
es[0] = TermError;
|
|
||||||
es[1] = MkErrorTerm(LOCAL_CommittedError);
|
|
||||||
Functor f = Yap_MkFunctor(Yap_LookupAtom("print_message"), 2);
|
|
||||||
YAP_RunGoalOnce(Yap_MkApplTerm(f, 2, es));
|
|
||||||
// Yap_PopTermFromDB(info->errorTerm);
|
|
||||||
// throw throw YAPError( SOURCE(), );
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
q_handles = Yap_StartSlots();
|
q_handles = Yap_StartSlots();
|
||||||
}
|
}
|
||||||
@ -926,9 +918,6 @@ PredEntry *YAPPredicate::getPred(YAPTerm &tt, CELL *&outp) {
|
|||||||
Term m = Yap_CurrentModule(), t = tt.term();
|
Term m = Yap_CurrentModule(), t = tt.term();
|
||||||
t = Yap_StripModule(t, &m);
|
t = Yap_StripModule(t, &m);
|
||||||
|
|
||||||
std::cerr << "Exception received by " << __func__ << "( " << tt.text()
|
|
||||||
<< ").\n Forwarded...\n\n";
|
|
||||||
|
|
||||||
if (IsVarTerm(t) || IsNumTerm(t)) {
|
if (IsVarTerm(t) || IsNumTerm(t)) {
|
||||||
if (IsVarTerm(t))
|
if (IsVarTerm(t))
|
||||||
throw YAPError(SOURCE(), INSTANTIATION_ERROR, tt.term(), 0);
|
throw YAPError(SOURCE(), INSTANTIATION_ERROR, tt.term(), 0);
|
||||||
|
247
H/YapGFlagInfo.h
247
H/YapGFlagInfo.h
@ -45,9 +45,8 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
|||||||
|
|
||||||
YAP_FLAG(ALLOW_VARIABLE_NAME_AS_FUNCTOR_FLAG,
|
YAP_FLAG(ALLOW_VARIABLE_NAME_AS_FUNCTOR_FLAG,
|
||||||
"allow_variable_name_as_functor", false, booleanFlag, "false",
|
"allow_variable_name_as_functor", false, booleanFlag, "false",
|
||||||
NULL), /**<
|
NULL),/**<
|
||||||
|
boolean flag to enable syntax such
|
||||||
boolean flag allows syntax such
|
|
||||||
as
|
as
|
||||||
~~~
|
~~~
|
||||||
Tree(Node(L,node,R)) :-
|
Tree(Node(L,node,R)) :-
|
||||||
@ -55,24 +54,34 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
|||||||
Tree(R).
|
Tree(R).
|
||||||
~~~
|
~~~
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**< `answer_format` how to present answers, default is `~p`. */
|
|
||||||
YAP_FLAG(ANSWER_FORMAT_FLAG, "answer_format", true, isatom, "~p", NULL),
|
YAP_FLAG(ANSWER_FORMAT_FLAG, "answer_format", true, isatom, "~p", NULL),
|
||||||
|
/**< how to present answers, default is `~p`. */
|
||||||
|
|
||||||
#if __APPLE__
|
#if __APPLE__
|
||||||
YAP_FLAG(APPLE_FLAG, "apple", false, booleanFlag, "true", NULL), /**<
|
YAP_FLAG(APPLE_FLAG, "apple", false, booleanFlag, "true", NULL), /**<
|
||||||
`read-only boolean, a machine running an Apple Operating System *
|
`read-only boolean, true if in a machine running an Apple Operating System *
|
||||||
*
|
*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
YAP_FLAG(ARCH_FLAG, "arch", false, isatom, YAP_ARCH, NULL),/**<
|
YAP_FLAG(ARCH_FLAG, "arch", false, isatom, YAP_ARCH, NULL),/**<
|
||||||
`apple`: read-only atom, it describes the ISA used in this version of YAP.
|
read-only atom, it describes the ISA used in this version of YAP.
|
||||||
Available from YAP_AEH.
|
Extracted from YAP_ARCH.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
YAP_FLAG(ARGV_FLAG, "argv", false, argv, "@boot", NULL),
|
YAP_FLAG(ARGV_FLAG, "argv", false, argv, "@boot", NULL), /**<
|
||||||
/**< `arithmetic_exceptions`
|
* read-only flag that stores the arguments passed from the calling program to the Prolog system,
|
||||||
|
*
|
||||||
|
* As an example, if YAP was called as follows:
|
||||||
|
* ~~~~~
|
||||||
|
* yap -l script -z main -- /home 33
|
||||||
|
* ~~~~
|
||||||
|
* the finall two arguments would be available as:
|
||||||
|
* ['home'. '33']
|
||||||
|
*/
|
||||||
|
|
||||||
|
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
|
||||||
Prolog exceptions. If enabled:
|
Prolog exceptions. If enabled:
|
||||||
@ -92,79 +101,81 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
|||||||
It is `true` by default, but it is disabled by packages like CLP(BN) and
|
It is `true` by default, but it is disabled by packages like CLP(BN) and
|
||||||
ProbLog.
|
ProbLog.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(ARITHMETIC_EXCEPTIONS_FLAG, "arithmetic_exceptions", true,
|
YAP_FLAG(BACK_QUOTES_FLAG, "back_quotes", true, isatom, "true", NULL),
|
||||||
booleanFlag, "true", NULL),
|
|
||||||
/**>
|
/**>
|
||||||
If _Value_ is unbound, tell whether a back quoted list of characters
|
If _Value_ is unbound, tell whether a back quoted list of characters
|
||||||
token is converted to a list of atoms, `chars`, to a list of integers,
|
token is converted to a list of atoms, `chars`, to a list of integers,
|
||||||
`codes`, or to a single atom, `atom`. If _Value_ is bound, set to
|
`codes`, or to a single atom, `atom`. If _Value_ is bound, set to
|
||||||
the corresponding behavior. The default value is `string`
|
the corresponding behavior. The default value is `string`
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(BACK_QUOTES_FLAG, "back_quotes", true, isatom, "true", NULL),
|
|
||||||
|
YAP_FLAG(BOUNDED_FLAG, "bounded", false, booleanFlag, "false", NULL),
|
||||||
/**< `bounded` is iso
|
/**< `bounded` is iso
|
||||||
|
|
||||||
Read-only flag telling whether integers are bounded. The value depends
|
Read-only flag telling whether integers are bounded. The value depends
|
||||||
on whether YAP uses the GMP library or not.
|
on whether YAP uses the GMP library or not.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
YAP_FLAG(BOUNDED_FLAG, "bounded", false, booleanFlag, "false", NULL),
|
|
||||||
YAP_FLAG(C_CC_FLAG, "c_cc", false, isatom, C_CC, NULL),
|
YAP_FLAG(C_CC_FLAG, "c_cc", false, isatom, C_CC, NULL),
|
||||||
|
/**< C compiler used to compile YAP. */
|
||||||
YAP_FLAG(C_CFLAGS_FLAG, "c_cflags", false, isatom, C_CFLAGS, NULL),
|
YAP_FLAG(C_CFLAGS_FLAG, "c_cflags", false, isatom, C_CFLAGS, NULL),
|
||||||
|
/**< preprocessor flags that were used to compile YAP */
|
||||||
YAP_FLAG(C_LDFLAGS_FLAG, "c_ldflags", false, isatom, C_LDFLAGS, NULL),
|
YAP_FLAG(C_LDFLAGS_FLAG, "c_ldflags", false, isatom, C_LDFLAGS, NULL),
|
||||||
|
/**< flags used to link YAP */
|
||||||
YAP_FLAG(C_LIBPLSO_FLAG, "c_libplso", false, isatom, C_LIBPLSO, NULL),
|
YAP_FLAG(C_LIBPLSO_FLAG, "c_libplso", false, isatom, C_LIBPLSO, NULL),
|
||||||
|
/**< name of YAP as a dynamic librar */
|
||||||
YAP_FLAG(C_LIBS_FLAG, "c_libs", false, isatom, C_LIBS, NULL),
|
YAP_FLAG(C_LIBS_FLAG, "c_libs", false, isatom, C_LIBS, NULL),
|
||||||
/**< `char_conversion is iso`
|
/**< libraries use to link YAP' */
|
||||||
|
YAP_FLAG(CHAR_CONVERSION_FLAG, "char_conversion", true, booleanFlag,
|
||||||
|
"false", NULL), /**<
|
||||||
Writable flag telling whether a character conversion table is used when
|
Writable flag telling whether a character conversion table is used when
|
||||||
reading terms. The default value for this flag is `off` except in
|
reading terms. The default value for this flag is `off` except in
|
||||||
`sicstus` and `iso` language modes, where it is `on`.
|
`sicstus` and `iso` language modes, where it is `on`.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(CHAR_CONVERSION_FLAG, "char_conversion", true, booleanFlag,
|
|
||||||
"false", NULL),
|
|
||||||
/**< `character_escapes is iso `
|
|
||||||
|
|
||||||
|
|
||||||
|
YAP_FLAG(CHARACTER_ESCAPES_FLAG, "character_escapes", true, booleanFlag,
|
||||||
|
"true", NULL),/**<
|
||||||
Writable flag telling whether a character escapes are enables,
|
Writable flag telling whether a character escapes are enables,
|
||||||
`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(CHARACTER_ESCAPES_FLAG, "character_escapes", true, booleanFlag,
|
|
||||||
"true", NULL),
|
|
||||||
YAP_FLAG(COLON_SETS_CALLING_CONTEXT_FLAG, "colon_sets_calling_context",
|
YAP_FLAG(COLON_SETS_CALLING_CONTEXT_FLAG, "colon_sets_calling_context",
|
||||||
true, booleanFlag, "true", NULL),
|
true, booleanFlag, "true", NULL),
|
||||||
/**< `compiled_at `
|
/**< use colom to set the caller module, and override the current default module. */
|
||||||
|
YAP_FLAG(COMPILED_AT_FLAG, "compiled_at", false, isatom, YAP_COMPILED_AT,
|
||||||
|
NULL), /**< `compiled_at `
|
||||||
|
|
||||||
Read-only flag that gives the time when the main YAP binary was compiled. It
|
Read-only flag that gives the time when the main YAP binary was compiled. It
|
||||||
is obtained staight from the __TIME__ macro, as defined in the C99.
|
is obtained staight from the __TIME__ macro, as defined in the C99.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(COMPILED_AT_FLAG, "compiled_at", false, isatom, YAP_COMPILED_AT,
|
|
||||||
NULL),
|
|
||||||
/**< `debug is iso `
|
YAP_FLAG(DEBUG_FLAG, "debug", true, booleanFlag, "false", NULL),/**< `debug is iso `
|
||||||
|
|
||||||
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),/**< generate debugging data */
|
||||||
YAP_FLAG(DEBUG_INFO_FLAG, "debug_info", true, booleanFlag, "true", NULL),
|
|
||||||
YAP_FLAG(DEBUG_ON_ERROR_FLAG, "debug_on_error", true, booleanFlag, "true",
|
YAP_FLAG(DEBUG_ON_ERROR_FLAG, "debug_on_error", true, booleanFlag, "true",
|
||||||
NULL),
|
NULL), /**< call debugger on generating an error */
|
||||||
/**< `debugger_print_options `
|
|
||||||
|
|
||||||
If bound, set the argument to the `write_term/3` options the
|
|
||||||
debugger uses to write terms. If unbound, show the current options.
|
|
||||||
*/
|
|
||||||
YAP_FLAG(DEBUGGER_PRINT_OPTIONS_FLAG, "debugger_print_options", true,
|
YAP_FLAG(DEBUGGER_PRINT_OPTIONS_FLAG, "debugger_print_options", true,
|
||||||
list_option,
|
list_option,
|
||||||
"[quoted(true),numbervars(true),portrayed(true),max_depth(10)]",
|
"[quoted(true),numbervars(true),portrayed(true),max_depth(10)]",
|
||||||
NULL),
|
NULL), /**<
|
||||||
|
If bound, set the argument to the `write_term/3` options the
|
||||||
|
debugger uses to write terms. If unbound, show the current options.
|
||||||
|
*/
|
||||||
YAP_FLAG(DEBUGGER_SHOW_CONTEXT_FLAG, "debugger_show_context", true,
|
YAP_FLAG(DEBUGGER_SHOW_CONTEXT_FLAG, "debugger_show_context", true,
|
||||||
booleanFlag, "false", NULL),
|
booleanFlag, "false", NULL), /**<
|
||||||
/**< `dialect `
|
* always show the current source module while debugging. YAP will only show the calling module if not `prolog`oy `user`*/
|
||||||
|
|
||||||
|
YAP_FLAG(DIALECT_FLAG, "dialect", false, ro, "yap", NULL), /**<
|
||||||
Read-only flag that always returns `yap`.
|
Read-only flag that always returns `yap`.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(DIALECT_FLAG, "dialect", false, ro, "yap", NULL),
|
YAP_FLAG(DISCONTIGUOUS_WARNINGS_FLAG, "discontiguous_warnings", true,
|
||||||
/**< `discontiguous_warnings `
|
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
|
||||||
that are separated by clauses for other predicates. This may indicate that
|
that are separated by clauses for other predicates. This may indicate that
|
||||||
different procedures have the same name.
|
different procedures have the same name.
|
||||||
@ -173,39 +184,41 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
|||||||
predicates.
|
predicates.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(DISCONTIGUOUS_WARNINGS_FLAG, "discontiguous_warnings", true,
|
|
||||||
booleanFlag, "true", NULL),
|
YAP_FLAG(DOLLAR_AS_LOWER_CASE_FLAG, "dollar_as_lower_case", true,
|
||||||
/**< `dollar_as_lower_case `
|
booleanFlag, "false", NULL), /**< `dollar_as_lower_case `
|
||||||
|
|
||||||
If `off` (default) consider the character `$` a control character, if
|
If `off` (default) consider the character `$` a control character, if
|
||||||
`on` consider `$` a lower case character.
|
`on` consider `$` a lower case character.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(DOLLAR_AS_LOWER_CASE_FLAG, "dollar_as_lower_case", true,
|
|
||||||
booleanFlag, "false", NULL),
|
|
||||||
/**< `double_quotes is iso `
|
YAP_FLAG(DOUBLE_QUOTES_FLAG, "double_quotes", true, isatom, "codes", dqs),/**< `double_quotes is iso `
|
||||||
|
|
||||||
If _Value_ is unbound, tell whether a double quoted list of characters
|
If _Value_ is unbound, tell whether a double quoted list of characters
|
||||||
token is converted to a list of atoms, `chars`, to a list of integers,
|
token is converted to a list of atoms, `chars`, to a list of integers,
|
||||||
`codes`, or to a single atom, `atom`. If _Value_ is bound, set to
|
`codes`, or to a single atom, `atom`. If _Value_ is bound, set to
|
||||||
the corresponding behavior. The default value is `codes`. */
|
the corresponding behavior. The default value is `codes`. */
|
||||||
YAP_FLAG(DOUBLE_QUOTES_FLAG, "double_quotes", true, isatom, "codes", dqs),
|
|
||||||
YAP_FLAG(EDITOR_FLAG, "editor", true, isatom, "$EDITOR", NULL),
|
YAP_FLAG(EDITOR_FLAG, "editor", true, isatom, "$EDITOR", NULL), /**<
|
||||||
/**< `executable `
|
* Report the current default editor, as defined by the environment variable EDITOR.
|
||||||
|
*/
|
||||||
|
|
||||||
|
YAP_FLAG(EXECUTABLE_FLAG, "executable", false, executable, "@boot", NULL),/**<
|
||||||
|
|
||||||
Read-only flag. It unifies with an atom that gives the
|
Read-only flag. It unifies with an atom that gives the
|
||||||
original program path.
|
original program path.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(EXECUTABLE_FLAG, "executable", false, executable, "@boot", NULL),
|
|
||||||
/**< `fast `
|
YAP_FLAG(FAST_FLAG, "fast", true, booleanFlag, "false", NULL),/**< `fast `
|
||||||
|
|
||||||
If `on` allow fast machine code, if `off` (default) disable it. Only
|
If `on` allow fast machine code, if `off` (default) disable it. Only
|
||||||
available in experimental implementations.
|
available in experimental implementations.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(FAST_FLAG, "fast", true, booleanFlag, "false", NULL),
|
|
||||||
YAP_FLAG(FILE_NAME_VARIABLES_FLAG, "file_name_variables", true, booleanFlag,
|
YAP_FLAG(FILE_NAME_VARIABLES_FLAG, "file_name_variables", true, booleanFlag,
|
||||||
"true", NULL),
|
"true", NULL),/**< non-implemented */
|
||||||
/**< + `float_format `
|
|
||||||
|
|
||||||
|
YAP_FLAG(FLOAT_FORMAT_FLAG, "float_format", true, isatom, "%.16f", NULL),/**<
|
||||||
C-library `printf()` format specification used by write/1 and
|
C-library `printf()` format specification used by write/1 and
|
||||||
friends to determine how floating point numbers are printed. The
|
friends to determine how floating point numbers are printed. The
|
||||||
default is `%.15g`. The specified value is passed to `printf()`
|
default is `%.15g`. The specified value is passed to `printf()`
|
||||||
@ -213,21 +226,18 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
|||||||
printed, `%g` will print all floats using 6 digits instead of the
|
printed, `%g` will print all floats using 6 digits instead of the
|
||||||
default 15.
|
default 15.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(FLOAT_FORMAT_FLAG, "float_format", true, isatom, "%.16f", NULL),
|
|
||||||
/**< `gc`
|
|
||||||
|
|
||||||
|
YAP_FLAG(GC_FLAG, "gc", true, booleanFlag, "on", NULL),/**<
|
||||||
If `on` allow garbage collection (default), if `off` disable it.
|
If `on` allow garbage collection (default), if `off` disable it.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(GC_FLAG, "gc", true, booleanFlag, "on", NULL),
|
|
||||||
/**< `gc_margin `
|
|
||||||
|
|
||||||
|
YAP_FLAG(GC_MARGIN_FLAG, "gc_margin", true, nat, "0", gc_margin),/**<
|
||||||
Set or show the minimum free stack before starting garbage
|
Set or show the minimum free stack before starting garbage
|
||||||
collection. The default depends on total stack size.
|
collection. The default depends on total stack size.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(GC_MARGIN_FLAG, "gc_margin", true, nat, "0", gc_margin),
|
YAP_FLAG(GC_TRACE_FLAG, "gc_trace", true, isatom, "off", NULL),
|
||||||
/**< `gc_trace `
|
/**< `
|
||||||
|
|
||||||
If `off` (default) do not show information on garbage collection
|
If `off` (default) do not show information on garbage collection
|
||||||
and stack shifts, if `on` inform when a garbage collection or stack
|
and stack shifts, if `on` inform when a garbage collection or stack
|
||||||
shift happened, if verbose give detailed information on garbage
|
shift happened, if verbose give detailed information on garbage
|
||||||
@ -235,17 +245,15 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
|||||||
information on data-structures found during the garbage collection
|
information on data-structures found during the garbage collection
|
||||||
process, namely, on choice-points.
|
process, namely, on choice-points.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(GC_TRACE_FLAG, "gc_trace", true, isatom, "off", NULL),
|
|
||||||
/**< `generate_debug_info `
|
|
||||||
|
|
||||||
|
YAP_FLAG(GENERATE_DEBUGGING_INFO_FLAG, "generate_debug_info", true,
|
||||||
|
booleanFlag, "true", NULL),/**<
|
||||||
If `true` (default) generate debugging information for
|
If `true` (default) generate debugging information for
|
||||||
procedures, including source mode. If `false` predicates no
|
procedures, including source mode. If `false` predicates no
|
||||||
information is generated, although debugging is still possible, and
|
information is generated, although debugging is still possible, and
|
||||||
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),
|
||||||
@ -386,55 +394,48 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
|||||||
Yap_InitReadline),
|
Yap_InitReadline),
|
||||||
YAP_FLAG(REPORT_ERROR_FLAG, "report_error", true, booleanFlag, "true",
|
YAP_FLAG(REPORT_ERROR_FLAG, "report_error", true, booleanFlag, "true",
|
||||||
NULL),
|
NULL),
|
||||||
/**<`resource_database`
|
|
||||||
|
YAP_FLAG(RESOURCE_DATABASE_FLAG, "resource_database", false, isatom,
|
||||||
|
YAP_BOOTSTRAP, NULL),/**<
|
||||||
Name of the resource file (saved-state or Prolog file) used to construct
|
Name of the resource file (saved-state or Prolog file) used to construct
|
||||||
the YAP
|
the YAP
|
||||||
run-time environment.
|
run-time environment.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(RESOURCE_DATABASE_FLAG, "resource_database", false, isatom,
|
|
||||||
YAP_BOOTSTRAP, NULL),
|
|
||||||
|
|
||||||
/**<`saved_program`
|
YAP_FLAG(SAVED_PROGRAM_FLAG, "saved_program", false, booleanFlag, "false",
|
||||||
|
NULL), /**<
|
||||||
if `true` YAP booted from a `yss` file, usually `startup.yss'. If
|
if `true` YAP booted from a `yss` file, usually `startup.yss'. If
|
||||||
`false`, YAP booted from a Prolog file, by default `boot.yap`.
|
`false`, YAP booted from a Prolog file, by default `boot.yap`.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(SAVED_PROGRAM_FLAG, "saved_program", false, booleanFlag, "false",
|
|
||||||
NULL),
|
|
||||||
|
|
||||||
/**< `shared_object_extension `
|
|
||||||
|
|
||||||
Suffix associated with loadable code.
|
|
||||||
*/
|
|
||||||
YAP_FLAG(SHARED_OBJECT_EXTENSION_FLAG, "shared_object_extension", false,
|
YAP_FLAG(SHARED_OBJECT_EXTENSION_FLAG, "shared_object_extension", false,
|
||||||
isatom, SO_EXT, NULL),
|
isatom, SO_EXT, NULL),
|
||||||
/**< `shared_object_search_path `
|
|
||||||
|
YAP_FLAG(SHARED_OBJECT_SEARCH_PATH_FLAG, "shared_object_search_path", true,
|
||||||
|
isatom, SO_PATH, NULL),/**<
|
||||||
|
|
||||||
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(SHARED_OBJECT_SEARCH_PATH_FLAG, "shared_object_search_path", true,
|
|
||||||
isatom, SO_PATH, NULL),
|
|
||||||
/**< `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(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 */
|
||||||
|
|
||||||
/**< `signals`
|
|
||||||
|
|
||||||
|
YAP_FLAG(SIGNALS_FLAG, "signals", true, booleanFlag, "true", NULL),/**<
|
||||||
If `true` (default) YAP handles Signals such as `^C`
|
If `true` (default) YAP handles Signals such as `^C`
|
||||||
(`SIGINT`).
|
(`SIGINT`).
|
||||||
|
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(SIGNALS_FLAG, "signals", true, booleanFlag, "true", NULL),
|
|
||||||
/**< `source`
|
|
||||||
|
|
||||||
|
YAP_FLAG(SOURCE_FLAG, "source", true, booleanFlag, "true", NULL),/**<
|
||||||
If `true` maintain the source for all clauses. Notice that this is trivially
|
If `true` maintain the source for all clauses. Notice that this is trivially
|
||||||
supported for facts, and always supported for dynamic code.
|
supported for facts, and always supported for dynamic code.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(SOURCE_FLAG, "source", true, booleanFlag, "true", NULL),
|
|
||||||
/**< `strict_iso `
|
|
||||||
|
|
||||||
|
YAP_FLAG(STRICT_ISO_FLAG, "strict_iso", true, booleanFlag, "false", NULL),/**<
|
||||||
If _Value_ is unbound, tell whether strict ISO compatibility mode
|
If _Value_ is unbound, tell whether strict ISO compatibility mode
|
||||||
is `on` or `off`. If _Value_ is bound to `on` set
|
is `on` or `off`. If _Value_ is bound to `on` set
|
||||||
language mode to `iso` and enable strict mode. If _Value_ is
|
language mode to `iso` and enable strict mode. If _Value_ is
|
||||||
@ -455,52 +456,51 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
|||||||
depends on a Prolog's platform specific features.
|
depends on a Prolog's platform specific features.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(STRICT_ISO_FLAG, "strict_iso", true, booleanFlag, "false", NULL),
|
|
||||||
/**< `system_options `
|
|
||||||
|
|
||||||
|
YAP_FLAG(SYSTEM_OPTIONS_FLAG, "system_options", false, options,
|
||||||
|
SYSTEM_OPTIONS, NULL), /**<
|
||||||
This read only flag tells which options were used to compile
|
This read only flag tells which options were used to compile
|
||||||
YAP. Currently it informs whether the system supports `big_numbers`,
|
YAP. Currently it informs whether the system supports `big_numbers`,
|
||||||
`coroutining`, `depth_limit`, `low_level_tracer`,
|
`coroutining`, `depth_limit`, `low_level_tracer`,
|
||||||
`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),
|
||||||
/**< `tabling_mode`
|
|
||||||
|
YAP_FLAG(TABLING_MODE_FLAG, "tabling_mode", true, isatom, "[]", NULL),/**< `tabling_mode`
|
||||||
|
|
||||||
Sets or reads the tabling mode for all tabled predicates. Please
|
Sets or reads the tabling mode for all tabled predicates. Please
|
||||||
(see Tabling) for the list of options.
|
(see Tabling) for the list of options.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(TABLING_MODE_FLAG, "tabling_mode", true, isatom, "[]", NULL),
|
|
||||||
YAP_FLAG(THREADS_FLAG, "threads", false, ro, "MAX_THREADS", NULL),
|
YAP_FLAG(THREADS_FLAG, "threads", false, ro, "MAX_THREADS", NULL),
|
||||||
YAP_FLAG(TIMEZONE_FLAG, "timezone", false, ro, "18000", NULL),
|
YAP_FLAG(TIMEZONE_FLAG, "timezone", false, ro, "18000", NULL),
|
||||||
YAP_FLAG(TOPLEVEL_PRINT_ANON_FLAG, "toplevel_print_anon", true, booleanFlag,
|
YAP_FLAG(TOPLEVEL_PRINT_ANON_FLAG, "toplevel_print_anon", true, booleanFlag,
|
||||||
"true", NULL),
|
"true", NULL),
|
||||||
/**< `toplevel_hook `
|
|
||||||
|
|
||||||
|
YAP_FLAG(TOPLEVEL_PRINT_OPTIONS_FLAG, "toplevel_print_options", true,
|
||||||
|
list_option, "[quoted(true),numbervars(true),portrayed(true)]",
|
||||||
|
NULL), /**<
|
||||||
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
|
||||||
top-level. If unbound show the current goal or `true` if none is
|
top-level. If unbound show the current goal or `true` if none is
|
||||||
presented. Only the first solution is considered and the goal is not
|
presented. Only the first solution is considered and the goal is not
|
||||||
backtracked into.
|
backtracked into.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(TOPLEVEL_PRINT_OPTIONS_FLAG, "toplevel_print_options", true,
|
|
||||||
list_option, "[quoted(true),numbervars(true),portrayed(true)]",
|
|
||||||
NULL),
|
|
||||||
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),
|
||||||
/**< `unix`
|
|
||||||
|
YAP_FLAG(UNIX_FLAG, "unix", false, ro, "true", NULL),/**<
|
||||||
|
|
||||||
Read-only BooleanFlag flag that unifies with `true` if YAP is
|
Read-only BooleanFlag flag that unifies with `true` if YAP is
|
||||||
running on an Unix system. Defined if the C-compiler used to compile
|
running on an Unix system. Defined if the C-compiler used to compile
|
||||||
this version of YAP either defines `__unix__` or `unix`.
|
this version of YAP either defines `__unix__` or `unix`.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(UNIX_FLAG, "unix", false, ro, "true", NULL),
|
|
||||||
/**< `update_semantics `
|
YAP_FLAG(UPDATE_SEMANTICS_FLAG, "update_semantics", true, isatom, "logical",
|
||||||
|
NULL), /**< `update_semantics `
|
||||||
|
|
||||||
Define whether YAP should follow `immediate` update
|
Define whether YAP should follow `immediate` update
|
||||||
semantics, as in C-Prolog (default), `logical` update semantics,
|
semantics, as in C-Prolog (default), `logical` update semantics,
|
||||||
@ -509,10 +509,8 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
|||||||
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(UPDATE_SEMANTICS_FLAG, "update_semantics", true, isatom, "logical",
|
|
||||||
NULL),
|
YAP_FLAG(USER_FLAGS_FLAG, "user_flags", true, isatom, "error", NULL),/**<
|
||||||
/**<
|
|
||||||
`user_flags `
|
|
||||||
|
|
||||||
Define the behaviour of set_prolog_flag/2 if the flag is not known. Values
|
Define the behaviour of set_prolog_flag/2 if the flag is not known. Values
|
||||||
are `silent`, `warning` and `error`. The first two create the flag
|
are `silent`, `warning` and `error`. The first two create the flag
|
||||||
@ -522,87 +520,82 @@ 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
|
are encouraged to use `create_prolog_flag/3` to create flags for their
|
||||||
library.
|
library.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(USER_FLAGS_FLAG, "user_flags", true, isatom, "error", NULL),
|
|
||||||
/**< `unknown is iso`
|
YAP_FLAG(UNKNOWN_FLAG, "unknown", true, isatom, "error", Yap_unknown), /**< `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),
|
||||||
/**< `verbose `
|
|
||||||
|
|
||||||
|
YAP_FLAG(VERBOSE_FLAG, "verbose", true, isatom, "normal", NULL),/**<
|
||||||
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`
|
||||||
disable printing these messages. It is `normal` by default except if
|
disable printing these messages. It is `normal` by default except if
|
||||||
YAP is booted with the `-q` or `-L` flag.
|
YAP is booted with the `-q` or `-L` flag.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(VERBOSE_FLAG, "verbose", true, isatom, "normal", NULL),
|
|
||||||
YAP_FLAG(VERBOSE_AUTOLOAD_FLAG, "verbose_autoload", true, booleanFlag,
|
YAP_FLAG(VERBOSE_AUTOLOAD_FLAG, "verbose_autoload", true, booleanFlag,
|
||||||
"false", NULL),
|
"false", NULL),
|
||||||
/**< `verbose_file_search `
|
|
||||||
|
YAP_FLAG(VERBOSE_FILE_SEARCH_FLAG, "verbose_file_search", true, booleanFlag,
|
||||||
|
"false", NULL),/**<
|
||||||
|
|
||||||
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_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
|
If `true` allow printing of informational messages when
|
||||||
consulting files. If `false` disable printing these messages. It
|
consulting files. If `false` disable printing these messages. It
|
||||||
is `normal` by default except if YAP is booted with the `-L`
|
is `normal` by default except if YAP is booted with the `-L`
|
||||||
flag.
|
flag.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(VERBOSE_LOAD_FLAG, "verbose_load", true, isatom, "normal", NULL),
|
|
||||||
/**< `version_data `
|
|
||||||
|
|
||||||
|
YAP_FLAG(VERSION_FLAG, "version", false, nat, YAP_NUMERIC_VERSION, NULL),/**<
|
||||||
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_FLAG, "version", false, nat, YAP_NUMERIC_VERSION, NULL),
|
|
||||||
/**<
|
YAP_FLAG(VERSION_DATA_FLAG, "version_data", false, ro, YAP_TVERSION, 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),
|
|
||||||
/**< `version_git `
|
YAP_FLAG(VERSION_GIT_FLAG, "version_git", false, isatom, YAP_GIT_HEAD,
|
||||||
`
|
NULL), /**<
|
||||||
this is the unique identifier for the last commit of the current GIT HEAD,
|
this is the unique identifier for the last commit of the current GIT HEAD,
|
||||||
it xan be used to identify versions that differ on small (or large) updates.
|
it xan be used to identify versions that differ on small (or large) updates.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(VERSION_GIT_FLAG, "version_git", false, isatom, YAP_GIT_HEAD,
|
|
||||||
NULL),
|
|
||||||
YAP_FLAG(WRITE_ATTRIBUTES_FLAG, "write_attributes", true, isatom, "ignore",
|
YAP_FLAG(WRITE_ATTRIBUTES_FLAG, "write_attributes", true, isatom, "ignore",
|
||||||
NULL),
|
NULL),
|
||||||
#if __WINDOWS__
|
#if __WINDOWS__
|
||||||
/**< `windows`
|
|
||||||
|
YAP_FLAG(WINDOWS_FLAG, "windows", false, ro, "true", NULL), /**< `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(WINDOWS_FLAG, "windows", false, ro, "true", NULL),
|
#endif
|
||||||
#endif
|
|
||||||
/**< `write_strings `
|
|
||||||
|
|
||||||
|
YAP_FLAG(WRITE_STRINGS_FLAG, "write_strings", true, booleanFlag, "false",
|
||||||
|
NULL) , /**<
|
||||||
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
|
||||||
|
|
||||||
|
@ -1584,7 +1584,7 @@ int Yap_OpenStream(Term tin, const char *io_mode, Term user_name,
|
|||||||
} else {
|
} else {
|
||||||
st->file = fopen(fname, io_mode);
|
st->file = fopen(fname, io_mode);
|
||||||
}
|
}
|
||||||
if (!st->file) {
|
if (!st->file && !st->vfs) {
|
||||||
fprintf(stderr, "trying %s\n", fname);
|
fprintf(stderr, "trying %s\n", fname);
|
||||||
PlIOError(EXISTENCE_ERROR_SOURCE_SINK, tin, "%s", fname);
|
PlIOError(EXISTENCE_ERROR_SOURCE_SINK, tin, "%s", fname);
|
||||||
/* extract BACK info passed through the stream descriptor */
|
/* extract BACK info passed through the stream descriptor */
|
||||||
@ -1629,7 +1629,7 @@ int Yap_OpenStream(Term tin, const char *io_mode, Term user_name,
|
|||||||
pop_text_stack(i);
|
pop_text_stack(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (st->file == NULL) {
|
if (st->file == NULL && st->vfs == NULL) {
|
||||||
if (!strchr(io_mode, 'b') && binary_file(fname)) {
|
if (!strchr(io_mode, 'b') && binary_file(fname)) {
|
||||||
UNLOCK(st->streamlock);
|
UNLOCK(st->streamlock);
|
||||||
if (errno == ENOENT && !strchr(io_mode, 'r')) {
|
if (errno == ENOENT && !strchr(io_mode, 'r')) {
|
||||||
|
@ -62,13 +62,11 @@ static void *py_open(VFS_t *me, const char *name, const char *io_mode,
|
|||||||
st->user_name = TermOutStream;
|
st->user_name = TermOutStream;
|
||||||
} else if (strcmp(name, "sys.stderr") == 0) {
|
} else if (strcmp(name, "sys.stderr") == 0) {
|
||||||
st->user_name = TermErrStream;
|
st->user_name = TermErrStream;
|
||||||
|
} else if (strcmp(name, "input") == 0) {
|
||||||
|
pystream = PyObject_Call(pystream, PyTuple_New(0), NULL);
|
||||||
} else {
|
} else {
|
||||||
st->user_name = YAP_MkAtomTerm(st->name);
|
st->user_name = YAP_MkAtomTerm(st->name);
|
||||||
}
|
}
|
||||||
// we assume object is already open, so there is no need to open it.
|
|
||||||
if (PyCallable_Check(pystream))
|
|
||||||
st->u.private_data = PyObject_Call(pystream, PyTuple_New(0), NULL);
|
|
||||||
else
|
|
||||||
st->u.private_data = pystream;
|
st->u.private_data = pystream;
|
||||||
st->vfs = me;
|
st->vfs = me;
|
||||||
python_release_GIL(ctk);
|
python_release_GIL(ctk);
|
||||||
|
@ -69,10 +69,10 @@ nb_setval(jupyter_cell, false),
|
|||||||
).
|
).
|
||||||
streams(true) :-
|
streams(true) :-
|
||||||
nb_setval(jupyter_cell, true),
|
nb_setval(jupyter_cell, true),
|
||||||
open('/python/input', read, _Input, [alias(user_input),bom(false)]),
|
% open('/python/input', read, _Input, [alias(user_input),bom(false)]),
|
||||||
open('/python/sys.stdout', append, _Output, [alias(user_output)]),
|
open('/python/sys.stdout', append, _Output, [alias(user_output)]),
|
||||||
open('/python/sys.stderr', append, _Error, [alias(user_error)]),
|
open('/python/sys.stderr', append, _Error, [alias(user_error)]),
|
||||||
set_prolog_flag(user_input,_Input),
|
% set_prolog_flag(user_input,_Input),
|
||||||
set_prolog_flag(user_output,_Output),
|
set_prolog_flag(user_output,_Output),
|
||||||
set_prolog_flag(user_error,_Error).
|
set_prolog_flag(user_error,_Error).
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* @brief support Prolog dialects
|
* @brief support Prolog dialects
|
||||||
*
|
*
|
||||||
* @defgroup Dialects Compatibilty with other Prolog dialects
|
* @defgroup Dialects Compatibility with other Prolog dialects
|
||||||
* @ingroup extensions
|
* @ingroup extensions
|
||||||
* @{
|
* @{
|
||||||
* @brief Prolog dialects
|
* @brief Prolog dialects
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
@defgroup SWI-error High-level error testing.
|
@defgroup SWI-error High-level error testing.
|
||||||
@ingroup builtins
|
@ingroup Deb_Interaction
|
||||||
|
|
||||||
This SWI module provides predicates to simplify error generation and
|
This SWI module provides predicates to simplify error generation and
|
||||||
checking. Adapted to use YAP built-ins.
|
checking. Adapted to use YAP built-ins.
|
||||||
|
Reference in New Issue
Block a user