This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/H/YapLFlagInfo.h

136 lines
4.7 KiB
C
Raw Normal View History

2018-04-27 13:01:08 +01:00
2015-06-18 01:59:07 +01:00
/*************************************************************************
2018-07-10 23:21:19 +01:00
* *
* YAP Prolog *
* *
* Yap Prolog was developed at NCCUP - Universidade do Porto *
* *
* Copyright L.Damas, V.S.Costa and Universidade do Porto 2015- *
* *
**************************************************************************
* *
* File: YapLFlagInfo.h * Last rev:
** mods: * comments: local flag enumeration. *
* *
*************************************************************************/
2015-06-18 01:59:07 +01:00
/** @file YapLFlagInfo.h
2018-04-20 14:59:17 +01:00
@addtogroup YAPFlags
2018-04-27 13:01:08 +01:00
@ingroup builtins
@{
2018-05-20 00:47:27 +01:00
@enum THREAD_LOCAL_FLAGS Local Flags supported by YAP
@brief local flags and their values.
2015-06-18 01:59:07 +01:00
*/
2018-05-10 13:11:56 +01:00
START_LOCAL_FLAGS
2018-07-10 23:21:19 +01:00
/** + `autoload`: set the system to look for undefined procedures */
YAP_FLAG(AUTOLOAD_FLAG, "autoload", true, booleanFlag, "false", NULL),
/** + `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(CALL_COUNTING_FLAG, "call_counting", true, booleanFlag, "true",
NULL), /** + `call_counting`
Predicates compiled with this flag set maintain a counter
on the numbers of proceduree calls and of retries. These counters
are decreasing counters, and they can be used as timers. Three
counters are available:
calls: number of predicate calls since execution started or
since system was reset; retries: number of retries for predicates
called since execution started or since counters were reset;
calls_and_retries: count both on predicate calls and
retries. These counters can be used to find out how many calls a
certain goal takes to execute. They can also be force the
computatiom yp stopping.
If `on` `fileerrors` is `on`, if `off` (default)
`fileerrors` is disabled.
*/
YAP_FLAG(ENCODING_FLAG, "encoding", true, isatom, "utf-8", getenc),
YAP_FLAG(FILEERRORS_FLAG, "fileerrors", true, booleanFlag, "true",
NULL), /** + `fileerrors`
If `on` `fileerrors` is `on`, if `off` (default)
`fileerrors` is disabled.
*/
YAP_FLAG(LANGUAGE_MODE_FLAG, "language_mode", true, isatom, "yap",
NULL), /** + `language_mode`
wweter native mode or trying to emulate a different Prolog.
*/
YAP_FLAG(STACK_DUMP_ON_ERROR_FLAG, "stack_dump_on_error", true, booleanFlag,
"true", NULL), /** + `stack_dump_on_error `
If `true` show a stack dump when YAP finds an error. The default is
2015-06-18 01:59:07 +01:00
`off`.
2018-07-10 23:21:19 +01:00
*/
YAP_FLAG(STREAM_TYPE_CHECK_FLAG, "stream_type_check", true, isatom, "loose",
NULL),
YAP_FLAG(SYNTAX_ERRORS_FLAG, "syntax_errors", true, synerr, "error",
NULL), /** + `syntax_errors`
2015-06-18 01:59:07 +01:00
2018-07-10 23:21:19 +01:00
Control action to be taken after syntax errors while executing read/1,
2015-06-18 01:59:07 +01:00
`read/2`, or `read_term/3`:
2018-07-10 23:21:19 +01:00
+ `dec10`
2015-06-18 01:59:07 +01:00
Report the syntax error and retry reading the term.
2018-07-10 23:21:19 +01:00
+ `fail`
2015-07-06 11:53:50 +01:00
Report the syntax error and fail.
2018-07-10 23:21:19 +01:00
+ `error`
2015-07-06 11:53:50 +01:00
Report the syntax error and generate an error (default).
2018-07-10 23:21:19 +01:00
+ `quiet`
2015-06-18 01:59:07 +01:00
Just fail
2018-07-10 23:21:19 +01:00
*/
YAP_FLAG(TYPEIN_MODULE_FLAG, "typein_module", true, isatom, "user",
typein), /** + `typein_module `
2015-06-18 01:59:07 +01:00
2018-07-10 23:21:19 +01:00
If bound, set the current working or type-in module to the argument,
2015-06-18 01:59:07 +01:00
which must be an atom. If unbound, unify the argument with the current
working module.
2018-07-10 23:21:19 +01:00
*/
YAP_FLAG(USER_ERROR_FLAG, "user_error", true, stream, "user_error",
set_error_stream), /** + `user_error1`
2015-06-18 01:59:07 +01:00
2018-07-10 23:21:19 +01:00
If the second argument is bound to a stream, set user_error to
2015-06-18 01:59:07 +01:00
this stream. If the second argument is unbound, unify the argument with
the current user_error stream.
By default, the user_error stream is set to a stream
corresponding to the Unix `stderr` stream.
The next example shows how to use this flag:
~~~{.prolog}
2018-07-10 23:21:19 +01:00
?- open( '/dev/null', append, Error,
[alias(mauri_tripa)] ).
2015-06-18 01:59:07 +01:00
2018-07-10 23:21:19 +01:00
Error = '$stream'(3) ? ;
2015-06-18 01:59:07 +01:00
2018-07-10 23:21:19 +01:00
no
?- set_prolog_flag(user_error, mauri_tripa).
2015-06-18 01:59:07 +01:00
2018-07-10 23:21:19 +01:00
close(mauri_tripa).
2015-06-18 01:59:07 +01:00
2018-07-10 23:21:19 +01:00
yes
?-
2015-06-18 01:59:07 +01:00
~~~
2018-07-10 23:21:19 +01:00
We execute three commands. First, we open a stream in write mode and
2015-06-18 01:59:07 +01:00
give it an alias, in this case `mauri_tripa`. Next, we set
user_error to the stream via the alias. Note that after we did so
prompts from the system were redirected to the stream
`mauri_tripa`. Last, we close the stream. At this point, YAP
automatically redirects the user_error alias to the original
`stderr`.
2018-07-10 23:21:19 +01:00
*/
YAP_FLAG(USER_INPUT_FLAG, "user_input", true, stream, "user_input",
set_input_stream),
YAP_FLAG(USER_OUTPUT_FLAG, "user_output", true, stream, "user_output",
set_output_stream),
2018-04-27 13:01:08 +01:00
2018-07-10 23:21:19 +01:00
END_LOCAL_FLAGS
2018-04-27 17:37:42 +01:00
2018-07-10 23:21:19 +01:00
/// @}