doc updates
This commit is contained in:
parent
a8c77d2609
commit
c629ae9283
@ -32,7 +32,7 @@ Built-ins, Debugging, Syntax, Top
|
|||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
@node Control, Undefined Procedures, , Top
|
@node Control, Undefined Procedures, , Top
|
||||||
@section Control Predicates
|
@chapter Control Predicates
|
||||||
|
|
||||||
|
|
||||||
This chapter describes the predicates for controlling the execution of
|
This chapter describes the predicates for controlling the execution of
|
||||||
@ -93,13 +93,13 @@ Succeeds once.
|
|||||||
@findex fail/0
|
@findex fail/0
|
||||||
@syindex fail/0
|
@syindex fail/0
|
||||||
@cyindex fail/0
|
@cyindex fail/0
|
||||||
Fails always.
|
Always fails.
|
||||||
|
|
||||||
@item false [ISO]
|
@item false [ISO]
|
||||||
@findex false/0
|
@findex false/0
|
||||||
@syindex false/0
|
@syindex false/0
|
||||||
@cnindex false/0
|
@cnindex false/0
|
||||||
The same as fail
|
The same as fail.
|
||||||
|
|
||||||
@item ! [ISO]
|
@item ! [ISO]
|
||||||
@findex !/0
|
@findex !/0
|
||||||
@ -698,7 +698,7 @@ Translates a message-term into a string object. Primarily intended for SWI-Prolo
|
|||||||
@end table
|
@end table
|
||||||
|
|
||||||
@node Testing Terms, Predicates on Atoms, Messages, Top
|
@node Testing Terms, Predicates on Atoms, Messages, Top
|
||||||
@section Predicates on terms
|
@chapter Predicates on terms
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
|
|
||||||
@ -1457,6 +1457,7 @@ conversion of integers to floating point numbers may raise an overflow
|
|||||||
exception. In all other cases, arguments are converted to the same type
|
exception. In all other cases, arguments are converted to the same type
|
||||||
using the order integer to rational number to floating point number.
|
using the order integer to rational number to floating point number.
|
||||||
|
|
||||||
|
@subsection Arithmetic Expressions
|
||||||
|
|
||||||
Arithmetic expressions in YAP may use the following operators or
|
Arithmetic expressions in YAP may use the following operators or
|
||||||
@i{evaluable predicates}:
|
@i{evaluable predicates}:
|
||||||
@ -1762,6 +1763,8 @@ A "random" floating point number between 0 and 1.
|
|||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
|
@subsection Arithmetic Primitives
|
||||||
|
|
||||||
The primitive YAP predicates involving arithmetic expressions are:
|
The primitive YAP predicates involving arithmetic expressions are:
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
@ -1846,6 +1849,7 @@ will generate an exception. If no error handler is available, execution
|
|||||||
will be thrown back to the top-level.
|
will be thrown back to the top-level.
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
|
@subsection Counting
|
||||||
|
|
||||||
The following predicates provide counting:
|
The following predicates provide counting:
|
||||||
|
|
||||||
@ -1909,7 +1913,7 @@ The following predicates provide counting:
|
|||||||
@end table
|
@end table
|
||||||
|
|
||||||
@node I/O, Database, Arithmetic, Top
|
@node I/O, Database, Arithmetic, Top
|
||||||
@section I/O Predicates
|
@chapter I/O Predicates
|
||||||
|
|
||||||
Some of the I/O predicates described below will in certain conditions
|
Some of the I/O predicates described below will in certain conditions
|
||||||
provide error messages and abort only if the file_errors flag is set.
|
provide error messages and abort only if the file_errors flag is set.
|
||||||
@ -1931,7 +1935,7 @@ Subnodes of Input/Output
|
|||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
@node Streams and Files, C-Prolog File Handling, , I/O
|
@node Streams and Files, C-Prolog File Handling, , I/O
|
||||||
@subsection Handling Streams and Files
|
@section Handling Streams and Files
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
|
|
||||||
@ -2354,8 +2358,8 @@ Given the packaged stream position term @var{StreamPosition}, unify
|
|||||||
@end table
|
@end table
|
||||||
|
|
||||||
@node C-Prolog File Handling, I/O of Terms, Streams and Files, I/O
|
@node C-Prolog File Handling, I/O of Terms, Streams and Files, I/O
|
||||||
@subsection Handling Streams and Files
|
@section C-Prolog File Handling
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
|
|
||||||
@item tell(+@var{S})
|
@item tell(+@var{S})
|
||||||
@ -2422,7 +2426,7 @@ Closes the current input stream (see 6.7.).
|
|||||||
@end table
|
@end table
|
||||||
|
|
||||||
@node I/O of Terms, I/O of Characters, C-Prolog File Handling, I/O
|
@node I/O of Terms, I/O of Characters, C-Prolog File Handling, I/O
|
||||||
@subsection Handling Input/Output of Terms
|
@section Handling Input/Output of Terms
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
|
|
||||||
@ -2770,11 +2774,8 @@ The next example shows how to align columns and padding. We first show
|
|||||||
left-alignment:
|
left-alignment:
|
||||||
|
|
||||||
@example
|
@example
|
||||||
|
|
||||||
@code{
|
|
||||||
?- format("~n*Hello~16+*~n",[]).
|
?- format("~n*Hello~16+*~n",[]).
|
||||||
*Hello *
|
*Hello *
|
||||||
}
|
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
Note that we reserve 16 characters for the column.
|
Note that we reserve 16 characters for the column.
|
||||||
@ -2783,10 +2784,8 @@ The following example shows how to do right-alignment:
|
|||||||
|
|
||||||
|
|
||||||
@example
|
@example
|
||||||
@code{
|
|
||||||
?- format("*~tHello~16+*~n",[]).
|
?- format("*~tHello~16+*~n",[]).
|
||||||
* Hello*
|
* Hello*
|
||||||
}
|
|
||||||
|
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@ -2796,10 +2795,8 @@ The @code{~t} escape sequence forces filling before @code{Hello}.
|
|||||||
We next show how to do centering:
|
We next show how to do centering:
|
||||||
|
|
||||||
@example
|
@example
|
||||||
@code{
|
|
||||||
?- format("*~tHello~t~16+*~n",[]).
|
?- format("*~tHello~t~16+*~n",[]).
|
||||||
* Hello *
|
* Hello *
|
||||||
}
|
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
|
|
||||||
@ -2865,7 +2862,7 @@ X = [104, 101, 108, 108, 111]
|
|||||||
@end table
|
@end table
|
||||||
|
|
||||||
@node I/O of Characters, I/O for Streams, I/O of Terms, I/O
|
@node I/O of Characters, I/O for Streams, I/O of Terms, I/O
|
||||||
@subsection Handling Input/Output of Characters
|
@section Handling Input/Output of Characters
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
|
|
||||||
@ -2994,7 +2991,7 @@ Outputs a new line to the current output stream.
|
|||||||
@end table
|
@end table
|
||||||
|
|
||||||
@node I/O for Streams, C-Prolog to Terminal, I/O of Characters, I/O
|
@node I/O for Streams, C-Prolog to Terminal, I/O of Characters, I/O
|
||||||
@subsection Input/Output Predicates applied to Streams
|
@section Input/Output Predicates applied to Streams
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
|
|
||||||
@ -3026,13 +3023,6 @@ stream.
|
|||||||
Displays term @var{T} on the stream @var{S}. Atoms are quoted when
|
Displays term @var{T} on the stream @var{S}. Atoms are quoted when
|
||||||
necessary, and operators are ignored.
|
necessary, and operators are ignored.
|
||||||
|
|
||||||
@item write_canonical(+@var{T}) [ISO]
|
|
||||||
@findex write_canonical/1
|
|
||||||
@syindex write_canonical/1
|
|
||||||
@cnindex write_canonical/1
|
|
||||||
Displays term @var{T}. Atoms are quoted when necessary, and operators
|
|
||||||
are ignored.
|
|
||||||
|
|
||||||
@item write_term(+@var{S}, +@var{T}, +@var{Opts}) [ISO]
|
@item write_term(+@var{S}, +@var{T}, +@var{Opts}) [ISO]
|
||||||
@findex write_term/3
|
@findex write_term/3
|
||||||
@syindex write_term/3
|
@syindex write_term/3
|
||||||
@ -3167,7 +3157,7 @@ Outputs a new line to stream @var{S}.
|
|||||||
@end table
|
@end table
|
||||||
|
|
||||||
@node C-Prolog to Terminal, I/O Control, I/O for Streams, I/O
|
@node C-Prolog to Terminal, I/O Control, I/O for Streams, I/O
|
||||||
@subsection Compatible C-Prolog predicates for Terminal I/O
|
@section Compatible C-Prolog predicates for Terminal I/O
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
|
|
||||||
@ -3211,7 +3201,7 @@ Outputs a new line to stream @code{user_output}.
|
|||||||
@end table
|
@end table
|
||||||
|
|
||||||
@node I/O Control, Sockets, C-Prolog to Terminal, I/O
|
@node I/O Control, Sockets, C-Prolog to Terminal, I/O
|
||||||
@subsection Controlling Input/Output
|
@section Controlling Input/Output
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
|
|
||||||
@ -3248,7 +3238,7 @@ interactive control from a pipe or a socket.
|
|||||||
@end table
|
@end table
|
||||||
|
|
||||||
@node Sockets, , I/O Control, I/O
|
@node Sockets, , I/O Control, I/O
|
||||||
@subsection Using Sockets From YAP
|
@section Using Sockets From YAP
|
||||||
|
|
||||||
YAP includes a SICStus Prolog compatible socket interface. In YAP-6.3
|
YAP includes a SICStus Prolog compatible socket interface. In YAP-6.3
|
||||||
this uses the @c{clib} package to emulate the old low level interface that
|
this uses the @c{clib} package to emulate the old low level interface that
|
||||||
@ -3345,11 +3335,6 @@ integer @var{LENGTH} gives the queue limit for incoming connections,
|
|||||||
and should be limited to @code{5} for portable applications. The socket
|
and should be limited to @code{5} for portable applications. The socket
|
||||||
must be of type @code{SOCK_STREAM} or @code{SOCK_SEQPACKET}.
|
must be of type @code{SOCK_STREAM} or @code{SOCK_SEQPACKET}.
|
||||||
|
|
||||||
@item socket_accept(+@var{SOCKET}, -@var{STREAM})
|
|
||||||
@findex socket_accept/2
|
|
||||||
@syindex socket_accept/2
|
|
||||||
@cnindex socket_accept/2
|
|
||||||
|
|
||||||
@item socket_accept(+@var{SOCKET}, -@var{CLIENT}, -@var{STREAM})
|
@item socket_accept(+@var{SOCKET}, -@var{CLIENT}, -@var{STREAM})
|
||||||
@findex socket_accept/3
|
@findex socket_accept/3
|
||||||
@syindex socket_accept/3
|
@syindex socket_accept/3
|
||||||
@ -3412,7 +3397,7 @@ address in number and dots notation.
|
|||||||
@end table
|
@end table
|
||||||
|
|
||||||
@node Database, Sets, I/O, Top
|
@node Database, Sets, I/O, Top
|
||||||
@section Using the Clausal Data Base
|
@chapter Using the Clausal Data Base
|
||||||
|
|
||||||
Predicates in YAP may be dynamic or static. By default, when
|
Predicates in YAP may be dynamic or static. By default, when
|
||||||
consulting or reconsulting, predicates are assumed to be static:
|
consulting or reconsulting, predicates are assumed to be static:
|
||||||
@ -3496,7 +3481,7 @@ Subnodes of Database
|
|||||||
@end table
|
@end table
|
||||||
|
|
||||||
@node Modifying the Database, Looking at the Database, , Database
|
@node Modifying the Database, Looking at the Database, , Database
|
||||||
@subsection Modification of the Data Base
|
@section Modification of the Data Base
|
||||||
|
|
||||||
These predicates can be used either for static or for dynamic
|
These predicates can be used either for static or for dynamic
|
||||||
predicates:
|
predicates:
|
||||||
@ -3639,7 +3624,7 @@ Retract all the clauses whose head matches the goal @var{G}. Goal
|
|||||||
@end table
|
@end table
|
||||||
|
|
||||||
@node Looking at the Database, Database References, Modifying the Database, Database
|
@node Looking at the Database, Database References, Modifying the Database, Database
|
||||||
@subsection Looking at the Data Base
|
@section Looking at the Data Base
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
|
|
||||||
@ -3734,7 +3719,7 @@ public.
|
|||||||
@findex tabled/0 (predicate_property flag)
|
@findex tabled/0 (predicate_property flag)
|
||||||
true if the predicate is tabled; note that only static predicates can
|
true if the predicate is tabled; note that only static predicates can
|
||||||
be tabled in YAP.
|
be tabled in YAP.
|
||||||
@item source
|
@item source (predicate_property flag)
|
||||||
@findex source/0 (predicate_property flag)
|
@findex source/0 (predicate_property flag)
|
||||||
true if source for the predicate is available.
|
true if source for the predicate is available.
|
||||||
@item number_of_clauses(@var{ClauseCount})
|
@item number_of_clauses(@var{ClauseCount})
|
||||||
@ -3762,7 +3747,7 @@ of space required to store indices to those clauses (in bytes).
|
|||||||
@end table
|
@end table
|
||||||
|
|
||||||
@node Database References, Internal Database, Looking at the Database, Database
|
@node Database References, Internal Database, Looking at the Database, Database
|
||||||
@subsection Using Data Base References
|
@section Using Data Base References
|
||||||
|
|
||||||
Data Base references are a fast way of accessing terms. The predicates
|
Data Base references are a fast way of accessing terms. The predicates
|
||||||
@code{erase/1} and @code{instance/1} also apply to these references and may
|
@code{erase/1} and @code{instance/1} also apply to these references and may
|
||||||
@ -3812,6 +3797,7 @@ database reference is @var{R}. The predicate must be dynamic.
|
|||||||
|
|
||||||
@node Internal Database, BlackBoard, Database References, Database
|
@node Internal Database, BlackBoard, Database References, Database
|
||||||
@section Internal Data Base
|
@section Internal Data Base
|
||||||
|
|
||||||
Some programs need global information for, e.g. counting or collecting
|
Some programs need global information for, e.g. counting or collecting
|
||||||
data obtained by backtracking. As a rule, to keep this information, the
|
data obtained by backtracking. As a rule, to keep this information, the
|
||||||
internal data base should be used instead of asserting and retracting
|
internal data base should be used instead of asserting and retracting
|
||||||
@ -3871,6 +3857,9 @@ If a term equal to @var{T} up to variable renaming is stored under key
|
|||||||
@var{K} fail. Otherwise, make term @var{T} the first record under key
|
@var{K} fail. Otherwise, make term @var{T} the first record under key
|
||||||
@var{K} and unify @var{R} with its reference.
|
@var{K} and unify @var{R} with its reference.
|
||||||
|
|
||||||
|
This predicate is YAP specific.
|
||||||
|
|
||||||
|
|
||||||
@item recorded(+@var{K},@var{T},@var{R})
|
@item recorded(+@var{K},@var{T},@var{R})
|
||||||
@findex recorded/3
|
@findex recorded/3
|
||||||
@saindex recorded/3
|
@saindex recorded/3
|
||||||
@ -3990,26 +3979,6 @@ counter.
|
|||||||
@noindent
|
@noindent
|
||||||
This predicate is YAP specific.
|
This predicate is YAP specific.
|
||||||
|
|
||||||
@item recordzifnot(+@var{K},@var{T},-@var{R})
|
|
||||||
@findex recordzifnot/3
|
|
||||||
@snindex recordzifnot/3
|
|
||||||
@cnindex recordzifnot/3
|
|
||||||
If a variant of @var{T} is stored under key @var{K} fail. Otherwise, make
|
|
||||||
term @var{T} the last record under key @var{K} and unify @var{R} with its
|
|
||||||
reference.
|
|
||||||
|
|
||||||
This predicate is YAP specific.
|
|
||||||
|
|
||||||
@item recordaifnot(+@var{K},@var{T},-@var{R})
|
|
||||||
@findex recordaifnot/3
|
|
||||||
@snindex recordaifnot/3
|
|
||||||
@cnindex recordaifnot/3
|
|
||||||
If a variant of @var{T} is stored under key @var{K} fail. Otherwise, make
|
|
||||||
term @var{T} the first record under key @var{K} and unify @var{R} with its
|
|
||||||
reference.
|
|
||||||
|
|
||||||
This predicate is YAP specific.
|
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
There is a strong analogy between the i.d.b. and the way dynamic
|
There is a strong analogy between the i.d.b. and the way dynamic
|
||||||
@ -4237,7 +4206,7 @@ no
|
|||||||
@end table
|
@end table
|
||||||
|
|
||||||
@node Grammars, OS, Sets, Top
|
@node Grammars, OS, Sets, Top
|
||||||
@section Grammar Rules
|
@chapter Grammar Rules
|
||||||
|
|
||||||
Grammar rules in Prolog are both a convenient way to express definite
|
Grammar rules in Prolog are both a convenient way to express definite
|
||||||
clause grammars and an extension of the well known context-free grammars.
|
clause grammars and an extension of the well known context-free grammars.
|
||||||
@ -4353,7 +4322,7 @@ This predicate is used by the grammar rules compiler and is defined as
|
|||||||
@end table
|
@end table
|
||||||
|
|
||||||
@node OS, Term Modification, Grammars, Top
|
@node OS, Term Modification, Grammars, Top
|
||||||
@section Access to Operating System Functionality
|
@chapter Access to Operating System Functionality
|
||||||
|
|
||||||
The following built-in predicates allow access to underlying
|
The following built-in predicates allow access to underlying
|
||||||
Operating System functionality:
|
Operating System functionality:
|
||||||
@ -4582,7 +4551,7 @@ order of dispatch.
|
|||||||
@end table
|
@end table
|
||||||
|
|
||||||
@node Term Modification, Global Variables, OS, Top
|
@node Term Modification, Global Variables, OS, Top
|
||||||
@section Term Modification
|
@chapter Term Modification
|
||||||
|
|
||||||
@cindex updating terms
|
@cindex updating terms
|
||||||
It is sometimes useful to change the value of instantiated
|
It is sometimes useful to change the value of instantiated
|
||||||
@ -4612,12 +4581,6 @@ Set the value of the @var{I}th argument of term @var{S} to term @var{T}.
|
|||||||
@cnindex create_mutable/2
|
@cnindex create_mutable/2
|
||||||
Create new mutable variable @var{M} with initial value @var{D}.
|
Create new mutable variable @var{M} with initial value @var{D}.
|
||||||
|
|
||||||
@item get_mutable(?@var{D},+@var{M})
|
|
||||||
@findex get_mutable/2
|
|
||||||
@syindex get_mutable/2
|
|
||||||
@cnindex get_mutable/2
|
|
||||||
Unify the current value of mutable term @var{M} with term @var{D}.
|
|
||||||
|
|
||||||
@item is_mutable(?@var{D})
|
@item is_mutable(?@var{D})
|
||||||
@findex is_mutable/1
|
@findex is_mutable/1
|
||||||
@syindex is_mutable/1
|
@syindex is_mutable/1
|
||||||
@ -4638,7 +4601,7 @@ Set the current value of mutable term @var{M} to term @var{D}.
|
|||||||
@end table
|
@end table
|
||||||
|
|
||||||
@node Global Variables, Profiling, Term Modification, Top
|
@node Global Variables, Profiling, Term Modification, Top
|
||||||
@section Global Variables
|
@chapter Global Variables
|
||||||
|
|
||||||
@cindex global variables
|
@cindex global variables
|
||||||
|
|
||||||
@ -4844,7 +4807,7 @@ compound terms.
|
|||||||
|
|
||||||
|
|
||||||
@node Profiling, Call Counting, Global Variables, Top
|
@node Profiling, Call Counting, Global Variables, Top
|
||||||
@section Profiling Prolog Programs
|
@chapter Profiling Prolog Programs
|
||||||
|
|
||||||
@cindex profiling
|
@cindex profiling
|
||||||
|
|
||||||
@ -4860,7 +4823,7 @@ The YAP profiling sub-system is currently under
|
|||||||
development. Functionality for this sub-system will increase with newer
|
development. Functionality for this sub-system will increase with newer
|
||||||
implementation.
|
implementation.
|
||||||
|
|
||||||
@subsection The Count Profiler
|
@section The Count Profiler
|
||||||
|
|
||||||
@strong{Notes:}
|
@strong{Notes:}
|
||||||
|
|
||||||
@ -4928,7 +4891,8 @@ Reset all profiling information.
|
|||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@subsection Tick Profiler
|
@section Tick Profiler
|
||||||
|
|
||||||
The tick profiler works by interrupting the Prolog code every so often
|
The tick profiler works by interrupting the Prolog code every so often
|
||||||
and checking at each point the code was. The profiler must be able to
|
and checking at each point the code was. The profiler must be able to
|
||||||
retrace the state of the abstract machine at every moment. The major
|
retrace the state of the abstract machine at every moment. The major
|
||||||
@ -4977,7 +4941,7 @@ Show profiling info for the top-most @var{N} predicates.
|
|||||||
The @code{showprofres/0} and @code{showprofres/1} predicates call a user-defined multifile hook predicate, @code{user:prolog_predicate_name/2}, that can be used for converting a possibly explicitly-qualified callable term into an atom that will used when printing the profiling information.
|
The @code{showprofres/0} and @code{showprofres/1} predicates call a user-defined multifile hook predicate, @code{user:prolog_predicate_name/2}, that can be used for converting a possibly explicitly-qualified callable term into an atom that will used when printing the profiling information.
|
||||||
|
|
||||||
@node Call Counting, Arrays, Profiling, Top
|
@node Call Counting, Arrays, Profiling, Top
|
||||||
@section Counting Calls
|
@chapter Counting Calls
|
||||||
|
|
||||||
@cindex Counting Calls
|
@cindex Counting Calls
|
||||||
Predicates compiled with YAP's flag @code{call_counting} set to
|
Predicates compiled with YAP's flag @code{call_counting} set to
|
||||||
@ -5053,7 +5017,7 @@ exception when @code{l/0} performs more than 10000 reductions.
|
|||||||
|
|
||||||
|
|
||||||
@node Arrays, Preds, Call Counting , Top
|
@node Arrays, Preds, Call Counting , Top
|
||||||
@section Arrays
|
@chapter Arrays
|
||||||
|
|
||||||
The YAP system includes experimental support for arrays. The
|
The YAP system includes experimental support for arrays. The
|
||||||
support is enabled with the option @code{YAP_ARRAYS}.
|
support is enabled with the option @code{YAP_ARRAYS}.
|
||||||
@ -5262,7 +5226,7 @@ terms.
|
|||||||
@end table
|
@end table
|
||||||
|
|
||||||
@node Preds, Misc, Arrays, Top
|
@node Preds, Misc, Arrays, Top
|
||||||
@section Predicate Information
|
@chapter Predicate Information
|
||||||
|
|
||||||
Built-ins that return information on the current predicates and modules:
|
Built-ins that return information on the current predicates and modules:
|
||||||
|
|
||||||
@ -5286,7 +5250,7 @@ Succeeds if @var{M} are current modules associated to the file @var{F}.
|
|||||||
@end table
|
@end table
|
||||||
|
|
||||||
@node Misc, , Preds, Top
|
@node Misc, , Preds, Top
|
||||||
@section Miscellaneous
|
@chapter Miscellaneous
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
|
|
||||||
@ -6107,7 +6071,7 @@ filed are ignored.
|
|||||||
@*
|
@*
|
||||||
Current source module.
|
Current source module.
|
||||||
|
|
||||||
@item source
|
@item source (prolog_load_context/2 option)
|
||||||
@findex file (prolog_load_context/2 option)
|
@findex file (prolog_load_context/2 option)
|
||||||
@*
|
@*
|
||||||
Full name for the file currently being read in, which may be consulted,
|
Full name for the file currently being read in, which may be consulted,
|
||||||
|
@ -42,8 +42,8 @@ standard info directory.
|
|||||||
predefined directory.
|
predefined directory.
|
||||||
|
|
||||||
@end enumerate
|
@end enumerate
|
||||||
In most systems you will need to be superuser in order to do @command{make
|
In most systems you will need to be superuser in order to do
|
||||||
install} and @command{make info} on the standard directories.
|
@command{make install} and @command{make info} on the standard directories.
|
||||||
|
|
||||||
@node Configuration Options, Machine Options, ,Install
|
@node Configuration Options, Machine Options, ,Install
|
||||||
@section Tuning the Functionality of YAP
|
@section Tuning the Functionality of YAP
|
||||||
@ -301,8 +301,7 @@ fetch these files from @var{$YAPSRC\VC\include}.
|
|||||||
set @code{Project Type} to @code{Release}
|
set @code{Project Type} to @code{Release}
|
||||||
|
|
||||||
@item To use YAP's own include directories you have to set the Project
|
@item To use YAP's own include directories you have to set the Project
|
||||||
option @code{Project.Project Settings.C/C++.Preprocessor.Additional
|
option @code{Project.Project Settings.C/C++.Preprocessor.Additional Include Directories} to include the directories @var{$YAPSRC\H},
|
||||||
Include Directories} to include the directories @var{$YAPSRC\H},
|
|
||||||
@var{$YAPSRC\VC\include}, @var{$YAPSRC\OPTYAP} and
|
@var{$YAPSRC\VC\include}, @var{$YAPSRC\OPTYAP} and
|
||||||
@var{$YAPSRC\include}. The syntax is:
|
@var{$YAPSRC\include}. The syntax is:
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ Loading Programs
|
|||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
|
|
||||||
@item consult(@var{+F})
|
@item consult(+@var{F})
|
||||||
@findex consult/1
|
@findex consult/1
|
||||||
@snindex consult/1
|
@snindex consult/1
|
||||||
@cyindex consult/1
|
@cyindex consult/1
|
||||||
@ -31,7 +31,7 @@ In YAP @code{consult/1} does not remove previous clauses for
|
|||||||
the procedures defined in @var{F}. Moreover, note that all code in YAP
|
the procedures defined in @var{F}. Moreover, note that all code in YAP
|
||||||
is compiled.
|
is compiled.
|
||||||
|
|
||||||
@item reconsult(@var{+F})
|
@item reconsult(+@var{F})
|
||||||
@findex reconsult/1
|
@findex reconsult/1
|
||||||
@snindex reconsult/1
|
@snindex reconsult/1
|
||||||
@cyindex reconsult/1
|
@cyindex reconsult/1
|
||||||
@ -39,13 +39,13 @@ Updates the program replacing the
|
|||||||
previous definitions for the predicates defined in @var{F}.
|
previous definitions for the predicates defined in @var{F}.
|
||||||
|
|
||||||
|
|
||||||
@item [@var{+F}]
|
@item [+@var{F}]
|
||||||
@findex nil/1
|
@findex nil/1
|
||||||
@saindex []/1
|
@saindex []/1
|
||||||
@cyindex []/1
|
@cyindex []/1
|
||||||
The same as @code{consult(F)}.
|
The same as @code{consult(F)}.
|
||||||
|
|
||||||
@item [-@var{+F}]
|
@item [-+@var{F}]
|
||||||
@findex dash_nil/1
|
@findex dash_nil/1
|
||||||
@saindex [-]/1
|
@saindex [-]/1
|
||||||
@cyindex [-]/1
|
@cyindex [-]/1
|
||||||
@ -60,14 +60,14 @@ Example:
|
|||||||
will consult @code{file1} @code{file4} and reconsult @code{file2} and
|
will consult @code{file1} @code{file4} and reconsult @code{file2} and
|
||||||
@code{file3}.
|
@code{file3}.
|
||||||
|
|
||||||
@item compile(@var{+F})
|
@item compile(+@var{F})
|
||||||
@findex compile/1
|
@findex compile/1
|
||||||
@syindex compile/1
|
@syindex compile/1
|
||||||
@cnindex compile/1
|
@cnindex compile/1
|
||||||
@noindent
|
@noindent
|
||||||
In YAP, the same as @code{reconsult/1}.
|
In YAP, the same as @code{reconsult/1}.
|
||||||
|
|
||||||
@item load_files(@var{+Files}, @var{+Options})
|
@item load_files(+@var{Files}, +@var{Options})
|
||||||
@findex load_files/2
|
@findex load_files/2
|
||||||
@syindex load_files/2
|
@syindex load_files/2
|
||||||
@cnindex load_files/2
|
@cnindex load_files/2
|
||||||
@ -138,7 +138,7 @@ supported encodings.
|
|||||||
is @code{exo}, these are facts with atoms and integers that need a very compact representation.
|
is @code{exo}, these are facts with atoms and integers that need a very compact representation.
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@item ensure_loaded(@var{+F}) [ISO]
|
@item ensure_loaded(+@var{F}) [ISO]
|
||||||
@findex ensure_loaded/1
|
@findex ensure_loaded/1
|
||||||
@syindex compile/1
|
@syindex compile/1
|
||||||
@cnindex compile/1
|
@cnindex compile/1
|
||||||
@ -153,14 +153,14 @@ if they have not been loaded before, does nothing otherwise.
|
|||||||
|
|
||||||
@var{F} must be a list containing the names of the files to load.
|
@var{F} must be a list containing the names of the files to load.
|
||||||
|
|
||||||
@item load_db(@var{+Files})
|
@item load_db(+@var{Files})
|
||||||
@findex load_db/1
|
@findex load_db/1
|
||||||
@syindex load_db/1
|
@syindex load_db/1
|
||||||
@cnindex load_db/1
|
@cnindex load_db/1
|
||||||
@noindent
|
@noindent
|
||||||
Load a database of facts with equal structure.
|
Load a database of facts with equal structure.
|
||||||
|
|
||||||
@item exo_files(@var{+Files})
|
@item exo_files(+@var{Files})
|
||||||
@findex exo_files/1
|
@findex exo_files/1
|
||||||
@syindex exo_files/1
|
@syindex exo_files/1
|
||||||
@cnindex exo_files/1
|
@cnindex exo_files/1
|
||||||
@ -185,7 +185,7 @@ read in a very compact way database tables.
|
|||||||
If `my_program' is started it will first reconsult all source files
|
If `my_program' is started it will first reconsult all source files
|
||||||
that have changed since the compilation.
|
that have changed since the compilation.
|
||||||
|
|
||||||
@item include(@var{+F}) [ISO]
|
@item include(+@var{F}) [ISO]
|
||||||
@findex include/1 (directive)
|
@findex include/1 (directive)
|
||||||
@snindex compile/1 (directive)
|
@snindex compile/1 (directive)
|
||||||
@cnindex compile/1 (directive)
|
@cnindex compile/1 (directive)
|
||||||
@ -439,15 +439,6 @@ file_search_path(system,A) :-
|
|||||||
Thus, @code{[library(A)]} will search for a file using
|
Thus, @code{[library(A)]} will search for a file using
|
||||||
@code{library_directory/1} to obtain the prefix.
|
@code{library_directory/1} to obtain the prefix.
|
||||||
|
|
||||||
@item library_directory(+@var{D})
|
|
||||||
@findex library_directory/1
|
|
||||||
@snindex library_directory/1
|
|
||||||
@cnindex library_directory/1
|
|
||||||
Succeeds when @var{D} is a current library directory name. Library
|
|
||||||
directories are the places where files specified in the form
|
|
||||||
@code{library(@var{File})} are searched by the predicates
|
|
||||||
@code{consult/1}, @code{reconsult/1}, @code{use_module/1} or
|
|
||||||
@code{ensure_loaded/1}.
|
|
||||||
|
|
||||||
@item prolog_file_name(+@var{Name},-@var{FullPath})
|
@item prolog_file_name(+@var{Name},-@var{FullPath})
|
||||||
@findex prolog_file_name/2
|
@findex prolog_file_name/2
|
||||||
@ -995,8 +986,8 @@ may be a predicate indicator or of the form ``@var{PI} @code{as}
|
|||||||
to be exported under name @var{NewName}.
|
to be exported under name @var{NewName}.
|
||||||
@item @code{except}(@var{List})
|
@item @code{except}(@var{List})
|
||||||
In this case, all predicates not in @var{List} are exported. Moreover,
|
In this case, all predicates not in @var{List} are exported. Moreover,
|
||||||
if ``@var{PI} @code{as} @var{NewName}'' is found, the predicate with
|
if @code{@var{PI} @code{as} @var{NewName}} is found, the predicate with
|
||||||
indicator @var{PI} is to be exported under name @var{NewName}@ as
|
indicator @var{PI} is to be exported under name @var{NewName} as
|
||||||
before.
|
before.
|
||||||
@end itemize
|
@end itemize
|
||||||
@end table
|
@end table
|
||||||
|
72
docs/yap.tex
72
docs/yap.tex
@ -47,11 +47,11 @@
|
|||||||
@subtitle Version @value{VERSION}
|
@subtitle Version @value{VERSION}
|
||||||
@author Vitor Santos Costa,
|
@author Vitor Santos Costa,
|
||||||
@author Luís Damas,
|
@author Luís Damas,
|
||||||
@author Rogério Reis, and
|
@author Rogério Reis
|
||||||
@author Rúben Azevedo
|
@author Rúben Azevedo
|
||||||
@page
|
@page
|
||||||
@vskip 2pc
|
@vskip 2pc
|
||||||
Copyright @copyright{} 1989-2000 L. Damas, V. Santos Costa and Universidade
|
@copyright{} 1989-2014 L. Damas, V. Santos Costa and Universidade
|
||||||
do Porto.
|
do Porto.
|
||||||
|
|
||||||
Permission is granted to make and distribute verbatim copies of
|
Permission is granted to make and distribute verbatim copies of
|
||||||
@ -405,12 +405,13 @@ On-line documentation is available for YAP at:
|
|||||||
Recent versions of YAP, including both source and selected binaries,
|
Recent versions of YAP, including both source and selected binaries,
|
||||||
can be found from this same URL.
|
can be found from this same URL.
|
||||||
|
|
||||||
This manual was written by V@'{@dotless{i}}tor Santos Costa,
|
This manual was written by Vítor Santos Costa,
|
||||||
Lu@'{@dotless{i}}s Damas, Rog@'erio Reis, and R@'uben Azevedo. The
|
Luís Damas, Rogério Reis, and Rúben Azevedo. The
|
||||||
manual is largely based on the DECsystem-10 Prolog User's Manual by
|
manual is largely based on the DECsystem-10 Prolog User's Manual by
|
||||||
D.L. Bowen, L. Byrd, F. C. N. Pereira, L. M. Pereira, and
|
D.L. Bowen, L. Byrd, F. C. N. Pereira, L. M. Pereira, and
|
||||||
D. H. D. Warren. We have also used comments from the Edinburgh Prolog
|
D. H. D. Warren. We have also used comments from the Edinburgh Prolog
|
||||||
library written by R. O'Keefe. We would also like to gratefully
|
library written by R. O'Keefe and from the SWI-Prolog manual written by
|
||||||
|
Jan Wielemaker. We would also like to gratefully
|
||||||
acknowledge the contributions from Ashwin Srinivasian.
|
acknowledge the contributions from Ashwin Srinivasian.
|
||||||
|
|
||||||
We are happy to include in YAP several excellent packages developed
|
We are happy to include in YAP several excellent packages developed
|
||||||
@ -669,7 +670,7 @@ The original author of this code was Richard O'Keefe. Jan Wielemaker
|
|||||||
|
|
||||||
|
|
||||||
@node Apply, Association Lists, Aggregate, Library
|
@node Apply, Association Lists, Aggregate, Library
|
||||||
@section Apply Macros
|
@sectionbui Apply Macros
|
||||||
@cindex apply
|
@cindex apply
|
||||||
|
|
||||||
This library provides a SWI-compatible set of utilities for applying a
|
This library provides a SWI-compatible set of utilities for applying a
|
||||||
@ -1151,6 +1152,7 @@ and lookup values of variables in each solution:
|
|||||||
|
|
||||||
@node Gecode and ClP(FD), The Gecode Interface, , Gecode
|
@node Gecode and ClP(FD), The Gecode Interface, , Gecode
|
||||||
@subsection Programming Finite Domain Constraints in YAP/Gecode
|
@subsection Programming Finite Domain Constraints in YAP/Gecode
|
||||||
|
|
||||||
The gecode/clp(fd) interface is designed to use the GECODE functionality
|
The gecode/clp(fd) interface is designed to use the GECODE functionality
|
||||||
in a more CLP like style. It requires
|
in a more CLP like style. It requires
|
||||||
@example
|
@example
|
||||||
@ -1714,17 +1716,10 @@ available by loading the library @code{library(lineutils)}.
|
|||||||
|
|
||||||
Search for a character @var{Char} in the list of codes @var{Line}.
|
Search for a character @var{Char} in the list of codes @var{Line}.
|
||||||
|
|
||||||
@item search_for(+@var{Char},+@var{Line})
|
|
||||||
@findex search_for/2
|
|
||||||
@snindex search_for/2
|
|
||||||
@cnindex search_for/2
|
|
||||||
|
|
||||||
Search for a character @var{Char} in the list of codes @var{Line}.
|
|
||||||
|
|
||||||
@item search_for(+@var{Char},+@var{Line},-@var{RestOfine})
|
@item search_for(+@var{Char},+@var{Line},-@var{RestOfine})
|
||||||
@findex search_for/2
|
@findex search_for/3
|
||||||
@snindex search_for/2
|
@snindex search_for/3
|
||||||
@cnindex search_for/2
|
@cnindex search_for/3
|
||||||
|
|
||||||
Search for a character @var{Char} in the list of codes @var{Line},
|
Search for a character @var{Char} in the list of codes @var{Line},
|
||||||
@var{RestOfLine} has the line to the right.
|
@var{RestOfLine} has the line to the right.
|
||||||
@ -1809,13 +1804,6 @@ the character code @var{Separator}.
|
|||||||
|
|
||||||
Copy a line from @var{StreamInput} to @var{StreamOutput}.
|
Copy a line from @var{StreamInput} to @var{StreamOutput}.
|
||||||
|
|
||||||
@item copy_line(+@var{StreamInput},+@var{StreamOutput})
|
|
||||||
@findex copy_line/2
|
|
||||||
@snindex copy_line/2
|
|
||||||
@cnindex copy_line/2
|
|
||||||
|
|
||||||
Copy a line from @var{StreamInput} to @var{StreamOutput}.
|
|
||||||
|
|
||||||
@item process(+@var{StreamInp}, +@var{Goal})
|
@item process(+@var{StreamInp}, +@var{Goal})
|
||||||
@findex process/2
|
@findex process/2
|
||||||
@snindex process/2
|
@snindex process/2
|
||||||
@ -1889,16 +1877,14 @@ the Prolog engine instead.
|
|||||||
Creates @var{TermOut1} and @var{TermOut2} by applying the predicate @var{Pred} to all
|
Creates @var{TermOut1} and @var{TermOut2} by applying the predicate @var{Pred} to all
|
||||||
arguments of @var{TermIn}
|
arguments of @var{TermIn}
|
||||||
|
|
||||||
@item mapargs(+@var{Pred}, +@var{TermIn}, ?@var{TermOut1},
|
@item mapargs(+@var{Pred}, +@var{TermIn}, ?@var{TermOut1}, ?@var{TermOut2}, ?@var{TermOut3})
|
||||||
?@var{TermOut2}, ?@var{TermOut3})
|
|
||||||
@findex mapargs/5
|
@findex mapargs/5
|
||||||
@snindex mapargs/5
|
@snindex mapargs/5
|
||||||
@cnindex mapargs/5
|
@cnindex mapargs/5
|
||||||
Creates @var{TermOut1}, @var{TermOut2} and @var{TermOut3} by applying the predicate @var{Pred} to all
|
Creates @var{TermOut1}, @var{TermOut2} and @var{TermOut3} by applying the predicate @var{Pred} to all
|
||||||
arguments of @var{TermIn}
|
arguments of @var{TermIn}
|
||||||
|
|
||||||
@item mapargs(+@var{Pred}, +@var{TermIn}, ?@var{TermOut1},
|
@item mapargs(+@var{Pred}, +@var{TermIn}, ?@var{TermOut1}, ?@var{TermOut2}, ?@var{TermOut3}, ?@var{TermOut4})
|
||||||
?@var{TermOut2}, ?@var{TermOut3}, ?@var{TermOut4})
|
|
||||||
@findex mapargs/6
|
@findex mapargs/6
|
||||||
@snindex mapargs/6
|
@snindex mapargs/6
|
||||||
@cnindex mapargs/6
|
@cnindex mapargs/6
|
||||||
@ -1912,7 +1898,7 @@ the Prolog engine instead.
|
|||||||
@cnindex foldargs/4
|
@cnindex foldargs/4
|
||||||
Calls the predicate @var{Pred} on all arguments of @var{Term} and
|
Calls the predicate @var{Pred} on all arguments of @var{Term} and
|
||||||
collects a result in @var{Accumulator}
|
collects a result in @var{Accumulator}
|
||||||
|
|
||||||
@item foldargs(+@var{Pred}, +@var{Term}, +@var{Term1}, ?@var{AccIn}, ?@var{AccOut})
|
@item foldargs(+@var{Pred}, +@var{Term}, +@var{Term1}, ?@var{AccIn}, ?@var{AccOut})
|
||||||
@findex foldargs/5
|
@findex foldargs/5
|
||||||
@snindex foldargs/5
|
@snindex foldargs/5
|
||||||
@ -2077,8 +2063,7 @@ applying the predicate @var{Pred} to all list elements on which
|
|||||||
Calls @var{Pred} on all elements of @var{List}, @var{List1} and @var{List2} and collects a result in
|
Calls @var{Pred} on all elements of @var{List}, @var{List1} and @var{List2} and collects a result in
|
||||||
@var{X} and @var{Y}.
|
@var{X} and @var{Y}.
|
||||||
|
|
||||||
@item foldl3(:@var{Pred}, +@var{List1}, ?@var{List2}, ?@var{X0},
|
@item foldl3(:@var{Pred}, +@var{List1}, ?@var{List2}, ?@var{X0}, ?@var{X}, ?@var{Y0}, ?@var{Y}, ?@var{Z0}, ?@var{Z})
|
||||||
?@var{X}, ?@var{Y0}, ?@var{Y}, ?@var{Z0}, ?@var{Z})
|
|
||||||
|
|
||||||
@findex foldl3/6
|
@findex foldl3/6
|
||||||
@snindex foldl3/6
|
@snindex foldl3/6
|
||||||
@ -2086,8 +2071,7 @@ applying the predicate @var{Pred} to all list elements on which
|
|||||||
Calls @var{Pred} on all elements of @code{List} and collects a
|
Calls @var{Pred} on all elements of @code{List} and collects a
|
||||||
result in @var{X}, @var{Y} and @var{Z}.
|
result in @var{X}, @var{Y} and @var{Z}.
|
||||||
|
|
||||||
@item foldl3(:@var{Pred}, +@var{List1}, ?@var{List2}, ?@var{X0},
|
@item foldl4(:@var{Pred}, +@var{List1}, ?@var{List2}, ?@var{X0}, ?@var{X}, ?@var{Y0}, ?@var{Y}, ?@var{Z0}, ?@var{Z}, ?@var{W0}, ?@var{W})
|
||||||
?@var{X}, ?@var{Y0}, ?@var{Y}, ?@var{Z0}, ?@var{Z}, ?@var{W0}, ?@var{W})
|
|
||||||
|
|
||||||
@findex foldl4/8
|
@findex foldl4/8
|
||||||
@snindex foldl4/8
|
@snindex foldl4/8
|
||||||
@ -2354,7 +2338,7 @@ all elements of a matrix or list
|
|||||||
@item -/2
|
@item -/2
|
||||||
subtract two numbers, subtract two matrices or lists element-by-element, or subtract a number from
|
subtract two numbers, subtract two matrices or lists element-by-element, or subtract a number from
|
||||||
all elements of a matrix or list
|
all elements of a matrix or list
|
||||||
@item */2
|
@item * /2
|
||||||
multiply two numbers, multiply two matrices or lists element-by-element, or multiply a number from
|
multiply two numbers, multiply two matrices or lists element-by-element, or multiply a number from
|
||||||
all elements of a matrix or list
|
all elements of a matrix or list
|
||||||
@item log/1
|
@item log/1
|
||||||
@ -2367,9 +2351,9 @@ natural exponentiation of a number, matrix or list
|
|||||||
@findex foreach/2
|
@findex foreach/2
|
||||||
@snindex foreach/2
|
@snindex foreach/2
|
||||||
@cnindex foreach/2
|
@cnindex foreach/2
|
||||||
Deterministic iterator. The ranges are given by @var{Sequence} that is either @code{@var{I} in
|
Deterministic iterator. The ranges are given by @var{Sequence} that is
|
||||||
@var{M}..@var{N}}, or of the form @code{[@var{I},@var{J}] ins
|
either @code{@var{I} in @var{M}..@var{N}}, or of the form
|
||||||
@var{M}..@var{N}}, or a list of the above conditions.
|
@code{[@var{I},@var{J}] ins @var{M}..@var{N}}, or a list of the above conditions.
|
||||||
|
|
||||||
Variables in the goal are assumed to be global, ie, share a single value
|
Variables in the goal are assumed to be global, ie, share a single value
|
||||||
in the execution. The exceptions are the iteration indices. Moreover, if
|
in the execution. The exceptions are the iteration indices. Moreover, if
|
||||||
@ -2868,16 +2852,6 @@ in the matlab variable with name @var{Array}. Corresponds to the
|
|||||||
MATLAB command @code{zeros}.
|
MATLAB command @code{zeros}.
|
||||||
|
|
||||||
|
|
||||||
@item matlab_zeros(+@var{SizeX}, +@var{SizeY}, +@var{SizeZ}, ?@var{Array})
|
|
||||||
@findex matlab_zeros/4
|
|
||||||
@snindex matlab_zeros/4
|
|
||||||
@cnindex matlab_zeros/4
|
|
||||||
MATLAB will create an array of zeros of size @var{SizeX}, @var{SizeY},
|
|
||||||
and @var{SizeZ}. If @var{Array} is bound to an atom, store the array
|
|
||||||
in the matlab variable with name @var{Array}. Corresponds to the
|
|
||||||
MATLAB command @code{zeros}.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
@ -8595,10 +8569,6 @@ The possible forms for @var{P} are the same as in @code{spy P}.
|
|||||||
@cnindex nospyall/0
|
@cnindex nospyall/0
|
||||||
Removes all existing spy-points.
|
Removes all existing spy-points.
|
||||||
|
|
||||||
@item notrace
|
|
||||||
@findex notrace/0
|
|
||||||
Switches off the debugger and stops tracing.
|
|
||||||
|
|
||||||
@item leash(+@var{M})
|
@item leash(+@var{M})
|
||||||
@findex leash/1
|
@findex leash/1
|
||||||
@syindex leash/1
|
@syindex leash/1
|
||||||
@ -10054,7 +10024,7 @@ static int start_n100(void);
|
|||||||
static int continue_n100(void);
|
static int continue_n100(void);
|
||||||
|
|
||||||
typedef struct @{
|
typedef struct @{
|
||||||
YAP_Term next_solution; /* the next solution */
|
YAP_Term next_solution;
|
||||||
@} n100_data_type;
|
@} n100_data_type;
|
||||||
|
|
||||||
n100_data_type *n100_data;
|
n100_data_type *n100_data;
|
||||||
|
@ -57,21 +57,12 @@ append(ListOfLists, List) :-
|
|||||||
append_(ListOfLists, List).
|
append_(ListOfLists, List).
|
||||||
|
|
||||||
append_([], []).
|
append_([], []).
|
||||||
append_([L|Ls], As) :-
|
append_([L], L).
|
||||||
append(L, Ws, As),
|
append_([L1,L2], L) :-
|
||||||
append_(Ls, Ws).
|
append(L1,L2,L).
|
||||||
|
append_([L1,L2|[L3|LL]], L) :-
|
||||||
|
append(L1,L2,LI),
|
||||||
% delete(List, Elem, Residue)
|
append_([LI|[L3|LL]],L).
|
||||||
% is true when List is a list, in which Elem may or may not occur, and
|
|
||||||
% Residue is a copy of List with all elements identical to Elem deleted.
|
|
||||||
|
|
||||||
delete([], _, []).
|
|
||||||
delete([Head|List], Elem, Residue) :-
|
|
||||||
Head == Elem, !,
|
|
||||||
delete(List, Elem, Residue).
|
|
||||||
delete([Head|List], Elem, [Head|Residue]) :-
|
|
||||||
delete(List, Elem, Residue).
|
|
||||||
|
|
||||||
|
|
||||||
% last(List, Last)
|
% last(List, Last)
|
||||||
|
282
misc/sysgraph
282
misc/sysgraph
@ -10,8 +10,22 @@
|
|||||||
|
|
||||||
:- yap_flag( double_quotes, string ).
|
:- yap_flag( double_quotes, string ).
|
||||||
|
|
||||||
:- dynamic edge/4, node/4.
|
:- dynamic edge/4, node/4, public_predicate/3, private_predicate/3, module_on/2.
|
||||||
|
|
||||||
|
% @short node(?Module:module, ?Predicate:pred_indicator, ?File:file, ?Generator:atom) is nondet
|
||||||
|
%
|
||||||
|
|
||||||
|
|
||||||
|
inline( !/0 ).
|
||||||
|
inline( (\+)/1 ).
|
||||||
|
inline( (fail)/0 ).
|
||||||
|
inline( (false)/0 ).
|
||||||
|
inline( (repeat)/0 ).
|
||||||
|
inline( (true)/0 ).
|
||||||
|
inline( []/0 ).
|
||||||
|
|
||||||
|
% @short edge(+SourceModule:module, +SourcePredicate:pred_indicator, +TargetPredicate:pred_indicator, +InFile:file) is nondet
|
||||||
|
%
|
||||||
|
|
||||||
main :-
|
main :-
|
||||||
% from libraries outside the current directories
|
% from libraries outside the current directories
|
||||||
@ -76,6 +90,7 @@ c_line(Line, _Mod, F) :-
|
|||||||
atom_string( N, NS),
|
atom_string( N, NS),
|
||||||
number_string(A, AS),
|
number_string(A, AS),
|
||||||
nb_getval( current_module, Mod ),
|
nb_getval( current_module, Mod ),
|
||||||
|
\+ inline(N/A),
|
||||||
assert( node( Mod, N/A, F, c) ).
|
assert( node( Mod, N/A, F, c) ).
|
||||||
c_line(Line, _Mod, F) :-
|
c_line(Line, _Mod, F) :-
|
||||||
append( _, [ "Yap_InitAsmPred", NS, AS|_], Line), !,
|
append( _, [ "Yap_InitAsmPred", NS, AS|_], Line), !,
|
||||||
@ -94,39 +109,39 @@ c_line(Line, _Mod, F) :-
|
|||||||
atom_string(N,NS),
|
atom_string(N,NS),
|
||||||
number_string(A, AS),
|
number_string(A, AS),
|
||||||
nb_getval( current_module, Mod ),
|
nb_getval( current_module, Mod ),
|
||||||
assert( node( Mod, N/A, F, back_c) ).
|
assert( node( Mod, N/A, F, c) ).
|
||||||
c_line(Line, _Mod, F) :-
|
c_line(Line, _Mod, F) :-
|
||||||
append( _, [ "YAP_UserCPredicate", NS, AS|_], Line), !,
|
append( _, [ "YAP_UserCPredicate", NS, AS|_], Line), !,
|
||||||
atom_string(N,NS),
|
atom_string(N,NS),
|
||||||
number_string(A, AS),
|
number_string(A, AS),
|
||||||
nb_getval( current_module, Mod ),
|
nb_getval( current_module, Mod ),
|
||||||
assert( node( Mod, N/A, F, user_c) ).
|
assert( node( Mod, N/A, F, c) ).
|
||||||
c_line(Line, _Mod, F) :-
|
c_line(Line, _Mod, F) :-
|
||||||
append( _, [ "PRED_DEF", NS, AS|_], Line), !,
|
append( _, [ "PRED_DEF", NS, AS|_], Line), !,
|
||||||
atom_string(N,NS),
|
atom_string(N,NS),
|
||||||
number_string(A, AS),
|
number_string(A, AS),
|
||||||
nb_getval( current_module, Mod ),
|
nb_getval( current_module, Mod ),
|
||||||
assert( node( Mod, N/A, F, user_c) ).
|
assert( node( Mod, N/A, F, c) ).
|
||||||
/*
|
/*
|
||||||
c_line(Line, _Mod, F) :-
|
c_line(Line, _Mod, F) :-
|
||||||
append( _, [ "PRED_IMPL", NS, AS|_], Line), !,
|
append( _, [ "PRED_IMPL", NS, AS|_], Line), !,
|
||||||
atom_string(N,NS),
|
atom_string(N,NS),
|
||||||
number_string(A, AS),
|
number_string(A, AS),
|
||||||
nb_getval( current_module, Mod ),
|
nb_getval( current_module, Mod ),
|
||||||
assert( node( Mod, N/A, F, user_c) ).
|
assert( node( Mod, N/A, F, c) ).
|
||||||
*/
|
*/
|
||||||
c_line(Line, _Mod, F) :-
|
c_line(Line, _Mod, F) :-
|
||||||
append( _, [ "PRED", NS, AS|_], Line), !,
|
append( _, [ "PRED", NS, AS|_], Line), !,
|
||||||
atom_string(N,NS),
|
atom_string(N,NS),
|
||||||
number_string(A, AS),
|
number_string(A, AS),
|
||||||
nb_getval( current_module, Mod ),
|
nb_getval( current_module, Mod ),
|
||||||
assert( node( Mod, N/A, F, user_c) ).
|
assert( node( Mod, N/A, F, c) ).
|
||||||
c_line(Line, _Mod, F) :-
|
c_line(Line, _Mod, F) :-
|
||||||
append( _, [ "FRG", NS, AS|_], Line), !,
|
append( _, [ "FRG", NS, AS|_], Line), !,
|
||||||
atom_string(N,NS),
|
atom_string(N,NS),
|
||||||
number_string(A, AS),
|
number_string(A, AS),
|
||||||
nb_getval( current_module, Mod ),
|
nb_getval( current_module, Mod ),
|
||||||
assert( node( Mod, N/A, F, user_c) ).
|
assert( node( Mod, N/A, F, c) ).
|
||||||
|
|
||||||
|
|
||||||
mod("ATTRIBUTES_MODULE", _, attributes ).
|
mod("ATTRIBUTES_MODULE", _, attributes ).
|
||||||
@ -147,6 +162,24 @@ mod("cm", M, M ).
|
|||||||
mod("OldCurrentModule", M, M ).
|
mod("OldCurrentModule", M, M ).
|
||||||
|
|
||||||
|
|
||||||
|
pl_preds(Dir) :-
|
||||||
|
atom( Dir ),
|
||||||
|
Root = '.',
|
||||||
|
Suffix = '.yap',
|
||||||
|
atom_concat([Root,'/',Dir,'/','*',Suffix], Pattern),
|
||||||
|
expand_file_name( Pattern, Files ),
|
||||||
|
member( File, Files ),
|
||||||
|
pl_nodes( File , prolog, Suffix ),
|
||||||
|
fail.
|
||||||
|
pl_preds(Dir) :-
|
||||||
|
atom( Dir ),
|
||||||
|
Root = '.',
|
||||||
|
Suffix = '.pl',
|
||||||
|
atom_concat([Root,'/',Dir,'/','*',Suffix], Pattern),
|
||||||
|
expand_file_name( Pattern, Files ),
|
||||||
|
member( File, Files ),
|
||||||
|
pl_nodes( File , prolog, Suffix ),
|
||||||
|
fail.
|
||||||
pl_preds(Dir) :-
|
pl_preds(Dir) :-
|
||||||
atom( Dir ),
|
atom( Dir ),
|
||||||
Root = '.',
|
Root = '.',
|
||||||
@ -167,11 +200,101 @@ pl_preds(Dir) :-
|
|||||||
fail.
|
fail.
|
||||||
pl_preds(_).
|
pl_preds(_).
|
||||||
|
|
||||||
|
pl_nodes(F, _Mod, Suffix) :-
|
||||||
|
% writeln(F),
|
||||||
|
file_to_module(F, Suffix, Mod),
|
||||||
|
nb_setval( current_module, Mod ),
|
||||||
|
open(F, read, S),
|
||||||
|
repeat,
|
||||||
|
read_term( S, T, [singletons(_Vars), term_position(_Pos) ] ),
|
||||||
|
( T == end_of_file
|
||||||
|
->
|
||||||
|
!,
|
||||||
|
close(S)
|
||||||
|
;
|
||||||
|
% warn_singletons(Vars, Pos),
|
||||||
|
nb_getval( current_module, M ),
|
||||||
|
line_count( S, Lines ),
|
||||||
|
build_nodes( T, F:Lines, M ),
|
||||||
|
fail
|
||||||
|
).
|
||||||
|
|
||||||
|
build_nodes( M:T, F, _ ) :- !,
|
||||||
|
build_nodes( T, F, M ).
|
||||||
|
build_nodes( (M:H :- B), F, _ ) :- !,
|
||||||
|
build_nodes( (H :- B), F, M ).
|
||||||
|
build_nodes( (H :- _B), F, M ) :- !,
|
||||||
|
functor(H, N, A),
|
||||||
|
add_node( M:N/A, F).
|
||||||
|
build_nodes( (H --> _B), F, M ) :- !,
|
||||||
|
functor(H, N, A1),
|
||||||
|
A is A1+2,
|
||||||
|
add_node( M:N/A, F).
|
||||||
|
build_nodes( (:- module( NM, Is ) ), F, _M ) :- !,
|
||||||
|
nb_setval( current_module, NM ),
|
||||||
|
F = FN:_,
|
||||||
|
assert( module_on( FN:_ , NM) ),
|
||||||
|
maplist( public(F, NM), Is ).
|
||||||
|
build_nodes( (:- private( Is ) ), F, M ) :- !,
|
||||||
|
maplist( private(F, M), Is ).
|
||||||
|
build_nodes( (:- dynamic Bs), F, M ) :-
|
||||||
|
add_nodes( Bs, F, M).
|
||||||
|
build_nodes( (:- multifile Bs), F, M ) :-
|
||||||
|
add_nodes( Bs, F, M).
|
||||||
|
build_nodes( (:- thread_local Bs), F, M ) :-
|
||||||
|
add_nodes( Bs, F, M).
|
||||||
|
build_nodes( (:- _B), _F, _M ) :- !.
|
||||||
|
build_nodes( (?- _B), _F, _M ) :- !.
|
||||||
|
build_nodes( H, F, M ) :-
|
||||||
|
functor(H, N, A),
|
||||||
|
add_node( M:N/A, F).
|
||||||
|
|
||||||
|
public(F, M, I) :-
|
||||||
|
assert(public_predicate(I, M, F)).
|
||||||
|
|
||||||
|
private(F, M, I) :-
|
||||||
|
assert(private_predicate(I, M, F)).
|
||||||
|
|
||||||
|
|
||||||
|
add_nodes( (A,B), F, M) :- !,
|
||||||
|
add_nodes( A, F, M),
|
||||||
|
add_nodes( B, F, M).
|
||||||
|
add_nodes( M:A, F, _M) :- !,
|
||||||
|
add_nodes( A, F, M).
|
||||||
|
add_nodes( B, F, M) :- !,
|
||||||
|
add_node( M:B, F).
|
||||||
|
|
||||||
|
|
||||||
|
add_node( N, F, M ) :-
|
||||||
|
always_strip_module(M:N, M, N1 ),
|
||||||
|
functor(N1, Na, Ar),
|
||||||
|
(Na = '$c_built_in'/3 -> writeln(add_node(M:Na/Ar, F)) ; true ),
|
||||||
|
add_node(M:Na/Ar, F).
|
||||||
|
|
||||||
|
add_node( M:N/A, F) :-
|
||||||
|
F = FN:_,
|
||||||
|
F0 = FN:0,
|
||||||
|
( module_on( F, _ ) -> true
|
||||||
|
;
|
||||||
|
sub_atom(N, 0, 1, _, '$') -> true
|
||||||
|
;
|
||||||
|
public_predicate(N/A, M, F0) -> true
|
||||||
|
;
|
||||||
|
private_predicate(N/A, M, F0) -> true
|
||||||
|
;
|
||||||
|
assert(public_predicate(N/A, M, F0) )
|
||||||
|
),
|
||||||
|
fail.
|
||||||
|
add_node( M:N/A, F) :- node( M, N/A, F, _ ), !.
|
||||||
|
add_node( M:N/A, F) :-
|
||||||
|
assert( node( M, N/A, F, prolog ) ).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pl_file(F, _Mod, Suffix) :-
|
pl_file(F, _Mod, Suffix) :-
|
||||||
% writeln(F),
|
% writeln(F),
|
||||||
file_base_name(F, Base),
|
file_to_module(F, Suffix, Mod),
|
||||||
atom_concat(Mod, Suffix, Base),
|
nb_setval( current_module, Mod ),
|
||||||
nb_setval( current_module, Mod ),
|
|
||||||
open(F, read, S),
|
open(F, read, S),
|
||||||
repeat,
|
repeat,
|
||||||
read_term( S, T, [singletons(_Vars), term_position(_Pos) ] ),
|
read_term( S, T, [singletons(_Vars), term_position(_Pos) ] ),
|
||||||
@ -187,47 +310,32 @@ pl_file(F, _Mod, Suffix) :-
|
|||||||
fail
|
fail
|
||||||
).
|
).
|
||||||
|
|
||||||
|
file_to_module(F, _Suffix, Mod) :-
|
||||||
|
module_on(F:_, Mod), !.
|
||||||
|
file_to_module(F, Suffix, Mod) :-
|
||||||
|
file_base_name(F, Base),
|
||||||
|
atom_concat(Mod0, Suffix, Base),
|
||||||
|
atom_concat('$_',Mod0, Mod).
|
||||||
|
|
||||||
build_graph( M:T, F, _ ) :- !,
|
build_graph( M:T, F, _ ) :- !,
|
||||||
build_graph( T, F, M ).
|
build_graph( T, F, M ).
|
||||||
build_graph( (M:H :- B), F, _ ) :- !,
|
build_graph( (M:H :- B), F, _ ) :- !,
|
||||||
build_graph( (H :- B), F, M ).
|
build_graph( (H :- B), F, M ).
|
||||||
build_graph( (H :- B), F, M ) :- !,
|
build_graph( (H :- B), F, M ) :- !,
|
||||||
functor(H, N, A),
|
functor(H, N, A),
|
||||||
add_node( M:N/A, F),
|
|
||||||
add_deps( B, M, M:N/A, F, 0).
|
add_deps( B, M, M:N/A, F, 0).
|
||||||
build_graph( (H --> B), F, M ) :- !,
|
build_graph( (H --> B), F, M ) :- !,
|
||||||
functor(H, N, A1),
|
functor(H, N, A1),
|
||||||
A is A1+2,
|
A is A1+2,
|
||||||
add_node( M:N/A, F),
|
|
||||||
add_deps( B, M, M:N/A, F, 2).
|
add_deps( B, M, M:N/A, F, 2).
|
||||||
build_graph( (:- dynamic Bs), F, M ) :-
|
build_graph( (:- module( NM, _Is ) ), F, _M ) :- !,
|
||||||
add_nodes( Bs, F, M).
|
nb_setval( current_module, NM ),
|
||||||
build_graph( (:- multifile Bs), F, M ) :-
|
F = FN:_,
|
||||||
add_nodes( Bs, F, M).
|
assert( module_on( FN:_ , NM) ).
|
||||||
build_graph( (:- thread_local Bs), F, M ) :-
|
|
||||||
add_nodes( Bs, F, M).
|
|
||||||
build_graph( (:- _B), _F, _M ) :- !.
|
build_graph( (:- _B), _F, _M ) :- !.
|
||||||
build_graph( (?- _B), _F, _M ) :- !.
|
build_graph( (?- _B), _F, _M ) :- !.
|
||||||
build_graph( H, F, M ) :-
|
build_graph( _H, _F, _M ).
|
||||||
functor(H, N, A),
|
|
||||||
add_node( M:N/A, F).
|
|
||||||
|
|
||||||
add_nodes( (A,B), F, M) :- !,
|
|
||||||
add_nodes( A, F, M),
|
|
||||||
add_nodes( B, F, M).
|
|
||||||
add_nodes( M:A, F, _M) :- !,
|
|
||||||
add_nodes( A, F, M).
|
|
||||||
add_nodes( B, F, M) :- !,
|
|
||||||
add_node( M:B, F).
|
|
||||||
|
|
||||||
|
|
||||||
add_node( N, F, M ) :-
|
|
||||||
always_strip_module(M:N, M, N1 ),
|
|
||||||
functor(N1, Na, Ar),
|
|
||||||
add_node(M:Na/Ar, F).
|
|
||||||
|
|
||||||
add_node( M:N/A, F) :- node( M, N/A, F, _ ), !.
|
|
||||||
add_node( M:N/A, F) :- assert( node( M, N/A, F, prolog ) ).
|
|
||||||
|
|
||||||
add_deps(V, _M, _P, _F, _) :- var(V), !.
|
add_deps(V, _M, _P, _F, _) :- var(V), !.
|
||||||
add_deps((A,B), M, P, F, L) :- !,
|
add_deps((A,B), M, P, F, L) :- !,
|
||||||
@ -244,17 +352,31 @@ add_deps(once(A), M, P, F, L) :- !,
|
|||||||
add_deps({A}, M, P, F, 2) :- !,
|
add_deps({A}, M, P, F, 2) :- !,
|
||||||
add_deps(A, M, P, F, 0).
|
add_deps(A, M, P, F, 0).
|
||||||
add_deps([_|_], _M, _P, _F, 2) :- !.
|
add_deps([_|_], _M, _P, _F, 2) :- !.
|
||||||
add_deps(A, M0, P, F, L) :- !,
|
add_deps([], _M, _P, _F, 2) :- !.
|
||||||
always_strip_module(M0:A, M, A1),
|
add_deps(!, _M, _P, _F, _) :- !.
|
||||||
|
add_deps(true, _M, _P, _F, 0) :- !.
|
||||||
|
add_deps(false, _M, _P, _F, 0) :- !.
|
||||||
|
add_deps(fail, _M, _P, _F, 0) :- !.
|
||||||
|
add_deps(repeat, _M, _P, _F, 0) :- !.
|
||||||
|
add_deps(A, _M0, P, F, L) :- !,
|
||||||
|
always_strip_module(unused_module:A, M1, A1),
|
||||||
functor(A1, N, Ar0),
|
functor(A1, N, Ar0),
|
||||||
Ar1 is Ar0+L,
|
Ar1 is Ar0+L,
|
||||||
|
(M1 == unused_module -> ( node( M, N/Ar1, _, _) -> true ; writeln( undef:M:N/Ar1 ), assert(node(prolog,N/Ar1,'/dev/null':0,prolog)) ) ; M = M1 ),
|
||||||
P = _:Na/Ar,
|
P = _:Na/Ar,
|
||||||
put_deps(M, Na/Ar, N/Ar1, F, L).
|
( put_deps(M, N/Ar1, Na/Ar, F, L)
|
||||||
|
->
|
||||||
|
true
|
||||||
|
;
|
||||||
|
writeln('FAILED'(add_deps(A, _M0, P, F, L)))
|
||||||
|
).
|
||||||
|
|
||||||
put_deps(M, PN, P, F, _L) :-
|
put_deps(_, P, _, _, _L) :-
|
||||||
edge(M, PN, P, F), !.
|
inline( P ), !.
|
||||||
put_deps(M, PN, P, F, _L) :-
|
put_deps(M, P, PN, F, _L) :-
|
||||||
assert(edge(M,PN, P, F) ).
|
edge(M, P, PN, F), !.
|
||||||
|
put_deps(M, P, PN, F, _L) :-
|
||||||
|
assert(edge(M,P, PN, F) ).
|
||||||
|
|
||||||
doubles :-
|
doubles :-
|
||||||
node(M, P, _F, _),
|
node(M, P, _F, _),
|
||||||
@ -265,7 +387,7 @@ doubles :-
|
|||||||
doubles.
|
doubles.
|
||||||
|
|
||||||
undefs :-
|
undefs :-
|
||||||
edge(_M,_,P,F),
|
edge(_M,P,_,F),
|
||||||
\+ node(_, P, _, _),
|
\+ node(_, P, _, _),
|
||||||
format('UNDEFINED procedure call ~q at ~w~n',[P, F]),
|
format('UNDEFINED procedure call ~q at ~w~n',[P, F]),
|
||||||
fail.
|
fail.
|
||||||
@ -276,7 +398,7 @@ pl_exports(M:Dir) :-
|
|||||||
atom_concat([Root,'/',Dir,'/','*.c'], Pattern),
|
atom_concat([Root,'/',Dir,'/','*.c'], Pattern),
|
||||||
expand_file_name( Pattern, Files ),
|
expand_file_name( Pattern, Files ),
|
||||||
member( File, Files ),
|
member( File, Files ),
|
||||||
pl_export( File , M ),
|
pl_export( File , M, '.c' ),
|
||||||
fail.
|
fail.
|
||||||
pl_exports(Dir) :-
|
pl_exports(Dir) :-
|
||||||
atom( Dir ),
|
atom( Dir ),
|
||||||
@ -284,34 +406,38 @@ pl_exports(Dir) :-
|
|||||||
atom_concat([Root,'/',Dir,'/','*.yap'], Pattern),
|
atom_concat([Root,'/',Dir,'/','*.yap'], Pattern),
|
||||||
expand_file_name( Pattern, Files ),
|
expand_file_name( Pattern, Files ),
|
||||||
member( File, Files ),
|
member( File, Files ),
|
||||||
pl_export( File , prolog ),
|
pl_export( File , prolog, '.yap' ),
|
||||||
|
fail.
|
||||||
|
pl_exports(Dir) :-
|
||||||
|
atom( Dir ),
|
||||||
|
Root = '.',
|
||||||
|
atom_concat([Root,'/',Dir,'/','*.pl'], Pattern),
|
||||||
|
expand_file_name( Pattern, Files ),
|
||||||
|
member( File, Files ),
|
||||||
|
pl_export( File , prolog, '.pl' ),
|
||||||
fail.
|
fail.
|
||||||
pl_exports(_).
|
pl_exports(_).
|
||||||
|
|
||||||
pl_export(F, _Mod) :-
|
pl_export(F, _Mod, Suffix) :-
|
||||||
% writeln(F),
|
file_to_module( F, Suffix, Mod),
|
||||||
file_base_name(F, Base),
|
format('****************** compile ~a ******************~n', [F]),
|
||||||
atom_concat(Mod, '.yap', Base),
|
|
||||||
nb_setval( current_module, Mod ),
|
nb_setval( current_module, Mod ),
|
||||||
( setof(P, pub(Mod, P), Es) -> true ; Es = [] ),
|
( module_on( F:_, _) -> Es = [], ( setof(P, mod_priv(Mod, P), Ps) -> true ; Ps = [] )
|
||||||
( setof(P, priv(Mod, P), Ps) -> true ; Ps = [] ),
|
;
|
||||||
format(':- system_module( ~q, ',[Mod]),
|
( setof(P, pub(Mod, P), Es) -> true ; Es = [] ),
|
||||||
out_list(Es),
|
( setof(P, priv(Mod, P), Ps) -> true ; Ps = [] ),
|
||||||
format(', '),
|
format(':- system_module( ~q, ',[Mod]),
|
||||||
out_list(Ps),
|
out_list(Es),
|
||||||
format(').~n~n', []),
|
format(', '),
|
||||||
|
out_list(Ps),
|
||||||
|
format(').~n~n', [])
|
||||||
|
),
|
||||||
fail.
|
fail.
|
||||||
|
pl_export(F, _Mod, Suffix) :-
|
||||||
pl_import(F, _Mod) :-
|
file_to_module( F, Suffix, Mod),
|
||||||
% writeln(F),
|
|
||||||
file_base_name(F, Base),
|
|
||||||
atom_concat(Mod, '.yap', Base),
|
|
||||||
nb_setval( current_module, Mod ),
|
nb_setval( current_module, Mod ),
|
||||||
( setof(P, pub(Mod, P), Es) -> true ; Es = [] ),
|
setof( P, has_edge(M, P, Mod, F), Ps),
|
||||||
( setof(P, priv(Mod, P), Ps) -> true ; Ps = [] ),
|
format(':- use_system_module( ~q, ',[M]),
|
||||||
format(':- system_module( ~q, ',[Mod]),
|
|
||||||
out_list(Es),
|
|
||||||
format(', '),
|
|
||||||
out_list(Ps),
|
out_list(Ps),
|
||||||
format(').~n~n', []),
|
format(').~n~n', []),
|
||||||
fail.
|
fail.
|
||||||
@ -333,12 +459,24 @@ pub(M, P) :-
|
|||||||
P = N/_A,
|
P = N/_A,
|
||||||
\+ sub_atom(N,0,1,_,'$').
|
\+ sub_atom(N,0,1,_,'$').
|
||||||
|
|
||||||
priv(M, P) :-
|
has_edge(M1, P1, M, F) :-
|
||||||
|
edge(M1, P1, _P, F:_),
|
||||||
|
node(M1, P1, _, _),
|
||||||
|
M1 \= prolog,
|
||||||
|
M1 \= M,
|
||||||
|
\+ public_predicate(P1, M1, _).
|
||||||
|
|
||||||
|
mod_priv(M, P) :-
|
||||||
node(M, P, _, _),
|
node(M, P, _, _),
|
||||||
P = N/_A,
|
node(M, P, _, _),
|
||||||
sub_atom(N,0,1,_,'$'),
|
\+ public_predicate(P, M, _),
|
||||||
edge(M1, P, _P0, _), M1 \= M.
|
edge(M1, P, _P0, _), M1 \= M.
|
||||||
|
|
||||||
|
priv(M, P) :-
|
||||||
|
node(M, P, F:_, _),
|
||||||
|
\+ public_predicate(P, M, _),
|
||||||
|
edge(_, P, _P1, F1:_), F1 \= F.
|
||||||
|
|
||||||
% utilities
|
% utilities
|
||||||
|
|
||||||
split_string( S , Cs, N) :-
|
split_string( S , Cs, N) :-
|
||||||
@ -348,7 +486,7 @@ split_string( S , Cs, N) :-
|
|||||||
maplist(remove_escapes, Ncs0, Ncs),
|
maplist(remove_escapes, Ncs0, Ncs),
|
||||||
maplist(string_codes, N, Ncs).
|
maplist(string_codes, N, Ncs).
|
||||||
|
|
||||||
remove_escapes([0'\\ ,A|Cs], [A|NCs]) :- !,
|
remove_escapes([0'\\ ,A|Cs], [A|NCs]) :- !, %'
|
||||||
remove_escapes(Cs, NCs).
|
remove_escapes(Cs, NCs).
|
||||||
remove_escapes([A|Cs], [A|NCs]) :-
|
remove_escapes([A|Cs], [A|NCs]) :-
|
||||||
remove_escapes(Cs, NCs).
|
remove_escapes(Cs, NCs).
|
||||||
|
34
os/pl-text.c
34
os/pl-text.c
@ -784,6 +784,40 @@ PL_mb_text(PL_chars_t *text, int flags)
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case ENC_UTF8:
|
||||||
|
{ const char *s = (const char*)text->text.t;
|
||||||
|
const char *e = &s[text->length];
|
||||||
|
|
||||||
|
if ( target == ENC_ISO_LATIN_1 )
|
||||||
|
{ for( ; s<e; )
|
||||||
|
{ int ch;
|
||||||
|
s = _PL__utf8_get_char(s, &ch);
|
||||||
|
if (ch > 0xff) {
|
||||||
|
unfindBuffer(BUF_RING);
|
||||||
|
norep = *s;
|
||||||
|
goto rep_error;
|
||||||
|
}
|
||||||
|
addBuffer(b, ch, char);
|
||||||
|
}
|
||||||
|
addBuffer(b, 0, char);
|
||||||
|
|
||||||
|
} else
|
||||||
|
{ mbstate_t mbs;
|
||||||
|
|
||||||
|
memset(&mbs, 0, sizeof(mbs));
|
||||||
|
for( ; s<e; )
|
||||||
|
{ int ch;
|
||||||
|
s = _PL__utf8_get_char(s, &ch);
|
||||||
|
if ( !wctobuffer(ch, &mbs, b) )
|
||||||
|
{ unfindBuffer(BUF_RING);
|
||||||
|
norep = ch;
|
||||||
|
goto rep_error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wctobuffer(0, &mbs, b);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case ENC_WCHAR:
|
case ENC_WCHAR:
|
||||||
{ if ( target == ENC_ISO_LATIN_1 )
|
{ if ( target == ENC_ISO_LATIN_1 )
|
||||||
{ return PL_demote_text(text);
|
{ return PL_demote_text(text);
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit d5c70de04a6fce6be71a9086d0164dd0b0c9d9d4
|
Subproject commit 0f77a1e1b90b36bddb1844712380f4f3858123b7
|
@ -524,7 +524,7 @@ void lbfgs_free(lbfgsfloatval_t *x);
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@mainpage libLBFGS: a library of Limited-memory Broyden-Fletcher-Goldfarb-Shanno (L-BFGS)
|
@chapter libLBFGS: a library of Limited-memory Broyden-Fletcher-Goldfarb-Shanno (L-BFGS)
|
||||||
|
|
||||||
@section intro Introduction
|
@section intro Introduction
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit abd65ae6486993e04dfa883163efdad3bab789ab
|
Subproject commit a8a43aa09892c4b7018dc053d8e7653e2f648107
|
Reference in New Issue
Block a user