This commit is contained in:
Vitor Santos Costa 2018-04-27 13:01:08 +01:00
parent af848f28aa
commit 1c293a9af4
51 changed files with 4794 additions and 2393 deletions

View File

@ -17,9 +17,9 @@
/** @file C/flags.c
@addtogroup Flags
@ingroup core
@{
@addtogroup Flags
@ingroup builtins
*/
// this is where we define flags
@ -1725,3 +1725,5 @@ void Yap_InitFlags(bool bootstrap) {
}
/* Accessing and changing the flags for a predicate */
// @}

View File

@ -21,10 +21,11 @@
@file inlines.c
@{
@defgroup YAP_Inlines Inlined Tests nad Ter Manipulation
@ingroup builtins
@{
*/
@ -1208,3 +1209,4 @@ cont_genarg( USES_REGS1 )
}
// @}

View File

@ -18,121 +18,6 @@
static char SccsId[] = "%W% %G%";
#endif
/**
@addtogroup YAPSyntax
describe the syntax for Prolog terms. In a second level we describe
the \a tokens from which Prolog \a terms are
built.
@defgroup Formal_Syntax Syntax of Terms
@ingroup YAPSyntax
@{
Below, we describe the syntax of YAP terms from the different
classes of tokens defined above. The formalism used will be <em>BNF</em>,
extended where necessary with attributes denoting integer precedence or
operator type.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
term
----> subterm(1200) end_of_term_marker
subterm(N) ----> term(M) [M <= N]
term(N) ----> op(N, fx) subterm(N-1)
| op(N, fy) subterm(N)
| subterm(N-1) op(N, xfx) subterm(N-1)
| subterm(N-1) op(N, xfy) subterm(N)
| subterm(N) op(N, yfx) subterm(N-1)
| subterm(N-1) op(N, xf)
| subterm(N) op(N, yf)
term(0) ----> atom '(' arguments ')'
| '(' subterm(1200) ')'
| '{' subterm(1200) '}'
| list
| string
| number
| atom
| variable
arguments ----> subterm(999)
| subterm(999) ',' arguments
list ----> '[]'
| '[' list_expr ']'
list_expr ----> subterm(999)
| subterm(999) list_tail
list_tail ----> ',' list_expr
| ',..' subterm(999)
| '|' subterm(999)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Notes:
+ \a op(N,T) denotes an atom which has been previously declared with type
\a T and base precedence \a N.
+ Since ',' is itself a pre-declared operator with type \a xfy and
precedence 1000, is \a subterm starts with a '(', \a op must be
followed by a space to avoid ambiguity with the case of a functor
followed by arguments, e.g.:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ (a,b) [the same as '+'(','(a,b)) of arity one]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
versus
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+(a,b) [the same as '+'(a,b) of arity two]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
In the first rule for term(0) no blank space should exist between
\a atom and '('.
+
Each term to be read by the YAP parser must end with a single
dot, followed by a blank (in the sense mentioned in the previous
paragraph). When a name consisting of a single dot could be taken for
the end of term marker, the ambiguity should be avoided by surrounding the
dot with single quotes.
@}
*/
/*
* Description:
*
* parser: produces a prolog term from an array of tokens
*
* parser usage: the parser takes its input from an array of token descriptions
* addressed by the global variable 'tokptr' and produces a Term as result. A
* macro 'NextToken' should be defined in 'yap.h' for advancing 'tokptr' from
* one token to the next. In the distributed version this macro also updates
* a variable named 'toktide' for keeping track of how far the parser went
* before failling with a syntax error. The parser should be invoked with
* 'tokptr' pointing to the first token. The last token should have type
* 'eot_tok'. The parser return either a Term. Syntactic errors are signaled
* by a return value 0. The parser builds new terms on the 'global stack' and
* also uses an auxiliary stack pointed to by 'AuxSp'. In the distributed
* version this auxiliary stack is assumed to grow downwards. This
* assumption, however, is only relevant to routine 'ParseArgs', and to the
* variable toktide. conclusion: set tokptr pointing to first token set AuxSp
* Call Parse
*
* VSC: Working whithout known bugs in 87/4/6
*
* LD: -I or +I evaluated by parser 87/4/28
*
* LD: parser extended 87/4/28
*
*/
#include "Yap.h"
#include "YapEval.h"

View File

@ -15,8 +15,10 @@
* *
*************************************************************************/
/** @file YapFlags.h
/**
@file YapFlags.h
@{
@addtogroup YAPFlags
*/
@ -228,15 +230,24 @@ typedef union flagTerm {
void Yap_InitFlags(bool);
#define YAP_FLAG(x, NAME, WRITABLE, DEF, INIT, HELPER) x
/**
@pred yap_flag( ?Param, ?Value)
typedef enum {
Set or read system properties for _Param_:
*/
#define YAP_FLAG(ITEM, NAME, WRITABLE, DEF, INIT, HELPER) ITEM
/* */
#include "YapGFlagInfo.h"
} global_flag_t;
typedef enum {
/* Local flags */
#include "YapLFlagInfo.h"
} local_flag_t;
#undef YAP_FLAG
bool setYapFlag(Term tflag, Term t2);
@ -372,3 +383,5 @@ xarg *Yap_ArgListToVector(Term listl, const param_t *def, int n);
xarg *Yap_ArgList2ToVector(Term listl, const param2_t *def, int n);
#endif // YAP_FLAGS_H
/// @}

View File

@ -21,44 +21,53 @@
@ingroup builtins
@{
@pred yap_flag( ?Param, ?Value)
Set or read system properties for _Param_:
@enum YapGFlag Prolog
@Brief global flag:
@enum GlobalFlags Global Flags Dupported ny YAP *
@enum GlobalFlags Global Flags supported by YAP
@brief global flag:
*/
typedef enum {
YAP_FLAG(ADDRESS_BITS_FLAG, "address_bits", false, nat, BITNESS, NULL), /**< `address_bits`
/**< `address_bits`
Number of address bits in the machine, either 64 or 32 bits */
YAP_FLAG(AGC_MARGIN_FLAG, "agc_margin", true, nat, "10000",
agc_threshold), /**< `agc_margin`
YAP_FLAG(ADDRESS_BITS_FLAG, "address_bits", false, nat, BITNESS, NULL),
/**< `agc_margin`
An integer: if this amount of atoms has been created since the last
atom-garbage collection, perform atom garbage collection at the first
opportunity. Initial value is 10,000. May be changed. A value of 0
(zero) disables atom garbage collection.
*/
YAP_FLAG(ALLOW_ASSERT_FOR_STATIC_PREDICATES,
"allow_assert_for_static_predicates", true, booleanFlag, "true",
NULL), /**< `allow asserting and retracting clauses of static
YAP_FLAG(AGC_MARGIN_FLAG, "agc_margin", true, nat, "10000",
agc_threshold),
/**< `allow_assert_for_static_predicates` allow asserting and retracting clauses of static
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", true, booleanFlag, "false" , NULL ),
/\**<
`allow_variable_name_as_functor` */
/* allow
* A(X)
* *\/
/**< `allow_variable_name_as_functor` boolean flag allows constructs such as
~~~~~~~~~~~~
Tree(Node(L,node,R)) :-
Tree(L),
Tree(R).
~~~~~~~~~~~~
*/
YAP_FLAG(ANSWER_FORMAT_FLAG, "answer_format", true, isatom, "~p",
NULL), /** `arithmetic_exceptions `
YAP_FLAG( ALLOW_VARIABLE_NAME_AS_FUNCTOR_FLAG, "allow_variable_name_as_functor", false, booleanFlag, "false", NULL),
/**< `answer_format` how to present answers, default is `~p`. */
YAP_FLAG(ANSWER_FORMAT_FLAG, "answer_format", true, isatom, "~p",
NULL),
#if __APPLE__
/**<
`apple`: read-only boolean, a machine running an Apple Operating System *
*/
YAP_FLAG(APPLE_FLAG, "apple", false, booleanFlag, "true",
NULL),
#endif
YAP_FLAG(ARCH_FLAG, "arch", false, isatom, YAP_ARCH, NULL),
YAP_FLAG(ARGV_FLAG, "argv", false, argv, "@boot", NULL),
/**< `arithmetic_exceptions`
Read-write flag telling whether arithmetic exceptions generate
Prolog exceptions. If enabled:
@ -78,85 +87,81 @@ X = (+inf).
It is `true` by default, but it is disabled by packages like CLP(BN) and
ProbLog.
*/
#if __APPLE__
YAP_FLAG(APPLE_FLAG, "apple", false, booleanFlag, "true",
NULL), /**< `apple`
Read-only booleanFlag flag that unifies with `true` if YAP is
running on an Apple machine.
*/
#endif
YAP_FLAG(ARCH_FLAG, "arch", false, isatom, YAP_ARCH, NULL),
YAP_FLAG(ARGV_FLAG, "argv", false, argv, "@boot", NULL),
YAP_FLAG(ARITHMETIC_EXCEPTIONS_FLAG, "arithmetic_exceptions", true,
booleanFlag, "true", NULL),
YAP_FLAG(BACK_QUOTES_FLAG, "back_quotes", true, isatom,
"string", bqs), /**>
/**>
If _Value_ is unbound, tell whether a back quoted list of characters
token is converted to a list of atoms, `chars`, to a list of integers,
`codes`, or to a single atom, `atom`. If _Value_ is bound, set to
the corresponding behavior. The default value is `string`
*/
YAP_FLAG(BOUNDED_FLAG, "bounded", false, booleanFlag, "false",
NULL), /**< `bounded` is iso
YAP_FLAG(BACK_QUOTES_FLAG, "back_quotes", true, isatom, "true", NULL),
/**< `bounded` is iso
Read-only flag telling whether integers are bounded. The value depends
on whether YAP uses the GMP library or not.
*/
YAP_FLAG(BOUNDED_FLAG, "bounded", false, booleanFlag, "false",
NULL),
YAP_FLAG(C_CC_FLAG, "c_cc", false, isatom, C_CC, NULL),
YAP_FLAG(C_CFLAGS_FLAG, "c_cflags", false, isatom, C_CFLAGS, NULL),
YAP_FLAG(C_LDFLAGS_FLAG, "c_ldflags", false, isatom, C_LDFLAGS, NULL),
YAP_FLAG(C_LIBPLSO_FLAG, "c_libplso", false, isatom, C_LIBPLSO, NULL),
YAP_FLAG(C_LIBS_FLAG, "c_libs", false, isatom, C_LIBS, NULL),
YAP_FLAG(CHAR_CONVERSION_FLAG, "char_conversion", true, booleanFlag,
"false", NULL), /**< `char_conversion is iso`
/**< `char_conversion is iso`
Writable flag telling whether a character conversion table is used when
reading terms. The default value for this flag is `off` except in
`sicstus` and `iso` language modes, where it is `on`.
*/
YAP_FLAG(CHARACTER_ESCAPES_FLAG, "character_escapes", true, booleanFlag,
"true", NULL), /**< `character_escapes is iso `
YAP_FLAG(CHAR_CONVERSION_FLAG, "char_conversion", true, booleanFlag,
"false", NULL),
/**< `character_escapes is iso `
Writable flag telling whether a character escapes are enables,
`true`, or disabled, `false`. The default value for this flag is
`true`. */
YAP_FLAG(CHARACTER_ESCAPES_FLAG, "character_escapes", true, booleanFlag,
"true", NULL),
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,
NULL), /**< `compiled_at `
/**< `compiled_at `
Read-only flag that gives the time when the main YAP binary was compiled. It is
obtained staight from the __TIME__ macro, as defined in the C99.
*/
YAP_FLAG(DEBUG_FLAG, "debug", true, booleanFlag, "false",
NULL), /**< `debug is iso `
YAP_FLAG(COMPILED_AT_FLAG, "compiled_at", false, isatom, YAP_COMPILED_AT,
NULL),
/**< `debug is iso `
If _Value_ is unbound, tell whether debugging is `true` or
`false`. If _Value_ is bound to `true` enable debugging, and if
it is bound to `false` disable debugging.
*/
YAP_FLAG(DEBUG_FLAG, "debug", true, booleanFlag, "false",
NULL),
YAP_FLAG(DEBUG_INFO_FLAG, "debug_info", true, booleanFlag, "true", NULL),
YAP_FLAG(DEBUG_ON_ERROR_FLAG, "debug_on_error", true, booleanFlag, "true",
NULL),
YAP_FLAG(DEBUGGER_PRINT_OPTIONS_FLAG, "debugger_print_options", true,
list_option,
"[quoted(true),numbervars(true),portrayed(true),max_depth(10)]",
NULL), /**< `debugger_print_options `
/**< `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,
list_option,
"[quoted(true),numbervars(true),portrayed(true),max_depth(10)]",
NULL),
YAP_FLAG(DEBUGGER_SHOW_CONTEXT_FLAG, "debugger_show_context", true,
booleanFlag, "false", NULL),
YAP_FLAG(DIALECT_FLAG, "dialect", false, ro, "yap",
NULL), /**< `dialect `
/**< `dialect `
Read-only flag that always returns `yap`.
*/
YAP_FLAG(DISCONTIGUOUS_WARNINGS_FLAG, "discontiguous_warnings", true,
booleanFlag, "true", NULL), /**< `discontiguous_warnings `
YAP_FLAG(DIALECT_FLAG, "dialect", false, ro, "yap",
NULL),
/**< `discontiguous_warnings `
If `true` (default `true`) YAP checks for definitions of the same predicate that
are separated by clauses for other predicates. This may indicate that different
@ -166,36 +171,41 @@ The declaration discontiguous/1 disables this warning for user-specified
predicates.
*/
YAP_FLAG(DOLLAR_AS_LOWER_CASE_FLAG, "dollar_as_lower_case", true,
booleanFlag, "false",
NULL), /**< `dollar_as_lower_case `
YAP_FLAG(DISCONTIGUOUS_WARNINGS_FLAG, "discontiguous_warnings", true,
booleanFlag, "true", NULL),
/**< `dollar_as_lower_case `
If `off` (default) consider the character `$` a control character, if
`on` consider `$` a lower case character.
*/
YAP_FLAG(DOUBLE_QUOTES_FLAG, "double_quotes", true, isatom, "codes",
dqs), /**< `double_quotes is iso `
YAP_FLAG(DOLLAR_AS_LOWER_CASE_FLAG, "dollar_as_lower_case", true,
booleanFlag, "false",
NULL),
/**< `double_quotes is iso `
If _Value_ is unbound, tell whether a double quoted list of characters
token is converted to a list of atoms, `chars`, to a list of integers,
`codes`, or to a single atom, `atom`. If _Value_ is bound, set to
the corresponding behavior. The default value is `codes`. */
YAP_FLAG(DOUBLE_QUOTES_FLAG, "double_quotes", true, isatom, "codes",
dqs),
YAP_FLAG(EDITOR_FLAG, "editor", true, isatom, "$EDITOR", NULL),
YAP_FLAG(EXECUTABLE_FLAG, "executable", false, executable, "@boot",
NULL), /**< `executable `
/**< `executable `
Read-only flag. It unifies with an atom that gives the
original program path.
*/
YAP_FLAG(FAST_FLAG, "fast", true, booleanFlag, "false", NULL), /**< `fast `
YAP_FLAG(EXECUTABLE_FLAG, "executable", false, executable, "@boot",
NULL),
/**< `fast `
If `on` allow fast machine code, if `off` (default) disable it. Only
available in experimental implementations.
*/
YAP_FLAG(FAST_FLAG, "fast", true, booleanFlag, "false", NULL),
YAP_FLAG(FILE_NAME_VARIABLES_FLAG, "file_name_variables", true, booleanFlag,
"true", NULL),
YAP_FLAG(FLOAT_FORMAT_FLAG, "float_format", true, isatom, "%.16g",
NULL), /**< + `float_format `
/**< + `float_format `
C-library `printf()` format specification used by write/1 and
friends to determine how floating point numbers are printed. The
@ -204,19 +214,22 @@ available in experimental implementations.
printed, `%g` will print all floats using 6 digits instead of the
default 15.
*/
YAP_FLAG(GC_FLAG, "gc", true, booleanFlag, "on", NULL), /**< `gc`
YAP_FLAG(FLOAT_FORMAT_FLAG, "float_format", true, isatom, "%.16g",
NULL),
/**< `gc`
If `on` allow garbage collection (default), if `off` disable it.
*/
YAP_FLAG(GC_MARGIN_FLAG, "gc_margin", true, nat, "0",
gc_margin), /**< `gc_margin `
YAP_FLAG(GC_FLAG, "gc", true, booleanFlag, "on", NULL),
/**< `gc_margin `
Set or show the minimum free stack before starting garbage
collection. The default depends on total stack size.
*/
YAP_FLAG(GC_TRACE_FLAG, "gc_trace", true, isatom, "off",
NULL), /**< `gc_trace `
YAP_FLAG(GC_MARGIN_FLAG, "gc_margin", true, nat, "0",
gc_margin),
/**< `gc_trace `
If `off` (default) do not show information on garbage collection
and stack shifts, if `on` inform when a garbage collection or stack
@ -225,8 +238,9 @@ collection and stack shifts. Last, if `very_verbose` give detailed
information on data-structures found during the garbage collection
process, namely, on choice-points.
*/
YAP_FLAG(GENERATE_DEBUGGING_INFO_FLAG, "generate_debug_info", true,
booleanFlag, "true", NULL), /**< `generate_debug_info `
YAP_FLAG(GC_TRACE_FLAG, "gc_trace", true, isatom, "off",
NULL),
/**< `generate_debug_info `
If `true` (default) generate debugging information for
procedures, including source mode. If `false` predicates no
@ -234,48 +248,55 @@ process, namely, on choice-points.
source mode is disabled.
*/
YAP_FLAG(GENERATE_DEBUGGING_INFO_FLAG, "generate_debug_info", true,
booleanFlag, "true", NULL),
YAP_FLAG(GMP_VERSION_FLAG, "gmp_version", false, isatom, "4.8.12", NULL),
YAP_FLAG(HALT_AFTER_CONSULT_FLAG, "halt_after_consult", false, booleanFlag,
"false", NULL),
YAP_FLAG(HOME_FLAG, "home", false, isatom, YAP_ROOTDIR, NULL), /**< home `
/**< home `
the root of the YAP installation, by default `/usr/local` in Unix or
`c:\Yap` in Windows system. Can only be set at configure time
*/
YAP_FLAG(HOST_TYPE_FLAG, "host_type", false, isatom, HOST_ALIAS,
NULL), /**< host_type `
YAP_FLAG(HOME_FLAG, "home", false, isatom, YAP_ROOTDIR, NULL),
/**< host_type `
Return `configure` system information, including the machine-id
for which YAP was compiled and Operating System information.
*/
YAP_FLAG(INDEX_FLAG, "index", true, indexer, "multi", NULL), /**< `index `
YAP_FLAG(HOST_TYPE_FLAG, "host_type", false, isatom, HOST_ALIAS,
NULL),
/**< `index `
If `on` allow indexing (default), if `off` disable it, if
`single` allow on first argument only.
*/
YAP_FLAG(INDEX_SUB_TERM_SEARCH_DEPTH_FLAG, "index_sub_term_search_depth",
true, nat, "0", NULL), /**< `Index_sub_term_search_depth `
YAP_FLAG(INDEX_FLAG, "index", true, indexer, "multi", NULL),
/**< `Index_sub_term_search_depth `
Maximum bound on searching sub-terms for indexing, if `0` (default) no bound.
*/
YAP_FLAG(INFORMATIONAL_MESSAGES_FLAG, "informational_messages", true,
isatom, "normal", NULL), /**< `informational_messages `
YAP_FLAG(INDEX_SUB_TERM_SEARCH_DEPTH_FLAG, "index_sub_term_search_depth",
true, nat, "0", NULL),
/**< `informational_messages `
If `on` allow printing of informational messages, such as the ones
that are printed when consulting. If `off` disable printing
these messages. It is `on` by default except if YAP is booted with
the `-L` flag.
*/
YAP_FLAG(INTEGER_ROUNDING_FUNCTION_FLAG, "integer_rounding_function", true,
isatom, "toward_zero",
NULL), /**< `integer_rounding_function is iso `
YAP_FLAG(INFORMATIONAL_MESSAGES_FLAG, "informational_messages", true,
isatom, "normal", NULL),
/**< `integer_rounding_function is iso `
Read-only flag telling the rounding function used for integers. Takes the value
`toward_zero` for the current version of YAP.
*/
YAP_FLAG(INTEGER_ROUNDING_FUNCTION_FLAG, "integer_rounding_function", true,
isatom, "toward_zero",
NULL),
YAP_FLAG(ISO_FLAG, "iso", true, booleanFlag, "false", NULL),
YAP_FLAG(LANGUAGE_FLAG, "language", true, isatom, "yap",
NULL), /**< `language `
/**< `language `
Choose whether YAP follows native, closer to C-Prolog, `yap`, iso-prolog,
`iso` or SICStus Prolog, `sicstus`. The current default is
@ -284,16 +305,21 @@ style checking, handling calls to undefined procedures, how directives
are interpreted, when to use dynamic, character escapes, and how files
are consulted. Also check the `dialect` option.
*/
YAP_FLAG(PROLOG_LIBRARY_DIRECTORY_FLAG, "prolog_library_directory", true, isatom, "", NULL), /**< if defined, first location where YAP expects to find the YAP Prolog library. Takes precedence over library_directory */
YAP_FLAG(LANGUAGE_FLAG, "language", true, isatom, "yap",
NULL),
/**< if defined, first location where YAP expects to find the YAP Prolog library. Takes precedence over library_directory */
YAP_FLAG(PROLOG_LIBRARY_DIRECTORY_FLAG, "prolog_library_directory", true, isatom, "", NULL),
YAP_FLAG(PROLOG_FOREIGN_DIRECTORY_FLAG, "prolog_foreign_directory", true, isatom, "", NULL), /**< if defined, first location where YAP expects to find the YAP Prolog shared libraries (DLLS). Takes precedence over executable_directory/2. */
/**< if defined, first location where YAP expects to find the YAP Prolog shared libraries (DLLS). Takes precedence over executable_directory/2. */
YAP_FLAG(PROLOG_FOREIGN_DIRECTORY_FLAG, "prolog_foreign_directory", true, isatom, "", NULL),
YAP_FLAG(MAX_ARITY_FLAG, "max_arity", false, isatom, "unbounded",
NULL), /**< `max_arity is iso `
/**< `max_arity is iso `
Read-only flag telling the maximum arity of a functor. Takes the value
`unbounded` for the current version of YAP.
*/
YAP_FLAG(MAX_ARITY_FLAG, "max_arity", false, isatom, "unbounded",
NULL),
YAP_FLAG(MAX_TAGGED_INTEGER_FLAG, "max_tagged_integer", false, at2n,
"INT_MAX", NULL),
YAP_FLAG(MAX_THREADS_FLAG, "max_threads", false, at2n, "MAX_THREADS", NULL),
@ -304,43 +330,46 @@ Read-only flag telling the maximum arity of a functor. Takes the value
"256", NULL),
YAP_FLAG(OCCURS_CHECK_FLAG, "occurs_check", true, booleanFlag, "false",
NULL),
YAP_FLAG(OPEN_EXPANDS_FILENAME_FLAG, "open_expands_filename", true,
booleanFlag, "false", NULL), /**< `open_expands_filename `
/**< `open_expands_filename `
If `true` the open/3 builtin performs filename-expansion
before opening a file (SICStus Prolog like). If `false` it does not
(SWI-Prolog like).
*/
YAP_FLAG(OPEN_SHARED_OBJECT_FLAG, "open_shared_object", true, booleanFlag,
"true", NULL), /**< `open_shared_object `
YAP_FLAG(OPEN_EXPANDS_FILENAME_FLAG, "open_expands_filename", true,
booleanFlag, "false", NULL),
/**< `open_shared_object `
If true, `open_shared_object/2` and friends are implemented,
providing access to shared libraries (`.so` files) or to dynamic link
libraries (`.DLL` files).
*/
// YAP_FLAG(MODULE_INDEPENDENT_OPERATORS_FLAG,
// "module_independent_operators", true, booleanFlag,
// "false", NULL),
/**< `module_independent_operators `
YAP_FLAG(OPEN_SHARED_OBJECT_FLAG, "open_shared_object", true, booleanFlag,
"true", NULL),
/**< `module_independent_operators `
If `true` an operator declaration will be valid for every module in the
program. This is for compatibility with old software that
might expect module-independent operators.
*/
// YAP_FLAG(MODULE_INDEPENDENT_OPERATORS_FLAG,
// "module_independent_operators", true, booleanFlag,
// "false", NULL),
YAP_FLAG(OPTIMISE_FLAG, "optimise", true, booleanFlag, "false", NULL),
YAP_FLAG(OS_ARGV_FLAG, "os_argv", false, os_argv, "@boot", NULL),
YAP_FLAG(PID_FLAG, "pid", false, sys_pid, "@boot", NULL),
YAP_FLAG(PIPE_FLAG, "pipe", true, booleanFlag, "true", NULL),
YAP_FLAG(PROFILING_FLAG, "profiling", true, booleanFlag, "false",
NULL), /**< `profiling `
/**< `profiling `
If `off` (default) do not compile call counting information for
procedures. If `on` compile predicates so that they calls and
retries to the predicate may be counted. Profiling data can be read through the
call_count_data/3 built-in.
*/
YAP_FLAG(PROMPT_ALTERNATIVES_ON_FLAG, "prompt_alternatives_on", true,
isatom, "determinism", NULL), /**< `prompt_alternatives_on(atom,
YAP_FLAG(PROFILING_FLAG, "profiling", true, booleanFlag, "false",
NULL),
/**< `prompt_alternatives_on(atom,
changeable) `
SWI-Compatible option, determines prompting for alternatives in the Prolog
@ -348,60 +377,69 @@ call_count_data/3 built-in.
only if the query contains variables. The alternative, default in SWI-Prolog is
<tt>determinism</tt> which implies the system prompts for alternatives if the
goal succeeded while leaving choicepoints. */
YAP_FLAG(PROMPT_ALTERNATIVES_ON_FLAG, "prompt_alternatives_on", true,
isatom, "determinism", NULL),
YAP_FLAG(QUASI_QUOTATIONS_FLAG, "quasi_quotations", true, booleanFlag,
"true", NULL),
YAP_FLAG(READLINE_FLAG, "readline", true, booleanFlag, "false",
Yap_InitReadline), /**< `readline(boolean, changeable)`
/**< `readline(boolean, changeable)`
}
enable the use of the readline library for console interactions, true by default
if readline was found. */
YAP_FLAG(READLINE_FLAG, "readline", true, booleanFlag, "false",
Yap_InitReadline),
YAP_FLAG(REPORT_ERROR_FLAG, "report_error", true, booleanFlag, "true",
NULL),
YAP_FLAG(RESOURCE_DATABASE_FLAG, "resource_database", false, isatom,
YAP_BOOTSTRAP, NULL),
/**<`resource_database`
/**<`resource_database`
Name of the resource file (saved-state or Prolog file) used to construct
the YAP
run-time environment.
*/
YAP_FLAG(SAVED_PROGRAM_FLAG, "saved_program", false, booleanFlag, "false",
NULL),
/**<`saved_program`
YAP_FLAG(RESOURCE_DATABASE_FLAG, "resource_database", false, isatom,
YAP_BOOTSTRAP, NULL),
/**<`saved_program`
if `true` YAP booted from a `yss` file, usually `startup.yss'. If
`false`, YAP booted from a Prolog file, by default `boot.yap`.
*/
YAP_FLAG(SHARED_OBJECT_EXTENSION_FLAG, "shared_object_extension", false,
isatom, SO_EXT, NULL), /**< `shared_object_extension `
YAP_FLAG(SAVED_PROGRAM_FLAG, "saved_program", false, booleanFlag, "false",
NULL),
/**< `shared_object_extension `
Suffix associated with loadable code.
*/
YAP_FLAG(SHARED_OBJECT_SEARCH_PATH_FLAG, "shared_object_search_path", true,
isatom, SO_PATH, NULL), /**< `shared_object_search_path `
YAP_FLAG(SHARED_OBJECT_EXTENSION_FLAG, "shared_object_extension", false,
isatom, SO_EXT, NULL),
/**< `shared_object_search_path `
Name of the environment variable used by the system to search for shared
objects.
*/
YAP_FLAG(SHARED_OBJECT_SEARCH_PATH_FLAG, "shared_object_search_path", true,
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), /**< `single_quoted text is usuallly interpreted as atoms. This flagTerm allows other inerpretations such as strings_contains_strings */
sqf),
YAP_FLAG(SIGNALS_FLAG, "signals", true, booleanFlag, "true",
NULL), /**< `signals`
/**< `signals`
If `true` (default) YAP handles Signals such as `^C`
(`SIGINT`).
*/
YAP_FLAG(SOURCE_FLAG, "source", true, booleanFlag, "true",
NULL), /**< `source`
YAP_FLAG(SIGNALS_FLAG, "signals", true, booleanFlag, "true",
NULL),
/**< `source`
If `true` maintain the source for all clauses. Notice that this is trivially
supported for facts, and always supported for dynamic code.
*/
YAP_FLAG(STRICT_ISO_FLAG, "strict_iso", true, booleanFlag, "false",
NULL), /**< `strict_iso `
YAP_FLAG(SOURCE_FLAG, "source", true, booleanFlag, "true",
NULL),
/**< `strict_iso `
If _Value_ is unbound, tell whether strict ISO compatibility mode
is `on` or `off`. If _Value_ is bound to `on` set
@ -423,9 +461,9 @@ believe this mode is mostly useful when investigating how a program
depends on a Prolog's platform specific features.
*/
YAP_FLAG(SYSTEM_OPTIONS_FLAG, "system_options", false, options,
SYSTEM_OPTIONS,
NULL), /**< `system_options `
YAP_FLAG(STRICT_ISO_FLAG, "strict_iso", true, booleanFlag, "false",
NULL),
/**< `system_options `
This read only flag tells which options were used to compile
YAP. Currently it informs whether the system supports `big_numbers`,
@ -433,22 +471,24 @@ YAP. Currently it informs whether the system supports `big_numbers`,
`or-parallelism`, `rational_trees`, `readline`, `tabling`,
`threads`, or the `wam_profiler`.
*/
YAP_FLAG(SYSTEM_OPTIONS_FLAG, "system_options", false, options,
SYSTEM_OPTIONS,
NULL),
YAP_FLAG(SYSTEM_THREAD_ID_FLAG, "system_thread_id", false, sys_thread_id,
"@boot", NULL),
YAP_FLAG(TABLING_MODE_FLAG, "tabling_mode", true, isatom, "[]",
NULL), /**< `tabling_mode`
/**< `tabling_mode`
Sets or reads the tabling mode for all tabled predicates. Please
(see Tabling) for the list of options.
*/
YAP_FLAG(TABLING_MODE_FLAG, "tabling_mode", true, isatom, "[]",
NULL),
YAP_FLAG(THREADS_FLAG, "threads", false, ro, "MAX_THREADS", NULL),
YAP_FLAG(TIMEZONE_FLAG, "timezone", false, ro, "18000", NULL),
YAP_FLAG(TOPLEVEL_PRINT_ANON_FLAG, "toplevel_print_anon", true, booleanFlag,
"true", NULL),
YAP_FLAG(TOPLEVEL_PRINT_OPTIONS_FLAG, "toplevel_print_options", true,
list_option, "[quoted(true),numbervars(true),portrayed(true)]",
NULL), /**< `toplevel_hook `
/**< `toplevel_hook `
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
@ -456,17 +496,20 @@ presented. Only the first solution is considered and the goal is not
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, "?- ",
mkprompt),
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
running on an Unix system. Defined if the C-compiler used to compile
this version of YAP either defines `__unix__` or `unix`.
*/
YAP_FLAG(UPDATE_SEMANTICS_FLAG, "update_semantics", true, isatom, "logical",
NULL), /**< `update_semantics `
YAP_FLAG(UNIX_FLAG, "unix", false, ro, "true", NULL),
/**< `update_semantics `
Define whether YAP should follow `immediate` update
semantics, as in C-Prolog (default), `logical` update semantics,
@ -475,7 +518,9 @@ also an intermediate mode, `logical_assert`, where dynamic
procedures follow logical semantics but the internal data base still
follows immediate semantics.
*/
YAP_FLAG(USER_FLAGS_FLAG, "user_flags", true, isatom, "error", NULL), /**<
YAP_FLAG(UPDATE_SEMANTICS_FLAG, "update_semantics", true, isatom, "logical",
NULL),
/**<
`user_flags `
Define the behaviour of set_prolog_flag/2 if the flag is not known. Values
@ -486,18 +531,19 @@ follows immediate semantics.
are encouraged to use `create_prolog_flag/3` to create flags for their
library.
*/
YAP_FLAG(UNKNOWN_FLAG, "unknown", true, isatom, "error",
Yap_unknown), /**< `unknown is iso`
YAP_FLAG(USER_FLAGS_FLAG, "user_flags", true, isatom, "error", NULL),
/**< `unknown is iso`
Corresponds to calling the unknown/2 built-in. Possible ISO values
are `error`, `fail`, and `warning`. Yap includes the following extensions:
`fast_fail` does not invoke any handler.
*/
YAP_FLAG(UNKNOWN_FLAG, "unknown", true, isatom, "error",
Yap_unknown),
YAP_FLAG(VARIABLE_NAMES_MAY_END_WITH_QUOTES_FLAG,
"variable_names_may_end_with_quotes", true, booleanFlag, "false",
NULL),
YAP_FLAG(VERBOSE_FLAG, "verbose", true, isatom, "normal",
NULL), /**< `verbose `
/**< `verbose `
If `normal` allow printing of informational and banner messages,
such as the ones that are printed when consulting. If `silent`
@ -505,34 +551,38 @@ disable printing these messages. It is `normal` by default except if
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,
"false", NULL),
YAP_FLAG(VERBOSE_FILE_SEARCH_FLAG, "verbose_file_search", true, booleanFlag,
"false", NULL), /**< `verbose_file_search `
/**< `verbose_file_search `
If `true` allow printing of informational messages when
searching for file names. If `false` disable printing these messages. It
is `false` by default except if YAP is booted with the `-L`
flag.
*/
YAP_FLAG(VERBOSE_LOAD_FLAG, "verbose_load", true, isatom, "normal",
NULL), /**< `verbose_load `
YAP_FLAG(VERBOSE_FILE_SEARCH_FLAG, "verbose_file_search", true, booleanFlag,
"false", NULL),
/**< `verbose_load `
If `true` allow printing of informational messages when
consulting files. If `false` disable printing these messages. It
is `normal` by default except if YAP is booted with the `-L`
flag.
*/
YAP_FLAG(VERSION_FLAG, "version", false, nat, YAP_NUMERIC_VERSION,
NULL), /**< `version_data `
YAP_FLAG(VERBOSE_LOAD_FLAG, "verbose_load", true, isatom, "normal",
NULL),
/**< `version_data `
Read-only flag that unifies with a number of the form
`_Major_ * 100000 + _Minor_ *100 + _Patch_`, where
_Major_ is the major version, _Minor_ is the minor version,
and _Patch_ is the patch number.
*/
YAP_FLAG(VERSION_DATA_FLAG, "version_data", false, ro, YAP_TVERSION,
NULL), /**<
YAP_FLAG(VERSION_FLAG, "version", false, nat, YAP_NUMERIC_VERSION,
NULL),
/**<
`version ` 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 first
argument will be the
@ -540,27 +590,35 @@ and _Patch_ is the patch number.
last one is reserved.
*/
YAP_FLAG(VERSION_GIT_FLAG, "version_git", false, isatom, YAP_GIT_HEAD,
NULL), /**< `version_git `
YAP_FLAG(VERSION_DATA_FLAG, "version_data", false, ro, YAP_TVERSION,
NULL),
/**< `version_git `
`
this is the unique identifier for the last commit of the current GIT HEAD, it
xan be used to identify versions that differ on small (or large) updates.
*/
YAP_FLAG(VERSION_GIT_FLAG, "version_git", false, isatom, YAP_GIT_HEAD,
NULL),
YAP_FLAG(WRITE_ATTRIBUTES_FLAG, "write_attributes", true, isatom, "ignore",
NULL),
#if __WINDOWS__
YAP_FLAG(WINDOWS_FLAG, "windows", false, ro, "true", NULL), /**< `windows `
/**< `windows `
Read-only booleanFlag flag that unifies with `true` if YAP is
running on an Windows machine.
*/
YAP_FLAG(WINDOWS_FLAG, "windows", false, ro, "true", NULL),
#endif
YAP_FLAG(WRITE_STRINGS_FLAG, "write_strings", true, booleanFlag, "false",
NULL), /**< `write_strings `
/**< `write_strings `
Writable flag telling whether the system should write lists of
integers that are writable character codes using the list notation. It
is `on` if enables or `off` if disabled. The default value for
this flag is `off`.
*/
YAP_FLAG(WRITE_STRINGS_FLAG, "write_strings", true, booleanFlag, "false",
NULL),
} global_flag_t;
//! @}

View File

@ -1,4 +1,5 @@
/*************************************************************************
* *
* YAP Prolog *
@ -19,8 +20,16 @@
/** @file YapLFlagInfo.h
@addtogroup YAPFlags
@ingroup builtins
@{
@enum LocalFlags local Flags supported by YAP
@brief local flag:
*/
typedef enum {
/** + `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 */
@ -119,3 +128,6 @@ automatically redirects the user_error alias to the original
*/
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 ),
} local_flag_t;

View File

@ -14,7 +14,9 @@
*************************************************************************/
/* prototype file for Yap */
/// @file Prototype Declarations
/// @file Yapproto.h
///
/// @brief Prototype Declarations
#ifndef YAP_PROTOS_H
#define YAP_PROTOS_H 1
@ -535,3 +537,5 @@ extern void init_myddas(void);
#endif
#endif /* YAP_PROTOS_H */
/// @}

View File

@ -11,6 +11,11 @@
** **
************************************************************************/
/// @file opt.preds.c
///
/// @namespace prolog
/************************************
** Includes & Prototypes **
************************************/

View File

@ -1,4 +1,4 @@
# Doxyfile 1.8.11
# Doxyfile 1.8.14
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
@ -8,9 +8,9 @@
#
# All text after a single hash (#) is considered a comment and will be ignored.
# The format is:
# TAG = value [value, file.]
# TAG = value [value, ...]
# For lists, items can also be appended using:
# TAG += value [value, file.]
# TAG += value [value, ...]
# Values that contain spaces should be placed between quotes (\" \").
#---------------------------------------------------------------------------
@ -98,7 +98,7 @@ OUTPUT_LANGUAGE = English
# documentation (similar to Javadoc). Set to NO to disable this.
# The default value is: YES.
BRIEF_MEMBER_DESC = YES
BRIEF_MEMBER_DESC = YES
# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief
# description of a member or function before the detailed description
@ -229,9 +229,14 @@ TAB_SIZE = 4
# "Side Effects:". You can put \n's in the value part of an alias to insert
# newlines.
ALIASES = "predicate=@brief" "license=@par License:\n" \
"doxygen=\if english" "endenglish=\endif" "dutch=\if dutch" \
"enddutch=\endif" "tbd=@par TBD:\n" "compat=@par Compatibility:\n" \
ALIASES = "predicate=@brief" \
"license=@par License:\n" \
"doxygen=\if english" \
"endenglish=\endif" \
"dutch=\if dutch" \
"enddutch=\endif" \
"tbd=@par TBD:\n" \
"compat=@par Compatibility:\n" \
"error=@par Error:\n"
# This tag can be used to specify a number of word-keyword mappings (TCL only).
@ -291,7 +296,10 @@ OPTIMIZE_OUTPUT_FOR_PROLOG = YES
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
# the files are not read by doxygen.
EXTENSION_MAPPING = md pl=Prolog yap=Prolog ypp=Prolog
EXTENSION_MAPPING = md \
pl=Prolog \
yap=Prolog \
ypp=Prolog
# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
# according to the Markdown format, which allows for more readable
@ -303,6 +311,15 @@ EXTENSION_MAPPING = md pl=Prolog yap=Prolog ypp=Prolog
MARKDOWN_SUPPORT = YES
# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up
# to that level are automatically included in the table of contents, even if
# they do not have an id attribute.
# Note: This feature currently applies only to Markdown headings.
# Minimum value: 0, maximum value: 99, default value: 0.
# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
TOC_INCLUDE_HEADINGS = 0
# When enabled doxygen tries to link words that correspond to documented
# classes, or namespaces to their corresponding documentation. Such a link can
# be prevented in individual cases by putting a % sign in front of the word or
@ -407,7 +424,7 @@ TYPEDEF_HIDES_STRUCT = NO
# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
# doxygen will become slower. If the cache is too large, memory is wasted. The
# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
# is 0file9, the default is 0, corresponding to a cache size of 2^16=65536
# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
# symbols. At the end of a run doxygen will report the cache usage and suggest
# the optimal cache size from a speed point of view.
# Minimum value: 0, maximum value: 9, default value: 0.
@ -636,8 +653,8 @@ GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
# The ENABLED_SECTIONS tag can be used to enable conditional documentation
# sections, marked by \if <section_label> file. \endif and \cond <section_label>
# file. \endcond blocks.
# sections, marked by \if <section_label> ... \endif and \cond <section_label>
# ... \endcond blocks.
ENABLED_SECTIONS =
@ -694,7 +711,7 @@ FILE_VERSION_FILTER =
# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
# tag is left empty.
LAYOUT_FILE = @CMAKE_SOURCE_DIR@/docs/custom/DoxygenLayout.xml
LAYOUT_FILE =
# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
# the reference definitions. This must be a list of .bib files. The .bib
@ -728,7 +745,7 @@ WARNINGS = YES
# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate
# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
# will automatically be disabled.
# will automatically be disabled.
# The default value is: YES.
WARN_IF_UNDOCUMENTED = YES
@ -749,6 +766,12 @@ WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
# a warning is encountered.
# The default value is: NO.
WARN_AS_ERROR = NO
# The WARN_FORMAT tag determines the format of the warning messages that doxygen
# can produce. The string should contain the $file, $line, and $text tags, which
# will be replaced by the file and line number from which the warning originated
@ -777,7 +800,6 @@ WARN_LOGFILE =
INPUT = @DOC_INPUT_FILES@
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
@ -798,10 +820,56 @@ INPUT_ENCODING = UTF-8
# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd,
# *.vhdl, *.ucf, *.qsf, *.as and *.js.
# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08,
# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, *.qsf, *.as, *.js, *.yap, *.ypp,
# *.prolog and *.pl.
FILE_PATTERNS = *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.idl *.ddl *.odl *.h *.h.in *.hh *.hxx *.hpp *.h++ *.cs *.d *.php *.php4 *.php5 *.phtml *.inc *.m *.markdown *.md *.mm *.dox *.py *.f90 *.f *.for *.tcl *.vhd *.vhdl *.ucf *.qsf *.as *.js *.pl *.yap *.ypp
FILE_PATTERNS = *.c \
*.cc \
*.cxx \
*.cpp \
*.c++ \
*.java \
*.ii \
*.ixx \
*.ipp \
*.i++ \
*.inl \
*.idl \
*.ddl \
*.odl \
*.h \
*.h.in \
*.hh \
*.hxx \
*.hpp \
*.h++ \
*.cs \
*.d \
*.php \
*.php4 \
*.php5 \
*.phtml \
*.inc \
*.m \
*.markdown \
*.md \
*.mm \
*.dox \
*.py \
*.f90 \
*.f \
*.for \
*.tcl \
*.vhd \
*.vhdl \
*.ucf \
*.qsf \
*.as \
*.js \
*.pl \
*.yap \
*.ypp
# The RECURSIVE tag can be used to specify whether or not subdirectories should
# be searched for input files as well.
@ -832,14 +900,14 @@ EXCLUDE_SYMLINKS = NO
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories for example use the pattern */test/*
EXCLUDE_PATTERNS = \
@PROJECT_SOURCE_DIR@/*/bprolog/* \
EXCLUDE_PATTERNS = @PROJECT_SOURCE_DIR@/*/bprolog/* \
@PROJECT_SOURCE_DIR@/*/prism/* \
@PROJECT_SOURCE_DIR@/packages/gecode/gecode4_yap.cc \
@PROJECT_SOURCE_DIR@/packages/gecode/gecode3.yap \
@PROJECT_SOURCE_DIR@/packages/gecode/gecode4.yap \
@PROJECT_SOURCE_DIR@/packages/gecode/gecode3_yap_hand_written.yap \ @PROJECT_SOURCE_DIR@/packages/gecode/gecode4_yap_hand_written.yap
*/CMakeFiles/* *~ */\#* \
@PROJECT_SOURCE_DIR@/packages/gecode/gecode3_yap_hand_written.yap \
\ \
@PROJECT_SOURCE_DIR@/packages/gecode/gecode4_yap_hand_written.yap
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
@ -1029,7 +1097,7 @@ VERBATIM_HEADERS = YES
# classes, structs, unions or interfaces.
# The default value is: YES.
ALPHABETICAL_INDEX = NO
ALPHABETICAL_INDEX = YES
# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
# which the alphabetical index list will be split.
@ -1088,7 +1156,7 @@ HTML_FILE_EXTENSION = .html
# of the possible markers and block names see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_HEADER = @CMAKE_SOURCE_DIR@/docs/custom/header.html
HTML_HEADER =
# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
# generated HTML page. If the tag is left blank doxygen will generate a standard
@ -1098,7 +1166,8 @@ HTML_HEADER = @CMAKE_SOURCE_DIR@/docs/custom/header.html
# that doxygen normally uses.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_FOOTER = @CMAKE_SOURCE_DIR@/docs/custom/footer.html
HTML_FOOTER =
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
# sheet that is used by each HTML page. It can be used to fine-tune the look of
@ -1110,7 +1179,7 @@ HTML_FOOTER = @CMAKE_SOURCE_DIR@/docs/custom/footer.html
# obsolete.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_STYLESHEET =
HTML_STYLESHEET = YES
# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
# cascading style sheets that are included after the standard style sheets
@ -1123,9 +1192,8 @@ HTML_STYLESHEET =
# list). For an example see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_EXTRA_STYLESHEET = \
@CMAKE_SOURCE_DIR@/docs/custom/customdoxygen.css \
@CMAKE_SOURCE_DIR@/docs/custom/solarized-light.css \
HTML_EXTRA_STYLESHEET =
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note
@ -1135,7 +1203,7 @@ HTML_EXTRA_STYLESHEET = \
# files will be copied as-is; there are no commands or markers available.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_EXTRA_FILES = @CMAKE_HTML_EXTRA@
HTML_EXTRA_FILES =
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
# will adjust the colors in the style sheet and background images according to
@ -1176,13 +1244,24 @@ HTML_COLORSTYLE_GAMMA = 80
HTML_TIMESTAMP = NO
# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
# documentation will contain a main index with vertical navigation menus that
# are dynamically created via Javascript. If disabled, the navigation index will
# consists of multiple levels of tabs that are statically embedded in every HTML
# page. Disable this option to support browsers that do not have Javascript,
# like the Qt help browser.
# The default value is: YES.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_DYNAMIC_MENUS = YES
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
# documentation will contain sections that can be hidden and shown after the
# page has loaded.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_DYNAMIC_SECTIONS = NO
HTML_DYNAMIC_SECTIONS = YES
# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
# shown in the various tree structured indices initially; the user can expand
@ -1411,7 +1490,7 @@ DISABLE_INDEX = NO
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
GENERATE_TREEVIEW = NO
GENERATE_TREEVIEW = YES
# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
# doxygen will group on one line in the generated HTML documentation.
@ -1482,7 +1561,7 @@ MATHJAX_FORMAT = HTML-CSS
# output directory using the MATHJAX_RELPATH option. The destination directory
# should contain the MathJax.js script. For instance, if the mathjax directory
# is located at the same level as the HTML output directory, then
# MATHJAX_RELPATH should be file/mathjax. The default value points to the MathJax
# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
# Content Delivery Network so you can quickly see the result without installing
# MathJax. However, it is strongly recommended to install a local copy of
# MathJax from http://www.mathjax.org before deployment.
@ -1537,7 +1616,7 @@ SEARCHENGINE = YES
# The default value is: NO.
# This tag requires that the tag SEARCHENGINE is set to YES.
SERVER_BASED_SEARCH = YES
SERVER_BASED_SEARCH = NO
# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
# script for searching. Instead the search results are written to an XML file
@ -1869,7 +1948,7 @@ MAN_SUBDIR =
# The default value is: NO.
# This tag requires that the tag GENERATE_MAN is set to YES.
MAN_LINKS = NOoi9 0
MAN_LINKS = NO
#---------------------------------------------------------------------------
# Configuration options related to the XML output
@ -1879,7 +1958,7 @@ MAN_LINKS = NOoi9 0
# captures the structure of the code including all documentation.
# The default value is: NO.
GENERATE_XML = NO
GENERATE_XML = YES
# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
@ -2019,7 +2098,7 @@ INCLUDE_PATH = @CMAKE_BINARY_DIR@ \
@PROJECT_SOURCE_DIR@/H/generated \
@PROJECT_SOURCE_DIR@/include \
@PROJECT_SOURCE_DIR@/os \
@PROJECT_SOURCE_DIR@/OPTYap \
@PROJECT_SOURCE_DIR@/OPTYap
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
# patterns (like *.h and *.hpp) to filter out the header-files in the
@ -2067,7 +2146,7 @@ SKIP_FUNCTION_MACROS = YES
# a tag file without this location is as follows:
# TAGFILES = file1 file2 ...
# Adding location for the tag files is done as follows:
# TAGFILES = file1=loc1 "file2 = loc2" file.
# TAGFILES = file1=loc1 "file2 = loc2" ...
# where loc1 and loc2 can be relative or absolute paths or URLs. See the
# section "Linking to external documentation" for more information about the use
# of tag files.
@ -2359,6 +2438,11 @@ DIAFILE_DIRS =
PLANTUML_JAR_PATH =
# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a
# configuration file for plantuml.
PLANTUML_CFG_FILE =
# When using plantuml, the specified paths are searched for files specified by
# the !include statement in a plantuml block.

View File

@ -5,17 +5,22 @@
:- initialization(main).
:- yap_flag(write_strings,on).
main :-
popen('find . \\( -name \"*.pl\" -o -name \"*.yap\" -o -name \"*.c\" -o -name \"*.h\" -o -name \"*.cpp\" -o -name \"*.hh\" \\) -type f -print | xargs grep \"@defgroup\\|@ingroup\\|@addtogroup\\|@\\{\\|@\\}\"', read, S),
S = popen('./get_comments'),
file_filter_with_start_end( S, user_output, add2graph, initgraph, checkgraph).
initgraph(_,_).
initgraph(_,_) :-
retractall(node(_,_,_,_)),
retractall(edge(_,_,_)),
retractall(e_b_n(_,_,_)).
:- dynamic node/3, edge/3, e_b_n/3.
:- dynamic node/4, edge/3, e_b_n/3.
checkgraph(_,_) :-
e_b_n(F,KN,_C),
node(KF,KN,_),
node(_,KF,KN,_),
add_edge(KF, F, KN),
fail.
checkgraph(_,_) :-
@ -23,10 +28,12 @@ checkgraph(_,_) :-
listing(edge).
add2graph(Line, _Out) :-
split( Line, "% \t/*:", [File, Job, Name|_]),
append( _, L, Line),
add2graph(Line, _Out) :-
writeln(Line),
split( Line, ":@% \t*", [File, Job, Name|_]),
append(Name, R, L),
append( _, L, Line),
!,
dispatch( Name, File, Job, R).
dispatch( Name, File, "defgroup", Comment):-
@ -45,20 +52,26 @@ dispatch( Name, File, "ingroup", Comment):-
atom_codes(C, Comment),
add_edge(KF, KN,C).
add_node(F, K,_C) :-
node(_,K,_),
throw( repeat(F:K) ).
node(d,F0,K,_),
!,
throw( repeat(K:F0/F) ).
add_node(F, K,_C) :-
retract(node(d,F1,K,_)),
!,
assert(edge(F,F1,K)),
assert(node(d,F,K,C)).
add_node(F, K,C) :-
assert(node(F,K,C)).
assert(node(d,F,K,C)).
add_node_edge(F, K,_C) :-
node(F1,K,_),
node(_,F1,K,_),
!,
assert(edge(F1,F,K)).
add_node_edge(F, K,C) :-
assert(node(F,K,C)).
assert(node(a,F,K,C)).
add_edge(F, K,_C) :-
node(F1,K,_),
node(_,F1,K,_),
!,
assert(edge(F1,F,K)).
add_edge(F, K,C) :-

View File

@ -31,362 +31,6 @@ interface.
+ @ref CohYroutining
+ @ref AttributeVariables_Builtins
@section SICS_attributes SICStus Style attribute declarations.
The YAP library `atts` implements attribute variables in the style of
SICStus Prolog. Attributed variables work as follows:
+ Each attribute must be declared beforehand. Attributes are described
as a functor with name and arity and are local to a module. Each
Prolog module declares its own sets of attributes. Different modules
may have attributes with the same name and arity.
+ The built-in put_atts/2 adds or deletes attributes to a
variable. The variable may be unbound or may be an attributed
variable. In the latter case, YAP discards previous values for the
attributes.
+ The built-in get_atts/2 can be used to check the values of
an attribute associated with a variable.
+ The unification algorithm calls the user-defined predicate
verify_attributes/3 before trying to bind an attributed
variable. Unification will resume after this call.
+ The user-defined predicate
<tt>attribute_goal/2</tt> converts from an attribute to a goal.
+ The user-defined predicate
<tt>project_attributes/2</tt> is used from a set of variables into a set of
constraints or goals. One application of <tt>project_attributes/2</tt> is in
the top-level, where it is used to output the set of
floundered constraints at the end of a query.
Attributes are compound terms associated with a variable. Each attribute
has a <em>name</em> which is <em>private</em> to the module in which the
attribute was defined. Variables may have at most one attribute with a
name. Attribute names are defined through the following declaration:
~~~~~
:- attribute AttributeSpec, ..., AttributeSpec.
~~~~~
where each _AttributeSpec_ has the form ( _Name_/ _Arity_).
One single such declaration is allowed per module _Module_.
Although the YAP module system is predicate based, attributes are local
to modules. This is implemented by rewriting all calls to the
built-ins that manipulate attributes so that attribute names are
preprocessed depending on the module. The `user:goal_expansion/3`
mechanism is used for this purpose.
The attribute manipulation predicates always work as follows:
+ The first argument is the unbound variable associated with
attributes,
+ The second argument is a list of attributes. Each attribute will
be a Prolog term or a constant, prefixed with the <tt>+</tt> and <tt>-</tt> unary
operators. The prefix <tt>+</tt> may be dropped for convenience.
The following three procedures are available to the user. Notice that
these built-ins are rewritten by the system into internal built-ins, and
that the rewriting process <em>depends</em> on the module on which the
built-ins have been invoked.
The user-predicate predicate verify_attributes/3 is called when
attempting to unify an attributed variable which might have attributes
in some _Module_.
Attributes are usually presented as goals. The following routines are
used by built-in predicates such as call_residue/2 and by the
Prolog top-level to display attributes:
Constraint solvers must be able to project a set of constraints to a set
of variables. This is useful when displaying the solution to a goal, but
may also be used to manipulate computations. The user-defined
project_attributes/2 is responsible for implementing this
projection.
The following examples are taken from the SICStus Prolog
manual. The sketches the implementation of a simple finite domain
`solver`. Note that an industrial strength solver would have to
provide a wider range of functionality and that it quite likely would
utilize a more efficient representation for the domains proper. The
module exports a single predicate `domain( _-Var_, _?Domain_)` which
associates _Domain_ (a list of terms) with _Var_. A variable can be
queried for its domain by leaving _Domain_ unbound.
We do not present here a definition for project_attributes/2.
Projecting finite domain constraints happens to be difficult.
~~~~~
:- module(domain, [domain/2]).
:- use_module(library(atts)).
:- use_module(library(ordsets), [
ord_intersection/3,
ord_intersect/2,
list_to_ord_set/2
]).
:- attribute dom/1.
verify_attributes(Var, Other, Goals) :-
get_atts(Var, dom(Da)), !, % are we involved?
( var(Other) -> % must be attributed then
( get_atts(Other, dom(Db)) -> % has a domain?
ord_intersection(Da, Db, Dc),
Dc = [El|Els], % at least one element
( Els = [] -> % exactly one element
Goals = [Other=El] % implied binding
; Goals = [],
put_atts(Other, dom(Dc))% rescue intersection
)
; Goals = [],
put_atts(Other, dom(Da)) % rescue the domain
)
; Goals = [],
ord_intersect([Other], Da) % value in domain?
).
verify_attributes(_, _, []). % unification triggered
% because of attributes
% in other modules
attribute_goal(Var, domain(Var,Dom)) :- % interpretation as goal
get_atts(Var, dom(Dom)).
domain(X, Dom) :-
var(Dom), !,
get_atts(X, dom(Dom)).
domain(X, List) :-
list_to_ord_set(List, Set),
Set = [El|Els], % at least one element
( Els = [] -> % exactly one element
X = El % implied binding
; put_atts(Fresh, dom(Set)),
X = Fresh % may call
% verify_attributes/3
).
~~~~~
Note that the _implied binding_ `Other=El` was deferred until after
the completion of `verify_attribute/3`. Otherwise, there might be a
danger of recursively invoking `verify_attribute/3`, which might bind
`Var`, which is not allowed inside the scope of `verify_attribute/3`.
Deferring unifications into the third argument of `verify_attribute/3`
effectively serializes the calls to `verify_attribute/3`.
Assuming that the code resides in the file domain.yap, we
can use it via:
~~~~~
| ?- use_module(domain).
~~~~~
Let's test it:
~~~~~
| ?- domain(X,[5,6,7,1]), domain(Y,[3,4,5,6]), domain(Z,[1,6,7,8]).
domain(X,[1,5,6,7]),
domain(Y,[3,4,5,6]),
domain(Z,[1,6,7,8]) ?
yes
| ?- domain(X,[5,6,7,1]), domain(Y,[3,4,5,6]), domain(Z,[1,6,7,8]),
X=Y.
Y = X,
domain(X,[5,6]),
domain(Z,[1,6,7,8]) ?
yes
| ?- domain(X,[5,6,7,1]), domain(Y,[3,4,5,6]), domain(Z,[1,6,7,8]),
X=Y, Y=Z.
X = 6,
Y = 6,
Z = 6
~~~~~
To demonstrate the use of the _Goals_ argument of
verify_attributes/3, we give an implementation of
freeze/2. We have to name it `myfreeze/2` in order to
avoid a name clash with the built-in predicate of the same name.
~~~~~
:- module(myfreeze, [myfreeze/2]).
:- use_module(library(atts)).
:- attribute frozen/1.
verify_attributes(Var, Other, Goals) :-
get_atts(Var, frozen(Fa)), !, % are we involved?
( var(Other) -> % must be attributed then
( get_atts(Other, frozen(Fb)) % has a pending goal?
-> put_atts(Other, frozen((Fa,Fb))) % rescue conjunction
; put_atts(Other, frozen(Fa)) % rescue the pending goal
),
Goals = []
; Goals = [Fa]
).
verify_attributes(_, _, []).
attribute_goal(Var, Goal) :- % interpretation as goal
get_atts(Var, frozen(Goal)).
myfreeze(X, Goal) :- put_atts(Fresh, frozen(Goal)), Fresh = X. ~~~~~
Assuming that this code lives in file myfreeze.yap,
we would use it via:
~~~~~
| ?- use_module(myfreeze).
| ?- myfreeze(X,print(bound(x,X))), X=2.
bound(x,2) % side effect
X = 2 % bindings
~~~~~
The two solvers even work together:
~~~~~
| ?- myfreeze(X,print(bound(x,X))), domain(X,[1,2,3]),
domain(Y,[2,10]), X=Y.
bound(x,2) % side effect
X = 2, % bindings
Y = 2
~~~~~
The two example solvers interact via bindings to shared attributed
variables only. More complicated interactions are likely to be found
in more sophisticated solvers. The corresponding
verify_attributes/3 predicates would typically refer to the
attributes from other known solvers/modules via the module prefix in
Module:get_atts/2`.
@}
@{
@defgroup New_Style_Attribute_Declarations hProlog and SWI-Prolog style Attribute Declarations
The following documentation is taken from the SWI-Prolog manual.
Binding an attributed variable schedules a goal to be executed at the
first possible opportunity. In the current implementation the hooks are
executed immediately after a successful unification of the clause-head
or successful completion of a foreign language (built-in) predicate. Each
attribute is associated to a module and the hook attr_unify_hook/2 is
executed in this module. The example below realises a very simple and
incomplete finite domain reasoner.
~~~~~
:- module(domain,
[ domain/2 % Var, ?Domain %
]).
:- use_module(library(ordsets)).
domain(X, Dom) :-
var(Dom), !,
get_attr(X, domain, Dom).
domain(X, List) :-
list_to_ord_set(List, Domain),
v put_attr(Y, domain, Domain),
X = Y.
% An attributed variable with attribute value Domain has been %
% assigned the value Y %
attr_unify_hook(Domain, Y) :-
( get_attr(Y, domain, Dom2)
-> ord_intersection(Domain, Dom2, NewDomain),
( NewDomain == []
-> fail
; NewDomain = [Value]
-> Y = Value
; put_attr(Y, domain, NewDomain)
)
; var(Y)
-> put_attr( Y, domain, Domain )
; ord_memberchk(Y, Domain)
).
% Translate attributes from this module to residual goals %
attribute_goals(X) -->
{ get_attr(X, domain, List) },
[domain(X, List)].
~~~~~
Before explaining the code we give some example queries:
The predicate `domain/2` fetches (first clause) or assigns
(second clause) the variable a <em>domain</em>, a set of values it can
be unified with. In the second clause first associates the domain
with a fresh variable and then unifies X to this variable to deal
with the possibility that X already has a domain. The
predicate attr_unify_hook/2 is a hook called after a variable with
a domain is assigned a value. In the simple case where the variable
is bound to a concrete value we simply check whether this value is in
the domain. Otherwise we take the intersection of the domains and either
fail if the intersection is empty (first example), simply assign the
value if there is only one value in the intersection (second example) or
assign the intersection as the new domain of the variable (third
example). The nonterminal `attribute_goals/3` is used to translate
remaining attributes to user-readable goals that, when executed, reinstate
these attributes.
@}
@{
@defgroup CohYroutining Co-routining
Prolog uses a simple left-to-right flow of control. It is sometimes
convenient to change this control so that goals will only execute when
sufficiently instantiated. This may result in a more "data-driven"
execution, or may be necessary to correctly implement extensions such
as negation by failure.
Initially, YAP used a separate mechanism for co-routining. Nowadays, YAP uses
attributed variables to implement co-routining.
Two declarations are supported:
+ block/1
The argument to `block/1` is a condition on a goal or a conjunction
of conditions, with each element separated by commas. Each condition is
of the form `predname( _C1_,..., _CN_)`, where _N_ is the
arity of the goal, and each _CI_ is of the form `-`, if the
argument must suspend until the first such variable is bound, or
`?`, otherwise.
+ wait/1
The argument to `wait/1` is a predicate descriptor or a conjunction
of these predicates. These predicates will suspend until their first
argument is bound.
The following primitives can be used:
- freeze/2
- dif/2
- when/2
- frozen/2
@}
@}

View File

@ -878,8 +878,7 @@ a solution was found.
Notice that you cannot create new slots if an YAP_ExnterGoal goal is open.
</li>
<li>`YAP_Bool` YAP_RetryGoal(`YAP_dogoalinfo \*` _infop_) @anchor
YAP_RetryGoal
<li>`YAP_Bool` YAP_RetryGoal(`YAP_dogoalinfo \*` _infop_) @anchor YAP_RetryGoal
Backtrack to a query created by [YAP_EnterGoal](@ref YAP_EnterGoal). The query
@ -984,8 +983,8 @@ collector, the second does the same for the atom garbage collector.`
</li>
<li>`void \*` YAP_ExternalDataInStackFromTerm(`YAP_Term t`)
</li>
<li>`YAP_Bool` YAP_IsExternalDataInStackTerm(`YAP_Term t`) @anchor
YAP_AllocExternalDataInStack
<li>`YAP_Bool` YAP_IsExternalDataInStackTerm(`YAP_Term t`)
@anchor YAP_AllocExternalDataInStack
The next routines allow one to store external data in the Prolog
@ -1000,8 +999,8 @@ so it should not be used to store Prolog terms. On the other hand, it
may be useful to store arrays in a compact way, or pointers to external objects.
</li>
<li>`int` YAP_HaltRegisterHook(`YAP_halt_hook f, void \*closure`) @anchor
YAP_HaltRegisterHook
<li>`int` YAP_HaltRegisterHook(`YAP_halt_hook f, void \*closure`)
@anchor YAP_HaltRegisterHook
Register the function _f_ to be called if YAP is halted. The
@ -1076,8 +1075,8 @@ the predicate and _arity_ is the predicate's arity.
</li>
<li>void YAP_UserBackCPredicate(char \* _name_, int \* _init_(), int \*
_cont_(), unsigned long int _arity_, unsigned int _sizeof_) @anchor
YAP_UserBackCPredicate
_cont_(), unsigned long int _arity_, unsigned int _sizeof_)
@anchor YAP_UserBackCPredicate
describes a new predicate where _name_ is the name of the predicate,
_init_, and _cont_ are the C functions that implement the
@ -1092,8 +1091,8 @@ predicate and _arity_ is the predicate's arity.
</li>
<li>void YAP_PRESERVED_DATA_CUT( _ptr_, _type_); @anchor
YAP_PRESERVED_DATA_CUT
<li>void YAP_PRESERVED_DATA_CUT( _ptr_, _type_);
@anchor YAP_PRESERVED_DATA_CUT
</li>

View File

@ -3,10 +3,10 @@
@brief Next, we present the main predicates and directives available to load
files and to control the Prolog environment.
+ @subpage YAPConsulting
+ @ref YAPConsulting
+ @subpage YAPModules
+ @ref YAPModules
+ @subpage YAPBigLoad
+ @ref YAPBigLoad

View File

@ -309,7 +309,7 @@ Punctuation tokens consist of one of the following characters:
These characters are used to group terms.
@subsection Layout Layout
@subsection LayoutComents Character Layout
Any characters with ASCII code less than or equal to 32 appearing before
a token are ignored.

View File

@ -5682,21 +5682,33 @@ attribute_goals(X) -->
),
attributes_goals(Ps).
%% @namespace clpfd_aux
clpfd_aux:attribute_goals(_) --> [].
clpfd_aux:attr_unify_hook(_,_) :- false.
%% @namespace clpfd_gcc_vs
clpfd_gcc_vs:attribute_goals(_) --> [].
clpfd_gcc_vs:attr_unify_hook(_,_) :- false.
%% @namespace clpfd_gcc_num
clpfd_gcc_num:attribute_goals(_) --> [].
clpfd_gcc_num:attr_unify_hook(_,_) :- false.
%% @namespace clpfd_gcc_occurred
clpfd_gcc_occurred:attribute_goals(_) --> [].
clpfd_gcc_occurred:attr_unify_hook(_,_) :- false.
%% @namespace clpfd_relation
clpfd_relation:attribute_goals(_) --> [].
clpfd_relation:attr_unify_hook(_,_) :- false.
%% @namespace clpfd_original
clpfd_original:attribute_goals(_) --> [].
clpfd_original:attr_unify_hook(_,_) :- false.

View File

@ -2,6 +2,9 @@
% SWI emulation.
% written in an on-demand basis.
%%
%% @file dialect/swi.yap
%%
%% @defgroup SWI Compatibility with SWI-Prolog and Other Prolog systems
%% @{
%% @ingroup YAPProgramming
@ -296,7 +299,7 @@ flag(Key, 0, New) :-
recorda(K, New, _).
current_flag(Key) :-
swi:flag(Key).
flag(Key).
require(F) :-
must_be(list, F),

View File

@ -3,12 +3,10 @@
* @author Bob Welham, Lawrence Byrd, and R. A. O'Keefe. Contributions from Vitor Santos Costa, Jan Wielemaker and others.
* @date 1999
*
* @addtogroup lists The Prolog Library
*
* @ingroup library
*
* @{
*
x * @addtogroup library The Prolog Library
*
* @brief List Manipulation Predicates
*
*

View File

@ -35,9 +35,11 @@
setrand/1
]).
/** @defgroup random Random Number Generator
@ingroup library
@{
/**
@{
@defgroup random Random Number Generator
@ingroup library
Since YAP-4.3.19 YAP uses
the O'Keefe public-domain algorithm, based on the "Applied Statistics"
@ -218,5 +220,6 @@ setrand(rand(X,Y,Z)) :-
getrand(rand(X,Y,Z)) :-
getrand(X,Y,Z).
/** @} */

View File

@ -52,10 +52,12 @@
]).
/**
*
* @{
*
* @defgroup rbtrees Red-Black Trees
* @ingroup library
@{
Red-Black trees are balanced search binary trees. They are named because
nodes can be classified as either red or black. The code we include is
based on "Introduction to Algorithms", second edition, by Cormen,

View File

@ -38,7 +38,7 @@
]).
/**
* @defgroup readutil
* @defgroup readutil Reading Lines and Files
* @ingroup library
*
* Read full lines and a full file in a single call.

View File

@ -574,7 +574,7 @@ process_inp_stream_for_exec(Error, _, G, L, L) :- var(Error), !,
process_inp_stream_for_exec(null, null, _, L, L) :- !.
process_inp_stream_for_exec(std, 0, _, L, L) :- !.
process_inp_stream_for_exec(pipe(ForWriting), ForReading, _, L, [ForReading|L]) :- var(ForWriting), !,
open_pipe_streams(ForReading, ForWriting).
open_pipe_stream(ForReading, ForWriting).
process_inp_stream_for_exec(pipe(Stream), _, _, L, L) :- !,
stream_property(Stream, input).
process_inp_stream_for_exec(Stream, Stream, _, L, L) :-
@ -587,7 +587,7 @@ process_out_stream_for_exec(Error, _, G, L, L) :- var(Error), !,
process_out_stream_for_exec(null, null, _, L, L) :- !.
process_out_stream_for_exec(std, 1, _, L, L) :- !.
process_out_stream_for_exec(pipe(ForReading), ForWriting, _, L, [ForWriting|L]) :- var(ForReading), !,
open_pipe_streams(ForReading, ForWriting).
open_pipe_stream(ForReading, ForWriting).
process_out_stream_for_exec(pipe(Stream), _, _, L, L) :- !,
stream_property(Stream, output).
process_out_stream_for_exec(Stream, Stream, _, L, L) :-
@ -599,7 +599,7 @@ process_err_stream_for_exec(Error, _, G, L, L) :- var(Error), !,
process_err_stream_for_exec(null, null, _, L, L) :- !.
process_err_stream_for_exec(std, 2, _, L, L) :- !.
process_err_stream_for_exec(pipe(ForReading), ForWriting, _, L, [ForWriting|L]) :- var(ForReading), !,
open_pipe_streams(ForReading, ForWriting).
open_pipe_stream(ForReading, ForWriting).
process_err_stream_for_exec(pipe(Stream), Stream, _, L, L) :- !,
stream_property(Stream, output).
process_err_stream_for_exec(Stream, Stream, _, L, L) :-
@ -803,7 +803,7 @@ Create file _OldFile_ to _NewFile_. This predicate uses the
*/
rename_file(F0, F) :-
rename_file(F0, F, Error),
handle_system_internal(Error, off, rename_file(F0, F))).
handle_system_internal(Error, off, rename_file(F0, F)).
/** @pred system(+ _S_)

View File

@ -1125,25 +1125,26 @@ static void check_bom(int sno, StreamDesc *st) {
}
}
bool Yap_initStream(int sno, FILE *fd, const char *name, const char *io_mode, Term file_name, encoding_t encoding,
stream_flags_t flags, void *vfs) {
bool Yap_initStream(int sno, FILE *fd, const char *name, const char *io_mode,
Term file_name, encoding_t encoding, stream_flags_t flags,
void *vfs) {
StreamDesc *st = &GLOBAL_Stream[sno];
if (io_mode == NULL)
Yap_Error(PERMISSION_ERROR_NEW_ALIAS_FOR_STREAM, MkIntegerTerm(sno), "File opened with NULL Permissions");
Yap_Error(PERMISSION_ERROR_NEW_ALIAS_FOR_STREAM, MkIntegerTerm(sno),
"File opened with NULL Permissions");
if (strchr(io_mode, 'a')) {
st->status = Append_Stream_f|Output_Stream_f|flags;
} else
if (strchr(io_mode, 'w')) {
st->status = Append_Stream_f | Output_Stream_f | flags;
} else if (strchr(io_mode, 'w')) {
st->status = Output_Stream_f | flags;
}
if (strchr(io_mode, 'r')) {
st->status = Input_Stream_f|flags;
st->status = Input_Stream_f | flags;
}
if (strchr(io_mode, 'b')) {
st->status = Binary_Stream_f|flags;
st->status = Binary_Stream_f | flags;
}
//st->vfs = vfs;
// st->vfs = vfs;
st->buf.on = false;
st->charcount = 0;
st->linecount = 1;
@ -1159,7 +1160,8 @@ bool Yap_initStream(int sno, FILE *fd, const char *name, const char *io_mode, Te
name = Yap_guessFileName(fd, sno, buf, YAP_FILENAME_MAX);
}
if (!name)
Yap_Error(SYSTEM_ERROR_INTERNAL,file_name,"Yap_guessFileName failed: opening a file without a name");
Yap_Error(SYSTEM_ERROR_INTERNAL, file_name,
"Yap_guessFileName failed: opening a file without a name");
st->name = Yap_LookupAtom(name);
st->user_name = file_name;
st->file = fd;
@ -1224,35 +1226,17 @@ typedef enum open_enum_choices { OPEN_DEFS() } open_choices_t;
static const param_t open_defs[] = {OPEN_DEFS()};
#undef PAR
static Int
do_open(Term file_name, Term t2,
Term tlist USES_REGS) {
static Int do_open(Term file_name, Term t2, Term tlist USES_REGS) {
Atom open_mode;
int sno;
StreamDesc *st;
bool avoid_bom = false, needs_bom = false;
const char *fname0;
stream_flags_t flags;
const char *s_encoding;
encoding_t encoding;
Term tenc;
char io_mode[8];
// original file name
if (IsVarTerm(file_name)) {
Yap_Error(INSTANTIATION_ERROR, file_name, "open/3");
return FALSE;
}
if (!IsAtomTerm(file_name)) {
if (IsStringTerm(file_name)) {
fname0 = (char *)StringOfTerm(file_name);
} else {
Yap_Error(DOMAIN_ERROR_SOURCE_SINK, file_name, "open/3");
return FALSE;
}
} else {
fname0 = RepAtom(AtomOfTerm(file_name))->StrOfAE;
}
// open mode
if (IsVarTerm(t2)) {
Yap_Error(INSTANTIATION_ERROR, t2, "open/3");
@ -1289,22 +1273,25 @@ do_open(Term file_name, Term t2,
// default encoding, no bom yet
encoding = enc_id(s_encoding, ENC_OCTET);
// only set encoding after getting BOM
char const *fname0;
bool ok = (args[OPEN_EXPAND_FILENAME].used
? args[OPEN_EXPAND_FILENAME].tvalue == TermTrue
: false) ||
trueGlobalPrologFlag(OPEN_EXPANDS_FILENAME_FLAG);
// expand file name?
if (ok) {
if (((IsAtomTerm(file_name) &&
(fname0 = RepAtom(AtomOfTerm(file_name))->StrOfAE))) ||
(IsStringTerm(file_name) && (fname0 = StringOfTerm(file_name)))) {
int lvl = push_text_stack();
const char *fname = Yap_AbsoluteFile(fname0, ok);
file_name = MkAtomTerm(Yap_LookupAtom(fname));
if (!fname) {
pop_text_stack(lvl);
PlIOError(EXISTENCE_ERROR_SOURCE_SINK, ARG1, NULL);
}
}
}
// Skip scripts that start with !#/.. or similar
pop_text_stack(lvl);
if (open_mode == AtomRead) {
strncpy(io_mode, "r", 8);
@ -1313,7 +1300,6 @@ do_open(Term file_name, Term t2,
} else if (open_mode == AtomAppend) {
strncpy(io_mode, "a", 8);
} else {
pop_text_stack(lvl);
return false;
}
// binary type
@ -1334,14 +1320,11 @@ do_open(Term file_name, Term t2,
#endif
/* note that this matters for UNICODE style conversions */
} else {
pop_text_stack(lvl);
Yap_Error(DOMAIN_ERROR_STREAM, tlist,
"type is ~a, must be one of binary or text", t);
}
}
if ((sno = Yap_OpenStream(file_name, io_mode, file_name, encoding)) < 0)
{
pop_text_stack(lvl);
if ((sno = Yap_OpenStream(file_name, io_mode, file_name, encoding)) < 0) {
return false;
}
@ -1350,19 +1333,14 @@ do_open(Term file_name, Term t2,
// BOM mess
if (encoding == ENC_UTF16_BE || encoding == ENC_UTF16_LE ||
encoding == ENC_UCS2_BE || encoding == ENC_UCS2_LE ||
encoding == ENC_ISO_UTF32_BE || encoding == ENC_ISO_UTF32_LE)
{
encoding == ENC_ISO_UTF32_BE || encoding == ENC_ISO_UTF32_LE) {
needs_bom = true;
}
if (args[OPEN_BOM].used)
{
if (args[OPEN_BOM].tvalue == TermTrue)
{
if (args[OPEN_BOM].used) {
if (args[OPEN_BOM].tvalue == TermTrue) {
avoid_bom = false;
needs_bom = true;
}
else if (args[OPEN_BOM].tvalue == TermFalse)
{
} else if (args[OPEN_BOM].tvalue == TermFalse) {
avoid_bom = true;
needs_bom = false;
}
@ -1400,7 +1378,6 @@ do_open(Term file_name, Term t2,
if (script) {
open_header(sno, open_mode);
}
pop_text_stack(lvl);
free(args);
UNLOCK(st->streamlock);
@ -1571,7 +1548,8 @@ static Int p_open_null_stream(USES_REGS1) {
return (Yap_unify(ARG1, t));
}
int Yap_OpenStream(Term tin, const char* io_mode, Term user_name, encoding_t enc) {
int Yap_OpenStream(Term tin, const char *io_mode, Term user_name,
encoding_t enc) {
CACHE_REGS
int sno;
StreamDesc *st;
@ -1581,26 +1559,36 @@ int Yap_OpenStream(Term tin, const char* io_mode, Term user_name, encoding_t enc
sno = GetFreeStreamD();
if (sno < 0) {
PlIOError(RESOURCE_ERROR_MAX_STREAMS,tin, "new stream not available for opening");
PlIOError(RESOURCE_ERROR_MAX_STREAMS, tin,
"new stream not available for opening");
return -1;
}
st = GLOBAL_Stream + sno;
// fname = Yap_VF(fname);
flags = 0;
if ((((IsAtomTerm(tin) &&
(fname = RepAtom(AtomOfTerm(tin))->StrOfAE))) ||
(IsStringTerm(tin) &&
(fname =StringOfTerm(tin)))) &&
((vfsp = vfs_owner(fname)) != NULL)) {
if (!vfsp->open(vfsp, fname, io_mode, sno)) {
if (IsAtomTerm(tin))
fname = RepAtom(AtomOfTerm(tin))->StrOfAE;
else if (IsStringTerm(tin))
fname = StringOfTerm(tin);
else
fname = NULL;
st->file = NULL;
if (fname) {
if ((vfsp = vfs_owner(fname)) != NULL &&
vfsp->open(vfsp, fname, io_mode, sno)) {
// read, write, append
user_name = st->user_name;
UNLOCK(st->streamlock);
PlIOError(EXISTENCE_ERROR_SOURCE_SINK, MkAtomTerm(Yap_LookupAtom(fname)),
"%s", fname);
} else {
st->file = fopen(fname, io_mode);
}
if (!st->file) {
PlIOError(EXISTENCE_ERROR_SOURCE_SINK, tin, "%s", fname);
/* extract BACK info passed through the stream descriptor */
return -1;
}
// read, write, append
user_name = st->user_name;
} else if (IsApplTerm(tin)) {
Functor f = FunctorOfTerm(tin);
if (f == FunctorAtom || f == FunctorString || f == FunctorCodes1 ||
@ -1613,6 +1601,7 @@ int Yap_OpenStream(Term tin, const char* io_mode, Term user_name, encoding_t enc
buf = Yap_TextTermToText(tin PASS_REGS);
if (!buf) {
pop_text_stack(i);
return false;
}
buf = pop_output_text_stack(i, buf);
@ -1620,44 +1609,48 @@ int Yap_OpenStream(Term tin, const char* io_mode, Term user_name, encoding_t enc
MEM_BUF_MALLOC);
return Yap_OpenBufWriteStream(PASS_REGS1);
}
} else if (f == FunctorPopen) {
} else if (!strcmp(RepAtom(NameOfFunctor(f))->StrOfAE, "popen")) {
const char *buf;
int i = push_text_stack();
buf = Yap_TextTermToText(tin PASS_REGS);
buf = Yap_TextTermToText(ArgOfTerm(1, tin) PASS_REGS);
if (!buf) {
return false;
}
pop_text_stack(i);
return -1;
}
#if _WIN32
st->file = _popen(buf, io_mode);
#else
st->file = popen(buf, io_mode);
#endif
} else {
st->file = fopen(fname, io_mode);
fname = "popen";
user_name = tin;
flags |= Popen_Stream_f;
pop_text_stack(i);
}
}
if (st->file == NULL) {
if (!strchr(io_mode, 'b') && binary_file(fname)) {
UNLOCK(st->streamlock);
if (errno == ENOENT && !strchr(io_mode, 'r')) {
PlIOError(EXISTENCE_ERROR_SOURCE_SINK,
MkAtomTerm(Yap_LookupAtom(fname)), "%s: %s", fname,
tin, "%s: %s", fname,
strerror(errno));
} else {
PlIOError(PERMISSION_ERROR_OPEN_SOURCE_SINK,
MkAtomTerm(Yap_LookupAtom(fname)), "%s: %s", fname,
tin, "%s: %s", fname,
strerror(errno));
}
}
return -1;
}
}}
Yap_initStream(sno, st->file, fname, io_mode, user_name, LOCAL_encoding, flags, vfsp);
Yap_initStream(sno, st->file, fname, io_mode, user_name, LOCAL_encoding,
flags, vfsp);
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "exists %s <%d>", fname,
sno);
return sno;
}
}
int Yap_FileStream(FILE *fd, char *name, Term file_name, int flags,
int Yap_FileStream(FILE *fd, char *name, Term file_name, int flags,
VFS_t *vfsp) {
CACHE_REGS
int sno;
@ -1677,12 +1670,12 @@ int Yap_OpenStream(Term tin, const char* io_mode, Term user_name, encoding_t enc
}
Yap_initStream(sno, fd, name, mode, file_name, LOCAL_encoding, flags, vfsp);
return sno;
}
}
#define CheckStream(arg, kind, msg) \
CheckStream__(__FILE__, __FUNCTION__, __LINE__, arg, kind, msg)
static int CheckStream__(const char *file, const char *f, int line, Term arg,
static int CheckStream__(const char *file, const char *f, int line, Term arg,
int kind, const char *msg) {
int sno = -1;
arg = Deref(arg);
@ -1739,14 +1732,14 @@ int Yap_OpenStream(Term tin, const char* io_mode, Term user_name, encoding_t enc
return -1;
}
return sno;
}
}
int Yap_CheckStream__(const char *file, const char *f, int line, Term arg,
int Yap_CheckStream__(const char *file, const char *f, int line, Term arg,
int kind, const char *msg) {
return CheckStream__(file, f, line, arg, kind, msg);
}
}
int Yap_CheckTextStream__(const char *file, const char *f, int line, Term arg,
int Yap_CheckTextStream__(const char *file, const char *f, int line, Term arg,
int kind, const char *msg) {
int sno;
if ((sno = CheckStream__(file, f, line, arg, kind, msg)) < 0)
@ -1762,9 +1755,9 @@ int Yap_OpenStream(Term tin, const char* io_mode, Term user_name, encoding_t enc
return -1;
}
return sno;
}
}
int Yap_CheckBinaryStream__(const char *file, const char *f, int line, Term arg,
int Yap_CheckBinaryStream__(const char *file, const char *f, int line, Term arg,
int kind, const char *msg) {
int sno;
if ((sno = CheckStream__(file, f, line, arg, kind, msg)) < 0)
@ -1778,10 +1771,10 @@ int Yap_OpenStream(Term tin, const char* io_mode, Term user_name, encoding_t enc
return -1;
}
return sno;
}
}
/* used from C-interface */
int Yap_GetFreeStreamDForReading(void) {
/* used from C-interface */
int Yap_GetFreeStreamDForReading(void) {
int sno = GetFreeStreamD();
StreamDesc *s;
@ -1795,24 +1788,24 @@ int Yap_OpenStream(Term tin, const char* io_mode, Term user_name, encoding_t enc
Yap_DefaultStreamOps(s);
UNLOCK(s->streamlock);
return sno;
}
}
/**
/**
* @pred always_prompt_user
*
* Ensure that the stream always prompts before asking the standard input
stream for data.
*/
static Int always_prompt_user(USES_REGS1) {
*/
static Int always_prompt_user(USES_REGS1) {
StreamDesc *s = GLOBAL_Stream + StdInStream;
s->status |= Promptable_Stream_f;
Yap_DefaultStreamOps(s);
return (TRUE);
}
}
static Int close1 /** @pred close(+ _S_) is iso
static Int close1 /** @pred close(+ _S_) is iso
Closes the stream _S_. If _S_ does not stand for a stream
@ -1834,24 +1827,24 @@ user_output, and user_error can never be closed.
Yap_CloseStream(sno);
UNLOCK(GLOBAL_Stream[sno].streamlock);
return (TRUE);
}
}
#define CLOSE_DEFS() \
PAR("force", booleanFlag, CLOSE_FORCE), PAR(NULL, ok, CLOSE_END)
#define PAR(x, y, z) z
typedef enum close_enum_choices { CLOSE_DEFS() } close_choices_t;
typedef enum close_enum_choices { CLOSE_DEFS() } close_choices_t;
#undef PAR
#define PAR(x, y, z) \
{ x, y, z }
static const param_t close_defs[] = {CLOSE_DEFS()};
static const param_t close_defs[] = {CLOSE_DEFS()};
#undef PAR
/** @pred close(+ _S_,+ _O_) is iso
/** @pred close(+ _S_,+ _O_) is iso
Closes the stream _S_, following options _O_.
@ -1859,8 +1852,8 @@ user_output, and user_error can never be closed.
YAP currently ignores these options.
*/
static Int close2(USES_REGS1) { /* '$close'(+GLOBAL_Stream) */
*/
static Int close2(USES_REGS1) { /* '$close'(+GLOBAL_Stream) */
Int sno = CheckStream(
ARG1, (Input_Stream_f | Output_Stream_f | Socket_Stream_f), "close/2");
Term tlist;
@ -1885,9 +1878,9 @@ user_output, and user_error can never be closed.
Yap_CloseStream(sno);
UNLOCK(GLOBAL_Stream[sno].streamlock);
return (TRUE);
}
}
Term read_line(int sno) {
Term read_line(int sno) {
CACHE_REGS
Term tail;
Int ch;
@ -1897,7 +1890,7 @@ user_output, and user_error can never be closed.
}
tail = read_line(sno);
return (MkPairTerm(MkIntTerm(ch), tail));
}
}
#define ABSOLUTE_FILE_NAME_DEFS() \
PAR("access", isatom, ABSOLUTE_FILE_NAME_ACCESS) \
@ -1914,20 +1907,20 @@ user_output, and user_error can never be closed.
#define PAR(x, y, z) z
typedef enum ABSOLUTE_FILE_NAME_enum_ {
typedef enum ABSOLUTE_FILE_NAME_enum_ {
ABSOLUTE_FILE_NAME_DEFS()
} absolute_file_name_choices_t;
} absolute_file_name_choices_t;
#undef PAR
#define PAR(x, y, z) \
{ x, y, z }
static const param_t absolute_file_name_search_defs[] = {
static const param_t absolute_file_name_search_defs[] = {
ABSOLUTE_FILE_NAME_DEFS()};
#undef PAR
static Int abs_file_parameters(USES_REGS1) {
static Int abs_file_parameters(USES_REGS1) {
Term t[ABSOLUTE_FILE_NAME_END];
Term tlist = Deref(ARG1), tf;
/* get options */
@ -1989,9 +1982,9 @@ user_output, and user_error can never be closed.
tf = Yap_MkApplTerm(Yap_MkFunctor(AtomOpt, ABSOLUTE_FILE_NAME_END),
ABSOLUTE_FILE_NAME_END, t);
return (Yap_unify(ARG2, tf));
}
}
static Int get_abs_file_parameter(USES_REGS1) {
static Int get_abs_file_parameter(USES_REGS1) {
Term t = Deref(ARG1), topts = Deref(ARG2);
/* get options */
/* done */
@ -2001,9 +1994,9 @@ user_output, and user_error can never be closed.
return Yap_unify(ARG3, ArgOfTerm(i + 1, topts));
Yap_Error(DOMAIN_ERROR_ABSOLUTE_FILE_NAME_OPTION, ARG1, NULL);
return false;
}
}
void Yap_InitPlIO(struct yap_boot_params *argi) {
void Yap_InitPlIO(struct yap_boot_params *argi) {
Int i;
if (argi->inp > 0)
Yap_stdin = fdopen(argi->inp - 1, "r");
@ -2030,9 +2023,9 @@ user_output, and user_error can never be closed.
GLOBAL_Stream[i].status = Free_Stream_f;
}
InitStdStreams();
}
}
void Yap_InitIOPreds(void) {
void Yap_InitIOPreds(void) {
/* here the Input/Output predicates */
Yap_InitCPred("always_prompt_user", 0, always_prompt_user,
SafePredFlag | SyncPredFlag);
@ -2068,4 +2061,4 @@ user_output, and user_error can never be closed.
Yap_InitSignalPreds();
Yap_InitSysPreds();
Yap_InitTimePreds();
}
}

View File

@ -18,7 +18,10 @@
static char SccsId[] = "%W% %G%";
#endif
/*
/**
*
* @file pipes.c
*
* This file includes the definition of a pipe related IO.
*
*/

View File

@ -989,6 +989,9 @@ static void CloseStream(int sno) {
me->close(sno);
}
GLOBAL_Stream[sno].vfs = NULL;
} else if (GLOBAL_Stream[sno].file &&
(GLOBAL_Stream[sno].status &Popen_Stream_f)) {
pclose(GLOBAL_Stream[sno].file);
} else if (GLOBAL_Stream[sno].file &&
!(GLOBAL_Stream[sno].status &
(Null_Stream_f | Socket_Stream_f | InMemory_Stream_f | Pipe_Stream_f)))

View File

@ -1,6 +1,6 @@
/**
@defgroup Gecode_and_ClPbBFDbC Programming Finite Domain Constraints in YAP/Gecode
@ingroup Gecode
@defgroup Gecode5and+ClPbBFDbC Programming Finite Domain Constraints in YAP/Gecode
@ingroup Gecode5
@{
The gecode/clp(fd) interface is designed to use the GECODE functionality

View File

@ -16,7 +16,7 @@
%% along with this program. If not, see <http://www.gnu.org/licenses/>.
%%=============================================================================
/** @defgroup Gecode Gecode Interface
/** @addtogroup Gecode4 Gecode Interface
@ingroup packages
@{
@ -27,8 +27,8 @@ Duchier, with recent work by Vítor Santos Costa to port it to version 4
of gecode and to have an higher level interface,
@defgroup The_Gecode_Interface The Gecode Interface
@ingroup Gecode
@addtogroup TheGecode4Interface The Gecode Interface
@ingroup Gecode4
@{
This text is due to Denys Duchier. The gecode interface requires

View File

@ -16,7 +16,7 @@
%% along with this program. If not, see <http://www.gnu.org/licenses/>.
%%=============================================================================
/** @defgroup Gecode Gecode Interface
/** @addtogroup Gecode4 Gecode 4 Interface
@ingroup packages
@{

View File

@ -20,7 +20,7 @@
(+=)/2, op(500, xfx, '+=')]).
/** @defgroup Gecode Gecode Interface
/** @addtogroup Gecode5 Gecode 5 Interface
@ingroup packages
@{

View File

@ -129,15 +129,7 @@ do_c_built_in(Mod:G, _, H, OUT) :-
var(G1), !,
do_c_built_metacall(G1, M1, H, OUT).
do_c_built_in('$do_error'( Error, Goal), M, Head,
(strip_module(M:Goal,M1,NGoal),
throw(error(Error,
print_message(
['while executing goal ~w' -M1:NGoal,nl,
'in clause matching ~w'-Head,nl]
)
)
)
)
throw(error(Error,M:Goal))
) :- !.
do_c_built_in(system_error( Error, Goal), M, Head, ErrorG) :-
do_c_built_in('$do_error'( Error, Goal), M, Head, ErrorG).

View File

@ -19,7 +19,9 @@
@file arrays.yap
@addtogroup YAPArrays
@addtogroup YAPArraysPl Prolog Support for seeing terms as arrays and for data-base arrays of objects
@ingroupp YAPArrays
@{
*/

View File

@ -9,7 +9,8 @@
*************************************************************************/
/**
* @file atoms.yap
* @file pl/atoms.yap
*
*
*/

View File

@ -19,11 +19,11 @@
@file boot.yap
@brief YAP bootstrap
@{
@defgroup YAPControl Control Predicates
@ingroup builtins
@{
*/
@ -147,17 +147,6 @@ print_message(L,E) :-
:- '$new_multifile'('$full_clause_optimisation'(_H, _M, _B0, _BF), prolog).
:- '$new_multifile'('$exec_directive'(_,_,_,_,_), prolog).
/**
@{
@defgroup library The Prolog library
@addtogroup YAPControl
@ingroup builtins
@{
*/
:- system_module( '$_init', [!/0,
':-'/1,
'?-'/1,
@ -321,8 +310,6 @@ initialize_prolog :-
:- ['protect.yap'].
:- stop_low_level_trace.
version(yap,[6,3]).
:- op(1150,fx,(mode)).
@ -439,7 +426,7 @@ as directives.
:- dynamic system:term_expansion/2.
:- multifile swi:swi_predicate_table/4.
:- multifile system:swi_predicate_table/4.
/** @pred user:message_hook(+ _Term_, + _Kind_, + _Lines_)
@ -478,3 +465,5 @@ If this hook preodicate succeeds it must instantiate the _Action_ argument to t
:- ensure_loaded('../pl/pathconf.yap').
:- yap_flag(user:unknown,error).
%% @}

View File

@ -1,5 +1,5 @@
/**
@file bootutils.c
@file bootutils.yap
@short utilities
@addtogroup Internal_Database

View File

@ -19,7 +19,7 @@
@file boot.yap
@brief YAP bootstrap
@defgroup YAPControl Control Predicates
@addtogroupg YAPControl Control Predicates
@ingroup builtins
@{

View File

@ -100,23 +100,6 @@ proven. The example verifies that all arithmetic statements in the list
~~~~~
*/
/** @pred forall(+ _Cond_,+ _Action_)
For all alternative bindings of _Cond_ _Action_ can be proven.
The next example verifies that all arithmetic statements in the list
_L_ are correct. It does not say which is wrong if one proves wrong.
~~~~~
?- forall(member(Result = Formula, [2 = 1 + 1, 4 = 2 * 2]),
Result =:= Formula).
~~~~~
*/
forall(Cond, Action) :- \+((Cond, \+(Action))).
@ -136,19 +119,6 @@ ignore(_).
*/
ignore(Goal) :- (Goal->true;true).
notrace(G) :-
strip_module(G, M, G1),
( '$$save_by'(CP),
'$debug_stop'( State ),
'$call'(G1, CP, G, M),
'$$save_by'(CP2),
(CP == CP2 -> ! ; '$debug_state'( NState ), ( true ; '$debug_restart'(NState), fail ) ),
'$debug_restart'( State )
;
'$debug_restart'( State ),
fail
).
/** @pred if(? _G_,? _H_,? _I_)
Call goal _H_ once per each solution of goal _H_. If goal
@ -204,19 +174,79 @@ if(X,Y,Z) :-
'$call'(Z,CP,if(X,Y,Z),M)
).
/** @pred call(
Closure,...,? Ai,...) is iso
Meta-call with extractpattern arguments, where _Closure_ is a closure
that is converted into a goal by appending the _Ai_ additional
arguments. YAP supports up to 10 extra arguments.
*/
call(X,A) :- '$execute'(X,A).
call(X,A1,A2) :- '$execute'(X,A1,A2).
/** @pred call(+ _Closure_,...,? _Ai_,...) is iso
Meta-call where _Closure_ is a closure that is converted into a goal by
appending the _Ai_ additional arguments. The number of arguments varies
between 0 and 10.
*/
call(X,A1,A2,A3) :- '$execute'(X,A1,A2,A3).
call(X,A1,A2,A3,A4) :- '$execute'(X,A1,A2,A3,A4).
@ -270,7 +300,7 @@ setup_call_catcher_cleanup(Setup, Goal, Catcher, Cleanup) :-
call_cleanup(Goal, Catcher, Cleanup).
/** @pred call_with_args(+ _Name_,...,? _Ai_,...)
/** @pred call_with_args(+ Name,...,? Ai,...)
Meta-call where _Name_ is the name of the procedure to be called and
@ -588,7 +618,15 @@ break :-
'$break'( false ).
at_halt(G) :-
/**
* @pred at_halt( G )
*
* Hook predicate: _G_ must be called on exit.
*
* @param _G_: the hook
*
* @return succeeds with side-effect.
*/at_halt(G) :-
recorda('$halt', G, _),
fail.
at_halt(_).
@ -619,7 +657,17 @@ halt(X) :-
set_value('$live','$false'),
'$halt'(X).
prolog_current_frame(Env) :-
/**
* @pred prolog_current_frame(-Env)
*
* reports a reference to the last execution environment _Env_.
* YAP creates an enviroment when a clause contains several sub-goals.
* Facts and simple recursion do not need an environment,
*
* @param Env
*
* @return
*/prolog_current_frame(Env) :-
Env is '$env'.
'$run_atom_goal'(GA) :-

View File

@ -421,6 +421,7 @@ be lost.
'$trace_query'(B, M, CP, S, EB).
'$trace_query'((A|B), M, CP, S, (EA|EB)) :- !,
'$trace_query'(A, M, CP, S, EA),
'$trace_query'(B, M, CP, S, EB).
'$trace_query'((\+ A), M, CP, S, (\+ EA)) :- !,
'$trace_query'(A, M, CP, S, EA).
'$trace_query'(G, M, _CP, _, (

View File

@ -6,7 +6,7 @@
*
* @brief support Prolog dialects
*
* @defgroup Dialects
* @defgroup Dialects Compatibilty with other Prolog dialects
* @ingroup builtins
*
*/

View File

@ -22,7 +22,7 @@
*
* @brief Control File Loading
%
% @defgroup Directives
% @defgroup Directives Prolog Directives
@ @ingroup consult
*
*

View File

@ -25,7 +25,7 @@
]), []) .
/**
@defgroup error Error generating support
@defgroup SWI-error High-level error testing.
@ingroup YAPError
This SWI module provides predicates to simplify error generation and

View File

@ -22,7 +22,7 @@
*
* @brief compiling expressions
*
* @defgroup CompiledExpressions
* @defgroup CompiledExpression A Compiler for Arithmetic
* @ingroup drectives
*
*

View File

@ -15,7 +15,7 @@
* *
*************************************************************************/
/**
* @file flagd.ysp
* @file flags.yap
*
* @defgroup YAPFlags Yap Flags
*

View File

@ -45,7 +45,7 @@
Notice that variable names option must have been on.
*/
hacks:context_variables(NamedVariables) :-
yap_hacks:context_variables(NamedVariables) :-
'$context_variables'(NamedVariables).

View File

@ -2,11 +2,15 @@
@file meta.yap
@defgroup YAPMetaPredicates Using Meta-Calls with Modules
@ingroup YAPModules
@{
@pred meta_predicate(G1 , Gj , Gn) is directive
@defgroup YAPMetaPredicates Using Meta-Calls with Modules
@ingroup YAPModules
*/
/**
@pred meta_predicate( Gi ) is directive
Declares that this predicate manipulates references to predicates.
Each _Gi_ is a mode specification.
@ -498,3 +502,5 @@ expand_goal(Input, Output) :-
'$yap_strip_module'(SM:G, M, IG),
'$expand_goals'(IG, _, GF0, M, SM, M, HVars-G),
'$yap_strip_module'(M:GF0, MF, GF).
%% @}

View File

@ -4,8 +4,8 @@
/** @file preddyns.yap */
/**
* @addtogroup Database
* @{
* @addtogroup Database
Next follow the main operations on dynamic predicates.
@ -347,3 +347,5 @@ dynamic_predicate(P,Sem) :-
'$bad_if_is_semantics'(Sem, Goal) :-
Sem \= immediate, Sem \= logical, !,
'$do_error'(domain_error(semantics_indicator,Sem),Goal).
%% @}

View File

@ -18,7 +18,7 @@
:- system_module( '$_protect', [], ['$protect'/0]).
/**
* @file protect.yap
* @addgroup ProtectCore Freeze System Configuration
* @addtogroup ProtectCore Freeze System Configuration
* @ingroup YAPControl
*
* This protects current code from further changes

View File

@ -377,6 +377,20 @@ debugging :-
get_value('$leash',Leash),
'$show_leash'(help,Leash).
notrace(G) :-
strip_module(G, M, G1),
( '$$save_by'(CP),
'$debug_stop'( State ),
'$call'(G1, CP, G, M),
'$$save_by'(CP2),
(CP == CP2 -> ! ; '$debug_state'( NState ), ( true ; '$debug_restart'(NState), fail ) ),
'$debug_restart'( State )
;
'$debug_restart'( State ),
fail
).
/*
@}

View File

@ -1,5 +1,5 @@
/**
* @file swi.yap
* @file pl/swi.yap
* @author VITOR SANTOS COSTA <vsc@VITORs-MBP-2.lan>
* @date Thu Oct 19 12:18:05 2017
*

View File

@ -5,7 +5,7 @@
*
* @brief top-level implementation plus system booting.x
*
* @defgroup Top-Level and Boot Predicates
* @defgroup TopLevel Top-Level and Boot Predicates
* @ingroup YAPControl
*
*/

View File

@ -32,10 +32,10 @@
).
/**
* @defgroup ypp Yap PreProcessing
* @ingroup library
*
*/
* @defgroup ypp Yap PreProcessing
* @ingroup library
*
*/
%====================================================================================
% Public Predicates

File diff suppressed because it is too large Load Diff