Codebase list swi-prolog / 433d3de
Imported Upstream version 7.2.3 Lev Lamberov 8 years ago
580 changed file(s) with 20394 addition(s) and 17359 deletion(s). Raw diff Collapse all Expand all
9999 GMP_VERSION=5.0.5
100100 PTHREADS_VERSION=2-9-1-release
101101 LIBDWARF_VERSION=20120410
102 SSL_VERSION=1.0.2
102 SSL_VERSION=1.0.2-latest
103103 JPEG_VERSION=8d
104104 ZLIB_VERSION=1.2.7
105105 ARCHIVE_VERSION=3.1.2
341341 { if [ -d libXpm ]; then
342342 (cd libXpm && git pull)
343343 else
344 git clone git://www.swi-prolog.org/home/pl/git/misc/libXpm.git
344 git clone https://github.com/SWI-Prolog/libXpm.git
345345 fi
346346 }
347347
0 7.2.0
0 7.2.3
181181 % fail. If the solver is too weak however it will succeed and
182182 % residual attributed variables holding the conflicting constraint
183183 % form a witness of this problem.
184 %
185 % @bug In the current implementation attributed variables may
186 % be garbage collected and will not appear in Vars.
187184
188185 :- meta_predicate
189186 call_residue_vars(0, -).
190187
191188 call_residue_vars(Goal, Vars) :-
192 '$get_choice_point'(Chp),
193 call_det(Goal, Det),
194 '$attvars_after_choicepoint'(Chp, Vars),
189 prolog_current_choice(Chp),
190 setup_call_cleanup(
191 '$call_residue_vars_start',
192 run_crv(Goal, Chp, Vars, Det),
193 '$call_residue_vars_end'),
195194 ( Det == true
196195 -> !
197196 ; true
198197 ).
199 call_residue_vars(_,_) :-
198 call_residue_vars(_, _) :-
200199 fail.
201200
202 call_det(Goal, Det) :-
203 Goal,
204 deterministic(Det).
201 run_crv(Goal, Chp, Vars, Det) :-
202 call(Goal),
203 deterministic(Det),
204 '$attvars_after_choicepoint'(Chp, Vars).
205205
206206 %% copy_term(+Term, -Copy, -Gs) is det.
207207 %
779779
780780 %% expand_functions(+G0, +P0, -G, -P, +M, +MList, +Term) is det.
781781 %
782 % Expand functional notation and arithmetic functions.
783 %
784 % @arg MList is the list of modules defining goal_expansion/2 in
785 % the expansion context.
786
787 expand_functions(G0, P0, G, P, M, MList, Term) :-
788 expand_functional_notation(G0, P0, G1, P1, M, MList, Term),
789 ( expand_arithmetic(G1, P1, G, P, Term)
790 -> true
791 ; G = G1,
792 P = P1
793 ).
794
795 %% expand_functional_notation(+G0, +P0, -G, -P, +M, +MList, +Term) is det.
796 %
782797 % @tbd: position logic
783798 % @tbd: make functions module-local
784799
785 expand_functions(G0, P0, G, P, M, _MList, _Term) :-
800 expand_functional_notation(G0, P0, G, P, M, _MList, _Term) :-
786801 contains_functions(G0),
787802 replace_functions(G0, P0, Eval, EvalPos, G1, G1Pos, M),
788803 Eval \== true, !,
789804 wrap_var(G1, G1Pos, G2, G2Pos),
790805 conj(Eval, EvalPos, G2, G2Pos, G, P).
791 expand_functions(G, P, G, P, _, _, _).
806 expand_functional_notation(G, P, G, P, _, _, _).
792807
793808 wrap_var(G, P, G, P) :-
794809 nonvar(G), !.
880895 % term.
881896
882897 function(.(_,_), _) :- \+ functor([_|_], ., _).
898
899
900 /*******************************
901 * ARITHMETIC *
902 *******************************/
903
904 %% expand_arithmetic(+G0, +P0, -G, -P, +Term) is semidet.
905 %
906 % Expand arithmetic expressions in is/2, (>)/2, etc. This is
907 % currently a dummy. The idea is to call rules similar to
908 % goal_expansion/2,4 that allow for rewriting an arithmetic
909 % expression. The system rules will perform evaluation of constant
910 % expressions.
911
912 expand_arithmetic(_G0, _P0, _G, _P, _Term) :- fail.
883913
884914
885915 /*******************************
595595 -> atomic_list_concat(Dirs, (;), Path)
596596 ; atomic_list_concat(Dirs, :, Path)
597597 ),
598 '$member'(Dir, Dirs).
598 '$member'(Dir, Dirs),
599 '$no-null-bytes'(Dir).
600
601 '$no-null-bytes'(Dir) :-
602 sub_atom(Dir, _, _, _, '\u0000'), !,
603 print_message(warning, null_byte_in_path(Dir)),
604 fail.
605 '$no-null-bytes'(_).
599606
600607 %% expand_file_search_path(+Spec, -Expanded) is nondet.
601608 %
856863 '$extend_file'(Expanded, Exts, LibFile),
857864 ( '$file_conditions'(Cond, LibFile),
858865 '$absolute_file_name'(LibFile, FullFile),
859 \+ '$search_path_file_cache'(Spec, Hash, Cache, FullFile),
860 assert('$search_path_file_cache'(Spec, Hash, Cache, FullFile))
866 ( '$search_path_file_cache'(Spec, Hash, Cache, FullFile)
867 -> true
868 ; asserta('$search_path_file_cache'(Spec, Hash, Cache, FullFile))
869 )
861870 -> '$search_message'(file_search(found(Spec, Cond), FullFile))
862871 ; '$search_message'(file_search(tried(Spec, Cond), LibFile)),
863872 fail
11081117 '$instantiation_error'(Input).
11091118 '$source_term'(stream(Id, In, Opts),
11101119 Read, RLayout, Term, TLayout, Stream, Parents, Options) :- !,
1120 '$record_included'(Parents, Id, Id, 0.0, Message),
11111121 setup_call_cleanup(
11121122 '$open_source'(stream(Id, In, Opts), In, State, Parents, Options),
11131123 '$term_in_file'(In, Read, RLayout, Term, TLayout, Stream,
11141124 [Id|Parents], Options),
1115 '$close_source'(State, true)).
1125 '$close_source'(State, Message)).
11161126 '$source_term'(File,
11171127 Read, RLayout, Term, TLayout, Stream, Parents, Options) :-
11181128 absolute_file_name(File, Path,
11191129 [ file_type(prolog),
11201130 access(read)
11211131 ]),
1122 '$record_included'(Parents, File, Path, Message),
1132 time_file(Path, Time),
1133 '$record_included'(Parents, File, Path, Time, Message),
11231134 setup_call_cleanup(
11241135 '$open_source'(Path, In, State, Parents, Options),
11251136 '$term_in_file'(In, Read, RLayout, Term, TLayout, Stream,
11321143 '$load_input'/2.
11331144
11341145 '$open_source'(stream(Id, In, Opts), In,
1135 restore(In, StreamState, Ref, Opts), Parents, Options) :- !,
1146 restore(In, StreamState, Id, Ref, Opts), Parents, Options) :- !,
11361147 '$context_type'(Parents, ContextType),
11371148 '$push_input_context'(ContextType),
11381149 '$set_encoding'(In, Options),
11391150 '$prepare_load_stream'(In, Id, StreamState),
11401151 asserta('$load_input'(stream(Id), In), Ref).
1141 '$open_source'(Path, In, close(In, Ref), Parents, Options) :-
1152 '$open_source'(Path, In, close(In, Path, Ref), Parents, Options) :-
11421153 '$context_type'(Parents, ContextType),
11431154 '$push_input_context'(ContextType),
11441155 open(Path, read, In),
11481159 '$context_type'([], load_file) :- !.
11491160 '$context_type'(_, include).
11501161
1151 '$close_source'(close(In, Ref), Message) :-
1162 '$close_source'(close(In, Id, Ref), Message) :-
11521163 erase(Ref),
1164 '$end_consult'(Id),
11531165 call_cleanup(
11541166 close(In),
11551167 '$pop_input_context'),
11561168 '$close_message'(Message).
1157 '$close_source'(restore(In, StreamState, Ref, Opts), Message) :-
1169 '$close_source'(restore(In, StreamState, Id, Ref, Opts), Message) :-
11581170 erase(Ref),
1171 '$end_consult'(Id),
11591172 call_cleanup(
11601173 '$restore_load_stream'(In, StreamState, Opts),
11611174 '$pop_input_context'),
12791292 :- dynamic
12801293 '$included'/4.
12811294
1282 %% '$record_included'(+Parents, +File, +Path) is det.
1295 %% '$record_included'(+Parents, +File, +Path, +Time, -Message) is det.
12831296 %
12841297 % Record that we included File into the head of Parents. This is
12851298 % troublesome when creating a QLF file because this may happen
12911304 % statement for this, that may appear both inside and outside QLF
12921305 % `parts'.
12931306
1294 '$record_included'([Parent|Parents], File, Path,
1307 '$record_included'([Parent|Parents], File, Path, Time,
12951308 message(DoneMsgLevel,
12961309 include_file(done(Level, file(File, Path))))) :-
1297 source_location(_, Line), !,
1310 source_location(SrcFile, Line), !,
12981311 '$compilation_level'(Level),
12991312 '$load_msg_level'(include_file, Level, StartMsgLevel, DoneMsgLevel),
13001313 '$print_message'(StartMsgLevel,
13011314 include_file(start(Level,
13021315 file(File, Path)))),
1303 time_file(Path, Time),
13041316 '$last'([Parent|Parents], Owner),
13051317 ( ( '$compilation_mode'(database)
13061318 ; '$qlf_current_source'(Owner)
13071319 )
1308 -> '$compile_aux_clauses'(
1320 -> '$store_admin_clause'(
13091321 system:'$included'(Parent, Line, Path, Time),
1310 Owner)
1322 _, Owner, SrcFile:Line)
13111323 ; '$qlf_include'(Owner, Parent, Line, Path, Time)
13121324 ).
1313 '$record_included'(_, _, _, true).
1325 '$record_included'(_, _, _, _, true).
13141326
13151327 %% '$master_file'(+File, -MasterFile)
13161328 %
12241224 prolog_message(pack(no_arch(Entry, Arch))) -->
12251225 [ 'Package ~w: no binary for architecture ~w'-[Entry, Arch] ].
12261226
1227 /*******************************
1228 * MISC *
1229 *******************************/
1230
1231 prolog_message(null_byte_in_path(Component)) -->
1232 [ '0-byte in PATH component: ~p (skipped directory)'-[Component] ].
1233
12271234
12281235 /*******************************
12291236 * PRINTING MESSAGES *
12841291 ],
12851292 AllLines),
12861293 msg_property(Kind, stream(Stream)),
1294 ignore(stream_property(Stream, position(Pos))),
12871295 print_message_lines(Stream, AllLines),
1288 ( msg_property(Kind, wait(Wait)),
1296 ( \+ stream_property(Stream, position(Pos)),
1297 msg_property(Kind, wait(Wait)),
12891298 Wait > 0
12901299 -> sleep(Wait)
12911300 ; true
14541463 % True for messages that must be printed only once.
14551464
14561465 print_once(compatibility(_), _).
1466 print_once(null_byte_in_path(_), _).
14571467
14581468 %% must_print(+Level, +Message)
14591469 %
7878 if [ "`uname`" = Darwin ]; then
7979 export LIBRARY_PATH=/usr/lib:/opt/local/lib
8080 export CPATH=/usr/include:/opt/local/include:/opt/X11/include
81 export PKG_CONFIG_PATH=/usr/X11R6/lib/pkgconfig:/opt/local/lib/pkgconfig
81 export PKG_CONFIG_PATH=/usr/X11R6/lib/pkgconfig:/opt/local/lib/pkgconfig:/opt/X11/lib/pkgconfig
8282 if [ -f "$JAVA_HOME/bin/java" ]; then
8383 export JAVAPREFIX="$JAVA_HOME/bin"
8484 elif [ -f /Library/Java/Home/bin/java ]; then
55
66 SWI-Prolog 7.2
77 Reference Manual
8 _U_p_d_a_t_e_d _f_o_r _v_e_r_s_i_o_n _7_._2_._0_, _M_a_y _2_0_1_5
8 _U_p_d_a_t_e_d _f_o_r _v_e_r_s_i_o_n _7_._2_._3_, _A_u_g_u_s_t _2_0_1_5
99
1010 _J_a_n _W_i_e_l_e_m_a_k_e_r
1111 J.Wielemaker@vu.nl
9898 The infrastructure for constraint programming is based on hProlog
9999 [Demoen, 2002]. Some libraries are copied from the YAP system.
100100 Together with YAP we developed a portability framework (see
101 section 14). This framework has been filled for SICStus Prolog, YAP
102 and IF/Prolog.
101 section 14). This framework has been filled for SICStus Prolog, YAP,
102 IF/Prolog and Ciao. SWI-Prolog version 7 introduces various extensions
103 to the Prolog language (see section 5). The _s_t_r_i_n_g data type and its
104 supporting set of built-in predicates is compatibility with ECLiPSe.
103105
104106
105107 11..22 SSttaattuuss aanndd rreelleeaasseess
23332335 Escapes the backslash itself. Thus, '\\' is an atom consisting of
23342336 a single \.
23352337
2336 \quote
2337 If the current quote (" or ') is preceded by a backslash, it is
2338 copied verbatim. Thus, '\'' and '''' both describe the atom with a
2339 single '.
2338 \'
2339 Single quote. Note that '\'' and '''' both describe the atom with
2340 a single ', i.e., '\'' == '''' is true.
2341
2342 \"
2343 Double quote.
2344
2345 \`
2346 Back quote.
23402347
23412348 Character escaping is only available if
23422349 current_prolog_flag(character_escapes, true) is active (default). See
37693776 There is no complete agreement on mode indicators in the Prolog
37703777 community. We use the following definitions:
37713778
3772 ________________________________________________________+Argument must be fully instantiated to a term that
3773
3774 satisfies the required argument type. Think of
3775 the argument as _i_n_p_u_t.
3776 - Argument must be unbound. Think of the argument
3777 as _o_u_t_p_u_t.
3778
3779 ? Argument must be bound to a _p_a_r_t_i_a_l _t_e_r_m
3780 of the indicated type. Note that a
3781 variable is a partial term for any type.
3782 Think of the argument as either _i_n_p_u_t or
3783 _o_u_t_p_u_t or _b_o_t_h input and output. For
3784 example, in stream_property(S, reposition(Bool)),
3785 the reposition part of the term is input and the
3786 uninstantiated _B_o_o_l is output.
3787
3788 : Argument is a meta-argument. Implies +. See
3789 chapter 6 for more information on module handling.
3790 @ Argument is not further instantiated. Typically
3791 used for type tests.
3792 ! Argument contains a mutable structure that may be
3793 ____modified_using_setarg/3_or_nb_setarg/3._____________
3779 _________________________________________________________++Argument must be ground, i.e., the argument may
3780
3781 not contain a variable anywhere.
3782 + Argument must be fully instantiated to a term
3783 that satisfies the type. This is not necessarily
3784 _g_r_o_u_n_d, e.g., the term [_] is a _l_i_s_t, although its
3785
3786 only member is unbound.
3787 - Argument is an _o_u_t_p_u_t argument. Unless
3788 specified otherwise, output arguments need not
3789 to be unbound. For example, the goal
3790 findall(X, Goal, [T]) is good style and equivalent
3791 to findall(X, Goal, Xs), Xs = [T] Note that the
3792 _d_e_t_e_r_m_i_n_i_s_m specification, e.g., ``det'' only
3793 applies if this argument is unbound.
3794
3795 -- Argument must be unbound. Typically used by
3796 predicates that create `something' and return a
3797 handle to the created object, such as open/3 which
3798 creates a _s_t_r_e_a_m.
3799 ? Argument must be bound to a _p_a_r_t_i_a_l _t_e_r_m
3800 of the indicated type. Note that a
3801 variable is a partial term for any type.
3802
3803 Think of the argument as either _i_n_p_u_t or
3804 _o_u_t_p_u_t or _b_o_t_h input and output. For
3805 example, in stream_property(S, reposition(Bool)),
3806 the reposition part of the term is input and the
3807 uninstantiated _B_o_o_l is output.
3808 : Argument is a meta-argument. Implies +. See
3809 chapter 6 for more information on module handling.
3810 @ Argument is not further instantiated. Typically
3811
3812 used for type tests.
3813 ! Argument contains a mutable structure that may be
3814 _____modified_using_setarg/3_or_nb_setarg/3._____________
37943815
37953816 Referring to a predicate in running text is done using a _p_r_e_d_i_c_a_t_e
37963817 _i_n_d_i_c_a_t_o_r. The canonical and most generic form of a predicate
71097130 (see blob/2 and section 10.4.7).
71107131
71117132
7112 ooppeenn((_+_S_r_c_D_e_s_t_, _+_M_o_d_e_, _-_S_t_r_e_a_m_, _+_O_p_t_i_o_n_s)) _[_I_S_O_]
7133 ooppeenn((_+_S_r_c_D_e_s_t_, _+_M_o_d_e_, _-_-_S_t_r_e_a_m_, _+_O_p_t_i_o_n_s)) _[_I_S_O_]
71137134 True when _S_r_c_D_e_s_t can be opened in _M_o_d_e and _S_t_r_e_a_m is an I/O
71147135 stream to/from the object. _S_r_c_D_e_s_t is normally the name of a
71157136 file, represented as an atom or string. _M_o_d_e is one of read,
72477268 connected to a file may be repositioned.
72487269
72497270
7250 ooppeenn((_+_S_r_c_D_e_s_t_, _+_M_o_d_e_, _?_S_t_r_e_a_m)) _[_I_S_O_]
7271 ooppeenn((_+_S_r_c_D_e_s_t_, _+_M_o_d_e_, _-_-_S_t_r_e_a_m)) _[_I_S_O_]
72517272 Equivalent to open/4 with an empty option list.
72527273
72537274
7254 ooppeenn__nnuullll__ssttrreeaamm((_?_S_t_r_e_a_m))
7275 ooppeenn__nnuullll__ssttrreeaamm((_-_-_S_t_r_e_a_m))
72557276 Open an output stream that produces no output. All counting
72567277 functions are enabled on such a stream. It can be used to discard
72577278 output (like Unix /dev/null) or exploit the counting properties.
85108531
85118532 qquuaassii__qquuoottaattiioonnss((_-_L_i_s_t))
85128533 If present, unify _L_i_s_t with the quasi quotations (see sec-
8513 tion 12.26 instead of evaluating quasi quotations. Each
8514 quasi quotation is a term quasi_quotation(_+_S_y_n_t_a_x_, _+_Q_u_o_t_a_t_i_o_n_,
8515 _+_V_a_r_D_i_c_t_, _-_R_e_s_u_l_t), where _S_y_n_t_a_x is the term in {|Syntax||,
8534 tion 12.26 instead of evaluating quasi quotations. Each quasi
8535 quotation is a term quasi_quotation(_+_S_y_n_t_a_x_, _+_Q_u_o_t_a_t_i_o_n_, _+_V_a_r_-
8536 _D_i_c_t_, _-_R_e_s_u_l_t), where _S_y_n_t_a_x is the term in {|Syntax||..|},
85168537 _Q_u_o_t_a_t_i_o_n is a list of character codes that represent the
85178538 quotation, _V_a_r_D_i_c_t is a list of _N_a_m_e=_V_a_r_i_a_b_l_e and _R_e_s_u_l_t is a
85188539 variable that shares with the place where the quotation must
87228743 answers.
87238744
87248745 ____________________________________________________________________| |
8725 | ?- Term = foo(X,Y,Z), |
8746 | ?- Term = f(X,Y,X), |
87268747 | numbervars(Term, 0, End), |
87278748 | write_canonical(Term), nl. |
87288749
8729 | foo('$VAR'(0),'$VAR'(1),'$VAR'(0)) |
8730 | Term = foo(A, B, A), |
8750 | f('$VAR'(0),'$VAR'(1),'$VAR'(0)) |
8751 | Term = f(A, B, A), |
87318752 | X = A, |
87328753 | Y = B, |
87338754 ||End_=_2.__________________________________________________________ ||
87368757
87378758
87388759 nnuummbbeerrvvaarrss((_+_T_e_r_m_, _+_S_t_a_r_t_, _-_E_n_d_, _+_O_p_t_i_o_n_s))
8739 As numbervars/3, but providing the following options:
8760 As numbervars/3, providing the following options:
87408761
87418762 ffuunnccttoorr__nnaammee((_+_A_t_o_m))
87428763 Name of the functor to use instead of $VAR.
95109531 must be instantiated to integers.
95119532
95129533
9534 ddiivvmmoodd((_+_D_i_v_i_d_e_n_d_, _+_D_i_v_i_s_o_r_, _-_Q_u_o_t_i_e_n_t_, _-_R_e_m_a_i_n_d_e_r))
9535 This predicate is a shorthand for computing both the _Q_u_o_t_i_e_n_t and
9536 _R_e_m_a_i_n_d_e_r of two integers in a single operation. This allows for
9537 exploiting the fact that the low level implementation for computing
9538 the quotient also produces the remainder. Timing confirms that
9539 this predicate is almost twice as fast as performing the steps
9540 independently. Semantically, divmod/4 is defined as below.
9541
9542 ____________________________________________________________________| |
9543 | divmod(Dividend, Divisor, Quotient, Remainder) :- |
9544
9545 | Quotient is Dividend div Divisor, |
9546 ||________Remainder_is_Dividend_mod_Divisor.________________________ ||
9547
9548 Note that this predicate is only available if SWI-Prolog is
9549 compiled with unbounded integer support. This is the case for all
9550 packaged versions.
9551
9552
9553 nntthh__iinntteeggeerr__rroooott__aanndd__rreemmaaiinnddeerr((_+_N_, _+_I_, _-_R_o_o_t_, _-_R_e_m_a_i_n_d_e_r))
9554 True when Root to the power N+ Remainder= I. _N and _I must be
9555 integers. _N must be one or more. If _I is negative and _N is _o_d_d,
9556 _R_o_o_t and _R_e_m_a_i_n_d_e_r are negative, i.e., the following holds for
9557 _I <0:
9558
9559 ____________________________________________________________________| |
9560 | % I < 0, |
9561 | % N mod 2 =\= 0, |
9562 | nth_integer_root_and_remainder( |
9563
9564 | N, I, Root, Remainder), |
9565 | IPos is -I, |
9566 | nth_integer_root_and_remainder( |
9567 | N, IPos, RootPos, RemainderPos), |
9568 | Root =:= -RootPos, |
9569 ||____Remainder_=:=_-RemainderPos.__________________________________ ||
9570
9571
95139572 44..2266..22 GGeenneerraall ppuurrppoossee aarriitthhmmeettiicc
95149573
95159574 The general arithmetic predicates are optionally compiled (see
98139872
98149873
98159874 rroouunndd((_+_E_x_p_r)) _[_I_S_O_]
9816 Evaluate _E_x_p_r and round the result to the nearest integer.
9875 Evaluate _E_x_p_r and round the result to the nearest integer.
9876 According to ISO, round/1 is defined as floor(_E_x_p_r_+_1_/_2), i.e.,
9877 rounding _d_o_w_n. This is an unconventional choice and under
9878 which the relation round(Expr) == -round(-Expr) does not hold.
9879 SWI-Prolog rounds _o_u_t_w_a_r_d, e.g., round(1.5) =:= 2 and round
9880 round(-1.5) =:= -2.
98179881
98189882
98199883 iinntteeggeerr((_+_E_x_p_r))
1009210156
1009310157 BBiittvveeccttoorr ffuunnccttiioonnss
1009410158
10095 The functions below are not covered by the standard. The msb/1
10096 function is compatible with hProlog. The others are private extensions
10097 that improve handling of ---unbounded--- integers as bit-vectors.
10159 The functions below are not covered by the standard. The
10160 msb/1 function also appears in hProlog and SICStus Prolog. The
10161 getbit/2 function also appears in ECLiPSe, which also provides
10162 setbit(_V_e_c_t_o_r_,_I_n_d_e_x) and clrbit(_V_e_c_t_o_r_,_I_n_d_e_x). The others are
10163 SWI-Prolog extensions that improve handling of ---unbounded--- integers
10164 as bit-vectors.
1009810165
1009910166
1010010167 mmssbb((_+_I_n_t_E_x_p_r))
1011410181 ppooppccoouunntt((_+_I_n_t_E_x_p_r))
1011510182 Return the number of 1s in the binary representation of the
1011610183 non-negative integer _I_n_t_E_x_p_r.
10184
10185
10186 ggeettbbiitt((_+_I_n_t_E_x_p_r_V_, _+_I_n_t_E_x_p_r_I))
10187 Evaluates to the bit value (0 or 1) of the _I_n_t_E_x_p_r_I-th bit of
10188 _I_n_t_E_x_p_r_V. Both arguments must evaluate to non-negative integers.
10189 The result is equivalent to (IntExprV >> IntExprI)/\1, but more
10190 efficient because materialization of the shifted value is avoided.
10191 Future versions will optimise (IntExprV >> IntExprI)/\1 to a call
10192 to getbit/2, providing both portability and performance.
1011710193
1011810194
1011910195 44..2277 MMiisscc aarriitthhmmeettiicc ssuuppppoorrtt pprreeddiiccaatteess
1152311599 Extracts the directory part of _F_i_l_e. The returned _D_i_r_e_c_t_o_r_y name
1152411600 does not end in /. There are two special cases. The directory
1152511601 name of / is / itself, and the directory name is . if _F_i_l_e does
11526 not contain any / characters. See also directory_file_path/3 from
11527 filesex. The system ensures that for every valid _P_a_t_h using
11528 the Prolog (POSIX) directory separators, following is true on
11529 systems with a sound implementation of same_file/2. See also
11530 prolog_to_os_filename/2.
11602 not contain any / characters. If the _F_i_l_e argument ends with a /,
11603 e.g., '/hello/', it is not a valid file name. In this case the
11604 final / is removed from _F_i_l_e, e.g., '/hello'.
11605
11606 See also directory_file_path/3 from filesex. The system
11607 ensures that for every valid _P_a_t_h using the Prolog (POSIX)
11608 directory separators, following is true on systems with a sound
11609 implementation of same_file/2. See also prolog_to_os_filename/2.
1153111610
1153211611 ____________________________________________________________________| |
1153311612 | ..., |
1154111620 ffiillee__bbaassee__nnaammee((_+_F_i_l_e_, _-_B_a_s_e_N_a_m_e))
1154211621 Extracts the filename part from a path specification. If _F_i_l_e does
1154311622 not contain any directory separators, _F_i_l_e is returned in _B_a_s_e_N_a_m_e.
11544 See also file_directory_name/2.
11623 See also file_directory_name/2. If the _F_i_l_e arguments ends with a
11624 /, e.g., '/hello/', _B_a_s_e_N_a_m_e is unified with the empty atom ('').
1154511625
1154611626
1154711627 ssaammee__ffiillee((_+_F_i_l_e_1_, _+_F_i_l_e_2))
1273212812
1273312813 Another place that is affected is write_canonical/1. Impact is
1273412814 minimized by using the list syntax for lists. The predicates
12735 read_term/2 and write_term/2 support the option dot_lists(_t_r_u_e), which
12815 read_term/2 and write_term/2 support the option dotlists(_t_r_u_e), which
1273612816 causes read_term/2 to read .(a,[]) as [a] and write_term/2to write [a]
1273712817 as .(a,[]).
1273812818
1388213962 Dicts are currently represented as a compound term using the functor
1388313963 `dict`. The first argument is the tag. The remaining arguments create
1388413964 an array of sorted key-value pairs. This representation is compact and
13885 guarantees good locality. Lookup is order log(N), while adding valuesm
13965 guarantees good locality. Lookup is order log(N), while adding values,
1388613966 deleting values and merging with other dicts has order N. The main
1388713967 disadvantage is that changing values in large dicts is costly, both in
1388813968 terms of memory and time.
1519615276 of the computation. The meta predicate call_residue_vars/2 finds
1519715277 variables that are given attribute variables or whose attributes
1519815278 are modified by _G_o_a_l, regardless of whether or not these variables
15199 are reachable from the arguments of _G_o_a_l.
15200
15201 The predicate has considerable implications. During the execution
15202 of _G_o_a_l, the garbage collector does not reclaim attributed
15203 variables. This causes some degradation of GC performance. In
15204 a well-behaved program there are no such variables, so the space
15205 impact is generally minimal. The actual collection of _V_a_r_s is
15206 implemented using a scan of the trail and global stacks.
15279 are reachable from the arguments of _G_o_a_l..
1520715280
1520815281
1520915282 77..33 GGlloobbaall vvaarriiaabblleess
1787217945
1787317946 _v_o_i_d _* PPLL__ffoorreeiiggnn__ccoonntteexxtt__aaddddrreessss((_c_o_n_t_r_o_l___t))
1787417947 Extracts an address as passed in by PL_retry_address().
17948
17949
17950 _p_r_e_d_i_c_a_t_e___t PPLL__ffoorreeiiggnn__ccoonntteexxtt__pprreeddiiccaattee((_c_o_n_t_r_o_l___t))
17951 Fetch the Prolog predicate that is executing this function. Note
17952 that if the predicate is imported, the returned predicate refers to
17953 the final definition rather than the imported predicate, i.e., the
17954 module reported by PL_predicate_info() is the module in which the
17955 predicate is defined rather than the module where it was called.
17956 See also PL_predicate_info().
1787517957
1787617958 Note: If a non-deterministic foreign function returns using
1787717959 PL_succeed() or PL_fail(), Prolog assumes the foreign function has
2262822710 the current constraints. Fails otherwise.
2262922711
2263022712
22631 llaabbeelliinngg((_+_V_s)) _[_n_o_n_d_e_t_]
22713 llaabbeelliinngg((_+_V_s)) _[_m_u_l_t_i_]
2263222714 Assigns truth values to the Boolean variables _V_s such that all
2263322715 stated constraints are satisfied.
2263422716
2266922751 constraints, CLP(FD) is often used to model and solve combinatorial
2267022752 problems such as planning, scheduling and allocation tasks.
2267122753
22672 When teaching Prolog, we _s_t_r_o_n_g_l_y recommend that you introduce CLP(FD)
22754 When teaching Prolog, we _s_t_r_o_n_g_l_y _r_e_c_o_m_m_e_n_d that you introduce CLP(FD)
2267322755 constraints _b_e_f_o_r_e explaining lower-level arithmetic predicates and
2267422756 their procedural idiosyncrasies. This is because constraints are easy
2267522757 to explain, understand and use due to their purely relational nature.
2269022772 rewritten at compilation time so that lower-level fallback predicates
2269122773 are automatically used whenever possible.
2269222774
22693 You can cite this library in your publications as:
22775 We recommend the following reference to cite this library in scientific
22776 publications:
2269422777
2269522778 ________________________________________________________________________| |
2269622779
2270422787 | year = {2012}, |
2270522788 | pages = {307-316} |
2270622789 |}|_____________________________________________________________________ | |
22790
22791 and the following URL to link to its documentation:
22792
22793 ________________________________________________________________________| |
22794 |http://www.swi-prolog.org/man/clpfd.html|______________________________ | |
2270722795
2270822796
2270922797 1122..88..00..66 AArriitthhmmeettiicc ccoonnssttrraaiinnttss
2273422822
2273522823 ___________________________________________________________
2273622824 | Expr1 #>= Expr2 |Expr1 is greater than or equal to Expr2 |
22737 | Expr1 #=< Expr2 |Expr1 is less than or equal to Expr2 |
22738 | Expr1 #= Expr2 |Expr1 equals Expr2 |
22739 | Expr1 #\= Expr2 |Expr1 is not equal to Expr2 |
22740 | Expr1 #> Expr2 |Expr1 is greater than Expr2 |
22741 |_Expr1_#<__Expr2__|Expr1_is_less_than_Expr2_______________ |
22825 | Expr1 #=< Expr2 |Expr1 is less than or equal to Expr2 |
22826 | Expr1 #= Expr2 |Expr1 equals Expr2 |
22827 | Expr1 #\= Expr2 |Expr1 is not equal to Expr2 |
22828 | Expr1 #> Expr2 |Expr1 is greater than Expr2 |
22829 |_Expr1_#<_Expr2__|Expr1_is_less_than_Expr2________________|
2274222830
2274322831
2274422832 1122..88..00..77 DDeeccllaarraattiivvee iinntteeggeerr aarriitthhmmeettiicc
2274522833
2274622834 CLP(FD) constraints let you declaratively express integer arithmetic.
2274722835 The CLP(FD) constraints #=/2, #>/2 etc. are meant to be used instead
22748 of the corresponding primitives is/2, =:=/2, >/2 etc.
22836 of the corresponding primitives is/2, =:=/2, >/2 etc. over integers.
2274922837
2275022838 An important advantage of arithmetic constraints is their purely
2275122839 relational nature. They are therefore easy to explain and use, and
2283022918 |_P_#<==_Q___|True_iff_Q_implies_P________________ |
2283122919
2283222920 The constraints of this table are reifiable as well.
22921
22922 When reasoning over Boolean variables, also consider using
22923 library(clpb) and its dedicated CLP(B) constraints.
2283322924
2283422925
2283522926 1122..88..00..99 DDoommaaiinnss
2291623007 solutions.
2291723008
2291823009 It is good practice to keep the modeling part, via a dedicated
22919 predicate, separate from the actual search for solutions. This lets
22920 you observe termination and determinism properties of the modeling part
22921 in isolation from the search, and more easily try different search
22922 strategies.
23010 predicate called the ccoorree rreellaattiioonn, separate from the actual search
23011 for solutions. This lets you observe termination and determinism
23012 properties of the core relation in isolation from the search, and more
23013 easily try different search strategies.
2292323014
2292423015 As an example of a constraint satisfaction problem, consider the
2292523016 cryptoarithmetic puzzle SEND + MORE = MONEY, where different letters
2295923050
2296023051 |C5|in_2..8.____________________________________________________________ | |
2296123052
22962 From this answer, we see that the modeling part _t_e_r_m_i_n_a_t_e_s and is in
23053 From this answer, we see that this core relation _t_e_r_m_i_n_a_t_e_s and is in
2296323054 fact _d_e_t_e_r_m_i_n_i_s_t_i_c. Moreover, we see from the residual goals that the
2296423055 constraint solver has deduced more stringent bounds for all variables.
2296523056 Such observations are only possible if modeling and search parts are
2298223073 solutions.
2298323074
2298423075
22985 1122..88..00..1122 AAddvvaanncceedd ttooppiiccss
23076 1122..88..00..1122 OOppttiimmiissaattiioonn
23077
23078 You can use labeling/2 to minimize or maximize the value of a CLP(FD)
23079 expression, and generate solutions in increasing or decreasing order
23080 of the value. See the labeling options min(Expr) and max(Expr),
23081 respectively.
23082
23083 Again, to easily try different labeling options in connection with
23084 optimisation, we recommend to introduce a dedicated predicate for
23085 posting constraints, and to use labeling/2 in a separate goal. This
23086 way, you can observe properties of the core relation in isolation, and
23087 try different labeling options without recompiling your code.
23088
23089 If necessary, you can use once/1 to commit to the first optimal
23090 solution. However, it is often very valuable to see alternative
23091 solutions that are _a_l_s_o optimal, so that you can choose among optimal
23092 solutions by other criteria. For the sake of purity and completeness,
23093 we recommend to avoid once/1 and other constructs that lead to
23094 impurities in CLP(FD) programs.
23095
23096
23097 1122..88..00..1133 AAddvvaanncceedd ttooppiiccss
2298623098
2298723099 If you set the flag clpfd_monotonic to true, then CLP(FD) is monotonic:
2298823100 Adding new constraints cannot yield new solutions. When this flag is
2345123563 bounded domain, or an integer. The constraint holds iff at each
2345223564 time slot during the start and end of each task, the total resource
2345323565 consumption of all tasks running at that time does not exceed the
23454 global resource limit (which is 1 by default). _O_p_t_i_o_n_s is a list
23455 of options. Currently, the only supported option is:
23566 global resource limit. _O_p_t_i_o_n_s is a list of options. Currently,
23567 the only supported option is:
2345623568
2345723569 lliimmiitt((_L))
23458 The integer _L is the global resource limit.
23570 The integer _L is the global resource limit. Default is 1.
2345923571
2346023572 For example, given the following predicate that relates three tasks
2346123573 of durations 2 and 3 to a list containing their starting times:
2359823710 | :- use_module(library(clpfd)). |
2359923711 | |
2360023712 | sudoku(Rows) :- |
23601 | length(Rows, 9), maplist(length_list(9), Rows), |
23713 | length(Rows, 9), maplist(same_length(Rows), Rows), |
2360223714 | append(Rows, Vs), Vs ins 1..9, |
2360323715 | maplist(all_distinct, Rows), |
2360423716 | transpose(Rows, Columns), |
2360723719 | Rows = [A,B,C,D,E,F,G,H,I], |
2360823720 | blocks(A, B, C), blocks(D, E, F), blocks(G, H, I). |
2360923721 | |
23610 | length_list(L, Ls) :- length(Ls, L). |
23611 | |
2361223722 | blocks([], [], []). |
23613
2361423723 | blocks([A,B,C|Bs1], [D,E,F|Bs2], [G,H,I|Bs3]) :- |
2361523724 | all_distinct([A,B,C,D,E,F,G,H,I]), |
23725
2361623726 | blocks(Bs1, Bs2, Bs3). |
2361723727 | |
2361823728 | problem(1, [[_,_,_,_,_,_,_,_,_], |
2361923729 | [_,_,_,_,_,3,_,8,5], |
2362023730 | [_,_,1,_,2,_,_,_,_], |
2362123731 | [_,_,_,5,_,7,_,_,_], |
23622
2362323732 | [_,_,4,_,_,_,1,_,_], |
2362423733 | [_,9,_,_,_,_,_,_,_], |
23734
2362523735 | [5,_,_,_,_,_,_,7,3], |
2362623736 | [_,_,2,_,1,_,_,_,_], |
2362723737 ||____________[_,_,_,_,4,_,_,_,9]]).________________________________ ||
2362923739 Sample query:
2363023740
2363123741 ____________________________________________________________________| |
23632
2363323742 | ?- problem(1, Rows), sudoku(Rows), maplist(writeln, Rows). |
2363423743 | [9,8,7,6,5,4,3,2,1] |
23744
2363523745 | [2,4,6,1,7,3,9,8,5] |
2363623746 | [3,5,1,9,2,8,7,4,6] |
2363723747 | [1,2,8,5,3,7,6,9,4] |
2363823748 | [6,3,4,8,9,2,1,5,7] |
2363923749 | [7,9,5,4,6,1,8,3,2] |
2364023750 | [5,1,9,2,8,6,4,7,3] |
23641
2364223751 | [4,7,2,3,1,9,5,6,8] |
2364323752 | [8,6,3,7,4,5,2,1,9] |
23753
2364423754 ||Rows_=_[[9,_8,_7,_6,_5,_4,_3,_2|...],_..._,_[...|...]].___________ ||
2364523755
2364623756
2522125331
2522225332 oopptt__hheellpp((_+_O_p_t_s_S_p_e_c_, _-_H_e_l_p_:_a_t_o_m)) _[_d_e_t_]
2522325333 True when _H_e_l_p is a help string synthesized from _O_p_t_s_S_p_e_c.
25334
25335
25336 ppaarrssee__ttyyppee((_+_T_y_p_e_, _+_C_o_d_e_s_:_l_i_s_t_(_c_o_d_e_)_, _-_R_e_s_u_l_t)) _[_s_e_m_i_d_e_t_,_m_u_l_t_i_f_i_l_e_]
25337 Hook to parse option text _C_o_d_e_s to an object of type _T_y_p_e.
2522425338
2522525339
2522625340 1122..1199 lliibbrraarryy((oorrddsseettss)):: OOrrddeerreedd sseett mmaanniippuullaattiioonn
2750027614 _L_o_c_a_t_i_o_n Atom or list of character codes.
2750127615
2750227616
27503 ppaarrssee__uurrll((_+_U_R_L_, _-_A_t_t_r_i_b_u_t_e_s)) _[_d_e_t_]
27617 ppaarrssee__uurrll((_?_U_R_L_, _?_A_t_t_r_i_b_u_t_e_s)) _[_d_e_t_]
2750427618 Construct or analyse a _U_R_L. _U_R_L is an atom holding a _U_R_L or a
2750527619 variable. _A_t_t_r_i_b_u_t_e_s is a list of components. Each component is
2750627620 of the format Name(Value). Defined components are:
2855328667 is inherited from the parent _g_o_a_l. See also module_transparent/1
2855428668 and _m_e_t_a_-_p_r_e_d_i_c_a_t_e.
2855528669
28556 ddeett
28670 ddeett [[ddeetteerrmmiinniissmm]]
2855728671 Short for _d_e_t_e_r_m_i_n_i_s_t_i_c.
28672
28673 ddeetteerrmmiinniissmm
28674 How many solutions a _g_o_a_l can provide. Values are `nondet' (zero
28675 to infinite), `multi' (one to infinite), `det' (exactly one) and
28676 `semidet' (zero or one).
2855828677
2855928678 ddeetteerrmmiinniissttiicc
2856028679 A _p_r_e_d_i_c_a_t_e is _d_e_t_e_r_m_i_n_i_s_t_i_c if it succeeds exactly one time
2863528754 than executing instructions from an (abstract) instruction set that
2863628755 is not or only indirectly related to Prolog.
2863728756
28757 iinnssttaannttiiaattiioonn [[ooff aann aarrgguummeenntt]]
28758 To what extend a term is bound to a value. Typical levels
28759 are `unbound' (a _v_a_r_i_a_b_l_e), `ground' (term without variables) or
28760 `partially bound' (term with embedded variables).
28761
2863828762 mmeettaa--pprreeddiiccaattee
2863928763 A _p_r_e_d_i_c_a_t_e that reasons about other _p_r_e_d_i_c_a_t_e_s, either by calling
2864028764 them, (re)defining them or querying _p_r_o_p_e_r_t_i_e_s.
28765
28766 mmooddee [[ddeeccllaarraattiioonn]]
28767 Declaration of an argument _i_n_s_t_a_n_t_i_a_t_i_o_n pattern for a _p_r_e_d_i_c_a_t_e,
28768 often accompanied with a _d_e_t_e_r_m_i_n_i_s_m.
2864128769
2864228770 mmoodduullee
2864328771 Collection of predicates. Each module defines a name-space for
2864828776 mmoodduullee ttrraannssppaarreenntt [[pprreeddiiccaattee]]
2864928777 A _p_r_e_d_i_c_a_t_e that does not change the _c_o_n_t_e_x_t _m_o_d_u_l_e. Sometimes
2865028778 also called a _m_e_t_a_-_p_r_e_d_i_c_a_t_e.
28779
28780 mmuullttii [[ddeetteerrmmiinniissmm]]
28781 A _p_r_e_d_i_c_a_t_e is said to have _d_e_t_e_r_m_i_n_i_s_m multi if it generates at
28782 _l_e_a_s_t one answer.
2865128783
2865228784 mmuullttiiffiillee [[pprreeddiiccaattee]]
2865328785 Predicate for which the definition is distributed over multiple
2900329135 The predicate summary is used by the Prolog predicate apropos/1 to
2900429136 suggest predicates from a keyword.
2900529137
29006 @/2 Call using calling context
29007 !/0 Cut (discard choicepoints)
29008 ,/2 Conjunction of goals
29009 ->/2 If-then-else
29010 *->/2 Soft-cut
29011 ./2 Consult. Also functional notation
29012 :</2 Select keys from a dict
29013 ;/2 Disjunction of two goals
29014
29015 </2 Arithmetic smaller
29016 =/2 True when arguments are unified
29017 =../2 ``Univ.'' Term to list conversion
29018 =:=/2 Arithmetic equality
29019 =</2 Arithmetic smaller or equal
29020 ==/2 Test for strict equality
29021 =@=/2 Test for structural equality (variant)
29022
29023 =\=/2 Arithmetic not equal
29024 >/2 Arithmetic larger
29025 >=/2 Arithmetic larger or equal
29026 >:</2 Partial dict unification
29027 ?=/2 Test of terms can be compared now
29028 @</2 Standard order smaller
29029 @=</2 Standard order smaller or equal
29030 @>/2 Standard order larger
29031
29032 @>=/2 Standard order larger or equal
29033 \+/1 Negation by failure. Same as not/1
29034 \=/2 True if arguments cannot be unified
29035 \==/2 True if arguments are not strictly equal
29036 \=@=/2 Not structural identical
29037 ^/2 Existential quantification (bagof/3, setof/3)
29038 |/2 Disjunction in DCGs. Same as ;/2
29039
29040 {}/1 DCG escape; constraints
29041 abolish/1 Remove predicate definition from the database
29042 abolish/2 Remove predicate definition from the database
29043 abort/0 Abort execution, return to top level
29044 absolute_file_name/2 Get absolute path name
29045 absolute_file_name/3 Get absolute path name with options
29046 access_file/2 Check access permissions of a file
29047 acyclic_term/1 Test term for cycles
29048
29049 add_import_module/3 Add module to the auto-import list
29050 add_nb_set/2 Add term to a non-backtrackable set
29051 add_nb_set/3 Add term to a non-backtrackable set
29052 append/1 Append to a file
29053 apply/2 Call goal with additional arguments
29054 apropos/1 online_help Search manual
29055 arg/3 Access argument of a term
29056
29057 assoc_to_list/2 Convert association tree to list
29058 assert/1 Add a clause to the database
29059 assert/2 Add a clause to the database, give reference
29060 asserta/1 Add a clause to the database (first)
29061 asserta/2 Add a clause to the database (first)
29062 assertion/1 Make assertions about your program
29063 assertz/1 Add a clause to the database (last)
29064 assertz/2 Add a clause to the database (last)
29065
29066 attach_console/0 Attach I/O console to thread
29067 attribute_goals/3 Project attributes to goals
29068 attr_unify_hook/2 Attributed variable unification hook
29069 attr_portray_hook/2 Attributed variable print hook
29070 attvar/1 Type test for attributed variable
29071 at_end_of_stream/0 Test for end of file on input
29072 at_end_of_stream/1 Test for end of file on stream
29073
29074 at_halt/1 Register goal to run at halt/1
29075 atom/1 Type check for an atom
29076 atom_chars/2 Convert between atom and list of characters
29077 atom_codes/2 Convert between atom and list of characters codes
29078 atom_concat/3 Contatenate two atoms
29079 atom_length/2 Determine length of an atom
29080 atom_number/2 Convert between atom and number
29081 atom_prefix/2 Test for start of atom
29082
29083 atom_string/2 Conversion between atom and string
29084 atom_to_term/3 Convert between atom and term
29085 atomic/1 Type check for primitive
29086 atomic_concat/3 Concatenate two atomic values to an atom
29087 atomic_list_concat/2 Append a list of atomics
29088 atomic_list_concat/3 Append a list of atomics with separator
29089 atomics_to_string/2 Concatenate list of inputs to a string
29090
29091 atomics_to_string/3 Concatenate list of inputs to a string
29092 autoload/0 Autoload all predicates now
29093 autoload_path/1 Add directories for autoloading
29094 b_getval/2 Fetch backtrackable global variable
29095 b_set_dict/3 Destructive assignment on a dict
29096 b_setval/2 Assign backtrackable global variable
29097 bagof/3 Find all solutions to a goal
29098 between/3 Integer range checking/generating
29099
29100 blob/2 Type check for a blob
29101 break/0 Start interactive top level
29102 break_hook/6 (hook) Debugger hook
29103 byte_count/2 Byte-position in a stream
29104 call/1 Call a goal
29105 call/[2..] Call with additional arguments
29106 call_cleanup/3 Guard a goal with a cleaup-handler
29107
29108 call_cleanup/2 Guard a goal with a cleaup-handler
29109 call_dcg/3 As phrase/3 without type checking
29110 call_residue_vars/2 Find residual attributed variables
29111 call_shared_object_function/2 UNIX: Call C-function in shared (.so) file
29112 call_with_depth_limit/3 Prove goal with bounded depth
29113 call_with_inference_limit/3 Prove goal in limited inferences
29114 callable/1 Test for atom or compound term
29115 cancel_halt/1 Cancel halt/0 from an at_halt/1 hook
29116
29117 catch/3 Call goal, watching for exceptions
29118 char_code/2 Convert between character and character code
29119 char_conversion/2 Provide mapping of input characters
29120 char_type/2 Classify characters
29121 character_count/2 Get character index on a stream
29122 chdir/1 Compatibility: change working directory
29123 chr_constraint/1 CHR Constraint declaration
29124
29125 chr_show_store/1 List suspended CHR constraints
29126 chr_trace/0 Start CHR tracer
29127 chr_type/1 CHR Type declaration
29128 chr_notrace/0 Stop CHR tracer
29129 chr_leash/1 Define CHR leashed ports
29130 chr_option/2 Specify CHR compilation options
29131 clause/2 Get clauses of a predicate
29132 clause/3 Get clauses of a predicate
29133
29134 clause_property/2 Get properties of a clause
29135 close/1 Close stream
29136 close/2 Close stream (forced)
29137 close_dde_conversation/1 Win32: Close DDE channel
29138 close_shared_object/1 UNIX: Close shared library (.so file)
29139 collation_key/2 Sort key for locale dependent ordering
29140 comment_hook/3 (hook) handle comments in sources
29141
29142 compare/3 Compare, using a predicate to determine the order
29143 compile_aux_clauses/1 Compile predicates for goal_expansion/2
29144 compile_predicates/1 Compile dynamic code to static
29145 compiling/0 Is this a compilation run?
29146 compound/1 Test for compound term
29147 compound_name_arity/3 Name and arity of a compound term
29148 compound_name_arguments/3 Name and arguments of a compound term
29149 code_type/2 Classify a character-code
29150
29151 consult/1 Read (compile) a Prolog source file
29152 context_module/1 Get context module of current goal
29153 convert_time/8 Break time stamp into fields
29154 convert_time/2 Convert time stamp to string
29155 copy_stream_data/2 Copy all data from stream to stream
29156 copy_stream_data/3 Copy n bytes from stream to stream
29157 copy_predicate_clauses/2 Copy clauses between predicates
29158
29159 copy_term/2 Make a copy of a term
29160 copy_term/3 Copy a term and obtain attribute-goals
29161 copy_term_nat/2 Make a copy of a term without attributes
29162 create_prolog_flag/3 Create a new Prolog flag
29163 current_arithmetic_function/1 Examine evaluable functions
29164 current_atom/1 Examine existing atoms
29165 current_blob/2 Examine typed blobs
29166 current_char_conversion/2 Query input character mapping
29167
29168 current_flag/1 Examine existing flags
29169 current_foreign_library/2 shlib Examine loaded shared libraries (.so files)
29170 current_format_predicate/2 Enumerate user-defined format codes
29171 current_functor/2 Examine existing name/arity pairs
29172 current_input/1 Get current input stream
29173 current_key/1 Examine existing database keys
29174 current_locale/1 Get the current locale
29175
29176 current_module/1 Examine existing modules
29177 current_op/3 Examine current operator declarations
29178 current_output/1 Get the current output stream
29179 current_predicate/1 Examine existing predicates (ISO)
29180 current_predicate/2 Examine existing predicates
29181 current_signal/3 Current software signal mapping
29182 current_stream/3 Examine open streams
29183 cyclic_term/1 Test term for cycles
29184
29185 day_of_the_week/2 Determine ordinal-day from date
29186 date_time_stamp/2 Convert date structure to time-stamp
29187 date_time_value/3 Extract info from a date structure
29188 dcg_translate_rule/2 Source translation of DCG rules
29189 dcg_translate_rule/4 Source translation of DCG rules
29190 dde_current_connection/2 Win32: Examine open DDE connections
29191 dde_current_service/2 Win32: Examine DDE services provided
29192
29193 dde_execute/2 Win32: Execute command on DDE server
29194 dde_register_service/2 Win32: Become a DDE server
29195 dde_request/3 Win32: Make a DDE request
29196 dde_poke/3 Win32: POKE operation on DDE server
29197 dde_unregister_service/1 Win32: Terminate a DDE service
29198 debug/0 Test for debugging mode
29199 debug/1 Select topic for debugging
29200 debug/3 Print debugging message on topic
29201
29202 debug_control_hook/1 (hook) Extend spy/1, etc.
29203 debugging/0 Show debugger status
29204 debugging/1 Test where we are debugging topic
29205 default_module/2 Query module inheritance
29206 del_attr/2 Delete attribute from variable
29207 del_attrs/1 Delete all attributes from variable
29208 del_dict/4 Delete Key-Value pair from a dict
29209
29210 delete_directory/1 Remove a folder from the file system
29211 delete_file/1 Remove a file from the file system
29212 delete_import_module/2 Remove module from import list
29213 deterministic/1 Test deterministicy of current clause
29214 dif/2 Constrain two terms to be different
29215 directory_files/2 Get entries of a directory/folder
29216 discontiguous/1 Indicate distributed definition of a predicate
29217 downcase_atom/2 Convert atom to lower-case
29218
29219 duplicate_term/2 Create a copy of a term
29220 dwim_match/2 Atoms match in ``Do What I Mean'' sense
29221 dwim_match/3 Atoms match in ``Do What I Mean'' sense
29222 dwim_predicate/2 Find predicate in ``Do What I Mean'' sense
29223 dynamic/1 Indicate predicate definition may change
29224 edit/0 Edit current script- or associated file
29225 edit/1 Edit a file, predicate, module (extensible)
29226
29227 elif/1 Part of conditional compilation (directive)
29228 else/0 Part of conditional compilation (directive)
29229 empty_assoc/1 Create/test empty association tree
29230 empty_nb_set/1 Test/create an empty non-backtrackable set
29231 encoding/1 Define encoding inside a source file
29232 endif/0 End of conditional compilation (directive)
29233 ensure_loaded/1 Consult a file if that has not yet been done
29234 erase/1 Erase a database record or clause
29235
29236 eval_license/0 Evaluate licenses of loaded modules
29237 exception/3 (hook) Handle runtime exceptions
29238 exists_directory/1 Check existence of directory
29239 exists_file/1 Check existence of file
29240 exists_source/1 Check existence of a Prolog source
29241 expand_answer/2 Expand answer of query
29242 expand_file_name/2 Wildcard expansion of file names
29243
29244 expand_file_search_path/2 Wildcard expansion of file paths
29245 expand_goal/2 Compiler: expand goal in clause-body
29246 expand_goal/4 Compiler: expand goal in clause-body
29247 expand_query/4 Expanded entered query
29248 expand_term/2 Compiler: expand read term into clause(s)
29249 expand_term/4 Compiler: expand read term into clause(s)
29250 expects_dialect/1 For which Prolog dialect is this code written?
29251 explain/1 explain Explain argument
29252
29253 explain/2 explain 2nd argument is explanation of first
29254 export/1 Export a predicate from a module
29255 fail/0 Always false
29256 false/0 Always false
29257 current_prolog_flag/2 Get system configuration parameters
29258 file_base_name/2 Get file part of path
29259 file_directory_name/2 Get directory part of path
29260
29261 file_name_extension/3 Add, remove or test file extensions
29262 file_search_path/2 Define path-aliases for locating files
29263 find_chr_constraint/1 Returns a constraint from the store
29264 findall/3 Find all solutions to a goal
29265 findall/4 Difference list version of findall/3
29266 findnsols/4 Find first _N solutions
29267 findnsols/5 Difference list version of findsols/4
29268 flag/3 Simple global variable system
29269
29270 float/1 Type check for a floating point number
29271 flush_output/0 Output pending characters on current stream
29272 flush_output/1 Output pending characters on specified stream
29273 forall/2 Prove goal for all solutions of another goal
29274 format/1 Formatted output
29275 format/2 Formatted output with arguments
29276 format/3 Formatted output on a stream
29277
29278 format_time/3 C strftime() like date/time formatter
29279 format_time/4 date/time formatter with explicit locale
29280 format_predicate/2 Program format/[1,2]
29281 term_attvars/2 Find attributed variables in a term
29282 term_variables/2 Find unbound variables in a term
29283 term_variables/3 Find unbound variables in a term
29284 text_to_string/2 Convert arbitrary text to a string
29285 freeze/2 Delay execution until variable is bound
29286
29287 frozen/2 Query delayed goals on var
29288 functor/3 Get name and arity of a term or construct a term
29289 garbage_collect/0 Invoke the garbage collector
29290 garbage_collect_atoms/0 Invoke the atom garbage collector
29291 garbage_collect_clauses/0 Invoke clause garbage collector
29292 gen_assoc/3 Enumerate members of association tree
29293 gen_nb_set/2 Generate members of non-backtrackable set
29294
29295 gensym/2 Generate unique atoms from a base
29296 get/1 Read first non-blank character
29297 get/2 Read first non-blank character from a stream
29298 get_assoc/3 Fetch key from association tree
29299 get_assoc/5 Fetch key from association tree
29300 get0/1 Read next character
29301 get0/2 Read next character from a stream
29302 get_attr/3 Fetch named attribute from a variable
29303
29304 get_attrs/2 Fetch all attributes of a variable
29305 get_byte/1 Read next byte (ISO)
29306 get_byte/2 Read next byte from a stream (ISO)
29307 get_char/1 Read next character as an atom (ISO)
29308 get_char/2 Read next character from a stream (ISO)
29309 get_code/1 Read next character (ISO)
29310 get_code/2 Read next character from a stream (ISO)
29311
29312 get_dict/3 Get the value associated to a key from a dict
29313 get_dict/5 Replace existing value in a dict
29314 get_single_char/1 Read next character from the terminal
29315 get_string_code/3 Get character code at index in string
29316 get_time/1 Get current time
29317 getenv/2 Get shell environment variable
29318 goal_expansion/2 Hook for macro-expanding goals
29319 goal_expansion/4 Hook for macro-expanding goals
29320
29321 ground/1 Verify term holds no unbound variables
29322 gdebug/0 Debug using graphical tracer
29323 gspy/1 Spy using graphical tracer
29324 gtrace/0 Trace using graphical tracer
29325 guitracer/0 Install hooks for the graphical debugger
29326 gxref/0 Cross-reference loaded program
29327 halt/0 Exit from Prolog
29328
29329 halt/1 Exit from Prolog with status
29330 term_hash/2 Hash-value of ground term
29331 term_hash/4 Hash-value of term with depth limit
29332 help/0 Give help on help
29333 help/1 Give help on predicates and show parts of manual
29334 help_hook/1 (hook) User-hook in the help-system
29335 if/1 Start conditional compilation (directive)
29336 ignore/1 Call the argument, but always succeed
29337
29338 import/1 Import a predicate from a module
29339 import_module/2 Query import modules
29340 in_pce_thread/1 Run goal in XPCE thread
29341 in_pce_thread_sync/1 Run goal in XPCE thread
29342 include/1 Include a file with declarations
29343 initialization/1 Initialization directive
29344 initialization/2 Initialization directive
29345
29346 instance/2 Fetch clause or record from reference
29347 integer/1 Type check for integer
29348 interactor/0 Start new thread with console and top level
29349 is/2 Evaluate arithmetic expression
29350 is_absolute_file_name/1 True if arg defines an absolute path
29351 is_assoc/1 Verify association list
29352 is_list/1 Type check for a list
29353 is_dict/1 Type check for a dict
29354
29355 is_dict/2 Type check for a dict in a class
29356 is_stream/1 Type check for a stream handle
29357 join_threads/0 Join all terminated threads interactively
29358 keysort/2 Sort, using a key
29359 last/2 Last element of a list
29360 leash/1 Change ports visited by the tracer
29361 length/2 Length of a list
29362
29363 library_directory/1 (hook) Directories holding Prolog libraries
29364 license/1 Define license for current file
29365 license/2 Define license for named module
29366 line_count/2 Line number on stream
29367 line_position/2 Character position in line on stream
29368 list_debug_topics/0 List registered topics for debugging
29369 list_to_assoc/2 Create association tree from list
29370 list_to_set/2 Remove duplicates from a list
29371
29372 list_strings/0 Help porting to version 7
29373 listing/0 List program in current module
29374 listing/1 List predicate
29375 load_files/1 Load source files
29376 load_files/2 Load source files with options
29377 load_foreign_library/1 shlib Load shared library (.so file)
29378 load_foreign_library/2 shlib Load shared library (.so file)
29379
29380 locale_create/3 Create a new locale object
29381 locale_destroy/1 Destroy a locale object
29382 locale_property/2 Query properties of locale objects
29383 locale_sort/2 Language dependent sort of atoms
29384 make/0 Reconsult all changed source files
29385 make_directory/1 Create a folder on the file system
29386 make_library_index/1 Create autoload file INDEX.pl
29387 make_library_index/2 Create selective autoload file INDEX.pl
29388
29389 map_assoc/2 Map association tree
29390 map_assoc/3 Map association tree
29391 dict_create/3 Create a dict from data
29392 dict_pairs/3 Convert between dict and list of pairs
29393 max_assoc/3 Highest key in association tree
29394 memberchk/2 Deterministic member/2
29395 message_hook/3 Intercept print_message/2
29396
29397 message_line_element/2 (hook) Intercept print_message_lines/3
29398 message_property/2 (hook) Define display of a message
29399 message_queue_create/1 Create queue for thread communication
29400 message_queue_create/2 Create queue for thread communication
29401 message_queue_destroy/1 Destroy queue for thread communication
29402 message_queue_property/2 Query message queue properties
29403 message_to_string/2 Translate message-term to string
29404 meta_predicate/1 Declare access to other predicates
29405
29406 min_assoc/3 Lowest key in association tree
29407 module/1 Query/set current type-in module
29408 module/2 Declare a module
29409 module/3 Declare a module with language options
29410 module_property/2 Find properties of a module
29411 module_transparent/1 Indicate module based meta-predicate
29412 msort/2 Sort, do not remove duplicates
29413
29414 multifile/1 Indicate distributed definition of predicate
29415 mutex_create/1 Create a thread-synchronisation device
29416 mutex_create/2 Create a thread-synchronisation device
29417 mutex_destroy/1 Destroy a mutex
29418 mutex_lock/1 Become owner of a mutex
29419 mutex_property/2 Query mutex properties
29420 mutex_statistics/0 Print statistics on mutex usage
29421 mutex_trylock/1 Become owner of a mutex (non-blocking)
29422
29423 mutex_unlock/1 Release ownership of mutex
29424 mutex_unlock_all/0 Release ownership of all mutexes
29425 name/2 Convert between atom and list of character codes
29426 nb_current/2 Enumerate non-backtrackable global variables
29427 nb_delete/1 Delete a non-backtrackable global variable
29428 nb_getval/2 Fetch non-backtrackable global variable
29429 nb_link_dict/3 Non-backtrackable assignment to dict
29430
29431 nb_linkarg/3 Non-backtrackable assignment to term
29432 nb_linkval/2 Assign non-backtrackable global variable
29433 nb_set_to_list/2 Convert non-backtrackable set to list
29434 nb_set_dict/3 Non-backtrackable assignment to dict
29435 nb_setarg/3 Non-backtrackable assignment to term
29436 nb_setval/2 Assign non-backtrackable global variable
29437 nl/0 Generate a newline
29438 nl/1 Generate a newline on a stream
29439
29440 nodebug/0 Disable debugging
29441 nodebug/1 Disable debug-topic
29442 noguitracer/0 Disable the graphical debugger
29443 nonvar/1 Type check for bound term
29444 noprofile/1 Hide (meta-) predicate for the profiler
29445 noprotocol/0 Disable logging of user interaction
29446 normalize_space/2 Normalize white space
29447
29448 nospy/1 Remove spy point
29449 nospyall/0 Remove all spy points
29450 not/1 Negation by failure (argument not provable). Same as \+/1
29451 notrace/0 Stop tracing
29452 notrace/1 Do not debug argument goal
29453 nth_clause/3 N-th clause of a predicate
29454 number/1 Type check for integer or float
29455 number_chars/2 Convert between number and one-char atoms
29456
29457 number_codes/2 Convert between number and character codes
29458 number_string/2 Convert between number and string
29459 numbervars/3 Number unbound variables of a term
29460 numbervars/4 Number unbound variables of a term
29461 on_signal/3 Handle a software signal
29462 once/1 Call a goal deterministically
29463 op/3 Declare an operator
29464
29465 open/3 Open a file (creating a stream)
29466 open/4 Open a file (creating a stream)
29467 open_dde_conversation/3 Win32: Open DDE channel
29468 open_null_stream/1 Open a stream to discard output
29469 open_resource/3 Open a program resource as a stream
29470 open_shared_object/2 UNIX: Open shared library (.so file)
29471 open_shared_object/3 UNIX: Open shared library (.so file)
29472 open_string/2 Open a string as a stream
29473
29474 ord_list_to_assoc/2 Convert ordered list to assoc
29475 parse_time/2 Parse text to a time-stamp
29476 parse_time/3 Parse text to a time-stamp
29477 pce_dispatch/1 Run XPCE GUI in separate thread
29478 pce_call/1 Run goal in XPCE GUI thread
29479 peek_byte/1 Read byte without removing
29480 peek_byte/2 Read byte without removing
29481
29482 peek_char/1 Read character without removing
29483 peek_char/2 Read character without removing
29484 peek_code/1 Read character-code without removing
29485 peek_code/2 Read character-code without removing
29486 peek_string/3 Read a string without removing
29487 phrase/2 Activate grammar-rule set
29488 phrase/3 Activate grammar-rule set (returning rest)
29489 phrase_from_quasi_quotation/2 Parse quasi quotation with DCG
29490
29491 please/3 Query/change environment parameters
29492 plus/3 Logical integer addition
29493 portray/1 (hook) Modify behaviour of print/1
29494 portray_clause/1 Pretty print a clause
29495 portray_clause/2 Pretty print a clause to a stream
29496 predicate_property/2 Query predicate attributes
29497 predsort/3 Sort, using a predicate to determine the order
29498
29499 print/1 Print a term
29500 print/2 Print a term on a stream
29501 print_message/2 Print message from (exception) term
29502 print_message_lines/3 Print message to stream
29503 profile/1 Obtain execution statistics
29504 profile/2 Obtain execution statistics
29505 profile_count/3 Obtain profile results on a predicate
29506 profiler/2 Obtain/change status of the profiler
29507
29508 prolog/0 Run interactive top level
29509 prolog_choice_attribute/3 Examine the choice point stack
29510 prolog_current_choice/1 Reference to most recent choice point
29511 prolog_current_frame/1 Reference to goal's environment stack
29512 prolog_cut_to/1 Realise global cuts
29513 prolog_edit:locate/2 Locate targets for edit/1
29514 prolog_edit:locate/3 Locate targets for edit/1
29515
29516 prolog_edit:edit_source/1 Call editor for edit/1
29517 prolog_edit:edit_command/2 Specify editor activation
29518 prolog_edit:load/0 Load edit/1 extensions
29519 prolog_exception_hook/4 Rewrite exceptions
29520 prolog_file_type/2 Define meaning of file extension
29521 prolog_frame_attribute/3 Obtain information on a goal environment
29522 prolog_ide/1 Program access to the development environment
29523 prolog_list_goal/1 (hook) Intercept tracer 'L' command
29524
29525 prolog_load_context/2 Context information for directives
29526 prolog_load_file/2 (hook) Program load_files/2
29527 prolog_skip_level/2 Indicate deepest recursion to trace
29528 prolog_skip_frame/1 Perform `skip' on a frame
29529 prolog_stack_property/2 Query properties of the stacks
29530 prolog_to_os_filename/2 Convert between Prolog and OS filenames
29531 prolog_trace_interception/4 user Intercept the Prolog tracer
29532
29533 project_attributes/2 Project constraints to query variables
29534 prompt1/1 Change prompt for 1 line
29535 prompt/2 Change the prompt used by read/1
29536 protocol/1 Make a log of the user interaction
29537 protocola/1 Append log of the user interaction to file
29538 protocolling/1 On what file is user interaction logged
29539 public/1 Declaration that a predicate may be called
29540 put/1 Write a character
29541
29542 put/2 Write a character on a stream
29543 put_assoc/4 Add Key-Value to association tree
29544 put_attr/3 Put attribute on a variable
29545 put_attrs/2 Set/replace all attributes on a variable
29546 put_byte/1 Write a byte
29547 put_byte/2 Write a byte on a stream
29548 put_char/1 Write a character
29549
29550 put_char/2 Write a character on a stream
29551 put_code/1 Write a character-code
29552 put_code/2 Write a character-code on a stream
29553 put_dict/3 Add/replace multiple keys in a dict
29554 put_dict/4 Add/replace a single key in a dict
29555 qcompile/1 Compile source to Quick Load File
29556 qcompile/2 Compile source to Quick Load File
29557 qsave_program/1 Create runtime application
29558
29559 qsave_program/2 Create runtime application
29560 quasi_quotation_syntax/1 Declare quasi quotation syntax
29561 quasi_quotation_syntax_error/1Raise syntax error
29562 random_property/1 Query properties of random generation
29563 rational/1 Type check for a rational number
29564 rational/3 Decompose a rational
29565 read/1 Read Prolog term
29566
29567 read/2 Read Prolog term from stream
29568 read_clause/3 Read clause from stream
29569 read_history/6 Read using history substitution
29570 read_link/3 Read a symbolic link
29571 read_pending_input/3 Fetch buffered input from a stream
29572 read_string/3 Read a number of characters into a string
29573 read_string/5 Read string upto a delimiter
29574 read_term/2 Read term with options
29575
29576 read_term/3 Read term with options from stream
29577 read_term_from_atom/3 Read term with options from atom
29578 recorda/2 Record term in the database (first)
29579 recorda/3 Record term in the database (first)
29580 recorded/2 Obtain term from the database
29581 recorded/3 Obtain term from the database
29582 recordz/2 Record term in the database (last)
29583
29584 recordz/3 Record term in the database (last)
29585 redefine_system_predicate/1 Abolish system definition
29586 reexport/1 Load files and re-export the imported predicates
29587 reexport/2 Load predicates from a file and re-export it
29588 reload_foreign_libraries/0 Reload DLLs/shared objects
29589 reload_library_index/0 Force reloading the autoload index
29590 rename_file/2 Change name of file
29591 repeat/0 Succeed, leaving infinite backtrack points
29592
29593 require/1 This file requires these predicates
29594 reset_gensym/1 Reset a gensym key
29595 reset_gensym/0 Reset all gensym keys
29596 reset_profiler/0 Clear statistics obtained by the profiler
29597 resource/3 Declare a program resource
29598 retract/1 Remove clause from the database
29599 retractall/1 Remove unifying clauses from the database
29600
29601 same_file/2 Succeeds if arguments refer to same file
29602 same_term/2 Test terms to be at the same address
29603 see/1 Change the current input stream
29604 seeing/1 Query the current input stream
29605 seek/4 Modify the current position in a stream
29606 seen/0 Close the current input stream
29607 select_dict/2 Select matching attributes from a dict
29608 select_dict/3 Select matching attributes from a dict
29609
29610 set_end_of_stream/1 Set physical end of an open file
29611 set_input/1 Set current input stream from a stream
29612 set_locale/1 Set the default local
29613 set_module/1 Set properties of a module
29614 set_output/1 Set current output stream from a stream
29615 set_prolog_IO/3 Prepare streams for interactive session
29616 set_prolog_flag/2 Define a system feature
29617
29618 set_prolog_stack/2 Modify stack characteristics
29619 set_random/1 Control random number generation
29620 set_stream/2 Set stream attribute
29621 set_stream_position/2 Seek stream to position
29622 setup_call_cleanup/3 Undo side-effects safely
29623 setup_call_catcher_cleanup/4 Undo side-effects safely
29624 setarg/3 Destructive assignment on term
29625 setenv/2 Set shell environment variable
29626
29627 setlocale/3 Set/query C-library regional information
29628 setof/3 Find all unique solutions to a goal
29629 shell/0 Execute interactive subshell
29630 shell/1 Execute OS command
29631 shell/2 Execute OS command
29632 show_profile/1 Show results of the profiler
29633 size_file/2 Get size of a file in characters
29634
29635 size_nb_set/2 Determine size of non-backtrackable set
29636 skip/1 Skip to character in current input
29637 skip/2 Skip to character on stream
29638 rl_add_history/1 Add line to readline(3) history
29639 rl_read_history/1 Read readline(3) history
29640 rl_read_init_file/1 Read readline(3) init file
29641 rl_write_history/1 Write readline(3) history
29642 sleep/1 Suspend execution for specified time
29643
29644 sort/2 Sort elements in a list
29645 sort/4 Sort elements in a list
29646 source_exports/2 Check whether source exports a predicate
29647 source_file/1 Examine currently loaded source files
29648 source_file/2 Obtain source file of predicate
29649 source_file_property/2 Information about loaded files
29650 source_location/2 Location of last read term
29651
29652 split_string/4 Break a string into substrings
29653 spy/1 Force tracer on specified predicate
29654 stamp_date_time/3 Convert time-stamp to date structure
29655 statistics/0 Show execution statistics
29656 statistics/2 Obtain collected statistics
29657 stream_pair/3 Create/examine a bi-directional stream
29658 stream_position_data/3 Access fields from stream position
29659 stream_property/2 Get stream properties
29660
29661 string/1 Type check for string
29662 string_concat/3 atom_concat/3 for strings
29663 string_length/2 Determine length of a string
29664 string_chars/2 Conversion between string and list of characters
29665 string_codes/2 Conversion between string and list of character codes
29666 string_code/3 Get or find a character code in a string
29667 string_lower/2 Case conversion to lower case
29668
29669 string_upper/2 Case conversion to upper case
29670 string_predicate/1 (hook) Predicate contains strings
29671 strip_module/3 Extract context module and term
29672 style_check/1 Change level of warnings
29673 sub_atom/5 Take a substring from an atom
29674 sub_atom_icasechk/3 Case insensitive substring match
29675 sub_string/5 Take a substring from a string
29676 subsumes_term/2 One-sided unification test
29677
29678 succ/2 Logical integer successor relation
29679 swritef/2 Formatted write on a string
29680 swritef/3 Formatted write on a string
29681 tab/1 Output number of spaces
29682 tab/2 Output number of spaces on a stream
29683 tdebug/0 Switch all threads into debug mode
29684 tdebug/1 Switch a thread into debug mode
29685
29686 tell/1 Change current output stream
29687 telling/1 Query current output stream
29688 term_expansion/2 (hook) Convert term before compilation
29689 term_expansion/4 (hook) Convert term before compilation
29690 term_string/2 Read/write a term from/to a string
29691 term_string/3 Read/write a term from/to a string
29692 term_subsumer/3 Most specific generalization of two terms
29693 term_to_atom/2 Convert between term and atom
29694
29695 thread_at_exit/1 Register goal to be called at exit
29696 thread_create/3 Create a new Prolog task
29697 thread_detach/1 Make thread cleanup after completion
29698 thread_exit/1 Terminate Prolog task with value
29699 thread_get_message/1 Wait for message
29700 thread_get_message/2 Wait for message in a queue
29701 thread_get_message/3 Wait for message in a queue
29702
29703 thread_initialization/1 Run action at start of thread
29704 thread_join/2 Wait for Prolog task-completion
29705 thread_local/1 Declare thread-specific clauses for a predicate
29706 thread_message_hook/3 Thread local message_hook/3
29707 thread_peek_message/1 Test for message
29708 thread_peek_message/2 Test for message in a queue
29709 thread_property/2 Examine Prolog threads
29710 thread_self/1 Get identifier of current thread
29711
29712 thread_send_message/2 Send message to another thread
29713 thread_send_message/3 Send message to another thread
29714 thread_setconcurrency/2 Number of active threads
29715 thread_signal/2 Execute goal in another thread
29716 thread_statistics/3 Get statistics of another thread
29717 threads/0 List running threads
29718 throw/1 Raise an exception (see catch/3)
29719
29720 time/1 Determine time needed to execute goal
29721 time_file/2 Get last modification time of file
29722 tmp_file/2 Create a temporary filename
29723 tmp_file_stream/3 Create a temporary file and open it
29724 tnodebug/0 Switch off debug mode in all threads
29725 tnodebug/1 Switch off debug mode in a thread
29726 told/0 Close current output
29727 tprofile/1 Profile a thread for some period
29728
29729 trace/0 Start the tracer
29730 trace/1 Set trace point on predicate
29731 trace/2 Set/Clear trace point on ports
29732 tracing/0 Query status of the tracer
29733 trim_stacks/0 Release unused memory resources
29734 true/0 Succeed
29735 tspy/1 Set spy point and enable debugging in all threads
29736
29737 tspy/2 Set spy point and enable debugging in a thread
29738 tty_get_capability/3 Get terminal parameter
29739 tty_goto/2 Goto position on screen
29740 tty_put/2 Write control string to terminal
29741 tty_size/2 Get row/column size of the terminal
29742 ttyflush/0 Flush output on terminal
29743 unify_with_occurs_check/2 Logically sound unification
29744 unifiable/3 Determining binding required for unification
29745
29746 unix/1 OS interaction
29747 unknown/2 Trap undefined predicates
29748 unload_file/1 Unload a source file
29749 unload_foreign_library/1 shlib Detach shared library (.so file)
29750 unload_foreign_library/2 shlib Detach shared library (.so file)
29751 unsetenv/1 Delete shell environment variable
29752 upcase_atom/2 Convert atom to upper-case
29753
29754 use_foreign_library/1 Load DLL/shared object (directive)
29755 use_foreign_library/2 Load DLL/shared object (directive)
29756 use_module/1 Import a module
29757 use_module/2 Import predicates from a module
29758 valid_string_goal/1 (hook) Goal handles strings
29759 var/1 Type check for unbound variable
29760 var_number/2 Check that var is numbered by numbervars
29761 var_property/2 Variable properties during macro expansion
29762
29763 variant_sha1/2 Term-hash for term-variants
29764 version/0 Print system banner message
29765 version/1 Add messages to the system banner
29766 visible/1 Ports that are visible in the tracer
29767 volatile/1 Predicates that are not saved
29768 wait_for_input/3 Wait for input with optional timeout
29769 when/2 Execute goal when condition becomes true
29770
29771 wildcard_match/2 Csh(1) style wildcard match
29772 win_add_dll_directory/1 Add directory to DLL search path
29773 win_add_dll_directory/2 Add directory to DLL search path
29774 win_remove_dll_directory/1 Remove directory from DLL search path
29775 win_exec/2 Win32: spawn Windows task
29776 win_has_menu/0 Win32: true if console menu is available
29777 win_folder/2 Win32: get special folder by CSIDL
29778 win_insert_menu/2 swipl-win.exe: add menu
29779
29780 win_insert_menu_item/4 swipl-win.exe: add item to menu
29781 win_shell/2 Win32: open document through Shell
29782 win_shell/3 Win32: open document through Shell
29783 win_registry_get_value/3 Win32: get registry value
29784 win_window_pos/1 Win32: change size and position of window
29785 window_title/2 Win32: change title of window
29786 with_mutex/2 Run goal while holding mutex
29787
29788 with_output_to/2 Write to strings and more
29789 with_quasi_quotation_input/3 Parse quasi quotation from stream
29790 working_directory/2 Query/change CWD
29791 write/1 Write term
29792 write/2 Write term to stream
29793 writeln/1 Write term, followed by a newline
29794 writeln/2 Write term, followed by a newline to a stream
29795 write_canonical/1 Write a term with quotes, ignore operators
29796
29797 write_canonical/2 Write a term with quotes, ignore operators on a stream
29798 write_length/3 Dermine #characters to output a term
29799 write_term/2 Write term with options
29800 write_term/3 Write term with options to stream
29801 writef/1 Formatted write
29802 writef/2 Formatted write on stream
29803 writeq/1 Write term, insert quotes
29804
29805 writeq/2 Write term, insert quotes on stream
29138 @/2 Call using calling context
29139 !/0 Cut (discard choicepoints)
29140 ,/2 Conjunction of goals
29141 ->/2 If-then-else
29142 *->/2 Soft-cut
29143 ./2 Consult. Also functional notation
29144 :</2 Select keys from a dict
29145 ;/2 Disjunction of two goals
29146
29147 </2 Arithmetic smaller
29148 =/2 True when arguments are unified
29149 =../2 ``Univ.'' Term to list conversion
29150 =:=/2 Arithmetic equality
29151 =</2 Arithmetic smaller or equal
29152 ==/2 Test for strict equality
29153 =@=/2 Test for structural equality (variant)
29154
29155 =\=/2 Arithmetic not equal
29156 >/2 Arithmetic larger
29157 >=/2 Arithmetic larger or equal
29158 >:</2 Partial dict unification
29159 ?=/2 Test of terms can be compared now
29160 @</2 Standard order smaller
29161 @=</2 Standard order smaller or equal
29162 @>/2 Standard order larger
29163
29164 @>=/2 Standard order larger or equal
29165 \+/1 Negation by failure. Same as not/1
29166 \=/2 True if arguments cannot be unified
29167 \==/2 True if arguments are not strictly equal
29168 \=@=/2 Not structural identical
29169 ^/2 Existential quantification (bagof/3, setof/3)
29170 |/2 Disjunction in DCGs. Same as ;/2
29171
29172 {}/1 DCG escape; constraints
29173 abolish/1 Remove predicate definition from the database
29174 abolish/2 Remove predicate definition from the database
29175 abort/0 Abort execution, return to top level
29176 absolute_file_name/2 Get absolute path name
29177 absolute_file_name/3 Get absolute path name with options
29178 access_file/2 Check access permissions of a file
29179 acyclic_term/1 Test term for cycles
29180
29181 add_import_module/3 Add module to the auto-import list
29182 add_nb_set/2 Add term to a non-backtrackable set
29183 add_nb_set/3 Add term to a non-backtrackable set
29184 append/1 Append to a file
29185 apply/2 Call goal with additional arguments
29186 apropos/1 online_help Search manual
29187 arg/3 Access argument of a term
29188
29189 assoc_to_list/2 Convert association tree to list
29190 assert/1 Add a clause to the database
29191 assert/2 Add a clause to the database, give reference
29192 asserta/1 Add a clause to the database (first)
29193 asserta/2 Add a clause to the database (first)
29194 assertion/1 Make assertions about your program
29195 assertz/1 Add a clause to the database (last)
29196 assertz/2 Add a clause to the database (last)
29197
29198 attach_console/0 Attach I/O console to thread
29199 attribute_goals/3 Project attributes to goals
29200 attr_unify_hook/2 Attributed variable unification hook
29201 attr_portray_hook/2 Attributed variable print hook
29202 attvar/1 Type test for attributed variable
29203 at_end_of_stream/0 Test for end of file on input
29204 at_end_of_stream/1 Test for end of file on stream
29205
29206 at_halt/1 Register goal to run at halt/1
29207 atom/1 Type check for an atom
29208 atom_chars/2 Convert between atom and list of characters
29209 atom_codes/2 Convert between atom and list of characters codes
29210 atom_concat/3 Contatenate two atoms
29211 atom_length/2 Determine length of an atom
29212 atom_number/2 Convert between atom and number
29213 atom_prefix/2 Test for start of atom
29214
29215 atom_string/2 Conversion between atom and string
29216 atom_to_term/3 Convert between atom and term
29217 atomic/1 Type check for primitive
29218 atomic_concat/3 Concatenate two atomic values to an atom
29219 atomic_list_concat/2 Append a list of atomics
29220 atomic_list_concat/3 Append a list of atomics with separator
29221 atomics_to_string/2 Concatenate list of inputs to a string
29222
29223 atomics_to_string/3 Concatenate list of inputs to a string
29224 autoload/0 Autoload all predicates now
29225 autoload_path/1 Add directories for autoloading
29226 b_getval/2 Fetch backtrackable global variable
29227 b_set_dict/3 Destructive assignment on a dict
29228 b_setval/2 Assign backtrackable global variable
29229 bagof/3 Find all solutions to a goal
29230 between/3 Integer range checking/generating
29231
29232 blob/2 Type check for a blob
29233 break/0 Start interactive top level
29234 break_hook/6 (hook) Debugger hook
29235 byte_count/2 Byte-position in a stream
29236 call/1 Call a goal
29237 call/[2..] Call with additional arguments
29238 call_cleanup/3 Guard a goal with a cleaup-handler
29239
29240 call_cleanup/2 Guard a goal with a cleaup-handler
29241 call_dcg/3 As phrase/3 without type checking
29242 call_residue_vars/2 Find residual attributed variables
29243 call_shared_object_function/2 UNIX: Call C-function in shared (.so) file
29244 call_with_depth_limit/3 Prove goal with bounded depth
29245 call_with_inference_limit/3 Prove goal in limited inferences
29246 callable/1 Test for atom or compound term
29247 cancel_halt/1 Cancel halt/0 from an at_halt/1 hook
29248
29249 catch/3 Call goal, watching for exceptions
29250 char_code/2 Convert between character and character code
29251 char_conversion/2 Provide mapping of input characters
29252 char_type/2 Classify characters
29253 character_count/2 Get character index on a stream
29254 chdir/1 Compatibility: change working directory
29255 chr_constraint/1 CHR Constraint declaration
29256
29257 chr_show_store/1 List suspended CHR constraints
29258 chr_trace/0 Start CHR tracer
29259 chr_type/1 CHR Type declaration
29260 chr_notrace/0 Stop CHR tracer
29261 chr_leash/1 Define CHR leashed ports
29262 chr_option/2 Specify CHR compilation options
29263 clause/2 Get clauses of a predicate
29264 clause/3 Get clauses of a predicate
29265
29266 clause_property/2 Get properties of a clause
29267 close/1 Close stream
29268 close/2 Close stream (forced)
29269 close_dde_conversation/1 Win32: Close DDE channel
29270 close_shared_object/1 UNIX: Close shared library (.so file)
29271 collation_key/2 Sort key for locale dependent ordering
29272 comment_hook/3 (hook) handle comments in sources
29273
29274 compare/3 Compare, using a predicate to determine the order
29275 compile_aux_clauses/1 Compile predicates for goal_expansion/2
29276 compile_predicates/1 Compile dynamic code to static
29277 compiling/0 Is this a compilation run?
29278 compound/1 Test for compound term
29279 compound_name_arity/3 Name and arity of a compound term
29280 compound_name_arguments/3 Name and arguments of a compound term
29281 code_type/2 Classify a character-code
29282
29283 consult/1 Read (compile) a Prolog source file
29284 context_module/1 Get context module of current goal
29285 convert_time/8 Break time stamp into fields
29286 convert_time/2 Convert time stamp to string
29287 copy_stream_data/2 Copy all data from stream to stream
29288 copy_stream_data/3 Copy n bytes from stream to stream
29289 copy_predicate_clauses/2 Copy clauses between predicates
29290
29291 copy_term/2 Make a copy of a term
29292 copy_term/3 Copy a term and obtain attribute-goals
29293 copy_term_nat/2 Make a copy of a term without attributes
29294 create_prolog_flag/3 Create a new Prolog flag
29295 current_arithmetic_function/1 Examine evaluable functions
29296 current_atom/1 Examine existing atoms
29297 current_blob/2 Examine typed blobs
29298 current_char_conversion/2 Query input character mapping
29299
29300 current_flag/1 Examine existing flags
29301 current_foreign_library/2 shlib Examine loaded shared libraries (.so files)
29302 current_format_predicate/2 Enumerate user-defined format codes
29303 current_functor/2 Examine existing name/arity pairs
29304 current_input/1 Get current input stream
29305 current_key/1 Examine existing database keys
29306 current_locale/1 Get the current locale
29307
29308 current_module/1 Examine existing modules
29309 current_op/3 Examine current operator declarations
29310 current_output/1 Get the current output stream
29311 current_predicate/1 Examine existing predicates (ISO)
29312 current_predicate/2 Examine existing predicates
29313 current_signal/3 Current software signal mapping
29314 current_stream/3 Examine open streams
29315 cyclic_term/1 Test term for cycles
29316
29317 day_of_the_week/2 Determine ordinal-day from date
29318 date_time_stamp/2 Convert date structure to time-stamp
29319 date_time_value/3 Extract info from a date structure
29320 dcg_translate_rule/2 Source translation of DCG rules
29321 dcg_translate_rule/4 Source translation of DCG rules
29322 dde_current_connection/2 Win32: Examine open DDE connections
29323 dde_current_service/2 Win32: Examine DDE services provided
29324
29325 dde_execute/2 Win32: Execute command on DDE server
29326 dde_register_service/2 Win32: Become a DDE server
29327 dde_request/3 Win32: Make a DDE request
29328 dde_poke/3 Win32: POKE operation on DDE server
29329 dde_unregister_service/1 Win32: Terminate a DDE service
29330 debug/0 Test for debugging mode
29331 debug/1 Select topic for debugging
29332 debug/3 Print debugging message on topic
29333
29334 debug_control_hook/1 (hook) Extend spy/1, etc.
29335 debugging/0 Show debugger status
29336 debugging/1 Test where we are debugging topic
29337 default_module/2 Query module inheritance
29338 del_attr/2 Delete attribute from variable
29339 del_attrs/1 Delete all attributes from variable
29340 del_dict/4 Delete Key-Value pair from a dict
29341
29342 delete_directory/1 Remove a folder from the file system
29343 delete_file/1 Remove a file from the file system
29344 delete_import_module/2 Remove module from import list
29345 deterministic/1 Test deterministicy of current clause
29346 dif/2 Constrain two terms to be different
29347 directory_files/2 Get entries of a directory/folder
29348 discontiguous/1 Indicate distributed definition of a predicate
29349 divmod/4 Compute quotient and remainder of two integers
29350
29351 downcase_atom/2 Convert atom to lower-case
29352 duplicate_term/2 Create a copy of a term
29353 dwim_match/2 Atoms match in ``Do What I Mean'' sense
29354 dwim_match/3 Atoms match in ``Do What I Mean'' sense
29355 dwim_predicate/2 Find predicate in ``Do What I Mean'' sense
29356 dynamic/1 Indicate predicate definition may change
29357 edit/0 Edit current script- or associated file
29358
29359 edit/1 Edit a file, predicate, module (extensible)
29360 elif/1 Part of conditional compilation (directive)
29361 else/0 Part of conditional compilation (directive)
29362 empty_assoc/1 Create/test empty association tree
29363 empty_nb_set/1 Test/create an empty non-backtrackable set
29364 encoding/1 Define encoding inside a source file
29365 endif/0 End of conditional compilation (directive)
29366 ensure_loaded/1 Consult a file if that has not yet been done
29367
29368 erase/1 Erase a database record or clause
29369 eval_license/0 Evaluate licenses of loaded modules
29370 exception/3 (hook) Handle runtime exceptions
29371 exists_directory/1 Check existence of directory
29372 exists_file/1 Check existence of file
29373 exists_source/1 Check existence of a Prolog source
29374 expand_answer/2 Expand answer of query
29375
29376 expand_file_name/2 Wildcard expansion of file names
29377 expand_file_search_path/2 Wildcard expansion of file paths
29378 expand_goal/2 Compiler: expand goal in clause-body
29379 expand_goal/4 Compiler: expand goal in clause-body
29380 expand_query/4 Expanded entered query
29381 expand_term/2 Compiler: expand read term into clause(s)
29382 expand_term/4 Compiler: expand read term into clause(s)
29383 expects_dialect/1 For which Prolog dialect is this code written?
29384
29385 explain/1 explain Explain argument
29386 explain/2 explain 2nd argument is explanation of first
29387 export/1 Export a predicate from a module
29388 fail/0 Always false
29389 false/0 Always false
29390 current_prolog_flag/2 Get system configuration parameters
29391 file_base_name/2 Get file part of path
29392
29393 file_directory_name/2 Get directory part of path
29394 file_name_extension/3 Add, remove or test file extensions
29395 file_search_path/2 Define path-aliases for locating files
29396 find_chr_constraint/1 Returns a constraint from the store
29397 findall/3 Find all solutions to a goal
29398 findall/4 Difference list version of findall/3
29399 findnsols/4 Find first _N solutions
29400 findnsols/5 Difference list version of findsols/4
29401
29402 flag/3 Simple global variable system
29403 float/1 Type check for a floating point number
29404 flush_output/0 Output pending characters on current stream
29405 flush_output/1 Output pending characters on specified stream
29406 forall/2 Prove goal for all solutions of another goal
29407 format/1 Formatted output
29408 format/2 Formatted output with arguments
29409
29410 format/3 Formatted output on a stream
29411 format_time/3 C strftime() like date/time formatter
29412 format_time/4 date/time formatter with explicit locale
29413 format_predicate/2 Program format/[1,2]
29414 term_attvars/2 Find attributed variables in a term
29415 term_variables/2 Find unbound variables in a term
29416 term_variables/3 Find unbound variables in a term
29417 text_to_string/2 Convert arbitrary text to a string
29418
29419 freeze/2 Delay execution until variable is bound
29420 frozen/2 Query delayed goals on var
29421 functor/3 Get name and arity of a term or construct a term
29422 garbage_collect/0 Invoke the garbage collector
29423 garbage_collect_atoms/0 Invoke the atom garbage collector
29424 garbage_collect_clauses/0 Invoke clause garbage collector
29425 gen_assoc/3 Enumerate members of association tree
29426
29427 gen_nb_set/2 Generate members of non-backtrackable set
29428 gensym/2 Generate unique atoms from a base
29429 get/1 Read first non-blank character
29430 get/2 Read first non-blank character from a stream
29431 get_assoc/3 Fetch key from association tree
29432 get_assoc/5 Fetch key from association tree
29433 get0/1 Read next character
29434 get0/2 Read next character from a stream
29435
29436 get_attr/3 Fetch named attribute from a variable
29437 get_attrs/2 Fetch all attributes of a variable
29438 get_byte/1 Read next byte (ISO)
29439 get_byte/2 Read next byte from a stream (ISO)
29440 get_char/1 Read next character as an atom (ISO)
29441 get_char/2 Read next character from a stream (ISO)
29442 get_code/1 Read next character (ISO)
29443
29444 get_code/2 Read next character from a stream (ISO)
29445 get_dict/3 Get the value associated to a key from a dict
29446 get_dict/5 Replace existing value in a dict
29447 get_single_char/1 Read next character from the terminal
29448 get_string_code/3 Get character code at index in string
29449 get_time/1 Get current time
29450 getenv/2 Get shell environment variable
29451 goal_expansion/2 Hook for macro-expanding goals
29452
29453 goal_expansion/4 Hook for macro-expanding goals
29454 ground/1 Verify term holds no unbound variables
29455 gdebug/0 Debug using graphical tracer
29456 gspy/1 Spy using graphical tracer
29457 gtrace/0 Trace using graphical tracer
29458 guitracer/0 Install hooks for the graphical debugger
29459 gxref/0 Cross-reference loaded program
29460
29461 halt/0 Exit from Prolog
29462 halt/1 Exit from Prolog with status
29463 term_hash/2 Hash-value of ground term
29464 term_hash/4 Hash-value of term with depth limit
29465 help/0 Give help on help
29466 help/1 Give help on predicates and show parts of manual
29467 help_hook/1 (hook) User-hook in the help-system
29468 if/1 Start conditional compilation (directive)
29469
29470 ignore/1 Call the argument, but always succeed
29471 import/1 Import a predicate from a module
29472 import_module/2 Query import modules
29473 in_pce_thread/1 Run goal in XPCE thread
29474 in_pce_thread_sync/1 Run goal in XPCE thread
29475 include/1 Include a file with declarations
29476 initialization/1 Initialization directive
29477
29478 initialization/2 Initialization directive
29479 instance/2 Fetch clause or record from reference
29480 integer/1 Type check for integer
29481 interactor/0 Start new thread with console and top level
29482 is/2 Evaluate arithmetic expression
29483 is_absolute_file_name/1 True if arg defines an absolute path
29484 is_assoc/1 Verify association list
29485 is_list/1 Type check for a list
29486
29487 is_dict/1 Type check for a dict
29488 is_dict/2 Type check for a dict in a class
29489 is_stream/1 Type check for a stream handle
29490 join_threads/0 Join all terminated threads interactively
29491 keysort/2 Sort, using a key
29492 last/2 Last element of a list
29493 leash/1 Change ports visited by the tracer
29494
29495 length/2 Length of a list
29496 library_directory/1 (hook) Directories holding Prolog libraries
29497 license/1 Define license for current file
29498 license/2 Define license for named module
29499 line_count/2 Line number on stream
29500 line_position/2 Character position in line on stream
29501 list_debug_topics/0 List registered topics for debugging
29502 list_to_assoc/2 Create association tree from list
29503
29504 list_to_set/2 Remove duplicates from a list
29505 list_strings/0 Help porting to version 7
29506 listing/0 List program in current module
29507 listing/1 List predicate
29508 load_files/1 Load source files
29509 load_files/2 Load source files with options
29510 load_foreign_library/1 shlib Load shared library (.so file)
29511
29512 load_foreign_library/2 shlib Load shared library (.so file)
29513 locale_create/3 Create a new locale object
29514 locale_destroy/1 Destroy a locale object
29515 locale_property/2 Query properties of locale objects
29516 locale_sort/2 Language dependent sort of atoms
29517 make/0 Reconsult all changed source files
29518 make_directory/1 Create a folder on the file system
29519 make_library_index/1 Create autoload file INDEX.pl
29520
29521 make_library_index/2 Create selective autoload file INDEX.pl
29522 map_assoc/2 Map association tree
29523 map_assoc/3 Map association tree
29524 dict_create/3 Create a dict from data
29525 dict_pairs/3 Convert between dict and list of pairs
29526 max_assoc/3 Highest key in association tree
29527 memberchk/2 Deterministic member/2
29528
29529 message_hook/3 Intercept print_message/2
29530 message_line_element/2 (hook) Intercept print_message_lines/3
29531 message_property/2 (hook) Define display of a message
29532 message_queue_create/1 Create queue for thread communication
29533 message_queue_create/2 Create queue for thread communication
29534 message_queue_destroy/1 Destroy queue for thread communication
29535 message_queue_property/2 Query message queue properties
29536 message_to_string/2 Translate message-term to string
29537
29538 meta_predicate/1 Declare access to other predicates
29539 min_assoc/3 Lowest key in association tree
29540 module/1 Query/set current type-in module
29541 module/2 Declare a module
29542 module/3 Declare a module with language options
29543 module_property/2 Find properties of a module
29544 module_transparent/1 Indicate module based meta-predicate
29545
29546 msort/2 Sort, do not remove duplicates
29547 multifile/1 Indicate distributed definition of predicate
29548 mutex_create/1 Create a thread-synchronisation device
29549 mutex_create/2 Create a thread-synchronisation device
29550 mutex_destroy/1 Destroy a mutex
29551 mutex_lock/1 Become owner of a mutex
29552 mutex_property/2 Query mutex properties
29553 mutex_statistics/0 Print statistics on mutex usage
29554
29555 mutex_trylock/1 Become owner of a mutex (non-blocking)
29556 mutex_unlock/1 Release ownership of mutex
29557 mutex_unlock_all/0 Release ownership of all mutexes
29558 name/2 Convert between atom and list of character codes
29559 nb_current/2 Enumerate non-backtrackable global variables
29560 nb_delete/1 Delete a non-backtrackable global variable
29561 nb_getval/2 Fetch non-backtrackable global variable
29562
29563 nb_link_dict/3 Non-backtrackable assignment to dict
29564 nb_linkarg/3 Non-backtrackable assignment to term
29565 nb_linkval/2 Assign non-backtrackable global variable
29566 nb_set_to_list/2 Convert non-backtrackable set to list
29567 nb_set_dict/3 Non-backtrackable assignment to dict
29568 nb_setarg/3 Non-backtrackable assignment to term
29569 nb_setval/2 Assign non-backtrackable global variable
29570 nl/0 Generate a newline
29571
29572 nl/1 Generate a newline on a stream
29573 nodebug/0 Disable debugging
29574 nodebug/1 Disable debug-topic
29575 noguitracer/0 Disable the graphical debugger
29576 nonvar/1 Type check for bound term
29577 noprofile/1 Hide (meta-) predicate for the profiler
29578 noprotocol/0 Disable logging of user interaction
29579
29580 normalize_space/2 Normalize white space
29581 nospy/1 Remove spy point
29582 nospyall/0 Remove all spy points
29583 not/1 Negation by failure (argument not provable). Same as \+/1
29584 notrace/0 Stop tracing
29585 notrace/1 Do not debug argument goal
29586 nth_clause/3 N-th clause of a predicate
29587 nth_integer_root_and_remainder/4Integer root and remainder
29588
29589 number/1 Type check for integer or float
29590 number_chars/2 Convert between number and one-char atoms
29591 number_codes/2 Convert between number and character codes
29592 number_string/2 Convert between number and string
29593 numbervars/3 Number unbound variables of a term
29594 numbervars/4 Number unbound variables of a term
29595 on_signal/3 Handle a software signal
29596
29597 once/1 Call a goal deterministically
29598 op/3 Declare an operator
29599 open/3 Open a file (creating a stream)
29600 open/4 Open a file (creating a stream)
29601 open_dde_conversation/3 Win32: Open DDE channel
29602 open_null_stream/1 Open a stream to discard output
29603 open_resource/3 Open a program resource as a stream
29604 open_shared_object/2 UNIX: Open shared library (.so file)
29605
29606 open_shared_object/3 UNIX: Open shared library (.so file)
29607 open_string/2 Open a string as a stream
29608 ord_list_to_assoc/2 Convert ordered list to assoc
29609 parse_time/2 Parse text to a time-stamp
29610 parse_time/3 Parse text to a time-stamp
29611 pce_dispatch/1 Run XPCE GUI in separate thread
29612 pce_call/1 Run goal in XPCE GUI thread
29613
29614 peek_byte/1 Read byte without removing
29615 peek_byte/2 Read byte without removing
29616 peek_char/1 Read character without removing
29617 peek_char/2 Read character without removing
29618 peek_code/1 Read character-code without removing
29619 peek_code/2 Read character-code without removing
29620 peek_string/3 Read a string without removing
29621 phrase/2 Activate grammar-rule set
29622
29623 phrase/3 Activate grammar-rule set (returning rest)
29624 phrase_from_quasi_quotation/2 Parse quasi quotation with DCG
29625 please/3 Query/change environment parameters
29626 plus/3 Logical integer addition
29627 portray/1 (hook) Modify behaviour of print/1
29628 portray_clause/1 Pretty print a clause
29629 portray_clause/2 Pretty print a clause to a stream
29630
29631 predicate_property/2 Query predicate attributes
29632 predsort/3 Sort, using a predicate to determine the order
29633 print/1 Print a term
29634 print/2 Print a term on a stream
29635 print_message/2 Print message from (exception) term
29636 print_message_lines/3 Print message to stream
29637 profile/1 Obtain execution statistics
29638 profile/2 Obtain execution statistics
29639
29640 profile_count/3 Obtain profile results on a predicate
29641 profiler/2 Obtain/change status of the profiler
29642 prolog/0 Run interactive top level
29643 prolog_choice_attribute/3 Examine the choice point stack
29644 prolog_current_choice/1 Reference to most recent choice point
29645 prolog_current_frame/1 Reference to goal's environment stack
29646 prolog_cut_to/1 Realise global cuts
29647
29648 prolog_edit:locate/2 Locate targets for edit/1
29649 prolog_edit:locate/3 Locate targets for edit/1
29650 prolog_edit:edit_source/1 Call editor for edit/1
29651 prolog_edit:edit_command/2 Specify editor activation
29652 prolog_edit:load/0 Load edit/1 extensions
29653 prolog_exception_hook/4 Rewrite exceptions
29654 prolog_file_type/2 Define meaning of file extension
29655 prolog_frame_attribute/3 Obtain information on a goal environment
29656
29657 prolog_ide/1 Program access to the development environment
29658 prolog_list_goal/1 (hook) Intercept tracer 'L' command
29659 prolog_load_context/2 Context information for directives
29660 prolog_load_file/2 (hook) Program load_files/2
29661 prolog_skip_level/2 Indicate deepest recursion to trace
29662 prolog_skip_frame/1 Perform `skip' on a frame
29663 prolog_stack_property/2 Query properties of the stacks
29664
29665 prolog_to_os_filename/2 Convert between Prolog and OS filenames
29666 prolog_trace_interception/4 user Intercept the Prolog tracer
29667 project_attributes/2 Project constraints to query variables
29668 prompt1/1 Change prompt for 1 line
29669 prompt/2 Change the prompt used by read/1
29670 protocol/1 Make a log of the user interaction
29671 protocola/1 Append log of the user interaction to file
29672 protocolling/1 On what file is user interaction logged
29673
29674 public/1 Declaration that a predicate may be called
29675 put/1 Write a character
29676 put/2 Write a character on a stream
29677 put_assoc/4 Add Key-Value to association tree
29678 put_attr/3 Put attribute on a variable
29679 put_attrs/2 Set/replace all attributes on a variable
29680 put_byte/1 Write a byte
29681
29682 put_byte/2 Write a byte on a stream
29683 put_char/1 Write a character
29684 put_char/2 Write a character on a stream
29685 put_code/1 Write a character-code
29686 put_code/2 Write a character-code on a stream
29687 put_dict/3 Add/replace multiple keys in a dict
29688 put_dict/4 Add/replace a single key in a dict
29689 qcompile/1 Compile source to Quick Load File
29690
29691 qcompile/2 Compile source to Quick Load File
29692 qsave_program/1 Create runtime application
29693 qsave_program/2 Create runtime application
29694 quasi_quotation_syntax/1 Declare quasi quotation syntax
29695 quasi_quotation_syntax_error/1 Raise syntax error
29696 random_property/1 Query properties of random generation
29697 rational/1 Type check for a rational number
29698
29699 rational/3 Decompose a rational
29700 read/1 Read Prolog term
29701 read/2 Read Prolog term from stream
29702 read_clause/3 Read clause from stream
29703 read_history/6 Read using history substitution
29704 read_link/3 Read a symbolic link
29705 read_pending_input/3 Fetch buffered input from a stream
29706 read_string/3 Read a number of characters into a string
29707
29708 read_string/5 Read string upto a delimiter
29709 read_term/2 Read term with options
29710 read_term/3 Read term with options from stream
29711 read_term_from_atom/3 Read term with options from atom
29712 recorda/2 Record term in the database (first)
29713 recorda/3 Record term in the database (first)
29714 recorded/2 Obtain term from the database
29715
29716 recorded/3 Obtain term from the database
29717 recordz/2 Record term in the database (last)
29718 recordz/3 Record term in the database (last)
29719 redefine_system_predicate/1 Abolish system definition
29720 reexport/1 Load files and re-export the imported predicates
29721 reexport/2 Load predicates from a file and re-export it
29722 reload_foreign_libraries/0 Reload DLLs/shared objects
29723 reload_library_index/0 Force reloading the autoload index
29724
29725 rename_file/2 Change name of file
29726 repeat/0 Succeed, leaving infinite backtrack points
29727 require/1 This file requires these predicates
29728 reset_gensym/1 Reset a gensym key
29729 reset_gensym/0 Reset all gensym keys
29730 reset_profiler/0 Clear statistics obtained by the profiler
29731 resource/3 Declare a program resource
29732
29733 retract/1 Remove clause from the database
29734 retractall/1 Remove unifying clauses from the database
29735 same_file/2 Succeeds if arguments refer to same file
29736 same_term/2 Test terms to be at the same address
29737 see/1 Change the current input stream
29738 seeing/1 Query the current input stream
29739 seek/4 Modify the current position in a stream
29740 seen/0 Close the current input stream
29741
29742 select_dict/2 Select matching attributes from a dict
29743 select_dict/3 Select matching attributes from a dict
29744 set_end_of_stream/1 Set physical end of an open file
29745 set_input/1 Set current input stream from a stream
29746 set_locale/1 Set the default local
29747 set_module/1 Set properties of a module
29748 set_output/1 Set current output stream from a stream
29749
29750 set_prolog_IO/3 Prepare streams for interactive session
29751 set_prolog_flag/2 Define a system feature
29752 set_prolog_stack/2 Modify stack characteristics
29753 set_random/1 Control random number generation
29754 set_stream/2 Set stream attribute
29755 set_stream_position/2 Seek stream to position
29756 setup_call_cleanup/3 Undo side-effects safely
29757 setup_call_catcher_cleanup/4 Undo side-effects safely
29758
29759 setarg/3 Destructive assignment on term
29760 setenv/2 Set shell environment variable
29761 setlocale/3 Set/query C-library regional information
29762 setof/3 Find all unique solutions to a goal
29763 shell/0 Execute interactive subshell
29764 shell/1 Execute OS command
29765 shell/2 Execute OS command
29766
29767 show_profile/1 Show results of the profiler
29768 size_file/2 Get size of a file in characters
29769 size_nb_set/2 Determine size of non-backtrackable set
29770 skip/1 Skip to character in current input
29771 skip/2 Skip to character on stream
29772 rl_add_history/1 Add line to readline(3) history
29773 rl_read_history/1 Read readline(3) history
29774 rl_read_init_file/1 Read readline(3) init file
29775
29776 rl_write_history/1 Write readline(3) history
29777 sleep/1 Suspend execution for specified time
29778 sort/2 Sort elements in a list
29779 sort/4 Sort elements in a list
29780 source_exports/2 Check whether source exports a predicate
29781 source_file/1 Examine currently loaded source files
29782 source_file/2 Obtain source file of predicate
29783
29784 source_file_property/2 Information about loaded files
29785 source_location/2 Location of last read term
29786 split_string/4 Break a string into substrings
29787 spy/1 Force tracer on specified predicate
29788 stamp_date_time/3 Convert time-stamp to date structure
29789 statistics/0 Show execution statistics
29790 statistics/2 Obtain collected statistics
29791 stream_pair/3 Create/examine a bi-directional stream
29792
29793 stream_position_data/3 Access fields from stream position
29794 stream_property/2 Get stream properties
29795 string/1 Type check for string
29796 string_concat/3 atom_concat/3 for strings
29797 string_length/2 Determine length of a string
29798 string_chars/2 Conversion between string and list of characters
29799 string_codes/2 Conversion between string and list of character codes
29800
29801 string_code/3 Get or find a character code in a string
29802 string_lower/2 Case conversion to lower case
29803 string_upper/2 Case conversion to upper case
29804 string_predicate/1 (hook) Predicate contains strings
29805 strip_module/3 Extract context module and term
29806 style_check/1 Change level of warnings
29807 sub_atom/5 Take a substring from an atom
29808 sub_atom_icasechk/3 Case insensitive substring match
29809
29810 sub_string/5 Take a substring from a string
29811 subsumes_term/2 One-sided unification test
29812 succ/2 Logical integer successor relation
29813 swritef/2 Formatted write on a string
29814 swritef/3 Formatted write on a string
29815 tab/1 Output number of spaces
29816 tab/2 Output number of spaces on a stream
29817
29818 tdebug/0 Switch all threads into debug mode
29819 tdebug/1 Switch a thread into debug mode
29820 tell/1 Change current output stream
29821 telling/1 Query current output stream
29822 term_expansion/2 (hook) Convert term before compilation
29823 term_expansion/4 (hook) Convert term before compilation
29824 term_string/2 Read/write a term from/to a string
29825 term_string/3 Read/write a term from/to a string
29826
29827 term_subsumer/3 Most specific generalization of two terms
29828 term_to_atom/2 Convert between term and atom
29829 thread_at_exit/1 Register goal to be called at exit
29830 thread_create/3 Create a new Prolog task
29831 thread_detach/1 Make thread cleanup after completion
29832 thread_exit/1 Terminate Prolog task with value
29833 thread_get_message/1 Wait for message
29834
29835 thread_get_message/2 Wait for message in a queue
29836 thread_get_message/3 Wait for message in a queue
29837 thread_initialization/1 Run action at start of thread
29838 thread_join/2 Wait for Prolog task-completion
29839 thread_local/1 Declare thread-specific clauses for a predicate
29840 thread_message_hook/3 Thread local message_hook/3
29841 thread_peek_message/1 Test for message
29842 thread_peek_message/2 Test for message in a queue
29843
29844 thread_property/2 Examine Prolog threads
29845 thread_self/1 Get identifier of current thread
29846 thread_send_message/2 Send message to another thread
29847 thread_send_message/3 Send message to another thread
29848 thread_setconcurrency/2 Number of active threads
29849 thread_signal/2 Execute goal in another thread
29850 thread_statistics/3 Get statistics of another thread
29851
29852 threads/0 List running threads
29853 throw/1 Raise an exception (see catch/3)
29854 time/1 Determine time needed to execute goal
29855 time_file/2 Get last modification time of file
29856 tmp_file/2 Create a temporary filename
29857 tmp_file_stream/3 Create a temporary file and open it
29858 tnodebug/0 Switch off debug mode in all threads
29859 tnodebug/1 Switch off debug mode in a thread
29860
29861 told/0 Close current output
29862 tprofile/1 Profile a thread for some period
29863 trace/0 Start the tracer
29864 trace/1 Set trace point on predicate
29865 trace/2 Set/Clear trace point on ports
29866 tracing/0 Query status of the tracer
29867 trim_stacks/0 Release unused memory resources
29868
29869 true/0 Succeed
29870 tspy/1 Set spy point and enable debugging in all threads
29871 tspy/2 Set spy point and enable debugging in a thread
29872 tty_get_capability/3 Get terminal parameter
29873 tty_goto/2 Goto position on screen
29874 tty_put/2 Write control string to terminal
29875 tty_size/2 Get row/column size of the terminal
29876 ttyflush/0 Flush output on terminal
29877
29878 unify_with_occurs_check/2 Logically sound unification
29879 unifiable/3 Determining binding required for unification
29880 unix/1 OS interaction
29881 unknown/2 Trap undefined predicates
29882 unload_file/1 Unload a source file
29883 unload_foreign_library/1 shlib Detach shared library (.so file)
29884 unload_foreign_library/2 shlib Detach shared library (.so file)
29885
29886 unsetenv/1 Delete shell environment variable
29887 upcase_atom/2 Convert atom to upper-case
29888 use_foreign_library/1 Load DLL/shared object (directive)
29889 use_foreign_library/2 Load DLL/shared object (directive)
29890 use_module/1 Import a module
29891 use_module/2 Import predicates from a module
29892 valid_string_goal/1 (hook) Goal handles strings
29893 var/1 Type check for unbound variable
29894
29895 var_number/2 Check that var is numbered by numbervars
29896 var_property/2 Variable properties during macro expansion
29897 variant_sha1/2 Term-hash for term-variants
29898 version/0 Print system banner message
29899 version/1 Add messages to the system banner
29900 visible/1 Ports that are visible in the tracer
29901 volatile/1 Predicates that are not saved
29902
29903 wait_for_input/3 Wait for input with optional timeout
29904 when/2 Execute goal when condition becomes true
29905 wildcard_match/2 Csh(1) style wildcard match
29906 win_add_dll_directory/1 Add directory to DLL search path
29907 win_add_dll_directory/2 Add directory to DLL search path
29908 win_remove_dll_directory/1 Remove directory from DLL search path
29909 win_exec/2 Win32: spawn Windows task
29910 win_has_menu/0 Win32: true if console menu is available
29911
29912 win_folder/2 Win32: get special folder by CSIDL
29913 win_insert_menu/2 swipl-win.exe: add menu
29914 win_insert_menu_item/4 swipl-win.exe: add item to menu
29915 win_shell/2 Win32: open document through Shell
29916 win_shell/3 Win32: open document through Shell
29917 win_registry_get_value/3 Win32: get registry value
29918 win_window_pos/1 Win32: change size and position of window
29919
29920 window_title/2 Win32: change title of window
29921 with_mutex/2 Run goal while holding mutex
29922 with_output_to/2 Write to strings and more
29923 with_quasi_quotation_input/3 Parse quasi quotation from stream
29924 working_directory/2 Query/change CWD
29925 write/1 Write term
29926 write/2 Write term to stream
29927 writeln/1 Write term, followed by a newline
29928
29929 writeln/2 Write term, followed by a newline to a stream
29930 write_canonical/1 Write a term with quotes, ignore operators
29931 write_canonical/2 Write a term with quotes, ignore operators on a stream
29932 write_length/3 Dermine #characters to output a term
29933 write_term/2 Write term with options
29934 write_term/3 Write term with options to stream
29935 writef/1 Formatted write
29936
29937 writef/2 Formatted write on stream
29938 writeq/1 Write term, insert quotes
29939 writeq/2 Write term, insert quotes on stream
2980629940
2980729941
2980829942 1177..22 LLiibbrraarryy pprreeddiiccaatteess
3000030134 opt_help/2 True when Help is a help string synthesized from OptsSpec.
3000130135 opt_parse/4 Equivalent to opt_parse(OptsSpec, ApplArgs, Opts, PositionalArgs, []).
3000230136 opt_parse/5 Parse the arguments Args (as list of atoms) according to OptsSpec.
30137 parse_type/3 Hook to parse option text Codes to an object of type Type.
3000330138
3000430139
3000530140 1177..22..1144 lliibbrraarryy((oorrddsseettss))
3036730502
3036830503 floor/1 Largest integer below argument
3036930504 gcd/2 Greatest common divisor
30505 getbit/2 Get bit at index from large integer
3037030506 integer/1 Round to nearest integer
3037130507 lgamma/1 Log of gamma function
3037230508 log/1 Natural logarithm
3037330509 log10/1 10 base logarithm
30510
3037430511 lsb/1 Least significant bit
30375
3037630512 max/2 Maximum of two numbers
3037730513 min/2 Minimum of two numbers
3037830514 msb/1 Most significant bit
3038030516 powm/3 Integer exponent and modulo
3038130517 random/1 Generate random number
3038230518 random_float/0 Generate random number
30519
3038330520 rational/1 Convert to rational number
30384
3038530521 rationalize/1 Convert to rational number
3038630522 rdiv/2 Ration number division
3038730523 rem/2 Remainder of division
3038830524 round/1 Round to nearest integer
3038930525 truncate/1 Truncate float to integer
3039030526 pi/0 Mathematical constant
30527
3039130528 popcount/1 Count 1s in a bitvector
30392
3039330529 sign/1 Extract sign of value
3039430530 sin/1 Sine
3039530531 sinh/1 Hyperbolic sine
3056030696 _l_o_g. MIT Press, Cambridge, Massachusetts,
3056130697 1986.
3056230698
30563 1798
30699 1804
3056430700
3056530701
3056630702 Index
3056730703
30568 ( _l_i_b_r_a_r_y, 965 PL_is_atomic(), 1032
30569 -lswipl _l_i_b_r_a_r_y, 1243 PL_is_blob(), 1155
30570 .pl, 79 PL_is_callable(), 1027
30571 .pro, 79 PL_is_compound(), 1028
30572 ?=/2, 211 PL_is_float(), 1026
30573 @/2, 810 PL_is_functor(), 1029
30574 =:=/2, 483 PL_is_ground(), 1022
30575 /\/2, 522 PL_is_initialised(), 1236
30576 =\=/2, 482 PL_is_integer(), 1025
30577 |/2, 220 PL_is_list(), 1030
30578 #/\/2, 1394 PL_is_number(), 1033
30579 #=/2, 1386 PL_is_pair(), 1031
30580 #<==>/2, 1391 PL_is_string(), 1024
30581 #>=/2, 1384 PL_is_variable(), 1021
30582 #>/2, 1388 PL_license(), 1755
30583 #=</2, 1385 PL_LIST, 1079
30584 #</2, 1389 PL_malloc(), 1249
30585 #\=/2, 1387 PL_malloc_atomic(), 1253
30586 #\/1, 1390 PL_malloc_atomic_uncollectable(),
30587 #\/2, 1396 1255
30588 ,/2, 218 PL_malloc_stubborn(), 1256
30589 #\//2, 1395 PL_malloc_uncollectable(), 1254
30590 {}/1, 1419 PL_module_name(), 1185
30591 !/0, 217 PL_new_atom(), 1008
30592 /, 80 PL_new_atom_nchars(), 1066
30593 //2, 493 PL_new_atom_wchars(), 1069
30594 ./2, 505 PL_new_functor(), 1012
30595 ./3, 765 PL_new_module(), 1186
30596 =/2, 194 PL_new_term_ref(), 991
30597 ==/2, 197 PL_new_term_refs(), 992
30598 >=/2, 481 PL_next_solution(), 1172
30599 >/2, 478 PL_NOT_A_LIST, 1079
30600 ^/2, 544 PL_on_halt(), 1229
30601 ///2, 496 PL_open_foreign_frame(), 1178
30602 ->/2, 221 PL_open_query(), 1171
30603 =</2, 480 PL_PARTIAL_LIST, 1079
30604 #<==/2, 1393 PL_permission_error(), 1144
30605 <</2, 520 PL_pred(), 1167
30606 </2, 479 PL_predicate(), 1168
30607 >:</2, 783 PL_predicate_info(), 1169
30608 :</2, 781 PL_put_atom(), 1083
30609 -/1, 488 PL_put_atom_chars(), 1085
30610 -/2, 491 PL_put_atom_nchars(), 1058
30611 \=/2, 195 PL_put_blob(), 1157
30612 \/1, 524 PL_put_bool(), 1084
30613 \==/2, 198 PL_put_float(), 1092
30614 \+/1, 223 PL_put_functor(), 1093
30615 \//2, 521 PL_put_int64(), 1090
30616 +/1, 489 PL_put_integer(), 1089
30617 +/2, 490 PL_put_list(), 1094
30618 **/2, 543 PL_put_list_chars(), 1088
30619 #==>/2, 1392 PL_put_list_nchars(), 1061
30620 >>/2, 519 PL_put_list_ncodes(), 1060
30621 ;/2, 219 PL_put_nil(), 1095
30622 *->/2, 222 PL_put_pointer(), 1091
30623 =@=/2, 206 PL_put_string_chars(), 1086
30624 \=@=/2, 207 PL_put_string_nchars(), 1059, 1087
30625 @>=/2, 202 PL_put_term(), 1096
30626 @>/2, 201 PL_put_variable(), 1082
30627 */2, 492 PL_query(), 1219
30628 @=</2, 200 PL_quote(), 1121
30629 @</2, 199 PL_raise(), 1194
30630 =../2, 416 PL_raise_exception(), 1188
30631 \, 80 PL_realloc(), 1250
30632 _PL_get_arg(), 1053 PL_record(), 1202
30633 64-bits PL_record_external(), 1205
30634 platforms, 73 PL_recorded(), 1203
30635
30636 abolish/1, 262, 263 PL_recorded_external(),P1206L_register_atom(), 1016
30637 abolish/2, 263 PL_register_extensions(), 1224
30638 abolish/[1 PL_register_extensions_in_module(),
30639 2], 41 1223
30640 abort/0, 20, 32, 239, 311, 316, PL_register_foreign(), 1222
30641 323, 660, 885, 1216, 1227, PL_register_foreign_in_module(), 1221
30642 1720 PL_representation_error(), 1140
30643 abs/1, 500 PL_reset_term_refs(), 994
30644 absolute_file_name/2, 7, 113, 125, PL_resource_error(), 1145
30645 644, 646, 656, 1271 PL_retry(), 1002
30646 absolute_file_name/3, 41, 44, 104, PL_retry_address(), 1003
30647 111, 122, 128, 612, 644, PL_rewind_foreign_frame(), 1181
30648 645, 1208, 1209, 1631, 1632 PL_same_compound(), 1200
30649 absolute_file_name/[2 PL_set_engine(), 964
30650 3], 41, 121, 645 PL_set_prolog_flag(), 1212
30651 access_file/2, 41, 634, 645 PL_signal(), 1193
30652 acos/1, 530 PL_skip_list(), 1079
30653 acosh/1, 538 PL_strip_module(), 1184
30654 acquire(), 1149 PL_succeed(), 999
30655 acyclic_term/1, 60, 191, 192, 205 PL_syntax_error(), 1146
30656 add_edges/3, 1679 PL_term_type(), 1020
30657 add_import_module/3, 818, 820, 835 PL_thread_at_exit(), 960
30658 add_nb_set/2, 1497 PL_thread_attach_engine(), 958
30659 add_nb_set/3, 1497--1499 PL_thread_destroy_engine(), 959
30660 add_vertices/3, 1677 PL_thread_self(), 956
30661 agent, 1318 PL_throw(), 1189
30662 aggregate/3, 807, 1278 PL_toplevel(), 1238
30663 aggregate/4, 807, 1279 PL_type_error(), 1141
30664 aggregate_all/3, 1280 PL_unify(), 1101
30665 aggregate_all/4, 1281 PL_unify_arg(), 1117
30666 all_different/1, 1380 PL_unify_atom(), 1102
30667 all_distinct/1, 1381 PL_unify_atom_chars(), 1105
30668 AMD64, 74 PL_unify_atom_nchars(), 1062
30669 anonymous PL_unify_blob(), 1156
30670 variable, 59 PL_unify_bool(), 1103
30671 anonymous variable, 1746 PL_unify_bool_ex(), 1137
30672 ansi_format/3, 247 PL_unify_chars(), 1104
30673 ansi_term _l_i_b_r_a_r_y, 41, 244, 248 PL_unify_compound(), 1114
30674 append/1, 325, 329 PL_unify_float(), 1111
30675 append/2, 805, 1465 PL_unify_functor(), 1113
30676 append/3, 306, 441, 1464 PL_unify_int64(), 1110
30677 apply/2, 227 PL_unify_integer(), 1109
30678 apply_macros _l_i_b_r_a_r_y, 259 PL_unify_list(), 1115
30679 apropos/1, 26, 27, 44, 1732, 1759 PL_unify_list_chars(), 1106
30680 arg/3, 415 PL_unify_list_ex(), 1135
30681 arithmetic_function/1, 1187 PL_unify_list_nchars(), 1065
30682 arity, 1746 PL_unify_list_ncodes(), 1064
30683 asin/1, 529 PL_unify_mpq(), 1164
30684 asinh/1, 537 PL_unify_mpz(), 1163
30685 assert, 1746 PL_unify_nil(), 1116
30686 assert/1, 111, 261, 268, 270, 283, PL_unify_nil_ex(), 1136
30687 289, 290, 302, 798, 806, PL_unify_pointer(), 1112
30688 836, 862, 929 PL_unify_string_chars(), 1107
30689 assert/2, 41, 273, 280, 305 PL_unify_string_nchars(), 1063, 1108
30690 assert_predicate_options/4, 1568 PL_unify_term(), 1118
30691 asserta/1, 18, 60, 61, 120, 206, PL_unify_thread_id(), 957
30692 268, 269, 271, 272, 808, PL_unify_wchars(), 1072
30693 810, 1746 PL_unify_wchars_diff(), 1073
30694 asserta/2, 271, 280 PL_uninstantiation_error(), 1139
30695 assertion/1, 1452, 1724 PL_unregister_atom(), 1017
30696 assertz/1, 120, 264, 269, 270, 302, PL_unregister_blob_type(), 1153
30697 307, 834, 1746 PL_warning(), 1214
30698 assertz/2, 272, 273, 280 PL_wchars_to_term(), 1120
30699 assignment/2, 1645 plus/3, 476
30700 assoc _l_i_b_r_a_r_y, 771, 788, 789, 1302, PLVERSION, 1258
30701 1495 popcount/1, 556
30702 assoc_to_keys/2, 1304 portable
30703 assoc_to_list/2, 1303 prolog code, 1741
30704 assoc_to_values/2, 1305 portray/1, 32, 82, 390, 401, 403,
30705 at_end_of_stream/0, 383 1171, 1232, 1730
30706 at_end_of_stream/1, 384, 388 portray_clause/1, 172, 174, 175
30707 at_end_of_stream/[0 portray_clause/2, 174, 175, 420
30708 1], 316, 1627 portray_text _l_i_b_r_a_r_y, 401
30709 at_halt/1, 41, 130, 131, 662, 907, portray_text/1, 259, 758
30710 1229, 1239, 1739, 1759 powm/3, 545
30711 atan/1, 531 precedence, 1746
30712 atan/2, 533 pred/1, 813
30713 atan2/2, 532 predicate, 1746
30714 atanh/1, 539 dynamic, 1746
30715 atom, 1746 exported, 1746
30716 atom/1, 184, 187, 1018 imported, 1746
30717 atom_chars/2, 110, 340, 367, 431, predicate indicator, 109, 1746
30718 433, 435, 457, 797 predicate_options/3, 1567
30719 atom_codes/2, 110, 340, 431--433, predicate_property/2, 116, 226,
30720 437, 438, 457, 797 293, 300, 302, 807, 833
30721 atom_concat/3, 441, 743 predsort/3, 566, 569
30722 ATOM_dot(), 1010 prefix/2, 1466
30723 atom_length/2, 41, 445, 740 print/1, 41, 390, 401, 403, 582,
30724 ATOM_nil(), 1009 587, 1171, 1759
30725 atom_number/2, 340, 437, 438 print/2, 41, 402
30726 atom_prefix/2, 446 print_message/2, 41, 44, 113, 130,
30727 atom_result/2, 827 242--245, 252, 401, 407,
30728 atom_string/2, 733 709, 901, 903, 1759
30729 atom_to_chars/2, 1332 print_message_lines/3, 243--245,
30730 atom_to_chars/3, 1333 248, 252, 1759
30731 atom_to_term/3, 409, 440 priority, 1746
30732 atomic/1, 187 process _l_i_b_r_a_r_y, 311, 598
30733 atomic_concat/3, 441, 442 process_create/3, 311, 598, 606
30734 atomic_list_concat/2, 437, 443, 444 profile file, 14
30735 atomic_list_concat/3, 444 profile/1, 696, 952, 1240
30736 atomics_to_string/2, 746, 747 profile/3, 697
30737 atomics_to_string/3, 747 profiler/2, 699
30738 attach_console/0, 943--945, 1216 profiling
30739 attr_portray_hook/2, 390, 845 foreign code, 1259
30740 attr_unify_hook/2, 837, 844 program, 1746
30741 attribute_goals//1, 845, 849 project_attributes/+QueryVars
30742 attribute_goals/1, 846 +ResidualVars, 847
30743 attribute_goals/3, 837 project_attributes/2, 847
30744 attvar/1, 839 prolog/0, 20, 324, 659, 663, 664,
30745 autoload/0, 49, 117, 1263, 1265 812, 1238, 1716
30746 autoload_path/1, 46 prolog/assertion_failed, 1453
30747 automaton/3, 1407 prolog/debug_print_hook, 1451
30748 automaton/8, 1408 prolog:break_hook/6, 1724
30749
30750 b_getval/2, 864, 866 prolog:called_by/2,p1602rolog:comment_hook/3, 1735
30751 b_linkarg/3, 787 prolog:debug_control_hook/1, 1731
30752 b_set_dict/3, 785 prolog:help_hook/1, 1732
30753 b_setval/2, 785, 862, 863, 1728 prolog:message_line_element/2, 248
30754 backtracking, 1746 prolog_breakpoints _l_i_b_r_a_r_y, 1723
30755 bagof/3, 60, 571, 575, 576, 807, prolog_choice_attribute/3, 1713,
30756 1759 1715, 1720
30757 bb_inf/3, 1427 prolog_codewalk _l_i_b_r_a_r_y, 302
30758 bb_inf/4, 1426 prolog_current_choice/1, 1713, 1715,
30759 bb_inf/5, 1425 1718
30760 between/3, 474 prolog_current_frame/1, 1712, 1714
30761 binding, 1746 prolog_cut_to/1, 1718
30762 bits prolog_edit:edit_command/2, 169
30763 64, 72 prolog_edit:edit_source/1, 168
30764 blackboard, 1318 prolog_edit:load/0, 170
30765 blob/2, 185, 187, 310 prolog_edit:locate/2, 167
30766 body, 1746 prolog_edit:locate/3, 166
30767 Boehm GC, 1252 prolog_exception_hook/4, 240, 709,
30768 BOM, 66 1725, 1726
30769 break/0, 20, 32, 41, 659, 885, 1216 prolog_file_type/2, 111, 123, 645
30770 broadcast, 1318 prolog_frame_attribute/3, 307, 1714,
30771 broadcast _l_i_b_r_a_r_y, 1318 1720, 1726
30772 broadcast/1, 1319, 1320 prolog_ide _c_l_a_s_s, 106
30773 broadcast_request/1, 1320 prolog_ide/1, 105, 106
30774 built-in predicate, 1746 prolog_list_goal/1, 1730
30775 Byte Order Mark, 66 prolog_load_context/2, 128, 129,
30776 byte_count/2, 321, 343 406, 1742
30777 call/1, 103, 189, 217, 225, 238, prolog_load_file/2, 113, 1733, 1734
30778 679, 693, 701, 703, 798, prolog_server _l_i_b_r_a_r_y, 309, 324
30779 857, 1165, 1724 prolog_skip_frame/1, 1721, 1722
30780 call/2, 189, 226 prolog_skip_level/2, 1721, 1722
30781 call/3, 390 prolog_stack _l_i_b_r_a_r_y, 1714, 1726
30782 call/[2-8], 226 prolog_stack_property/2, 709, 710
30783 call_cleanup/2, 233, 235, 236, 340, prolog_to_os_filename/2, 80, 612,
30784 1716, 1745 636, 646, 650
30785 call_cleanup/3, 236 prolog_trace_interception/4, 95,
30786 call_dcg/3, 259, 260 675, 709, 1714, 1715, 1720
30787 call_residue_vars/2, 861 prolog_xref _l_i_b_r_a_r_y, 103, 799
30788 call_shared_object_function/2, 987 prompt
30789 call_with_depth_limit/3, 231, 232 alternatives, 41
30790 call_with_inference_limit/3, 231,prompt/2, 410--412, 901
30791 232 prompt1/1, 412
30792 call_with_time_limit/2, 232, 233 proper_length/2, 1478
30793 callable/1, 189, 1027, 1592 property, 1746
30794 cancel_halt/1, 130, 131, 662, 1239 protocol/1, 667, 668, 670
30795 catch/3, 237--240, 407, 660, 701, protocola/1, 668, 670
30796 901, 909, 910, 1715, 1726-- protocolling/1, 670
30797 1728, 1759 prove, 1746
30798 ceil/1, 518 public list, 1746
30799 ceiling/1, 517 public/1, 288, 293, 302, 1265
30800 chain/2, 1411 put/1, 350, 351, 769
30801 char_code/2, 110, 434 put/2, 351, 770
30802 char_conversion/2, 41, 470, 471 put_assoc/4, 1316
30803 char_type/2, 58, 449, 456--459 put_attr/3, 839, 840, 844, 852
30804 character set, 53 put_attrs/2, 854
30805 character_count/2, 321, 343, 344 put_byte/1, 352
30806 chdir/1, 656, 657 put_byte/2, 353
30807 check _l_i_b_r_a_r_y, 119, 302 put_byte/[1
30808 check/0, 117, 1343 2], 110
30809 check:string_predicate/1, 756 put_char/1, 350, 354, 356
30810 check:valid_string_goal/1, 757 put_char/2, 355
30811 check_predicate_option/3, 1570 put_char/[1
30812 check_predicate_options/0, 1573 2], 110
30813 checker/2, 1356 put_code/1, 350, 356, 357
30814 choice point, 1746 put_code/2, 65, 357, 386, 388
30815 chr _l_i_b_r_a_r_y, 882, 886 put_code/[1
30816 chr_constraint/1, 880, 894 2], 110
30817 chr_leash/1, 889 put_dict/3, 769, 778
30818 chr_notrace/0, 885, 888 put_dict/4, 770, 779
30819 chr_option/2, 876, 894 qcompile/1, 4, 113, 134, 159--161,
30820 chr_show_store/1, 890 896
30821 chr_trace/0, 885, 887 qcompile/2, 161
30822 chr_type/1, 881 qsave_program/1, 41, 132, 1264
30823 circuit/1, 1403 qsave_program/2, 4, 39, 41, 49, 82,
30824 clause, 1746 105, 1262, 1263, 1269
30825 clause/2, 172, 304, 305, 1265 qsave_program/[1
30826 clause/3, 271, 280, 305, 307, 1267 2], 18, 38, 41, 302, 973, 1235,
30827 clause/[2 1245, 1265, 1267
30828 3], 41 quasi_quotation_syntax/1, 302, 1606
30829 clause_property/2, 116, 125, 302, quasi_quotation_syntax_error/1, 1607
30830 307, 1714 query, 1746
30831 close/1, 308, 314, 319 quiet, 18
30832 close/2, 315
30833 close_any/1, 1460 random _l_i_b_r_a_r_y, 558
30834 close_dde_conversation/1, 714 random/1, 506, 1609
30835 close_shared_object/1, 986 random/3, 1611, 1612
30836 clpfd _l_i_b_r_a_r_y, 816 random_between/3, 1610
30837 clpqr _l_i_b_r_a_r_y, 1417 random_float/0, 507
30838 code_type/2, 449, 455, 457, 458 random_member/2, 1619
30839 collate, 463 random_perm2/4, 1618
30840 collation_key/2, 449, 464, 465, 604 random_permutation/2, 1624, 1625
30841 COM, 1147 random_property/1, 558, 559
30842 command line random_select/3, 1620, 1621
30843 arguments, 18 randseq/3, 1623
30844 compare randset/3, 1622
30845 language-specific, 463 rational
30846 compare(), 1151 number, 485
30847 compare/3, 60, 203, 569, 1199, 1745 rational trees, 60
30848 compile_aux_clauses/1, 111, 140 rational/1, 181, 511
30849 compile_predicates/1, 289, 290 rational/3, 182, 485
30850 compiling/0, 134, 160 rationalize/1, 512
30851 complement/2, 1684 rb_new/1, 41
30852 completion rbtrees _l_i_b_r_a_r_y, 41
30853 TAB, 86 RDF
30854 compose/3, 1685 memory usage, 75
30855 compound, 1746 rdiv/2, 498
30856 compound/1, 188 reachable/3, 1690
30857 compound_name_arguments/3, 188, 416- read/1, 41, 70, 309--311, 360, 397,
30858 -418, 761, 764 404, 407, 411, 689, 870,
30859 compound_name_arity/3, 188, 414, 1632, 1759
30860 417, 418, 761, 764 read/2, 342, 405
30861 concat_atom/3, 444 read_clause/3, 59, 406, 689
30862 constraint/3, 1646, 1647 read_file_to_codes/3, 1631
30863 constraint/4, 1647 read_file_to_terms/3, 1632
30864 constraint_add/4, 1648 read_from_chars/2, 1336
30865 consult/1, 11, 14, 44, 94, 111- read_history/6, 410
30866 -116, 119, 156, 159, 160, read_line_to_codes/2, 753, 1627,
30867 291 1628
30868 context module, 1746 read_line_to_codes/3, 1627, 1628
30869 context_module/1, 807, 829, 1171 read_link/3, 651
30870 convert_time/2, 41 read_pending_input/3, 388
30871 convert_time/[2 read_stream_to_codes/2, 1629, 1630
30872 8], 643 read_stream_to_codes/3, 1630
30873 copy_file/2, 598 read_string/3, 750
30874 copy_predicate_clauses/2, 264 read_string/5, 744, 751
30875 copy_stream_data/2, 387, 388 read_term/2, 41, 128, 148, 390,
30876 copy_stream_data/3, 322, 386 407, 408, 410, 440, 729,
30877 copy_term/2, 60, 206, 424, 426, 736, 1735
30878 429, 784, 836, 850, 864 read_term/3, 59, 390, 406--409,
30879 copy_term/3, 390, 845, 846, 849 470, 664, 788, 1735
30880 copy_term_nat/2, 850 read_term/[2
30881 copysign/1, 502 3], 407
30882 cos/1, 527 read_term_from_atom/3, 409, 440
30883 cosh/1, 535 read_term_from_chars/3, 1337
30884 count_atom_results/3, 827 readutil _l_i_b_r_a_r_y, 84
30885 cputime/0, 552 reconsult, 111
30886 create_pool/1, 1672 record _l_i_b_r_a_r_y, 788, 789, 1633
30887 create_prolog_flag/3, 41--43, 1211 record/1, 1633, 1634
30888 crypt _l_i_b_r_a_r_y, 1757 recorda/2, 275
30889 csv//1, 1436 recorda/3, 60, 274, 276, 280, 299,
30890 csv//2, 1437 862, 1201, 1202, 1205
30891 csv_read_file/2, 566, 1434 recorded/2, 279
30892 csv_read_file/3, 1435 recorded/3, 278, 280, 1267
30893 csv_read_file_row/3, 1438 recordz/2, 277
30894 csv_write_file/2, 1439 recordz/3, 60, 276, 280
30895 csv_write_file/3, 1440 redefine_system_predicate/1, 265,
30896 csv_write_stream/3, 1441 1746
30897 ctype _l_i_b_r_a_r_y, 455 reexport/1, 111, 113, 814, 1741
30898 cumulative/1, 1404 reexport/2, 111, 113, 815, 1741
30899 cumulative/2, 1405 registry, 68
30900 current_arithmetic_function/1, 560 registry _l_i_b_r_a_r_y, 1635
30901 current_atom/1, 295 registry_delete_key/1, 1640
30902 current_blob/2, 296, 1148 registry_get_key/2, 1636
30903 current_char_conversion/2, 470, 471 registry_get_key/3, 1637
30904 current_flag/1, 298 registry_set_key/2, 1638
30905 current_foreign_library/2, 981, 1263 registry_set_key/3, 1639
30906 current_format_predicate/2, 591 release(), 1150
30907 current_functor/2, 297 reload_foreign_libraries/0, 982
30908 current_input/1, 128, 309, 330, 337 reload_library_index/0, 45, 46, 49
30909 current_key/1, 278, 299 rem/2, 495
30910 current_locale/1, 454 rename_file/2, 598, 641
30911 current_module/1, 300, 832 repeat/0, 212, 216, 231, 233
30912 current_op/3, 468 representation_error/1, 1140
30913 current_option_arg/2, 1571 require/1, 117, 1741
30914 current_output/1, 309, 331, 338 reset_gensym/0, 1457
30915 current_persistent_predicate/1, 1548 reset_gensym/1, 1456
30916 current_predicate/1, 226, 300--302 reset_profiler/0, 700
30917 current_predicate/2, 300, 301 resource/3, 41, 1262, 1263, 1269,
30918 current_predicate_option/3, 1569 1271, 1272
30919 current_predicate_options/3, 1572 resource_error/1, 1145
30920 current_prolog_flag/2, 18, 40, 41, retract, 1746
30921 45, 50, 55, 113, 407, 719, retract/1, 111, 120, 261, 262, 266,
30922 972, 1276, 1746 283, 289, 290, 302, 929
30923 current_signal/3, 254, 255 retract/2, 836
30924 current_stream/3, 317 retractall/1, 261, 262, 267
30925 current_thread_pool/1, 1669 retractall_predicate_options/0, 1575
30926 cyclic terms, 60 rev/3, 800
30927 cyclic_term/1, 60, 191, 192 reverse/2, 260, 800, 1480
30928
30929 daemon, 1318 rl_add_history/1,r1738l_read_history/1, 1740
30930 date_time_stamp/2, 620 rl_read_init_file/1, 1737
30931 date_time_value/3, 616, 621 rl_write_history/1, 1739
30932 day_of_the_week/2, 626 round/1, 508
30933 db_attach/2, 1549
30934 db_sync/1, 1550 same_file/2, 636, 638
30935 db_sync_all/1, 1551 same_length/2, 1479
30936 DCG, 111, 257 same_term/2, 430
30937 dcg_translate_rule/2, 137, 141 sandbox/safe_meta, 1284
30938 dcg_translate_rule/4, 148 sat/1, 1362
30939 dde_current_connection/2, 722 sat_count/2, 1365
30940 dde_current_service/2, 721 scalar_product/4, 1383
30941 dde_execute/2, 716 scanl/4, 1298
30942 dde_poke/4, 717 scanl/5, 1299
30943 dde_register_service/2, 719 scanl/6, 1300
30944 dde_request/3, 715 scanl/7, 1301
30945 dde_unregister_service/1, 720 see/1, 308, 309, 325--327
30946 debug _l_i_b_r_a_r_y, 106 seeing/1, 325, 326, 330
30947 debug/0, 32, 41, 240, 678, 680, seek/4, 316, 320, 322
30948 681, 709, 946, 1216, 1724, seen/0, 332
30949 1726 select(), 342
30950 debug/1, 1446 select/3, 1467
30951 debug/3, 243, 1450 select/4, 1469
30952 debug_message_context/1, 1449 select_dict/2, 782
30953 debugging select_dict/3, 782, 783
30954 exceptions, 240 select_option/3, 1507
30955 debugging/0, 44, 678, 682, 1731 select_option/4, 1508
30956 debugging/1, 1443, 1444 selectchk/3, 1468
30957 debugging/2, 1445 selectchk/4, 1470
30958 default_module/2, 302, 818, 819 semi deterministic, 1746
30959 del_attr/2, 842, 852 semidet, 1746
30960 del_attrs/1, 855 serialize, 257
30961 del_dict/4, 780 serialized/2, 1399
30962 del_edges/3, 1680 set_breakpoint/4, 1724
30963 del_vertices/3, 1678 set_end_of_stream/1, 385
30964 delete/3, 1472 set_input/1, 309, 323, 327, 335
30965 delete_directory/1, 655 set_locale/1, 453
30966 delete_file/1, 598, 640, 653 set_module/1, 268, 817, 833, 834
30967 delete_import_module/2, 818, 820, set_output/1, 309, 328, 336
30968 821, 835 set_prolog_flag/2, 30, 40--43, 111,
30969 derive_predicate_options/0, 1574 477, 1211
30970 derived_predicate_options/1, 1577 set_prolog_IO/3, 309, 324
30971 derived_predicate_options/3, 1576 set_prolog_stack/2, 19, 68, 680,
30972 deserialize, 257 709, 710, 731, 901
30973 det, 1746 set_random/1, 506, 558, 559
30974 deterministic, 1746 set_stream/2, 65, 309, 311, 316,
30975 deterministic/1, 233, 1716 323, 324, 342, 378, 453
30976 Development environment, 76 set_stream_position/2, 316, 320, 322
30977 dialect.pl _l_i_b_r_a_r_y, 1741 set_url_encoding/2, 1699
30978 dict_create/3, 776, 778 setarg/3, 109, 424, 426, 427, 429,
30979 dict_options/2, 1511 430, 785, 840, 870, 1633
30980 dict_pairs/2, 788 setenv/2, 602
30981 dict_pairs/3, 777 setlocale/1, 901
30982 dif _l_i_b_r_a_r_y, 860 setlocale/3, 465, 604
30983 dif/2, 60, 195, 859, 860 setof/3, 60, 576, 807, 1759
30984 directory_file_path/3, 636 setrand/1, 1613
30985 directory_files/2, 648 setup_call_catcher_cleanup/4, 234
30986 discontiguous/1, 116, 243, 288, setup_call_cleanup/2, 930
30987 292, 689 setup_call_cleanup/3, 233, 235, 905,
30988 disjoint2/1, 1406 934, 935, 938
30989 display/1, 582, 1080 shadow_price/3, 1653
30990 distinct/1, 1660 shared, 1746
30991 distinct/2, 1661 shell/0, 600, 605
30992 div/2, 497 shell/1, 80, 169, 599, 605
30993 do_not_use/1, 813 shell/2, 598, 606
30994 domain/2, 837 shell/[0-2], 602
30995 domain_error/2, 1142 shell/[1
30996 downcase_atom/2, 456, 459, 460 2], 598
30997 dump/3, 1428, 1432 shell_register_dde/6, 1642
30998 duplicate_term/2, 60, 424, 427, shell_register_file_type/4, 1641,
30999 429, 865 1642
31000 dwim_match/2, 303, 724, 725 shell_register_prolog/1, 1643
31001 dwim_match/3, 725 shlib _l_i_b_r_a_r_y, 1759
31002 dwim_predicate/2, 303 show_profile/1, 697, 698
31003 dynamic predicate, 1746 sign/1, 501
31004 dynamic/1, 41, 109, 116, 261, 267, simplex _l_i_b_r_a_r_y, 1644
31005 288--290, 302, 828, 928, sin/1, 526
31006 929, 1265 singleton, 1746
31007
31008 e/0, 550 sinvariable,h59/1, 534
31009 edges/2, 1676 size_file/2, 642
31010 edit/0, 41, 164 size_nb_set/2, 1500
31011 edit/1, 41, 44, 86, 89, 94, 107, skip/1, 380, 381
31012 116, 119, 162--166, 168, skip/2, 381
31013 811, 1759 sleep/1, 727
31014 edit_source/1, 169 socket _l_i_b_r_a_r_y, 342
31015 editor _c_l_a_s_s, 85, 90 Solaris, 908
31016 element/3, 1400 solution, 1746
31017 elif/1, 151 sort/2, 232, 565--567, 569, 576
31018 else/0, 152 sort/4, 566
31019 Emacs, 23 source_exports/2, 1741, 1744
31020 emacs/[0 source_file/1, 124
31021 1], 89 source_file/2, 116, 125, 160, 302
31022 emacs/prolog_colour _l_i_b_r_a_r_y, 93 source_file_property/2, 113, 116,
31023 empty_assoc/1, 1306 126
31024 empty_nb_set/1, 1496 source_location/2, 128, 129
31025 encoding/1, 65, 118 split_string/4, 444, 744, 751
31026 endif/0, 153 spy/1, 32, 41, 44, 96, 97, 107,
31027 ensure_loaded/1, 34, 111, 115, 804 109, 683, 811, 950, 951,
31028 entailed/1, 1420 1731, 1759
31029 environment/2, 1588 sqrt/1, 525
31030 epsilon/0, 551 stack
31031 erase/1, 271, 274, 280, 305 memory management, 69
31032 erf/1, 547 stamp_date_time/3, 616, 619, 620
31033 erfc/1, 548 startup file, 14
31034 error _l_i_b_r_a_r_y, 176, 1633 statistics _l_i_b_r_a_r_y, 694
31035 eval/1, 553 statistics/0, 243, 692
31036 eval_license/0, 1751--1753 statistics/2, 552, 691, 911
31037 exception/3, 862, 1727, 1728 stream_pair/3, 310, 314, 319, 323
31038 exceptions stream_position_data/3, 128, 316,
31039 debugging, 240 321, 407, 1735
31040 exclude/3, 1287 stream_property/2, 66, 128, 311,
31041 exists_directory/1, 639 316, 320--323, 407
31042 exists_file/1, 41, 635 stream_to_lazy_list/2, 1560
31043 exists_source/1, 1741, 1743 string/1, 186, 187, 587, 732
31044 exp/1, 542 string_chars/2, 737
31045 expand_answer/2, 664, 665 string_code/3, 741, 742, 758
31046 expand_file_name/2, 41, 113, 602, string_codes/2, 738, 753
31047 605, 644, 645, 648, 649 string_concat/3, 743, 753
31048 expand_file_search_path/2, 122 string_length/2, 740
31049 expand_goal/2, 41, 135--139, 150 string_lower/2, 749
31050 expand_goal/4, 144 string_predicate/1, 1354
31051 expand_query/4, 664 string_upper/2, 748
31052 expand_term/2, 135--138, 141, 257, strip_module/3, 807, 827, 830, 835
31053 1634 structure, 1746
31054 expand_term/4, 146 style_check/1, 59, 70, 113, 292,
31055 expects_dialect/1, 113, 128, 1741, 689
31056 1742 sub_atom/5, 447, 745
31057 explain _l_i_b_r_a_r_y, 1759 sub_atom_icasechk/3, 448
31058 explain/1, 28 sub_string/5, 741, 745, 753
31059 explain/2, 29 subset/2, 1493
31060 export/1, 293, 824--826 subsumes_chk/2, 287
31061 export_list/2, 825 subsumes_term/2, 60, 204, 208
31062 exported predicate, 1746 subtract/3, 1494
31063
31064 fact, 1746 succ/2, 475
31065 fail/0, 139, 213 succeed, 1746
31066 false/0, 214 sum/3, 1382
31067 fd_dom/2, 1416 sum_list/2, 1485
31068 fd_inf/2, 1413 sup/2, 1422
31069 fd_size/2, 1415 swi/pce_profile _l_i_b_r_a_r_y, 694
31070 fd_sup/2, 1414 swi_edit _l_i_b_r_a_r_y, 170
31071 fd_var/1, 1412 swritef/2, 584
31072 file_base_name/2, 637 swritef/3, 340, 579, 583
31073 file_directory_name/2, 636, 637 syntax_error/1, 1557
31074 file_name_extension/3, 647 TAB
31075 file_name_to_url/2, 1703, 1704 completion, 86
31076 file_of_label/2, 812 tab/1, 358
31077 file_search_path/2, 14, 18, 41, 45, tab/2, 359
31078 49, 81, 104, 113, 120, 121, tan/1, 528
31079 123, 128, 1209, 1245, 1268, tanh/1, 536
31080 1271, 1274 taut/2, 1363
31081 fileerrors/2, 41 tdebug/0, 901, 947, 951
31082 filesex _l_i_b_r_a_r_y, 598, 636 tdebug/1, 946, 947, 950
31083 find_chr_constraint/1, 891 tell/1, 308, 309, 325, 326, 328,
31084 findall/3, 60, 206, 212, 571, 572, 329
31085 574, 578, 788, 836, 1759 telling/1, 325, 326, 331
31086 findall/4, 572, 574 term, 1746
31087 findnsols/4, 573 term//1, 340
31088 findnsols/5, 574 term_attvars/2, 851
31089 findsols/4, 1759 term_expansion/2, 44, 111, 134--
31090 flag/3, 282, 298, 427 138, 149, 160, 664, 882,
31091 flag:access_level, 41 1745
31092 flag:address_bits, 41 term_expansion/4, 111, 147
31093 flag:agc_margin, 41 term_hash/2, 60, 63, 284--287
31094 flag:allow_dot_in_atom, 41 term_hash/4, 63, 284, 286
31095 flag:allow_variable_name_as_functor, term_string/2, 439, 735, 736
31096 41 term_string/3, 736
31097 flag:answer_write_options, 41 term_subsumer/3, 209
31098 flag:apple, 41 term_to_atom/2, 340, 439, 1119
31099 flag:arch, 41 term_variables/2, 60, 407, 422, 423
31100 flag:argv, 41 term_variables/3, 422, 423
31101 flag:associated_file, 41 terms
31102 flag:autoload, 41 cyclic, 60
31103 flag:back_quotes, 41 text_to_string/2, 739
31104 flag:bounded, 41 thread _l_i_b_r_a_r_y, 41
31105 flag:break_level, 41 thread_at_exit/1, 662, 901, 907, 960
31106 flag:c_cc, 41 thread_create/3, 901, 904, 907, 968
31107 flag:c_cflags, 41 thread_create_in_pool/4, 901, 1671
31108 flag:c_ldflags, 41 thread_detach/1, 901, 904
31109 flag:c_libplso, 41 thread_exit/1, 903, 905, 910
31110 flag:c_libs, 41 thread_get_message/1, 917, 922
31111 flag:char_conversion, 41 thread_get_message/2, 921--923
31112 flag:character_escapes, 41 thread_get_message/3, 916, 918, 923
31113 flag:colon_sets_calling_context, 41 thread_initialization/1, 862, 906
31114 flag:color_term, 41 thread_join/2, 901, 903, 905, 910
31115 flag:compile_meta_arguments, 41 thread_local/1, 246, 289, 302, 928,
31116 flag:compiled_at, 41 929
31117 flag:console_menu, 41 thread_message_hook/3, 246
31118 flag:cpu_count, 41 thread_peek_message/1, 917, 918, 924
31119 flag:dde, 41 thread_peek_message/2, 923, 924
31120 flag:debug, 41 thread_pool_create/3, 1667
31121 flag:debug_on_error, 41 thread_pool_destroy/1, 1668
31122 flag:debugger_show_context, 41 thread_pool_property/2, 1670
31123 flag:debugger_write_options, 41 thread_property/2, 903, 904, 907,
31124 flag:dialect, 41 910
31125 flag:double_quotes, 41 thread_self/1, 41, 902, 904, 907,
31126 flag:editor, 41 915
31127 flag:emacs_inferior_process, 41 thread_send_message/2, 915, 916, 920
31128 flag:encoding, 41 thread_send_message/3, 916
31129 flag:executable, 41 thread_setconcurrency/2, 41, 908
31130 flag:exit_status, 41 thread_signal/2, 233, 927, 946,
31131 flag:file_name_variables, 41 1194, 1242
31132 flag:gc, 41 thread_statistics/3, 910, 911
31133 flag:generate_debug_info, 41 threads/0, 941
31134 flag:gmp_version, 41 throw/1, 32, 60, 237--239, 252,
31135 flag:gui, 41 256, 905, 910, 926, 927,
31136 flag:history, 41 1188, 1190, 1726--1728
31137 flag:home, 41 time/1, 552, 693
31138 flag:hwnd, 41 time_file/2, 643
31139 flag:integer_rounding_function, 41 tmp_file/2, 652, 653
31140 flag:iso, 41 tmp_file_stream/3, 652, 653
31141 flag:large_files, 41 tnodebug/0, 949
31142 flag:last_call_optimisation, 41 tnodebug/1, 948, 951
31143 flag:max_arity, 41 told/0, 333
31144 flag:max_integer, 41 top_sort/2, 1687
31145 flag:max_tagged_integer, 41 top_sort/3, 1688
31146 flag:min_integer, 41 tprofile/1, 952, 953
31147 flag:min_tagged_integer, 41 trace/0, 32, 41, 96, 97, 107, 672,
31148 flag:occurs_check, 41 678, 887, 888, 927, 1216,
31149 flag:open_shared_object, 41 1724, 1726
31150 flag:optimise, 41 trace/1, 41, 677
31151 flag:os_argv, 41 trace/2, 678
31152 flag:pid, 41 tracing/0, 673
31153 flag:pipe, 41 transformation
31154 flag:print_write_options, 41 of program, 135
31155 flag:prompt_alternatives_on, 41 transitive_closure/2, 1689
31156 flag:qcompile, 41 transparent, 1746
31157 flag:readline, 41 transportation/4, 1654
31158 flag:report_error, 41 transpose/2, 1409, 1681
31159 flag:resource_database, 41 transpose_pairs/2, 1544
31160 flag:runtime, 41 trim_stacks/0, 706, 708, 709
31161 flag:sandboxed_load, 41 trivial_fail_goal/1, 1351
31162 flag:saved_program, 41 true/0, 41, 139, 215, 231
31163 flag:shared_object_extension, 41 truncate/1, 515
31164 flag:shared_object_search_path, 41 tspy/1, 901, 944, 951
31165 flag:signals, 41 tspy/2, 950
31166 flag:stream_type_check, 41 tty_get_capability/3, 593, 595, 596
31167 flag:system_thread_id, 41 tty_goto/2, 594
31168 flag:timezone, 41 tty_put/2, 595
31169 flag:toplevel_print_anon, 41 tty_size/2, 596
31170 flag:toplevel_print_factorized, 41 ttyflush/0, 362, 582
31171 flag:toplevel_prompt, 41 tuples_in/2, 1398
31172 flag:toplevel_var_size, 41 type_error/2, 252, 1141, 1143
31173 flag:trace_gc, 41
31174 flag:traditional, 41 UCS, 64
31175 flag:tty_control, 41 ugraph _l_i_b_r_a_r_y, 1673
31176 flag:unix, 41 ugraph_union/3, 1686
31177 flag:unknown, 41 ugraphs.pl _l_i_b_r_a_r_y, 1673
31178 flag:unload_foreign_libraries, 41 Unicode, 64
31179 flag:user_flags, 41 unifiable/3, 60, 204, 210
31180 flag:verbose, 41 unify, 1746
31181 flag:verbose_autoload, 41 unify_with_occurs_check/2, 41, 60,
31182 flag:verbose_file_search, 41 204, 205
31183 flag:verbose_load, 41 union/3, 1492
31184 flag:version, 41 unix, 41
31185 flag:version_data, 41 unix/1, 605
31186 flag:version_git, 41 unknown/2, 688, 1276
31187 flag:warn_override_implicit_import, unlisten/1, 1323
31188 41 unlisten/2, 1324
31189 flag:windows, 41 unlisten/3, 1325
31190 flag:write_attributes, 41 unload_file/1, 113, 127
31191 flag:write_help_with_overstrike, 41 unload_foreign_library/1, 979
31192 flag:xpce, 41 unload_foreign_library/2, 980
31193 flag:xpce_version, 41 unsetenv/1, 602, 603
31194 flatten/2, 804, 1482 upcase_atom/2, 456, 460
31195 float/1, 180, 187, 510 update view, 283, 1746
31196 float_fractional_part/1, 513 URL, 608
31197 float_integer_part/1, 514 url _l_i_b_r_a_r_y, 1502
31198 floor/1, 516 url_iri/2, 1700, 1701
31199 flush_output/0, 360 use_foreign_library/1, 121, 132,
31200 flush_output/1, 244, 361, 388 612, 977, 1263
31201 flush_output/[0 use_foreign_library/2, 978
31202 1], 311, 362 use_module/1, 41, 44, 81, 111, 113,
31203 foldl/4, 1294 116, 156, 802--805, 814,
31204 foldl/5, 1295 822, 823, 1265, 1741
31205 foldl/6, 1296 use_module/2, 45, 111, 113, 803--
31206 foldl/7, 1297 805, 815, 1741
31207 forall/2, 578 use_module/[1
31208 foreach/2, 578, 1282 2], 34, 94, 111, 113, 115, 824,
31209 format/1, 244, 579, 586 825, 1746
31210 format/2, 57, 311, 401, 449, 579, user _l_i_b_r_a_r_y, 1759
31211 586--588 user profile file, 14
31212 format/3, 243, 244, 247, 252, 309, UTF-8, 64
31213 340, 389, 439, 449, 462, utf-8, 110
31214 485, 486, 579, 587, 588,
31215 590, 753, 757 valgrind, 1259
31216 format/[1 valid_string_goal/1, 1355
31217 2], 389, 1759 var/1, 177, 839, 1018
31218 format/[2 var_number/2, 421
31219 3], 55 var_property/2, 142
31220 format_predicate/2, 590 variable, 1746
31221 format_time/3, 449, 590, 604, 622 anonymous, 1746
31222 format_time/4, 622, 623 variable_value/3, 1655
31223 format_to_chars/3, 1328 variant, 206
31224 format_to_chars/4, 1329 variant_sha1/2, 287, 1757
31225 free_variables/4, 1283 varnumbers/2, 1707
31226 freeze/2, 856, 857, 859 varnumbers/3, 1708
31227 frozen/2, 858 verbose, 18
31228 functor, 1746 version/0, 250, 251
31229 functor/3, 188, 301, 414, 416, 417, version/1, 250, 251
31230 761, 764, 870 vertices/2, 1675
31231
31232 garbage_collect/0, 706 vertices_edges_to_ugraph/3,v1674iew
31233 garbage_collect_atoms/0, 707, 1231 update, 1746
31234 garbage_collect_clauses/0, 61, 154, visible/1, 687, 1720
31235 155, 158 vm_list/1, 1217
31236 garbage_collect_heap/0, 691 volatile/1, 302, 929, 1266
31237 gcd/2, 499
31238 gdebug/0, 100 wait_for_input/3, 323, 342
31239 gen_assoc/3, 1307 when _l_i_b_r_a_r_y, 859
31240 gen_nb_set/2, 1499 when/2, 60, 859
31241 gen_state/1, 1649 wildcard_match/2, 726
31242 gensym/2, 1455 win_add_dll_directory/1, 612
31243 get/1, 371, 372, 768 win_add_dll_directory/2, 612--614
31244 get/2, 372 win_exec/2, 598, 606--608
31245 get0/1, 311, 369--372 win_folder/2, 14, 18, 611
31246 get0/2, 370, 372 win_has_menu/0, 630
31247 get_assoc/2, 788 win_insert_menu/2, 630--632
31248 get_assoc/3, 1308 win_insert_menu_item/4, 630, 632
31249 get_assoc/5, 1309 win_registry_get_value/3, 610
31250 get_attr/3, 841, 852 win_remove_dll_directory/1, 613, 614
31251 get_attrs/2, 853, 854 win_shell/2, 598, 606, 608, 609,
31252 get_byte/1, 363, 369 1503
31253 get_byte/2, 364, 368 win_window_pos/1, 629
31254 get_byte/[1 window_title/2, 628
31255 2], 110 windows, 41
31256 get_char/1, 365, 367 with_mutex/2, 926, 930, 934, 935,
31257 get_char/2, 368 938, 954
31258 get_char/[1 with_output_to/2, 309, 310, 336,
31259 2], 110 340, 389, 439, 462, 588, 622
31260 get_code/1, 110, 309, 365, 369, with_output_to_chars/2, 1339
31261 380, 382 with_output_to_chars/3, 1340
31262 get_code/2, 65, 322, 366, 368, 370, with_output_to_chars/4, 1341
31263 386, 388 with_quasi_quotation_input/3, 1604
31264 get_code/[1 working_directory/2, 16, 605, 645,
31265 2], 110 656, 657
31266 get_dict/3, 768, 774 write(), 1152
31267 get_dict/5, 775 write/1, 41, 60, 70, 309, 395, 582,
31268 get_dict_ex/3, 765, 768 587, 1039, 1080, 1152
31269 get_single_char/1, 18, 41, 382 write/2, 396
31270 get_string_code/3, 742 write_canonical/1, 390, 393, 407,
31271 get_time/1, 618, 643, 691, 916, 923 587, 729
31272 getenv/2, 601, 602, 1503 write_canonical/2, 394, 420, 1039
31273 getrand/1, 1614 write_length/3, 392, 445
31274 global_cardinality/2, 1401 write_term/2, 32, 41, 390--393,
31275 global_cardinality/3, 1402 401, 407, 420, 439, 582,
31276 global_url/3, 1692 587, 729, 736, 845
31277 GMP, 485 write_term/3, 41, 44, 390, 391,
31278 GNU-Emacs, 23 419, 445
31279 go/0, 761 write_to_chars/2, 1330
31280 goal, 1746 write_to_chars/3, 1331
31281 goal_expansion/2, 111, 135, 136, writef/1, 579, 581
31282 138--140, 142, 149, 1742, writef/2, 7, 55, 389, 579, 581--583
31283 1745, 1759 writeln/1, 399
31284 goal_expansion/4, 111, 145 writeln/2, 400
31285 ground/1, 60, 190, 285, 1022 writeq/1, 397, 582, 587
31286 group_by/4, 1665 writeq/2, 398, 1039
31287 group_pairs_by_key/2, 1543 www_form_encode/2, 1697, 1698
31288 gspy/1, 101 www_open_url/1, 1503
31289 gtrace/0, 99, 944
31290 guitracer/0, 96--98, 107, 671, 675 xor/2, 523
31291 gxref/0, 28, 104, 805, 1265, 1592 xref_built_in/1, 1600
31292
31293 halt/0, 32, 130, 661, 1759 xref_called/3,x1597ref_clean/1, 1595
31294 halt/1, 41, 661, 662, 1216, 1759 xref_current_source/1, 1594
31295 halt/[0 xref_defined/3, 1596
31296 1], 130 xref_exported/2, 1598
31297 hashing, 1746 xref_module/2, 1599
31298 head, 1746 xref_source/1, 1593
31299 help/0, 25, 44, 1269, 1732
31300 help/1, 25, 26, 41, 44, 1732 YAP
31301 hooks, 44 prolog, 1741
31302 html_write _l_i_b_r_a_r_y, 1602
31303 http/http_error _l_i_b_r_a_r_y, 240 zcompare/3, 1410
31304 http/http_header _l_i_b_r_a_r_y, 622
31305 http/http_load _l_i_b_r_a_r_y, 113, 1734
31306 http_location/2, 1694
31307 http_open/3, 252
31308 http_timestamp/2, 622
31309 IA32, 74
30704 ( _l_i_b_r_a_r_y, 968 PL_get_string_chars(), 1042
30705 -lswipl _l_i_b_r_a_r_y, 1247 PL_get_tail(), 1081
30706 .pl, 79 PL_get_wchars(), 1075
30707 .pro, 79 PL_halt(), 1245
30708 ?=/2, 211 PL_handle_signals(), 1199
30709 @/2, 813 PL_initialise(), 1239
30710 =:=/2, 485 PL_install_readline(), 1241
30711 /\/2, 524 PL_instantiation_error(), 1142
30712 =\=/2, 484 PL_is_acyclic(), 1038
30713 |/2, 220 PL_is_atom(), 1027
30714 #/\/2, 1399 PL_is_atomic(), 1036
30715 #=/2, 1391 PL_is_blob(), 1159
30716 #<==>/2, 1396 PL_is_callable(), 1031
30717 #>=/2, 1389 PL_is_compound(), 1032
30718 #>/2, 1393 PL_is_float(), 1030
30719 #=</2, 1390 PL_is_functor(), 1033
30720 #</2, 1394 PL_is_ground(), 1026
30721 #\=/2, 1392 PL_is_initialised(), 1240
30722 #\/1, 1395 PL_is_integer(), 1029
30723 #\/2, 1401 PL_is_list(), 1034
30724 ,/2, 218 PL_is_number(), 1037
30725 #\//2, 1400 PL_is_pair(), 1035
30726 {}/1, 1424 PL_is_string(), 1028
30727 !/0, 217 PL_is_variable(), 1025
30728 /, 80 PL_license(), 1761
30729 //2, 495 PL_LIST, 1083
30730 ./2, 507 PL_malloc(), 1253
30731 ./3, 768 PL_malloc_atomic(), 1257
30732 =/2, 194 PL_malloc_atomic_uncollectable(),
30733 ==/2, 197 1259
30734 >=/2, 483 PL_malloc_stubborn(), 1260
30735 >/2, 480 PL_malloc_uncollectable(), 1258
30736 ^/2, 546 PL_module_name(), 1189
30737 ///2, 498 PL_new_atom(), 1012
30738 ->/2, 221 PL_new_atom_nchars(), 1070
30739 =</2, 482 PL_new_atom_wchars(), 1073
30740 #<==/2, 1398 PL_new_functor(), 1016
30741 <</2, 522 PL_new_module(), 1190
30742 </2, 481 PL_new_term_ref(), 994
30743 >:</2, 786 PL_new_term_refs(), 995
30744 :</2, 784 PL_next_solution(), 1176
30745 -/1, 490 PL_NOT_A_LIST, 1083
30746 -/2, 493 PL_on_halt(), 1233
30747 \=/2, 195 PL_open_foreign_frame(), 1182
30748 \/1, 526 PL_open_query(), 1175
30749 \==/2, 198 PL_PARTIAL_LIST, 1083
30750 \+/1, 223 PL_permission_error(), 1148
30751 \//2, 523 PL_pred(), 1171
30752 +/1, 491 PL_predicate(), 1172
30753 +/2, 492 PL_predicate_info(), 1173
30754 **/2, 545 PL_put_atom(), 1087
30755 #==>/2, 1397 PL_put_atom_chars(), 1089
30756 >>/2, 521 PL_put_atom_nchars(), 1062
30757 ;/2, 219 PL_put_blob(), 1161
30758 *->/2, 222 PL_put_bool(), 1088
30759 =@=/2, 206 PL_put_float(), 1096
30760 \=@=/2, 207 PL_put_functor(), 1097
30761 @>=/2, 202 PL_put_int64(), 1094
30762 @>/2, 201 PL_put_integer(), 1093
30763 */2, 494 PL_put_list(), 1098
30764 @=</2, 200 PL_put_list_chars(), 1092
30765 @</2, 199 PL_put_list_nchars(), 1065
30766 =../2, 416 PL_put_list_ncodes(), 1064
30767 \, 80 PL_put_nil(), 1099
30768 _PL_get_arg(), 1057 PL_put_pointer(), 1095
30769 64-bits PL_put_string_chars(), 1090
30770 platforms, 73 PL_put_string_nchars(), 1063, 1091
30771
30772 abolish/1, 262, 263 PL_put_term(),P1100L_put_variable(), 1086
30773 abolish/2, 263 PL_query(), 1223
30774 abolish/[1 PL_quote(), 1125
30775 2], 41 PL_raise(), 1198
30776 abort/0, 20, 32, 239, 311, 316, PL_raise_exception(), 1192
30777 323, 663, 888, 1220, 1231, PL_realloc(), 1254
30778 1726 PL_record(), 1206
30779 abs/1, 502 PL_record_external(), 1209
30780 absolute_file_name/2, 7, 113, 125, PL_recorded(), 1207
30781 647, 649, 659, 1275 PL_recorded_external(), 1210
30782 absolute_file_name/3, 41, 44, 104, PL_register_atom(), 1020
30783 111, 122, 128, 615, 647, PL_register_extensions(), 1228
30784 648, 1212, 1213, 1637, 1638 PL_register_extensions_in_module(),
30785 absolute_file_name/[2 1227
30786 3], 41, 121, 648 PL_register_foreign(), 1226
30787 access_file/2, 41, 637, 648 PL_register_foreign_in_module(), 1225
30788 acos/1, 532 PL_representation_error(), 1144
30789 acosh/1, 540 PL_reset_term_refs(), 997
30790 acquire(), 1153 PL_resource_error(), 1149
30791 acyclic_term/1, 60, 191, 192, 205 PL_retry(), 1005
30792 add_edges/3, 1685 PL_retry_address(), 1006
30793 add_import_module/3, 821, 823, 838 PL_rewind_foreign_frame(), 1185
30794 add_nb_set/2, 1502 PL_same_compound(), 1204
30795 add_nb_set/3, 1502--1504 PL_set_engine(), 967
30796 add_vertices/3, 1683 PL_set_prolog_flag(), 1216
30797 agent, 1322 PL_signal(), 1197
30798 aggregate/3, 810, 1282 PL_skip_list(), 1083
30799 aggregate/4, 810, 1283 PL_strip_module(), 1188
30800 aggregate_all/3, 1284 PL_succeed(), 1002
30801 aggregate_all/4, 1285 PL_syntax_error(), 1150
30802 all_different/1, 1385 PL_term_type(), 1024
30803 all_distinct/1, 1386 PL_thread_at_exit(), 963
30804 AMD64, 74 PL_thread_attach_engine(), 961
30805 anonymous PL_thread_destroy_engine(), 962
30806 variable, 59 PL_thread_self(), 959
30807 anonymous variable, 1752 PL_throw(), 1193
30808 ansi_format/3, 247 PL_toplevel(), 1242
30809 ansi_term _l_i_b_r_a_r_y, 41, 244, 248 PL_type_error(), 1145
30810 append/1, 325, 329 PL_unify(), 1105
30811 append/2, 808, 1470 PL_unify_arg(), 1121
30812 append/3, 306, 441, 1469 PL_unify_atom(), 1106
30813 apply/2, 227 PL_unify_atom_chars(), 1109
30814 apply_macros _l_i_b_r_a_r_y, 259 PL_unify_atom_nchars(), 1066
30815 apropos/1, 26, 27, 44, 1738, 1765 PL_unify_blob(), 1160
30816 arg/3, 415 PL_unify_bool(), 1107
30817 arithmetic_function/1, 1191 PL_unify_bool_ex(), 1141
30818 arity, 1752 PL_unify_chars(), 1108
30819 asin/1, 531 PL_unify_compound(), 1118
30820 asinh/1, 539 PL_unify_float(), 1115
30821 assert, 1752 PL_unify_functor(), 1117
30822 assert/1, 111, 261, 268, 270, 283, PL_unify_int64(), 1114
30823 289, 290, 302, 801, 809, PL_unify_integer(), 1113
30824 839, 865, 932 PL_unify_list(), 1119
30825 assert/2, 41, 273, 280, 305 PL_unify_list_chars(), 1110
30826 assert_predicate_options/4, 1574 PL_unify_list_ex(), 1139
30827 asserta/1, 18, 60, 61, 120, 206, PL_unify_list_nchars(), 1069
30828 268, 269, 271, 272, 811, PL_unify_list_ncodes(), 1068
30829 813, 1752 PL_unify_mpq(), 1168
30830 asserta/2, 271, 280 PL_unify_mpz(), 1167
30831 assertion/1, 1457, 1730 PL_unify_nil(), 1120
30832 assertz/1, 120, 264, 269, 270, 302, PL_unify_nil_ex(), 1140
30833 307, 837, 1752 PL_unify_pointer(), 1116
30834 assertz/2, 272, 273, 280 PL_unify_string_chars(), 1111
30835 assignment/2, 1651 PL_unify_string_nchars(), 1067, 1112
30836 assoc _l_i_b_r_a_r_y, 774, 791, 792, 1306, PL_unify_term(), 1122
30837 1500 PL_unify_thread_id(), 960
30838 assoc_to_keys/2, 1308 PL_unify_wchars(), 1076
30839 assoc_to_list/2, 1307 PL_unify_wchars_diff(), 1077
30840 assoc_to_values/2, 1309 PL_uninstantiation_error(), 1143
30841 at_end_of_stream/0, 383 PL_unregister_atom(), 1021
30842 at_end_of_stream/1, 384, 388 PL_unregister_blob_type(), 1157
30843 at_end_of_stream/[0 PL_warning(), 1218
30844 1], 316, 1633 PL_wchars_to_term(), 1124
30845 at_halt/1, 41, 130, 131, 665, 910, plus/3, 476
30846 1233, 1243, 1745, 1765 PLVERSION, 1262
30847 atan/1, 533 popcount/1, 558
30848 atan/2, 535 portable
30849 atan2/2, 534 prolog code, 1747
30850 atanh/1, 541 portray/1, 32, 82, 390, 401, 403,
30851 atom, 1752 1175, 1236, 1736
30852 atom/1, 184, 187, 1022 portray_clause/1, 172, 174, 175
30853 atom_chars/2, 110, 340, 367, 431, portray_clause/2, 174, 175, 420
30854 433, 435, 457, 800 portray_text _l_i_b_r_a_r_y, 401
30855 atom_codes/2, 110, 340, 431--433, portray_text/1, 259, 761
30856 437, 438, 457, 800 powm/3, 547
30857 atom_concat/3, 441, 746 precedence, 1752
30858 ATOM_dot(), 1014 pred/1, 816
30859 atom_length/2, 41, 445, 743 predicate, 1752
30860 ATOM_nil(), 1013 dynamic, 1752
30861 atom_number/2, 340, 437, 438 exported, 1752
30862 atom_prefix/2, 446 imported, 1752
30863 atom_result/2, 830 predicate indicator, 109, 1752
30864 atom_string/2, 736 predicate_options/3, 1573
30865 atom_to_chars/2, 1336 predicate_property/2, 116, 226,
30866 atom_to_chars/3, 1337 293, 300, 302, 810, 836
30867 atom_to_term/3, 409, 440 predsort/3, 569, 572
30868 atomic/1, 187 prefix/2, 1471
30869 atomic_concat/3, 441, 442 print/1, 41, 390, 401, 403, 585,
30870 atomic_list_concat/2, 437, 443, 444 590, 1175, 1765
30871 atomic_list_concat/3, 444 print/2, 41, 402
30872 atomics_to_string/2, 749, 750 print_message/2, 41, 44, 113, 130,
30873 atomics_to_string/3, 750 242--245, 252, 401, 407,
30874 attach_console/0, 946--948, 1220 712, 904, 906, 1765
30875 attr_portray_hook/2, 390, 848 print_message_lines/3, 243--245,
30876 attr_unify_hook/2, 840, 847 248, 252, 1765
30877 attribute_goals//1, 848, 852 priority, 1752
30878 attribute_goals/1, 849 process _l_i_b_r_a_r_y, 311, 601
30879 attribute_goals/3, 840 process_create/3, 311, 601, 609
30880 attvar/1, 842 profile file, 14
30881 autoload/0, 49, 117, 1267, 1269 profile/1, 699, 955, 1244
30882 autoload_path/1, 46 profile/3, 700
30883 automaton/3, 1412 profiler/2, 702
30884 automaton/8, 1413 profiling
30885
30886 b_getval/2, 867, 869 proforeigngcode,r1263am, 1752
30887 b_linkarg/3, 790 project_attributes/+QueryVars
30888 b_set_dict/3, 788 +ResidualVars, 850
30889 b_setval/2, 788, 865, 866, 1734 project_attributes/2, 850
30890 backtracking, 1752 prolog/0, 20, 324, 662, 666, 667,
30891 bagof/3, 60, 574, 578, 579, 810, 815, 1242, 1722
30892 1765 prolog/assertion_failed, 1458
30893 bb_inf/3, 1432 prolog/debug_print_hook, 1456
30894 bb_inf/4, 1431 prolog:break_hook/6, 1730
30895 bb_inf/5, 1430 prolog:called_by/2, 1608
30896 between/3, 474 prolog:comment_hook/3, 1741
30897 binding, 1752 prolog:debug_control_hook/1, 1737
30898 bits prolog:help_hook/1, 1738
30899 64, 72 prolog:message_line_element/2, 248
30900 blackboard, 1322 prolog_breakpoints _l_i_b_r_a_r_y, 1729
30901 blob/2, 185, 187, 310 prolog_choice_attribute/3, 1719,
30902 body, 1752 1721, 1726
30903 Boehm GC, 1256 prolog_codewalk _l_i_b_r_a_r_y, 302
30904 BOM, 66 prolog_current_choice/1, 1719, 1721,
30905 break/0, 20, 32, 41, 662, 888, 1220 1724
30906 broadcast, 1322 prolog_current_frame/1, 1718, 1720
30907 broadcast _l_i_b_r_a_r_y, 1322 prolog_cut_to/1, 1724
30908 broadcast/1, 1323, 1324 prolog_edit:edit_command/2, 169
30909 broadcast_request/1, 1324 prolog_edit:edit_source/1, 168
30910 built-in predicate, 1752 prolog_edit:load/0, 170
30911 Byte Order Mark, 66 prolog_edit:locate/2, 167
30912 byte_count/2, 321, 343 prolog_edit:locate/3, 166
30913 call/1, 103, 189, 217, 225, 238, prolog_exception_hook/4, 240, 712,
30914 682, 696, 704, 706, 801, 1731, 1732
30915 860, 1169, 1730 prolog_file_type/2, 111, 123, 648
30916 call/2, 189, 226 prolog_frame_attribute/3, 307, 1720,
30917 call/3, 390 1726, 1732
30918 call/[2-8], 226 prolog_ide _c_l_a_s_s, 106
30919 call_cleanup/2, 233, 235, 236, 340, prolog_ide/1, 105, 106
30920 1722, 1751 prolog_list_goal/1, 1736
30921 call_cleanup/3, 236 prolog_load_context/2, 128, 129,
30922 call_dcg/3, 259, 260 406, 1748
30923 call_residue_vars/2, 864 prolog_load_file/2, 113, 1739, 1740
30924 call_shared_object_function/2, 990 prolog_server _l_i_b_r_a_r_y, 309, 324
30925 call_with_depth_limit/3, 231, 232 prolog_skip_frame/1, 1727, 1728
30926 call_with_inference_limit/3, 231,prolog_skip_level/2, 1727, 1728
30927 232 prolog_stack _l_i_b_r_a_r_y, 1720, 1732
30928 call_with_time_limit/2, 232, 233 prolog_stack_property/2, 712, 713
30929 callable/1, 189, 1031, 1598 prolog_to_os_filename/2, 80, 615,
30930 cancel_halt/1, 130, 131, 665, 1243 639, 649, 653
30931 catch/3, 237--240, 407, 663, 704, prolog_trace_interception/4, 95,
30932 904, 912, 913, 1721, 1732-- 678, 712, 1720, 1721, 1726
30933 1734, 1765 prolog_xref _l_i_b_r_a_r_y, 103, 802
30934 ceil/1, 520 prompt
30935 ceiling/1, 519 alternatives, 41
30936 chain/2, 1416 prompt/2, 410--412, 904
30937 char_code/2, 110, 434 prompt1/1, 412
30938 char_conversion/2, 41, 470, 471 proper_length/2, 1483
30939 char_type/2, 58, 449, 456--459 property, 1752
30940 character set, 53 protocol/1, 670, 671, 673
30941 character_count/2, 321, 343, 344 protocola/1, 671, 673
30942 chdir/1, 659, 660 protocolling/1, 673
30943 check _l_i_b_r_a_r_y, 119, 302 prove, 1752
30944 check/0, 117, 1347 public list, 1752
30945 check:string_predicate/1, 759 public/1, 288, 293, 302, 1269
30946 check:valid_string_goal/1, 760 put/1, 350, 351, 772
30947 check_predicate_option/3, 1576 put/2, 351, 773
30948 check_predicate_options/0, 1579 put_assoc/4, 1320
30949 checker/2, 1360 put_attr/3, 842, 843, 847, 855
30950 choice point, 1752 put_attrs/2, 857
30951 chr _l_i_b_r_a_r_y, 885, 889 put_byte/1, 352
30952 chr_constraint/1, 883, 897 put_byte/2, 353
30953 chr_leash/1, 892 put_byte/[1
30954 chr_notrace/0, 888, 891 2], 110
30955 chr_option/2, 879, 897 put_char/1, 350, 354, 356
30956 chr_show_store/1, 893 put_char/2, 355
30957 chr_trace/0, 888, 890 put_char/[1
30958 chr_type/1, 884 2], 110
30959 circuit/1, 1408 put_code/1, 350, 356, 357
30960 clause, 1752 put_code/2, 65, 357, 386, 388
30961 clause/2, 172, 304, 305, 1269 put_code/[1
30962 clause/3, 271, 280, 305, 307, 1271 2], 110
30963 clause/[2 put_dict/3, 772, 781
30964 3], 41 put_dict/4, 773, 782
30965 clause_property/2, 116, 125, 302, qcompile/1, 4, 113, 134, 159--161,
30966 307, 1720 899
30967 close/1, 308, 314, 319 qcompile/2, 161
30968 close/2, 315 qsave_program/1, 41, 132, 1268
30969 close_any/1, 1465 qsave_program/2, 4, 39, 41, 49, 82,
30970 close_dde_conversation/1, 717 105, 1266, 1267, 1273
30971 close_shared_object/1, 989 qsave_program/[1
30972 clpfd _l_i_b_r_a_r_y, 819 2], 18, 38, 41, 302, 976, 1239,
30973 clpqr _l_i_b_r_a_r_y, 1422 1249, 1269, 1271
30974 code_type/2, 449, 455, 457, 458 quasi_quotation_syntax/1, 302, 1612
30975 collate, 463 quasi_quotation_syntax_error/1, 1613
30976 collation_key/2, 449, 464, 465, 607 query, 1752
30977 COM, 1151 quiet, 18
30978 command line
30979 arguments, 18 random _l_i_b_r_a_r_y, 561
30980 compare random/1, 508, 1615
30981 language-specific, 463 random/3, 1617, 1618
30982 compare(), 1155 random_between/3, 1616
30983 compare/3, 60, 203, 572, 1203, 1751 random_float/0, 509
30984 compile_aux_clauses/1, 111, 140 random_member/2, 1625
30985 compile_predicates/1, 289, 290 random_perm2/4, 1624
30986 compiling/0, 134, 160 random_permutation/2, 1630, 1631
30987 complement/2, 1690 random_property/1, 561, 562
30988 completion random_select/3, 1626, 1627
30989 TAB, 86 randseq/3, 1629
30990 compose/3, 1691 randset/3, 1628
30991 compound, 1752 rational
30992 compound/1, 188 number, 487
30993 compound_name_arguments/3, 188, 416- rational trees, 60
30994 -418, 764, 767 rational/1, 181, 513
30995 compound_name_arity/3, 188, 414, rational/3, 182, 487
30996 417, 418, 764, 767 rationalize/1, 514
30997 concat_atom/3, 444 rb_new/1, 41
30998 constraint/3, 1652, 1653 rbtrees _l_i_b_r_a_r_y, 41
30999 constraint/4, 1653 RDF
31000 constraint_add/4, 1654 memory usage, 75
31001 consult/1, 11, 14, 44, 94, 111- rdiv/2, 500
31002 -116, 119, 156, 159, 160, reachable/3, 1696
31003 291 read/1, 41, 70, 309--311, 360, 397,
31004 context module, 1752 404, 407, 411, 692, 873,
31005 context_module/1, 810, 832, 1175 1638, 1765
31006 convert_time/2, 41 read/2, 342, 405
31007 convert_time/[2 read_clause/3, 59, 406, 692
31008 8], 646 read_file_to_codes/3, 1637
31009 copy_file/2, 601 read_file_to_terms/3, 1638
31010 copy_predicate_clauses/2, 264 read_from_chars/2, 1340
31011 copy_stream_data/2, 387, 388 read_history/6, 410
31012 copy_stream_data/3, 322, 386 read_line_to_codes/2, 756, 1633,
31013 copy_term/2, 60, 206, 424, 426, 1634
31014 429, 787, 839, 853, 867 read_line_to_codes/3, 1633, 1634
31015 copy_term/3, 390, 848, 849, 852 read_link/3, 654
31016 copy_term_nat/2, 853 read_pending_input/3, 388
31017 copysign/1, 504 read_stream_to_codes/2, 1635, 1636
31018 cos/1, 529 read_stream_to_codes/3, 1636
31019 cosh/1, 537 read_string/3, 753
31020 count_atom_results/3, 830 read_string/5, 747, 754
31021 cputime/0, 554 read_term/2, 41, 128, 148, 390,
31022 create_pool/1, 1678 407, 408, 410, 440, 732,
31023 create_prolog_flag/3, 41--43, 1215 739, 1741
31024 crypt _l_i_b_r_a_r_y, 1763 read_term/3, 59, 390, 406--409,
31025 csv//1, 1441 470, 667, 791, 1741
31026 csv//2, 1442 read_term/[2
31027 csv_read_file/2, 569, 1439 3], 407
31028 csv_read_file/3, 1440 read_term_from_atom/3, 409, 440
31029 csv_read_file_row/3, 1443 read_term_from_chars/3, 1341
31030 csv_write_file/2, 1444 readutil _l_i_b_r_a_r_y, 84
31031 csv_write_file/3, 1445 reconsult, 111
31032 csv_write_stream/3, 1446 record _l_i_b_r_a_r_y, 791, 792, 1639
31033 ctype _l_i_b_r_a_r_y, 455 record/1, 1639, 1640
31034 cumulative/1, 1409 recorda/2, 275
31035 cumulative/2, 1410 recorda/3, 60, 274, 276, 280, 299,
31036 current_arithmetic_function/1, 563 865, 1205, 1206, 1209
31037 current_atom/1, 295 recorded/2, 279
31038 current_blob/2, 296, 1152 recorded/3, 278, 280, 1271
31039 current_char_conversion/2, 470, 471 recordz/2, 277
31040 current_flag/1, 298 recordz/3, 60, 276, 280
31041 current_foreign_library/2, 984, 1267 redefine_system_predicate/1, 265,
31042 current_format_predicate/2, 594 1752
31043 current_functor/2, 297 reexport/1, 111, 113, 817, 1747
31044 current_input/1, 128, 309, 330, 337 reexport/2, 111, 113, 818, 1747
31045 current_key/1, 278, 299 registry, 68
31046 current_locale/1, 454 registry _l_i_b_r_a_r_y, 1641
31047 current_module/1, 300, 835 registry_delete_key/1, 1646
31048 current_op/3, 468 registry_get_key/2, 1642
31049 current_option_arg/2, 1577 registry_get_key/3, 1643
31050 current_output/1, 309, 331, 338 registry_set_key/2, 1644
31051 current_persistent_predicate/1, 1554 registry_set_key/3, 1645
31052 current_predicate/1, 226, 300--302 release(), 1154
31053 current_predicate/2, 300, 301 reload_foreign_libraries/0, 985
31054 current_predicate_option/3, 1575 reload_library_index/0, 45, 46, 49
31055 current_predicate_options/3, 1578 rem/2, 497
31056 current_prolog_flag/2, 18, 40, 41, rename_file/2, 601, 644
31057 45, 50, 55, 113, 407, 722, repeat/0, 212, 216, 231, 233
31058 975, 1280, 1752 representation_error/1, 1144
31059 current_signal/3, 254, 255 require/1, 117, 1747
31060 current_stream/3, 317 reset_gensym/0, 1462
31061 current_thread_pool/1, 1675 reset_gensym/1, 1461
31062 cyclic terms, 60 reset_profiler/0, 703
31063 cyclic_term/1, 60, 191, 192 resource/3, 41, 1266, 1267, 1273,
31064
31065 daemon, 1322 resour1275,c1276e_error/1, 1149
31066 date_time_stamp/2, 623 retract, 1752
31067 date_time_value/3, 619, 624 retract/1, 111, 120, 261, 262, 266,
31068 day_of_the_week/2, 629 283, 289, 290, 302, 932
31069 db_attach/2, 1555 retract/2, 839
31070 db_sync/1, 1556 retractall/1, 261, 262, 267
31071 db_sync_all/1, 1557 retractall_predicate_options/0, 1581
31072 DCG, 111, 257 rev/3, 803
31073 dcg_translate_rule/2, 137, 141 reverse/2, 260, 803, 1485
31074 dcg_translate_rule/4, 148 rl_add_history/1, 1744
31075 dde_current_connection/2, 725 rl_read_history/1, 1746
31076 dde_current_service/2, 724 rl_read_init_file/1, 1743
31077 dde_execute/2, 719 rl_write_history/1, 1745
31078 dde_poke/4, 720 round/1, 510
31079 dde_register_service/2, 722
31080 dde_request/3, 718 same_file/2, 639, 641
31081 dde_unregister_service/1, 723 same_length/2, 1484
31082 debug _l_i_b_r_a_r_y, 106 same_term/2, 430
31083 debug/0, 32, 41, 240, 681, 683, sandbox/safe_meta, 1288
31084 684, 712, 949, 1220, 1730, sat/1, 1366
31085 1732 sat_count/2, 1369
31086 debug/1, 1451 scalar_product/4, 1388
31087 debug/3, 243, 1455 scanl/4, 1302
31088 debug_message_context/1, 1454 scanl/5, 1303
31089 debugging scanl/6, 1304
31090 exceptions, 240 scanl/7, 1305
31091 debugging/0, 44, 681, 685, 1737 see/1, 308, 309, 325--327
31092 debugging/1, 1448, 1449 seeing/1, 325, 326, 330
31093 debugging/2, 1450 seek/4, 316, 320, 322
31094 default_module/2, 302, 821, 822 seen/0, 332
31095 del_attr/2, 845, 855 select(), 342
31096 del_attrs/1, 858 select/3, 1472
31097 del_dict/4, 783 select/4, 1474
31098 del_edges/3, 1686 select_dict/2, 785
31099 del_vertices/3, 1684 select_dict/3, 785, 786
31100 delete/3, 1477 select_option/3, 1512
31101 delete_directory/1, 658 select_option/4, 1513
31102 delete_file/1, 601, 643, 656 selectchk/3, 1473
31103 delete_import_module/2, 821, 823, selectchk/4, 1475
31104 824, 838 semi deterministic, 1752
31105 derive_predicate_options/0, 1580 semidet, 1752
31106 derived_predicate_options/1, 1583 serialize, 257
31107 derived_predicate_options/3, 1582 serialized/2, 1404
31108 deserialize, 257 set_breakpoint/4, 1730
31109 det, 1752 set_end_of_stream/1, 385
31110 determinism, 1752 set_input/1, 309, 323, 327, 335
31111 deterministic, 1752 set_locale/1, 453
31112 deterministic/1, 233, 1722 set_module/1, 268, 820, 836, 837
31113 Development environment, 76 set_output/1, 309, 328, 336
31114 dialect.pl _l_i_b_r_a_r_y, 1747 set_prolog_flag/2, 30, 40--43, 111,
31115 dict_create/3, 779, 781 479, 1215
31116 dict_options/2, 1516 set_prolog_IO/3, 309, 324
31117 dict_pairs/2, 791 set_prolog_stack/2, 19, 68, 683,
31118 dict_pairs/3, 780 712, 713, 734, 904
31119 dif _l_i_b_r_a_r_y, 863 set_random/1, 508, 561, 562
31120 dif/2, 60, 195, 862, 863 set_stream/2, 65, 309, 311, 316,
31121 directory_file_path/3, 639 323, 324, 342, 378, 453
31122 directory_files/2, 651 set_stream_position/2, 316, 320, 322
31123 discontiguous/1, 116, 243, 288, set_url_encoding/2, 1705
31124 292, 692 setarg/3, 109, 424, 426, 427, 429,
31125 disjoint2/1, 1411 430, 788, 843, 873, 1639
31126 display/1, 585, 1084 setenv/2, 605
31127 distinct/1, 1666 setlocale/1, 904
31128 distinct/2, 1667 setlocale/3, 465, 607
31129 div/2, 499 setof/3, 60, 579, 810, 1765
31130 divmod/4, 477 setrand/1, 1619
31131 do_not_use/1, 816 setup_call_catcher_cleanup/4, 234
31132 domain/2, 840 setup_call_cleanup/2, 933
31133 domain_error/2, 1146 setup_call_cleanup/3, 233, 235, 908,
31134 downcase_atom/2, 456, 459, 460 937, 938, 941
31135 dump/3, 1433, 1437 shadow_price/3, 1659
31136 duplicate_term/2, 60, 424, 427, shared, 1752
31137 429, 868 shell/0, 603, 608
31138 dwim_match/2, 303, 727, 728 shell/1, 80, 169, 602, 608
31139 dwim_match/3, 728 shell/2, 601, 609
31140 dwim_predicate/2, 303 shell/[0-2], 605
31141 dynamic predicate, 1752 shell/[1
31142 dynamic/1, 41, 109, 116, 261, 267, 2], 601
31143 288--290, 302, 831, 931, shell_register_dde/6, 1648
31144 932, 1269 shell_register_file_type/4, 1647,
31145
31146 e/0, 552 shell_1648register_prolog/1, 1649
31147 edges/2, 1682 shlib _l_i_b_r_a_r_y, 1765
31148 edit/0, 41, 164 show_profile/1, 700, 701
31149 edit/1, 41, 44, 86, 89, 94, 107, sign/1, 503
31150 116, 119, 162--166, 168, simplex _l_i_b_r_a_r_y, 1650
31151 814, 1765 sin/1, 528
31152 edit_source/1, 169 singleton, 1752
31153 editor _c_l_a_s_s, 85, 90 variable, 59
31154 element/3, 1405 sinh/1, 536
31155 elif/1, 151 size_file/2, 645
31156 else/0, 152 size_nb_set/2, 1505
31157 Emacs, 23 skip/1, 380, 381
31158 emacs/[0 skip/2, 381
31159 1], 89 sleep/1, 730
31160 emacs/prolog_colour _l_i_b_r_a_r_y, 93 socket _l_i_b_r_a_r_y, 342
31161 empty_assoc/1, 1310 Solaris, 911
31162 empty_nb_set/1, 1501 solution, 1752
31163 encoding/1, 65, 118 sort/2, 232, 568--570, 572, 579
31164 endif/0, 153 sort/4, 569
31165 ensure_loaded/1, 34, 111, 115, 807 source_exports/2, 1747, 1750
31166 entailed/1, 1425 source_file/1, 124
31167 environment/2, 1594 source_file/2, 116, 125, 160, 302
31168 epsilon/0, 553 source_file_property/2, 113, 116,
31169 erase/1, 271, 274, 280, 305 126
31170 erf/1, 549 source_location/2, 128, 129
31171 erfc/1, 550 split_string/4, 444, 747, 754
31172 error _l_i_b_r_a_r_y, 176, 1639 spy/1, 32, 41, 44, 96, 97, 107,
31173 eval/1, 555 109, 686, 814, 953, 954,
31174 eval_license/0, 1757--1759 1737, 1765
31175 exception/3, 865, 1733, 1734 sqrt/1, 527
31176 exceptions stack
31177 debugging, 240 memory management, 69
31178 exclude/3, 1291 stamp_date_time/3, 619, 622, 623
31179 exists_directory/1, 642 startup file, 14
31180 exists_file/1, 41, 638 statistics _l_i_b_r_a_r_y, 697
31181 exists_source/1, 1747, 1749 statistics/0, 243, 695
31182 exp/1, 544 statistics/2, 554, 694, 914
31183 expand_answer/2, 667, 668 stream_pair/3, 310, 314, 319, 323
31184 expand_file_name/2, 41, 113, 605, stream_position_data/3, 128, 316,
31185 608, 647, 648, 651, 652 321, 407, 1741
31186 expand_file_search_path/2, 122 stream_property/2, 66, 128, 311,
31187 expand_goal/2, 41, 135--139, 150 316, 320--323, 407
31188 expand_goal/4, 144 stream_to_lazy_list/2, 1566
31189 expand_query/4, 667 string/1, 186, 187, 590, 735
31190 expand_term/2, 135--138, 141, 257, string_chars/2, 740
31191 1640 string_code/3, 744, 745, 761
31192 expand_term/4, 146 string_codes/2, 741, 756
31193 expects_dialect/1, 113, 128, 1747, string_concat/3, 746, 756
31194 1748 string_length/2, 743
31195 explain _l_i_b_r_a_r_y, 1765 string_lower/2, 752
31196 explain/1, 28 string_predicate/1, 1358
31197 explain/2, 29 string_upper/2, 751
31198 export/1, 293, 827--829 strip_module/3, 810, 830, 833, 838
31199 export_list/2, 828 structure, 1752
31200 exported predicate, 1752 style_check/1, 59, 70, 113, 292,
31201
31202 fact, 1752 692
31203 fail/0, 139, 213 sub_atom/5, 447, 748
31204 false/0, 214 sub_atom_icasechk/3, 448
31205 fd_dom/2, 1421 sub_string/5, 744, 748, 756
31206 fd_inf/2, 1418 subset/2, 1498
31207 fd_size/2, 1420 subsumes_chk/2, 287
31208 fd_sup/2, 1419 subsumes_term/2, 60, 204, 208
31209 fd_var/1, 1417 subtract/3, 1499
31210 file_base_name/2, 640 succ/2, 475
31211 file_directory_name/2, 639, 640 succeed, 1752
31212 file_name_extension/3, 650 sum/3, 1387
31213 file_name_to_url/2, 1709, 1710 sum_list/2, 1490
31214 file_of_label/2, 815 sup/2, 1427
31215 file_search_path/2, 14, 18, 41, 45, swi/pce_profile _l_i_b_r_a_r_y, 697
31216 49, 81, 104, 113, 120, 121, swi_edit _l_i_b_r_a_r_y, 170
31217 123, 128, 1213, 1249, 1272, swritef/2, 587
31218 1275, 1278 swritef/3, 340, 582, 586
31219 fileerrors/2, 41 syntax_error/1, 1563
31220 filesex _l_i_b_r_a_r_y, 601, 639 TAB
31221 find_chr_constraint/1, 894 completion, 86
31222 findall/3, 60, 206, 212, 574, 575, tab/1, 358
31223 577, 581, 791, 839, 1765 tab/2, 359
31224 findall/4, 575, 577 tan/1, 530
31225 findnsols/4, 576 tanh/1, 538
31226 findnsols/5, 577 taut/2, 1367
31227 findsols/4, 1765 tdebug/0, 904, 950, 954
31228 flag/3, 282, 298, 427 tdebug/1, 949, 950, 953
31229 flag:access_level, 41 tell/1, 308, 309, 325, 326, 328,
31230 flag:address_bits, 41 329
31231 flag:agc_margin, 41 telling/1, 325, 326, 331
31232 flag:allow_dot_in_atom, 41 term, 1752
31233 flag:allow_variable_name_as_functor, term//1, 340
31234 41 term_attvars/2, 854
31235 flag:answer_write_options, 41 term_expansion/2, 44, 111, 134--
31236 flag:apple, 41 138, 149, 160, 667, 885,
31237 flag:arch, 41 1751
31238 flag:argv, 41 term_expansion/4, 111, 147
31239 flag:associated_file, 41 term_hash/2, 60, 63, 284--287
31240 flag:autoload, 41 term_hash/4, 63, 284, 286
31241 flag:back_quotes, 41 term_string/2, 439, 738, 739
31242 flag:bounded, 41 term_string/3, 739
31243 flag:break_level, 41 term_subsumer/3, 209
31244 flag:c_cc, 41 term_to_atom/2, 340, 439, 1123
31245 flag:c_cflags, 41 term_variables/2, 60, 407, 422, 423
31246 flag:c_ldflags, 41 term_variables/3, 422, 423
31247 flag:c_libplso, 41 terms
31248 flag:c_libs, 41 cyclic, 60
31249 flag:char_conversion, 41 text_to_string/2, 742
31250 flag:character_escapes, 41 thread _l_i_b_r_a_r_y, 41
31251 flag:colon_sets_calling_context, 41 thread_at_exit/1, 665, 904, 910, 963
31252 flag:color_term, 41 thread_create/3, 904, 907, 910, 971
31253 flag:compile_meta_arguments, 41 thread_create_in_pool/4, 904, 1677
31254 flag:compiled_at, 41 thread_detach/1, 904, 907
31255 flag:console_menu, 41 thread_exit/1, 906, 908, 913
31256 flag:cpu_count, 41 thread_get_message/1, 920, 925
31257 flag:dde, 41 thread_get_message/2, 924--926
31258 flag:debug, 41 thread_get_message/3, 919, 921, 926
31259 flag:debug_on_error, 41 thread_initialization/1, 865, 909
31260 flag:debugger_show_context, 41 thread_join/2, 904, 906, 908, 913
31261 flag:debugger_write_options, 41 thread_local/1, 246, 289, 302, 931,
31262 flag:dialect, 41 932
31263 flag:double_quotes, 41 thread_message_hook/3, 246
31264 flag:editor, 41 thread_peek_message/1, 920, 921, 927
31265 flag:emacs_inferior_process, 41 thread_peek_message/2, 926, 927
31266 flag:encoding, 41 thread_pool_create/3, 1673
31267 flag:executable, 41 thread_pool_destroy/1, 1674
31268 flag:exit_status, 41 thread_pool_property/2, 1676
31269 flag:file_name_variables, 41 thread_property/2, 906, 907, 910,
31270 flag:gc, 41 913
31271 flag:generate_debug_info, 41 thread_self/1, 41, 905, 907, 910,
31272 flag:gmp_version, 41 918
31273 flag:gui, 41 thread_send_message/2, 918, 919, 923
31274 flag:history, 41 thread_send_message/3, 919
31275 flag:home, 41 thread_setconcurrency/2, 41, 911
31276 flag:hwnd, 41 thread_signal/2, 233, 930, 949,
31277 flag:integer_rounding_function, 41 1198, 1246
31278 flag:iso, 41 thread_statistics/3, 913, 914
31279 flag:large_files, 41 threads/0, 944
31280 flag:last_call_optimisation, 41 throw/1, 32, 60, 237--239, 252,
31281 flag:max_arity, 41 256, 908, 913, 929, 930,
31282 flag:max_integer, 41 1192, 1194, 1732--1734
31283 flag:max_tagged_integer, 41 time/1, 554, 696
31284 flag:min_integer, 41 time_file/2, 646
31285 flag:min_tagged_integer, 41 tmp_file/2, 655, 656
31286 flag:occurs_check, 41 tmp_file_stream/3, 655, 656
31287 flag:open_shared_object, 41 tnodebug/0, 952
31288 flag:optimise, 41 tnodebug/1, 951, 954
31289 flag:os_argv, 41 told/0, 333
31290 flag:pid, 41 top_sort/2, 1693
31291 flag:pipe, 41 top_sort/3, 1694
31292 flag:print_write_options, 41 tprofile/1, 955, 956
31293 flag:prompt_alternatives_on, 41 trace/0, 32, 41, 96, 97, 107, 675,
31294 flag:qcompile, 41 681, 890, 891, 930, 1220,
31295 flag:readline, 41 1730, 1732
31296 flag:report_error, 41 trace/1, 41, 680
31297 flag:resource_database, 41 trace/2, 681
31298 flag:runtime, 41 tracing/0, 676
31299 flag:sandboxed_load, 41 transformation
31300 flag:saved_program, 41 of program, 135
31301 flag:shared_object_extension, 41 transitive_closure/2, 1695
31302 flag:shared_object_search_path, 41 transparent, 1752
31303 flag:signals, 41 transportation/4, 1660
31304 flag:stream_type_check, 41 transpose/2, 1414, 1687
31305 flag:system_thread_id, 41 transpose_pairs/2, 1550
31306 flag:timezone, 41 trim_stacks/0, 709, 711, 712
31307 flag:toplevel_print_anon, 41 trivial_fail_goal/1, 1355
31308 flag:toplevel_print_factorized, 41 true/0, 41, 139, 215, 231
31309 flag:toplevel_prompt, 41 truncate/1, 517
31310 flag:toplevel_var_size, 41 tspy/1, 904, 947, 954
31311 flag:trace_gc, 41 tspy/2, 953
31312 flag:traditional, 41 tty_get_capability/3, 596, 598, 599
31313 flag:tty_control, 41 tty_goto/2, 597
31314 flag:unix, 41 tty_put/2, 598
31315 flag:unknown, 41 tty_size/2, 599
31316 flag:unload_foreign_libraries, 41 ttyflush/0, 362, 585
31317 flag:user_flags, 41 tuples_in/2, 1403
31318 flag:verbose, 41 type_error/2, 252, 1145, 1147
31319 flag:verbose_autoload, 41
31320 flag:verbose_file_search, 41 UCS, 64
31321 flag:verbose_load, 41 ugraph _l_i_b_r_a_r_y, 1679
31322 flag:version, 41 ugraph_union/3, 1692
31323 flag:version_data, 41 ugraphs.pl _l_i_b_r_a_r_y, 1679
31324 flag:version_git, 41 Unicode, 64
31325 flag:warn_override_implicit_import, unifiable/3, 60, 204, 210
31326 41 unify, 1752
31327 flag:windows, 41 unify_with_occurs_check/2, 41, 60,
31328 flag:write_attributes, 41 204, 205
31329 flag:write_help_with_overstrike, 41 union/3, 1497
31330 flag:xpce, 41 unix, 41
31331 flag:xpce_version, 41 unix/1, 608
31332 flatten/2, 807, 1487 unknown/2, 691, 1280
31333 float/1, 180, 187, 512 unlisten/1, 1327
31334 float_fractional_part/1, 515 unlisten/2, 1328
31335 float_integer_part/1, 516 unlisten/3, 1329
31336 floor/1, 518 unload_file/1, 113, 127
31337 flush_output/0, 360 unload_foreign_library/1, 982
31338 flush_output/1, 244, 361, 388 unload_foreign_library/2, 983
31339 flush_output/[0 unsetenv/1, 605, 606
31340 1], 311, 362 upcase_atom/2, 456, 460
31341 foldl/4, 1298 update view, 283, 1752
31342 foldl/5, 1299 URL, 611
31343 foldl/6, 1300 url _l_i_b_r_a_r_y, 1507
31344 foldl/7, 1301 url_iri/2, 1706, 1707
31345 forall/2, 581 use_foreign_library/1, 121, 132,
31346 foreach/2, 581, 1286 615, 980, 1267
31347 format/1, 244, 582, 589 use_foreign_library/2, 981
31348 format/2, 57, 311, 401, 449, 582, use_module/1, 41, 44, 81, 111, 113,
31349 589--591 116, 156, 805--808, 817,
31350 format/3, 243, 244, 247, 252, 309, 825, 826, 1269, 1747
31351 340, 389, 439, 449, 462, use_module/2, 45, 111, 113, 806--
31352 487, 488, 582, 590, 591, 808, 818, 1747
31353 593, 756, 760 use_module/[1
31354 format/[1 2], 34, 94, 111, 113, 115, 827,
31355 2], 389, 1765 828, 1752
31356 format/[2 user _l_i_b_r_a_r_y, 1765
31357 3], 55 user profile file, 14
31358 format_predicate/2, 593 UTF-8, 64
31359 format_time/3, 449, 593, 607, 625 utf-8, 110
31360 format_time/4, 625, 626
31361 format_to_chars/3, 1332 valgrind, 1263
31362 format_to_chars/4, 1333 valid_string_goal/1, 1359
31363 free_variables/4, 1287 var/1, 177, 842, 1022
31364 freeze/2, 859, 860, 862 var_number/2, 421
31365 frozen/2, 861 var_property/2, 142
31366 functor, 1752 variable, 1752
31367 functor/3, 188, 301, 414, 416, 417, anonymous, 1752
31368 764, 767, 873 variable_value/3, 1661
31369
31370 garbage_collect/0, 709 variant,v206ariant_sha1/2, 287, 1763
31371 garbage_collect_atoms/0, 710, 1235 varnumbers/2, 1713
31372 garbage_collect_clauses/0, 61, 154, varnumbers/3, 1714
31373 155, 158 verbose, 18
31374 garbage_collect_heap/0, 694 version/0, 250, 251
31375 gcd/2, 501 version/1, 250, 251
31376 gdebug/0, 100 vertices/2, 1681
31377 gen_assoc/3, 1311 vertices_edges_to_ugraph/3, 1680
31378 gen_nb_set/2, 1504 view
31379 gen_state/1, 1655 update, 1752
31380 gensym/2, 1460 visible/1, 690, 1726
31381 get/1, 371, 372, 771 vm_list/1, 1221
31382 get/2, 372 volatile/1, 302, 932, 1270
31383 get0/1, 311, 369--372
31384 get0/2, 370, 372 wait_for_input/3, 323, 342
31385 get_assoc/2, 791 when _l_i_b_r_a_r_y, 862
31386 get_assoc/3, 1312 when/2, 60, 862
31387 get_assoc/5, 1313 wildcard_match/2, 729
31388 get_attr/3, 844, 855 win_add_dll_directory/1, 615
31389 get_attrs/2, 856, 857 win_add_dll_directory/2, 615--617
31390 get_byte/1, 363, 369 win_exec/2, 601, 609--611
31391 get_byte/2, 364, 368 win_folder/2, 14, 18, 614
31392 get_byte/[1 win_has_menu/0, 633
31393 2], 110 win_insert_menu/2, 633--635
31394 get_char/1, 365, 367 win_insert_menu_item/4, 633, 635
31395 get_char/2, 368 win_registry_get_value/3, 613
31396 get_char/[1 win_remove_dll_directory/1, 616, 617
31397 2], 110 win_shell/2, 601, 609, 611, 612,
31398 get_code/1, 110, 309, 365, 369, 1508
31399 380, 382 win_window_pos/1, 632
31400 get_code/2, 65, 322, 366, 368, 370, window_title/2, 631
31401 386, 388 windows, 41
31402 get_code/[1 with_mutex/2, 929, 933, 937, 938,
31403 2], 110 941, 957
31404 get_dict/3, 771, 777 with_output_to/2, 309, 310, 336,
31405 get_dict/5, 778 340, 389, 439, 462, 591, 625
31406 get_dict_ex/3, 768, 771 with_output_to_chars/2, 1343
31407 get_single_char/1, 18, 41, 382 with_output_to_chars/3, 1344
31408 get_string_code/3, 745 with_output_to_chars/4, 1345
31409 get_time/1, 621, 646, 694, 919, 926 with_quasi_quotation_input/3, 1610
31410 getbit/2, 559 working_directory/2, 16, 608, 648,
31411 getenv/2, 604, 605, 1508 659, 660
31412 getrand/1, 1620 write(), 1156
31413 global_cardinality/2, 1406 write/1, 41, 60, 70, 309, 395, 585,
31414 global_cardinality/3, 1407 590, 1043, 1084, 1156
31415 global_url/3, 1698 write/2, 396
31416 GMP, 487 write_canonical/1, 390, 393, 407,
31417 GNU-Emacs, 23 590, 732
31418 go/0, 764 write_canonical/2, 394, 420, 1043
31419 goal, 1752 write_length/3, 392, 445
31420 goal_expansion/2, 111, 135, 136, write_term/2, 32, 41, 390--393,
31421 138--140, 142, 149, 1748, 401, 407, 420, 439, 585,
31422 1751, 1765 590, 732, 739, 848
31423 goal_expansion/4, 111, 145 write_term/3, 41, 44, 390, 391,
31424 ground/1, 60, 190, 285, 1026 419, 445
31425 group_by/4, 1671 write_to_chars/2, 1334
31426 group_pairs_by_key/2, 1549 write_to_chars/3, 1335
31427 gspy/1, 101 writef/1, 582, 584
31428 gtrace/0, 99, 947 writef/2, 7, 55, 389, 582, 584--586
31429 guitracer/0, 96--98, 107, 674, 678 writeln/1, 399
31430 gxref/0, 28, 104, 808, 1269, 1598 writeln/2, 400
31431
31432 halt/0, 32, 130, 664, 1765 writeq/1,w397,r585,i590teq/2, 398, 1043
31433 halt/1, 41, 664, 665, 1220, 1765 www_form_encode/2, 1703, 1704
31434 halt/[0 www_open_url/1, 1508
31435 1], 130
31436 hashing, 1752 xor/2, 525
31437 head, 1752 xref_built_in/1, 1606
31438 help/0, 25, 44, 1273, 1738 xref_called/3, 1603
31439 help/1, 25, 26, 41, 44, 1738 xref_clean/1, 1601
31440 hooks, 44 xref_current_source/1, 1600
31441 html_write _l_i_b_r_a_r_y, 1608 xref_defined/3, 1602
31442 http/http_error _l_i_b_r_a_r_y, 240 xref_exported/2, 1604
31443 http/http_header _l_i_b_r_a_r_y, 625 xref_module/2, 1605
31444 http/http_load _l_i_b_r_a_r_y, 113, 1740 xref_source/1, 1599
31445 http_location/2, 1700
31446 http_open/3, 252 YAP
31447 http_timestamp/2, 625 prolog, 1747
31448 IA32, 74 zcompare/3, 1415
3131031449 IDE, 76
3131131450 if
3131231451 directive, 149
3131331452 if/1, 128, 150
31314 ignore/1, 230, 701, 901
31453 ignore/1, 230, 704, 904
3131531454 immediate
3131631455 update view, 283
31317 import/1, 825, 826
31318 import_module/2, 300, 818--820
31319 imported predicate, 1746
31320 in/2, 1375
31321 in_pce_thread/1, 966, 967
31322 in_pce_thread_sync/1, 967
31456 import/1, 828, 829
31457 import_module/2, 300, 821--823
31458 imported predicate, 1752
31459 in/2, 1380
31460 in_pce_thread/1, 969, 970
31461 in_pce_thread_sync/1, 970
3132331462 include/1, 111, 113, 116, 125, 126,
3132431463 307
31325 include/3, 1286
31326 indexing, 1746
31464 include/3, 1290
31465 indexing, 1752
3132731466 term-hashes, 284
31328 indomain/1, 1377
31329 inf/2, 1421
31467 indomain/1, 1382
31468 inf/2, 1426
3133031469 infinite trees, 60
3133131470 initialization/1, 111, 132, 133,
31332 157, 862, 906, 973, 1235,
31333 1267
31471 157, 865, 909, 976, 1239,
31472 1271
3133431473 initialization/2, 133
31335 ins/2, 1376
31474 ins/2, 1381
3133631475 instance/2, 281
31337 instantiation_error/1, 1138
31338 integer, 1746
31339 unbounded, 485
31476 instantiation, 1752
31477 instantiation_error/1, 1142
31478 integer, 1752
31479 unbounded, 487
3134031480 integer//1, 259
31341 integer/1, 179, 187, 509
31342 interactor/0, 323, 943
31481 integer/1, 179, 187, 511
31482 interactor/0, 323, 946
3134331483 internationalization, 64
31344 interpreted, 1746
31345 intersection/3, 1491
31346 is/2, 484, 485, 510, 894
31347 is_absolute_file_name/1, 646
31348 is_absolute_url/1, 1693
31349 is_assoc/1, 1317
31350 is_dict/1, 772
31351 is_dict/2, 773
31352 is_list/1, 562
31353 is_ordset/1, 1519
31354 is_set/1, 1489
31484 interpreted, 1752
31485 intersection/3, 1496
31486 is/2, 486, 487, 512, 897
31487 is_absolute_file_name/1, 649
31488 is_absolute_url/1, 1699
31489 is_assoc/1, 1321
31490 is_dict/1, 775
31491 is_dict/2, 776
31492 is_list/1, 565
31493 is_ordset/1, 1525
31494 is_set/1, 1494
3135531495 is_stream/1, 318
3135631496 ISO Latin 1, 53
3135731497
31358 Java, 1147
31498 Java, 1151
3135931499 jitindex, 61
31360 join_threads/0, 942
31361
31362 keysort/2, 566, 568, 569
31363
31364 label/1, 1378
31365 labeling/1, 1364
31366 labeling/2, 1379
31367 last/2, 1477
31368 lazy_list_character_count/1, 1559
31369 lazy_list_location//1, 1558
31370 leash/1, 32, 686, 687, 889, 1720
31371 length/2, 564
31372 lex_chain/1, 1397
31373 lgamma/1, 546
31500 join_threads/0, 945
31501
31502 keysort/2, 569, 571, 572
31503
31504 label/1, 1383
31505 labeling/1, 1368
31506 labeling/2, 1384
31507 last/2, 1482
31508 lazy_list_character_count/1, 1565
31509 lazy_list_location//1, 1564
31510 leash/1, 32, 689, 690, 892, 1726
31511 length/2, 567
31512 lex_chain/1, 1402
31513 lgamma/1, 548
3137431514 library(apply_macros) _l_i_b_r_a_r_y, 111
3137531515 library(dcg/basics) _l_i_b_r_a_r_y, 259
3137631516 library_directory/1, 45, 49, 120
31377 license/1, 1754
31378 license/2, 1753, 1754
31379 limit/2, 1662
31380 line_count/2, 321, 323, 345, 594
31381 line_position/2, 321, 323, 346, 594
31382 list_autoload/0, 1346
31383 list_debug_topics/0, 1448
31384 list_redefined/0, 1347
31385 list_strings/0, 728, 755, 756, 758,
31386 1352
31387 list_strings/1, 1353
31388 list_to_assoc/2, 788, 1310
31389 list_to_ord_set/2, 1522
31390 list_to_set/2, 1490
31391 list_trivial_fails/0, 1349
31392 list_trivial_fails/1, 1350
31393 list_undefined/0, 41, 119, 1344
31394 list_undefined/1, 1345
31395 list_void_declarations/0, 1348
31396 listen/2, 1321, 1322
31397 listen/3, 1322--1325
31398 listening/3, 1326
31517 license/1, 1760
31518 license/2, 1759, 1760
31519 limit/2, 1668
31520 line_count/2, 321, 323, 345, 597
31521 line_position/2, 321, 323, 346, 597
31522 list_autoload/0, 1350
31523 list_debug_topics/0, 1453
31524 list_redefined/0, 1351
31525 list_strings/0, 731, 758, 759, 761,
31526 1356
31527 list_strings/1, 1357
31528 list_to_assoc/2, 791, 1314
31529 list_to_ord_set/2, 1528
31530 list_to_set/2, 1495
31531 list_trivial_fails/0, 1353
31532 list_trivial_fails/1, 1354
31533 list_undefined/0, 41, 119, 1348
31534 list_undefined/1, 1349
31535 list_void_declarations/0, 1352
31536 listen/2, 1325, 1326
31537 listen/3, 1326--1329
31538 listening/3, 1330
3139931539 listing/0, 173
3140031540 listing/1, 32, 172, 173
31401 lists _l_i_b_r_a_r_y, 561
31541 lists _l_i_b_r_a_r_y, 564
3140231542 load_file/2, 113
3140331543 load_files/1, 112
3140431544 load_files/2, 41, 44, 65, 111--114,
3140531545 126, 127, 156, 157, 161,
31406 689, 805, 1592, 1733, 1734,
31407 1743, 1759
31408 load_foreign_library/1, 132, 975,
31409 984, 1243, 1268
31410 load_foreign_library/2, 976
31546 692, 808, 1598, 1739, 1740,
31547 1749, 1765
31548 load_foreign_library/1, 132, 978,
31549 987, 1247, 1272
31550 load_foreign_library/2, 979
3141131551 load_hotfixes/1, 113
3141231552 locale, 463
3141331553 locale_create/3, 450, 452
3141431554 locale_destroy/1, 450, 451
3141531555 locale_property/2, 452
31416 locale_sort/2, 449, 464, 465, 604
31417 log/1, 540
31418 log10/1, 541
31556 locale_sort/2, 449, 464, 465, 607
31557 log/1, 542
31558 log10/1, 543
3141931559 logical
3142031560 update view, 283
31421 lsb/1, 555
31561 lsb/1, 557
3142231562
3142331563 MacOS, 41
3142431564 make/0, 4, 41, 45, 49, 87, 94, 107,
3142531565 113, 116, 119, 126, 154
31426 make_directory/1, 598, 654
31566 make_directory/1, 601, 657
3142731567 make_library_index/1, 45, 47
3142831568 make_library_index/2, 45, 48
3142931569 make_library_index/[1
3143031570 2], 49
3143131571 manpce/0, 68
31432 map_assoc/2, 1311
31433 map_assoc/3, 1312
31434 map_list_to_pairs/3, 1545
31435 maplist/2, 578, 797, 1290
31436 maplist/3, 788, 806, 827, 1291
31437 maplist/4, 1292
31438 maplist/5, 1293
31439 maplist_/3, 806, 827
31440 max/2, 503
31441 max_assoc/3, 1313
31442 max_list/2, 1486
31443 max_member/2, 1483
31444 max_var_number/3, 1709
31445 maximize/1, 1424
31446 maximize/3, 1650, 1651
31447 maybe/0, 1615
31448 maybe/1, 1616
31449 maybe/2, 1617
31450 member/2, 32, 233, 563, 645, 805,
31451 1463, 1759
31452 memberchk/2, 563, 758
31572 map_assoc/2, 1315
31573 map_assoc/3, 1316
31574 map_list_to_pairs/3, 1551
31575 maplist/2, 581, 800, 1294
31576 maplist/3, 791, 809, 830, 1295
31577 maplist/4, 1296
31578 maplist/5, 1297
31579 maplist_/3, 809, 830
31580 max/2, 505
31581 max_assoc/3, 1317
31582 max_list/2, 1491
31583 max_member/2, 1488
31584 max_var_number/3, 1715
31585 maximize/1, 1429
31586 maximize/3, 1656, 1657
31587 maybe/0, 1621
31588 maybe/1, 1622
31589 maybe/2, 1623
31590 member/2, 32, 233, 566, 648, 808,
31591 1468, 1765
31592 memberchk/2, 566, 761
3145331593 memory
3145431594 layout, 69
31455 merge_options/3, 1509
31595 merge_options/3, 1514
3145631596 message
31457 service, 1318
31458 message_hook/3, 242--246, 252, 709,
31459 1759
31597 service, 1322
31598 message_hook/3, 242--246, 252, 712,
31599 1765
3146031600 message_property/2, 41, 247
31461 message_queue_create/1, 914, 919,
31462 921
31463 message_queue_create/2, 919, 920,
31464 925
31465 message_queue_create/3, 930
31466 message_queue_destroy/1, 921, 922
31467 message_queue_property/2, 910, 925
31601 message_queue_create/1, 917, 922,
31602 924
31603 message_queue_create/2, 922, 923,
31604 928
31605 message_queue_create/3, 933
31606 message_queue_destroy/1, 924, 925
31607 message_queue_property/2, 913, 928
3146831608 message_to_string/2, 243, 245, 249
31469 meta-predicate, 1746
31470 meta_options/3, 805, 1510
31609 meta-predicate, 1752
31610 meta_options/3, 808, 1515
3147131611 meta_predicate/1, 41, 138, 189,
31472 302, 806, 807, 827, 835,
31473 1171, 1221, 1265
31474 min/2, 504
31475 min_assoc/3, 1314
31476 min_list/2, 1487
31477 min_member/2, 1484
31478 minimize/1, 1423
31479 minimize/3, 1651
31480 mod/2, 494
31481 module, 1746
31482 contex, 1746
31483 module transparent, 1746
31484 module/1, 41, 111, 293, 811, 812,
31485 901
31486 module/2, 136, 466, 467, 800--802,
31487 805, 816, 824, 835
31488 module/3, 802
31489 module_property/2, 833, 834
31490 module_transparent/1, 302, 807,
31491 810, 828, 835, 1171, 1746
31492 msb/1, 554
31493 msort/2, 566, 567
31612 302, 809, 810, 830, 838,
31613 1175, 1225, 1269
31614 min/2, 506
31615 min_assoc/3, 1318
31616 min_list/2, 1492
31617 min_member/2, 1489
31618 minimize/1, 1428
31619 minimize/3, 1657
31620 mod/2, 496
31621 mode, 1752
31622 module, 1752
31623 contex, 1752
31624 module transparent, 1752
31625 module/1, 41, 111, 293, 814, 815,
31626 904
31627 module/2, 136, 466, 467, 803--805,
31628 808, 819, 827, 838
31629 module/3, 805
31630 module_property/2, 836, 837
31631 module_transparent/1, 302, 810,
31632 813, 831, 838, 1175, 1752
31633 msb/1, 556
31634 msort/2, 569, 570
31635 multi, 1752
3149431636 multifile/1, 41, 116, 288, 291,
31495 302, 1730, 1746
31496 must_be/2, 1633
31497 mutex_create/1, 931, 934, 935
31498 mutex_create/2, 932, 939
31499 mutex_destroy/1, 933
31500 mutex_lock/1, 935, 936
31501 mutex_property/2, 939
31502 mutex_statistics/0, 912
31503 mutex_trylock/1, 936
31504 mutex_unlock/1, 937
31505 mutex_unlock_all/0, 938
31506 my_compare/3, 1745
31507 mypred/1, 813
31508 name/1, 806
31637 302, 1736, 1752
31638 must_be/2, 1639
31639 mutex_create/1, 934, 937, 938
31640 mutex_create/2, 935, 942
31641 mutex_destroy/1, 936
31642 mutex_lock/1, 938, 939
31643 mutex_property/2, 942
31644 mutex_statistics/0, 915
31645 mutex_trylock/1, 939
31646 mutex_unlock/1, 940
31647 mutex_unlock_all/0, 941
31648 my_compare/3, 1751
31649 mypred/1, 816
31650 name/1, 809
3150931651 name/2, 431, 438
31510 name_of/2, 1322
31511 nb_current/2, 868
31512 nb_delete/1, 869
31513 nb_getval/2, 866, 868
31514 nb_link_dict/3, 787
31652 name_of/2, 1326
31653 nb_current/2, 871
31654 nb_delete/1, 872
31655 nb_getval/2, 869, 871
31656 nb_link_dict/3, 790
3151531657 nb_linkarg/3, 427--429
31516 nb_linkval/2, 428, 429, 787, 867,
31517 870
31518 nb_set _l_i_b_r_a_r_y, 1495
31519 nb_set_dict/3, 786
31520 nb_set_to_list/2, 1501
31521 nb_setarg/3, 109, 426--429, 574,
31522 786, 1495, 1633
31523 nb_setval/2, 427, 429, 786, 862,
31524 865, 867, 870, 1728
31525 neck, 1746
31526 neighbors/3, 1683
31527 neighbours/3, 1682, 1683
31528 nextto/3, 1471
31658 nb_linkval/2, 428, 429, 790, 870,
31659 873
31660 nb_set _l_i_b_r_a_r_y, 1500
31661 nb_set_dict/3, 789
31662 nb_set_to_list/2, 1506
31663 nb_setarg/3, 109, 426--429, 577,
31664 789, 1500, 1639
31665 nb_setval/2, 427, 429, 789, 865,
31666 868, 870, 873, 1734
31667 neck, 1752
31668 neighbors/3, 1689
31669 neighbours/3, 1688, 1689
31670 nextto/3, 1476
3152931671 nl/0, 348
3153031672 nl/1, 349
3153131673 nl/[0
31532 1], 582
31533 nodebug/0, 680, 681, 1720
31534 nodebug/1, 1447
31535 noguitracer/0, 96, 98, 107, 676
31536 non deterministic, 1746
31537 nondet, 1746
31674 1], 585
31675 nodebug/0, 683, 684, 1726
31676 nodebug/1, 1452
31677 noguitracer/0, 96, 98, 107, 679
31678 non deterministic, 1752
31679 nondet, 1752
3153831680 nonvar/1, 178
31539 noprofile/1, 701
31540 noprotocol/0, 669
31681 noprofile/1, 704
31682 noprotocol/0, 672
3154131683 normalize_space/2, 462
31542 nospy/1, 32, 44, 684, 951, 1731
31543 nospyall/0, 44, 685, 1731
31544 not/1, 228, 1759
31545 notrace/0, 674, 887, 888
31546 notrace/1, 679
31547 nth0/3, 1473
31548 nth0/4, 1475
31549 nth1/3, 1474
31550 nth1/4, 1476
31551 nth_clause/3, 302, 306, 307, 1714
31684 nospy/1, 32, 44, 687, 954, 1737
31685 nospyall/0, 44, 688, 1737
31686 not/1, 228, 1765
31687 notrace/0, 677, 890, 891
31688 notrace/1, 682
31689 nth0/3, 1478
31690 nth0/4, 1480
31691 nth1/3, 1479
31692 nth1/4, 1481
31693 nth_clause/3, 302, 306, 307, 1720
31694 nth_integer_root_and_remainder/4, 478
3155231695 number
31553 rational, 485
31696 rational, 487
3155431697 number/1, 183
3155531698 number_chars/2, 110, 435, 436
3155631699 number_codes/2, 110, 431, 436--438
31557 number_string/2, 734
31558 number_to_chars/2, 1334
31559 number_to_chars/3, 1335
31560 numbervars/1, 1706
31700 number_string/2, 737
31701 number_to_chars/2, 1338
31702 number_to_chars/3, 1339
31703 numbervars/1, 1712
3156131704 numbervars/3, 60, 390, 419--421
3156231705 numbervars/4, 60, 393, 419, 420
31563 numlist/3, 1488
31564
31565 objective/2, 1652
31706 numlist/3, 1493
31707
31708 objective/2, 1658
3156631709 occurs_check, 205
31567 offset/2, 1663
31710 offset/2, 1669
3156831711 on_signal/3, 254, 255
31569 once/1, 229, 230, 233, 340, 574,
31570 660, 679, 696, 697, 930,
31571 934, 1176
31572 online_help _l_i_b_r_a_r_y, 1759
31573 op/3, 288, 390, 467, 468, 816
31574 open/3, 41, 308, 310, 312, 1139
31712 once/1, 229, 230, 233, 340, 577,
31713 663, 682, 699, 700, 933,
31714 937, 1180
31715 online_help _l_i_b_r_a_r_y, 1765
31716 op/3, 288, 390, 467, 468, 819
31717 open/3, 41, 109, 308, 310, 312,
31718 1143
3157531719 open/4, 65, 66, 110, 311, 312, 316,
31576 322, 323, 384, 453, 788,
31577 789, 1631, 1632
31578 open_any/5, 1459
31579 open_chars_stream/2, 1338
31580 open_dde_conversation/3, 713
31581 open_hook/6, 1461
31720 322, 323, 384, 453, 791,
31721 792, 1637, 1638
31722 open_any/5, 1464
31723 open_chars_stream/2, 1342
31724 open_dde_conversation/3, 716
31725 open_hook/6, 1466
3158231726 open_null_stream/1, 313, 322
31583 open_resource/3, 1262, 1269, 1272
31584 open_shared_object/2, 41, 613, 972,
31585 984, 985
31586 open_shared_object/3, 984, 985
31587 open_string/2, 752
31588 operand, 1746
31589 operator, 1746
31727 open_resource/3, 1266, 1273, 1276
31728 open_shared_object/2, 41, 616, 975,
31729 987, 988
31730 open_shared_object/3, 987, 988
31731 open_string/2, 755
31732 operand, 1752
31733 operator, 1752
3159031734 and modules, 466
31591 opt_arguments/3, 1514
31592 opt_help/2, 1517
31593 opt_parse/4, 1515
31594 opt_parse/5, 1516
31595 option _l_i_b_r_a_r_y, 788, 796, 1633
31596 option/2, 1506
31597 option/3, 1505
31598 options _l_i_b_r_a_r_y, 792
31599 ord_add_element/3, 1529
31600 ord_del_element/3, 1530
31601 ord_disjoint/2, 1524
31602 ord_empty/1, 1520
31603 ord_intersect/2, 1523
31604 ord_intersect/3, 1525
31605 ord_intersection/2, 1526
31606 ord_intersection/3, 1527
31607 ord_intersection/4, 1528
31608 ord_list_to_assoc/2, 1315
31609 ord_memberchk/2, 1532
31610 ord_selectchk/3, 1531
31611 ord_seteq/2, 1521
31612 ord_subset/2, 1533
31613 ord_subtract/3, 1534
31614 ord_symdiff/3, 1538
31615 ord_union/2, 1535
31616 ord_union/3, 1536
31617 ord_union/4, 1537
31618 order_by/2, 566, 1664
31619
31620 pack_info/1, 1580
31621 pack_install/1, 1583
31622 pack_install/2, 1584
31623 pack_list/1, 1582
31624 pack_list_installed/0, 1579
31625 pack_property/2, 1591
31626 pack_rebuild/0, 1587
31627 pack_rebuild/1, 1586
31628 pack_remove/1, 1590
31629 pack_search/1, 1581
31630 pack_upgrade/1, 1589
31631 pack_url_file/2, 1585
31632 pairs _l_i_b_r_a_r_y, 568, 788
31633 pairs_keys/2, 1542
31634 pairs_keys_values/3, 1540
31635 pairs_values/2, 1541
31636 parse_time/2, 624
31637 parse_time/3, 624, 625
31638 parse_url/2, 1695
31639 parse_url/3, 1696
31640 parse_url_search/2, 1702
31641 partition/4, 1288
31642 partition/5, 1289
31643 pce_dispatch/1, 965, 968
31644 pce_thread/1, 967
31735 opt_arguments/3, 1519
31736 opt_help/2, 1522
31737 opt_parse/4, 1520
31738 opt_parse/5, 1521
31739 option _l_i_b_r_a_r_y, 791, 799, 1639
31740 option/2, 1511
31741 option/3, 1510
31742 options _l_i_b_r_a_r_y, 795
31743 ord_add_element/3, 1535
31744 ord_del_element/3, 1536
31745 ord_disjoint/2, 1530
31746 ord_empty/1, 1526
31747 ord_intersect/2, 1529
31748 ord_intersect/3, 1531
31749 ord_intersection/2, 1532
31750 ord_intersection/3, 1533
31751 ord_intersection/4, 1534
31752 ord_list_to_assoc/2, 1319
31753 ord_memberchk/2, 1538
31754 ord_selectchk/3, 1537
31755 ord_seteq/2, 1527
31756 ord_subset/2, 1539
31757 ord_subtract/3, 1540
31758 ord_symdiff/3, 1544
31759 ord_union/2, 1541
31760 ord_union/3, 1542
31761 ord_union/4, 1543
31762 order_by/2, 569, 1670
31763
31764 pack_info/1, 1586
31765 pack_install/1, 1589
31766 pack_install/2, 1590
31767 pack_list/1, 1588
31768 pack_list_installed/0, 1585
31769 pack_property/2, 1597
31770 pack_rebuild/0, 1593
31771 pack_rebuild/1, 1592
31772 pack_remove/1, 1596
31773 pack_search/1, 1587
31774 pack_upgrade/1, 1595
31775 pack_url_file/2, 1591
31776 pairs _l_i_b_r_a_r_y, 571, 791
31777 pairs_keys/2, 1548
31778 pairs_keys_values/3, 1546
31779 pairs_values/2, 1547
31780 parse_time/2, 627
31781 parse_time/3, 627, 628
31782 parse_type/3, 1523
31783 parse_url/2, 1701
31784 parse_url/3, 1702
31785 parse_url_search/2, 1708
31786 partition/4, 1292
31787 partition/5, 1293
31788 pce_dispatch/1, 968, 971
31789 pce_thread/1, 970
3164531790 pce_xref _l_i_b_r_a_r_y, 103
3164631791 peek_byte/1, 373
3164731792 peek_byte/2, 374
3165631801 peek_code/[1
3165731802 2], 110
3165831803 peek_string/3, 379
31659 pengines _l_i_b_r_a_r_y, 574
31660 permission_error/3, 1144
31661 permutation/2, 1481
31662 persistent/1, 1547
31804 pengines _l_i_b_r_a_r_y, 577
31805 permission_error/3, 1148
31806 permutation/2, 1486
31807 persistent/1, 1553
3166331808 phrase/2, 257, 258
31664 phrase/3, 257, 259, 260, 753, 807,
31665 1759
31666 phrase_from_file/2, 1554
31667 phrase_from_file/3, 1555
31668 phrase_from_quasi_quotation/2, 1605
31669 phrase_from_stream/2, 1556
31670 pi/0, 549
31671 PL_abort_hook(), 1227
31672 PL_abort_unhook(), 1228
31673 PL_action(), 1216
31674 PL_agc_hook(), 1231
31675 PL_atom_chars(), 1011
31676 PL_atom_nchars(), 1067
31677 PL_atom_wchars(), 1070
31678 PL_backtrace(), 1217
31679 PL_blob_data(), 1159
31680 PL_BLOB_NOCOPY, 1148
31681 PL_BLOB_TEXT, 1148
31682 PL_BLOB_UNIQUE, 1148
31683 PL_call(), 1176
31684 PL_call_predicate(), 1175
31685 PL_chars_to_term(), 1119
31686 PL_cleanup(), 1239
31687 PL_cleanup_fork(), 1240
31688 PL_clear_exception(), 1191
31689 PL_close_foreign_frame(), 1179
31690 PL_close_query(), 1174
31691 PL_compare(), 1199
31692 PL_cons_functor(), 1097
31693 PL_cons_functor_v(), 1098
31694 PL_cons_list(), 1099
31695 PL_context(), 1183
31696 PL_copy_term_ref(), 993
31697 PL_create_engine(), 962
31698 PL_cut_query(), 1173
31699 PL_CYCLIC_TERM, 1079
31700 PL_destroy_engine(), 963
31701 PL_discard_foreign_frame(), 1180
31702 PL_dispatch_hook(), 1226
31703 PL_domain_error(), 1142
31704 PL_end_stubborn_change(), 1257
31705 PL_erase(), 1204
31706 PL_erase_external(), 1207
31707 PL_exception(), 1190
31708 PL_existence_error(), 1143
31709 PL_exit_hook(), 1230
31710 PL_fail(), 1000
31711 PL_foreign_context(), 1005
31712 PL_foreign_context_address(), 1006
31713 PL_foreign_control(), 1004
31714 PL_free(), 1251
31715 PL_functor_arity(), 1014
31716 PL_functor_name(), 1013
31717 PL_get_arg(), 1052
31718 PL_get_atom(), 1036
31719 PL_get_atom_chars(), 1037
31720 PL_get_atom_ex(), 1123
31721 PL_get_atom_nchars(), 1055
31722 PL_get_blob(), 1158
31723 PL_get_bool(), 1045
31724 PL_get_bool_ex(), 1129
31725 PL_get_char_ex(), 1131
31726 PL_get_chars(), 1039
31727 PL_get_compound_name_arity(), 1050
31728 PL_get_file_name(), 1209
31729 PL_get_file_nameW(), 1210
31730 PL_get_float(), 1047
31731 PL_get_float_ex(), 1130
31732 PL_get_functor(), 1048
31733 PL_get_head(), 1076
31734 PL_get_int64(), 1043
31735 PL_get_int64_ex(), 1126
31736 PL_get_integer(), 1041
31737 PL_get_integer_ex(), 1124
31738 PL_get_intptr(), 1044
31739 PL_get_intptr_ex(), 1127
31740 PL_get_list(), 1075
31741 PL_get_list_chars(), 1040
31742 PL_get_list_ex(), 1133
31743 PL_get_list_nchars(), 1056
31744 PL_get_long(), 1042
31745 PL_get_long_ex(), 1125
31746 PL_get_module(), 1051
31747 PL_get_mpq(), 1162
31748 PL_get_mpz(), 1161
31749 PL_get_name_arity(), 1049
31750 PL_get_nchars(), 1057
31751 PL_get_nil(), 1078
31752 PL_get_nil_ex(), 1134
31753 PL_get_pointer(), 1046
31754 PL_get_pointer_ex(), 1132
31755 PL_get_signum_ex(), 1196
31756 PL_get_size_ex(), 1128
31757 PL_get_string_chars(), 1038
31758 PL_get_tail(), 1077
31759 PL_get_wchars(), 1071
31760 PL_halt(), 1241
31761 PL_handle_signals(), 1195
31762 PL_initialise(), 1235
31763 PL_install_readline(), 1237
31764 PL_instantiation_error(), 1138
31765 PL_is_acyclic(), 1034
31766 PL_is_atom(), 1023
31767
31768 1799
31809 phrase/3, 257, 259, 260, 756, 810,
31810 1765
31811 phrase_from_file/2, 1560
31812 phrase_from_file/3, 1561
31813 phrase_from_quasi_quotation/2, 1611
31814 phrase_from_stream/2, 1562
31815 pi/0, 551
31816 PL_abort_hook(), 1231
31817 PL_abort_unhook(), 1232
31818 PL_action(), 1220
31819 PL_agc_hook(), 1235
31820 PL_atom_chars(), 1015
31821 PL_atom_nchars(), 1071
31822 PL_atom_wchars(), 1074
31823 PL_backtrace(), 1221
31824 PL_blob_data(), 1163
31825 PL_BLOB_NOCOPY, 1152
31826 PL_BLOB_TEXT, 1152
31827 PL_BLOB_UNIQUE, 1152
31828 PL_call(), 1180
31829 PL_call_predicate(), 1179
31830 PL_chars_to_term(), 1123
31831 PL_cleanup(), 1243
31832 PL_cleanup_fork(), 1244
31833 PL_clear_exception(), 1195
31834 PL_close_foreign_frame(), 1183
31835 PL_close_query(), 1178
31836 PL_compare(), 1203
31837 PL_cons_functor(), 1101
31838 PL_cons_functor_v(), 1102
31839 PL_cons_list(), 1103
31840 PL_context(), 1187
31841 PL_copy_term_ref(), 996
31842 PL_create_engine(), 965
31843 PL_cut_query(), 1177
31844 PL_CYCLIC_TERM, 1083
31845 PL_destroy_engine(), 966
31846 PL_discard_foreign_frame(), 1184
31847 PL_dispatch_hook(), 1230
31848 PL_domain_error(), 1146
31849 PL_end_stubborn_change(), 1261
31850 PL_erase(), 1208
31851 PL_erase_external(), 1211
31852 PL_exception(), 1194
31853 PL_existence_error(), 1147
31854 PL_exit_hook(), 1234
31855 PL_fail(), 1003
31856 PL_foreign_context(), 1008
31857 PL_foreign_context_address(), 1009
31858 PL_foreign_context_predicate(), 1010
31859 PL_foreign_control(), 1007
31860 PL_free(), 1255
31861 PL_functor_arity(), 1018
31862 PL_functor_name(), 1017
31863 PL_get_arg(), 1056
31864 PL_get_atom(), 1040
31865 PL_get_atom_chars(), 1041
31866 PL_get_atom_ex(), 1127
31867 PL_get_atom_nchars(), 1059
31868 PL_get_blob(), 1162
31869 PL_get_bool(), 1049
31870 PL_get_bool_ex(), 1133
31871 PL_get_char_ex(), 1135
31872 PL_get_chars(), 1043
31873 PL_get_compound_name_arity(), 1054
31874 PL_get_file_name(), 1213
31875 PL_get_file_nameW(), 1214
31876 PL_get_float(), 1051
31877 PL_get_float_ex(), 1134
31878 PL_get_functor(), 1052
31879 PL_get_head(), 1080
31880 PL_get_int64(), 1047
31881 PL_get_int64_ex(), 1130
31882 PL_get_integer(), 1045
31883 PL_get_integer_ex(), 1128
31884 PL_get_intptr(), 1048
31885 PL_get_intptr_ex(), 1131
31886 PL_get_list(), 1079
31887 PL_get_list_chars(), 1044
31888 PL_get_list_ex(), 1137
31889 PL_get_list_nchars(), 1060
31890 PL_get_long(), 1046
31891 PL_get_long_ex(), 1129
31892 PL_get_module(), 1055
31893 PL_get_mpq(), 1166
31894 PL_get_mpz(), 1165
31895 PL_get_name_arity(), 1053
31896 PL_get_nchars(), 1061
31897 PL_get_nil(), 1082
31898 PL_get_nil_ex(), 1138
31899 PL_get_pointer(), 1050
31900 PL_get_pointer_ex(), 1136
31901 PL_get_signum_ex(), 1200
31902 PL_get_size_ex(), 1132
31903
31904 1805
161161 % solutions, i.e., the minumum and maximum of an empty set is
162162 % undefined.
163163
164 aggregate_all(Var, _, _) :-
165 var(Var), !,
166 instantiation_error(Var).
164167 aggregate_all(count, Goal, Count) :- !,
165 State = state(0, _),
166 ( Goal,
167 arg(1, State, C0),
168 C1 is C0+1,
169 nb_setarg(1, State, C1),
170 fail
171 ; arg(1, State, Count)
168 aggregate_all(sum(1), Goal, Count).
169 aggregate_all(sum(X), Goal, Sum) :- !,
170 State = state(0),
171 ( call(Goal),
172 arg(1, State, S0),
173 S is S0 + X,
174 nb_setarg(1, State, S),
175 fail
176 ; arg(1, State, Sum)
177 ).
178 aggregate_all(max(X), Goal, Max) :- !,
179 State = state(X),
180 ( call(Goal),
181 arg(1, State, M0),
182 M is max(M0,X),
183 nb_setarg(1, State, M),
184 fail
185 ; arg(1, State, Max),
186 nonvar(Max)
187 ).
188 aggregate_all(min(X), Goal, Min) :- !,
189 State = state(X),
190 ( call(Goal),
191 arg(1, State, M0),
192 M is min(M0,X),
193 nb_setarg(1, State, M),
194 fail
195 ; arg(1, State, Min),
196 nonvar(Min)
172197 ).
173198 aggregate_all(Template, Goal0, Result) :-
174199 template_to_pattern(all, Template, Pattern, Goal0, Goal, Aggregate),
188213 sort(Pairs0, Pairs),
189214 pairs_values(Pairs, List),
190215 aggregate_list(Aggregate, List, Result).
191
192216
193217 template_to_pattern(All, Template, Pattern, Goal0, Goal, Aggregate) :-
194218 template_to_pattern(Template, Pattern, Post, Vars, Aggregate),
165165 -> call(Pre)
166166 ; true
167167 ),
168 load_files(Source, [silent(true)])
168 load_files(Source, [silent(true), if(not_loaded)])
169169 ),
170170 Properties.put(action, load))
171171 -> test_component(Properties),
292292 maplist(del_bdd, Roots),
293293 maplist(=(Root), Roots),
294294 root_put_formula_bdd(Root, And, BDD1),
295 is_bdd(BDD1),
295296 satisfiable_bdd(BDD1)
296297 ).
297298
356357
357358 taut(Sat0, T) :-
358359 parse_sat(Sat0, Sat),
359 sat_roots(Sat, Roots),
360 catch((roots_and(Roots, _-1, _-Ands),
361 ( T = 0, unsatisfiable_conjunction(Sat, Ands) -> true
362 ; T = 1, unsatisfiable_conjunction(1#Sat, Ands) -> true
363 ; false
364 ),
365 % reset all attributes
366 throw(truth(T))),
367 truth(T),
368 true).
369
370 unsatisfiable_conjunction(Sat, Ands) :-
371 sat_bdd(Sat, BDD),
372 bdd_and(BDD, Ands, B),
373 B == 0.
360 ( T = 0, \+ sat(Sat) -> true
361 ; T = 1, tautology(Sat) -> true
362 ; false
363 ).
364
365 tautology(Sat) :-
366 ( phrase(sat_ands(Sat), Ands), Ands = [_,_|_] ->
367 maplist(tautology, Ands)
368 ; \+ sat(1#Sat)
369 ).
374370
375371 satisfiable_bdd(BDD) :-
376372 ( BDD == 0 -> false
377373 ; BDD == 1 -> true
378 ; bdd_variables(BDD, Vs),
379 node_var_low_high(BDD, Var, _, _),
380 var_index(Var, Lowest),
381 maplist(variable_definite_value(BDD,Lowest), Vs, Values),
382 ( maplist(var, Values) -> true % nothing to propagate
383 ; Vs = Values % propagate all assignments at once
374 ; ( bdd_nodes(var_unbound, BDD, Nodes) ->
375 bdd_variables_classification(BDD, Nodes, Classes),
376 partition(var_class, Classes, Eqs, Bs, Ds),
377 domain_consistency(Eqs, Goal),
378 aliasing_consistency(Bs, Ds, Goals),
379 maplist(unification, [Goal|Goals])
380 ; % if any variable is instantiated, we do not perform
381 % any propagation for now
382 true
384383 )
385384 ).
386385
387 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
388 We walk the BDD and check for the given variable if only a single
389 value can make the formula true. This means: The variable is not
390 skipped in any branch leading to 1 (its being skipped means that it
391 may be assigned either 0 or 1 and can thus not be fixed yet), and
392 all nodes where it occurs as a branching variable have either lower
393 or upper child fixed to 0 consistently.
394 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
395
396 variable_definite_value(BDD, Lowest, Var, Value) :-
397 var_index(Var, VI),
398 ( VI < Lowest ->
399 Value = _ % either value is possible
400 ; ( bdd_nodes(var_always_0(VI), BDD, _) -> Value = 0
401 ; bdd_nodes(var_always_1(VI), BDD, _) -> Value = 1
402 ; Value = _ % either value is possible
386 var_class(_=_, <).
387 var_class(further_branching(_,_), =).
388 var_class(negative_decisive(_), >).
389
390 unification(true).
391 unification(A=B) :- A = B. % safe_goal/1 detects safety of this call
392
393 var_unbound(Node) :-
394 node_var_low_high(Node, Var, _, _),
395 var(Var).
396
397 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
398 By aliasing consistency, we mean that all unifications X=Y, where
399 taut(X=:=Y, 1) holds, are posted.
400
401 To detect this, we distinguish two kinds of variables among those
402 variables that are not skipped in any branch: further-branching and
403 negative-decisive. X is negative-decisive iff every node where X
404 appears as a branching variable has 0 as one of its children. X is
405 further-branching iff 1 is not a direct child of any node where X
406 appears as a branching variable.
407
408 Any potential aliasing must involve one further-branching, and one
409 negative-decisive variable. X=Y must hold if, for each low branch
410 of nodes with X as branching variable, Y has high branch 0, and for
411 each high branch of nodes involving X, Y has low branch 0.
412 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
413
414 aliasing_consistency(Bs, Ds, Goals) :-
415 phrase(aliasings(Bs, Ds), Goals).
416
417 aliasings([], _) --> [].
418 aliasings([further_branching(B,Nodes)|Bs], Ds) -->
419 { var_index(B, BI) },
420 aliasings_(Ds, B, BI, Nodes),
421 aliasings(Bs, Ds).
422
423 aliasings_([], _, _, _) --> [].
424 aliasings_([negative_decisive(D)|Ds], B, BI, Nodes) -->
425 { var_index(D, DI) },
426 ( { DI > BI,
427 always_false(high, DI, Nodes),
428 always_false(low, DI, Nodes) } ->
429 [D=B]
430 ; []
431 ),
432 aliasings_(Ds, B, BI, Nodes).
433
434 always_false(Which, DI, Nodes) :-
435 phrase(nodes_always_false(Nodes, Which, DI), Opposites),
436 maplist(with_aux(unvisit), Opposites).
437
438 nodes_always_false([], _, _) --> [].
439 nodes_always_false([Node|Nodes], Which, DI) -->
440 { which_node_child(Which, Node, Child),
441 opposite(Which, Opposite) },
442 opposite_always_false(Opposite, DI, Child),
443 nodes_always_false(Nodes, Which, DI).
444
445 which_node_child(low, Node, Child) :-
446 node_var_low_high(Node, _, Child, _).
447 which_node_child(high, Node, Child) :-
448 node_var_low_high(Node, _, _, Child).
449
450 opposite(low, high).
451 opposite(high, low).
452
453 opposite_always_false(Opposite, DI, Node) -->
454 ( { node_visited(Node) } -> []
455 ; { node_var_low_high(Node, Var, Low, High),
456 with_aux(put_visited, Node),
457 var_index(Var, VI) },
458 [Node],
459 ( { VI =:= DI } ->
460 { which_node_child(Opposite, Node, Child),
461 Child == 0 }
462 ; opposite_always_false(Opposite, DI, Low),
463 opposite_always_false(Opposite, DI, High)
403464 )
404465 ).
405466
406 var_always_0(VI, Node) :-
407 node_var_low_high(Node, OVar, Low, High),
408 single_truth_value(VI, OVar, High, Low). % note reverse order!
409
410 var_always_1(VI, Node) :-
411 node_var_low_high(Node, OVar, Low, High),
412 single_truth_value(VI, OVar, Low, High).
413
414 single_truth_value(VI, OVar, Child1, Child2) :-
415 % If any variable is instantiated, the following fails, as intended.
416 % This only means that we do not perform any propagation for now.
417 var_index(OVar, OVI),
418 ( VI =:= OVI -> Child1 == 0
419 ; OVI > VI -> true
420 ; % OVI < VI ->
421 \+ index_skipped(VI, Child1),
422 \+ index_skipped(VI, Child2)
423 ).
424
425 index_skipped(VI, ChildNode) :-
426 ( ChildNode == 0 -> false
427 ; ChildNode == 1 -> true
428 ; node_var_low_high(ChildNode, ChildVar, _, _),
429 var_index(ChildVar, ChildIndex),
430 VI < ChildIndex
467 further_branching(Node) :-
468 node_var_low_high(Node, _, Low, High),
469 Low \== 1,
470 High \== 1.
471
472 negative_decisive(Node) :-
473 node_var_low_high(Node, _, Low, High),
474 ( Low == 0 -> true
475 ; High == 0 -> true
476 ; false
477 ).
478
479 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
480 Instantiate all variables that only admit a single Boolean value.
481
482 This is the case if: The variable is not skipped in any branch
483 leading to 1 (its being skipped means that it may be assigned
484 either 0 or 1 and can thus not be fixed yet), and all nodes where
485 it occurs as a branching variable have either lower or upper child
486 fixed to 0 consistently.
487 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
488
489 domain_consistency(Eqs, Goal) :-
490 maplist(eq_a_b, Eqs, Vs, Values),
491 Goal = (Vs = Values). % propagate all assignments at once
492
493 eq_a_b(A=B, A, B).
494
495 consistently_false_(Which, Node) :-
496 which_node_child(Which, Node, Child),
497 Child == 0.
498
499 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
500 In essentially one sweep of the BDD, all variables can be classified:
501 Unification with 0 or 1, further branching and/or negative decisive.
502
503 Strategy: Breadth-first traversal of the BDD, failing (and thus
504 clearing all attributes) if the variable is skipped in some branch,
505 and moving the frontier along each time.
506 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
507
508 bdd_variables_classification(BDD, Nodes, Classes) :-
509 nodes_variables(Nodes, Vs0),
510 variables_in_index_order(Vs0, Vs),
511 phrase(variables_classification(Vs, [BDD]), Classes),
512 maplist(with_aux(unvisit), Nodes).
513
514 variables_classification([], _) --> [].
515 variables_classification([V|Vs], Nodes0) -->
516 { var_index(V, Index) },
517 ( { phrase(nodes_with_variable(Nodes0, Index), Nodes) } ->
518 ( { maplist(consistently_false_(low), Nodes) } -> [V=1]
519 ; { maplist(consistently_false_(high), Nodes) } -> [V=0]
520 ; []
521 ),
522 ( { maplist(further_branching, Nodes) } ->
523 [further_branching(V, Nodes)]
524 ; []
525 ),
526 ( { maplist(negative_decisive, Nodes) } ->
527 [negative_decisive(V)]
528 ; []
529 ),
530 { maplist(with_aux(unvisit), Nodes) },
531 variables_classification(Vs, Nodes)
532 ; variables_classification(Vs, Nodes0)
533 ).
534
535 nodes_with_variable([], _) --> [].
536 nodes_with_variable([Node|Nodes], VI) -->
537 { Node \== 1 },
538 ( { node_visited(Node) } -> nodes_with_variable(Nodes, VI)
539 ; { with_aux(put_visited, Node),
540 node_var_low_high(Node, OVar, Low, High),
541 var_index(OVar, OVI) },
542 { OVI =< VI },
543 ( { OVI =:= VI } -> [Node]
544 ; nodes_with_variable([Low,High], VI)
545 ),
546 nodes_with_variable(Nodes, VI)
431547 ).
432548
433549 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
520636 same_length([_|Fs], Indicators),
521637 fill_indicators(Indicators, 0, Cs),
522638 phrase(formulas_variables(Fs, Vars0), ExBDDs),
639 maplist(unvisit, Vars0),
523640 % The counter network is built bottom-up, so variables with
524641 % highest index must be processed first.
525642 variables_in_index_order(Vars0, Vars1),
529646
530647 % Introduce fresh variables for expressions that are not variables.
531648 % These variables are later existentially quantified to remove them.
649 % Also, new variables are introduced for variables that are used more
650 % than once, as in card([0,1],[X,X,Y]), to keep the BDD ordered.
532651
533652 formulas_variables([], []) --> [].
534653 formulas_variables([F|Fs], [V|Vs]) -->
535 ( { var(F) } -> { V = F }
654 ( { var(F), \+ is_visited(F) } ->
655 { V = F,
656 put_visited(F) }
536657 ; { enumerate_variable(V),
537658 sat_rewrite(V =:= F, Sat),
538659 sat_bdd(Sat, BDD) },
692813 satisfiable_bdd(BDD)
693814 ; no_truth_value(Other)
694815 )
695 ; parse_sat(Other, OtherSat),
816 ; % due to variable aliasing, any BDDs may now be unordered,
817 % so we need to rebuild the new BDD from the conjunction.
696818 root_get_formula_bdd(Root, Sat0, _),
697819 Sat = Sat0*OtherSat,
698 sat_roots(Sat, Roots),
699 maplist(root_rebuild_bdd, Roots),
700 roots_and(Roots, 1-1, And-BDD1),
820 ( var(Other), var_index_root(Other, _, OtherRoot),
821 OtherRoot \== Root ->
822 root_get_formula_bdd(OtherRoot, OtherSat, _),
823 parse_sat(Sat, Sat1),
824 sat_bdd(Sat1, BDD1),
825 And = Sat1,
826 sat_roots(Sat, Roots)
827 ; parse_sat(Other, OtherSat),
828 sat_roots(Sat, Roots),
829 maplist(root_rebuild_bdd, Roots),
830 roots_and(Roots, 1-1, And-BDD1)
831 ),
701832 maplist(del_bdd, Roots),
702833 maplist(=(NewRoot), Roots),
703834 root_put_formula_bdd(NewRoot, And, BDD1),
810941 maplist(with_aux(unvisit), Ns).
811942
812943 bdd_nodes_(VPred, Node) -->
813 ( { integer(Node) ; with_aux(is_visited, Node) } -> []
944 ( { node_visited(Node) } -> []
814945 ; { call(VPred, Node),
815946 with_aux(put_visited, Node),
816947 node_var_low_high(Node, _, Low, High) },
818949 bdd_nodes_(VPred, Low),
819950 bdd_nodes_(VPred, High)
820951 ).
952
953 node_visited(Node) :- integer(Node).
954 node_visited(Node) :- with_aux(is_visited, Node).
821955
822956 bdd_variables(BDD, Vs) :-
823957 bdd_nodes(BDD, Nodes),
864998 ( member(ITE, ITEs), \+ registered_node(ITE) ->
865999 domain_error(registered_node, ITE)
8661000 ; true
1001 ),
1002 ( member(I, ITEs), \+ ordered(I) ->
1003 domain_error(ordered_node, I)
1004 ; true
8671005 )
8681006 ; true
8691007 ).
8701008
1009 ordered(_-ite(Var,High,Low)) :-
1010 ( var_index(Var, VI) ->
1011 greater_varindex_than(High, VI),
1012 greater_varindex_than(Low, VI)
1013 ; true
1014 ).
1015
1016 greater_varindex_than(Node, VI) :-
1017 ( integer(Node) -> true
1018 ; node_var_low_high(Node, Var, _, _),
1019 ( var_index(Var, OI) ->
1020 OI > VI
1021 ; true
1022 )
1023 ).
1024
8711025 registered_node(Node-ite(Var,High,Low)) :-
872 low_high_key(Low, High, Key),
873 lookup_node(Var, Key, Node0),
874 Node == Node0.
1026 ( var(Var) ->
1027 low_high_key(Low, High, Key),
1028 lookup_node(Var, Key, Node0),
1029 Node == Node0
1030 ; true
1031 ).
8751032
8761033 bdd_ites(BDD, ITEs) :-
8771034 bdd_nodes(BDD, Nodes),
8801037 node_ite(Node, Node-ite(Var,High,Low)) :-
8811038 node_var_low_high(Node, Var, Low, High).
8821039
883 %% labeling(+Vs) is nondet.
1040 %% labeling(+Vs) is multi.
8841041 %
8851042 % Assigns truth values to the Boolean variables Vs such that all
8861043 % stated constraints are satisfied.
9721129 ).
9731130
9741131 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1132 Pick a solution in such a way that each solution is equally likely.
1133 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
1134
1135 random_solution(Seed, Vars) :-
1136 must_be(list, Vars),
1137 set_random(seed(Seed)),
1138 ( ground(Vars) -> true
1139 ; catch((sat(+[1|Vars]), % capture all variables with a single BDD
1140 once((member(Var, Vars),var(Var))),
1141 var_index_root(Var, _, Root),
1142 root_get_formula_bdd(Root, _, BDD),
1143 bdd_variables(BDD, Vs),
1144 variables_in_index_order(Vs, IVs),
1145 foldl(renumber_variable, IVs, 1, VNum),
1146 phrase(random_bindings(VNum, BDD), Bs),
1147 maplist(del_attrs, Vs),
1148 % reset all attribute modifications
1149 throw(randsol(Vars, Bs))),
1150 randsol(Vars, Bs),
1151 true),
1152 maplist(call, Bs),
1153 % set remaining variables to 0 or 1 with equal probability
1154 include(var, Vars, Remaining),
1155 maplist(maybe_one, Remaining)
1156 ).
1157
1158 maybe_one(Var) :-
1159 ( maybe -> Var = 0
1160 ; Var = 1
1161 ).
1162
1163 random_bindings(_, Node) --> { Node == 1 }, !.
1164 random_bindings(VNum, Node) -->
1165 { node_var_low_high(Node, Var, Low, High),
1166 bdd_count(Node, VNum, Total),
1167 bdd_count(Low, VNum, LCount) },
1168 ( { maybe(LCount, Total) } ->
1169 [Var=0], random_bindings(VNum, Low)
1170 ; [Var=1], random_bindings(VNum, High)
1171 ).
1172
1173 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9751174 Projection to residual goals.
9761175 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
9771176
9781177 attribute_goals(Var) -->
9791178 { var_index_root(Var, _, Root) },
9801179 ( { root_get_formula_bdd(Root, Formula, BDD) } ->
981 { del_bdd(Root),
982 phrase(sat_ands(Formula), Ands),
983 maplist(formula_anf, Ands, ANFs0),
984 sort(ANFs0, ANFs1),
985 exclude(eq_1, ANFs1, ANFs),
986 % formula variables not occurring in the BDD should be booleans
987 bdd_variables(BDD, Vs),
1180 { del_bdd(Root) },
1181 ( { current_prolog_flag(clpb_residuals, bdd) } ->
1182 { bdd_nodes(BDD, Nodes) },
1183 nodes(Nodes)
1184 ; { phrase(sat_ands(Formula), Ands),
1185 maplist(formula_anf, Ands, ANFs0),
1186 sort(ANFs0, ANFs1),
1187 exclude(eq_1, ANFs1, ANFs) },
1188 sats(ANFs)
1189 ),
1190 % formula variables not occurring in the BDD should be booleans
1191 { bdd_variables(BDD, Vs),
9881192 maplist(del_clpb, Vs),
9891193 term_variables(Formula, RestVs0),
9901194 include(clpb_variable, RestVs0, RestVs) },
991 sats(ANFs),
9921195 booleans(RestVs)
9931196 ; boolean(Var) % the variable may have occurred only in taut/2
9941197 ).
9951198
1199 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1200 Set the Prolog flag clpb_residuals to bdd to obtain the BDD nodes
1201 as residuals. Note that they cannot be used as regular goals.
1202 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
1203
1204 nodes([]) --> [].
1205 nodes([Node|Nodes]) -->
1206 { node_var_low_high(Node, Var, Low, High),
1207 maplist(node_projection, [Node,High,Low], [ID,HID,LID]),
1208 var_index(Var, VI) },
1209 [ID-(v(Var,VI) -> HID ; LID)],
1210 nodes(Nodes).
1211
1212
1213 node_projection(Node, Projection) :-
1214 node_id(Node, ID),
1215 ( integer(ID) -> Projection = node(ID)
1216 ; Projection = ID
1217 ).
1218
1219
9961220 del_clpb(Var) :- del_attr(Var, clpb).
9971221
1222 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1223 By default, residual goals are sat/1 calls of the remaining formulas,
1224 using (mostly) algebraic normal form.
1225 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
1226
9981227 sats([]) --> [].
999 sats([A|As]) --> [sat(A)], sats(As).
1228 sats([A|As]) -->
1229 { copy_term_nat(A, Copy) },
1230 ( { Copy =@= X#Y, A = X#Y } -> [sat(X=\=Y)]
1231 ; { Copy =@= 1#X#Y, A = 1#X#Y } -> [sat(X=:=Y)]
1232 ; [sat(A)]
1233 ),
1234 sats(As).
10001235
10011236 booleans([]) --> [].
1002 booleans([B|Bs]) --> boolean(B), booleans(Bs).
1237 booleans([B|Bs]) --> boolean(B), { del_clpb(B) }, booleans(Bs).
10031238
10041239 boolean(Var) -->
10051240 ( { get_attr(Var, clpb_omit_boolean, true) } -> []
162162 combinatorial problems such as planning, scheduling and
163163 allocation tasks.
164164
165 When teaching Prolog, we _strongly_ recommend that you introduce
165 When teaching Prolog, we _strongly recommend_ that you introduce
166166 CLP(FD) constraints _before_ explaining lower-level arithmetic
167167 predicates and their procedural idiosyncrasies. This is because
168168 constraints are easy to explain, understand and use due to their
183183 rewritten at compilation time so that lower-level fallback predicates
184184 are automatically used whenever possible.
185185
186 You can cite this library in your publications as:
186 We recommend the following reference to cite this library in
187 scientific publications:
187188
188189 ==
189190 @inproceedings{Triska12,
197198 }
198199 ==
199200
201 and the following URL to link to its documentation:
202
203 ==
204 http://www.swi-prolog.org/man/clpfd.html
205 ==
206
200207 ### Arithmetic constraints {#cplfd-arith-constraints}
201208
202209 A finite domain _arithmetic expression_ is one of:
211218 | Expr ^ Expr | Exponentiation |
212219 | min(Expr,Expr) | Minimum of two expressions |
213220 | max(Expr,Expr) | Maximum of two expressions |
214 | Expr mod Expr | Modulo induced by floored division |
215 | Expr rem Expr | Modulo induced by truncated division |
221 | Expr `mod` Expr | Modulo induced by floored division |
222 | Expr `rem` Expr | Modulo induced by truncated division |
216223 | abs(Expr) | Absolute value |
217224 | Expr // Expr | Truncated integer division |
218225
220227
221228 The most important arithmetic constraints are:
222229
223 | Expr1 #>= Expr2 | Expr1 is greater than or equal to Expr2 |
224 | Expr1 #=< Expr2 | Expr1 is less than or equal to Expr2 |
225 | Expr1 #= Expr2 | Expr1 equals Expr2 |
226 | Expr1 #\= Expr2 | Expr1 is not equal to Expr2 |
227 | Expr1 #> Expr2 | Expr1 is greater than Expr2 |
228 | Expr1 #< Expr2 | Expr1 is less than Expr2 |
230 | Expr1 `#>=` Expr2 | Expr1 is greater than or equal to Expr2 |
231 | Expr1 `#=<` Expr2 | Expr1 is less than or equal to Expr2 |
232 | Expr1 `#=` Expr2 | Expr1 equals Expr2 |
233 | Expr1 `#\=` Expr2 | Expr1 is not equal to Expr2 |
234 | Expr1 `#>` Expr2 | Expr1 is greater than Expr2 |
235 | Expr1 `#<` Expr2 | Expr1 is less than Expr2 |
229236
230237 ### Declarative integer arithmetic {#clpfd-integer-arith}
231238
232239 CLP(FD) constraints let you declaratively express integer arithmetic.
233240 The CLP(FD) constraints #=/2, #>/2 etc. are meant to be used instead
234 of the corresponding primitives is/2, =:=/2, >/2 etc.
241 of the corresponding primitives is/2, =:=/2, >/2 etc. over integers.
235242
236243 An important advantage of arithmetic constraints is their purely
237244 relational nature. They are therefore easy to explain and use, and
314321
315322 The constraints of this table are reifiable as well.
316323
324 When reasoning over Boolean variables, also consider using
325 `library(clpb)` and its dedicated CLP(B) constraints.
326
317327 ### Domains {#clpfd-domains}
318328
319329 Each CLP(FD) variable has an associated set of admissible integers
394404 concrete solutions.
395405
396406 It is good practice to keep the modeling part, via a dedicated
397 predicate, separate from the actual search for solutions. This lets
398 you observe termination and determinism properties of the modeling
399 part in isolation from the search, and more easily try different
400 search strategies.
407 predicate called the *core relation*, separate from the actual
408 search for solutions. This lets you observe termination and
409 determinism properties of the core relation in isolation from the
410 search, and more easily try different search strategies.
401411
402412 As an example of a constraint satisfaction problem, consider the
403413 cryptoarithmetic puzzle SEND + MORE = MONEY, where different letters
436446 C5 in 2..8.
437447 ==
438448
439 From this answer, we see that the modeling part _terminates_ and is in
449 From this answer, we see that this core relation _terminates_ and is in
440450 fact _deterministic_. Moreover, we see from the residual goals that
441451 the constraint solver has deduced more stringent bounds for all
442452 variables. Such observations are only possible if modeling and search
458468 to reduce the domains of remaining variables to singleton sets. In
459469 general though, it is necessary to label all variables to obtain
460470 ground solutions.
471
472 ### Optimisation {#clpfd-optimisation}
473
474 You can use labeling/2 to minimize or maximize the value of a CLP(FD)
475 expression, and generate solutions in increasing or decreasing order
476 of the value. See the labeling options `min(Expr)` and `max(Expr)`,
477 respectively.
478
479 Again, to easily try different labeling options in connection with
480 optimisation, we recommend to introduce a dedicated predicate for
481 posting constraints, and to use `labeling/2` in a separate goal. This
482 way, you can observe properties of the core relation in isolation,
483 and try different labeling options without recompiling your code.
484
485 If necessary, you can use `once/1` to commit to the first optimal
486 solution. However, it is often very valuable to see alternative
487 solutions that are _also_ optimal, so that you can choose among
488 optimal solutions by other criteria. For the sake of purity and
489 completeness, we recommend to avoid `once/1` and other constructs
490 that lead to impurities in CLP(FD) programs.
461491
462492 ### Advanced topics {#clpfd-advanced-topics}
463493
16661696 all_different(Ls) :-
16671697 fd_must_be_list(Ls),
16681698 maplist(fd_variable, Ls),
1669 put_attr(Orig, clpfd_original, all_different(Ls)),
1699 Orig = original_goal(_, all_different(Ls)),
16701700 all_different(Ls, [], Orig),
16711701 do_queue.
16721702
20522082 m(A mod B) => [g(B #\= 0), p(pmod(A, B, R))],
20532083 m(A rem B) => [g(B #\= 0), p(prem(A, B, R))],
20542084 m(abs(A)) => [g(?(R) #>= 0), p(pabs(A, R))],
2055 m(A/B) => [g(B #\= 0), p(ptzdiv(A, B, R))],
2085 % m(A/B) => [g(B #\= 0), p(ptzdiv(A, B, R))],
20562086 m(A//B) => [g(B #\= 0), p(ptzdiv(A, B, R))],
20572087 m(A div B) => [g(?(R) #= (A - (A mod B)) // B)],
20582088 m(A rdiv B) => [g(B #\= 0), p(prdiv(A, B, R))],
23732403 expr_conds(A0//B0, A//B) -->
23742404 expr_conds(A0, A), expr_conds(B0, B),
23752405 [B =\= 0].
2376 expr_conds(A0/B0, AB) --> expr_conds(A0//B0, AB).
2406 %expr_conds(A0/B0, AB) --> expr_conds(A0//B0, AB).
23772407 expr_conds(min(A0,B0), min(A,B)) --> expr_conds(A0, A), expr_conds(B0, B).
23782408 expr_conds(max(A0,B0), max(A,B)) --> expr_conds(A0, A), expr_conds(B0, B).
23792409 expr_conds(A0 mod B0, A mod B) -->
23842414 [(B >= 0 ; A =:= -1)].
23852415
23862416 :- multifile
2387 user:goal_expansion/2.
2417 system:goal_expansion/2.
23882418 :- dynamic
2389 user:goal_expansion/2.
2390
2391 user:goal_expansion(Var in Dom, In) :-
2419 system:goal_expansion/2.
2420
2421 system:goal_expansion(Goal, Expansion) :-
23922422 \+ current_prolog_flag(clpfd_goal_expansion, false),
2423 clpfd_expandable(Goal),
2424 prolog_load_context(module, M),
2425 ( M == clpfd
2426 -> true
2427 ; predicate_property(M:Goal, imported_from(clpfd))
2428 ),
2429 clpfd_expansion(Goal, Expansion).
2430
2431 clpfd_expandable(_ in _).
2432 clpfd_expandable(_ #= _).
2433 clpfd_expandable(_ #>= _).
2434 clpfd_expandable(_ #=< _).
2435 clpfd_expandable(_ #> _).
2436 clpfd_expandable(_ #< _).
2437
2438 clpfd_expansion(Var in Dom, In) :-
23932439 ( ground(Dom), Dom = L..U, integer(L), integer(U) ->
23942440 expansion_simpler(
23952441 ( integer(Var) ->
23982444 ), In)
23992445 ; In = clpfd:clpfd_in(Var, Dom)
24002446 ).
2401 user:goal_expansion(X0 #= Y0, Equal) :-
2402 \+ current_prolog_flag(clpfd_goal_expansion, false),
2447 clpfd_expansion(X0 #= Y0, Equal) :-
24032448 phrase(expr_conds(X0, X), CsX),
24042449 phrase(expr_conds(Y0, Y), CsY),
24052450 list_goal(CsX, CondX),
24162461 )
24172462 ; clpfd:clpfd_equal(X0, Y0)
24182463 ), Equal).
2419 user:goal_expansion(X0 #>= Y0, Geq) :-
2420 \+ current_prolog_flag(clpfd_goal_expansion, false),
2464 clpfd_expansion(X0 #>= Y0, Geq) :-
24212465 phrase(expr_conds(X0, X), CsX),
24222466 phrase(expr_conds(Y0, Y), CsY),
24232467 list_goal(CsX, CondX),
24302474 ; CondY -> T is Y, clpfd:clpfd_geq(X0, T)
24312475 ; clpfd:clpfd_geq(X0, Y0)
24322476 ), Geq).
2433 user:goal_expansion(X #=< Y, Leq) :- user:goal_expansion(Y #>= X, Leq).
2434 user:goal_expansion(X #> Y, Gt) :- user:goal_expansion(X #>= Y+1, Gt).
2435 user:goal_expansion(X #< Y, Lt) :- user:goal_expansion(Y #> X, Lt).
2477 clpfd_expansion(X #=< Y, Leq) :- clpfd_expansion(Y #>= X, Leq).
2478 clpfd_expansion(X #> Y, Gt) :- clpfd_expansion(X #>= Y+1, Gt).
2479 clpfd_expansion(X #< Y, Lt) :- clpfd_expansion(Y #> X, Lt).
24362480
24372481 expansion_simpler((True->Then0;_), Then) :-
24382482 is_true(True), !,
27832827 list_to_drep(Vals, Drep).
27842828
27852829 disjunctive_eqs_var(V, _) :- var(V), !, false.
2830 disjunctive_eqs_var(V in I, V) :- var(V), integer(I).
27862831 disjunctive_eqs_var(L #= R, Var) :-
27872832 ( var(L), integer(R) -> Var = L
27882833 ; integer(L), var(R) -> Var = R
27942839 VA == VB.
27952840
27962841 disjunctive_eqs_vals(L #= R) --> ( { integer(L) } -> [L] ; [R] ).
2842 disjunctive_eqs_vals(_ in I) --> [I].
27972843 disjunctive_eqs_vals(A #\/ B) -->
27982844 disjunctive_eqs_vals(A),
27992845 disjunctive_eqs_vals(B).
28422888 m(max(A,B)) => [d(D), p(pgeq(R, A)), p(pgeq(R, B)), p(pmax(A,B,R)), a(A,B,R)],
28432889 m(min(A,B)) => [d(D), p(pgeq(A, R)), p(pgeq(B, R)), p(pmin(A,B,R)), a(A,B,R)],
28442890 m(abs(A)) => [g(?(R)#>=0), d(D), p(pabs(A, R)), a(A,R)],
2845 m(A/B) => [skeleton(A,B,D,R,ptzdiv)],
2891 % m(A/B) => [skeleton(A,B,D,R,ptzdiv)],
28462892 m(A//B) => [skeleton(A,B,D,R,ptzdiv)],
28472893 m(A div B) => [skeleton(A,B,D,R,pdiv)],
28482894 m(A rdiv B) => [skeleton(A,B,D,R,prdiv)],
52215267
52225268 weak_arc_all_distinct(Ls) :-
52235269 must_be(list, Ls),
5224 put_attr(O, clpfd_original, weak_arc_all_distinct(Ls)),
5225 all_distinct(Ls, [], O),
5270 Orig = original_goal(_, weak_arc_all_distinct(Ls)),
5271 all_distinct(Ls, [], Orig),
52265272 do_queue.
52275273
52285274 all_distinct([], _, _).
53275373 serialized(Starts, Durations) :-
53285374 must_be(list(integer), Durations),
53295375 pairs_keys_values(SDs, Starts, Durations),
5330 put_attr(Orig, clpfd_original, serialized(Starts, Durations)),
5376 Orig = original_goal(_, serialized(Starts, Durations)),
53315377 serialize(SDs, Orig).
53325378
53335379 serialize([], _).
59035949 % an integer. The constraint holds iff at each time slot during the
59045950 % start and end of each task, the total resource consumption of all
59055951 % tasks running at that time does not exceed the global resource
5906 % limit (which is 1 by default). Options is a list of options.
5907 % Currently, the only supported option is:
5952 % limit. Options is a list of options. Currently, the only supported
5953 % option is:
59085954 %
59095955 % * limit(L)
5910 % The integer L is the global resource limit.
5956 % The integer L is the global resource limit. Default is 1.
59115957 %
59125958 % For example, given the following predicate that relates three tasks
59135959 % of durations 2 and 3 to a list containing their starting times:
59355981 ; domain_error(cumulative_options_empty_or_limit, Options)
59365982 ),
59375983 ( Tasks = [] -> true
5938 ; maplist(task_bs, Tasks, Bss),
5984 ; fully_elastic_relaxation(Tasks, L),
5985 maplist(task_bs, Tasks, Bss),
59395986 maplist(arg(1), Tasks, Starts),
59405987 maplist(fd_inf, Starts, MinStarts),
59415988 maplist(arg(3), Tasks, Ends),
59425989 maplist(fd_sup, Ends, MaxEnds),
59435990 min_list(MinStarts, Start),
59445991 max_list(MaxEnds, End),
5945 min_end_time(Tasks, L, Start),
59465992 resource_limit(Start, End, Tasks, Bss, L)
59475993 ).
59485994
59495995 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5950 Naive lower bound for global end time, assuming no gaps.
5996 Trivial lower and upper bounds, assuming no gaps and not necessarily
5997 retaining the rectangular shape of each task.
59515998 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
59525999
5953 min_end_time(Tasks, Limit, Start) :-
6000 fully_elastic_relaxation(Tasks, Limit) :-
59546001 maplist(task_duration_consumption, Tasks, Ds, Cs),
59556002 maplist(area, Ds, Cs, As),
59566003 sum(As, #=, ?(Area)),
59576004 ?(MinTime) #= (Area + Limit - 1) // Limit,
5958 tasks_all_done(Tasks, DoneTime),
5959 DoneTime #>= Start + MinTime.
6005 tasks_minstart_maxend(Tasks, MinStart, MaxEnd),
6006 MaxEnd #>= MinStart + MinTime.
59606007
59616008 task_duration_consumption(task(_,D,_,C,_), D, C).
59626009
59636010 area(X, Y, Area) :- ?(Area) #= ?(X) * ?(Y).
59646011
5965 tasks_all_done(Tasks, End) :-
5966 maplist(task_end, Tasks, [End0|Es]),
5967 foldl(max_, Es, End0, End).
6012 tasks_minstart_maxend(Tasks, Start, End) :-
6013 maplist(task_start_end, Tasks, [Start0|Starts], [End0|Ends]),
6014 foldl(min_, Starts, Start0, Start),
6015 foldl(max_, Ends, End0, End).
59686016
59696017 max_(E, M0, M) :- ?(M) #= max(E, M0).
59706018
5971 task_end(task(_,_,End,_,_), ?(End)).
6019 min_(E, M0, M) :- ?(M) #= min(E, M0).
6020
6021 task_start_end(task(Start,_,End,_,_), ?(Start), ?(End)).
59726022
59736023 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
59746024 All time slots must respect the resource limit.
62736323 % :- use_module(library(clpfd)).
62746324 %
62756325 % sudoku(Rows) :-
6276 % length(Rows, 9), maplist(length_list(9), Rows),
6326 % length(Rows, 9), maplist(same_length(Rows), Rows),
62776327 % append(Rows, Vs), Vs ins 1..9,
62786328 % maplist(all_distinct, Rows),
62796329 % transpose(Rows, Columns),
62806330 % maplist(all_distinct, Columns),
62816331 % Rows = [A,B,C,D,E,F,G,H,I],
62826332 % blocks(A, B, C), blocks(D, E, F), blocks(G, H, I).
6283 %
6284 % length_list(L, Ls) :- length(Ls, L).
62856333 %
62866334 % blocks([], [], []).
62876335 % blocks([A,B,C|Bs1], [D,E,F|Bs2], [G,H,I|Bs3]) :-
65876635
65886636 clpfd_relation:attribute_goals(_) --> [].
65896637 clpfd_relation:attr_unify_hook(_,_) :- false.
6590
6591 clpfd_original:attribute_goals(_) --> [].
6592 clpfd_original:attr_unify_hook(_,_) :- false.
65936638
65946639 attributes_goals([]) --> [].
65956640 attributes_goals([propagator(P, State)|As]) -->
66916736 ; [(?(A) #/\ ?(B) #/\ G) #<==> ?(D)]
66926737 ).
66936738
6694 original_goal(V) -->
6695 ( { get_attr(V, clpfd_original, Goal) } ->
6696 { del_attr(V, clpfd_original) },
6739 original_goal(original_goal(State, Goal)) -->
6740 ( { var(State) } ->
6741 { State = processed },
66976742 [Goal]
66986743 ; []
66996744 ).
297297
298298 assertion_failed(Reason, G) :-
299299 prolog:assertion_failed(Reason, G), !.
300 assertion_failed(Reason, _) :-
301 assertion_rethrow(Reason), !,
302 throw(Reason).
300303 assertion_failed(Reason, G) :-
301304 print_message(error, assertion_failed(Reason, G)),
302305 backtrace(10),
306309 ).
307310
308311 assertion_failed.
312
313 assertion_rethrow(time_limit_exceeded).
314 assertion_rethrow('$aborted').
309315
310316 %% assume(:Goal) is det.
311317 %
0 /* $Id$
1
2 Part of SWI-Prolog
0 /* Part of SWI-Prolog
31
42 Author: Tom Schrijvers, K.U.Leuven
53 E-mail: Tom.Schrijvers@cs.kuleuven.ac.be
64 WWW: http://www.swi-prolog.org
7 Copyright (C): 2003-2004, K.U.Leuven
5 Copyright (C): 2003-2015, K.U.Leuven
86
97 This program is free software; you can redistribute it and/or
108 modify it under the terms of the GNU General Public License
3331 % This module implements the dif/2 constraint. It constraints two terms
3432 % to be not identical.
3533 %
36 % Author: Tom Schrijvers, K.U.Leuven
37 % E-mail: Tom.Schrijvers@cs.kuleuven.ac.be
34 % Author: Tom Schrijvers, K.U.Leuven
35 % E-mail: Tom.Schrijvers@cs.kuleuven.ac.be
3836 % Copyright: 2003-2004, K.U.Leuven
3937 %
4038 % Update 7/3/2004:
5351
5452 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5553 dif(X,Y) :-
54 X \== Y,
5655 dif_c_c(X,Y,_).
5756
5857 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5958 % types of attributes?
60 % vardif: X is a variable
59 % vardif: X is a variable
6160 %% node(Parent,Children,Variables,Counter)
6261
6362 dif_c_c(X,Y,OrNode) :-
163162 reverse_lookups(NXs,Value,RNodes,RRest).
164163
165164 verify_compounds([],_).
166 verify_compounds([Node-Y|Rest],X) :-
165 verify_compounds([OrNode-Y|Rest],X) :-
167166 ( var(Y) ->
168167 true
169 ;
170 dif_c_c(X,Y,Node)
168 ; OrNode == (-) ->
169 true
170 ;
171 dif_c_c(X,Y,OrNode)
171172 ),
172173 verify_compounds(Rest,X).
173174
209210 del_or_dif(Xs).
210211
211212 cleanup_dead_nodes(X) :-
212 ( attvar(X) ->
213 get_attr(X,dif,Attr),
213 ( attvar(X) ->
214 get_attr(X,dif,Attr),
214215 Attr = vardif(V1,V2),
215216 filter_dead_ors(V1,NV1),
216217 filter_dead_ors(V2,NV2),
9797 reset_gensym(Base) :-
9898 atom_concat('$gs_', Base, Key),
9999 with_mutex('$gensym', flag(Key, _, 0)).
100
101 :- multifile sandbox:safe_primitive/1.
102
103 sandbox:safe_primitive(gensym:gensym(_,_)).
165165 fail.
166166 is_pairing_heap(nil, _).
167167 is_pairing_heap(t(_,P,Sub), MinP) :-
168 P @=< MinP,
168 MinP @=< P,
169169 are_pairing_heaps(Sub, P).
170170
171171 % True iff 1st arg is a list of pairing heaps, each with min key @=< 2nd arg.
1111 % Predicate predicate/5
1212
1313 predicate(~,0,'',41,48).
14 predicate(help,0,'Give help on help',745,747).
15 predicate(help,1,'Give help on predicates and show parts of manual',749,773).
16 predicate(apropos,1,'library(online_help) Search manual',775,784).
17 predicate(explain,1,'library(explain) Explain argument',786,792).
18 predicate(explain,2,'library(explain) 2nd argument is explanation of first',794,797).
19 predicate(current_prolog_flag,2,'Get system configuration parameters',1230,1955).
20 predicate(set_prolog_flag,2,'Define a system feature',1957,1979).
21 predicate(create_prolog_flag,3,'Create a new Prolog flag',1981,2000).
22 predicate(autoload_path,1,'Add directories for autoloading',2129,2141).
23 predicate(make_library_index,1,'Create autoload file INDEX.pl',2143,2147).
24 predicate(make_library_index,2,'Create selective autoload file INDEX.pl',2149,2169).
25 predicate(reload_library_index,0,'Force reloading the autoload index',2171,2187).
26 predicate(guitracer,0,'Install hooks for the graphical debugger',3569,3575).
27 predicate(noguitracer,0,'Disable the graphical debugger',3577,3580).
28 predicate(gtrace,0,'Trace using graphical tracer',3582,3584).
29 predicate(gdebug,0,'Debug using graphical tracer',3586,3588).
30 predicate(gspy,1,'Spy using graphical tracer',3590,3592).
31 predicate(gxref,0,'Cross-reference loaded program',3626,3683).
32 predicate(prolog_ide,1,'Program access to the development environment',3695,3722).
33 predicate(load_files,1,'Load source files',3969,3972).
34 predicate(load_files,2,'Load source files with options',3974,4141).
35 predicate(consult,1,'Read (compile) a Prolog source file',4143,4159).
36 predicate(ensure_loaded,1,'Consult a file if that has not yet been done',4161,4173).
37 predicate(include,1,'Include a file with declarations',4175,4224).
38 predicate(require,1,'This file requires these predicates',4226,4241).
39 predicate(encoding,1,'Define encoding inside a source file',4243,4248).
40 predicate(make,0,'Reconsult all changed source files',4250,4261).
41 predicate(library_directory,1,'Hook (user) Directories holding Prolog libraries',4263,4269).
42 predicate(file_search_path,2,'Define path-aliases for locating files',4271,4313).
43 predicate(expand_file_search_path,2,'Wildcard expansion of file paths',4315,4318).
44 predicate(prolog_file_type,2,'Define meaning of file extension',4320,4342).
45 predicate(source_file,1,'Examine currently loaded source files',4344,4347).
46 predicate(source_file,2,'Obtain source file of predicate',4349,4359).
47 predicate(source_file_property,2,'Information about loaded files',4361,4400).
48 predicate(unload_file,1,'Unload a source file',4402,4413).
49 predicate(prolog_load_context,2,'Context information for directives',4415,4459).
50 predicate(source_location,2,'Location of last read term',4461,4466).
51 predicate(at_halt,1,'Register goal to run at halt/1',4468,4477).
52 predicate(cancel_halt,1,'Cancel halt/0 from an at_halt/1 hook',4479,4485).
53 predicate(initialization,1,'Initialization directive',4487,4519).
54 predicate(initialization,2,'Initialization directive',4521,4535).
55 predicate(compiling,0,'Is this a compilation run?',4537,4542).
56 predicate(term_expansion,2,'Hook (user) Convert term before compilation',4559,4580).
57 predicate(expand_term,2,'Compiler: expand read term into clause(s)',4582,4598).
58 predicate(goal_expansion,2,'Hook for macro-expanding goals',4600,4617).
59 predicate(expand_goal,2,'Compiler: expand goal in clause-body',4619,4626).
60 predicate(compile_aux_clauses,1,'Compile predicates for goal_expansion/2',4628,4633).
61 predicate(dcg_translate_rule,2,'Source translation of DCG rules',4635,4639).
62 predicate(var_property,2,'Variable properties during macro expansion',4641,4658).
63 predicate(expand_goal,4,'Compiler: expand goal in clause-body',4674,4675).
64 predicate(goal_expansion,4,'Hook for macro-expanding goals',4677,4678).
65 predicate(expand_term,4,'Compiler: expand read term into clause(s)',4680,4681).
66 predicate(term_expansion,4,'Hook (user) Convert term before compilation',4683,4684).
67 predicate(dcg_translate_rule,4,'Source translation of DCG rules',4686,4691).
68 predicate(if,1,'Start conditional compilation (directive)',4724,4729).
69 predicate(elif,1,'Part of conditional compilation (directive)',4731,4747).
70 predicate(else,0,'Part of conditional compilation (directive)',4749,4751).
71 predicate(endif,0,'End of conditional compilation (directive)',4753,4755).
72 predicate(garbage_collect_clauses,0,'Invoke clause garbage collector',4781,4789).
73 predicate(qcompile,1,'Compile source to Quick Load File',4895,4915).
74 predicate(qcompile,2,'Compile source to Quick Load File',4917,4920).
75 predicate(edit,1,'Edit a file, predicate, module (extensible)',4947,4954).
76 predicate(edit,0,'Edit current script- or associated file',4956,4960).
77 predicate(locate,3,'Locate targets for edit/1',4969,4982).
78 predicate(locate,2,'Locate targets for edit/1',4984,4987).
79 predicate(edit_source,1,'Call editor for edit/1',4989,5006).
80 predicate(edit_command,2,'Specify editor activation',5008,5033).
81 predicate(load,0,'Load edit/1 extensions',5035,5048).
82 predicate(listing,1,'List predicate',5053,5064).
83 predicate(listing,0,'List program in current module',5066,5070).
84 predicate(portray_clause,1,'Pretty print a clause',5072,5077).
85 predicate(portray_clause,2,'Pretty print a clause to a stream',5079,5081).
86 predicate(var,1,'Type check for unbound variable',5091,5093).
87 predicate(nonvar,1,'Type check for bound term',5095,5097).
88 predicate(integer,1,'Type check for integer',5099,5101).
89 predicate(float,1,'Type check for a floating point number',5103,5105).
90 predicate(rational,1,'Type check for a rational number',5107,5110).
91 predicate(rational,3,'Decompose a rational',5112,5117).
92 predicate(number,1,'Type check for integer or float',5119,5121).
93 predicate(atom,1,'Type check for an atom',5123,5125).
94 predicate(blob,2,'Type check for a blob',5127,5129).
95 predicate(string,1,'Type check for string',5131,5137).
96 predicate(atomic,1,'Type check for primitive',5139,5153).
97 predicate(compound,1,'Test for compound term',5155,5158).
98 predicate(callable,1,'Test for atom or compound term',5160,5179).
99 predicate(ground,1,'Verify term holds no unbound variables',5181,5183).
100 predicate(cyclic_term,1,'Test term for cycles',5185,5188).
101 predicate(acyclic_term,1,'Test term for cycles',5190,5194).
102 predicate(=,2,'True when arguments are unified',5202,5209).
103 predicate(\=,2,'True if arguments cannot be unified',5211,5213).
104 predicate(==,2,'Test for strict equality',5239,5242).
105 predicate(\==,2,'True if arguments are not strictly equal',5244,5246).
106 predicate(@<,2,'Standard order smaller',5248,5250).
107 predicate(@=<,2,'Standard order smaller or equal',5252,5255).
108 predicate(@>,2,'Standard order larger',5257,5259).
109 predicate(@>=,2,'Standard order larger or equal',5261,5264).
110 predicate(compare,3,'Compare, using a predicate to determine the order',5266,5269).
111 predicate(unify_with_occurs_check,2,'Logically sound unification',5282,5319).
112 predicate(=@=,2,'Test for structural equality (variant)',5321,5362).
113 predicate(\=@=,2,'Not structural identical',5364,5366).
114 predicate(subsumes_term,2,'One-sided unification test',5368,5374).
115 predicate(term_subsumer,3,'Most specific generalization of two terms',5376,5379).
116 predicate(unifiable,3,'Determining binding required for unification',5381,5386).
117 predicate(?=,2,'Test of terms can be compared now',5388,5393).
118 predicate(fail,0,'Always false',5411,5414).
119 predicate(false,0,'Always false',5416,5418).
120 predicate(true,0,'Succeed',5420,5423).
121 predicate(repeat,0,'Succeed, leaving infinite backtrack points',5425,5427).
122 predicate(!,0,'Cut (discard choicepoints)',5429,5448).
123 predicate(',',2,'Conjunction of goals',5450,5457).
124 predicate(;,2,'Disjunction of two goals',5459,5465).
125 predicate('|',2,'Disjunction in DCGs. Same as ;/2',5467,5470).
126 predicate(->,2,'If-then-else',5472,5489).
127 predicate(*->,2,'Soft-cut',5491,5501).
128 predicate(\+,1,'Negation by failure. Same as not/1',5503,5507).
129 predicate(call,1,'Call a goal',5519,5522).
130 predicate(call,_G48,'Call with additional arguments',5524,5535).
131 predicate(apply,2,'Call goal with additional arguments',5537,5542).
132 predicate(not,1,'Negation by failure (argument not provable). Same as \\+/1',5544,5547).
133 predicate(once,1,'Call a goal deterministically',5549,5563).
134 predicate(ignore,1,'Call the argument, but always succeed',5565,5573).
135 predicate(call_with_depth_limit,3,'Prove goal with bounded depth',5575,5604).
136 predicate(call_with_inference_limit,3,'Prove goal in limited inferences',5606,5638).
137 predicate(setup_call_cleanup,3,'Undo side-effects safely',5640,5695).
138 predicate(setup_call_catcher_cleanup,4,'Undo side-effects safely',5697,5728).
139 predicate(call_cleanup,2,'Guard a goal with a cleaup-handler',5730,5737).
140 predicate(call_cleanup,3,'Guard a goal with a cleaup-handler',5739,5742).
141 predicate(catch,3,'Call goal, watching for exceptions',5754,5765).
142 predicate(throw,1,'Raise an exception (see catch/3)',5767,5799).
143 predicate(print_message,2,'Print message from (exception) term',5879,5944).
144 predicate(print_message_lines,3,'Print message to stream',5946,5987).
145 predicate(message_hook,3,'Intercept print_message/2',5989,5997).
146 predicate(thread_message_hook,3,'Thread local message_hook/3',5999,6005).
147 predicate(message_property,2,'Hook (user) Define display of a message',6007,6044).
148 predicate(message_line_element,2,'Hook (prolog) Intercept print_message_lines/3',6046,6050).
149 predicate(message_to_string,2,'Translate message-term to string',6052,6054).
150 predicate(version,0,'Print system banner message',6056,6060).
151 predicate(version,1,'Add messages to the system banner',6062,6067).
152 predicate(on_signal,3,'Handle a software signal',6154,6188).
153 predicate(current_signal,3,'Current software signal mapping',6190,6194).
154 predicate(phrase,2,'Activate grammar-rule set',6277,6279).
155 predicate(phrase,3,'Activate grammar-rule set (returning rest)',6281,6337).
156 predicate(call_dcg,3,'As phrase/3 without type checking',6339,6365).
157 predicate(abolish,1,'Remove predicate definition from the database',6396,6412).
158 predicate(abolish,2,'Remove predicate definition from the database',6414,6417).
159 predicate(copy_predicate_clauses,2,'Copy clauses between predicates',6419,6442).
160 predicate(redefine_system_predicate,1,'Abolish system definition',6444,6454).
161 predicate(retract,1,'Remove clause from the database',6456,6460).
162 predicate(retractall,1,'Remove unifying clauses from the database',6462,6467).
163 predicate(asserta,1,'Add a clause to the database (first)',6469,6476).
164 predicate(assertz,1,'Add a clause to the database (last)',6478,6481).
165 predicate(assert,1,'Add a clause to the database',6483,6486).
166 predicate(asserta,2,'Add a clause to the database (first)',6488,6492).
167 predicate(assertz,2,'Add a clause to the database (last)',6494,6497).
168 predicate(assert,2,'Add a clause to the database, give reference',6499,6502).
169 predicate(recorda,3,'Record term in the database (first)',6504,6510).
170 predicate(recorda,2,'Record term in the database (first)',6512,6514).
171 predicate(recordz,3,'Record term in the database (last)',6516,6519).
172 predicate(recordz,2,'Record term in the database (last)',6521,6523).
173 predicate(recorded,3,'Obtain term from the database',6525,6536).
174 predicate(recorded,2,'Obtain term from the database',6538,6540).
175 predicate(erase,1,'Erase a database record or clause',6542,6547).
176 predicate(instance,2,'Fetch clause or record from reference',6549,6552).
177 predicate(flag,3,'Simple global variable system',6554,6564).
178 predicate(term_hash,2,'Hash-value of ground term',6600,6615).
179 predicate(term_hash,4,'Hash-value of term with depth limit',6617,6626).
180 predicate(variant_sha1,2,'Term-hash for term-variants',6628,6647).
181 predicate(dynamic,1,'Indicate predicate definition may change',6668,6676).
182 predicate(compile_predicates,1,'Compile dynamic code to static',6678,6686).
183 predicate(multifile,1,'Indicate distributed definition of predicate',6688,6692).
184 predicate(discontiguous,1,'Indicate distributed definition of a predicate',6694,6697).
185 predicate(public,1,'Declaration that a predicate may be called',6699,6708).
186 predicate(current_atom,1,'Examine existing atoms',6713,6717).
187 predicate(current_blob,2,'Examine typed blobs',6719,6724).
188 predicate(current_functor,2,'Examine existing name/arity pairs',6726,6729).
189 predicate(current_flag,1,'Examine existing flags',6731,6734).
190 predicate(current_key,1,'Examine existing database keys',6736,6739).
191 predicate(current_predicate,1,'Examine existing predicates (ISO)',6741,6757).
192 predicate(current_predicate,2,'Examine existing predicates',6759,6776).
193 predicate(predicate_property,2,'Query predicate attributes',6778,6934).
194 predicate(dwim_predicate,2,'Find predicate in ``Do What I Mean\'\' sense',6936,6945).
195 predicate(clause,2,'Get clauses of a predicate',6947,6951).
196 predicate(clause,3,'Get clauses of a predicate',6953,6958).
197 predicate(nth_clause,3,'N-th clause of a predicate',6960,6979).
198 predicate(clause_property,2,'Get properties of a clause',6981,7035).
199 predicate(open,4,'Open a file (creating a stream)',7113,7249).
200 predicate(open,3,'Open a file (creating a stream)',7251,7253).
201 predicate(open_null_stream,1,'Open a stream to discard output',7255,7273).
202 predicate(close,1,'Close stream',7275,7285).
203 predicate(close,2,'Close stream (forced)',7287,7291).
204 predicate(stream_property,2,'Get stream properties',7293,7406).
205 predicate(current_stream,3,'Examine open streams',7408,7415).
206 predicate(is_stream,1,'Type check for a stream handle',7417,7421).
207 predicate(stream_pair,3,'Create/examine a bi-directional stream',7423,7440).
208 predicate(set_stream_position,2,'Seek stream to position',7442,7446).
209 predicate(stream_position_data,3,'Access fields from stream position',7448,7454).
210 predicate(seek,4,'Modify the current position in a stream',7456,7484).
211 predicate(set_stream,2,'Set stream attribute',7486,7585).
212 predicate(set_prolog_IO,3,'Prepare streams for interactive session',7587,7598).
213 predicate(see,1,'Change the current input stream',7677,7682).
214 predicate(tell,1,'Change current output stream',7684,7689).
215 predicate(append,1,'Append to a file',7691,7695).
216 predicate(seeing,1,'Query the current input stream',7697,7702).
217 predicate(telling,1,'Query current output stream',7704,7709).
218 predicate(seen,0,'Close the current input stream',7711,7714).
219 predicate(told,0,'Close current output',7716,7719).
220 predicate(set_input,1,'Set current input stream from a stream',7727,7731).
221 predicate(set_output,1,'Set current output stream from a stream',7733,7736).
222 predicate(current_input,1,'Get current input stream',7738,7741).
223 predicate(current_output,1,'Get the current output stream',7743,7745).
224 predicate(with_output_to,2,'Write to strings and more',7750,7800).
225 predicate(wait_for_input,3,'Wait for input with optional timeout',7805,7847).
226 predicate(byte_count,2,'Byte-position in a stream',7849,7854).
227 predicate(character_count,2,'Get character index on a stream',7856,7861).
228 predicate(line_count,2,'Line number on stream',7863,7866).
229 predicate(line_position,2,'Character position in line on stream',7868,7873).
230 predicate(nl,0,'Generate a newline',7880,7883).
231 predicate(nl,1,'Generate a newline on a stream',7885,7887).
232 predicate(put,1,'Write a character',7889,7894).
233 predicate(put,2,'Write a character on a stream',7896,7898).
234 predicate(put_byte,1,'Write a byte',7900,7903).
235 predicate(put_byte,2,'Write a byte on a stream',7905,7908).
236 predicate(put_char,1,'Write a character',7910,7915).
237 predicate(put_char,2,'Write a character on a stream',7917,7921).
238 predicate(put_code,1,'Write a character-code',7923,7927).
239 predicate(put_code,2,'Write a character-code on a stream',7929,7931).
240 predicate(tab,1,'Output number of spaces',7933,7937).
241 predicate(tab,2,'Output number of spaces on a stream',7939,7941).
242 predicate(flush_output,0,'Output pending characters on current stream',7943,7947).
243 predicate(flush_output,1,'Output pending characters on specified stream',7949,7952).
244 predicate(ttyflush,0,'Flush output on terminal',7954,7956).
245 predicate(get_byte,1,'Read next byte (ISO)',7958,7962).
246 predicate(get_byte,2,'Read next byte from a stream (ISO)',7964,7967).
247 predicate(get_code,1,'Read next character (ISO)',7969,7973).
248 predicate(get_code,2,'Read next character from a stream (ISO)',7975,7977).
249 predicate(get_char,1,'Read next character as an atom (ISO)',7979,7983).
250 predicate(get_char,2,'Read next character from a stream (ISO)',7985,7988).
251 predicate(get0,1,'Read next character',7990,7995).
252 predicate(get0,2,'Read next character from a stream',7997,8000).
253 predicate(get,1,'Read first non-blank character',8002,8006).
254 predicate(get,2,'Read first non-blank character from a stream',8008,8011).
255 predicate(peek_byte,1,'Read byte without removing',8013,8014).
256 predicate(peek_byte,2,'Read byte without removing',8016,8017).
257 predicate(peek_code,1,'Read character-code without removing',8019,8020).
258 predicate(peek_code,2,'Read character-code without removing',8022,8023).
259 predicate(peek_char,1,'Read character without removing',8025,8026).
260 predicate(peek_char,2,'Read character without removing',8028,8035).
261 predicate(peek_string,3,'Read a string without removing',8037,8044).
262 predicate(skip,1,'Skip to character in current input',8046,8050).
263 predicate(skip,2,'Skip to character on stream',8052,8054).
264 predicate(get_single_char,1,'Read next character from the terminal',8056,8065).
265 predicate(at_end_of_stream,0,'Test for end of file on input',8067,8071).
266 predicate(at_end_of_stream,1,'Test for end of file on stream',8073,8078).
267 predicate(set_end_of_stream,1,'Set physical end of an open file',8080,8084).
268 predicate(copy_stream_data,3,'Copy n bytes from stream to stream',8086,8091).
269 predicate(copy_stream_data,2,'Copy all data from stream to stream',8093,8095).
270 predicate(read_pending_input,3,'Fetch buffered input from a stream',8097,8123).
271 predicate(write_term,2,'Write term with options',8137,8304).
272 predicate(write_term,3,'Write term with options to stream',8306,8309).
273 predicate(write_length,3,'Dermine #characters to output a term',8311,8320).
274 predicate(write_canonical,1,'Write a term with quotes, ignore operators',8322,8336).
275 predicate(write_canonical,2,'Write a term with quotes, ignore operators on a stream',8338,8340).
276 predicate(write,1,'Write term',8342,8345).
277 predicate(write,2,'Write term to stream',8347,8349).
278 predicate(writeq,1,'Write term, insert quotes',8351,8356).
279 predicate(writeq,2,'Write term, insert quotes on stream',8358,8360).
280 predicate(writeln,1,'Write term, followed by a newline',8362,8366).
281 predicate(writeln,2,'Write term, followed by a newline to a stream',8368,8372).
282 predicate(print,1,'Print a term',8374,8402).
283 predicate(print,2,'Print a term on a stream',8404,8406).
284 predicate(portray,1,'Hook (user) Modify behaviour of print/1',8408,8415).
285 predicate(read,1,'Read Prolog term',8417,8422).
286 predicate(read,2,'Read Prolog term from stream',8424,8426).
287 predicate(read_clause,3,'Read clause from stream',8428,8458).
288 predicate(read_term,2,'Read term with options',8460,8601).
289 predicate(read_term,3,'Read term with options from stream',8603,8605).
290 predicate(read_term_from_atom,3,'Read term with options from atom',8607,8612).
291 predicate(read_history,6,'Read using history substitution',8614,8629).
292 predicate(prompt,2,'Change the prompt used by read/1',8631,8639).
293 predicate(prompt1,1,'Change prompt for 1 line',8641,8644).
294 predicate(functor,3,'Get name and arity of a term or construct a term ',8649,8669).
295 predicate(arg,3,'Access argument of a term',8671,8680).
296 predicate(=..,2,'``Univ.\'\' Term to list conversion',8682,8704).
297 predicate(compound_name_arity,3,'Name and arity of a compound term',8706,8710).
298 predicate(compound_name_arguments,3,'Name and arguments of a compound term',8712,8715).
299 predicate(numbervars,3,'Number unbound variables of a term',8717,8737).
300 predicate(numbervars,4,'Number unbound variables of a term',8739,8758).
301 predicate(var_number,2,'Check that var is numbered by numbervars',8760,8766).
302 predicate(term_variables,2,'Find unbound variables in a term',8768,8778).
303 predicate(term_variables,3,'Find unbound variables in a term',8780,8783).
304 predicate(copy_term,2,'Make a copy of a term',8785,8794).
305 predicate(setarg,3,'Destructive assignment on term',8806,8822).
306 predicate(nb_setarg,3,'Non-backtrackable assignment to term',8824,8854).
307 predicate(nb_linkarg,3,'Non-backtrackable assignment to term',8856,8860).
308 predicate(duplicate_term,2,'Create a copy of a term',8862,8867).
309 predicate(same_term,2,'Test terms to be at the same address',8869,8874).
310 predicate(atom_codes,2,'Convert between atom and list of characters codes',8897,8903).
311 predicate(atom_chars,2,'Convert between atom and list of characters',8905,8913).
312 predicate(char_code,2,'Convert between character and character code',8915,8918).
313 predicate(number_chars,2,'Convert between number and one-char atoms',8920,8927).
314 predicate(number_codes,2,'Convert between number and character codes',8929,8933).
315 predicate(atom_number,2,'Convert between atom and number',8935,8942).
316 predicate(name,2,'Convert between atom and list of character codes',8944,8961).
317 predicate(term_to_atom,2,'Convert between term and atom',8963,8970).
318 predicate(atom_to_term,3,'Convert between atom and term',8972,8979).
319 predicate(atom_concat,3,'Contatenate two atoms',8981,8988).
320 predicate(atomic_concat,3,'Concatenate two atomic values to an atom',8990,8998).
321 predicate(atomic_list_concat,2,'Append a list of atomics',9000,9005).
322 predicate(atomic_list_concat,3,'Append a list of atomics with separator',9007,9028).
323 predicate(atom_length,2,'Determine length of an atom',9030,9036).
324 predicate(atom_prefix,2,'Test for start of atom',9038,9041).
325 predicate(sub_atom,5,'Take a substring from an atom',9043,9057).
326 predicate(sub_atom_icasechk,3,'Case insensitive substring match',9059,9065).
327 predicate(locale_create,3,'Create a new locale object',9095,9129).
328 predicate(locale_destroy,1,'Destroy a locale object',9131,9135).
329 predicate(locale_property,2,'Query properties of locale objects',9137,9140).
330 predicate(set_locale,1,'Set the default local',9142,9148).
331 predicate(current_locale,1,'Get the current locale',9150,9152).
332 predicate(char_type,2,'Classify characters',9167,9275).
333 predicate(code_type,2,'Classify a character-code',9277,9284).
334 predicate(downcase_atom,2,'Convert atom to lower-case',9294,9299).
335 predicate(upcase_atom,2,'Convert atom to upper-case',9301,9303).
336 predicate(normalize_space,2,'Normalize white space',9308,9313).
337 predicate(collation_key,2,'Sort key for locale dependent ordering',9321,9334).
338 predicate(locale_sort,2,'Language dependent sort of atoms',9336,9341).
339 predicate(op,3,'Declare an operator',9380,9448).
340 predicate(current_op,3,'Examine current operator declarations',9450,9453).
341 predicate(char_conversion,2,'Provide mapping of input characters',9461,9467).
342 predicate(current_char_conversion,2,'Query input character mapping',9469,9472).
343 predicate(between,3,'Integer range checking/generating',9492,9499).
344 predicate(succ,2,'Logical integer successor relation',9501,9507).
345 predicate(plus,3,'Logical integer addition',9509,9512).
346 predicate(>,2,'Arithmetic larger',9523,9525).
347 predicate(<,2,'Arithmetic smaller',9527,9529).
348 predicate(=<,2,'Arithmetic smaller or equal',9531,9534).
349 predicate(>=,2,'Arithmetic larger or equal',9536,9539).
350 predicate(=\=,2,'Arithmetic not equal',9541,9543).
351 predicate(=:=,2,'Arithmetic equality',9545,9547).
352 predicate(is,2,'Evaluate arithmetic expression',9549,9558).
353 predicate(-,1,'Unary minus',9674,9676).
354 predicate(+,1,'Unary plus (No-op)',9678,9681).
355 predicate(+,2,'Addition',9683,9685).
356 predicate(-,2,'Subtraction',9687,9689).
357 predicate(*,2,'Multiplication',9691,9693).
358 predicate(/,2,'Division',9695,9703).
359 predicate(mod,2,'Remainder of division',9705,9708).
360 predicate(rem,2,'Remainder of division',9710,9713).
361 predicate(//,2,'Integer division',9715,9720).
362 predicate(div,2,'Integer division',9722,9735).
363 predicate(rdiv,2,'Ration number division',9737,9741).
364 predicate(gcd,2,'Greatest common divisor',9743,9745).
365 predicate(abs,1,'Absolute value',9747,9749).
366 predicate(sign,1,'Extract sign of value',9751,9756).
367 predicate(copysign,2,'Apply sign of N2 to N1',9758,9769).
368 predicate(max,2,'Maximum of two numbers',9771,9776).
369 predicate(min,2,'Minimum of two numbers',9778,9781).
370 predicate('.',2,'Consult. Also functional notation',9783,9792).
371 predicate(random,1,'Binds R to a new random float in the _open_ interval (0.0,1.0).',9794,9806).
372 predicate(random_float,0,'Generate random number',9808,9814).
373 predicate(round,1,'Round to nearest integer',9816,9818).
374 predicate(integer,1,'Type check for integer',9820,9822).
375 predicate(float,1,'Type check for a floating point number',9824,9829).
376 predicate(rational,1,'Type check for a rational number',9831,9849).
377 predicate(rationalize,1,'Convert to rational number',9851,9865).
378 predicate(float_fractional_part,1,'Fractional part of a float',9867,9872).
379 predicate(float_integer_part,1,'Integer part of a float',9874,9877).
380 predicate(truncate,1,'Truncate float to integer',9879,9883).
381 predicate(floor,1,'Largest integer below argument',9885,9888).
382 predicate(ceiling,1,'Smallest integer larger than arg',9890,9893).
383 predicate(ceil,1,'Smallest integer larger than arg',9895,9897).
384 predicate(>>,2,'Bitwise right shift',9899,9904).
385 predicate(<<,2,'Bitwise left shift',9906,9908).
386 predicate(\/,2,'Bitwise or',9910,9912).
387 predicate(/\,2,'Bitwise and',9914,9916).
388 predicate(xor,2,'Bitwise exclusive or',9918,9920).
389 predicate(\,1,'Bitwise negation',9922,9925).
390 predicate(sqrt,1,'Square root',9927,9929).
391 predicate(sin,1,'Sine',9931,9933).
392 predicate(cos,1,'Cosine',9935,9937).
393 predicate(tan,1,'Tangent',9939,9941).
394 predicate(asin,1,'Inverse (arc) sine',9943,9945).
395 predicate(acos,1,'Inverse (arc) cosine',9947,9949).
396 predicate(atan,1,'Inverse hyperbolic sine',9951,9953).
397 predicate(atan2,2,'Rectangular to polar conversion',9955,9963).
398 predicate(atan,2,'Rectangular to polar conversion',9965,9967).
399 predicate(sinh,1,'Hyperbolic sine',9969,9972).
400 predicate(cosh,1,'Hyperbolic cosine',9974,9977).
401 predicate(tanh,1,'Hyperbolic tangent',9979,9982).
402 predicate(asinh,1,'Inverse (arc) sine',9984,9986).
403 predicate(acosh,1,'Inverse hyperbolic cosine',9988,9990).
404 predicate(atanh,1,'Inverse hyperbolic tangent',9992,9994).
405 predicate(log,1,'Natural logarithm',9996,9998).
406 predicate(log10,1,'10 base logarithm',10000,10002).
407 predicate(exp,1,'Exponent (base $e$)',10004,10006).
408 predicate(**,2,'Power function',10008,10023).
409 predicate(^,2,'Existential quantification (bagof/3, setof/3)',10025,10043).
410 predicate(powm,3,'Integer exponent and modulo',10045,10050).
411 predicate(lgamma,1,'Log of gamma function',10052,10055).
412 predicate(erf,1,'Gauss error function',10057,10062).
413 predicate(erfc,1,'Complementary error function',10064,10066).
414 predicate(pi,0,'Mathematical constant',10068,10070).
415 predicate(e,0,'Mathematical constant',10072,10074).
416 predicate(epsilon,0,'Floating point precision',10076,10079).
417 predicate(cputime,0,'Get CPU time',10081,10085).
418 predicate(eval,1,'Evaluate term as expression',10087,10099).
419 predicate(msb,1,'Most significant bit',10101,10106).
420 predicate(lsb,1,'Least significant bit',10108,10113).
421 predicate(popcount,1,'Count 1s in a bitvector',10115,10118).
422 predicate(set_random,1,'Control random number generation',10123,10145).
423 predicate(random_property,1,'Query properties of random generation',10147,10159).
424 predicate(current_arithmetic_function,1,'Examine evaluable functions',10161,10168).
425 predicate(is_list,1,'Type check for a list',10177,10192).
426 predicate(memberchk,2,'Deterministic member/2',10194,10202).
427 predicate(length,2,'Length of a list',10204,10221).
428 predicate(sort,2,'Sort elements in a list',10223,10229).
429 predicate(sort,4,'Sort elements in a list',10231,10282).
430 predicate(msort,2,'Sort, do not remove duplicates',10284,10287).
431 predicate(keysort,2,'Sort, using a key',10289,10311).
432 predicate(predsort,3,'Sort, using a predicate to determine the order',10313,10318).
433 predicate(findall,3,'Find all solutions to a goal',10323,10330).
434 predicate(findall,4,'Difference list version of findall/3',10332,10340).
435 predicate(findnsols,4,'Find first solutions',10342,10343).
436 predicate(findnsols,5,'Difference list version of findsols/4',10345,10378).
437 predicate(bagof,3,'Find all solutions to a goal',10380,10412).
438 predicate(setof,3,'Find all unique solutions to a goal',10414,10417).
439 predicate(forall,2,'Prove goal for all solutions of another goal',10422,10463).
440 predicate(writef,1,'Formatted write',10478,10480).
441 predicate(writef,2,'Formatted write on stream',10482,10541).
442 predicate(swritef,3,'Formatted write on a string',10543,10551).
443 predicate(swritef,2,'Formatted write on a string',10553,10555).
444 predicate(format,1,'Formatted output',10563,10566).
445 predicate(format,2,'Formatted output with arguments',10568,10739).
446 predicate(format,3,'Formatted output on a stream',10741,10751).
447 predicate(format_predicate,2,'Program format/[1,2]',10756,10785).
448 predicate(current_format_predicate,2,'Enumerate user-defined format codes',10787,10790).
449 predicate(tty_get_capability,3,'Get terminal parameter',10800,10808).
450 predicate(tty_goto,2,'Goto position on screen',10810,10814).
451 predicate(tty_put,2,'Write control string to terminal',10816,10822).
452 predicate(tty_size,2,'Get row/column size of the terminal',10824,10838).
453 predicate(shell,2,'Execute OS command',10843,10872).
454 predicate(shell,1,'Execute OS command',10874,10876).
455 predicate(shell,0,'Execute interactive subshell',10878,10882).
456 predicate(getenv,2,'Get shell environment variable',10884,10888).
457 predicate(setenv,2,'Set shell environment variable',10890,10899).
458 predicate(unsetenv,1,'Delete shell environment variable',10901,10905).
459 predicate(setlocale,3,'Set/query C-library regional information',10907,10919).
460 predicate(unix,1,'OS interaction',10921,10962).
461 predicate(win_exec,2,'Win32: spawn Windows task',10973,10980).
462 predicate(win_shell,3,'Win32: open document through Shell',10982,10991).
463 predicate(win_shell,2,'Win32: open document through Shell',10993,10995).
464 predicate(win_registry_get_value,3,'Win32: get registry value',10997,11018).
465 predicate(win_folder,2,'Win32: get special folder by CSIDL',11020,11033).
466 predicate(win_add_dll_directory,1,'Add directory to DLL search path',11035,11044).
467 predicate(win_add_dll_directory,2,'Add directory to DLL search path',11046,11069).
468 predicate(win_remove_dll_directory,1,'Remove directory from DLL search path',11071,11074).
469 predicate(get_time,1,'Get current time',11148,11151).
470 predicate(stamp_date_time,3,'Convert time-stamp to date structure',11153,11159).
471 predicate(date_time_stamp,2,'Convert date structure to time-stamp',11161,11212).
472 predicate(date_time_value,3,'Extract info from a date structure',11214,11231).
473 predicate(format_time,3,'C strftime() like date/time formatter',11233,11395).
474 predicate(format_time,4,'date/time formatter with explicit locale',11397,11406).
475 predicate(parse_time,2,'Parse text to a time-stamp',11408,11410).
476 predicate(parse_time,3,'Parse text to a time-stamp',11412,11432).
477 predicate(day_of_the_week,2,'Determine ordinal-day from date',11434,11439).
478 predicate(window_title,2,'Win32: change title of window',11450,11453).
479 predicate(win_window_pos,1,'Win32: change size and position of window',11455,11478).
480 predicate(win_has_menu,0,'Win32: true if console menu is available',11480,11482).
481 predicate(win_insert_menu,2,'swipl-win.exe: add menu',11484,11495).
482 predicate(win_insert_menu_item,4,'swipl-win.exe: add item to menu',11497,11501).
483 predicate(access_file,2,'Check access permissions of a file',11506,11516).
484 predicate(exists_file,1,'Check existence of file',11518,11521).
485 predicate(file_directory_name,2,'Get directory part of path',11523,11540).
486 predicate(file_base_name,2,'Get file part of path',11542,11546).
487 predicate(same_file,2,'Succeeds if arguments refer to same file',11548,11557).
488 predicate(exists_directory,1,'Check existence of directory',11559,11562).
489 predicate(delete_file,1,'Remove a file from the file system',11564,11566).
490 predicate(rename_file,2,'Change name of file',11568,11574).
491 predicate(size_file,2,'Get size of a file in characters',11576,11578).
492 predicate(time_file,2,'Get last modification time of file',11580,11584).
493 predicate(absolute_file_name,2,'Get absolute path name',11586,11594).
494 predicate(absolute_file_name,3,'Get absolute path name with options',11596,11653).
495 predicate(is_absolute_file_name,1,'True if arg defines an absolute path',11655,11661).
496 predicate(file_name_extension,3,'Add, remove or test file extensions',11663,11671).
497 predicate(directory_files,2,'Get entries of a directory/folder',11673,11679).
498 predicate(expand_file_name,2,'Wildcard expansion of file names',11681,11698).
499 predicate(prolog_to_os_filename,2,'Convert between Prolog and OS filenames',11700,11706).
500 predicate(read_link,3,'Read a symbolic link',11708,11714).
501 predicate(tmp_file,2,'Create a temporary filename',11716,11726).
502 predicate(tmp_file_stream,3,'Create a temporary file and open it',11728,11755).
503 predicate(make_directory,1,'Create a folder on the file system',11757,11761).
504 predicate(delete_directory,1,'Remove a folder from the file system',11763,11767).
505 predicate(working_directory,2,'Query/change CWD',11769,11775).
506 predicate(chdir,1,'Compatibility: change working directory',11777,11779).
507 predicate(break,0,'Start interactive top level',11784,11792).
508 predicate(abort,0,'Abort execution, return to top level',11794,11811).
509 predicate(halt,0,'Exit from Prolog',11813,11816).
510 predicate(halt,1,'Exit from Prolog with status',11818,11847).
511 predicate(prolog,0,'Run interactive top level',11849,11858).
512 predicate(expand_query,4,'Expanded entered query',11860,11868).
513 predicate(expand_answer,2,'Expand answer of query',11870,11875).
514 predicate(protocol,1,'Make a log of the user interaction',11884,11887).
515 predicate(protocola,1,'Append log of the user interaction to file',11889,11892).
516 predicate(noprotocol,0,'Disable logging of user interaction',11894,11897).
517 predicate(protocolling,1,'On what file is user interaction logged',11899,11902).
518 predicate(trace,0,'Start the tracer',11913,11917).
519 predicate(tracing,0,'Query status of the tracer',11919,11922).
520 predicate(notrace,0,'Stop tracing',11924,11926).
521 predicate(guitracer,0,'Install hooks for the graphical debugger',11928,11933).
522 predicate(noguitracer,0,'Disable the graphical debugger',11935,11937).
523 predicate(trace,1,'Set trace point on predicate',11939,11941).
524 predicate(trace,2,'Set/Clear trace point on ports',11943,11963).
525 predicate(notrace,1,'Do not debug argument goal',11965,11970).
526 predicate(debug,0,'Test for debugging mode',11972,11985).
527 predicate(nodebug,0,'Disable debugging',11987,11990).
528 predicate(debugging,0,'Show debugger status',11992,11995).
529 predicate(spy,1,'Force tracer on specified predicate',11997,12000).
530 predicate(nospy,1,'Remove spy point',12002,12005).
531 predicate(nospyall,0,'Remove all spy points',12007,12009).
532 predicate(leash,1,'Change ports visited by the tracer',12011,12019).
533 predicate(visible,1,'Ports that are visible in the tracer',12021,12024).
534 predicate(unknown,2,'Trap undefined predicates',12026,12031).
535 predicate(style_check,1,'Change level of warnings',12033,12117).
536 predicate(statistics,2,'Obtain collected statistics',12122,12210).
537 predicate(statistics,0,'Show execution statistics',12212,12214).
538 predicate(time,1,'Determine time needed to execute goal',12216,12224).
539 predicate(profile,1,'Obtain execution statistics',12242,12246).
540 predicate(profile,2,'Obtain execution statistics',12248,12261).
541 predicate(show_profile,1,'Show results of the profiler',12263,12275).
542 predicate(profiler,2,'Obtain/change status of the profiler',12277,12291).
543 predicate(reset_profiler,0,'Clear statistics obtained by the profiler',12293,12295).
544 predicate(noprofile,1,'Hide (meta-) predicate for the profiler',12297,12303).
545 predicate(garbage_collect,0,'Invoke the garbage collector',12406,12413).
546 predicate(garbage_collect_atoms,0,'Invoke the atom garbage collector',12415,12423).
547 predicate(trim_stacks,0,'Release unused memory resources',12425,12443).
548 predicate(set_prolog_stack,2,'Modify stack characteristics',12445,12484).
549 predicate(prolog_stack_property,2,'Query properties of the stacks',12486,12489).
550 predicate(open_dde_conversation,3,'Win32: Open DDE channel',12535,12540).
551 predicate(close_dde_conversation,1,'Win32: Close DDE channel',12542,12547).
552 predicate(dde_request,3,'Win32: Make a DDE request',12549,12553).
553 predicate(dde_execute,2,'Win32: Execute command on DDE server',12555,12559).
554 predicate(dde_poke,3,'Win32: POKE operation on DDE server',12561,12564).
555 predicate(dde_register_service,2,'Win32: Become a DDE server',12575,12612).
556 predicate(dde_unregister_service,1,'Win32: Terminate a DDE service',12614,12617).
557 predicate(dde_current_service,2,'Win32: Examine DDE services provided',12619,12621).
558 predicate(dde_current_connection,2,'Win32: Examine open DDE connections',12623,12625).
559 predicate(dwim_match,2,'Atoms match in ``Do What I Mean\'\' sense',12630,12648).
560 predicate(dwim_match,3,'Atoms match in ``Do What I Mean\'\' sense',12650,12655).
561 predicate(wildcard_match,2,'Csh(1) style wildcard match',12657,12673).
562 predicate(sleep,1,'Suspend execution for specified time',12675,12685).
563 predicate(atom_string,2,'Conversion between atom and string',12829,12833).
564 predicate(number_string,2,'Convert between number and string',12835,12853).
565 predicate(term_string,2,'Read/write a term from/to a string',12855,12860).
566 predicate(term_string,3,'Read/write a term from/to a string',12862,12871).
567 predicate(string_chars,2,'Conversion between string and list of characters',12873,12877).
568 predicate(string_codes,2,'Conversion between string and list of character codes',12879,12882).
569 predicate(text_to_string,2,'Convert arbitrary text to a string',12884,12888).
570 predicate(string_length,2,'Determine length of a string',12890,12894).
571 predicate(string_code,3,'Get or find a character code in a string',12896,12903).
572 predicate(get_string_code,3,'Get character code at index in string',12905,12910).
573 predicate(string_concat,3,'atom_concat/3 for strings',12912,12921).
574 predicate(split_string,4,'Break a string into substrings',12923,12955).
575 predicate(sub_string,5,'Take a substring from a string',12957,12974).
576 predicate(atomics_to_string,2,'Concatenate list of inputs to a string',12976,12981).
577 predicate(atomics_to_string,3,'Concatenate list of inputs to a string',12983,12992).
578 predicate(string_upper,2,'Case conversion to upper case',12994,12996).
579 predicate(read_string,3,'Read a number of characters into a string',13002,13006).
580 predicate(read_string,5,'Read string upto a delimiter',13008,13037).
581 predicate(open_string,2,'Open a string as a stream',13039,13043).
582 predicate(list_strings,0,'Help porting to version 7',13087,13119).
583 predicate(string_predicate,1,'Hook (check) Predicate contains strings',13121,13134).
584 predicate(valid_string_goal,1,'Hook (check) Goal handles strings',13136,13148).
585 predicate('.',3,'',13465,13472).
586 predicate(get,1,'Read first non-blank character',13519,13532).
587 predicate(put,1,'Write a character',13534,13537).
588 predicate(put,2,'Write a character on a stream',13539,13563).
589 predicate(is_dict,1,'Type check for a dict',13571,13573).
590 predicate(is_dict,2,'Type check for a dict in a class',13575,13577).
591 predicate(get_dict,3,'Get the value associated to a key from a dict',13579,13585).
592 predicate(get_dict,5,'Replace existing value in a dict',13587,13597).
593 predicate(dict_create,3,'Create a dict from data',13599,13605).
594 predicate(dict_pairs,3,'Convert between dict and list of pairs',13607,13610).
595 predicate(put_dict,3,'Add/replace multiple keys in a dict',13612,13628).
596 predicate(put_dict,4,'Add/replace a single key in a dict',13630,13639).
597 predicate(del_dict,4,'Delete Key-Value pair from a dict',13641,13644).
598 predicate(:<,2,'Select keys from a dict',13646,13664).
599 predicate(select_dict,3,'Select matching attributes from a dict',13666,13682).
600 predicate(>:<,2,'Partial dict unification',13684,13698).
601 predicate(b_set_dict,3,'Destructive assignment on a dict',13724,13729).
602 predicate(nb_set_dict,3,'Non-backtrackable assignment to dict',13731,13736).
603 predicate(nb_link_dict,3,'Non-backtrackable assignment to dict',13738,13745).
604 predicate(module,2,'Declare a module',14102,14115).
605 predicate(module,3,'Declare a module with language options',14117,14126).
606 predicate(use_module,1,'Import a module',14142,14186).
607 predicate(use_module,2,'Import predicates from a module',14188,14214).
608 predicate(meta_predicate,1,'Declare access to other predicates',14267,14344).
609 predicate(@,2,'Call using calling context',14388,14403).
610 predicate(module,1,'Query/set current type-in module',14421,14433).
611 predicate(reexport,1,'Load files and re-export the imported predicates',14456,14460).
612 predicate(reexport,2,'Load predicates from a file and re-export it',14462,14466).
613 predicate(import_module,2,'Query import modules',14521,14526).
614 predicate(default_module,2,'Query module inheritance',14528,14533).
615 predicate(add_import_module,3,'Add module to the auto-import list',14535,14539).
616 predicate(delete_import_module,2,'Remove module from import list',14541,14548).
617 predicate(export,1,'Export a predicate from a module',14577,14583).
618 predicate(import,1,'Import a predicate from a module',14585,14592).
619 predicate(module_transparent,1,'Indicate module based meta-predicate',14703,14707).
620 predicate(context_module,1,'Get context module of current goal',14709,14712).
621 predicate(strip_module,3,'Extract context module and term',14714,14720).
622 predicate(current_module,1,'Examine existing modules',14728,14733).
623 predicate(module_property,2,'Find properties of a module',14735,14786).
624 predicate(set_module,1,'Set properties of a module',14788,14807).
625 predicate(attvar,1,'Type test for attributed variable',15000,15004).
626 predicate(put_attr,3,'Put attribute on a variable',15006,15014).
627 predicate(get_attr,3,'Fetch named attribute from a variable',15016,15021).
628 predicate(del_attr,2,'Delete attribute from variable',15023,15029).
629 predicate(attr_unify_hook,2,'Attributed variable unification hook',15038,15049).
630 predicate(attr_portray_hook,2,'Attributed variable print hook',15051,15058).
631 predicate(attribute_goals,3,'Project attributes to goals',15060,15065).
632 predicate(copy_term,3,'Copy a term and obtain attribute-goals',15081,15093).
633 predicate(copy_term_nat,2,'Make a copy of a term without attributes',15095,15098).
634 predicate(term_attvars,2,'Find attributed variables in a term',15100,15107).
635 predicate(get_attrs,2,'Fetch all attributes of a variable',15117,15121).
636 predicate(put_attrs,2,'Set/replace all attributes on a variable',15123,15126).
637 predicate(del_attrs,1,'Delete all attributes from variable',15128,15131).
638 predicate(freeze,2,'Delay execution until variable is bound',15151,15158).
639 predicate(frozen,2,'Query delayed goals on var',15160,15163).
640 predicate(when,2,'Execute goal when condition becomes true',15165,15174).
641 predicate(dif,2,'Constrain two terms to be different',15176,15188).
642 predicate(call_residue_vars,2,'Find residual attributed variables',15190,15208).
643 predicate(b_setval,2,'Assign backtrackable global variable',15249,15255).
644 predicate(b_getval,2,'Fetch backtrackable global variable',15257,15264).
645 predicate(nb_setval,2,'Assign non-backtrackable global variable',15266,15270).
646 predicate(nb_getval,2,'Fetch non-backtrackable global variable',15272,15279).
647 predicate(nb_linkval,2,'Assign non-backtrackable global variable',15281,15302).
648 predicate(nb_current,2,'Enumerate non-backtrackable global variables',15304,15309).
649 predicate(nb_delete,1,'Delete a non-backtrackable global variable',15311,15314).
650 predicate(chr_option,2,'Specify CHR compilation options',15522,15560).
651 predicate(chr_constraint,1,'CHR Constraint declaration',15575,15650).
652 predicate(chr_type,1,'CHR Type declaration',15652,15781).
653 predicate(chr_trace,0,'Start CHR tracer',15918,15922).
654 predicate(chr_notrace,0,'Stop CHR tracer',15924,15928).
655 predicate(chr_leash,1,'Define CHR leashed ports',15930,15937).
656 predicate(chr_show_store,1,'List suspended CHR constraints',15939,15946).
657 predicate(find_chr_constraint,1,'Returns a constraint from the store',15948,15951).
658 predicate(thread_create,3,'Create a new Prolog task',16251,16340).
659 predicate(thread_self,1,'Get identifier of current thread',16342,16345).
660 predicate(thread_join,2,'Wait for Prolog task-completion',16347,16373).
661 predicate(thread_detach,1,'Make thread cleanup after completion',16375,16387).
662 predicate(thread_exit,1,'Terminate Prolog task with value',16389,16400).
663 predicate(thread_initialization,1,'Run action at start of thread',16402,16411).
664 predicate(thread_at_exit,1,'Register goal to be called at exit',16413,16428).
665 predicate(thread_setconcurrency,2,'Number of active threads',16430,16437).
666 predicate(thread_property,2,'Examine Prolog threads',16452,16493).
667 predicate(thread_statistics,3,'Get statistics of another thread',16495,16500).
668 predicate(mutex_statistics,0,'Print statistics on mutex usage',16502,16509).
669 predicate(thread_send_message,2,'Send message to another thread',16530,16546).
670 predicate(thread_send_message,3,'Send message to another thread',16548,16575).
671 predicate(thread_get_message,1,'Wait for message',16577,16597).
672 predicate(thread_peek_message,1,'Test for message',16599,16606).
673 predicate(message_queue_create,1,'Create queue for thread communication',16608,16613).
674 predicate(message_queue_create,2,'Create queue for thread communication',16615,16631).
675 predicate(message_queue_destroy,1,'Destroy queue for thread communication',16633,16638).
676 predicate(thread_get_message,2,'Wait for message in a queue',16640,16646).
677 predicate(thread_get_message,3,'Wait for message in a queue',16648,16671).
678 predicate(thread_peek_message,2,'Test for message in a queue',16673,16678).
679 predicate(message_queue_property,2,'Query message queue properties',16680,16739).
680 predicate(thread_signal,2,'Execute goal in another thread',16754,16772).
681 predicate(thread_local,1,'Declare thread-specific clauses for a predicate',16792,16821).
682 predicate(mutex_create,1,'Create a thread-synchronisation device',16867,16871).
683 predicate(mutex_create,2,'Create a thread-synchronisation device',16873,16879).
684 predicate(mutex_destroy,1,'Destroy a mutex',16881,16887).
685 predicate(with_mutex,2,'Run goal while holding mutex',16889,16900).
686 predicate(mutex_lock,1,'Become owner of a mutex',16902,16920).
687 predicate(mutex_trylock,1,'Become owner of a mutex (non-blocking)',16922,16925).
688 predicate(mutex_unlock,1,'Release ownership of mutex',16927,16931).
689 predicate(mutex_unlock_all,0,'Release ownership of all mutexes',16933,16937).
690 predicate(mutex_property,2,'Query mutex properties',16939,16953).
691 predicate(threads,0,'List running threads',16962,16964).
692 predicate(join_threads,0,'Join all terminated threads interactively',16966,16973).
693 predicate(interactor,0,'Start new thread with console and top level',16975,16979).
694 predicate(attach_console,0,'Attach I/O console to thread',16993,17008).
695 predicate(tdebug,1,'Switch a thread into debug mode',17010,17018).
696 predicate(tdebug,0,'Switch all threads into debug mode',17020,17022).
697 predicate(tnodebug,1,'Switch off debug mode in a thread',17024,17026).
698 predicate(tnodebug,0,'Switch off debug mode in all threads',17028,17030).
699 predicate(tspy,2,'Set spy point and enable debugging in a thread',17032,17038).
700 predicate(tspy,1,'Set spy point and enable debugging in all threads',17040,17045).
701 predicate(tprofile,1,'Profile a thread for some period',17056,17060).
702 predicate(in_pce_thread,1,'Run goal in XPCE thread',17256,17263).
703 predicate(in_pce_thread_sync,1,'Run goal in XPCE thread',17265,17278).
704 predicate(pce_dispatch,1,'Run XPCE GUI in separate thread',17280,17287).
705 predicate(load_foreign_library,1,'library(shlib) Load shared library (.so file)',17431,17432).
706 predicate(load_foreign_library,2,'library(shlib) Load shared library (.so file)',17434,17460).
707 predicate(use_foreign_library,1,'Load DLL/shared object (directive)',17462,17463).
708 predicate(use_foreign_library,2,'Load DLL/shared object (directive)',17465,17478).
709 predicate(unload_foreign_library,1,'library(shlib) Detach shared library (.so file)',17480,17481).
710 predicate(unload_foreign_library,2,'library(shlib) Detach shared library (.so file)',17483,17488).
711 predicate(current_foreign_library,2,'library(shlib) Examine loaded shared libraries (.so files)',17490,17492).
712 predicate(reload_foreign_libraries,0,'Reload DLLs/shared objects',17494,17497).
713 predicate(open_shared_object,2,'UNIX: Open shared library (.so file)',17509,17518).
714 predicate(open_shared_object,3,'UNIX: Open shared library (.so file)',17520,17529).
715 predicate(close_shared_object,1,'UNIX: Close shared library (.so file)',17531,17533).
716 predicate(call_shared_object_function,2,'UNIX: Call C-function in shared (.so) file',17535,17540).
717 predicate(qsave_program,2,'Create runtime application',21407,21472).
718 predicate(qsave_program,1,'Create runtime application',21474,21476).
719 predicate(autoload,0,'Autoload all predicates now',21478,21527).
720 predicate(volatile,1,'Predicates that are not saved',21529,21534).
721 predicate(resource,3,'Declare a program resource',21658,21692).
722 predicate(open_resource,3,'Open a program resource as a stream',21694,21713).
723 predicate(aggregate,3,'Aggregate bindings in Goal according to Template.',21905,21908).
724 predicate(aggregate,4,'Aggregate bindings in Goal according to Template.',21910,21913).
725 predicate(aggregate_all,3,'Aggregate bindings in Goal according to Template.',21915,21921).
726 predicate(aggregate_all,4,'Aggregate bindings in Goal according to Template.',21923,21928).
727 predicate(foreach,2,'True if conjunction of results is true.',21930,21952).
728 predicate(free_variables,4,'Find free variables in bagof/setof template.',21954,21978).
729 predicate(safe_meta,2,'Declare the aggregate meta-calls safe.',21980,21983).
730 predicate(include,3,'Filter elements for which Goal succeeds.',21998,22004).
731 predicate(exclude,3,'Filter elements for which Goal fails.',22006,22009).
732 predicate(partition,4,'Filter elements of List according to Pred.',22011,22015).
733 predicate(partition,5,'Filter List according to Pred in three sets.',22017,22022).
734 predicate(maplist,2,'True if Goal can successfully be applied on all elements of List.',22024,22028).
735 predicate(maplist,3,'As maplist/2, operating on pairs of elements from two lists.',22030,22032).
736 predicate(maplist,4,'As maplist/2, operating on triples of elements from three lists.',22034,22036).
737 predicate(maplist,5,'As maplist/2, operating on quadruples of elements from four lists.',22038,22040).
738 predicate(foldl,4,'Fold a list, using arguments of the list as left argument.',22042,22043).
739 predicate(foldl,5,'Fold a list, using arguments of the list as left argument.',22045,22046).
740 predicate(foldl,6,'Fold a list, using arguments of the list as left argument.',22048,22049).
741 predicate(foldl,7,'Fold a list, using arguments of the list as left argument.',22051,22061).
742 predicate(scanl,4,'Left scan of list.',22063,22064).
743 predicate(scanl,5,'Left scan of list.',22066,22067).
744 predicate(scanl,6,'Left scan of list.',22069,22070).
745 predicate(scanl,7,'Left scan of list.',22072,22083).
746 predicate(assoc_to_list,2,'Convert association tree to list',22098,22101).
747 predicate(assoc_to_keys,2,'Translate assoc into a key list',22103,22106).
748 predicate(assoc_to_values,2,'Translate assoc into a value list',22108,22111).
749 predicate(empty_assoc,1,'Create/test empty association tree',22113,22115).
750 predicate(gen_assoc,3,'Enumerate members of association tree',22117,22120).
751 predicate(get_assoc,3,'Fetch key from association tree',22122,22125).
752 predicate(get_assoc,5,'Fetch key from association tree',22127,22130).
753 predicate(list_to_assoc,2,'Create association tree from list',22132,22135).
754 predicate(map_assoc,2,'Map association tree',22137,22139).
755 predicate(map_assoc,3,'Map association tree',22141,22144).
756 predicate(max_assoc,3,'Highest key in association tree',22146,22149).
757 predicate(min_assoc,3,'Lowest key in association tree',22151,22154).
758 predicate(ord_list_to_assoc,2,'Convert ordered list to assoc',22156,22159).
759 predicate(put_assoc,4,'Add Key-Value to association tree',22161,22165).
760 predicate(is_assoc,1,'Verify association list',22167,22170).
761 predicate(broadcast,1,'Send event notification',22194,22200).
762 predicate(broadcast_request,1,'Request all agents',22202,22216).
763 predicate(listen,2,'Listen to event notifications',22218,22230).
764 predicate(listen,3,'Listen to event notifications',22232,22267).
765 predicate(unlisten,1,'Stop listening to event notifications',22269,22271).
766 predicate(unlisten,2,'Stop listening to event notifications',22273,22276).
767 predicate(unlisten,3,'Stop listening to event notifications',22278,22281).
768 predicate(listening,3,'Who is listening to event notifications?',22283,22286).
769 predicate(format_to_chars,3,'Use format/2 to write to a list of character codes.',22301,22303).
770 predicate(format_to_chars,4,'Use format/2 to write to a difference list of character codes.',22305,22307).
771 predicate(write_to_chars,2,'Write a term to a code list.',22309,22312).
772 predicate(write_to_chars,3,'Write a term to a code list.',22314,22317).
773 predicate(atom_to_chars,2,'Convert Atom into a list of character codes.',22319,22323).
774 predicate(atom_to_chars,3,'Convert Atom into a difference list of character codes.',22325,22327).
775 predicate(number_to_chars,2,'Convert Atom into a list of character codes.',22329,22333).
776 predicate(number_to_chars,3,'Convert Number into a difference list of character codes.',22335,22337).
777 predicate(read_from_chars,2,'Read Codes into Term.',22339,22344).
778 predicate(read_term_from_chars,3,'Read Codes into Term.',22346,22350).
779 predicate(open_chars_stream,2,'Open Codes as an input stream.',22352,22356).
780 predicate(with_output_to_chars,2,'Run Goal as with once/1.',22358,22361).
781 predicate(with_output_to_chars,3,'Run Goal as with once/1.',22363,22366).
782 predicate(with_output_to_chars,4,'Same as with_output_to_chars/3 using an explicit stream.',22368,22372).
783 predicate(check,0,'Run all consistency checks defined by checker/2.',22389,22404).
784 predicate(list_undefined,0,'Report undefined predicates.',22406,22407).
785 predicate(list_undefined,1,'Report undefined predicates.',22409,22422).
786 predicate(list_autoload,0,'Report predicates that may be auto-loaded.',22424,22433).
787 predicate(list_redefined,0,'Lists predicates that are defined in the global module =user= as well as in a normal module; that is, predicates for which the local definition overrules the global default definition.',22435,22439).
788 predicate(list_void_declarations,0,'List predicates that have declared attributes, but no clauses.',22441,22443).
789 predicate(list_trivial_fails,0,'List goals that trivially fail because there is no matching clause.',22445,22446).
790 predicate(list_trivial_fails,1,'List goals that trivially fail because there is no matching clause.',22448,22456).
791 predicate(trivial_fail_goal,1,'Multifile hook that tells list_trivial_fails/0 to accept Goal as valid.',22458,22461).
792 predicate(list_strings,0,'Help porting to version 7',22463,22464).
793 predicate(list_strings,1,'List strings that appear in clauses.',22466,22477).
794 predicate(string_predicate,1,'Hook (check) Predicate contains strings',22479,22482).
795 predicate(valid_string_goal,1,'Hook (check) Goal handles strings',22484,22488).
796 predicate(checker,2,'Register code validation routines.',22490,22507).
797 predicate(sat,1,'True iff Expr is a satisfiable Boolean expression.',22622,22624).
798 predicate(taut,2,'Succeeds with T = 0 if the Boolean expression Expr cannot be satisfied, and with T = 1 if Expr is always true with respect to the current constraints.',22626,22630).
799 predicate(labeling,1,'Assigns truth values to the Boolean variables Vs such that all stated constraints are satisfied.',22632,22635).
800 predicate(sat_count,2,'N is the number of different assignments of truth values to the variables in the Boolean expression Expr, such that Expr is true and all posted constraints are satisfiable.',22637,22650).
801 predicate(in,2,'Var is an element of Domain.',23048,23062).
802 predicate(ins,2,'The variables in the list Vars are elements of Domain.',23064,23066).
803 predicate(indomain,1,'Bind Var to all feasible values of its domain on backtracking.',23068,23071).
804 predicate(label,1,'Equivalent to labeling([], Vars).',23073,23075).
805 predicate(labeling,2,'Assign a value to each variable in Vars.',23077,23162).
806 predicate(all_different,1,'Vars are pairwise distinct.',23164,23166).
807 predicate(all_distinct,1,'Like all_different/1, with stronger propagation.',23168,23179).
808 predicate(sum,3,'The sum of elements of the list Vars is in relation Rel to Expr.',23181,23192).
809 predicate(scalar_product,4,'True iff the scalar product of Cs and Vs is in relation Rel to Expr.',23194,23198).
810 predicate(#>=,2,'X is greater than or equal to Y.',23200,23202).
811 predicate(#=<,2,'X is less than or equal to Y.',23204,23206).
812 predicate(#=,2,'X equals Y.',23208,23210).
813 predicate(#\=,2,'X is not Y.',23212,23214).
814 predicate(#>,2,'X is greater than Y.',23216,23218).
815 predicate(#<,2,'X is less than Y.',23220,23235).
816 predicate(#\,1,'The reifiable constraint Q does _not_ hold.',23237,23245).
817 predicate(#<==>,2,'P and Q are equivalent.',23247,23286).
818 predicate(#==>,2,'P implies Q.',23288,23290).
819 predicate(#<==,2,'Q implies P.',23292,23294).
820 predicate(#/\,2,'P and Q hold.',23296,23298).
821 predicate(#\/,2,'P or Q holds.',23300,23312).
822 predicate(#\,2,'Either P holds or Q holds, but not both.',23314,23316).
823 predicate(lex_chain,1,'Lists are lexicographically non-decreasing.',23318,23320).
824 predicate(tuples_in,2,'True iff all Tuples are elements of Relation.',23322,23367).
825 predicate(serialized,2,'Describes a set of non-overlapping tasks.',23369,23388).
826 predicate(element,3,'The N-th element of the list of finite domain variables Vs is V.',23390,23393).
827 predicate(global_cardinality,2,'Global Cardinality constraint.',23395,23405).
828 predicate(global_cardinality,3,'Global Cardinality constraint.',23407,23424).
829 predicate(circuit,1,'True iff the list Vs of finite domain variables induces a Hamiltonian circuit.',23426,23440).
830 predicate(cumulative,1,'Equivalent to cumulative(Tasks, [limit(1)]).',23442,23444).
831 predicate(cumulative,2,'Schedule with a limited resource.',23446,23479).
832 predicate(disjoint2,1,'True iff Rectangles are not overlapping.',23481,23487).
833 predicate(automaton,3,'Describes a list of finite domain variables with a finite automaton.',23489,23515).
834 predicate(automaton,8,'Describes a list of finite domain variables with a finite automaton.',23517,23584).
835 predicate(transpose,2,'Invert the direction of all edges',23586,23646).
836 predicate(zcompare,3,'Analogous to compare/3, with finite domain variables A and B.',23648,23673).
837 predicate(chain,2,'Zs form a chain with respect to Relation.',23675,23686).
838 predicate(fd_var,1,'True iff Var is a CLP(FD) variable.',23688,23690).
839 predicate(fd_inf,2,'Inf is the infimum of the current domain of Var.',23692,23694).
840 predicate(fd_sup,2,'Sup is the supremum of the current domain of Var.',23696,23698).
841 predicate(fd_size,2,'Size is the number of elements of the current domain of Var, or the atom *sup* if the domain is unbounded.',23700,23703).
842 predicate(fd_dom,2,'Dom is the current domain (see in/2) of Var.',23705,23733).
843 predicate({},1,'DCG escape; constraints',23774,23776).
844 predicate(entailed,1,'Check if constraint is entailed',23778,23782).
845 predicate(inf,2,'Find the infimum of an expression',23784,23788).
846 predicate(sup,2,'Find the supremum of an expression',23790,23794).
847 predicate(minimize,1,'Minimizes an expression',23796,23800).
848 predicate(maximize,1,'Maximizes an expression',23802,23806).
849 predicate(bb_inf,5,'Infimum of expression for mixed-integer problems',23808,23817).
850 predicate(bb_inf,4,'Infimum of expression for mixed-integer problems',23819,23822).
851 predicate(bb_inf,3,'Infimum of expression for mixed-integer problems',23824,23827).
852 predicate(dump,3,'Dump constraints on variables',23829,23839).
853 predicate(csv_read_file,2,'Read a CSV file into a list of rows.',23974,23975).
854 predicate(csv_read_file,3,'Read a CSV file into a list of rows.',23977,23993).
855 predicate(csv,3,'Prolog DCG to `read/write\' CSV data.',23995,23996).
856 predicate(csv,4,'Prolog DCG to `read/write\' CSV data.',23998,24031).
857 predicate(csv_read_file_row,3,'True when Row is a row in File.',24033,24053).
858 predicate(csv_write_file,2,'Write a list of Prolog terms to a CSV file.',24055,24056).
859 predicate(csv_write_file,3,'Write a list of Prolog terms to a CSV file.',24058,24063).
860 predicate(csv_write_stream,3,'Write the rows in Data to Stream.',24065,24079).
861 predicate(debugging,1,'Test where we are debugging topic',24101,24102).
862 predicate(debugging,1,'Test where we are debugging topic',24104,24105).
863 predicate(debugging,2,'Examine debug topics.',24107,24121).
864 predicate(debug,1,'Select topic for debugging',24123,24124).
865 predicate(nodebug,1,'Disable debug-topic',24126,24135).
866 predicate(list_debug_topics,0,'List registered topics for debugging',24137,24139).
867 predicate(debug_message_context,1,'Specify additional context for debug messages.',24141,24147).
868 predicate(debug,3,'Print debugging message on topic',24149,24162).
869 predicate(debug_print_hook,3,'Hook called by debug/3.',24164,24170).
870 predicate(assertion,1,'Make assertions about your program',24172,24185).
871 predicate(assertion_failed,2,'This hook is called if the Goal of assertion/1 fails.',24187,24193).
872 predicate(gensym,2,'Generate unique atoms from a base',24208,24213).
873 predicate(reset_gensym,1,'Reset a gensym key',24215,24219).
874 predicate(reset_gensym,0,'Reset all gensym keys',24221,24226).
875 predicate(open_any,5,'',24256,24303).
876 predicate(close_any,1,'',24305,24309).
877 predicate(open_hook,6,'',24311,24321).
878 predicate(member,2,'True if Elem is a member of List.',24341,24351).
879 predicate(append,3,'List1AndList2 is the concatenation of List1 and List2.',24353,24355).
880 predicate(append,2,'Concatenate a list of lists.',24357,24363).
881 predicate(prefix,2,'True iff Part is a leading substring of Whole.',24365,24368).
882 predicate(select,3,'Is true when List1, with Elem removed, results in List2.',24370,24372).
883 predicate(selectchk,3,'Semi-deterministic removal of first element in List that unifies with Elem.',24374,24377).
884 predicate(select,4,'Select from two lists at the same positon.',24379,24395).
885 predicate(selectchk,4,'Semi-deterministic version of select/4.',24397,24399).
886 predicate(nextto,3,'True if Y follows X in List.',24401,24403).
887 predicate(delete,3,'Delete matching elements from a list.',24405,24417).
888 predicate(nth0,3,'True when Elem is the Index\'th element of List.',24419,24427).
889 predicate(nth1,3,'Is true when Elem is the Index\'th element of List.',24429,24434).
890 predicate(nth0,4,'Select/insert element at index.',24436,24453).
891 predicate(nth1,4,'As nth0/4, but counting starts at 1.',24455,24457).
892 predicate(last,2,'Last element of a list',24459,24467).
893 predicate(proper_length,2,'True when Length is the number of elements in the proper list List.',24469,24478).
894 predicate(same_length,2,'Is true when List1 and List2 are lists with the same number of elements.',24480,24487).
895 predicate(reverse,2,'Is true when the elements of List2 are in reverse order compared to List1.',24489,24492).
896 predicate(permutation,2,'True when Xs is a permutation of Ys.',24494,24525).
897 predicate(flatten,2,'Is true if FlatList is a non-nested version of NestedList.',24527,24539).
898 predicate(max_member,2,'True when Max is the largest member in the standard order of terms.',24541,24548).
899 predicate(min_member,2,'True when Min is the smallest member in the standard order of terms.',24550,24557).
900 predicate(sum_list,2,'Sum is the result of adding all numbers in List.',24559,24561).
901 predicate(max_list,2,'True if Max is the largest number in List.',24563,24567).
902 predicate(min_list,2,'True if Min is the smallest number in List.',24569,24574).
903 predicate(numlist,3,'List is a list [Low, Low+1, ... High].',24576,24582).
904 predicate(is_set,1,'True if Set is a proper list without duplicates.',24584,24589).
905 predicate(list_to_set,2,'Remove duplicates from a list',24591,24609).
906 predicate(intersection,3,'True if Set3 unifies with the intersection of Set1 and Set2.',24611,24616).
907 predicate(union,3,'True if Set3 unifies with the union of Set1 and Set2.',24618,24623).
908 predicate(subset,2,'True if all elements of SubSet belong to Set as well.',24625,24630).
909 predicate(subtract,3,'Delete all elements in Delete from Set.',24632,24637).
910 predicate(empty_nb_set,1,'Test/create an empty non-backtrackable set',24666,24668).
911 predicate(add_nb_set,2,'Add term to a non-backtrackable set',24670,24673).
912 predicate(add_nb_set,3,'Add term to a non-backtrackable set',24675,24683).
913 predicate(gen_nb_set,2,'Generate members of non-backtrackable set',24685,24688).
914 predicate(size_nb_set,2,'Determine size of non-backtrackable set',24690,24692).
915 predicate(nb_set_to_list,2,'Convert non-backtrackable set to list',24694,24697).
916 predicate(www_open_url,1,'Open a web-page in a browser',24705,24725).
917 predicate(option,3,'Get an Option Qfrom OptionList.',24780,24786).
918 predicate(option,2,'Get an Option from OptionList.',24788,24795).
919 predicate(select_option,3,'Get and remove Option from an option list.',24797,24801).
920 predicate(select_option,4,'Get and remove Option with default value.',24803,24807).
921 predicate(merge_options,3,'Merge two option lists.',24809,24816).
922 predicate(meta_options,3,'Perform meta-expansion on options that are module-sensitive.',24818,24835).
923 predicate(dict_options,2,'Convert between an option list and a dictionary.',24837,24857).
924 predicate(opt_arguments,3,'Extract commandline options according to a specification.',25164,25180).
925 predicate(opt_parse,4,'Equivalent to opt_parse(OptsSpec, ApplArgs, Opts, PositionalArgs, []).',25182,25184).
926 predicate(opt_parse,5,'Parse the arguments Args (as list of atoms) according to OptsSpec.',25186,25221).
927 predicate(opt_help,2,'True when Help is a help string synthesized from OptsSpec.',25223,25225).
928 predicate(is_ordset,1,'True if Term is an ordered set.',25256,25261).
929 predicate(ord_empty,1,'True when List is the empty ordered set.',25263,25266).
930 predicate(ord_seteq,2,'True if Set1 and Set2 have the same elements.',25268,25273).
931 predicate(list_to_ord_set,2,'Transform a list into an ordered set.',25275,25278).
932 predicate(ord_intersect,2,'True if both ordered sets have a non-empty intersection.',25280,25282).
933 predicate(ord_disjoint,2,'True if Set1 and Set2 have no common elements.',25284,25287).
934 predicate(ord_intersect,3,'Intersection holds the common elements of Set1 and Set2.',25289,25293).
935 predicate(ord_intersection,2,'Intersection of a powerset.',25295,25300).
936 predicate(ord_intersection,3,'Intersection holds the common elements of Set1 and Set2.',25302,25304).
937 predicate(ord_intersection,4,'Intersection and difference between two ordered sets.',25306,25312).
938 predicate(ord_add_element,3,'Insert an element into the set.',25314,25317).
939 predicate(ord_del_element,3,'Delete an element from an ordered set.',25319,25322).
940 predicate(ord_selectchk,3,'Selectchk/3, specialised for ordered sets.',25324,25334).
941 predicate(ord_memberchk,2,'True if Element is a member of OrdSet, compared using ==.',25336,25347).
942 predicate(ord_subset,2,'Is true if all elements of Sub are in Super.',25349,25351).
943 predicate(ord_subtract,3,'Diff is the set holding all elements of InOSet that are not in NotInOSet.',25353,25356).
944 predicate(ord_union,2,'True if Union is the union of all elements in the superset SetOfSets.',25358,25365).
945 predicate(ord_union,3,'Union is the union of Set1 and Set2.',25367,25369).
946 predicate(ord_union,4,'True iff ord_union(Set1, Set2, Union) and ord_subtract(Set2, Set1, New).',25371,25374).
947 predicate(ord_symdiff,3,'Is true when Difference is the symmetric difference of Set1 and Set2.',25376,25394).
948 predicate(pairs_keys_values,3,'True if Keys holds the keys of Pairs and Values the values.',25411,25419).
949 predicate(pairs_values,2,'Remove the keys from a list of Key-Value pairs.',25421,25424).
950 predicate(pairs_keys,2,'Remove the values from a list of Key-Value pairs.',25426,25429).
951 predicate(group_pairs_by_key,2,'Group values with the same key.',25431,25447).
952 predicate(transpose_pairs,2,'Swap Key-Value to Value-Key.',25449,25452).
953 predicate(map_list_to_pairs,3,'Create a Key-Value list by mapping each element of List.',25454,25461).
954 predicate(persistent,1,'Declare dynamic database terms.',25531,25549).
955 predicate(current_persistent_predicate,1,'True if PI is a predicate that provides access to the persistent database DB.',25551,25554).
956 predicate(db_attach,2,'Use File as persistent database for the calling module.',25556,25565).
957 predicate(db_sync,1,'Synchronise database with the associated file.',25567,25593).
958 predicate(db_sync_all,1,'Sync all registered databases.',25595,25597).
959 predicate(phrase_from_file,2,'Process the content of File using the DCG rule Grammar.',25629,25653).
960 predicate(phrase_from_file,3,'As phrase_from_file/2, providing additional Options.',25655,25661).
961 predicate(phrase_from_stream,2,'Helper for phrase_from_file/3.',25663,25666).
962 predicate(syntax_error,3,'Throw the syntax error Error at the current location of the input.',25668,25674).
963 predicate(lazy_list_location,3,'Determine current (error) location in a lazy list.',25676,25691).
964 predicate(lazy_list_character_count,3,'True when CharCount is the current character count in the Lazy list.',25693,25704).
965 predicate(stream_to_lazy_list,2,'Create a lazy list representing the character codes in Stream.',25706,25718).
966 predicate(predicate_options,3,'Declare that the predicate PI processes options on Arg.',25860,25894).
967 predicate(assert_predicate_options,4,'As predicate_options(:PI, +Arg, +Options).',25896,25904).
968 predicate(current_predicate_option,3,'True when Arg of PI processes Option.',25906,25917).
969 predicate(check_predicate_option,3,'Verify predicate options at runtime.',25919,25934).
970 predicate(current_option_arg,2,'True when Arg of PI processes predicate options.',25936,25939).
971 predicate(current_predicate_options,3,'True when Options is the current active option declaration for PI on Arg.',25941,25949).
972 predicate(check_predicate_options,0,'Analyse loaded program for erroneous options.',25951,25967).
973 predicate(derive_predicate_options,0,'Derive new predicate option declarations.',25969,25978).
974 predicate(retractall_predicate_options,0,'Remove all dynamically (derived) predicate options.',25980,25982).
975 predicate(derived_predicate_options,3,'Derive option arguments using static analysis.',25984,25987).
976 predicate(derived_predicate_options,1,'Derive predicate option declarations for a module.',25989,25992).
977 predicate(pack_list_installed,0,'List currently installed packages.',26012,26018).
978 predicate(pack_info,1,'Print more detailed information about Pack.',26020,26022).
979 predicate(pack_search,1,'Query package server and installed packages and display results.',26024,26025).
980 predicate(pack_list,1,'Query package server and installed packages and display results.',26027,26059).
981 predicate(pack_install,1,'Install a package.',26061,26079).
982 predicate(pack_install,2,'Install package Name.',26081,26112).
983 predicate(pack_url_file,2,'True if File is a unique id for the referenced pack and version.',26114,26118).
984 predicate(pack_rebuild,1,'Rebuilt possible foreign components of Pack.',26120,26122).
985 predicate(pack_rebuild,0,'Rebuild foreign components of all packages.',26124,26126).
986 predicate(environment,2,'Hook to define the environment for building packs.',26128,26144).
987 predicate(pack_upgrade,1,'Try to upgrade the package Pack.',26146,26151).
988 predicate(pack_remove,1,'Remove the indicated package.',26153,26155).
989 predicate(pack_property,2,'True when Property is a property of Pack.',26157,26182).
990 predicate(xref_source,1,'Cross-reference analysis of source',26217,26222).
991 predicate(xref_current_source,1,'Examine cross-referenced sources',26224,26226).
992 predicate(xref_clean,1,'Remove analysis of source',26228,26230).
993 predicate(xref_defined,3,'Examine defined predicates',26232,26243).
994 predicate(xref_called,3,'Examine called predicates',26245,26247).
995 predicate(xref_exported,2,'Examine exported predicates',26249,26251).
996 predicate(xref_module,2,'Module defined by source',26253,26255).
997 predicate(xref_built_in,1,'Examine defined built-ins',26257,26262).
998 predicate(called_by,2,'Hook (prolog) Extend cross-referencer',26270,26283).
999 predicate(with_quasi_quotation_input,3,'Parse quasi quotation from stream',26363,26383).
1000 predicate(phrase_from_quasi_quotation,2,'Parse quasi quotation with DCG',26385,26391).
1001 predicate(quasi_quotation_syntax,1,'Declare quasi quotation syntax',26393,26396).
1002 predicate(quasi_quotation_syntax_error,1,'Raise syntax error',26398,26403).
1003 predicate(random,1,'Binds R to a new random float in the _open_ interval (0.0,1.0).',26417,26425).
1004 predicate(random_between,3,'Binds R to a random integer in [L,U] (i.e., including both L and U).',26427,26430).
1005 predicate(random,3,'Generate a random integer or float in a range.',26432,26433).
1006 predicate(random,3,'Generate a random integer or float in a range.',26435,26445).
1007 predicate(setrand,1,'Query/set the state of the random generator.',26447,26448).
1008 predicate(getrand,1,'Query/set the state of the random generator.',26450,26469).
1009 predicate(maybe,0,'Succeed/fail with equal probability (variant of maybe/1).',26471,26473).
1010 predicate(maybe,1,'Succeed with probability P, fail with probability 1-P.',26475,26477).
1011 predicate(maybe,2,'Succeed with probability K/N (variant of maybe/1).',26479,26481).
1012 predicate(random_perm2,4,'Does X=A,Y=B or X=B,Y=A with equal probability.',26483,26485).
1013 predicate(random_member,2,'X is a random member of List.',26487,26492).
1014 predicate(random_select,3,'Randomly select or insert an element.',26494,26495).
1015 predicate(random_select,3,'Randomly select or insert an element.',26497,26502).
1016 predicate(randset,3,'S is a sorted list of K unique random integers in the range 1..N.',26504,26519).
1017 predicate(randseq,3,'S is a list of K unique random integers in the range 1..N.',26521,26532).
1018 predicate(random_permutation,2,'Permutation is a random permutation of List.',26534,26535).
1019 predicate(random_permutation,2,'Permutation is a random permutation of List.',26537,26543).
1020 predicate(read_line_to_codes,2,'Read line from a stream',26556,26564).
1021 predicate(read_line_to_codes,3,'Read line from a stream',26566,26587).
1022 predicate(read_stream_to_codes,2,'Read contents of stream',26589,26591).
1023 predicate(read_stream_to_codes,3,'Read contents of stream',26593,26595).
1024 predicate(read_file_to_codes,3,'Read contents of file',26597,26603).
1025 predicate(read_file_to_terms,3,'Read contents of file to Prolog terms',26605,26611).
1026 predicate(record,1,'Define named fields in a term',26705,26710).
1027 predicate(registry_get_key,2,'Get principal value of key',26729,26732).
1028 predicate(registry_get_key,3,'Get associated value of key',26734,26736).
1029 predicate(registry_set_key,2,'Set principal value of key',26738,26741).
1030 predicate(registry_set_key,3,'Set associated value of key',26743,26746).
1031 predicate(registry_delete_key,1,'Remove a key',26748,26750).
1032 predicate(shell_register_file_type,4,'Register a file-type',26752,26758).
1033 predicate(shell_register_dde,6,'Register DDE action',26760,26767).
1034 predicate(shell_register_prolog,1,'Register Prolog',26769,26788).
1035 predicate(assignment,2,'Solve assignment problem',26813,26819).
1036 predicate(constraint,3,'Add linear constraint to state',26821,26831).
1037 predicate(constraint,4,'Add named linear constraint to state',26833,26836).
1038 predicate(constraint_add,4,'Extend a named constraint',26838,26842).
1039 predicate(gen_state,1,'Create empty linear program',26844,26847).
1040 predicate(maximize,3,'Maximize objective function in to linear constraints',26849,26854).
1041 predicate(minimize,3,'Minimize objective function in to linear constraints',26856,26858).
1042 predicate(objective,2,'Fetch value of objective function',26860,26863).
1043 predicate(shadow_price,3,'Fetch shadow price in solved state',26865,26869).
1044 predicate(transportation,4,'Solve transportation problem',26871,26880).
1045 predicate(variable_value,3,'Fetch value of variable in solved state',26882,26891).
1046 predicate(distinct,1,'True if Goal is true and no previous solution of Goal bound Witness to the same value.',27076,27077).
1047 predicate(distinct,2,'True if Goal is true and no previous solution of Goal bound Witness to the same value.',27079,27092).
1048 predicate(limit,2,'Limit the number of solutions.',27094,27098).
1049 predicate(offset,2,'Ignore the first Count solutions.',27100,27104).
1050 predicate(group_by,4,'Group bindings of Template that have the same value for By.',27119,27125).
1051 predicate(thread_pool_create,3,'Create a pool of threads.',27163,27180).
1052 predicate(thread_pool_destroy,1,'Destroy the thread pool named Name.',27182,27186).
1053 predicate(current_thread_pool,1,'True if Name refers to a defined thread pool.',27188,27190).
1054 predicate(thread_pool_property,2,'True if Property is a property of thread pool Name.',27192,27213).
1055 predicate(thread_create_in_pool,4,'Create a thread in Pool.',27215,27229).
1056 predicate(create_pool,1,'Hook to create a thread pool lazily.',27231,27245).
1057 predicate(vertices_edges_to_ugraph,3,'Create unweighted graph',27276,27294).
1058 predicate(vertices,2,'Find vertices in graph',27296,27302).
1059 predicate(edges,2,'Find edges in graph',27304,27311).
1060 predicate(add_vertices,3,'Add vertices to graph',27313,27321).
1061 predicate(del_vertices,3,'Delete vertices from graph',27323,27335).
1062 predicate(add_edges,3,'Add edges to graph',27337,27349).
1063 predicate(del_edges,3,'Delete edges from graph',27351,27361).
1064 predicate(transpose,2,'Invert the direction of all edges',27363,27374).
1065 predicate(neighbours,3,'Find neighbors of vertice',27376,27385).
1066 predicate(neighbors,3,'Find neighbors of vertice',27387,27389).
1067 predicate(complement,2,'Inverse presense of edges',27391,27401).
1068 predicate(compose,3,'',27403,27411).
1069 predicate(ugraph_union,3,'Union of two graphs',27413,27420).
1070 predicate(top_sort,2,'Sort graph topologically',27422,27432).
1071 predicate(top_sort,3,'Sort graph topologically',27434,27437).
1072 predicate(transitive_closure,2,'Create transitive closure of graph',27439,27447).
1073 predicate(reachable,3,'Find all reachable vertices',27449,27457).
1074 predicate(global_url,3,'Translate a possibly relative URL into an absolute one.',27480,27484).
1075 predicate(is_absolute_url,1,'True if URL is an absolute URL.',27486,27489).
1076 predicate(http_location,2,'Construct or analyze an HTTP location.',27491,27502).
1077 predicate(parse_url,2,'Construct or analyse a URL.',27504,27561).
1078 predicate(parse_url,3,'Similar to parse_url/2 for relative URLs.',27563,27566).
1079 predicate(www_form_encode,2,'En/decode to/from application/x-www-form-encoded.',27568,27569).
1080 predicate(www_form_encode,2,'En/decode to/from application/x-www-form-encoded.',27571,27582).
1081 predicate(set_url_encoding,2,'Query and set the encoding for URLs.',27584,27591).
1082 predicate(url_iri,2,'Convert between a URL, encoding in US-ASCII and an IRI.',27593,27594).
1083 predicate(url_iri,2,'Convert between a URL, encoding in US-ASCII and an IRI.',27596,27600).
1084 predicate(parse_url_search,2,'Construct or analyze an HTTP search specification.',27602,27606).
1085 predicate(file_name_to_url,2,'Translate between a filename and a file:Sidiv{} URL.',27608,27609).
1086 predicate(file_name_to_url,2,'Translate between a filename and a file:Sidiv{} URL.',27611,27616).
1087 predicate(numbervars,1,'Number variables in Term using $VAR(N).',27642,27647).
1088 predicate(varnumbers,2,'Inverse of numbervars/1.',27649,27651).
1089 predicate(varnumbers,3,'Inverse of numbervars/3.',27653,27664).
1090 predicate(max_var_number,3,'True when Max is the max of Start and the highest numbered $VAR(N) term.',27666,27673).
1091 predicate(prolog_current_frame,1,'Reference to goal\'s environment stack',27688,27694).
1092 predicate(prolog_current_choice,1,'Reference to most recent choice point',27696,27700).
1093 predicate(prolog_frame_attribute,3,'Obtain information on a goal environment',27702,27785).
1094 predicate(prolog_choice_attribute,3,'Examine the choice point stack',27787,27809).
1095 predicate(deterministic,1,'Test deterministicy of current clause',27811,27818).
1096 predicate(prolog_cut_to,1,'Realise global cuts',27823,27829).
1097 predicate(prolog_trace_interception,4,'library(user) Intercept the Prolog tracer',27834,27947).
1098 predicate(prolog_skip_frame,1,'Perform `skip\' on a frame',27949,27956).
1099 predicate(prolog_skip_level,2,'Indicate deepest recursion to trace',27958,27965).
1100 predicate(break_hook,6,'Hook (prolog) Debugger hook',27977,28054).
1101 predicate(prolog_exception_hook,4,'Rewrite exceptions',28064,28107).
1102 predicate(exception,3,'Hook (user) Handle runtime exceptions',28122,28148).
1103 predicate(prolog_list_goal,1,'Hook (user) Intercept tracer \'L\' command',28160,28166).
1104 predicate(debug_control_hook,1,'Hook (prolog) Extend spy/1, etc.',28168,28194).
1105 predicate(help_hook,1,'Hook (prolog) User-hook in the help-system',28196,28211).
1106 predicate(prolog_load_file,2,'Hook (user) Program load_files/2',28220,28231).
1107 predicate(comment_hook,3,'Hook (prolog) handle comments in sources',28233,28252).
1108 predicate(rl_read_init_file,1,'Read readline(3) init file',28262,28266).
1109 predicate(rl_add_history,1,'Add line to readline(3) history',28268,28271).
1110 predicate(rl_write_history,1,'Write readline(3) history',28273,28276).
1111 predicate(rl_read_history,1,'Read readline(3) history',28278,28280).
1112 predicate(expects_dialect,1,'For which Prolog dialect is this code written?',28323,28349).
1113 predicate(exists_source,1,'Check existence of a Prolog source',28351,28355).
1114 predicate(source_exports,2,'Check whether source exports a predicate',28357,28360).
1115 predicate(eval_license,0,'Evaluate licenses of loaded modules',28891,28897).
1116 predicate(license,2,'Define license for named module',28899,28951).
1117 predicate(license,1,'Define license for current file',28953,28956).
14 predicate(help,0,'Give help on help',747,749).
15 predicate(help,1,'Give help on predicates and show parts of manual',751,775).
16 predicate(apropos,1,'library(online_help) Search manual',777,786).
17 predicate(explain,1,'library(explain) Explain argument',788,794).
18 predicate(explain,2,'library(explain) 2nd argument is explanation of first',796,799).
19 predicate(current_prolog_flag,2,'Get system configuration parameters',1232,1957).
20 predicate(set_prolog_flag,2,'Define a system feature',1959,1981).
21 predicate(create_prolog_flag,3,'Create a new Prolog flag',1983,2002).
22 predicate(autoload_path,1,'Add directories for autoloading',2131,2143).
23 predicate(make_library_index,1,'Create autoload file INDEX.pl',2145,2149).
24 predicate(make_library_index,2,'Create selective autoload file INDEX.pl',2151,2171).
25 predicate(reload_library_index,0,'Force reloading the autoload index',2173,2189).
26 predicate(guitracer,0,'Install hooks for the graphical debugger',3576,3582).
27 predicate(noguitracer,0,'Disable the graphical debugger',3584,3587).
28 predicate(gtrace,0,'Trace using graphical tracer',3589,3591).
29 predicate(gdebug,0,'Debug using graphical tracer',3593,3595).
30 predicate(gspy,1,'Spy using graphical tracer',3597,3599).
31 predicate(gxref,0,'Cross-reference loaded program',3633,3690).
32 predicate(prolog_ide,1,'Program access to the development environment',3702,3729).
33 predicate(load_files,1,'Load source files',3990,3993).
34 predicate(load_files,2,'Load source files with options',3995,4162).
35 predicate(consult,1,'Read (compile) a Prolog source file',4164,4180).
36 predicate(ensure_loaded,1,'Consult a file if that has not yet been done',4182,4194).
37 predicate(include,1,'Include a file with declarations',4196,4245).
38 predicate(require,1,'This file requires these predicates',4247,4262).
39 predicate(encoding,1,'Define encoding inside a source file',4264,4269).
40 predicate(make,0,'Reconsult all changed source files',4271,4282).
41 predicate(library_directory,1,'Hook (user) Directories holding Prolog libraries',4284,4290).
42 predicate(file_search_path,2,'Define path-aliases for locating files',4292,4334).
43 predicate(expand_file_search_path,2,'Wildcard expansion of file paths',4336,4339).
44 predicate(prolog_file_type,2,'Define meaning of file extension',4341,4363).
45 predicate(source_file,1,'Examine currently loaded source files',4365,4368).
46 predicate(source_file,2,'Obtain source file of predicate',4370,4380).
47 predicate(source_file_property,2,'Information about loaded files',4382,4421).
48 predicate(unload_file,1,'Unload a source file',4423,4434).
49 predicate(prolog_load_context,2,'Context information for directives',4436,4480).
50 predicate(source_location,2,'Location of last read term',4482,4487).
51 predicate(at_halt,1,'Register goal to run at halt/1',4489,4498).
52 predicate(cancel_halt,1,'Cancel halt/0 from an at_halt/1 hook',4500,4506).
53 predicate(initialization,1,'Initialization directive',4508,4540).
54 predicate(initialization,2,'Initialization directive',4542,4556).
55 predicate(compiling,0,'Is this a compilation run?',4558,4563).
56 predicate(term_expansion,2,'Hook (user) Convert term before compilation',4580,4601).
57 predicate(expand_term,2,'Compiler: expand read term into clause(s)',4603,4619).
58 predicate(goal_expansion,2,'Hook for macro-expanding goals',4621,4638).
59 predicate(expand_goal,2,'Compiler: expand goal in clause-body',4640,4647).
60 predicate(compile_aux_clauses,1,'Compile predicates for goal_expansion/2',4649,4654).
61 predicate(dcg_translate_rule,2,'Source translation of DCG rules',4656,4660).
62 predicate(var_property,2,'Variable properties during macro expansion',4662,4679).
63 predicate(expand_goal,4,'Compiler: expand goal in clause-body',4695,4696).
64 predicate(goal_expansion,4,'Hook for macro-expanding goals',4698,4699).
65 predicate(expand_term,4,'Compiler: expand read term into clause(s)',4701,4702).
66 predicate(term_expansion,4,'Hook (user) Convert term before compilation',4704,4705).
67 predicate(dcg_translate_rule,4,'Source translation of DCG rules',4707,4712).
68 predicate(if,1,'Start conditional compilation (directive)',4745,4750).
69 predicate(elif,1,'Part of conditional compilation (directive)',4752,4768).
70 predicate(else,0,'Part of conditional compilation (directive)',4770,4772).
71 predicate(endif,0,'End of conditional compilation (directive)',4774,4776).
72 predicate(garbage_collect_clauses,0,'Invoke clause garbage collector',4802,4810).
73 predicate(qcompile,1,'Compile source to Quick Load File',4916,4936).
74 predicate(qcompile,2,'Compile source to Quick Load File',4938,4941).
75 predicate(edit,1,'Edit a file, predicate, module (extensible)',4968,4975).
76 predicate(edit,0,'Edit current script- or associated file',4977,4981).
77 predicate(locate,3,'Locate targets for edit/1',4990,5003).
78 predicate(locate,2,'Locate targets for edit/1',5005,5008).
79 predicate(edit_source,1,'Call editor for edit/1',5010,5027).
80 predicate(edit_command,2,'Specify editor activation',5029,5054).
81 predicate(load,0,'Load edit/1 extensions',5056,5069).
82 predicate(listing,1,'List predicate',5074,5085).
83 predicate(listing,0,'List program in current module',5087,5091).
84 predicate(portray_clause,1,'Pretty print a clause',5093,5098).
85 predicate(portray_clause,2,'Pretty print a clause to a stream',5100,5102).
86 predicate(var,1,'Type check for unbound variable',5112,5114).
87 predicate(nonvar,1,'Type check for bound term',5116,5118).
88 predicate(integer,1,'Type check for integer',5120,5122).
89 predicate(float,1,'Type check for a floating point number',5124,5126).
90 predicate(rational,1,'Type check for a rational number',5128,5131).
91 predicate(rational,3,'Decompose a rational',5133,5138).
92 predicate(number,1,'Type check for integer or float',5140,5142).
93 predicate(atom,1,'Type check for an atom',5144,5146).
94 predicate(blob,2,'Type check for a blob',5148,5150).
95 predicate(string,1,'Type check for string',5152,5158).
96 predicate(atomic,1,'Type check for primitive',5160,5174).
97 predicate(compound,1,'Test for compound term',5176,5179).
98 predicate(callable,1,'Test for atom or compound term',5181,5200).
99 predicate(ground,1,'Verify term holds no unbound variables',5202,5204).
100 predicate(cyclic_term,1,'Test term for cycles',5206,5209).
101 predicate(acyclic_term,1,'Test term for cycles',5211,5215).
102 predicate(=,2,'True when arguments are unified',5223,5230).
103 predicate(\=,2,'True if arguments cannot be unified',5232,5234).
104 predicate(==,2,'Test for strict equality',5260,5263).
105 predicate(\==,2,'True if arguments are not strictly equal',5265,5267).
106 predicate(@<,2,'Standard order smaller',5269,5271).
107 predicate(@=<,2,'Standard order smaller or equal',5273,5276).
108 predicate(@>,2,'Standard order larger',5278,5280).
109 predicate(@>=,2,'Standard order larger or equal',5282,5285).
110 predicate(compare,3,'Compare, using a predicate to determine the order',5287,5290).
111 predicate(unify_with_occurs_check,2,'Logically sound unification',5303,5340).
112 predicate(=@=,2,'Test for structural equality (variant)',5342,5383).
113 predicate(\=@=,2,'Not structural identical',5385,5387).
114 predicate(subsumes_term,2,'One-sided unification test',5389,5395).
115 predicate(term_subsumer,3,'Most specific generalization of two terms',5397,5400).
116 predicate(unifiable,3,'Determining binding required for unification',5402,5407).
117 predicate(?=,2,'Test of terms can be compared now',5409,5414).
118 predicate(fail,0,'Always false',5432,5435).
119 predicate(false,0,'Always false',5437,5439).
120 predicate(true,0,'Succeed',5441,5444).
121 predicate(repeat,0,'Succeed, leaving infinite backtrack points',5446,5448).
122 predicate(!,0,'Cut (discard choicepoints)',5450,5469).
123 predicate(',',2,'Conjunction of goals',5471,5478).
124 predicate(;,2,'Disjunction of two goals',5480,5486).
125 predicate('|',2,'Disjunction in DCGs. Same as ;/2',5488,5491).
126 predicate(->,2,'If-then-else',5493,5510).
127 predicate(*->,2,'Soft-cut',5512,5522).
128 predicate(\+,1,'Negation by failure. Same as not/1',5524,5528).
129 predicate(call,1,'Call a goal',5540,5543).
130 predicate(call,_G48,'Call with additional arguments',5545,5556).
131 predicate(apply,2,'Call goal with additional arguments',5558,5563).
132 predicate(not,1,'Negation by failure (argument not provable). Same as \\+/1',5565,5568).
133 predicate(once,1,'Call a goal deterministically',5570,5584).
134 predicate(ignore,1,'Call the argument, but always succeed',5586,5594).
135 predicate(call_with_depth_limit,3,'Prove goal with bounded depth',5596,5625).
136 predicate(call_with_inference_limit,3,'Prove goal in limited inferences',5627,5659).
137 predicate(setup_call_cleanup,3,'Undo side-effects safely',5661,5716).
138 predicate(setup_call_catcher_cleanup,4,'Undo side-effects safely',5718,5749).
139 predicate(call_cleanup,2,'Guard a goal with a cleaup-handler',5751,5758).
140 predicate(call_cleanup,3,'Guard a goal with a cleaup-handler',5760,5763).
141 predicate(catch,3,'Call goal, watching for exceptions',5775,5786).
142 predicate(throw,1,'Raise an exception (see catch/3)',5788,5820).
143 predicate(print_message,2,'Print message from (exception) term',5900,5965).
144 predicate(print_message_lines,3,'Print message to stream',5967,6008).
145 predicate(message_hook,3,'Intercept print_message/2',6010,6018).
146 predicate(thread_message_hook,3,'Thread local message_hook/3',6020,6026).
147 predicate(message_property,2,'Hook (user) Define display of a message',6028,6065).
148 predicate(message_line_element,2,'Hook (prolog) Intercept print_message_lines/3',6067,6071).
149 predicate(message_to_string,2,'Translate message-term to string',6073,6075).
150 predicate(version,0,'Print system banner message',6077,6081).
151 predicate(version,1,'Add messages to the system banner',6083,6088).
152 predicate(on_signal,3,'Handle a software signal',6175,6209).
153 predicate(current_signal,3,'Current software signal mapping',6211,6215).
154 predicate(phrase,2,'Activate grammar-rule set',6298,6300).
155 predicate(phrase,3,'Activate grammar-rule set (returning rest)',6302,6358).
156 predicate(call_dcg,3,'As phrase/3 without type checking',6360,6386).
157 predicate(abolish,1,'Remove predicate definition from the database',6417,6433).
158 predicate(abolish,2,'Remove predicate definition from the database',6435,6438).
159 predicate(copy_predicate_clauses,2,'Copy clauses between predicates',6440,6463).
160 predicate(redefine_system_predicate,1,'Abolish system definition',6465,6475).
161 predicate(retract,1,'Remove clause from the database',6477,6481).
162 predicate(retractall,1,'Remove unifying clauses from the database',6483,6488).
163 predicate(asserta,1,'Add a clause to the database (first)',6490,6497).
164 predicate(assertz,1,'Add a clause to the database (last)',6499,6502).
165 predicate(assert,1,'Add a clause to the database',6504,6507).
166 predicate(asserta,2,'Add a clause to the database (first)',6509,6513).
167 predicate(assertz,2,'Add a clause to the database (last)',6515,6518).
168 predicate(assert,2,'Add a clause to the database, give reference',6520,6523).
169 predicate(recorda,3,'Record term in the database (first)',6525,6531).
170 predicate(recorda,2,'Record term in the database (first)',6533,6535).
171 predicate(recordz,3,'Record term in the database (last)',6537,6540).
172 predicate(recordz,2,'Record term in the database (last)',6542,6544).
173 predicate(recorded,3,'Obtain term from the database',6546,6557).
174 predicate(recorded,2,'Obtain term from the database',6559,6561).
175 predicate(erase,1,'Erase a database record or clause',6563,6568).
176 predicate(instance,2,'Fetch clause or record from reference',6570,6573).
177 predicate(flag,3,'Simple global variable system',6575,6585).
178 predicate(term_hash,2,'Hash-value of ground term',6621,6636).
179 predicate(term_hash,4,'Hash-value of term with depth limit',6638,6647).
180 predicate(variant_sha1,2,'Term-hash for term-variants',6649,6668).
181 predicate(dynamic,1,'Indicate predicate definition may change',6689,6697).
182 predicate(compile_predicates,1,'Compile dynamic code to static',6699,6707).
183 predicate(multifile,1,'Indicate distributed definition of predicate',6709,6713).
184 predicate(discontiguous,1,'Indicate distributed definition of a predicate',6715,6718).
185 predicate(public,1,'Declaration that a predicate may be called',6720,6729).
186 predicate(current_atom,1,'Examine existing atoms',6734,6738).
187 predicate(current_blob,2,'Examine typed blobs',6740,6745).
188 predicate(current_functor,2,'Examine existing name/arity pairs',6747,6750).
189 predicate(current_flag,1,'Examine existing flags',6752,6755).
190 predicate(current_key,1,'Examine existing database keys',6757,6760).
191 predicate(current_predicate,1,'Examine existing predicates (ISO)',6762,6778).
192 predicate(current_predicate,2,'Examine existing predicates',6780,6797).
193 predicate(predicate_property,2,'Query predicate attributes',6799,6955).
194 predicate(dwim_predicate,2,'Find predicate in ``Do What I Mean\'\' sense',6957,6966).
195 predicate(clause,2,'Get clauses of a predicate',6968,6972).
196 predicate(clause,3,'Get clauses of a predicate',6974,6979).
197 predicate(nth_clause,3,'N-th clause of a predicate',6981,7000).
198 predicate(clause_property,2,'Get properties of a clause',7002,7056).
199 predicate(open,4,'Open a file (creating a stream)',7134,7270).
200 predicate(open,3,'Open a file (creating a stream)',7272,7274).
201 predicate(open_null_stream,1,'Open a stream to discard output',7276,7294).
202 predicate(close,1,'Close stream',7296,7306).
203 predicate(close,2,'Close stream (forced)',7308,7312).
204 predicate(stream_property,2,'Get stream properties',7314,7427).
205 predicate(current_stream,3,'Examine open streams',7429,7436).
206 predicate(is_stream,1,'Type check for a stream handle',7438,7442).
207 predicate(stream_pair,3,'Create/examine a bi-directional stream',7444,7461).
208 predicate(set_stream_position,2,'Seek stream to position',7463,7467).
209 predicate(stream_position_data,3,'Access fields from stream position',7469,7475).
210 predicate(seek,4,'Modify the current position in a stream',7477,7505).
211 predicate(set_stream,2,'Set stream attribute',7507,7606).
212 predicate(set_prolog_IO,3,'Prepare streams for interactive session',7608,7619).
213 predicate(see,1,'Change the current input stream',7698,7703).
214 predicate(tell,1,'Change current output stream',7705,7710).
215 predicate(append,1,'Append to a file',7712,7716).
216 predicate(seeing,1,'Query the current input stream',7718,7723).
217 predicate(telling,1,'Query current output stream',7725,7730).
218 predicate(seen,0,'Close the current input stream',7732,7735).
219 predicate(told,0,'Close current output',7737,7740).
220 predicate(set_input,1,'Set current input stream from a stream',7748,7752).
221 predicate(set_output,1,'Set current output stream from a stream',7754,7757).
222 predicate(current_input,1,'Get current input stream',7759,7762).
223 predicate(current_output,1,'Get the current output stream',7764,7766).
224 predicate(with_output_to,2,'Write to strings and more',7771,7821).
225 predicate(wait_for_input,3,'Wait for input with optional timeout',7826,7868).
226 predicate(byte_count,2,'Byte-position in a stream',7870,7875).
227 predicate(character_count,2,'Get character index on a stream',7877,7882).
228 predicate(line_count,2,'Line number on stream',7884,7887).
229 predicate(line_position,2,'Character position in line on stream',7889,7894).
230 predicate(nl,0,'Generate a newline',7901,7904).
231 predicate(nl,1,'Generate a newline on a stream',7906,7908).
232 predicate(put,1,'Write a character',7910,7915).
233 predicate(put,2,'Write a character on a stream',7917,7919).
234 predicate(put_byte,1,'Write a byte',7921,7924).
235 predicate(put_byte,2,'Write a byte on a stream',7926,7929).
236 predicate(put_char,1,'Write a character',7931,7936).
237 predicate(put_char,2,'Write a character on a stream',7938,7942).
238 predicate(put_code,1,'Write a character-code',7944,7948).
239 predicate(put_code,2,'Write a character-code on a stream',7950,7952).
240 predicate(tab,1,'Output number of spaces',7954,7958).
241 predicate(tab,2,'Output number of spaces on a stream',7960,7962).
242 predicate(flush_output,0,'Output pending characters on current stream',7964,7968).
243 predicate(flush_output,1,'Output pending characters on specified stream',7970,7973).
244 predicate(ttyflush,0,'Flush output on terminal',7975,7977).
245 predicate(get_byte,1,'Read next byte (ISO)',7979,7983).
246 predicate(get_byte,2,'Read next byte from a stream (ISO)',7985,7988).
247 predicate(get_code,1,'Read next character (ISO)',7990,7994).
248 predicate(get_code,2,'Read next character from a stream (ISO)',7996,7998).
249 predicate(get_char,1,'Read next character as an atom (ISO)',8000,8004).
250 predicate(get_char,2,'Read next character from a stream (ISO)',8006,8009).
251 predicate(get0,1,'Read next character',8011,8016).
252 predicate(get0,2,'Read next character from a stream',8018,8021).
253 predicate(get,1,'Read first non-blank character',8023,8027).
254 predicate(get,2,'Read first non-blank character from a stream',8029,8032).
255 predicate(peek_byte,1,'Read byte without removing',8034,8035).
256 predicate(peek_byte,2,'Read byte without removing',8037,8038).
257 predicate(peek_code,1,'Read character-code without removing',8040,8041).
258 predicate(peek_code,2,'Read character-code without removing',8043,8044).
259 predicate(peek_char,1,'Read character without removing',8046,8047).
260 predicate(peek_char,2,'Read character without removing',8049,8056).
261 predicate(peek_string,3,'Read a string without removing',8058,8065).
262 predicate(skip,1,'Skip to character in current input',8067,8071).
263 predicate(skip,2,'Skip to character on stream',8073,8075).
264 predicate(get_single_char,1,'Read next character from the terminal',8077,8086).
265 predicate(at_end_of_stream,0,'Test for end of file on input',8088,8092).
266 predicate(at_end_of_stream,1,'Test for end of file on stream',8094,8099).
267 predicate(set_end_of_stream,1,'Set physical end of an open file',8101,8105).
268 predicate(copy_stream_data,3,'Copy n bytes from stream to stream',8107,8112).
269 predicate(copy_stream_data,2,'Copy all data from stream to stream',8114,8116).
270 predicate(read_pending_input,3,'Fetch buffered input from a stream',8118,8144).
271 predicate(write_term,2,'Write term with options',8158,8325).
272 predicate(write_term,3,'Write term with options to stream',8327,8330).
273 predicate(write_length,3,'Dermine #characters to output a term',8332,8341).
274 predicate(write_canonical,1,'Write a term with quotes, ignore operators',8343,8357).
275 predicate(write_canonical,2,'Write a term with quotes, ignore operators on a stream',8359,8361).
276 predicate(write,1,'Write term',8363,8366).
277 predicate(write,2,'Write term to stream',8368,8370).
278 predicate(writeq,1,'Write term, insert quotes',8372,8377).
279 predicate(writeq,2,'Write term, insert quotes on stream',8379,8381).
280 predicate(writeln,1,'Write term, followed by a newline',8383,8387).
281 predicate(writeln,2,'Write term, followed by a newline to a stream',8389,8393).
282 predicate(print,1,'Print a term',8395,8423).
283 predicate(print,2,'Print a term on a stream',8425,8427).
284 predicate(portray,1,'Hook (user) Modify behaviour of print/1',8429,8436).
285 predicate(read,1,'Read Prolog term',8438,8443).
286 predicate(read,2,'Read Prolog term from stream',8445,8447).
287 predicate(read_clause,3,'Read clause from stream',8449,8479).
288 predicate(read_term,2,'Read term with options',8481,8622).
289 predicate(read_term,3,'Read term with options from stream',8624,8626).
290 predicate(read_term_from_atom,3,'Read term with options from atom',8628,8633).
291 predicate(read_history,6,'Read using history substitution',8635,8650).
292 predicate(prompt,2,'Change the prompt used by read/1',8652,8660).
293 predicate(prompt1,1,'Change prompt for 1 line',8662,8665).
294 predicate(functor,3,'Get name and arity of a term or construct a term ',8670,8690).
295 predicate(arg,3,'Access argument of a term',8692,8701).
296 predicate(=..,2,'``Univ.\'\' Term to list conversion',8703,8725).
297 predicate(compound_name_arity,3,'Name and arity of a compound term',8727,8731).
298 predicate(compound_name_arguments,3,'Name and arguments of a compound term',8733,8736).
299 predicate(numbervars,3,'Number unbound variables of a term',8738,8758).
300 predicate(numbervars,4,'Number unbound variables of a term',8760,8779).
301 predicate(var_number,2,'Check that var is numbered by numbervars',8781,8787).
302 predicate(term_variables,2,'Find unbound variables in a term',8789,8799).
303 predicate(term_variables,3,'Find unbound variables in a term',8801,8804).
304 predicate(copy_term,2,'Make a copy of a term',8806,8815).
305 predicate(setarg,3,'Destructive assignment on term',8827,8843).
306 predicate(nb_setarg,3,'Non-backtrackable assignment to term',8845,8875).
307 predicate(nb_linkarg,3,'Non-backtrackable assignment to term',8877,8881).
308 predicate(duplicate_term,2,'Create a copy of a term',8883,8888).
309 predicate(same_term,2,'Test terms to be at the same address',8890,8895).
310 predicate(atom_codes,2,'Convert between atom and list of characters codes',8918,8924).
311 predicate(atom_chars,2,'Convert between atom and list of characters',8926,8934).
312 predicate(char_code,2,'Convert between character and character code',8936,8939).
313 predicate(number_chars,2,'Convert between number and one-char atoms',8941,8948).
314 predicate(number_codes,2,'Convert between number and character codes',8950,8954).
315 predicate(atom_number,2,'Convert between atom and number',8956,8963).
316 predicate(name,2,'Convert between atom and list of character codes',8965,8982).
317 predicate(term_to_atom,2,'Convert between term and atom',8984,8991).
318 predicate(atom_to_term,3,'Convert between atom and term',8993,9000).
319 predicate(atom_concat,3,'Contatenate two atoms',9002,9009).
320 predicate(atomic_concat,3,'Concatenate two atomic values to an atom',9011,9019).
321 predicate(atomic_list_concat,2,'Append a list of atomics',9021,9026).
322 predicate(atomic_list_concat,3,'Append a list of atomics with separator',9028,9049).
323 predicate(atom_length,2,'Determine length of an atom',9051,9057).
324 predicate(atom_prefix,2,'Test for start of atom',9059,9062).
325 predicate(sub_atom,5,'Take a substring from an atom',9064,9078).
326 predicate(sub_atom_icasechk,3,'Case insensitive substring match',9080,9086).
327 predicate(locale_create,3,'Create a new locale object',9116,9150).
328 predicate(locale_destroy,1,'Destroy a locale object',9152,9156).
329 predicate(locale_property,2,'Query properties of locale objects',9158,9161).
330 predicate(set_locale,1,'Set the default local',9163,9169).
331 predicate(current_locale,1,'Get the current locale',9171,9173).
332 predicate(char_type,2,'Classify characters',9188,9296).
333 predicate(code_type,2,'Classify a character-code',9298,9305).
334 predicate(downcase_atom,2,'Convert atom to lower-case',9315,9320).
335 predicate(upcase_atom,2,'Convert atom to upper-case',9322,9324).
336 predicate(normalize_space,2,'Normalize white space',9329,9334).
337 predicate(collation_key,2,'Sort key for locale dependent ordering',9342,9355).
338 predicate(locale_sort,2,'Language dependent sort of atoms',9357,9362).
339 predicate(op,3,'Declare an operator',9401,9469).
340 predicate(current_op,3,'Examine current operator declarations',9471,9474).
341 predicate(char_conversion,2,'Provide mapping of input characters',9482,9488).
342 predicate(current_char_conversion,2,'Query input character mapping',9490,9493).
343 predicate(between,3,'Integer range checking/generating',9513,9520).
344 predicate(succ,2,'Logical integer successor relation',9522,9528).
345 predicate(plus,3,'Logical integer addition',9530,9533).
346 predicate(divmod,4,'Compute quotient and remainder of two integers',9535,9552).
347 predicate(nth_integer_root_and_remainder,4,'Integer root and remainder',9554,9571).
348 predicate(>,2,'Arithmetic larger',9582,9584).
349 predicate(<,2,'Arithmetic smaller',9586,9588).
350 predicate(=<,2,'Arithmetic smaller or equal',9590,9593).
351 predicate(>=,2,'Arithmetic larger or equal',9595,9598).
352 predicate(=\=,2,'Arithmetic not equal',9600,9602).
353 predicate(=:=,2,'Arithmetic equality',9604,9606).
354 predicate(is,2,'Evaluate arithmetic expression',9608,9617).
355 predicate(-,1,'Unary minus',9733,9735).
356 predicate(+,1,'Unary plus (No-op)',9737,9740).
357 predicate(+,2,'Addition',9742,9744).
358 predicate(-,2,'Subtraction',9746,9748).
359 predicate(*,2,'Multiplication',9750,9752).
360 predicate(/,2,'Division',9754,9762).
361 predicate(mod,2,'Remainder of division',9764,9767).
362 predicate(rem,2,'Remainder of division',9769,9772).
363 predicate(//,2,'Integer division',9774,9779).
364 predicate(div,2,'Integer division',9781,9794).
365 predicate(rdiv,2,'Ration number division',9796,9800).
366 predicate(gcd,2,'Greatest common divisor',9802,9804).
367 predicate(abs,1,'Absolute value',9806,9808).
368 predicate(sign,1,'Extract sign of value',9810,9815).
369 predicate(copysign,2,'Apply sign of N2 to N1',9817,9828).
370 predicate(max,2,'Maximum of two numbers',9830,9835).
371 predicate(min,2,'Minimum of two numbers',9837,9840).
372 predicate('.',2,'Consult. Also functional notation',9842,9851).
373 predicate(random,1,'Binds R to a new random float in the _open_ interval (0.0,1.0).',9853,9865).
374 predicate(random_float,0,'Generate random number',9867,9873).
375 predicate(round,1,'Round to nearest integer',9875,9882).
376 predicate(integer,1,'Type check for integer',9884,9886).
377 predicate(float,1,'Type check for a floating point number',9888,9893).
378 predicate(rational,1,'Type check for a rational number',9895,9913).
379 predicate(rationalize,1,'Convert to rational number',9915,9929).
380 predicate(float_fractional_part,1,'Fractional part of a float',9931,9936).
381 predicate(float_integer_part,1,'Integer part of a float',9938,9941).
382 predicate(truncate,1,'Truncate float to integer',9943,9947).
383 predicate(floor,1,'Largest integer below argument',9949,9952).
384 predicate(ceiling,1,'Smallest integer larger than arg',9954,9957).
385 predicate(ceil,1,'Smallest integer larger than arg',9959,9961).
386 predicate(>>,2,'Bitwise right shift',9963,9968).
387 predicate(<<,2,'Bitwise left shift',9970,9972).
388 predicate(\/,2,'Bitwise or',9974,9976).
389 predicate(/\,2,'Bitwise and',9978,9980).
390 predicate(xor,2,'Bitwise exclusive or',9982,9984).
391 predicate(\,1,'Bitwise negation',9986,9989).
392 predicate(sqrt,1,'Square root',9991,9993).
393 predicate(sin,1,'Sine',9995,9997).
394 predicate(cos,1,'Cosine',9999,10001).
395 predicate(tan,1,'Tangent',10003,10005).
396 predicate(asin,1,'Inverse (arc) sine',10007,10009).
397 predicate(acos,1,'Inverse (arc) cosine',10011,10013).
398 predicate(atan,1,'Inverse hyperbolic sine',10015,10017).
399 predicate(atan2,2,'Rectangular to polar conversion',10019,10027).
400 predicate(atan,2,'Rectangular to polar conversion',10029,10031).
401 predicate(sinh,1,'Hyperbolic sine',10033,10036).
402 predicate(cosh,1,'Hyperbolic cosine',10038,10041).
403 predicate(tanh,1,'Hyperbolic tangent',10043,10046).
404 predicate(asinh,1,'Inverse (arc) sine',10048,10050).
405 predicate(acosh,1,'Inverse hyperbolic cosine',10052,10054).
406 predicate(atanh,1,'Inverse hyperbolic tangent',10056,10058).
407 predicate(log,1,'Natural logarithm',10060,10062).
408 predicate(log10,1,'10 base logarithm',10064,10066).
409 predicate(exp,1,'Exponent (base $e$)',10068,10070).
410 predicate(**,2,'Power function',10072,10087).
411 predicate(^,2,'Existential quantification (bagof/3, setof/3)',10089,10107).
412 predicate(powm,3,'Integer exponent and modulo',10109,10114).
413 predicate(lgamma,1,'Log of gamma function',10116,10119).
414 predicate(erf,1,'Gauss error function',10121,10126).
415 predicate(erfc,1,'Complementary error function',10128,10130).
416 predicate(pi,0,'Mathematical constant',10132,10134).
417 predicate(e,0,'Mathematical constant',10136,10138).
418 predicate(epsilon,0,'Floating point precision',10140,10143).
419 predicate(cputime,0,'Get CPU time',10145,10149).
420 predicate(eval,1,'Evaluate term as expression',10151,10166).
421 predicate(msb,1,'Most significant bit',10168,10173).
422 predicate(lsb,1,'Least significant bit',10175,10180).
423 predicate(popcount,1,'Count 1s in a bitvector',10182,10185).
424 predicate(getbit,2,'Get bit at index from large integer',10187,10194).
425 predicate(set_random,1,'Control random number generation',10199,10221).
426 predicate(random_property,1,'Query properties of random generation',10223,10235).
427 predicate(current_arithmetic_function,1,'Examine evaluable functions',10237,10244).
428 predicate(is_list,1,'Type check for a list',10253,10268).
429 predicate(memberchk,2,'Deterministic member/2',10270,10278).
430 predicate(length,2,'Length of a list',10280,10297).
431 predicate(sort,2,'Sort elements in a list',10299,10305).
432 predicate(sort,4,'Sort elements in a list',10307,10358).
433 predicate(msort,2,'Sort, do not remove duplicates',10360,10363).
434 predicate(keysort,2,'Sort, using a key',10365,10387).
435 predicate(predsort,3,'Sort, using a predicate to determine the order',10389,10394).
436 predicate(findall,3,'Find all solutions to a goal',10399,10406).
437 predicate(findall,4,'Difference list version of findall/3',10408,10416).
438 predicate(findnsols,4,'Find first solutions',10418,10419).
439 predicate(findnsols,5,'Difference list version of findsols/4',10421,10454).
440 predicate(bagof,3,'Find all solutions to a goal',10456,10488).
441 predicate(setof,3,'Find all unique solutions to a goal',10490,10493).
442 predicate(forall,2,'Prove goal for all solutions of another goal',10498,10539).
443 predicate(writef,1,'Formatted write',10554,10556).
444 predicate(writef,2,'Formatted write on stream',10558,10617).
445 predicate(swritef,3,'Formatted write on a string',10619,10627).
446 predicate(swritef,2,'Formatted write on a string',10629,10631).
447 predicate(format,1,'Formatted output',10639,10642).
448 predicate(format,2,'Formatted output with arguments',10644,10815).
449 predicate(format,3,'Formatted output on a stream',10817,10827).
450 predicate(format_predicate,2,'Program format/[1,2]',10832,10861).
451 predicate(current_format_predicate,2,'Enumerate user-defined format codes',10863,10866).
452 predicate(tty_get_capability,3,'Get terminal parameter',10876,10884).
453 predicate(tty_goto,2,'Goto position on screen',10886,10890).
454 predicate(tty_put,2,'Write control string to terminal',10892,10898).
455 predicate(tty_size,2,'Get row/column size of the terminal',10900,10914).
456 predicate(shell,2,'Execute OS command',10919,10948).
457 predicate(shell,1,'Execute OS command',10950,10952).
458 predicate(shell,0,'Execute interactive subshell',10954,10958).
459 predicate(getenv,2,'Get shell environment variable',10960,10964).
460 predicate(setenv,2,'Set shell environment variable',10966,10975).
461 predicate(unsetenv,1,'Delete shell environment variable',10977,10981).
462 predicate(setlocale,3,'Set/query C-library regional information',10983,10995).
463 predicate(unix,1,'OS interaction',10997,11038).
464 predicate(win_exec,2,'Win32: spawn Windows task',11049,11056).
465 predicate(win_shell,3,'Win32: open document through Shell',11058,11067).
466 predicate(win_shell,2,'Win32: open document through Shell',11069,11071).
467 predicate(win_registry_get_value,3,'Win32: get registry value',11073,11094).
468 predicate(win_folder,2,'Win32: get special folder by CSIDL',11096,11109).
469 predicate(win_add_dll_directory,1,'Add directory to DLL search path',11111,11120).
470 predicate(win_add_dll_directory,2,'Add directory to DLL search path',11122,11145).
471 predicate(win_remove_dll_directory,1,'Remove directory from DLL search path',11147,11150).
472 predicate(get_time,1,'Get current time',11224,11227).
473 predicate(stamp_date_time,3,'Convert time-stamp to date structure',11229,11235).
474 predicate(date_time_stamp,2,'Convert date structure to time-stamp',11237,11288).
475 predicate(date_time_value,3,'Extract info from a date structure',11290,11307).
476 predicate(format_time,3,'C strftime() like date/time formatter',11309,11471).
477 predicate(format_time,4,'date/time formatter with explicit locale',11473,11482).
478 predicate(parse_time,2,'Parse text to a time-stamp',11484,11486).
479 predicate(parse_time,3,'Parse text to a time-stamp',11488,11508).
480 predicate(day_of_the_week,2,'Determine ordinal-day from date',11510,11515).
481 predicate(window_title,2,'Win32: change title of window',11526,11529).
482 predicate(win_window_pos,1,'Win32: change size and position of window',11531,11554).
483 predicate(win_has_menu,0,'Win32: true if console menu is available',11556,11558).
484 predicate(win_insert_menu,2,'swipl-win.exe: add menu',11560,11571).
485 predicate(win_insert_menu_item,4,'swipl-win.exe: add item to menu',11573,11577).
486 predicate(access_file,2,'Check access permissions of a file',11582,11592).
487 predicate(exists_file,1,'Check existence of file',11594,11597).
488 predicate(file_directory_name,2,'Get directory part of path',11599,11619).
489 predicate(file_base_name,2,'Get file part of path',11621,11626).
490 predicate(same_file,2,'Succeeds if arguments refer to same file',11628,11637).
491 predicate(exists_directory,1,'Check existence of directory',11639,11642).
492 predicate(delete_file,1,'Remove a file from the file system',11644,11646).
493 predicate(rename_file,2,'Change name of file',11648,11654).
494 predicate(size_file,2,'Get size of a file in characters',11656,11658).
495 predicate(time_file,2,'Get last modification time of file',11660,11664).
496 predicate(absolute_file_name,2,'Get absolute path name',11666,11674).
497 predicate(absolute_file_name,3,'Get absolute path name with options',11676,11733).
498 predicate(is_absolute_file_name,1,'True if arg defines an absolute path',11735,11741).
499 predicate(file_name_extension,3,'Add, remove or test file extensions',11743,11751).
500 predicate(directory_files,2,'Get entries of a directory/folder',11753,11759).
501 predicate(expand_file_name,2,'Wildcard expansion of file names',11761,11778).
502 predicate(prolog_to_os_filename,2,'Convert between Prolog and OS filenames',11780,11786).
503 predicate(read_link,3,'Read a symbolic link',11788,11794).
504 predicate(tmp_file,2,'Create a temporary filename',11796,11806).
505 predicate(tmp_file_stream,3,'Create a temporary file and open it',11808,11835).
506 predicate(make_directory,1,'Create a folder on the file system',11837,11841).
507 predicate(delete_directory,1,'Remove a folder from the file system',11843,11847).
508 predicate(working_directory,2,'Query/change CWD',11849,11855).
509 predicate(chdir,1,'Compatibility: change working directory',11857,11859).
510 predicate(break,0,'Start interactive top level',11864,11872).
511 predicate(abort,0,'Abort execution, return to top level',11874,11891).
512 predicate(halt,0,'Exit from Prolog',11893,11896).
513 predicate(halt,1,'Exit from Prolog with status',11898,11927).
514 predicate(prolog,0,'Run interactive top level',11929,11938).
515 predicate(expand_query,4,'Expanded entered query',11940,11948).
516 predicate(expand_answer,2,'Expand answer of query',11950,11955).
517 predicate(protocol,1,'Make a log of the user interaction',11964,11967).
518 predicate(protocola,1,'Append log of the user interaction to file',11969,11972).
519 predicate(noprotocol,0,'Disable logging of user interaction',11974,11977).
520 predicate(protocolling,1,'On what file is user interaction logged',11979,11982).
521 predicate(trace,0,'Start the tracer',11993,11997).
522 predicate(tracing,0,'Query status of the tracer',11999,12002).
523 predicate(notrace,0,'Stop tracing',12004,12006).
524 predicate(guitracer,0,'Install hooks for the graphical debugger',12008,12013).
525 predicate(noguitracer,0,'Disable the graphical debugger',12015,12017).
526 predicate(trace,1,'Set trace point on predicate',12019,12021).
527 predicate(trace,2,'Set/Clear trace point on ports',12023,12043).
528 predicate(notrace,1,'Do not debug argument goal',12045,12050).
529 predicate(debug,0,'Test for debugging mode',12052,12065).
530 predicate(nodebug,0,'Disable debugging',12067,12070).
531 predicate(debugging,0,'Show debugger status',12072,12075).
532 predicate(spy,1,'Force tracer on specified predicate',12077,12080).
533 predicate(nospy,1,'Remove spy point',12082,12085).
534 predicate(nospyall,0,'Remove all spy points',12087,12089).
535 predicate(leash,1,'Change ports visited by the tracer',12091,12099).
536 predicate(visible,1,'Ports that are visible in the tracer',12101,12104).
537 predicate(unknown,2,'Trap undefined predicates',12106,12111).
538 predicate(style_check,1,'Change level of warnings',12113,12197).
539 predicate(statistics,2,'Obtain collected statistics',12202,12290).
540 predicate(statistics,0,'Show execution statistics',12292,12294).
541 predicate(time,1,'Determine time needed to execute goal',12296,12304).
542 predicate(profile,1,'Obtain execution statistics',12322,12326).
543 predicate(profile,2,'Obtain execution statistics',12328,12341).
544 predicate(show_profile,1,'Show results of the profiler',12343,12355).
545 predicate(profiler,2,'Obtain/change status of the profiler',12357,12371).
546 predicate(reset_profiler,0,'Clear statistics obtained by the profiler',12373,12375).
547 predicate(noprofile,1,'Hide (meta-) predicate for the profiler',12377,12383).
548 predicate(garbage_collect,0,'Invoke the garbage collector',12486,12493).
549 predicate(garbage_collect_atoms,0,'Invoke the atom garbage collector',12495,12503).
550 predicate(trim_stacks,0,'Release unused memory resources',12505,12523).
551 predicate(set_prolog_stack,2,'Modify stack characteristics',12525,12564).
552 predicate(prolog_stack_property,2,'Query properties of the stacks',12566,12569).
553 predicate(open_dde_conversation,3,'Win32: Open DDE channel',12615,12620).
554 predicate(close_dde_conversation,1,'Win32: Close DDE channel',12622,12627).
555 predicate(dde_request,3,'Win32: Make a DDE request',12629,12633).
556 predicate(dde_execute,2,'Win32: Execute command on DDE server',12635,12639).
557 predicate(dde_poke,3,'Win32: POKE operation on DDE server',12641,12644).
558 predicate(dde_register_service,2,'Win32: Become a DDE server',12655,12692).
559 predicate(dde_unregister_service,1,'Win32: Terminate a DDE service',12694,12697).
560 predicate(dde_current_service,2,'Win32: Examine DDE services provided',12699,12701).
561 predicate(dde_current_connection,2,'Win32: Examine open DDE connections',12703,12705).
562 predicate(dwim_match,2,'Atoms match in ``Do What I Mean\'\' sense',12710,12728).
563 predicate(dwim_match,3,'Atoms match in ``Do What I Mean\'\' sense',12730,12735).
564 predicate(wildcard_match,2,'Csh(1) style wildcard match',12737,12753).
565 predicate(sleep,1,'Suspend execution for specified time',12755,12765).
566 predicate(atom_string,2,'Conversion between atom and string',12909,12913).
567 predicate(number_string,2,'Convert between number and string',12915,12933).
568 predicate(term_string,2,'Read/write a term from/to a string',12935,12940).
569 predicate(term_string,3,'Read/write a term from/to a string',12942,12951).
570 predicate(string_chars,2,'Conversion between string and list of characters',12953,12957).
571 predicate(string_codes,2,'Conversion between string and list of character codes',12959,12962).
572 predicate(text_to_string,2,'Convert arbitrary text to a string',12964,12968).
573 predicate(string_length,2,'Determine length of a string',12970,12974).
574 predicate(string_code,3,'Get or find a character code in a string',12976,12983).
575 predicate(get_string_code,3,'Get character code at index in string',12985,12990).
576 predicate(string_concat,3,'atom_concat/3 for strings',12992,13001).
577 predicate(split_string,4,'Break a string into substrings',13003,13035).
578 predicate(sub_string,5,'Take a substring from a string',13037,13054).
579 predicate(atomics_to_string,2,'Concatenate list of inputs to a string',13056,13061).
580 predicate(atomics_to_string,3,'Concatenate list of inputs to a string',13063,13072).
581 predicate(string_upper,2,'Case conversion to upper case',13074,13076).
582 predicate(read_string,3,'Read a number of characters into a string',13082,13086).
583 predicate(read_string,5,'Read string upto a delimiter',13088,13117).
584 predicate(open_string,2,'Open a string as a stream',13119,13123).
585 predicate(list_strings,0,'Help porting to version 7',13167,13199).
586 predicate(string_predicate,1,'Hook (check) Predicate contains strings',13201,13214).
587 predicate(valid_string_goal,1,'Hook (check) Goal handles strings',13216,13228).
588 predicate('.',3,'',13545,13552).
589 predicate(get,1,'Read first non-blank character',13599,13612).
590 predicate(put,1,'Write a character',13614,13617).
591 predicate(put,2,'Write a character on a stream',13619,13643).
592 predicate(is_dict,1,'Type check for a dict',13651,13653).
593 predicate(is_dict,2,'Type check for a dict in a class',13655,13657).
594 predicate(get_dict,3,'Get the value associated to a key from a dict',13659,13665).
595 predicate(get_dict,5,'Replace existing value in a dict',13667,13677).
596 predicate(dict_create,3,'Create a dict from data',13679,13685).
597 predicate(dict_pairs,3,'Convert between dict and list of pairs',13687,13690).
598 predicate(put_dict,3,'Add/replace multiple keys in a dict',13692,13708).
599 predicate(put_dict,4,'Add/replace a single key in a dict',13710,13719).
600 predicate(del_dict,4,'Delete Key-Value pair from a dict',13721,13724).
601 predicate(:<,2,'Select keys from a dict',13726,13744).
602 predicate(select_dict,3,'Select matching attributes from a dict',13746,13762).
603 predicate(>:<,2,'Partial dict unification',13764,13778).
604 predicate(b_set_dict,3,'Destructive assignment on a dict',13804,13809).
605 predicate(nb_set_dict,3,'Non-backtrackable assignment to dict',13811,13816).
606 predicate(nb_link_dict,3,'Non-backtrackable assignment to dict',13818,13825).
607 predicate(module,2,'Declare a module',14182,14195).
608 predicate(module,3,'Declare a module with language options',14197,14206).
609 predicate(use_module,1,'Import a module',14222,14266).
610 predicate(use_module,2,'Import predicates from a module',14268,14294).
611 predicate(meta_predicate,1,'Declare access to other predicates',14347,14424).
612 predicate(@,2,'Call using calling context',14468,14483).
613 predicate(module,1,'Query/set current type-in module',14501,14513).
614 predicate(reexport,1,'Load files and re-export the imported predicates',14536,14540).
615 predicate(reexport,2,'Load predicates from a file and re-export it',14542,14546).
616 predicate(import_module,2,'Query import modules',14601,14606).
617 predicate(default_module,2,'Query module inheritance',14608,14613).
618 predicate(add_import_module,3,'Add module to the auto-import list',14615,14619).
619 predicate(delete_import_module,2,'Remove module from import list',14621,14628).
620 predicate(export,1,'Export a predicate from a module',14657,14663).
621 predicate(import,1,'Import a predicate from a module',14665,14672).
622 predicate(module_transparent,1,'Indicate module based meta-predicate',14783,14787).
623 predicate(context_module,1,'Get context module of current goal',14789,14792).
624 predicate(strip_module,3,'Extract context module and term',14794,14800).
625 predicate(current_module,1,'Examine existing modules',14808,14813).
626 predicate(module_property,2,'Find properties of a module',14815,14866).
627 predicate(set_module,1,'Set properties of a module',14868,14887).
628 predicate(attvar,1,'Type test for attributed variable',15080,15084).
629 predicate(put_attr,3,'Put attribute on a variable',15086,15094).
630 predicate(get_attr,3,'Fetch named attribute from a variable',15096,15101).
631 predicate(del_attr,2,'Delete attribute from variable',15103,15109).
632 predicate(attr_unify_hook,2,'Attributed variable unification hook',15118,15129).
633 predicate(attr_portray_hook,2,'Attributed variable print hook',15131,15138).
634 predicate(attribute_goals,3,'Project attributes to goals',15140,15145).
635 predicate(copy_term,3,'Copy a term and obtain attribute-goals',15161,15173).
636 predicate(copy_term_nat,2,'Make a copy of a term without attributes',15175,15178).
637 predicate(term_attvars,2,'Find attributed variables in a term',15180,15187).
638 predicate(get_attrs,2,'Fetch all attributes of a variable',15197,15201).
639 predicate(put_attrs,2,'Set/replace all attributes on a variable',15203,15206).
640 predicate(del_attrs,1,'Delete all attributes from variable',15208,15211).
641 predicate(freeze,2,'Delay execution until variable is bound',15231,15238).
642 predicate(frozen,2,'Query delayed goals on var',15240,15243).
643 predicate(when,2,'Execute goal when condition becomes true',15245,15254).
644 predicate(dif,2,'Constrain two terms to be different',15256,15268).
645 predicate(call_residue_vars,2,'Find residual attributed variables',15270,15281).
646 predicate(b_setval,2,'Assign backtrackable global variable',15322,15328).
647 predicate(b_getval,2,'Fetch backtrackable global variable',15330,15337).
648 predicate(nb_setval,2,'Assign non-backtrackable global variable',15339,15343).
649 predicate(nb_getval,2,'Fetch non-backtrackable global variable',15345,15352).
650 predicate(nb_linkval,2,'Assign non-backtrackable global variable',15354,15375).
651 predicate(nb_current,2,'Enumerate non-backtrackable global variables',15377,15382).
652 predicate(nb_delete,1,'Delete a non-backtrackable global variable',15384,15387).
653 predicate(chr_option,2,'Specify CHR compilation options',15595,15633).
654 predicate(chr_constraint,1,'CHR Constraint declaration',15648,15723).
655 predicate(chr_type,1,'CHR Type declaration',15725,15854).
656 predicate(chr_trace,0,'Start CHR tracer',15991,15995).
657 predicate(chr_notrace,0,'Stop CHR tracer',15997,16001).
658 predicate(chr_leash,1,'Define CHR leashed ports',16003,16010).
659 predicate(chr_show_store,1,'List suspended CHR constraints',16012,16019).
660 predicate(find_chr_constraint,1,'Returns a constraint from the store',16021,16024).
661 predicate(thread_create,3,'Create a new Prolog task',16324,16413).
662 predicate(thread_self,1,'Get identifier of current thread',16415,16418).
663 predicate(thread_join,2,'Wait for Prolog task-completion',16420,16446).
664 predicate(thread_detach,1,'Make thread cleanup after completion',16448,16460).
665 predicate(thread_exit,1,'Terminate Prolog task with value',16462,16473).
666 predicate(thread_initialization,1,'Run action at start of thread',16475,16484).
667 predicate(thread_at_exit,1,'Register goal to be called at exit',16486,16501).
668 predicate(thread_setconcurrency,2,'Number of active threads',16503,16510).
669 predicate(thread_property,2,'Examine Prolog threads',16525,16566).
670 predicate(thread_statistics,3,'Get statistics of another thread',16568,16573).
671 predicate(mutex_statistics,0,'Print statistics on mutex usage',16575,16582).
672 predicate(thread_send_message,2,'Send message to another thread',16603,16619).
673 predicate(thread_send_message,3,'Send message to another thread',16621,16648).
674 predicate(thread_get_message,1,'Wait for message',16650,16670).
675 predicate(thread_peek_message,1,'Test for message',16672,16679).
676 predicate(message_queue_create,1,'Create queue for thread communication',16681,16686).
677 predicate(message_queue_create,2,'Create queue for thread communication',16688,16704).
678 predicate(message_queue_destroy,1,'Destroy queue for thread communication',16706,16711).
679 predicate(thread_get_message,2,'Wait for message in a queue',16713,16719).
680 predicate(thread_get_message,3,'Wait for message in a queue',16721,16744).
681 predicate(thread_peek_message,2,'Test for message in a queue',16746,16751).
682 predicate(message_queue_property,2,'Query message queue properties',16753,16812).
683 predicate(thread_signal,2,'Execute goal in another thread',16827,16845).
684 predicate(thread_local,1,'Declare thread-specific clauses for a predicate',16865,16894).
685 predicate(mutex_create,1,'Create a thread-synchronisation device',16940,16944).
686 predicate(mutex_create,2,'Create a thread-synchronisation device',16946,16952).
687 predicate(mutex_destroy,1,'Destroy a mutex',16954,16960).
688 predicate(with_mutex,2,'Run goal while holding mutex',16962,16973).
689 predicate(mutex_lock,1,'Become owner of a mutex',16975,16993).
690 predicate(mutex_trylock,1,'Become owner of a mutex (non-blocking)',16995,16998).
691 predicate(mutex_unlock,1,'Release ownership of mutex',17000,17004).
692 predicate(mutex_unlock_all,0,'Release ownership of all mutexes',17006,17010).
693 predicate(mutex_property,2,'Query mutex properties',17012,17026).
694 predicate(threads,0,'List running threads',17035,17037).
695 predicate(join_threads,0,'Join all terminated threads interactively',17039,17046).
696 predicate(interactor,0,'Start new thread with console and top level',17048,17052).
697 predicate(attach_console,0,'Attach I/O console to thread',17066,17081).
698 predicate(tdebug,1,'Switch a thread into debug mode',17083,17091).
699 predicate(tdebug,0,'Switch all threads into debug mode',17093,17095).
700 predicate(tnodebug,1,'Switch off debug mode in a thread',17097,17099).
701 predicate(tnodebug,0,'Switch off debug mode in all threads',17101,17103).
702 predicate(tspy,2,'Set spy point and enable debugging in a thread',17105,17111).
703 predicate(tspy,1,'Set spy point and enable debugging in all threads',17113,17118).
704 predicate(tprofile,1,'Profile a thread for some period',17129,17133).
705 predicate(in_pce_thread,1,'Run goal in XPCE thread',17329,17336).
706 predicate(in_pce_thread_sync,1,'Run goal in XPCE thread',17338,17351).
707 predicate(pce_dispatch,1,'Run XPCE GUI in separate thread',17353,17360).
708 predicate(load_foreign_library,1,'library(shlib) Load shared library (.so file)',17504,17505).
709 predicate(load_foreign_library,2,'library(shlib) Load shared library (.so file)',17507,17533).
710 predicate(use_foreign_library,1,'Load DLL/shared object (directive)',17535,17536).
711 predicate(use_foreign_library,2,'Load DLL/shared object (directive)',17538,17551).
712 predicate(unload_foreign_library,1,'library(shlib) Detach shared library (.so file)',17553,17554).
713 predicate(unload_foreign_library,2,'library(shlib) Detach shared library (.so file)',17556,17561).
714 predicate(current_foreign_library,2,'library(shlib) Examine loaded shared libraries (.so files)',17563,17565).
715 predicate(reload_foreign_libraries,0,'Reload DLLs/shared objects',17567,17570).
716 predicate(open_shared_object,2,'UNIX: Open shared library (.so file)',17582,17591).
717 predicate(open_shared_object,3,'UNIX: Open shared library (.so file)',17593,17602).
718 predicate(close_shared_object,1,'UNIX: Close shared library (.so file)',17604,17606).
719 predicate(call_shared_object_function,2,'UNIX: Call C-function in shared (.so) file',17608,17613).
720 predicate(qsave_program,2,'Create runtime application',21489,21554).
721 predicate(qsave_program,1,'Create runtime application',21556,21558).
722 predicate(autoload,0,'Autoload all predicates now',21560,21609).
723 predicate(volatile,1,'Predicates that are not saved',21611,21616).
724 predicate(resource,3,'Declare a program resource',21740,21774).
725 predicate(open_resource,3,'Open a program resource as a stream',21776,21795).
726 predicate(aggregate,3,'Aggregate bindings in Goal according to Template.',21987,21990).
727 predicate(aggregate,4,'Aggregate bindings in Goal according to Template.',21992,21995).
728 predicate(aggregate_all,3,'Aggregate bindings in Goal according to Template.',21997,22003).
729 predicate(aggregate_all,4,'Aggregate bindings in Goal according to Template.',22005,22010).
730 predicate(foreach,2,'True if conjunction of results is true.',22012,22034).
731 predicate(free_variables,4,'Find free variables in bagof/setof template.',22036,22060).
732 predicate(safe_meta,2,'Declare the aggregate meta-calls safe.',22062,22065).
733 predicate(include,3,'Filter elements for which Goal succeeds.',22080,22086).
734 predicate(exclude,3,'Filter elements for which Goal fails.',22088,22091).
735 predicate(partition,4,'Filter elements of List according to Pred.',22093,22097).
736 predicate(partition,5,'Filter List according to Pred in three sets.',22099,22104).
737 predicate(maplist,2,'True if Goal can successfully be applied on all elements of List.',22106,22110).
738 predicate(maplist,3,'As maplist/2, operating on pairs of elements from two lists.',22112,22114).
739 predicate(maplist,4,'As maplist/2, operating on triples of elements from three lists.',22116,22118).
740 predicate(maplist,5,'As maplist/2, operating on quadruples of elements from four lists.',22120,22122).
741 predicate(foldl,4,'Fold a list, using arguments of the list as left argument.',22124,22125).
742 predicate(foldl,5,'Fold a list, using arguments of the list as left argument.',22127,22128).
743 predicate(foldl,6,'Fold a list, using arguments of the list as left argument.',22130,22131).
744 predicate(foldl,7,'Fold a list, using arguments of the list as left argument.',22133,22143).
745 predicate(scanl,4,'Left scan of list.',22145,22146).
746 predicate(scanl,5,'Left scan of list.',22148,22149).
747 predicate(scanl,6,'Left scan of list.',22151,22152).
748 predicate(scanl,7,'Left scan of list.',22154,22165).
749 predicate(assoc_to_list,2,'Convert association tree to list',22180,22183).
750 predicate(assoc_to_keys,2,'Translate assoc into a key list',22185,22188).
751 predicate(assoc_to_values,2,'Translate assoc into a value list',22190,22193).
752 predicate(empty_assoc,1,'Create/test empty association tree',22195,22197).
753 predicate(gen_assoc,3,'Enumerate members of association tree',22199,22202).
754 predicate(get_assoc,3,'Fetch key from association tree',22204,22207).
755 predicate(get_assoc,5,'Fetch key from association tree',22209,22212).
756 predicate(list_to_assoc,2,'Create association tree from list',22214,22217).
757 predicate(map_assoc,2,'Map association tree',22219,22221).
758 predicate(map_assoc,3,'Map association tree',22223,22226).
759 predicate(max_assoc,3,'Highest key in association tree',22228,22231).
760 predicate(min_assoc,3,'Lowest key in association tree',22233,22236).
761 predicate(ord_list_to_assoc,2,'Convert ordered list to assoc',22238,22241).
762 predicate(put_assoc,4,'Add Key-Value to association tree',22243,22247).
763 predicate(is_assoc,1,'Verify association list',22249,22252).
764 predicate(broadcast,1,'Send event notification',22276,22282).
765 predicate(broadcast_request,1,'Request all agents',22284,22298).
766 predicate(listen,2,'Listen to event notifications',22300,22312).
767 predicate(listen,3,'Listen to event notifications',22314,22349).
768 predicate(unlisten,1,'Stop listening to event notifications',22351,22353).
769 predicate(unlisten,2,'Stop listening to event notifications',22355,22358).
770 predicate(unlisten,3,'Stop listening to event notifications',22360,22363).
771 predicate(listening,3,'Who is listening to event notifications?',22365,22368).
772 predicate(format_to_chars,3,'Use format/2 to write to a list of character codes.',22383,22385).
773 predicate(format_to_chars,4,'Use format/2 to write to a difference list of character codes.',22387,22389).
774 predicate(write_to_chars,2,'Write a term to a code list.',22391,22394).
775 predicate(write_to_chars,3,'Write a term to a code list.',22396,22399).
776 predicate(atom_to_chars,2,'Convert Atom into a list of character codes.',22401,22405).
777 predicate(atom_to_chars,3,'Convert Atom into a difference list of character codes.',22407,22409).
778 predicate(number_to_chars,2,'Convert Atom into a list of character codes.',22411,22415).
779 predicate(number_to_chars,3,'Convert Number into a difference list of character codes.',22417,22419).
780 predicate(read_from_chars,2,'Read Codes into Term.',22421,22426).
781 predicate(read_term_from_chars,3,'Read Codes into Term.',22428,22432).
782 predicate(open_chars_stream,2,'Open Codes as an input stream.',22434,22438).
783 predicate(with_output_to_chars,2,'Run Goal as with once/1.',22440,22443).
784 predicate(with_output_to_chars,3,'Run Goal as with once/1.',22445,22448).
785 predicate(with_output_to_chars,4,'Same as with_output_to_chars/3 using an explicit stream.',22450,22454).
786 predicate(check,0,'Run all consistency checks defined by checker/2.',22471,22486).
787 predicate(list_undefined,0,'Report undefined predicates.',22488,22489).
788 predicate(list_undefined,1,'Report undefined predicates.',22491,22504).
789 predicate(list_autoload,0,'Report predicates that may be auto-loaded.',22506,22515).
790 predicate(list_redefined,0,'Lists predicates that are defined in the global module =user= as well as in a normal module; that is, predicates for which the local definition overrules the global default definition.',22517,22521).
791 predicate(list_void_declarations,0,'List predicates that have declared attributes, but no clauses.',22523,22525).
792 predicate(list_trivial_fails,0,'List goals that trivially fail because there is no matching clause.',22527,22528).
793 predicate(list_trivial_fails,1,'List goals that trivially fail because there is no matching clause.',22530,22538).
794 predicate(trivial_fail_goal,1,'Multifile hook that tells list_trivial_fails/0 to accept Goal as valid.',22540,22543).
795 predicate(list_strings,0,'Help porting to version 7',22545,22546).
796 predicate(list_strings,1,'List strings that appear in clauses.',22548,22559).
797 predicate(string_predicate,1,'Hook (check) Predicate contains strings',22561,22564).
798 predicate(valid_string_goal,1,'Hook (check) Goal handles strings',22566,22570).
799 predicate(checker,2,'Register code validation routines.',22572,22589).
800 predicate(sat,1,'True iff Expr is a satisfiable Boolean expression.',22704,22706).
801 predicate(taut,2,'Succeeds with T = 0 if the Boolean expression Expr cannot be satisfied, and with T = 1 if Expr is always true with respect to the current constraints.',22708,22712).
802 predicate(labeling,1,'Assigns truth values to the Boolean variables Vs such that all stated constraints are satisfied.',22714,22717).
803 predicate(sat_count,2,'N is the number of different assignments of truth values to the variables in the Boolean expression Expr, such that Expr is true and all posted constraints are satisfiable.',22719,22732).
804 predicate(in,2,'Var is an element of Domain.',23160,23174).
805 predicate(ins,2,'The variables in the list Vars are elements of Domain.',23176,23178).
806 predicate(indomain,1,'Bind Var to all feasible values of its domain on backtracking.',23180,23183).
807 predicate(label,1,'Equivalent to labeling([], Vars).',23185,23187).
808 predicate(labeling,2,'Assign a value to each variable in Vars.',23189,23274).
809 predicate(all_different,1,'Vars are pairwise distinct.',23276,23278).
810 predicate(all_distinct,1,'Like all_different/1, with stronger propagation.',23280,23291).
811 predicate(sum,3,'The sum of elements of the list Vars is in relation Rel to Expr.',23293,23304).
812 predicate(scalar_product,4,'True iff the scalar product of Cs and Vs is in relation Rel to Expr.',23306,23310).
813 predicate(#>=,2,'X is greater than or equal to Y.',23312,23314).
814 predicate(#=<,2,'X is less than or equal to Y.',23316,23318).
815 predicate(#=,2,'X equals Y.',23320,23322).
816 predicate(#\=,2,'X is not Y.',23324,23326).
817 predicate(#>,2,'X is greater than Y.',23328,23330).
818 predicate(#<,2,'X is less than Y.',23332,23347).
819 predicate(#\,1,'The reifiable constraint Q does _not_ hold.',23349,23357).
820 predicate(#<==>,2,'P and Q are equivalent.',23359,23398).
821 predicate(#==>,2,'P implies Q.',23400,23402).
822 predicate(#<==,2,'Q implies P.',23404,23406).
823 predicate(#/\,2,'P and Q hold.',23408,23410).
824 predicate(#\/,2,'P or Q holds.',23412,23424).
825 predicate(#\,2,'Either P holds or Q holds, but not both.',23426,23428).
826 predicate(lex_chain,1,'Lists are lexicographically non-decreasing.',23430,23432).
827 predicate(tuples_in,2,'True iff all Tuples are elements of Relation.',23434,23479).
828 predicate(serialized,2,'Describes a set of non-overlapping tasks.',23481,23500).
829 predicate(element,3,'The N-th element of the list of finite domain variables Vs is V.',23502,23505).
830 predicate(global_cardinality,2,'Global Cardinality constraint.',23507,23517).
831 predicate(global_cardinality,3,'Global Cardinality constraint.',23519,23536).
832 predicate(circuit,1,'True iff the list Vs of finite domain variables induces a Hamiltonian circuit.',23538,23552).
833 predicate(cumulative,1,'Equivalent to cumulative(Tasks, [limit(1)]).',23554,23556).
834 predicate(cumulative,2,'Schedule with a limited resource.',23558,23591).
835 predicate(disjoint2,1,'True iff Rectangles are not overlapping.',23593,23599).
836 predicate(automaton,3,'Describes a list of finite domain variables with a finite automaton.',23601,23627).
837 predicate(automaton,8,'Describes a list of finite domain variables with a finite automaton.',23629,23696).
838 predicate(transpose,2,'Invert the direction of all edges',23698,23756).
839 predicate(zcompare,3,'Analogous to compare/3, with finite domain variables A and B.',23758,23783).
840 predicate(chain,2,'Zs form a chain with respect to Relation.',23785,23796).
841 predicate(fd_var,1,'True iff Var is a CLP(FD) variable.',23798,23800).
842 predicate(fd_inf,2,'Inf is the infimum of the current domain of Var.',23802,23804).
843 predicate(fd_sup,2,'Sup is the supremum of the current domain of Var.',23806,23808).
844 predicate(fd_size,2,'Size is the number of elements of the current domain of Var, or the atom *sup* if the domain is unbounded.',23810,23813).
845 predicate(fd_dom,2,'Dom is the current domain (see in/2) of Var.',23815,23843).
846 predicate({},1,'DCG escape; constraints',23884,23886).
847 predicate(entailed,1,'Check if constraint is entailed',23888,23892).
848 predicate(inf,2,'Find the infimum of an expression',23894,23898).
849 predicate(sup,2,'Find the supremum of an expression',23900,23904).
850 predicate(minimize,1,'Minimizes an expression',23906,23910).
851 predicate(maximize,1,'Maximizes an expression',23912,23916).
852 predicate(bb_inf,5,'Infimum of expression for mixed-integer problems',23918,23927).
853 predicate(bb_inf,4,'Infimum of expression for mixed-integer problems',23929,23932).
854 predicate(bb_inf,3,'Infimum of expression for mixed-integer problems',23934,23937).
855 predicate(dump,3,'Dump constraints on variables',23939,23949).
856 predicate(csv_read_file,2,'Read a CSV file into a list of rows.',24084,24085).
857 predicate(csv_read_file,3,'Read a CSV file into a list of rows.',24087,24103).
858 predicate(csv,3,'Prolog DCG to `read/write\' CSV data.',24105,24106).
859 predicate(csv,4,'Prolog DCG to `read/write\' CSV data.',24108,24141).
860 predicate(csv_read_file_row,3,'True when Row is a row in File.',24143,24163).
861 predicate(csv_write_file,2,'Write a list of Prolog terms to a CSV file.',24165,24166).
862 predicate(csv_write_file,3,'Write a list of Prolog terms to a CSV file.',24168,24173).
863 predicate(csv_write_stream,3,'Write the rows in Data to Stream.',24175,24189).
864 predicate(debugging,1,'Test where we are debugging topic',24211,24212).
865 predicate(debugging,1,'Test where we are debugging topic',24214,24215).
866 predicate(debugging,2,'Examine debug topics.',24217,24231).
867 predicate(debug,1,'Select topic for debugging',24233,24234).
868 predicate(nodebug,1,'Disable debug-topic',24236,24245).
869 predicate(list_debug_topics,0,'List registered topics for debugging',24247,24249).
870 predicate(debug_message_context,1,'Specify additional context for debug messages.',24251,24257).
871 predicate(debug,3,'Print debugging message on topic',24259,24272).
872 predicate(debug_print_hook,3,'Hook called by debug/3.',24274,24280).
873 predicate(assertion,1,'Make assertions about your program',24282,24295).
874 predicate(assertion_failed,2,'This hook is called if the Goal of assertion/1 fails.',24297,24303).
875 predicate(gensym,2,'Generate unique atoms from a base',24318,24323).
876 predicate(reset_gensym,1,'Reset a gensym key',24325,24329).
877 predicate(reset_gensym,0,'Reset all gensym keys',24331,24336).
878 predicate(open_any,5,'',24366,24413).
879 predicate(close_any,1,'',24415,24419).
880 predicate(open_hook,6,'',24421,24431).
881 predicate(member,2,'True if Elem is a member of List.',24451,24461).
882 predicate(append,3,'List1AndList2 is the concatenation of List1 and List2.',24463,24465).
883 predicate(append,2,'Concatenate a list of lists.',24467,24473).
884 predicate(prefix,2,'True iff Part is a leading substring of Whole.',24475,24478).
885 predicate(select,3,'Is true when List1, with Elem removed, results in List2.',24480,24482).
886 predicate(selectchk,3,'Semi-deterministic removal of first element in List that unifies with Elem.',24484,24487).
887 predicate(select,4,'Select from two lists at the same positon.',24489,24505).
888 predicate(selectchk,4,'Semi-deterministic version of select/4.',24507,24509).
889 predicate(nextto,3,'True if Y follows X in List.',24511,24513).
890 predicate(delete,3,'Delete matching elements from a list.',24515,24527).
891 predicate(nth0,3,'True when Elem is the Index\'th element of List.',24529,24537).
892 predicate(nth1,3,'Is true when Elem is the Index\'th element of List.',24539,24544).
893 predicate(nth0,4,'Select/insert element at index.',24546,24563).
894 predicate(nth1,4,'As nth0/4, but counting starts at 1.',24565,24567).
895 predicate(last,2,'Last element of a list',24569,24577).
896 predicate(proper_length,2,'True when Length is the number of elements in the proper list List.',24579,24588).
897 predicate(same_length,2,'Is true when List1 and List2 are lists with the same number of elements.',24590,24597).
898 predicate(reverse,2,'Is true when the elements of List2 are in reverse order compared to List1.',24599,24602).
899 predicate(permutation,2,'True when Xs is a permutation of Ys.',24604,24635).
900 predicate(flatten,2,'Is true if FlatList is a non-nested version of NestedList.',24637,24649).
901 predicate(max_member,2,'True when Max is the largest member in the standard order of terms.',24651,24658).
902 predicate(min_member,2,'True when Min is the smallest member in the standard order of terms.',24660,24667).
903 predicate(sum_list,2,'Sum is the result of adding all numbers in List.',24669,24671).
904 predicate(max_list,2,'True if Max is the largest number in List.',24673,24677).
905 predicate(min_list,2,'True if Min is the smallest number in List.',24679,24684).
906 predicate(numlist,3,'List is a list [Low, Low+1, ... High].',24686,24692).
907 predicate(is_set,1,'True if Set is a proper list without duplicates.',24694,24699).
908 predicate(list_to_set,2,'Remove duplicates from a list',24701,24719).
909 predicate(intersection,3,'True if Set3 unifies with the intersection of Set1 and Set2.',24721,24726).
910 predicate(union,3,'True if Set3 unifies with the union of Set1 and Set2.',24728,24733).
911 predicate(subset,2,'True if all elements of SubSet belong to Set as well.',24735,24740).
912 predicate(subtract,3,'Delete all elements in Delete from Set.',24742,24747).
913 predicate(empty_nb_set,1,'Test/create an empty non-backtrackable set',24776,24778).
914 predicate(add_nb_set,2,'Add term to a non-backtrackable set',24780,24783).
915 predicate(add_nb_set,3,'Add term to a non-backtrackable set',24785,24793).
916 predicate(gen_nb_set,2,'Generate members of non-backtrackable set',24795,24798).
917 predicate(size_nb_set,2,'Determine size of non-backtrackable set',24800,24802).
918 predicate(nb_set_to_list,2,'Convert non-backtrackable set to list',24804,24807).
919 predicate(www_open_url,1,'Open a web-page in a browser',24815,24835).
920 predicate(option,3,'Get an Option Qfrom OptionList.',24890,24896).
921 predicate(option,2,'Get an Option from OptionList.',24898,24905).
922 predicate(select_option,3,'Get and remove Option from an option list.',24907,24911).
923 predicate(select_option,4,'Get and remove Option with default value.',24913,24917).
924 predicate(merge_options,3,'Merge two option lists.',24919,24926).
925 predicate(meta_options,3,'Perform meta-expansion on options that are module-sensitive.',24928,24945).
926 predicate(dict_options,2,'Convert between an option list and a dictionary.',24947,24967).
927 predicate(opt_arguments,3,'Extract commandline options according to a specification.',25274,25290).
928 predicate(opt_parse,4,'Equivalent to opt_parse(OptsSpec, ApplArgs, Opts, PositionalArgs, []).',25292,25294).
929 predicate(opt_parse,5,'Parse the arguments Args (as list of atoms) according to OptsSpec.',25296,25331).
930 predicate(opt_help,2,'True when Help is a help string synthesized from OptsSpec.',25333,25335).
931 predicate(parse_type,3,'Hook to parse option text Codes to an object of type Type.',25337,25339).
932 predicate(is_ordset,1,'True if Term is an ordered set.',25370,25375).
933 predicate(ord_empty,1,'True when List is the empty ordered set.',25377,25380).
934 predicate(ord_seteq,2,'True if Set1 and Set2 have the same elements.',25382,25387).
935 predicate(list_to_ord_set,2,'Transform a list into an ordered set.',25389,25392).
936 predicate(ord_intersect,2,'True if both ordered sets have a non-empty intersection.',25394,25396).
937 predicate(ord_disjoint,2,'True if Set1 and Set2 have no common elements.',25398,25401).
938 predicate(ord_intersect,3,'Intersection holds the common elements of Set1 and Set2.',25403,25407).
939 predicate(ord_intersection,2,'Intersection of a powerset.',25409,25414).
940 predicate(ord_intersection,3,'Intersection holds the common elements of Set1 and Set2.',25416,25418).
941 predicate(ord_intersection,4,'Intersection and difference between two ordered sets.',25420,25426).
942 predicate(ord_add_element,3,'Insert an element into the set.',25428,25431).
943 predicate(ord_del_element,3,'Delete an element from an ordered set.',25433,25436).
944 predicate(ord_selectchk,3,'Selectchk/3, specialised for ordered sets.',25438,25448).
945 predicate(ord_memberchk,2,'True if Element is a member of OrdSet, compared using ==.',25450,25461).
946 predicate(ord_subset,2,'Is true if all elements of Sub are in Super.',25463,25465).
947 predicate(ord_subtract,3,'Diff is the set holding all elements of InOSet that are not in NotInOSet.',25467,25470).
948 predicate(ord_union,2,'True if Union is the union of all elements in the superset SetOfSets.',25472,25479).
949 predicate(ord_union,3,'Union is the union of Set1 and Set2.',25481,25483).
950 predicate(ord_union,4,'True iff ord_union(Set1, Set2, Union) and ord_subtract(Set2, Set1, New).',25485,25488).
951 predicate(ord_symdiff,3,'Is true when Difference is the symmetric difference of Set1 and Set2.',25490,25508).
952 predicate(pairs_keys_values,3,'True if Keys holds the keys of Pairs and Values the values.',25525,25533).
953 predicate(pairs_values,2,'Remove the keys from a list of Key-Value pairs.',25535,25538).
954 predicate(pairs_keys,2,'Remove the values from a list of Key-Value pairs.',25540,25543).
955 predicate(group_pairs_by_key,2,'Group values with the same key.',25545,25561).
956 predicate(transpose_pairs,2,'Swap Key-Value to Value-Key.',25563,25566).
957 predicate(map_list_to_pairs,3,'Create a Key-Value list by mapping each element of List.',25568,25575).
958 predicate(persistent,1,'Declare dynamic database terms.',25645,25663).
959 predicate(current_persistent_predicate,1,'True if PI is a predicate that provides access to the persistent database DB.',25665,25668).
960 predicate(db_attach,2,'Use File as persistent database for the calling module.',25670,25679).
961 predicate(db_sync,1,'Synchronise database with the associated file.',25681,25707).
962 predicate(db_sync_all,1,'Sync all registered databases.',25709,25711).
963 predicate(phrase_from_file,2,'Process the content of File using the DCG rule Grammar.',25743,25767).
964 predicate(phrase_from_file,3,'As phrase_from_file/2, providing additional Options.',25769,25775).
965 predicate(phrase_from_stream,2,'Helper for phrase_from_file/3.',25777,25780).
966 predicate(syntax_error,3,'Throw the syntax error Error at the current location of the input.',25782,25788).
967 predicate(lazy_list_location,3,'Determine current (error) location in a lazy list.',25790,25805).
968 predicate(lazy_list_character_count,3,'True when CharCount is the current character count in the Lazy list.',25807,25818).
969 predicate(stream_to_lazy_list,2,'Create a lazy list representing the character codes in Stream.',25820,25832).
970 predicate(predicate_options,3,'Declare that the predicate PI processes options on Arg.',25974,26008).
971 predicate(assert_predicate_options,4,'As predicate_options(:PI, +Arg, +Options).',26010,26018).
972 predicate(current_predicate_option,3,'True when Arg of PI processes Option.',26020,26031).
973 predicate(check_predicate_option,3,'Verify predicate options at runtime.',26033,26048).
974 predicate(current_option_arg,2,'True when Arg of PI processes predicate options.',26050,26053).
975 predicate(current_predicate_options,3,'True when Options is the current active option declaration for PI on Arg.',26055,26063).
976 predicate(check_predicate_options,0,'Analyse loaded program for erroneous options.',26065,26081).
977 predicate(derive_predicate_options,0,'Derive new predicate option declarations.',26083,26092).
978 predicate(retractall_predicate_options,0,'Remove all dynamically (derived) predicate options.',26094,26096).
979 predicate(derived_predicate_options,3,'Derive option arguments using static analysis.',26098,26101).
980 predicate(derived_predicate_options,1,'Derive predicate option declarations for a module.',26103,26106).
981 predicate(pack_list_installed,0,'List currently installed packages.',26126,26132).
982 predicate(pack_info,1,'Print more detailed information about Pack.',26134,26136).
983 predicate(pack_search,1,'Query package server and installed packages and display results.',26138,26139).
984 predicate(pack_list,1,'Query package server and installed packages and display results.',26141,26173).
985 predicate(pack_install,1,'Install a package.',26175,26193).
986 predicate(pack_install,2,'Install package Name.',26195,26226).
987 predicate(pack_url_file,2,'True if File is a unique id for the referenced pack and version.',26228,26232).
988 predicate(pack_rebuild,1,'Rebuilt possible foreign components of Pack.',26234,26236).
989 predicate(pack_rebuild,0,'Rebuild foreign components of all packages.',26238,26240).
990 predicate(environment,2,'Hook to define the environment for building packs.',26242,26258).
991 predicate(pack_upgrade,1,'Try to upgrade the package Pack.',26260,26265).
992 predicate(pack_remove,1,'Remove the indicated package.',26267,26269).
993 predicate(pack_property,2,'True when Property is a property of Pack.',26271,26296).
994 predicate(xref_source,1,'Cross-reference analysis of source',26331,26336).
995 predicate(xref_current_source,1,'Examine cross-referenced sources',26338,26340).
996 predicate(xref_clean,1,'Remove analysis of source',26342,26344).
997 predicate(xref_defined,3,'Examine defined predicates',26346,26357).
998 predicate(xref_called,3,'Examine called predicates',26359,26361).
999 predicate(xref_exported,2,'Examine exported predicates',26363,26365).
1000 predicate(xref_module,2,'Module defined by source',26367,26369).
1001 predicate(xref_built_in,1,'Examine defined built-ins',26371,26376).
1002 predicate(called_by,2,'Hook (prolog) Extend cross-referencer',26384,26397).
1003 predicate(with_quasi_quotation_input,3,'Parse quasi quotation from stream',26477,26497).
1004 predicate(phrase_from_quasi_quotation,2,'Parse quasi quotation with DCG',26499,26505).
1005 predicate(quasi_quotation_syntax,1,'Declare quasi quotation syntax',26507,26510).
1006 predicate(quasi_quotation_syntax_error,1,'Raise syntax error',26512,26517).
1007 predicate(random,1,'Binds R to a new random float in the _open_ interval (0.0,1.0).',26531,26539).
1008 predicate(random_between,3,'Binds R to a random integer in [L,U] (i.e., including both L and U).',26541,26544).
1009 predicate(random,3,'Generate a random integer or float in a range.',26546,26547).
1010 predicate(random,3,'Generate a random integer or float in a range.',26549,26559).
1011 predicate(setrand,1,'Query/set the state of the random generator.',26561,26562).
1012 predicate(getrand,1,'Query/set the state of the random generator.',26564,26583).
1013 predicate(maybe,0,'Succeed/fail with equal probability (variant of maybe/1).',26585,26587).
1014 predicate(maybe,1,'Succeed with probability P, fail with probability 1-P.',26589,26591).
1015 predicate(maybe,2,'Succeed with probability K/N (variant of maybe/1).',26593,26595).
1016 predicate(random_perm2,4,'Does X=A,Y=B or X=B,Y=A with equal probability.',26597,26599).
1017 predicate(random_member,2,'X is a random member of List.',26601,26606).
1018 predicate(random_select,3,'Randomly select or insert an element.',26608,26609).
1019 predicate(random_select,3,'Randomly select or insert an element.',26611,26616).
1020 predicate(randset,3,'S is a sorted list of K unique random integers in the range 1..N.',26618,26633).
1021 predicate(randseq,3,'S is a list of K unique random integers in the range 1..N.',26635,26646).
1022 predicate(random_permutation,2,'Permutation is a random permutation of List.',26648,26649).
1023 predicate(random_permutation,2,'Permutation is a random permutation of List.',26651,26657).
1024 predicate(read_line_to_codes,2,'Read line from a stream',26670,26678).
1025 predicate(read_line_to_codes,3,'Read line from a stream',26680,26701).
1026 predicate(read_stream_to_codes,2,'Read contents of stream',26703,26705).
1027 predicate(read_stream_to_codes,3,'Read contents of stream',26707,26709).
1028 predicate(read_file_to_codes,3,'Read contents of file',26711,26717).
1029 predicate(read_file_to_terms,3,'Read contents of file to Prolog terms',26719,26725).
1030 predicate(record,1,'Define named fields in a term',26819,26824).
1031 predicate(registry_get_key,2,'Get principal value of key',26843,26846).
1032 predicate(registry_get_key,3,'Get associated value of key',26848,26850).
1033 predicate(registry_set_key,2,'Set principal value of key',26852,26855).
1034 predicate(registry_set_key,3,'Set associated value of key',26857,26860).
1035 predicate(registry_delete_key,1,'Remove a key',26862,26864).
1036 predicate(shell_register_file_type,4,'Register a file-type',26866,26872).
1037 predicate(shell_register_dde,6,'Register DDE action',26874,26881).
1038 predicate(shell_register_prolog,1,'Register Prolog',26883,26902).
1039 predicate(assignment,2,'Solve assignment problem',26927,26933).
1040 predicate(constraint,3,'Add linear constraint to state',26935,26945).
1041 predicate(constraint,4,'Add named linear constraint to state',26947,26950).
1042 predicate(constraint_add,4,'Extend a named constraint',26952,26956).
1043 predicate(gen_state,1,'Create empty linear program',26958,26961).
1044 predicate(maximize,3,'Maximize objective function in to linear constraints',26963,26968).
1045 predicate(minimize,3,'Minimize objective function in to linear constraints',26970,26972).
1046 predicate(objective,2,'Fetch value of objective function',26974,26977).
1047 predicate(shadow_price,3,'Fetch shadow price in solved state',26979,26983).
1048 predicate(transportation,4,'Solve transportation problem',26985,26994).
1049 predicate(variable_value,3,'Fetch value of variable in solved state',26996,27005).
1050 predicate(distinct,1,'True if Goal is true and no previous solution of Goal bound Witness to the same value.',27190,27191).
1051 predicate(distinct,2,'True if Goal is true and no previous solution of Goal bound Witness to the same value.',27193,27206).
1052 predicate(limit,2,'Limit the number of solutions.',27208,27212).
1053 predicate(offset,2,'Ignore the first Count solutions.',27214,27218).
1054 predicate(group_by,4,'Group bindings of Template that have the same value for By.',27233,27239).
1055 predicate(thread_pool_create,3,'Create a pool of threads.',27277,27294).
1056 predicate(thread_pool_destroy,1,'Destroy the thread pool named Name.',27296,27300).
1057 predicate(current_thread_pool,1,'True if Name refers to a defined thread pool.',27302,27304).
1058 predicate(thread_pool_property,2,'True if Property is a property of thread pool Name.',27306,27327).
1059 predicate(thread_create_in_pool,4,'Create a thread in Pool.',27329,27343).
1060 predicate(create_pool,1,'Hook to create a thread pool lazily.',27345,27359).
1061 predicate(vertices_edges_to_ugraph,3,'Create unweighted graph',27390,27408).
1062 predicate(vertices,2,'Find vertices in graph',27410,27416).
1063 predicate(edges,2,'Find edges in graph',27418,27425).
1064 predicate(add_vertices,3,'Add vertices to graph',27427,27435).
1065 predicate(del_vertices,3,'Delete vertices from graph',27437,27449).
1066 predicate(add_edges,3,'Add edges to graph',27451,27463).
1067 predicate(del_edges,3,'Delete edges from graph',27465,27475).
1068 predicate(transpose,2,'Invert the direction of all edges',27477,27488).
1069 predicate(neighbours,3,'Find neighbors of vertice',27490,27499).
1070 predicate(neighbors,3,'Find neighbors of vertice',27501,27503).
1071 predicate(complement,2,'Inverse presense of edges',27505,27515).
1072 predicate(compose,3,'',27517,27525).
1073 predicate(ugraph_union,3,'Union of two graphs',27527,27534).
1074 predicate(top_sort,2,'Sort graph topologically',27536,27546).
1075 predicate(top_sort,3,'Sort graph topologically',27548,27551).
1076 predicate(transitive_closure,2,'Create transitive closure of graph',27553,27561).
1077 predicate(reachable,3,'Find all reachable vertices',27563,27571).
1078 predicate(global_url,3,'Translate a possibly relative URL into an absolute one.',27594,27598).
1079 predicate(is_absolute_url,1,'True if URL is an absolute URL.',27600,27603).
1080 predicate(http_location,2,'Construct or analyze an HTTP location.',27605,27616).
1081 predicate(parse_url,2,'Construct or analyse a URL.',27618,27675).
1082 predicate(parse_url,3,'Similar to parse_url/2 for relative URLs.',27677,27680).
1083 predicate(www_form_encode,2,'En/decode to/from application/x-www-form-encoded.',27682,27683).
1084 predicate(www_form_encode,2,'En/decode to/from application/x-www-form-encoded.',27685,27696).
1085 predicate(set_url_encoding,2,'Query and set the encoding for URLs.',27698,27705).
1086 predicate(url_iri,2,'Convert between a URL, encoding in US-ASCII and an IRI.',27707,27708).
1087 predicate(url_iri,2,'Convert between a URL, encoding in US-ASCII and an IRI.',27710,27714).
1088 predicate(parse_url_search,2,'Construct or analyze an HTTP search specification.',27716,27720).
1089 predicate(file_name_to_url,2,'Translate between a filename and a file:Sidiv{} URL.',27722,27723).
1090 predicate(file_name_to_url,2,'Translate between a filename and a file:Sidiv{} URL.',27725,27730).
1091 predicate(numbervars,1,'Number variables in Term using $VAR(N).',27756,27761).
1092 predicate(varnumbers,2,'Inverse of numbervars/1.',27763,27765).
1093 predicate(varnumbers,3,'Inverse of numbervars/3.',27767,27778).
1094 predicate(max_var_number,3,'True when Max is the max of Start and the highest numbered $VAR(N) term.',27780,27787).
1095 predicate(prolog_current_frame,1,'Reference to goal\'s environment stack',27802,27808).
1096 predicate(prolog_current_choice,1,'Reference to most recent choice point',27810,27814).
1097 predicate(prolog_frame_attribute,3,'Obtain information on a goal environment',27816,27899).
1098 predicate(prolog_choice_attribute,3,'Examine the choice point stack',27901,27923).
1099 predicate(deterministic,1,'Test deterministicy of current clause',27925,27932).
1100 predicate(prolog_cut_to,1,'Realise global cuts',27937,27943).
1101 predicate(prolog_trace_interception,4,'library(user) Intercept the Prolog tracer',27948,28061).
1102 predicate(prolog_skip_frame,1,'Perform `skip\' on a frame',28063,28070).
1103 predicate(prolog_skip_level,2,'Indicate deepest recursion to trace',28072,28079).
1104 predicate(break_hook,6,'Hook (prolog) Debugger hook',28091,28168).
1105 predicate(prolog_exception_hook,4,'Rewrite exceptions',28178,28221).
1106 predicate(exception,3,'Hook (user) Handle runtime exceptions',28236,28262).
1107 predicate(prolog_list_goal,1,'Hook (user) Intercept tracer \'L\' command',28274,28280).
1108 predicate(debug_control_hook,1,'Hook (prolog) Extend spy/1, etc.',28282,28308).
1109 predicate(help_hook,1,'Hook (prolog) User-hook in the help-system',28310,28325).
1110 predicate(prolog_load_file,2,'Hook (user) Program load_files/2',28334,28345).
1111 predicate(comment_hook,3,'Hook (prolog) handle comments in sources',28347,28366).
1112 predicate(rl_read_init_file,1,'Read readline(3) init file',28376,28380).
1113 predicate(rl_add_history,1,'Add line to readline(3) history',28382,28385).
1114 predicate(rl_write_history,1,'Write readline(3) history',28387,28390).
1115 predicate(rl_read_history,1,'Read readline(3) history',28392,28394).
1116 predicate(expects_dialect,1,'For which Prolog dialect is this code written?',28437,28463).
1117 predicate(exists_source,1,'Check existence of a Prolog source',28465,28469).
1118 predicate(source_exports,2,'Check whether source exports a predicate',28471,28474).
1119 predicate(eval_license,0,'Evaluate licenses of loaded modules',29023,29029).
1120 predicate(license,2,'Define license for named module',29031,29083).
1121 predicate(license,1,'Define license for current file',29085,29088).
11181122
11191123
11201124 % Predicate section/4
11211125
1122 section([1],'INTRODUCTION',50,315).
1123 section([1,1],'Positioning SWI-Prolog',63,104).
1124 section([1,2],'Status and releases',106,132).
1125 section([1,3],'Should I be using SWI-Prolog?',134,217).
1126 section([1,4],'Support the SWI-Prolog project',219,229).
1127 section([1,5],'Implementation history',231,265).
1128 section([1,6],'Acknowledgements',267,315).
1129 section([2],'OVERVIEW',317,2984).
1130 section([2,1],'Getting started quickly',320,405).
1131 section([2,1,1],'Starting SWI-Prolog',323,378).
1132 section([2,1,1,1],'Starting SWI-Prolog on Unix',326,356).
1133 section([2,1,1,2],'Starting SWI-Prolog on Windows',358,378).
1134 section([2,1,2],'Executing a query',380,405).
1135 section([2,2],'The user\'s initialisation file',407,439).
1136 section([2,3],'Initialisation files and goals',441,474).
1137 section([2,4],'Command line options',476,715).
1138 section([2,4,1],'Informational command line options',511,539).
1139 section([2,4,2],'Command line options for running Prolog',541,634).
1140 section([2,4,3],'Controlling the stack sizes',636,665).
1141 section([2,4,4],'Running goals from the command line',667,689).
1142 section([2,4,5],'Compilation options',691,699).
1143 section([2,4,6],'Maintenance options',701,715).
1144 section([2,5],'GNU Emacs Interface',717,729).
1145 section([2,6],'Online Help',731,797).
1146 section([2,7],'Command line history',799,824).
1147 section([2,8],'Reuse of top-level bindings',826,865).
1148 section([2,9],'Overview of the Debugger',867,1036).
1149 section([2,10],'Compilation',1038,1217).
1150 section([2,10,1],'During program development',1041,1068).
1151 section([2,10,2],'For running the result',1070,1217).
1152 section([2,10,2,1],'Using PrologScript',1078,1133).
1153 section([2,10,2,2],'Creating a shell script',1135,1168).
1154 section([2,10,2,3],'Creating a saved state',1170,1181).
1155 section([2,10,2,4],'Compilation using the -c command line option',1183,1217).
1156 section([2,11],'Environment Control (Prolog flags)',1219,2000).
1157 section([2,12],'An overview of hook predicates',2002,2073).
1158 section([2,13],'Automatic loading of libraries',2075,2187).
1159 section([2,14],'Garbage Collection',2189,2194).
1160 section([2,15],'The SWI-Prolog syntax',2196,2495).
1161 section([2,15,1],'ISO Syntax Support',2207,2217).
1162 section([2,15,1,1],'Processor Character Set',2212,2217).
1163 section([2,15,2],'Nested comments',2219,2495).
1164 section([2,15,2,1],'Character Escape Syntax',2240,2350).
1165 section([2,15,2,2],'Syntax for non-decimal numbers',2352,2360).
1166 section([2,15,2,3],'Using digit groups in large integers',2362,2385).
1167 section([2,15,2,4],'Unicode Prolog source',2387,2432).
1168 section([2,15,2,5],'Singleton variable checking',2434,2495).
1169 section([2,16],'Rational trees (cyclic terms)',2497,2527).
1170 section([2,17],'Just-in-time clause indexing',2529,2622).
1171 section([2,17,1],'Future directions',2596,2607).
1172 section([2,17,2],'Indexing and portability',2609,2622).
1173 section([2,18],'Wide character support',2624,2746).
1174 section([2,18,1],'Wide character encodings on streams',2651,2746).
1175 section([2,18,1,1],'BOM: Byte Order Mark',2722,2746).
1176 section([2,19],'System limits',2748,2895).
1177 section([2,19,1],'Limits on memory areas',2751,2838).
1178 section([2,19,1,1],'The heap',2832,2838).
1179 section([2,19,2],'Other Limits',2840,2885).
1180 section([2,19,3],'Reserved Names',2887,2895).
1181 section([2,20],'SWI-Prolog and 64-bit machines',2897,2984).
1182 section([2,20,1],'Supported platforms',2904,2909).
1183 section([2,20,2],'Comparing 32- and 64-bits Prolog',2911,2943).
1184 section([2,20,3],'Choosing between 32- and 64-bit Prolog',2945,2984).
1185 section([3],'INITIALISING AND MANAGING A PROLOG PROJECT',2986,3760).
1186 section([3,1],'The project source files',3001,3167).
1187 section([3,1,1],'File Names and Locations',3011,3090).
1188 section([3,1,1,1],'File Name Extensions',3014,3035).
1189 section([3,1,1,2],'Project Directories',3037,3056).
1190 section([3,1,1,3],'Sub-projects using search paths',3058,3090).
1191 section([3,1,2],'Project Special Files',3092,3123).
1192 section([3,1,3],'International source files',3125,3167).
1193 section([3,2],'Using modules',3169,3212).
1194 section([3,3],'The test-edit-reload cycle',3214,3280).
1195 section([3,3,1],'Locating things to edit',3230,3248).
1196 section([3,3,2],'Editing and incremental compilation',3250,3280).
1197 section([3,4],'Using the PceEmacs built-in editor',3282,3537).
1198 section([3,4,1],'Activating PceEmacs',3285,3291).
1199 section([3,4,2],'Bluffing through PceEmacs',3293,3412).
1200 section([3,4,2,1],'Edit modes',3306,3329).
1201 section([3,4,2,2],'Frequently used editor commands',3331,3412).
1202 section([3,4,3],'Prolog Mode',3414,3537).
1203 section([3,4,3,1],'Finding your way around',3526,3537).
1204 section([3,5],'The Graphical Debugger',3539,3592).
1205 section([3,5,1],'Invoking the window-based debugger',3555,3592).
1206 section([3,6],'The Prolog Navigator',3594,3600).
1207 section([3,7],'Cross-referencer',3602,3683).
1208 section([3,8],'Accessing the IDE from your program',3685,3722).
1209 section([3,9],'Summary of the IDE',3724,3760).
1210 section([4],'BUILT-IN PREDICATES',3762,12685).
1211 section([4,1],'Notation of Predicate Descriptions',3765,3808).
1212 section([4,2],'Character representation',3810,3865).
1213 section([4,3],'Loading Prolog source files',3867,4920).
1214 section([4,3,1],'Conditional compilation and program transformation',4544,4755).
1215 section([4,3,1,1],'Program transformation with source layout info',4660,4691).
1216 section([4,3,1,2],'Conditional compilation',4693,4755).
1217 section([4,3,2],'Loading files, active code and threads',4757,4873).
1218 section([4,3,2,1],'Compilation of mutually dependent code',4791,4811).
1219 section([4,3,2,2],'Compilation with multiple threads',4813,4844).
1220 section([4,3,2,3],'Reloading running code',4846,4873).
1221 section([4,3,3],'Quick load files',4875,4920).
1222 section([4,4],'Editor Interface',4922,5048).
1223 section([4,4,1],'Customizing the editor interface',4962,5048).
1224 section([4,5],'List the program, predicates or clauses',5050,5081).
1225 section([4,6],'Verify Type of a Term',5083,5194).
1226 section([4,7],'Comparison and Unification of Terms',5196,5393).
1227 section([4,7,1],'Standard Order of Terms',5215,5269).
1228 section([4,7,2],'Special unification and comparison predicates',5271,5393).
1229 section([4,8],'Control Predicates',5395,5507).
1230 section([4,9],'Meta-Call Predicates',5509,5742).
1231 section([4,10],'ISO compliant Exception handling',5744,6134).
1232 section([4,10,1],'Debugging and exceptions',5801,5840).
1233 section([4,10,2],'The exception term',5842,5854).
1234 section([4,10,3],'Printing messages',5856,6134).
1235 section([4,10,3,1],'Printing from libraries',6069,6134).
1236 section([4,11],'Handling signals',6136,6229).
1237 section([4,11,1],'Notes on signal handling',6196,6229).
1238 section([4,12],'DCG Grammar rules',6231,6365).
1239 section([4,13],'Database',6367,6647).
1240 section([4,13,1],'Update view',6566,6585).
1241 section([4,13,2],'Indexing databases',6587,6647).
1242 section([4,14],'Declaring predicate properties',6649,6708).
1243 section([4,15],'Examining the program',6710,7035).
1244 section([4,16],'Input and output',7037,7800).
1245 section([4,16,1],'Predefined stream aliases',7051,7087).
1246 section([4,16,2],'ISO Input and Output Streams',7089,7598).
1247 section([4,16,3],'Edinburgh-style I/O',7600,7719).
1248 section([],'Compatibility notes',7648,31769).
1249 section([4,16,4],'Switching between Edinburgh and ISO I/O',7721,7745).
1250 section([4,16,5],'Write onto atoms, code-lists, etc.',7747,7800).
1251 section([4,17],'Status of streams',7802,7873).
1252 section([4,18],'Primitive character I/O',7875,8123).
1253 section([4,19],'Term reading and writing',8125,8644).
1254 section([4,20],'Analysing and Constructing Terms',8646,8874).
1255 section([4,20,1],'Non-logical operations on terms',8796,8874).
1256 section([4,21],'Analysing and Constructing Atoms',8876,9065).
1257 section([4,22],'Localization (locale) support',9067,9152).
1258 section([4,23],'Character properties',9154,9341).
1259 section([4,23,1],'Case conversion',9286,9303).
1260 section([4,23,2],'White space normalization',9305,9313).
1261 section([4,23,3],'Language-specific comparison',9315,9341).
1262 section([4,24],'Operators',9343,9453).
1263 section([4,25],'Character Conversion',9455,9472).
1264 section([4,26],'Arithmetic',9474,10118).
1265 section([4,26,1],'Special purpose integer arithmetic',9484,9512).
1266 section([4,26,2],'General purpose arithmetic',9514,10118).
1267 section([4,26,2,1],'Arithmetic types',9560,9612).
1268 section([4,26,2,2],'Rational number examples',9614,9645).
1269 section([4,26,2,3],'Arithmetic Functions',9647,10118).
1270 section([4,27],'Misc arithmetic support predicates',10120,10168).
1271 section([4,28],'Built-in list operations',10170,10318).
1272 section([4,29],'Finding all Solutions to a Goal',10320,10417).
1273 section([4,30],'Forall',10419,10463).
1274 section([4,31],'Formatted Write',10465,10790).
1275 section([4,31,1],'Writef',10475,10555).
1276 section([4,31,2],'Format',10557,10751).
1277 section([4,31,3],'Programming Format',10753,10790).
1278 section([4,32],'Terminal Control',10792,10838).
1279 section([4,33],'Operating System Interaction',10840,11501).
1280 section([4,33,1],'Windows-specific Operating System Interaction',10964,11074).
1281 section([4,33,2],'Dealing with time and date',11076,11439).
1282 section([4,33,2,1],'Time and date data structures',11115,11143).
1283 section([4,33,2,2],'Time and date predicates',11145,11439).
1284 section([4,33,3],'Controlling the swipl-win.exe console window',11441,11501).
1285 section([4,34],'File System Interaction',11503,11779).
1286 section([4,35],'User Top-level Manipulation',11781,11875).
1287 section([4,36],'Creating a Protocol of the User Interaction',11877,11902).
1288 section([4,37],'Debugging and Tracing Programs',11904,12117).
1289 section([4,38],'Obtaining Runtime Statistics',12119,12224).
1290 section([4,39],'Execution profiling',12226,12401).
1291 section([4,39,1],'Profiling predicates',12237,12303).
1292 section([4,39,2],'Visualizing profiling data',12305,12352).
1293 section([4,39,3],'Information gathering',12354,12401).
1294 section([4,39,3,1],'Profiling in the Windows Implementation',12386,12401).
1295 section([4,40],'Memory Management',12403,12489).
1296 section([4,41],'Windows DDE interface',12491,12625).
1297 section([4,41,1],'DDE client interface',12507,12564).
1298 section([4,41,2],'DDE server mode',12566,12625).
1299 section([4,42],'Miscellaneous',12627,12685).
1300 section([5],'SWI-PROLOG EXTENSIONS',12687,14021).
1301 section([5,1],'Lists are special',12707,12771).
1302 section([5,1,1],'Motivating \'[|]\' and [] for lists',12741,12771).
1303 section([5,2],'The string type and its double quoted syntax',12773,13255).
1304 section([5,2,1],'Predicates that operate on strings',12811,13043).
1305 section([5,2,2],'Representing text: strings, atoms and code lists',13045,13078).
1306 section([5,2,3],'Adapting code for double quoted strings',13080,13148).
1307 section([5,2,4],'Why has the representation of double quoted text changed?',13150,13255).
1308 section([5,3],'Syntax changes',13257,13364).
1309 section([5,3,1],'Operators and quoted atoms',13260,13274).
1310 section([5,3,2],'Compound terms with zero arguments',13276,13332).
1311 section([5,3,3],'Block operators',13334,13364).
1312 section([5,4],'Dicts: structures with named arguments',13366,13895).
1313 section([5,4,1],'Functions on dicts',13417,13563).
1314 section([5,4,1,1],'User defined functions on dicts',13474,13512).
1315 section([5,4,1,2],'Predefined functions on dicts',13514,13563).
1316 section([5,4,2],'Predicates for managing dicts',13565,13745).
1317 section([5,4,2,1],'Destructive assignment in dicts',13700,13745).
1318 section([5,4,3],'When to use dicts?',13747,13842).
1319 section([5,4,4],'A motivation for dicts as primary citizens',13844,13874).
1320 section([5,4,5],'Implementation notes about dicts',13876,13895).
1321 section([5,5],'Integration of strings and dicts in the libraries',13897,13977).
1322 section([5,5,1],'Dicts and option processing',13912,13916).
1323 section([5,5,2],'Dicts in core data structures',13918,13928).
1324 section([5,5,3],'Dicts, strings and XML',13930,13944).
1325 section([5,5,4],'Dicts, strings and JSON',13946,13961).
1326 section([5,5,5],'Dicts, strings and HTTP',13963,13977).
1327 section([5,6],'Remaining issues',13979,14021).
1328 section([6],'MODULES',14023,14864).
1329 section([6,1],'Why Use Modules?',14050,14070).
1330 section([6,2],'Defining a Module',14072,14126).
1331 section([6,3],'Importing Predicates into a Module',14128,14214).
1332 section([6,4],'Defining a meta-predicate',14216,14344).
1333 section([6,5],'Overruling Module Boundaries',14346,14403).
1334 section([6,5,1],'Explicit manipulation of the calling context',14378,14403).
1335 section([6,6],'Interacting with modules from the top level',14405,14433).
1336 section([6,7],'Composing modules from other modules',14435,14466).
1337 section([6,8],'Operators and modules',14468,14498).
1338 section([6,9],'Dynamic importing using import modules',14500,14548).
1339 section([6,10],'Reserved Modules and using the `user\' module',14550,14565).
1340 section([6,11],'An alternative import/export interface',14567,14592).
1341 section([6,12],'Dynamic Modules',14594,14627).
1342 section([6,13],'Transparent predicates: definition and context module',14629,14720).
1343 section([6,14],'Module properties',14722,14807).
1344 section([6,15],'Compatibility of the Module System',14809,14864).
1345 section([7],'SPECIAL VARIABLES AND COROUTINING',14866,15329).
1346 section([7,1],'Attributed variables',14913,15131).
1347 section([7,1,1],'Attribute manipulation predicates',14997,15029).
1348 section([7,1,2],'Attributed variable hooks',15031,15076).
1349 section([7,1,3],'Operations on terms with attributed variables',15078,15107).
1350 section([7,1,4],'Special purpose predicates for attributes',15109,15131).
1351 section([7,2],'Coroutining',15133,15208).
1352 section([7,3],'Global variables',15210,15329).
1353 section([7,3,1],'Compatibility of SWI-Prolog Global Variables',15316,15329).
1354 section([8],'CHR: CONSTRAINT HANDLING RULES',15331,16208).
1355 section([8,1],'Introduction',15353,15381).
1356 section([8,2],'Syntax and Semantics',15383,15560).
1357 section([8,2,1],'Syntax of CHR rules',15386,15438).
1358 section([8,2,2],'Semantics',15440,15560).
1359 section([8,3],'CHR in SWI-Prolog Programs',15562,15808).
1360 section([8,3,1],'Embedding in Prolog Programs',15565,15570).
1361 section([8,3,2],'Constraint declaration',15572,15781).
1362 section([8,3,3],'Compilation',15783,15808).
1363 section([8,4],'Debugging',15810,15951).
1364 section([8,4,1],'Ports',15820,15861).
1365 section([8,4,2],'Tracing',15863,15910).
1366 section([8,4,3],'CHR Debugging Predicates',15912,15951).
1367 section([8,5],'Examples',15953,16012).
1368 section([8,6],'Backwards Compatibility',16014,16092).
1369 section([8,6,1],'The Old SICStus CHR implemenation',16017,16060).
1370 section([8,6,2],'The Old ECLiPSe CHR implemenation',16062,16092).
1371 section([8,7],'Programming Tips and Tricks',16094,16137).
1372 section([8,8],'Compiler Errors and Warnings',16139,16208).
1373 section([8,8,1],'CHR Compiler Errors',16145,16208).
1374 section([9],'MULTITHREADED APPLICATIONS',16210,17287).
1375 section([9,1],'Creating and destroying Prolog threads',16248,16437).
1376 section([9,2],'Monitoring threads',16439,16509).
1377 section([9,3],'Thread communication',16511,16821).
1378 section([9,3,1],'Message queues',16514,16739).
1379 section([9,3,2],'Signalling threads',16741,16772).
1380 section([9,3,3],'Threads and dynamic predicates',16774,16821).
1381 section([9,4],'Thread synchronisation',16823,16953).
1382 section([9,5],'Thread support library(threadutil)',16955,17060).
1383 section([9,5,1],'Debugging threads',16981,17045).
1384 section([9,5,2],'Profiling threads',17047,17060).
1385 section([9,6],'Multithreaded mixed C and Prolog applications',17062,17231).
1386 section([9,6,1],'A Prolog thread for each native thread (one-to-one)',17084,17164).
1387 section([9,6,2],'Pooling Prolog engines (many-to-many)',17166,17231).
1388 section([9,7],'Multithreading and the XPCE graphics system',17233,17287).
1389 section([10],'FOREIGN LANGUAGE INTERFACE',17289,21383).
1390 section([10,1],'Overview of the Interface',17308,17333).
1391 section([10,2],'Linking Foreign Modules',17335,17602).
1392 section([10,2,1],'What linking is provided?',17346,17354).
1393 section([10,2,2],'What kind of loading should I be using?',17356,17372).
1394 section([10,2,3],'library(shlib): Utility library for loading foreign objects',17374,17497).
1395 section([10,2,4],'Low-level operations on shared libraries',17499,17540).
1396 section([10,2,5],'Static Linking',17542,17602).
1397 section([10,3],'Interface Data Types',17604,17770).
1398 section([10,3,1],'Type term_t: a reference to a Prolog term',17607,17721).
1399 section([10,3,1,1],'Interaction with the garbage collector and stack-shifter',17710,17721).
1400 section([10,3,2],'Other foreign interface types',17723,17770).
1401 section([10,4],'The Foreign Include File',17772,20914).
1402 section([10,4,1],'Argument Passing and Control',17775,17914).
1403 section([10,4,1,1],'Non-deterministic Foreign Predicates',17794,17914).
1404 section([10,4,2],'Atoms and functors',17916,18003).
1405 section([10,4,2,1],'Atoms and atom garbage collection',17969,18003).
1406 section([10,4,3],'Analysing Terms via the Foreign Interface',18005,18578).
1407 section([10,4,3,1],'Testing the type of a term',18018,18132).
1408 section([10,4,3,2],'Reading data from a term',18134,18331).
1409 section([10,4,3,3],'Exchanging text using length and string',18333,18397).
1410 section([10,4,3,4],'Wide-character versions',18399,18446).
1411 section([10,4,3,5],'Reading a list',18448,18524).
1412 section([10,4,3,6],'An example: defining write/1 in C',18526,18578).
1413 section([10,4,4],'Constructing Terms',18580,18726).
1414 section([10,4,5],'Unifying data',18728,19127).
1415 section([10,4,6],'Convenient functions to generate Prolog exceptions',19129,19288).
1416 section([10,4,7],'BLOBS: Using atoms to store arbitrary binary data',19290,19439).
1417 section([10,4,7,1],'Defining a BLOB type',19312,19399).
1418 section([10,4,7,2],'Accessing blobs',19401,19439).
1419 section([10,4,8],'Exchanging GMP numbers',19441,19525).
1420 section([10,4,9],'Calling Prolog from C',19527,19676).
1421 section([10,4,9,1],'Predicate references',19540,19567).
1422 section([10,4,9,2],'Initiating a query from C',19569,19676).
1423 section([10,4,10],'Discarding Data',19678,19738).
1424 section([10,4,11],'Foreign Code and Modules',19740,19779).
1425 section([10,4,12],'Prolog exceptions in foreign code',19781,19908).
1426 section([10,4,13],'Catching Signals (Software Interrupts)',19910,19976).
1427 section([10,4,14],'Miscellaneous',19978,20165).
1428 section([10,4,14,1],'Term Comparison',19981,19992).
1429 section([10,4,14,2],'Recorded database',19994,20087).
1430 section([10,4,14,3],'Getting file names',20089,20138).
1431 section([10,4,14,4],'Dealing with Prolog flags from C',20140,20165).
1432 section([10,4,15],'Errors and warnings',20167,20180).
1433 section([10,4,16],'Environment Control from Foreign Code',20182,20267).
1434 section([10,4,17],'Querying Prolog',20269,20306).
1435 section([10,4,18],'Registering Foreign Predicates',20308,20432).
1436 section([10,4,19],'Foreign Code Hooks',20434,20519).
1437 section([10,4,20],'Storing foreign data',20521,20713).
1438 section([10,4,20,1],'Examples for storing foreign data',20591,20713).
1439 section([10,4,21],'Embedding SWI-Prolog in other applications',20715,20914).
1440 section([10,4,21,1],'Threading, Signals and embedded Prolog',20875,20914).
1441 section([10,5],'Linking embedded applications using swipl-ld',20916,21135).
1442 section([10,5,1],'A simple example',21049,21135).
1443 section([10,6],'The Prolog `home\' directory',21137,21171).
1444 section([10,7],'Example of Using the Foreign Interface',21173,21232).
1445 section([10,8],'Notes on Using Foreign Code',21234,21383).
1446 section([10,8,1],'Memory Allocation',21237,21299).
1447 section([10,8,1,1],'Boehm-GC support',21269,21299).
1448 section([10,8,2],'Compatibility between Prolog versions',21301,21313).
1449 section([10,8,3],'Debugging and profiling foreign code (valgrind)',21315,21335).
1450 section([10,8,4],'Name Conflicts in C modules',21337,21354).
1451 section([10,8,5],'Compatibility of the Foreign Interface',21356,21383).
1452 section([11],'GENERATING RUNTIME APPLICATIONS',21385,21791).
1453 section([11,1],'Limitations of qsave_program',21536,21552).
1454 section([11,2],'Runtimes and Foreign Code',21554,21620).
1455 section([11,3],'Using program resources',21622,21744).
1456 section([11,3,1],'Resource manipulation predicates',21655,21713).
1457 section([11,3,2],'The swipl-rc program',21715,21744).
1458 section([11,4],'Finding Application files',21746,21791).
1459 section([11,4,1],'Specifying a file search path from the command line',21778,21791).
1460 section([12],'THE SWI-PROLOG LIBRARY',21793,27673).
1461 section([12,1],'library(aggregate): Aggregation operators on backtrackable',21817,21983).
1462 section([12,2],'library(apply): Apply predicates on a list',21985,22083).
1463 section([12,3],'library(assoc): Association lists',22085,22170).
1464 section([12,4],'library(broadcast): Broadcast and receive event notifications',22172,22286).
1465 section([12,5],'library(charsio): I/O on Lists of Character Codes',22288,22372).
1466 section([12,6],'library(check): Consistency checking',22374,22507).
1467 section([12,7],'library(clpb): Constraint Logic Programming over Boolean',22509,22650).
1468 section([12,7,0,1],'Introduction',22515,22525).
1469 section([12,7,0,2],'Boolean expressions',22527,22560).
1470 section([12,7,0,3],'Interface predicates',22562,22580).
1471 section([12,7,0,4],'Examples',22582,22650).
1472 section([12,8],'library(clpfd): Constraint Logic Programming over Finite Domains',22652,23733).
1473 section([12,8,0,5],'Introduction',22657,22708).
1474 section([12,8,0,6],'Arithmetic constraints',22710,22743).
1475 section([12,8,0,7],'Declarative integer arithmetic',22745,22814).
1476 section([12,8,0,8],'Reification',22816,22834).
1477 section([12,8,0,9],'Domains',22836,22861).
1478 section([12,8,0,10],'Examples',22863,22899).
1479 section([12,8,0,11],'Enumeration predicates and search',22901,22984).
1480 section([12,8,0,12],'Advanced topics',22986,23733).
1481 section([12,9],'library(clpqr): Constraint Logic Programming over Rationals and',23735,23957).
1482 section([12,9,1],'Solver predicates',23769,23839).
1483 section([12,9,2],'Syntax of the predicate arguments',23841,23880).
1484 section([12,9,3],'Use of unification',23882,23899).
1485 section([12,9,4],'Non-linear constraints',23901,23926).
1486 section([12,9,5],'Status and known problems',23928,23957).
1487 section([12,10],'library(csv): Process CSV (Comma-Separated Values) data',23959,24079).
1488 section([12,11],'library(debug): Print debug messages and test assertions',24081,24193).
1489 section([12,12],'library(gensym): Generate unique identifiers',24195,24226).
1490 section([12,13],'library(iostream): Utilities to deal with streams',24228,24321).
1491 section([12,14],'library(lists): List Manipulation',24323,24637).
1492 section([12,15],'library(nb_set): Non-backtrackable set',24639,24697).
1493 section([12,16],'library(www_browser): Activating your Web-browser',24699,24725).
1494 section([12,17],'library(option): Option list processing',24727,24857).
1495 section([12,18],'library(optparse): command line parsing',24859,25225).
1496 section([12,18,1],'Notes and tips',25123,25225).
1497 section([12,19],'library(ordsets): Ordered set manipulation',25227,25394).
1498 section([12,20],'library(pairs): Operations on key-value lists',25396,25461).
1499 section([12,21],'library(persistency): Provide persistent dynamic predicates',25463,25597).
1500 section([12,22],'library(pio): Pure I/O',25599,25718).
1501 section([12,22,1],'library(pure_input): Pure Input from files',25607,25718).
1502 section([12,23],'library(predicate_options): Declare option-processing of predi-',25720,25992).
1503 section([12,23,1],'The strength and weakness of predicate options',25726,25776).
1504 section([12,23,2],'Options as arguments or environment?',25778,25810).
1505 section([12,23,3],'Improving on the current situation',25812,25992).
1506 section([12,23,3,1],'Options as types',25822,25849).
1507 section([12,23,3,2],'Reflective access to options',25851,25992).
1508 section([12,24],'library(prolog_pack): A package manager for Prolog',25994,26182).
1509 section([12,25],'library(prolog_xref): Cross-reference data collection library',26184,26283).
1510 section([12,25,1],'Extending the library',26264,26283).
1511 section([12,26],'library(quasi_quotations): Define Quasi Quotation syntax',26285,26403).
1512 section([12,27],'library(random): Random numbers',26405,26543).
1513 section([12,28],'library(readutil): Reading lines, streams and files',26545,26611).
1514 section([12,29],'library(record): Access named fields in a term',26613,26710).
1515 section([12,30],'library(registry): Manipulating the Windows registry',26712,26788).
1516 section([12,31],'library(simplex): Solve linear programming problems',26790,27027).
1517 section([12,31,1],'Example 1',26893,26925).
1518 section([12,31,2],'Example 2',26927,26985).
1519 section([12,31,3],'Example 3',26987,27027).
1520 section([12,32],'library(solution_sequences): Modify solution sequences',27029,27125).
1521 section([12,33],'library(thread_pool): Resource bounded thread management',27127,27245).
1522 section([12,34],'library(ugraphs): Unweighted Graphs',27247,27457).
1523 section([12,35],'library(url): Analysing and constructing URL',27459,27616).
1524 section([12,36],'library(varnumbers): Utilities for numbered terms',27618,27673).
1525 section([13],'HACKERS CORNER',27675,28280).
1526 section([13,1],'Examining the Environment Stack',27685,27818).
1527 section([13,2],'Ancestral cuts',27820,27829).
1528 section([13,3],'Intercepting the Tracer',27831,27965).
1529 section([13,4],'Breakpoint and watchpoint handling',27967,28054).
1530 section([13,5],'Adding context to errors: prolog_exception_hook',28056,28107).
1531 section([13,6],'Hooks using the exception predicate',28109,28148).
1532 section([13,7],'Hooks for integrating libraries',28150,28211).
1533 section([13,8],'Hooks for loading files',28213,28252).
1534 section([13,9],'Readline Interaction',28254,28280).
1535 section([14],'COMPATIBILITY WITH OTHER PROLOG DIALECTS',28282,28477).
1536 section([14,1],'Some considerations for writing portable code',28362,28477).
1537 section([15],'GLOSSARY OF TERMS',28479,28802).
1538 section([16],'SWI-PROLOG LICENSE CONDITIONS AND TOOLS',28804,28997).
1539 section([16,1],'The SWI-Prolog kernel and foreign libraries',28834,28866).
1540 section([16,1,1],'The SWI-Prolog Prolog libraries',28849,28866).
1541 section([16,2],'Contributing to the SWI-Prolog project',28868,28878).
1542 section([16,3],'Software support to keep track of license conditions',28880,28961).
1543 section([16,4],'License conditions inherited from used code',28963,28997).
1544 section([16,4,1],'Cryptographic routines',28966,28997).
1545 section([17],'SUMMARY',28999,30468).
1546 section([17,1],'Predicates',29002,29807).
1547 section([17,2],'Library predicates',29809,30319).
1548 section([17,2,1],'library(aggregate)',29812,29821).
1549 section([17,2,2],'library(apply)',29823,29843).
1550 section([17,2,3],'library(assoc)',29845,29862).
1551 section([17,2,4],'library(broadcast)',29864,29874).
1552 section([17,2,5],'library(charsio)',29876,29893).
1553 section([17,2,6],'library(check)',29895,29912).
1554 section([17,2,7],'library(csv)',29914,29924).
1555 section([17,2,8],'library(lists)',29926,29964).
1556 section([17,2,9],'library(debug)',29966,29979).
1557 section([17,2,10],'library(iostream)',29981,29982).
1558 section([17,2,11],'library(summaries.d/iostream/tex)',29984,29985).
1559 section([17,2,12],'library(option)',29987,29996).
1560 section([17,2,13],'library(optparse)',29998,30004).
1561 section([17,2,14],'library(ordsets)',30006,30030).
1562 section([17,2,15],'library(persistency)',30032,30039).
1563 section([17,2,16],'library(predicate_options)',30041,30055).
1564 section([17,2,17],'library(prologpack)',30057,30073).
1565 section([17,2,18],'library(prologxref)',30075,30087).
1566 section([17,2,19],'library(pairs)',30089,30097).
1567 section([17,2,20],'library(pio)',30099,30111).
1568 section([17,2,20,1],'library(pure_input)',30102,30111).
1569 section([17,2,21],'library(random)',30113,30130).
1570 section([17,2,22],'library(readutil)',30132,30140).
1571 section([17,2,23],'library(record)',30142,30145).
1572 section([17,2,24],'library(registry)',30147,30159).
1573 section([17,2,25],'library(ugraphs)',30161,30182).
1574 section([17,2,26],'library(url)',30184,30197).
1575 section([17,2,27],'library(www_browser)',30199,30202).
1576 section([17,2,28],'library(clp/clpb)',30204,30210).
1577 section([17,2,29],'library(clp/clpfd)',30212,30261).
1578 section([17,2,30],'library(clpqr)',30263,30275).
1579 section([17,2,31],'library(clp/simplex)',30277,30291).
1580 section([17,2,32],'library(solution_sequences)',30293,30301).
1581 section([17,2,33],'library(thread_pool)',30303,30311).
1582 section([17,2,34],'library(varnumbers)',30313,30319).
1583 section([17,3],'Arithmetic Functions',30321,30401).
1584 section([17,4],'Operators',30403,30468).
1585 section([18],'Bibliography',30470,31769).
1586 section([],'Index',30567,31769).
1126 section([1],'INTRODUCTION',50,317).
1127 section([1,1],'Positioning SWI-Prolog',63,106).
1128 section([1,2],'Status and releases',108,134).
1129 section([1,3],'Should I be using SWI-Prolog?',136,219).
1130 section([1,4],'Support the SWI-Prolog project',221,231).
1131 section([1,5],'Implementation history',233,267).
1132 section([1,6],'Acknowledgements',269,317).
1133 section([2],'OVERVIEW',319,2991).
1134 section([2,1],'Getting started quickly',322,407).
1135 section([2,1,1],'Starting SWI-Prolog',325,380).
1136 section([2,1,1,1],'Starting SWI-Prolog on Unix',328,358).
1137 section([2,1,1,2],'Starting SWI-Prolog on Windows',360,380).
1138 section([2,1,2],'Executing a query',382,407).
1139 section([2,2],'The user\'s initialisation file',409,441).
1140 section([2,3],'Initialisation files and goals',443,476).
1141 section([2,4],'Command line options',478,717).
1142 section([2,4,1],'Informational command line options',513,541).
1143 section([2,4,2],'Command line options for running Prolog',543,636).
1144 section([2,4,3],'Controlling the stack sizes',638,667).
1145 section([2,4,4],'Running goals from the command line',669,691).
1146 section([2,4,5],'Compilation options',693,701).
1147 section([2,4,6],'Maintenance options',703,717).
1148 section([2,5],'GNU Emacs Interface',719,731).
1149 section([2,6],'Online Help',733,799).
1150 section([2,7],'Command line history',801,826).
1151 section([2,8],'Reuse of top-level bindings',828,867).
1152 section([2,9],'Overview of the Debugger',869,1038).
1153 section([2,10],'Compilation',1040,1219).
1154 section([2,10,1],'During program development',1043,1070).
1155 section([2,10,2],'For running the result',1072,1219).
1156 section([2,10,2,1],'Using PrologScript',1080,1135).
1157 section([2,10,2,2],'Creating a shell script',1137,1170).
1158 section([2,10,2,3],'Creating a saved state',1172,1183).
1159 section([2,10,2,4],'Compilation using the -c command line option',1185,1219).
1160 section([2,11],'Environment Control (Prolog flags)',1221,2002).
1161 section([2,12],'An overview of hook predicates',2004,2075).
1162 section([2,13],'Automatic loading of libraries',2077,2189).
1163 section([2,14],'Garbage Collection',2191,2196).
1164 section([2,15],'The SWI-Prolog syntax',2198,2502).
1165 section([2,15,1],'ISO Syntax Support',2209,2219).
1166 section([2,15,1,1],'Processor Character Set',2214,2219).
1167 section([2,15,2],'Nested comments',2221,2502).
1168 section([2,15,2,1],'Character Escape Syntax',2242,2357).
1169 section([2,15,2,2],'Syntax for non-decimal numbers',2359,2367).
1170 section([2,15,2,3],'Using digit groups in large integers',2369,2392).
1171 section([2,15,2,4],'Unicode Prolog source',2394,2439).
1172 section([2,15,2,5],'Singleton variable checking',2441,2502).
1173 section([2,16],'Rational trees (cyclic terms)',2504,2534).
1174 section([2,17],'Just-in-time clause indexing',2536,2629).
1175 section([2,17,1],'Future directions',2603,2614).
1176 section([2,17,2],'Indexing and portability',2616,2629).
1177 section([2,18],'Wide character support',2631,2753).
1178 section([2,18,1],'Wide character encodings on streams',2658,2753).
1179 section([2,18,1,1],'BOM: Byte Order Mark',2729,2753).
1180 section([2,19],'System limits',2755,2902).
1181 section([2,19,1],'Limits on memory areas',2758,2845).
1182 section([2,19,1,1],'The heap',2839,2845).
1183 section([2,19,2],'Other Limits',2847,2892).
1184 section([2,19,3],'Reserved Names',2894,2902).
1185 section([2,20],'SWI-Prolog and 64-bit machines',2904,2991).
1186 section([2,20,1],'Supported platforms',2911,2916).
1187 section([2,20,2],'Comparing 32- and 64-bits Prolog',2918,2950).
1188 section([2,20,3],'Choosing between 32- and 64-bit Prolog',2952,2991).
1189 section([3],'INITIALISING AND MANAGING A PROLOG PROJECT',2993,3767).
1190 section([3,1],'The project source files',3008,3174).
1191 section([3,1,1],'File Names and Locations',3018,3097).
1192 section([3,1,1,1],'File Name Extensions',3021,3042).
1193 section([3,1,1,2],'Project Directories',3044,3063).
1194 section([3,1,1,3],'Sub-projects using search paths',3065,3097).
1195 section([3,1,2],'Project Special Files',3099,3130).
1196 section([3,1,3],'International source files',3132,3174).
1197 section([3,2],'Using modules',3176,3219).
1198 section([3,3],'The test-edit-reload cycle',3221,3287).
1199 section([3,3,1],'Locating things to edit',3237,3255).
1200 section([3,3,2],'Editing and incremental compilation',3257,3287).
1201 section([3,4],'Using the PceEmacs built-in editor',3289,3544).
1202 section([3,4,1],'Activating PceEmacs',3292,3298).
1203 section([3,4,2],'Bluffing through PceEmacs',3300,3419).
1204 section([3,4,2,1],'Edit modes',3313,3336).
1205 section([3,4,2,2],'Frequently used editor commands',3338,3419).
1206 section([3,4,3],'Prolog Mode',3421,3544).
1207 section([3,4,3,1],'Finding your way around',3533,3544).
1208 section([3,5],'The Graphical Debugger',3546,3599).
1209 section([3,5,1],'Invoking the window-based debugger',3562,3599).
1210 section([3,6],'The Prolog Navigator',3601,3607).
1211 section([3,7],'Cross-referencer',3609,3690).
1212 section([3,8],'Accessing the IDE from your program',3692,3729).
1213 section([3,9],'Summary of the IDE',3731,3767).
1214 section([4],'BUILT-IN PREDICATES',3769,12765).
1215 section([4,1],'Notation of Predicate Descriptions',3772,3829).
1216 section([4,2],'Character representation',3831,3886).
1217 section([4,3],'Loading Prolog source files',3888,4941).
1218 section([4,3,1],'Conditional compilation and program transformation',4565,4776).
1219 section([4,3,1,1],'Program transformation with source layout info',4681,4712).
1220 section([4,3,1,2],'Conditional compilation',4714,4776).
1221 section([4,3,2],'Loading files, active code and threads',4778,4894).
1222 section([4,3,2,1],'Compilation of mutually dependent code',4812,4832).
1223 section([4,3,2,2],'Compilation with multiple threads',4834,4865).
1224 section([4,3,2,3],'Reloading running code',4867,4894).
1225 section([4,3,3],'Quick load files',4896,4941).
1226 section([4,4],'Editor Interface',4943,5069).
1227 section([4,4,1],'Customizing the editor interface',4983,5069).
1228 section([4,5],'List the program, predicates or clauses',5071,5102).
1229 section([4,6],'Verify Type of a Term',5104,5215).
1230 section([4,7],'Comparison and Unification of Terms',5217,5414).
1231 section([4,7,1],'Standard Order of Terms',5236,5290).
1232 section([4,7,2],'Special unification and comparison predicates',5292,5414).
1233 section([4,8],'Control Predicates',5416,5528).
1234 section([4,9],'Meta-Call Predicates',5530,5763).
1235 section([4,10],'ISO compliant Exception handling',5765,6155).
1236 section([4,10,1],'Debugging and exceptions',5822,5861).
1237 section([4,10,2],'The exception term',5863,5875).
1238 section([4,10,3],'Printing messages',5877,6155).
1239 section([4,10,3,1],'Printing from libraries',6090,6155).
1240 section([4,11],'Handling signals',6157,6250).
1241 section([4,11,1],'Notes on signal handling',6217,6250).
1242 section([4,12],'DCG Grammar rules',6252,6386).
1243 section([4,13],'Database',6388,6668).
1244 section([4,13,1],'Update view',6587,6606).
1245 section([4,13,2],'Indexing databases',6608,6668).
1246 section([4,14],'Declaring predicate properties',6670,6729).
1247 section([4,15],'Examining the program',6731,7056).
1248 section([4,16],'Input and output',7058,7821).
1249 section([4,16,1],'Predefined stream aliases',7072,7108).
1250 section([4,16,2],'ISO Input and Output Streams',7110,7619).
1251 section([4,16,3],'Edinburgh-style I/O',7621,7740).
1252 section([],'Compatibility notes',7669,31905).
1253 section([4,16,4],'Switching between Edinburgh and ISO I/O',7742,7766).
1254 section([4,16,5],'Write onto atoms, code-lists, etc.',7768,7821).
1255 section([4,17],'Status of streams',7823,7894).
1256 section([4,18],'Primitive character I/O',7896,8144).
1257 section([4,19],'Term reading and writing',8146,8665).
1258 section([4,20],'Analysing and Constructing Terms',8667,8895).
1259 section([4,20,1],'Non-logical operations on terms',8817,8895).
1260 section([4,21],'Analysing and Constructing Atoms',8897,9086).
1261 section([4,22],'Localization (locale) support',9088,9173).
1262 section([4,23],'Character properties',9175,9362).
1263 section([4,23,1],'Case conversion',9307,9324).
1264 section([4,23,2],'White space normalization',9326,9334).
1265 section([4,23,3],'Language-specific comparison',9336,9362).
1266 section([4,24],'Operators',9364,9474).
1267 section([4,25],'Character Conversion',9476,9493).
1268 section([4,26],'Arithmetic',9495,10194).
1269 section([4,26,1],'Special purpose integer arithmetic',9505,9571).
1270 section([4,26,2],'General purpose arithmetic',9573,10194).
1271 section([4,26,2,1],'Arithmetic types',9619,9671).
1272 section([4,26,2,2],'Rational number examples',9673,9704).
1273 section([4,26,2,3],'Arithmetic Functions',9706,10194).
1274 section([4,27],'Misc arithmetic support predicates',10196,10244).
1275 section([4,28],'Built-in list operations',10246,10394).
1276 section([4,29],'Finding all Solutions to a Goal',10396,10493).
1277 section([4,30],'Forall',10495,10539).
1278 section([4,31],'Formatted Write',10541,10866).
1279 section([4,31,1],'Writef',10551,10631).
1280 section([4,31,2],'Format',10633,10827).
1281 section([4,31,3],'Programming Format',10829,10866).
1282 section([4,32],'Terminal Control',10868,10914).
1283 section([4,33],'Operating System Interaction',10916,11577).
1284 section([4,33,1],'Windows-specific Operating System Interaction',11040,11150).
1285 section([4,33,2],'Dealing with time and date',11152,11515).
1286 section([4,33,2,1],'Time and date data structures',11191,11219).
1287 section([4,33,2,2],'Time and date predicates',11221,11515).
1288 section([4,33,3],'Controlling the swipl-win.exe console window',11517,11577).
1289 section([4,34],'File System Interaction',11579,11859).
1290 section([4,35],'User Top-level Manipulation',11861,11955).
1291 section([4,36],'Creating a Protocol of the User Interaction',11957,11982).
1292 section([4,37],'Debugging and Tracing Programs',11984,12197).
1293 section([4,38],'Obtaining Runtime Statistics',12199,12304).
1294 section([4,39],'Execution profiling',12306,12481).
1295 section([4,39,1],'Profiling predicates',12317,12383).
1296 section([4,39,2],'Visualizing profiling data',12385,12432).
1297 section([4,39,3],'Information gathering',12434,12481).
1298 section([4,39,3,1],'Profiling in the Windows Implementation',12466,12481).
1299 section([4,40],'Memory Management',12483,12569).
1300 section([4,41],'Windows DDE interface',12571,12705).
1301 section([4,41,1],'DDE client interface',12587,12644).
1302 section([4,41,2],'DDE server mode',12646,12705).
1303 section([4,42],'Miscellaneous',12707,12765).
1304 section([5],'SWI-PROLOG EXTENSIONS',12767,14101).
1305 section([5,1],'Lists are special',12787,12851).
1306 section([5,1,1],'Motivating \'[|]\' and [] for lists',12821,12851).
1307 section([5,2],'The string type and its double quoted syntax',12853,13335).
1308 section([5,2,1],'Predicates that operate on strings',12891,13123).
1309 section([5,2,2],'Representing text: strings, atoms and code lists',13125,13158).
1310 section([5,2,3],'Adapting code for double quoted strings',13160,13228).
1311 section([5,2,4],'Why has the representation of double quoted text changed?',13230,13335).
1312 section([5,3],'Syntax changes',13337,13444).
1313 section([5,3,1],'Operators and quoted atoms',13340,13354).
1314 section([5,3,2],'Compound terms with zero arguments',13356,13412).
1315 section([5,3,3],'Block operators',13414,13444).
1316 section([5,4],'Dicts: structures with named arguments',13446,13975).
1317 section([5,4,1],'Functions on dicts',13497,13643).
1318 section([5,4,1,1],'User defined functions on dicts',13554,13592).
1319 section([5,4,1,2],'Predefined functions on dicts',13594,13643).
1320 section([5,4,2],'Predicates for managing dicts',13645,13825).
1321 section([5,4,2,1],'Destructive assignment in dicts',13780,13825).
1322 section([5,4,3],'When to use dicts?',13827,13922).
1323 section([5,4,4],'A motivation for dicts as primary citizens',13924,13954).
1324 section([5,4,5],'Implementation notes about dicts',13956,13975).
1325 section([5,5],'Integration of strings and dicts in the libraries',13977,14057).
1326 section([5,5,1],'Dicts and option processing',13992,13996).
1327 section([5,5,2],'Dicts in core data structures',13998,14008).
1328 section([5,5,3],'Dicts, strings and XML',14010,14024).
1329 section([5,5,4],'Dicts, strings and JSON',14026,14041).
1330 section([5,5,5],'Dicts, strings and HTTP',14043,14057).
1331 section([5,6],'Remaining issues',14059,14101).
1332 section([6],'MODULES',14103,14944).
1333 section([6,1],'Why Use Modules?',14130,14150).
1334 section([6,2],'Defining a Module',14152,14206).
1335 section([6,3],'Importing Predicates into a Module',14208,14294).
1336 section([6,4],'Defining a meta-predicate',14296,14424).
1337 section([6,5],'Overruling Module Boundaries',14426,14483).
1338 section([6,5,1],'Explicit manipulation of the calling context',14458,14483).
1339 section([6,6],'Interacting with modules from the top level',14485,14513).
1340 section([6,7],'Composing modules from other modules',14515,14546).
1341 section([6,8],'Operators and modules',14548,14578).
1342 section([6,9],'Dynamic importing using import modules',14580,14628).
1343 section([6,10],'Reserved Modules and using the `user\' module',14630,14645).
1344 section([6,11],'An alternative import/export interface',14647,14672).
1345 section([6,12],'Dynamic Modules',14674,14707).
1346 section([6,13],'Transparent predicates: definition and context module',14709,14800).
1347 section([6,14],'Module properties',14802,14887).
1348 section([6,15],'Compatibility of the Module System',14889,14944).
1349 section([7],'SPECIAL VARIABLES AND COROUTINING',14946,15402).
1350 section([7,1],'Attributed variables',14993,15211).
1351 section([7,1,1],'Attribute manipulation predicates',15077,15109).
1352 section([7,1,2],'Attributed variable hooks',15111,15156).
1353 section([7,1,3],'Operations on terms with attributed variables',15158,15187).
1354 section([7,1,4],'Special purpose predicates for attributes',15189,15211).
1355 section([7,2],'Coroutining',15213,15281).
1356 section([7,3],'Global variables',15283,15402).
1357 section([7,3,1],'Compatibility of SWI-Prolog Global Variables',15389,15402).
1358 section([8],'CHR: CONSTRAINT HANDLING RULES',15404,16281).
1359 section([8,1],'Introduction',15426,15454).
1360 section([8,2],'Syntax and Semantics',15456,15633).
1361 section([8,2,1],'Syntax of CHR rules',15459,15511).
1362 section([8,2,2],'Semantics',15513,15633).
1363 section([8,3],'CHR in SWI-Prolog Programs',15635,15881).
1364 section([8,3,1],'Embedding in Prolog Programs',15638,15643).
1365 section([8,3,2],'Constraint declaration',15645,15854).
1366 section([8,3,3],'Compilation',15856,15881).
1367 section([8,4],'Debugging',15883,16024).
1368 section([8,4,1],'Ports',15893,15934).
1369 section([8,4,2],'Tracing',15936,15983).
1370 section([8,4,3],'CHR Debugging Predicates',15985,16024).
1371 section([8,5],'Examples',16026,16085).
1372 section([8,6],'Backwards Compatibility',16087,16165).
1373 section([8,6,1],'The Old SICStus CHR implemenation',16090,16133).
1374 section([8,6,2],'The Old ECLiPSe CHR implemenation',16135,16165).
1375 section([8,7],'Programming Tips and Tricks',16167,16210).
1376 section([8,8],'Compiler Errors and Warnings',16212,16281).
1377 section([8,8,1],'CHR Compiler Errors',16218,16281).
1378 section([9],'MULTITHREADED APPLICATIONS',16283,17360).
1379 section([9,1],'Creating and destroying Prolog threads',16321,16510).
1380 section([9,2],'Monitoring threads',16512,16582).
1381 section([9,3],'Thread communication',16584,16894).
1382 section([9,3,1],'Message queues',16587,16812).
1383 section([9,3,2],'Signalling threads',16814,16845).
1384 section([9,3,3],'Threads and dynamic predicates',16847,16894).
1385 section([9,4],'Thread synchronisation',16896,17026).
1386 section([9,5],'Thread support library(threadutil)',17028,17133).
1387 section([9,5,1],'Debugging threads',17054,17118).
1388 section([9,5,2],'Profiling threads',17120,17133).
1389 section([9,6],'Multithreaded mixed C and Prolog applications',17135,17304).
1390 section([9,6,1],'A Prolog thread for each native thread (one-to-one)',17157,17237).
1391 section([9,6,2],'Pooling Prolog engines (many-to-many)',17239,17304).
1392 section([9,7],'Multithreading and the XPCE graphics system',17306,17360).
1393 section([10],'FOREIGN LANGUAGE INTERFACE',17362,21465).
1394 section([10,1],'Overview of the Interface',17381,17406).
1395 section([10,2],'Linking Foreign Modules',17408,17675).
1396 section([10,2,1],'What linking is provided?',17419,17427).
1397 section([10,2,2],'What kind of loading should I be using?',17429,17445).
1398 section([10,2,3],'library(shlib): Utility library for loading foreign objects',17447,17570).
1399 section([10,2,4],'Low-level operations on shared libraries',17572,17613).
1400 section([10,2,5],'Static Linking',17615,17675).
1401 section([10,3],'Interface Data Types',17677,17843).
1402 section([10,3,1],'Type term_t: a reference to a Prolog term',17680,17794).
1403 section([10,3,1,1],'Interaction with the garbage collector and stack-shifter',17783,17794).
1404 section([10,3,2],'Other foreign interface types',17796,17843).
1405 section([10,4],'The Foreign Include File',17845,20996).
1406 section([10,4,1],'Argument Passing and Control',17848,17996).
1407 section([10,4,1,1],'Non-deterministic Foreign Predicates',17867,17996).
1408 section([10,4,2],'Atoms and functors',17998,18085).
1409 section([10,4,2,1],'Atoms and atom garbage collection',18051,18085).
1410 section([10,4,3],'Analysing Terms via the Foreign Interface',18087,18660).
1411 section([10,4,3,1],'Testing the type of a term',18100,18214).
1412 section([10,4,3,2],'Reading data from a term',18216,18413).
1413 section([10,4,3,3],'Exchanging text using length and string',18415,18479).
1414 section([10,4,3,4],'Wide-character versions',18481,18528).
1415 section([10,4,3,5],'Reading a list',18530,18606).
1416 section([10,4,3,6],'An example: defining write/1 in C',18608,18660).
1417 section([10,4,4],'Constructing Terms',18662,18808).
1418 section([10,4,5],'Unifying data',18810,19209).
1419 section([10,4,6],'Convenient functions to generate Prolog exceptions',19211,19370).
1420 section([10,4,7],'BLOBS: Using atoms to store arbitrary binary data',19372,19521).
1421 section([10,4,7,1],'Defining a BLOB type',19394,19481).
1422 section([10,4,7,2],'Accessing blobs',19483,19521).
1423 section([10,4,8],'Exchanging GMP numbers',19523,19607).
1424 section([10,4,9],'Calling Prolog from C',19609,19758).
1425 section([10,4,9,1],'Predicate references',19622,19649).
1426 section([10,4,9,2],'Initiating a query from C',19651,19758).
1427 section([10,4,10],'Discarding Data',19760,19820).
1428 section([10,4,11],'Foreign Code and Modules',19822,19861).
1429 section([10,4,12],'Prolog exceptions in foreign code',19863,19990).
1430 section([10,4,13],'Catching Signals (Software Interrupts)',19992,20058).
1431 section([10,4,14],'Miscellaneous',20060,20247).
1432 section([10,4,14,1],'Term Comparison',20063,20074).
1433 section([10,4,14,2],'Recorded database',20076,20169).
1434 section([10,4,14,3],'Getting file names',20171,20220).
1435 section([10,4,14,4],'Dealing with Prolog flags from C',20222,20247).
1436 section([10,4,15],'Errors and warnings',20249,20262).
1437 section([10,4,16],'Environment Control from Foreign Code',20264,20349).
1438 section([10,4,17],'Querying Prolog',20351,20388).
1439 section([10,4,18],'Registering Foreign Predicates',20390,20514).
1440 section([10,4,19],'Foreign Code Hooks',20516,20601).
1441 section([10,4,20],'Storing foreign data',20603,20795).
1442 section([10,4,20,1],'Examples for storing foreign data',20673,20795).
1443 section([10,4,21],'Embedding SWI-Prolog in other applications',20797,20996).
1444 section([10,4,21,1],'Threading, Signals and embedded Prolog',20957,20996).
1445 section([10,5],'Linking embedded applications using swipl-ld',20998,21217).
1446 section([10,5,1],'A simple example',21131,21217).
1447 section([10,6],'The Prolog `home\' directory',21219,21253).
1448 section([10,7],'Example of Using the Foreign Interface',21255,21314).
1449 section([10,8],'Notes on Using Foreign Code',21316,21465).
1450 section([10,8,1],'Memory Allocation',21319,21381).
1451 section([10,8,1,1],'Boehm-GC support',21351,21381).
1452 section([10,8,2],'Compatibility between Prolog versions',21383,21395).
1453 section([10,8,3],'Debugging and profiling foreign code (valgrind)',21397,21417).
1454 section([10,8,4],'Name Conflicts in C modules',21419,21436).
1455 section([10,8,5],'Compatibility of the Foreign Interface',21438,21465).
1456 section([11],'GENERATING RUNTIME APPLICATIONS',21467,21873).
1457 section([11,1],'Limitations of qsave_program',21618,21634).
1458 section([11,2],'Runtimes and Foreign Code',21636,21702).
1459 section([11,3],'Using program resources',21704,21826).
1460 section([11,3,1],'Resource manipulation predicates',21737,21795).
1461 section([11,3,2],'The swipl-rc program',21797,21826).
1462 section([11,4],'Finding Application files',21828,21873).
1463 section([11,4,1],'Specifying a file search path from the command line',21860,21873).
1464 section([12],'THE SWI-PROLOG LIBRARY',21875,27787).
1465 section([12,1],'library(aggregate): Aggregation operators on backtrackable',21899,22065).
1466 section([12,2],'library(apply): Apply predicates on a list',22067,22165).
1467 section([12,3],'library(assoc): Association lists',22167,22252).
1468 section([12,4],'library(broadcast): Broadcast and receive event notifications',22254,22368).
1469 section([12,5],'library(charsio): I/O on Lists of Character Codes',22370,22454).
1470 section([12,6],'library(check): Consistency checking',22456,22589).
1471 section([12,7],'library(clpb): Constraint Logic Programming over Boolean',22591,22732).
1472 section([12,7,0,1],'Introduction',22597,22607).
1473 section([12,7,0,2],'Boolean expressions',22609,22642).
1474 section([12,7,0,3],'Interface predicates',22644,22662).
1475 section([12,7,0,4],'Examples',22664,22732).
1476 section([12,8],'library(clpfd): Constraint Logic Programming over Finite Domains',22734,23843).
1477 section([12,8,0,5],'Introduction',22739,22796).
1478 section([12,8,0,6],'Arithmetic constraints',22798,22831).
1479 section([12,8,0,7],'Declarative integer arithmetic',22833,22902).
1480 section([12,8,0,8],'Reification',22904,22925).
1481 section([12,8,0,9],'Domains',22927,22952).
1482 section([12,8,0,10],'Examples',22954,22990).
1483 section([12,8,0,11],'Enumeration predicates and search',22992,23075).
1484 section([12,8,0,12],'Optimisation',23077,23096).
1485 section([12,8,0,13],'Advanced topics',23098,23843).
1486 section([12,9],'library(clpqr): Constraint Logic Programming over Rationals and',23845,24067).
1487 section([12,9,1],'Solver predicates',23879,23949).
1488 section([12,9,2],'Syntax of the predicate arguments',23951,23990).
1489 section([12,9,3],'Use of unification',23992,24009).
1490 section([12,9,4],'Non-linear constraints',24011,24036).
1491 section([12,9,5],'Status and known problems',24038,24067).
1492 section([12,10],'library(csv): Process CSV (Comma-Separated Values) data',24069,24189).
1493 section([12,11],'library(debug): Print debug messages and test assertions',24191,24303).
1494 section([12,12],'library(gensym): Generate unique identifiers',24305,24336).
1495 section([12,13],'library(iostream): Utilities to deal with streams',24338,24431).
1496 section([12,14],'library(lists): List Manipulation',24433,24747).
1497 section([12,15],'library(nb_set): Non-backtrackable set',24749,24807).
1498 section([12,16],'library(www_browser): Activating your Web-browser',24809,24835).
1499 section([12,17],'library(option): Option list processing',24837,24967).
1500 section([12,18],'library(optparse): command line parsing',24969,25339).
1501 section([12,18,1],'Notes and tips',25233,25339).
1502 section([12,19],'library(ordsets): Ordered set manipulation',25341,25508).
1503 section([12,20],'library(pairs): Operations on key-value lists',25510,25575).
1504 section([12,21],'library(persistency): Provide persistent dynamic predicates',25577,25711).
1505 section([12,22],'library(pio): Pure I/O',25713,25832).
1506 section([12,22,1],'library(pure_input): Pure Input from files',25721,25832).
1507 section([12,23],'library(predicate_options): Declare option-processing of predi-',25834,26106).
1508 section([12,23,1],'The strength and weakness of predicate options',25840,25890).
1509 section([12,23,2],'Options as arguments or environment?',25892,25924).
1510 section([12,23,3],'Improving on the current situation',25926,26106).
1511 section([12,23,3,1],'Options as types',25936,25963).
1512 section([12,23,3,2],'Reflective access to options',25965,26106).
1513 section([12,24],'library(prolog_pack): A package manager for Prolog',26108,26296).
1514 section([12,25],'library(prolog_xref): Cross-reference data collection library',26298,26397).
1515 section([12,25,1],'Extending the library',26378,26397).
1516 section([12,26],'library(quasi_quotations): Define Quasi Quotation syntax',26399,26517).
1517 section([12,27],'library(random): Random numbers',26519,26657).
1518 section([12,28],'library(readutil): Reading lines, streams and files',26659,26725).
1519 section([12,29],'library(record): Access named fields in a term',26727,26824).
1520 section([12,30],'library(registry): Manipulating the Windows registry',26826,26902).
1521 section([12,31],'library(simplex): Solve linear programming problems',26904,27141).
1522 section([12,31,1],'Example 1',27007,27039).
1523 section([12,31,2],'Example 2',27041,27099).
1524 section([12,31,3],'Example 3',27101,27141).
1525 section([12,32],'library(solution_sequences): Modify solution sequences',27143,27239).
1526 section([12,33],'library(thread_pool): Resource bounded thread management',27241,27359).
1527 section([12,34],'library(ugraphs): Unweighted Graphs',27361,27571).
1528 section([12,35],'library(url): Analysing and constructing URL',27573,27730).
1529 section([12,36],'library(varnumbers): Utilities for numbered terms',27732,27787).
1530 section([13],'HACKERS CORNER',27789,28394).
1531 section([13,1],'Examining the Environment Stack',27799,27932).
1532 section([13,2],'Ancestral cuts',27934,27943).
1533 section([13,3],'Intercepting the Tracer',27945,28079).
1534 section([13,4],'Breakpoint and watchpoint handling',28081,28168).
1535 section([13,5],'Adding context to errors: prolog_exception_hook',28170,28221).
1536 section([13,6],'Hooks using the exception predicate',28223,28262).
1537 section([13,7],'Hooks for integrating libraries',28264,28325).
1538 section([13,8],'Hooks for loading files',28327,28366).
1539 section([13,9],'Readline Interaction',28368,28394).
1540 section([14],'COMPATIBILITY WITH OTHER PROLOG DIALECTS',28396,28591).
1541 section([14,1],'Some considerations for writing portable code',28476,28591).
1542 section([15],'GLOSSARY OF TERMS',28593,28934).
1543 section([16],'SWI-PROLOG LICENSE CONDITIONS AND TOOLS',28936,29129).
1544 section([16,1],'The SWI-Prolog kernel and foreign libraries',28966,28998).
1545 section([16,1,1],'The SWI-Prolog Prolog libraries',28981,28998).
1546 section([16,2],'Contributing to the SWI-Prolog project',29000,29010).
1547 section([16,3],'Software support to keep track of license conditions',29012,29093).
1548 section([16,4],'License conditions inherited from used code',29095,29129).
1549 section([16,4,1],'Cryptographic routines',29098,29129).
1550 section([17],'SUMMARY',29131,30604).
1551 section([17,1],'Predicates',29134,29941).
1552 section([17,2],'Library predicates',29943,30454).
1553 section([17,2,1],'library(aggregate)',29946,29955).
1554 section([17,2,2],'library(apply)',29957,29977).
1555 section([17,2,3],'library(assoc)',29979,29996).
1556 section([17,2,4],'library(broadcast)',29998,30008).
1557 section([17,2,5],'library(charsio)',30010,30027).
1558 section([17,2,6],'library(check)',30029,30046).
1559 section([17,2,7],'library(csv)',30048,30058).
1560 section([17,2,8],'library(lists)',30060,30098).
1561 section([17,2,9],'library(debug)',30100,30113).
1562 section([17,2,10],'library(iostream)',30115,30116).
1563 section([17,2,11],'library(summaries.d/iostream/tex)',30118,30119).
1564 section([17,2,12],'library(option)',30121,30130).
1565 section([17,2,13],'library(optparse)',30132,30139).
1566 section([17,2,14],'library(ordsets)',30141,30165).
1567 section([17,2,15],'library(persistency)',30167,30174).
1568 section([17,2,16],'library(predicate_options)',30176,30190).
1569 section([17,2,17],'library(prologpack)',30192,30208).
1570 section([17,2,18],'library(prologxref)',30210,30222).
1571 section([17,2,19],'library(pairs)',30224,30232).
1572 section([17,2,20],'library(pio)',30234,30246).
1573 section([17,2,20,1],'library(pure_input)',30237,30246).
1574 section([17,2,21],'library(random)',30248,30265).
1575 section([17,2,22],'library(readutil)',30267,30275).
1576 section([17,2,23],'library(record)',30277,30280).
1577 section([17,2,24],'library(registry)',30282,30294).
1578 section([17,2,25],'library(ugraphs)',30296,30317).
1579 section([17,2,26],'library(url)',30319,30332).
1580 section([17,2,27],'library(www_browser)',30334,30337).
1581 section([17,2,28],'library(clp/clpb)',30339,30345).
1582 section([17,2,29],'library(clp/clpfd)',30347,30396).
1583 section([17,2,30],'library(clpqr)',30398,30410).
1584 section([17,2,31],'library(clp/simplex)',30412,30426).
1585 section([17,2,32],'library(solution_sequences)',30428,30436).
1586 section([17,2,33],'library(thread_pool)',30438,30446).
1587 section([17,2,34],'library(varnumbers)',30448,30454).
1588 section([17,3],'Arithmetic Functions',30456,30537).
1589 section([17,4],'Operators',30539,30604).
1590 section([18],'Bibliography',30606,31905).
1591 section([],'Index',30703,31905).
15871592
15881593
15891594 % Predicate function/3
15901595
1591 function('PL_thread_self',17095,17100).
1592 function('PL_unify_thread_id',17102,17106).
1593 function('PL_thread_attach_engine',17108,17142).
1594 function('PL_thread_destroy_engine',17144,17154).
1595 function('PL_thread_at_exit',17156,17164).
1596 function('PL_create_engine',17193,17202).
1597 function('PL_destroy_engine',17204,17209).
1598 function('PL_set_engine',17211,17231).
1599 function('PL_new_term_ref',17667,17673).
1600 function('PL_new_term_refs',17675,17690).
1601 function('PL_copy_term_ref',17692,17696).
1602 function('PL_reset_term_refs',17698,17708).
1603 function('PL_succeed',17785,17787).
1604 function('PL_fail',17789,17792).
1605 function('PL_retry',17843,17852).
1606 function('PL_retry_address',17854,17858).
1607 function('PL_foreign_control',17860,17865).
1608 function('PL_foreign_context',17867,17872).
1609 function('PL_foreign_context_address',17874,17914).
1610 function('PL_new_atom',17922,17931).
1611 function('PL_atom_chars',17946,17954).
1612 function('PL_new_functor',17956,17959).
1613 function('PL_functor_name',17961,17963).
1614 function('PL_functor_arity',17965,17967).
1615 function('PL_register_atom',17982,17986).
1616 function('PL_unregister_atom',17988,18003).
1617 function('PL_term_type',18021,18069).
1618 function('PL_is_variable',18071,18073).
1619 function('PL_is_ground',18075,18078).
1620 function('PL_is_atom',18080,18082).
1621 function('PL_is_string',18084,18086).
1622 function('PL_is_integer',18088,18090).
1623 function('PL_is_float',18092,18094).
1624 function('PL_is_callable',18096,18099).
1625 function('PL_is_compound',18101,18103).
1626 function('PL_is_functor',18105,18109).
1627 function('PL_is_list',18111,18115).
1628 function('PL_is_pair',18117,18120).
1629 function('PL_is_atomic',18122,18124).
1630 function('PL_is_number',18126,18128).
1631 function('PL_is_acyclic',18130,18132).
1632 function('PL_get_atom',18141,18148).
1633 function('PL_get_atom_chars',18150,18155).
1634 function('PL_get_string_chars',18157,18163).
1635 function('PL_get_chars',18165,18247).
1636 function('PL_get_list_chars',18249,18252).
1637 function('PL_get_integer',18254,18258).
1638 function('PL_get_long',18260,18266).
1639 function('PL_get_int64',18268,18273).
1640 function('PL_get_intptr',18275,18280).
1641 function('PL_get_bool',18282,18285).
1642 function('PL_get_pointer',18287,18293).
1643 function('PL_get_float',18295,18297).
1644 function('PL_get_functor',18299,18303).
1645 function('PL_get_name_arity',18305,18309).
1646 function('PL_get_compound_name_arity',18311,18315).
1647 function('PL_get_module',18317,18321).
1648 function('PL_get_arg',18323,18326).
1649 function('_PL_get_arg',18328,18331).
1650 function('PL_get_atom_nchars',18342,18344).
1651 function('PL_get_list_nchars',18346,18348).
1652 function('PL_get_nchars',18350,18352).
1653 function('PL_put_atom_nchars',18354,18356).
1654 function('PL_put_string_nchars',18358,18360).
1655 function('PL_put_list_ncodes',18362,18364).
1656 function('PL_put_list_nchars',18366,18368).
1657 function('PL_unify_atom_nchars',18370,18372).
1658 function('PL_unify_string_nchars',18374,18376).
1659 function('PL_unify_list_ncodes',18378,18380).
1660 function('PL_unify_list_nchars',18382,18387).
1661 function('PL_new_atom_nchars',18389,18393).
1662 function('PL_atom_nchars',18395,18397).
1663 function('PL_new_atom_wchars',18412,18417).
1664 function('PL_atom_wchars',18419,18425).
1665 function('PL_get_wchars',18427,18430).
1666 function('PL_unify_wchars',18432,18436).
1667 function('PL_unify_wchars_diff',18438,18446).
1668 function('PL_get_list',18478,18481).
1669 function('PL_get_head',18483,18486).
1670 function('PL_get_tail',18488,18491).
1671 function('PL_get_nil',18493,18495).
1672 function('PL_skip_list',18497,18524).
1673 function('PL_put_variable',18592,18595).
1674 function('PL_put_atom',18597,18600).
1675 function('PL_put_bool',18602,18605).
1676 function('PL_put_atom_chars',18607,18611).
1677 function('PL_put_string_chars',18613,18616).
1678 function('PL_put_string_nchars',18618,18622).
1679 function('PL_put_list_chars',18624,18626).
1680 function('PL_put_integer',18628,18630).
1681 function('PL_put_int64',18632,18634).
1682 function('PL_put_pointer',18636,18639).
1683 function('PL_put_float',18641,18643).
1684 function('PL_put_functor',18645,18650).
1685 function('PL_put_list',18652,18657).
1686 function('PL_put_nil',18659,18664).
1687 function('PL_put_term',18666,18668).
1688 function('PL_cons_functor',18670,18695).
1689 function('PL_cons_functor_v',18697,18702).
1690 function('PL_cons_list',18704,18726).
1691 function('PL_unify',18776,18808).
1692 function('PL_unify_atom',18810,18812).
1693 function('PL_unify_bool',18814,18816).
1694 function('PL_unify_chars',18818,18831).
1695 function('PL_unify_atom_chars',18833,18836).
1696 function('PL_unify_list_chars',18838,18840).
1697 function('PL_unify_string_chars',18842,18846).
1698 function('PL_unify_string_nchars',18848,18852).
1699 function('PL_unify_integer',18854,18856).
1700 function('PL_unify_int64',18858,18860).
1701 function('PL_unify_float',18862,18864).
1702 function('PL_unify_pointer',18866,18869).
1703 function('PL_unify_functor',18871,18877).
1704 function('PL_unify_compound',18879,18885).
1705 function('PL_unify_list',18887,18918).
1706 function('PL_unify_nil',18920,18922).
1707 function('PL_unify_arg',18924,18926).
1708 function('PL_unify_term',18928,19079).
1709 function('PL_chars_to_term',19081,19112).
1710 function('PL_wchars_to_term',19114,19116).
1711 function('PL_quote',19118,19127).
1712 function('PL_get_atom_ex',19159,19162).
1713 function('PL_get_integer_ex',19164,19168).
1714 function('PL_get_long_ex',19170,19174).
1715 function('PL_get_int64_ex',19176,19180).
1716 function('PL_get_intptr_ex',19182,19186).
1717 function('PL_get_size_ex',19188,19192).
1718 function('PL_get_bool_ex',19194,19197).
1719 function('PL_get_float_ex',19199,19202).
1720 function('PL_get_char_ex',19204,19208).
1721 function('PL_get_pointer_ex',19210,19213).
1722 function('PL_get_list_ex',19215,19218).
1723 function('PL_get_nil_ex',19220,19223).
1724 function('PL_unify_list_ex',19225,19228).
1725 function('PL_unify_nil_ex',19230,19233).
1726 function('PL_unify_bool_ex',19235,19245).
1727 function('PL_instantiation_error',19247,19251).
1728 function('PL_uninstantiation_error',19253,19258).
1729 function('PL_representation_error',19260,19262).
1730 function('PL_type_error',19264,19266).
1731 function('PL_domain_error',19268,19270).
1732 function('PL_existence_error',19272,19274).
1733 function('PL_permission_error',19276,19279).
1734 function('PL_resource_error',19281,19283).
1735 function('PL_syntax_error',19285,19288).
1736 function('PL_unregister_blob_type',19391,19399).
1737 function('PL_is_blob',19409,19412).
1738 function('PL_unify_blob',19414,19417).
1739 function('PL_put_blob',19419,19427).
1740 function('PL_get_blob',19429,19433).
1741 function('PL_blob_data',19435,19439).
1742 function('PL_get_mpz',19499,19505).
1743 function('PL_get_mpq',19507,19514).
1744 function('PL_unify_mpz',19516,19519).
1745 function('PL_unify_mpq',19521,19525).
1746 function('PL_pred',19548,19553).
1747 function('PL_predicate',19555,19558).
1748 function('PL_predicate_info',19560,19567).
1749 function('PL_open_query',19581,19644).
1750 function('PL_next_solution',19646,19651).
1751 function('PL_cut_query',19653,19657).
1752 function('PL_close_query',19659,19662).
1753 function('PL_call_predicate',19664,19668).
1754 function('PL_call',19670,19676).
1755 function('PL_open_foreign_frame',19687,19693).
1756 function('PL_close_foreign_frame',19695,19699).
1757 function('PL_discard_foreign_frame',19701,19704).
1758 function('PL_rewind_foreign_frame',19706,19738).
1759 function('PL_context',19746,19749).
1760 function('PL_strip_module',19751,19771).
1761 function('PL_module_name',19773,19775).
1762 function('PL_new_module',19777,19779).
1763 function('PL_raise_exception',19856,19883).
1764 function('PL_throw',19885,19888).
1765 function('PL_exception',19890,19902).
1766 function('PL_clear_exception',19904,19908).
1767 function('PL_signal',19923,19949).
1768 function('PL_raise',19951,19955).
1769 function('PL_handle_signals',19957,19968).
1770 function('PL_get_signum_ex',19970,19976).
1771 function('PL_compare',19984,19987).
1772 function('PL_same_compound',19989,19992).
1773 function('PL_record',20012,20017).
1774 function('PL_recorded',20019,20025).
1775 function('PL_erase',20027,20062).
1776 function('PL_record_external',20064,20076).
1777 function('PL_recorded_external',20078,20082).
1778 function('PL_erase_external',20084,20087).
1779 function('PL_get_file_name',20097,20130).
1780 function('PL_get_file_nameW',20132,20138).
1781 function('PL_set_prolog_flag',20146,20165).
1782 function('PL_warning',20175,20180).
1783 function('PL_action',20185,20243).
1784 function('PL_backtrace',20245,20267).
1785 function('PL_query',20272,20306).
1786 function('PL_register_foreign_in_module',20311,20384).
1787 function('PL_register_foreign',20386,20389).
1788 function('PL_register_extensions_in_module',20391,20427).
1789 function('PL_register_extensions',20429,20432).
1790 function('PL_dispatch_hook',20439,20449).
1791 function('PL_abort_hook',20451,20460).
1792 function('PL_abort_unhook',20462,20465).
1793 function('PL_on_halt',20467,20475).
1794 function('PL_exit_hook',20477,20480).
1795 function('PL_agc_hook',20482,20519).
1796 function('PL_initialise',20750,20806).
1797 function('PL_is_initialised',20808,20814).
1798 function('PL_install_readline',20816,20821).
1799 function('PL_toplevel',20823,20826).
1800 function('PL_cleanup',20828,20852).
1801 function('PL_cleanup_fork',20854,20867).
1802 function('PL_halt',20869,20873).
1803 function('PL_malloc',21251,21256).
1804 function('PL_realloc',21258,21262).
1805 function('PL_free',21264,21267).
1806 function('PL_malloc_atomic',21279,21280).
1807 function('PL_malloc_uncollectable',21282,21283).
1808 function('PL_malloc_atomic_uncollectable',21285,21291).
1809 function('PL_malloc_stubborn',21293,21294).
1810 function('PL_end_stubborn_change',21296,21299).
1811 function('PL_license',28958,28961).
1596 function('PL_thread_self',17168,17173).
1597 function('PL_unify_thread_id',17175,17179).
1598 function('PL_thread_attach_engine',17181,17215).
1599 function('PL_thread_destroy_engine',17217,17227).
1600 function('PL_thread_at_exit',17229,17237).
1601 function('PL_create_engine',17266,17275).
1602 function('PL_destroy_engine',17277,17282).
1603 function('PL_set_engine',17284,17304).
1604 function('PL_new_term_ref',17740,17746).
1605 function('PL_new_term_refs',17748,17763).
1606 function('PL_copy_term_ref',17765,17769).
1607 function('PL_reset_term_refs',17771,17781).
1608 function('PL_succeed',17858,17860).
1609 function('PL_fail',17862,17865).
1610 function('PL_retry',17916,17925).
1611 function('PL_retry_address',17927,17931).
1612 function('PL_foreign_control',17933,17938).
1613 function('PL_foreign_context',17940,17945).
1614 function('PL_foreign_context_address',17947,17949).
1615 function('PL_foreign_context_predicate',17951,17996).
1616 function('PL_new_atom',18004,18013).
1617 function('PL_atom_chars',18028,18036).
1618 function('PL_new_functor',18038,18041).
1619 function('PL_functor_name',18043,18045).
1620 function('PL_functor_arity',18047,18049).
1621 function('PL_register_atom',18064,18068).
1622 function('PL_unregister_atom',18070,18085).
1623 function('PL_term_type',18103,18151).
1624 function('PL_is_variable',18153,18155).
1625 function('PL_is_ground',18157,18160).
1626 function('PL_is_atom',18162,18164).
1627 function('PL_is_string',18166,18168).
1628 function('PL_is_integer',18170,18172).
1629 function('PL_is_float',18174,18176).
1630 function('PL_is_callable',18178,18181).
1631 function('PL_is_compound',18183,18185).
1632 function('PL_is_functor',18187,18191).
1633 function('PL_is_list',18193,18197).
1634 function('PL_is_pair',18199,18202).
1635 function('PL_is_atomic',18204,18206).
1636 function('PL_is_number',18208,18210).
1637 function('PL_is_acyclic',18212,18214).
1638 function('PL_get_atom',18223,18230).
1639 function('PL_get_atom_chars',18232,18237).
1640 function('PL_get_string_chars',18239,18245).
1641 function('PL_get_chars',18247,18329).
1642 function('PL_get_list_chars',18331,18334).
1643 function('PL_get_integer',18336,18340).
1644 function('PL_get_long',18342,18348).
1645 function('PL_get_int64',18350,18355).
1646 function('PL_get_intptr',18357,18362).
1647 function('PL_get_bool',18364,18367).
1648 function('PL_get_pointer',18369,18375).
1649 function('PL_get_float',18377,18379).
1650 function('PL_get_functor',18381,18385).
1651 function('PL_get_name_arity',18387,18391).
1652 function('PL_get_compound_name_arity',18393,18397).
1653 function('PL_get_module',18399,18403).
1654 function('PL_get_arg',18405,18408).
1655 function('_PL_get_arg',18410,18413).
1656 function('PL_get_atom_nchars',18424,18426).
1657 function('PL_get_list_nchars',18428,18430).
1658 function('PL_get_nchars',18432,18434).
1659 function('PL_put_atom_nchars',18436,18438).
1660 function('PL_put_string_nchars',18440,18442).
1661 function('PL_put_list_ncodes',18444,18446).
1662 function('PL_put_list_nchars',18448,18450).
1663 function('PL_unify_atom_nchars',18452,18454).
1664 function('PL_unify_string_nchars',18456,18458).
1665 function('PL_unify_list_ncodes',18460,18462).
1666 function('PL_unify_list_nchars',18464,18469).
1667 function('PL_new_atom_nchars',18471,18475).
1668 function('PL_atom_nchars',18477,18479).
1669 function('PL_new_atom_wchars',18494,18499).
1670 function('PL_atom_wchars',18501,18507).
1671 function('PL_get_wchars',18509,18512).
1672 function('PL_unify_wchars',18514,18518).
1673 function('PL_unify_wchars_diff',18520,18528).
1674 function('PL_get_list',18560,18563).
1675 function('PL_get_head',18565,18568).
1676 function('PL_get_tail',18570,18573).
1677 function('PL_get_nil',18575,18577).
1678 function('PL_skip_list',18579,18606).
1679 function('PL_put_variable',18674,18677).
1680 function('PL_put_atom',18679,18682).
1681 function('PL_put_bool',18684,18687).
1682 function('PL_put_atom_chars',18689,18693).
1683 function('PL_put_string_chars',18695,18698).
1684 function('PL_put_string_nchars',18700,18704).
1685 function('PL_put_list_chars',18706,18708).
1686 function('PL_put_integer',18710,18712).
1687 function('PL_put_int64',18714,18716).
1688 function('PL_put_pointer',18718,18721).
1689 function('PL_put_float',18723,18725).
1690 function('PL_put_functor',18727,18732).
1691 function('PL_put_list',18734,18739).
1692 function('PL_put_nil',18741,18746).
1693 function('PL_put_term',18748,18750).
1694 function('PL_cons_functor',18752,18777).
1695 function('PL_cons_functor_v',18779,18784).
1696 function('PL_cons_list',18786,18808).
1697 function('PL_unify',18858,18890).
1698 function('PL_unify_atom',18892,18894).
1699 function('PL_unify_bool',18896,18898).
1700 function('PL_unify_chars',18900,18913).
1701 function('PL_unify_atom_chars',18915,18918).
1702 function('PL_unify_list_chars',18920,18922).
1703 function('PL_unify_string_chars',18924,18928).
1704 function('PL_unify_string_nchars',18930,18934).
1705 function('PL_unify_integer',18936,18938).
1706 function('PL_unify_int64',18940,18942).
1707 function('PL_unify_float',18944,18946).
1708 function('PL_unify_pointer',18948,18951).
1709 function('PL_unify_functor',18953,18959).
1710 function('PL_unify_compound',18961,18967).
1711 function('PL_unify_list',18969,19000).
1712 function('PL_unify_nil',19002,19004).
1713 function('PL_unify_arg',19006,19008).
1714 function('PL_unify_term',19010,19161).
1715 function('PL_chars_to_term',19163,19194).
1716 function('PL_wchars_to_term',19196,19198).
1717 function('PL_quote',19200,19209).
1718 function('PL_get_atom_ex',19241,19244).
1719 function('PL_get_integer_ex',19246,19250).
1720 function('PL_get_long_ex',19252,19256).
1721 function('PL_get_int64_ex',19258,19262).
1722 function('PL_get_intptr_ex',19264,19268).
1723 function('PL_get_size_ex',19270,19274).
1724 function('PL_get_bool_ex',19276,19279).
1725 function('PL_get_float_ex',19281,19284).
1726 function('PL_get_char_ex',19286,19290).
1727 function('PL_get_pointer_ex',19292,19295).
1728 function('PL_get_list_ex',19297,19300).
1729 function('PL_get_nil_ex',19302,19305).
1730 function('PL_unify_list_ex',19307,19310).
1731 function('PL_unify_nil_ex',19312,19315).
1732 function('PL_unify_bool_ex',19317,19327).
1733 function('PL_instantiation_error',19329,19333).
1734 function('PL_uninstantiation_error',19335,19340).
1735 function('PL_representation_error',19342,19344).
1736 function('PL_type_error',19346,19348).
1737 function('PL_domain_error',19350,19352).
1738 function('PL_existence_error',19354,19356).
1739 function('PL_permission_error',19358,19361).
1740 function('PL_resource_error',19363,19365).
1741 function('PL_syntax_error',19367,19370).
1742 function('PL_unregister_blob_type',19473,19481).
1743 function('PL_is_blob',19491,19494).
1744 function('PL_unify_blob',19496,19499).
1745 function('PL_put_blob',19501,19509).
1746 function('PL_get_blob',19511,19515).
1747 function('PL_blob_data',19517,19521).
1748 function('PL_get_mpz',19581,19587).
1749 function('PL_get_mpq',19589,19596).
1750 function('PL_unify_mpz',19598,19601).
1751 function('PL_unify_mpq',19603,19607).
1752 function('PL_pred',19630,19635).
1753 function('PL_predicate',19637,19640).
1754 function('PL_predicate_info',19642,19649).
1755 function('PL_open_query',19663,19726).
1756 function('PL_next_solution',19728,19733).
1757 function('PL_cut_query',19735,19739).
1758 function('PL_close_query',19741,19744).
1759 function('PL_call_predicate',19746,19750).
1760 function('PL_call',19752,19758).
1761 function('PL_open_foreign_frame',19769,19775).
1762 function('PL_close_foreign_frame',19777,19781).
1763 function('PL_discard_foreign_frame',19783,19786).
1764 function('PL_rewind_foreign_frame',19788,19820).
1765 function('PL_context',19828,19831).
1766 function('PL_strip_module',19833,19853).
1767 function('PL_module_name',19855,19857).
1768 function('PL_new_module',19859,19861).
1769 function('PL_raise_exception',19938,19965).
1770 function('PL_throw',19967,19970).
1771 function('PL_exception',19972,19984).
1772 function('PL_clear_exception',19986,19990).
1773 function('PL_signal',20005,20031).
1774 function('PL_raise',20033,20037).
1775 function('PL_handle_signals',20039,20050).
1776 function('PL_get_signum_ex',20052,20058).
1777 function('PL_compare',20066,20069).
1778 function('PL_same_compound',20071,20074).
1779 function('PL_record',20094,20099).
1780 function('PL_recorded',20101,20107).
1781 function('PL_erase',20109,20144).
1782 function('PL_record_external',20146,20158).
1783 function('PL_recorded_external',20160,20164).
1784 function('PL_erase_external',20166,20169).
1785 function('PL_get_file_name',20179,20212).
1786 function('PL_get_file_nameW',20214,20220).
1787 function('PL_set_prolog_flag',20228,20247).
1788 function('PL_warning',20257,20262).
1789 function('PL_action',20267,20325).
1790 function('PL_backtrace',20327,20349).
1791 function('PL_query',20354,20388).
1792 function('PL_register_foreign_in_module',20393,20466).
1793 function('PL_register_foreign',20468,20471).
1794 function('PL_register_extensions_in_module',20473,20509).
1795 function('PL_register_extensions',20511,20514).
1796 function('PL_dispatch_hook',20521,20531).
1797 function('PL_abort_hook',20533,20542).
1798 function('PL_abort_unhook',20544,20547).
1799 function('PL_on_halt',20549,20557).
1800 function('PL_exit_hook',20559,20562).
1801 function('PL_agc_hook',20564,20601).
1802 function('PL_initialise',20832,20888).
1803 function('PL_is_initialised',20890,20896).
1804 function('PL_install_readline',20898,20903).
1805 function('PL_toplevel',20905,20908).
1806 function('PL_cleanup',20910,20934).
1807 function('PL_cleanup_fork',20936,20949).
1808 function('PL_halt',20951,20955).
1809 function('PL_malloc',21333,21338).
1810 function('PL_realloc',21340,21344).
1811 function('PL_free',21346,21349).
1812 function('PL_malloc_atomic',21361,21362).
1813 function('PL_malloc_uncollectable',21364,21365).
1814 function('PL_malloc_atomic_uncollectable',21367,21373).
1815 function('PL_malloc_stubborn',21375,21376).
1816 function('PL_end_stubborn_change',21378,21381).
1817 function('PL_license',29090,29093).
18121818
18131819
770770 inc_indent(Indent0, Inc, Indent) :-
771771 Indent is Indent0 + Inc*4.
772772
773 :- multifile
774 sandbox:safe_meta/2.
775
776 sandbox:safe_meta(listing(What), []) :-
777 not_qualified(What).
778
779 not_qualified(Var) :-
780 var(Var), !.
781 not_qualified(_:_) :- !, fail.
782 not_qualified(_).
332332 output_functor(atom),
333333 suppress_empty_meta(boolean)
334334 ]).
335
336 :- multifile
337 error:has_type/2,
338 parse_type/3.
335339
336340 %% opt_arguments(+OptsSpec, -Opts, -PositionalArgs) is det
337341 %
689693 context(validate_opts_spec/1, Msg)))
690694
691695 %invalid if unknown type
692 ; (memberchk(type(Type), OptSpec),
693 \+ member(Type, [boolean,integer,float,atom,term]))
696 ; ( memberchk(type(Type), OptSpec),
697 \+ clause(error:has_type(Type,_), _)
698 )
694699 -> format(atom(Msg), 'unknown type ''~w'' in option ''~w''', [Type, Name]),
695700 throw(error(type_error(flag_value, Type),
696701 context(validate_opts_spec/1, Msg)))
875880 atom_codes(A, Cs),
876881 term_to_atom(Result, A),
877882 !.
883 parse_loc(Type, Cs, Result) :-
884 parse_type(Type, Cs, Result), !.
878885 parse_loc(Type, _Cs, _) :- %could not parse Cs as Type
879886 throw(error(type_error(flag_value, Type), _)), !. %}}}
880887 %}}}
881888
882
889 %% parse_type(+Type, +Codes:list(code), -Result) is semidet.
890 %
891 % Hook to parse option text Codes to an object of type Type.
883892
884893 partition_args_([], [], []).
885894 partition_args_([opt(K,V)|Rest], [opt(K,V)|RestOpts], RestPos) :-
0 /* $Id$
1
2 Part of SWI-Prolog
0 /* Part of SWI-Prolog
31
42 Author: Jan Wielemaker and Anjo Anjewierden
53 E-mail: J.Wielemaker@vu.nl
64 WWW: http://www.swi-prolog.org/
7 Copyright (C): 1985-2011, University of Amsterdam
5 Copyright (C): 2011-2015, University of Amsterdam
86 VU University Amsterdam
97
108 This program is free software; you can redistribute it and/or
3129
3230 :- module(prolog_breakpoints,
3331 [ set_breakpoint/4, % +File, +Line, +CharPos, -Id
32 set_breakpoint/5, % +Owner, +File, +Line, +CharPos, -Id
3433 delete_breakpoint/1, % +Id
3534 breakpoint_property/2 % ?Id, ?Property
3635 ]).
5958 user:prolog_event_hook/1.
6059
6160 %% set_breakpoint(+File, +Line, +Char, -Id) is det.
61 %% set_breakpoint(+Owner, +File, +Line, +Char, -Id) is det.
6262 %
6363 % Put a breakpoint at the indicated source-location. File is a
6464 % current sourcefile (as reported by source_file/1). Line is the
6565 % 1-based line in which Char is. Char is the position of the
6666 % break.
6767 %
68 % First, '$clause_from_source'/3 uses the SWI-Prolog clause-source
68 % First, '$clause_from_source'/4 uses the SWI-Prolog clause-source
6969 % information to find the last clause starting before Line.
7070 % '$break_pc' generated (on backtracking), a list of possible
7171 % break-points.
7575 % different ways this may be done. See debug/0, tdebug/0 and
7676 % tdebug/1. Therefore, this predicate does *not* enable debug
7777 % mode.
78 %
79 % @arg Owner denotes the file that _owns_ the clause.
80 % set_breakpoint/5 is used to set breakpoints in an included file
81 % in the context of the Owner main file. See
82 % source_file_property/2.
7883
7984 set_breakpoint(File, Line, Char, Id) :-
85 set_breakpoint(File, File, Line, Char, Id).
86 set_breakpoint(Owner, File, Line, Char, Id) :-
8087 debug(break, 'break_at(~q, ~d, ~d).', [File, Line, Char]),
81 '$clause_from_source'(File, Line, ClauseRef),
88 '$clause_from_source'(Owner, File, Line, ClauseRef),
8289 clause_info(ClauseRef, InfoFile, TermPos, _NameOffset),
8390 ( InfoFile == File
8491 -> '$break_pc'(ClauseRef, PC, NextPC),
439439 pack_default_options(Dir, Pack, _, Options) :- % Install from directory
440440 exists_directory(Dir),
441441 pack_info_term(Dir, name(Pack)), !,
442 pack_info_term(Dir, version(Version)),
443 uri_file_name(DirURL, Dir),
444 Options = [url(DirURL), version(Version)].
442 ( pack_info_term(Dir, version(Version))
443 -> uri_file_name(DirURL, Dir),
444 Options = [url(DirURL), version(Version)]
445 ; throw(error(existence_error(key, version, Dir),_))
446 ).
445447 pack_default_options(URL, Pack, _, Options) :- % Install from URL
446448 pack_version_file(Pack, Version, URL),
447449 download_url(URL), !,
15441546 inquiry_result(Reply, File, Options) :-
15451547 findall(Eval, eval_inquiry(Reply, File, Eval, Options), Evaluation),
15461548 \+ member(cancel, Evaluation),
1549 select_option(git(_), Options, Options1, _),
15471550 forall(member(install_dependencies(Resolution), Evaluation),
1548 maplist(install_dependency(Options), Resolution)).
1551 maplist(install_dependency(Options1), Resolution)).
15491552
15501553 eval_inquiry(true(Reply), URL, Eval, _) :-
15511554 include(alt_hash, Reply, Alts),
647647 build_alias_cache :-
648648 findall(t(DirLen, AliasLen, Alias, Dir),
649649 search_path(Alias, Dir, AliasLen, DirLen), Ts),
650 sort(Ts, List0),
651 reverse(List0, List),
650 sort(0, >, Ts, List),
652651 forall(member(t(_, _, Alias, Dir), List),
653652 assert(alias_cache(Alias, Dir))).
654653
741741
742742 pi_to_head(PI, Src, Head) :-
743743 pi_to_head(PI, Head0),
744 strip_module(Head0, M, Plain),
745 ( xmodule(M, Src)
746 -> Head = Plain
747 ; Head = M:Plain
748 ).
749
744 ( Head0 = _:_
745 -> strip_module(Head0, M, Plain),
746 ( xmodule(M, Src)
747 -> Head = Plain
748 ; Head = M:Plain
749 )
750 ; Head = Head0
751 ).
750752 :- endif.
751753
752754 %% xref_comment(?Source, ?Title, ?Comment) is nondet.
10241026 xref_meta(call_cleanup(A, _, B),[A, B]).
10251027 xref_meta(setup_call_cleanup(A, B, C),[A, B, C]).
10261028 xref_meta(setup_call_catcher_cleanup(A, B, _, C),[A, B, C]).
1029 xref_meta(call_residue_vars(A,_), [A]).
10271030 xref_meta(with_mutex(_,A), [A]).
10281031 xref_meta(assume(G), [G]). % library(debug)
10291032 xref_meta(assertion(G), [G]). % library(debug)
413413 attrib_name(built_in, system, 1).
414414 attrib_name(nodebug, hide_childs, 1).
415415 attrib_name(quasi_quotation_syntax, quasi_quotation_syntax, 1).
416 attrib_name(iso, iso, 1).
416417
417418
418419 save_attribute(P, Attribute) :-
0 /* $Id$
1
2 Part of SWI-Prolog
0 /* Part of SWI-Prolog
31
42 Author: Jan Wielemaker
53 E-mail: J.Wielemaker@uva.nl
64 WWW: http://www.swi-prolog.org
7 Copyright (C): 1985-2008, University of Amsterdam
5 Copyright (C): 1985-2015, University of Amsterdam
6 VU University Amsterdam
87
98 This program is free software; you can redistribute it and/or
109 modify it under the terms of the GNU General Public License
181180 % Generalised version of ISO arg/3. SWI-Prolog's arg/3 is already
182181 % genarg/3.
183182
184 genarg(N, T, A) :- % SWI-Prolog arg/3 is generic
183 genarg(N, T, A) :-
185184 arg(N, T, A).
186185
187186
252251 * DIRECTIVES *
253252 *********************************/
254253
255 % :- op(1150, fx, [(mode)]).
254 %% mode(+ModeDecl) is det.
255 %
256 % Ignore a DEC10/Quintus `:- mode(Head)` declaration. Typically
257 % these declarations are written in operator form. The operator
258 % declaration is not part of the Quintus emulation library. The
259 % following declaration is compatible with Quintus:
260 %
261 % ==
262 % :- op(1150, fx, [(mode)]).
263 % ==
256264
257265 mode(_).
258266
298306 stream_mode(update, write).
299307
300308 %% stream_position(+Stream, -Old, +New)
309 %
310 % True when Old is the current position in Stream and the stream
311 % has been repositioned to New.
312 %
313 % @deprecated New code should use the ISO predicates
314 % stream_property/2 and set_stream_position/2.
301315
302316 stream_position(Stream, Old, New) :-
303317 stream_property(Stream, position(Old)),
369369 verify_safe_declaration(Module:Goal) :-
370370 must_be(atom, Module),
371371 must_be(callable, Goal),
372 ( ( predicate_property(Module:Goal, visible)
372 ( ok_meta(Module:Goal)
373 -> true
374 ; ( predicate_property(Module:Goal, visible)
373375 -> true
374376 ; predicate_property(Module:Goal, foreign)
375377 ),
385387 -> true
386388 ; permission_error(declare, safe_goal, Goal)
387389 ).
390
391 ok_meta(system:assert(_)).
392 ok_meta(system:use_module(_,_)).
393 ok_meta(system:use_module(_)).
388394
389395 verify_predefined_safe_declarations :-
390396 forall(clause(safe_primitive(Goal), _Body, Ref),
451457 % unification and equivalence
452458 safe_primitive(=(_,_)).
453459 safe_primitive(\=(_,_)).
460 safe_primitive(system:'?='(_,_)).
454461 safe_primitive(system:unifiable(_,_,_)).
455462 safe_primitive(unify_with_occurs_check(_,_)).
456463 safe_primitive(\==(_,_)).
526533 safe_primitive(system:atomics_to_string(_,_)).
527534 safe_primitive(system:string_concat(_,_,_)).
528535 safe_primitive(system:string_length(_,_)).
536 safe_primitive(system:string_lower(_,_)).
537 safe_primitive(system:string_upper(_,_)).
529538 safe_primitive(system:term_string(_,_)).
530539 % Lists
531540 safe_primitive(length(_,_)).
556565 safe_primitive(system:strip_module(_,_,_)).
557566 safe_primitive('$messages':message_to_string(_,_)).
558567 safe_primitive(system:import_module(_,_)).
568 safe_primitive(system:file_base_name(_,_)).
569 safe_primitive(system:file_directory_name(_,_)).
570 safe_primitive(system:file_name_extension(_,_,_)).
559571
560572 safe_primitive(clause(H,_)) :- safe_clause(H).
561573 safe_primitive(asserta(X)) :- safe_assert(X).
567579 % target key before we can conclude that functions on dicts
568580 % are safe.
569581 safe_primitive('$dicts':'.'(_,K,_)) :- atom(K).
582 safe_primitive('$dicts':'.'(_,K,_)) :-
583 nonvar(K),
584 dict_built_in(K).
585
586 dict_built_in(get(_)).
587 dict_built_in(put(_)).
588 dict_built_in(put(_,_)).
570589
571590 % The non-ISO system predicates. These can be redefined, so we must
572591 % be careful to ensure the system ones are used.
841860 safe_meta(system:call_cleanup(0,0)).
842861 safe_meta(system:setup_call_cleanup(0,0,0)).
843862 safe_meta(system:setup_call_catcher_cleanup(0,0,*,0)).
844 safe_meta(system:call_residue_vars(0,*)).
863 safe_meta('$attvar':call_residue_vars(0,*)).
845864 safe_meta(system:call_with_inference_limit(0,*,*)).
846865 safe_meta(system:call_with_depth_limit(0,*,*)).
847866 safe_meta(^(*,0)).
275275 * PARSING *
276276 *******************************/
277277
278 %% parse_url(+URL, -Attributes) is det.
278 %% parse_url(?URL, ?Attributes) is det.
279279 %
280280 % Construct or analyse a URL. URL is an atom holding a URL or a
281281 % variable. Attributes is a list of components. Each component is
0 /* $Id$
1
2 Part of SWI-Prolog
0 /* Part of SWI-Prolog
31
42 Author: Jan Wielemaker
53 E-mail: J.Wielemaker@cs.vu.nl
64 WWW: http://www.swi-prolog.org
7 Copyright (C): 1985-2011, University of Amsterdam
5 Copyright (C): 1985-2015, University of Amsterdam
86 VU University Amsterdam
97
108 This program is free software; you can redistribute it and/or
3432 expand_url_path/2 % +Spec, -URL
3533 ]).
3634 :- use_module(library(lists)).
37 :- use_module(library(readutil)).
35 :- if(exists_source(library(process))).
36 :- use_module(library(process)).
37 :- endif.
3838
3939 :- multifile
4040 known_browser/2.
4141
42 /** <module> Open a URL in the users browser
43
44 This library deals with the highly platform specific task of opening a
45 web page. In addition, is provides a mechanism similar to
46 absolute_file_name/3 that expands compound terms to concrete URLs. For
47 example, the SWI-Prolog home page can be opened using:
48
49 ==
50 ?- www_open_url(swipl(.)).
51 ==
52 */
53
4254 %% www_open_url(+Url)
4355 %
4456 % Open URL in running version of the users' browser or start a new
4557 % browser. This predicate tries the following steps:
4658 %
4759 % 1. If a prolog flag (see set_prolog_flag/2) =browser= is set
48 % or the environment =BROWSER= and this is the name of a known
49 % executable, use this. This uses www_open_url/2.
60 % and this is the name of a known executable, use this.
5061 %
5162 % 2. On Windows, use win_shell(open, URL)
5263 %
53 % 3. Find a generic `open' comment. Candidates are =open=,
54 % =|gnome-open|=, =kfmclient=.
55 %
56 % 4. Try to find a known browser.
64 % 3. Find a generic `open' comment. Candidates are =xdg-open=,
65 % =open= or =|gnome-open|=.
66 %
67 % 4. If a environment variable =BROWSER= is set
68 % and this is the name of a known executable, use this.
69 %
70 % 5. Try to find a known browser.
5771 %
5872 % @tbd Figure out the right tool in step 3 as it is not
5973 % uncommon that multiple are installed.
6074
6175 www_open_url(Spec) :- % user configured
62 ( current_prolog_flag(browser, Browser)
63 ; getenv('BROWSER', Browser)
64 ),
76 expand_url_path(Spec, URL),
77 open_url(URL).
78
79 open_url(URL) :-
80 current_prolog_flag(browser, Browser),
6581 has_command(Browser), !,
66 expand_url_path(Spec, URL),
67 www_open_url(Browser, URL).
82 run_browser(Browser, URL).
6883 :- if(current_predicate(win_shell/2)).
69 www_open_url(Spec) :- % Windows shell
70 expand_url_path(Spec, URL),
84 open_url(URL) :- % Windows shell
7185 win_shell(open, URL).
7286 :- endif.
73 www_open_url(Spec) :- % Unix `open document'
87 open_url(URL) :- % Unix `open document'
7488 open_command(Open),
7589 has_command(Open), !,
76 expand_url_path(Spec, URL),
77 format(string(Cmd), '~w "~w"', [Open, URL]),
78 shell(Cmd).
79 www_open_url(Spec) :- % KDE client
80 has_command(kfmclient), !,
81 expand_url_path(Spec, URL),
82 format(string(Cmd), 'kfmclient openURL "~w"', [URL]),
83 shell(Cmd).
84 www_open_url(Spec) :- % something we know
90 run_command(Open, [URL], fg).
91 open_url(URL) :- % user configured
92 getenv('BROWSER', Browser),
93 has_command(Browser), !,
94 run_browser(Browser, URL).
95 open_url(URL) :- % something we know
8596 known_browser(Browser, _),
8697 has_command(Browser), !,
87 expand_url_path(Spec, URL),
88 www_open_url(Browser, URL).
89
90 open_command('gnome-open').
91 open_command(open).
92 open_command('xdg-open').
93
94 %% www_open_url(+Browser, +URL) is det.
95 %
96 % Open a page using a browser. Preferably we use an existing
97 % browser to to the job. Currently only supports browsers with a
98 % netscape compatible remote interface.
99 %
100 % @see http://www.mozilla.org/unix/remote.html
101
102 www_open_url(Browser, URL) :-
103 compatible(Browser, netscape),
104 netscape_remote(Browser, 'ping()', []), !,
105 netscape_remote(Browser, 'openURL(~w,new-window)', [URL]).
106 www_open_url(Browser, URL) :-
107 format(string(Cmd), '"~w" "~w" &', [Browser, URL]),
108 shell(Cmd).
109
110 %% netscape_remote(+Browser, +Format, +Args) is semidet.
111 %
112 % Execute netscape remote command using =|-remote|=. Create the
113 % remote command using format/3 from Format and Args.
114 %
115 % @bug At least firefox gives always 0 exit code on -remote,
116 % so we must check the error message. Grrrr.
117
118 netscape_remote(Browser, Fmt, Args) :-
119 format(string(RCmd), Fmt, Args),
120 format(string(Cmd), '"~w" -remote "~w" 2>&1', [Browser, RCmd]),
121 open(pipe(Cmd), read, In),
122 call_cleanup(read_stream_to_codes(In, Codes),
123 close(In)),
124 ( phrase(netscape_error, Codes, _)
125 -> !, fail
126 ; true
127 ).
128
129 netscape_error -->
130 "Error:".
131
132 compatible(Browser, With) :-
133 file_base_name(Browser, Base),
134 known_browser(Base, With).
98 run_browser(Browser, URL).
99
100 open_command(open) :- % Apples open command
101 current_prolog_flag(apple, true).
102 open_command('xdg-open'). % Free desktop
103 open_command('gnome-open'). % Gnome (deprecated in favour of xdg-open
104 open_command(open). % Who knows
105
106 %% run_browser(+Browser, +URL) is det.
107 %
108 % Open a page using a browser.
109
110 run_browser(Browser, URL) :-
111 run_command(Browser, [URL], bg).
112
113 %% run_command(+Command, +Args, +Background)
114 %
115 % Run OS command Command using Args, silencing the error output
116 % because many browsers are rather verbose.
117
118 :- if(current_predicate(process_create/3)).
119 run_command(Command, Args, fg) :- !,
120 process_create(path(Command), Args, [stderr(null)]).
121 :- endif.
122 :- if(current_prolog_flag(unix, true)).
123 run_command(Command, [Arg], fg) :-
124 format(string(Cmd), "\"~w\" \"~w\" &> /dev/null", [Command, Arg]),
125 shell(Cmd).
126 run_command(Command, [Arg], bg) :-
127 format(string(Cmd), "\"~w\" \"~w\" &> /dev/null &", [Command, Arg]),
128 shell(Cmd).
129 :- else.
130 run_command(Command, [Arg], fg) :-
131 format(string(Cmd), "\"~w\" \"~w\"", [Command, Arg]),
132 shell(Cmd).
133 run_command(Command, [Arg], bg) :-
134 format(string(Cmd), "\"~w\" \"~w\" &", [Command, Arg]),
135 shell(Cmd).
136 :- endif.
135137
136138 %% known_browser(+FileBaseName, -Compatible)
137139 %
193195 id=q6R3Q3B-VC4C&redir_esc=y').
194196
195197 user:url_path(swipl_faq, swipl('FAQ')).
196 user:url_path(swipl_man, swipl('pldoc/index.html')).
198 user:url_path(swipl_man, swipl('pldoc/doc_for?object=manual')).
197199 user:url_path(swipl_mail, swipl('Mailinglist.html')).
198200 user:url_path(swipl_download, swipl('Download.html')).
199201 user:url_path(swipl_pack, swipl('pack/list')).
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 2.20</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 2.20</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
922922 <div class="toc-h4"><a class="sec" href="clpfd.html#sec:A.8.6"><span class="sec-nr">A.8.6</span> <span class="sec-title">Examples</span></a></div>
923923 <div class="toc-h4"><a class="sec" href="clpfd.html#sec:A.8.7"><span class="sec-nr">A.8.7</span> <span class="sec-title">Enumeration
924924 predicates and search</span></a></div>
925 <div class="toc-h4"><a class="sec" href="clpfd.html#sec:A.8.8"><span class="sec-nr">A.8.8</span> <span class="sec-title">Advanced
925 <div class="toc-h4"><a class="sec" href="clpfd.html#sec:A.8.8"><span class="sec-nr">A.8.8</span> <span class="sec-title">Optimisation</span></a></div>
926 <div class="toc-h4"><a class="sec" href="clpfd.html#sec:A.8.9"><span class="sec-nr">A.8.9</span> <span class="sec-title">Advanced
926927 topics</span></a></div>
927928 <div class="toc-h2"><a class="sec" href="clpqr.html"><span class="sec-nr">A.9</span> <span class="sec-title">library(clpqr):
928929 Constraint Logic Programming over Rationals and Reals</span></a></div>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.12</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.12</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
237237
238238 <a id="sec:DCG"></a>
239239
240 <p><a id="idx:DCG:700"></a><a id="idx:serialize:701"></a><a id="idx:deserialize:702"></a>Grammar
240 <p><a id="idx:DCG:701"></a><a id="idx:serialize:702"></a><a id="idx:deserialize:703"></a>Grammar
241241 rules form a comfortable interface to <em>difference lists</em>. They
242242 are designed both to support writing parsers that build a parse tree
243243 from a list of characters or tokens and for generating a flat list from
245245
246246 <p>Grammar rules look like ordinary clauses using <code><code>--&gt;</code>/2</code>
247247 for separating the head and body rather than <code><code>:-</code>/2</code>.
248 Expanding grammar rules is done by <a id="idx:expandterm2:703"></a><a class="pred" href="consulting.html#expand_term/2">expand_term/2</a>,
248 Expanding grammar rules is done by <a id="idx:expandterm2:704"></a><a class="pred" href="consulting.html#expand_term/2">expand_term/2</a>,
249249 which adds two additional arguments to each term for representing the
250250 difference list.
251251
280280 }.
281281 </pre>
282282
283 <p>Grammar rule sets are called using the built-in predicates <a id="idx:phrase2:704"></a><a class="pred" href="DCG.html#phrase/2">phrase/2</a>
284 and <a id="idx:phrase3:705"></a><a class="pred" href="DCG.html#phrase/3">phrase/3</a>:
283 <p>Grammar rule sets are called using the built-in predicates <a id="idx:phrase2:705"></a><a class="pred" href="DCG.html#phrase/2">phrase/2</a>
284 and <a id="idx:phrase3:706"></a><a class="pred" href="DCG.html#phrase/3">phrase/3</a>:
285285
286286 <dl class="latex">
287287 <dt class="pubdef"><a id="phrase/2"><strong>phrase</strong>(<var>:DCGBody,
298298 <em>callable</em> term that denotes a grammar rule, it can be any term
299299 that is valid as the body of a DCG rule.
300300
301 <p>The example below calls the rule set <a id="idx:integer1:706"></a><span class="pred-ext">integer/3</span>
301 <p>The example below calls the rule set <a id="idx:integer1:707"></a><span class="pred-ext">integer/3</span>
302302 defined in <a class="sec" href="DCG.html">section 4.12</a> and available
303303 from <code>library(library(dcg/basics))</code>, binding <var>Rest</var>
304304 to the remainder of the input after matching the integer.
329329 Minor = 4.
330330 </pre>
331331
332 <p>The SWI-Prolog implementation of <a id="idx:phrase3:707"></a><a class="pred" href="DCG.html#phrase/3">phrase/3</a>
332 <p>The SWI-Prolog implementation of <a id="idx:phrase3:708"></a><a class="pred" href="DCG.html#phrase/3">phrase/3</a>
333333 verifies that the <var>List</var> and <var>Rest</var> arguments are
334334 unbound, bound to the empty list or a list
335 <em>cons cell</em>. Other values raise a type error.<sup class="fn">58<span class="fn-text">The
335 <em>cons cell</em>. Other values raise a type error.<sup class="fn">59<span class="fn-text">The
336336 ISO standard allows for both raising a type error and accepting any term
337337 as input and output. Note the tail of the list is not checked for
338 performance reasons.</span></sup> The predicate <a id="idx:calldcg3:708"></a><a class="pred" href="DCG.html#call_dcg/3">call_dcg/3</a>
338 performance reasons.</span></sup> The predicate <a id="idx:calldcg3:709"></a><a class="pred" href="DCG.html#call_dcg/3">call_dcg/3</a>
339339 is provided to use grammar rules with terms that are not lists.
340340
341341 <p>Note that the syntax for lists of codes changed in SWI-Prolog version&nbsp;7
342342 (see <a class="sec" href="strings.html">section 5.2</a>). If a DCG body
343343 is translated, both <code>"text"</code> and <code>`text`</code> is a
344344 valid code-list literal in version&nbsp;7. A version&nbsp;7 string (<code>"text"</code>)
345 is <b>not</b> acceptable for the second and third arguments of <a id="idx:phrase3:709"></a><a class="pred" href="DCG.html#phrase/3">phrase/3</a>.
345 is <b>not</b> acceptable for the second and third arguments of <a id="idx:phrase3:710"></a><a class="pred" href="DCG.html#phrase/3">phrase/3</a>.
346346 This is typically not a problem for applications as the input of a DCG
347347 rarely appears in the source code. For testing in the toplevel, one must
348348 use double quoted text in versions prior to&nbsp;7 and back quoted text
349349 in version&nbsp;7 or later.
350350
351 <p>See also <a id="idx:portraytext1:710"></a><span class="pred-ext">portray_text/1</span>,
351 <p>See also <a id="idx:portraytext1:711"></a><span class="pred-ext">portray_text/1</span>,
352352 which can be used to print lists of character codes as a string to the
353353 top level and debugger to facilitate debugging DCGs that process
354 character codes. The library <code>library(apply_macros)</code> compiles <a id="idx:phrase3:711"></a><a class="pred" href="DCG.html#phrase/3">phrase/3</a>
354 character codes. The library <code>library(apply_macros)</code> compiles <a id="idx:phrase3:712"></a><a class="pred" href="DCG.html#phrase/3">phrase/3</a>
355355 if the argument is sufficiently instantiated, eliminating the runtime
356356 overhead of translating <var>DCGBody</var> and meta-calling.</dd>
357357 <dt class="pubdef"><a id="call_dcg/3"><strong>call_dcg</strong>(<var>:DCGBody,
358358 ?State0, ?State</var>)</a></dt>
359359 <dd class="defbody">
360 As <a id="idx:phrase3:712"></a><a class="pred" href="DCG.html#phrase/3">phrase/3</a>,
360 As <a id="idx:phrase3:713"></a><a class="pred" href="DCG.html#phrase/3">phrase/3</a>,
361361 but without type checking <var>State0</var> and <var>State</var>. This
362362 allows for using DCG rules for threading an arbitrary state variable.
363363 This predicate was introduced after type checking was added to
364 <a id="idx:phrase3:713"></a><a class="pred" href="DCG.html#phrase/3">phrase/3</a>.<sup class="fn">59<span class="fn-text">After
364 <a id="idx:phrase3:714"></a><a class="pred" href="DCG.html#phrase/3">phrase/3</a>.<sup class="fn">60<span class="fn-text">After
365365 discussion with Samer Abdallah.</span></sup>
366366
367367 <p>A portable solution for threading state through a DCG can be
368368 implemented by wrapping the state in a list and use the DCG push-back
369369 facility. Subsequently, the following predicates may be used to access
370 and modify the state:<sup class="fn">60<span class="fn-text">This
370 and modify the state:<sup class="fn">61<span class="fn-text">This
371371 solutio was proposed by Markus Triska.</span></sup>
372372
373373 <pre class="code">
380380
381381 <p>As stated above, grammar rules are a general interface to difference
382382 lists. To illustrate, we show a DCG-based implementation of
383 <a id="idx:reverse2:714"></a><a class="pred" href="lists.html#reverse/2">reverse/2</a>:
383 <a id="idx:reverse2:715"></a><a class="pred" href="lists.html#reverse/2">reverse/2</a>:
384384
385385 <pre class="code">
386386 reverse(List, Reversed) :-
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.41</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.41</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
238238 <a id="sec:DDE"></a>
239239
240240 <p>The predicates in this section deal with MS-Windows `Dynamic Data
241 Exchange' or DDE protocol.<sup class="fn">123<span class="fn-text">This
241 Exchange' or DDE protocol.<sup class="fn">126<span class="fn-text">This
242242 interface is contributed by Don Dwiggins.</span></sup> A Windows DDE
243243 conversation is a form of interprocess communication based on sending
244244 reserved window events between the communicating processes.
340340 an atom, indicating <var>Goal</var> only handles requests on this topic,
341341 or a variable that also appears in <var>Goal</var>. <var>Item</var> and <var>Value</var>
342342 are variables that also appear in <var>Goal</var>. <var>Item</var>
343 represents the request data as a Prolog atom.<sup class="fn">124<span class="fn-text">Up
343 represents the request data as a Prolog atom.<sup class="fn">127<span class="fn-text">Up
344344 to version 3.4.5 this was a list of character codes. As recent versions
345345 have atom garbage collection there is no need for this anymore.</span></sup>
346346
347 <p>The example below registers the Prolog <a id="idx:currentprologflag2:1438"></a><a class="pred" href="flags.html#current_prolog_flag/2">current_prolog_flag/2</a>
347 <p>The example below registers the Prolog <a id="idx:currentprologflag2:1440"></a><a class="pred" href="flags.html#current_prolog_flag/2">current_prolog_flag/2</a>
348348 predicate to be accessible from other applications. The request may be
349349 given from the same Prolog as well as from another application.
350350
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
246246 <a class="idx" href="64bits.html#idx:64bitsplatforms:255">2.20.1</a></dd>
247247 <dt><a class="idx" href="db.html#abolish/1">abolish/1</a></dt>
248248 <dd>
249 <a class="idx" href="db.html#idx:abolish1:719">4.13</a> <a class="idx" href="db.html#idx:abolish1:722">4.13</a> <a class="idx" href="db.html#idx:abolish1:723">4.13</a> <a class="idx" href="db.html#idx:abolish1:726">4.13</a></dd>
249 <a class="idx" href="db.html#idx:abolish1:720">4.13</a> <a class="idx" href="db.html#idx:abolish1:723">4.13</a> <a class="idx" href="db.html#idx:abolish1:724">4.13</a> <a class="idx" href="db.html#idx:abolish1:727">4.13</a></dd>
250250 <dt><a class="idx" href="db.html#abolish/2">abolish/2</a></dt>
251251 <dd>
252 <a class="idx" href="db.html#idx:abolish2:725">4.13</a></dd>
252 <a class="idx" href="db.html#idx:abolish2:726">4.13</a></dd>
253253 <dt>abolish/[1,2]</dt>
254254 <dd>
255255 <a class="idx" href="flags.html#idx:abolish12:97">2.11</a></dd>
256256 <dt><a class="idx" href="toplevel.html#abort/0">abort/0</a></dt>
257257 <dd>
258 <a class="idx" href="cmdline.html#idx:abort0:29">2.4.4</a> <a class="idx" href="debugoverview.html#idx:abort0:50">2.9</a> <a class="idx" href="exception.html#idx:abort0:645">4.10</a> <a class="idx" href="IO.html#idx:abort0:868">4.16.2</a> <a class="idx" href="IO.html#idx:abort0:876">4.16.2</a> <a class="idx" href="IO.html#idx:abort0:910">4.16.2</a> <a class="idx" href="debugging.html#idx:abort0:1679">8.4.2</a> <a class="idx" href="foreigninclude.html#idx:abort0:1877">10.4.16</a> <a class="idx" href="foreigninclude.html#idx:abort0:1882">10.4.19</a> <a class="idx" href="foreigninclude.html#idx:abort0:1883">10.4.19</a> <a class="idx" href="tracehook.html#idx:abort0:1997">B.3</a></dd>
258 <a class="idx" href="cmdline.html#idx:abort0:29">2.4.4</a> <a class="idx" href="debugoverview.html#idx:abort0:50">2.9</a> <a class="idx" href="exception.html#idx:abort0:646">4.10</a> <a class="idx" href="IO.html#idx:abort0:869">4.16.2</a> <a class="idx" href="IO.html#idx:abort0:877">4.16.2</a> <a class="idx" href="IO.html#idx:abort0:911">4.16.2</a> <a class="idx" href="debugging.html#idx:abort0:1682">8.4.2</a> <a class="idx" href="foreigninclude.html#idx:abort0:1880">10.4.16</a> <a class="idx" href="foreigninclude.html#idx:abort0:1885">10.4.19</a> <a class="idx" href="foreigninclude.html#idx:abort0:1886">10.4.19</a> <a class="idx" href="tracehook.html#idx:abort0:2000">B.3</a></dd>
259259 <dt><a class="idx" href="files.html#absolute_file_name/2">absolute_file_name/2</a></dt>
260260 <dd>
261 <a class="idx" href="acknowledge.html#idx:absolutefilename2:5">1.6</a> <a class="idx" href="consulting.html#idx:absolutefilename2:366">4.3</a> <a class="idx" href="consulting.html#idx:absolutefilename2:440">4.3</a> <a class="idx" href="files.html#idx:absolutefilename2:1365">4.34</a> <a class="idx" href="files.html#idx:absolutefilename2:1371">4.34</a> <a class="idx" href="useresource.html#idx:absolutefilename2:1931">11.3.1</a></dd>
261 <a class="idx" href="acknowledge.html#idx:absolutefilename2:5">1.6</a> <a class="idx" href="consulting.html#idx:absolutefilename2:367">4.3</a> <a class="idx" href="consulting.html#idx:absolutefilename2:441">4.3</a> <a class="idx" href="files.html#idx:absolutefilename2:1367">4.34</a> <a class="idx" href="files.html#idx:absolutefilename2:1373">4.34</a> <a class="idx" href="useresource.html#idx:absolutefilename2:1934">11.3.1</a></dd>
262262 <dt><a class="idx" href="files.html#absolute_file_name/3">absolute_file_name/3</a></dt>
263263 <dd>
264 <a class="idx" href="flags.html#idx:absolutefilename3:111">2.11</a> <a class="idx" href="hooks.html#idx:absolutefilename3:142">2.12</a> <a class="idx" href="hooks.html#idx:absolutefilename3:143">2.12</a> <a class="idx" href="xref.html#idx:absolutefilename3:294">3.7</a> <a class="idx" href="consulting.html#idx:absolutefilename3:332">4.3</a> <a class="idx" href="consulting.html#idx:absolutefilename3:334">4.3</a> <a class="idx" href="consulting.html#idx:absolutefilename3:436">4.3</a> <a class="idx" href="consulting.html#idx:absolutefilename3:459">4.3</a> <a class="idx" href="system.html#idx:absolutefilename3:1327">4.33.1</a> <a class="idx" href="files.html#idx:absolutefilename3:1355">4.34</a> <a class="idx" href="files.html#idx:absolutefilename3:1356">4.34</a> <a class="idx" href="files.html#idx:absolutefilename3:1358">4.34</a> <a class="idx" href="foreigninclude.html#idx:absolutefilename3:1868">10.4.14.3</a> <a class="idx" href="foreigninclude.html#idx:absolutefilename3:1869">10.4.14.3</a> <a class="idx" href="readutil.html#idx:absolutefilename3:1965">A.28</a> <a class="idx" href="readutil.html#idx:absolutefilename3:1966">A.28</a> <a class="idx" href="readutil.html#idx:absolutefilename3:1969">A.28</a> <a class="idx" href="readutil.html#idx:absolutefilename3:1970">A.28</a></dd>
264 <a class="idx" href="flags.html#idx:absolutefilename3:111">2.11</a> <a class="idx" href="hooks.html#idx:absolutefilename3:142">2.12</a> <a class="idx" href="hooks.html#idx:absolutefilename3:143">2.12</a> <a class="idx" href="xref.html#idx:absolutefilename3:294">3.7</a> <a class="idx" href="consulting.html#idx:absolutefilename3:333">4.3</a> <a class="idx" href="consulting.html#idx:absolutefilename3:335">4.3</a> <a class="idx" href="consulting.html#idx:absolutefilename3:437">4.3</a> <a class="idx" href="consulting.html#idx:absolutefilename3:460">4.3</a> <a class="idx" href="system.html#idx:absolutefilename3:1329">4.33.1</a> <a class="idx" href="files.html#idx:absolutefilename3:1357">4.34</a> <a class="idx" href="files.html#idx:absolutefilename3:1358">4.34</a> <a class="idx" href="files.html#idx:absolutefilename3:1360">4.34</a> <a class="idx" href="foreigninclude.html#idx:absolutefilename3:1871">10.4.14.3</a> <a class="idx" href="foreigninclude.html#idx:absolutefilename3:1872">10.4.14.3</a> <a class="idx" href="readutil.html#idx:absolutefilename3:1968">A.28</a> <a class="idx" href="readutil.html#idx:absolutefilename3:1969">A.28</a> <a class="idx" href="readutil.html#idx:absolutefilename3:1972">A.28</a> <a class="idx" href="readutil.html#idx:absolutefilename3:1973">A.28</a></dd>
265265 <dt>absolute_file_name/[2,3]</dt>
266266 <dd>
267 <a class="idx" href="flags.html#idx:absolutefilename23:129">2.11</a> <a class="idx" href="consulting.html#idx:absolutefilename23:435">4.3</a> <a class="idx" href="files.html#idx:absolutefilename23:1360">4.34</a></dd>
267 <a class="idx" href="flags.html#idx:absolutefilename23:129">2.11</a> <a class="idx" href="consulting.html#idx:absolutefilename23:436">4.3</a> <a class="idx" href="files.html#idx:absolutefilename23:1362">4.34</a></dd>
268268 <dt><a class="idx" href="files.html#access_file/2">access_file/2</a></dt>
269269 <dd>
270 <a class="idx" href="flags.html#idx:accessfile2:91">2.11</a> <a class="idx" href="files.html#idx:accessfile2:1361">4.34</a></dd>
270 <a class="idx" href="flags.html#idx:accessfile2:91">2.11</a> <a class="idx" href="files.html#idx:accessfile2:1363">4.34</a></dd>
271271 <dt><a class="idx" href="foreigninclude.html#acquire()">acquire()</a></dt>
272272 <dt><a class="idx" href="typetest.html#acyclic_term/1">acyclic_term/1</a></dt>
273273 <dd>
274 <a class="idx" href="cyclic.html#idx:acyclicterm1:200">2.16</a> <a class="idx" href="typetest.html#idx:acyclicterm1:572">4.6</a> <a class="idx" href="typetest.html#idx:acyclicterm1:574">4.6</a> <a class="idx" href="compare.html#idx:acyclicterm1:583">4.7.2</a></dd>
274 <a class="idx" href="cyclic.html#idx:acyclicterm1:200">2.16</a> <a class="idx" href="typetest.html#idx:acyclicterm1:573">4.6</a> <a class="idx" href="typetest.html#idx:acyclicterm1:575">4.6</a> <a class="idx" href="compare.html#idx:acyclicterm1:584">4.7.2</a></dd>
275275 <dt><a class="idx" href="ugraphs.html#add_edges/3">add_edges/3</a></dt>
276276 <dt><a class="idx" href="importmodule.html#add_import_module/3">add_import_module/3</a></dt>
277277 <dd>
278 <a class="idx" href="importmodule.html#idx:addimportmodule3:1575">6.9</a> <a class="idx" href="modulecompat.html#idx:addimportmodule3:1612">6.15</a></dd>
278 <a class="idx" href="importmodule.html#idx:addimportmodule3:1577">6.9</a> <a class="idx" href="modulecompat.html#idx:addimportmodule3:1614">6.15</a></dd>
279279 <dt><a class="idx" href="nb_set.html#add_nb_set/2">add_nb_set/2</a></dt>
280280 <dt><a class="idx" href="nb_set.html#add_nb_set/3">add_nb_set/3</a></dt>
281281 <dd>
282 <a class="idx" href="nb_set.html#idx:addnbset3:1953">A.15</a> <a class="idx" href="nb_set.html#idx:addnbset3:1954">A.15</a></dd>
282 <a class="idx" href="nb_set.html#idx:addnbset3:1956">A.15</a> <a class="idx" href="nb_set.html#idx:addnbset3:1957">A.15</a></dd>
283283 <dt><a class="idx" href="ugraphs.html#add_vertices/3">add_vertices/3</a></dt>
284284 <dt>agent</dt>
285285 <dd>
286 <a class="idx" href="broadcast.html#idx:agent:1942">A.4</a></dd>
286 <a class="idx" href="broadcast.html#idx:agent:1945">A.4</a></dd>
287287 <dt><a class="idx" href="aggregate.html#aggregate/3">aggregate/3</a></dt>
288288 <dd>
289 <a class="idx" href="metapred.html#idx:aggregate3:1551">6.4</a></dd>
289 <a class="idx" href="metapred.html#idx:aggregate3:1553">6.4</a></dd>
290290 <dt><a class="idx" href="aggregate.html#aggregate/4">aggregate/4</a></dt>
291291 <dd>
292 <a class="idx" href="metapred.html#idx:aggregate4:1552">6.4</a></dd>
292 <a class="idx" href="metapred.html#idx:aggregate4:1554">6.4</a></dd>
293293 <dt><a class="idx" href="aggregate.html#aggregate_all/3">aggregate_all/3</a></dt>
294294 <dt><a class="idx" href="aggregate.html#aggregate_all/4">aggregate_all/4</a></dt>
295295 <dt><a class="idx" href="clpfd.html#all_different/1">all_different/1</a></dt>
296296 <dt><a class="idx" href="clpfd.html#all_distinct/1">all_distinct/1</a></dt>
297297 <dt>anonymous variable</dt>
298298 <dd>
299 <a class="idx" href="glossary.html#idx:anonymousvariable:2070">D</a></dd>
299 <a class="idx" href="glossary.html#idx:anonymousvariable:2073">D</a></dd>
300300 <dt>anonymous,variable</dt>
301301 <dd>
302302 <a class="idx" href="syntax.html#idx:anonymousvariable:191">2.15.2.5</a></dd>
303303 <dt>ansi_format/3</dt>
304304 <dd>
305 <a class="idx" href="exception.html#idx:ansiformat3:683">4.10.3</a></dd>
305 <a class="idx" href="exception.html#idx:ansiformat3:684">4.10.3</a></dd>
306306 <dt><a class="idx" href="IO.html#append/1">append/1</a></dt>
307307 <dd>
308 <a class="idx" href="IO.html#idx:append1:925">4.16.3</a></dd>
308 <a class="idx" href="IO.html#idx:append1:926">4.16.3</a></dd>
309309 <dt><a class="idx" href="lists.html#append/2">append/2</a></dt>
310310 <dd>
311 <a class="idx" href="import.html#idx:append2:1535">6.3</a></dd>
311 <a class="idx" href="import.html#idx:append2:1537">6.3</a></dd>
312312 <dt><a class="idx" href="lists.html#append/3">append/3</a></dt>
313313 <dd>
314 <a class="idx" href="examineprog.html#idx:append3:831">4.15</a> <a class="idx" href="manipatom.html#idx:append3:1153">4.21</a></dd>
314 <a class="idx" href="examineprog.html#idx:append3:832">4.15</a> <a class="idx" href="manipatom.html#idx:append3:1154">4.21</a></dd>
315315 <dt><a class="idx" href="metacall.html#apply/2">apply/2</a></dt>
316316 <dt><a class="idx" href="help.html#apropos/1">apropos/1</a></dt>
317317 <dd>
318 <a class="idx" href="help.html#idx:apropos1:33">2.6</a> <a class="idx" href="help.html#idx:apropos1:34">2.6</a> <a class="idx" href="hooks.html#idx:apropos1:159">2.12</a> <a class="idx" href="intlibs.html#idx:apropos1:2038">B.7</a> <a class="idx" href="predsummary.html#idx:apropos1:2142">F.1</a></dd>
318 <a class="idx" href="help.html#idx:apropos1:33">2.6</a> <a class="idx" href="help.html#idx:apropos1:34">2.6</a> <a class="idx" href="hooks.html#idx:apropos1:159">2.12</a> <a class="idx" href="intlibs.html#idx:apropos1:2041">B.7</a> <a class="idx" href="predsummary.html#idx:apropos1:2149">F.1</a></dd>
319319 <dt><a class="idx" href="manipterm.html#arg/3">arg/3</a></dt>
320320 <dd>
321 <a class="idx" href="manipterm.html#idx:arg3:1075">4.20</a></dd>
321 <a class="idx" href="manipterm.html#idx:arg3:1076">4.20</a></dd>
322322 <dt>arithmetic_function/1</dt>
323323 <dd>
324 <a class="idx" href="foreigninclude.html#idx:arithmeticfunction1:1860">10.4.12</a></dd>
324 <a class="idx" href="foreigninclude.html#idx:arithmeticfunction1:1863">10.4.12</a></dd>
325325 <dt>arity</dt>
326326 <dd>
327 <a class="idx" href="glossary.html#idx:arity:2072">D</a></dd>
327 <a class="idx" href="glossary.html#idx:arity:2075">D</a></dd>
328328 <dt>assert</dt>
329329 <dd>
330 <a class="idx" href="glossary.html#idx:assert:2073">D</a></dd>
330 <a class="idx" href="glossary.html#idx:assert:2076">D</a></dd>
331331 <dt><a class="idx" href="db.html#assert/1">assert/1</a></dt>
332332 <dd>
333 <a class="idx" href="consulting.html#idx:assert1:340">4.3</a> <a class="idx" href="db.html#idx:assert1:715">4.13</a> <a class="idx" href="db.html#idx:assert1:730">4.13</a> <a class="idx" href="db.html#idx:assert1:761">4.13.1</a> <a class="idx" href="dynamic.html#idx:assert1:776">4.14</a> <a class="idx" href="dynamic.html#idx:assert1:781">4.14</a> <a class="idx" href="dynamic.html#idx:assert1:782">4.14</a> <a class="idx" href="examineprog.html#idx:assert1:807">4.15</a> <a class="idx" href="modules.html#idx:assert1:1516">6</a> <a class="idx" href="metapred.html#idx:assert1:1542">6.4</a> <a class="idx" href="extvar.html#idx:assert1:1614">7</a> <a class="idx" href="gvar.html#idx:assert1:1650">7.3</a> <a class="idx" href="threadcom.html#idx:assert1:1774">9.3.3</a></dd>
333 <a class="idx" href="consulting.html#idx:assert1:341">4.3</a> <a class="idx" href="db.html#idx:assert1:716">4.13</a> <a class="idx" href="db.html#idx:assert1:731">4.13</a> <a class="idx" href="db.html#idx:assert1:762">4.13.1</a> <a class="idx" href="dynamic.html#idx:assert1:777">4.14</a> <a class="idx" href="dynamic.html#idx:assert1:782">4.14</a> <a class="idx" href="dynamic.html#idx:assert1:783">4.14</a> <a class="idx" href="examineprog.html#idx:assert1:808">4.15</a> <a class="idx" href="modules.html#idx:assert1:1518">6</a> <a class="idx" href="metapred.html#idx:assert1:1544">6.4</a> <a class="idx" href="extvar.html#idx:assert1:1616">7</a> <a class="idx" href="gvar.html#idx:assert1:1653">7.3</a> <a class="idx" href="threadcom.html#idx:assert1:1777">9.3.3</a></dd>
334334 <dt><a class="idx" href="db.html#assert/2">assert/2</a></dt>
335335 <dd>
336 <a class="idx" href="flags.html#idx:assert2:78">2.11</a> <a class="idx" href="db.html#idx:assert2:751">4.13</a> <a class="idx" href="examineprog.html#idx:assert2:829">4.15</a></dd>
336 <a class="idx" href="flags.html#idx:assert2:78">2.11</a> <a class="idx" href="db.html#idx:assert2:752">4.13</a> <a class="idx" href="examineprog.html#idx:assert2:830">4.15</a></dd>
337337 <dt><a class="idx" href="predicate_options.html#assert_predicate_options/4">assert_predicate_options/4</a></dt>
338338 <dt><a class="idx" href="db.html#asserta/1">asserta/1</a></dt>
339339 <dd>
340 <a class="idx" href="cmdline.html#idx:asserta1:22">2.4.2</a> <a class="idx" href="cyclic.html#idx:asserta1:222">2.16</a> <a class="idx" href="jitindex.html#idx:asserta1:224">2.17</a> <a class="idx" href="consulting.html#idx:asserta1:429">4.3</a> <a class="idx" href="compare.html#idx:asserta1:587">4.7.2</a> <a class="idx" href="db.html#idx:asserta1:732">4.13</a> <a class="idx" href="db.html#idx:asserta1:733">4.13</a> <a class="idx" href="db.html#idx:asserta1:736">4.13</a> <a class="idx" href="db.html#idx:asserta1:739">4.13</a> <a class="idx" href="overrule.html#idx:asserta1:1558">6.5</a> <a class="idx" href="overrule.html#idx:asserta1:1560">6.5.1</a> <a class="idx" href="glossary.html#idx:asserta1:2074">D</a></dd>
340 <a class="idx" href="cmdline.html#idx:asserta1:22">2.4.2</a> <a class="idx" href="cyclic.html#idx:asserta1:222">2.16</a> <a class="idx" href="jitindex.html#idx:asserta1:224">2.17</a> <a class="idx" href="consulting.html#idx:asserta1:430">4.3</a> <a class="idx" href="compare.html#idx:asserta1:588">4.7.2</a> <a class="idx" href="db.html#idx:asserta1:733">4.13</a> <a class="idx" href="db.html#idx:asserta1:734">4.13</a> <a class="idx" href="db.html#idx:asserta1:737">4.13</a> <a class="idx" href="db.html#idx:asserta1:740">4.13</a> <a class="idx" href="overrule.html#idx:asserta1:1560">6.5</a> <a class="idx" href="overrule.html#idx:asserta1:1562">6.5.1</a> <a class="idx" href="glossary.html#idx:asserta1:2077">D</a></dd>
341341 <dt><a class="idx" href="db.html#asserta/2">asserta/2</a></dt>
342342 <dd>
343 <a class="idx" href="db.html#idx:asserta2:752">4.13</a></dd>
343 <a class="idx" href="db.html#idx:asserta2:753">4.13</a></dd>
344344 <dt><a class="idx" href="debug.html#assertion/1">assertion/1</a></dt>
345345 <dd>
346 <a class="idx" href="breakpoint.html#idx:assertion1:2006">B.4</a></dd>
346 <a class="idx" href="breakpoint.html#idx:assertion1:2009">B.4</a></dd>
347347 <dt><a class="idx" href="db.html#assertz/1">assertz/1</a></dt>
348348 <dd>
349 <a class="idx" href="consulting.html#idx:assertz1:428">4.3</a> <a class="idx" href="db.html#idx:assertz1:727">4.13</a> <a class="idx" href="db.html#idx:assertz1:734">4.13</a> <a class="idx" href="db.html#idx:assertz1:735">4.13</a> <a class="idx" href="examineprog.html#idx:assertz1:820">4.15</a> <a class="idx" href="examineprog.html#idx:assertz1:836">4.15</a> <a class="idx" href="manipmodule.html#idx:assertz1:1605">6.14</a> <a class="idx" href="glossary.html#idx:assertz1:2075">D</a></dd>
349 <a class="idx" href="consulting.html#idx:assertz1:429">4.3</a> <a class="idx" href="db.html#idx:assertz1:728">4.13</a> <a class="idx" href="db.html#idx:assertz1:735">4.13</a> <a class="idx" href="db.html#idx:assertz1:736">4.13</a> <a class="idx" href="examineprog.html#idx:assertz1:821">4.15</a> <a class="idx" href="examineprog.html#idx:assertz1:837">4.15</a> <a class="idx" href="manipmodule.html#idx:assertz1:1607">6.14</a> <a class="idx" href="glossary.html#idx:assertz1:2078">D</a></dd>
350350 <dt><a class="idx" href="db.html#assertz/2">assertz/2</a></dt>
351351 <dd>
352 <a class="idx" href="db.html#idx:assertz2:740">4.13</a> <a class="idx" href="db.html#idx:assertz2:741">4.13</a> <a class="idx" href="db.html#idx:assertz2:753">4.13</a></dd>
352 <a class="idx" href="db.html#idx:assertz2:741">4.13</a> <a class="idx" href="db.html#idx:assertz2:742">4.13</a> <a class="idx" href="db.html#idx:assertz2:754">4.13</a></dd>
353353 <dt><a class="idx" href="simplex.html#assignment/2">assignment/2</a></dt>
354354 <dt><a class="idx" href="assoc.html#assoc_to_keys/2">assoc_to_keys/2</a></dt>
355355 <dt><a class="idx" href="assoc.html#assoc_to_list/2">assoc_to_list/2</a></dt>
357357 <dt><a class="idx" href="chario.html#at_end_of_stream/0">at_end_of_stream/0</a></dt>
358358 <dt><a class="idx" href="chario.html#at_end_of_stream/1">at_end_of_stream/1</a></dt>
359359 <dd>
360 <a class="idx" href="chario.html#idx:atendofstream1:991">4.18</a></dd>
360 <a class="idx" href="chario.html#idx:atendofstream1:992">4.18</a></dd>
361361 <dt>at_end_of_stream/[0,1]</dt>
362362 <dd>
363 <a class="idx" href="IO.html#idx:atendofstream01:877">4.16.2</a> <a class="idx" href="readutil.html#idx:atendofstream01:1962">A.28</a></dd>
363 <a class="idx" href="IO.html#idx:atendofstream01:878">4.16.2</a> <a class="idx" href="readutil.html#idx:atendofstream01:1965">A.28</a></dd>
364364 <dt><a class="idx" href="consulting.html#at_halt/1">at_halt/1</a></dt>
365365 <dd>
366 <a class="idx" href="flags.html#idx:athalt1:88">2.11</a> <a class="idx" href="consulting.html#idx:athalt1:465">4.3</a> <a class="idx" href="toplevel.html#idx:athalt1:1381">4.35</a> <a class="idx" href="threadcreate.html#idx:athalt1:1722">9.1</a> <a class="idx" href="foreigninclude.html#idx:athalt1:1884">10.4.19</a> <a class="idx" href="foreigninclude.html#idx:athalt1:1885">10.4.19</a> <a class="idx" href="foreigninclude.html#idx:athalt1:1886">10.4.19</a> <a class="idx" href="foreigninclude.html#idx:athalt1:1892">10.4.21</a> <a class="idx" href="readline.html#idx:athalt1:2046">B.9</a> <a class="idx" href="predsummary.html#idx:athalt1:2149">F.1</a></dd>
366 <a class="idx" href="flags.html#idx:athalt1:88">2.11</a> <a class="idx" href="consulting.html#idx:athalt1:466">4.3</a> <a class="idx" href="toplevel.html#idx:athalt1:1383">4.35</a> <a class="idx" href="threadcreate.html#idx:athalt1:1725">9.1</a> <a class="idx" href="foreigninclude.html#idx:athalt1:1887">10.4.19</a> <a class="idx" href="foreigninclude.html#idx:athalt1:1888">10.4.19</a> <a class="idx" href="foreigninclude.html#idx:athalt1:1889">10.4.19</a> <a class="idx" href="foreigninclude.html#idx:athalt1:1895">10.4.21</a> <a class="idx" href="readline.html#idx:athalt1:2049">B.9</a> <a class="idx" href="predsummary.html#idx:athalt1:2156">F.1</a></dd>
367367 <dt>atom</dt>
368368 <dd>
369 <a class="idx" href="glossary.html#idx:atom:2076">D</a></dd>
369 <a class="idx" href="glossary.html#idx:atom:2079">D</a></dd>
370370 <dt><a class="idx" href="typetest.html#atom/1">atom/1</a></dt>
371371 <dd>
372 <a class="idx" href="typetest.html#idx:atom1:558">4.6</a> <a class="idx" href="foreigninclude.html#idx:atom1:1829">10.4.3</a></dd>
372 <a class="idx" href="typetest.html#idx:atom1:559">4.6</a> <a class="idx" href="foreigninclude.html#idx:atom1:1832">10.4.3</a></dd>
373373 <dt><a class="idx" href="manipatom.html#atom_chars/2">atom_chars/2</a></dt>
374374 <dd>
375 <a class="idx" href="chars.html#idx:atomchars2:314">4.2</a> <a class="idx" href="IO.html#idx:atomchars2:951">4.16.5</a> <a class="idx" href="chario.html#idx:atomchars2:969">4.18</a> <a class="idx" href="manipatom.html#idx:atomchars2:1123">4.21</a> <a class="idx" href="manipatom.html#idx:atomchars2:1124">4.21</a> <a class="idx" href="manipatom.html#idx:atomchars2:1126">4.21</a> <a class="idx" href="manipatom.html#idx:atomchars2:1128">4.21</a> <a class="idx" href="manipatom.html#idx:atomchars2:1130">4.21</a> <a class="idx" href="chartype.html#idx:atomchars2:1178">4.23</a> <a class="idx" href="ext-issues.html#idx:atomchars2:1513">5.6</a></dd>
375 <a class="idx" href="chars.html#idx:atomchars2:315">4.2</a> <a class="idx" href="IO.html#idx:atomchars2:952">4.16.5</a> <a class="idx" href="chario.html#idx:atomchars2:970">4.18</a> <a class="idx" href="manipatom.html#idx:atomchars2:1124">4.21</a> <a class="idx" href="manipatom.html#idx:atomchars2:1125">4.21</a> <a class="idx" href="manipatom.html#idx:atomchars2:1127">4.21</a> <a class="idx" href="manipatom.html#idx:atomchars2:1129">4.21</a> <a class="idx" href="manipatom.html#idx:atomchars2:1131">4.21</a> <a class="idx" href="chartype.html#idx:atomchars2:1179">4.23</a> <a class="idx" href="ext-issues.html#idx:atomchars2:1515">5.6</a></dd>
376376 <dt><a class="idx" href="manipatom.html#atom_codes/2">atom_codes/2</a></dt>
377377 <dd>
378 <a class="idx" href="chars.html#idx:atomcodes2:312">4.2</a> <a class="idx" href="chars.html#idx:atomcodes2:315">4.2</a> <a class="idx" href="IO.html#idx:atomcodes2:950">4.16.5</a> <a class="idx" href="manipatom.html#idx:atomcodes2:1117">4.21</a> <a class="idx" href="manipatom.html#idx:atomcodes2:1120">4.21</a> <a class="idx" href="manipatom.html#idx:atomcodes2:1125">4.21</a> <a class="idx" href="manipatom.html#idx:atomcodes2:1127">4.21</a> <a class="idx" href="manipatom.html#idx:atomcodes2:1129">4.21</a> <a class="idx" href="manipatom.html#idx:atomcodes2:1134">4.21</a> <a class="idx" href="manipatom.html#idx:atomcodes2:1141">4.21</a> <a class="idx" href="chartype.html#idx:atomcodes2:1179">4.23</a> <a class="idx" href="ext-issues.html#idx:atomcodes2:1512">5.6</a></dd>
378 <a class="idx" href="chars.html#idx:atomcodes2:313">4.2</a> <a class="idx" href="chars.html#idx:atomcodes2:316">4.2</a> <a class="idx" href="IO.html#idx:atomcodes2:951">4.16.5</a> <a class="idx" href="manipatom.html#idx:atomcodes2:1118">4.21</a> <a class="idx" href="manipatom.html#idx:atomcodes2:1121">4.21</a> <a class="idx" href="manipatom.html#idx:atomcodes2:1126">4.21</a> <a class="idx" href="manipatom.html#idx:atomcodes2:1128">4.21</a> <a class="idx" href="manipatom.html#idx:atomcodes2:1130">4.21</a> <a class="idx" href="manipatom.html#idx:atomcodes2:1135">4.21</a> <a class="idx" href="manipatom.html#idx:atomcodes2:1142">4.21</a> <a class="idx" href="chartype.html#idx:atomcodes2:1180">4.23</a> <a class="idx" href="ext-issues.html#idx:atomcodes2:1514">5.6</a></dd>
379379 <dt><a class="idx" href="manipatom.html#atom_concat/3">atom_concat/3</a></dt>
380380 <dd>
381 <a class="idx" href="strings.html#idx:atomconcat3:1455">5.2.1</a></dd>
381 <a class="idx" href="strings.html#idx:atomconcat3:1457">5.2.1</a></dd>
382382 <dt><a class="idx" href="manipatom.html#atom_length/2">atom_length/2</a></dt>
383383 <dd>
384 <a class="idx" href="flags.html#idx:atomlength2:95">2.11</a> <a class="idx" href="strings.html#idx:atomlength2:1452">5.2.1</a></dd>
384 <a class="idx" href="flags.html#idx:atomlength2:95">2.11</a> <a class="idx" href="strings.html#idx:atomlength2:1454">5.2.1</a></dd>
385385 <dt><a class="idx" href="manipatom.html#atom_number/2">atom_number/2</a></dt>
386386 <dd>
387 <a class="idx" href="IO.html#idx:atomnumber2:945">4.16.5</a> <a class="idx" href="manipatom.html#idx:atomnumber2:1137">4.21</a> <a class="idx" href="manipatom.html#idx:atomnumber2:1145">4.21</a></dd>
387 <a class="idx" href="IO.html#idx:atomnumber2:946">4.16.5</a> <a class="idx" href="manipatom.html#idx:atomnumber2:1138">4.21</a> <a class="idx" href="manipatom.html#idx:atomnumber2:1146">4.21</a></dd>
388388 <dt><a class="idx" href="manipatom.html#atom_prefix/2">atom_prefix/2</a></dt>
389389 <dt>atom_result/2</dt>
390390 <dd>
391 <a class="idx" href="ctxmodule.html#idx:atomresult2:1597">6.13</a></dd>
391 <a class="idx" href="ctxmodule.html#idx:atomresult2:1599">6.13</a></dd>
392392 <dt><a class="idx" href="strings.html#atom_string/2">atom_string/2</a></dt>
393393 <dt><a class="idx" href="charsio.html#atom_to_chars/2">atom_to_chars/2</a></dt>
394394 <dt><a class="idx" href="charsio.html#atom_to_chars/3">atom_to_chars/3</a></dt>
395395 <dt><a class="idx" href="manipatom.html#atom_to_term/3">atom_to_term/3</a></dt>
396396 <dd>
397 <a class="idx" href="termrw.html#idx:atomtoterm3:1066">4.19</a></dd>
397 <a class="idx" href="termrw.html#idx:atomtoterm3:1067">4.19</a></dd>
398398 <dt><a class="idx" href="typetest.html#atomic/1">atomic/1</a></dt>
399399 <dd>
400 <a class="idx" href="typetest.html#idx:atomic1:556">4.6</a></dd>
400 <a class="idx" href="typetest.html#idx:atomic1:557">4.6</a></dd>
401401 <dt><a class="idx" href="manipatom.html#atomic_concat/3">atomic_concat/3</a></dt>
402402 <dd>
403 <a class="idx" href="manipatom.html#idx:atomicconcat3:1154">4.21</a></dd>
403 <a class="idx" href="manipatom.html#idx:atomicconcat3:1155">4.21</a></dd>
404404 <dt><a class="idx" href="manipatom.html#atomic_list_concat/2">atomic_list_concat/2</a></dt>
405405 <dd>
406 <a class="idx" href="manipatom.html#idx:atomiclistconcat2:1139">4.21</a> <a class="idx" href="manipatom.html#idx:atomiclistconcat2:1155">4.21</a></dd>
406 <a class="idx" href="manipatom.html#idx:atomiclistconcat2:1140">4.21</a> <a class="idx" href="manipatom.html#idx:atomiclistconcat2:1156">4.21</a></dd>
407407 <dt><a class="idx" href="manipatom.html#atomic_list_concat/3">atomic_list_concat/3</a></dt>
408408 <dt><a class="idx" href="strings.html#atomics_to_string/2">atomics_to_string/2</a></dt>
409409 <dd>
410 <a class="idx" href="strings.html#idx:atomicstostring2:1458">5.2.1</a></dd>
410 <a class="idx" href="strings.html#idx:atomicstostring2:1460">5.2.1</a></dd>
411411 <dt><a class="idx" href="strings.html#atomics_to_string/3">atomics_to_string/3</a></dt>
412412 <dt><a class="idx" href="thutil.html#attach_console/0">attach_console/0</a></dt>
413413 <dd>
414 <a class="idx" href="thutil.html#idx:attachconsole0:1795">9.5</a> <a class="idx" href="thutil.html#idx:attachconsole0:1797">9.5.1</a> <a class="idx" href="foreigninclude.html#idx:attachconsole0:1879">10.4.16</a></dd>
414 <a class="idx" href="thutil.html#idx:attachconsole0:1798">9.5</a> <a class="idx" href="thutil.html#idx:attachconsole0:1800">9.5.1</a> <a class="idx" href="foreigninclude.html#idx:attachconsole0:1882">10.4.16</a></dd>
415415 <dt><a class="idx" href="attvar.html#attr_portray_hook/2">attr_portray_hook/2</a></dt>
416416 <dd>
417 <a class="idx" href="termrw.html#idx:attrportrayhook2:1003">4.19</a></dd>
417 <a class="idx" href="termrw.html#idx:attrportrayhook2:1004">4.19</a></dd>
418418 <dt><a class="idx" href="attvar.html#attr_unify_hook/2">attr_unify_hook/2</a></dt>
419419 <dd>
420 <a class="idx" href="attvar.html#idx:attrunifyhook2:1618">7.1</a> <a class="idx" href="attvar.html#idx:attrunifyhook2:1620">7.1</a></dd>
420 <a class="idx" href="attvar.html#idx:attrunifyhook2:1620">7.1</a> <a class="idx" href="attvar.html#idx:attrunifyhook2:1622">7.1</a></dd>
421421 <dt>attribute_goals//1</dt>
422422 <dd>
423 <a class="idx" href="attvar.html#idx:attributegoals1:1628">7.1.2</a> <a class="idx" href="attvar.html#idx:attributegoals1:1631">7.1.3</a></dd>
423 <a class="idx" href="attvar.html#idx:attributegoals1:1630">7.1.2</a> <a class="idx" href="attvar.html#idx:attributegoals1:1633">7.1.3</a></dd>
424424 <dt><a class="idx" href="attvar.html#attribute_goals/3">attribute_goals/3</a></dt>
425425 <dd>
426 <a class="idx" href="attvar.html#idx:attributegoals3:1621">7.1</a></dd>
426 <a class="idx" href="attvar.html#idx:attributegoals3:1623">7.1</a></dd>
427427 <dt><a class="idx" href="attvar.html#attvar/1">attvar/1</a></dt>
428428 <dt><a class="idx" href="runtime.html#autoload/0">autoload/0</a></dt>
429429 <dd>
430 <a class="idx" href="autoload.html#idx:autoload0:178">2.13</a> <a class="idx" href="consulting.html#idx:autoload0:421">4.3</a> <a class="idx" href="runtime.html#idx:autoload0:1907">11</a> <a class="idx" href="runtime.html#idx:autoload0:1911">11</a></dd>
430 <a class="idx" href="autoload.html#idx:autoload0:178">2.13</a> <a class="idx" href="consulting.html#idx:autoload0:422">4.3</a> <a class="idx" href="runtime.html#idx:autoload0:1910">11</a> <a class="idx" href="runtime.html#idx:autoload0:1914">11</a></dd>
431431 <dt><a class="idx" href="autoload.html#autoload_path/1">autoload_path/1</a></dt>
432432 <dt><a class="idx" href="clpfd.html#automaton/3">automaton/3</a></dt>
433433 <dt><a class="idx" href="clpfd.html#automaton/8">automaton/8</a></dt>
434434 <dt><a class="idx" href="gvar.html#b_getval/2">b_getval/2</a></dt>
435435 <dd>
436 <a class="idx" href="gvar.html#idx:bgetval2:1660">7.3</a> <a class="idx" href="gvar.html#idx:bgetval2:1663">7.3</a></dd>
436 <a class="idx" href="gvar.html#idx:bgetval2:1663">7.3</a> <a class="idx" href="gvar.html#idx:bgetval2:1666">7.3</a></dd>
437437 <dt>b_linkarg/3</dt>
438438 <dd>
439 <a class="idx" href="dicts.html#idx:blinkarg3:1501">5.4.2.1</a></dd>
439 <a class="idx" href="dicts.html#idx:blinkarg3:1503">5.4.2.1</a></dd>
440440 <dt><a class="idx" href="dicts.html#b_set_dict/3">b_set_dict/3</a></dt>
441441 <dt><a class="idx" href="gvar.html#b_setval/2">b_setval/2</a></dt>
442442 <dd>
443 <a class="idx" href="dicts.html#idx:bsetval2:1498">5.4.2.1</a> <a class="idx" href="gvar.html#idx:bsetval2:1653">7.3</a> <a class="idx" href="gvar.html#idx:bsetval2:1654">7.3</a> <a class="idx" href="exception3.html#idx:bsetval2:2021">B.6</a></dd>
443 <a class="idx" href="dicts.html#idx:bsetval2:1500">5.4.2.1</a> <a class="idx" href="gvar.html#idx:bsetval2:1656">7.3</a> <a class="idx" href="gvar.html#idx:bsetval2:1657">7.3</a> <a class="idx" href="exception3.html#idx:bsetval2:2024">B.6</a></dd>
444444 <dt>backtracking</dt>
445445 <dd>
446 <a class="idx" href="glossary.html#idx:backtracking:2077">D</a></dd>
446 <a class="idx" href="glossary.html#idx:backtracking:2080">D</a></dd>
447447 <dt><a class="idx" href="allsolutions.html#bagof/3">bagof/3</a></dt>
448448 <dd>
449 <a class="idx" href="cyclic.html#idx:bagof3:201">2.16</a> <a class="idx" href="allsolutions.html#idx:bagof3:1240">4.29</a> <a class="idx" href="allsolutions.html#idx:bagof3:1241">4.29</a> <a class="idx" href="allsolutions.html#idx:bagof3:1247">4.29</a> <a class="idx" href="allsolutions.html#idx:bagof3:1248">4.29</a> <a class="idx" href="allsolutions.html#idx:bagof3:1249">4.29</a> <a class="idx" href="allsolutions.html#idx:bagof3:1250">4.29</a> <a class="idx" href="allsolutions.html#idx:bagof3:1251">4.29</a> <a class="idx" href="metapred.html#idx:bagof3:1550">6.4</a> <a class="idx" href="predsummary.html#idx:bagof3:2144">F.1</a></dd>
449 <a class="idx" href="cyclic.html#idx:bagof3:201">2.16</a> <a class="idx" href="allsolutions.html#idx:bagof3:1242">4.29</a> <a class="idx" href="allsolutions.html#idx:bagof3:1243">4.29</a> <a class="idx" href="allsolutions.html#idx:bagof3:1249">4.29</a> <a class="idx" href="allsolutions.html#idx:bagof3:1250">4.29</a> <a class="idx" href="allsolutions.html#idx:bagof3:1251">4.29</a> <a class="idx" href="allsolutions.html#idx:bagof3:1252">4.29</a> <a class="idx" href="allsolutions.html#idx:bagof3:1253">4.29</a> <a class="idx" href="metapred.html#idx:bagof3:1552">6.4</a> <a class="idx" href="predsummary.html#idx:bagof3:2151">F.1</a></dd>
450450 <dt><a class="idx" href="clpqr.html#bb_inf/3">bb_inf/3</a></dt>
451451 <dt><a class="idx" href="clpqr.html#bb_inf/4">bb_inf/4</a></dt>
452452 <dt><a class="idx" href="clpqr.html#bb_inf/5">bb_inf/5</a></dt>
453453 <dt><a class="idx" href="arith.html#between/3">between/3</a></dt>
454454 <dd>
455 <a class="idx" href="arith.html#idx:between3:1201">4.26.1</a></dd>
455 <a class="idx" href="arith.html#idx:between3:1202">4.26.1</a></dd>
456456 <dt>binding</dt>
457457 <dd>
458 <a class="idx" href="glossary.html#idx:binding:2078">D</a></dd>
458 <a class="idx" href="glossary.html#idx:binding:2081">D</a></dd>
459459 <dt>bits, 64</dt>
460460 <dd>
461461 <a class="idx" href="64bits.html#idx:bits64:254">2.20</a></dd>
462462 <dt>blackboard</dt>
463463 <dd>
464 <a class="idx" href="broadcast.html#idx:blackboard:1941">A.4</a></dd>
464 <a class="idx" href="broadcast.html#idx:blackboard:1944">A.4</a></dd>
465465 <dt><a class="idx" href="typetest.html#blob/2">blob/2</a></dt>
466466 <dd>
467 <a class="idx" href="typetest.html#idx:blob2:562">4.6</a> <a class="idx" href="IO.html#idx:blob2:862">4.16.2</a></dd>
467 <a class="idx" href="typetest.html#idx:blob2:563">4.6</a> <a class="idx" href="IO.html#idx:blob2:863">4.16.2</a></dd>
468468 <dt>body</dt>
469469 <dd>
470 <a class="idx" href="glossary.html#idx:body:2081">D</a></dd>
470 <a class="idx" href="glossary.html#idx:body:2084">D</a></dd>
471471 <dt><a class="idx" href="toplevel.html#break/0">break/0</a></dt>
472472 <dd>
473 <a class="idx" href="cmdline.html#idx:break0:28">2.4.4</a> <a class="idx" href="debugoverview.html#idx:break0:51">2.9</a> <a class="idx" href="flags.html#idx:break0:70">2.11</a> <a class="idx" href="flags.html#idx:break0:117">2.11</a> <a class="idx" href="debugging.html#idx:break0:1678">8.4.2</a> <a class="idx" href="foreigninclude.html#idx:break0:1878">10.4.16</a></dd>
473 <a class="idx" href="cmdline.html#idx:break0:28">2.4.4</a> <a class="idx" href="debugoverview.html#idx:break0:51">2.9</a> <a class="idx" href="flags.html#idx:break0:70">2.11</a> <a class="idx" href="flags.html#idx:break0:117">2.11</a> <a class="idx" href="debugging.html#idx:break0:1681">8.4.2</a> <a class="idx" href="foreigninclude.html#idx:break0:1881">10.4.16</a></dd>
474474 <dt>broadcast</dt>
475475 <dd>
476 <a class="idx" href="broadcast.html#idx:broadcast:1939">A.4</a></dd>
476 <a class="idx" href="broadcast.html#idx:broadcast:1942">A.4</a></dd>
477477 <dt><a class="idx" href="broadcast.html#broadcast/1">broadcast/1</a></dt>
478478 <dd>
479 <a class="idx" href="broadcast.html#idx:broadcast1:1944">A.4</a> <a class="idx" href="broadcast.html#idx:broadcast1:1945">A.4</a></dd>
479 <a class="idx" href="broadcast.html#idx:broadcast1:1947">A.4</a> <a class="idx" href="broadcast.html#idx:broadcast1:1948">A.4</a></dd>
480480 <dt><a class="idx" href="broadcast.html#broadcast_request/1">broadcast_request/1</a></dt>
481481 <dt>built-in predicate</dt>
482482 <dd>
483 <a class="idx" href="glossary.html#idx:builtinpredicate:2079">D</a></dd>
483 <a class="idx" href="glossary.html#idx:builtinpredicate:2082">D</a></dd>
484484 <dt><a class="idx" href="streamstat.html#byte_count/2">byte_count/2</a></dt>
485485 <dd>
486 <a class="idx" href="IO.html#idx:bytecount2:894">4.16.2</a></dd>
486 <a class="idx" href="IO.html#idx:bytecount2:895">4.16.2</a></dd>
487487 <dt><a class="idx" href="metacall.html#call/1">call/1</a></dt>
488488 <dd>
489 <a class="idx" href="xref.html#idx:call1:292">3.7</a> <a class="idx" href="typetest.html#idx:call1:566">4.6</a> <a class="idx" href="typetest.html#idx:call1:568">4.6</a> <a class="idx" href="typetest.html#idx:call1:571">4.6</a> <a class="idx" href="control.html#idx:call1:597">4.8</a> <a class="idx" href="metacall.html#idx:call1:599">4.9</a> <a class="idx" href="exception.html#idx:call1:629">4.10</a> <a class="idx" href="exception.html#idx:call1:633">4.10</a> <a class="idx" href="exception.html#idx:call1:635">4.10</a> <a class="idx" href="debugger.html#idx:call1:1404">4.37</a> <a class="idx" href="statistics.html#idx:call1:1418">4.38</a> <a class="idx" href="profile.html#idx:call1:1423">4.39.1</a> <a class="idx" href="profile.html#idx:call1:1426">4.39.3</a> <a class="idx" href="profile.html#idx:call1:1427">4.39.3</a> <a class="idx" href="modules.html#idx:call1:1515">6</a> <a class="idx" href="coroutining.html#idx:call1:1640">7.2</a> <a class="idx" href="foreigninclude.html#idx:call1:1853">10.4.9</a> <a class="idx" href="breakpoint.html#idx:call1:2005">B.4</a></dd>
489 <a class="idx" href="xref.html#idx:call1:292">3.7</a> <a class="idx" href="typetest.html#idx:call1:567">4.6</a> <a class="idx" href="typetest.html#idx:call1:569">4.6</a> <a class="idx" href="typetest.html#idx:call1:572">4.6</a> <a class="idx" href="control.html#idx:call1:598">4.8</a> <a class="idx" href="metacall.html#idx:call1:600">4.9</a> <a class="idx" href="exception.html#idx:call1:630">4.10</a> <a class="idx" href="exception.html#idx:call1:634">4.10</a> <a class="idx" href="exception.html#idx:call1:636">4.10</a> <a class="idx" href="debugger.html#idx:call1:1406">4.37</a> <a class="idx" href="statistics.html#idx:call1:1420">4.38</a> <a class="idx" href="profile.html#idx:call1:1425">4.39.1</a> <a class="idx" href="profile.html#idx:call1:1428">4.39.3</a> <a class="idx" href="profile.html#idx:call1:1429">4.39.3</a> <a class="idx" href="modules.html#idx:call1:1517">6</a> <a class="idx" href="coroutining.html#idx:call1:1642">7.2</a> <a class="idx" href="foreigninclude.html#idx:call1:1856">10.4.9</a> <a class="idx" href="breakpoint.html#idx:call1:2008">B.4</a></dd>
490490 <dt><a class="idx" href="metacall.html#call/2">call/2</a></dt>
491491 <dd>
492 <a class="idx" href="typetest.html#idx:call2:567">4.6</a></dd>
492 <a class="idx" href="typetest.html#idx:call2:568">4.6</a></dd>
493493 <dt>call/3</dt>
494494 <dd>
495 <a class="idx" href="termrw.html#idx:call3:1012">4.19</a></dd>
495 <a class="idx" href="termrw.html#idx:call3:1013">4.19</a></dd>
496496 <dt>call/[2-8]</dt>
497497 <dd>
498 <a class="idx" href="metacall.html#idx:call28:600">4.9</a></dd>
498 <a class="idx" href="metacall.html#idx:call28:601">4.9</a></dd>
499499 <dt><a class="idx" href="metacall.html#call_cleanup/2">call_cleanup/2</a></dt>
500500 <dd>
501 <a class="idx" href="metacall.html#idx:callcleanup2:623">4.9</a> <a class="idx" href="metacall.html#idx:callcleanup2:624">4.9</a> <a class="idx" href="metacall.html#idx:callcleanup2:626">4.9</a> <a class="idx" href="IO.html#idx:callcleanup2:949">4.16.5</a> <a class="idx" href="manipstack.html#idx:callcleanup2:1990">B.1</a> <a class="idx" href="portabilitystrategies.html#idx:callcleanup2:2060">C.1</a></dd>
501 <a class="idx" href="metacall.html#idx:callcleanup2:624">4.9</a> <a class="idx" href="metacall.html#idx:callcleanup2:625">4.9</a> <a class="idx" href="metacall.html#idx:callcleanup2:627">4.9</a> <a class="idx" href="IO.html#idx:callcleanup2:950">4.16.5</a> <a class="idx" href="manipstack.html#idx:callcleanup2:1993">B.1</a> <a class="idx" href="portabilitystrategies.html#idx:callcleanup2:2063">C.1</a></dd>
502502 <dt><a class="idx" href="metacall.html#call_cleanup/3">call_cleanup/3</a></dt>
503503 <dt><a class="idx" href="DCG.html#call_dcg/3">call_dcg/3</a></dt>
504504 <dd>
505 <a class="idx" href="DCG.html#idx:calldcg3:708">4.12</a></dd>
505 <a class="idx" href="DCG.html#idx:calldcg3:709">4.12</a></dd>
506506 <dt><a class="idx" href="coroutining.html#call_residue_vars/2">call_residue_vars/2</a></dt>
507507 <dd>
508 <a class="idx" href="coroutining.html#idx:callresiduevars2:1649">7.2</a></dd>
508 <a class="idx" href="coroutining.html#idx:callresiduevars2:1651">7.2</a> <a class="idx" href="coroutining.html#idx:callresiduevars2:1652">7.2</a></dd>
509509 <dt><a class="idx" href="foreignlink.html#call_shared_object_function/2">call_shared_object_function/2</a></dt>
510510 <dt><a class="idx" href="metacall.html#call_with_depth_limit/3">call_with_depth_limit/3</a></dt>
511511 <dd>
512 <a class="idx" href="metacall.html#idx:callwithdepthlimit3:605">4.9</a> <a class="idx" href="metacall.html#idx:callwithdepthlimit3:608">4.9</a> <a class="idx" href="metacall.html#idx:callwithdepthlimit3:613">4.9</a></dd>
512 <a class="idx" href="metacall.html#idx:callwithdepthlimit3:606">4.9</a> <a class="idx" href="metacall.html#idx:callwithdepthlimit3:609">4.9</a> <a class="idx" href="metacall.html#idx:callwithdepthlimit3:614">4.9</a></dd>
513513 <dt><a class="idx" href="metacall.html#call_with_inference_limit/3">call_with_inference_limit/3</a></dt>
514514 <dd>
515 <a class="idx" href="metacall.html#idx:callwithinferencelimit3:609">4.9</a> <a class="idx" href="metacall.html#idx:callwithinferencelimit3:610">4.9</a> <a class="idx" href="metacall.html#idx:callwithinferencelimit3:611">4.9</a></dd>
515 <a class="idx" href="metacall.html#idx:callwithinferencelimit3:610">4.9</a> <a class="idx" href="metacall.html#idx:callwithinferencelimit3:611">4.9</a> <a class="idx" href="metacall.html#idx:callwithinferencelimit3:612">4.9</a></dd>
516516 <dt>call_with_time_limit/2</dt>
517517 <dd>
518 <a class="idx" href="metacall.html#idx:callwithtimelimit2:614">4.9</a> <a class="idx" href="metacall.html#idx:callwithtimelimit2:615">4.9</a></dd>
518 <a class="idx" href="metacall.html#idx:callwithtimelimit2:615">4.9</a> <a class="idx" href="metacall.html#idx:callwithtimelimit2:616">4.9</a></dd>
519519 <dt><a class="idx" href="typetest.html#callable/1">callable/1</a></dt>
520520 <dd>
521 <a class="idx" href="typetest.html#idx:callable1:570">4.6</a> <a class="idx" href="foreigninclude.html#idx:callable1:1831">10.4.3.1</a> <a class="idx" href="prolog_xref.html#idx:callable1:1960">A.25</a></dd>
521 <a class="idx" href="typetest.html#idx:callable1:571">4.6</a> <a class="idx" href="foreigninclude.html#idx:callable1:1834">10.4.3.1</a> <a class="idx" href="prolog_xref.html#idx:callable1:1963">A.25</a></dd>
522522 <dt><a class="idx" href="consulting.html#cancel_halt/1">cancel_halt/1</a></dt>
523523 <dd>
524 <a class="idx" href="consulting.html#idx:cancelhalt1:463">4.3</a> <a class="idx" href="toplevel.html#idx:cancelhalt1:1382">4.35</a> <a class="idx" href="foreigninclude.html#idx:cancelhalt1:1893">10.4.21</a></dd>
524 <a class="idx" href="consulting.html#idx:cancelhalt1:464">4.3</a> <a class="idx" href="toplevel.html#idx:cancelhalt1:1384">4.35</a> <a class="idx" href="foreigninclude.html#idx:cancelhalt1:1896">10.4.21</a></dd>
525525 <dt><a class="idx" href="exception.html#catch/3">catch/3</a></dt>
526526 <dd>
527 <a class="idx" href="exception.html#idx:catch3:627">4.10</a> <a class="idx" href="exception.html#idx:catch3:632">4.10</a> <a class="idx" href="exception.html#idx:catch3:634">4.10</a> <a class="idx" href="exception.html#idx:catch3:636">4.10</a> <a class="idx" href="exception.html#idx:catch3:637">4.10</a> <a class="idx" href="exception.html#idx:catch3:638">4.10</a> <a class="idx" href="exception.html#idx:catch3:640">4.10</a> <a class="idx" href="exception.html#idx:catch3:641">4.10</a> <a class="idx" href="exception.html#idx:catch3:642">4.10</a> <a class="idx" href="exception.html#idx:catch3:643">4.10</a> <a class="idx" href="exception.html#idx:catch3:648">4.10.1</a> <a class="idx" href="exception.html#idx:catch3:649">4.10.1</a> <a class="idx" href="exception.html#idx:catch3:650">4.10.1</a> <a class="idx" href="termrw.html#idx:catch3:1050">4.19</a> <a class="idx" href="manipatom.html#idx:catch3:1143">4.21</a> <a class="idx" href="toplevel.html#idx:catch3:1378">4.35</a> <a class="idx" href="profile.html#idx:catch3:1425">4.39.1</a> <a class="idx" href="threadcreate.html#idx:catch3:1702">9.1</a> <a class="idx" href="thmonitor.html#idx:catch3:1729">9.2</a> <a class="idx" href="thmonitor.html#idx:catch3:1734">9.2</a> <a class="idx" href="manipstack.html#idx:catch3:1988">B.1</a> <a class="idx" href="excepthook.html#idx:catch3:2010">B.5</a> <a class="idx" href="exception3.html#idx:catch3:2015">B.6</a> <a class="idx" href="exception3.html#idx:catch3:2018">B.6</a> <a class="idx" href="predsummary.html#idx:catch3:2166">F.1</a></dd>
527 <a class="idx" href="exception.html#idx:catch3:628">4.10</a> <a class="idx" href="exception.html#idx:catch3:633">4.10</a> <a class="idx" href="exception.html#idx:catch3:635">4.10</a> <a class="idx" href="exception.html#idx:catch3:637">4.10</a> <a class="idx" href="exception.html#idx:catch3:638">4.10</a> <a class="idx" href="exception.html#idx:catch3:639">4.10</a> <a class="idx" href="exception.html#idx:catch3:641">4.10</a> <a class="idx" href="exception.html#idx:catch3:642">4.10</a> <a class="idx" href="exception.html#idx:catch3:643">4.10</a> <a class="idx" href="exception.html#idx:catch3:644">4.10</a> <a class="idx" href="exception.html#idx:catch3:649">4.10.1</a> <a class="idx" href="exception.html#idx:catch3:650">4.10.1</a> <a class="idx" href="exception.html#idx:catch3:651">4.10.1</a> <a class="idx" href="termrw.html#idx:catch3:1051">4.19</a> <a class="idx" href="manipatom.html#idx:catch3:1144">4.21</a> <a class="idx" href="toplevel.html#idx:catch3:1380">4.35</a> <a class="idx" href="profile.html#idx:catch3:1427">4.39.1</a> <a class="idx" href="threadcreate.html#idx:catch3:1705">9.1</a> <a class="idx" href="thmonitor.html#idx:catch3:1732">9.2</a> <a class="idx" href="thmonitor.html#idx:catch3:1737">9.2</a> <a class="idx" href="manipstack.html#idx:catch3:1991">B.1</a> <a class="idx" href="excepthook.html#idx:catch3:2013">B.5</a> <a class="idx" href="exception3.html#idx:catch3:2018">B.6</a> <a class="idx" href="exception3.html#idx:catch3:2021">B.6</a> <a class="idx" href="predsummary.html#idx:catch3:2173">F.1</a></dd>
528528 <dt><a class="idx" href="clpfd.html#chain/2">chain/2</a></dt>
529529 <dt><a class="idx" href="manipatom.html#char_code/2">char_code/2</a></dt>
530530 <dd>
531 <a class="idx" href="chars.html#idx:charcode2:313">4.2</a></dd>
531 <a class="idx" href="chars.html#idx:charcode2:314">4.2</a></dd>
532532 <dt><a class="idx" href="charconv.html#char_conversion/2">char_conversion/2</a></dt>
533533 <dd>
534 <a class="idx" href="flags.html#idx:charconversion2:71">2.11</a> <a class="idx" href="charconv.html#idx:charconversion2:1200">4.25</a></dd>
534 <a class="idx" href="flags.html#idx:charconversion2:71">2.11</a> <a class="idx" href="charconv.html#idx:charconversion2:1201">4.25</a></dd>
535535 <dt><a class="idx" href="chartype.html#char_type/2">char_type/2</a></dt>
536536 <dd>
537 <a class="idx" href="syntax.html#idx:chartype2:189">2.15.2.4</a> <a class="idx" href="locale.html#idx:chartype2:1160">4.22</a> <a class="idx" href="chartype.html#idx:chartype2:1177">4.23</a> <a class="idx" href="chartype.html#idx:chartype2:1181">4.23.1</a> <a class="idx" href="chartype.html#idx:chartype2:1182">4.23.1</a></dd>
537 <a class="idx" href="syntax.html#idx:chartype2:189">2.15.2.4</a> <a class="idx" href="locale.html#idx:chartype2:1161">4.22</a> <a class="idx" href="chartype.html#idx:chartype2:1178">4.23</a> <a class="idx" href="chartype.html#idx:chartype2:1182">4.23.1</a> <a class="idx" href="chartype.html#idx:chartype2:1183">4.23.1</a></dd>
538538 <dt>character set</dt>
539539 <dd>
540540 <a class="idx" href="syntax.html#idx:characterset:181">2.15.1.1</a></dd>
541541 <dt><a class="idx" href="streamstat.html#character_count/2">character_count/2</a></dt>
542542 <dd>
543 <a class="idx" href="IO.html#idx:charactercount2:893">4.16.2</a> <a class="idx" href="streamstat.html#idx:charactercount2:958">4.17</a></dd>
543 <a class="idx" href="IO.html#idx:charactercount2:894">4.16.2</a> <a class="idx" href="streamstat.html#idx:charactercount2:959">4.17</a></dd>
544544 <dt><a class="idx" href="files.html#chdir/1">chdir/1</a></dt>
545545 <dd>
546 <a class="idx" href="files.html#idx:chdir1:1372">4.34</a></dd>
546 <a class="idx" href="files.html#idx:chdir1:1374">4.34</a></dd>
547547 <dt><a class="idx" href="check.html#check/0">check/0</a></dt>
548548 <dd>
549 <a class="idx" href="consulting.html#idx:check0:420">4.3</a></dd>
549 <a class="idx" href="consulting.html#idx:check0:421">4.3</a></dd>
550550 <dt><a class="idx" href="strings.html#check:string_predicate/1">check:string_predicate/1</a></dt>
551551 <dt><a class="idx" href="strings.html#check:valid_string_goal/1">check:valid_string_goal/1</a></dt>
552552 <dt><a class="idx" href="predicate_options.html#check_predicate_option/3">check_predicate_option/3</a></dt>
554554 <dt><a class="idx" href="check.html#checker/2">checker/2</a></dt>
555555 <dt>choice point</dt>
556556 <dd>
557 <a class="idx" href="glossary.html#idx:choicepoint:2082">D</a></dd>
557 <a class="idx" href="glossary.html#idx:choicepoint:2085">D</a></dd>
558558 <dt><a class="idx" href="practical.html#chr_constraint/1">chr_constraint/1</a></dt>
559559 <dd>
560 <a class="idx" href="practical.html#idx:chrconstraint1:1673">8.3.2</a> <a class="idx" href="sicstus-chr.html#idx:chrconstraint1:1685">8.6.1</a></dd>
560 <a class="idx" href="practical.html#idx:chrconstraint1:1676">8.3.2</a> <a class="idx" href="sicstus-chr.html#idx:chrconstraint1:1688">8.6.1</a></dd>
561561 <dt><a class="idx" href="debugging.html#chr_leash/1">chr_leash/1</a></dt>
562562 <dt><a class="idx" href="debugging.html#chr_notrace/0">chr_notrace/0</a></dt>
563563 <dd>
564 <a class="idx" href="debugging.html#idx:chrnotrace0:1677">8.4.2</a></dd>
564 <a class="idx" href="debugging.html#idx:chrnotrace0:1680">8.4.2</a></dd>
565565 <dt><a class="idx" href="SyntaxAndSemantics.html#chr_option/2">chr_option/2</a></dt>
566566 <dd>
567 <a class="idx" href="sicstus-chr.html#idx:chroption2:1686">8.6.1</a></dd>
567 <a class="idx" href="sicstus-chr.html#idx:chroption2:1689">8.6.1</a></dd>
568568 <dt><a class="idx" href="debugging.html#chr_show_store/1">chr_show_store/1</a></dt>
569569 <dt><a class="idx" href="debugging.html#chr_trace/0">chr_trace/0</a></dt>
570570 <dd>
571 <a class="idx" href="debugging.html#idx:chrtrace0:1676">8.4.2</a></dd>
571 <a class="idx" href="debugging.html#idx:chrtrace0:1679">8.4.2</a></dd>
572572 <dt><a class="idx" href="practical.html#chr_type/1">chr_type/1</a></dt>
573573 <dd>
574 <a class="idx" href="practical.html#idx:chrtype1:1674">8.3.2</a></dd>
574 <a class="idx" href="practical.html#idx:chrtype1:1677">8.3.2</a></dd>
575575 <dt><a class="idx" href="clpfd.html#circuit/1">circuit/1</a></dt>
576576 <dt>clause</dt>
577577 <dd>
578 <a class="idx" href="glossary.html#idx:clause:2083">D</a></dd>
578 <a class="idx" href="glossary.html#idx:clause:2086">D</a></dd>
579579 <dt><a class="idx" href="examineprog.html#clause/2">clause/2</a></dt>
580580 <dd>
581 <a class="idx" href="listing.html#idx:clause2:549">4.5</a> <a class="idx" href="control.html#idx:clause2:598">4.8</a> <a class="idx" href="examineprog.html#idx:clause2:828">4.15</a> <a class="idx" href="runtime.html#idx:clause2:1912">11</a></dd>
581 <a class="idx" href="listing.html#idx:clause2:550">4.5</a> <a class="idx" href="control.html#idx:clause2:599">4.8</a> <a class="idx" href="examineprog.html#idx:clause2:829">4.15</a> <a class="idx" href="runtime.html#idx:clause2:1915">11</a></dd>
582582 <dt><a class="idx" href="examineprog.html#clause/3">clause/3</a></dt>
583583 <dd>
584 <a class="idx" href="db.html#idx:clause3:737">4.13</a> <a class="idx" href="db.html#idx:clause3:750">4.13</a> <a class="idx" href="examineprog.html#idx:clause3:832">4.15</a> <a class="idx" href="examineprog.html#idx:clause3:838">4.15</a> <a class="idx" href="qsavelimits.html#idx:clause3:1921">11.1</a></dd>
584 <a class="idx" href="db.html#idx:clause3:738">4.13</a> <a class="idx" href="db.html#idx:clause3:751">4.13</a> <a class="idx" href="examineprog.html#idx:clause3:833">4.15</a> <a class="idx" href="examineprog.html#idx:clause3:839">4.15</a> <a class="idx" href="qsavelimits.html#idx:clause3:1924">11.1</a></dd>
585585 <dt>clause/[2,3]</dt>
586586 <dd>
587587 <a class="idx" href="flags.html#idx:clause23:96">2.11</a></dd>
588588 <dt><a class="idx" href="examineprog.html#clause_property/2">clause_property/2</a></dt>
589589 <dd>
590 <a class="idx" href="consulting.html#idx:clauseproperty2:418">4.3</a> <a class="idx" href="consulting.html#idx:clauseproperty2:441">4.3</a> <a class="idx" href="examineprog.html#idx:clauseproperty2:812">4.15</a> <a class="idx" href="examineprog.html#idx:clauseproperty2:814">4.15</a> <a class="idx" href="examineprog.html#idx:clauseproperty2:835">4.15</a> <a class="idx" href="manipstack.html#idx:clauseproperty2:1985">B.1</a></dd>
590 <a class="idx" href="consulting.html#idx:clauseproperty2:419">4.3</a> <a class="idx" href="consulting.html#idx:clauseproperty2:442">4.3</a> <a class="idx" href="examineprog.html#idx:clauseproperty2:813">4.15</a> <a class="idx" href="examineprog.html#idx:clauseproperty2:815">4.15</a> <a class="idx" href="examineprog.html#idx:clauseproperty2:836">4.15</a> <a class="idx" href="manipstack.html#idx:clauseproperty2:1988">B.1</a></dd>
591591 <dt><a class="idx" href="IO.html#close/1">close/1</a></dt>
592592 <dd>
593 <a class="idx" href="IO.html#idx:close1:840">4.16</a> <a class="idx" href="IO.html#idx:close1:874">4.16.2</a> <a class="idx" href="IO.html#idx:close1:887">4.16.2</a></dd>
593 <a class="idx" href="IO.html#idx:close1:841">4.16</a> <a class="idx" href="IO.html#idx:close1:875">4.16.2</a> <a class="idx" href="IO.html#idx:close1:888">4.16.2</a></dd>
594594 <dt><a class="idx" href="IO.html#close/2">close/2</a></dt>
595595 <dt><a class="idx" href="iostream.html#close_any/1">close_any/1</a></dt>
596596 <dt><a class="idx" href="DDE.html#close_dde_conversation/1">close_dde_conversation/1</a></dt>
597597 <dt><a class="idx" href="foreignlink.html#close_shared_object/1">close_shared_object/1</a></dt>
598598 <dt><a class="idx" href="chartype.html#code_type/2">code_type/2</a></dt>
599599 <dd>
600 <a class="idx" href="locale.html#idx:codetype2:1161">4.22</a> <a class="idx" href="chartype.html#idx:codetype2:1172">4.23</a> <a class="idx" href="chartype.html#idx:codetype2:1180">4.23.1</a></dd>
600 <a class="idx" href="locale.html#idx:codetype2:1162">4.22</a> <a class="idx" href="chartype.html#idx:codetype2:1173">4.23</a> <a class="idx" href="chartype.html#idx:codetype2:1181">4.23.1</a></dd>
601601 <dt>collate</dt>
602602 <dd>
603 <a class="idx" href="chartype.html#idx:collate:1187">4.23.3</a></dd>
603 <a class="idx" href="chartype.html#idx:collate:1188">4.23.3</a></dd>
604604 <dt><a class="idx" href="chartype.html#collation_key/2">collation_key/2</a></dt>
605605 <dd>
606 <a class="idx" href="locale.html#idx:collationkey2:1162">4.22</a> <a class="idx" href="chartype.html#idx:collationkey2:1189">4.23.3</a> <a class="idx" href="chartype.html#idx:collationkey2:1192">4.23.3</a> <a class="idx" href="system.html#idx:collationkey2:1310">4.33</a></dd>
606 <a class="idx" href="locale.html#idx:collationkey2:1163">4.22</a> <a class="idx" href="chartype.html#idx:collationkey2:1190">4.23.3</a> <a class="idx" href="chartype.html#idx:collationkey2:1193">4.23.3</a> <a class="idx" href="system.html#idx:collationkey2:1312">4.33</a></dd>
607607 <dt>command line, arguments</dt>
608608 <dd>
609609 <a class="idx" href="cmdline.html#idx:commandlinearguments:24">2.4.2</a></dd>
610610 <dt><a class="idx" href="foreigninclude.html#compare()">compare()</a></dt>
611611 <dt>compare,language-specific</dt>
612612 <dd>
613 <a class="idx" href="chartype.html#idx:comparelanguagespecific:1188">4.23.3</a></dd>
613 <a class="idx" href="chartype.html#idx:comparelanguagespecific:1189">4.23.3</a></dd>
614614 <dt><a class="idx" href="compare.html#compare/3">compare/3</a></dt>
615615 <dd>
616 <a class="idx" href="cyclic.html#idx:compare3:202">2.16</a> <a class="idx" href="builtinlist.html#idx:compare3:1236">4.28</a> <a class="idx" href="foreigninclude.html#idx:compare3:1864">10.4.14.1</a> <a class="idx" href="portabilitystrategies.html#idx:compare3:2063">C.1</a> <a class="idx" href="portabilitystrategies.html#idx:compare3:2064">C.1</a> <a class="idx" href="portabilitystrategies.html#idx:compare3:2065">C.1</a> <a class="idx" href="portabilitystrategies.html#idx:compare3:2068">C.1</a></dd>
616 <a class="idx" href="cyclic.html#idx:compare3:202">2.16</a> <a class="idx" href="builtinlist.html#idx:compare3:1238">4.28</a> <a class="idx" href="foreigninclude.html#idx:compare3:1867">10.4.14.1</a> <a class="idx" href="portabilitystrategies.html#idx:compare3:2066">C.1</a> <a class="idx" href="portabilitystrategies.html#idx:compare3:2067">C.1</a> <a class="idx" href="portabilitystrategies.html#idx:compare3:2068">C.1</a> <a class="idx" href="portabilitystrategies.html#idx:compare3:2071">C.1</a></dd>
617617 <dt><a class="idx" href="consulting.html#compile_aux_clauses/1">compile_aux_clauses/1</a></dt>
618618 <dd>
619 <a class="idx" href="consulting.html#idx:compileauxclauses1:344">4.3</a></dd>
619 <a class="idx" href="consulting.html#idx:compileauxclauses1:345">4.3</a></dd>
620620 <dt><a class="idx" href="dynamic.html#compile_predicates/1">compile_predicates/1</a></dt>
621621 <dd>
622 <a class="idx" href="dynamic.html#idx:compilepredicates1:779">4.14</a></dd>
622 <a class="idx" href="dynamic.html#idx:compilepredicates1:780">4.14</a></dd>
623623 <dt><a class="idx" href="consulting.html#compiling/0">compiling/0</a></dt>
624624 <dd>
625 <a class="idx" href="consulting.html#idx:compiling0:534">4.3.3</a></dd>
625 <a class="idx" href="consulting.html#idx:compiling0:535">4.3.3</a></dd>
626626 <dt><a class="idx" href="ugraphs.html#complement/2">complement/2</a></dt>
627627 <dt><a class="idx" href="ugraphs.html#compose/3">compose/3</a></dt>
628628 <dt>compound</dt>
629629 <dd>
630 <a class="idx" href="glossary.html#idx:compound:2084">D</a></dd>
630 <a class="idx" href="glossary.html#idx:compound:2087">D</a></dd>
631631 <dt><a class="idx" href="typetest.html#compound/1">compound/1</a></dt>
632632 <dt><a class="idx" href="manipterm.html#compound_name_arguments/3">compound_name_arguments/3</a></dt>
633633 <dd>
634 <a class="idx" href="typetest.html#idx:compoundnamearguments3:565">4.6</a> <a class="idx" href="manipterm.html#idx:compoundnamearguments3:1076">4.20</a> <a class="idx" href="manipterm.html#idx:compoundnamearguments3:1079">4.20</a> <a class="idx" href="ext-syntax.html#idx:compoundnamearguments3:1480">5.3.2</a> <a class="idx" href="ext-syntax.html#idx:compoundnamearguments3:1482">5.3.2</a> <a class="idx" href="dicts.html#idx:compoundnamearguments3:1486">5.4.1</a></dd>
634 <a class="idx" href="typetest.html#idx:compoundnamearguments3:566">4.6</a> <a class="idx" href="manipterm.html#idx:compoundnamearguments3:1077">4.20</a> <a class="idx" href="manipterm.html#idx:compoundnamearguments3:1080">4.20</a> <a class="idx" href="ext-syntax.html#idx:compoundnamearguments3:1482">5.3.2</a> <a class="idx" href="ext-syntax.html#idx:compoundnamearguments3:1484">5.3.2</a> <a class="idx" href="dicts.html#idx:compoundnamearguments3:1488">5.4.1</a></dd>
635635 <dt><a class="idx" href="manipterm.html#compound_name_arity/3">compound_name_arity/3</a></dt>
636636 <dd>
637 <a class="idx" href="typetest.html#idx:compoundnamearity3:564">4.6</a> <a class="idx" href="manipterm.html#idx:compoundnamearity3:1073">4.20</a> <a class="idx" href="manipterm.html#idx:compoundnamearity3:1080">4.20</a> <a class="idx" href="ext-syntax.html#idx:compoundnamearity3:1479">5.3.2</a> <a class="idx" href="ext-syntax.html#idx:compoundnamearity3:1481">5.3.2</a> <a class="idx" href="dicts.html#idx:compoundnamearity3:1485">5.4.1</a></dd>
637 <a class="idx" href="typetest.html#idx:compoundnamearity3:565">4.6</a> <a class="idx" href="manipterm.html#idx:compoundnamearity3:1074">4.20</a> <a class="idx" href="manipterm.html#idx:compoundnamearity3:1081">4.20</a> <a class="idx" href="ext-syntax.html#idx:compoundnamearity3:1481">5.3.2</a> <a class="idx" href="ext-syntax.html#idx:compoundnamearity3:1483">5.3.2</a> <a class="idx" href="dicts.html#idx:compoundnamearity3:1487">5.4.1</a></dd>
638638 <dt>concat_atom/3</dt>
639639 <dd>
640 <a class="idx" href="manipatom.html#idx:concatatom3:1156">4.21</a></dd>
640 <a class="idx" href="manipatom.html#idx:concatatom3:1157">4.21</a></dd>
641641 <dt><a class="idx" href="simplex.html#constraint/3">constraint/3</a></dt>
642642 <dd>
643 <a class="idx" href="simplex.html#idx:constraint3:1978">A.31</a></dd>
643 <a class="idx" href="simplex.html#idx:constraint3:1981">A.31</a></dd>
644644 <dt><a class="idx" href="simplex.html#constraint/4">constraint/4</a></dt>
645645 <dt><a class="idx" href="simplex.html#constraint_add/4">constraint_add/4</a></dt>
646646 <dt><a class="idx" href="consulting.html#consult/1">consult/1</a></dt>
647647 <dd>
648 <a class="idx" href="quickstart.html#idx:consult1:6">2.1.1.1</a> <a class="idx" href="initfile.html#idx:consult1:10">2.2</a> <a class="idx" href="hooks.html#idx:consult1:148">2.12</a> <a class="idx" href="pceemacs.html#idx:consult1:283">3.4.3.1</a> <a class="idx" href="consulting.html#idx:consult1:328">4.3</a> <a class="idx" href="consulting.html#idx:consult1:349">4.3</a> <a class="idx" href="consulting.html#idx:consult1:355">4.3</a> <a class="idx" href="consulting.html#idx:consult1:361">4.3</a> <a class="idx" href="consulting.html#idx:consult1:372">4.3</a> <a class="idx" href="consulting.html#idx:consult1:392">4.3</a> <a class="idx" href="consulting.html#idx:consult1:396">4.3</a> <a class="idx" href="consulting.html#idx:consult1:397">4.3</a> <a class="idx" href="consulting.html#idx:consult1:399">4.3</a> <a class="idx" href="consulting.html#idx:consult1:401">4.3</a> <a class="idx" href="consulting.html#idx:consult1:410">4.3</a> <a class="idx" href="consulting.html#idx:consult1:412">4.3</a> <a class="idx" href="consulting.html#idx:consult1:422">4.3</a> <a class="idx" href="consulting.html#idx:consult1:517">4.3.2.1</a> <a class="idx" href="consulting.html#idx:consult1:518">4.3.2.1</a> <a class="idx" href="consulting.html#idx:consult1:524">4.3.2.1</a> <a class="idx" href="consulting.html#idx:consult1:530">4.3.3</a> <a class="idx" href="consulting.html#idx:consult1:531">4.3.3</a> <a class="idx" href="consulting.html#idx:consult1:532">4.3.3</a> <a class="idx" href="dynamic.html#idx:consult1:784">4.14</a></dd>
648 <a class="idx" href="quickstart.html#idx:consult1:6">2.1.1.1</a> <a class="idx" href="initfile.html#idx:consult1:10">2.2</a> <a class="idx" href="hooks.html#idx:consult1:148">2.12</a> <a class="idx" href="pceemacs.html#idx:consult1:283">3.4.3.1</a> <a class="idx" href="consulting.html#idx:consult1:329">4.3</a> <a class="idx" href="consulting.html#idx:consult1:350">4.3</a> <a class="idx" href="consulting.html#idx:consult1:356">4.3</a> <a class="idx" href="consulting.html#idx:consult1:362">4.3</a> <a class="idx" href="consulting.html#idx:consult1:373">4.3</a> <a class="idx" href="consulting.html#idx:consult1:393">4.3</a> <a class="idx" href="consulting.html#idx:consult1:397">4.3</a> <a class="idx" href="consulting.html#idx:consult1:398">4.3</a> <a class="idx" href="consulting.html#idx:consult1:400">4.3</a> <a class="idx" href="consulting.html#idx:consult1:402">4.3</a> <a class="idx" href="consulting.html#idx:consult1:411">4.3</a> <a class="idx" href="consulting.html#idx:consult1:413">4.3</a> <a class="idx" href="consulting.html#idx:consult1:423">4.3</a> <a class="idx" href="consulting.html#idx:consult1:518">4.3.2.1</a> <a class="idx" href="consulting.html#idx:consult1:519">4.3.2.1</a> <a class="idx" href="consulting.html#idx:consult1:525">4.3.2.1</a> <a class="idx" href="consulting.html#idx:consult1:531">4.3.3</a> <a class="idx" href="consulting.html#idx:consult1:532">4.3.3</a> <a class="idx" href="consulting.html#idx:consult1:533">4.3.3</a> <a class="idx" href="dynamic.html#idx:consult1:785">4.14</a></dd>
649649 <dt>context module</dt>
650650 <dd>
651 <a class="idx" href="glossary.html#idx:contextmodule:2085">D</a></dd>
651 <a class="idx" href="glossary.html#idx:contextmodule:2088">D</a></dd>
652652 <dt><a class="idx" href="ctxmodule.html#context_module/1">context_module/1</a></dt>
653653 <dd>
654 <a class="idx" href="metapred.html#idx:contextmodule1:1556">6.4</a> <a class="idx" href="ctxmodule.html#idx:contextmodule1:1601">6.13</a> <a class="idx" href="foreigninclude.html#idx:contextmodule1:1855">10.4.9.2</a></dd>
654 <a class="idx" href="metapred.html#idx:contextmodule1:1558">6.4</a> <a class="idx" href="ctxmodule.html#idx:contextmodule1:1603">6.13</a> <a class="idx" href="foreigninclude.html#idx:contextmodule1:1858">10.4.9.2</a></dd>
655655 <dt>convert_time/2</dt>
656656 <dd>
657657 <a class="idx" href="flags.html#idx:converttime2:113">2.11</a></dd>
658658 <dt>convert_time/[2,8]</dt>
659659 <dd>
660 <a class="idx" href="files.html#idx:converttime28:1353">4.34</a></dd>
660 <a class="idx" href="files.html#idx:converttime28:1355">4.34</a></dd>
661661 <dt>copy_file/2</dt>
662662 <dd>
663 <a class="idx" href="system.html#idx:copyfile2:1300">4.33</a></dd>
663 <a class="idx" href="system.html#idx:copyfile2:1302">4.33</a></dd>
664664 <dt><a class="idx" href="db.html#copy_predicate_clauses/2">copy_predicate_clauses/2</a></dt>
665665 <dt><a class="idx" href="chario.html#copy_stream_data/2">copy_stream_data/2</a></dt>
666666 <dd>
667 <a class="idx" href="chario.html#idx:copystreamdata2:996">4.18</a></dd>
667 <a class="idx" href="chario.html#idx:copystreamdata2:997">4.18</a></dd>
668668 <dt><a class="idx" href="chario.html#copy_stream_data/3">copy_stream_data/3</a></dt>
669669 <dd>
670 <a class="idx" href="IO.html#idx:copystreamdata3:900">4.16.2</a></dd>
670 <a class="idx" href="IO.html#idx:copystreamdata3:901">4.16.2</a></dd>
671671 <dt><a class="idx" href="manipterm.html#copy_term/2">copy_term/2</a></dt>
672672 <dd>
673 <a class="idx" href="cyclic.html#idx:copyterm2:203">2.16</a> <a class="idx" href="compare.html#idx:copyterm2:585">4.7.2</a> <a class="idx" href="manipterm.html#idx:copyterm2:1093">4.20</a> <a class="idx" href="manipterm.html#idx:copyterm2:1100">4.20.1</a> <a class="idx" href="manipterm.html#idx:copyterm2:1110">4.20.1</a> <a class="idx" href="dicts.html#idx:copyterm2:1496">5.4.2.1</a> <a class="idx" href="extvar.html#idx:copyterm2:1617">7</a> <a class="idx" href="attvar.html#idx:copyterm2:1632">7.1.3</a> <a class="idx" href="gvar.html#idx:copyterm2:1659">7.3</a></dd>
673 <a class="idx" href="cyclic.html#idx:copyterm2:203">2.16</a> <a class="idx" href="compare.html#idx:copyterm2:586">4.7.2</a> <a class="idx" href="manipterm.html#idx:copyterm2:1094">4.20</a> <a class="idx" href="manipterm.html#idx:copyterm2:1101">4.20.1</a> <a class="idx" href="manipterm.html#idx:copyterm2:1111">4.20.1</a> <a class="idx" href="dicts.html#idx:copyterm2:1498">5.4.2.1</a> <a class="idx" href="extvar.html#idx:copyterm2:1619">7</a> <a class="idx" href="attvar.html#idx:copyterm2:1634">7.1.3</a> <a class="idx" href="gvar.html#idx:copyterm2:1662">7.3</a></dd>
674674 <dt><a class="idx" href="attvar.html#copy_term/3">copy_term/3</a></dt>
675675 <dd>
676 <a class="idx" href="termrw.html#idx:copyterm3:1020">4.19</a> <a class="idx" href="attvar.html#idx:copyterm3:1627">7.1.2</a> <a class="idx" href="attvar.html#idx:copyterm3:1629">7.1.2</a></dd>
676 <a class="idx" href="termrw.html#idx:copyterm3:1021">4.19</a> <a class="idx" href="attvar.html#idx:copyterm3:1629">7.1.2</a> <a class="idx" href="attvar.html#idx:copyterm3:1631">7.1.2</a></dd>
677677 <dt><a class="idx" href="attvar.html#copy_term_nat/2">copy_term_nat/2</a></dt>
678678 <dt>count_atom_results/3</dt>
679679 <dd>
680 <a class="idx" href="ctxmodule.html#idx:countatomresults3:1596">6.13</a> <a class="idx" href="ctxmodule.html#idx:countatomresults3:1598">6.13</a></dd>
680 <a class="idx" href="ctxmodule.html#idx:countatomresults3:1598">6.13</a> <a class="idx" href="ctxmodule.html#idx:countatomresults3:1600">6.13</a></dd>
681681 <dt><a class="idx" href="threadpool.html#create_pool/1">create_pool/1</a></dt>
682682 <dt><a class="idx" href="flags.html#create_prolog_flag/3">create_prolog_flag/3</a></dt>
683683 <dd>
684 <a class="idx" href="flags.html#idx:createprologflag3:125">2.11</a> <a class="idx" href="flags.html#idx:createprologflag3:126">2.11</a> <a class="idx" href="flags.html#idx:createprologflag3:136">2.11</a> <a class="idx" href="foreigninclude.html#idx:createprologflag3:1872">10.4.14.4</a></dd>
684 <a class="idx" href="flags.html#idx:createprologflag3:125">2.11</a> <a class="idx" href="flags.html#idx:createprologflag3:126">2.11</a> <a class="idx" href="flags.html#idx:createprologflag3:136">2.11</a> <a class="idx" href="foreigninclude.html#idx:createprologflag3:1875">10.4.14.4</a></dd>
685685 <dt><a class="idx" href="csv.html#csv/3">csv/3</a></dt>
686686 <dt><a class="idx" href="csv.html#csv/4">csv/4</a></dt>
687687 <dt><a class="idx" href="csv.html#csv_read_file/2">csv_read_file/2</a></dt>
688688 <dd>
689 <a class="idx" href="builtinlist.html#idx:csvreadfile2:1227">4.28</a></dd>
689 <a class="idx" href="builtinlist.html#idx:csvreadfile2:1229">4.28</a></dd>
690690 <dt><a class="idx" href="csv.html#csv_read_file/3">csv_read_file/3</a></dt>
691691 <dt><a class="idx" href="csv.html#csv_read_file_row/3">csv_read_file_row/3</a></dt>
692692 <dt><a class="idx" href="csv.html#csv_write_file/2">csv_write_file/2</a></dt>
697697 <dt><a class="idx" href="miscarith.html#current_arithmetic_function/1">current_arithmetic_function/1</a></dt>
698698 <dt><a class="idx" href="examineprog.html#current_atom/1">current_atom/1</a></dt>
699699 <dd>
700 <a class="idx" href="examineprog.html#idx:currentatom1:791">4.15</a></dd>
700 <a class="idx" href="examineprog.html#idx:currentatom1:792">4.15</a></dd>
701701 <dt><a class="idx" href="examineprog.html#current_blob/2">current_blob/2</a></dt>
702702 <dd>
703 <a class="idx" href="foreigninclude.html#idx:currentblob2:1851">10.4.7.1</a></dd>
703 <a class="idx" href="foreigninclude.html#idx:currentblob2:1854">10.4.7.1</a></dd>
704704 <dt><a class="idx" href="charconv.html#current_char_conversion/2">current_char_conversion/2</a></dt>
705705 <dd>
706 <a class="idx" href="charconv.html#idx:currentcharconversion2:1199">4.25</a></dd>
706 <a class="idx" href="charconv.html#idx:currentcharconversion2:1200">4.25</a></dd>
707707 <dt><a class="idx" href="examineprog.html#current_flag/1">current_flag/1</a></dt>
708708 <dt><a class="idx" href="foreignlink.html#current_foreign_library/2">current_foreign_library/2</a></dt>
709709 <dd>
710 <a class="idx" href="runtime.html#idx:currentforeignlibrary2:1908">11</a></dd>
710 <a class="idx" href="runtime.html#idx:currentforeignlibrary2:1911">11</a></dd>
711711 <dt><a class="idx" href="format.html#current_format_predicate/2">current_format_predicate/2</a></dt>
712712 <dt><a class="idx" href="examineprog.html#current_functor/2">current_functor/2</a></dt>
713713 <dt><a class="idx" href="IO.html#current_input/1">current_input/1</a></dt>
714714 <dd>
715 <a class="idx" href="consulting.html#idx:currentinput1:453">4.3</a> <a class="idx" href="IO.html#idx:currentinput1:855">4.16.1</a> <a class="idx" href="IO.html#idx:currentinput1:939">4.16.3</a></dd>
715 <a class="idx" href="consulting.html#idx:currentinput1:454">4.3</a> <a class="idx" href="IO.html#idx:currentinput1:856">4.16.1</a> <a class="idx" href="IO.html#idx:currentinput1:940">4.16.3</a></dd>
716716 <dt><a class="idx" href="examineprog.html#current_key/1">current_key/1</a></dt>
717717 <dd>
718 <a class="idx" href="db.html#idx:currentkey1:746">4.13</a></dd>
718 <a class="idx" href="db.html#idx:currentkey1:747">4.13</a></dd>
719719 <dt><a class="idx" href="locale.html#current_locale/1">current_locale/1</a></dt>
720720 <dt><a class="idx" href="manipmodule.html#current_module/1">current_module/1</a></dt>
721721 <dd>
722 <a class="idx" href="examineprog.html#idx:currentmodule1:797">4.15</a></dd>
722 <a class="idx" href="examineprog.html#idx:currentmodule1:798">4.15</a></dd>
723723 <dt><a class="idx" href="operators.html#current_op/3">current_op/3</a></dt>
724724 <dt><a class="idx" href="predicate_options.html#current_option_arg/2">current_option_arg/2</a></dt>
725725 <dt><a class="idx" href="IO.html#current_output/1">current_output/1</a></dt>
726726 <dd>
727 <a class="idx" href="IO.html#idx:currentoutput1:856">4.16.1</a> <a class="idx" href="IO.html#idx:currentoutput1:940">4.16.3</a></dd>
727 <a class="idx" href="IO.html#idx:currentoutput1:857">4.16.1</a> <a class="idx" href="IO.html#idx:currentoutput1:941">4.16.3</a></dd>
728728 <dt><a class="idx" href="persistency.html#current_persistent_predicate/1">current_persistent_predicate/1</a></dt>
729729 <dt><a class="idx" href="examineprog.html#current_predicate/1">current_predicate/1</a></dt>
730730 <dd>
731 <a class="idx" href="metacall.html#idx:currentpredicate1:601">4.9</a> <a class="idx" href="examineprog.html#idx:currentpredicate1:794">4.15</a> <a class="idx" href="examineprog.html#idx:currentpredicate1:800">4.15</a> <a class="idx" href="examineprog.html#idx:currentpredicate1:806">4.15</a></dd>
731 <a class="idx" href="metacall.html#idx:currentpredicate1:602">4.9</a> <a class="idx" href="examineprog.html#idx:currentpredicate1:795">4.15</a> <a class="idx" href="examineprog.html#idx:currentpredicate1:801">4.15</a> <a class="idx" href="examineprog.html#idx:currentpredicate1:807">4.15</a></dd>
732732 <dt><a class="idx" href="examineprog.html#current_predicate/2">current_predicate/2</a></dt>
733733 <dd>
734 <a class="idx" href="examineprog.html#idx:currentpredicate2:795">4.15</a> <a class="idx" href="examineprog.html#idx:currentpredicate2:802">4.15</a></dd>
734 <a class="idx" href="examineprog.html#idx:currentpredicate2:796">4.15</a> <a class="idx" href="examineprog.html#idx:currentpredicate2:803">4.15</a></dd>
735735 <dt><a class="idx" href="predicate_options.html#current_predicate_option/3">current_predicate_option/3</a></dt>
736736 <dt><a class="idx" href="predicate_options.html#current_predicate_options/3">current_predicate_options/3</a></dt>
737737 <dt><a class="idx" href="flags.html#current_prolog_flag/2">current_prolog_flag/2</a></dt>
738738 <dd>
739 <a class="idx" href="cmdline.html#idx:currentprologflag2:16">2.4.2</a> <a class="idx" href="cmdline.html#idx:currentprologflag2:19">2.4.2</a> <a class="idx" href="cmdline.html#idx:currentprologflag2:25">2.4.2</a> <a class="idx" href="flags.html#idx:currentprologflag2:61">2.11</a> <a class="idx" href="flags.html#idx:currentprologflag2:63">2.11</a> <a class="idx" href="autoload.html#idx:currentprologflag2:163">2.13</a> <a class="idx" href="gc.html#idx:currentprologflag2:179">2.14</a> <a class="idx" href="syntax.html#idx:currentprologflag2:182">2.15.2.1</a> <a class="idx" href="consulting.html#idx:currentprologflag2:368">4.3</a> <a class="idx" href="termrw.html#idx:currentprologflag2:1051">4.19</a> <a class="idx" href="DDE.html#idx:currentprologflag2:1438">4.41.2</a> <a class="idx" href="foreignlink.html#idx:currentprologflag2:1821">10.2.1</a> <a class="idx" href="foreigninclude.html#idx:currentprologflag2:1873">10.4.14.4</a> <a class="idx" href="libpl.html#idx:currentprologflag2:1938">A</a> <a class="idx" href="glossary.html#idx:currentprologflag2:2105">D</a></dd>
739 <a class="idx" href="cmdline.html#idx:currentprologflag2:16">2.4.2</a> <a class="idx" href="cmdline.html#idx:currentprologflag2:19">2.4.2</a> <a class="idx" href="cmdline.html#idx:currentprologflag2:25">2.4.2</a> <a class="idx" href="flags.html#idx:currentprologflag2:61">2.11</a> <a class="idx" href="flags.html#idx:currentprologflag2:63">2.11</a> <a class="idx" href="autoload.html#idx:currentprologflag2:163">2.13</a> <a class="idx" href="gc.html#idx:currentprologflag2:179">2.14</a> <a class="idx" href="syntax.html#idx:currentprologflag2:182">2.15.2.1</a> <a class="idx" href="consulting.html#idx:currentprologflag2:369">4.3</a> <a class="idx" href="termrw.html#idx:currentprologflag2:1052">4.19</a> <a class="idx" href="DDE.html#idx:currentprologflag2:1440">4.41.2</a> <a class="idx" href="foreignlink.html#idx:currentprologflag2:1824">10.2.1</a> <a class="idx" href="foreigninclude.html#idx:currentprologflag2:1876">10.4.14.4</a> <a class="idx" href="libpl.html#idx:currentprologflag2:1941">A</a> <a class="idx" href="glossary.html#idx:currentprologflag2:2109">D</a></dd>
740740 <dt><a class="idx" href="signal.html#current_signal/3">current_signal/3</a></dt>
741741 <dd>
742 <a class="idx" href="signal.html#idx:currentsignal3:697">4.11</a></dd>
742 <a class="idx" href="signal.html#idx:currentsignal3:698">4.11</a></dd>
743743 <dt><a class="idx" href="IO.html#current_stream/3">current_stream/3</a></dt>
744744 <dd>
745 <a class="idx" href="IO.html#idx:currentstream3:886">4.16.2</a> <a class="idx" href="files.html#idx:currentstream3:1375">4.34</a></dd>
745 <a class="idx" href="IO.html#idx:currentstream3:887">4.16.2</a> <a class="idx" href="files.html#idx:currentstream3:1377">4.34</a></dd>
746746 <dt><a class="idx" href="threadpool.html#current_thread_pool/1">current_thread_pool/1</a></dt>
747747 <dt>cyclic terms</dt>
748748 <dd>
749749 <a class="idx" href="cyclic.html#idx:cyclicterms:198">2.16</a></dd>
750750 <dt><a class="idx" href="typetest.html#cyclic_term/1">cyclic_term/1</a></dt>
751751 <dd>
752 <a class="idx" href="cyclic.html#idx:cyclicterm1:204">2.16</a> <a class="idx" href="typetest.html#idx:cyclicterm1:573">4.6</a> <a class="idx" href="typetest.html#idx:cyclicterm1:575">4.6</a></dd>
752 <a class="idx" href="cyclic.html#idx:cyclicterm1:204">2.16</a> <a class="idx" href="typetest.html#idx:cyclicterm1:574">4.6</a> <a class="idx" href="typetest.html#idx:cyclicterm1:576">4.6</a></dd>
753753 <dt>daemon</dt>
754754 <dd>
755 <a class="idx" href="broadcast.html#idx:daemon:1943">A.4</a></dd>
755 <a class="idx" href="broadcast.html#idx:daemon:1946">A.4</a></dd>
756756 <dt><a class="idx" href="system.html#date_time_stamp/2">date_time_stamp/2</a></dt>
757757 <dt><a class="idx" href="system.html#date_time_value/3">date_time_value/3</a></dt>
758758 <dd>
759 <a class="idx" href="system.html#idx:datetimevalue3:1333">4.33.2.1</a> <a class="idx" href="system.html#idx:datetimevalue3:1334">4.33.2.1</a></dd>
759 <a class="idx" href="system.html#idx:datetimevalue3:1335">4.33.2.1</a> <a class="idx" href="system.html#idx:datetimevalue3:1336">4.33.2.1</a></dd>
760760 <dt><a class="idx" href="system.html#day_of_the_week/2">day_of_the_week/2</a></dt>
761761 <dt><a class="idx" href="persistency.html#db_attach/2">db_attach/2</a></dt>
762762 <dt><a class="idx" href="persistency.html#db_sync/1">db_sync/1</a></dt>
763763 <dt><a class="idx" href="persistency.html#db_sync_all/1">db_sync_all/1</a></dt>
764764 <dt><a class="idx" href="consulting.html#dcg_translate_rule/2">dcg_translate_rule/2</a></dt>
765765 <dd>
766 <a class="idx" href="consulting.html#idx:dcgtranslaterule2:492">4.3.1</a></dd>
766 <a class="idx" href="consulting.html#idx:dcgtranslaterule2:493">4.3.1</a></dd>
767767 <dt><a class="idx" href="consulting.html#dcg_translate_rule/4">dcg_translate_rule/4</a></dt>
768768 <dt><a class="idx" href="DDE.html#dde_current_connection/2">dde_current_connection/2</a></dt>
769769 <dt><a class="idx" href="DDE.html#dde_current_service/2">dde_current_service/2</a></dt>
774774 <dt><a class="idx" href="DDE.html#dde_unregister_service/1">dde_unregister_service/1</a></dt>
775775 <dt><a class="idx" href="debugger.html#debug/0">debug/0</a></dt>
776776 <dd>
777 <a class="idx" href="debugoverview.html#idx:debug0:41">2.9</a> <a class="idx" href="debugoverview.html#idx:debug0:54">2.9</a> <a class="idx" href="flags.html#idx:debug0:118">2.11</a> <a class="idx" href="exception.html#idx:debug0:651">4.10.1</a> <a class="idx" href="debugger.html#idx:debug0:1399">4.37</a> <a class="idx" href="debugger.html#idx:debug0:1407">4.37</a> <a class="idx" href="memory.html#idx:debug0:1432">4.40</a> <a class="idx" href="thutil.html#idx:debug0:1799">9.5.1</a> <a class="idx" href="foreigninclude.html#idx:debug0:1875">10.4.16</a> <a class="idx" href="breakpoint.html#idx:debug0:2003">B.4</a> <a class="idx" href="excepthook.html#idx:debug0:2013">B.5</a></dd>
777 <a class="idx" href="debugoverview.html#idx:debug0:41">2.9</a> <a class="idx" href="debugoverview.html#idx:debug0:54">2.9</a> <a class="idx" href="flags.html#idx:debug0:118">2.11</a> <a class="idx" href="exception.html#idx:debug0:652">4.10.1</a> <a class="idx" href="debugger.html#idx:debug0:1401">4.37</a> <a class="idx" href="debugger.html#idx:debug0:1409">4.37</a> <a class="idx" href="memory.html#idx:debug0:1434">4.40</a> <a class="idx" href="thutil.html#idx:debug0:1802">9.5.1</a> <a class="idx" href="foreigninclude.html#idx:debug0:1878">10.4.16</a> <a class="idx" href="breakpoint.html#idx:debug0:2006">B.4</a> <a class="idx" href="excepthook.html#idx:debug0:2016">B.5</a></dd>
778778 <dt><a class="idx" href="debug.html#debug/1">debug/1</a></dt>
779779 <dt><a class="idx" href="debug.html#debug/3">debug/3</a></dt>
780780 <dd>
781 <a class="idx" href="exception.html#idx:debug3:659">4.10.3</a></dd>
781 <a class="idx" href="exception.html#idx:debug3:660">4.10.3</a></dd>
782782 <dt><a class="idx" href="debug.html#debug_message_context/1">debug_message_context/1</a></dt>
783783 <dt>debugging,exceptions</dt>
784784 <dd>
785 <a class="idx" href="exception.html#idx:debuggingexceptions:647">4.10.1</a></dd>
785 <a class="idx" href="exception.html#idx:debuggingexceptions:648">4.10.1</a></dd>
786786 <dt><a class="idx" href="debugger.html#debugging/0">debugging/0</a></dt>
787787 <dd>
788 <a class="idx" href="hooks.html#idx:debugging0:156">2.12</a> <a class="idx" href="debugger.html#idx:debugging0:1402">4.37</a> <a class="idx" href="intlibs.html#idx:debugging0:2031">B.7</a> <a class="idx" href="intlibs.html#idx:debugging0:2032">B.7</a></dd>
788 <a class="idx" href="hooks.html#idx:debugging0:156">2.12</a> <a class="idx" href="debugger.html#idx:debugging0:1404">4.37</a> <a class="idx" href="intlibs.html#idx:debugging0:2034">B.7</a> <a class="idx" href="intlibs.html#idx:debugging0:2035">B.7</a></dd>
789789 <dt><a class="idx" href="debug.html#debugging/1">debugging/1</a></dt>
790790 <dt><a class="idx" href="debug.html#debugging/2">debugging/2</a></dt>
791791 <dt><a class="idx" href="importmodule.html#default_module/2">default_module/2</a></dt>
792792 <dd>
793 <a class="idx" href="examineprog.html#idx:defaultmodule2:804">4.15</a> <a class="idx" href="examineprog.html#idx:defaultmodule2:824">4.15</a> <a class="idx" href="importmodule.html#idx:defaultmodule2:1577">6.9</a></dd>
793 <a class="idx" href="examineprog.html#idx:defaultmodule2:805">4.15</a> <a class="idx" href="examineprog.html#idx:defaultmodule2:825">4.15</a> <a class="idx" href="importmodule.html#idx:defaultmodule2:1579">6.9</a></dd>
794794 <dt><a class="idx" href="attvar.html#del_attr/2">del_attr/2</a></dt>
795795 <dd>
796 <a class="idx" href="attvar.html#idx:delattr2:1636">7.1.4</a></dd>
796 <a class="idx" href="attvar.html#idx:delattr2:1638">7.1.4</a></dd>
797797 <dt><a class="idx" href="attvar.html#del_attrs/1">del_attrs/1</a></dt>
798798 <dt><a class="idx" href="dicts.html#del_dict/4">del_dict/4</a></dt>
799799 <dt><a class="idx" href="ugraphs.html#del_edges/3">del_edges/3</a></dt>
802802 <dt><a class="idx" href="files.html#delete_directory/1">delete_directory/1</a></dt>
803803 <dt><a class="idx" href="files.html#delete_file/1">delete_file/1</a></dt>
804804 <dd>
805 <a class="idx" href="system.html#idx:deletefile1:1298">4.33</a> <a class="idx" href="files.html#idx:deletefile1:1370">4.34</a></dd>
805 <a class="idx" href="system.html#idx:deletefile1:1300">4.33</a> <a class="idx" href="files.html#idx:deletefile1:1372">4.34</a></dd>
806806 <dt><a class="idx" href="importmodule.html#delete_import_module/2">delete_import_module/2</a></dt>
807807 <dd>
808 <a class="idx" href="importmodule.html#idx:deleteimportmodule2:1576">6.9</a> <a class="idx" href="importmodule.html#idx:deleteimportmodule2:1580">6.9</a> <a class="idx" href="modulecompat.html#idx:deleteimportmodule2:1613">6.15</a></dd>
808 <a class="idx" href="importmodule.html#idx:deleteimportmodule2:1578">6.9</a> <a class="idx" href="importmodule.html#idx:deleteimportmodule2:1582">6.9</a> <a class="idx" href="modulecompat.html#idx:deleteimportmodule2:1615">6.15</a></dd>
809809 <dt><a class="idx" href="predicate_options.html#derive_predicate_options/0">derive_predicate_options/0</a></dt>
810810 <dt><a class="idx" href="predicate_options.html#derived_predicate_options/1">derived_predicate_options/1</a></dt>
811811 <dt><a class="idx" href="predicate_options.html#derived_predicate_options/3">derived_predicate_options/3</a></dt>
812812 <dt>deserialize</dt>
813813 <dd>
814 <a class="idx" href="DCG.html#idx:deserialize:702">4.12</a></dd>
814 <a class="idx" href="DCG.html#idx:deserialize:703">4.12</a></dd>
815815 <dt>det</dt>
816816 <dd>
817 <a class="idx" href="glossary.html#idx:det:2088">D</a></dd>
817 <a class="idx" href="glossary.html#idx:det:2091">D</a></dd>
818 <dt>determinism</dt>
819 <dd>
820 <a class="idx" href="glossary.html#idx:determinism:2092">D</a></dd>
818821 <dt>deterministic</dt>
819822 <dd>
820 <a class="idx" href="glossary.html#idx:deterministic:2089">D</a></dd>
823 <a class="idx" href="glossary.html#idx:deterministic:2093">D</a></dd>
821824 <dt><a class="idx" href="manipstack.html#deterministic/1">deterministic/1</a></dt>
822825 <dd>
823 <a class="idx" href="metacall.html#idx:deterministic1:622">4.9</a></dd>
826 <a class="idx" href="metacall.html#idx:deterministic1:623">4.9</a></dd>
824827 <dt><a class="idx" href="dicts.html#dict_create/3">dict_create/3</a></dt>
825828 <dd>
826 <a class="idx" href="dicts.html#idx:dictcreate3:1493">5.4.2</a></dd>
829 <a class="idx" href="dicts.html#idx:dictcreate3:1495">5.4.2</a></dd>
827830 <dt><a class="idx" href="option.html#dict_options/2">dict_options/2</a></dt>
828831 <dt>dict_pairs/2</dt>
829832 <dd>
830 <a class="idx" href="dicts.html#idx:dictpairs2:1510">5.4.3</a></dd>
833 <a class="idx" href="dicts.html#idx:dictpairs2:1512">5.4.3</a></dd>
831834 <dt><a class="idx" href="dicts.html#dict_pairs/3">dict_pairs/3</a></dt>
832835 <dt><a class="idx" href="coroutining.html#dif/2">dif/2</a></dt>
833836 <dd>
834 <a class="idx" href="cyclic.html#idx:dif2:205">2.16</a> <a class="idx" href="compare.html#idx:dif2:576">4.7</a> <a class="idx" href="compare.html#idx:dif2:591">4.7.2</a> <a class="idx" href="coroutining.html#idx:dif2:1643">7.2</a> <a class="idx" href="coroutining.html#idx:dif2:1645">7.2</a> <a class="idx" href="coroutining.html#idx:dif2:1646">7.2</a> <a class="idx" href="coroutining.html#idx:dif2:1647">7.2</a> <a class="idx" href="coroutining.html#idx:dif2:1648">7.2</a></dd>
837 <a class="idx" href="cyclic.html#idx:dif2:205">2.16</a> <a class="idx" href="compare.html#idx:dif2:577">4.7</a> <a class="idx" href="compare.html#idx:dif2:592">4.7.2</a> <a class="idx" href="coroutining.html#idx:dif2:1645">7.2</a> <a class="idx" href="coroutining.html#idx:dif2:1647">7.2</a> <a class="idx" href="coroutining.html#idx:dif2:1648">7.2</a> <a class="idx" href="coroutining.html#idx:dif2:1649">7.2</a> <a class="idx" href="coroutining.html#idx:dif2:1650">7.2</a></dd>
835838 <dt>directory_file_path/3</dt>
836839 <dd>
837 <a class="idx" href="files.html#idx:directoryfilepath3:1346">4.34</a></dd>
840 <a class="idx" href="files.html#idx:directoryfilepath3:1348">4.34</a></dd>
838841 <dt><a class="idx" href="files.html#directory_files/2">directory_files/2</a></dt>
839842 <dt><a class="idx" href="dynamic.html#discontiguous/1">discontiguous/1</a></dt>
840843 <dd>
841 <a class="idx" href="consulting.html#idx:discontiguous1:413">4.3</a> <a class="idx" href="exception.html#idx:discontiguous1:662">4.10.3</a> <a class="idx" href="dynamic.html#idx:discontiguous1:773">4.14</a> <a class="idx" href="debugger.html#idx:discontiguous1:1413">4.37</a></dd>
844 <a class="idx" href="consulting.html#idx:discontiguous1:414">4.3</a> <a class="idx" href="exception.html#idx:discontiguous1:663">4.10.3</a> <a class="idx" href="dynamic.html#idx:discontiguous1:774">4.14</a> <a class="idx" href="debugger.html#idx:discontiguous1:1415">4.37</a></dd>
842845 <dt><a class="idx" href="clpfd.html#disjoint2/1">disjoint2/1</a></dt>
843846 <dt>display/1</dt>
844847 <dd>
845 <a class="idx" href="format.html#idx:display1:1273">4.31.1</a> <a class="idx" href="foreigninclude.html#idx:display1:1838">10.4.3.6</a> <a class="idx" href="foreigninclude.html#idx:display1:1839">10.4.3.6</a></dd>
848 <a class="idx" href="format.html#idx:display1:1275">4.31.1</a> <a class="idx" href="foreigninclude.html#idx:display1:1841">10.4.3.6</a> <a class="idx" href="foreigninclude.html#idx:display1:1842">10.4.3.6</a></dd>
846849 <dt><a class="idx" href="solutionsequences.html#distinct/1">distinct/1</a></dt>
847850 <dt><a class="idx" href="solutionsequences.html#distinct/2">distinct/2</a></dt>
851 <dt><a class="idx" href="arith.html#divmod/4">divmod/4</a></dt>
852 <dd>
853 <a class="idx" href="arith.html#idx:divmod4:1204">4.26.1</a></dd>
848854 <dt>dld</dt>
849855 <dd>
850 <a class="idx" href="foreignlink.html#idx:dld:1820">10.2</a></dd>
856 <a class="idx" href="foreignlink.html#idx:dld:1823">10.2</a></dd>
851857 <dt>do_not_use/1</dt>
852858 <dd>
853 <a class="idx" href="reexport.html#idx:donotuse1:1567">6.7</a></dd>
859 <a class="idx" href="reexport.html#idx:donotuse1:1569">6.7</a></dd>
854860 <dt>domain/2</dt>
855861 <dd>
856 <a class="idx" href="attvar.html#idx:domain2:1619">7.1</a></dd>
862 <a class="idx" href="attvar.html#idx:domain2:1621">7.1</a></dd>
857863 <dt>domain_error/2</dt>
858864 <dd>
859 <a class="idx" href="foreigninclude.html#idx:domainerror2:1845">10.4.6</a></dd>
865 <a class="idx" href="foreigninclude.html#idx:domainerror2:1848">10.4.6</a></dd>
860866 <dt><a class="idx" href="chartype.html#downcase_atom/2">downcase_atom/2</a></dt>
861867 <dd>
862 <a class="idx" href="chartype.html#idx:downcaseatom2:1174">4.23</a> <a class="idx" href="chartype.html#idx:downcaseatom2:1176">4.23</a> <a class="idx" href="chartype.html#idx:downcaseatom2:1183">4.23.1</a></dd>
868 <a class="idx" href="chartype.html#idx:downcaseatom2:1175">4.23</a> <a class="idx" href="chartype.html#idx:downcaseatom2:1177">4.23</a> <a class="idx" href="chartype.html#idx:downcaseatom2:1184">4.23.1</a></dd>
863869 <dt><a class="idx" href="clpqr.html#dump/3">dump/3</a></dt>
864870 <dd>
865 <a class="idx" href="clpqr.html#idx:dump3:1951">A.9.5</a></dd>
871 <a class="idx" href="clpqr.html#idx:dump3:1954">A.9.5</a></dd>
866872 <dt><a class="idx" href="manipterm.html#duplicate_term/2">duplicate_term/2</a></dt>
867873 <dd>
868 <a class="idx" href="cyclic.html#idx:duplicateterm2:206">2.16</a> <a class="idx" href="manipterm.html#idx:duplicateterm2:1095">4.20</a> <a class="idx" href="manipterm.html#idx:duplicateterm2:1102">4.20.1</a> <a class="idx" href="gvar.html#idx:duplicateterm2:1661">7.3</a></dd>
874 <a class="idx" href="cyclic.html#idx:duplicateterm2:206">2.16</a> <a class="idx" href="manipterm.html#idx:duplicateterm2:1096">4.20</a> <a class="idx" href="manipterm.html#idx:duplicateterm2:1103">4.20.1</a> <a class="idx" href="gvar.html#idx:duplicateterm2:1664">7.3</a></dd>
869875 <dt><a class="idx" href="miscpreds.html#dwim_match/2">dwim_match/2</a></dt>
870876 <dd>
871 <a class="idx" href="examineprog.html#idx:dwimmatch2:827">4.15</a> <a class="idx" href="miscpreds.html#idx:dwimmatch2:1439">4.42</a></dd>
877 <a class="idx" href="examineprog.html#idx:dwimmatch2:828">4.15</a> <a class="idx" href="miscpreds.html#idx:dwimmatch2:1441">4.42</a></dd>
872878 <dt><a class="idx" href="miscpreds.html#dwim_match/3">dwim_match/3</a></dt>
873879 <dt><a class="idx" href="examineprog.html#dwim_predicate/2">dwim_predicate/2</a></dt>
874880 <dt>dynamic predicate</dt>
875881 <dd>
876 <a class="idx" href="glossary.html#idx:dynamicpredicate:2090">D</a></dd>
882 <a class="idx" href="glossary.html#idx:dynamicpredicate:2094">D</a></dd>
877883 <dt><a class="idx" href="dynamic.html#dynamic/1">dynamic/1</a></dt>
878884 <dd>
879 <a class="idx" href="flags.html#idx:dynamic1:102">2.11</a> <a class="idx" href="flags.html#idx:dynamic1:122">2.11</a> <a class="idx" href="preddesc.html#idx:dynamic1:308">4.1</a> <a class="idx" href="consulting.html#idx:dynamic1:404">4.3</a> <a class="idx" href="db.html#idx:dynamic1:718">4.13</a> <a class="idx" href="db.html#idx:dynamic1:728">4.13</a> <a class="idx" href="db.html#idx:dynamic1:729">4.13</a> <a class="idx" href="dynamic.html#idx:dynamic1:771">4.14</a> <a class="idx" href="dynamic.html#idx:dynamic1:780">4.14</a> <a class="idx" href="examineprog.html#idx:dynamic1:809">4.15</a> <a class="idx" href="ctxmodule.html#idx:dynamic1:1600">6.13</a> <a class="idx" href="threadcom.html#idx:dynamic1:1771">9.3.3</a> <a class="idx" href="threadcom.html#idx:dynamic1:1773">9.3.3</a> <a class="idx" href="runtime.html#idx:dynamic1:1917">11</a></dd>
885 <a class="idx" href="flags.html#idx:dynamic1:102">2.11</a> <a class="idx" href="flags.html#idx:dynamic1:122">2.11</a> <a class="idx" href="preddesc.html#idx:dynamic1:309">4.1</a> <a class="idx" href="consulting.html#idx:dynamic1:405">4.3</a> <a class="idx" href="db.html#idx:dynamic1:719">4.13</a> <a class="idx" href="db.html#idx:dynamic1:729">4.13</a> <a class="idx" href="db.html#idx:dynamic1:730">4.13</a> <a class="idx" href="dynamic.html#idx:dynamic1:772">4.14</a> <a class="idx" href="dynamic.html#idx:dynamic1:781">4.14</a> <a class="idx" href="examineprog.html#idx:dynamic1:810">4.15</a> <a class="idx" href="ctxmodule.html#idx:dynamic1:1602">6.13</a> <a class="idx" href="threadcom.html#idx:dynamic1:1774">9.3.3</a> <a class="idx" href="threadcom.html#idx:dynamic1:1776">9.3.3</a> <a class="idx" href="runtime.html#idx:dynamic1:1920">11</a></dd>
880886 <dt><a class="idx" href="ugraphs.html#edges/2">edges/2</a></dt>
881887 <dt><a class="idx" href="edit.html#edit/0">edit/0</a></dt>
882888 <dd>
883889 <a class="idx" href="flags.html#idx:edit0:69">2.11</a></dd>
884890 <dt><a class="idx" href="edit.html#edit/1">edit/1</a></dt>
885891 <dd>
886 <a class="idx" href="flags.html#idx:edit1:85">2.11</a> <a class="idx" href="hooks.html#idx:edit1:150">2.12</a> <a class="idx" href="hooks.html#idx:edit1:151">2.12</a> <a class="idx" href="hooks.html#idx:edit1:152">2.12</a> <a class="idx" href="editreload.html#idx:edit1:275">3.3.1</a> <a class="idx" href="pceemacs.html#idx:edit1:278">3.4.1</a> <a class="idx" href="pceemacs.html#idx:edit1:280">3.4.3.1</a> <a class="idx" href="idesummary.html#idx:edit1:297">3.9</a> <a class="idx" href="idesummary.html#idx:edit1:298">3.9</a> <a class="idx" href="consulting.html#idx:edit1:415">4.3</a> <a class="idx" href="consulting.html#idx:edit1:424">4.3</a> <a class="idx" href="edit.html#idx:edit1:538">4.4</a> <a class="idx" href="edit.html#idx:edit1:539">4.4</a> <a class="idx" href="edit.html#idx:edit1:540">4.4</a> <a class="idx" href="edit.html#idx:edit1:541">4.4</a> <a class="idx" href="edit.html#idx:edit1:542">4.4.1</a> <a class="idx" href="edit.html#idx:edit1:543">4.4.1</a> <a class="idx" href="edit.html#idx:edit1:544">4.4.1</a> <a class="idx" href="edit.html#idx:edit1:545">4.4.1</a> <a class="idx" href="mtoplevel.html#idx:edit1:1562">6.6</a> <a class="idx" href="predsummary.html#idx:edit1:2159">F.1</a> <a class="idx" href="predsummary.html#idx:edit1:2160">F.1</a> <a class="idx" href="predsummary.html#idx:edit1:2161">F.1</a> <a class="idx" href="predsummary.html#idx:edit1:2162">F.1</a></dd>
892 <a class="idx" href="flags.html#idx:edit1:85">2.11</a> <a class="idx" href="hooks.html#idx:edit1:150">2.12</a> <a class="idx" href="hooks.html#idx:edit1:151">2.12</a> <a class="idx" href="hooks.html#idx:edit1:152">2.12</a> <a class="idx" href="editreload.html#idx:edit1:275">3.3.1</a> <a class="idx" href="pceemacs.html#idx:edit1:278">3.4.1</a> <a class="idx" href="pceemacs.html#idx:edit1:280">3.4.3.1</a> <a class="idx" href="idesummary.html#idx:edit1:297">3.9</a> <a class="idx" href="idesummary.html#idx:edit1:298">3.9</a> <a class="idx" href="consulting.html#idx:edit1:416">4.3</a> <a class="idx" href="consulting.html#idx:edit1:425">4.3</a> <a class="idx" href="edit.html#idx:edit1:539">4.4</a> <a class="idx" href="edit.html#idx:edit1:540">4.4</a> <a class="idx" href="edit.html#idx:edit1:541">4.4</a> <a class="idx" href="edit.html#idx:edit1:542">4.4</a> <a class="idx" href="edit.html#idx:edit1:543">4.4.1</a> <a class="idx" href="edit.html#idx:edit1:544">4.4.1</a> <a class="idx" href="edit.html#idx:edit1:545">4.4.1</a> <a class="idx" href="edit.html#idx:edit1:546">4.4.1</a> <a class="idx" href="mtoplevel.html#idx:edit1:1564">6.6</a> <a class="idx" href="predsummary.html#idx:edit1:2166">F.1</a> <a class="idx" href="predsummary.html#idx:edit1:2167">F.1</a> <a class="idx" href="predsummary.html#idx:edit1:2168">F.1</a> <a class="idx" href="predsummary.html#idx:edit1:2169">F.1</a></dd>
887893 <dt>edit_source/1</dt>
888894 <dd>
889 <a class="idx" href="edit.html#idx:editsource1:547">4.4.1</a></dd>
895 <a class="idx" href="edit.html#idx:editsource1:548">4.4.1</a></dd>
890896 <dt>editor</dt>
891897 <dd>
892898 <a class="sec" href="editreload.html#sec:3.3">3.3</a> <a class="sec" href="pceemacs.html#sec:3.4.2">3.4.2</a></dd>
904910 <dt><a class="idx" href="consulting.html#endif/0">endif/0</a></dt>
905911 <dt><a class="idx" href="consulting.html#ensure_loaded/1">ensure_loaded/1</a></dt>
906912 <dd>
907 <a class="idx" href="compilation.html#idx:ensureloaded1:56">2.10.1</a> <a class="idx" href="consulting.html#idx:ensureloaded1:329">4.3</a> <a class="idx" href="consulting.html#idx:ensureloaded1:350">4.3</a> <a class="idx" href="consulting.html#idx:ensureloaded1:356">4.3</a> <a class="idx" href="consulting.html#idx:ensureloaded1:400">4.3</a> <a class="idx" href="import.html#idx:ensureloaded1:1525">6.3</a> <a class="idx" href="import.html#idx:ensureloaded1:1526">6.3</a></dd>
913 <a class="idx" href="compilation.html#idx:ensureloaded1:56">2.10.1</a> <a class="idx" href="consulting.html#idx:ensureloaded1:330">4.3</a> <a class="idx" href="consulting.html#idx:ensureloaded1:351">4.3</a> <a class="idx" href="consulting.html#idx:ensureloaded1:357">4.3</a> <a class="idx" href="consulting.html#idx:ensureloaded1:401">4.3</a> <a class="idx" href="import.html#idx:ensureloaded1:1527">6.3</a> <a class="idx" href="import.html#idx:ensureloaded1:1528">6.3</a></dd>
908914 <dt><a class="idx" href="clpqr.html#entailed/1">entailed/1</a></dt>
909915 <dt><a class="idx" href="prologpack.html#environment/2">environment/2</a></dt>
910916 <dt><a class="idx" href="db.html#erase/1">erase/1</a></dt>
911917 <dd>
912 <a class="idx" href="db.html#idx:erase1:738">4.13</a> <a class="idx" href="db.html#idx:erase1:742">4.13</a> <a class="idx" href="examineprog.html#idx:erase1:830">4.15</a></dd>
918 <a class="idx" href="db.html#idx:erase1:739">4.13</a> <a class="idx" href="db.html#idx:erase1:743">4.13</a> <a class="idx" href="examineprog.html#idx:erase1:831">4.15</a></dd>
913919 <dt><a class="idx" href="softlicense.html#eval_license/0">eval_license/0</a></dt>
914920 <dd>
915 <a class="idx" href="softlicense.html#idx:evallicense0:2138">E.3</a> <a class="idx" href="softlicense.html#idx:evallicense0:2139">E.3</a></dd>
921 <a class="idx" href="softlicense.html#idx:evallicense0:2145">E.3</a> <a class="idx" href="softlicense.html#idx:evallicense0:2146">E.3</a></dd>
916922 <dt><a class="idx" href="exception3.html#exception/3">exception/3</a></dt>
917923 <dd>
918 <a class="idx" href="gvar.html#idx:exception3:1658">7.3</a> <a class="idx" href="exception3.html#idx:exception3:2014">B.6</a> <a class="idx" href="exception3.html#idx:exception3:2017">B.6</a></dd>
924 <a class="idx" href="gvar.html#idx:exception3:1661">7.3</a> <a class="idx" href="exception3.html#idx:exception3:2017">B.6</a> <a class="idx" href="exception3.html#idx:exception3:2020">B.6</a></dd>
919925 <dt>exceptions,debugging</dt>
920926 <dd>
921 <a class="idx" href="exception.html#idx:exceptionsdebugging:646">4.10.1</a></dd>
927 <a class="idx" href="exception.html#idx:exceptionsdebugging:647">4.10.1</a></dd>
922928 <dt><a class="idx" href="apply.html#exclude/3">exclude/3</a></dt>
923929 <dt><a class="idx" href="files.html#exists_directory/1">exists_directory/1</a></dt>
924930 <dt><a class="idx" href="files.html#exists_file/1">exists_file/1</a></dt>
926932 <a class="idx" href="flags.html#idx:existsfile1:90">2.11</a></dd>
927933 <dt><a class="idx" href="dialect.html#exists_source/1">exists_source/1</a></dt>
928934 <dd>
929 <a class="idx" href="dialect.html#idx:existssource1:2050">C</a></dd>
935 <a class="idx" href="dialect.html#idx:existssource1:2053">C</a></dd>
930936 <dt><a class="idx" href="toplevel.html#expand_answer/2">expand_answer/2</a></dt>
931937 <dd>
932 <a class="idx" href="toplevel.html#idx:expandanswer2:1387">4.35</a></dd>
938 <a class="idx" href="toplevel.html#idx:expandanswer2:1389">4.35</a></dd>
933939 <dt><a class="idx" href="files.html#expand_file_name/2">expand_file_name/2</a></dt>
934940 <dd>
935 <a class="idx" href="flags.html#idx:expandfilename2:92">2.11</a> <a class="idx" href="consulting.html#idx:expandfilename2:371">4.3</a> <a class="idx" href="system.html#idx:expandfilename2:1304">4.33</a> <a class="idx" href="system.html#idx:expandfilename2:1316">4.33</a> <a class="idx" href="files.html#idx:expandfilename2:1357">4.34</a> <a class="idx" href="files.html#idx:expandfilename2:1363">4.34</a> <a class="idx" href="files.html#idx:expandfilename2:1367">4.34</a></dd>
941 <a class="idx" href="flags.html#idx:expandfilename2:92">2.11</a> <a class="idx" href="consulting.html#idx:expandfilename2:372">4.3</a> <a class="idx" href="system.html#idx:expandfilename2:1306">4.33</a> <a class="idx" href="system.html#idx:expandfilename2:1318">4.33</a> <a class="idx" href="files.html#idx:expandfilename2:1359">4.34</a> <a class="idx" href="files.html#idx:expandfilename2:1365">4.34</a> <a class="idx" href="files.html#idx:expandfilename2:1369">4.34</a></dd>
936942 <dt><a class="idx" href="consulting.html#expand_file_search_path/2">expand_file_search_path/2</a></dt>
937943 <dt><a class="idx" href="consulting.html#expand_goal/2">expand_goal/2</a></dt>
938944 <dd>
939 <a class="idx" href="flags.html#idx:expandgoal2:101">2.11</a> <a class="idx" href="consulting.html#idx:expandgoal2:482">4.3.1</a> <a class="idx" href="consulting.html#idx:expandgoal2:490">4.3.1</a> <a class="idx" href="consulting.html#idx:expandgoal2:493">4.3.1</a> <a class="idx" href="consulting.html#idx:expandgoal2:497">4.3.1</a> <a class="idx" href="consulting.html#idx:expandgoal2:503">4.3.1</a> <a class="idx" href="consulting.html#idx:expandgoal2:513">4.3.1.2</a></dd>
945 <a class="idx" href="flags.html#idx:expandgoal2:101">2.11</a> <a class="idx" href="consulting.html#idx:expandgoal2:483">4.3.1</a> <a class="idx" href="consulting.html#idx:expandgoal2:491">4.3.1</a> <a class="idx" href="consulting.html#idx:expandgoal2:494">4.3.1</a> <a class="idx" href="consulting.html#idx:expandgoal2:498">4.3.1</a> <a class="idx" href="consulting.html#idx:expandgoal2:504">4.3.1</a> <a class="idx" href="consulting.html#idx:expandgoal2:514">4.3.1.2</a></dd>
940946 <dt><a class="idx" href="consulting.html#expand_goal/4">expand_goal/4</a></dt>
941947 <dt><a class="idx" href="toplevel.html#expand_query/4">expand_query/4</a></dt>
942948 <dt><a class="idx" href="consulting.html#expand_term/2">expand_term/2</a></dt>
943949 <dd>
944 <a class="idx" href="consulting.html#idx:expandterm2:479">4.3.1</a> <a class="idx" href="consulting.html#idx:expandterm2:484">4.3.1</a> <a class="idx" href="consulting.html#idx:expandterm2:486">4.3.1</a> <a class="idx" href="consulting.html#idx:expandterm2:488">4.3.1</a> <a class="idx" href="consulting.html#idx:expandterm2:496">4.3.1</a> <a class="idx" href="consulting.html#idx:expandterm2:507">4.3.1</a> <a class="idx" href="DCG.html#idx:expandterm2:703">4.12</a> <a class="idx" href="record.html#idx:expandterm2:1976">A.29</a></dd>
950 <a class="idx" href="consulting.html#idx:expandterm2:480">4.3.1</a> <a class="idx" href="consulting.html#idx:expandterm2:485">4.3.1</a> <a class="idx" href="consulting.html#idx:expandterm2:487">4.3.1</a> <a class="idx" href="consulting.html#idx:expandterm2:489">4.3.1</a> <a class="idx" href="consulting.html#idx:expandterm2:497">4.3.1</a> <a class="idx" href="consulting.html#idx:expandterm2:508">4.3.1</a> <a class="idx" href="DCG.html#idx:expandterm2:704">4.12</a> <a class="idx" href="record.html#idx:expandterm2:1979">A.29</a></dd>
945951 <dt><a class="idx" href="consulting.html#expand_term/4">expand_term/4</a></dt>
946952 <dt><a class="idx" href="dialect.html#expects_dialect/1">expects_dialect/1</a></dt>
947953 <dd>
948 <a class="idx" href="consulting.html#idx:expectsdialect1:370">4.3</a> <a class="idx" href="consulting.html#idx:expectsdialect1:391">4.3</a> <a class="idx" href="consulting.html#idx:expectsdialect1:454">4.3</a> <a class="idx" href="dialect.html#idx:expectsdialect1:2049">C</a></dd>
954 <a class="idx" href="consulting.html#idx:expectsdialect1:371">4.3</a> <a class="idx" href="consulting.html#idx:expectsdialect1:392">4.3</a> <a class="idx" href="consulting.html#idx:expectsdialect1:455">4.3</a> <a class="idx" href="dialect.html#idx:expectsdialect1:2052">C</a></dd>
949955 <dt><a class="idx" href="help.html#explain/1">explain/1</a></dt>
950956 <dd>
951957 <a class="idx" href="help.html#idx:explain1:35">2.6</a></dd>
952958 <dt><a class="idx" href="help.html#explain/2">explain/2</a></dt>
953959 <dt><a class="idx" href="altmoduleapi.html#export/1">export/1</a></dt>
954960 <dd>
955 <a class="idx" href="dynamic.html#idx:export1:790">4.14</a> <a class="idx" href="altmoduleapi.html#idx:export1:1585">6.11</a> <a class="idx" href="altmoduleapi.html#idx:export1:1588">6.11</a> <a class="idx" href="dynamic-modules.html#idx:export1:1591">6.12</a></dd>
961 <a class="idx" href="dynamic.html#idx:export1:791">4.14</a> <a class="idx" href="altmoduleapi.html#idx:export1:1587">6.11</a> <a class="idx" href="altmoduleapi.html#idx:export1:1590">6.11</a> <a class="idx" href="dynamic-modules.html#idx:export1:1593">6.12</a></dd>
956962 <dt>export_list/2</dt>
957963 <dd>
958 <a class="idx" href="altmoduleapi.html#idx:exportlist2:1589">6.11</a></dd>
964 <a class="idx" href="altmoduleapi.html#idx:exportlist2:1591">6.11</a></dd>
959965 <dt>exported predicate</dt>
960966 <dd>
961 <a class="idx" href="glossary.html#idx:exportedpredicate:2092">D</a></dd>
967 <a class="idx" href="glossary.html#idx:exportedpredicate:2096">D</a></dd>
962968 <dt><a class="idx" href="arith.html#f-**/2">f-**/2</a></dt>
963969 <dt><a class="idx" href="arith.html#f-*/2">f-*/2</a></dt>
964970 <dt><a class="idx" href="arith.html#f-+/1">f-+/1</a></dt>
10011007 <dt><a class="idx" href="arith.html#f-float_integer_part/1">f-float_integer_part/1</a></dt>
10021008 <dt><a class="idx" href="arith.html#f-floor/1">f-floor/1</a></dt>
10031009 <dt><a class="idx" href="arith.html#f-gcd/2">f-gcd/2</a></dt>
1010 <dt><a class="idx" href="arith.html#f-getbit/2">f-getbit/2</a></dt>
10041011 <dt><a class="idx" href="arith.html#f-integer/1">f-integer/1</a></dt>
10051012 <dt><a class="idx" href="arith.html#f-lgamma/1">f-lgamma/1</a></dt>
10061013 <dt><a class="idx" href="arith.html#f-log/1">f-log/1</a></dt>
10301037 <dt><a class="idx" href="arith.html#f-xor/2">f-xor/2</a></dt>
10311038 <dt>fact</dt>
10321039 <dd>
1033 <a class="idx" href="glossary.html#idx:fact:2095">D</a></dd>
1040 <a class="idx" href="glossary.html#idx:fact:2099">D</a></dd>
10341041 <dt><a class="idx" href="control.html#fail/0">fail/0</a></dt>
10351042 <dd>
1036 <a class="idx" href="consulting.html#idx:fail0:505">4.3.1</a> <a class="idx" href="control.html#idx:fail0:595">4.8</a></dd>
1043 <a class="idx" href="consulting.html#idx:fail0:506">4.3.1</a> <a class="idx" href="control.html#idx:fail0:596">4.8</a></dd>
10371044 <dt><a class="idx" href="control.html#false/0">false/0</a></dt>
10381045 <dt><a class="idx" href="clpfd.html#fd_dom/2">fd_dom/2</a></dt>
10391046 <dt><a class="idx" href="clpfd.html#fd_inf/2">fd_inf/2</a></dt>
10431050 <dt><a class="idx" href="files.html#file_base_name/2">file_base_name/2</a></dt>
10441051 <dt><a class="idx" href="files.html#file_directory_name/2">file_directory_name/2</a></dt>
10451052 <dd>
1046 <a class="idx" href="files.html#idx:filedirectoryname2:1350">4.34</a></dd>
1053 <a class="idx" href="files.html#idx:filedirectoryname2:1352">4.34</a></dd>
10471054 <dt><a class="idx" href="files.html#file_name_extension/3">file_name_extension/3</a></dt>
10481055 <dt><a class="idx" href="url.html#file_name_to_url/2">file_name_to_url/2</a></dt>
10491056 <dt>file_of_label/2</dt>
10501057 <dd>
1051 <a class="idx" href="mtoplevel.html#idx:fileoflabel2:1565">6.6</a></dd>
1058 <a class="idx" href="mtoplevel.html#idx:fileoflabel2:1567">6.6</a></dd>
10521059 <dt><a class="idx" href="consulting.html#file_search_path/2">file_search_path/2</a></dt>
10531060 <dd>
1054 <a class="idx" href="initfile.html#idx:filesearchpath2:11">2.2</a> <a class="idx" href="cmdline.html#idx:filesearchpath2:21">2.4.2</a> <a class="idx" href="cmdline.html#idx:filesearchpath2:23">2.4.2</a> <a class="idx" href="flags.html#idx:filesearchpath2:68">2.11</a> <a class="idx" href="flags.html#idx:filesearchpath2:130">2.11</a> <a class="idx" href="autoload.html#idx:filesearchpath2:161">2.13</a> <a class="idx" href="autoload.html#idx:filesearchpath2:167">2.13</a> <a class="idx" href="autoload.html#idx:filesearchpath2:173">2.13</a> <a class="idx" href="projectfiles.html#idx:filesearchpath2:268">3.1.1.3</a> <a class="idx" href="projectfiles.html#idx:filesearchpath2:269">3.1.1.3</a> <a class="idx" href="xref.html#idx:filesearchpath2:293">3.7</a> <a class="idx" href="consulting.html#idx:filesearchpath2:373">4.3</a> <a class="idx" href="consulting.html#idx:filesearchpath2:431">4.3</a> <a class="idx" href="consulting.html#idx:filesearchpath2:432">4.3</a> <a class="idx" href="consulting.html#idx:filesearchpath2:434">4.3</a> <a class="idx" href="consulting.html#idx:filesearchpath2:437">4.3</a> <a class="idx" href="consulting.html#idx:filesearchpath2:438">4.3</a> <a class="idx" href="consulting.html#idx:filesearchpath2:458">4.3</a> <a class="idx" href="foreigninclude.html#idx:filesearchpath2:1870">10.4.14.3</a> <a class="idx" href="findhome.html#idx:filesearchpath2:1898">10.6</a> <a class="idx" href="qsaveforeign.html#idx:filesearchpath2:1924">11.2</a> <a class="idx" href="qsaveforeign.html#idx:filesearchpath2:1925">11.2</a> <a class="idx" href="useresource.html#idx:filesearchpath2:1930">11.3.1</a> <a class="idx" href="useresource.html#idx:filesearchpath2:1932">11.3.1</a> <a class="idx" href="findappfile.html#idx:filesearchpath2:1936">11.4</a></dd>
1061 <a class="idx" href="initfile.html#idx:filesearchpath2:11">2.2</a> <a class="idx" href="cmdline.html#idx:filesearchpath2:21">2.4.2</a> <a class="idx" href="cmdline.html#idx:filesearchpath2:23">2.4.2</a> <a class="idx" href="flags.html#idx:filesearchpath2:68">2.11</a> <a class="idx" href="flags.html#idx:filesearchpath2:130">2.11</a> <a class="idx" href="autoload.html#idx:filesearchpath2:161">2.13</a> <a class="idx" href="autoload.html#idx:filesearchpath2:167">2.13</a> <a class="idx" href="autoload.html#idx:filesearchpath2:173">2.13</a> <a class="idx" href="projectfiles.html#idx:filesearchpath2:268">3.1.1.3</a> <a class="idx" href="projectfiles.html#idx:filesearchpath2:269">3.1.1.3</a> <a class="idx" href="xref.html#idx:filesearchpath2:293">3.7</a> <a class="idx" href="consulting.html#idx:filesearchpath2:374">4.3</a> <a class="idx" href="consulting.html#idx:filesearchpath2:432">4.3</a> <a class="idx" href="consulting.html#idx:filesearchpath2:433">4.3</a> <a class="idx" href="consulting.html#idx:filesearchpath2:435">4.3</a> <a class="idx" href="consulting.html#idx:filesearchpath2:438">4.3</a> <a class="idx" href="consulting.html#idx:filesearchpath2:439">4.3</a> <a class="idx" href="consulting.html#idx:filesearchpath2:459">4.3</a> <a class="idx" href="foreigninclude.html#idx:filesearchpath2:1873">10.4.14.3</a> <a class="idx" href="findhome.html#idx:filesearchpath2:1901">10.6</a> <a class="idx" href="qsaveforeign.html#idx:filesearchpath2:1927">11.2</a> <a class="idx" href="qsaveforeign.html#idx:filesearchpath2:1928">11.2</a> <a class="idx" href="useresource.html#idx:filesearchpath2:1933">11.3.1</a> <a class="idx" href="useresource.html#idx:filesearchpath2:1935">11.3.1</a> <a class="idx" href="findappfile.html#idx:filesearchpath2:1939">11.4</a></dd>
10551062 <dt>fileerrors/2</dt>
10561063 <dd>
10571064 <a class="idx" href="flags.html#idx:fileerrors2:83">2.11</a></dd>
10581065 <dt><a class="idx" href="debugging.html#find_chr_constraint/1">find_chr_constraint/1</a></dt>
10591066 <dt><a class="idx" href="allsolutions.html#findall/3">findall/3</a></dt>
10601067 <dd>
1061 <a class="idx" href="cyclic.html#idx:findall3:207">2.16</a> <a class="idx" href="compare.html#idx:findall3:586">4.7.2</a> <a class="idx" href="control.html#idx:findall3:594">4.8</a> <a class="idx" href="allsolutions.html#idx:findall3:1239">4.29</a> <a class="idx" href="allsolutions.html#idx:findall3:1242">4.29</a> <a class="idx" href="allsolutions.html#idx:findall3:1243">4.29</a> <a class="idx" href="forall2.html#idx:findall3:1259">4.30</a> <a class="idx" href="dicts.html#idx:findall3:1506">5.4.3</a> <a class="idx" href="extvar.html#idx:findall3:1616">7</a> <a class="idx" href="predsummary.html#idx:findall3:2152">F.1</a></dd>
1068 <a class="idx" href="cyclic.html#idx:findall3:207">2.16</a> <a class="idx" href="compare.html#idx:findall3:587">4.7.2</a> <a class="idx" href="control.html#idx:findall3:595">4.8</a> <a class="idx" href="allsolutions.html#idx:findall3:1241">4.29</a> <a class="idx" href="allsolutions.html#idx:findall3:1244">4.29</a> <a class="idx" href="allsolutions.html#idx:findall3:1245">4.29</a> <a class="idx" href="forall2.html#idx:findall3:1261">4.30</a> <a class="idx" href="dicts.html#idx:findall3:1508">5.4.3</a> <a class="idx" href="extvar.html#idx:findall3:1618">7</a> <a class="idx" href="predsummary.html#idx:findall3:2159">F.1</a></dd>
10621069 <dt><a class="idx" href="allsolutions.html#findall/4">findall/4</a></dt>
10631070 <dd>
1064 <a class="idx" href="allsolutions.html#idx:findall4:1244">4.29</a></dd>
1071 <a class="idx" href="allsolutions.html#idx:findall4:1246">4.29</a></dd>
10651072 <dt><a class="idx" href="allsolutions.html#findnsols/4">findnsols/4</a></dt>
10661073 <dt><a class="idx" href="allsolutions.html#findnsols/5">findnsols/5</a></dt>
10671074 <dt>findsols/4</dt>
10681075 <dd>
1069 <a class="idx" href="predsummary.html#idx:findsols4:2153">F.1</a></dd>
1076 <a class="idx" href="predsummary.html#idx:findsols4:2160">F.1</a></dd>
10701077 <dt><a class="idx" href="db.html#flag/3">flag/3</a></dt>
10711078 <dd>
1072 <a class="idx" href="db.html#idx:flag3:754">4.13</a> <a class="idx" href="db.html#idx:flag3:755">4.13</a> <a class="idx" href="examineprog.html#idx:flag3:792">4.15</a> <a class="idx" href="manipterm.html#idx:flag3:1106">4.20.1</a></dd>
1079 <a class="idx" href="db.html#idx:flag3:755">4.13</a> <a class="idx" href="db.html#idx:flag3:756">4.13</a> <a class="idx" href="examineprog.html#idx:flag3:793">4.15</a> <a class="idx" href="manipterm.html#idx:flag3:1107">4.20.1</a></dd>
10731080 <dt><a class="idx" href="lists.html#flatten/2">flatten/2</a></dt>
10741081 <dd>
1075 <a class="idx" href="import.html#idx:flatten2:1527">6.3</a> <a class="idx" href="import.html#idx:flatten2:1530">6.3</a></dd>
1082 <a class="idx" href="import.html#idx:flatten2:1529">6.3</a> <a class="idx" href="import.html#idx:flatten2:1532">6.3</a></dd>
10761083 <dt><a class="idx" href="typetest.html#float/1">float/1</a></dt>
10771084 <dd>
1078 <a class="idx" href="typetest.html#idx:float1:561">4.6</a></dd>
1085 <a class="idx" href="typetest.html#idx:float1:562">4.6</a></dd>
10791086 <dt><a class="idx" href="chario.html#flush_output/0">flush_output/0</a></dt>
10801087 <dd>
1081 <a class="idx" href="chario.html#idx:flushoutput0:965">4.18</a></dd>
1088 <a class="idx" href="chario.html#idx:flushoutput0:966">4.18</a></dd>
10821089 <dt><a class="idx" href="chario.html#flush_output/1">flush_output/1</a></dt>
10831090 <dd>
1084 <a class="idx" href="exception.html#idx:flushoutput1:671">4.10.3</a> <a class="idx" href="chario.html#idx:flushoutput1:994">4.18</a></dd>
1091 <a class="idx" href="exception.html#idx:flushoutput1:672">4.10.3</a> <a class="idx" href="chario.html#idx:flushoutput1:995">4.18</a></dd>
10851092 <dt>flush_output/[0,1]</dt>
10861093 <dd>
1087 <a class="idx" href="IO.html#idx:flushoutput01:867">4.16.2</a> <a class="idx" href="chario.html#idx:flushoutput01:967">4.18</a></dd>
1094 <a class="idx" href="IO.html#idx:flushoutput01:868">4.16.2</a> <a class="idx" href="chario.html#idx:flushoutput01:968">4.18</a></dd>
10881095 <dt><a class="idx" href="apply.html#foldl/4">foldl/4</a></dt>
10891096 <dt><a class="idx" href="apply.html#foldl/5">foldl/5</a></dt>
10901097 <dt><a class="idx" href="apply.html#foldl/6">foldl/6</a></dt>
10911098 <dt><a class="idx" href="apply.html#foldl/7">foldl/7</a></dt>
10921099 <dt><a class="idx" href="forall2.html#forall/2">forall/2</a></dt>
10931100 <dd>
1094 <a class="idx" href="forall2.html#idx:forall2:1253">4.30</a> <a class="idx" href="forall2.html#idx:forall2:1254">4.30</a> <a class="idx" href="forall2.html#idx:forall2:1255">4.30</a> <a class="idx" href="forall2.html#idx:forall2:1256">4.30</a> <a class="idx" href="forall2.html#idx:forall2:1257">4.30</a></dd>
1101 <a class="idx" href="forall2.html#idx:forall2:1255">4.30</a> <a class="idx" href="forall2.html#idx:forall2:1256">4.30</a> <a class="idx" href="forall2.html#idx:forall2:1257">4.30</a> <a class="idx" href="forall2.html#idx:forall2:1258">4.30</a> <a class="idx" href="forall2.html#idx:forall2:1259">4.30</a></dd>
10951102 <dt><a class="idx" href="aggregate.html#foreach/2">foreach/2</a></dt>
10961103 <dd>
1097 <a class="idx" href="forall2.html#idx:foreach2:1260">4.30</a></dd>
1104 <a class="idx" href="forall2.html#idx:foreach2:1262">4.30</a></dd>
10981105 <dt><a class="idx" href="format.html#format/1">format/1</a></dt>
10991106 <dd>
1100 <a class="idx" href="exception.html#idx:format1:672">4.10.3</a> <a class="idx" href="format.html#idx:format1:1264">4.31</a></dd>
1107 <a class="idx" href="exception.html#idx:format1:673">4.10.3</a> <a class="idx" href="format.html#idx:format1:1266">4.31</a></dd>
11011108 <dt><a class="idx" href="format.html#format/2">format/2</a></dt>
11021109 <dd>
1103 <a class="idx" href="syntax.html#idx:format2:188">2.15.2.3</a> <a class="idx" href="IO.html#idx:format2:871">4.16.2</a> <a class="idx" href="termrw.html#idx:format2:1030">4.19</a> <a class="idx" href="locale.html#idx:format2:1165">4.22</a> <a class="idx" href="locale.html#idx:format2:1166">4.22</a> <a class="idx" href="format.html#idx:format2:1265">4.31</a> <a class="idx" href="format.html#idx:format2:1277">4.31.2</a> <a class="idx" href="format.html#idx:format2:1285">4.31.2</a></dd>
1110 <a class="idx" href="syntax.html#idx:format2:188">2.15.2.3</a> <a class="idx" href="IO.html#idx:format2:872">4.16.2</a> <a class="idx" href="termrw.html#idx:format2:1031">4.19</a> <a class="idx" href="locale.html#idx:format2:1166">4.22</a> <a class="idx" href="locale.html#idx:format2:1167">4.22</a> <a class="idx" href="format.html#idx:format2:1267">4.31</a> <a class="idx" href="format.html#idx:format2:1279">4.31.2</a> <a class="idx" href="format.html#idx:format2:1287">4.31.2</a></dd>
11041111 <dt><a class="idx" href="format.html#format/3">format/3</a></dt>
11051112 <dd>
1106 <a class="idx" href="exception.html#idx:format3:657">4.10.3</a> <a class="idx" href="exception.html#idx:format3:670">4.10.3</a> <a class="idx" href="exception.html#idx:format3:673">4.10.3</a> <a class="idx" href="exception.html#idx:format3:684">4.10.3</a> <a class="idx" href="exception.html#idx:format3:688">4.10.3.1</a> <a class="idx" href="IO.html#idx:format3:853">4.16.1</a> <a class="idx" href="IO.html#idx:format3:946">4.16.5</a> <a class="idx" href="termrw.html#idx:format3:1000">4.19</a> <a class="idx" href="manipatom.html#idx:format3:1131">4.21</a> <a class="idx" href="manipatom.html#idx:format3:1147">4.21</a> <a class="idx" href="locale.html#idx:format3:1167">4.22</a> <a class="idx" href="chartype.html#idx:format3:1185">4.23.2</a> <a class="idx" href="arith.html#idx:format3:1210">4.26.2.1</a> <a class="idx" href="arith.html#idx:format3:1212">4.26.2.2</a> <a class="idx" href="format.html#idx:format3:1266">4.31</a> <a class="idx" href="format.html#idx:format3:1282">4.31.2</a> <a class="idx" href="format.html#idx:format3:1287">4.31.3</a> <a class="idx" href="strings.html#idx:format3:1464">5.2.2</a> <a class="idx" href="strings.html#idx:format3:1473">5.2.3</a></dd>
1113 <a class="idx" href="exception.html#idx:format3:658">4.10.3</a> <a class="idx" href="exception.html#idx:format3:671">4.10.3</a> <a class="idx" href="exception.html#idx:format3:674">4.10.3</a> <a class="idx" href="exception.html#idx:format3:685">4.10.3</a> <a class="idx" href="exception.html#idx:format3:689">4.10.3.1</a> <a class="idx" href="IO.html#idx:format3:854">4.16.1</a> <a class="idx" href="IO.html#idx:format3:947">4.16.5</a> <a class="idx" href="termrw.html#idx:format3:1001">4.19</a> <a class="idx" href="manipatom.html#idx:format3:1132">4.21</a> <a class="idx" href="manipatom.html#idx:format3:1148">4.21</a> <a class="idx" href="locale.html#idx:format3:1168">4.22</a> <a class="idx" href="chartype.html#idx:format3:1186">4.23.2</a> <a class="idx" href="arith.html#idx:format3:1212">4.26.2.1</a> <a class="idx" href="arith.html#idx:format3:1214">4.26.2.2</a> <a class="idx" href="format.html#idx:format3:1268">4.31</a> <a class="idx" href="format.html#idx:format3:1284">4.31.2</a> <a class="idx" href="format.html#idx:format3:1289">4.31.3</a> <a class="idx" href="strings.html#idx:format3:1466">5.2.2</a> <a class="idx" href="strings.html#idx:format3:1475">5.2.3</a></dd>
11071114 <dt>format/[1,2]</dt>
11081115 <dd>
1109 <a class="idx" href="termrw.html#idx:format12:997">4.19</a> <a class="idx" href="predsummary.html#idx:format12:2154">F.1</a></dd>
1116 <a class="idx" href="termrw.html#idx:format12:998">4.19</a> <a class="idx" href="predsummary.html#idx:format12:2161">F.1</a></dd>
11101117 <dt>format/[2,3]</dt>
11111118 <dd>
11121119 <a class="idx" href="syntax.html#idx:format23:186">2.15.2.1</a></dd>
11131120 <dt><a class="idx" href="format.html#format_predicate/2">format_predicate/2</a></dt>
11141121 <dt><a class="idx" href="system.html#format_time/3">format_time/3</a></dt>
11151122 <dd>
1116 <a class="idx" href="locale.html#idx:formattime3:1164">4.22</a> <a class="idx" href="format.html#idx:formattime3:1288">4.31.3</a> <a class="idx" href="system.html#idx:formattime3:1309">4.33</a></dd>
1123 <a class="idx" href="locale.html#idx:formattime3:1165">4.22</a> <a class="idx" href="format.html#idx:formattime3:1290">4.31.3</a> <a class="idx" href="system.html#idx:formattime3:1311">4.33</a></dd>
11171124 <dt><a class="idx" href="system.html#format_time/4">format_time/4</a></dt>
11181125 <dd>
1119 <a class="idx" href="system.html#idx:formattime4:1337">4.33.2.2</a> <a class="idx" href="system.html#idx:formattime4:1338">4.33.2.2</a> <a class="idx" href="system.html#idx:formattime4:1339">4.33.2.2</a> <a class="idx" href="system.html#idx:formattime4:1340">4.33.2.2</a></dd>
1126 <a class="idx" href="system.html#idx:formattime4:1339">4.33.2.2</a> <a class="idx" href="system.html#idx:formattime4:1340">4.33.2.2</a> <a class="idx" href="system.html#idx:formattime4:1341">4.33.2.2</a> <a class="idx" href="system.html#idx:formattime4:1342">4.33.2.2</a></dd>
11201127 <dt><a class="idx" href="charsio.html#format_to_chars/3">format_to_chars/3</a></dt>
11211128 <dt><a class="idx" href="charsio.html#format_to_chars/4">format_to_chars/4</a></dt>
11221129 <dt><a class="idx" href="aggregate.html#free_variables/4">free_variables/4</a></dt>
11231130 <dt><a class="idx" href="coroutining.html#freeze/2">freeze/2</a></dt>
11241131 <dd>
1125 <a class="idx" href="coroutining.html#idx:freeze2:1638">7.2</a> <a class="idx" href="coroutining.html#idx:freeze2:1639">7.2</a> <a class="idx" href="coroutining.html#idx:freeze2:1641">7.2</a> <a class="idx" href="coroutining.html#idx:freeze2:1642">7.2</a></dd>
1132 <a class="idx" href="coroutining.html#idx:freeze2:1640">7.2</a> <a class="idx" href="coroutining.html#idx:freeze2:1641">7.2</a> <a class="idx" href="coroutining.html#idx:freeze2:1643">7.2</a> <a class="idx" href="coroutining.html#idx:freeze2:1644">7.2</a></dd>
11261133 <dt><a class="idx" href="coroutining.html#frozen/2">frozen/2</a></dt>
11271134 <dt>functor</dt>
11281135 <dd>
1129 <a class="idx" href="glossary.html#idx:functor:2096">D</a></dd>
1136 <a class="idx" href="glossary.html#idx:functor:2100">D</a></dd>
11301137 <dt><a class="idx" href="manipterm.html#functor/3">functor/3</a></dt>
11311138 <dd>
1132 <a class="idx" href="typetest.html#idx:functor3:563">4.6</a> <a class="idx" href="examineprog.html#idx:functor3:801">4.15</a> <a class="idx" href="manipterm.html#idx:functor3:1074">4.20</a> <a class="idx" href="manipterm.html#idx:functor3:1077">4.20</a> <a class="idx" href="manipterm.html#idx:functor3:1078">4.20</a> <a class="idx" href="ext-syntax.html#idx:functor3:1478">5.3.2</a> <a class="idx" href="dicts.html#idx:functor3:1484">5.4.1</a> <a class="idx" href="gvar.html#idx:functor3:1671">7.3.1</a></dd>
1139 <a class="idx" href="typetest.html#idx:functor3:564">4.6</a> <a class="idx" href="examineprog.html#idx:functor3:802">4.15</a> <a class="idx" href="manipterm.html#idx:functor3:1075">4.20</a> <a class="idx" href="manipterm.html#idx:functor3:1078">4.20</a> <a class="idx" href="manipterm.html#idx:functor3:1079">4.20</a> <a class="idx" href="ext-syntax.html#idx:functor3:1480">5.3.2</a> <a class="idx" href="dicts.html#idx:functor3:1486">5.4.1</a> <a class="idx" href="gvar.html#idx:functor3:1674">7.3.1</a></dd>
11331140 <dt><a class="idx" href="memory.html#garbage_collect/0">garbage_collect/0</a></dt>
11341141 <dt><a class="idx" href="memory.html#garbage_collect_atoms/0">garbage_collect_atoms/0</a></dt>
11351142 <dd>
1136 <a class="idx" href="flags.html#idx:garbagecollectatoms0:64">2.11</a> <a class="idx" href="memory.html#idx:garbagecollectatoms0:1429">4.40</a> <a class="idx" href="foreigninclude.html#idx:garbagecollectatoms0:1887">10.4.19</a></dd>
1143 <a class="idx" href="flags.html#idx:garbagecollectatoms0:64">2.11</a> <a class="idx" href="memory.html#idx:garbagecollectatoms0:1431">4.40</a> <a class="idx" href="foreigninclude.html#idx:garbagecollectatoms0:1890">10.4.19</a></dd>
11371144 <dt><a class="idx" href="consulting.html#garbage_collect_clauses/0">garbage_collect_clauses/0</a></dt>
11381145 <dd>
1139 <a class="idx" href="jitindex.html#idx:garbagecollectclauses0:225">2.17</a> <a class="idx" href="consulting.html#idx:garbagecollectclauses0:515">4.3.2</a> <a class="idx" href="consulting.html#idx:garbagecollectclauses0:516">4.3.2</a> <a class="idx" href="consulting.html#idx:garbagecollectclauses0:528">4.3.2.3</a></dd>
1146 <a class="idx" href="jitindex.html#idx:garbagecollectclauses0:225">2.17</a> <a class="idx" href="consulting.html#idx:garbagecollectclauses0:516">4.3.2</a> <a class="idx" href="consulting.html#idx:garbagecollectclauses0:517">4.3.2</a> <a class="idx" href="consulting.html#idx:garbagecollectclauses0:529">4.3.2.3</a></dd>
11401147 <dt>garbage_collect_heap/0</dt>
11411148 <dd>
1142 <a class="idx" href="statistics.html#idx:garbagecollectheap0:1414">4.38</a></dd>
1149 <a class="idx" href="statistics.html#idx:garbagecollectheap0:1416">4.38</a></dd>
11431150 <dt><a class="idx" href="guitracer.html#gdebug/0">gdebug/0</a></dt>
11441151 <dt><a class="idx" href="assoc.html#gen_assoc/3">gen_assoc/3</a></dt>
11451152 <dt><a class="idx" href="nb_set.html#gen_nb_set/2">gen_nb_set/2</a></dt>
11471154 <dt><a class="idx" href="gensym.html#gensym/2">gensym/2</a></dt>
11481155 <dt><a class="idx" href="chario.html#get/1">get/1</a></dt>
11491156 <dd>
1150 <a class="idx" href="chario.html#idx:get1:979">4.18</a> <a class="idx" href="chario.html#idx:get1:981">4.18</a></dd>
1157 <a class="idx" href="chario.html#idx:get1:980">4.18</a> <a class="idx" href="chario.html#idx:get1:982">4.18</a></dd>
11511158 <dt><a class="idx" href="chario.html#get/2">get/2</a></dt>
11521159 <dt><a class="idx" href="chario.html#get0/1">get0/1</a></dt>
11531160 <dd>
1154 <a class="idx" href="IO.html#idx:get01:869">4.16.2</a> <a class="idx" href="chario.html#idx:get01:974">4.18</a> <a class="idx" href="chario.html#idx:get01:976">4.18</a> <a class="idx" href="chario.html#idx:get01:978">4.18</a> <a class="idx" href="chario.html#idx:get01:980">4.18</a> <a class="idx" href="chario.html#idx:get01:982">4.18</a></dd>
1161 <a class="idx" href="IO.html#idx:get01:870">4.16.2</a> <a class="idx" href="chario.html#idx:get01:975">4.18</a> <a class="idx" href="chario.html#idx:get01:977">4.18</a> <a class="idx" href="chario.html#idx:get01:979">4.18</a> <a class="idx" href="chario.html#idx:get01:981">4.18</a> <a class="idx" href="chario.html#idx:get01:983">4.18</a></dd>
11551162 <dt><a class="idx" href="chario.html#get0/2">get0/2</a></dt>
11561163 <dd>
1157 <a class="idx" href="chario.html#idx:get02:983">4.18</a></dd>
1164 <a class="idx" href="chario.html#idx:get02:984">4.18</a></dd>
11581165 <dt>get_assoc/2</dt>
11591166 <dd>
1160 <a class="idx" href="dicts.html#idx:getassoc2:1509">5.4.3</a></dd>
1167 <a class="idx" href="dicts.html#idx:getassoc2:1511">5.4.3</a></dd>
11611168 <dt><a class="idx" href="assoc.html#get_assoc/3">get_assoc/3</a></dt>
11621169 <dt><a class="idx" href="assoc.html#get_assoc/5">get_assoc/5</a></dt>
11631170 <dt><a class="idx" href="attvar.html#get_attr/3">get_attr/3</a></dt>
11641171 <dd>
1165 <a class="idx" href="attvar.html#idx:getattr3:1635">7.1.4</a></dd>
1172 <a class="idx" href="attvar.html#idx:getattr3:1637">7.1.4</a></dd>
11661173 <dt><a class="idx" href="attvar.html#get_attrs/2">get_attrs/2</a></dt>
11671174 <dd>
1168 <a class="idx" href="attvar.html#idx:getattrs2:1637">7.1.4</a></dd>
1175 <a class="idx" href="attvar.html#idx:getattrs2:1639">7.1.4</a></dd>
11691176 <dt><a class="idx" href="chario.html#get_byte/1">get_byte/1</a></dt>
11701177 <dd>
1171 <a class="idx" href="chario.html#idx:getbyte1:975">4.18</a></dd>
1178 <a class="idx" href="chario.html#idx:getbyte1:976">4.18</a></dd>
11721179 <dt><a class="idx" href="chario.html#get_byte/2">get_byte/2</a></dt>
11731180 <dd>
1174 <a class="idx" href="chario.html#idx:getbyte2:971">4.18</a></dd>
1181 <a class="idx" href="chario.html#idx:getbyte2:972">4.18</a></dd>
11751182 <dt>get_byte/[1,2]</dt>
11761183 <dd>
1177 <a class="idx" href="chars.html#idx:getbyte12:320">4.2</a></dd>
1184 <a class="idx" href="chars.html#idx:getbyte12:321">4.2</a></dd>
11781185 <dt><a class="idx" href="chario.html#get_char/1">get_char/1</a></dt>
11791186 <dd>
1180 <a class="idx" href="chario.html#idx:getchar1:968">4.18</a></dd>
1187 <a class="idx" href="chario.html#idx:getchar1:969">4.18</a></dd>
11811188 <dt><a class="idx" href="chario.html#get_char/2">get_char/2</a></dt>
11821189 <dd>
1183 <a class="idx" href="chario.html#idx:getchar2:970">4.18</a></dd>
1190 <a class="idx" href="chario.html#idx:getchar2:971">4.18</a></dd>
11841191 <dt>get_char/[1,2]</dt>
11851192 <dd>
1186 <a class="idx" href="chars.html#idx:getchar12:318">4.2</a></dd>
1193 <a class="idx" href="chars.html#idx:getchar12:319">4.2</a></dd>
11871194 <dt><a class="idx" href="chario.html#get_code/1">get_code/1</a></dt>
11881195 <dd>
1189 <a class="idx" href="chars.html#idx:getcode1:311">4.2</a> <a class="idx" href="IO.html#idx:getcode1:847">4.16.1</a> <a class="idx" href="chario.html#idx:getcode1:973">4.18</a> <a class="idx" href="chario.html#idx:getcode1:985">4.18</a> <a class="idx" href="chario.html#idx:getcode1:987">4.18</a></dd>
1196 <a class="idx" href="chars.html#idx:getcode1:312">4.2</a> <a class="idx" href="IO.html#idx:getcode1:848">4.16.1</a> <a class="idx" href="chario.html#idx:getcode1:974">4.18</a> <a class="idx" href="chario.html#idx:getcode1:986">4.18</a> <a class="idx" href="chario.html#idx:getcode1:988">4.18</a></dd>
11901197 <dt><a class="idx" href="chario.html#get_code/2">get_code/2</a></dt>
11911198 <dd>
1192 <a class="idx" href="widechars.html#idx:getcode2:232">2.18.1</a> <a class="idx" href="IO.html#idx:getcode2:899">4.16.2</a> <a class="idx" href="chario.html#idx:getcode2:972">4.18</a> <a class="idx" href="chario.html#idx:getcode2:977">4.18</a> <a class="idx" href="chario.html#idx:getcode2:989">4.18</a> <a class="idx" href="chario.html#idx:getcode2:992">4.18</a></dd>
1199 <a class="idx" href="widechars.html#idx:getcode2:232">2.18.1</a> <a class="idx" href="IO.html#idx:getcode2:900">4.16.2</a> <a class="idx" href="chario.html#idx:getcode2:973">4.18</a> <a class="idx" href="chario.html#idx:getcode2:978">4.18</a> <a class="idx" href="chario.html#idx:getcode2:990">4.18</a> <a class="idx" href="chario.html#idx:getcode2:993">4.18</a></dd>
11931200 <dt>get_code/[1,2]</dt>
11941201 <dd>
1195 <a class="idx" href="chars.html#idx:getcode12:319">4.2</a></dd>
1202 <a class="idx" href="chars.html#idx:getcode12:320">4.2</a></dd>
11961203 <dt><a class="idx" href="dicts.html#get_dict/3">get_dict/3</a></dt>
11971204 <dd>
1198 <a class="idx" href="dicts.html#idx:getdict3:1489">5.4.1.2</a></dd>
1205 <a class="idx" href="dicts.html#idx:getdict3:1491">5.4.1.2</a></dd>
11991206 <dt><a class="idx" href="dicts.html#get_dict/5">get_dict/5</a></dt>
12001207 <dt>get_dict_ex/3</dt>
12011208 <dd>
1202 <a class="idx" href="dicts.html#idx:getdictex3:1487">5.4.1</a> <a class="idx" href="dicts.html#idx:getdictex3:1490">5.4.1.2</a></dd>
1209 <a class="idx" href="dicts.html#idx:getdictex3:1489">5.4.1</a> <a class="idx" href="dicts.html#idx:getdictex3:1492">5.4.1.2</a></dd>
12031210 <dt><a class="idx" href="chario.html#get_single_char/1">get_single_char/1</a></dt>
12041211 <dd>
12051212 <a class="idx" href="cmdline.html#idx:getsinglechar1:17">2.4.2</a> <a class="idx" href="flags.html#idx:getsinglechar1:120">2.11</a></dd>
12061213 <dt><a class="idx" href="strings.html#get_string_code/3">get_string_code/3</a></dt>
12071214 <dt><a class="idx" href="system.html#get_time/1">get_time/1</a></dt>
12081215 <dd>
1209 <a class="idx" href="files.html#idx:gettime1:1354">4.34</a> <a class="idx" href="statistics.html#idx:gettime1:1416">4.38</a> <a class="idx" href="threadcom.html#idx:gettime1:1745">9.3.1</a> <a class="idx" href="threadcom.html#idx:gettime1:1759">9.3.1</a></dd>
1216 <a class="idx" href="files.html#idx:gettime1:1356">4.34</a> <a class="idx" href="statistics.html#idx:gettime1:1418">4.38</a> <a class="idx" href="threadcom.html#idx:gettime1:1748">9.3.1</a> <a class="idx" href="threadcom.html#idx:gettime1:1762">9.3.1</a></dd>
12101217 <dt><a class="idx" href="system.html#getenv/2">getenv/2</a></dt>
12111218 <dd>
1212 <a class="idx" href="system.html#idx:getenv2:1303">4.33</a> <a class="idx" href="www_browser.html#idx:getenv2:1956">A.16</a></dd>
1219 <a class="idx" href="system.html#idx:getenv2:1305">4.33</a> <a class="idx" href="www_browser.html#idx:getenv2:1959">A.16</a></dd>
12131220 <dt><a class="idx" href="random.html#getrand/1">getrand/1</a></dt>
12141221 <dt><a class="idx" href="clpfd.html#global_cardinality/2">global_cardinality/2</a></dt>
12151222 <dt><a class="idx" href="clpfd.html#global_cardinality/3">global_cardinality/3</a></dt>
12161223 <dt><a class="idx" href="url.html#global_url/3">global_url/3</a></dt>
12171224 <dt>go/0</dt>
12181225 <dd>
1219 <a class="idx" href="ext-syntax.html#idx:go0:1483">5.3.2</a></dd>
1226 <a class="idx" href="ext-syntax.html#idx:go0:1485">5.3.2</a></dd>
12201227 <dt>goal</dt>
12211228 <dd>
1222 <a class="idx" href="glossary.html#idx:goal:2097">D</a></dd>
1229 <a class="idx" href="glossary.html#idx:goal:2101">D</a></dd>
12231230 <dt><a class="idx" href="consulting.html#goal_expansion/2">goal_expansion/2</a></dt>
12241231 <dd>
1225 <a class="idx" href="consulting.html#idx:goalexpansion2:338">4.3</a> <a class="idx" href="consulting.html#idx:goalexpansion2:481">4.3.1</a> <a class="idx" href="consulting.html#idx:goalexpansion2:489">4.3.1</a> <a class="idx" href="consulting.html#idx:goalexpansion2:495">4.3.1</a> <a class="idx" href="consulting.html#idx:goalexpansion2:498">4.3.1</a> <a class="idx" href="consulting.html#idx:goalexpansion2:499">4.3.1</a> <a class="idx" href="consulting.html#idx:goalexpansion2:500">4.3.1</a> <a class="idx" href="consulting.html#idx:goalexpansion2:502">4.3.1</a> <a class="idx" href="consulting.html#idx:goalexpansion2:506">4.3.1</a> <a class="idx" href="consulting.html#idx:goalexpansion2:508">4.3.1</a> <a class="idx" href="consulting.html#idx:goalexpansion2:512">4.3.1.2</a> <a class="idx" href="dialect.html#idx:goalexpansion2:2058">C</a> <a class="idx" href="portabilitystrategies.html#idx:goalexpansion2:2062">C.1</a> <a class="idx" href="portabilitystrategies.html#idx:goalexpansion2:2067">C.1</a> <a class="idx" href="portabilitystrategies.html#idx:goalexpansion2:2069">C.1</a> <a class="idx" href="predsummary.html#idx:goalexpansion2:2150">F.1</a></dd>
1232 <a class="idx" href="consulting.html#idx:goalexpansion2:339">4.3</a> <a class="idx" href="consulting.html#idx:goalexpansion2:482">4.3.1</a> <a class="idx" href="consulting.html#idx:goalexpansion2:490">4.3.1</a> <a class="idx" href="consulting.html#idx:goalexpansion2:496">4.3.1</a> <a class="idx" href="consulting.html#idx:goalexpansion2:499">4.3.1</a> <a class="idx" href="consulting.html#idx:goalexpansion2:500">4.3.1</a> <a class="idx" href="consulting.html#idx:goalexpansion2:501">4.3.1</a> <a class="idx" href="consulting.html#idx:goalexpansion2:503">4.3.1</a> <a class="idx" href="consulting.html#idx:goalexpansion2:507">4.3.1</a> <a class="idx" href="consulting.html#idx:goalexpansion2:509">4.3.1</a> <a class="idx" href="consulting.html#idx:goalexpansion2:513">4.3.1.2</a> <a class="idx" href="dialect.html#idx:goalexpansion2:2061">C</a> <a class="idx" href="portabilitystrategies.html#idx:goalexpansion2:2065">C.1</a> <a class="idx" href="portabilitystrategies.html#idx:goalexpansion2:2070">C.1</a> <a class="idx" href="portabilitystrategies.html#idx:goalexpansion2:2072">C.1</a> <a class="idx" href="predsummary.html#idx:goalexpansion2:2157">F.1</a></dd>
12261233 <dt><a class="idx" href="consulting.html#goal_expansion/4">goal_expansion/4</a></dt>
12271234 <dd>
1228 <a class="idx" href="consulting.html#idx:goalexpansion4:339">4.3</a></dd>
1235 <a class="idx" href="consulting.html#idx:goalexpansion4:340">4.3</a></dd>
12291236 <dt><a class="idx" href="typetest.html#ground/1">ground/1</a></dt>
12301237 <dd>
1231 <a class="idx" href="cyclic.html#idx:ground1:208">2.16</a> <a class="idx" href="db.html#idx:ground1:766">4.13.2</a> <a class="idx" href="foreigninclude.html#idx:ground1:1830">10.4.3.1</a></dd>
1238 <a class="idx" href="cyclic.html#idx:ground1:208">2.16</a> <a class="idx" href="db.html#idx:ground1:767">4.13.2</a> <a class="idx" href="foreigninclude.html#idx:ground1:1833">10.4.3.1</a></dd>
12321239 <dt><a class="idx" href="solutionsequences.html#group_by/4">group_by/4</a></dt>
12331240 <dt><a class="idx" href="pairs.html#group_pairs_by_key/2">group_pairs_by_key/2</a></dt>
12341241 <dt><a class="idx" href="guitracer.html#gspy/1">gspy/1</a></dt>
12351242 <dt><a class="idx" href="guitracer.html#gtrace/0">gtrace/0</a></dt>
12361243 <dd>
1237 <a class="idx" href="thutil.html#idx:gtrace0:1798">9.5.1</a></dd>
1244 <a class="idx" href="thutil.html#idx:gtrace0:1801">9.5.1</a></dd>
12381245 <dt><a class="idx" href="guitracer.html#guitracer/0">guitracer/0</a></dt>
12391246 <dd>
1240 <a class="idx" href="guitracer.html#idx:guitracer0:285">3.5.1</a> <a class="idx" href="guitracer.html#idx:guitracer0:291">3.5.1</a> <a class="idx" href="idesummary.html#idx:guitracer0:300">3.9</a> <a class="idx" href="debugger.html#idx:guitracer0:1392">4.37</a></dd>
1247 <a class="idx" href="guitracer.html#idx:guitracer0:285">3.5.1</a> <a class="idx" href="guitracer.html#idx:guitracer0:291">3.5.1</a> <a class="idx" href="idesummary.html#idx:guitracer0:300">3.9</a> <a class="idx" href="debugger.html#idx:guitracer0:1394">4.37</a></dd>
12411248 <dt><a class="idx" href="xref.html#gxref/0">gxref/0</a></dt>
12421249 <dd>
1243 <a class="idx" href="help.html#idx:gxref0:36">2.6</a> <a class="idx" href="import.html#idx:gxref0:1540">6.3</a> <a class="idx" href="runtime.html#idx:gxref0:1915">11</a> <a class="idx" href="prolog_xref.html#idx:gxref0:1958">A.25</a></dd>
1250 <a class="idx" href="help.html#idx:gxref0:36">2.6</a> <a class="idx" href="import.html#idx:gxref0:1542">6.3</a> <a class="idx" href="runtime.html#idx:gxref0:1918">11</a> <a class="idx" href="prolog_xref.html#idx:gxref0:1961">A.25</a></dd>
12441251 <dt><a class="idx" href="toplevel.html#halt/0">halt/0</a></dt>
12451252 <dd>
1246 <a class="idx" href="debugoverview.html#idx:halt0:52">2.9</a> <a class="idx" href="consulting.html#idx:halt0:464">4.3</a> <a class="idx" href="predsummary.html#idx:halt0:2148">F.1</a></dd>
1253 <a class="idx" href="debugoverview.html#idx:halt0:52">2.9</a> <a class="idx" href="consulting.html#idx:halt0:465">4.3</a> <a class="idx" href="predsummary.html#idx:halt0:2155">F.1</a></dd>
12471254 <dt><a class="idx" href="toplevel.html#halt/1">halt/1</a></dt>
12481255 <dd>
1249 <a class="idx" href="flags.html#idx:halt1:87">2.11</a> <a class="idx" href="toplevel.html#idx:halt1:1380">4.35</a> <a class="idx" href="foreigninclude.html#idx:halt1:1876">10.4.16</a> <a class="idx" href="predsummary.html#idx:halt1:2146">F.1</a></dd>
1256 <a class="idx" href="flags.html#idx:halt1:87">2.11</a> <a class="idx" href="toplevel.html#idx:halt1:1382">4.35</a> <a class="idx" href="foreigninclude.html#idx:halt1:1879">10.4.16</a> <a class="idx" href="predsummary.html#idx:halt1:2153">F.1</a></dd>
12501257 <dt>halt/[0,1]</dt>
12511258 <dd>
1252 <a class="idx" href="consulting.html#idx:halt01:462">4.3</a></dd>
1259 <a class="idx" href="consulting.html#idx:halt01:463">4.3</a></dd>
12531260 <dt>hashing</dt>
12541261 <dd>
1255 <a class="idx" href="glossary.html#idx:hashing:2099">D</a></dd>
1262 <a class="idx" href="glossary.html#idx:hashing:2103">D</a></dd>
12561263 <dt>head</dt>
12571264 <dd>
1258 <a class="idx" href="glossary.html#idx:head:2100">D</a></dd>
1265 <a class="idx" href="glossary.html#idx:head:2104">D</a></dd>
12591266 <dt><a class="idx" href="help.html#help/0">help/0</a></dt>
12601267 <dd>
1261 <a class="idx" href="hooks.html#idx:help0:157">2.12</a> <a class="idx" href="useresource.html#idx:help0:1929">11.3</a> <a class="idx" href="intlibs.html#idx:help0:2033">B.7</a> <a class="idx" href="intlibs.html#idx:help0:2035">B.7</a></dd>
1268 <a class="idx" href="hooks.html#idx:help0:157">2.12</a> <a class="idx" href="useresource.html#idx:help0:1932">11.3</a> <a class="idx" href="intlibs.html#idx:help0:2036">B.7</a> <a class="idx" href="intlibs.html#idx:help0:2038">B.7</a></dd>
12621269 <dt><a class="idx" href="help.html#help/1">help/1</a></dt>
12631270 <dd>
1264 <a class="idx" href="help.html#idx:help1:32">2.6</a> <a class="idx" href="flags.html#idx:help1:135">2.11</a> <a class="idx" href="hooks.html#idx:help1:158">2.12</a> <a class="idx" href="intlibs.html#idx:help1:2034">B.7</a> <a class="idx" href="intlibs.html#idx:help1:2036">B.7</a> <a class="idx" href="intlibs.html#idx:help1:2037">B.7</a></dd>
1271 <a class="idx" href="help.html#idx:help1:32">2.6</a> <a class="idx" href="flags.html#idx:help1:135">2.11</a> <a class="idx" href="hooks.html#idx:help1:158">2.12</a> <a class="idx" href="intlibs.html#idx:help1:2037">B.7</a> <a class="idx" href="intlibs.html#idx:help1:2039">B.7</a> <a class="idx" href="intlibs.html#idx:help1:2040">B.7</a></dd>
12651272 <dt>hooks</dt>
12661273 <dd>
12671274 <a class="idx" href="hooks.html#idx:hooks:138">2.12</a></dd>
12681275 <dt><a class="idx" href="url.html#http_location/2">http_location/2</a></dt>
12691276 <dt>http_open/3</dt>
12701277 <dd>
1271 <a class="idx" href="exception.html#idx:httpopen3:693">4.10.3.1</a></dd>
1278 <a class="idx" href="exception.html#idx:httpopen3:694">4.10.3.1</a></dd>
12721279 <dt>http_timestamp/2</dt>
12731280 <dd>
1274 <a class="idx" href="system.html#idx:httptimestamp2:1341">4.33.2.2</a></dd>
1281 <a class="idx" href="system.html#idx:httptimestamp2:1343">4.33.2.2</a></dd>
12751282 <dt>if, directive</dt>
12761283 <dd>
1277 <a class="idx" href="consulting.html#idx:ifdirective:510">4.3.1.2</a></dd>
1284 <a class="idx" href="consulting.html#idx:ifdirective:511">4.3.1.2</a></dd>
12781285 <dt><a class="idx" href="consulting.html#if/1">if/1</a></dt>
12791286 <dd>
1280 <a class="idx" href="consulting.html#idx:if1:452">4.3</a></dd>
1287 <a class="idx" href="consulting.html#idx:if1:453">4.3</a></dd>
12811288 <dt><a class="idx" href="metacall.html#ignore/1">ignore/1</a></dt>
12821289 <dd>
1283 <a class="idx" href="profile.html#idx:ignore1:1424">4.39.1</a> <a class="idx" href="threadcreate.html#idx:ignore1:1701">9.1</a></dd>
1290 <a class="idx" href="profile.html#idx:ignore1:1426">4.39.1</a> <a class="idx" href="threadcreate.html#idx:ignore1:1704">9.1</a></dd>
12841291 <dt>immediate, update view</dt>
12851292 <dd>
1286 <a class="idx" href="db.html#idx:immediateupdateview:759">4.13.1</a></dd>
1293 <a class="idx" href="db.html#idx:immediateupdateview:760">4.13.1</a></dd>
12871294 <dt><a class="idx" href="altmoduleapi.html#import/1">import/1</a></dt>
12881295 <dd>
1289 <a class="idx" href="altmoduleapi.html#idx:import1:1587">6.11</a> <a class="idx" href="dynamic-modules.html#idx:import1:1590">6.12</a></dd>
1296 <a class="idx" href="altmoduleapi.html#idx:import1:1589">6.11</a> <a class="idx" href="dynamic-modules.html#idx:import1:1592">6.12</a></dd>
12901297 <dt><a class="idx" href="importmodule.html#import_module/2">import_module/2</a></dt>
12911298 <dd>
1292 <a class="idx" href="examineprog.html#idx:importmodule2:798">4.15</a> <a class="idx" href="importmodule.html#idx:importmodule2:1578">6.9</a> <a class="idx" href="importmodule.html#idx:importmodule2:1579">6.9</a></dd>
1299 <a class="idx" href="examineprog.html#idx:importmodule2:799">4.15</a> <a class="idx" href="importmodule.html#idx:importmodule2:1580">6.9</a> <a class="idx" href="importmodule.html#idx:importmodule2:1581">6.9</a></dd>
12931300 <dt>imported predicate</dt>
12941301 <dd>
1295 <a class="idx" href="glossary.html#idx:importedpredicate:2101">D</a></dd>
1302 <a class="idx" href="glossary.html#idx:importedpredicate:2105">D</a></dd>
12961303 <dt><a class="idx" href="clpfd.html#in/2">in/2</a></dt>
12971304 <dt><a class="idx" href="mt-xpce.html#in_pce_thread/1">in_pce_thread/1</a></dt>
12981305 <dd>
1299 <a class="idx" href="mt-xpce.html#idx:inpcethread1:1813">9.7</a> <a class="idx" href="mt-xpce.html#idx:inpcethread1:1814">9.7</a> <a class="idx" href="mt-xpce.html#idx:inpcethread1:1815">9.7</a></dd>
1306 <a class="idx" href="mt-xpce.html#idx:inpcethread1:1816">9.7</a> <a class="idx" href="mt-xpce.html#idx:inpcethread1:1817">9.7</a> <a class="idx" href="mt-xpce.html#idx:inpcethread1:1818">9.7</a></dd>
13001307 <dt><a class="idx" href="mt-xpce.html#in_pce_thread_sync/1">in_pce_thread_sync/1</a></dt>
13011308 <dd>
1302 <a class="idx" href="mt-xpce.html#idx:inpcethreadsync1:1816">9.7</a> <a class="idx" href="mt-xpce.html#idx:inpcethreadsync1:1818">9.7</a></dd>
1309 <a class="idx" href="mt-xpce.html#idx:inpcethreadsync1:1819">9.7</a> <a class="idx" href="mt-xpce.html#idx:inpcethreadsync1:1821">9.7</a></dd>
13031310 <dt><a class="idx" href="consulting.html#include/1">include/1</a></dt>
13041311 <dd>
1305 <a class="idx" href="consulting.html#idx:include1:331">4.3</a> <a class="idx" href="consulting.html#idx:include1:364">4.3</a> <a class="idx" href="consulting.html#idx:include1:407">4.3</a> <a class="idx" href="consulting.html#idx:include1:409">4.3</a> <a class="idx" href="consulting.html#idx:include1:411">4.3</a> <a class="idx" href="consulting.html#idx:include1:442">4.3</a> <a class="idx" href="consulting.html#idx:include1:443">4.3</a> <a class="idx" href="consulting.html#idx:include1:446">4.3</a> <a class="idx" href="examineprog.html#idx:include1:837">4.15</a></dd>
1312 <a class="idx" href="consulting.html#idx:include1:332">4.3</a> <a class="idx" href="consulting.html#idx:include1:365">4.3</a> <a class="idx" href="consulting.html#idx:include1:408">4.3</a> <a class="idx" href="consulting.html#idx:include1:410">4.3</a> <a class="idx" href="consulting.html#idx:include1:412">4.3</a> <a class="idx" href="consulting.html#idx:include1:443">4.3</a> <a class="idx" href="consulting.html#idx:include1:444">4.3</a> <a class="idx" href="consulting.html#idx:include1:447">4.3</a> <a class="idx" href="examineprog.html#idx:include1:838">4.15</a></dd>
13061313 <dt><a class="idx" href="apply.html#include/3">include/3</a></dt>
13071314 <dt>indexing</dt>
13081315 <dd>
1309 <a class="idx" href="glossary.html#idx:indexing:2103">D</a></dd>
1316 <a class="idx" href="glossary.html#idx:indexing:2107">D</a></dd>
13101317 <dt>indexing,term-hashes</dt>
13111318 <dd>
1312 <a class="idx" href="db.html#idx:indexingtermhashes:763">4.13.2</a></dd>
1319 <a class="idx" href="db.html#idx:indexingtermhashes:764">4.13.2</a></dd>
13131320 <dt><a class="idx" href="clpfd.html#indomain/1">indomain/1</a></dt>
13141321 <dt><a class="idx" href="clpqr.html#inf/2">inf/2</a></dt>
13151322 <dt>infinite trees</dt>
13171324 <a class="idx" href="cyclic.html#idx:infinitetrees:197">2.16</a></dd>
13181325 <dt><a class="idx" href="consulting.html#initialization/1">initialization/1</a></dt>
13191326 <dd>
1320 <a class="idx" href="consulting.html#idx:initialization1:346">4.3</a> <a class="idx" href="consulting.html#idx:initialization1:467">4.3</a> <a class="idx" href="consulting.html#idx:initialization1:468">4.3</a> <a class="idx" href="consulting.html#idx:initialization1:470">4.3</a> <a class="idx" href="consulting.html#idx:initialization1:473">4.3</a> <a class="idx" href="consulting.html#idx:initialization1:474">4.3</a> <a class="idx" href="consulting.html#idx:initialization1:526">4.3.2.2</a> <a class="idx" href="gvar.html#idx:initialization1:1656">7.3</a> <a class="idx" href="threadcreate.html#idx:initialization1:1720">9.1</a> <a class="idx" href="threadcreate.html#idx:initialization1:1721">9.1</a> <a class="idx" href="foreignlink.html#idx:initialization1:1824">10.2.2</a> <a class="idx" href="foreigninclude.html#idx:initialization1:1889">10.4.21</a> <a class="idx" href="qsavelimits.html#idx:initialization1:1920">11.1</a></dd>
1327 <a class="idx" href="consulting.html#idx:initialization1:347">4.3</a> <a class="idx" href="consulting.html#idx:initialization1:468">4.3</a> <a class="idx" href="consulting.html#idx:initialization1:469">4.3</a> <a class="idx" href="consulting.html#idx:initialization1:471">4.3</a> <a class="idx" href="consulting.html#idx:initialization1:474">4.3</a> <a class="idx" href="consulting.html#idx:initialization1:475">4.3</a> <a class="idx" href="consulting.html#idx:initialization1:527">4.3.2.2</a> <a class="idx" href="gvar.html#idx:initialization1:1659">7.3</a> <a class="idx" href="threadcreate.html#idx:initialization1:1723">9.1</a> <a class="idx" href="threadcreate.html#idx:initialization1:1724">9.1</a> <a class="idx" href="foreignlink.html#idx:initialization1:1827">10.2.2</a> <a class="idx" href="foreigninclude.html#idx:initialization1:1892">10.4.21</a> <a class="idx" href="qsavelimits.html#idx:initialization1:1923">11.1</a></dd>
13211328 <dt><a class="idx" href="consulting.html#initialization/2">initialization/2</a></dt>
13221329 <dt><a class="idx" href="clpfd.html#ins/2">ins/2</a></dt>
13231330 <dt><a class="idx" href="db.html#instance/2">instance/2</a></dt>
1331 <dt>instantiation</dt>
1332 <dd>
1333 <a class="idx" href="glossary.html#idx:instantiation:2111">D</a></dd>
13241334 <dt>instantiation_error/1</dt>
13251335 <dd>
1326 <a class="idx" href="foreigninclude.html#idx:instantiationerror1:1841">10.4.6</a></dd>
1336 <a class="idx" href="foreigninclude.html#idx:instantiationerror1:1844">10.4.6</a></dd>
13271337 <dt>integer</dt>
13281338 <dd>
1329 <a class="idx" href="glossary.html#idx:integer:2104">D</a></dd>
1339 <a class="idx" href="glossary.html#idx:integer:2108">D</a></dd>
13301340 <dt>integer,unbounded</dt>
13311341 <dd>
1332 <a class="idx" href="arith.html#idx:integerunbounded:1205">4.26.2.1</a></dd>
1342 <a class="idx" href="arith.html#idx:integerunbounded:1207">4.26.2.1</a></dd>
13331343 <dt>integer//1</dt>
13341344 <dd>
1335 <a class="idx" href="DCG.html#idx:integer1:706">4.12</a></dd>
1345 <a class="idx" href="DCG.html#idx:integer1:707">4.12</a></dd>
13361346 <dt><a class="idx" href="typetest.html#integer/1">integer/1</a></dt>
13371347 <dd>
1338 <a class="idx" href="typetest.html#idx:integer1:560">4.6</a></dd>
1348 <a class="idx" href="typetest.html#idx:integer1:561">4.6</a></dd>
13391349 <dt><a class="idx" href="thutil.html#interactor/0">interactor/0</a></dt>
13401350 <dd>
1341 <a class="idx" href="IO.html#idx:interactor0:909">4.16.2</a></dd>
1351 <a class="idx" href="IO.html#idx:interactor0:910">4.16.2</a></dd>
13421352 <dt>internationalization</dt>
13431353 <dd>
13441354 <a class="idx" href="widechars.html#idx:internationalization:231">2.18</a></dd>
13451355 <dt>interpreted</dt>
13461356 <dd>
1347 <a class="idx" href="glossary.html#idx:interpreted:2106">D</a></dd>
1357 <a class="idx" href="glossary.html#idx:interpreted:2110">D</a></dd>
13481358 <dt><a class="idx" href="lists.html#intersection/3">intersection/3</a></dt>
13491359 <dt><a class="idx" href="arith.html#is/2">is/2</a></dt>
13501360 <dd>
1351 <a class="idx" href="arith.html#idx:is2:1204">4.26.2</a> <a class="idx" href="arith.html#idx:is2:1209">4.26.2.1</a> <a class="idx" href="arith.html#idx:is2:1214">4.26.2.3</a> <a class="idx" href="sicstus-chr.html#idx:is2:1687">8.6.1</a></dd>
1361 <a class="idx" href="arith.html#idx:is2:1206">4.26.2</a> <a class="idx" href="arith.html#idx:is2:1211">4.26.2.1</a> <a class="idx" href="arith.html#idx:is2:1216">4.26.2.3</a> <a class="idx" href="sicstus-chr.html#idx:is2:1690">8.6.1</a></dd>
13521362 <dt><a class="idx" href="files.html#is_absolute_file_name/1">is_absolute_file_name/1</a></dt>
13531363 <dt><a class="idx" href="url.html#is_absolute_url/1">is_absolute_url/1</a></dt>
13541364 <dt><a class="idx" href="assoc.html#is_assoc/1">is_assoc/1</a></dt>
13561366 <dt><a class="idx" href="dicts.html#is_dict/2">is_dict/2</a></dt>
13571367 <dt><a class="idx" href="builtinlist.html#is_list/1">is_list/1</a></dt>
13581368 <dd>
1359 <a class="idx" href="builtinlist.html#idx:islist1:1220">4.28</a> <a class="idx" href="builtinlist.html#idx:islist1:1221">4.28</a> <a class="idx" href="builtinlist.html#idx:islist1:1222">4.28</a></dd>
1369 <a class="idx" href="builtinlist.html#idx:islist1:1222">4.28</a> <a class="idx" href="builtinlist.html#idx:islist1:1223">4.28</a> <a class="idx" href="builtinlist.html#idx:islist1:1224">4.28</a></dd>
13601370 <dt><a class="idx" href="ordsets.html#is_ordset/1">is_ordset/1</a></dt>
13611371 <dt><a class="idx" href="lists.html#is_set/1">is_set/1</a></dt>
13621372 <dt><a class="idx" href="IO.html#is_stream/1">is_stream/1</a></dt>
13651375 <a class="idx" href="jitindex.html#idx:jitindex:223">2.17</a></dd>
13661376 <dt><a class="idx" href="thutil.html#join_threads/0">join_threads/0</a></dt>
13671377 <dd>
1368 <a class="idx" href="thutil.html#idx:jointhreads0:1794">9.5</a></dd>
1378 <a class="idx" href="thutil.html#idx:jointhreads0:1797">9.5</a></dd>
13691379 <dt><a class="idx" href="builtinlist.html#keysort/2">keysort/2</a></dt>
13701380 <dd>
1371 <a class="idx" href="builtinlist.html#idx:keysort2:1230">4.28</a> <a class="idx" href="builtinlist.html#idx:keysort2:1234">4.28</a> <a class="idx" href="builtinlist.html#idx:keysort2:1238">4.28</a></dd>
1381 <a class="idx" href="builtinlist.html#idx:keysort2:1232">4.28</a> <a class="idx" href="builtinlist.html#idx:keysort2:1236">4.28</a> <a class="idx" href="builtinlist.html#idx:keysort2:1240">4.28</a></dd>
13721382 <dt><a class="idx" href="clpfd.html#label/1">label/1</a></dt>
13731383 <dt><a class="idx" href="clpb.html#labeling/1">labeling/1</a></dt>
13741384 <dt><a class="idx" href="clpfd.html#labeling/2">labeling/2</a></dt>
13771387 <dt><a class="idx" href="pio.html#lazy_list_location/3">lazy_list_location/3</a></dt>
13781388 <dt><a class="idx" href="debugger.html#leash/1">leash/1</a></dt>
13791389 <dd>
1380 <a class="idx" href="debugoverview.html#idx:leash1:44">2.9</a> <a class="idx" href="debugger.html#idx:leash1:1408">4.37</a> <a class="idx" href="debugging.html#idx:leash1:1684">8.4.3</a> <a class="idx" href="tracehook.html#idx:leash1:1992">B.3</a></dd>
1390 <a class="idx" href="debugoverview.html#idx:leash1:44">2.9</a> <a class="idx" href="debugger.html#idx:leash1:1410">4.37</a> <a class="idx" href="debugging.html#idx:leash1:1687">8.4.3</a> <a class="idx" href="tracehook.html#idx:leash1:1995">B.3</a></dd>
13811391 <dt><a class="idx" href="builtinlist.html#length/2">length/2</a></dt>
13821392 <dd>
1383 <a class="idx" href="dicts.html#idx:length2:1488">5.4.1.1</a></dd>
1393 <a class="idx" href="dicts.html#idx:length2:1490">5.4.1.1</a></dd>
13841394 <dt><a class="idx" href="clpfd.html#lex_chain/1">lex_chain/1</a></dt>
13851395 <dt><a class="idx" href="consulting.html#library_directory/1">library_directory/1</a></dt>
13861396 <dd>
13881398 <dt><a class="idx" href="softlicense.html#license/1">license/1</a></dt>
13891399 <dt><a class="idx" href="softlicense.html#license/2">license/2</a></dt>
13901400 <dd>
1391 <a class="idx" href="softlicense.html#idx:license2:2140">E.3</a></dd>
1401 <a class="idx" href="softlicense.html#idx:license2:2147">E.3</a></dd>
13921402 <dt><a class="idx" href="solutionsequences.html#limit/2">limit/2</a></dt>
13931403 <dt><a class="idx" href="streamstat.html#line_count/2">line_count/2</a></dt>
13941404 <dd>
1395 <a class="idx" href="IO.html#idx:linecount2:891">4.16.2</a> <a class="idx" href="IO.html#idx:linecount2:918">4.16.2</a> <a class="idx" href="tty.html#idx:linecount2:1289">4.32</a></dd>
1405 <a class="idx" href="IO.html#idx:linecount2:892">4.16.2</a> <a class="idx" href="IO.html#idx:linecount2:919">4.16.2</a> <a class="idx" href="tty.html#idx:linecount2:1291">4.32</a></dd>
13961406 <dt><a class="idx" href="streamstat.html#line_position/2">line_position/2</a></dt>
13971407 <dd>
1398 <a class="idx" href="IO.html#idx:lineposition2:892">4.16.2</a> <a class="idx" href="IO.html#idx:lineposition2:912">4.16.2</a> <a class="idx" href="IO.html#idx:lineposition2:919">4.16.2</a> <a class="idx" href="tty.html#idx:lineposition2:1290">4.32</a></dd>
1408 <a class="idx" href="IO.html#idx:lineposition2:893">4.16.2</a> <a class="idx" href="IO.html#idx:lineposition2:913">4.16.2</a> <a class="idx" href="IO.html#idx:lineposition2:920">4.16.2</a> <a class="idx" href="tty.html#idx:lineposition2:1292">4.32</a></dd>
13991409 <dt><a class="idx" href="check.html#list_autoload/0">list_autoload/0</a></dt>
14001410 <dt><a class="idx" href="debug.html#list_debug_topics/0">list_debug_topics/0</a></dt>
14011411 <dt><a class="idx" href="check.html#list_redefined/0">list_redefined/0</a></dt>
14021412 <dt><a class="idx" href="strings.html#list_strings/0">list_strings/0</a></dt>
14031413 <dd>
1404 <a class="idx" href="extensions.html#idx:liststrings0:1441">5</a> <a class="idx" href="strings.html#idx:liststrings0:1469">5.2.3</a> <a class="idx" href="strings.html#idx:liststrings0:1470">5.2.3</a> <a class="idx" href="strings.html#idx:liststrings0:1471">5.2.3</a> <a class="idx" href="strings.html#idx:liststrings0:1472">5.2.3</a> <a class="idx" href="strings.html#idx:liststrings0:1477">5.2.4</a></dd>
1414 <a class="idx" href="extensions.html#idx:liststrings0:1443">5</a> <a class="idx" href="strings.html#idx:liststrings0:1471">5.2.3</a> <a class="idx" href="strings.html#idx:liststrings0:1472">5.2.3</a> <a class="idx" href="strings.html#idx:liststrings0:1473">5.2.3</a> <a class="idx" href="strings.html#idx:liststrings0:1474">5.2.3</a> <a class="idx" href="strings.html#idx:liststrings0:1479">5.2.4</a></dd>
14051415 <dt><a class="idx" href="check.html#list_strings/1">list_strings/1</a></dt>
14061416 <dt><a class="idx" href="assoc.html#list_to_assoc/2">list_to_assoc/2</a></dt>
14071417 <dd>
1408 <a class="idx" href="dicts.html#idx:listtoassoc2:1508">5.4.3</a></dd>
1418 <a class="idx" href="dicts.html#idx:listtoassoc2:1510">5.4.3</a></dd>
14091419 <dt><a class="idx" href="ordsets.html#list_to_ord_set/2">list_to_ord_set/2</a></dt>
14101420 <dt><a class="idx" href="lists.html#list_to_set/2">list_to_set/2</a></dt>
14111421 <dt><a class="idx" href="check.html#list_trivial_fails/0">list_trivial_fails/0</a></dt>
14121422 <dt><a class="idx" href="check.html#list_trivial_fails/1">list_trivial_fails/1</a></dt>
14131423 <dt><a class="idx" href="check.html#list_undefined/0">list_undefined/0</a></dt>
14141424 <dd>
1415 <a class="idx" href="flags.html#idx:listundefined0:77">2.11</a> <a class="idx" href="consulting.html#idx:listundefined0:427">4.3</a></dd>
1425 <a class="idx" href="flags.html#idx:listundefined0:77">2.11</a> <a class="idx" href="consulting.html#idx:listundefined0:428">4.3</a></dd>
14161426 <dt><a class="idx" href="check.html#list_undefined/1">list_undefined/1</a></dt>
14171427 <dt><a class="idx" href="check.html#list_void_declarations/0">list_void_declarations/0</a></dt>
14181428 <dt><a class="idx" href="broadcast.html#listen/2">listen/2</a></dt>
14191429 <dd>
1420 <a class="idx" href="broadcast.html#idx:listen2:1946">A.4</a></dd>
1430 <a class="idx" href="broadcast.html#idx:listen2:1949">A.4</a></dd>
14211431 <dt><a class="idx" href="broadcast.html#listen/3">listen/3</a></dt>
14221432 <dd>
1423 <a class="idx" href="broadcast.html#idx:listen3:1948">A.4</a> <a class="idx" href="broadcast.html#idx:listen3:1949">A.4</a> <a class="idx" href="broadcast.html#idx:listen3:1950">A.4</a></dd>
1433 <a class="idx" href="broadcast.html#idx:listen3:1951">A.4</a> <a class="idx" href="broadcast.html#idx:listen3:1952">A.4</a> <a class="idx" href="broadcast.html#idx:listen3:1953">A.4</a></dd>
14241434 <dt><a class="idx" href="broadcast.html#listening/3">listening/3</a></dt>
14251435 <dt><a class="idx" href="listing.html#listing/0">listing/0</a></dt>
14261436 <dt><a class="idx" href="listing.html#listing/1">listing/1</a></dt>
14271437 <dd>
1428 <a class="idx" href="debugoverview.html#idx:listing1:49">2.9</a> <a class="idx" href="listing.html#idx:listing1:552">4.5</a></dd>
1438 <a class="idx" href="debugoverview.html#idx:listing1:49">2.9</a> <a class="idx" href="listing.html#idx:listing1:553">4.5</a></dd>
14291439 <dt>load_file/2</dt>
14301440 <dd>
1431 <a class="idx" href="consulting.html#idx:loadfile2:382">4.3</a></dd>
1441 <a class="idx" href="consulting.html#idx:loadfile2:383">4.3</a></dd>
14321442 <dt><a class="idx" href="consulting.html#load_files/1">load_files/1</a></dt>
14331443 <dt><a class="idx" href="consulting.html#load_files/2">load_files/2</a></dt>
14341444 <dd>
1435 <a class="idx" href="flags.html#idx:loadfiles2:107">2.11</a> <a class="idx" href="flags.html#idx:loadfiles2:109">2.11</a> <a class="idx" href="flags.html#idx:loadfiles2:128">2.11</a> <a class="idx" href="hooks.html#idx:loadfiles2:144">2.12</a> <a class="idx" href="hooks.html#idx:loadfiles2:146">2.12</a> <a class="idx" href="hooks.html#idx:loadfiles2:147">2.12</a> <a class="idx" href="widechars.html#idx:loadfiles2:234">2.18.1</a> <a class="idx" href="consulting.html#idx:loadfiles2:348">4.3</a> <a class="idx" href="consulting.html#idx:loadfiles2:354">4.3</a> <a class="idx" href="consulting.html#idx:loadfiles2:362">4.3</a> <a class="idx" href="consulting.html#idx:loadfiles2:363">4.3</a> <a class="idx" href="consulting.html#idx:loadfiles2:365">4.3</a> <a class="idx" href="consulting.html#idx:loadfiles2:393">4.3</a> <a class="idx" href="consulting.html#idx:loadfiles2:395">4.3</a> <a class="idx" href="consulting.html#idx:loadfiles2:398">4.3</a> <a class="idx" href="consulting.html#idx:loadfiles2:444">4.3</a> <a class="idx" href="consulting.html#idx:loadfiles2:445">4.3</a> <a class="idx" href="consulting.html#idx:loadfiles2:447">4.3</a> <a class="idx" href="consulting.html#idx:loadfiles2:448">4.3</a> <a class="idx" href="consulting.html#idx:loadfiles2:450">4.3</a> <a class="idx" href="consulting.html#idx:loadfiles2:519">4.3.2.1</a> <a class="idx" href="consulting.html#idx:loadfiles2:522">4.3.2.1</a> <a class="idx" href="consulting.html#idx:loadfiles2:525">4.3.2.2</a> <a class="idx" href="consulting.html#idx:loadfiles2:527">4.3.2.2</a> <a class="idx" href="consulting.html#idx:loadfiles2:537">4.3.3</a> <a class="idx" href="debugger.html#idx:loadfiles2:1410">4.37</a> <a class="idx" href="import.html#idx:loadfiles2:1533">6.3</a> <a class="idx" href="prolog_xref.html#idx:loadfiles2:1959">A.25</a> <a class="idx" href="loadfilehook.html#idx:loadfiles2:2039">B.8</a> <a class="idx" href="loadfilehook.html#idx:loadfiles2:2041">B.8</a> <a class="idx" href="dialect.html#idx:loadfiles2:2059">C</a> <a class="idx" href="predsummary.html#idx:loadfiles2:2163">F.1</a></dd>
1445 <a class="idx" href="flags.html#idx:loadfiles2:107">2.11</a> <a class="idx" href="flags.html#idx:loadfiles2:109">2.11</a> <a class="idx" href="flags.html#idx:loadfiles2:128">2.11</a> <a class="idx" href="hooks.html#idx:loadfiles2:144">2.12</a> <a class="idx" href="hooks.html#idx:loadfiles2:146">2.12</a> <a class="idx" href="hooks.html#idx:loadfiles2:147">2.12</a> <a class="idx" href="widechars.html#idx:loadfiles2:234">2.18.1</a> <a class="idx" href="consulting.html#idx:loadfiles2:349">4.3</a> <a class="idx" href="consulting.html#idx:loadfiles2:355">4.3</a> <a class="idx" href="consulting.html#idx:loadfiles2:363">4.3</a> <a class="idx" href="consulting.html#idx:loadfiles2:364">4.3</a> <a class="idx" href="consulting.html#idx:loadfiles2:366">4.3</a> <a class="idx" href="consulting.html#idx:loadfiles2:394">4.3</a> <a class="idx" href="consulting.html#idx:loadfiles2:396">4.3</a> <a class="idx" href="consulting.html#idx:loadfiles2:399">4.3</a> <a class="idx" href="consulting.html#idx:loadfiles2:445">4.3</a> <a class="idx" href="consulting.html#idx:loadfiles2:446">4.3</a> <a class="idx" href="consulting.html#idx:loadfiles2:448">4.3</a> <a class="idx" href="consulting.html#idx:loadfiles2:449">4.3</a> <a class="idx" href="consulting.html#idx:loadfiles2:451">4.3</a> <a class="idx" href="consulting.html#idx:loadfiles2:520">4.3.2.1</a> <a class="idx" href="consulting.html#idx:loadfiles2:523">4.3.2.1</a> <a class="idx" href="consulting.html#idx:loadfiles2:526">4.3.2.2</a> <a class="idx" href="consulting.html#idx:loadfiles2:528">4.3.2.2</a> <a class="idx" href="consulting.html#idx:loadfiles2:538">4.3.3</a> <a class="idx" href="debugger.html#idx:loadfiles2:1412">4.37</a> <a class="idx" href="import.html#idx:loadfiles2:1535">6.3</a> <a class="idx" href="prolog_xref.html#idx:loadfiles2:1962">A.25</a> <a class="idx" href="loadfilehook.html#idx:loadfiles2:2042">B.8</a> <a class="idx" href="loadfilehook.html#idx:loadfiles2:2044">B.8</a> <a class="idx" href="dialect.html#idx:loadfiles2:2062">C</a> <a class="idx" href="predsummary.html#idx:loadfiles2:2170">F.1</a></dd>
14361446 <dt><a class="idx" href="foreignlink.html#load_foreign_library/1">load_foreign_library/1</a></dt>
14371447 <dd>
1438 <a class="idx" href="consulting.html#idx:loadforeignlibrary1:471">4.3</a> <a class="idx" href="foreignlink.html#idx:loadforeignlibrary1:1826">10.2.4</a> <a class="idx" href="plld.html#idx:loadforeignlibrary1:1896">10.5</a> <a class="idx" href="qsaveforeign.html#idx:loadforeignlibrary1:1923">11.2</a></dd>
1448 <a class="idx" href="consulting.html#idx:loadforeignlibrary1:472">4.3</a> <a class="idx" href="foreignlink.html#idx:loadforeignlibrary1:1829">10.2.4</a> <a class="idx" href="plld.html#idx:loadforeignlibrary1:1899">10.5</a> <a class="idx" href="qsaveforeign.html#idx:loadforeignlibrary1:1926">11.2</a></dd>
14391449 <dt><a class="idx" href="foreignlink.html#load_foreign_library/2">load_foreign_library/2</a></dt>
14401450 <dt>load_hotfixes/1</dt>
14411451 <dd>
1442 <a class="idx" href="consulting.html#idx:loadhotfixes1:388">4.3</a></dd>
1452 <a class="idx" href="consulting.html#idx:loadhotfixes1:389">4.3</a></dd>
14431453 <dt>locale</dt>
14441454 <dd>
1445 <a class="idx" href="chartype.html#idx:locale:1186">4.23.3</a></dd>
1455 <a class="idx" href="chartype.html#idx:locale:1187">4.23.3</a></dd>
14461456 <dt><a class="idx" href="locale.html#locale_create/3">locale_create/3</a></dt>
14471457 <dd>
1448 <a class="idx" href="locale.html#idx:localecreate3:1169">4.22</a></dd>
1458 <a class="idx" href="locale.html#idx:localecreate3:1170">4.22</a></dd>
14491459 <dt><a class="idx" href="locale.html#locale_destroy/1">locale_destroy/1</a></dt>
14501460 <dd>
1451 <a class="idx" href="locale.html#idx:localedestroy1:1168">4.22</a></dd>
1461 <a class="idx" href="locale.html#idx:localedestroy1:1169">4.22</a></dd>
14521462 <dt><a class="idx" href="locale.html#locale_property/2">locale_property/2</a></dt>
14531463 <dt><a class="idx" href="chartype.html#locale_sort/2">locale_sort/2</a></dt>
14541464 <dd>
1455 <a class="idx" href="locale.html#idx:localesort2:1163">4.22</a> <a class="idx" href="chartype.html#idx:localesort2:1190">4.23.3</a> <a class="idx" href="chartype.html#idx:localesort2:1191">4.23.3</a> <a class="idx" href="system.html#idx:localesort2:1311">4.33</a></dd>
1465 <a class="idx" href="locale.html#idx:localesort2:1164">4.22</a> <a class="idx" href="chartype.html#idx:localesort2:1191">4.23.3</a> <a class="idx" href="chartype.html#idx:localesort2:1192">4.23.3</a> <a class="idx" href="system.html#idx:localesort2:1313">4.33</a></dd>
14561466 <dt>logical,update view</dt>
14571467 <dd>
1458 <a class="idx" href="db.html#idx:logicalupdateview:758">4.13.1</a></dd>
1468 <a class="idx" href="db.html#idx:logicalupdateview:759">4.13.1</a></dd>
14591469 <dt><a class="idx" href="dicts.html#m-get-1">m-get-1</a></dt>
14601470 <dt><a class="idx" href="dicts.html#m-put-1">m-put-1</a></dt>
14611471 <dt><a class="idx" href="dicts.html#m-put-2">m-put-2</a></dt>
14621472 <dt><a class="idx" href="consulting.html#make/0">make/0</a></dt>
14631473 <dd>
1464 <a class="idx" href="swiorother.html#idx:make0:1">1.3</a> <a class="idx" href="flags.html#idx:make0:76">2.11</a> <a class="idx" href="autoload.html#idx:make0:165">2.13</a> <a class="idx" href="autoload.html#idx:make0:175">2.13</a> <a class="idx" href="editreload.html#idx:make0:276">3.3.2</a> <a class="idx" href="editreload.html#idx:make0:277">3.3.2</a> <a class="idx" href="pceemacs.html#idx:make0:281">3.4.3.1</a> <a class="idx" href="idesummary.html#idx:make0:299">3.9</a> <a class="idx" href="consulting.html#idx:make0:369">4.3</a> <a class="idx" href="consulting.html#idx:make0:387">4.3</a> <a class="idx" href="consulting.html#idx:make0:403">4.3</a> <a class="idx" href="consulting.html#idx:make0:406">4.3</a> <a class="idx" href="consulting.html#idx:make0:423">4.3</a> <a class="idx" href="consulting.html#idx:make0:425">4.3</a> <a class="idx" href="consulting.html#idx:make0:426">4.3</a> <a class="idx" href="consulting.html#idx:make0:449">4.3</a> <a class="idx" href="consulting.html#idx:make0:514">4.3.2</a></dd>
1474 <a class="idx" href="swiorother.html#idx:make0:1">1.3</a> <a class="idx" href="flags.html#idx:make0:76">2.11</a> <a class="idx" href="autoload.html#idx:make0:165">2.13</a> <a class="idx" href="autoload.html#idx:make0:175">2.13</a> <a class="idx" href="editreload.html#idx:make0:276">3.3.2</a> <a class="idx" href="editreload.html#idx:make0:277">3.3.2</a> <a class="idx" href="pceemacs.html#idx:make0:281">3.4.3.1</a> <a class="idx" href="idesummary.html#idx:make0:299">3.9</a> <a class="idx" href="consulting.html#idx:make0:370">4.3</a> <a class="idx" href="consulting.html#idx:make0:388">4.3</a> <a class="idx" href="consulting.html#idx:make0:404">4.3</a> <a class="idx" href="consulting.html#idx:make0:407">4.3</a> <a class="idx" href="consulting.html#idx:make0:424">4.3</a> <a class="idx" href="consulting.html#idx:make0:426">4.3</a> <a class="idx" href="consulting.html#idx:make0:427">4.3</a> <a class="idx" href="consulting.html#idx:make0:450">4.3</a> <a class="idx" href="consulting.html#idx:make0:515">4.3.2</a></dd>
14651475 <dt><a class="idx" href="files.html#make_directory/1">make_directory/1</a></dt>
14661476 <dd>
1467 <a class="idx" href="system.html#idx:makedirectory1:1297">4.33</a></dd>
1477 <a class="idx" href="system.html#idx:makedirectory1:1299">4.33</a></dd>
14681478 <dt><a class="idx" href="autoload.html#make_library_index/1">make_library_index/1</a></dt>
14691479 <dd>
14701480 <a class="idx" href="autoload.html#idx:makelibraryindex1:169">2.13</a></dd>
14821492 <dt><a class="idx" href="pairs.html#map_list_to_pairs/3">map_list_to_pairs/3</a></dt>
14831493 <dt><a class="idx" href="apply.html#maplist/2">maplist/2</a></dt>
14841494 <dd>
1485 <a class="idx" href="forall2.html#idx:maplist2:1258">4.30</a> <a class="idx" href="ext-issues.html#idx:maplist2:1514">5.6</a></dd>
1495 <a class="idx" href="forall2.html#idx:maplist2:1260">4.30</a> <a class="idx" href="ext-issues.html#idx:maplist2:1516">5.6</a></dd>
14861496 <dt><a class="idx" href="apply.html#maplist/3">maplist/3</a></dt>
14871497 <dd>
1488 <a class="idx" href="dicts.html#idx:maplist3:1507">5.4.3</a> <a class="idx" href="metapred.html#idx:maplist3:1544">6.4</a> <a class="idx" href="metapred.html#idx:maplist3:1546">6.4</a> <a class="idx" href="ctxmodule.html#idx:maplist3:1593">6.13</a> <a class="idx" href="ctxmodule.html#idx:maplist3:1594">6.13</a></dd>
1498 <a class="idx" href="dicts.html#idx:maplist3:1509">5.4.3</a> <a class="idx" href="metapred.html#idx:maplist3:1546">6.4</a> <a class="idx" href="metapred.html#idx:maplist3:1548">6.4</a> <a class="idx" href="ctxmodule.html#idx:maplist3:1595">6.13</a> <a class="idx" href="ctxmodule.html#idx:maplist3:1596">6.13</a></dd>
14891499 <dt><a class="idx" href="apply.html#maplist/4">maplist/4</a></dt>
14901500 <dt><a class="idx" href="apply.html#maplist/5">maplist/5</a></dt>
14911501 <dt>maplist_/3</dt>
14921502 <dd>
1493 <a class="idx" href="metapred.html#idx:maplist3:1545">6.4</a> <a class="idx" href="ctxmodule.html#idx:maplist3:1595">6.13</a></dd>
1503 <a class="idx" href="metapred.html#idx:maplist3:1547">6.4</a> <a class="idx" href="ctxmodule.html#idx:maplist3:1597">6.13</a></dd>
14941504 <dt><a class="idx" href="assoc.html#max_assoc/3">max_assoc/3</a></dt>
14951505 <dt><a class="idx" href="lists.html#max_list/2">max_list/2</a></dt>
14961506 <dt><a class="idx" href="lists.html#max_member/2">max_member/2</a></dt>
14981508 <dt><a class="idx" href="clpqr.html#maximize/1">maximize/1</a></dt>
14991509 <dt><a class="idx" href="simplex.html#maximize/3">maximize/3</a></dt>
15001510 <dd>
1501 <a class="idx" href="simplex.html#idx:maximize3:1979">A.31</a></dd>
1511 <a class="idx" href="simplex.html#idx:maximize3:1982">A.31</a></dd>
15021512 <dt><a class="idx" href="random.html#maybe/0">maybe/0</a></dt>
15031513 <dt><a class="idx" href="random.html#maybe/1">maybe/1</a></dt>
15041514 <dt><a class="idx" href="random.html#maybe/2">maybe/2</a></dt>
15051515 <dt><a class="idx" href="lists.html#member/2">member/2</a></dt>
15061516 <dd>
1507 <a class="idx" href="debugoverview.html#idx:member2:47">2.9</a> <a class="idx" href="debugoverview.html#idx:member2:48">2.9</a> <a class="idx" href="metacall.html#idx:member2:618">4.9</a> <a class="idx" href="builtinlist.html#idx:member2:1223">4.28</a> <a class="idx" href="files.html#idx:member2:1364">4.34</a> <a class="idx" href="import.html#idx:member2:1534">6.3</a> <a class="idx" href="predsummary.html#idx:member2:2155">F.1</a></dd>
1517 <a class="idx" href="debugoverview.html#idx:member2:47">2.9</a> <a class="idx" href="debugoverview.html#idx:member2:48">2.9</a> <a class="idx" href="metacall.html#idx:member2:619">4.9</a> <a class="idx" href="builtinlist.html#idx:member2:1225">4.28</a> <a class="idx" href="files.html#idx:member2:1366">4.34</a> <a class="idx" href="import.html#idx:member2:1536">6.3</a> <a class="idx" href="predsummary.html#idx:member2:2162">F.1</a></dd>
15081518 <dt><a class="idx" href="builtinlist.html#memberchk/2">memberchk/2</a></dt>
15091519 <dd>
1510 <a class="idx" href="compare.html#idx:memberchk2:590">4.7.2</a> <a class="idx" href="builtinlist.html#idx:memberchk2:1224">4.28</a> <a class="idx" href="builtinlist.html#idx:memberchk2:1225">4.28</a> <a class="idx" href="strings.html#idx:memberchk2:1476">5.2.4</a></dd>
1520 <a class="idx" href="compare.html#idx:memberchk2:591">4.7.2</a> <a class="idx" href="builtinlist.html#idx:memberchk2:1226">4.28</a> <a class="idx" href="builtinlist.html#idx:memberchk2:1227">4.28</a> <a class="idx" href="strings.html#idx:memberchk2:1478">5.2.4</a></dd>
15111521 <dt>memory,layout</dt>
15121522 <dd>
15131523 <a class="idx" href="limits.html#idx:memorylayout:249">2.19.1.1</a></dd>
15141524 <dt><a class="idx" href="option.html#merge_options/3">merge_options/3</a></dt>
15151525 <dt>message,service</dt>
15161526 <dd>
1517 <a class="idx" href="broadcast.html#idx:messageservice:1940">A.4</a></dd>
1527 <a class="idx" href="broadcast.html#idx:messageservice:1943">A.4</a></dd>
15181528 <dt><a class="idx" href="exception.html#message_hook/3">message_hook/3</a></dt>
15191529 <dd>
1520 <a class="idx" href="exception.html#idx:messagehook3:655">4.10.3</a> <a class="idx" href="exception.html#idx:messagehook3:658">4.10.3</a> <a class="idx" href="exception.html#idx:messagehook3:661">4.10.3</a> <a class="idx" href="exception.html#idx:messagehook3:665">4.10.3</a> <a class="idx" href="exception.html#idx:messagehook3:666">4.10.3</a> <a class="idx" href="exception.html#idx:messagehook3:675">4.10.3</a> <a class="idx" href="exception.html#idx:messagehook3:680">4.10.3</a> <a class="idx" href="exception.html#idx:messagehook3:682">4.10.3</a> <a class="idx" href="exception.html#idx:messagehook3:695">4.10.3.1</a> <a class="idx" href="memory.html#idx:messagehook3:1434">4.40</a> <a class="idx" href="predsummary.html#idx:messagehook3:2165">F.1</a></dd>
1530 <a class="idx" href="exception.html#idx:messagehook3:656">4.10.3</a> <a class="idx" href="exception.html#idx:messagehook3:659">4.10.3</a> <a class="idx" href="exception.html#idx:messagehook3:662">4.10.3</a> <a class="idx" href="exception.html#idx:messagehook3:666">4.10.3</a> <a class="idx" href="exception.html#idx:messagehook3:667">4.10.3</a> <a class="idx" href="exception.html#idx:messagehook3:676">4.10.3</a> <a class="idx" href="exception.html#idx:messagehook3:681">4.10.3</a> <a class="idx" href="exception.html#idx:messagehook3:683">4.10.3</a> <a class="idx" href="exception.html#idx:messagehook3:696">4.10.3.1</a> <a class="idx" href="memory.html#idx:messagehook3:1436">4.40</a> <a class="idx" href="predsummary.html#idx:messagehook3:2172">F.1</a></dd>
15211531 <dt><a class="idx" href="exception.html#message_property/2">message_property/2</a></dt>
15221532 <dd>
15231533 <a class="idx" href="flags.html#idx:messageproperty2:73">2.11</a></dd>
15241534 <dt><a class="idx" href="threadcom.html#message_queue_create/1">message_queue_create/1</a></dt>
15251535 <dd>
1526 <a class="idx" href="threadcom.html#idx:messagequeuecreate1:1739">9.3.1</a> <a class="idx" href="threadcom.html#idx:messagequeuecreate1:1754">9.3.1</a></dd>
1536 <a class="idx" href="threadcom.html#idx:messagequeuecreate1:1742">9.3.1</a> <a class="idx" href="threadcom.html#idx:messagequeuecreate1:1757">9.3.1</a></dd>
15271537 <dt><a class="idx" href="threadcom.html#message_queue_create/2">message_queue_create/2</a></dt>
15281538 <dd>
1529 <a class="idx" href="threadcom.html#idx:messagequeuecreate2:1752">9.3.1</a> <a class="idx" href="threadcom.html#idx:messagequeuecreate2:1765">9.3.1</a></dd>
1539 <a class="idx" href="threadcom.html#idx:messagequeuecreate2:1755">9.3.1</a> <a class="idx" href="threadcom.html#idx:messagequeuecreate2:1768">9.3.1</a></dd>
15301540 <dt>message_queue_create/3</dt>
15311541 <dd>
1532 <a class="idx" href="threadsync.html#idx:messagequeuecreate3:1781">9.4</a></dd>
1542 <a class="idx" href="threadsync.html#idx:messagequeuecreate3:1784">9.4</a></dd>
15331543 <dt><a class="idx" href="threadcom.html#message_queue_destroy/1">message_queue_destroy/1</a></dt>
15341544 <dd>
1535 <a class="idx" href="threadcom.html#idx:messagequeuedestroy1:1757">9.3.1</a></dd>
1545 <a class="idx" href="threadcom.html#idx:messagequeuedestroy1:1760">9.3.1</a></dd>
15361546 <dt><a class="idx" href="threadcom.html#message_queue_property/2">message_queue_property/2</a></dt>
15371547 <dd>
1538 <a class="idx" href="thmonitor.html#idx:messagequeueproperty2:1736">9.2</a></dd>
1548 <a class="idx" href="thmonitor.html#idx:messagequeueproperty2:1739">9.2</a></dd>
15391549 <dt><a class="idx" href="exception.html#message_to_string/2">message_to_string/2</a></dt>
15401550 <dd>
1541 <a class="idx" href="exception.html#idx:messagetostring2:668">4.10.3</a> <a class="idx" href="exception.html#idx:messagetostring2:679">4.10.3</a></dd>
1551 <a class="idx" href="exception.html#idx:messagetostring2:669">4.10.3</a> <a class="idx" href="exception.html#idx:messagetostring2:680">4.10.3</a></dd>
15421552 <dt>meta-predicate</dt>
15431553 <dd>
1544 <a class="idx" href="glossary.html#idx:metapredicate:2107">D</a></dd>
1554 <a class="idx" href="glossary.html#idx:metapredicate:2112">D</a></dd>
15451555 <dt><a class="idx" href="option.html#meta_options/3">meta_options/3</a></dt>
15461556 <dd>
1547 <a class="idx" href="import.html#idx:metaoptions3:1536">6.3</a></dd>
1557 <a class="idx" href="import.html#idx:metaoptions3:1538">6.3</a></dd>
15481558 <dt><a class="idx" href="metapred.html#meta_predicate/1">meta_predicate/1</a></dt>
15491559 <dd>
1550 <a class="idx" href="flags.html#idx:metapredicate1:75">2.11</a> <a class="idx" href="consulting.html#idx:metapredicate1:501">4.3.1</a> <a class="idx" href="typetest.html#idx:metapredicate1:569">4.6</a> <a class="idx" href="examineprog.html#idx:metapredicate1:816">4.15</a> <a class="idx" href="examineprog.html#idx:metapredicate1:817">4.15</a> <a class="idx" href="examineprog.html#idx:metapredicate1:823">4.15</a> <a class="idx" href="metapred.html#idx:metapredicate1:1543">6.4</a> <a class="idx" href="metapred.html#idx:metapredicate1:1547">6.4</a> <a class="idx" href="metapred.html#idx:metapredicate1:1554">6.4</a> <a class="idx" href="ctxmodule.html#idx:metapredicate1:1592">6.13</a> <a class="idx" href="modulecompat.html#idx:metapredicate1:1609">6.15</a> <a class="idx" href="modulecompat.html#idx:metapredicate1:1610">6.15</a> <a class="idx" href="foreigninclude.html#idx:metapredicate1:1854">10.4.9.2</a> <a class="idx" href="foreigninclude.html#idx:metapredicate1:1881">10.4.18</a> <a class="idx" href="runtime.html#idx:metapredicate1:1913">11</a> <a class="idx" href="runtime.html#idx:metapredicate1:1916">11</a></dd>
1560 <a class="idx" href="flags.html#idx:metapredicate1:75">2.11</a> <a class="idx" href="consulting.html#idx:metapredicate1:502">4.3.1</a> <a class="idx" href="typetest.html#idx:metapredicate1:570">4.6</a> <a class="idx" href="examineprog.html#idx:metapredicate1:817">4.15</a> <a class="idx" href="examineprog.html#idx:metapredicate1:818">4.15</a> <a class="idx" href="examineprog.html#idx:metapredicate1:824">4.15</a> <a class="idx" href="metapred.html#idx:metapredicate1:1545">6.4</a> <a class="idx" href="metapred.html#idx:metapredicate1:1549">6.4</a> <a class="idx" href="metapred.html#idx:metapredicate1:1556">6.4</a> <a class="idx" href="ctxmodule.html#idx:metapredicate1:1594">6.13</a> <a class="idx" href="modulecompat.html#idx:metapredicate1:1611">6.15</a> <a class="idx" href="modulecompat.html#idx:metapredicate1:1612">6.15</a> <a class="idx" href="foreigninclude.html#idx:metapredicate1:1857">10.4.9.2</a> <a class="idx" href="foreigninclude.html#idx:metapredicate1:1884">10.4.18</a> <a class="idx" href="runtime.html#idx:metapredicate1:1916">11</a> <a class="idx" href="runtime.html#idx:metapredicate1:1919">11</a></dd>
15511561 <dt><a class="idx" href="assoc.html#min_assoc/3">min_assoc/3</a></dt>
15521562 <dt><a class="idx" href="lists.html#min_list/2">min_list/2</a></dt>
15531563 <dt><a class="idx" href="lists.html#min_member/2">min_member/2</a></dt>
15541564 <dt><a class="idx" href="clpqr.html#minimize/1">minimize/1</a></dt>
15551565 <dt><a class="idx" href="simplex.html#minimize/3">minimize/3</a></dt>
1566 <dt>mode</dt>
1567 <dd>
1568 <a class="idx" href="glossary.html#idx:mode:2113">D</a></dd>
15561569 <dt>module</dt>
15571570 <dd>
1558 <a class="idx" href="glossary.html#idx:module:2108">D</a></dd>
1571 <a class="idx" href="glossary.html#idx:module:2114">D</a></dd>
15591572 <dt>module transparent</dt>
15601573 <dd>
1561 <a class="idx" href="glossary.html#idx:moduletransparent:2109">D</a></dd>
1574 <a class="idx" href="glossary.html#idx:moduletransparent:2115">D</a></dd>
15621575 <dt>module,contex</dt>
15631576 <dd>
1564 <a class="idx" href="glossary.html#idx:modulecontex:2086">D</a></dd>
1577 <a class="idx" href="glossary.html#idx:modulecontex:2089">D</a></dd>
15651578 <dt><a class="idx" href="mtoplevel.html#module/1">module/1</a></dt>
15661579 <dd>
1567 <a class="idx" href="flags.html#idx:module1:116">2.11</a> <a class="idx" href="consulting.html#idx:module1:327">4.3</a> <a class="idx" href="dynamic.html#idx:module1:789">4.14</a> <a class="idx" href="mtoplevel.html#idx:module1:1563">6.6</a> <a class="idx" href="threadcreate.html#idx:module1:1705">9.1</a></dd>
1580 <a class="idx" href="flags.html#idx:module1:116">2.11</a> <a class="idx" href="consulting.html#idx:module1:328">4.3</a> <a class="idx" href="dynamic.html#idx:module1:790">4.14</a> <a class="idx" href="mtoplevel.html#idx:module1:1565">6.6</a> <a class="idx" href="threadcreate.html#idx:module1:1708">9.1</a></dd>
15681581 <dt><a class="idx" href="defmodule.html#module/2">module/2</a></dt>
15691582 <dd>
1570 <a class="idx" href="consulting.html#idx:module2:483">4.3.1</a> <a class="idx" href="operators.html#idx:module2:1195">4.24</a> <a class="idx" href="operators.html#idx:module2:1196">4.24</a> <a class="idx" href="defmodule.html#idx:module2:1517">6.2</a> <a class="idx" href="defmodule.html#idx:module2:1518">6.2</a> <a class="idx" href="defmodule.html#idx:module2:1521">6.2</a> <a class="idx" href="import.html#idx:module2:1537">6.3</a> <a class="idx" href="moduleop.html#idx:module2:1573">6.8</a> <a class="idx" href="altmoduleapi.html#idx:module2:1584">6.11</a> <a class="idx" href="modulecompat.html#idx:module2:1611">6.15</a></dd>
1583 <a class="idx" href="consulting.html#idx:module2:484">4.3.1</a> <a class="idx" href="operators.html#idx:module2:1196">4.24</a> <a class="idx" href="operators.html#idx:module2:1197">4.24</a> <a class="idx" href="defmodule.html#idx:module2:1519">6.2</a> <a class="idx" href="defmodule.html#idx:module2:1520">6.2</a> <a class="idx" href="defmodule.html#idx:module2:1523">6.2</a> <a class="idx" href="import.html#idx:module2:1539">6.3</a> <a class="idx" href="moduleop.html#idx:module2:1575">6.8</a> <a class="idx" href="altmoduleapi.html#idx:module2:1586">6.11</a> <a class="idx" href="modulecompat.html#idx:module2:1613">6.15</a></dd>
15711584 <dt><a class="idx" href="defmodule.html#module/3">module/3</a></dt>
15721585 <dt><a class="idx" href="manipmodule.html#module_property/2">module_property/2</a></dt>
15731586 <dd>
1574 <a class="idx" href="manipmodule.html#idx:moduleproperty2:1604">6.14</a> <a class="idx" href="manipmodule.html#idx:moduleproperty2:1606">6.14</a></dd>
1587 <a class="idx" href="manipmodule.html#idx:moduleproperty2:1606">6.14</a> <a class="idx" href="manipmodule.html#idx:moduleproperty2:1608">6.14</a></dd>
15751588 <dt><a class="idx" href="ctxmodule.html#module_transparent/1">module_transparent/1</a></dt>
15761589 <dd>
1577 <a class="idx" href="examineprog.html#idx:moduletransparent1:822">4.15</a> <a class="idx" href="metapred.html#idx:moduletransparent1:1555">6.4</a> <a class="idx" href="overrule.html#idx:moduletransparent1:1559">6.5.1</a> <a class="idx" href="modulecompat.html#idx:moduletransparent1:1607">6.15</a> <a class="idx" href="foreigninclude.html#idx:moduletransparent1:1856">10.4.9.2</a> <a class="idx" href="glossary.html#idx:moduletransparent1:2087">D</a></dd>
1590 <a class="idx" href="examineprog.html#idx:moduletransparent1:823">4.15</a> <a class="idx" href="metapred.html#idx:moduletransparent1:1557">6.4</a> <a class="idx" href="overrule.html#idx:moduletransparent1:1561">6.5.1</a> <a class="idx" href="modulecompat.html#idx:moduletransparent1:1609">6.15</a> <a class="idx" href="foreigninclude.html#idx:moduletransparent1:1859">10.4.9.2</a> <a class="idx" href="glossary.html#idx:moduletransparent1:2090">D</a></dd>
15781591 <dt><a class="idx" href="builtinlist.html#msort/2">msort/2</a></dt>
15791592 <dd>
1580 <a class="idx" href="builtinlist.html#idx:msort2:1229">4.28</a></dd>
1593 <a class="idx" href="builtinlist.html#idx:msort2:1231">4.28</a></dd>
1594 <dt>multi</dt>
1595 <dd>
1596 <a class="idx" href="glossary.html#idx:multi:2117">D</a></dd>
15811597 <dt><a class="idx" href="dynamic.html#multifile/1">multifile/1</a></dt>
15821598 <dd>
1583 <a class="idx" href="flags.html#idx:multifile1:123">2.11</a> <a class="idx" href="consulting.html#idx:multifile1:405">4.3</a> <a class="idx" href="consulting.html#idx:multifile1:414">4.3</a> <a class="idx" href="dynamic.html#idx:multifile1:772">4.14</a> <a class="idx" href="examineprog.html#idx:multifile1:815">4.15</a> <a class="idx" href="intlibs.html#idx:multifile1:2023">B.7</a> <a class="idx" href="glossary.html#idx:multifile1:2111">D</a></dd>
1599 <a class="idx" href="flags.html#idx:multifile1:123">2.11</a> <a class="idx" href="consulting.html#idx:multifile1:406">4.3</a> <a class="idx" href="consulting.html#idx:multifile1:415">4.3</a> <a class="idx" href="dynamic.html#idx:multifile1:773">4.14</a> <a class="idx" href="examineprog.html#idx:multifile1:816">4.15</a> <a class="idx" href="intlibs.html#idx:multifile1:2026">B.7</a> <a class="idx" href="glossary.html#idx:multifile1:2118">D</a></dd>
15841600 <dt>must_be/2</dt>
15851601 <dd>
1586 <a class="idx" href="record.html#idx:mustbe2:1973">A.29</a></dd>
1602 <a class="idx" href="record.html#idx:mustbe2:1976">A.29</a></dd>
15871603 <dt><a class="idx" href="threadsync.html#mutex_create/1">mutex_create/1</a></dt>
15881604 <dd>
1589 <a class="idx" href="threadsync.html#idx:mutexcreate1:1783">9.4</a> <a class="idx" href="threadsync.html#idx:mutexcreate1:1786">9.4</a></dd>
1605 <a class="idx" href="threadsync.html#idx:mutexcreate1:1786">9.4</a> <a class="idx" href="threadsync.html#idx:mutexcreate1:1789">9.4</a></dd>
15901606 <dt><a class="idx" href="threadsync.html#mutex_create/2">mutex_create/2</a></dt>
15911607 <dd>
1592 <a class="idx" href="threadsync.html#idx:mutexcreate2:1793">9.4</a></dd>
1608 <a class="idx" href="threadsync.html#idx:mutexcreate2:1796">9.4</a></dd>
15931609 <dt><a class="idx" href="threadsync.html#mutex_destroy/1">mutex_destroy/1</a></dt>
15941610 <dt><a class="idx" href="threadsync.html#mutex_lock/1">mutex_lock/1</a></dt>
15951611 <dd>
1596 <a class="idx" href="threadsync.html#idx:mutexlock1:1789">9.4</a></dd>
1612 <a class="idx" href="threadsync.html#idx:mutexlock1:1792">9.4</a></dd>
15971613 <dt><a class="idx" href="threadsync.html#mutex_property/2">mutex_property/2</a></dt>
15981614 <dt><a class="idx" href="thmonitor.html#mutex_statistics/0">mutex_statistics/0</a></dt>
15991615 <dt><a class="idx" href="threadsync.html#mutex_trylock/1">mutex_trylock/1</a></dt>
16011617 <dt><a class="idx" href="threadsync.html#mutex_unlock_all/0">mutex_unlock_all/0</a></dt>
16021618 <dt>my_compare/3</dt>
16031619 <dd>
1604 <a class="idx" href="portabilitystrategies.html#idx:mycompare3:2066">C.1</a></dd>
1620 <a class="idx" href="portabilitystrategies.html#idx:mycompare3:2069">C.1</a></dd>
16051621 <dt>mypred/1</dt>
16061622 <dd>
1607 <a class="idx" href="reexport.html#idx:mypred1:1569">6.7</a></dd>
1623 <a class="idx" href="reexport.html#idx:mypred1:1571">6.7</a></dd>
16081624 <dt>name/1</dt>
16091625 <dd>
1610 <a class="idx" href="metapred.html#idx:name1:1541">6.4</a></dd>
1626 <a class="idx" href="metapred.html#idx:name1:1543">6.4</a></dd>
16111627 <dt><a class="idx" href="manipatom.html#name/2">name/2</a></dt>
16121628 <dd>
1613 <a class="idx" href="manipatom.html#idx:name2:1119">4.21</a> <a class="idx" href="manipatom.html#idx:name2:1122">4.21</a> <a class="idx" href="manipatom.html#idx:name2:1140">4.21</a></dd>
1629 <a class="idx" href="manipatom.html#idx:name2:1120">4.21</a> <a class="idx" href="manipatom.html#idx:name2:1123">4.21</a> <a class="idx" href="manipatom.html#idx:name2:1141">4.21</a></dd>
16141630 <dt>name_of/2</dt>
16151631 <dd>
1616 <a class="idx" href="broadcast.html#idx:nameof2:1947">A.4</a></dd>
1632 <a class="idx" href="broadcast.html#idx:nameof2:1950">A.4</a></dd>
16171633 <dt><a class="idx" href="gvar.html#nb_current/2">nb_current/2</a></dt>
16181634 <dd>
1619 <a class="idx" href="gvar.html#idx:nbcurrent2:1666">7.3</a></dd>
1635 <a class="idx" href="gvar.html#idx:nbcurrent2:1669">7.3</a></dd>
16201636 <dt><a class="idx" href="gvar.html#nb_delete/1">nb_delete/1</a></dt>
16211637 <dt><a class="idx" href="gvar.html#nb_getval/2">nb_getval/2</a></dt>
16221638 <dd>
1623 <a class="idx" href="gvar.html#idx:nbgetval2:1662">7.3</a> <a class="idx" href="gvar.html#idx:nbgetval2:1664">7.3</a> <a class="idx" href="gvar.html#idx:nbgetval2:1667">7.3</a></dd>
1639 <a class="idx" href="gvar.html#idx:nbgetval2:1665">7.3</a> <a class="idx" href="gvar.html#idx:nbgetval2:1667">7.3</a> <a class="idx" href="gvar.html#idx:nbgetval2:1670">7.3</a></dd>
16241640 <dt><a class="idx" href="dicts.html#nb_link_dict/3">nb_link_dict/3</a></dt>
16251641 <dt><a class="idx" href="manipterm.html#nb_linkarg/3">nb_linkarg/3</a></dt>
16261642 <dd>
1627 <a class="idx" href="manipterm.html#idx:nblinkarg3:1105">4.20.1</a> <a class="idx" href="manipterm.html#idx:nblinkarg3:1115">4.20.1</a></dd>
1643 <a class="idx" href="manipterm.html#idx:nblinkarg3:1106">4.20.1</a> <a class="idx" href="manipterm.html#idx:nblinkarg3:1116">4.20.1</a></dd>
16281644 <dt><a class="idx" href="gvar.html#nb_linkval/2">nb_linkval/2</a></dt>
16291645 <dd>
1630 <a class="idx" href="manipterm.html#idx:nblinkval2:1108">4.20.1</a> <a class="idx" href="manipterm.html#idx:nblinkval2:1109">4.20.1</a> <a class="idx" href="manipterm.html#idx:nblinkval2:1113">4.20.1</a> <a class="idx" href="dicts.html#idx:nblinkval2:1502">5.4.2.1</a> <a class="idx" href="dicts.html#idx:nblinkval2:1503">5.4.2.1</a> <a class="idx" href="gvar.html#idx:nblinkval2:1669">7.3.1</a></dd>
1646 <a class="idx" href="manipterm.html#idx:nblinkval2:1109">4.20.1</a> <a class="idx" href="manipterm.html#idx:nblinkval2:1110">4.20.1</a> <a class="idx" href="manipterm.html#idx:nblinkval2:1114">4.20.1</a> <a class="idx" href="dicts.html#idx:nblinkval2:1504">5.4.2.1</a> <a class="idx" href="dicts.html#idx:nblinkval2:1505">5.4.2.1</a> <a class="idx" href="gvar.html#idx:nblinkval2:1672">7.3.1</a></dd>
16311647 <dt><a class="idx" href="dicts.html#nb_set_dict/3">nb_set_dict/3</a></dt>
16321648 <dt><a class="idx" href="nb_set.html#nb_set_to_list/2">nb_set_to_list/2</a></dt>
16331649 <dt><a class="idx" href="manipterm.html#nb_setarg/3">nb_setarg/3</a></dt>
16341650 <dd>
1635 <a class="idx" href="preddesc.html#idx:nbsetarg3:305">4.1</a> <a class="idx" href="db.html#idx:nbsetarg3:757">4.13</a> <a class="idx" href="manipterm.html#idx:nbsetarg3:1097">4.20.1</a> <a class="idx" href="manipterm.html#idx:nbsetarg3:1107">4.20.1</a> <a class="idx" href="manipterm.html#idx:nbsetarg3:1114">4.20.1</a> <a class="idx" href="allsolutions.html#idx:nbsetarg3:1245">4.29</a> <a class="idx" href="dicts.html#idx:nbsetarg3:1499">5.4.2.1</a> <a class="idx" href="nb_set.html#idx:nbsetarg3:1952">A.15</a> <a class="idx" href="record.html#idx:nbsetarg3:1975">A.29</a></dd>
1651 <a class="idx" href="preddesc.html#idx:nbsetarg3:306">4.1</a> <a class="idx" href="db.html#idx:nbsetarg3:758">4.13</a> <a class="idx" href="manipterm.html#idx:nbsetarg3:1098">4.20.1</a> <a class="idx" href="manipterm.html#idx:nbsetarg3:1108">4.20.1</a> <a class="idx" href="manipterm.html#idx:nbsetarg3:1115">4.20.1</a> <a class="idx" href="allsolutions.html#idx:nbsetarg3:1247">4.29</a> <a class="idx" href="dicts.html#idx:nbsetarg3:1501">5.4.2.1</a> <a class="idx" href="nb_set.html#idx:nbsetarg3:1955">A.15</a> <a class="idx" href="record.html#idx:nbsetarg3:1978">A.29</a></dd>
16361652 <dt><a class="idx" href="gvar.html#nb_setval/2">nb_setval/2</a></dt>
16371653 <dd>
1638 <a class="idx" href="db.html#idx:nbsetval2:756">4.13</a> <a class="idx" href="manipterm.html#idx:nbsetval2:1103">4.20.1</a> <a class="idx" href="manipterm.html#idx:nbsetval2:1104">4.20.1</a> <a class="idx" href="manipterm.html#idx:nbsetval2:1112">4.20.1</a> <a class="idx" href="dicts.html#idx:nbsetval2:1500">5.4.2.1</a> <a class="idx" href="gvar.html#idx:nbsetval2:1652">7.3</a> <a class="idx" href="gvar.html#idx:nbsetval2:1655">7.3</a> <a class="idx" href="gvar.html#idx:nbsetval2:1665">7.3</a> <a class="idx" href="gvar.html#idx:nbsetval2:1668">7.3.1</a> <a class="idx" href="exception3.html#idx:nbsetval2:2020">B.6</a></dd>
1654 <a class="idx" href="db.html#idx:nbsetval2:757">4.13</a> <a class="idx" href="manipterm.html#idx:nbsetval2:1104">4.20.1</a> <a class="idx" href="manipterm.html#idx:nbsetval2:1105">4.20.1</a> <a class="idx" href="manipterm.html#idx:nbsetval2:1113">4.20.1</a> <a class="idx" href="dicts.html#idx:nbsetval2:1502">5.4.2.1</a> <a class="idx" href="gvar.html#idx:nbsetval2:1655">7.3</a> <a class="idx" href="gvar.html#idx:nbsetval2:1658">7.3</a> <a class="idx" href="gvar.html#idx:nbsetval2:1668">7.3</a> <a class="idx" href="gvar.html#idx:nbsetval2:1671">7.3.1</a> <a class="idx" href="exception3.html#idx:nbsetval2:2023">B.6</a></dd>
16391655 <dt>neck</dt>
16401656 <dd>
1641 <a class="idx" href="glossary.html#idx:neck:2112">D</a></dd>
1657 <a class="idx" href="glossary.html#idx:neck:2119">D</a></dd>
16421658 <dt><a class="idx" href="ugraphs.html#neighbors/3">neighbors/3</a></dt>
16431659 <dt><a class="idx" href="ugraphs.html#neighbours/3">neighbours/3</a></dt>
16441660 <dd>
1645 <a class="idx" href="ugraphs.html#idx:neighbours3:1980">A.34</a></dd>
1661 <a class="idx" href="ugraphs.html#idx:neighbours3:1983">A.34</a></dd>
16461662 <dt><a class="idx" href="lists.html#nextto/3">nextto/3</a></dt>
16471663 <dt><a class="idx" href="chario.html#nl/0">nl/0</a></dt>
16481664 <dd>
1649 <a class="idx" href="chario.html#idx:nl0:959">4.18</a></dd>
1665 <a class="idx" href="chario.html#idx:nl0:960">4.18</a></dd>
16501666 <dt><a class="idx" href="chario.html#nl/1">nl/1</a></dt>
16511667 <dt>nl/[0,1]</dt>
16521668 <dd>
1653 <a class="idx" href="format.html#idx:nl01:1268">4.31.1</a></dd>
1669 <a class="idx" href="format.html#idx:nl01:1270">4.31.1</a></dd>
16541670 <dt><a class="idx" href="debugger.html#nodebug/0">nodebug/0</a></dt>
16551671 <dd>
1656 <a class="idx" href="debugger.html#idx:nodebug0:1405">4.37</a> <a class="idx" href="tracehook.html#idx:nodebug0:1998">B.3</a></dd>
1672 <a class="idx" href="debugger.html#idx:nodebug0:1407">4.37</a> <a class="idx" href="tracehook.html#idx:nodebug0:2001">B.3</a></dd>
16571673 <dt><a class="idx" href="debug.html#nodebug/1">nodebug/1</a></dt>
16581674 <dt><a class="idx" href="guitracer.html#noguitracer/0">noguitracer/0</a></dt>
16591675 <dd>
16601676 <a class="idx" href="guitracer.html#idx:noguitracer0:286">3.5.1</a> <a class="idx" href="idesummary.html#idx:noguitracer0:301">3.9</a></dd>
16611677 <dt>non deterministic</dt>
16621678 <dd>
1663 <a class="idx" href="glossary.html#idx:nondeterministic:2114">D</a></dd>
1679 <a class="idx" href="glossary.html#idx:nondeterministic:2121">D</a></dd>
16641680 <dt>nondet</dt>
16651681 <dd>
1666 <a class="idx" href="glossary.html#idx:nondet:2113">D</a></dd>
1682 <a class="idx" href="glossary.html#idx:nondet:2120">D</a></dd>
16671683 <dt><a class="idx" href="typetest.html#nonvar/1">nonvar/1</a></dt>
16681684 <dt><a class="idx" href="profile.html#noprofile/1">noprofile/1</a></dt>
16691685 <dt><a class="idx" href="protocol.html#noprotocol/0">noprotocol/0</a></dt>
16701686 <dt><a class="idx" href="chartype.html#normalize_space/2">normalize_space/2</a></dt>
16711687 <dt><a class="idx" href="debugger.html#nospy/1">nospy/1</a></dt>
16721688 <dd>
1673 <a class="idx" href="debugoverview.html#idx:nospy1:46">2.9</a> <a class="idx" href="hooks.html#idx:nospy1:154">2.12</a> <a class="idx" href="thutil.html#idx:nospy1:1806">9.5.1</a> <a class="idx" href="intlibs.html#idx:nospy1:2026">B.7</a> <a class="idx" href="intlibs.html#idx:nospy1:2027">B.7</a> <a class="idx" href="intlibs.html#idx:nospy1:2029">B.7</a></dd>
1689 <a class="idx" href="debugoverview.html#idx:nospy1:46">2.9</a> <a class="idx" href="hooks.html#idx:nospy1:154">2.12</a> <a class="idx" href="thutil.html#idx:nospy1:1809">9.5.1</a> <a class="idx" href="intlibs.html#idx:nospy1:2029">B.7</a> <a class="idx" href="intlibs.html#idx:nospy1:2030">B.7</a> <a class="idx" href="intlibs.html#idx:nospy1:2032">B.7</a></dd>
16741690 <dt><a class="idx" href="debugger.html#nospyall/0">nospyall/0</a></dt>
16751691 <dd>
1676 <a class="idx" href="hooks.html#idx:nospyall0:155">2.12</a> <a class="idx" href="intlibs.html#idx:nospyall0:2030">B.7</a></dd>
1692 <a class="idx" href="hooks.html#idx:nospyall0:155">2.12</a> <a class="idx" href="intlibs.html#idx:nospyall0:2033">B.7</a></dd>
16771693 <dt><a class="idx" href="metacall.html#not/1">not/1</a></dt>
16781694 <dd>
1679 <a class="idx" href="predsummary.html#idx:not1:2143">F.1</a></dd>
1695 <a class="idx" href="predsummary.html#idx:not1:2150">F.1</a></dd>
16801696 <dt><a class="idx" href="debugger.html#notrace/0">notrace/0</a></dt>
16811697 <dd>
1682 <a class="idx" href="debugger.html#idx:notrace0:1396">4.37</a> <a class="idx" href="debugging.html#idx:notrace0:1681">8.4.3</a> <a class="idx" href="debugging.html#idx:notrace0:1683">8.4.3</a></dd>
1698 <a class="idx" href="debugger.html#idx:notrace0:1398">4.37</a> <a class="idx" href="debugging.html#idx:notrace0:1684">8.4.3</a> <a class="idx" href="debugging.html#idx:notrace0:1686">8.4.3</a></dd>
16831699 <dt><a class="idx" href="debugger.html#notrace/1">notrace/1</a></dt>
16841700 <dt><a class="idx" href="lists.html#nth0/3">nth0/3</a></dt>
16851701 <dt><a class="idx" href="lists.html#nth0/4">nth0/4</a></dt>
16871703 <dt><a class="idx" href="lists.html#nth1/4">nth1/4</a></dt>
16881704 <dt><a class="idx" href="examineprog.html#nth_clause/3">nth_clause/3</a></dt>
16891705 <dd>
1690 <a class="idx" href="examineprog.html#idx:nthclause3:811">4.15</a> <a class="idx" href="examineprog.html#idx:nthclause3:833">4.15</a> <a class="idx" href="manipstack.html#idx:nthclause3:1984">B.1</a></dd>
1706 <a class="idx" href="examineprog.html#idx:nthclause3:812">4.15</a> <a class="idx" href="examineprog.html#idx:nthclause3:834">4.15</a> <a class="idx" href="manipstack.html#idx:nthclause3:1987">B.1</a></dd>
1707 <dt><a class="idx" href="arith.html#nth_integer_root_and_remainder/4">nth_integer_root_and_remainder/4</a></dt>
16911708 <dt>number,rational</dt>
16921709 <dd>
1693 <a class="idx" href="arith.html#idx:numberrational:1207">4.26.2.1</a></dd>
1710 <a class="idx" href="arith.html#idx:numberrational:1209">4.26.2.1</a></dd>
16941711 <dt><a class="idx" href="typetest.html#number/1">number/1</a></dt>
16951712 <dd>
1696 <a class="idx" href="typetest.html#idx:number1:555">4.6</a> <a class="idx" href="typetest.html#idx:number1:557">4.6</a></dd>
1713 <a class="idx" href="typetest.html#idx:number1:556">4.6</a> <a class="idx" href="typetest.html#idx:number1:558">4.6</a></dd>
16971714 <dt><a class="idx" href="manipatom.html#number_chars/2">number_chars/2</a></dt>
16981715 <dd>
1699 <a class="idx" href="chars.html#idx:numberchars2:316">4.2</a> <a class="idx" href="manipatom.html#idx:numberchars2:1133">4.21</a></dd>
1716 <a class="idx" href="chars.html#idx:numberchars2:317">4.2</a> <a class="idx" href="manipatom.html#idx:numberchars2:1134">4.21</a></dd>
17001717 <dt><a class="idx" href="manipatom.html#number_codes/2">number_codes/2</a></dt>
17011718 <dd>
1702 <a class="idx" href="chars.html#idx:numbercodes2:317">4.2</a> <a class="idx" href="manipatom.html#idx:numbercodes2:1118">4.21</a> <a class="idx" href="manipatom.html#idx:numbercodes2:1121">4.21</a> <a class="idx" href="manipatom.html#idx:numbercodes2:1135">4.21</a> <a class="idx" href="manipatom.html#idx:numbercodes2:1136">4.21</a> <a class="idx" href="manipatom.html#idx:numbercodes2:1138">4.21</a> <a class="idx" href="manipatom.html#idx:numbercodes2:1142">4.21</a> <a class="idx" href="manipatom.html#idx:numbercodes2:1144">4.21</a></dd>
1719 <a class="idx" href="chars.html#idx:numbercodes2:318">4.2</a> <a class="idx" href="manipatom.html#idx:numbercodes2:1119">4.21</a> <a class="idx" href="manipatom.html#idx:numbercodes2:1122">4.21</a> <a class="idx" href="manipatom.html#idx:numbercodes2:1136">4.21</a> <a class="idx" href="manipatom.html#idx:numbercodes2:1137">4.21</a> <a class="idx" href="manipatom.html#idx:numbercodes2:1139">4.21</a> <a class="idx" href="manipatom.html#idx:numbercodes2:1143">4.21</a> <a class="idx" href="manipatom.html#idx:numbercodes2:1145">4.21</a></dd>
17031720 <dt><a class="idx" href="strings.html#number_string/2">number_string/2</a></dt>
17041721 <dt><a class="idx" href="charsio.html#number_to_chars/2">number_to_chars/2</a></dt>
17051722 <dt><a class="idx" href="charsio.html#number_to_chars/3">number_to_chars/3</a></dt>
17061723 <dt><a class="idx" href="varnumbers.html#numbervars/1">numbervars/1</a></dt>
17071724 <dt><a class="idx" href="manipterm.html#numbervars/3">numbervars/3</a></dt>
17081725 <dd>
1709 <a class="idx" href="cyclic.html#idx:numbervars3:210">2.16</a> <a class="idx" href="termrw.html#idx:numbervars3:1009">4.19</a> <a class="idx" href="manipterm.html#idx:numbervars3:1083">4.20</a> <a class="idx" href="manipterm.html#idx:numbervars3:1084">4.20</a> <a class="idx" href="manipterm.html#idx:numbervars3:1089">4.20</a></dd>
1726 <a class="idx" href="cyclic.html#idx:numbervars3:210">2.16</a> <a class="idx" href="termrw.html#idx:numbervars3:1010">4.19</a> <a class="idx" href="manipterm.html#idx:numbervars3:1084">4.20</a> <a class="idx" href="manipterm.html#idx:numbervars3:1085">4.20</a> <a class="idx" href="manipterm.html#idx:numbervars3:1090">4.20</a></dd>
17101727 <dt><a class="idx" href="manipterm.html#numbervars/4">numbervars/4</a></dt>
17111728 <dd>
1712 <a class="idx" href="cyclic.html#idx:numbervars4:211">2.16</a> <a class="idx" href="termrw.html#idx:numbervars4:1024">4.19</a> <a class="idx" href="termrw.html#idx:numbervars4:1025">4.19</a> <a class="idx" href="manipterm.html#idx:numbervars4:1082">4.20</a> <a class="idx" href="manipterm.html#idx:numbervars4:1085">4.20</a></dd>
1729 <a class="idx" href="cyclic.html#idx:numbervars4:211">2.16</a> <a class="idx" href="termrw.html#idx:numbervars4:1025">4.19</a> <a class="idx" href="termrw.html#idx:numbervars4:1026">4.19</a> <a class="idx" href="manipterm.html#idx:numbervars4:1083">4.20</a> <a class="idx" href="manipterm.html#idx:numbervars4:1086">4.20</a></dd>
17131730 <dt><a class="idx" href="lists.html#numlist/3">numlist/3</a></dt>
17141731 <dt><a class="idx" href="simplex.html#objective/2">objective/2</a></dt>
17151732 <dt>occurs_check</dt>
17161733 <dd>
1717 <a class="idx" href="compare.html#idx:occurscheck:580">4.7.2</a></dd>
1734 <a class="idx" href="compare.html#idx:occurscheck:581">4.7.2</a></dd>
17181735 <dt><a class="idx" href="solutionsequences.html#offset/2">offset/2</a></dt>
17191736 <dt><a class="idx" href="signal.html#on_signal/3">on_signal/3</a></dt>
17201737 <dd>
1721 <a class="idx" href="signal.html#idx:onsignal3:696">4.11</a> <a class="idx" href="signal.html#idx:onsignal3:698">4.11</a></dd>
1738 <a class="idx" href="signal.html#idx:onsignal3:697">4.11</a> <a class="idx" href="signal.html#idx:onsignal3:699">4.11</a></dd>
17221739 <dt><a class="idx" href="metacall.html#once/1">once/1</a></dt>
17231740 <dd>
1724 <a class="idx" href="metacall.html#idx:once1:603">4.9</a> <a class="idx" href="metacall.html#idx:once1:604">4.9</a> <a class="idx" href="metacall.html#idx:once1:617">4.9</a> <a class="idx" href="IO.html#idx:once1:942">4.16.5</a> <a class="idx" href="allsolutions.html#idx:once1:1246">4.29</a> <a class="idx" href="toplevel.html#idx:once1:1379">4.35</a> <a class="idx" href="debugger.html#idx:once1:1403">4.37</a> <a class="idx" href="profile.html#idx:once1:1419">4.39.1</a> <a class="idx" href="profile.html#idx:once1:1420">4.39.1</a> <a class="idx" href="threadsync.html#idx:once1:1779">9.4</a> <a class="idx" href="threadsync.html#idx:once1:1782">9.4</a> <a class="idx" href="threadsync.html#idx:once1:1785">9.4</a> <a class="idx" href="foreigninclude.html#idx:once1:1859">10.4.9.2</a></dd>
1741 <a class="idx" href="metacall.html#idx:once1:604">4.9</a> <a class="idx" href="metacall.html#idx:once1:605">4.9</a> <a class="idx" href="metacall.html#idx:once1:618">4.9</a> <a class="idx" href="IO.html#idx:once1:943">4.16.5</a> <a class="idx" href="allsolutions.html#idx:once1:1248">4.29</a> <a class="idx" href="toplevel.html#idx:once1:1381">4.35</a> <a class="idx" href="debugger.html#idx:once1:1405">4.37</a> <a class="idx" href="profile.html#idx:once1:1421">4.39.1</a> <a class="idx" href="profile.html#idx:once1:1422">4.39.1</a> <a class="idx" href="threadsync.html#idx:once1:1782">9.4</a> <a class="idx" href="threadsync.html#idx:once1:1785">9.4</a> <a class="idx" href="threadsync.html#idx:once1:1788">9.4</a> <a class="idx" href="foreigninclude.html#idx:once1:1862">10.4.9.2</a></dd>
17251742 <dt><a class="idx" href="operators.html#op/3">op/3</a></dt>
17261743 <dd>
1727 <a class="idx" href="dynamic.html#idx:op3:775">4.14</a> <a class="idx" href="termrw.html#idx:op3:1008">4.19</a> <a class="idx" href="operators.html#idx:op3:1197">4.24</a> <a class="idx" href="moduleop.html#idx:op3:1572">6.8</a></dd>
1744 <a class="idx" href="dynamic.html#idx:op3:776">4.14</a> <a class="idx" href="termrw.html#idx:op3:1009">4.19</a> <a class="idx" href="operators.html#idx:op3:1198">4.24</a> <a class="idx" href="moduleop.html#idx:op3:1574">6.8</a></dd>
17281745 <dt><a class="idx" href="IO.html#open/3">open/3</a></dt>
17291746 <dd>
1730 <a class="idx" href="flags.html#idx:open3:89">2.11</a> <a class="idx" href="IO.html#idx:open3:839">4.16</a> <a class="idx" href="IO.html#idx:open3:858">4.16.2</a> <a class="idx" href="foreigninclude.html#idx:open3:1842">10.4.6</a></dd>
1747 <a class="idx" href="flags.html#idx:open3:89">2.11</a> <a class="idx" href="preddesc.html#idx:open3:304">4.1</a> <a class="idx" href="IO.html#idx:open3:840">4.16</a> <a class="idx" href="IO.html#idx:open3:859">4.16.2</a> <a class="idx" href="foreigninclude.html#idx:open3:1845">10.4.6</a></dd>
17311748 <dt><a class="idx" href="IO.html#open/4">open/4</a></dt>
17321749 <dd>
1733 <a class="idx" href="widechars.html#idx:open4:235">2.18.1</a> <a class="idx" href="widechars.html#idx:open4:241">2.18.1.1</a> <a class="idx" href="widechars.html#idx:open4:243">2.18.1.1</a> <a class="idx" href="chars.html#idx:open4:309">4.2</a> <a class="idx" href="IO.html#idx:open4:864">4.16.2</a> <a class="idx" href="IO.html#idx:open4:872">4.16.2</a> <a class="idx" href="IO.html#idx:open4:875">4.16.2</a> <a class="idx" href="IO.html#idx:open4:878">4.16.2</a> <a class="idx" href="IO.html#idx:open4:879">4.16.2</a> <a class="idx" href="IO.html#idx:open4:896">4.16.2</a> <a class="idx" href="IO.html#idx:open4:907">4.16.2</a> <a class="idx" href="IO.html#idx:open4:917">4.16.2</a> <a class="idx" href="chario.html#idx:open4:988">4.18</a> <a class="idx" href="locale.html#idx:open4:1170">4.22</a> <a class="idx" href="dicts.html#idx:open4:1505">5.4.3</a> <a class="idx" href="dicts.html#idx:open4:1511">5.4.4</a> <a class="idx" href="readutil.html#idx:open4:1967">A.28</a> <a class="idx" href="readutil.html#idx:open4:1971">A.28</a></dd>
1750 <a class="idx" href="widechars.html#idx:open4:235">2.18.1</a> <a class="idx" href="widechars.html#idx:open4:241">2.18.1.1</a> <a class="idx" href="widechars.html#idx:open4:243">2.18.1.1</a> <a class="idx" href="chars.html#idx:open4:310">4.2</a> <a class="idx" href="IO.html#idx:open4:865">4.16.2</a> <a class="idx" href="IO.html#idx:open4:873">4.16.2</a> <a class="idx" href="IO.html#idx:open4:876">4.16.2</a> <a class="idx" href="IO.html#idx:open4:879">4.16.2</a> <a class="idx" href="IO.html#idx:open4:880">4.16.2</a> <a class="idx" href="IO.html#idx:open4:897">4.16.2</a> <a class="idx" href="IO.html#idx:open4:908">4.16.2</a> <a class="idx" href="IO.html#idx:open4:918">4.16.2</a> <a class="idx" href="chario.html#idx:open4:989">4.18</a> <a class="idx" href="locale.html#idx:open4:1171">4.22</a> <a class="idx" href="dicts.html#idx:open4:1507">5.4.3</a> <a class="idx" href="dicts.html#idx:open4:1513">5.4.4</a> <a class="idx" href="readutil.html#idx:open4:1970">A.28</a> <a class="idx" href="readutil.html#idx:open4:1974">A.28</a></dd>
17341751 <dt><a class="idx" href="iostream.html#open_any/5">open_any/5</a></dt>
17351752 <dt><a class="idx" href="charsio.html#open_chars_stream/2">open_chars_stream/2</a></dt>
17361753 <dt><a class="idx" href="DDE.html#open_dde_conversation/3">open_dde_conversation/3</a></dt>
17371754 <dt><a class="idx" href="iostream.html#open_hook/6">open_hook/6</a></dt>
17381755 <dt><a class="idx" href="IO.html#open_null_stream/1">open_null_stream/1</a></dt>
17391756 <dd>
1740 <a class="idx" href="IO.html#idx:opennullstream1:901">4.16.2</a></dd>
1757 <a class="idx" href="IO.html#idx:opennullstream1:902">4.16.2</a></dd>
17411758 <dt><a class="idx" href="useresource.html#open_resource/3">open_resource/3</a></dt>
17421759 <dd>
1743 <a class="idx" href="runtime.html#idx:openresource3:1904">11</a> <a class="idx" href="useresource.html#idx:openresource3:1928">11.3</a> <a class="idx" href="useresource.html#idx:openresource3:1933">11.3.1</a></dd>
1760 <a class="idx" href="runtime.html#idx:openresource3:1907">11</a> <a class="idx" href="useresource.html#idx:openresource3:1931">11.3</a> <a class="idx" href="useresource.html#idx:openresource3:1936">11.3.1</a></dd>
17441761 <dt><a class="idx" href="foreignlink.html#open_shared_object/2">open_shared_object/2</a></dt>
17451762 <dd>
1746 <a class="idx" href="flags.html#idx:opensharedobject2:99">2.11</a> <a class="idx" href="system.html#idx:opensharedobject2:1329">4.33.1</a> <a class="idx" href="foreignlink.html#idx:opensharedobject2:1822">10.2.1</a> <a class="idx" href="foreignlink.html#idx:opensharedobject2:1827">10.2.4</a></dd>
1763 <a class="idx" href="flags.html#idx:opensharedobject2:99">2.11</a> <a class="idx" href="system.html#idx:opensharedobject2:1331">4.33.1</a> <a class="idx" href="foreignlink.html#idx:opensharedobject2:1825">10.2.1</a> <a class="idx" href="foreignlink.html#idx:opensharedobject2:1830">10.2.4</a></dd>
17471764 <dt><a class="idx" href="foreignlink.html#open_shared_object/3">open_shared_object/3</a></dt>
17481765 <dd>
1749 <a class="idx" href="foreignlink.html#idx:opensharedobject3:1825">10.2.4</a></dd>
1766 <a class="idx" href="foreignlink.html#idx:opensharedobject3:1828">10.2.4</a></dd>
17501767 <dt><a class="idx" href="strings.html#open_string/2">open_string/2</a></dt>
17511768 <dt>operand</dt>
17521769 <dd>
1753 <a class="idx" href="glossary.html#idx:operand:2116">D</a></dd>
1770 <a class="idx" href="glossary.html#idx:operand:2123">D</a></dd>
17541771 <dt>operator</dt>
17551772 <dd>
1756 <a class="idx" href="glossary.html#idx:operator:2115">D</a></dd>
1773 <a class="idx" href="glossary.html#idx:operator:2122">D</a></dd>
17571774 <dt>operator,and modules</dt>
17581775 <dd>
1759 <a class="idx" href="operators.html#idx:operatorandmodules:1194">4.24</a></dd>
1776 <a class="idx" href="operators.html#idx:operatorandmodules:1195">4.24</a></dd>
17601777 <dt><a class="idx" href="optparse.html#opt_arguments/3">opt_arguments/3</a></dt>
17611778 <dt><a class="idx" href="optparse.html#opt_help/2">opt_help/2</a></dt>
17621779 <dt><a class="idx" href="optparse.html#opt_parse/4">opt_parse/4</a></dt>
17841801 <dt><a class="idx" href="ordsets.html#ord_union/4">ord_union/4</a></dt>
17851802 <dt><a class="idx" href="solutionsequences.html#order_by/2">order_by/2</a></dt>
17861803 <dd>
1787 <a class="idx" href="builtinlist.html#idx:orderby2:1232">4.28</a></dd>
1804 <a class="idx" href="builtinlist.html#idx:orderby2:1234">4.28</a></dd>
17881805 <dt><a class="idx" href="prologpack.html#pack_info/1">pack_info/1</a></dt>
17891806 <dt><a class="idx" href="prologpack.html#pack_install/1">pack_install/1</a></dt>
17901807 <dt><a class="idx" href="prologpack.html#pack_install/2">pack_install/2</a></dt>
18031820 <dt><a class="idx" href="system.html#parse_time/2">parse_time/2</a></dt>
18041821 <dt><a class="idx" href="system.html#parse_time/3">parse_time/3</a></dt>
18051822 <dd>
1806 <a class="idx" href="system.html#idx:parsetime3:1342">4.33.2.2</a></dd>
1823 <a class="idx" href="system.html#idx:parsetime3:1344">4.33.2.2</a></dd>
1824 <dt><a class="idx" href="optparse.html#parse_type/3">parse_type/3</a></dt>
18071825 <dt><a class="idx" href="url.html#parse_url/2">parse_url/2</a></dt>
18081826 <dt><a class="idx" href="url.html#parse_url/3">parse_url/3</a></dt>
18091827 <dt><a class="idx" href="url.html#parse_url_search/2">parse_url_search/2</a></dt>
18111829 <dt><a class="idx" href="apply.html#partition/5">partition/5</a></dt>
18121830 <dt><a class="idx" href="mt-xpce.html#pce_dispatch/1">pce_dispatch/1</a></dt>
18131831 <dd>
1814 <a class="idx" href="mt-xpce.html#idx:pcedispatch1:1812">9.7</a></dd>
1832 <a class="idx" href="mt-xpce.html#idx:pcedispatch1:1815">9.7</a></dd>
18151833 <dt>pce_thread/1</dt>
18161834 <dd>
1817 <a class="idx" href="mt-xpce.html#idx:pcethread1:1817">9.7</a></dd>
1835 <a class="idx" href="mt-xpce.html#idx:pcethread1:1820">9.7</a></dd>
18181836 <dt><a class="idx" href="chario.html#peek_byte/1">peek_byte/1</a></dt>
18191837 <dt><a class="idx" href="chario.html#peek_byte/2">peek_byte/2</a></dt>
18201838 <dt>peek_byte/[1,2]</dt>
18211839 <dd>
1822 <a class="idx" href="chars.html#idx:peekbyte12:323">4.2</a></dd>
1840 <a class="idx" href="chars.html#idx:peekbyte12:324">4.2</a></dd>
18231841 <dt><a class="idx" href="chario.html#peek_char/1">peek_char/1</a></dt>
18241842 <dt><a class="idx" href="chario.html#peek_char/2">peek_char/2</a></dt>
18251843 <dt>peek_char/[1,2]</dt>
18261844 <dd>
1827 <a class="idx" href="chars.html#idx:peekchar12:321">4.2</a></dd>
1845 <a class="idx" href="chars.html#idx:peekchar12:322">4.2</a></dd>
18281846 <dt><a class="idx" href="chario.html#peek_code/1">peek_code/1</a></dt>
18291847 <dt><a class="idx" href="chario.html#peek_code/2">peek_code/2</a></dt>
18301848 <dt>peek_code/[1,2]</dt>
18311849 <dd>
1832 <a class="idx" href="chars.html#idx:peekcode12:322">4.2</a></dd>
1850 <a class="idx" href="chars.html#idx:peekcode12:323">4.2</a></dd>
18331851 <dt><a class="idx" href="chario.html#peek_string/3">peek_string/3</a></dt>
18341852 <dt>permission_error/3</dt>
18351853 <dd>
1836 <a class="idx" href="foreigninclude.html#idx:permissionerror3:1847">10.4.6</a></dd>
1854 <a class="idx" href="foreigninclude.html#idx:permissionerror3:1850">10.4.6</a></dd>
18371855 <dt><a class="idx" href="lists.html#permutation/2">permutation/2</a></dt>
18381856 <dt><a class="idx" href="persistency.html#persistent/1">persistent/1</a></dt>
18391857 <dt><a class="idx" href="DCG.html#phrase/2">phrase/2</a></dt>
18401858 <dd>
1841 <a class="idx" href="DCG.html#idx:phrase2:704">4.12</a></dd>
1859 <a class="idx" href="DCG.html#idx:phrase2:705">4.12</a></dd>
18421860 <dt><a class="idx" href="DCG.html#phrase/3">phrase/3</a></dt>
18431861 <dd>
1844 <a class="idx" href="DCG.html#idx:phrase3:705">4.12</a> <a class="idx" href="DCG.html#idx:phrase3:707">4.12</a> <a class="idx" href="DCG.html#idx:phrase3:709">4.12</a> <a class="idx" href="DCG.html#idx:phrase3:711">4.12</a> <a class="idx" href="DCG.html#idx:phrase3:712">4.12</a> <a class="idx" href="DCG.html#idx:phrase3:713">4.12</a> <a class="idx" href="strings.html#idx:phrase3:1462">5.2.2</a> <a class="idx" href="metapred.html#idx:phrase3:1553">6.4</a> <a class="idx" href="predsummary.html#idx:phrase3:2147">F.1</a></dd>
1862 <a class="idx" href="DCG.html#idx:phrase3:706">4.12</a> <a class="idx" href="DCG.html#idx:phrase3:708">4.12</a> <a class="idx" href="DCG.html#idx:phrase3:710">4.12</a> <a class="idx" href="DCG.html#idx:phrase3:712">4.12</a> <a class="idx" href="DCG.html#idx:phrase3:713">4.12</a> <a class="idx" href="DCG.html#idx:phrase3:714">4.12</a> <a class="idx" href="strings.html#idx:phrase3:1464">5.2.2</a> <a class="idx" href="metapred.html#idx:phrase3:1555">6.4</a> <a class="idx" href="predsummary.html#idx:phrase3:2154">F.1</a></dd>
18451863 <dt><a class="idx" href="pio.html#phrase_from_file/2">phrase_from_file/2</a></dt>
18461864 <dt><a class="idx" href="pio.html#phrase_from_file/3">phrase_from_file/3</a></dt>
18471865 <dt><a class="idx" href="quasiquotations.html#phrase_from_quasi_quotation/2">phrase_from_quasi_quotation/2</a></dt>
18491867 <dt><a class="idx" href="arith.html#plus/3">plus/3</a></dt>
18501868 <dt>portable,prolog code</dt>
18511869 <dd>
1852 <a class="idx" href="dialect.html#idx:portableprologcode:2048">C</a></dd>
1870 <a class="idx" href="dialect.html#idx:portableprologcode:2051">C</a></dd>
18531871 <dt><a class="idx" href="termrw.html#portray/1">portray/1</a></dt>
18541872 <dd>
1855 <a class="idx" href="debugoverview.html#idx:portray1:53">2.9</a> <a class="idx" href="projectfiles.html#idx:portray1:272">3.1.2</a> <a class="idx" href="termrw.html#idx:portray1:1004">4.19</a> <a class="idx" href="termrw.html#idx:portray1:1011">4.19</a> <a class="idx" href="termrw.html#idx:portray1:1013">4.19</a> <a class="idx" href="termrw.html#idx:portray1:1014">4.19</a> <a class="idx" href="termrw.html#idx:portray1:1033">4.19</a> <a class="idx" href="termrw.html#idx:portray1:1034">4.19</a> <a class="idx" href="termrw.html#idx:portray1:1037">4.19</a> <a class="idx" href="termrw.html#idx:portray1:1038">4.19</a> <a class="idx" href="termrw.html#idx:portray1:1039">4.19</a> <a class="idx" href="foreigninclude.html#idx:portray1:1858">10.4.9.2</a> <a class="idx" href="foreigninclude.html#idx:portray1:1888">10.4.20</a> <a class="idx" href="intlibs.html#idx:portray1:2022">B.7</a></dd>
1873 <a class="idx" href="debugoverview.html#idx:portray1:53">2.9</a> <a class="idx" href="projectfiles.html#idx:portray1:272">3.1.2</a> <a class="idx" href="termrw.html#idx:portray1:1005">4.19</a> <a class="idx" href="termrw.html#idx:portray1:1012">4.19</a> <a class="idx" href="termrw.html#idx:portray1:1014">4.19</a> <a class="idx" href="termrw.html#idx:portray1:1015">4.19</a> <a class="idx" href="termrw.html#idx:portray1:1034">4.19</a> <a class="idx" href="termrw.html#idx:portray1:1035">4.19</a> <a class="idx" href="termrw.html#idx:portray1:1038">4.19</a> <a class="idx" href="termrw.html#idx:portray1:1039">4.19</a> <a class="idx" href="termrw.html#idx:portray1:1040">4.19</a> <a class="idx" href="foreigninclude.html#idx:portray1:1861">10.4.9.2</a> <a class="idx" href="foreigninclude.html#idx:portray1:1891">10.4.20</a> <a class="idx" href="intlibs.html#idx:portray1:2025">B.7</a></dd>
18561874 <dt><a class="idx" href="listing.html#portray_clause/1">portray_clause/1</a></dt>
18571875 <dd>
1858 <a class="idx" href="listing.html#idx:portrayclause1:550">4.5</a> <a class="idx" href="listing.html#idx:portrayclause1:551">4.5</a> <a class="idx" href="listing.html#idx:portrayclause1:554">4.5</a></dd>
1876 <a class="idx" href="listing.html#idx:portrayclause1:551">4.5</a> <a class="idx" href="listing.html#idx:portrayclause1:552">4.5</a> <a class="idx" href="listing.html#idx:portrayclause1:555">4.5</a></dd>
18591877 <dt><a class="idx" href="listing.html#portray_clause/2">portray_clause/2</a></dt>
18601878 <dd>
1861 <a class="idx" href="listing.html#idx:portrayclause2:553">4.5</a> <a class="idx" href="manipterm.html#idx:portrayclause2:1087">4.20</a></dd>
1879 <a class="idx" href="listing.html#idx:portrayclause2:554">4.5</a> <a class="idx" href="manipterm.html#idx:portrayclause2:1088">4.20</a></dd>
18621880 <dt>portray_text/1</dt>
18631881 <dd>
1864 <a class="idx" href="DCG.html#idx:portraytext1:710">4.12</a> <a class="idx" href="strings.html#idx:portraytext1:1474">5.2.4</a></dd>
1882 <a class="idx" href="DCG.html#idx:portraytext1:711">4.12</a> <a class="idx" href="strings.html#idx:portraytext1:1476">5.2.4</a></dd>
18651883 <dt>precedence</dt>
18661884 <dd>
1867 <a class="idx" href="glossary.html#idx:precedence:2117">D</a></dd>
1885 <a class="idx" href="glossary.html#idx:precedence:2124">D</a></dd>
18681886 <dt>pred/1</dt>
18691887 <dd>
1870 <a class="idx" href="reexport.html#idx:pred1:1566">6.7</a> <a class="idx" href="reexport.html#idx:pred1:1568">6.7</a></dd>
1888 <a class="idx" href="reexport.html#idx:pred1:1568">6.7</a> <a class="idx" href="reexport.html#idx:pred1:1570">6.7</a></dd>
18711889 <dt>predicate</dt>
18721890 <dd>
1873 <a class="idx" href="glossary.html#idx:predicate:2118">D</a></dd>
1891 <a class="idx" href="glossary.html#idx:predicate:2125">D</a></dd>
18741892 <dt>predicate indicator</dt>
18751893 <dd>
1876 <a class="idx" href="preddesc.html#idx:predicateindicator:306">4.1</a> <a class="idx" href="glossary.html#idx:predicateindicator:2119">D</a></dd>
1894 <a class="idx" href="preddesc.html#idx:predicateindicator:307">4.1</a> <a class="idx" href="glossary.html#idx:predicateindicator:2126">D</a></dd>
18771895 <dt>predicate,dynamic</dt>
18781896 <dd>
1879 <a class="idx" href="glossary.html#idx:predicatedynamic:2091">D</a></dd>
1897 <a class="idx" href="glossary.html#idx:predicatedynamic:2095">D</a></dd>
18801898 <dt>predicate,exported</dt>
18811899 <dd>
1882 <a class="idx" href="glossary.html#idx:predicateexported:2093">D</a></dd>
1900 <a class="idx" href="glossary.html#idx:predicateexported:2097">D</a></dd>
18831901 <dt>predicate,imported</dt>
18841902 <dd>
1885 <a class="idx" href="glossary.html#idx:predicateimported:2102">D</a></dd>
1903 <a class="idx" href="glossary.html#idx:predicateimported:2106">D</a></dd>
18861904 <dt><a class="idx" href="predicate_options.html#predicate_options/3">predicate_options/3</a></dt>
18871905 <dt><a class="idx" href="examineprog.html#predicate_property/2">predicate_property/2</a></dt>
18881906 <dd>
1889 <a class="idx" href="consulting.html#idx:predicateproperty2:379">4.3</a> <a class="idx" href="consulting.html#idx:predicateproperty2:417">4.3</a> <a class="idx" href="metacall.html#idx:predicateproperty2:602">4.9</a> <a class="idx" href="dynamic.html#idx:predicateproperty2:787">4.14</a> <a class="idx" href="examineprog.html#idx:predicateproperty2:796">4.15</a> <a class="idx" href="examineprog.html#idx:predicateproperty2:799">4.15</a> <a class="idx" href="examineprog.html#idx:predicateproperty2:803">4.15</a> <a class="idx" href="examineprog.html#idx:predicateproperty2:805">4.15</a> <a class="idx" href="metapred.html#idx:predicateproperty2:1548">6.4</a> <a class="idx" href="manipmodule.html#idx:predicateproperty2:1602">6.14</a></dd>
1907 <a class="idx" href="consulting.html#idx:predicateproperty2:380">4.3</a> <a class="idx" href="consulting.html#idx:predicateproperty2:418">4.3</a> <a class="idx" href="metacall.html#idx:predicateproperty2:603">4.9</a> <a class="idx" href="dynamic.html#idx:predicateproperty2:788">4.14</a> <a class="idx" href="examineprog.html#idx:predicateproperty2:797">4.15</a> <a class="idx" href="examineprog.html#idx:predicateproperty2:800">4.15</a> <a class="idx" href="examineprog.html#idx:predicateproperty2:804">4.15</a> <a class="idx" href="examineprog.html#idx:predicateproperty2:806">4.15</a> <a class="idx" href="metapred.html#idx:predicateproperty2:1550">6.4</a> <a class="idx" href="manipmodule.html#idx:predicateproperty2:1604">6.14</a></dd>
18901908 <dt><a class="idx" href="builtinlist.html#predsort/3">predsort/3</a></dt>
18911909 <dd>
1892 <a class="idx" href="builtinlist.html#idx:predsort3:1231">4.28</a></dd>
1910 <a class="idx" href="builtinlist.html#idx:predsort3:1233">4.28</a></dd>
18931911 <dt><a class="idx" href="lists.html#prefix/2">prefix/2</a></dt>
18941912 <dt><a class="idx" href="termrw.html#print/1">print/1</a></dt>
18951913 <dd>
1896 <a class="idx" href="flags.html#idx:print1:104">2.11</a> <a class="idx" href="termrw.html#idx:print1:1015">4.19</a> <a class="idx" href="termrw.html#idx:print1:1028">4.19</a> <a class="idx" href="termrw.html#idx:print1:1029">4.19</a> <a class="idx" href="termrw.html#idx:print1:1035">4.19</a> <a class="idx" href="termrw.html#idx:print1:1036">4.19</a> <a class="idx" href="termrw.html#idx:print1:1040">4.19</a> <a class="idx" href="format.html#idx:print1:1269">4.31.1</a> <a class="idx" href="format.html#idx:print1:1274">4.31.1</a> <a class="idx" href="format.html#idx:print1:1279">4.31.2</a> <a class="idx" href="foreigninclude.html#idx:print1:1857">10.4.9.2</a> <a class="idx" href="predsummary.html#idx:print1:2158">F.1</a></dd>
1914 <a class="idx" href="flags.html#idx:print1:104">2.11</a> <a class="idx" href="termrw.html#idx:print1:1016">4.19</a> <a class="idx" href="termrw.html#idx:print1:1029">4.19</a> <a class="idx" href="termrw.html#idx:print1:1030">4.19</a> <a class="idx" href="termrw.html#idx:print1:1036">4.19</a> <a class="idx" href="termrw.html#idx:print1:1037">4.19</a> <a class="idx" href="termrw.html#idx:print1:1041">4.19</a> <a class="idx" href="format.html#idx:print1:1271">4.31.1</a> <a class="idx" href="format.html#idx:print1:1276">4.31.1</a> <a class="idx" href="format.html#idx:print1:1281">4.31.2</a> <a class="idx" href="foreigninclude.html#idx:print1:1860">10.4.9.2</a> <a class="idx" href="predsummary.html#idx:print1:2165">F.1</a></dd>
18971915 <dt><a class="idx" href="termrw.html#print/2">print/2</a></dt>
18981916 <dd>
18991917 <a class="idx" href="flags.html#idx:print2:105">2.11</a></dd>
19001918 <dt><a class="idx" href="exception.html#print_message/2">print_message/2</a></dt>
19011919 <dd>
1902 <a class="idx" href="flags.html#idx:printmessage2:74">2.11</a> <a class="idx" href="flags.html#idx:printmessage2:127">2.11</a> <a class="idx" href="hooks.html#idx:printmessage2:140">2.12</a> <a class="idx" href="hooks.html#idx:printmessage2:141">2.12</a> <a class="idx" href="consulting.html#idx:printmessage2:367">4.3</a> <a class="idx" href="consulting.html#idx:printmessage2:461">4.3</a> <a class="idx" href="exception.html#idx:printmessage2:653">4.10.3</a> <a class="idx" href="exception.html#idx:printmessage2:654">4.10.3</a> <a class="idx" href="exception.html#idx:printmessage2:656">4.10.3</a> <a class="idx" href="exception.html#idx:printmessage2:663">4.10.3</a> <a class="idx" href="exception.html#idx:printmessage2:667">4.10.3</a> <a class="idx" href="exception.html#idx:printmessage2:669">4.10.3</a> <a class="idx" href="exception.html#idx:printmessage2:674">4.10.3</a> <a class="idx" href="exception.html#idx:printmessage2:676">4.10.3</a> <a class="idx" href="exception.html#idx:printmessage2:677">4.10.3</a> <a class="idx" href="exception.html#idx:printmessage2:689">4.10.3.1</a> <a class="idx" href="exception.html#idx:printmessage2:690">4.10.3.1</a> <a class="idx" href="termrw.html#idx:printmessage2:1031">4.19</a> <a class="idx" href="termrw.html#idx:printmessage2:1058">4.19</a> <a class="idx" href="termrw.html#idx:printmessage2:1059">4.19</a> <a class="idx" href="memory.html#idx:printmessage2:1433">4.40</a> <a class="idx" href="threadcreate.html#idx:printmessage2:1700">9.1</a> <a class="idx" href="threadcreate.html#idx:printmessage2:1711">9.1</a> <a class="idx" href="predsummary.html#idx:printmessage2:2156">F.1</a></dd>
1920 <a class="idx" href="flags.html#idx:printmessage2:74">2.11</a> <a class="idx" href="flags.html#idx:printmessage2:127">2.11</a> <a class="idx" href="hooks.html#idx:printmessage2:140">2.12</a> <a class="idx" href="hooks.html#idx:printmessage2:141">2.12</a> <a class="idx" href="consulting.html#idx:printmessage2:368">4.3</a> <a class="idx" href="consulting.html#idx:printmessage2:462">4.3</a> <a class="idx" href="exception.html#idx:printmessage2:654">4.10.3</a> <a class="idx" href="exception.html#idx:printmessage2:655">4.10.3</a> <a class="idx" href="exception.html#idx:printmessage2:657">4.10.3</a> <a class="idx" href="exception.html#idx:printmessage2:664">4.10.3</a> <a class="idx" href="exception.html#idx:printmessage2:668">4.10.3</a> <a class="idx" href="exception.html#idx:printmessage2:670">4.10.3</a> <a class="idx" href="exception.html#idx:printmessage2:675">4.10.3</a> <a class="idx" href="exception.html#idx:printmessage2:677">4.10.3</a> <a class="idx" href="exception.html#idx:printmessage2:678">4.10.3</a> <a class="idx" href="exception.html#idx:printmessage2:690">4.10.3.1</a> <a class="idx" href="exception.html#idx:printmessage2:691">4.10.3.1</a> <a class="idx" href="termrw.html#idx:printmessage2:1032">4.19</a> <a class="idx" href="termrw.html#idx:printmessage2:1059">4.19</a> <a class="idx" href="termrw.html#idx:printmessage2:1060">4.19</a> <a class="idx" href="memory.html#idx:printmessage2:1435">4.40</a> <a class="idx" href="threadcreate.html#idx:printmessage2:1703">9.1</a> <a class="idx" href="threadcreate.html#idx:printmessage2:1714">9.1</a> <a class="idx" href="predsummary.html#idx:printmessage2:2163">F.1</a></dd>
19031921 <dt><a class="idx" href="exception.html#print_message_lines/3">print_message_lines/3</a></dt>
19041922 <dd>
1905 <a class="idx" href="exception.html#idx:printmessagelines3:664">4.10.3</a> <a class="idx" href="exception.html#idx:printmessagelines3:678">4.10.3</a> <a class="idx" href="exception.html#idx:printmessagelines3:685">4.10.3</a> <a class="idx" href="exception.html#idx:printmessagelines3:694">4.10.3.1</a> <a class="idx" href="predsummary.html#idx:printmessagelines3:2157">F.1</a></dd>
1923 <a class="idx" href="exception.html#idx:printmessagelines3:665">4.10.3</a> <a class="idx" href="exception.html#idx:printmessagelines3:679">4.10.3</a> <a class="idx" href="exception.html#idx:printmessagelines3:686">4.10.3</a> <a class="idx" href="exception.html#idx:printmessagelines3:695">4.10.3.1</a> <a class="idx" href="predsummary.html#idx:printmessagelines3:2164">F.1</a></dd>
19061924 <dt>priority</dt>
19071925 <dd>
1908 <a class="idx" href="glossary.html#idx:priority:2120">D</a></dd>
1926 <a class="idx" href="glossary.html#idx:priority:2127">D</a></dd>
19091927 <dt>process_create/3</dt>
19101928 <dd>
1911 <a class="idx" href="IO.html#idx:processcreate3:863">4.16.2</a> <a class="idx" href="system.html#idx:processcreate3:1301">4.33</a> <a class="idx" href="system.html#idx:processcreate3:1321">4.33.1</a></dd>
1929 <a class="idx" href="IO.html#idx:processcreate3:864">4.16.2</a> <a class="idx" href="system.html#idx:processcreate3:1303">4.33</a> <a class="idx" href="system.html#idx:processcreate3:1323">4.33.1</a></dd>
19121930 <dt>profile file</dt>
19131931 <dd>
19141932 <a class="idx" href="initfile.html#idx:profilefile:9">2.2</a></dd>
19151933 <dt><a class="idx" href="profile.html#profile/1">profile/1</a></dt>
19161934 <dd>
1917 <a class="idx" href="thutil.html#idx:profile1:1808">9.5.2</a> <a class="idx" href="foreigninclude.html#idx:profile1:1894">10.4.21</a></dd>
1935 <a class="idx" href="thutil.html#idx:profile1:1811">9.5.2</a> <a class="idx" href="foreigninclude.html#idx:profile1:1897">10.4.21</a></dd>
19181936 <dt><a class="idx" href="profile.html#profile/3">profile/3</a></dt>
19191937 <dt><a class="idx" href="profile.html#profiler/2">profiler/2</a></dt>
19201938 <dt>profiling,foreign code</dt>
19211939 <dd>
1922 <a class="idx" href="foreignnotes.html#idx:profilingforeigncode:1902">10.8.3</a></dd>
1940 <a class="idx" href="foreignnotes.html#idx:profilingforeigncode:1905">10.8.3</a></dd>
19231941 <dt>program</dt>
19241942 <dd>
1925 <a class="idx" href="glossary.html#idx:program:2121">D</a></dd>
1943 <a class="idx" href="glossary.html#idx:program:2128">D</a></dd>
19261944 <dt>project_attributes/2</dt>
19271945 <dd>
1928 <a class="idx" href="attvar.html#idx:projectattributes2:1630">7.1.2</a></dd>
1946 <a class="idx" href="attvar.html#idx:projectattributes2:1632">7.1.2</a></dd>
19291947 <dt><a class="idx" href="toplevel.html#prolog/0">prolog/0</a></dt>
19301948 <dd>
1931 <a class="idx" href="cmdline.html#idx:prolog0:27">2.4.4</a> <a class="idx" href="IO.html#idx:prolog0:922">4.16.2</a> <a class="idx" href="toplevel.html#idx:prolog0:1377">4.35</a> <a class="idx" href="toplevel.html#idx:prolog0:1384">4.35</a> <a class="idx" href="toplevel.html#idx:prolog0:1386">4.35</a> <a class="idx" href="mtoplevel.html#idx:prolog0:1564">6.6</a> <a class="idx" href="foreigninclude.html#idx:prolog0:1891">10.4.21</a> <a class="idx" href="manipstack.html#idx:prolog0:1989">B.1</a></dd>
1949 <a class="idx" href="cmdline.html#idx:prolog0:27">2.4.4</a> <a class="idx" href="IO.html#idx:prolog0:923">4.16.2</a> <a class="idx" href="toplevel.html#idx:prolog0:1379">4.35</a> <a class="idx" href="toplevel.html#idx:prolog0:1386">4.35</a> <a class="idx" href="toplevel.html#idx:prolog0:1388">4.35</a> <a class="idx" href="mtoplevel.html#idx:prolog0:1566">6.6</a> <a class="idx" href="foreigninclude.html#idx:prolog0:1894">10.4.21</a> <a class="idx" href="manipstack.html#idx:prolog0:1992">B.1</a></dd>
19321950 <dt><a class="idx" href="debug.html#prolog:assertion_failed/2">prolog:assertion_failed/2</a></dt>
19331951 <dt><a class="idx" href="breakpoint.html#prolog:break_hook/6">prolog:break_hook/6</a></dt>
19341952 <dt><a class="idx" href="prolog_xref.html#prolog:called_by/2">prolog:called_by/2</a></dt>
19391957 <dt><a class="idx" href="exception.html#prolog:message_line_element/2">prolog:message_line_element/2</a></dt>
19401958 <dt><a class="idx" href="manipstack.html#prolog_choice_attribute/3">prolog_choice_attribute/3</a></dt>
19411959 <dd>
1942 <a class="idx" href="manipstack.html#idx:prologchoiceattribute3:1981">B.1</a> <a class="idx" href="tracehook.html#idx:prologchoiceattribute3:1996">B.3</a></dd>
1960 <a class="idx" href="manipstack.html#idx:prologchoiceattribute3:1984">B.1</a> <a class="idx" href="tracehook.html#idx:prologchoiceattribute3:1999">B.3</a></dd>
19431961 <dt><a class="idx" href="manipstack.html#prolog_current_choice/1">prolog_current_choice/1</a></dt>
19441962 <dd>
1945 <a class="idx" href="manipstack.html#idx:prologcurrentchoice1:1987">B.1</a> <a class="idx" href="ancestral-cut.html#idx:prologcurrentchoice1:1991">B.2</a></dd>
1963 <a class="idx" href="manipstack.html#idx:prologcurrentchoice1:1990">B.1</a> <a class="idx" href="ancestral-cut.html#idx:prologcurrentchoice1:1994">B.2</a></dd>
19461964 <dt><a class="idx" href="manipstack.html#prolog_current_frame/1">prolog_current_frame/1</a></dt>
19471965 <dd>
1948 <a class="idx" href="manipstack.html#idx:prologcurrentframe1:1982">B.1</a></dd>
1966 <a class="idx" href="manipstack.html#idx:prologcurrentframe1:1985">B.1</a></dd>
19491967 <dt><a class="idx" href="ancestral-cut.html#prolog_cut_to/1">prolog_cut_to/1</a></dt>
19501968 <dt><a class="idx" href="edit.html#prolog_edit:edit_command/2">prolog_edit:edit_command/2</a></dt>
19511969 <dt><a class="idx" href="edit.html#prolog_edit:edit_source/1">prolog_edit:edit_source/1</a></dt>
19541972 <dt><a class="idx" href="edit.html#prolog_edit:locate/3">prolog_edit:locate/3</a></dt>
19551973 <dt><a class="idx" href="excepthook.html#prolog_exception_hook/4">prolog_exception_hook/4</a></dt>
19561974 <dd>
1957 <a class="idx" href="exception.html#idx:prologexceptionhook4:652">4.10.1</a> <a class="idx" href="memory.html#idx:prologexceptionhook4:1436">4.40</a> <a class="idx" href="excepthook.html#idx:prologexceptionhook4:2007">B.5</a> <a class="idx" href="excepthook.html#idx:prologexceptionhook4:2011">B.5</a></dd>
1975 <a class="idx" href="exception.html#idx:prologexceptionhook4:653">4.10.1</a> <a class="idx" href="memory.html#idx:prologexceptionhook4:1438">4.40</a> <a class="idx" href="excepthook.html#idx:prologexceptionhook4:2010">B.5</a> <a class="idx" href="excepthook.html#idx:prologexceptionhook4:2014">B.5</a></dd>
19581976 <dt><a class="idx" href="consulting.html#prolog_file_type/2">prolog_file_type/2</a></dt>
19591977 <dd>
1960 <a class="idx" href="consulting.html#idx:prologfiletype2:333">4.3</a> <a class="idx" href="consulting.html#idx:prologfiletype2:439">4.3</a> <a class="idx" href="files.html#idx:prologfiletype2:1362">4.34</a></dd>
1978 <a class="idx" href="consulting.html#idx:prologfiletype2:334">4.3</a> <a class="idx" href="consulting.html#idx:prologfiletype2:440">4.3</a> <a class="idx" href="files.html#idx:prologfiletype2:1364">4.34</a></dd>
19611979 <dt><a class="idx" href="manipstack.html#prolog_frame_attribute/3">prolog_frame_attribute/3</a></dt>
19621980 <dd>
1963 <a class="idx" href="examineprog.html#idx:prologframeattribute3:834">4.15</a> <a class="idx" href="tracehook.html#idx:prologframeattribute3:1994">B.3</a> <a class="idx" href="tracehook.html#idx:prologframeattribute3:1995">B.3</a> <a class="idx" href="excepthook.html#idx:prologframeattribute3:2009">B.5</a></dd>
1981 <a class="idx" href="examineprog.html#idx:prologframeattribute3:835">4.15</a> <a class="idx" href="tracehook.html#idx:prologframeattribute3:1997">B.3</a> <a class="idx" href="tracehook.html#idx:prologframeattribute3:1998">B.3</a> <a class="idx" href="excepthook.html#idx:prologframeattribute3:2012">B.5</a></dd>
19641982 <dt>prolog_ide</dt>
19651983 <dd>
19661984 <a class="sec" href="idepreds.html#sec:3.8">3.8</a></dd>
19701988 <dt><a class="idx" href="intlibs.html#prolog_list_goal/1">prolog_list_goal/1</a></dt>
19711989 <dt><a class="idx" href="consulting.html#prolog_load_context/2">prolog_load_context/2</a></dt>
19721990 <dd>
1973 <a class="idx" href="consulting.html#idx:prologloadcontext2:460">4.3</a> <a class="idx" href="termrw.html#idx:prologloadcontext2:1048">4.19</a> <a class="idx" href="dialect.html#idx:prologloadcontext2:2057">C</a></dd>
1991 <a class="idx" href="consulting.html#idx:prologloadcontext2:461">4.3</a> <a class="idx" href="termrw.html#idx:prologloadcontext2:1049">4.19</a> <a class="idx" href="dialect.html#idx:prologloadcontext2:2060">C</a></dd>
19741992 <dt><a class="idx" href="loadfilehook.html#prolog_load_file/2">prolog_load_file/2</a></dt>
19751993 <dd>
1976 <a class="idx" href="consulting.html#idx:prologloadfile2:394">4.3</a> <a class="idx" href="loadfilehook.html#idx:prologloadfile2:2040">B.8</a></dd>
1994 <a class="idx" href="consulting.html#idx:prologloadfile2:395">4.3</a> <a class="idx" href="loadfilehook.html#idx:prologloadfile2:2043">B.8</a></dd>
19771995 <dt><a class="idx" href="tracehook.html#prolog_skip_frame/1">prolog_skip_frame/1</a></dt>
19781996 <dd>
1979 <a class="idx" href="tracehook.html#idx:prologskipframe1:2000">B.3</a> <a class="idx" href="tracehook.html#idx:prologskipframe1:2001">B.3</a></dd>
1997 <a class="idx" href="tracehook.html#idx:prologskipframe1:2003">B.3</a> <a class="idx" href="tracehook.html#idx:prologskipframe1:2004">B.3</a></dd>
19801998 <dt><a class="idx" href="tracehook.html#prolog_skip_level/2">prolog_skip_level/2</a></dt>
19811999 <dd>
1982 <a class="idx" href="tracehook.html#idx:prologskiplevel2:1999">B.3</a></dd>
2000 <a class="idx" href="tracehook.html#idx:prologskiplevel2:2002">B.3</a></dd>
19832001 <dt><a class="idx" href="memory.html#prolog_stack_property/2">prolog_stack_property/2</a></dt>
19842002 <dd>
1985 <a class="idx" href="memory.html#idx:prologstackproperty2:1430">4.40</a></dd>
2003 <a class="idx" href="memory.html#idx:prologstackproperty2:1432">4.40</a></dd>
19862004 <dt><a class="idx" href="files.html#prolog_to_os_filename/2">prolog_to_os_filename/2</a></dt>
19872005 <dd>
1988 <a class="idx" href="projectfiles.html#idx:prologtoosfilename2:265">3.1.1.2</a> <a class="idx" href="projectfiles.html#idx:prologtoosfilename2:266">3.1.1.2</a> <a class="idx" href="system.html#idx:prologtoosfilename2:1325">4.33.1</a> <a class="idx" href="files.html#idx:prologtoosfilename2:1349">4.34</a> <a class="idx" href="files.html#idx:prologtoosfilename2:1366">4.34</a></dd>
2006 <a class="idx" href="projectfiles.html#idx:prologtoosfilename2:265">3.1.1.2</a> <a class="idx" href="projectfiles.html#idx:prologtoosfilename2:266">3.1.1.2</a> <a class="idx" href="system.html#idx:prologtoosfilename2:1327">4.33.1</a> <a class="idx" href="files.html#idx:prologtoosfilename2:1351">4.34</a> <a class="idx" href="files.html#idx:prologtoosfilename2:1368">4.34</a></dd>
19892007 <dt><a class="idx" href="tracehook.html#prolog_trace_interception/4">prolog_trace_interception/4</a></dt>
19902008 <dd>
1991 <a class="idx" href="guitracer.html#idx:prologtraceinterception4:284">3.5</a> <a class="idx" href="debugger.html#idx:prologtraceinterception4:1397">4.37</a> <a class="idx" href="memory.html#idx:prologtraceinterception4:1435">4.40</a> <a class="idx" href="manipstack.html#idx:prologtraceinterception4:1983">B.1</a> <a class="idx" href="manipstack.html#idx:prologtraceinterception4:1986">B.1</a></dd>
2009 <a class="idx" href="guitracer.html#idx:prologtraceinterception4:284">3.5</a> <a class="idx" href="debugger.html#idx:prologtraceinterception4:1399">4.37</a> <a class="idx" href="memory.html#idx:prologtraceinterception4:1437">4.40</a> <a class="idx" href="manipstack.html#idx:prologtraceinterception4:1986">B.1</a> <a class="idx" href="manipstack.html#idx:prologtraceinterception4:1989">B.1</a></dd>
19922010 <dt>prompt, alternatives</dt>
19932011 <dd>
19942012 <a class="idx" href="flags.html#idx:promptalternatives:106">2.11</a></dd>
19952013 <dt><a class="idx" href="termrw.html#prompt/2">prompt/2</a></dt>
19962014 <dd>
1997 <a class="idx" href="termrw.html#idx:prompt2:1069">4.19</a> <a class="idx" href="termrw.html#idx:prompt2:1072">4.19</a> <a class="idx" href="threadcreate.html#idx:prompt2:1704">9.1</a></dd>
2015 <a class="idx" href="termrw.html#idx:prompt2:1070">4.19</a> <a class="idx" href="termrw.html#idx:prompt2:1073">4.19</a> <a class="idx" href="threadcreate.html#idx:prompt2:1707">9.1</a></dd>
19982016 <dt><a class="idx" href="termrw.html#prompt1/1">prompt1/1</a></dt>
19992017 <dt><a class="idx" href="lists.html#proper_length/2">proper_length/2</a></dt>
20002018 <dt>property</dt>
20012019 <dd>
2002 <a class="idx" href="glossary.html#idx:property:2122">D</a></dd>
2020 <a class="idx" href="glossary.html#idx:property:2129">D</a></dd>
20032021 <dt><a class="idx" href="protocol.html#protocol/1">protocol/1</a></dt>
20042022 <dd>
2005 <a class="idx" href="protocol.html#idx:protocol1:1389">4.36</a> <a class="idx" href="protocol.html#idx:protocol1:1390">4.36</a></dd>
2023 <a class="idx" href="protocol.html#idx:protocol1:1391">4.36</a> <a class="idx" href="protocol.html#idx:protocol1:1392">4.36</a></dd>
20062024 <dt><a class="idx" href="protocol.html#protocola/1">protocola/1</a></dt>
20072025 <dd>
2008 <a class="idx" href="protocol.html#idx:protocola1:1391">4.36</a></dd>
2026 <a class="idx" href="protocol.html#idx:protocola1:1393">4.36</a></dd>
20092027 <dt><a class="idx" href="protocol.html#protocolling/1">protocolling/1</a></dt>
20102028 <dt>prove</dt>
20112029 <dd>
2012 <a class="idx" href="glossary.html#idx:prove:2123">D</a></dd>
2030 <a class="idx" href="glossary.html#idx:prove:2130">D</a></dd>
20132031 <dt>public list</dt>
20142032 <dd>
2015 <a class="idx" href="glossary.html#idx:publiclist:2124">D</a></dd>
2033 <a class="idx" href="glossary.html#idx:publiclist:2131">D</a></dd>
20162034 <dt><a class="idx" href="dynamic.html#public/1">public/1</a></dt>
20172035 <dd>
2018 <a class="idx" href="dynamic.html#idx:public1:774">4.14</a> <a class="idx" href="dynamic.html#idx:public1:786">4.14</a> <a class="idx" href="dynamic.html#idx:public1:788">4.14</a> <a class="idx" href="examineprog.html#idx:public1:818">4.15</a> <a class="idx" href="runtime.html#idx:public1:1918">11</a></dd>
2036 <a class="idx" href="dynamic.html#idx:public1:775">4.14</a> <a class="idx" href="dynamic.html#idx:public1:787">4.14</a> <a class="idx" href="dynamic.html#idx:public1:789">4.14</a> <a class="idx" href="examineprog.html#idx:public1:819">4.15</a> <a class="idx" href="runtime.html#idx:public1:1921">11</a></dd>
20192037 <dt><a class="idx" href="chario.html#put/1">put/1</a></dt>
20202038 <dd>
2021 <a class="idx" href="chario.html#idx:put1:962">4.18</a></dd>
2039 <a class="idx" href="chario.html#idx:put1:963">4.18</a></dd>
20222040 <dt><a class="idx" href="chario.html#put/2">put/2</a></dt>
20232041 <dt><a class="idx" href="assoc.html#put_assoc/4">put_assoc/4</a></dt>
20242042 <dt><a class="idx" href="attvar.html#put_attr/3">put_attr/3</a></dt>
20252043 <dd>
2026 <a class="idx" href="attvar.html#idx:putattr3:1623">7.1.1</a> <a class="idx" href="attvar.html#idx:putattr3:1625">7.1.2</a> <a class="idx" href="attvar.html#idx:putattr3:1634">7.1.4</a></dd>
2044 <a class="idx" href="attvar.html#idx:putattr3:1625">7.1.1</a> <a class="idx" href="attvar.html#idx:putattr3:1627">7.1.2</a> <a class="idx" href="attvar.html#idx:putattr3:1636">7.1.4</a></dd>
20272045 <dt><a class="idx" href="attvar.html#put_attrs/2">put_attrs/2</a></dt>
20282046 <dt><a class="idx" href="chario.html#put_byte/1">put_byte/1</a></dt>
20292047 <dt><a class="idx" href="chario.html#put_byte/2">put_byte/2</a></dt>
20302048 <dt>put_byte/[1,2]</dt>
20312049 <dd>
2032 <a class="idx" href="chars.html#idx:putbyte12:326">4.2</a></dd>
2050 <a class="idx" href="chars.html#idx:putbyte12:327">4.2</a></dd>
20332051 <dt><a class="idx" href="chario.html#put_char/1">put_char/1</a></dt>
20342052 <dd>
2035 <a class="idx" href="chario.html#idx:putchar1:960">4.18</a> <a class="idx" href="chario.html#idx:putchar1:963">4.18</a></dd>
2053 <a class="idx" href="chario.html#idx:putchar1:961">4.18</a> <a class="idx" href="chario.html#idx:putchar1:964">4.18</a></dd>
20362054 <dt><a class="idx" href="chario.html#put_char/2">put_char/2</a></dt>
20372055 <dt>put_char/[1,2]</dt>
20382056 <dd>
2039 <a class="idx" href="chars.html#idx:putchar12:325">4.2</a></dd>
2057 <a class="idx" href="chars.html#idx:putchar12:326">4.2</a></dd>
20402058 <dt><a class="idx" href="chario.html#put_code/1">put_code/1</a></dt>
20412059 <dd>
2042 <a class="idx" href="chario.html#idx:putcode1:961">4.18</a> <a class="idx" href="chario.html#idx:putcode1:964">4.18</a></dd>
2060 <a class="idx" href="chario.html#idx:putcode1:962">4.18</a> <a class="idx" href="chario.html#idx:putcode1:965">4.18</a></dd>
20432061 <dt><a class="idx" href="chario.html#put_code/2">put_code/2</a></dt>
20442062 <dd>
2045 <a class="idx" href="widechars.html#idx:putcode2:233">2.18.1</a> <a class="idx" href="chario.html#idx:putcode2:990">4.18</a> <a class="idx" href="chario.html#idx:putcode2:993">4.18</a> <a class="idx" href="chario.html#idx:putcode2:995">4.18</a></dd>
2063 <a class="idx" href="widechars.html#idx:putcode2:233">2.18.1</a> <a class="idx" href="chario.html#idx:putcode2:991">4.18</a> <a class="idx" href="chario.html#idx:putcode2:994">4.18</a> <a class="idx" href="chario.html#idx:putcode2:996">4.18</a></dd>
20462064 <dt>put_code/[1,2]</dt>
20472065 <dd>
2048 <a class="idx" href="chars.html#idx:putcode12:324">4.2</a></dd>
2066 <a class="idx" href="chars.html#idx:putcode12:325">4.2</a></dd>
20492067 <dt><a class="idx" href="dicts.html#put_dict/3">put_dict/3</a></dt>
20502068 <dd>
2051 <a class="idx" href="dicts.html#idx:putdict3:1491">5.4.1.2</a></dd>
2069 <a class="idx" href="dicts.html#idx:putdict3:1493">5.4.1.2</a></dd>
20522070 <dt><a class="idx" href="dicts.html#put_dict/4">put_dict/4</a></dt>
20532071 <dd>
2054 <a class="idx" href="dicts.html#idx:putdict4:1492">5.4.1.2</a></dd>
2072 <a class="idx" href="dicts.html#idx:putdict4:1494">5.4.1.2</a></dd>
20552073 <dt><a class="idx" href="consulting.html#qcompile/1">qcompile/1</a></dt>
20562074 <dd>
2057 <a class="idx" href="swiorother.html#idx:qcompile1:2">1.3</a> <a class="idx" href="consulting.html#idx:qcompile1:343">4.3</a> <a class="idx" href="consulting.html#idx:qcompile1:374">4.3</a> <a class="idx" href="consulting.html#idx:qcompile1:381">4.3</a> <a class="idx" href="consulting.html#idx:qcompile1:383">4.3</a> <a class="idx" href="consulting.html#idx:qcompile1:475">4.3</a> <a class="idx" href="consulting.html#idx:qcompile1:529">4.3.3</a> <a class="idx" href="consulting.html#idx:qcompile1:536">4.3.3</a> <a class="idx" href="guidelines.html#idx:qcompile1:1688">8.7</a></dd>
2075 <a class="idx" href="swiorother.html#idx:qcompile1:2">1.3</a> <a class="idx" href="consulting.html#idx:qcompile1:344">4.3</a> <a class="idx" href="consulting.html#idx:qcompile1:375">4.3</a> <a class="idx" href="consulting.html#idx:qcompile1:382">4.3</a> <a class="idx" href="consulting.html#idx:qcompile1:384">4.3</a> <a class="idx" href="consulting.html#idx:qcompile1:476">4.3</a> <a class="idx" href="consulting.html#idx:qcompile1:530">4.3.3</a> <a class="idx" href="consulting.html#idx:qcompile1:537">4.3.3</a> <a class="idx" href="guidelines.html#idx:qcompile1:1691">8.7</a></dd>
20582076 <dt><a class="idx" href="consulting.html#qcompile/2">qcompile/2</a></dt>
20592077 <dt><a class="idx" href="runtime.html#qsave_program/1">qsave_program/1</a></dt>
20602078 <dd>
2061 <a class="idx" href="flags.html#idx:qsaveprogram1:80">2.11</a> <a class="idx" href="consulting.html#idx:qsaveprogram1:466">4.3</a> <a class="idx" href="consulting.html#idx:qsaveprogram1:469">4.3</a></dd>
2079 <a class="idx" href="flags.html#idx:qsaveprogram1:80">2.11</a> <a class="idx" href="consulting.html#idx:qsaveprogram1:467">4.3</a> <a class="idx" href="consulting.html#idx:qsaveprogram1:470">4.3</a></dd>
20622080 <dt><a class="idx" href="runtime.html#qsave_program/2">qsave_program/2</a></dt>
20632081 <dd>
2064 <a class="idx" href="swiorother.html#idx:qsaveprogram2:3">1.3</a> <a class="idx" href="compilation.html#idx:qsaveprogram2:58">2.10.2.4</a> <a class="idx" href="compilation.html#idx:qsaveprogram2:59">2.10.2.4</a> <a class="idx" href="compilation.html#idx:qsaveprogram2:60">2.10.2.4</a> <a class="idx" href="flags.html#idx:qsaveprogram2:86">2.11</a> <a class="idx" href="autoload.html#idx:qsaveprogram2:177">2.13</a> <a class="idx" href="projectfiles.html#idx:qsaveprogram2:271">3.1.2</a> <a class="idx" href="idepreds.html#idx:qsaveprogram2:295">3.8</a> <a class="idx" href="runtime.html#idx:qsaveprogram2:1905">11</a> <a class="idx" href="useresource.html#idx:qsaveprogram2:1926">11.3</a></dd>
2082 <a class="idx" href="swiorother.html#idx:qsaveprogram2:3">1.3</a> <a class="idx" href="compilation.html#idx:qsaveprogram2:58">2.10.2.4</a> <a class="idx" href="compilation.html#idx:qsaveprogram2:59">2.10.2.4</a> <a class="idx" href="compilation.html#idx:qsaveprogram2:60">2.10.2.4</a> <a class="idx" href="flags.html#idx:qsaveprogram2:86">2.11</a> <a class="idx" href="autoload.html#idx:qsaveprogram2:177">2.13</a> <a class="idx" href="projectfiles.html#idx:qsaveprogram2:271">3.1.2</a> <a class="idx" href="idepreds.html#idx:qsaveprogram2:295">3.8</a> <a class="idx" href="runtime.html#idx:qsaveprogram2:1908">11</a> <a class="idx" href="useresource.html#idx:qsaveprogram2:1929">11.3</a></dd>
20652083 <dt>qsave_program/[1,2]</dt>
20662084 <dd>
2067 <a class="idx" href="cmdline.html#idx:qsaveprogram12:20">2.4.2</a> <a class="idx" href="compilation.html#idx:qsaveprogram12:57">2.10.2.3</a> <a class="idx" href="flags.html#idx:qsaveprogram12:110">2.11</a> <a class="idx" href="examineprog.html#idx:qsaveprogram12:825">4.15</a> <a class="idx" href="foreignlink.html#idx:qsaveprogram12:1823">10.2.2</a> <a class="idx" href="foreigninclude.html#idx:qsaveprogram12:1890">10.4.21</a> <a class="idx" href="findhome.html#idx:qsaveprogram12:1897">10.6</a> <a class="idx" href="runtime.html#idx:qsaveprogram12:1910">11</a> <a class="idx" href="qsavelimits.html#idx:qsaveprogram12:1919">11.1</a></dd>
2085 <a class="idx" href="cmdline.html#idx:qsaveprogram12:20">2.4.2</a> <a class="idx" href="compilation.html#idx:qsaveprogram12:57">2.10.2.3</a> <a class="idx" href="flags.html#idx:qsaveprogram12:110">2.11</a> <a class="idx" href="examineprog.html#idx:qsaveprogram12:826">4.15</a> <a class="idx" href="foreignlink.html#idx:qsaveprogram12:1826">10.2.2</a> <a class="idx" href="foreigninclude.html#idx:qsaveprogram12:1893">10.4.21</a> <a class="idx" href="findhome.html#idx:qsaveprogram12:1900">10.6</a> <a class="idx" href="runtime.html#idx:qsaveprogram12:1913">11</a> <a class="idx" href="qsavelimits.html#idx:qsaveprogram12:1922">11.1</a></dd>
20682086 <dt><a class="idx" href="quasiquotations.html#quasi_quotation_syntax/1">quasi_quotation_syntax/1</a></dt>
20692087 <dd>
2070 <a class="idx" href="examineprog.html#idx:quasiquotationsyntax1:819">4.15</a></dd>
2088 <a class="idx" href="examineprog.html#idx:quasiquotationsyntax1:820">4.15</a></dd>
20712089 <dt><a class="idx" href="quasiquotations.html#quasi_quotation_syntax_error/1">quasi_quotation_syntax_error/1</a></dt>
20722090 <dt>query</dt>
20732091 <dd>
2074 <a class="idx" href="glossary.html#idx:query:2098">D</a></dd>
2092 <a class="idx" href="glossary.html#idx:query:2102">D</a></dd>
20752093 <dt>quiet</dt>
20762094 <dd>
20772095 <a class="idx" href="cmdline.html#idx:quiet:15">2.4.2</a></dd>
20832101 <dt><a class="idx" href="random.html#random_permutation/2">random_permutation/2</a></dt>
20842102 <dt><a class="idx" href="miscarith.html#random_property/1">random_property/1</a></dt>
20852103 <dd>
2086 <a class="idx" href="miscarith.html#idx:randomproperty1:1218">4.27</a></dd>
2104 <a class="idx" href="miscarith.html#idx:randomproperty1:1220">4.27</a></dd>
20872105 <dt><a class="idx" href="random.html#random_select/3">random_select/3</a></dt>
20882106 <dt><a class="idx" href="random.html#randseq/3">randseq/3</a></dt>
20892107 <dt><a class="idx" href="random.html#randset/3">randset/3</a></dt>
20922110 <a class="idx" href="cyclic.html#idx:rationaltrees:196">2.16</a></dd>
20932111 <dt>rational,number</dt>
20942112 <dd>
2095 <a class="idx" href="arith.html#idx:rationalnumber:1206">4.26.2.1</a></dd>
2113 <a class="idx" href="arith.html#idx:rationalnumber:1208">4.26.2.1</a></dd>
20962114 <dt><a class="idx" href="typetest.html#rational/1">rational/1</a></dt>
20972115 <dt><a class="idx" href="typetest.html#rational/3">rational/3</a></dt>
20982116 <dd>
2099 <a class="idx" href="arith.html#idx:rational3:1211">4.26.2.1</a></dd>
2117 <a class="idx" href="arith.html#idx:rational3:1213">4.26.2.1</a></dd>
21002118 <dt>rb_new/1</dt>
21012119 <dd>
21022120 <a class="idx" href="flags.html#idx:rbnew1:114">2.11</a></dd>
21032121 <dt><a class="idx" href="ugraphs.html#reachable/3">reachable/3</a></dt>
21042122 <dt><a class="idx" href="termrw.html#read/1">read/1</a></dt>
21052123 <dd>
2106 <a class="idx" href="flags.html#idx:read1:66">2.11</a> <a class="idx" href="flags.html#idx:read1:72">2.11</a> <a class="idx" href="limits.html#idx:read1:250">2.19.2</a> <a class="idx" href="limits.html#idx:read1:252">2.19.2</a> <a class="idx" href="IO.html#idx:read1:845">4.16.1</a> <a class="idx" href="IO.html#idx:read1:861">4.16.2</a> <a class="idx" href="IO.html#idx:read1:870">4.16.2</a> <a class="idx" href="chario.html#idx:read1:966">4.18</a> <a class="idx" href="termrw.html#idx:read1:1027">4.19</a> <a class="idx" href="termrw.html#idx:read1:1041">4.19</a> <a class="idx" href="termrw.html#idx:read1:1049">4.19</a> <a class="idx" href="termrw.html#idx:read1:1071">4.19</a> <a class="idx" href="debugger.html#idx:read1:1412">4.37</a> <a class="idx" href="gvar.html#idx:read1:1670">7.3.1</a> <a class="idx" href="readutil.html#idx:read1:1968">A.28</a> <a class="idx" href="predsummary.html#idx:read1:2164">F.1</a></dd>
2124 <a class="idx" href="flags.html#idx:read1:66">2.11</a> <a class="idx" href="flags.html#idx:read1:72">2.11</a> <a class="idx" href="limits.html#idx:read1:250">2.19.2</a> <a class="idx" href="limits.html#idx:read1:252">2.19.2</a> <a class="idx" href="IO.html#idx:read1:846">4.16.1</a> <a class="idx" href="IO.html#idx:read1:862">4.16.2</a> <a class="idx" href="IO.html#idx:read1:871">4.16.2</a> <a class="idx" href="chario.html#idx:read1:967">4.18</a> <a class="idx" href="termrw.html#idx:read1:1028">4.19</a> <a class="idx" href="termrw.html#idx:read1:1042">4.19</a> <a class="idx" href="termrw.html#idx:read1:1050">4.19</a> <a class="idx" href="termrw.html#idx:read1:1072">4.19</a> <a class="idx" href="debugger.html#idx:read1:1414">4.37</a> <a class="idx" href="gvar.html#idx:read1:1673">7.3.1</a> <a class="idx" href="readutil.html#idx:read1:1971">A.28</a> <a class="idx" href="predsummary.html#idx:read1:2171">F.1</a></dd>
21072125 <dt><a class="idx" href="termrw.html#read/2">read/2</a></dt>
21082126 <dd>
2109 <a class="idx" href="streamstat.html#idx:read2:956">4.17</a></dd>
2127 <a class="idx" href="streamstat.html#idx:read2:957">4.17</a></dd>
21102128 <dt><a class="idx" href="termrw.html#read_clause/3">read_clause/3</a></dt>
21112129 <dd>
2112 <a class="idx" href="syntax.html#idx:readclause3:194">2.15.2.5</a> <a class="idx" href="debugger.html#idx:readclause3:1411">4.37</a></dd>
2130 <a class="idx" href="syntax.html#idx:readclause3:194">2.15.2.5</a> <a class="idx" href="debugger.html#idx:readclause3:1413">4.37</a></dd>
21132131 <dt><a class="idx" href="readutil.html#read_file_to_codes/3">read_file_to_codes/3</a></dt>
21142132 <dt><a class="idx" href="readutil.html#read_file_to_terms/3">read_file_to_terms/3</a></dt>
21152133 <dt><a class="idx" href="charsio.html#read_from_chars/2">read_from_chars/2</a></dt>
21162134 <dd>
2117 <a class="idx" href="manipatom.html#idx:readfromchars2:1132">4.21</a></dd>
2135 <a class="idx" href="manipatom.html#idx:readfromchars2:1133">4.21</a></dd>
21182136 <dt><a class="idx" href="termrw.html#read_history/6">read_history/6</a></dt>
21192137 <dd>
2120 <a class="idx" href="termrw.html#idx:readhistory6:1068">4.19</a> <a class="idx" href="termrw.html#idx:readhistory6:1070">4.19</a></dd>
2138 <a class="idx" href="termrw.html#idx:readhistory6:1069">4.19</a> <a class="idx" href="termrw.html#idx:readhistory6:1071">4.19</a></dd>
21212139 <dt><a class="idx" href="readutil.html#read_line_to_codes/2">read_line_to_codes/2</a></dt>
21222140 <dd>
2123 <a class="idx" href="strings.html#idx:readlinetocodes2:1463">5.2.2</a> <a class="idx" href="readutil.html#idx:readlinetocodes2:1963">A.28</a></dd>
2141 <a class="idx" href="strings.html#idx:readlinetocodes2:1465">5.2.2</a> <a class="idx" href="readutil.html#idx:readlinetocodes2:1966">A.28</a></dd>
21242142 <dt><a class="idx" href="readutil.html#read_line_to_codes/3">read_line_to_codes/3</a></dt>
21252143 <dd>
2126 <a class="idx" href="readutil.html#idx:readlinetocodes3:1961">A.28</a></dd>
2144 <a class="idx" href="readutil.html#idx:readlinetocodes3:1964">A.28</a></dd>
21272145 <dt><a class="idx" href="files.html#read_link/3">read_link/3</a></dt>
21282146 <dt><a class="idx" href="chario.html#read_pending_input/3">read_pending_input/3</a></dt>
21292147 <dt><a class="idx" href="readutil.html#read_stream_to_codes/2">read_stream_to_codes/2</a></dt>
21302148 <dd>
2131 <a class="idx" href="readutil.html#idx:readstreamtocodes2:1964">A.28</a></dd>
2149 <a class="idx" href="readutil.html#idx:readstreamtocodes2:1967">A.28</a></dd>
21322150 <dt><a class="idx" href="readutil.html#read_stream_to_codes/3">read_stream_to_codes/3</a></dt>
21332151 <dt><a class="idx" href="strings.html#read_string/3">read_string/3</a></dt>
21342152 <dt><a class="idx" href="strings.html#read_string/5">read_string/5</a></dt>
21352153 <dd>
2136 <a class="idx" href="strings.html#idx:readstring5:1456">5.2.1</a> <a class="idx" href="strings.html#idx:readstring5:1460">5.2.1</a></dd>
2154 <a class="idx" href="strings.html#idx:readstring5:1458">5.2.1</a> <a class="idx" href="strings.html#idx:readstring5:1462">5.2.1</a></dd>
21372155 <dt><a class="idx" href="termrw.html#read_term/2">read_term/2</a></dt>
21382156 <dd>
2139 <a class="idx" href="flags.html#idx:readterm2:67">2.11</a> <a class="idx" href="consulting.html#idx:readterm2:457">4.3</a> <a class="idx" href="consulting.html#idx:readterm2:509">4.3.1.1</a> <a class="idx" href="termrw.html#idx:readterm2:1006">4.19</a> <a class="idx" href="termrw.html#idx:readterm2:1019">4.19</a> <a class="idx" href="termrw.html#idx:readterm2:1053">4.19</a> <a class="idx" href="termrw.html#idx:readterm2:1064">4.19</a> <a class="idx" href="termrw.html#idx:readterm2:1067">4.19</a> <a class="idx" href="manipatom.html#idx:readterm2:1150">4.21</a> <a class="idx" href="manipatom.html#idx:readterm2:1151">4.21</a> <a class="idx" href="ext-lists.html#idx:readterm2:1443">5.1</a> <a class="idx" href="ext-lists.html#idx:readterm2:1445">5.1</a> <a class="idx" href="strings.html#idx:readterm2:1450">5.2.1</a> <a class="idx" href="loadfilehook.html#idx:readterm2:2042">B.8</a> <a class="idx" href="loadfilehook.html#idx:readterm2:2043">B.8</a></dd>
2157 <a class="idx" href="flags.html#idx:readterm2:67">2.11</a> <a class="idx" href="consulting.html#idx:readterm2:458">4.3</a> <a class="idx" href="consulting.html#idx:readterm2:510">4.3.1.1</a> <a class="idx" href="termrw.html#idx:readterm2:1007">4.19</a> <a class="idx" href="termrw.html#idx:readterm2:1020">4.19</a> <a class="idx" href="termrw.html#idx:readterm2:1054">4.19</a> <a class="idx" href="termrw.html#idx:readterm2:1065">4.19</a> <a class="idx" href="termrw.html#idx:readterm2:1068">4.19</a> <a class="idx" href="manipatom.html#idx:readterm2:1151">4.21</a> <a class="idx" href="manipatom.html#idx:readterm2:1152">4.21</a> <a class="idx" href="ext-lists.html#idx:readterm2:1445">5.1</a> <a class="idx" href="ext-lists.html#idx:readterm2:1447">5.1</a> <a class="idx" href="strings.html#idx:readterm2:1452">5.2.1</a> <a class="idx" href="loadfilehook.html#idx:readterm2:2045">B.8</a> <a class="idx" href="loadfilehook.html#idx:readterm2:2046">B.8</a></dd>
21402158 <dt><a class="idx" href="termrw.html#read_term/3">read_term/3</a></dt>
21412159 <dd>
2142 <a class="idx" href="syntax.html#idx:readterm3:195">2.15.2.5</a> <a class="idx" href="termrw.html#idx:readterm3:1016">4.19</a> <a class="idx" href="termrw.html#idx:readterm3:1042">4.19</a> <a class="idx" href="termrw.html#idx:readterm3:1043">4.19</a> <a class="idx" href="termrw.html#idx:readterm3:1044">4.19</a> <a class="idx" href="termrw.html#idx:readterm3:1045">4.19</a> <a class="idx" href="termrw.html#idx:readterm3:1046">4.19</a> <a class="idx" href="termrw.html#idx:readterm3:1047">4.19</a> <a class="idx" href="termrw.html#idx:readterm3:1057">4.19</a> <a class="idx" href="termrw.html#idx:readterm3:1065">4.19</a> <a class="idx" href="charconv.html#idx:readterm3:1198">4.25</a> <a class="idx" href="toplevel.html#idx:readterm3:1385">4.35</a> <a class="idx" href="dicts.html#idx:readterm3:1504">5.4.3</a> <a class="idx" href="loadfilehook.html#idx:readterm3:2045">B.8</a></dd>
2160 <a class="idx" href="syntax.html#idx:readterm3:195">2.15.2.5</a> <a class="idx" href="termrw.html#idx:readterm3:1017">4.19</a> <a class="idx" href="termrw.html#idx:readterm3:1043">4.19</a> <a class="idx" href="termrw.html#idx:readterm3:1044">4.19</a> <a class="idx" href="termrw.html#idx:readterm3:1045">4.19</a> <a class="idx" href="termrw.html#idx:readterm3:1046">4.19</a> <a class="idx" href="termrw.html#idx:readterm3:1047">4.19</a> <a class="idx" href="termrw.html#idx:readterm3:1048">4.19</a> <a class="idx" href="termrw.html#idx:readterm3:1058">4.19</a> <a class="idx" href="termrw.html#idx:readterm3:1066">4.19</a> <a class="idx" href="charconv.html#idx:readterm3:1199">4.25</a> <a class="idx" href="toplevel.html#idx:readterm3:1387">4.35</a> <a class="idx" href="dicts.html#idx:readterm3:1506">5.4.3</a> <a class="idx" href="loadfilehook.html#idx:readterm3:2048">B.8</a></dd>
21432161 <dt>read_term/[2,3]</dt>
21442162 <dd>
2145 <a class="idx" href="termrw.html#idx:readterm23:1060">4.19</a> <a class="idx" href="termrw.html#idx:readterm23:1061">4.19</a></dd>
2163 <a class="idx" href="termrw.html#idx:readterm23:1061">4.19</a> <a class="idx" href="termrw.html#idx:readterm23:1062">4.19</a></dd>
21462164 <dt><a class="idx" href="termrw.html#read_term_from_atom/3">read_term_from_atom/3</a></dt>
21472165 <dd>
2148 <a class="idx" href="manipatom.html#idx:readtermfromatom3:1152">4.21</a></dd>
2166 <a class="idx" href="manipatom.html#idx:readtermfromatom3:1153">4.21</a></dd>
21492167 <dt><a class="idx" href="charsio.html#read_term_from_chars/3">read_term_from_chars/3</a></dt>
21502168 <dt>reconsult</dt>
21512169 <dd>
2152 <a class="idx" href="consulting.html#idx:reconsult:347">4.3</a></dd>
2170 <a class="idx" href="consulting.html#idx:reconsult:348">4.3</a></dd>
21532171 <dt><a class="idx" href="record.html#record/1">record/1</a></dt>
21542172 <dd>
2155 <a class="idx" href="record.html#idx:record1:1972">A.29</a></dd>
2173 <a class="idx" href="record.html#idx:record1:1975">A.29</a></dd>
21562174 <dt><a class="idx" href="db.html#recorda/2">recorda/2</a></dt>
21572175 <dd>
2158 <a class="idx" href="db.html#idx:recorda2:744">4.13</a></dd>
2176 <a class="idx" href="db.html#idx:recorda2:745">4.13</a></dd>
21592177 <dt><a class="idx" href="db.html#recorda/3">recorda/3</a></dt>
21602178 <dd>
2161 <a class="idx" href="cyclic.html#idx:recorda3:212">2.16</a> <a class="idx" href="db.html#idx:recorda3:743">4.13</a> <a class="idx" href="db.html#idx:recorda3:747">4.13</a> <a class="idx" href="examineprog.html#idx:recorda3:793">4.15</a> <a class="idx" href="gvar.html#idx:recorda3:1651">7.3</a> <a class="idx" href="foreigninclude.html#idx:recorda3:1865">10.4.14.2</a> <a class="idx" href="foreigninclude.html#idx:recorda3:1866">10.4.14.2</a> <a class="idx" href="foreigninclude.html#idx:recorda3:1867">10.4.14.2</a></dd>
2179 <a class="idx" href="cyclic.html#idx:recorda3:212">2.16</a> <a class="idx" href="db.html#idx:recorda3:744">4.13</a> <a class="idx" href="db.html#idx:recorda3:748">4.13</a> <a class="idx" href="examineprog.html#idx:recorda3:794">4.15</a> <a class="idx" href="gvar.html#idx:recorda3:1654">7.3</a> <a class="idx" href="foreigninclude.html#idx:recorda3:1868">10.4.14.2</a> <a class="idx" href="foreigninclude.html#idx:recorda3:1869">10.4.14.2</a> <a class="idx" href="foreigninclude.html#idx:recorda3:1870">10.4.14.2</a></dd>
21622180 <dt><a class="idx" href="db.html#recorded/2">recorded/2</a></dt>
21632181 <dt><a class="idx" href="db.html#recorded/3">recorded/3</a></dt>
21642182 <dd>
2165 <a class="idx" href="db.html#idx:recorded3:749">4.13</a> <a class="idx" href="qsavelimits.html#idx:recorded3:1922">11.1</a></dd>
2183 <a class="idx" href="db.html#idx:recorded3:750">4.13</a> <a class="idx" href="qsavelimits.html#idx:recorded3:1925">11.1</a></dd>
21662184 <dt><a class="idx" href="db.html#recordz/2">recordz/2</a></dt>
21672185 <dd>
2168 <a class="idx" href="db.html#idx:recordz2:745">4.13</a></dd>
2186 <a class="idx" href="db.html#idx:recordz2:746">4.13</a></dd>
21692187 <dt><a class="idx" href="db.html#recordz/3">recordz/3</a></dt>
21702188 <dd>
2171 <a class="idx" href="cyclic.html#idx:recordz3:213">2.16</a> <a class="idx" href="db.html#idx:recordz3:748">4.13</a></dd>
2189 <a class="idx" href="cyclic.html#idx:recordz3:213">2.16</a> <a class="idx" href="db.html#idx:recordz3:749">4.13</a></dd>
21722190 <dt><a class="idx" href="db.html#redefine_system_predicate/1">redefine_system_predicate/1</a></dt>
21732191 <dd>
2174 <a class="idx" href="glossary.html#idx:redefinesystempredicate1:2080">D</a></dd>
2192 <a class="idx" href="glossary.html#idx:redefinesystempredicate1:2083">D</a></dd>
21752193 <dt><a class="idx" href="reexport.html#reexport/1">reexport/1</a></dt>
21762194 <dd>
2177 <a class="idx" href="consulting.html#idx:reexport1:353">4.3</a> <a class="idx" href="consulting.html#idx:reexport1:359">4.3</a> <a class="idx" href="consulting.html#idx:reexport1:385">4.3</a> <a class="idx" href="dialect.html#idx:reexport1:2055">C</a></dd>
2195 <a class="idx" href="consulting.html#idx:reexport1:354">4.3</a> <a class="idx" href="consulting.html#idx:reexport1:360">4.3</a> <a class="idx" href="consulting.html#idx:reexport1:386">4.3</a> <a class="idx" href="dialect.html#idx:reexport1:2058">C</a></dd>
21782196 <dt><a class="idx" href="reexport.html#reexport/2">reexport/2</a></dt>
21792197 <dd>
2180 <a class="idx" href="consulting.html#idx:reexport2:360">4.3</a> <a class="idx" href="consulting.html#idx:reexport2:377">4.3</a> <a class="idx" href="consulting.html#idx:reexport2:386">4.3</a> <a class="idx" href="dialect.html#idx:reexport2:2056">C</a></dd>
2198 <a class="idx" href="consulting.html#idx:reexport2:361">4.3</a> <a class="idx" href="consulting.html#idx:reexport2:378">4.3</a> <a class="idx" href="consulting.html#idx:reexport2:387">4.3</a> <a class="idx" href="dialect.html#idx:reexport2:2059">C</a></dd>
21812199 <dt>registry</dt>
21822200 <dd>
21832201 <a class="idx" href="limits.html#idx:registry:245">2.19.1</a></dd>
21932211 <a class="idx" href="autoload.html#idx:reloadlibraryindex0:162">2.13</a> <a class="idx" href="autoload.html#idx:reloadlibraryindex0:171">2.13</a> <a class="idx" href="autoload.html#idx:reloadlibraryindex0:176">2.13</a></dd>
21942212 <dt><a class="idx" href="files.html#rename_file/2">rename_file/2</a></dt>
21952213 <dd>
2196 <a class="idx" href="system.html#idx:renamefile2:1299">4.33</a></dd>
2214 <a class="idx" href="system.html#idx:renamefile2:1301">4.33</a></dd>
21972215 <dt><a class="idx" href="control.html#repeat/0">repeat/0</a></dt>
21982216 <dd>
2199 <a class="idx" href="control.html#idx:repeat0:593">4.8</a> <a class="idx" href="metacall.html#idx:repeat0:607">4.9</a> <a class="idx" href="metacall.html#idx:repeat0:620">4.9</a></dd>
2217 <a class="idx" href="control.html#idx:repeat0:594">4.8</a> <a class="idx" href="metacall.html#idx:repeat0:608">4.9</a> <a class="idx" href="metacall.html#idx:repeat0:621">4.9</a></dd>
22002218 <dt>representation_error/1</dt>
22012219 <dd>
2202 <a class="idx" href="foreigninclude.html#idx:representationerror1:1843">10.4.6</a></dd>
2220 <a class="idx" href="foreigninclude.html#idx:representationerror1:1846">10.4.6</a></dd>
22032221 <dt><a class="idx" href="consulting.html#require/1">require/1</a></dt>
22042222 <dd>
2205 <a class="idx" href="dialect.html#idx:require1:2052">C</a></dd>
2223 <a class="idx" href="dialect.html#idx:require1:2055">C</a></dd>
22062224 <dt><a class="idx" href="gensym.html#reset_gensym/0">reset_gensym/0</a></dt>
22072225 <dt><a class="idx" href="gensym.html#reset_gensym/1">reset_gensym/1</a></dt>
22082226 <dt><a class="idx" href="profile.html#reset_profiler/0">reset_profiler/0</a></dt>
22092227 <dt><a class="idx" href="useresource.html#resource/3">resource/3</a></dt>
22102228 <dd>
2211 <a class="idx" href="flags.html#idx:resource3:108">2.11</a> <a class="idx" href="runtime.html#idx:resource3:1903">11</a> <a class="idx" href="runtime.html#idx:resource3:1906">11</a> <a class="idx" href="useresource.html#idx:resource3:1927">11.3</a> <a class="idx" href="useresource.html#idx:resource3:1934">11.3.1</a> <a class="idx" href="useresource.html#idx:resource3:1935">11.3.1</a></dd>
2229 <a class="idx" href="flags.html#idx:resource3:108">2.11</a> <a class="idx" href="runtime.html#idx:resource3:1906">11</a> <a class="idx" href="runtime.html#idx:resource3:1909">11</a> <a class="idx" href="useresource.html#idx:resource3:1930">11.3</a> <a class="idx" href="useresource.html#idx:resource3:1937">11.3.1</a> <a class="idx" href="useresource.html#idx:resource3:1938">11.3.1</a></dd>
22122230 <dt>resource_error/1</dt>
22132231 <dd>
2214 <a class="idx" href="foreigninclude.html#idx:resourceerror1:1848">10.4.6</a></dd>
2232 <a class="idx" href="foreigninclude.html#idx:resourceerror1:1851">10.4.6</a></dd>
22152233 <dt>retract</dt>
22162234 <dd>
2217 <a class="idx" href="glossary.html#idx:retract:2125">D</a></dd>
2235 <a class="idx" href="glossary.html#idx:retract:2132">D</a></dd>
22182236 <dt><a class="idx" href="db.html#retract/1">retract/1</a></dt>
22192237 <dd>
2220 <a class="idx" href="consulting.html#idx:retract1:341">4.3</a> <a class="idx" href="consulting.html#idx:retract1:430">4.3</a> <a class="idx" href="db.html#idx:retract1:716">4.13</a> <a class="idx" href="db.html#idx:retract1:720">4.13</a> <a class="idx" href="db.html#idx:retract1:762">4.13.1</a> <a class="idx" href="dynamic.html#idx:retract1:777">4.14</a> <a class="idx" href="dynamic.html#idx:retract1:783">4.14</a> <a class="idx" href="examineprog.html#idx:retract1:808">4.15</a> <a class="idx" href="threadcom.html#idx:retract1:1775">9.3.3</a></dd>
2238 <a class="idx" href="consulting.html#idx:retract1:342">4.3</a> <a class="idx" href="consulting.html#idx:retract1:431">4.3</a> <a class="idx" href="db.html#idx:retract1:717">4.13</a> <a class="idx" href="db.html#idx:retract1:721">4.13</a> <a class="idx" href="db.html#idx:retract1:763">4.13.1</a> <a class="idx" href="dynamic.html#idx:retract1:778">4.14</a> <a class="idx" href="dynamic.html#idx:retract1:784">4.14</a> <a class="idx" href="examineprog.html#idx:retract1:809">4.15</a> <a class="idx" href="threadcom.html#idx:retract1:1778">9.3.3</a></dd>
22212239 <dt>retract/2</dt>
22222240 <dd>
2223 <a class="idx" href="extvar.html#idx:retract2:1615">7</a></dd>
2241 <a class="idx" href="extvar.html#idx:retract2:1617">7</a></dd>
22242242 <dt><a class="idx" href="db.html#retractall/1">retractall/1</a></dt>
22252243 <dd>
2226 <a class="idx" href="db.html#idx:retractall1:717">4.13</a> <a class="idx" href="db.html#idx:retractall1:721">4.13</a> <a class="idx" href="db.html#idx:retractall1:724">4.13</a></dd>
2244 <a class="idx" href="db.html#idx:retractall1:718">4.13</a> <a class="idx" href="db.html#idx:retractall1:722">4.13</a> <a class="idx" href="db.html#idx:retractall1:725">4.13</a></dd>
22272245 <dt><a class="idx" href="predicate_options.html#retractall_predicate_options/0">retractall_predicate_options/0</a></dt>
22282246 <dt>rev/3</dt>
22292247 <dd>
2230 <a class="idx" href="defmodule.html#idx:rev3:1520">6.2</a></dd>
2248 <a class="idx" href="defmodule.html#idx:rev3:1522">6.2</a></dd>
22312249 <dt><a class="idx" href="lists.html#reverse/2">reverse/2</a></dt>
22322250 <dd>
2233 <a class="idx" href="DCG.html#idx:reverse2:714">4.12</a> <a class="idx" href="defmodule.html#idx:reverse2:1519">6.2</a></dd>
2251 <a class="idx" href="DCG.html#idx:reverse2:715">4.12</a> <a class="idx" href="defmodule.html#idx:reverse2:1521">6.2</a></dd>
22342252 <dt><a class="idx" href="readline.html#rl_add_history/1">rl_add_history/1</a></dt>
22352253 <dt><a class="idx" href="readline.html#rl_read_history/1">rl_read_history/1</a></dt>
22362254 <dt><a class="idx" href="readline.html#rl_read_init_file/1">rl_read_init_file/1</a></dt>
22372255 <dt><a class="idx" href="readline.html#rl_write_history/1">rl_write_history/1</a></dt>
22382256 <dt><a class="idx" href="files.html#same_file/2">same_file/2</a></dt>
22392257 <dd>
2240 <a class="idx" href="files.html#idx:samefile2:1347">4.34</a> <a class="idx" href="files.html#idx:samefile2:1348">4.34</a> <a class="idx" href="files.html#idx:samefile2:1351">4.34</a> <a class="idx" href="files.html#idx:samefile2:1352">4.34</a></dd>
2258 <a class="idx" href="files.html#idx:samefile2:1349">4.34</a> <a class="idx" href="files.html#idx:samefile2:1350">4.34</a> <a class="idx" href="files.html#idx:samefile2:1353">4.34</a> <a class="idx" href="files.html#idx:samefile2:1354">4.34</a></dd>
22412259 <dt><a class="idx" href="lists.html#same_length/2">same_length/2</a></dt>
22422260 <dt><a class="idx" href="manipterm.html#same_term/2">same_term/2</a></dt>
22432261 <dt><a class="idx" href="aggregate.html#sandbox:safe_meta/2">sandbox:safe_meta/2</a></dt>
22502268 <dt><a class="idx" href="apply.html#scanl/7">scanl/7</a></dt>
22512269 <dt><a class="idx" href="IO.html#see/1">see/1</a></dt>
22522270 <dd>
2253 <a class="idx" href="IO.html#idx:see1:842">4.16</a> <a class="idx" href="IO.html#idx:see1:848">4.16.1</a> <a class="idx" href="IO.html#idx:see1:926">4.16.3</a> <a class="idx" href="IO.html#idx:see1:933">4.16.3</a> <a class="idx" href="IO.html#idx:see1:935">4.16.3</a></dd>
2271 <a class="idx" href="IO.html#idx:see1:843">4.16</a> <a class="idx" href="IO.html#idx:see1:849">4.16.1</a> <a class="idx" href="IO.html#idx:see1:927">4.16.3</a> <a class="idx" href="IO.html#idx:see1:934">4.16.3</a> <a class="idx" href="IO.html#idx:see1:936">4.16.3</a></dd>
22542272 <dt><a class="idx" href="IO.html#seeing/1">seeing/1</a></dt>
22552273 <dd>
2256 <a class="idx" href="IO.html#idx:seeing1:928">4.16.3</a> <a class="idx" href="IO.html#idx:seeing1:931">4.16.3</a> <a class="idx" href="files.html#idx:seeing1:1374">4.34</a></dd>
2274 <a class="idx" href="IO.html#idx:seeing1:929">4.16.3</a> <a class="idx" href="IO.html#idx:seeing1:932">4.16.3</a> <a class="idx" href="files.html#idx:seeing1:1376">4.34</a></dd>
22572275 <dt><a class="idx" href="IO.html#seek/4">seek/4</a></dt>
22582276 <dd>
2259 <a class="idx" href="IO.html#idx:seek4:882">4.16.2</a> <a class="idx" href="IO.html#idx:seek4:889">4.16.2</a> <a class="idx" href="IO.html#idx:seek4:895">4.16.2</a> <a class="idx" href="IO.html#idx:seek4:902">4.16.2</a></dd>
2277 <a class="idx" href="IO.html#idx:seek4:883">4.16.2</a> <a class="idx" href="IO.html#idx:seek4:890">4.16.2</a> <a class="idx" href="IO.html#idx:seek4:896">4.16.2</a> <a class="idx" href="IO.html#idx:seek4:903">4.16.2</a></dd>
22602278 <dt><a class="idx" href="IO.html#seen/0">seen/0</a></dt>
22612279 <dt>select()</dt>
22622280 <dd>
2263 <a class="idx" href="streamstat.html#idx:select:954">4.17</a></dd>
2281 <a class="idx" href="streamstat.html#idx:select:955">4.17</a></dd>
22642282 <dt><a class="idx" href="lists.html#select/3">select/3</a></dt>
22652283 <dt><a class="idx" href="lists.html#select/4">select/4</a></dt>
22662284 <dt>select_dict/2</dt>
22672285 <dd>
2268 <a class="idx" href="dicts.html#idx:selectdict2:1494">5.4.2</a></dd>
2286 <a class="idx" href="dicts.html#idx:selectdict2:1496">5.4.2</a></dd>
22692287 <dt><a class="idx" href="dicts.html#select_dict/3">select_dict/3</a></dt>
22702288 <dd>
2271 <a class="idx" href="dicts.html#idx:selectdict3:1495">5.4.2</a></dd>
2289 <a class="idx" href="dicts.html#idx:selectdict3:1497">5.4.2</a></dd>
22722290 <dt><a class="idx" href="option.html#select_option/3">select_option/3</a></dt>
22732291 <dt><a class="idx" href="option.html#select_option/4">select_option/4</a></dt>
22742292 <dt><a class="idx" href="lists.html#selectchk/3">selectchk/3</a></dt>
22752293 <dt><a class="idx" href="lists.html#selectchk/4">selectchk/4</a></dt>
22762294 <dt>semi deterministic</dt>
22772295 <dd>
2278 <a class="idx" href="glossary.html#idx:semideterministic:2127">D</a></dd>
2296 <a class="idx" href="glossary.html#idx:semideterministic:2134">D</a></dd>
22792297 <dt>semidet</dt>
22802298 <dd>
2281 <a class="idx" href="glossary.html#idx:semidet:2126">D</a></dd>
2299 <a class="idx" href="glossary.html#idx:semidet:2133">D</a></dd>
22822300 <dt><a class="idx" href="control.html#send_arrow/2">send_arrow/2</a></dt>
22832301 <dt>serialize</dt>
22842302 <dd>
2285 <a class="idx" href="DCG.html#idx:serialize:701">4.12</a></dd>
2303 <a class="idx" href="DCG.html#idx:serialize:702">4.12</a></dd>
22862304 <dt><a class="idx" href="clpfd.html#serialized/2">serialized/2</a></dt>
22872305 <dt>set_breakpoint/4</dt>
22882306 <dd>
2289 <a class="idx" href="breakpoint.html#idx:setbreakpoint4:2002">B.4</a></dd>
2307 <a class="idx" href="breakpoint.html#idx:setbreakpoint4:2005">B.4</a></dd>
22902308 <dt><a class="idx" href="chario.html#set_end_of_stream/1">set_end_of_stream/1</a></dt>
22912309 <dt><a class="idx" href="IO.html#set_input/1">set_input/1</a></dt>
22922310 <dd>
2293 <a class="idx" href="IO.html#idx:setinput1:850">4.16.1</a> <a class="idx" href="IO.html#idx:setinput1:908">4.16.2</a> <a class="idx" href="IO.html#idx:setinput1:936">4.16.3</a></dd>
2311 <a class="idx" href="IO.html#idx:setinput1:851">4.16.1</a> <a class="idx" href="IO.html#idx:setinput1:909">4.16.2</a> <a class="idx" href="IO.html#idx:setinput1:937">4.16.3</a></dd>
22942312 <dt><a class="idx" href="locale.html#set_locale/1">set_locale/1</a></dt>
22952313 <dt><a class="idx" href="manipmodule.html#set_module/1">set_module/1</a></dt>
22962314 <dd>
2297 <a class="idx" href="db.html#idx:setmodule1:731">4.13</a> <a class="idx" href="importmodule.html#idx:setmodule1:1574">6.9</a> <a class="idx" href="manipmodule.html#idx:setmodule1:1603">6.14</a></dd>
2315 <a class="idx" href="db.html#idx:setmodule1:732">4.13</a> <a class="idx" href="importmodule.html#idx:setmodule1:1576">6.9</a> <a class="idx" href="manipmodule.html#idx:setmodule1:1605">6.14</a></dd>
22982316 <dt><a class="idx" href="IO.html#set_output/1">set_output/1</a></dt>
22992317 <dd>
2300 <a class="idx" href="IO.html#idx:setoutput1:851">4.16.1</a> <a class="idx" href="IO.html#idx:setoutput1:937">4.16.3</a></dd>
2318 <a class="idx" href="IO.html#idx:setoutput1:852">4.16.1</a> <a class="idx" href="IO.html#idx:setoutput1:938">4.16.3</a></dd>
23012319 <dt><a class="idx" href="flags.html#set_prolog_flag/2">set_prolog_flag/2</a></dt>
23022320 <dd>
2303 <a class="idx" href="history.html#idx:setprologflag2:37">2.7</a> <a class="idx" href="flags.html#idx:setprologflag2:62">2.11</a> <a class="idx" href="flags.html#idx:setprologflag2:124">2.11</a> <a class="idx" href="flags.html#idx:setprologflag2:137">2.11</a> <a class="idx" href="consulting.html#idx:setprologflag2:345">4.3</a> <a class="idx" href="arith.html#idx:setprologflag2:1203">4.26.2</a> <a class="idx" href="foreigninclude.html#idx:setprologflag2:1871">10.4.14.4</a></dd>
2321 <a class="idx" href="history.html#idx:setprologflag2:37">2.7</a> <a class="idx" href="flags.html#idx:setprologflag2:62">2.11</a> <a class="idx" href="flags.html#idx:setprologflag2:124">2.11</a> <a class="idx" href="flags.html#idx:setprologflag2:137">2.11</a> <a class="idx" href="consulting.html#idx:setprologflag2:346">4.3</a> <a class="idx" href="arith.html#idx:setprologflag2:1205">4.26.2</a> <a class="idx" href="foreigninclude.html#idx:setprologflag2:1874">10.4.14.4</a></dd>
23042322 <dt><a class="idx" href="memory.html#set_prolog_stack/2">set_prolog_stack/2</a></dt>
23052323 <dd>
2306 <a class="idx" href="cmdline.html#idx:setprologstack2:26">2.4.3</a> <a class="idx" href="limits.html#idx:setprologstack2:244">2.19.1</a> <a class="idx" href="limits.html#idx:setprologstack2:247">2.19.1</a> <a class="idx" href="debugger.html#idx:setprologstack2:1406">4.37</a> <a class="idx" href="memory.html#idx:setprologstack2:1437">4.40</a> <a class="idx" href="strings.html#idx:setprologstack2:1447">5.2</a> <a class="idx" href="threadcreate.html#idx:setprologstack2:1707">9.1</a></dd>
2324 <a class="idx" href="cmdline.html#idx:setprologstack2:26">2.4.3</a> <a class="idx" href="limits.html#idx:setprologstack2:244">2.19.1</a> <a class="idx" href="limits.html#idx:setprologstack2:247">2.19.1</a> <a class="idx" href="debugger.html#idx:setprologstack2:1408">4.37</a> <a class="idx" href="memory.html#idx:setprologstack2:1439">4.40</a> <a class="idx" href="strings.html#idx:setprologstack2:1449">5.2</a> <a class="idx" href="threadcreate.html#idx:setprologstack2:1710">9.1</a></dd>
23072325 <dt><a class="idx" href="miscarith.html#set_random/1">set_random/1</a></dt>
23082326 <dd>
2309 <a class="idx" href="arith.html#idx:setrandom1:1213">4.26.2.3</a> <a class="idx" href="miscarith.html#idx:setrandom1:1219">4.27</a></dd>
2327 <a class="idx" href="arith.html#idx:setrandom1:1215">4.26.2.3</a> <a class="idx" href="miscarith.html#idx:setrandom1:1221">4.27</a></dd>
23102328 <dt><a class="idx" href="IO.html#set_stream/2">set_stream/2</a></dt>
23112329 <dd>
2312 <a class="idx" href="widechars.html#idx:setstream2:236">2.18.1</a> <a class="idx" href="widechars.html#idx:setstream2:238">2.18.1</a> <a class="idx" href="IO.html#idx:setstream2:844">4.16.1</a> <a class="idx" href="IO.html#idx:setstream2:865">4.16.2</a> <a class="idx" href="IO.html#idx:setstream2:883">4.16.2</a> <a class="idx" href="IO.html#idx:setstream2:884">4.16.2</a> <a class="idx" href="IO.html#idx:setstream2:885">4.16.2</a> <a class="idx" href="IO.html#idx:setstream2:923">4.16.2</a> <a class="idx" href="streamstat.html#idx:setstream2:957">4.17</a> <a class="idx" href="chario.html#idx:setstream2:984">4.18</a> <a class="idx" href="locale.html#idx:setstream2:1171">4.22</a></dd>
2330 <a class="idx" href="widechars.html#idx:setstream2:236">2.18.1</a> <a class="idx" href="widechars.html#idx:setstream2:238">2.18.1</a> <a class="idx" href="IO.html#idx:setstream2:845">4.16.1</a> <a class="idx" href="IO.html#idx:setstream2:866">4.16.2</a> <a class="idx" href="IO.html#idx:setstream2:884">4.16.2</a> <a class="idx" href="IO.html#idx:setstream2:885">4.16.2</a> <a class="idx" href="IO.html#idx:setstream2:886">4.16.2</a> <a class="idx" href="IO.html#idx:setstream2:924">4.16.2</a> <a class="idx" href="streamstat.html#idx:setstream2:958">4.17</a> <a class="idx" href="chario.html#idx:setstream2:985">4.18</a> <a class="idx" href="locale.html#idx:setstream2:1172">4.22</a></dd>
23132331 <dt><a class="idx" href="IO.html#set_stream_position/2">set_stream_position/2</a></dt>
23142332 <dd>
2315 <a class="idx" href="IO.html#idx:setstreamposition2:881">4.16.2</a> <a class="idx" href="IO.html#idx:setstreamposition2:898">4.16.2</a> <a class="idx" href="IO.html#idx:setstreamposition2:904">4.16.2</a></dd>
2333 <a class="idx" href="IO.html#idx:setstreamposition2:882">4.16.2</a> <a class="idx" href="IO.html#idx:setstreamposition2:899">4.16.2</a> <a class="idx" href="IO.html#idx:setstreamposition2:905">4.16.2</a></dd>
23162334 <dt><a class="idx" href="url.html#set_url_encoding/2">set_url_encoding/2</a></dt>
23172335 <dt><a class="idx" href="manipterm.html#setarg/3">setarg/3</a></dt>
23182336 <dd>
2319 <a class="idx" href="preddesc.html#idx:setarg3:304">4.1</a> <a class="idx" href="manipterm.html#idx:setarg3:1094">4.20</a> <a class="idx" href="manipterm.html#idx:setarg3:1096">4.20.1</a> <a class="idx" href="manipterm.html#idx:setarg3:1098">4.20.1</a> <a class="idx" href="manipterm.html#idx:setarg3:1099">4.20.1</a> <a class="idx" href="manipterm.html#idx:setarg3:1101">4.20.1</a> <a class="idx" href="manipterm.html#idx:setarg3:1111">4.20.1</a> <a class="idx" href="manipterm.html#idx:setarg3:1116">4.20.1</a> <a class="idx" href="dicts.html#idx:setarg3:1497">5.4.2.1</a> <a class="idx" href="attvar.html#idx:setarg3:1624">7.1.1</a> <a class="idx" href="gvar.html#idx:setarg3:1672">7.3.1</a> <a class="idx" href="record.html#idx:setarg3:1974">A.29</a></dd>
2337 <a class="idx" href="preddesc.html#idx:setarg3:305">4.1</a> <a class="idx" href="manipterm.html#idx:setarg3:1095">4.20</a> <a class="idx" href="manipterm.html#idx:setarg3:1097">4.20.1</a> <a class="idx" href="manipterm.html#idx:setarg3:1099">4.20.1</a> <a class="idx" href="manipterm.html#idx:setarg3:1100">4.20.1</a> <a class="idx" href="manipterm.html#idx:setarg3:1102">4.20.1</a> <a class="idx" href="manipterm.html#idx:setarg3:1112">4.20.1</a> <a class="idx" href="manipterm.html#idx:setarg3:1117">4.20.1</a> <a class="idx" href="dicts.html#idx:setarg3:1499">5.4.2.1</a> <a class="idx" href="attvar.html#idx:setarg3:1626">7.1.1</a> <a class="idx" href="gvar.html#idx:setarg3:1675">7.3.1</a> <a class="idx" href="record.html#idx:setarg3:1977">A.29</a></dd>
23202338 <dt><a class="idx" href="system.html#setenv/2">setenv/2</a></dt>
23212339 <dd>
2322 <a class="idx" href="system.html#idx:setenv2:1305">4.33</a></dd>
2340 <a class="idx" href="system.html#idx:setenv2:1307">4.33</a></dd>
23232341 <dt>setlocale/1</dt>
23242342 <dd>
2325 <a class="idx" href="threadcreate.html#idx:setlocale1:1706">9.1</a></dd>
2343 <a class="idx" href="threadcreate.html#idx:setlocale1:1709">9.1</a></dd>
23262344 <dt><a class="idx" href="system.html#setlocale/3">setlocale/3</a></dt>
23272345 <dd>
2328 <a class="idx" href="chartype.html#idx:setlocale3:1193">4.23.3</a> <a class="idx" href="system.html#idx:setlocale3:1308">4.33</a></dd>
2346 <a class="idx" href="chartype.html#idx:setlocale3:1194">4.23.3</a> <a class="idx" href="system.html#idx:setlocale3:1310">4.33</a></dd>
23292347 <dt><a class="idx" href="allsolutions.html#setof/3">setof/3</a></dt>
23302348 <dd>
2331 <a class="idx" href="cyclic.html#idx:setof3:214">2.16</a> <a class="idx" href="metapred.html#idx:setof3:1549">6.4</a> <a class="idx" href="predsummary.html#idx:setof3:2145">F.1</a></dd>
2349 <a class="idx" href="cyclic.html#idx:setof3:214">2.16</a> <a class="idx" href="metapred.html#idx:setof3:1551">6.4</a> <a class="idx" href="predsummary.html#idx:setof3:2152">F.1</a></dd>
23322350 <dt><a class="idx" href="random.html#setrand/1">setrand/1</a></dt>
23332351 <dt><a class="idx" href="metacall.html#setup_call_catcher_cleanup/4">setup_call_catcher_cleanup/4</a></dt>
23342352 <dt>setup_call_cleanup/2</dt>
23352353 <dd>
2336 <a class="idx" href="threadsync.html#idx:setupcallcleanup2:1780">9.4</a></dd>
2354 <a class="idx" href="threadsync.html#idx:setupcallcleanup2:1783">9.4</a></dd>
23372355 <dt><a class="idx" href="metacall.html#setup_call_cleanup/3">setup_call_cleanup/3</a></dt>
23382356 <dd>
2339 <a class="idx" href="metacall.html#idx:setupcallcleanup3:619">4.9</a> <a class="idx" href="metacall.html#idx:setupcallcleanup3:621">4.9</a> <a class="idx" href="metacall.html#idx:setupcallcleanup3:625">4.9</a> <a class="idx" href="threadcreate.html#idx:setupcallcleanup3:1718">9.1</a> <a class="idx" href="threadsync.html#idx:setupcallcleanup3:1784">9.4</a> <a class="idx" href="threadsync.html#idx:setupcallcleanup3:1788">9.4</a> <a class="idx" href="threadsync.html#idx:setupcallcleanup3:1791">9.4</a></dd>
2357 <a class="idx" href="metacall.html#idx:setupcallcleanup3:620">4.9</a> <a class="idx" href="metacall.html#idx:setupcallcleanup3:622">4.9</a> <a class="idx" href="metacall.html#idx:setupcallcleanup3:626">4.9</a> <a class="idx" href="threadcreate.html#idx:setupcallcleanup3:1721">9.1</a> <a class="idx" href="threadsync.html#idx:setupcallcleanup3:1787">9.4</a> <a class="idx" href="threadsync.html#idx:setupcallcleanup3:1791">9.4</a> <a class="idx" href="threadsync.html#idx:setupcallcleanup3:1794">9.4</a></dd>
23402358 <dt><a class="idx" href="simplex.html#shadow_price/3">shadow_price/3</a></dt>
23412359 <dt>shared</dt>
23422360 <dd>
2343 <a class="idx" href="glossary.html#idx:shared:2128">D</a></dd>
2361 <a class="idx" href="glossary.html#idx:shared:2135">D</a></dd>
23442362 <dt><a class="idx" href="system.html#shell/0">shell/0</a></dt>
23452363 <dd>
2346 <a class="idx" href="system.html#idx:shell0:1314">4.33</a></dd>
2364 <a class="idx" href="system.html#idx:shell0:1316">4.33</a></dd>
23472365 <dt><a class="idx" href="system.html#shell/1">shell/1</a></dt>
23482366 <dd>
2349 <a class="idx" href="projectfiles.html#idx:shell1:267">3.1.1.2</a> <a class="idx" href="edit.html#idx:shell1:546">4.4.1</a> <a class="idx" href="edit.html#idx:shell1:548">4.4.1</a> <a class="idx" href="system.html#idx:shell1:1312">4.33</a> <a class="idx" href="system.html#idx:shell1:1313">4.33</a></dd>
2367 <a class="idx" href="projectfiles.html#idx:shell1:267">3.1.1.2</a> <a class="idx" href="edit.html#idx:shell1:547">4.4.1</a> <a class="idx" href="edit.html#idx:shell1:549">4.4.1</a> <a class="idx" href="system.html#idx:shell1:1314">4.33</a> <a class="idx" href="system.html#idx:shell1:1315">4.33</a></dd>
23502368 <dt><a class="idx" href="system.html#shell/2">shell/2</a></dt>
23512369 <dd>
2352 <a class="idx" href="system.html#idx:shell2:1320">4.33.1</a></dd>
2370 <a class="idx" href="system.html#idx:shell2:1322">4.33.1</a></dd>
23532371 <dt>shell/[0-2]</dt>
23542372 <dd>
2355 <a class="idx" href="system.html#idx:shell02:1302">4.33</a></dd>
2373 <a class="idx" href="system.html#idx:shell02:1304">4.33</a></dd>
23562374 <dt>shell/[1,2]</dt>
23572375 <dd>
2358 <a class="idx" href="system.html#idx:shell12:1294">4.33</a></dd>
2376 <a class="idx" href="system.html#idx:shell12:1296">4.33</a></dd>
23592377 <dt><a class="idx" href="registry.html#shell_register_dde/6">shell_register_dde/6</a></dt>
23602378 <dt><a class="idx" href="registry.html#shell_register_file_type/4">shell_register_file_type/4</a></dt>
23612379 <dd>
2362 <a class="idx" href="registry.html#idx:shellregisterfiletype4:1977">A.30</a></dd>
2380 <a class="idx" href="registry.html#idx:shellregisterfiletype4:1980">A.30</a></dd>
23632381 <dt><a class="idx" href="registry.html#shell_register_prolog/1">shell_register_prolog/1</a></dt>
23642382 <dt><a class="idx" href="profile.html#show_profile/1">show_profile/1</a></dt>
23652383 <dd>
2366 <a class="idx" href="profile.html#idx:showprofile1:1421">4.39.1</a> <a class="idx" href="profile.html#idx:showprofile1:1422">4.39.1</a></dd>
2384 <a class="idx" href="profile.html#idx:showprofile1:1423">4.39.1</a> <a class="idx" href="profile.html#idx:showprofile1:1424">4.39.1</a></dd>
23672385 <dt>singleton</dt>
23682386 <dd>
2369 <a class="idx" href="glossary.html#idx:singleton:2129">D</a></dd>
2387 <a class="idx" href="glossary.html#idx:singleton:2136">D</a></dd>
23702388 <dt>singleton,variable</dt>
23712389 <dd>
23722390 <a class="idx" href="syntax.html#idx:singletonvariable:190">2.15.2.5</a></dd>
23742392 <dt><a class="idx" href="nb_set.html#size_nb_set/2">size_nb_set/2</a></dt>
23752393 <dt><a class="idx" href="chario.html#skip/1">skip/1</a></dt>
23762394 <dd>
2377 <a class="idx" href="chario.html#idx:skip1:986">4.18</a></dd>
2395 <a class="idx" href="chario.html#idx:skip1:987">4.18</a></dd>
23782396 <dt><a class="idx" href="chario.html#skip/2">skip/2</a></dt>
23792397 <dt><a class="idx" href="miscpreds.html#sleep/1">sleep/1</a></dt>
23802398 <dd>
2381 <a class="idx" href="miscpreds.html#idx:sleep1:1440">4.42</a></dd>
2399 <a class="idx" href="miscpreds.html#idx:sleep1:1442">4.42</a></dd>
23822400 <dt>solution</dt>
23832401 <dd>
2384 <a class="idx" href="glossary.html#idx:solution:2130">D</a></dd>
2402 <a class="idx" href="glossary.html#idx:solution:2137">D</a></dd>
23852403 <dt><a class="idx" href="builtinlist.html#sort/2">sort/2</a></dt>
23862404 <dd>
2387 <a class="idx" href="metacall.html#idx:sort2:612">4.9</a> <a class="idx" href="builtinlist.html#idx:sort2:1226">4.28</a> <a class="idx" href="builtinlist.html#idx:sort2:1228">4.28</a> <a class="idx" href="builtinlist.html#idx:sort2:1233">4.28</a> <a class="idx" href="builtinlist.html#idx:sort2:1235">4.28</a> <a class="idx" href="builtinlist.html#idx:sort2:1237">4.28</a> <a class="idx" href="allsolutions.html#idx:sort2:1252">4.29</a></dd>
2405 <a class="idx" href="metacall.html#idx:sort2:613">4.9</a> <a class="idx" href="builtinlist.html#idx:sort2:1228">4.28</a> <a class="idx" href="builtinlist.html#idx:sort2:1230">4.28</a> <a class="idx" href="builtinlist.html#idx:sort2:1235">4.28</a> <a class="idx" href="builtinlist.html#idx:sort2:1237">4.28</a> <a class="idx" href="builtinlist.html#idx:sort2:1239">4.28</a> <a class="idx" href="allsolutions.html#idx:sort2:1254">4.29</a></dd>
23882406 <dt><a class="idx" href="builtinlist.html#sort/4">sort/4</a></dt>
23892407 <dt><a class="idx" href="dialect.html#source_exports/2">source_exports/2</a></dt>
23902408 <dd>
2391 <a class="idx" href="dialect.html#idx:sourceexports2:2051">C</a></dd>
2409 <a class="idx" href="dialect.html#idx:sourceexports2:2054">C</a></dd>
23922410 <dt><a class="idx" href="consulting.html#source_file/1">source_file/1</a></dt>
23932411 <dt><a class="idx" href="consulting.html#source_file/2">source_file/2</a></dt>
23942412 <dd>
2395 <a class="idx" href="consulting.html#idx:sourcefile2:416">4.3</a> <a class="idx" href="consulting.html#idx:sourcefile2:535">4.3.3</a> <a class="idx" href="examineprog.html#idx:sourcefile2:810">4.15</a> <a class="idx" href="examineprog.html#idx:sourcefile2:813">4.15</a></dd>
2413 <a class="idx" href="consulting.html#idx:sourcefile2:417">4.3</a> <a class="idx" href="consulting.html#idx:sourcefile2:536">4.3.3</a> <a class="idx" href="examineprog.html#idx:sourcefile2:811">4.15</a> <a class="idx" href="examineprog.html#idx:sourcefile2:814">4.15</a></dd>
23962414 <dt><a class="idx" href="consulting.html#source_file_property/2">source_file_property/2</a></dt>
23972415 <dd>
2398 <a class="idx" href="consulting.html#idx:sourcefileproperty2:389">4.3</a> <a class="idx" href="consulting.html#idx:sourcefileproperty2:419">4.3</a></dd>
2416 <a class="idx" href="consulting.html#idx:sourcefileproperty2:390">4.3</a> <a class="idx" href="consulting.html#idx:sourcefileproperty2:420">4.3</a></dd>
23992417 <dt><a class="idx" href="consulting.html#source_location/2">source_location/2</a></dt>
24002418 <dd>
2401 <a class="idx" href="consulting.html#idx:sourcelocation2:451">4.3</a></dd>
2419 <a class="idx" href="consulting.html#idx:sourcelocation2:452">4.3</a></dd>
24022420 <dt><a class="idx" href="strings.html#split_string/4">split_string/4</a></dt>
24032421 <dd>
2404 <a class="idx" href="manipatom.html#idx:splitstring4:1157">4.21</a> <a class="idx" href="strings.html#idx:splitstring4:1459">5.2.1</a> <a class="idx" href="strings.html#idx:splitstring4:1461">5.2.1</a></dd>
2422 <a class="idx" href="manipatom.html#idx:splitstring4:1158">4.21</a> <a class="idx" href="strings.html#idx:splitstring4:1461">5.2.1</a> <a class="idx" href="strings.html#idx:splitstring4:1463">5.2.1</a></dd>
24052423 <dt><a class="idx" href="debugger.html#spy/1">spy/1</a></dt>
24062424 <dd>
2407 <a class="idx" href="debugoverview.html#idx:spy1:40">2.9</a> <a class="idx" href="debugoverview.html#idx:spy1:45">2.9</a> <a class="idx" href="flags.html#idx:spy1:81">2.11</a> <a class="idx" href="flags.html#idx:spy1:94">2.11</a> <a class="idx" href="hooks.html#idx:spy1:153">2.12</a> <a class="idx" href="guitracer.html#idx:spy1:288">3.5.1</a> <a class="idx" href="guitracer.html#idx:spy1:290">3.5.1</a> <a class="idx" href="idesummary.html#idx:spy1:303">3.9</a> <a class="idx" href="preddesc.html#idx:spy1:307">4.1</a> <a class="idx" href="mtoplevel.html#idx:spy1:1561">6.6</a> <a class="idx" href="thutil.html#idx:spy1:1802">9.5.1</a> <a class="idx" href="thutil.html#idx:spy1:1804">9.5.1</a> <a class="idx" href="intlibs.html#idx:spy1:2024">B.7</a> <a class="idx" href="intlibs.html#idx:spy1:2025">B.7</a> <a class="idx" href="intlibs.html#idx:spy1:2028">B.7</a> <a class="idx" href="predsummary.html#idx:spy1:2151">F.1</a></dd>
2425 <a class="idx" href="debugoverview.html#idx:spy1:40">2.9</a> <a class="idx" href="debugoverview.html#idx:spy1:45">2.9</a> <a class="idx" href="flags.html#idx:spy1:81">2.11</a> <a class="idx" href="flags.html#idx:spy1:94">2.11</a> <a class="idx" href="hooks.html#idx:spy1:153">2.12</a> <a class="idx" href="guitracer.html#idx:spy1:288">3.5.1</a> <a class="idx" href="guitracer.html#idx:spy1:290">3.5.1</a> <a class="idx" href="idesummary.html#idx:spy1:303">3.9</a> <a class="idx" href="preddesc.html#idx:spy1:308">4.1</a> <a class="idx" href="mtoplevel.html#idx:spy1:1563">6.6</a> <a class="idx" href="thutil.html#idx:spy1:1805">9.5.1</a> <a class="idx" href="thutil.html#idx:spy1:1807">9.5.1</a> <a class="idx" href="intlibs.html#idx:spy1:2027">B.7</a> <a class="idx" href="intlibs.html#idx:spy1:2028">B.7</a> <a class="idx" href="intlibs.html#idx:spy1:2031">B.7</a> <a class="idx" href="predsummary.html#idx:spy1:2158">F.1</a></dd>
24082426 <dt>stack,memory management</dt>
24092427 <dd>
24102428 <a class="idx" href="limits.html#idx:stackmemorymanagement:248">2.19.1.1</a></dd>
24112429 <dt><a class="idx" href="system.html#stamp_date_time/3">stamp_date_time/3</a></dt>
24122430 <dd>
2413 <a class="idx" href="system.html#idx:stampdatetime3:1332">4.33.2.1</a> <a class="idx" href="system.html#idx:stampdatetime3:1335">4.33.2.2</a></dd>
2431 <a class="idx" href="system.html#idx:stampdatetime3:1334">4.33.2.1</a> <a class="idx" href="system.html#idx:stampdatetime3:1337">4.33.2.2</a></dd>
24142432 <dt>startup file</dt>
24152433 <dd>
24162434 <a class="idx" href="initfile.html#idx:startupfile:7">2.2</a></dd>
24172435 <dt><a class="idx" href="statistics.html#statistics/0">statistics/0</a></dt>
24182436 <dd>
2419 <a class="idx" href="exception.html#idx:statistics0:660">4.10.3</a></dd>
2437 <a class="idx" href="exception.html#idx:statistics0:661">4.10.3</a></dd>
24202438 <dt><a class="idx" href="statistics.html#statistics/2">statistics/2</a></dt>
24212439 <dd>
2422 <a class="idx" href="arith.html#idx:statistics2:1216">4.26.2.3</a> <a class="idx" href="statistics.html#idx:statistics2:1415">4.38</a> <a class="idx" href="statistics.html#idx:statistics2:1417">4.38</a> <a class="idx" href="thmonitor.html#idx:statistics2:1737">9.2</a> <a class="idx" href="thmonitor.html#idx:statistics2:1738">9.2</a></dd>
2440 <a class="idx" href="arith.html#idx:statistics2:1218">4.26.2.3</a> <a class="idx" href="statistics.html#idx:statistics2:1417">4.38</a> <a class="idx" href="statistics.html#idx:statistics2:1419">4.38</a> <a class="idx" href="thmonitor.html#idx:statistics2:1740">9.2</a> <a class="idx" href="thmonitor.html#idx:statistics2:1741">9.2</a></dd>
24232441 <dt><a class="idx" href="IO.html#stream_pair/3">stream_pair/3</a></dt>
24242442 <dd>
2425 <a class="idx" href="IO.html#idx:streampair3:860">4.16.2</a> <a class="idx" href="IO.html#idx:streampair3:873">4.16.2</a> <a class="idx" href="IO.html#idx:streampair3:905">4.16.2</a></dd>
2443 <a class="idx" href="IO.html#idx:streampair3:861">4.16.2</a> <a class="idx" href="IO.html#idx:streampair3:874">4.16.2</a> <a class="idx" href="IO.html#idx:streampair3:906">4.16.2</a></dd>
24262444 <dt><a class="idx" href="IO.html#stream_position_data/3">stream_position_data/3</a></dt>
24272445 <dd>
2428 <a class="idx" href="consulting.html#idx:streampositiondata3:456">4.3</a> <a class="idx" href="IO.html#idx:streampositiondata3:880">4.16.2</a> <a class="idx" href="termrw.html#idx:streampositiondata3:1052">4.19</a> <a class="idx" href="loadfilehook.html#idx:streampositiondata3:2044">B.8</a></dd>
2446 <a class="idx" href="consulting.html#idx:streampositiondata3:457">4.3</a> <a class="idx" href="IO.html#idx:streampositiondata3:881">4.16.2</a> <a class="idx" href="termrw.html#idx:streampositiondata3:1053">4.19</a> <a class="idx" href="loadfilehook.html#idx:streampositiondata3:2047">B.8</a></dd>
24292447 <dt><a class="idx" href="IO.html#stream_property/2">stream_property/2</a></dt>
24302448 <dd>
2431 <a class="idx" href="widechars.html#idx:streamproperty2:242">2.18.1.1</a> <a class="idx" href="consulting.html#idx:streamproperty2:455">4.3</a> <a class="idx" href="IO.html#idx:streamproperty2:866">4.16.2</a> <a class="idx" href="IO.html#idx:streamproperty2:888">4.16.2</a> <a class="idx" href="IO.html#idx:streamproperty2:890">4.16.2</a> <a class="idx" href="IO.html#idx:streamproperty2:897">4.16.2</a> <a class="idx" href="IO.html#idx:streamproperty2:903">4.16.2</a> <a class="idx" href="IO.html#idx:streamproperty2:906">4.16.2</a> <a class="idx" href="IO.html#idx:streamproperty2:911">4.16.2</a> <a class="idx" href="IO.html#idx:streamproperty2:913">4.16.2</a> <a class="idx" href="IO.html#idx:streamproperty2:914">4.16.2</a> <a class="idx" href="IO.html#idx:streamproperty2:920">4.16.2</a> <a class="idx" href="IO.html#idx:streamproperty2:921">4.16.2</a> <a class="idx" href="termrw.html#idx:streamproperty2:1062">4.19</a></dd>
2449 <a class="idx" href="widechars.html#idx:streamproperty2:242">2.18.1.1</a> <a class="idx" href="consulting.html#idx:streamproperty2:456">4.3</a> <a class="idx" href="IO.html#idx:streamproperty2:867">4.16.2</a> <a class="idx" href="IO.html#idx:streamproperty2:889">4.16.2</a> <a class="idx" href="IO.html#idx:streamproperty2:891">4.16.2</a> <a class="idx" href="IO.html#idx:streamproperty2:898">4.16.2</a> <a class="idx" href="IO.html#idx:streamproperty2:904">4.16.2</a> <a class="idx" href="IO.html#idx:streamproperty2:907">4.16.2</a> <a class="idx" href="IO.html#idx:streamproperty2:912">4.16.2</a> <a class="idx" href="IO.html#idx:streamproperty2:914">4.16.2</a> <a class="idx" href="IO.html#idx:streamproperty2:915">4.16.2</a> <a class="idx" href="IO.html#idx:streamproperty2:921">4.16.2</a> <a class="idx" href="IO.html#idx:streamproperty2:922">4.16.2</a> <a class="idx" href="termrw.html#idx:streamproperty2:1063">4.19</a></dd>
24322450 <dt><a class="idx" href="pio.html#stream_to_lazy_list/2">stream_to_lazy_list/2</a></dt>
24332451 <dt><a class="idx" href="typetest.html#string/1">string/1</a></dt>
24342452 <dd>
2435 <a class="idx" href="typetest.html#idx:string1:559">4.6</a> <a class="idx" href="format.html#idx:string1:1281">4.31.2</a> <a class="idx" href="strings.html#idx:string1:1448">5.2.1</a></dd>
2453 <a class="idx" href="typetest.html#idx:string1:560">4.6</a> <a class="idx" href="format.html#idx:string1:1283">4.31.2</a> <a class="idx" href="strings.html#idx:string1:1450">5.2.1</a></dd>
24362454 <dt><a class="idx" href="strings.html#string_chars/2">string_chars/2</a></dt>
24372455 <dt><a class="idx" href="strings.html#string_code/3">string_code/3</a></dt>
24382456 <dd>
2439 <a class="idx" href="strings.html#idx:stringcode3:1454">5.2.1</a> <a class="idx" href="strings.html#idx:stringcode3:1475">5.2.4</a></dd>
2457 <a class="idx" href="strings.html#idx:stringcode3:1456">5.2.1</a> <a class="idx" href="strings.html#idx:stringcode3:1477">5.2.4</a></dd>
24402458 <dt><a class="idx" href="strings.html#string_codes/2">string_codes/2</a></dt>
24412459 <dd>
2442 <a class="idx" href="strings.html#idx:stringcodes2:1467">5.2.2</a> <a class="idx" href="strings.html#idx:stringcodes2:1468">5.2.2</a></dd>
2460 <a class="idx" href="strings.html#idx:stringcodes2:1469">5.2.2</a> <a class="idx" href="strings.html#idx:stringcodes2:1470">5.2.2</a></dd>
24432461 <dt><a class="idx" href="strings.html#string_concat/3">string_concat/3</a></dt>
24442462 <dd>
2445 <a class="idx" href="strings.html#idx:stringconcat3:1465">5.2.2</a></dd>
2463 <a class="idx" href="strings.html#idx:stringconcat3:1467">5.2.2</a></dd>
24462464 <dt><a class="idx" href="strings.html#string_length/2">string_length/2</a></dt>
24472465 <dt><a class="idx" href="strings.html#string_lower/2">string_lower/2</a></dt>
24482466 <dt><a class="idx" href="check.html#string_predicate/1">string_predicate/1</a></dt>
24492467 <dt><a class="idx" href="strings.html#string_upper/2">string_upper/2</a></dt>
24502468 <dt><a class="idx" href="ctxmodule.html#strip_module/3">strip_module/3</a></dt>
24512469 <dd>
2452 <a class="idx" href="metapred.html#idx:stripmodule3:1557">6.4</a> <a class="idx" href="ctxmodule.html#idx:stripmodule3:1599">6.13</a> <a class="idx" href="modulecompat.html#idx:stripmodule3:1608">6.15</a></dd>
2470 <a class="idx" href="metapred.html#idx:stripmodule3:1559">6.4</a> <a class="idx" href="ctxmodule.html#idx:stripmodule3:1601">6.13</a> <a class="idx" href="modulecompat.html#idx:stripmodule3:1610">6.15</a></dd>
24532471 <dt>structure</dt>
24542472 <dd>
2455 <a class="idx" href="glossary.html#idx:structure:2131">D</a></dd>
2473 <a class="idx" href="glossary.html#idx:structure:2138">D</a></dd>
24562474 <dt><a class="idx" href="debugger.html#style_check/1">style_check/1</a></dt>
24572475 <dd>
2458 <a class="idx" href="syntax.html#idx:stylecheck1:192">2.15.2.5</a> <a class="idx" href="syntax.html#idx:stylecheck1:193">2.15.2.5</a> <a class="idx" href="limits.html#idx:stylecheck1:251">2.19.2</a> <a class="idx" href="consulting.html#idx:stylecheck1:390">4.3</a> <a class="idx" href="dynamic.html#idx:stylecheck1:785">4.14</a></dd>
2476 <a class="idx" href="syntax.html#idx:stylecheck1:192">2.15.2.5</a> <a class="idx" href="syntax.html#idx:stylecheck1:193">2.15.2.5</a> <a class="idx" href="limits.html#idx:stylecheck1:251">2.19.2</a> <a class="idx" href="consulting.html#idx:stylecheck1:391">4.3</a> <a class="idx" href="dynamic.html#idx:stylecheck1:786">4.14</a></dd>
24592477 <dt><a class="idx" href="manipatom.html#sub_atom/5">sub_atom/5</a></dt>
24602478 <dd>
2461 <a class="idx" href="strings.html#idx:subatom5:1457">5.2.1</a></dd>
2479 <a class="idx" href="strings.html#idx:subatom5:1459">5.2.1</a></dd>
24622480 <dt><a class="idx" href="manipatom.html#sub_atom_icasechk/3">sub_atom_icasechk/3</a></dt>
24632481 <dt><a class="idx" href="strings.html#sub_string/5">sub_string/5</a></dt>
24642482 <dd>
2465 <a class="idx" href="strings.html#idx:substring5:1453">5.2.1</a> <a class="idx" href="strings.html#idx:substring5:1466">5.2.2</a></dd>
2483 <a class="idx" href="strings.html#idx:substring5:1455">5.2.1</a> <a class="idx" href="strings.html#idx:substring5:1468">5.2.2</a></dd>
24662484 <dt><a class="idx" href="lists.html#subset/2">subset/2</a></dt>
24672485 <dt>subsumes_chk/2</dt>
24682486 <dd>
2469 <a class="idx" href="compare.html#idx:subsumeschk2:589">4.7.2</a> <a class="idx" href="db.html#idx:subsumeschk2:770">4.13.2</a></dd>
2487 <a class="idx" href="compare.html#idx:subsumeschk2:590">4.7.2</a> <a class="idx" href="db.html#idx:subsumeschk2:771">4.13.2</a></dd>
24702488 <dt><a class="idx" href="compare.html#subsumes_term/2">subsumes_term/2</a></dt>
24712489 <dd>
2472 <a class="idx" href="cyclic.html#idx:subsumesterm2:215">2.16</a> <a class="idx" href="compare.html#idx:subsumesterm2:578">4.7.2</a> <a class="idx" href="compare.html#idx:subsumesterm2:588">4.7.2</a></dd>
2490 <a class="idx" href="cyclic.html#idx:subsumesterm2:215">2.16</a> <a class="idx" href="compare.html#idx:subsumesterm2:579">4.7.2</a> <a class="idx" href="compare.html#idx:subsumesterm2:589">4.7.2</a></dd>
24732491 <dt><a class="idx" href="lists.html#subtract/3">subtract/3</a></dt>
24742492 <dt><a class="idx" href="arith.html#succ/2">succ/2</a></dt>
24752493 <dd>
2476 <a class="idx" href="arith.html#idx:succ2:1202">4.26.1</a></dd>
2494 <a class="idx" href="arith.html#idx:succ2:1203">4.26.1</a></dd>
24772495 <dt>succeed</dt>
24782496 <dd>
2479 <a class="idx" href="glossary.html#idx:succeed:2132">D</a></dd>
2497 <a class="idx" href="glossary.html#idx:succeed:2139">D</a></dd>
24802498 <dt><a class="idx" href="clpfd.html#sum/3">sum/3</a></dt>
24812499 <dt><a class="idx" href="lists.html#sum_list/2">sum_list/2</a></dt>
24822500 <dt><a class="idx" href="clpqr.html#sup/2">sup/2</a></dt>
24832501 <dt><a class="idx" href="format.html#swritef/2">swritef/2</a></dt>
24842502 <dt><a class="idx" href="format.html#swritef/3">swritef/3</a></dt>
24852503 <dd>
2486 <a class="idx" href="IO.html#idx:swritef3:943">4.16.5</a> <a class="idx" href="format.html#idx:swritef3:1263">4.31</a></dd>
2504 <a class="idx" href="IO.html#idx:swritef3:944">4.16.5</a> <a class="idx" href="format.html#idx:swritef3:1265">4.31</a></dd>
24872505 <dt><a class="idx" href="pio.html#syntax_error/3">syntax_error/3</a></dt>
24882506 <dt><a class="idx" href="chario.html#tab/1">tab/1</a></dt>
24892507 <dt><a class="idx" href="chario.html#tab/2">tab/2</a></dt>
24902508 <dt><a class="idx" href="clpb.html#taut/2">taut/2</a></dt>
24912509 <dt><a class="idx" href="thutil.html#tdebug/0">tdebug/0</a></dt>
24922510 <dd>
2493 <a class="idx" href="threadcreate.html#idx:tdebug0:1695">9.1</a> <a class="idx" href="thutil.html#idx:tdebug0:1805">9.5.1</a></dd>
2511 <a class="idx" href="threadcreate.html#idx:tdebug0:1698">9.1</a> <a class="idx" href="thutil.html#idx:tdebug0:1808">9.5.1</a></dd>
24942512 <dt><a class="idx" href="thutil.html#tdebug/1">tdebug/1</a></dt>
24952513 <dd>
2496 <a class="idx" href="thutil.html#idx:tdebug1:1801">9.5.1</a> <a class="idx" href="thutil.html#idx:tdebug1:1803">9.5.1</a></dd>
2514 <a class="idx" href="thutil.html#idx:tdebug1:1804">9.5.1</a> <a class="idx" href="thutil.html#idx:tdebug1:1806">9.5.1</a></dd>
24972515 <dt><a class="idx" href="IO.html#tell/1">tell/1</a></dt>
24982516 <dd>
2499 <a class="idx" href="IO.html#idx:tell1:841">4.16</a> <a class="idx" href="IO.html#idx:tell1:849">4.16.1</a> <a class="idx" href="IO.html#idx:tell1:924">4.16.3</a> <a class="idx" href="IO.html#idx:tell1:929">4.16.3</a> <a class="idx" href="IO.html#idx:tell1:932">4.16.3</a> <a class="idx" href="IO.html#idx:tell1:934">4.16.3</a> <a class="idx" href="IO.html#idx:tell1:938">4.16.3</a></dd>
2517 <a class="idx" href="IO.html#idx:tell1:842">4.16</a> <a class="idx" href="IO.html#idx:tell1:850">4.16.1</a> <a class="idx" href="IO.html#idx:tell1:925">4.16.3</a> <a class="idx" href="IO.html#idx:tell1:930">4.16.3</a> <a class="idx" href="IO.html#idx:tell1:933">4.16.3</a> <a class="idx" href="IO.html#idx:tell1:935">4.16.3</a> <a class="idx" href="IO.html#idx:tell1:939">4.16.3</a></dd>
25002518 <dt><a class="idx" href="IO.html#telling/1">telling/1</a></dt>
25012519 <dd>
2502 <a class="idx" href="IO.html#idx:telling1:927">4.16.3</a> <a class="idx" href="IO.html#idx:telling1:930">4.16.3</a> <a class="idx" href="files.html#idx:telling1:1373">4.34</a></dd>
2520 <a class="idx" href="IO.html#idx:telling1:928">4.16.3</a> <a class="idx" href="IO.html#idx:telling1:931">4.16.3</a> <a class="idx" href="files.html#idx:telling1:1375">4.34</a></dd>
25032521 <dt>term</dt>
25042522 <dd>
2505 <a class="idx" href="glossary.html#idx:term:2133">D</a></dd>
2523 <a class="idx" href="glossary.html#idx:term:2140">D</a></dd>
25062524 <dt>term//1</dt>
25072525 <dd>
2508 <a class="idx" href="IO.html#idx:term1:947">4.16.5</a></dd>
2526 <a class="idx" href="IO.html#idx:term1:948">4.16.5</a></dd>
25092527 <dt><a class="idx" href="attvar.html#term_attvars/2">term_attvars/2</a></dt>
25102528 <dd>
2511 <a class="idx" href="attvar.html#idx:termattvars2:1633">7.1.3</a></dd>
2529 <a class="idx" href="attvar.html#idx:termattvars2:1635">7.1.3</a></dd>
25122530 <dt><a class="idx" href="consulting.html#term_expansion/2">term_expansion/2</a></dt>
25132531 <dd>
2514 <a class="idx" href="hooks.html#idx:termexpansion2:145">2.12</a> <a class="idx" href="consulting.html#idx:termexpansion2:336">4.3</a> <a class="idx" href="consulting.html#idx:termexpansion2:342">4.3</a> <a class="idx" href="consulting.html#idx:termexpansion2:476">4.3</a> <a class="idx" href="consulting.html#idx:termexpansion2:478">4.3.1</a> <a class="idx" href="consulting.html#idx:termexpansion2:480">4.3.1</a> <a class="idx" href="consulting.html#idx:termexpansion2:485">4.3.1</a> <a class="idx" href="consulting.html#idx:termexpansion2:487">4.3.1</a> <a class="idx" href="consulting.html#idx:termexpansion2:491">4.3.1</a> <a class="idx" href="consulting.html#idx:termexpansion2:494">4.3.1</a> <a class="idx" href="consulting.html#idx:termexpansion2:511">4.3.1.2</a> <a class="idx" href="consulting.html#idx:termexpansion2:533">4.3.3</a> <a class="idx" href="toplevel.html#idx:termexpansion2:1388">4.35</a> <a class="idx" href="practical.html#idx:termexpansion2:1675">8.3.3</a> <a class="idx" href="portabilitystrategies.html#idx:termexpansion2:2061">C.1</a></dd>
2532 <a class="idx" href="hooks.html#idx:termexpansion2:145">2.12</a> <a class="idx" href="consulting.html#idx:termexpansion2:337">4.3</a> <a class="idx" href="consulting.html#idx:termexpansion2:343">4.3</a> <a class="idx" href="consulting.html#idx:termexpansion2:477">4.3</a> <a class="idx" href="consulting.html#idx:termexpansion2:479">4.3.1</a> <a class="idx" href="consulting.html#idx:termexpansion2:481">4.3.1</a> <a class="idx" href="consulting.html#idx:termexpansion2:486">4.3.1</a> <a class="idx" href="consulting.html#idx:termexpansion2:488">4.3.1</a> <a class="idx" href="consulting.html#idx:termexpansion2:492">4.3.1</a> <a class="idx" href="consulting.html#idx:termexpansion2:495">4.3.1</a> <a class="idx" href="consulting.html#idx:termexpansion2:512">4.3.1.2</a> <a class="idx" href="consulting.html#idx:termexpansion2:534">4.3.3</a> <a class="idx" href="toplevel.html#idx:termexpansion2:1390">4.35</a> <a class="idx" href="practical.html#idx:termexpansion2:1678">8.3.3</a> <a class="idx" href="portabilitystrategies.html#idx:termexpansion2:2064">C.1</a></dd>
25152533 <dt><a class="idx" href="consulting.html#term_expansion/4">term_expansion/4</a></dt>
25162534 <dd>
2517 <a class="idx" href="consulting.html#idx:termexpansion4:337">4.3</a></dd>
2535 <a class="idx" href="consulting.html#idx:termexpansion4:338">4.3</a></dd>
25182536 <dt><a class="idx" href="db.html#term_hash/2">term_hash/2</a></dt>
25192537 <dd>
2520 <a class="idx" href="cyclic.html#idx:termhash2:209">2.16</a> <a class="idx" href="jitindex.html#idx:termhash2:226">2.17.2</a> <a class="idx" href="db.html#idx:termhash2:764">4.13.2</a> <a class="idx" href="db.html#idx:termhash2:767">4.13.2</a> <a class="idx" href="db.html#idx:termhash2:768">4.13.2</a> <a class="idx" href="db.html#idx:termhash2:769">4.13.2</a></dd>
2538 <a class="idx" href="cyclic.html#idx:termhash2:209">2.16</a> <a class="idx" href="jitindex.html#idx:termhash2:226">2.17.2</a> <a class="idx" href="db.html#idx:termhash2:765">4.13.2</a> <a class="idx" href="db.html#idx:termhash2:768">4.13.2</a> <a class="idx" href="db.html#idx:termhash2:769">4.13.2</a> <a class="idx" href="db.html#idx:termhash2:770">4.13.2</a></dd>
25212539 <dt><a class="idx" href="db.html#term_hash/4">term_hash/4</a></dt>
25222540 <dd>
2523 <a class="idx" href="jitindex.html#idx:termhash4:227">2.17.2</a> <a class="idx" href="db.html#idx:termhash4:765">4.13.2</a></dd>
2541 <a class="idx" href="jitindex.html#idx:termhash4:227">2.17.2</a> <a class="idx" href="db.html#idx:termhash4:766">4.13.2</a></dd>
25242542 <dt><a class="idx" href="strings.html#term_string/2">term_string/2</a></dt>
25252543 <dd>
2526 <a class="idx" href="manipatom.html#idx:termstring2:1149">4.21</a> <a class="idx" href="strings.html#idx:termstring2:1449">5.2.1</a></dd>
2544 <a class="idx" href="manipatom.html#idx:termstring2:1150">4.21</a> <a class="idx" href="strings.html#idx:termstring2:1451">5.2.1</a></dd>
25272545 <dt><a class="idx" href="strings.html#term_string/3">term_string/3</a></dt>
25282546 <dt><a class="idx" href="compare.html#term_subsumer/3">term_subsumer/3</a></dt>
25292547 <dt><a class="idx" href="manipatom.html#term_to_atom/2">term_to_atom/2</a></dt>
25302548 <dd>
2531 <a class="idx" href="IO.html#idx:termtoatom2:944">4.16.5</a> <a class="idx" href="foreigninclude.html#idx:termtoatom2:1840">10.4.5</a></dd>
2549 <a class="idx" href="IO.html#idx:termtoatom2:945">4.16.5</a> <a class="idx" href="foreigninclude.html#idx:termtoatom2:1843">10.4.5</a></dd>
25322550 <dt><a class="idx" href="manipterm.html#term_variables/2">term_variables/2</a></dt>
25332551 <dd>
2534 <a class="idx" href="cyclic.html#idx:termvariables2:216">2.16</a> <a class="idx" href="termrw.html#idx:termvariables2:1063">4.19</a> <a class="idx" href="manipterm.html#idx:termvariables2:1090">4.20</a> <a class="idx" href="manipterm.html#idx:termvariables2:1092">4.20</a></dd>
2552 <a class="idx" href="cyclic.html#idx:termvariables2:216">2.16</a> <a class="idx" href="termrw.html#idx:termvariables2:1064">4.19</a> <a class="idx" href="manipterm.html#idx:termvariables2:1091">4.20</a> <a class="idx" href="manipterm.html#idx:termvariables2:1093">4.20</a></dd>
25352553 <dt><a class="idx" href="manipterm.html#term_variables/3">term_variables/3</a></dt>
25362554 <dd>
2537 <a class="idx" href="manipterm.html#idx:termvariables3:1091">4.20</a></dd>
2555 <a class="idx" href="manipterm.html#idx:termvariables3:1092">4.20</a></dd>
25382556 <dt>terms,cyclic</dt>
25392557 <dd>
25402558 <a class="idx" href="cyclic.html#idx:termscyclic:199">2.16</a></dd>
25412559 <dt><a class="idx" href="strings.html#text_to_string/2">text_to_string/2</a></dt>
25422560 <dt><a class="idx" href="threadcreate.html#thread_at_exit/1">thread_at_exit/1</a></dt>
25432561 <dd>
2544 <a class="idx" href="toplevel.html#idx:threadatexit1:1383">4.35</a> <a class="idx" href="threadcreate.html#idx:threadatexit1:1690">9.1</a> <a class="idx" href="threadcreate.html#idx:threadatexit1:1691">9.1</a> <a class="idx" href="threadcreate.html#idx:threadatexit1:1692">9.1</a> <a class="idx" href="threadcreate.html#idx:threadatexit1:1693">9.1</a> <a class="idx" href="threadcreate.html#idx:threadatexit1:1725">9.1</a> <a class="idx" href="threadcreate.html#idx:threadatexit1:1726">9.1</a> <a class="idx" href="foreignthread.html#idx:threadatexit1:1811">9.6.1</a></dd>
2562 <a class="idx" href="toplevel.html#idx:threadatexit1:1385">4.35</a> <a class="idx" href="threadcreate.html#idx:threadatexit1:1693">9.1</a> <a class="idx" href="threadcreate.html#idx:threadatexit1:1694">9.1</a> <a class="idx" href="threadcreate.html#idx:threadatexit1:1695">9.1</a> <a class="idx" href="threadcreate.html#idx:threadatexit1:1696">9.1</a> <a class="idx" href="threadcreate.html#idx:threadatexit1:1728">9.1</a> <a class="idx" href="threadcreate.html#idx:threadatexit1:1729">9.1</a> <a class="idx" href="foreignthread.html#idx:threadatexit1:1814">9.6.1</a></dd>
25452563 <dt><a class="idx" href="threadcreate.html#thread_create/3">thread_create/3</a></dt>
25462564 <dd>
2547 <a class="idx" href="threadcreate.html#idx:threadcreate3:1713">9.1</a> <a class="idx" href="threadcreate.html#idx:threadcreate3:1727">9.1</a> <a class="idx" href="mt-xpce.html#idx:threadcreate3:1819">9.7</a></dd>
2565 <a class="idx" href="threadcreate.html#idx:threadcreate3:1716">9.1</a> <a class="idx" href="threadcreate.html#idx:threadcreate3:1730">9.1</a> <a class="idx" href="mt-xpce.html#idx:threadcreate3:1822">9.7</a></dd>
25482566 <dt><a class="idx" href="threadpool.html#thread_create_in_pool/4">thread_create_in_pool/4</a></dt>
25492567 <dd>
2550 <a class="idx" href="threadcreate.html#idx:threadcreateinpool4:1703">9.1</a></dd>
2568 <a class="idx" href="threadcreate.html#idx:threadcreateinpool4:1706">9.1</a></dd>
25512569 <dt><a class="idx" href="threadcreate.html#thread_detach/1">thread_detach/1</a></dt>
25522570 <dd>
2553 <a class="idx" href="threadcreate.html#idx:threaddetach1:1699">9.1</a></dd>
2571 <a class="idx" href="threadcreate.html#idx:threaddetach1:1702">9.1</a></dd>
25542572 <dt><a class="idx" href="threadcreate.html#thread_exit/1">thread_exit/1</a></dt>
25552573 <dd>
2556 <a class="idx" href="threadcreate.html#idx:threadexit1:1712">9.1</a> <a class="idx" href="thmonitor.html#idx:threadexit1:1732">9.2</a> <a class="idx" href="threadsync.html#idx:threadexit1:1792">9.4</a></dd>
2574 <a class="idx" href="threadcreate.html#idx:threadexit1:1715">9.1</a> <a class="idx" href="thmonitor.html#idx:threadexit1:1735">9.2</a> <a class="idx" href="threadsync.html#idx:threadexit1:1795">9.4</a></dd>
25572575 <dt><a class="idx" href="threadcom.html#thread_get_message/1">thread_get_message/1</a></dt>
25582576 <dd>
2559 <a class="idx" href="threadcom.html#idx:threadgetmessage1:1756">9.3.1</a></dd>
2577 <a class="idx" href="threadcom.html#idx:threadgetmessage1:1759">9.3.1</a></dd>
25602578 <dt><a class="idx" href="threadcom.html#thread_get_message/2">thread_get_message/2</a></dt>
25612579 <dd>
2562 <a class="idx" href="threadcom.html#idx:threadgetmessage2:1755">9.3.1</a> <a class="idx" href="threadcom.html#idx:threadgetmessage2:1758">9.3.1</a></dd>
2580 <a class="idx" href="threadcom.html#idx:threadgetmessage2:1758">9.3.1</a> <a class="idx" href="threadcom.html#idx:threadgetmessage2:1761">9.3.1</a></dd>
25632581 <dt><a class="idx" href="threadcom.html#thread_get_message/3">thread_get_message/3</a></dt>
25642582 <dd>
2565 <a class="idx" href="threadcom.html#idx:threadgetmessage3:1744">9.3.1</a> <a class="idx" href="threadcom.html#idx:threadgetmessage3:1751">9.3.1</a> <a class="idx" href="threadcom.html#idx:threadgetmessage3:1760">9.3.1</a> <a class="idx" href="threadcom.html#idx:threadgetmessage3:1761">9.3.1</a> <a class="idx" href="threadcom.html#idx:threadgetmessage3:1763">9.3.1</a></dd>
2583 <a class="idx" href="threadcom.html#idx:threadgetmessage3:1747">9.3.1</a> <a class="idx" href="threadcom.html#idx:threadgetmessage3:1754">9.3.1</a> <a class="idx" href="threadcom.html#idx:threadgetmessage3:1763">9.3.1</a> <a class="idx" href="threadcom.html#idx:threadgetmessage3:1764">9.3.1</a> <a class="idx" href="threadcom.html#idx:threadgetmessage3:1766">9.3.1</a></dd>
25662584 <dt><a class="idx" href="threadcreate.html#thread_initialization/1">thread_initialization/1</a></dt>
25672585 <dd>
2568 <a class="idx" href="gvar.html#idx:threadinitialization1:1657">7.3</a></dd>
2586 <a class="idx" href="gvar.html#idx:threadinitialization1:1660">7.3</a></dd>
25692587 <dt><a class="idx" href="threadcreate.html#thread_join/2">thread_join/2</a></dt>
25702588 <dd>
2571 <a class="idx" href="threadcreate.html#idx:threadjoin2:1689">9.1</a> <a class="idx" href="threadcreate.html#idx:threadjoin2:1696">9.1</a> <a class="idx" href="threadcreate.html#idx:threadjoin2:1697">9.1</a> <a class="idx" href="threadcreate.html#idx:threadjoin2:1698">9.1</a> <a class="idx" href="threadcreate.html#idx:threadjoin2:1709">9.1</a> <a class="idx" href="threadcreate.html#idx:threadjoin2:1710">9.1</a> <a class="idx" href="threadcreate.html#idx:threadjoin2:1716">9.1</a> <a class="idx" href="threadcreate.html#idx:threadjoin2:1717">9.1</a> <a class="idx" href="thmonitor.html#idx:threadjoin2:1731">9.2</a></dd>
2589 <a class="idx" href="threadcreate.html#idx:threadjoin2:1692">9.1</a> <a class="idx" href="threadcreate.html#idx:threadjoin2:1699">9.1</a> <a class="idx" href="threadcreate.html#idx:threadjoin2:1700">9.1</a> <a class="idx" href="threadcreate.html#idx:threadjoin2:1701">9.1</a> <a class="idx" href="threadcreate.html#idx:threadjoin2:1712">9.1</a> <a class="idx" href="threadcreate.html#idx:threadjoin2:1713">9.1</a> <a class="idx" href="threadcreate.html#idx:threadjoin2:1719">9.1</a> <a class="idx" href="threadcreate.html#idx:threadjoin2:1720">9.1</a> <a class="idx" href="thmonitor.html#idx:threadjoin2:1734">9.2</a></dd>
25722590 <dt><a class="idx" href="threadcom.html#thread_local/1">thread_local/1</a></dt>
25732591 <dd>
2574 <a class="idx" href="exception.html#idx:threadlocal1:681">4.10.3</a> <a class="idx" href="dynamic.html#idx:threadlocal1:778">4.14</a> <a class="idx" href="examineprog.html#idx:threadlocal1:821">4.15</a> <a class="idx" href="threadcom.html#idx:threadlocal1:1772">9.3.3</a></dd>
2592 <a class="idx" href="exception.html#idx:threadlocal1:682">4.10.3</a> <a class="idx" href="dynamic.html#idx:threadlocal1:779">4.14</a> <a class="idx" href="examineprog.html#idx:threadlocal1:822">4.15</a> <a class="idx" href="threadcom.html#idx:threadlocal1:1775">9.3.3</a></dd>
25752593 <dt><a class="idx" href="exception.html#thread_message_hook/3">thread_message_hook/3</a></dt>
25762594 <dt><a class="idx" href="threadcom.html#thread_peek_message/1">thread_peek_message/1</a></dt>
25772595 <dd>
2578 <a class="idx" href="threadcom.html#idx:threadpeekmessage1:1749">9.3.1</a> <a class="idx" href="threadcom.html#idx:threadpeekmessage1:1750">9.3.1</a> <a class="idx" href="threadcom.html#idx:threadpeekmessage1:1764">9.3.1</a></dd>
2596 <a class="idx" href="threadcom.html#idx:threadpeekmessage1:1752">9.3.1</a> <a class="idx" href="threadcom.html#idx:threadpeekmessage1:1753">9.3.1</a> <a class="idx" href="threadcom.html#idx:threadpeekmessage1:1767">9.3.1</a></dd>
25792597 <dt><a class="idx" href="threadcom.html#thread_peek_message/2">thread_peek_message/2</a></dt>
25802598 <dd>
2581 <a class="idx" href="threadcom.html#idx:threadpeekmessage2:1762">9.3.1</a></dd>
2599 <a class="idx" href="threadcom.html#idx:threadpeekmessage2:1765">9.3.1</a></dd>
25822600 <dt><a class="idx" href="threadpool.html#thread_pool_create/3">thread_pool_create/3</a></dt>
25832601 <dt><a class="idx" href="threadpool.html#thread_pool_destroy/1">thread_pool_destroy/1</a></dt>
25842602 <dt><a class="idx" href="threadpool.html#thread_pool_property/2">thread_pool_property/2</a></dt>
25852603 <dt><a class="idx" href="thmonitor.html#thread_property/2">thread_property/2</a></dt>
25862604 <dd>
2587 <a class="idx" href="threadcreate.html#idx:threadproperty2:1708">9.1</a> <a class="idx" href="threadcreate.html#idx:threadproperty2:1715">9.1</a> <a class="idx" href="threadcreate.html#idx:threadproperty2:1723">9.1</a> <a class="idx" href="thmonitor.html#idx:threadproperty2:1730">9.2</a></dd>
2605 <a class="idx" href="threadcreate.html#idx:threadproperty2:1711">9.1</a> <a class="idx" href="threadcreate.html#idx:threadproperty2:1718">9.1</a> <a class="idx" href="threadcreate.html#idx:threadproperty2:1726">9.1</a> <a class="idx" href="thmonitor.html#idx:threadproperty2:1733">9.2</a></dd>
25882606 <dt><a class="idx" href="threadcreate.html#thread_self/1">thread_self/1</a></dt>
25892607 <dd>
2590 <a class="idx" href="flags.html#idx:threadself1:112">2.11</a> <a class="idx" href="threadcreate.html#idx:threadself1:1714">9.1</a> <a class="idx" href="threadcreate.html#idx:threadself1:1724">9.1</a> <a class="idx" href="threadcom.html#idx:threadself1:1740">9.3.1</a></dd>
2608 <a class="idx" href="flags.html#idx:threadself1:112">2.11</a> <a class="idx" href="threadcreate.html#idx:threadself1:1717">9.1</a> <a class="idx" href="threadcreate.html#idx:threadself1:1727">9.1</a> <a class="idx" href="threadcom.html#idx:threadself1:1743">9.3.1</a></dd>
25912609 <dt><a class="idx" href="threadcom.html#thread_send_message/2">thread_send_message/2</a></dt>
25922610 <dd>
2593 <a class="idx" href="threadcom.html#idx:threadsendmessage2:1741">9.3.1</a> <a class="idx" href="threadcom.html#idx:threadsendmessage2:1742">9.3.1</a> <a class="idx" href="threadcom.html#idx:threadsendmessage2:1753">9.3.1</a></dd>
2611 <a class="idx" href="threadcom.html#idx:threadsendmessage2:1744">9.3.1</a> <a class="idx" href="threadcom.html#idx:threadsendmessage2:1745">9.3.1</a> <a class="idx" href="threadcom.html#idx:threadsendmessage2:1756">9.3.1</a></dd>
25942612 <dt><a class="idx" href="threadcom.html#thread_send_message/3">thread_send_message/3</a></dt>
25952613 <dd>
2596 <a class="idx" href="threadcom.html#idx:threadsendmessage3:1743">9.3.1</a> <a class="idx" href="threadcom.html#idx:threadsendmessage3:1746">9.3.1</a> <a class="idx" href="threadcom.html#idx:threadsendmessage3:1747">9.3.1</a> <a class="idx" href="threadcom.html#idx:threadsendmessage3:1748">9.3.1</a></dd>
2614 <a class="idx" href="threadcom.html#idx:threadsendmessage3:1746">9.3.1</a> <a class="idx" href="threadcom.html#idx:threadsendmessage3:1749">9.3.1</a> <a class="idx" href="threadcom.html#idx:threadsendmessage3:1750">9.3.1</a> <a class="idx" href="threadcom.html#idx:threadsendmessage3:1751">9.3.1</a></dd>
25972615 <dt><a class="idx" href="threadcreate.html#thread_setconcurrency/2">thread_setconcurrency/2</a></dt>
25982616 <dd>
25992617 <a class="idx" href="flags.html#idx:threadsetconcurrency2:79">2.11</a></dd>
26002618 <dt><a class="idx" href="threadcom.html#thread_signal/2">thread_signal/2</a></dt>
26012619 <dd>
2602 <a class="idx" href="metacall.html#idx:threadsignal2:616">4.9</a> <a class="idx" href="threadcom.html#idx:threadsignal2:1768">9.3.2</a> <a class="idx" href="thutil.html#idx:threadsignal2:1800">9.5.1</a> <a class="idx" href="foreigninclude.html#idx:threadsignal2:1863">10.4.13</a> <a class="idx" href="foreigninclude.html#idx:threadsignal2:1895">10.4.21.1</a></dd>
2620 <a class="idx" href="metacall.html#idx:threadsignal2:617">4.9</a> <a class="idx" href="threadcom.html#idx:threadsignal2:1771">9.3.2</a> <a class="idx" href="thutil.html#idx:threadsignal2:1803">9.5.1</a> <a class="idx" href="foreigninclude.html#idx:threadsignal2:1866">10.4.13</a> <a class="idx" href="foreigninclude.html#idx:threadsignal2:1898">10.4.21.1</a></dd>
26032621 <dt><a class="idx" href="thmonitor.html#thread_statistics/3">thread_statistics/3</a></dt>
26042622 <dd>
2605 <a class="idx" href="thmonitor.html#idx:threadstatistics3:1735">9.2</a></dd>
2623 <a class="idx" href="thmonitor.html#idx:threadstatistics3:1738">9.2</a></dd>
26062624 <dt><a class="idx" href="thutil.html#threads/0">threads/0</a></dt>
26072625 <dt><a class="idx" href="exception.html#throw/1">throw/1</a></dt>
26082626 <dd>
2609 <a class="idx" href="debugoverview.html#idx:throw1:38">2.9</a> <a class="idx" href="cyclic.html#idx:throw1:217">2.16</a> <a class="idx" href="exception.html#idx:throw1:628">4.10</a> <a class="idx" href="exception.html#idx:throw1:630">4.10</a> <a class="idx" href="exception.html#idx:throw1:631">4.10</a> <a class="idx" href="exception.html#idx:throw1:639">4.10</a> <a class="idx" href="exception.html#idx:throw1:644">4.10</a> <a class="idx" href="exception.html#idx:throw1:691">4.10.3.1</a> <a class="idx" href="signal.html#idx:throw1:699">4.11.1</a> <a class="idx" href="threadcreate.html#idx:throw1:1719">9.1</a> <a class="idx" href="thmonitor.html#idx:throw1:1733">9.2</a> <a class="idx" href="threadcom.html#idx:throw1:1767">9.3.2</a> <a class="idx" href="threadcom.html#idx:throw1:1769">9.3.2</a> <a class="idx" href="foreigninclude.html#idx:throw1:1861">10.4.12</a> <a class="idx" href="foreigninclude.html#idx:throw1:1862">10.4.12</a> <a class="idx" href="excepthook.html#idx:throw1:2008">B.5</a> <a class="idx" href="exception3.html#idx:throw1:2016">B.6</a> <a class="idx" href="exception3.html#idx:throw1:2019">B.6</a></dd>
2627 <a class="idx" href="debugoverview.html#idx:throw1:38">2.9</a> <a class="idx" href="cyclic.html#idx:throw1:217">2.16</a> <a class="idx" href="exception.html#idx:throw1:629">4.10</a> <a class="idx" href="exception.html#idx:throw1:631">4.10</a> <a class="idx" href="exception.html#idx:throw1:632">4.10</a> <a class="idx" href="exception.html#idx:throw1:640">4.10</a> <a class="idx" href="exception.html#idx:throw1:645">4.10</a> <a class="idx" href="exception.html#idx:throw1:692">4.10.3.1</a> <a class="idx" href="signal.html#idx:throw1:700">4.11.1</a> <a class="idx" href="threadcreate.html#idx:throw1:1722">9.1</a> <a class="idx" href="thmonitor.html#idx:throw1:1736">9.2</a> <a class="idx" href="threadcom.html#idx:throw1:1770">9.3.2</a> <a class="idx" href="threadcom.html#idx:throw1:1772">9.3.2</a> <a class="idx" href="foreigninclude.html#idx:throw1:1864">10.4.12</a> <a class="idx" href="foreigninclude.html#idx:throw1:1865">10.4.12</a> <a class="idx" href="excepthook.html#idx:throw1:2011">B.5</a> <a class="idx" href="exception3.html#idx:throw1:2019">B.6</a> <a class="idx" href="exception3.html#idx:throw1:2022">B.6</a></dd>
26102628 <dt><a class="idx" href="statistics.html#time/1">time/1</a></dt>
26112629 <dd>
2612 <a class="idx" href="arith.html#idx:time1:1217">4.26.2.3</a></dd>
2630 <a class="idx" href="arith.html#idx:time1:1219">4.26.2.3</a></dd>
26132631 <dt><a class="idx" href="files.html#time_file/2">time_file/2</a></dt>
26142632 <dt><a class="idx" href="files.html#tmp_file/2">tmp_file/2</a></dt>
26152633 <dd>
2616 <a class="idx" href="files.html#idx:tmpfile2:1369">4.34</a></dd>
2634 <a class="idx" href="files.html#idx:tmpfile2:1371">4.34</a></dd>
26172635 <dt><a class="idx" href="files.html#tmp_file_stream/3">tmp_file_stream/3</a></dt>
26182636 <dd>
2619 <a class="idx" href="files.html#idx:tmpfilestream3:1368">4.34</a></dd>
2637 <a class="idx" href="files.html#idx:tmpfilestream3:1370">4.34</a></dd>
26202638 <dt><a class="idx" href="thutil.html#tnodebug/0">tnodebug/0</a></dt>
26212639 <dt><a class="idx" href="thutil.html#tnodebug/1">tnodebug/1</a></dt>
26222640 <dd>
2623 <a class="idx" href="thutil.html#idx:tnodebug1:1807">9.5.1</a></dd>
2641 <a class="idx" href="thutil.html#idx:tnodebug1:1810">9.5.1</a></dd>
26242642 <dt><a class="idx" href="IO.html#told/0">told/0</a></dt>
26252643 <dt><a class="idx" href="ugraphs.html#top_sort/2">top_sort/2</a></dt>
26262644 <dt><a class="idx" href="ugraphs.html#top_sort/3">top_sort/3</a></dt>
26272645 <dt><a class="idx" href="thutil.html#tprofile/1">tprofile/1</a></dt>
26282646 <dd>
2629 <a class="idx" href="thutil.html#idx:tprofile1:1809">9.5.2</a></dd>
2647 <a class="idx" href="thutil.html#idx:tprofile1:1812">9.5.2</a></dd>
26302648 <dt><a class="idx" href="debugger.html#trace/0">trace/0</a></dt>
26312649 <dd>
2632 <a class="idx" href="debugoverview.html#idx:trace0:39">2.9</a> <a class="idx" href="debugoverview.html#idx:trace0:42">2.9</a> <a class="idx" href="flags.html#idx:trace0:93">2.11</a> <a class="idx" href="flags.html#idx:trace0:119">2.11</a> <a class="idx" href="guitracer.html#idx:trace0:287">3.5.1</a> <a class="idx" href="guitracer.html#idx:trace0:289">3.5.1</a> <a class="idx" href="idesummary.html#idx:trace0:302">3.9</a> <a class="idx" href="debugger.html#idx:trace0:1393">4.37</a> <a class="idx" href="debugger.html#idx:trace0:1394">4.37</a> <a class="idx" href="debugger.html#idx:trace0:1400">4.37</a> <a class="idx" href="debugger.html#idx:trace0:1401">4.37</a> <a class="idx" href="debugging.html#idx:trace0:1680">8.4.3</a> <a class="idx" href="debugging.html#idx:trace0:1682">8.4.3</a> <a class="idx" href="threadcom.html#idx:trace0:1770">9.3.2</a> <a class="idx" href="foreigninclude.html#idx:trace0:1874">10.4.16</a> <a class="idx" href="breakpoint.html#idx:trace0:2004">B.4</a> <a class="idx" href="excepthook.html#idx:trace0:2012">B.5</a></dd>
2650 <a class="idx" href="debugoverview.html#idx:trace0:39">2.9</a> <a class="idx" href="debugoverview.html#idx:trace0:42">2.9</a> <a class="idx" href="flags.html#idx:trace0:93">2.11</a> <a class="idx" href="flags.html#idx:trace0:119">2.11</a> <a class="idx" href="guitracer.html#idx:trace0:287">3.5.1</a> <a class="idx" href="guitracer.html#idx:trace0:289">3.5.1</a> <a class="idx" href="idesummary.html#idx:trace0:302">3.9</a> <a class="idx" href="debugger.html#idx:trace0:1395">4.37</a> <a class="idx" href="debugger.html#idx:trace0:1396">4.37</a> <a class="idx" href="debugger.html#idx:trace0:1402">4.37</a> <a class="idx" href="debugger.html#idx:trace0:1403">4.37</a> <a class="idx" href="debugging.html#idx:trace0:1683">8.4.3</a> <a class="idx" href="debugging.html#idx:trace0:1685">8.4.3</a> <a class="idx" href="threadcom.html#idx:trace0:1773">9.3.2</a> <a class="idx" href="foreigninclude.html#idx:trace0:1877">10.4.16</a> <a class="idx" href="breakpoint.html#idx:trace0:2007">B.4</a> <a class="idx" href="excepthook.html#idx:trace0:2015">B.5</a></dd>
26332651 <dt><a class="idx" href="debugger.html#trace/1">trace/1</a></dt>
26342652 <dd>
26352653 <a class="idx" href="flags.html#idx:trace1:82">2.11</a></dd>
26362654 <dt><a class="idx" href="debugger.html#trace/2">trace/2</a></dt>
26372655 <dd>
2638 <a class="idx" href="debugger.html#idx:trace2:1398">4.37</a></dd>
2656 <a class="idx" href="debugger.html#idx:trace2:1400">4.37</a></dd>
26392657 <dt><a class="idx" href="debugger.html#tracing/0">tracing/0</a></dt>
26402658 <dd>
2641 <a class="idx" href="debugger.html#idx:tracing0:1395">4.37</a></dd>
2659 <a class="idx" href="debugger.html#idx:tracing0:1397">4.37</a></dd>
26422660 <dt>transformation,of program</dt>
26432661 <dd>
2644 <a class="idx" href="consulting.html#idx:transformationofprogram:477">4.3.1</a></dd>
2662 <a class="idx" href="consulting.html#idx:transformationofprogram:478">4.3.1</a></dd>
26452663 <dt><a class="idx" href="ugraphs.html#transitive_closure/2">transitive_closure/2</a></dt>
26462664 <dt>transparent</dt>
26472665 <dd>
2648 <a class="idx" href="glossary.html#idx:transparent:2110">D</a></dd>
2666 <a class="idx" href="glossary.html#idx:transparent:2116">D</a></dd>
26492667 <dt><a class="idx" href="simplex.html#transportation/4">transportation/4</a></dt>
26502668 <dt><a class="idx" href="clpfd.html#transpose/2">transpose/2</a></dt>
26512669 <dt><a class="idx" href="pairs.html#transpose_pairs/2">transpose_pairs/2</a></dt>
26522670 <dt><a class="idx" href="memory.html#trim_stacks/0">trim_stacks/0</a></dt>
26532671 <dd>
2654 <a class="idx" href="memory.html#idx:trimstacks0:1428">4.40</a> <a class="idx" href="memory.html#idx:trimstacks0:1431">4.40</a></dd>
2672 <a class="idx" href="memory.html#idx:trimstacks0:1430">4.40</a> <a class="idx" href="memory.html#idx:trimstacks0:1433">4.40</a></dd>
26552673 <dt><a class="idx" href="check.html#trivial_fail_goal/1">trivial_fail_goal/1</a></dt>
26562674 <dt><a class="idx" href="control.html#true/0">true/0</a></dt>
26572675 <dd>
2658 <a class="idx" href="flags.html#idx:true0:100">2.11</a> <a class="idx" href="consulting.html#idx:true0:504">4.3.1</a> <a class="idx" href="control.html#idx:true0:596">4.8</a> <a class="idx" href="metacall.html#idx:true0:606">4.9</a></dd>
2676 <a class="idx" href="flags.html#idx:true0:100">2.11</a> <a class="idx" href="consulting.html#idx:true0:505">4.3.1</a> <a class="idx" href="control.html#idx:true0:597">4.8</a> <a class="idx" href="metacall.html#idx:true0:607">4.9</a></dd>
26592677 <dt>truncate/1</dt>
26602678 <dd>
2661 <a class="idx" href="arith.html#idx:truncate1:1215">4.26.2.3</a></dd>
2679 <a class="idx" href="arith.html#idx:truncate1:1217">4.26.2.3</a></dd>
26622680 <dt><a class="idx" href="thutil.html#tspy/1">tspy/1</a></dt>
26632681 <dd>
2664 <a class="idx" href="threadcreate.html#idx:tspy1:1694">9.1</a> <a class="idx" href="thutil.html#idx:tspy1:1796">9.5.1</a></dd>
2682 <a class="idx" href="threadcreate.html#idx:tspy1:1697">9.1</a> <a class="idx" href="thutil.html#idx:tspy1:1799">9.5.1</a></dd>
26652683 <dt><a class="idx" href="thutil.html#tspy/2">tspy/2</a></dt>
26662684 <dt><a class="idx" href="tty.html#tty_get_capability/3">tty_get_capability/3</a></dt>
26672685 <dd>
2668 <a class="idx" href="tty.html#idx:ttygetcapability3:1291">4.32</a> <a class="idx" href="tty.html#idx:ttygetcapability3:1293">4.32</a></dd>
2686 <a class="idx" href="tty.html#idx:ttygetcapability3:1293">4.32</a> <a class="idx" href="tty.html#idx:ttygetcapability3:1295">4.32</a></dd>
26692687 <dt><a class="idx" href="tty.html#tty_goto/2">tty_goto/2</a></dt>
26702688 <dt><a class="idx" href="tty.html#tty_put/2">tty_put/2</a></dt>
26712689 <dt><a class="idx" href="tty.html#tty_size/2">tty_size/2</a></dt>
26722690 <dd>
2673 <a class="idx" href="tty.html#idx:ttysize2:1292">4.32</a></dd>
2691 <a class="idx" href="tty.html#idx:ttysize2:1294">4.32</a></dd>
26742692 <dt><a class="idx" href="chario.html#ttyflush/0">ttyflush/0</a></dt>
26752693 <dd>
2676 <a class="idx" href="format.html#idx:ttyflush0:1275">4.31.1</a></dd>
2694 <a class="idx" href="format.html#idx:ttyflush0:1277">4.31.1</a></dd>
26772695 <dt><a class="idx" href="clpfd.html#tuples_in/2">tuples_in/2</a></dt>
26782696 <dt>type_error/2</dt>
26792697 <dd>
2680 <a class="idx" href="exception.html#idx:typeerror2:692">4.10.3.1</a> <a class="idx" href="foreigninclude.html#idx:typeerror2:1844">10.4.6</a> <a class="idx" href="foreigninclude.html#idx:typeerror2:1846">10.4.6</a></dd>
2698 <a class="idx" href="exception.html#idx:typeerror2:693">4.10.3.1</a> <a class="idx" href="foreigninclude.html#idx:typeerror2:1847">10.4.6</a> <a class="idx" href="foreigninclude.html#idx:typeerror2:1849">10.4.6</a></dd>
26812699 <dt><a class="idx" href="ugraphs.html#ugraph_union/3">ugraph_union/3</a></dt>
26822700 <dt><a class="idx" href="compare.html#unifiable/3">unifiable/3</a></dt>
26832701 <dd>
2684 <a class="idx" href="cyclic.html#idx:unifiable3:219">2.16</a> <a class="idx" href="compare.html#idx:unifiable3:579">4.7.2</a></dd>
2702 <a class="idx" href="cyclic.html#idx:unifiable3:219">2.16</a> <a class="idx" href="compare.html#idx:unifiable3:580">4.7.2</a></dd>
26852703 <dt>unify</dt>
26862704 <dd>
2687 <a class="idx" href="glossary.html#idx:unify:2134">D</a></dd>
2705 <a class="idx" href="glossary.html#idx:unify:2141">D</a></dd>
26882706 <dt><a class="idx" href="compare.html#unify_with_occurs_check/2">unify_with_occurs_check/2</a></dt>
26892707 <dd>
2690 <a class="idx" href="flags.html#idx:unifywithoccurscheck2:98">2.11</a> <a class="idx" href="cyclic.html#idx:unifywithoccurscheck2:218">2.16</a> <a class="idx" href="compare.html#idx:unifywithoccurscheck2:577">4.7.2</a> <a class="idx" href="compare.html#idx:unifywithoccurscheck2:581">4.7.2</a> <a class="idx" href="compare.html#idx:unifywithoccurscheck2:582">4.7.2</a></dd>
2708 <a class="idx" href="flags.html#idx:unifywithoccurscheck2:98">2.11</a> <a class="idx" href="cyclic.html#idx:unifywithoccurscheck2:218">2.16</a> <a class="idx" href="compare.html#idx:unifywithoccurscheck2:578">4.7.2</a> <a class="idx" href="compare.html#idx:unifywithoccurscheck2:582">4.7.2</a> <a class="idx" href="compare.html#idx:unifywithoccurscheck2:583">4.7.2</a></dd>
26912709 <dt><a class="idx" href="lists.html#union/3">union/3</a></dt>
26922710 <dt>unix</dt>
26932711 <dd>
26952713 <dt><a class="idx" href="system.html#unix/1">unix/1</a></dt>
26962714 <dt><a class="idx" href="debugger.html#unknown/2">unknown/2</a></dt>
26972715 <dd>
2698 <a class="idx" href="debugger.html#idx:unknown2:1409">4.37</a> <a class="idx" href="libpl.html#idx:unknown2:1937">A</a></dd>
2716 <a class="idx" href="debugger.html#idx:unknown2:1411">4.37</a> <a class="idx" href="libpl.html#idx:unknown2:1940">A</a></dd>
26992717 <dt><a class="idx" href="broadcast.html#unlisten/1">unlisten/1</a></dt>
27002718 <dt><a class="idx" href="broadcast.html#unlisten/2">unlisten/2</a></dt>
27012719 <dt><a class="idx" href="broadcast.html#unlisten/3">unlisten/3</a></dt>
27022720 <dt><a class="idx" href="consulting.html#unload_file/1">unload_file/1</a></dt>
27032721 <dd>
2704 <a class="idx" href="consulting.html#idx:unloadfile1:384">4.3</a></dd>
2722 <a class="idx" href="consulting.html#idx:unloadfile1:385">4.3</a></dd>
27052723 <dt><a class="idx" href="foreignlink.html#unload_foreign_library/1">unload_foreign_library/1</a></dt>
27062724 <dt><a class="idx" href="foreignlink.html#unload_foreign_library/2">unload_foreign_library/2</a></dt>
27072725 <dt><a class="idx" href="system.html#unsetenv/1">unsetenv/1</a></dt>
27082726 <dd>
2709 <a class="idx" href="system.html#idx:unsetenv1:1306">4.33</a> <a class="idx" href="system.html#idx:unsetenv1:1307">4.33</a></dd>
2727 <a class="idx" href="system.html#idx:unsetenv1:1308">4.33</a> <a class="idx" href="system.html#idx:unsetenv1:1309">4.33</a></dd>
27102728 <dt><a class="idx" href="chartype.html#upcase_atom/2">upcase_atom/2</a></dt>
27112729 <dd>
2712 <a class="idx" href="chartype.html#idx:upcaseatom2:1173">4.23</a> <a class="idx" href="chartype.html#idx:upcaseatom2:1175">4.23</a></dd>
2730 <a class="idx" href="chartype.html#idx:upcaseatom2:1174">4.23</a> <a class="idx" href="chartype.html#idx:upcaseatom2:1176">4.23</a></dd>
27132731 <dt>update view</dt>
27142732 <dd>
2715 <a class="idx" href="db.html#idx:updateview:760">4.13.1</a> <a class="idx" href="glossary.html#idx:updateview:2135">D</a></dd>
2733 <a class="idx" href="db.html#idx:updateview:761">4.13.1</a> <a class="idx" href="glossary.html#idx:updateview:2142">D</a></dd>
27162734 <dt><a class="idx" href="url.html#url_iri/2">url_iri/2</a></dt>
27172735 <dt><a class="idx" href="foreignlink.html#use_foreign_library/1">use_foreign_library/1</a></dt>
27182736 <dd>
2719 <a class="idx" href="consulting.html#idx:useforeignlibrary1:433">4.3</a> <a class="idx" href="consulting.html#idx:useforeignlibrary1:472">4.3</a> <a class="idx" href="system.html#idx:useforeignlibrary1:1326">4.33.1</a> <a class="idx" href="runtime.html#idx:useforeignlibrary1:1909">11</a></dd>
2737 <a class="idx" href="consulting.html#idx:useforeignlibrary1:434">4.3</a> <a class="idx" href="consulting.html#idx:useforeignlibrary1:473">4.3</a> <a class="idx" href="system.html#idx:useforeignlibrary1:1328">4.33.1</a> <a class="idx" href="runtime.html#idx:useforeignlibrary1:1912">11</a></dd>
27202738 <dt><a class="idx" href="foreignlink.html#use_foreign_library/2">use_foreign_library/2</a></dt>
27212739 <dt><a class="idx" href="import.html#use_module/1">use_module/1</a></dt>
27222740 <dd>
2723 <a class="idx" href="flags.html#idx:usemodule1:131">2.11</a> <a class="idx" href="hooks.html#idx:usemodule1:149">2.12</a> <a class="idx" href="projectfiles.html#idx:usemodule1:270">3.1.1.3</a> <a class="idx" href="consulting.html#idx:usemodule1:351">4.3</a> <a class="idx" href="consulting.html#idx:usemodule1:357">4.3</a> <a class="idx" href="consulting.html#idx:usemodule1:375">4.3</a> <a class="idx" href="consulting.html#idx:usemodule1:408">4.3</a> <a class="idx" href="consulting.html#idx:usemodule1:520">4.3.2.1</a> <a class="idx" href="consulting.html#idx:usemodule1:521">4.3.2.1</a> <a class="idx" href="consulting.html#idx:usemodule1:523">4.3.2.1</a> <a class="idx" href="defmodule.html#idx:usemodule1:1522">6.2</a> <a class="idx" href="import.html#idx:usemodule1:1523">6.3</a> <a class="idx" href="import.html#idx:usemodule1:1531">6.3</a> <a class="idx" href="import.html#idx:usemodule1:1538">6.3</a> <a class="idx" href="reexport.html#idx:usemodule1:1570">6.7</a> <a class="idx" href="resmodules.html#idx:usemodule1:1581">6.10</a> <a class="idx" href="altmoduleapi.html#idx:usemodule1:1582">6.11</a> <a class="idx" href="runtime.html#idx:usemodule1:1914">11</a> <a class="idx" href="dialect.html#idx:usemodule1:2053">C</a></dd>
2741 <a class="idx" href="flags.html#idx:usemodule1:131">2.11</a> <a class="idx" href="hooks.html#idx:usemodule1:149">2.12</a> <a class="idx" href="projectfiles.html#idx:usemodule1:270">3.1.1.3</a> <a class="idx" href="consulting.html#idx:usemodule1:352">4.3</a> <a class="idx" href="consulting.html#idx:usemodule1:358">4.3</a> <a class="idx" href="consulting.html#idx:usemodule1:376">4.3</a> <a class="idx" href="consulting.html#idx:usemodule1:409">4.3</a> <a class="idx" href="consulting.html#idx:usemodule1:521">4.3.2.1</a> <a class="idx" href="consulting.html#idx:usemodule1:522">4.3.2.1</a> <a class="idx" href="consulting.html#idx:usemodule1:524">4.3.2.1</a> <a class="idx" href="defmodule.html#idx:usemodule1:1524">6.2</a> <a class="idx" href="import.html#idx:usemodule1:1525">6.3</a> <a class="idx" href="import.html#idx:usemodule1:1533">6.3</a> <a class="idx" href="import.html#idx:usemodule1:1540">6.3</a> <a class="idx" href="reexport.html#idx:usemodule1:1572">6.7</a> <a class="idx" href="resmodules.html#idx:usemodule1:1583">6.10</a> <a class="idx" href="altmoduleapi.html#idx:usemodule1:1584">6.11</a> <a class="idx" href="runtime.html#idx:usemodule1:1917">11</a> <a class="idx" href="dialect.html#idx:usemodule1:2056">C</a></dd>
27242742 <dt><a class="idx" href="import.html#use_module/2">use_module/2</a></dt>
27252743 <dd>
2726 <a class="idx" href="autoload.html#idx:usemodule2:164">2.13</a> <a class="idx" href="consulting.html#idx:usemodule2:352">4.3</a> <a class="idx" href="consulting.html#idx:usemodule2:358">4.3</a> <a class="idx" href="consulting.html#idx:usemodule2:376">4.3</a> <a class="idx" href="consulting.html#idx:usemodule2:378">4.3</a> <a class="idx" href="import.html#idx:usemodule2:1524">6.3</a> <a class="idx" href="import.html#idx:usemodule2:1528">6.3</a> <a class="idx" href="import.html#idx:usemodule2:1529">6.3</a> <a class="idx" href="import.html#idx:usemodule2:1532">6.3</a> <a class="idx" href="import.html#idx:usemodule2:1539">6.3</a> <a class="idx" href="reexport.html#idx:usemodule2:1571">6.7</a> <a class="idx" href="dialect.html#idx:usemodule2:2054">C</a></dd>
2744 <a class="idx" href="autoload.html#idx:usemodule2:164">2.13</a> <a class="idx" href="consulting.html#idx:usemodule2:353">4.3</a> <a class="idx" href="consulting.html#idx:usemodule2:359">4.3</a> <a class="idx" href="consulting.html#idx:usemodule2:377">4.3</a> <a class="idx" href="consulting.html#idx:usemodule2:379">4.3</a> <a class="idx" href="import.html#idx:usemodule2:1526">6.3</a> <a class="idx" href="import.html#idx:usemodule2:1530">6.3</a> <a class="idx" href="import.html#idx:usemodule2:1531">6.3</a> <a class="idx" href="import.html#idx:usemodule2:1534">6.3</a> <a class="idx" href="import.html#idx:usemodule2:1541">6.3</a> <a class="idx" href="reexport.html#idx:usemodule2:1573">6.7</a> <a class="idx" href="dialect.html#idx:usemodule2:2057">C</a></dd>
27272745 <dt>use_module/[1,2]</dt>
27282746 <dd>
2729 <a class="idx" href="compilation.html#idx:usemodule12:55">2.10.1</a> <a class="idx" href="pceemacs.html#idx:usemodule12:282">3.4.3.1</a> <a class="idx" href="consulting.html#idx:usemodule12:330">4.3</a> <a class="idx" href="consulting.html#idx:usemodule12:380">4.3</a> <a class="idx" href="consulting.html#idx:usemodule12:402">4.3</a> <a class="idx" href="altmoduleapi.html#idx:usemodule12:1583">6.11</a> <a class="idx" href="altmoduleapi.html#idx:usemodule12:1586">6.11</a> <a class="idx" href="glossary.html#idx:usemodule12:2094">D</a></dd>
2747 <a class="idx" href="compilation.html#idx:usemodule12:55">2.10.1</a> <a class="idx" href="pceemacs.html#idx:usemodule12:282">3.4.3.1</a> <a class="idx" href="consulting.html#idx:usemodule12:331">4.3</a> <a class="idx" href="consulting.html#idx:usemodule12:381">4.3</a> <a class="idx" href="consulting.html#idx:usemodule12:403">4.3</a> <a class="idx" href="altmoduleapi.html#idx:usemodule12:1585">6.11</a> <a class="idx" href="altmoduleapi.html#idx:usemodule12:1588">6.11</a> <a class="idx" href="glossary.html#idx:usemodule12:2098">D</a></dd>
27302748 <dt>user profile file</dt>
27312749 <dd>
27322750 <a class="idx" href="initfile.html#idx:userprofilefile:8">2.2</a></dd>
27332751 <dt>utf-8</dt>
27342752 <dd>
2735 <a class="idx" href="chars.html#idx:utf8:310">4.2</a></dd>
2753 <a class="idx" href="chars.html#idx:utf8:311">4.2</a></dd>
27362754 <dt>valgrind</dt>
27372755 <dd>
2738 <a class="idx" href="foreignnotes.html#idx:valgrind:1901">10.8.3</a></dd>
2756 <a class="idx" href="foreignnotes.html#idx:valgrind:1904">10.8.3</a></dd>
27392757 <dt><a class="idx" href="check.html#valid_string_goal/1">valid_string_goal/1</a></dt>
27402758 <dt><a class="idx" href="typetest.html#var/1">var/1</a></dt>
27412759 <dd>
2742 <a class="idx" href="attvar.html#idx:var1:1622">7.1.1</a> <a class="idx" href="foreigninclude.html#idx:var1:1828">10.4.3</a></dd>
2760 <a class="idx" href="attvar.html#idx:var1:1624">7.1.1</a> <a class="idx" href="foreigninclude.html#idx:var1:1831">10.4.3</a></dd>
27432761 <dt><a class="idx" href="manipterm.html#var_number/2">var_number/2</a></dt>
27442762 <dt><a class="idx" href="consulting.html#var_property/2">var_property/2</a></dt>
27452763 <dt>variable</dt>
27462764 <dd>
2747 <a class="idx" href="glossary.html#idx:variable:2137">D</a></dd>
2765 <a class="idx" href="glossary.html#idx:variable:2144">D</a></dd>
27482766 <dt>variable,anonymous</dt>
27492767 <dd>
2750 <a class="idx" href="glossary.html#idx:variableanonymous:2071">D</a></dd>
2768 <a class="idx" href="glossary.html#idx:variableanonymous:2074">D</a></dd>
27512769 <dt><a class="idx" href="simplex.html#variable_value/3">variable_value/3</a></dt>
27522770 <dt>variant</dt>
27532771 <dd>
2754 <a class="idx" href="compare.html#idx:variant:584">4.7.2</a></dd>
2772 <a class="idx" href="compare.html#idx:variant:585">4.7.2</a></dd>
27552773 <dt><a class="idx" href="db.html#variant_sha1/2">variant_sha1/2</a></dt>
27562774 <dd>
2757 <a class="idx" href="otherlicenses.html#idx:variantsha12:2141">E.4.1</a></dd>
2775 <a class="idx" href="otherlicenses.html#idx:variantsha12:2148">E.4.1</a></dd>
27582776 <dt><a class="idx" href="varnumbers.html#varnumbers/2">varnumbers/2</a></dt>
27592777 <dt><a class="idx" href="varnumbers.html#varnumbers/3">varnumbers/3</a></dt>
27602778 <dt>verbose</dt>
27622780 <a class="idx" href="cmdline.html#idx:verbose:14">2.4.2</a></dd>
27632781 <dt><a class="idx" href="exception.html#version/0">version/0</a></dt>
27642782 <dd>
2765 <a class="idx" href="exception.html#idx:version0:687">4.10.3</a></dd>
2783 <a class="idx" href="exception.html#idx:version0:688">4.10.3</a></dd>
27662784 <dt><a class="idx" href="exception.html#version/1">version/1</a></dt>
27672785 <dd>
2768 <a class="idx" href="exception.html#idx:version1:686">4.10.3</a></dd>
2786 <a class="idx" href="exception.html#idx:version1:687">4.10.3</a></dd>
27692787 <dt><a class="idx" href="ugraphs.html#vertices/2">vertices/2</a></dt>
27702788 <dt><a class="idx" href="ugraphs.html#vertices_edges_to_ugraph/3">vertices_edges_to_ugraph/3</a></dt>
27712789 <dt>view,update</dt>
27722790 <dd>
2773 <a class="idx" href="glossary.html#idx:viewupdate:2136">D</a></dd>
2791 <a class="idx" href="glossary.html#idx:viewupdate:2143">D</a></dd>
27742792 <dt><a class="idx" href="debugger.html#visible/1">visible/1</a></dt>
27752793 <dd>
2776 <a class="idx" href="tracehook.html#idx:visible1:1993">B.3</a></dd>
2794 <a class="idx" href="tracehook.html#idx:visible1:1996">B.3</a></dd>
27772795 <dt>vm_list/1</dt>
27782796 <dd>
2779 <a class="idx" href="foreigninclude.html#idx:vmlist1:1880">10.4.16</a></dd>
2797 <a class="idx" href="foreigninclude.html#idx:vmlist1:1883">10.4.16</a></dd>
27802798 <dt><a class="idx" href="runtime.html#volatile/1">volatile/1</a></dt>
27812799 <dd>
2782 <a class="idx" href="examineprog.html#idx:volatile1:826">4.15</a> <a class="idx" href="threadcom.html#idx:volatile1:1776">9.3.3</a></dd>
2800 <a class="idx" href="examineprog.html#idx:volatile1:827">4.15</a> <a class="idx" href="threadcom.html#idx:volatile1:1779">9.3.3</a></dd>
27832801 <dt><a class="idx" href="streamstat.html#wait_for_input/3">wait_for_input/3</a></dt>
27842802 <dd>
2785 <a class="idx" href="IO.html#idx:waitforinput3:915">4.16.2</a> <a class="idx" href="IO.html#idx:waitforinput3:916">4.16.2</a> <a class="idx" href="streamstat.html#idx:waitforinput3:952">4.17</a> <a class="idx" href="streamstat.html#idx:waitforinput3:953">4.17</a> <a class="idx" href="streamstat.html#idx:waitforinput3:955">4.17</a></dd>
2803 <a class="idx" href="IO.html#idx:waitforinput3:916">4.16.2</a> <a class="idx" href="IO.html#idx:waitforinput3:917">4.16.2</a> <a class="idx" href="streamstat.html#idx:waitforinput3:953">4.17</a> <a class="idx" href="streamstat.html#idx:waitforinput3:954">4.17</a> <a class="idx" href="streamstat.html#idx:waitforinput3:956">4.17</a></dd>
27862804 <dt><a class="idx" href="coroutining.html#when/2">when/2</a></dt>
27872805 <dd>
2788 <a class="idx" href="cyclic.html#idx:when2:220">2.16</a> <a class="idx" href="compare.html#idx:when2:592">4.7.2</a> <a class="idx" href="coroutining.html#idx:when2:1644">7.2</a></dd>
2806 <a class="idx" href="cyclic.html#idx:when2:220">2.16</a> <a class="idx" href="compare.html#idx:when2:593">4.7.2</a> <a class="idx" href="coroutining.html#idx:when2:1646">7.2</a></dd>
27892807 <dt><a class="idx" href="miscpreds.html#wildcard_match/2">wildcard_match/2</a></dt>
27902808 <dt><a class="idx" href="system.html#win_add_dll_directory/1">win_add_dll_directory/1</a></dt>
27912809 <dt><a class="idx" href="system.html#win_add_dll_directory/2">win_add_dll_directory/2</a></dt>
27922810 <dd>
2793 <a class="idx" href="system.html#idx:winadddlldirectory2:1324">4.33.1</a> <a class="idx" href="system.html#idx:winadddlldirectory2:1330">4.33.1</a> <a class="idx" href="system.html#idx:winadddlldirectory2:1331">4.33.1</a></dd>
2811 <a class="idx" href="system.html#idx:winadddlldirectory2:1326">4.33.1</a> <a class="idx" href="system.html#idx:winadddlldirectory2:1332">4.33.1</a> <a class="idx" href="system.html#idx:winadddlldirectory2:1333">4.33.1</a></dd>
27942812 <dt><a class="idx" href="system.html#win_exec/2">win_exec/2</a></dt>
27952813 <dd>
2796 <a class="idx" href="system.html#idx:winexec2:1295">4.33</a> <a class="idx" href="system.html#idx:winexec2:1318">4.33.1</a> <a class="idx" href="system.html#idx:winexec2:1323">4.33.1</a></dd>
2814 <a class="idx" href="system.html#idx:winexec2:1297">4.33</a> <a class="idx" href="system.html#idx:winexec2:1320">4.33.1</a> <a class="idx" href="system.html#idx:winexec2:1325">4.33.1</a></dd>
27972815 <dt><a class="idx" href="system.html#win_folder/2">win_folder/2</a></dt>
27982816 <dd>
27992817 <a class="idx" href="initfile.html#idx:winfolder2:12">2.2</a> <a class="idx" href="cmdline.html#idx:winfolder2:18">2.4.2</a></dd>
28002818 <dt><a class="idx" href="system.html#win_has_menu/0">win_has_menu/0</a></dt>
28012819 <dt><a class="idx" href="system.html#win_insert_menu/2">win_insert_menu/2</a></dt>
28022820 <dd>
2803 <a class="idx" href="system.html#idx:wininsertmenu2:1343">4.33.3</a> <a class="idx" href="system.html#idx:wininsertmenu2:1345">4.33.3</a></dd>
2821 <a class="idx" href="system.html#idx:wininsertmenu2:1345">4.33.3</a> <a class="idx" href="system.html#idx:wininsertmenu2:1347">4.33.3</a></dd>
28042822 <dt><a class="idx" href="system.html#win_insert_menu_item/4">win_insert_menu_item/4</a></dt>
28052823 <dd>
2806 <a class="idx" href="system.html#idx:wininsertmenuitem4:1344">4.33.3</a></dd>
2824 <a class="idx" href="system.html#idx:wininsertmenuitem4:1346">4.33.3</a></dd>
28072825 <dt><a class="idx" href="system.html#win_registry_get_value/3">win_registry_get_value/3</a></dt>
28082826 <dt><a class="idx" href="system.html#win_remove_dll_directory/1">win_remove_dll_directory/1</a></dt>
28092827 <dd>
2810 <a class="idx" href="system.html#idx:winremovedlldirectory1:1328">4.33.1</a></dd>
2828 <a class="idx" href="system.html#idx:winremovedlldirectory1:1330">4.33.1</a></dd>
28112829 <dt><a class="idx" href="system.html#win_shell/2">win_shell/2</a></dt>
28122830 <dd>
2813 <a class="idx" href="system.html#idx:winshell2:1296">4.33</a> <a class="idx" href="system.html#idx:winshell2:1319">4.33.1</a> <a class="idx" href="www_browser.html#idx:winshell2:1955">A.16</a></dd>
2831 <a class="idx" href="system.html#idx:winshell2:1298">4.33</a> <a class="idx" href="system.html#idx:winshell2:1321">4.33.1</a> <a class="idx" href="www_browser.html#idx:winshell2:1958">A.16</a></dd>
28142832 <dt><a class="idx" href="system.html#win_window_pos/1">win_window_pos/1</a></dt>
28152833 <dt><a class="idx" href="system.html#window_title/2">window_title/2</a></dt>
28162834 <dt>windows</dt>
28182836 <a class="idx" href="flags.html#idx:windows:132">2.11</a></dd>
28192837 <dt><a class="idx" href="threadsync.html#with_mutex/2">with_mutex/2</a></dt>
28202838 <dd>
2821 <a class="idx" href="threadcom.html#idx:withmutex2:1766">9.3.2</a> <a class="idx" href="threadsync.html#idx:withmutex2:1777">9.4</a> <a class="idx" href="threadsync.html#idx:withmutex2:1778">9.4</a> <a class="idx" href="threadsync.html#idx:withmutex2:1787">9.4</a> <a class="idx" href="threadsync.html#idx:withmutex2:1790">9.4</a> <a class="idx" href="foreignthread.html#idx:withmutex2:1810">9.6</a></dd>
2839 <a class="idx" href="threadcom.html#idx:withmutex2:1769">9.3.2</a> <a class="idx" href="threadsync.html#idx:withmutex2:1780">9.4</a> <a class="idx" href="threadsync.html#idx:withmutex2:1781">9.4</a> <a class="idx" href="threadsync.html#idx:withmutex2:1790">9.4</a> <a class="idx" href="threadsync.html#idx:withmutex2:1793">9.4</a> <a class="idx" href="foreignthread.html#idx:withmutex2:1813">9.6</a></dd>
28222840 <dt><a class="idx" href="IO.html#with_output_to/2">with_output_to/2</a></dt>
28232841 <dd>
2824 <a class="idx" href="IO.html#idx:withoutputto2:852">4.16.1</a> <a class="idx" href="IO.html#idx:withoutputto2:854">4.16.1</a> <a class="idx" href="IO.html#idx:withoutputto2:859">4.16.2</a> <a class="idx" href="IO.html#idx:withoutputto2:941">4.16.4</a> <a class="idx" href="IO.html#idx:withoutputto2:948">4.16.5</a> <a class="idx" href="termrw.html#idx:withoutputto2:999">4.19</a> <a class="idx" href="manipatom.html#idx:withoutputto2:1148">4.21</a> <a class="idx" href="chartype.html#idx:withoutputto2:1184">4.23.2</a> <a class="idx" href="format.html#idx:withoutputto2:1286">4.31.2</a> <a class="idx" href="system.html#idx:withoutputto2:1336">4.33.2.2</a></dd>
2842 <a class="idx" href="IO.html#idx:withoutputto2:853">4.16.1</a> <a class="idx" href="IO.html#idx:withoutputto2:855">4.16.1</a> <a class="idx" href="IO.html#idx:withoutputto2:860">4.16.2</a> <a class="idx" href="IO.html#idx:withoutputto2:942">4.16.4</a> <a class="idx" href="IO.html#idx:withoutputto2:949">4.16.5</a> <a class="idx" href="termrw.html#idx:withoutputto2:1000">4.19</a> <a class="idx" href="manipatom.html#idx:withoutputto2:1149">4.21</a> <a class="idx" href="chartype.html#idx:withoutputto2:1185">4.23.2</a> <a class="idx" href="format.html#idx:withoutputto2:1288">4.31.2</a> <a class="idx" href="system.html#idx:withoutputto2:1338">4.33.2.2</a></dd>
28252843 <dt><a class="idx" href="charsio.html#with_output_to_chars/2">with_output_to_chars/2</a></dt>
28262844 <dt><a class="idx" href="charsio.html#with_output_to_chars/3">with_output_to_chars/3</a></dt>
28272845 <dt><a class="idx" href="charsio.html#with_output_to_chars/4">with_output_to_chars/4</a></dt>
28282846 <dt><a class="idx" href="quasiquotations.html#with_quasi_quotation_input/3">with_quasi_quotation_input/3</a></dt>
28292847 <dt><a class="idx" href="files.html#working_directory/2">working_directory/2</a></dt>
28302848 <dd>
2831 <a class="idx" href="cmdline.html#idx:workingdirectory2:13">2.4</a> <a class="idx" href="system.html#idx:workingdirectory2:1315">4.33</a> <a class="idx" href="system.html#idx:workingdirectory2:1317">4.33</a> <a class="idx" href="files.html#idx:workingdirectory2:1359">4.34</a> <a class="idx" href="files.html#idx:workingdirectory2:1376">4.34</a></dd>
2849 <a class="idx" href="cmdline.html#idx:workingdirectory2:13">2.4</a> <a class="idx" href="system.html#idx:workingdirectory2:1317">4.33</a> <a class="idx" href="system.html#idx:workingdirectory2:1319">4.33</a> <a class="idx" href="files.html#idx:workingdirectory2:1361">4.34</a> <a class="idx" href="files.html#idx:workingdirectory2:1378">4.34</a></dd>
28322850 <dt><a class="idx" href="foreigninclude.html#write()">write()</a></dt>
28332851 <dt><a class="idx" href="termrw.html#write/1">write/1</a></dt>
28342852 <dd>
2835 <a class="idx" href="flags.html#idx:write1:133">2.11</a> <a class="idx" href="cyclic.html#idx:write1:221">2.16</a> <a class="idx" href="limits.html#idx:write1:253">2.19.2</a> <a class="idx" href="IO.html#idx:write1:846">4.16.1</a> <a class="idx" href="IO.html#idx:write1:857">4.16.1</a> <a class="idx" href="format.html#idx:write1:1270">4.31.1</a> <a class="idx" href="format.html#idx:write1:1283">4.31.2</a> <a class="idx" href="foreigninclude.html#idx:write1:1832">10.4.3.2</a> <a class="idx" href="foreigninclude.html#idx:write1:1833">10.4.3.2</a> <b>10.4.3.5</b> <a class="idx" href="foreigninclude.html#idx:write1:1837">10.4.3.6</a> <a class="idx" href="foreigninclude.html#idx:write1:1852">10.4.7.1</a></dd>
2853 <a class="idx" href="flags.html#idx:write1:133">2.11</a> <a class="idx" href="cyclic.html#idx:write1:221">2.16</a> <a class="idx" href="limits.html#idx:write1:253">2.19.2</a> <a class="idx" href="IO.html#idx:write1:847">4.16.1</a> <a class="idx" href="IO.html#idx:write1:858">4.16.1</a> <a class="idx" href="format.html#idx:write1:1272">4.31.1</a> <a class="idx" href="format.html#idx:write1:1285">4.31.2</a> <a class="idx" href="foreigninclude.html#idx:write1:1835">10.4.3.2</a> <a class="idx" href="foreigninclude.html#idx:write1:1836">10.4.3.2</a> <b>10.4.3.5</b> <a class="idx" href="foreigninclude.html#idx:write1:1840">10.4.3.6</a> <a class="idx" href="foreigninclude.html#idx:write1:1855">10.4.7.1</a></dd>
28362854 <dt><a class="idx" href="termrw.html#write/2">write/2</a></dt>
28372855 <dt><a class="idx" href="termrw.html#write_canonical/1">write_canonical/1</a></dt>
28382856 <dd>
2839 <a class="idx" href="termrw.html#idx:writecanonical1:1017">4.19</a> <a class="idx" href="termrw.html#idx:writecanonical1:1026">4.19</a> <a class="idx" href="termrw.html#idx:writecanonical1:1056">4.19</a> <a class="idx" href="format.html#idx:writecanonical1:1278">4.31.2</a> <a class="idx" href="ext-lists.html#idx:writecanonical1:1442">5.1</a></dd>
2857 <a class="idx" href="termrw.html#idx:writecanonical1:1018">4.19</a> <a class="idx" href="termrw.html#idx:writecanonical1:1027">4.19</a> <a class="idx" href="termrw.html#idx:writecanonical1:1057">4.19</a> <a class="idx" href="format.html#idx:writecanonical1:1280">4.31.2</a> <a class="idx" href="ext-lists.html#idx:writecanonical1:1444">5.1</a></dd>
28402858 <dt><a class="idx" href="termrw.html#write_canonical/2">write_canonical/2</a></dt>
28412859 <dd>
2842 <a class="idx" href="manipterm.html#idx:writecanonical2:1088">4.20</a> <a class="idx" href="foreigninclude.html#idx:writecanonical2:1834">10.4.3.2</a></dd>
2860 <a class="idx" href="manipterm.html#idx:writecanonical2:1089">4.20</a> <a class="idx" href="foreigninclude.html#idx:writecanonical2:1837">10.4.3.2</a></dd>
28432861 <dt><a class="idx" href="termrw.html#write_length/3">write_length/3</a></dt>
28442862 <dd>
2845 <a class="idx" href="manipatom.html#idx:writelength3:1158">4.21</a></dd>
2863 <a class="idx" href="manipatom.html#idx:writelength3:1159">4.21</a></dd>
28462864 <dt><a class="idx" href="termrw.html#write_term/2">write_term/2</a></dt>
28472865 <dd>
2848 <a class="idx" href="debugoverview.html#idx:writeterm2:43">2.9</a> <a class="idx" href="flags.html#idx:writeterm2:84">2.11</a> <a class="idx" href="flags.html#idx:writeterm2:103">2.11</a> <a class="idx" href="flags.html#idx:writeterm2:115">2.11</a> <a class="idx" href="termrw.html#idx:writeterm2:1001">4.19</a> <a class="idx" href="termrw.html#idx:writeterm2:1002">4.19</a> <a class="idx" href="termrw.html#idx:writeterm2:1005">4.19</a> <a class="idx" href="termrw.html#idx:writeterm2:1007">4.19</a> <a class="idx" href="termrw.html#idx:writeterm2:1018">4.19</a> <a class="idx" href="termrw.html#idx:writeterm2:1021">4.19</a> <a class="idx" href="termrw.html#idx:writeterm2:1022">4.19</a> <a class="idx" href="termrw.html#idx:writeterm2:1023">4.19</a> <a class="idx" href="termrw.html#idx:writeterm2:1032">4.19</a> <a class="idx" href="termrw.html#idx:writeterm2:1054">4.19</a> <a class="idx" href="termrw.html#idx:writeterm2:1055">4.19</a> <a class="idx" href="manipterm.html#idx:writeterm2:1086">4.20</a> <a class="idx" href="manipatom.html#idx:writeterm2:1146">4.21</a> <a class="idx" href="format.html#idx:writeterm2:1272">4.31.1</a> <a class="idx" href="format.html#idx:writeterm2:1284">4.31.2</a> <a class="idx" href="ext-lists.html#idx:writeterm2:1444">5.1</a> <a class="idx" href="ext-lists.html#idx:writeterm2:1446">5.1</a> <a class="idx" href="strings.html#idx:writeterm2:1451">5.2.1</a> <a class="idx" href="attvar.html#idx:writeterm2:1626">7.1.2</a></dd>
2866 <a class="idx" href="debugoverview.html#idx:writeterm2:43">2.9</a> <a class="idx" href="flags.html#idx:writeterm2:84">2.11</a> <a class="idx" href="flags.html#idx:writeterm2:103">2.11</a> <a class="idx" href="flags.html#idx:writeterm2:115">2.11</a> <a class="idx" href="termrw.html#idx:writeterm2:1002">4.19</a> <a class="idx" href="termrw.html#idx:writeterm2:1003">4.19</a> <a class="idx" href="termrw.html#idx:writeterm2:1006">4.19</a> <a class="idx" href="termrw.html#idx:writeterm2:1008">4.19</a> <a class="idx" href="termrw.html#idx:writeterm2:1019">4.19</a> <a class="idx" href="termrw.html#idx:writeterm2:1022">4.19</a> <a class="idx" href="termrw.html#idx:writeterm2:1023">4.19</a> <a class="idx" href="termrw.html#idx:writeterm2:1024">4.19</a> <a class="idx" href="termrw.html#idx:writeterm2:1033">4.19</a> <a class="idx" href="termrw.html#idx:writeterm2:1055">4.19</a> <a class="idx" href="termrw.html#idx:writeterm2:1056">4.19</a> <a class="idx" href="manipterm.html#idx:writeterm2:1087">4.20</a> <a class="idx" href="manipatom.html#idx:writeterm2:1147">4.21</a> <a class="idx" href="format.html#idx:writeterm2:1274">4.31.1</a> <a class="idx" href="format.html#idx:writeterm2:1286">4.31.2</a> <a class="idx" href="ext-lists.html#idx:writeterm2:1446">5.1</a> <a class="idx" href="ext-lists.html#idx:writeterm2:1448">5.1</a> <a class="idx" href="strings.html#idx:writeterm2:1453">5.2.1</a> <a class="idx" href="attvar.html#idx:writeterm2:1628">7.1.2</a></dd>
28492867 <dt><a class="idx" href="termrw.html#write_term/3">write_term/3</a></dt>
28502868 <dd>
2851 <a class="idx" href="flags.html#idx:writeterm3:134">2.11</a> <a class="idx" href="hooks.html#idx:writeterm3:139">2.12</a> <a class="idx" href="termrw.html#idx:writeterm3:1010">4.19</a> <a class="idx" href="manipterm.html#idx:writeterm3:1081">4.20</a> <a class="idx" href="manipatom.html#idx:writeterm3:1159">4.21</a></dd>
2869 <a class="idx" href="flags.html#idx:writeterm3:134">2.11</a> <a class="idx" href="hooks.html#idx:writeterm3:139">2.12</a> <a class="idx" href="termrw.html#idx:writeterm3:1011">4.19</a> <a class="idx" href="manipterm.html#idx:writeterm3:1082">4.20</a> <a class="idx" href="manipatom.html#idx:writeterm3:1160">4.21</a></dd>
28522870 <dt><a class="idx" href="charsio.html#write_to_chars/2">write_to_chars/2</a></dt>
28532871 <dt><a class="idx" href="charsio.html#write_to_chars/3">write_to_chars/3</a></dt>
28542872 <dt><a class="idx" href="format.html#writef/1">writef/1</a></dt>
28552873 <dd>
2856 <a class="idx" href="format.html#idx:writef1:1261">4.31</a></dd>
2874 <a class="idx" href="format.html#idx:writef1:1263">4.31</a></dd>
28572875 <dt><a class="idx" href="format.html#writef/2">writef/2</a></dt>
28582876 <dd>
2859 <a class="idx" href="acknowledge.html#idx:writef2:4">1.6</a> <a class="idx" href="syntax.html#idx:writef2:183">2.15.2.1</a> <a class="idx" href="syntax.html#idx:writef2:184">2.15.2.1</a> <a class="idx" href="syntax.html#idx:writef2:185">2.15.2.1</a> <a class="idx" href="syntax.html#idx:writef2:187">2.15.2.1</a> <a class="idx" href="termrw.html#idx:writef2:998">4.19</a> <a class="idx" href="format.html#idx:writef2:1262">4.31</a> <a class="idx" href="format.html#idx:writef2:1267">4.31.1</a> <a class="idx" href="format.html#idx:writef2:1276">4.31.1</a></dd>
2877 <a class="idx" href="acknowledge.html#idx:writef2:4">1.6</a> <a class="idx" href="syntax.html#idx:writef2:183">2.15.2.1</a> <a class="idx" href="syntax.html#idx:writef2:184">2.15.2.1</a> <a class="idx" href="syntax.html#idx:writef2:185">2.15.2.1</a> <a class="idx" href="syntax.html#idx:writef2:187">2.15.2.1</a> <a class="idx" href="termrw.html#idx:writef2:999">4.19</a> <a class="idx" href="format.html#idx:writef2:1264">4.31</a> <a class="idx" href="format.html#idx:writef2:1269">4.31.1</a> <a class="idx" href="format.html#idx:writef2:1278">4.31.1</a></dd>
28602878 <dt><a class="idx" href="termrw.html#writeln/1">writeln/1</a></dt>
28612879 <dt><a class="idx" href="termrw.html#writeln/2">writeln/2</a></dt>
28622880 <dt><a class="idx" href="termrw.html#writeq/1">writeq/1</a></dt>
28632881 <dd>
2864 <a class="idx" href="format.html#idx:writeq1:1271">4.31.1</a> <a class="idx" href="format.html#idx:writeq1:1280">4.31.2</a></dd>
2882 <a class="idx" href="format.html#idx:writeq1:1273">4.31.1</a> <a class="idx" href="format.html#idx:writeq1:1282">4.31.2</a></dd>
28652883 <dt><a class="idx" href="termrw.html#writeq/2">writeq/2</a></dt>
28662884 <dd>
2867 <a class="idx" href="foreigninclude.html#idx:writeq2:1835">10.4.3.2</a></dd>
2885 <a class="idx" href="foreigninclude.html#idx:writeq2:1838">10.4.3.2</a></dd>
28682886 <dt><a class="idx" href="url.html#www_form_encode/2">www_form_encode/2</a></dt>
28692887 <dt><a class="idx" href="www_browser.html#www_open_url/1">www_open_url/1</a></dt>
28702888 <dd>
2871 <a class="idx" href="www_browser.html#idx:wwwopenurl1:1957">A.16</a></dd>
2889 <a class="idx" href="www_browser.html#idx:wwwopenurl1:1960">A.16</a></dd>
28722890 <dt><a class="idx" href="prolog_xref.html#xref_built_in/1">xref_built_in/1</a></dt>
28732891 <dt><a class="idx" href="prolog_xref.html#xref_called/3">xref_called/3</a></dt>
28742892 <dt><a class="idx" href="prolog_xref.html#xref_clean/1">xref_clean/1</a></dt>
29392957 <dt class="index-sep">B</dt>
29402958 <dt>Boehm GC</dt>
29412959 <dd>
2942 <a class="idx" href="foreignnotes.html#idx:BoehmGC:1899">10.8.1.1</a></dd>
2960 <a class="idx" href="foreignnotes.html#idx:BoehmGC:1902">10.8.1.1</a></dd>
29432961 <dt>BOM</dt>
29442962 <dd>
29452963 <a class="idx" href="widechars.html#idx:BOM:239">2.18.1.1</a></dd>
29492967 <dt class="index-sep">C</dt>
29502968 <dt>COM</dt>
29512969 <dd>
2952 <a class="idx" href="foreigninclude.html#idx:COM:1850">10.4.7</a></dd>
2970 <a class="idx" href="foreigninclude.html#idx:COM:1853">10.4.7</a></dd>
29532971 <dt class="index-sep">D</dt>
29542972 <dt>Development environment</dt>
29552973 <dd>
29562974 <a class="idx" href="IDE.html#idx:Developmentenvironment:260">3</a></dd>
29572975 <dt>DCG</dt>
29582976 <dd>
2959 <a class="idx" href="consulting.html#idx:DCG:335">4.3</a> <a class="idx" href="DCG.html#idx:DCG:700">4.12</a></dd>
2977 <a class="idx" href="consulting.html#idx:DCG:336">4.3</a> <a class="idx" href="DCG.html#idx:DCG:701">4.12</a></dd>
29602978 <dt class="index-sep">E</dt>
29612979 <dt>Emacs</dt>
29622980 <dd>
29642982 <dt class="index-sep">G</dt>
29652983 <dt>GMP</dt>
29662984 <dd>
2967 <a class="idx" href="arith.html#idx:GMP:1208">4.26.2.1</a></dd>
2985 <a class="idx" href="arith.html#idx:GMP:1210">4.26.2.1</a></dd>
29682986 <dt>GNU-Emacs</dt>
29692987 <dd>
29702988 <a class="idx" href="gemacs.html#idx:GNUEmacs:30">2.5</a></dd>
29772995 <a class="idx" href="IDE.html#idx:IDE:259">3</a></dd>
29782996 <dt><a class="idx" href="IO.html#set_prolog_IO/3">set_prolog_IO/3</a></dt>
29792997 <dd>
2980 <a class="idx" href="IO.html#idx:setprologIO3:843">4.16.1</a></dd>
2998 <a class="idx" href="IO.html#idx:setprologIO3:844">4.16.1</a></dd>
29812999 <dt>ISO Latin 1</dt>
29823000 <dd>
29833001 <a class="idx" href="syntax.html#idx:ISOLatin1:180">2.15.1.1</a></dd>
29843002 <dt class="index-sep">J</dt>
29853003 <dt>Java</dt>
29863004 <dd>
2987 <a class="idx" href="foreigninclude.html#idx:Java:1849">10.4.7</a></dd>
3005 <a class="idx" href="foreigninclude.html#idx:Java:1852">10.4.7</a></dd>
29883006 <dt class="index-sep">M</dt>
29893007 <dt>MacOS</dt>
29903008 <dd>
30283046 <dt><a class="idx" href="foreigninclude.html#PL_fail()">PL_fail()</a></dt>
30293047 <dt><a class="idx" href="foreigninclude.html#PL_foreign_context()">PL_foreign_context()</a></dt>
30303048 <dt><a class="idx" href="foreigninclude.html#PL_foreign_context_address()">PL_foreign_context_address()</a></dt>
3049 <dt><a class="idx" href="foreigninclude.html#PL_foreign_context_predicate()">PL_foreign_context_predicate()</a></dt>
30313050 <dt><a class="idx" href="foreigninclude.html#PL_foreign_control()">PL_foreign_control()</a></dt>
30323051 <dt><a class="idx" href="foreignnotes.html#PL_free()">PL_free()</a></dt>
30333052 <dt><a class="idx" href="foreigninclude.html#PL_functor_arity()">PL_functor_arity()</a></dt>
32173236 <dt><a class="idx" href="foreigninclude.html#PL_PARTIAL_LIST">PL_PARTIAL_LIST</a></dt>
32183237 <dt>PLVERSION</dt>
32193238 <dd>
3220 <a class="idx" href="foreignnotes.html#idx:PLVERSION:1900">10.8.2</a></dd>
3239 <a class="idx" href="foreignnotes.html#idx:PLVERSION:1903">10.8.2</a></dd>
32213240 <dt><a class="idx" href="foreigninclude.html#PL_get_file_nameW()">PL_get_file_nameW()</a></dt>
32223241 <dt class="index-sep">Q</dt>
32233242 <dt><a class="idx" href="attvar.html#project_attributes/+QueryVars, +ResidualVars">project_attributes/+QueryVars,
32293248 <dt class="index-sep">S</dt>
32303249 <dt>Solaris</dt>
32313250 <dd>
3232 <a class="idx" href="threadcreate.html#idx:Solaris:1728">9.1</a></dd>
3251 <a class="idx" href="threadcreate.html#idx:Solaris:1731">9.1</a></dd>
32333252 <dt><code>/</code></dt>
32343253 <dd>
32353254 <a class="idx" href="projectfiles.html#idx:Sdiv:263">3.1.1.2</a></dd>
32523271 <a class="idx" href="widechars.html#idx:UCS:230">2.18</a></dd>
32533272 <dt>URL</dt>
32543273 <dd>
3255 <a class="idx" href="system.html#idx:URL:1322">4.33.1</a></dd>
3274 <a class="idx" href="system.html#idx:URL:1324">4.33.1</a></dd>
32563275 <dt>UTF-8</dt>
32573276 <dd>
32583277 <a class="idx" href="widechars.html#idx:UTF8:228">2.18</a></dd>
32593278 <dt class="index-sep">Y</dt>
32603279 <dt>YAP,prolog</dt>
32613280 <dd>
3262 <a class="idx" href="dialect.html#idx:YAPprolog:2047">C</a></dd>
3281 <a class="idx" href="dialect.html#idx:YAPprolog:2050">C</a></dd>
32633282 <dt class="index-sep">{</dt>
32643283 <dt><a class="idx" href="clpqr.html#{}/1">/1</a></dt>
32653284 <dt class="index-sep">|</dt>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.16</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.16</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
238238 <a id="sec:IO"></a>
239239
240240 <p>SWI-Prolog provides two different packages for input and output. The
241 native I/O system is based on the ISO standard predicates <a id="idx:open3:839"></a><a class="pred" href="IO.html#open/3">open/3</a>,
242 <a id="idx:close1:840"></a><a class="pred" href="IO.html#close/1">close/1</a>
243 and friends.<sup class="fn">69<span class="fn-text">Actually based on
241 native I/O system is based on the ISO standard predicates <a id="idx:open3:840"></a><a class="pred" href="IO.html#open/3">open/3</a>,
242 <a id="idx:close1:841"></a><a class="pred" href="IO.html#close/1">close/1</a>
243 and friends.<sup class="fn">70<span class="fn-text">Actually based on
244244 Quintus Prolog, providing this interface before the ISO standard
245245 existed.</span></sup> Being more widely portable and equipped with a
246246 clearer and more robust specification, new code is encouraged to use
247247 these predicates for manipulation of I/O streams.
248248
249 <p><a class="sec" href="IO.html">Section 4.16.3</a> describes <a id="idx:tell1:841"></a><a class="pred" href="IO.html#tell/1">tell/1</a>, <a id="idx:see1:842"></a><a class="pred" href="IO.html#see/1">see/1</a>
249 <p><a class="sec" href="IO.html">Section 4.16.3</a> describes <a id="idx:tell1:842"></a><a class="pred" href="IO.html#tell/1">tell/1</a>, <a id="idx:see1:843"></a><a class="pred" href="IO.html#see/1">see/1</a>
250250 and friends, providing I/O in the spirit of the traditional Edinburgh
251251 standard. These predicates are layered on top of the ISO predicates.
252252 Both packages are fully integrated; the user may switch freely between
268268 handles 0,&nbsp;1 and&nbsp;2). These aliases may be re-bound, for
269269 example if standard I/O refers to a window such as in the <b>swipl-win.exe</b>
270270 GUI executable for Windows. They can be re-bound by the user using
271 <a id="idx:setprologIO3:843"></a><a class="pred" href="IO.html#set_prolog_IO/3">set_prolog_IO/3</a>
272 and <a id="idx:setstream2:844"></a><a class="pred" href="IO.html#set_stream/2">set_stream/2</a>
271 <a id="idx:setprologIO3:844"></a><a class="pred" href="IO.html#set_prolog_IO/3">set_prolog_IO/3</a>
272 and <a id="idx:setstream2:845"></a><a class="pred" href="IO.html#set_stream/2">set_stream/2</a>
273273 by setting the alias of a stream (e.g,
274274 <code>set_stream(S, alias(user_output))</code>). An example of rebinding
275275 can be found in library <code>library(prolog_server)</code>, providing a <b>telnet</b>
276276 service. The aliases <code>current_input</code> and <code>current_output</code>
277277 define the source and destination for predicates that do not take a
278 stream argument (e.g., <a id="idx:read1:845"></a><a class="pred" href="termrw.html#read/1">read/1</a>, <a id="idx:write1:846"></a><a class="pred" href="termrw.html#write/1">write/1</a>, <a id="idx:getcode1:847"></a><a class="pred" href="chario.html#get_code/1">get_code/1</a>,
278 stream argument (e.g., <a id="idx:read1:846"></a><a class="pred" href="termrw.html#read/1">read/1</a>, <a id="idx:write1:847"></a><a class="pred" href="termrw.html#write/1">write/1</a>, <a id="idx:getcode1:848"></a><a class="pred" href="chario.html#get_code/1">get_code/1</a>,
279279 ... ). Initially, these are bound to the same stream as <code>user_input</code>
280280 and
281 <code>user_error</code>. They are re-bound by <a id="idx:see1:848"></a><a class="pred" href="IO.html#see/1">see/1</a>, <a id="idx:tell1:849"></a><a class="pred" href="IO.html#tell/1">tell/1</a>, <a id="idx:setinput1:850"></a><a class="pred" href="IO.html#set_input/1">set_input/1</a>
281 <code>user_error</code>. They are re-bound by <a id="idx:see1:849"></a><a class="pred" href="IO.html#see/1">see/1</a>, <a id="idx:tell1:850"></a><a class="pred" href="IO.html#tell/1">tell/1</a>, <a id="idx:setinput1:851"></a><a class="pred" href="IO.html#set_input/1">set_input/1</a>
282282 and
283 <a id="idx:setoutput1:851"></a><a class="pred" href="IO.html#set_output/1">set_output/1</a>.
284 The <code>current_output</code> stream is also temporary re-bound by <a id="idx:withoutputto2:852"></a><a class="pred" href="IO.html#with_output_to/2">with_output_to/2</a>
285 or <a id="idx:format3:853"></a><a class="pred" href="format.html#format/3">format/3</a>
283 <a id="idx:setoutput1:852"></a><a class="pred" href="IO.html#set_output/1">set_output/1</a>.
284 The <code>current_output</code> stream is also temporary re-bound by <a id="idx:withoutputto2:853"></a><a class="pred" href="IO.html#with_output_to/2">with_output_to/2</a>
285 or <a id="idx:format3:854"></a><a class="pred" href="format.html#format/3">format/3</a>
286286 using e.g.,
287287 <code>format(atom(A), ...</code>. Note that code which explicitly writes
288288 to the streams <code>user_output</code> and <code>user_error</code> will
289 not be redirected by <a id="idx:withoutputto2:854"></a><a class="pred" href="IO.html#with_output_to/2">with_output_to/2</a>.
289 not be redirected by <a id="idx:withoutputto2:855"></a><a class="pred" href="IO.html#with_output_to/2">with_output_to/2</a>.
290290
291291 <p><b>Compatibility</b>
292292
293293 <p>Note that the ISO standard only defines the <code>user_*</code>
294 streams. The `current' streams can be accessed using <a id="idx:currentinput1:855"></a><a class="pred" href="IO.html#current_input/1">current_input/1</a>
294 streams. The `current' streams can be accessed using <a id="idx:currentinput1:856"></a><a class="pred" href="IO.html#current_input/1">current_input/1</a>
295295 and
296 <a id="idx:currentoutput1:856"></a><a class="pred" href="IO.html#current_output/1">current_output/1</a>.
296 <a id="idx:currentoutput1:857"></a><a class="pred" href="IO.html#current_output/1">current_output/1</a>.
297297 For example, an ISO compatible implementation of
298 <a id="idx:write1:857"></a><a class="pred" href="termrw.html#write/1">write/1</a>
298 <a id="idx:write1:858"></a><a class="pred" href="termrw.html#write/1">write/1</a>
299299 is
300300
301301 <pre class="code">
314314 <a id="sec:isoIO"></a>
315315
316316 <p>The predicates described in this section provide ISO compliant I/O,
317 where streams are explicitly created using the predicate <a id="idx:open3:858"></a><a class="pred" href="IO.html#open/3">open/3</a>.
317 where streams are explicitly created using the predicate <a id="idx:open3:859"></a><a class="pred" href="IO.html#open/3">open/3</a>.
318318 The resulting stream identifier is then passed as a parameter to the
319319 reading and writing predicates to specify the source or destination of
320320 the data.
322322 <p>This schema is not vulnerable to filename and stream ambiguities as
323323 well as changes to the working directory. On the other hand, using the
324324 notion of current-I/O simplifies reusability of code without the need to
325 pass arguments around. E.g., see <a id="idx:withoutputto2:859"></a><a class="pred" href="IO.html#with_output_to/2">with_output_to/2</a>.
325 pass arguments around. E.g., see <a id="idx:withoutputto2:860"></a><a class="pred" href="IO.html#with_output_to/2">with_output_to/2</a>.
326326
327327 <p>SWI-Prolog streams are, compatible with the ISO standard, either
328328 input or output streams. To accommodate portability to other systems, a
329329 pair of streams can be packed into a <em>stream-pair</em>. See
330 <a id="idx:streampair3:860"></a><a class="pred" href="IO.html#stream_pair/3">stream_pair/3</a>
330 <a id="idx:streampair3:861"></a><a class="pred" href="IO.html#stream_pair/3">stream_pair/3</a>
331331 for details.
332332
333333 <p>SWI-Prolog stream handles are unique symbols that have no syntactical
334334 representation. They are written as <code>&lt;stream&gt;(hex-number)</code>,
335 which is not valid input for <a id="idx:read1:861"></a><a class="pred" href="termrw.html#read/1">read/1</a>.
336 They are realised using a <em>blob</em> of type <code>stream</code> (see <a id="idx:blob2:862"></a><a class="pred" href="typetest.html#blob/2">blob/2</a>
335 which is not valid input for <a id="idx:read1:862"></a><a class="pred" href="termrw.html#read/1">read/1</a>.
336 They are realised using a <em>blob</em> of type <code>stream</code> (see <a id="idx:blob2:863"></a><a class="pred" href="typetest.html#blob/2">blob/2</a>
337337 and <a class="sec" href="foreigninclude.html">section 10.4.7</a>).
338338
339339 <dl class="latex">
340340 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="open/4"><strong>open</strong>(<var>+SrcDest,
341 +Mode, -Stream, +Options</var>)</a></dt>
341 +Mode, --Stream, +Options</var>)</a></dt>
342342 <dd class="defbody">
343343 True when <var>SrcDest</var> can be opened in <var>Mode</var> and <var>Stream</var>
344344 is an I/O stream to/from the object. <var>SrcDest</var> is normally the
351351 positioning the file pointer at the beginning of the file without
352352 truncating the file. <var>Stream</var> is either a variable, in which
353353 case it is bound to an integer identifying the stream, or an atom, in
354 which case this atom will be the stream identifier.<sup class="fn">70<span class="fn-text">New
354 which case this atom will be the stream identifier.<sup class="fn">71<span class="fn-text">New
355355 code should use the <code>alias(Alias)</code> option for compatibility
356356 with the ISO standard.</span></sup>
357357
363363 <code>read</code>, data written by <var>Command</var> to the standard
364364 output may be read from <var>Stream</var>. On Unix systems, <var>Command</var>
365365 is handed to popen() which hands it to the Unix shell. On Windows, <var>Command</var>
366 is executed directly. See also <a id="idx:processcreate3:863"></a><span class="pred-ext">process_create/3</span>
366 is executed directly. See also <a id="idx:processcreate3:864"></a><span class="pred-ext">process_create/3</span>
367367 from <code>library(process)</code>.
368368
369 <p>The following <var>Options</var> are recognised by <a id="idx:open4:864"></a><a class="pred" href="IO.html#open/4">open/4</a>:
369 <p>The following <var>Options</var> are recognised by <a id="idx:open4:865"></a><a class="pred" href="IO.html#open/4">open/4</a>:
370370
371371 <dl class="latex">
372372 <dt><strong>alias</strong>(<var>Atom</var>)</dt>
373373 <dd class="defbody">
374374 Gives the stream a name. Below is an example. Be careful with this
375 option as stream names are global. See also <a id="idx:setstream2:865"></a><a class="pred" href="IO.html#set_stream/2">set_stream/2</a>.
375 option as stream names are global. See also <a id="idx:setstream2:866"></a><a class="pred" href="IO.html#set_stream/2">set_stream/2</a>.
376376
377377 <pre class="code">
378378 ?- open(data, read, Fd, [alias(input)]).
387387 <dd class="defbody">
388388 Check for a BOM (<em>Byte Order Marker</em>) or write one. If omitted,
389389 the default is <code>true</code> for mode <code>read</code> and
390 <code>false</code> for mode <code>write</code>. See also <a id="idx:streamproperty2:866"></a><a class="pred" href="IO.html#stream_property/2">stream_property/2</a>
390 <code>false</code> for mode <code>write</code>. See also <a id="idx:streamproperty2:867"></a><a class="pred" href="IO.html#stream_property/2">stream_property/2</a>
391391 and especially <a class="sec" href="widechars.html">section 2.18.1.1</a>
392392 for a discussion of this feature.</dd>
393393 <dt><strong>buffer</strong>(<var>Buffering</var>)</dt>
396396 full buffering, <code>line</code> buffering by line, and <code>false</code>
397397 implies the stream is fully unbuffered. Smaller buffering is useful if
398398 another process or the user is waiting for the output as it is being
399 produced. See also <a id="idx:flushoutput01:867"></a><span class="pred-ext">flush_output/[0,1]</span>.
399 produced. See also <a id="idx:flushoutput01:868"></a><span class="pred-ext">flush_output/[0,1]</span>.
400400 This option is not an ISO option.</dd>
401401 <dt><strong>close_on_abort</strong>(<var>Bool</var>)</dt>
402402 <dd class="defbody">
403403 If <code>true</code> (default), the stream is closed on an abort (see
404 <a id="idx:abort0:868"></a><a class="pred" href="toplevel.html#abort/0">abort/0</a>).
404 <a id="idx:abort0:869"></a><a class="pred" href="toplevel.html#abort/0">abort/0</a>).
405405 If <code>false</code>, the stream is not closed. If it is an output
406406 stream, however, it will be flushed. Useful for logfiles and if the
407407 stream is associated to a process (using the <code>pipe/1</code>
410410 <dd class="defbody">
411411 Specifies how a new file is created when opening in <code>write</code>,
412412 <code>append</code> or <code>update</code> mode. Currently, <var>List</var>
413 is a list of atoms that describe the permissions of the created file.<sup class="fn">71<span class="fn-text">Added
413 is a list of atoms that describe the permissions of the created file.<sup class="fn">72<span class="fn-text">Added
414414 after feedback from Joachim Shimpf and Per Mildner.</span></sup> Defined
415415 values are below. Not recognised values are silently ignored, allowing
416416 for adding platform specific extensions to this set.
454454 <dt><strong>eof_action</strong>(<var>Action</var>)</dt>
455455 <dd class="defbody">
456456 Defines what happens if the end of the input stream is reached. Action
457 <code>eof_code</code> makes <a id="idx:get01:869"></a><a class="pred" href="chario.html#get0/1">get0/1</a>
458 and friends return -1, and <a id="idx:read1:870"></a><a class="pred" href="termrw.html#read/1">read/1</a>
457 <code>eof_code</code> makes <a id="idx:get01:870"></a><a class="pred" href="chario.html#get0/1">get0/1</a>
458 and friends return -1, and <a id="idx:read1:871"></a><a class="pred" href="termrw.html#read/1">read/1</a>
459459 and friends return the atom <code>end_of_file</code>. Repetitive reading
460460 keeps yielding the same result. Action <code>error</code> is like <code>eof_code</code>,
461461 but repetitive reading will raise an error. With action <code>reset</code>,
463463 grown.</dd>
464464 <dt><strong>locale</strong>(<var>+Locale</var>)</dt>
465465 <dd class="defbody">
466 Set the locale that is used by notably <a id="idx:format2:871"></a><a class="pred" href="format.html#format/2">format/2</a>
466 Set the locale that is used by notably <a id="idx:format2:872"></a><a class="pred" href="format.html#format/2">format/2</a>
467467 for output on this stream. See <a class="sec" href="locale.html">section
468468 4.22</a>.</dd>
469469 <dt><strong>lock</strong>(<var>LockingMode</var>)</dt>
503503 <p>The option <code>reposition</code> is not supported in SWI-Prolog.
504504 All streams connected to a file may be repositioned.</dd>
505505 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="open/3"><strong>open</strong>(<var>+SrcDest,
506 +Mode, ?Stream</var>)</a></dt>
507 <dd class="defbody">
508 Equivalent to <a id="idx:open4:872"></a><a class="pred" href="IO.html#open/4">open/4</a>
506 +Mode, --Stream</var>)</a></dt>
507 <dd class="defbody">
508 Equivalent to <a id="idx:open4:873"></a><a class="pred" href="IO.html#open/4">open/4</a>
509509 with an empty option list.</dd>
510 <dt class="pubdef"><a id="open_null_stream/1"><strong>open_null_stream</strong>(<var>?Stream</var>)</a></dt>
510 <dt class="pubdef"><a id="open_null_stream/1"><strong>open_null_stream</strong>(<var>--Stream</var>)</a></dt>
511511 <dd class="defbody">
512512 Open an output stream that produces no output. All counting functions
513513 are enabled on such a stream. It can be used to discard output (like
531531 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="close/1"><strong>close</strong>(<var>+Stream</var>)</a></dt>
532532 <dd class="defbody">
533533 Close the specified stream. If <var>Stream</var> is not open, an
534 existence error is raised. See <a id="idx:streampair3:873"></a><a class="pred" href="IO.html#stream_pair/3">stream_pair/3</a>
534 existence error is raised. See <a id="idx:streampair3:874"></a><a class="pred" href="IO.html#stream_pair/3">stream_pair/3</a>
535535 for the implications of closing a
536536 <em>stream pair</em>.
537537
538538 <p>If the closed stream is the current input, output or error stream,
539539 the stream alias is bound to the initial standard I/O streams of the
540 process. Calling <a id="idx:close1:874"></a><a class="pred" href="IO.html#close/1">close/1</a>
540 process. Calling <a id="idx:close1:875"></a><a class="pred" href="IO.html#close/1">close/1</a>
541541 on the initial standard I/O streams of the process is a no-op for an
542 input stream and flushes an output stream without closing it.<sup class="fn">72<span class="fn-text">This
542 input stream and flushes an output stream without closing it.<sup class="fn">73<span class="fn-text">This
543543 behaviour was defined with purely interactive usage of Prolog in mind.
544544 Applications should not count on this behaviour. Future versions may
545545 allow for closing the initial standard I/O streams.</span></sup></dd>
565565 <dd class="defbody">
566566 SWI-Prolog extension to query the buffering mode of this stream.
567567 <var>Buffering</var> is one of <code>full</code>, <code>line</code> or <code>false</code>.
568 See also <a id="idx:open4:875"></a><a class="pred" href="IO.html#open/4">open/4</a>.</dd>
568 See also <a id="idx:open4:876"></a><a class="pred" href="IO.html#open/4">open/4</a>.</dd>
569569 <dt><strong>buffer_size</strong>(<var>Integer</var>)</dt>
570570 <dd class="defbody">
571571 SWI-Prolog extension to query the size of the I/O buffer associated to a
578578 2.18.1.1</a> for details.</dd>
579579 <dt><strong>close_on_abort</strong>(<var>Bool</var>)</dt>
580580 <dd class="defbody">
581 Determine whether or not <a id="idx:abort0:876"></a><a class="pred" href="toplevel.html#abort/0">abort/0</a>
581 Determine whether or not <a id="idx:abort0:877"></a><a class="pred" href="toplevel.html#abort/0">abort/0</a>
582582 closes the stream. By default streams are closed.</dd>
583583 <dt><strong>close_on_exec</strong>(<var>Bool</var>)</dt>
584584 <dd class="defbody">
597597 If <var>Stream</var> is an input stream, unify <var>E</var> with one of
598598 the atoms <code>not</code>, <code>at</code> or <code>past</code>. See
599599 also
600 <a id="idx:atendofstream01:877"></a><span class="pred-ext">at_end_of_stream/[0,1]</span>.</dd>
600 <a id="idx:atendofstream01:878"></a><span class="pred-ext">at_end_of_stream/[0,1]</span>.</dd>
601601 <dt><strong>eof_action</strong>(<var>A</var>)</dt>
602602 <dd class="defbody">
603603 Unify <var>A</var> with one of <code>eof_code</code>, <code>reset</code>
604604 or
605 <code>error</code>. See <a id="idx:open4:878"></a><a class="pred" href="IO.html#open/4">open/4</a>
605 <code>error</code>. See <a id="idx:open4:879"></a><a class="pred" href="IO.html#open/4">open/4</a>
606606 for details.</dd>
607607 <dt><strong>file_name</strong>(<var>Atom</var>)</dt>
608608 <dd class="defbody">
623623 stream. See <a class="sec" href="locale.html">section 4.22</a>.</dd>
624624 <dt><strong>mode</strong>(<var>IOMode</var>)</dt>
625625 <dd class="defbody">
626 Unify <var>IOMode</var> to the mode given to <a id="idx:open4:879"></a><a class="pred" href="IO.html#open/4">open/4</a>
626 Unify <var>IOMode</var> to the mode given to <a id="idx:open4:880"></a><a class="pred" href="IO.html#open/4">open/4</a>
627627 for opening the stream. Values are: <code>read</code>, <code>write</code>, <code>append</code>
628628 and the SWI-Prolog extension <code>update</code>.</dd>
629629 <dt><strong>newline</strong>(<var>NewlineMode</var>)</dt>
646646 <dd class="defbody">
647647 Unify <var>Pos</var> with the current stream position. A stream position
648648 is an opaque term whose fields can be extracted using
649 <a id="idx:streampositiondata3:880"></a><a class="pred" href="IO.html#stream_position_data/3">stream_position_data/3</a>.
650 See also <a id="idx:setstreamposition2:881"></a><a class="pred" href="IO.html#set_stream_position/2">set_stream_position/2</a>.</dd>
649 <a id="idx:streampositiondata3:881"></a><a class="pred" href="IO.html#stream_position_data/3">stream_position_data/3</a>.
650 See also <a id="idx:setstreamposition2:882"></a><a class="pred" href="IO.html#set_stream_position/2">set_stream_position/2</a>.</dd>
651651 <dt><strong>reposition</strong>(<var>Bool</var>)</dt>
652652 <dd class="defbody">
653653 Unify <var>Bool</var> with <var>true</var> if the position of the stream
654 can be set (see <a id="idx:seek4:882"></a><a class="pred" href="IO.html#seek/4">seek/4</a>).
654 can be set (see <a id="idx:seek4:883"></a><a class="pred" href="IO.html#seek/4">seek/4</a>).
655655 It is assumed the position can be set if the stream has a <em>seek-function</em>
656656 and is not based on a POSIX file descriptor that is not associated to a
657657 regular file.</dd>
665665 character entity). The initial mode is <code>prolog</code> for the user
666666 streams and
667667 <code>error</code> for all other streams. See also <a class="sec" href="widechars.html">section
668 2.18.1</a> and <a id="idx:setstream2:883"></a><a class="pred" href="IO.html#set_stream/2">set_stream/2</a>.</dd>
668 2.18.1</a> and <a id="idx:setstream2:884"></a><a class="pred" href="IO.html#set_stream/2">set_stream/2</a>.</dd>
669669 <dt><strong>timeout</strong>(<var>-Time</var>)</dt>
670670 <dd class="defbody">
671671 <var>Time</var> is the timeout currently associated with the stream. See
672 <a id="idx:setstream2:884"></a><a class="pred" href="IO.html#set_stream/2">set_stream/2</a>
672 <a id="idx:setstream2:885"></a><a class="pred" href="IO.html#set_stream/2">set_stream/2</a>
673673 with the same option. If no timeout is specified,
674674 <var>Time</var> is unified to the atom <code>infinite</code>.</dd>
675675 <dt><strong>type</strong>(<var>Type</var>)</dt>
678678 <dt><strong>tty</strong>(<var>Bool</var>)</dt>
679679 <dd class="defbody">
680680 This property is reported with <var>Bool</var> equal to <code>true</code>
681 if the stream is associated with a terminal. See also <a id="idx:setstream2:885"></a><a class="pred" href="IO.html#set_stream/2">set_stream/2</a>.
681 if the stream is associated with a terminal. See also <a id="idx:setstream2:886"></a><a class="pred" href="IO.html#set_stream/2">set_stream/2</a>.
682682 </dd>
683683 </dl>
684684
686686 <dt class="pubdef"><a id="current_stream/3"><strong>current_stream</strong>(<var>?Object,
687687 ?Mode, ?Stream</var>)</a></dt>
688688 <dd class="defbody">
689 The predicate <a id="idx:currentstream3:886"></a><a class="pred" href="IO.html#current_stream/3">current_stream/3</a>
689 The predicate <a id="idx:currentstream3:887"></a><a class="pred" href="IO.html#current_stream/3">current_stream/3</a>
690690 is used to access the status of a stream as well as to generate all open
691691 streams. <var>Object</var> is the name of the file opened if the stream
692692 refers to an open file, an integer file descriptor if the stream
712712
713713 <p>Stream-pairs can be used by all I/O operations on streams, where the
714714 operation selects the appropriate member of the pair. The predicate
715 <a id="idx:close1:887"></a><a class="pred" href="IO.html#close/1">close/1</a>
716 closes the still open streams of the pair.<sup class="fn">73<span class="fn-text">As
715 <a id="idx:close1:888"></a><a class="pred" href="IO.html#close/1">close/1</a>
716 closes the still open streams of the pair.<sup class="fn">74<span class="fn-text">As
717717 of version 7.1.19, it is allowed to close one of the members of the
718718 stream directly and close the pair later.</span></sup> The output stream
719719 is closed before the input stream. If closing the output stream results
723723 +Pos</var>)</a></dt>
724724 <dd class="defbody">
725725 Set the current position of <var>Stream</var> to <var>Pos</var>. <var>Pos</var>
726 is a term as returned by <a id="idx:streamproperty2:888"></a><a class="pred" href="IO.html#stream_property/2">stream_property/2</a>
727 using the <code>position(Pos)</code> property. See also <a id="idx:seek4:889"></a><a class="pred" href="IO.html#seek/4">seek/4</a>.</dd>
726 is a term as returned by <a id="idx:streamproperty2:889"></a><a class="pred" href="IO.html#stream_property/2">stream_property/2</a>
727 using the <code>position(Pos)</code> property. See also <a id="idx:seek4:890"></a><a class="pred" href="IO.html#seek/4">seek/4</a>.</dd>
728728 <dt class="pubdef"><a id="stream_position_data/3"><strong>stream_position_data</strong>(<var>?Field,
729729 +Pos, -Data</var>)</a></dt>
730730 <dd class="defbody">
731 Extracts information from the opaque stream position term as returned by <a id="idx:streamproperty2:890"></a><a class="pred" href="IO.html#stream_property/2">stream_property/2</a>
731 Extracts information from the opaque stream position term as returned by <a id="idx:streamproperty2:891"></a><a class="pred" href="IO.html#stream_property/2">stream_property/2</a>
732732 requesting the <code>position(Pos)</code> property.
733733 <var>Field</var> is one of <code>line_count</code>, <code>line_position</code>,
734 <code>char_count</code> or <code>byte_count</code>. See also <a id="idx:linecount2:891"></a><a class="pred" href="streamstat.html#line_count/2">line_count/2</a>,
735 <a id="idx:lineposition2:892"></a><a class="pred" href="streamstat.html#line_position/2">line_position/2</a>, <a id="idx:charactercount2:893"></a><a class="pred" href="streamstat.html#character_count/2">character_count/2</a>
736 and <a id="idx:bytecount2:894"></a><a class="pred" href="streamstat.html#byte_count/2">byte_count/2</a>.<sup class="fn">74<span class="fn-text">Introduced
734 <code>char_count</code> or <code>byte_count</code>. See also <a id="idx:linecount2:892"></a><a class="pred" href="streamstat.html#line_count/2">line_count/2</a>,
735 <a id="idx:lineposition2:893"></a><a class="pred" href="streamstat.html#line_position/2">line_position/2</a>, <a id="idx:charactercount2:894"></a><a class="pred" href="streamstat.html#character_count/2">character_count/2</a>
736 and <a id="idx:bytecount2:895"></a><a class="pred" href="streamstat.html#byte_count/2">byte_count/2</a>.<sup class="fn">75<span class="fn-text">Introduced
737737 in version 5.6.4 after extending the position term with a byte count.
738738 Compatible with SICStus Prolog.</span></sup></dd>
739739 <dt class="pubdef"><a id="seek/4"><strong>seek</strong>(<var>+Stream,
749749 files using 2-byte Unicode encoding (2 bytes) or <em>wchar</em> encoding
750750 (sizeof(wchar_t)). The latter guarantees comfortable interaction with
751751 wide-character text objects. Otherwise, the use of
752 <a id="idx:seek4:895"></a><a class="pred" href="IO.html#seek/4">seek/4</a>
753 on non-binary files (see <a id="idx:open4:896"></a><a class="pred" href="IO.html#open/4">open/4</a>)
752 <a id="idx:seek4:896"></a><a class="pred" href="IO.html#seek/4">seek/4</a>
753 on non-binary files (see <a id="idx:open4:897"></a><a class="pred" href="IO.html#open/4">open/4</a>)
754754 is of limited use, especially when using multi-byte text encodings (e.g. UTF-8)
755755 or multi-byte newline files (e.g. DOS/Windows). On text files,
756 SWI-Prolog offers reliable backup to an old position using <a id="idx:streamproperty2:897"></a><a class="pred" href="IO.html#stream_property/2">stream_property/2</a>
756 SWI-Prolog offers reliable backup to an old position using <a id="idx:streamproperty2:898"></a><a class="pred" href="IO.html#stream_property/2">stream_property/2</a>
757757 and
758 <a id="idx:setstreamposition2:898"></a><a class="pred" href="IO.html#set_stream_position/2">set_stream_position/2</a>.
758 <a id="idx:setstreamposition2:899"></a><a class="pred" href="IO.html#set_stream_position/2">set_stream_position/2</a>.
759759 Skipping <var>N</var> character codes is achieved calling
760 <a id="idx:getcode2:899"></a><a class="pred" href="chario.html#get_code/2">get_code/2</a> <var>N</var>
761 times or using <a id="idx:copystreamdata3:900"></a><a class="pred" href="chario.html#copy_stream_data/3">copy_stream_data/3</a>,
762 directing the output to a null stream (see <a id="idx:opennullstream1:901"></a><a class="pred" href="IO.html#open_null_stream/1">open_null_stream/1</a>).
760 <a id="idx:getcode2:900"></a><a class="pred" href="chario.html#get_code/2">get_code/2</a> <var>N</var>
761 times or using <a id="idx:copystreamdata3:901"></a><a class="pred" href="chario.html#copy_stream_data/3">copy_stream_data/3</a>,
762 directing the output to a null stream (see <a id="idx:opennullstream1:902"></a><a class="pred" href="IO.html#open_null_stream/1">open_null_stream/1</a>).
763763 If the seek modifies the current location, the line number and character
764764 position in the line are set to 0.
765765
767767 is raised. If applying the offset would result in a file position less
768768 than zero, a <code>domain_error</code> is raised. Behaviour when seeking
769769 to positions beyond the size of the underlying object depend on the
770 object and possibly the operating system. The predicate <a id="idx:seek4:902"></a><a class="pred" href="IO.html#seek/4">seek/4</a>
770 object and possibly the operating system. The predicate <a id="idx:seek4:903"></a><a class="pred" href="IO.html#seek/4">seek/4</a>
771771 is compatible with Quintus Prolog, though the error conditions and
772 signalling is ISO compliant. See also <a id="idx:streamproperty2:903"></a><a class="pred" href="IO.html#stream_property/2">stream_property/2</a>
773 and <a id="idx:setstreamposition2:904"></a><a class="pred" href="IO.html#set_stream_position/2">set_stream_position/2</a>.</dd>
772 signalling is ISO compliant. See also <a id="idx:streamproperty2:904"></a><a class="pred" href="IO.html#stream_property/2">stream_property/2</a>
773 and <a id="idx:setstreamposition2:905"></a><a class="pred" href="IO.html#set_stream_position/2">set_stream_position/2</a>.</dd>
774774 <dt class="pubdef"><a id="set_stream/2"><strong>set_stream</strong>(<var>+Stream,
775775 +Attribute</var>)</a></dt>
776776 <dd class="defbody">
777777 Modify an attribute of an existing stream. <var>Attribute</var>
778 specifies the stream property to set. If stream is a <em>pair</em> (see <a id="idx:streampair3:905"></a><a class="pred" href="IO.html#stream_pair/3">stream_pair/3</a>)
778 specifies the stream property to set. If stream is a <em>pair</em> (see <a id="idx:streampair3:906"></a><a class="pred" href="IO.html#stream_pair/3">stream_pair/3</a>)
779779 both streams are modified, unless the property is only meaningful on one
780780 of the streams or setting both is not meaningful. In particular,
781781 <code>eof_action</code> only applies to the <em>read</em> stream,
782782 <code>representation_errors</code> only applies to the <em>write</em>
783783 stream and trying to set <code>alias</code> or <code>line_position</code>
784784 on a pair results in a <code>permission_error</code> exception. See also
785 <a id="idx:streamproperty2:906"></a><a class="pred" href="IO.html#stream_property/2">stream_property/2</a>
786 and <a id="idx:open4:907"></a><a class="pred" href="IO.html#open/4">open/4</a>.
785 <a id="idx:streamproperty2:907"></a><a class="pred" href="IO.html#stream_property/2">stream_property/2</a>
786 and <a id="idx:open4:908"></a><a class="pred" href="IO.html#open/4">open/4</a>.
787787
788788 <dl class="latex">
789789 <dt><strong>alias</strong>(<var>AliasName</var>)</dt>
790790 <dd class="defbody">
791791 Set the alias of an already created stream. If <var>AliasName</var> is
792792 the name of one of the standard streams, this stream is rebound. Thus, <code>set_stream(S,
793 current_input)</code> is the same as <a id="idx:setinput1:908"></a><a class="pred" href="IO.html#set_input/1">set_input/1</a>,
793 current_input)</code> is the same as <a id="idx:setinput1:909"></a><a class="pred" href="IO.html#set_input/1">set_input/1</a>,
794794 and by setting the alias of a stream to <code>user_input</code>, etc.,
795 all user terminal input is read from this stream. See also <a id="idx:interactor0:909"></a><a class="pred" href="thutil.html#interactor/0">interactor/0</a>.</dd>
795 all user terminal input is read from this stream. See also <a id="idx:interactor0:910"></a><a class="pred" href="thutil.html#interactor/0">interactor/0</a>.</dd>
796796 <dt><strong>buffer</strong>(<var>Buffering</var>)</dt>
797797 <dd class="defbody">
798798 Set the buffering mode of an already created stream. Buffering is one of <code>full</code>, <code>line</code>
803803 bytes.</dd>
804804 <dt><strong>close_on_abort</strong>(<var>Bool</var>)</dt>
805805 <dd class="defbody">
806 Determine whether or not the stream is closed by <a id="idx:abort0:910"></a><a class="pred" href="toplevel.html#abort/0">abort/0</a>.
806 Determine whether or not the stream is closed by <a id="idx:abort0:911"></a><a class="pred" href="toplevel.html#abort/0">abort/0</a>.
807807 By default, streams are closed.</dd>
808808 <dt><strong>close_on_exec</strong>(<var>Bool</var>)</dt>
809809 <dd class="defbody">
810 Set the <code>close_on_exec</code> property. See <a id="idx:streamproperty2:911"></a><a class="pred" href="IO.html#stream_property/2">stream_property/2</a>.</dd>
810 Set the <code>close_on_exec</code> property. See <a id="idx:streamproperty2:912"></a><a class="pred" href="IO.html#stream_property/2">stream_property/2</a>.</dd>
811811 <dt><strong>encoding</strong>(<var>Atom</var>)</dt>
812812 <dd class="defbody">
813813 Defines the mapping between bytes and character codes used for the
834834 to correct position management of the stream after sending a terminal
835835 escape sequence (e.g., setting ANSI character attributes). Setting this
836836 attribute raises a permission error if the stream does not record
837 positions. See <a id="idx:lineposition2:912"></a><a class="pred" href="streamstat.html#line_position/2">line_position/2</a>
838 and <a id="idx:streamproperty2:913"></a><a class="pred" href="IO.html#stream_property/2">stream_property/2</a>
837 positions. See <a id="idx:lineposition2:913"></a><a class="pred" href="streamstat.html#line_position/2">line_position/2</a>
838 and <a id="idx:streamproperty2:914"></a><a class="pred" href="IO.html#stream_property/2">stream_property/2</a>
839839 (property <code>position</code>).</dd>
840840 <dt><strong>locale</strong>(<var>+Locale</var>)</dt>
841841 <dd class="defbody">
844844 <dt><strong>newline</strong>(<var>NewlineMode</var>)</dt>
845845 <dd class="defbody">
846846 Set input or output translation for newlines. See corresponding
847 <a id="idx:streamproperty2:914"></a><a class="pred" href="IO.html#stream_property/2">stream_property/2</a>
847 <a id="idx:streamproperty2:915"></a><a class="pred" href="IO.html#stream_property/2">stream_property/2</a>
848848 for details. In addition to the detected modes, an input stream can be
849849 set in mode <code>detect</code>. It will be set to <code>dos</code> if a <code>\r</code>
850850 character was removed.</dd>
853853 This option can be used to make streams generate an exception if it
854854 takes longer than <var>Seconds</var> before any new data arrives at the
855855 stream. The value <var>infinite</var> (default) makes the stream block
856 indefinitely. Like <a id="idx:waitforinput3:915"></a><a class="pred" href="streamstat.html#wait_for_input/3">wait_for_input/3</a>,
856 indefinitely. Like <a id="idx:waitforinput3:916"></a><a class="pred" href="streamstat.html#wait_for_input/3">wait_for_input/3</a>,
857857 this call only applies to streams that support the select() system call.
858 For further information about timeout handling, see <a id="idx:waitforinput3:916"></a><a class="pred" href="streamstat.html#wait_for_input/3">wait_for_input/3</a>.
858 For further information about timeout handling, see <a id="idx:waitforinput3:917"></a><a class="pred" href="streamstat.html#wait_for_input/3">wait_for_input/3</a>.
859859 The exception is of the form
860860 <blockquote>
861861 <code>error(<code>timeout_error(read, Stream)</code>, _)</code>
864864 <dt><strong>type</strong>(<var>Type</var>)</dt>
865865 <dd class="defbody">
866866 Set the type of the stream to one of <code>text</code> or <code>binary</code>.
867 See also <a id="idx:open4:917"></a><a class="pred" href="IO.html#open/4">open/4</a>
867 See also <a id="idx:open4:918"></a><a class="pred" href="IO.html#open/4">open/4</a>
868868 and the <code>encoding</code> property of streams. Switching to <code>binary</code>
869869 sets the encoding to <code>octet</code>. Switching to
870870 <code>text</code> sets the encoding to the default text encoding.</dd>
871871 <dt><strong>record_position</strong>(<var>Bool</var>)</dt>
872872 <dd class="defbody">
873 Do/do not record the line count and line position (see <a id="idx:linecount2:918"></a><a class="pred" href="streamstat.html#line_count/2">line_count/2</a>
874 and <a id="idx:lineposition2:919"></a><a class="pred" href="streamstat.html#line_position/2">line_position/2</a>).</dd>
873 Do/do not record the line count and line position (see <a id="idx:linecount2:919"></a><a class="pred" href="streamstat.html#line_count/2">line_count/2</a>
874 and <a id="idx:lineposition2:920"></a><a class="pred" href="streamstat.html#line_position/2">line_position/2</a>).</dd>
875875 <dt><strong>representation_errors</strong>(<var>Mode</var>)</dt>
876876 <dd class="defbody">
877877 Change the behaviour when writing characters to the stream that cannot
878 be represented by the encoding. See also <a id="idx:streamproperty2:920"></a><a class="pred" href="IO.html#stream_property/2">stream_property/2</a>
878 be represented by the encoding. See also <a id="idx:streamproperty2:921"></a><a class="pred" href="IO.html#stream_property/2">stream_property/2</a>
879879 and
880880 <a class="sec" href="widechars.html">section 2.18.1</a>.</dd>
881881 <dt><strong>tty</strong>(<var>Bool</var>)</dt>
883883 Modify whether Prolog thinks there is a terminal (i.e. human
884884 interaction) connected to this stream. On Unix systems the initial value
885885 comes from isatty(). On Windows, the initial user streams are supposed
886 to be associated to a terminal. See also <a id="idx:streamproperty2:921"></a><a class="pred" href="IO.html#stream_property/2">stream_property/2</a>.
886 to be associated to a terminal. See also <a id="idx:streamproperty2:922"></a><a class="pred" href="IO.html#stream_property/2">stream_property/2</a>.
887887 </dd>
888888 </dl>
889889
901901 is used for
902902 <code>user_error</code>. Output buffering for <var>Out</var> is set to
903903 <code>line</code> and buffering on <var>Error</var> is disabled. See
904 also <a id="idx:prolog0:922"></a><a class="pred" href="toplevel.html#prolog/0">prolog/0</a>
905 and <a id="idx:setstream2:923"></a><a class="pred" href="IO.html#set_stream/2">set_stream/2</a>.
904 also <a id="idx:prolog0:923"></a><a class="pred" href="toplevel.html#prolog/0">prolog/0</a>
905 and <a id="idx:setstream2:924"></a><a class="pred" href="IO.html#set_stream/2">set_stream/2</a>.
906906 The <em>clib</em> package provides the library <code>library(prolog_server)</code>,
907907 creating a TCP/IP server for creating an interactive session to Prolog.
908908 </dd>
917917 compatible with Edinburgh DEC-10 and C-Prolog. The reading and writing
918918 predicates refer to, resp., the <em>current</em> input and output
919919 streams. Initially these streams are connected to the terminal. The
920 current output stream is changed using <a id="idx:tell1:924"></a><a class="pred" href="IO.html#tell/1">tell/1</a>
921 or <a id="idx:append1:925"></a><a class="pred" href="IO.html#append/1">append/1</a>.
922 The current input stream is changed using <a id="idx:see1:926"></a><a class="pred" href="IO.html#see/1">see/1</a>.
923 The stream's current value can be obtained using <a id="idx:telling1:927"></a><a class="pred" href="IO.html#telling/1">telling/1</a>
924 for output and <a id="idx:seeing1:928"></a><a class="pred" href="IO.html#seeing/1">seeing/1</a>
920 current output stream is changed using <a id="idx:tell1:925"></a><a class="pred" href="IO.html#tell/1">tell/1</a>
921 or <a id="idx:append1:926"></a><a class="pred" href="IO.html#append/1">append/1</a>.
922 The current input stream is changed using <a id="idx:see1:927"></a><a class="pred" href="IO.html#see/1">see/1</a>.
923 The stream's current value can be obtained using <a id="idx:telling1:928"></a><a class="pred" href="IO.html#telling/1">telling/1</a>
924 for output and <a id="idx:seeing1:929"></a><a class="pred" href="IO.html#seeing/1">seeing/1</a>
925925 for input.
926926
927927 <p>Source and destination are either a file, <code>user</code>, or a
928928 term `pipe(<var>Command</var>)'. The reserved stream name <code>user</code>
929 refers to the terminal.<sup class="fn">75<span class="fn-text">The ISO
929 refers to the terminal.<sup class="fn">76<span class="fn-text">The ISO
930930 I/O layer uses <code>user_input</code>, <code>user_output</code> and <code>user_error</code>.</span></sup>
931931 In the predicate descriptions below we will call the source/destination
932932 argument `<var>SrcDest</var>'. Below are some examples of
942942 </table>
943943
944944 <p>Another example of using the <code>pipe/1</code> construct is shown
945 below.<sup class="fn">76<span class="fn-text">As of version 5.3.15, the
945 below.<sup class="fn">77<span class="fn-text">As of version 5.3.15, the
946946 pipe construct is supported in the MS-Windows version, both for <b>swipl.exe</b>
947947 and <b>swipl-win.exe</b>. The implementation uses code from the LUA
948948 programming language (<a class="url" href="http://www.lua.org">http://www.lua.org</a>).</span></sup>
962962 collect_wd([]).
963963 </pre>
964964
965 <p>The effect of <a id="idx:tell1:929"></a><a class="pred" href="IO.html#tell/1">tell/1</a>
965 <p>The effect of <a id="idx:tell1:930"></a><a class="pred" href="IO.html#tell/1">tell/1</a>
966966 is not undone on backtracking, and since the stream handle is not
967967 specified explicitly in further I/O operations when using
968968 Edinburgh-style I/O, you may write to unintended streams more easily
975975
976976 <h4>Compatibility notes</h4>
977977
978 <p>Unlike Edinburgh Prolog systems, <a id="idx:telling1:930"></a><a class="pred" href="IO.html#telling/1">telling/1</a>
979 and <a id="idx:seeing1:931"></a><a class="pred" href="IO.html#seeing/1">seeing/1</a>
978 <p>Unlike Edinburgh Prolog systems, <a id="idx:telling1:931"></a><a class="pred" href="IO.html#telling/1">telling/1</a>
979 and <a id="idx:seeing1:932"></a><a class="pred" href="IO.html#seeing/1">seeing/1</a>
980980 do not return the filename of the current input/output but rather the
981981 stream identifier, to ensure the design pattern below works under all
982 circumstances:<sup class="fn">77<span class="fn-text">Filenames can be
982 circumstances:<sup class="fn">78<span class="fn-text">Filenames can be
983983 ambiguous and SWI-Prolog streams can refer to much more than just files.</span></sup>
984984
985985 <pre class="code">
990990 ...,
991991 </pre>
992992
993 <p>The predicates <a id="idx:tell1:932"></a><a class="pred" href="IO.html#tell/1">tell/1</a>
994 and <a id="idx:see1:933"></a><a class="pred" href="IO.html#see/1">see/1</a>
993 <p>The predicates <a id="idx:tell1:933"></a><a class="pred" href="IO.html#tell/1">tell/1</a>
994 and <a id="idx:see1:934"></a><a class="pred" href="IO.html#see/1">see/1</a>
995995 first check for <code>user</code>, the
996996 <code>pipe(command)</code> and a stream handle. Otherwise, if the
997997 argument is an atom it is first compared to open streams associated to a
998998 file with <em>exactly</em> the same name. If such a stream exists,
999999 created using
1000 <a id="idx:tell1:934"></a><a class="pred" href="IO.html#tell/1">tell/1</a>
1001 or <a id="idx:see1:935"></a><a class="pred" href="IO.html#see/1">see/1</a>,
1000 <a id="idx:tell1:935"></a><a class="pred" href="IO.html#tell/1">tell/1</a>
1001 or <a id="idx:see1:936"></a><a class="pred" href="IO.html#see/1">see/1</a>,
10021002 output (input) is switched to the open stream. Otherwise a file with the
10031003 specified name is opened.
10041004
10131013 <dt class="pubdef"><a id="see/1"><strong>see</strong>(<var>+SrcDest</var>)</a></dt>
10141014 <dd class="defbody">
10151015 Open <var>SrcDest</var> for reading and make it the current input (see
1016 <a id="idx:setinput1:936"></a><a class="pred" href="IO.html#set_input/1">set_input/1</a>).
1016 <a id="idx:setinput1:937"></a><a class="pred" href="IO.html#set_input/1">set_input/1</a>).
10171017 If <var>SrcDest</var> is a stream handle, just make this stream the
10181018 current input. See the introduction of <a class="sec" href="IO.html">section
10191019 4.16.3</a> for details.</dd>
10201020 <dt class="pubdef"><a id="tell/1"><strong>tell</strong>(<var>+SrcDest</var>)</a></dt>
10211021 <dd class="defbody">
10221022 Open <var>SrcDest</var> for writing and make it the current output (see
1023 <a id="idx:setoutput1:937"></a><a class="pred" href="IO.html#set_output/1">set_output/1</a>).
1023 <a id="idx:setoutput1:938"></a><a class="pred" href="IO.html#set_output/1">set_output/1</a>).
10241024 If <var>SrcDest</var> is a stream handle, just make this stream the
10251025 current output. See the introduction of <a class="sec" href="IO.html">section
10261026 4.16.3</a> for details.</dd>
10271027 <dt class="pubdef"><a id="append/1"><strong>append</strong>(<var>+File</var>)</a></dt>
10281028 <dd class="defbody">
1029 Similar to <a id="idx:tell1:938"></a><a class="pred" href="IO.html#tell/1">tell/1</a>,
1029 Similar to <a id="idx:tell1:939"></a><a class="pred" href="IO.html#tell/1">tell/1</a>,
10301030 but positions the file pointer at the end of <var>File</var> rather than
10311031 truncating an existing file. The pipe construct is not accepted by this
10321032 predicate.</dd>
10331033 <dt class="pubdef"><a id="seeing/1"><strong>seeing</strong>(<var>?SrcDest</var>)</a></dt>
10341034 <dd class="defbody">
1035 Same as <a id="idx:currentinput1:939"></a><a class="pred" href="IO.html#current_input/1">current_input/1</a>,
1035 Same as <a id="idx:currentinput1:940"></a><a class="pred" href="IO.html#current_input/1">current_input/1</a>,
10361036 except that <code>user</code> is returned if the current input is the
10371037 stream <code>user_input</code> to improve compatibility with traditional
10381038 Edinburgh I/O. See the introduction of
10391039 <a class="sec" href="IO.html">section 4.16.3</a> for details.</dd>
10401040 <dt class="pubdef"><a id="telling/1"><strong>telling</strong>(<var>?SrcDest</var>)</a></dt>
10411041 <dd class="defbody">
1042 Same as <a id="idx:currentoutput1:940"></a><a class="pred" href="IO.html#current_output/1">current_output/1</a>,
1042 Same as <a id="idx:currentoutput1:941"></a><a class="pred" href="IO.html#current_output/1">current_output/1</a>,
10431043 except that <code>user</code> is returned if the current output is the
10441044 stream <code>user_output</code> to improve compatibility with
10451045 traditional Edinburgh I/O. See the introduction of
10721072 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="set_output/1"><strong>set_output</strong>(<var>+Stream</var>)</a></dt>
10731073 <dd class="defbody">
10741074 Set the current output stream to become <var>Stream</var>. See also
1075 <a id="idx:withoutputto2:941"></a><a class="pred" href="IO.html#with_output_to/2">with_output_to/2</a>.
1075 <a id="idx:withoutputto2:942"></a><a class="pred" href="IO.html#with_output_to/2">with_output_to/2</a>.
10761076 </dd>
10771077 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="current_input/1"><strong>current_input</strong>(<var>-Stream</var>)</a></dt>
10781078 <dd class="defbody">
10941094 <dt class="pubdef"><a id="with_output_to/2"><strong>with_output_to</strong>(<var>+Output,
10951095 :Goal</var>)</a></dt>
10961096 <dd class="defbody">
1097 Run <var>Goal</var> as <a id="idx:once1:942"></a><a class="pred" href="metacall.html#once/1">once/1</a>,
1097 Run <var>Goal</var> as <a id="idx:once1:943"></a><a class="pred" href="metacall.html#once/1">once/1</a>,
10981098 while characters written to the current output are sent to <var>Output</var>.
10991099 The predicate is SWI-Prolog-specific, inspired by various posts to the
11001100 mailinglist. It provides a flexible replacement for predicates such as
1101 sformat/3 , <a id="idx:swritef3:943"></a><a class="pred" href="format.html#swritef/3">swritef/3</a>,
1102 <a id="idx:termtoatom2:944"></a><a class="pred" href="manipatom.html#term_to_atom/2">term_to_atom/2</a>, <a id="idx:atomnumber2:945"></a><a class="pred" href="manipatom.html#atom_number/2">atom_number/2</a>
1103 converting numbers to atoms, etc. The predicate <a id="idx:format3:946"></a><a class="pred" href="format.html#format/3">format/3</a>
1101 sformat/3 , <a id="idx:swritef3:944"></a><a class="pred" href="format.html#swritef/3">swritef/3</a>,
1102 <a id="idx:termtoatom2:945"></a><a class="pred" href="manipatom.html#term_to_atom/2">term_to_atom/2</a>, <a id="idx:atomnumber2:946"></a><a class="pred" href="manipatom.html#atom_number/2">atom_number/2</a>
1103 converting numbers to atoms, etc. The predicate <a id="idx:format3:947"></a><a class="pred" href="format.html#format/3">format/3</a>
11041104 accepts the same terms as output argument.
11051105
11061106 <p>Applications should generally avoid creating atoms by breaking and
11081108 intermediate atoms generally leads to poor performance, even more so in
11091109 multithreaded applications. This predicate supports creating difference
11101110 lists from character data efficiently. The example below defines the DCG
1111 rule <a id="idx:term1:947"></a><span class="pred-ext">term/3</span> to
1111 rule <a id="idx:term1:948"></a><span class="pred-ext">term/3</span> to
11121112 insert a term in the output:
11131113
11141114 <pre class="code">
11241124 <dt><b>A Stream handle or alias</b></dt>
11251125 <dd class="defbody">
11261126 Temporarily switch current output to the given stream. Redirection using
1127 <a id="idx:withoutputto2:948"></a><a class="pred" href="IO.html#with_output_to/2">with_output_to/2</a>
1127 <a id="idx:withoutputto2:949"></a><a class="pred" href="IO.html#with_output_to/2">with_output_to/2</a>
11281128 guarantees the original output is restored, also if
1129 <var>Goal</var> fails or raises an exception. See also <a id="idx:callcleanup2:949"></a><a class="pred" href="metacall.html#call_cleanup/2">call_cleanup/2</a>.</dd>
1129 <var>Goal</var> fails or raises an exception. See also <a id="idx:callcleanup2:950"></a><a class="pred" href="metacall.html#call_cleanup/2">call_cleanup/2</a>.</dd>
11301130 <dt><strong>atom</strong>(<var>-Atom</var>)</dt>
11311131 <dd class="defbody">
11321132 Create an atom from the emitted characters. Please note the remark
11381138 <dt><strong>codes</strong>(<var>-Codes</var>)</dt>
11391139 <dd class="defbody">
11401140 Create a list of character codes from the emitted characters, similar to
1141 <a id="idx:atomcodes2:950"></a><a class="pred" href="manipatom.html#atom_codes/2">atom_codes/2</a>.</dd>
1141 <a id="idx:atomcodes2:951"></a><a class="pred" href="manipatom.html#atom_codes/2">atom_codes/2</a>.</dd>
11421142 <dt><strong>codes</strong>(<var>-Codes, -Tail</var>)</dt>
11431143 <dd class="defbody">
11441144 Create a list of character codes as a difference list.</dd>
11451145 <dt><strong>chars</strong>(<var>-Chars</var>)</dt>
11461146 <dd class="defbody">
11471147 Create a list of one-character atoms from the emitted characters,
1148 similar to <a id="idx:atomchars2:951"></a><a class="pred" href="manipatom.html#atom_chars/2">atom_chars/2</a>.</dd>
1148 similar to <a id="idx:atomchars2:952"></a><a class="pred" href="manipatom.html#atom_chars/2">atom_chars/2</a>.</dd>
11491149 <dt><strong>chars</strong>(<var>-Chars, -Tail</var>)</dt>
11501150 <dd class="defbody">
11511151 Create a list of one-character atoms as a difference list.
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 8.2</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 8.2</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 1.6</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 1.6</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.1</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.1</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.29</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.29</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
244244 Create a list of the instantiations <var>Template</var> gets
245245 successively on backtracking over <var>Goal</var> and unify the result
246246 with <var>Bag</var>. Succeeds with an empty list if <var>Goal</var> has
247 no solutions. <a id="idx:findall3:1239"></a><a class="pred" href="allsolutions.html#findall/3">findall/3</a>
248 is equivalent to <a id="idx:bagof3:1240"></a><a class="pred" href="allsolutions.html#bagof/3">bagof/3</a>
247 no solutions. <a id="idx:findall3:1241"></a><a class="pred" href="allsolutions.html#findall/3">findall/3</a>
248 is equivalent to <a id="idx:bagof3:1242"></a><a class="pred" href="allsolutions.html#bagof/3">bagof/3</a>
249249 with all free variables bound with the existential operator (<strong><code>^</code></strong>),
250 except that <a id="idx:bagof3:1241"></a><a class="pred" href="allsolutions.html#bagof/3">bagof/3</a>
250 except that <a id="idx:bagof3:1243"></a><a class="pred" href="allsolutions.html#bagof/3">bagof/3</a>
251251 fails when <var>Goal</var> has no solutions.</dd>
252252 <dt class="pubdef"><a id="findall/4"><strong>findall</strong>(<var>+Template,
253253 :Goal, -Bag, +Tail</var>)</a></dt>
254254 <dd class="defbody">
255 As <a id="idx:findall3:1242"></a><a class="pred" href="allsolutions.html#findall/3">findall/3</a>,
255 As <a id="idx:findall3:1244"></a><a class="pred" href="allsolutions.html#findall/3">findall/3</a>,
256256 but returns the result as the difference list
257257 <var>Bag</var>-<var>Tail</var>. The 3-argument version is defined as
258258
267267 <dt class="pubdef"><span class="pred-tag">[nondet]</span><a id="findnsols/5"><strong>findnsols</strong>(<var>+N,
268268 @Template, :Goal, -List, ?Tail</var>)</a></dt>
269269 <dd class="defbody">
270 As <a id="idx:findall3:1243"></a><a class="pred" href="allsolutions.html#findall/3">findall/3</a>
271 and <a id="idx:findall4:1244"></a><a class="pred" href="allsolutions.html#findall/4">findall/4</a>,
270 As <a id="idx:findall3:1245"></a><a class="pred" href="allsolutions.html#findall/3">findall/3</a>
271 and <a id="idx:findall4:1246"></a><a class="pred" href="allsolutions.html#findall/4">findall/4</a>,
272272 but generates at most <var>N</var> solutions. If
273273 <var>N</var> solutions are returned, this predicate succeeds with a
274274 choice point if <var>Goal</var> has a choice point. Backtracking returns
275275 the next chunk of (at most) <var>N</var> solutions. In addition to
276276 passing a plain integer for <var>N</var>, a term of the form <code>count(N)</code>
277277 is accepted. Using <code>count(N)</code>, the size of the next chunk can
278 be controlled using <a id="idx:nbsetarg3:1245"></a><a class="pred" href="manipterm.html#nb_setarg/3">nb_setarg/3</a>.
278 be controlled using <a id="idx:nbsetarg3:1247"></a><a class="pred" href="manipterm.html#nb_setarg/3">nb_setarg/3</a>.
279279 The non-deterministic behaviour used to implement the
280280 <em>chunk</em> option in <code>library(pengines)</code>. Based on Ciao,
281281 but the Ciao version is deterministic. Portability can be achieved by
282 wrapping the goal in <a id="idx:once1:1246"></a><a class="pred" href="metacall.html#once/1">once/1</a>.
282 wrapping the goal in <a id="idx:once1:1248"></a><a class="pred" href="metacall.html#once/1">once/1</a>.
283283 Below are three examples. The first illustrates standard chunking of
284284 answers. The second illustrates that the chunk size can be adjusted
285285 dynamically and the last illustrates that no choice point is left if <var>Goal</var>
307307 :Goal, -Bag</var>)</a></dt>
308308 <dd class="defbody">
309309 Unify <var>Bag</var> with the alternatives of <var>Template</var>. If <var>Goal</var>
310 has free variables besides the one sharing with <var>Template</var>, <a id="idx:bagof3:1247"></a><a class="pred" href="allsolutions.html#bagof/3">bagof/3</a>
310 has free variables besides the one sharing with <var>Template</var>, <a id="idx:bagof3:1249"></a><a class="pred" href="allsolutions.html#bagof/3">bagof/3</a>
311311 will backtrack over the alternatives of these free variables, unifying
312312 <var>Bag</var> with the corresponding alternatives of <var>Template</var>.
313313 The construct <code>+<var>Var</var><code>^</code><var>Goal</var></code>
314 tells <a id="idx:bagof3:1248"></a><a class="pred" href="allsolutions.html#bagof/3">bagof/3</a>
314 tells <a id="idx:bagof3:1250"></a><a class="pred" href="allsolutions.html#bagof/3">bagof/3</a>
315315 not to bind
316 <var>Var</var> in <var>Goal</var>. <a id="idx:bagof3:1249"></a><a class="pred" href="allsolutions.html#bagof/3">bagof/3</a>
316 <var>Var</var> in <var>Goal</var>. <a id="idx:bagof3:1251"></a><a class="pred" href="allsolutions.html#bagof/3">bagof/3</a>
317317 fails if <var>Goal</var> has no solutions.
318318
319 <p>The example below illustrates <a id="idx:bagof3:1250"></a><a class="pred" href="allsolutions.html#bagof/3">bagof/3</a>
319 <p>The example below illustrates <a id="idx:bagof3:1252"></a><a class="pred" href="allsolutions.html#bagof/3">bagof/3</a>
320320 and the <strong><code>^</code></strong> operator. The variable bindings
321321 are printed together on one line to save paper.
322322
345345 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="setof/3"><strong>setof</strong>(<var>+Template,
346346 +Goal, -Set</var>)</a></dt>
347347 <dd class="defbody">
348 Equivalent to <a id="idx:bagof3:1251"></a><a class="pred" href="allsolutions.html#bagof/3">bagof/3</a>,
349 but sorts the result using <a id="idx:sort2:1252"></a><a class="pred" href="builtinlist.html#sort/2">sort/2</a>
348 Equivalent to <a id="idx:bagof3:1253"></a><a class="pred" href="allsolutions.html#bagof/3">bagof/3</a>,
349 but sorts the result using <a id="idx:sort2:1254"></a><a class="pred" href="builtinlist.html#sort/2">sort/2</a>
350350 to get a sorted list of alternatives without duplicates.
351351 </dd>
352352 </dl>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 6.11</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 6.11</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
237237
238238 <a id="sec:altmoduleapi"></a>
239239
240 <p>The <a id="idx:usemodule1:1582"></a><a class="pred" href="import.html#use_module/1">use_module/1</a>
240 <p>The <a id="idx:usemodule1:1584"></a><a class="pred" href="import.html#use_module/1">use_module/1</a>
241241 predicate from <a class="sec" href="import.html">section 6.3</a> defines
242242 import and export relations based on the filename from which a module is
243243 loaded. If modules are created differently, such as by asserting
251251 <dd class="defbody">
252252 Add predicates to the public list of the context module. This implies
253253 the predicate will be imported into another module if this module is
254 imported with <a id="idx:usemodule12:1583"></a><span class="pred-ext">use_module/[1,2]</span>.
255 Note that predicates are normally exported using the directive <a id="idx:module2:1584"></a><a class="pred" href="defmodule.html#module/2">module/2</a>. <a id="idx:export1:1585"></a><a class="pred" href="altmoduleapi.html#export/1">export/1</a>
254 imported with <a id="idx:usemodule12:1585"></a><span class="pred-ext">use_module/[1,2]</span>.
255 Note that predicates are normally exported using the directive <a id="idx:module2:1586"></a><a class="pred" href="defmodule.html#module/2">module/2</a>. <a id="idx:export1:1587"></a><a class="pred" href="altmoduleapi.html#export/1">export/1</a>
256256 is meant to handle export from dynamically created modules.</dd>
257257 <dt class="pubdef"><a id="import/1"><strong>import</strong>(<var>+PredicateIndicator,
258258 ...</var>)</a></dt>
260260 Import predicates <var>PredicateIndicator</var> into the current context
261261 module. <var>PredicateIndicator</var> must specify the source module
262262 using the &lt;<var>module</var>&gt;:&lt;<var>pi</var>&gt; construct.
263 Note that predicates are normally imported using one of the directives <a id="idx:usemodule12:1586"></a><span class="pred-ext">use_module/[1,2]</span>.
264 The <a id="idx:import1:1587"></a><a class="pred" href="altmoduleapi.html#import/1">import/1</a>
263 Note that predicates are normally imported using one of the directives <a id="idx:usemodule12:1588"></a><span class="pred-ext">use_module/[1,2]</span>.
264 The <a id="idx:import1:1589"></a><a class="pred" href="altmoduleapi.html#import/1">import/1</a>
265265 alternative is meant for handling imports into dynamically created
266 modules. See also <a id="idx:export1:1588"></a><a class="pred" href="altmoduleapi.html#export/1">export/1</a>
267 and <a id="idx:exportlist2:1589"></a><span class="pred-ext">export_list/2</span>.
266 modules. See also <a id="idx:export1:1590"></a><a class="pred" href="altmoduleapi.html#export/1">export/1</a>
267 and <a id="idx:exportlist2:1591"></a><span class="pred-ext">export_list/2</span>.
268268 </dd>
269269 </dl>
270270
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section B.2</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section B.2</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
241241 <dt class="pubdef"><a id="prolog_cut_to/1"><strong>prolog_cut_to</strong>(<var>+Choice</var>)</a></dt>
242242 <dd class="defbody">
243243 Prunes all choice points created since <var>Choice</var>. Can be used
244 together with <a id="idx:prologcurrentchoice1:1991"></a><a class="pred" href="manipstack.html#prolog_current_choice/1">prolog_current_choice/1</a>
244 together with <a id="idx:prologcurrentchoice1:1994"></a><a class="pred" href="manipstack.html#prolog_current_choice/1">prolog_current_choice/1</a>
245245 to implement <em>ancestral</em> cuts. This predicate is in the hackers
246246 corner because it should not be used in normal Prolog code. It may be
247247 used to create new high level control structures, particularly for
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.2</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.2</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.26</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.26</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
264264 =&lt;<var>High</var></var>. When <var>Value</var> is a variable it is
265265 successively bound to all integers between <var>Low</var> and <var>High</var>.
266266 If <var>High</var> is <code>inf</code> or
267 <code>infinite</code><sup class="fn">94<span class="fn-text">We prefer <code>infinite</code>,
267 <code>infinite</code><sup class="fn">95<span class="fn-text">We prefer <code>infinite</code>,
268268 but some other Prolog systems already use <code>inf</code> for infinity;
269269 we accept both for the time being.</span></sup>
270 <a id="idx:between3:1201"></a><a class="pred" href="arith.html#between/3">between/3</a>
270 <a id="idx:between3:1202"></a><a class="pred" href="arith.html#between/3">between/3</a>
271271 is true iff <var><var>Value</var> &gt;=<var>Low</var></var>, a feature
272272 that is particularly interesting for generating integers from a certain
273273 value.</dd>
278278 &gt;= 0</var>. At least one of the arguments must be instantiated to a
279279 natural number. This predicate raises the domain error <code>not_less_than_zero</code>
280280 if called with a negative integer. E.g. <code>succ(X, 0)</code> fails
281 silently and <code>succ(X, -1)</code> raises a domain error.<sup class="fn">95<span class="fn-text">The
281 silently and <code>succ(X, -1)</code> raises a domain error.<sup class="fn">96<span class="fn-text">The
282282 behaviour to deal with natural numbers only was defined by Richard
283283 O'Keefe to support the common count-down-to-zero in a natural way. Up to
284 5.1.8, <a id="idx:succ2:1202"></a><a class="pred" href="arith.html#succ/2">succ/2</a>
284 5.1.8, <a id="idx:succ2:1203"></a><a class="pred" href="arith.html#succ/2">succ/2</a>
285285 also accepted negative integers.</span></sup></dd>
286286 <dt class="pubdef"><a id="plus/3"><strong>plus</strong>(<var>?Int1,
287287 ?Int2, ?Int3</var>)</a></dt>
288288 <dd class="defbody">
289289 True if <var><var>Int3</var> = <var>Int1</var> + <var>Int2</var></var>.
290 At least two of the three arguments must be instantiated to integers.
291 </dd>
290 At least two of the three arguments must be instantiated to integers.</dd>
291 <dt class="pubdef"><a id="divmod/4"><strong>divmod</strong>(<var>+Dividend,
292 +Divisor, -Quotient, -Remainder</var>)</a></dt>
293 <dd class="defbody">
294 This predicate is a shorthand for computing both the <var>Quotient</var>
295 and
296 <var>Remainder</var> of two integers in a single operation. This allows
297 for exploiting the fact that the low level implementation for computing
298 the quotient also produces the remainder. Timing confirms that this
299 predicate is almost twice as fast as performing the steps independently.
300 Semantically, <a id="idx:divmod4:1204"></a><a class="pred" href="arith.html#divmod/4">divmod/4</a>
301 is defined as below.
302
303 <pre class="code">
304 divmod(Dividend, Divisor, Quotient, Remainder) :-
305 Quotient is Dividend div Divisor,
306 Remainder is Dividend mod Divisor.
307 </pre>
308
309 <p>Note that this predicate is only available if SWI-Prolog is compiled
310 with unbounded integer support. This is the case for all packaged
311 versions.</dd>
312 <dt class="pubdef"><a id="nth_integer_root_and_remainder/4"><strong>nth_integer_root_and_remainder</strong>(<var>+N,
313 +I, -Root, -Remainder</var>)</a></dt>
314 <dd class="defbody">
315 True when <var>Root ** N + Remainder = I</var>. <var>N</var> and <var>I</var>
316 must be integers.<sup class="fn">97<span class="fn-text">This predicate
317 was suggested by Markus Triska. The final name and argument order is by
318 Richard O'Keefe. The decision to include the remainder is by Jan
319 Wielemaker. Including the remainder makes this predicate about twice as
320 slow if <var>Root</var> is not exact.</span></sup>
321 <var>N</var> must be one or more. If <var>I</var> is negative and
322 <var>N</var> is <em>odd</em>, <var>Root</var> and <var>Remainder</var>
323 are negative, i.e., the following holds for <var><var>I</var> &lt; 0</var>:
324
325 <pre class="code">
326 % I &lt; 0,
327 % N mod 2 =\= 0,
328 nth_integer_root_and_remainder(
329 N, I, Root, Remainder),
330 IPos is -I,
331 nth_integer_root_and_remainder(
332 N, IPos, RootPos, RemainderPos),
333 Root =:= -RootPos,
334 Remainder =:= -RemainderPos.
335 </pre>
336
337 <p></dd>
292338 </dl>
293339
294340 <p><h3 id="sec:arithpreds"><a id="sec:4.26.2"><span class="sec-nr">4.26.2</span> <span class="sec-title">General
297343 <a id="sec:arithpreds"></a>
298344
299345 <p>The general arithmetic predicates are optionally compiled (see
300 <a id="idx:setprologflag2:1203"></a><a class="pred" href="flags.html#set_prolog_flag/2">set_prolog_flag/2</a>
346 <a id="idx:setprologflag2:1205"></a><a class="pred" href="flags.html#set_prolog_flag/2">set_prolog_flag/2</a>
301347 and the <strong>-O</strong> command line option). Compiled arithmetic
302348 reduces global stack requirements and improves performance.
303349 Unfortunately compiled arithmetic cannot be traced, which is why it is
329375 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="is/2"><var>-Number</var> <strong>is</strong> <var>+Expr</var></a></dt>
330376 <dd class="defbody">
331377 True when <var>Number</var> is the value to which <var>Expr</var>
332 evaluates. Typically, <a id="idx:is2:1204"></a><a class="pred" href="arith.html#is/2">is/2</a>
378 evaluates. Typically, <a id="idx:is2:1206"></a><a class="pred" href="arith.html#is/2">is/2</a>
333379 should be used with unbound left operand. If equality is to be tested, <a class="pred" href="arith.html#=:=/2">=:=/2</a>
334380 should be used. For example:
335381
346392
347393 <a id="sec:artypes"></a>
348394
349 <p><a id="idx:integerunbounded:1205"></a><a id="idx:rationalnumber:1206"></a><a id="idx:numberrational:1207"></a>SWI-Prolog
395 <p><a id="idx:integerunbounded:1207"></a><a id="idx:rationalnumber:1208"></a><a id="idx:numberrational:1209"></a>SWI-Prolog
350396 defines the following numeric types:
351397
352398 <p>
353399 <ul class="latex">
354400 <li><i>integer</i><br>
355401 If SWI-Prolog is built using the <em>GNU multiple precision arithmetic
356 library</em> <a id="idx:GMP:1208"></a>(GMP), integer arithmetic is <em>unbounded</em>,
402 library</em> <a id="idx:GMP:1210"></a>(GMP), integer arithmetic is <em>unbounded</em>,
357403 which means that the size of integers is limited by available memory
358404 only. Without GMP, SWI-Prolog integers are 64-bits, regardless of the
359405 native integer size of the platform. The type of integer support can be
375421 arithmetic is only provided if GMP is used (see above). Rational numbers
376422 are currently not supported by a Prolog type. They are represented by
377423 the compound term <code>rdiv(N,M)</code>. Rational numbers that are
378 returned from <a id="idx:is2:1209"></a><a class="pred" href="arith.html#is/2">is/2</a>
424 returned from <a id="idx:is2:1211"></a><a class="pred" href="arith.html#is/2">is/2</a>
379425 are <em>canonical</em>, which means <var>M</var> is positive and <var>N</var>
380426 and
381427 <var>M</var> have no common divisors. Rational numbers are introduced in
383429 or the <a class="function" href="arith.html#f-rdiv/2">rdiv/2</a>
384430 (rational division) function. Using the same functor for rational
385431 division and for representing rational numbers allows for passing
386 rational numbers between computations as well as for using <a id="idx:format3:1210"></a><a class="pred" href="format.html#format/3">format/3</a>
432 rational numbers between computations as well as for using <a id="idx:format3:1212"></a><a class="pred" href="format.html#format/3">format/3</a>
387433 for printing.
388434
389435 <p>In the long term, it is likely that rational numbers will become
390436 <em>atomic</em> as well as a subtype of <em>number</em>. User code that
391437 creates or inspects the <code>rdiv(M,N)</code> terms will not be
392438 portable to future versions. Rationals are created using one of the
393 functions mentioned above and inspected using <a id="idx:rational3:1211"></a><a class="pred" href="typetest.html#rational/3">rational/3</a>.
439 functions mentioned above and inspected using <a id="idx:rational3:1213"></a><a class="pred" href="typetest.html#rational/3">rational/3</a>.
394440
395441 <p>
396442 <li><i>float</i><br>
438484 for details and examples.
439485
440486 <p>Rational numbers can be printed as decimal numbers with arbitrary
441 precision using the <a id="idx:format3:1212"></a><a class="pred" href="format.html#format/3">format/3</a>
487 precision using the <a id="idx:format3:1214"></a><a class="pred" href="format.html#format/3">format/3</a>
442488 floating point conversion:
443489
444490 <pre class="code">
526572 . The function <var>rnd_I</var> is the default rounding used by the C
527573 compiler and available through the Prolog flag
528574 <a class="flag" href="flags.html#flag:integer_rounding_function">integer_rounding_function</a>.
529 In the C99 standard, C-rounding is defined as <code>towards_zero</code>.<sup class="fn">96<span class="fn-text">Future
575 In the C99 standard, C-rounding is defined as <code>towards_zero</code>.<sup class="fn">98<span class="fn-text">Future
530576 versions might guarantee rounding towards zero.</span></sup></dd>
531577 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="f-div/2"><strong>div</strong>(<var>+IntExpr1,
532578 +IntExpr2</var>)</a></dt>
613659 is set from <code>/dev/random</code>. Otherwise it is set from the
614660 system clock. If unbounded arithmetic is not supported, random numbers
615661 are shared between threads and the seed is initialised from the clock
616 when SWI-Prolog was started. The predicate <a id="idx:setrandom1:1213"></a><a class="pred" href="miscarith.html#set_random/1">set_random/1</a>
662 when SWI-Prolog was started. The predicate <a id="idx:setrandom1:1215"></a><a class="pred" href="miscarith.html#set_random/1">set_random/1</a>
617663 can be used to control the random number generator.</dd>
618664 <dt class="pubdef"><a id="f-random_float/0"><strong>random_float</strong></a></dt>
619665 <dd class="defbody">
624670 Note that both sides of the domain are <em>open</em>. This avoids
625671 evaluation errors on, e.g., <a class="function" href="arith.html#f-log/1">log/1</a>
626672 or <a class="function" href="arith.html#f-//2">//2</a> while no
627 practical application can expect 0.0.<sup class="fn">97<span class="fn-text">Richard
673 practical application can expect 0.0.<sup class="fn">99<span class="fn-text">Richard
628674 O'Keefe said: ``If you <em>are</em> generating IEEE doubles with the
629675 claimed uniformity, then 0 has a 1 in <var>2^53 = 1 in
630676 9,007,199,254,740,992</var> chance of turning up. No program that
633679 expects (0.0,1.0) could be devastated if 0.0 did turn up.''</span></sup></dd>
634680 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="f-round/1"><strong>round</strong>(<var>+Expr</var>)</a></dt>
635681 <dd class="defbody">
636 Evaluate <var>Expr</var> and round the result to the nearest integer.</dd>
682 Evaluate <var>Expr</var> and round the result to the nearest integer.
683 According to ISO, <a class="function" href="arith.html#f-round/1">round/1</a>
684 is defined as
685 <code>floor(Expr+1/2)</code>, i.e., rounding <em>down</em>. This is an
686 unconventional choice and under which the relation
687 <code>round(Expr) == -round(-Expr)</code> does not hold. SWI-Prolog
688 rounds <em>outward</em>, e.g., <code>round(1.5) =:= 2</code> and round
689 <code>round(-1.5) =:= -2</code>.</dd>
637690 <dt class="pubdef"><a id="f-integer/1"><strong>integer</strong>(<var>+Expr</var>)</a></dt>
638691 <dd class="defbody">
639692 Same as <a class="function" href="arith.html#f-round/1">round/1</a>
642695 <dd class="defbody">
643696 Translate the result to a floating point number. Normally, Prolog will
644697 use integers whenever possible. When used around the 2nd argument of
645 <a id="idx:is2:1214"></a><a class="pred" href="arith.html#is/2">is/2</a>,
698 <a id="idx:is2:1216"></a><a class="pred" href="arith.html#is/2">is/2</a>,
646699 the result will be returned as a floating point number. In other
647700 contexts, the operation has no effect.</dd>
648701 <dt class="pubdef"><a id="f-rational/1"><strong>rational</strong>(<var>+Expr</var>)</a></dt>
671724 Convert the <var>Expr</var> to a rational number or integer. The
672725 function is similar to <a class="function" href="arith.html#f-rational/1">rational/1</a>,
673726 but the result is only accurate within the rounding error of floating
674 point numbers, generally producing a much smaller denominator.<sup class="fn">98<span class="fn-text">The
727 point numbers, generally producing a much smaller denominator.<sup class="fn">100<span class="fn-text">The
675728 names <a class="function" href="arith.html#f-rational/1">rational/1</a>
676729 and <a class="function" href="arith.html#f-rationalize/1">rationalize/1</a>
677730 as well as their semantics are inspired by Common Lisp.</span></sup>
701754 Truncate <var>Expr</var> to an integer. If <var><var>Expr</var> &gt;= 0</var>
702755 this is the same as <code>floor(Expr)</code>. For <var><var>Expr</var> &lt;
703756 0</var> this is the same as
704 <code>ceil(Expr)</code>. That is, <a id="idx:truncate1:1215"></a><span class="pred-ext">truncate/1</span>
757 <code>ceil(Expr)</code>. That is, <a id="idx:truncate1:1217"></a><span class="pred-ext">truncate/1</span>
705758 rounds towards zero.</dd>
706759 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="f-floor/1"><strong>floor</strong>(<var>+Expr</var>)</a></dt>
707760 <dd class="defbody">
881934 <dt class="pubdef"><a id="f-lgamma/1"><strong>lgamma</strong>(<var>+Expr</var>)</a></dt>
882935 <dd class="defbody">
883936 Return the natural logarithm of the absolute value of the Gamma
884 function.<sup class="fn">99<span class="fn-text">Some interfaces also
937 function.<sup class="fn">101<span class="fn-text">Some interfaces also
885938 provide the sign of the Gamma function. We canot do that in an
886939 arithmetic function. Future versions may provide a <em>predicate</em>
887940 lgamma/3 that returns both the value and the sign.</span></sup></dd>
910963 <dt class="pubdef"><a id="f-cputime/0"><strong>cputime</strong></a></dt>
911964 <dd class="defbody">
912965 Evaluate to a floating point number expressing the <span style="font-variant:small-caps">CPU</span>
913 time (in seconds) used by Prolog up till now. See also <a id="idx:statistics2:1216"></a><a class="pred" href="statistics.html#statistics/2">statistics/2</a>
914 and <a id="idx:time1:1217"></a><a class="pred" href="statistics.html#time/1">time/1</a>.</dd>
966 time (in seconds) used by Prolog up till now. See also <a id="idx:statistics2:1218"></a><a class="pred" href="statistics.html#statistics/2">statistics/2</a>
967 and <a id="idx:time1:1219"></a><a class="pred" href="statistics.html#time/1">time/1</a>.</dd>
915968 <dt class="pubdef"><a id="f-eval/1"><strong>eval</strong>(<var>+Expr</var>)</a></dt>
916969 <dd class="defbody">
917970 Evaluate <var>Expr</var>. Although ISO standard dictates that `<var>A</var>=1+2, <var>B</var>
919972 <var>A</var>' works and unifies <var>B</var> to 3, it is widely felt
920973 that source level variables in arithmetic expressions should have been
921974 limited to numbers. In this view the eval function can be used to
922 evaluate arbitrary expressions.<sup class="fn">100<span class="fn-text">The <a class="function" href="arith.html#f-eval/1">eval/1</a>
975 evaluate arbitrary expressions.<sup class="fn">102<span class="fn-text">The <a class="function" href="arith.html#f-eval/1">eval/1</a>
923976 function was first introduced by ECLiPSe and is under consideration for
924977 YAP.</span></sup>
925978 </dd>
928981 <p><b>Bitvector functions</b>
929982
930983 <p>The functions below are not covered by the standard. The
931 <a class="function" href="arith.html#f-msb/1">msb/1</a> function is
932 compatible with hProlog. The others are private extensions that improve
933 handling of ---unbounded--- integers as bit-vectors.
984 <a class="function" href="arith.html#f-msb/1">msb/1</a> function also
985 appears in hProlog and SICStus Prolog. The <a class="function" href="arith.html#f-getbit/2">getbit/2</a>
986 function also appears in ECLiPSe, which also provides <code>setbit(Vector,Index)</code>
987 and <code>clrbit(Vector,Index)</code>. The others are SWI-Prolog
988 extensions that improve handling of ---unbounded--- integers as
989 bit-vectors.
934990
935991 <dl class="latex">
936992 <dt class="pubdef"><a id="f-msb/1"><strong>msb</strong>(<var>+IntExpr</var>)</a></dt>
9481004 <dt class="pubdef"><a id="f-popcount/1"><strong>popcount</strong>(<var>+IntExpr</var>)</a></dt>
9491005 <dd class="defbody">
9501006 Return the number of 1s in the binary representation of the non-negative
951 integer <var>IntExpr</var>.
1007 integer <var>IntExpr</var>.</dd>
1008 <dt class="pubdef"><a id="f-getbit/2"><strong>getbit</strong>(<var>+IntExprV,
1009 +IntExprI</var>)</a></dt>
1010 <dd class="defbody">
1011 Evaluates to the bit value (0 or 1) of the <var>IntExprI</var>-th bit of
1012 <var>IntExprV</var>. Both arguments must evaluate to non-negative
1013 integers. The result is equivalent to <code>(IntExprV &gt;&gt; IntExprI)/\1</code>,
1014 but more efficient because materialization of the shifted value is
1015 avoided. Future versions will optimise <code>(IntExprV &gt;&gt; IntExprI)/\1</code>
1016 to a call to <a class="function" href="arith.html#f-getbit/2">getbit/2</a>,
1017 providing both portability and performance.<sup class="fn">103<span class="fn-text">This
1018 issue was fiercely debated at the ISO standard mailinglist. The name <i>getbit</i>
1019 was selected for compatibility with ECLiPSe, the only system providing
1020 this support. Richard O'Keefe disliked the name and argued that
1021 efficient handling of the above implementation is the best choice for
1022 this functionality.</span></sup>
9521023 </dd>
9531024 </dl>
9541025
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.3</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.3</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 7.1</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 7.1</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
252252 first possible opportunity. In the current implementation the hooks are
253253 executed immediately after a successful unification of the clause-head
254254 or successful completion of a foreign language (built-in) predicate.
255 Each attribute is associated to a module, and the hook (<a id="idx:attrunifyhook2:1618"></a><a class="pred" href="attvar.html#attr_unify_hook/2">attr_unify_hook/2</a>)
255 Each attribute is associated to a module, and the hook (<a id="idx:attrunifyhook2:1620"></a><a class="pred" href="attvar.html#attr_unify_hook/2">attr_unify_hook/2</a>)
256256 is executed in this module. The example below realises a very simple and
257257 incomplete finite domain reasoner:
258258
307307
308308 <p>The predicate domain/2 fetches (first clause) or assigns (second
309309 clause) the variable a <em>domain</em>, a set of values the variable can
310 be unified with. In the second clause, <a id="idx:domain2:1619"></a><span class="pred-ext">domain/2</span>
310 be unified with. In the second clause, <a id="idx:domain2:1621"></a><span class="pred-ext">domain/2</span>
311311 first associates the domain with a fresh variable (Y) and then unifies X
312312 to this variable to deal with the possibility that X already has a
313 domain. The predicate <a id="idx:attrunifyhook2:1620"></a><a class="pred" href="attvar.html#attr_unify_hook/2">attr_unify_hook/2</a>
313 domain. The predicate <a id="idx:attrunifyhook2:1622"></a><a class="pred" href="attvar.html#attr_unify_hook/2">attr_unify_hook/2</a>
314314 (see below) is a hook called after a variable with a domain is assigned
315315 a value. In the simple case where the variable is bound to a concrete
316316 value, we simply check whether this value is in the domain. Otherwise we
318318 is empty (first example), assign the value if there is only one value in
319319 the intersection (second example), or assign the intersection as the new
320320 domain of the variable (third example). The nonterminal
321 <a id="idx:attributegoals3:1621"></a><a class="pred" href="attvar.html#attribute_goals/3">attribute_goals/3</a>
321 <a id="idx:attributegoals3:1623"></a><a class="pred" href="attvar.html#attribute_goals/3">attribute_goals/3</a>
322322 is used to translate remaining attributes to user-readable goals that,
323323 when executed, reinstate these attributes.
324324
330330 <dl class="latex">
331331 <dt class="pubdef"><a id="attvar/1"><strong>attvar</strong>(<var>@Term</var>)</a></dt>
332332 <dd class="defbody">
333 Succeeds if <var>Term</var> is an attributed variable. Note that <a id="idx:var1:1622"></a><a class="pred" href="typetest.html#var/1">var/1</a>
333 Succeeds if <var>Term</var> is an attributed variable. Note that <a id="idx:var1:1624"></a><a class="pred" href="typetest.html#var/1">var/1</a>
334334 also succeeds on attributed variables. Attributed variables are created
335335 with
336 <a id="idx:putattr3:1623"></a><a class="pred" href="attvar.html#put_attr/3">put_attr/3</a>.</dd>
336 <a id="idx:putattr3:1625"></a><a class="pred" href="attvar.html#put_attr/3">put_attr/3</a>.</dd>
337337 <dt class="pubdef"><a id="put_attr/3"><strong>put_attr</strong>(<var>+Var,
338338 +Module, +Value</var>)</a></dt>
339339 <dd class="defbody">
341341 for the attribute named <var>Module</var> to <var>Value</var>. If an
342342 attribute with this name is already associated with <var>Var</var>, the
343343 old value is replaced. Backtracking will restore the old value (i.e., an
344 attribute is a mutable term; see also <a id="idx:setarg3:1624"></a><a class="pred" href="manipterm.html#setarg/3">setarg/3</a>).
344 attribute is a mutable term; see also <a id="idx:setarg3:1626"></a><a class="pred" href="manipterm.html#setarg/3">setarg/3</a>).
345345 This predicate raises a representation error if
346346 <var>Var</var> is not a variable and a type error if <var>Module</var>
347347 is not an atom.</dd>
386386 <var>VarValue</var>, forcing backtracking to undo the binding. If
387387 <var>VarValue</var> is another attributed variable the hook often
388388 combines the two attributes and associates the combined attribute with
389 <var>VarValue</var> using <a id="idx:putattr3:1625"></a><a class="pred" href="attvar.html#put_attr/3">put_attr/3</a>.</dd>
389 <var>VarValue</var> using <a id="idx:putattr3:1627"></a><a class="pred" href="attvar.html#put_attr/3">put_attr/3</a>.</dd>
390390 <dt class="pubdef"><span class="pred-tag">[deprecated]</span><a id="attr_portray_hook/2"><strong>attr_portray_hook</strong>(<var>+AttValue,
391391 +Var</var>)</a></dt>
392392 <dd class="defbody">
393 Called by <a id="idx:writeterm2:1626"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>
393 Called by <a id="idx:writeterm2:1628"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>
394394 and friends for each attribute if the option
395395 <code>attributes(portray)</code> is in effect. If the hook succeeds the
396396 attribute is considered printed. Otherwise <code>Module = ...</code> is
397397 printed to indicate the existence of a variable. New infrastructure
398398 dealing with communicating attribute values must be based on
399 <a id="idx:copyterm3:1627"></a><a class="pred" href="attvar.html#copy_term/3">copy_term/3</a>
400 and its hook <a id="idx:attributegoals1:1628"></a><a class="pred" href="attvar.html#attribute_goals/3">attribute_goals/3</a>.</dd>
399 <a id="idx:copyterm3:1629"></a><a class="pred" href="attvar.html#copy_term/3">copy_term/3</a>
400 and its hook <a id="idx:attributegoals1:1630"></a><a class="pred" href="attvar.html#attribute_goals/3">attribute_goals/3</a>.</dd>
401401 <dt class="pubdef"><a id="attribute_goals/3"><strong>attribute_goals</strong>(<var>+Var</var>)</a><code>//</code></dt>
402402 <dd class="defbody">
403 This nonterminal, if it is defined in a module, is used by <a id="idx:copyterm3:1629"></a><a class="pred" href="attvar.html#copy_term/3">copy_term/3</a>
403 This nonterminal, if it is defined in a module, is used by <a id="idx:copyterm3:1631"></a><a class="pred" href="attvar.html#copy_term/3">copy_term/3</a>
404404 to project attributes of that module to residual goals. It is also used
405405 by the top level to obtain residual goals after executing a query.</dd>
406406 <dt class="pubdef"><a id="project_attributes/+QueryVars, +ResidualVars"><strong>project_attributes</strong>(<var>+QueryVars,
410410 introduced variables back to the query variables.
411411 <var>QueryVars</var> is the list of variables occurring in the query and
412412 <var>ResidualVars</var> is a list of variables that have attributes
413 attached. There may be variables that occur in both lists. If possible, <a id="idx:projectattributes2:1630"></a><span class="pred-ext">project_attributes/2</span>
413 attached. There may be variables that occur in both lists. If possible, <a id="idx:projectattributes2:1632"></a><span class="pred-ext">project_attributes/2</span>
414414 should change the attributes so that all constraints are expressed as
415415 residual goals that refer only to
416416 <var>QueryVars</var>, while other variables are existentially
430430 Create a regular term <var>Copy</var> as a copy of <var>Term</var>
431431 (without any attributes), and a list <var>Gs</var> of goals that
432432 represents the attributes. The goal maplist(call,<var>Gs</var>)
433 recreates the attributes for <var>Copy</var>. The nonterminal <a id="idx:attributegoals1:1631"></a><a class="pred" href="attvar.html#attribute_goals/3">attribute_goals/3</a>,
433 recreates the attributes for <var>Copy</var>. The nonterminal <a id="idx:attributegoals1:1633"></a><a class="pred" href="attvar.html#attribute_goals/3">attribute_goals/3</a>,
434434 as defined in the modules the attributes stem from, is used to convert
435435 attributes to lists of goals.
436436
441441 <dt class="pubdef"><a id="copy_term_nat/2"><strong>copy_term_nat</strong>(<var>+Term,
442442 -Copy</var>)</a></dt>
443443 <dd class="defbody">
444 As <a id="idx:copyterm2:1632"></a><a class="pred" href="manipterm.html#copy_term/2">copy_term/2</a>.
444 As <a id="idx:copyterm2:1634"></a><a class="pred" href="manipterm.html#copy_term/2">copy_term/2</a>.
445445 Attributes, however, are <em>not</em> copied but replaced by fresh
446446 variables.</dd>
447447 <dt class="pubdef"><a id="term_attvars/2"><strong>term_attvars</strong>(<var>+Term,
448448 -AttVars</var>)</a></dt>
449449 <dd class="defbody">
450450 <var>AttVars</var> is a list of all attributed variables in <var>Term</var>
451 and its attributes. That is, <a id="idx:termattvars2:1633"></a><a class="pred" href="attvar.html#term_attvars/2">term_attvars/2</a>
451 and its attributes. That is, <a id="idx:termattvars2:1635"></a><a class="pred" href="attvar.html#term_attvars/2">term_attvars/2</a>
452452 works recursively through attributes. This predicate is cycle-safe. The
453453 goal
454454 <code>term_attvars(Term,[])</code> in an efficient test that <var>Term</var>
463463
464464 <a id="sec:attvar-low-level-preds"></a>
465465
466 <p>Normal user code should deal with <a id="idx:putattr3:1634"></a><a class="pred" href="attvar.html#put_attr/3">put_attr/3</a>, <a id="idx:getattr3:1635"></a><a class="pred" href="attvar.html#get_attr/3">get_attr/3</a>
467 and <a id="idx:delattr2:1636"></a><a class="pred" href="attvar.html#del_attr/2">del_attr/2</a>.
466 <p>Normal user code should deal with <a id="idx:putattr3:1636"></a><a class="pred" href="attvar.html#put_attr/3">put_attr/3</a>, <a id="idx:getattr3:1637"></a><a class="pred" href="attvar.html#get_attr/3">get_attr/3</a>
467 and <a id="idx:delattr2:1638"></a><a class="pred" href="attvar.html#del_attr/2">del_attr/2</a>.
468468 The routines in this section fetch or set the entire attribute list of a
469469 variable. Use of these predicates is anticipated to be restricted to
470470 printing and other special purpose operations.
481481 <dt class="pubdef"><a id="put_attrs/2"><strong>put_attrs</strong>(<var>+Var,
482482 -Attributes</var>)</a></dt>
483483 <dd class="defbody">
484 Set all attributes of <var>Var</var>. See <a id="idx:getattrs2:1637"></a><a class="pred" href="attvar.html#get_attrs/2">get_attrs/2</a>
484 Set all attributes of <var>Var</var>. See <a id="idx:getattrs2:1639"></a><a class="pred" href="attvar.html#get_attrs/2">get_attrs/2</a>
485485 for a description of
486486 <var>Attributes</var>.</dd>
487487 <dt class="pubdef"><a id="del_attrs/1"><strong>del_attrs</strong>(<var>+Var</var>)</a></dt>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 2.13</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 2.13</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section B.4</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section B.4</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
249249 +PC, +FR, +BFR, +Expression, -Action</var>)</a></dt>
250250 <dd class="defbody">
251251 <em>Experimental</em> This hook is called if the virtual machine
252 executes a <code>D_BREAK</code>, set using <a id="idx:setbreakpoint4:2002"></a><span class="pred-ext">set_breakpoint/4</span>. <var>Clause</var>
252 executes a <code>D_BREAK</code>, set using <a id="idx:setbreakpoint4:2005"></a><span class="pred-ext">set_breakpoint/4</span>. <var>Clause</var>
253253 and <var>PC</var> identify the breakpoint. <var>FR</var> and <var>BFR</var>
254254 provide the environment frame and current choicepoint. <var>Expression</var>
255255 identifies the action that is interrupted, and is one of the following:
284284 <dd class="defbody">
285285 The breakpoint is on the completion of an in-lined unification while the
286286 system is not in debug mode. If the system is in debug mode, inlined
287 unification is returned as call(Var=Term).<sup class="fn">162<span class="fn-text">This
287 unification is returned as call(Var=Term).<sup class="fn">165<span class="fn-text">This
288288 hack will disappear if we find a good solution for applying D_BREAK to
289289 inlined unification. Only option might be to place the break on both the
290290 unification start and end instructions.</span></sup>
301301 Just continue as if no breakpoint was present.</dd>
302302 <dt><strong>debug</strong></dt>
303303 <dd class="defbody">
304 Continue in <em>debug mode</em>. See <a id="idx:debug0:2003"></a><a class="pred" href="debugger.html#debug/0">debug/0</a>.</dd>
304 Continue in <em>debug mode</em>. See <a id="idx:debug0:2006"></a><a class="pred" href="debugger.html#debug/0">debug/0</a>.</dd>
305305 <dt><strong>trace</strong></dt>
306306 <dd class="defbody">
307 Continue in <em>trace mode</em>. See <a id="idx:trace0:2004"></a><a class="pred" href="debugger.html#trace/0">trace/0</a>.</dd>
307 Continue in <em>trace mode</em>. See <a id="idx:trace0:2007"></a><a class="pred" href="debugger.html#trace/0">trace/0</a>.</dd>
308308 <dt><strong>call</strong>(<var>Goal</var>)</dt>
309309 <dd class="defbody">
310310 Execute <var>Goal</var> instead of the goal that would be executed.
311 <var>Goal</var> is executed as <a id="idx:call1:2005"></a><a class="pred" href="metacall.html#call/1">call/1</a>,
311 <var>Goal</var> is executed as <a id="idx:call1:2008"></a><a class="pred" href="metacall.html#call/1">call/1</a>,
312312 preserving (non-)determinism and exceptions.
313313 </dd>
314314 </dl>
331331 <li>Watch variables at a specific point in the execution. Note that
332332 binding of these variables can be monitored using <em>attributed
333333 variables</em>, see <a class="sec" href="attvar.html">section 7.1</a>.
334 <li>Dynamically add <em>assertions</em> on variables using <a id="idx:assertion1:2006"></a><a class="pred" href="debug.html#assertion/1">assertion/1</a>.
334 <li>Dynamically add <em>assertions</em> on variables using <a id="idx:assertion1:2009"></a><a class="pred" href="debug.html#assertion/1">assertion/1</a>.
335335 <li>Wrap the <var>Goal</var> into a meta-call that traces progress of
336336 the <var>Goal</var>.
337337 </ul>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.4</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.4</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
237237
238238 <a id="sec:broadcast"></a>
239239
240 <p><a id="idx:broadcast:1939"></a><a id="idx:messageservice:1940"></a><a id="idx:blackboard:1941"></a><a id="idx:agent:1942"></a><a id="idx:daemon:1943"></a>The <code>library(broadcast)</code>
240 <p><a id="idx:broadcast:1942"></a><a id="idx:messageservice:1943"></a><a id="idx:blackboard:1944"></a><a id="idx:agent:1945"></a><a id="idx:daemon:1946"></a>The <code>library(broadcast)</code>
241241 library was invented to realise GUI applications consisting of
242242 stand-alone components that use the Prolog database for storing the
243243 application data. <a class="fig" href="broadcast.html#fig:broadcast">Figure
267267 Broadcast <var>Term</var>. There are no limitations to <var>Term</var>,
268268 though being a global service, it is good practice to use a descriptive
269269 and unique principal functor. All associated goals are started and
270 regardless of their success or failure, <a id="idx:broadcast1:1944"></a><a class="pred" href="broadcast.html#broadcast/1">broadcast/1</a>
270 regardless of their success or failure, <a id="idx:broadcast1:1947"></a><a class="pred" href="broadcast.html#broadcast/1">broadcast/1</a>
271271 always succeeds. Exceptions are passed.</dd>
272272 <dt class="pubdef"><a id="broadcast_request/1"><strong>broadcast_request</strong>(<var>+Term</var>)</a></dt>
273273 <dd class="defbody">
274 Unlike <a id="idx:broadcast1:1945"></a><a class="pred" href="broadcast.html#broadcast/1">broadcast/1</a>,
274 Unlike <a id="idx:broadcast1:1948"></a><a class="pred" href="broadcast.html#broadcast/1">broadcast/1</a>,
275275 this predicate stops if an associated goal succeeds. Backtracking causes
276276 it to try other listeners. A broadcast request is used to fetch
277277 information without knowing the identity of the agent providing it. C.f. ``Is
305305 +Template, :Goal</var>)</a></dt>
306306 <dd class="defbody">
307307 Declare <var>Listener</var> as the owner of the channel. Unlike a
308 channel opened using <a id="idx:listen2:1946"></a><a class="pred" href="broadcast.html#listen/2">listen/2</a>,
308 channel opened using <a id="idx:listen2:1949"></a><a class="pred" href="broadcast.html#listen/2">listen/2</a>,
309309 channels that have an owner can terminate the channel. This is commonly
310310 used if an object is listening to broadcast messages. In the example
311311 below we define a `name-item' displaying the name of an identifier
312 represented by the predicate <a id="idx:nameof2:1947"></a><span class="pred-ext">name_of/2</span>.
312 represented by the predicate <a id="idx:nameof2:1950"></a><span class="pred-ext">name_of/2</span>.
313313
314314 <pre class="code">
315315 :- pce_begin_class(name_item, text_item).
340340 </dd>
341341 <dt class="pubdef"><a id="unlisten/1"><strong>unlisten</strong>(<var>+Listener</var>)</a></dt>
342342 <dd class="defbody">
343 Deregister all entries created with <a id="idx:listen3:1948"></a><a class="pred" href="broadcast.html#listen/3">listen/3</a>
343 Deregister all entries created with <a id="idx:listen3:1951"></a><a class="pred" href="broadcast.html#listen/3">listen/3</a>
344344 whose <var>Listener</var> unify.</dd>
345345 <dt class="pubdef"><a id="unlisten/2"><strong>unlisten</strong>(<var>+Listener,
346346 +Template</var>)</a></dt>
347347 <dd class="defbody">
348 Deregister all entries created with <a id="idx:listen3:1949"></a><a class="pred" href="broadcast.html#listen/3">listen/3</a>
348 Deregister all entries created with <a id="idx:listen3:1952"></a><a class="pred" href="broadcast.html#listen/3">listen/3</a>
349349 whose <var>Listener</var> and <var>Template</var> unify.</dd>
350350 <dt class="pubdef"><a id="unlisten/3"><strong>unlisten</strong>(<var>+Listener,
351351 +Template, :Goal</var>)</a></dt>
352352 <dd class="defbody">
353 Deregister all entries created with <a id="idx:listen3:1950"></a><a class="pred" href="broadcast.html#listen/3">listen/3</a>
353 Deregister all entries created with <a id="idx:listen3:1953"></a><a class="pred" href="broadcast.html#listen/3">listen/3</a>
354354 whose <var>Listener</var>,
355355 <var>Template</var> and <var>Goal</var> unify.</dd>
356356 <dt class="pubdef"><a id="listening/3"><strong>listening</strong>(<var>?Listener,
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.28</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.28</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
246246 <dt class="pubdef"><a id="is_list/1"><strong>is_list</strong>(<var>+Term</var>)</a></dt>
247247 <dd class="defbody">
248248 True if <var>Term</var> is bound to the empty list (<code>[]</code>) or
249 a term with functor `<code>'[|]'</code>'<sup class="fn">102<span class="fn-text">The
249 a term with functor `<code>'[|]'</code>'<sup class="fn">105<span class="fn-text">The
250250 traditional list functor is the dot (<code>'.'</code>). This is still
251251 the case of the command line option <strong>--traditional</strong> is
252252 given. See also <a class="sec" href="ext-lists.html">section 5.1</a>.</span></sup>
253 and arity&nbsp;2 and the second argument is a list.<sup class="fn">103<span class="fn-text">In
254 versions before 5.0.1, <a id="idx:islist1:1220"></a><a class="pred" href="builtinlist.html#is_list/1">is_list/1</a>
253 and arity&nbsp;2 and the second argument is a list.<sup class="fn">106<span class="fn-text">In
254 versions before 5.0.1, <a id="idx:islist1:1222"></a><a class="pred" href="builtinlist.html#is_list/1">is_list/1</a>
255255 just checked for <code>[]</code> or <code>[_|_]</code> and proper_list/1
256 had the role of the current <a id="idx:islist1:1221"></a><a class="pred" href="builtinlist.html#is_list/1">is_list/1</a>.
256 had the role of the current <a id="idx:islist1:1223"></a><a class="pred" href="builtinlist.html#is_list/1">is_list/1</a>.
257257 The current definition conforms to the de facto standard. Assuming
258258 proper coding standards, there should only be very few cases where a
259 quick-and-dirty <a id="idx:islist1:1222"></a><a class="pred" href="builtinlist.html#is_list/1">is_list/1</a>
259 quick-and-dirty <a id="idx:islist1:1224"></a><a class="pred" href="builtinlist.html#is_list/1">is_list/1</a>
260260 is a good choice. Richard O'Keefe pointed at this issue.</span></sup>
261261 This predicate acts as if defined by the definition below on
262262 <em>acyclic</em> terms. The implementation <em>fails</em> safely if
277277 <dd class="defbody">
278278 True when <var>Elem</var> is an element of <var>List</var>. This `chk'
279279 variant of
280 <a id="idx:member2:1223"></a><a class="pred" href="lists.html#member/2">member/2</a>
280 <a id="idx:member2:1225"></a><a class="pred" href="lists.html#member/2">member/2</a>
281281 is semi deterministic and typically used to test membership of a list.
282282 Raises a <code>type</code> error if scanning <var>List</var> encounters
283 a non-list. Note that <a id="idx:memberchk2:1224"></a><a class="pred" href="builtinlist.html#memberchk/2">memberchk/2</a>
283 a non-list. Note that <a id="idx:memberchk2:1226"></a><a class="pred" href="builtinlist.html#memberchk/2">memberchk/2</a>
284284 does <em>not</em> perform a full list typecheck. For example, <code>memberchk(a,
285 [a|b])</code> succeeds without error and <a id="idx:memberchk2:1225"></a><a class="pred" href="builtinlist.html#memberchk/2">memberchk/2</a>
285 [a|b])</code> succeeds without error and <a id="idx:memberchk2:1227"></a><a class="pred" href="builtinlist.html#memberchk/2">memberchk/2</a>
286286 loops on a cyclic list if <var>Elem</var> is not a member of <var>List</var>.</dd>
287287 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="length/2"><strong>length</strong>(<var>?List,
288288 ?Int</var>)</a></dt>
300300 <li><var>Int</var> is bound to a non-integer.
301301 <li><var>Int</var> is a negative integer.
302302 <li><var>List</var> is neither a list nor a partial list. This error
303 condition includes cyclic lists.<sup class="fn">104<span class="fn-text">ISO
303 condition includes cyclic lists.<sup class="fn">107<span class="fn-text">ISO
304304 demands failure here. We think an error is more appropriate.</span></sup>
305305 </ul>
306306
307307 <p>This predicate fails if the tail of <var>List</var> is equivalent to
308 <var>Int</var> (e.g., <code>length(L,L)</code>).<sup class="fn">105<span class="fn-text">This
308 <var>Int</var> (e.g., <code>length(L,L)</code>).<sup class="fn">108<span class="fn-text">This
309309 is logically correct. An exception would be more appropriate, but to our
310310 best knowledge, current practice in Prolog does not describe a suitable
311311 candidate exception term.</span></sup></dd>
315315 True if <var>Sorted</var> can be unified with a list holding the
316316 elements of <var>List</var>, sorted to the standard order of terms (see
317317 <a class="sec" href="compare.html">section 4.7</a>). Duplicates are
318 removed. The implementation is in C, using <em>natural merge sort</em>.<sup class="fn">106<span class="fn-text">Contributed
319 by Richard O'Keefe.</span></sup> The <a id="idx:sort2:1226"></a><a class="pred" href="builtinlist.html#sort/2">sort/2</a>
318 removed. The implementation is in C, using <em>natural merge sort</em>.<sup class="fn">109<span class="fn-text">Contributed
319 by Richard O'Keefe.</span></sup> The <a id="idx:sort2:1228"></a><a class="pred" href="builtinlist.html#sort/2">sort/2</a>
320320 predicate can sort a cyclic list, returning a non-cyclic version with
321321 the same elements.</dd>
322322 <dt class="pubdef"><a id="sort/4"><strong>sort</strong>(<var>+Key,
327327 <var>List</var>. <var>Key</var> determines which part of each element in
328328 <var>List</var> is used for comparing two term and <var>Order</var>
329329 describes the relation between each set of consecutive elements in
330 <var>Sorted</var>.<sup class="fn">107<span class="fn-text">The
330 <var>Sorted</var>.<sup class="fn">110<span class="fn-text">The
331331 definition of this predicate was established after discussion with
332332 Joachim Schimpf from the ECLiPSe team. ECLiPSe currently only accepts <code><code>&lt;</code></code>, <code><code>=&lt;</code></code>, <code><code>&gt;</code></code>
333333 and <code><code>&gt;=</code></code> for the <var>Order</var> argument
348348 <p>Deeper nested elements of structures can be selected by using a list
349349 of keys for the <var>Key</var> argument.
350350
351 <p>The <var>Order</var> argument is described in the table below<sup class="fn">108<span class="fn-text">For
351 <p>The <var>Order</var> argument is described in the table below<sup class="fn">111<span class="fn-text">For
352352 compatibility with ECLiPSe, the values <code><code>&lt;</code></code>, <code><code>=&lt;</code></code>, <code><code>&gt;</code></code>
353353 and <code><code>&gt;=</code></code> are allowed as synonyms.</span></sup>
354354
375375
376376 <p>The following example sorts a list of rows, for example resulting
377377 from
378 <a id="idx:csvreadfile2:1227"></a><a class="pred" href="csv.html#csv_read_file/2">csv_read_file/2</a>)
378 <a id="idx:csvreadfile2:1229"></a><a class="pred" href="csv.html#csv_read_file/2">csv_read_file/2</a>)
379379 ascending on the 3th column and descending on the 4th column:
380380
381381 <pre class="code">
383383 sort(3, @=&lt;, Rows1, Sorted).
384384 </pre>
385385
386 <p>See also <a id="idx:sort2:1228"></a><a class="pred" href="builtinlist.html#sort/2">sort/2</a>
387 (ISO), <a id="idx:msort2:1229"></a><a class="pred" href="builtinlist.html#msort/2">msort/2</a>, <a id="idx:keysort2:1230"></a><a class="pred" href="builtinlist.html#keysort/2">keysort/2</a>, <a id="idx:predsort3:1231"></a><a class="pred" href="builtinlist.html#predsort/3">predsort/3</a>
388 and <a id="idx:orderby2:1232"></a><a class="pred" href="solutionsequences.html#order_by/2">order_by/2</a>.</dd>
386 <p>See also <a id="idx:sort2:1230"></a><a class="pred" href="builtinlist.html#sort/2">sort/2</a>
387 (ISO), <a id="idx:msort2:1231"></a><a class="pred" href="builtinlist.html#msort/2">msort/2</a>, <a id="idx:keysort2:1232"></a><a class="pred" href="builtinlist.html#keysort/2">keysort/2</a>, <a id="idx:predsort3:1233"></a><a class="pred" href="builtinlist.html#predsort/3">predsort/3</a>
388 and <a id="idx:orderby2:1234"></a><a class="pred" href="solutionsequences.html#order_by/2">order_by/2</a>.</dd>
389389 <dt class="pubdef"><a id="msort/2"><strong>msort</strong>(<var>+List,
390390 -Sorted</var>)</a></dt>
391391 <dd class="defbody">
392 Equivalent to <a id="idx:sort2:1233"></a><a class="pred" href="builtinlist.html#sort/2">sort/2</a>,
392 Equivalent to <a id="idx:sort2:1235"></a><a class="pred" href="builtinlist.html#sort/2">sort/2</a>,
393393 but does not remove duplicates. Raises a
394394 <code>type_error</code> if <var>List</var> is a cyclic list or not a
395395 list.</dd>
406406 same
407407 <var>Key</var> is not changed.
408408
409 <p>The <a id="idx:keysort2:1234"></a><a class="pred" href="builtinlist.html#keysort/2">keysort/2</a>
409 <p>The <a id="idx:keysort2:1236"></a><a class="pred" href="builtinlist.html#keysort/2">keysort/2</a>
410410 predicate is often used together with library
411411 <code>library(pairs)</code>. It can be used to sort lists on different
412412 or multiple criteria. For example, the following predicates sorts a list
426426 <dt class="pubdef"><a id="predsort/3"><strong>predsort</strong>(<var>+Pred,
427427 +List, -Sorted</var>)</a></dt>
428428 <dd class="defbody">
429 Sorts similar to <a id="idx:sort2:1235"></a><a class="pred" href="builtinlist.html#sort/2">sort/2</a>,
429 Sorts similar to <a id="idx:sort2:1237"></a><a class="pred" href="builtinlist.html#sort/2">sort/2</a>,
430430 but determines the order of two terms by calling <var>Pred</var>(-<var>Delta</var>,
431431 +<var>E1</var>, +<var>E2</var>) . This call must unify <var>Delta</var>
432432 with one of <code><code>&lt;</code></code>, <code><code>&gt;</code></code>
433433 or
434 <code><code>=</code></code>. If the built-in predicate <a id="idx:compare3:1236"></a><a class="pred" href="compare.html#compare/3">compare/3</a>
435 is used, the result is the same as <a id="idx:sort2:1237"></a><a class="pred" href="builtinlist.html#sort/2">sort/2</a>.
436 See also <a id="idx:keysort2:1238"></a><a class="pred" href="builtinlist.html#keysort/2">keysort/2</a>.
434 <code><code>=</code></code>. If the built-in predicate <a id="idx:compare3:1238"></a><a class="pred" href="compare.html#compare/3">compare/3</a>
435 is used, the result is the same as <a id="idx:sort2:1239"></a><a class="pred" href="builtinlist.html#sort/2">sort/2</a>.
436 See also <a id="idx:keysort2:1240"></a><a class="pred" href="builtinlist.html#keysort/2">keysort/2</a>.
437437 </dd>
438438 </dl>
439439
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.25</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.25</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
244244 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="char_conversion/2"><strong>char_conversion</strong>(<var>+CharIn,
245245 +CharOut</var>)</a></dt>
246246 <dd class="defbody">
247 Define that term input (see <a id="idx:readterm3:1198"></a><a class="pred" href="termrw.html#read_term/3">read_term/3</a>)
247 Define that term input (see <a id="idx:readterm3:1199"></a><a class="pred" href="termrw.html#read_term/3">read_term/3</a>)
248248 maps each character read as
249249 <var>CharIn</var> to the character <var>CharOut</var>. Character
250250 conversion is only executed if the Prolog flag <a class="flag" href="flags.html#flag:char_conversion">char_conversion</a>
251251 is set to
252252 <code>true</code> and not inside quoted atoms or strings. The initial
253 table maps each character onto itself. See also <a id="idx:currentcharconversion2:1199"></a><a class="pred" href="charconv.html#current_char_conversion/2">current_char_conversion/2</a>.
253 table maps each character onto itself. See also <a id="idx:currentcharconversion2:1200"></a><a class="pred" href="charconv.html#current_char_conversion/2">current_char_conversion/2</a>.
254254 </dd>
255255 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="current_char_conversion/2"><strong>current_char_conversion</strong>(<var>?CharIn,
256256 ?CharOut</var>)</a></dt>
257257 <dd class="defbody">
258 Queries the current character conversion table. See <a id="idx:charconversion2:1200"></a><a class="pred" href="charconv.html#char_conversion/2">char_conversion/2</a>
258 Queries the current character conversion table. See <a id="idx:charconversion2:1201"></a><a class="pred" href="charconv.html#char_conversion/2">char_conversion/2</a>
259259 for details.
260260 </dd>
261261 </dl>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.18</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.18</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
244244 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="nl/0"><strong>nl</strong></a></dt>
245245 <dd class="defbody">
246246 Write a newline character to the current output stream. On Unix systems
247 <a id="idx:nl0:959"></a><a class="pred" href="chario.html#nl/0">nl/0</a>
247 <a id="idx:nl0:960"></a><a class="pred" href="chario.html#nl/0">nl/0</a>
248248 is equivalent to <code>put(10)</code>.</dd>
249249 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="nl/1"><strong>nl</strong>(<var>+Stream</var>)</a></dt>
250250 <dd class="defbody">
253253 <dd class="defbody">
254254 Write <var>Char</var> to the current output stream. <var>Char</var> is
255255 either an integer expression evaluating to a character code or an atom
256 of one character. Deprecated. New code should use <a id="idx:putchar1:960"></a><a class="pred" href="chario.html#put_char/1">put_char/1</a>
257 or <a id="idx:putcode1:961"></a><a class="pred" href="chario.html#put_code/1">put_code/1</a>.</dd>
256 of one character. Deprecated. New code should use <a id="idx:putchar1:961"></a><a class="pred" href="chario.html#put_char/1">put_char/1</a>
257 or <a id="idx:putcode1:962"></a><a class="pred" href="chario.html#put_code/1">put_code/1</a>.</dd>
258258 <dt class="pubdef"><a id="put/2"><strong>put</strong>(<var>+Stream,
259259 +Char</var>)</a></dt>
260260 <dd class="defbody">
261 Write <var>Char</var> to <var>Stream</var>. See <a id="idx:put1:962"></a><a class="pred" href="chario.html#put/1">put/1</a>
261 Write <var>Char</var> to <var>Stream</var>. See <a id="idx:put1:963"></a><a class="pred" href="chario.html#put/1">put/1</a>
262262 for details.</dd>
263263 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="put_byte/1"><strong>put_byte</strong>(<var>+Byte</var>)</a></dt>
264264 <dd class="defbody">
282282 of <var>Stream</var> cannot represent <var>Char</var>.</dd>
283283 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="put_code/1"><strong>put_code</strong>(<var>+Code</var>)</a></dt>
284284 <dd class="defbody">
285 Similar to <a id="idx:putchar1:963"></a><a class="pred" href="chario.html#put_char/1">put_char/1</a>,
285 Similar to <a id="idx:putchar1:964"></a><a class="pred" href="chario.html#put_char/1">put_char/1</a>,
286286 but using a <em>character code</em>. <var>Code</var> is a non-negative
287287 integer. Note that this may raise an exception if the encoding of the
288288 output stream cannot represent <var>Code</var>.</dd>
289289 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="put_code/2"><strong>put_code</strong>(<var>+Stream,
290290 +Code</var>)</a></dt>
291291 <dd class="defbody">
292 Same as <a id="idx:putcode1:964"></a><a class="pred" href="chario.html#put_code/1">put_code/1</a>
292 Same as <a id="idx:putcode1:965"></a><a class="pred" href="chario.html#put_code/1">put_code/1</a>
293293 but directing <var>Code</var> to <var>Stream</var>.</dd>
294294 <dt class="pubdef"><a id="tab/1"><strong>tab</strong>(<var>+Amount</var>)</a></dt>
295295 <dd class="defbody">
302302 Write <var>Amount</var> spaces to <var>Stream</var>.</dd>
303303 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="flush_output/0"><strong>flush_output</strong></a></dt>
304304 <dd class="defbody">
305 Flush pending output on current output stream. <a id="idx:flushoutput0:965"></a><a class="pred" href="chario.html#flush_output/0">flush_output/0</a>
306 is automatically generated by <a id="idx:read1:966"></a><a class="pred" href="termrw.html#read/1">read/1</a>
305 Flush pending output on current output stream. <a id="idx:flushoutput0:966"></a><a class="pred" href="chario.html#flush_output/0">flush_output/0</a>
306 is automatically generated by <a id="idx:read1:967"></a><a class="pred" href="termrw.html#read/1">read/1</a>
307307 and derivatives if the current input stream is <code>user</code> and the
308308 cursor is not at the left margin.</dd>
309309 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="flush_output/1"><strong>flush_output</strong>(<var>+Stream</var>)</a></dt>
312312 writing.</dd>
313313 <dt class="pubdef"><a id="ttyflush/0"><strong>ttyflush</strong></a></dt>
314314 <dd class="defbody">
315 Flush pending output on stream <code>user</code>. See also <a id="idx:flushoutput01:967"></a><span class="pred-ext">flush_output/[0,1]</span>.
315 Flush pending output on stream <code>user</code>. See also <a id="idx:flushoutput01:968"></a><span class="pred-ext">flush_output/[0,1]</span>.
316316 </dd>
317317 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="get_byte/1"><strong>get_byte</strong>(<var>-Byte</var>)</a></dt>
318318 <dd class="defbody">
328328 <dd class="defbody">
329329 Read the current input stream and unify <var>Code</var> with the
330330 character code of the next character. <var>Code</var> is unified with -1
331 on end of file. See also <a id="idx:getchar1:968"></a><a class="pred" href="chario.html#get_char/1">get_char/1</a>.</dd>
331 on end of file. See also <a id="idx:getchar1:969"></a><a class="pred" href="chario.html#get_char/1">get_char/1</a>.</dd>
332332 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="get_code/2"><strong>get_code</strong>(<var>+Stream,
333333 -Code</var>)</a></dt>
334334 <dd class="defbody">
336336 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="get_char/1"><strong>get_char</strong>(<var>-Char</var>)</a></dt>
337337 <dd class="defbody">
338338 Read the current input stream and unify <var>Char</var> with the next
339 character as a one-character atom. See also <a id="idx:atomchars2:969"></a><a class="pred" href="manipatom.html#atom_chars/2">atom_chars/2</a>.
339 character as a one-character atom. See also <a id="idx:atomchars2:970"></a><a class="pred" href="manipatom.html#atom_chars/2">atom_chars/2</a>.
340340 On end-of-file, <var>Char</var> is unified to the atom <code>end_of_file</code>.</dd>
341341 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="get_char/2"><strong>get_char</strong>(<var>+Stream,
342342 -Char</var>)</a></dt>
343343 <dd class="defbody">
344344 Unify <var>Char</var> with the next character from <var>Stream</var> as
345 a one-character atom. See also <a id="idx:getchar2:970"></a><a class="pred" href="chario.html#get_char/2">get_char/2</a>, <a id="idx:getbyte2:971"></a><a class="pred" href="chario.html#get_byte/2">get_byte/2</a>
346 and <a id="idx:getcode2:972"></a><a class="pred" href="chario.html#get_code/2">get_code/2</a>.</dd>
345 a one-character atom. See also <a id="idx:getchar2:971"></a><a class="pred" href="chario.html#get_char/2">get_char/2</a>, <a id="idx:getbyte2:972"></a><a class="pred" href="chario.html#get_byte/2">get_byte/2</a>
346 and <a id="idx:getcode2:973"></a><a class="pred" href="chario.html#get_code/2">get_code/2</a>.</dd>
347347 <dt class="pubdef"><span class="pred-tag">[deprecated]</span><a id="get0/1"><strong>get0</strong>(<var>-Char</var>)</a></dt>
348348 <dd class="defbody">
349 Edinburgh version of the ISO <a id="idx:getcode1:973"></a><a class="pred" href="chario.html#get_code/1">get_code/1</a>
349 Edinburgh version of the ISO <a id="idx:getcode1:974"></a><a class="pred" href="chario.html#get_code/1">get_code/1</a>
350350 predicate. Note that Edinburgh Prolog didn't support wide characters and
351351 therefore technically speaking
352 <a id="idx:get01:974"></a><a class="pred" href="chario.html#get0/1">get0/1</a>
353 should have been mapped to <a id="idx:getbyte1:975"></a><a class="pred" href="chario.html#get_byte/1">get_byte/1</a>.
354 The intention of <a id="idx:get01:976"></a><a class="pred" href="chario.html#get0/1">get0/1</a>,
352 <a id="idx:get01:975"></a><a class="pred" href="chario.html#get0/1">get0/1</a>
353 should have been mapped to <a id="idx:getbyte1:976"></a><a class="pred" href="chario.html#get_byte/1">get_byte/1</a>.
354 The intention of <a id="idx:get01:977"></a><a class="pred" href="chario.html#get0/1">get0/1</a>,
355355 however, is to read character codes.</dd>
356356 <dt class="pubdef"><span class="pred-tag">[deprecated]</span><a id="get0/2"><strong>get0</strong>(<var>+Stream,
357357 -Char</var>)</a></dt>
358358 <dd class="defbody">
359 Edinburgh version of the ISO <a id="idx:getcode2:977"></a><a class="pred" href="chario.html#get_code/2">get_code/2</a>
360 predicate. See also <a id="idx:get01:978"></a><a class="pred" href="chario.html#get0/1">get0/1</a>.</dd>
359 Edinburgh version of the ISO <a id="idx:getcode2:978"></a><a class="pred" href="chario.html#get_code/2">get_code/2</a>
360 predicate. See also <a id="idx:get01:979"></a><a class="pred" href="chario.html#get0/1">get0/1</a>.</dd>
361361 <dt class="pubdef"><span class="pred-tag">[deprecated]</span><a id="get/1"><strong>get</strong>(<var>-Char</var>)</a></dt>
362362 <dd class="defbody">
363363 Read the current input stream and unify the next non-blank character
364364 with <var>Char</var>. <var>Char</var> is unified with -1 on end of file.
365 The predicate <a id="idx:get1:979"></a><a class="pred" href="chario.html#get/1">get/1</a>
366 operates on character <em>codes</em>. See also <a id="idx:get01:980"></a><a class="pred" href="chario.html#get0/1">get0/1</a>.</dd>
365 The predicate <a id="idx:get1:980"></a><a class="pred" href="chario.html#get/1">get/1</a>
366 operates on character <em>codes</em>. See also <a id="idx:get01:981"></a><a class="pred" href="chario.html#get0/1">get0/1</a>.</dd>
367367 <dt class="pubdef"><span class="pred-tag">[deprecated]</span><a id="get/2"><strong>get</strong>(<var>+Stream,
368368 -Char</var>)</a></dt>
369369 <dd class="defbody">
370370 Read the next non-blank character from <var>Stream</var>. See also
371 <a id="idx:get1:981"></a><a class="pred" href="chario.html#get/1">get/1</a>, <a id="idx:get01:982"></a><a class="pred" href="chario.html#get0/1">get0/1</a>
372 and <a id="idx:get02:983"></a><a class="pred" href="chario.html#get0/2">get0/2</a>.</dd>
371 <a id="idx:get1:982"></a><a class="pred" href="chario.html#get/1">get/1</a>, <a id="idx:get01:983"></a><a class="pred" href="chario.html#get0/1">get0/1</a>
372 and <a id="idx:get02:984"></a><a class="pred" href="chario.html#get0/2">get0/2</a>.</dd>
373373 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="peek_byte/1"><strong>peek_byte</strong>(<var>-Byte</var>)</a></dt>
374374 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="peek_byte/2"><strong>peek_byte</strong>(<var>+Stream,
375375 -Byte</var>)</a></dt>
382382 <dd class="defbody">
383383 Read the next byte/code/char from the input without removing it. These
384384 predicates do not modify the stream's position or end-of-file status.
385 These predicates require a buffered stream (see <a id="idx:setstream2:984"></a><a class="pred" href="IO.html#set_stream/2">set_stream/2</a>)
385 These predicates require a buffered stream (see <a id="idx:setstream2:985"></a><a class="pred" href="IO.html#set_stream/2">set_stream/2</a>)
386386 and raise a permission error if the stream is unbuffered or the buffer
387387 is too small to hold the longest multi-byte sequence that might need to
388388 be buffered.</dd>
399399 <dt class="pubdef"><a id="skip/1"><strong>skip</strong>(<var>+Code</var>)</a></dt>
400400 <dd class="defbody">
401401 Read the input until <var>Code</var> or the end of the file is
402 encountered. A subsequent call to <a id="idx:getcode1:985"></a><a class="pred" href="chario.html#get_code/1">get_code/1</a>
402 encountered. A subsequent call to <a id="idx:getcode1:986"></a><a class="pred" href="chario.html#get_code/1">get_code/1</a>
403403 will read the first character after
404404 <var>Code</var>.</dd>
405405 <dt class="pubdef"><a id="skip/2"><strong>skip</strong>(<var>+Stream,
406406 +Code</var>)</a></dt>
407407 <dd class="defbody">
408 Skip input (as <a id="idx:skip1:986"></a><a class="pred" href="chario.html#skip/1">skip/1</a>)
408 Skip input (as <a id="idx:skip1:987"></a><a class="pred" href="chario.html#skip/1">skip/1</a>)
409409 on <var>Stream</var>.</dd>
410410 <dt class="pubdef"><a id="get_single_char/1"><strong>get_single_char</strong>(<var>-Code</var>)</a></dt>
411411 <dd class="defbody">
412412 Get a single character from input stream `user' (regardless of the
413 current input stream). Unlike <a id="idx:getcode1:987"></a><a class="pred" href="chario.html#get_code/1">get_code/1</a>,
413 current input stream). Unlike <a id="idx:getcode1:988"></a><a class="pred" href="chario.html#get_code/1">get_code/1</a>,
414414 this predicate does not wait for a return. The character is not echoed
415415 to the user's terminal. This predicate is meant for keyboard menu
416416 selection, etc. If SWI-Prolog was started with the <strong>-tty</strong>
426426 Succeeds after the last character of the named stream is read, or
427427 <var>Stream</var> is not a valid input stream. The end-of-stream test is
428428 only available on buffered input streams (unbuffered input streams are
429 rarely used; see <a id="idx:open4:988"></a><a class="pred" href="IO.html#open/4">open/4</a>).</dd>
429 rarely used; see <a id="idx:open4:989"></a><a class="pred" href="IO.html#open/4">open/4</a>).</dd>
430430 <dt class="pubdef"><a id="set_end_of_stream/1"><strong>set_end_of_stream</strong>(<var>+Stream</var>)</a></dt>
431431 <dd class="defbody">
432432 Set the size of the file opened as <var>Stream</var> to the current file
435435 +StreamOut, +Len</var>)</a></dt>
436436 <dd class="defbody">
437437 Copy <var>Len</var> codes from <var>StreamIn</var> to <var>StreamOut</var>.
438 Note that the copy is done using the semantics of <a id="idx:getcode2:989"></a><a class="pred" href="chario.html#get_code/2">get_code/2</a>
438 Note that the copy is done using the semantics of <a id="idx:getcode2:990"></a><a class="pred" href="chario.html#get_code/2">get_code/2</a>
439439 and
440 <a id="idx:putcode2:990"></a><a class="pred" href="chario.html#put_code/2">put_code/2</a>,
440 <a id="idx:putcode2:991"></a><a class="pred" href="chario.html#put_code/2">put_code/2</a>,
441441 taking care of possibly recoding that needs to take place between two
442442 text files. See <a class="sec" href="widechars.html">section 2.18.1</a>.</dd>
443443 <dt class="pubdef"><a id="copy_stream_data/2"><strong>copy_stream_data</strong>(<var>+StreamIn,
456456 connections or devices.
457457
458458 <p>The following code fragment realises efficient non-blocking copying
459 of data from an input to an output stream. The <a id="idx:atendofstream1:991"></a><a class="pred" href="chario.html#at_end_of_stream/1">at_end_of_stream/1</a>
459 of data from an input to an output stream. The <a id="idx:atendofstream1:992"></a><a class="pred" href="chario.html#at_end_of_stream/1">at_end_of_stream/1</a>
460460 call checks for end-of-stream and fills the input buffer. Note that the
461 use of a <a id="idx:getcode2:992"></a><a class="pred" href="chario.html#get_code/2">get_code/2</a>
462 and <a id="idx:putcode2:993"></a><a class="pred" href="chario.html#put_code/2">put_code/2</a>
463 based loop requires a <a id="idx:flushoutput1:994"></a><a class="pred" href="chario.html#flush_output/1">flush_output/1</a>
464 call after <em>each</em> <a id="idx:putcode2:995"></a><a class="pred" href="chario.html#put_code/2">put_code/2</a>.
465 The <a id="idx:copystreamdata2:996"></a><a class="pred" href="chario.html#copy_stream_data/2">copy_stream_data/2</a>
461 use of a <a id="idx:getcode2:993"></a><a class="pred" href="chario.html#get_code/2">get_code/2</a>
462 and <a id="idx:putcode2:994"></a><a class="pred" href="chario.html#put_code/2">put_code/2</a>
463 based loop requires a <a id="idx:flushoutput1:995"></a><a class="pred" href="chario.html#flush_output/1">flush_output/1</a>
464 call after <em>each</em> <a id="idx:putcode2:996"></a><a class="pred" href="chario.html#put_code/2">put_code/2</a>.
465 The <a id="idx:copystreamdata2:997"></a><a class="pred" href="chario.html#copy_stream_data/2">copy_stream_data/2</a>
466466 does not allow for inspection of the copied data and suffers from the
467467 same buffering issues.
468468
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.2</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.2</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
245245 8859-1) is applicable to many Western languages.
246246
247247 <p>ISO Prolog introduces three types, two of which are used for
248 characters and one for accessing binary streams (see <a id="idx:open4:309"></a><a class="pred" href="IO.html#open/4">open/4</a>).
248 characters and one for accessing binary streams (see <a id="idx:open4:310"></a><a class="pred" href="IO.html#open/4">open/4</a>).
249249 These types are:
250250
251251 <p>
253253 <li><i>code</i><br>
254254 A <em>character code</em> is an integer representing a single character.
255255 As files may use multi-byte encoding for supporting different character
256 sets (<a id="idx:utf8:310">utf-8</a> encoding for example), reading a
256 sets (<a id="idx:utf8:311">utf-8</a> encoding for example), reading a
257257 code from a text file is in general not the same as reading a byte.
258258 <li><i>char</i><br>
259259 Alternatively, characters may be represented as
265265 </ul>
266266
267267 <p>In SWI-Prolog, character codes are <em>always</em> the Unicode
268 equivalent of the encoding. That is, if <a id="idx:getcode1:311"></a><a class="pred" href="chario.html#get_code/1">get_code/1</a>
268 equivalent of the encoding. That is, if <a id="idx:getcode1:312"></a><a class="pred" href="chario.html#get_code/1">get_code/1</a>
269269 reads from a stream encoded as
270270 <code>KOI8-R</code> (used for the Cyrillic alphabet), it returns the
271271 corresponding Unicode code points. Similarly, assembling or
272 disassembling atoms using <a id="idx:atomcodes2:312"></a><a class="pred" href="manipatom.html#atom_codes/2">atom_codes/2</a>
272 disassembling atoms using <a id="idx:atomcodes2:313"></a><a class="pred" href="manipatom.html#atom_codes/2">atom_codes/2</a>
273273 interprets the codes as Unicode points. See
274274 <a class="sec" href="widechars.html">section 2.18.1</a> for details.
275275
288288
289289 <p>The two character representations are handled by a large number of
290290 built-in predicates, all of which are ISO-compatible. For converting
291 between code and character there is <a id="idx:charcode2:313"></a><a class="pred" href="manipatom.html#char_code/2">char_code/2</a>.
292 For breaking atoms and numbers into characters there are <a id="idx:atomchars2:314"></a><a class="pred" href="manipatom.html#atom_chars/2">atom_chars/2</a>, <a id="idx:atomcodes2:315"></a><a class="pred" href="manipatom.html#atom_codes/2">atom_codes/2</a>,
293 <a id="idx:numberchars2:316"></a><a class="pred" href="manipatom.html#number_chars/2">number_chars/2</a>
294 and <a id="idx:numbercodes2:317"></a><a class="pred" href="manipatom.html#number_codes/2">number_codes/2</a>.
291 between code and character there is <a id="idx:charcode2:314"></a><a class="pred" href="manipatom.html#char_code/2">char_code/2</a>.
292 For breaking atoms and numbers into characters there are <a id="idx:atomchars2:315"></a><a class="pred" href="manipatom.html#atom_chars/2">atom_chars/2</a>, <a id="idx:atomcodes2:316"></a><a class="pred" href="manipatom.html#atom_codes/2">atom_codes/2</a>,
293 <a id="idx:numberchars2:317"></a><a class="pred" href="manipatom.html#number_chars/2">number_chars/2</a>
294 and <a id="idx:numbercodes2:318"></a><a class="pred" href="manipatom.html#number_codes/2">number_codes/2</a>.
295295 For character I/O on streams there are
296 <a id="idx:getchar12:318"></a><span class="pred-ext">get_char/[1,2]</span>, <a id="idx:getcode12:319"></a><span class="pred-ext">get_code/[1,2]</span>, <a id="idx:getbyte12:320"></a><span class="pred-ext">get_byte/[1,2]</span>, <a id="idx:peekchar12:321"></a><span class="pred-ext">peek_char/[1,2]</span>,
297 <a id="idx:peekcode12:322"></a><span class="pred-ext">peek_code/[1,2]</span>, <a id="idx:peekbyte12:323"></a><span class="pred-ext">peek_byte/[1,2]</span>, <a id="idx:putcode12:324"></a><span class="pred-ext">put_code/[1,2]</span>, <a id="idx:putchar12:325"></a><span class="pred-ext">put_char/[1,2]</span>
296 <a id="idx:getchar12:319"></a><span class="pred-ext">get_char/[1,2]</span>, <a id="idx:getcode12:320"></a><span class="pred-ext">get_code/[1,2]</span>, <a id="idx:getbyte12:321"></a><span class="pred-ext">get_byte/[1,2]</span>, <a id="idx:peekchar12:322"></a><span class="pred-ext">peek_char/[1,2]</span>,
297 <a id="idx:peekcode12:323"></a><span class="pred-ext">peek_code/[1,2]</span>, <a id="idx:peekbyte12:324"></a><span class="pred-ext">peek_byte/[1,2]</span>, <a id="idx:putcode12:325"></a><span class="pred-ext">put_code/[1,2]</span>, <a id="idx:putchar12:326"></a><span class="pred-ext">put_char/[1,2]</span>
298298 and
299 <a id="idx:putbyte12:326"></a><span class="pred-ext">put_byte/[1,2]</span>.
299 <a id="idx:putbyte12:327"></a><span class="pred-ext">put_byte/[1,2]</span>.
300300 The Prolog flag <a class="flag" href="flags.html#flag:double_quotes">double_quotes</a>
301301 controls how text between double quotes is interpreted.
302302
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.5</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.5</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.23</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.23</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
245245
246246 <p>In addition, there is the library <code>library(ctype)</code>
247247 providing compatibility with some other Prolog systems. The predicates
248 of this library are defined in terms of <a id="idx:codetype2:1172"></a><a class="pred" href="chartype.html#code_type/2">code_type/2</a>.
248 of this library are defined in terms of <a id="idx:codetype2:1173"></a><a class="pred" href="chartype.html#code_type/2">code_type/2</a>.
249249
250250 <dl class="latex">
251251 <dt class="pubdef"><a id="char_type/2"><strong>char_type</strong>(<var>?Char,
321321 <dd class="defbody">
322322 <var>Char</var> is a lowercase version of <var>Upper</var>. For
323323 non-letters, or letter without case, <var>Char</var> and <var>Lower</var>
324 are the same. See also <a id="idx:upcaseatom2:1173"></a><a class="pred" href="chartype.html#upcase_atom/2">upcase_atom/2</a>
325 and <a id="idx:downcaseatom2:1174"></a><a class="pred" href="chartype.html#downcase_atom/2">downcase_atom/2</a>.
324 are the same. See also <a id="idx:upcaseatom2:1174"></a><a class="pred" href="chartype.html#upcase_atom/2">upcase_atom/2</a>
325 and <a id="idx:downcaseatom2:1175"></a><a class="pred" href="chartype.html#downcase_atom/2">downcase_atom/2</a>.
326326 </dd>
327327 <dt><strong>upper</strong></dt>
328328 <dd class="defbody">
338338 <dd class="defbody">
339339 <var>Char</var> is an uppercase version of <var>Lower</var>. For
340340 non-letters, or letter without case, <var>Char</var> and <var>Lower</var>
341 are the same. See also <a id="idx:upcaseatom2:1175"></a><a class="pred" href="chartype.html#upcase_atom/2">upcase_atom/2</a>
342 and <a id="idx:downcaseatom2:1176"></a><a class="pred" href="chartype.html#downcase_atom/2">downcase_atom/2</a>.
341 are the same. See also <a id="idx:upcaseatom2:1176"></a><a class="pred" href="chartype.html#upcase_atom/2">upcase_atom/2</a>
342 and <a id="idx:downcaseatom2:1177"></a><a class="pred" href="chartype.html#downcase_atom/2">downcase_atom/2</a>.
343343 </dd>
344344 <dt><strong>punct</strong></dt>
345345 <dd class="defbody">
400400 <dt class="pubdef"><a id="code_type/2"><strong>code_type</strong>(<var>?Code,
401401 ?Type</var>)</a></dt>
402402 <dd class="defbody">
403 As <a id="idx:chartype2:1177"></a><a class="pred" href="chartype.html#char_type/2">char_type/2</a>,
403 As <a id="idx:chartype2:1178"></a><a class="pred" href="chartype.html#char_type/2">char_type/2</a>,
404404 but uses character codes rather than one-character atoms. Please note
405405 that both predicates are as flexible as possible. They handle either
406406 representation if the argument is instantiated and will instantiate only
407407 with an integer code or a one-character atom, depending of the version
408408 used. See also the Prolog flag
409 <a class="flag" href="flags.html#flag:double_quotes">double_quotes</a>, <a id="idx:atomchars2:1178"></a><a class="pred" href="manipatom.html#atom_chars/2">atom_chars/2</a>
410 and <a id="idx:atomcodes2:1179"></a><a class="pred" href="manipatom.html#atom_codes/2">atom_codes/2</a>.
409 <a class="flag" href="flags.html#flag:double_quotes">double_quotes</a>, <a id="idx:atomchars2:1179"></a><a class="pred" href="manipatom.html#atom_chars/2">atom_chars/2</a>
410 and <a id="idx:atomcodes2:1180"></a><a class="pred" href="manipatom.html#atom_codes/2">atom_codes/2</a>.
411411 </dd>
412412 </dl>
413413
417417 <a id="sec:case"></a>
418418
419419 <p>There is nothing in the Prolog standard for converting case in
420 textual data. The SWI-Prolog predicates <a id="idx:codetype2:1180"></a><a class="pred" href="chartype.html#code_type/2">code_type/2</a>
421 and <a id="idx:chartype2:1181"></a><a class="pred" href="chartype.html#char_type/2">char_type/2</a>
420 textual data. The SWI-Prolog predicates <a id="idx:codetype2:1181"></a><a class="pred" href="chartype.html#code_type/2">code_type/2</a>
421 and <a id="idx:chartype2:1182"></a><a class="pred" href="chartype.html#char_type/2">char_type/2</a>
422422 can be used to test and convert individual characters. We have started
423423 some additional support:
424424
426426 <dt class="pubdef"><a id="downcase_atom/2"><strong>downcase_atom</strong>(<var>+AnyCase,
427427 -LowerCase</var>)</a></dt>
428428 <dd class="defbody">
429 Converts the characters of <var>AnyCase</var> into lowercase as <a id="idx:chartype2:1182"></a><a class="pred" href="chartype.html#char_type/2">char_type/2</a>
429 Converts the characters of <var>AnyCase</var> into lowercase as <a id="idx:chartype2:1183"></a><a class="pred" href="chartype.html#char_type/2">char_type/2</a>
430430 does (i.e. based on the defined <em>locale</em> if Prolog provides
431431 locale support on the hosting platform) and unifies the lowercase atom
432432 with <var>LowerCase</var>.</dd>
433433 <dt class="pubdef"><a id="upcase_atom/2"><strong>upcase_atom</strong>(<var>+AnyCase,
434434 -UpperCase</var>)</a></dt>
435435 <dd class="defbody">
436 Converts, similar to <a id="idx:downcaseatom2:1183"></a><a class="pred" href="chartype.html#downcase_atom/2">downcase_atom/2</a>,
436 Converts, similar to <a id="idx:downcaseatom2:1184"></a><a class="pred" href="chartype.html#downcase_atom/2">downcase_atom/2</a>,
437437 an atom to uppercase.
438438 </dd>
439439 </dl>
450450 Normalize white space in <var>In</var>. All leading and trailing white
451451 space is removed. All non-empty sequences for Unicode white space
452452 characters are replaced by a single space (<code>\u0020</code>)
453 character. <var>Out</var> uses the same conventions as <a id="idx:withoutputto2:1184"></a><a class="pred" href="IO.html#with_output_to/2">with_output_to/2</a>
454 and <a id="idx:format3:1185"></a><a class="pred" href="format.html#format/3">format/3</a>.
453 character. <var>Out</var> uses the same conventions as <a id="idx:withoutputto2:1185"></a><a class="pred" href="IO.html#with_output_to/2">with_output_to/2</a>
454 and <a id="idx:format3:1186"></a><a class="pred" href="format.html#format/3">format/3</a>.
455455 </dd>
456456 </dl>
457457
460460
461461 <a id="sec:collate"></a>
462462
463 <p><a id="idx:locale:1186"></a><a id="idx:collate:1187"></a><a id="idx:comparelanguagespecific:1188"></a>This
463 <p><a id="idx:locale:1187"></a><a id="idx:collate:1188"></a><a id="idx:comparelanguagespecific:1189"></a>This
464464 section deals with predicates for language-specific string comparison
465465 operations.
466466
474474 is alphabetically smaller than <var>B</var> using the sort order of the
475475 current locale.
476476
477 <p>The predicate <a id="idx:collationkey2:1189"></a><a class="pred" href="chartype.html#collation_key/2">collation_key/2</a>
478 is used by <a id="idx:localesort2:1190"></a><a class="pred" href="chartype.html#locale_sort/2">locale_sort/2</a>
479 from library(sort). Please examine the implementation of <a id="idx:localesort2:1191"></a><a class="pred" href="chartype.html#locale_sort/2">locale_sort/2</a>
477 <p>The predicate <a id="idx:collationkey2:1190"></a><a class="pred" href="chartype.html#collation_key/2">collation_key/2</a>
478 is used by <a id="idx:localesort2:1191"></a><a class="pred" href="chartype.html#locale_sort/2">locale_sort/2</a>
479 from library(sort). Please examine the implementation of <a id="idx:localesort2:1192"></a><a class="pred" href="chartype.html#locale_sort/2">locale_sort/2</a>
480480 as an example of using this call.
481481
482482 <p>The <var>Key</var> is an implementation-defined and generally
488488 Sort a list of atoms using the current locale. <var>List</var> is a list
489489 of atoms or string objects (see <a class="sec" href="strings.html">section
490490 5.2</a>). <var>Sorted</var> is unified with a list containing all atoms
491 of <var>List</var>, sorted to the rules of the current locale. See also <a id="idx:collationkey2:1192"></a><a class="pred" href="chartype.html#collation_key/2">collation_key/2</a>
491 of <var>List</var>, sorted to the rules of the current locale. See also <a id="idx:collationkey2:1193"></a><a class="pred" href="chartype.html#collation_key/2">collation_key/2</a>
492492 and
493 <a id="idx:setlocale3:1193"></a><a class="pred" href="system.html#setlocale/3">setlocale/3</a>.
493 <a id="idx:setlocale3:1194"></a><a class="pred" href="system.html#setlocale/3">setlocale/3</a>.
494494 </dd>
495495 </dl>
496496
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.6</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.6</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 8.1</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 8.1</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section E.1</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section E.1</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.7</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.7</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
376376 Succeeds with <var>T</var> = 0 if the Boolean expression <var>Expr</var>
377377 cannot be satisfied, and with <var>T</var> = 1 if <var>Expr</var> is
378378 always true with respect to the current constraints. Fails otherwise.</dd>
379 <dt class="pubdef"><span class="pred-tag">[nondet]</span><a id="labeling/1"><strong>labeling</strong>(<var>+Vs</var>)</a></dt>
379 <dt class="pubdef"><span class="pred-tag">[multi]</span><a id="labeling/1"><strong>labeling</strong>(<var>+Vs</var>)</a></dt>
380380 <dd class="defbody">
381381 Assigns truth values to the Boolean variables <var>Vs</var> such that
382382 all stated constraints are satisfied.</dd>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.8</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.8</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
264264 problems such as planning, scheduling and allocation tasks.
265265 </ol>
266266
267 <p>When teaching Prolog, we <i>strongly</i> recommend that you introduce
267 <p>When teaching Prolog, we <i>strongly recommend</i> that you introduce
268268 CLP(FD) constraints <i>before</i> explaining lower-level arithmetic
269269 predicates and their procedural idiosyncrasies. This is because
270270 constraints are easy to explain, understand and use due to their purely
285285 rewritten at compilation time so that lower-level fallback predicates
286286 are automatically used whenever possible.
287287
288 <p>You can cite this library in your publications as:
288 <p>We recommend the following reference to cite this library in
289 scientific publications:
289290
290291 <pre class="code">
291292 @inproceedings{Triska12,
297298 year = {2012},
298299 pages = {307-316}
299300 }
301 </pre>
302
303 <p>and the following URL to link to its documentation:
304
305 <pre class="code">
306 http://www.swi-prolog.org/man/clpfd.html
300307 </pre>
301308
302309 <p><h4 id="sec:cplfd-arith-constraints"><a id="sec:A.8.2"><span class="sec-nr">A.8.2</span> <span class="sec-title">Arithmetic
317324 <tr><td>Expr <code>^</code> Expr</td><td>Exponentiation </td></tr>
318325 <tr><td><code>min(Expr,Expr)</code> </td><td>Minimum of two expressions </td></tr>
319326 <tr><td><code>max(Expr,Expr)</code> </td><td>Maximum of two expressions </td></tr>
320 <tr><td>Expr mod Expr</td><td>Modulo induced by floored division </td></tr>
321 <tr><td>Expr rem Expr</td><td>Modulo induced by truncated division </td></tr>
327 <tr><td>Expr <code>mod</code> Expr</td><td>Modulo induced by floored
328 division </td></tr>
329 <tr><td>Expr <code>rem</code> Expr</td><td>Modulo induced by truncated
330 division </td></tr>
322331 <tr><td><code>abs(Expr)</code> </td><td>Absolute value </td></tr>
323332 <tr><td>Expr <code>//</code> Expr</td><td>Truncated integer division </td></tr>
324333 </table>
350359 <p>CLP(FD) constraints let you declaratively express integer arithmetic.
351360 The CLP(FD) constraints <a class="pred" href="clpfd.html##=/2">#=/2</a>, <a class="pred" href="clpfd.html##>/2">#&gt;/2</a>
352361 etc. are meant to be used instead of the corresponding primitives <a class="pred" href="arith.html#is/2">is/2</a>, <a class="pred" href="arith.html#=:=/2">=:=/2</a>, <a class="pred" href="arith.html#>/2">&gt;/2</a>
353 etc.
362 etc. over integers.
354363
355364 <p>An important advantage of arithmetic constraints is their purely
356365 relational nature. They are therefore easy to explain and use, and well
440449
441450 <p>The constraints of this table are reifiable as well.
442451
452 <p>When reasoning over Boolean variables, also consider using
453 <code>library(clpb)</code> and its dedicated CLP(B) constraints.
454
443455 <p><h4 id="sec:clpfd-domains"><a id="sec:A.8.5"><span class="sec-nr">A.8.5</span> <span class="sec-title">Domains</span></a></h4>
444456
445457 <p><a id="sec:clpfd-domains"></a>
533545 </ol>
534546
535547 <p>It is good practice to keep the modeling part, via a dedicated
536 predicate, separate from the actual search for solutions. This lets you
537 observe termination and determinism properties of the modeling part in
538 isolation from the search, and more easily try different search
539 strategies.
548 predicate called the <b>core relation</b>, separate from the actual
549 search for solutions. This lets you observe termination and determinism
550 properties of the core relation in isolation from the search, and more
551 easily try different search strategies.
540552
541553 <p>As an example of a constraint satisfaction problem, consider the
542554 cryptoarithmetic puzzle SEND + MORE = MONEY, where different letters
575587 C5 in 2..8.
576588 </pre>
577589
578 <p>From this answer, we see that the modeling part <i>terminates</i> and
579 is in fact <i>deterministic</i>. Moreover, we see from the residual
590 <p>From this answer, we see that this core relation <i>terminates</i>
591 and is in fact <i>deterministic</i>. Moreover, we see from the residual
580592 goals that the constraint solver has deduced more stringent bounds for
581593 all variables. Such observations are only possible if modeling and
582594 search parts are cleanly separated.
598610 general though, it is necessary to label all variables to obtain ground
599611 solutions.
600612
601 <p><h4 id="sec:clpfd-advanced-topics"><a id="sec:A.8.8"><span class="sec-nr">A.8.8</span> <span class="sec-title">Advanced
613 <p><h4 id="sec:clpfd-optimisation"><a id="sec:A.8.8"><span class="sec-nr">A.8.8</span> <span class="sec-title">Optimisation</span></a></h4>
614
615 <p><a id="sec:clpfd-optimisation"></a>
616
617 <p>You can use <a class="pred" href="clpfd.html#labeling/2">labeling/2</a>
618 to minimize or maximize the value of a CLP(FD) expression, and generate
619 solutions in increasing or decreasing order of the value. See the
620 labeling options <code>min(Expr)</code> and <code>max(Expr)</code>,
621 respectively.
622
623 <p>Again, to easily try different labeling options in connection with
624 optimisation, we recommend to introduce a dedicated predicate for
625 posting constraints, and to use <code>labeling/2</code> in a separate
626 goal. This way, you can observe properties of the core relation in
627 isolation, and try different labeling options without recompiling your
628 code.
629
630 <p>If necessary, you can use <code>once/1</code> to commit to the first
631 optimal solution. However, it is often very valuable to see alternative
632 solutions that are <i>also</i> optimal, so that you can choose among
633 optimal solutions by other criteria. For the sake of purity and
634 completeness, we recommend to avoid <code>once/1</code> and other
635 constructs that lead to impurities in CLP(FD) programs.
636
637 <p><h4 id="sec:clpfd-advanced-topics"><a id="sec:A.8.9"><span class="sec-nr">A.8.9</span> <span class="sec-title">Advanced
602638 topics</span></a></h4>
603639
604640 <p><a id="sec:clpfd-advanced-topics"></a>
11211157 these arguments must be a finite domain variable with bounded domain, or
11221158 an integer. The constraint holds iff at each time slot during the start
11231159 and end of each task, the total resource consumption of all tasks
1124 running at that time does not exceed the global resource limit (which is
1125 1 by default). <var>Options</var> is a list of options. Currently, the
1126 only supported option is:
1160 running at that time does not exceed the global resource limit. <var>Options</var>
1161 is a list of options. Currently, the only supported option is:
11271162
11281163 <dl class="latex">
11291164 <dt><strong>limit</strong>(<var>L</var>)</dt>
11301165 <dd class="defbody">
1131 The integer <var>L</var> is the global resource limit.
1166 The integer <var>L</var> is the global resource limit. Default is 1.
11321167 </dd>
11331168 </dl>
11341169
12781313 :- use_module(library(clpfd)).
12791314
12801315 sudoku(Rows) :-
1281 length(Rows, 9), maplist(length_list(9), Rows),
1316 length(Rows, 9), maplist(same_length(Rows), Rows),
12821317 append(Rows, Vs), Vs ins 1..9,
12831318 maplist(all_distinct, Rows),
12841319 transpose(Rows, Columns),
12851320 maplist(all_distinct, Columns),
12861321 Rows = [A,B,C,D,E,F,G,H,I],
12871322 blocks(A, B, C), blocks(D, E, F), blocks(G, H, I).
1288
1289 length_list(L, Ls) :- length(Ls, L).
12901323
12911324 blocks([], [], []).
12921325 blocks([A,B,C|Bs1], [D,E,F|Bs2], [G,H,I|Bs3]) :-
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.9</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.9</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
244244 <p>This CLP(Q,R) system is a port of the CLP(Q,R) system of Sicstus
245245 Prolog by Christian Holzbaur: Holzbaur C.: OFAI clp(q,r) Manual, Edition
246246 1.3.3, Austrian Research Institute for Artificial Intelligence, Vienna,
247 TR-95-09, 1995.<sup class="fn">159<span class="fn-text">http://www.ai.univie.ac.at/cgi-bin/tr-online?number+95-09</span></sup>
247 TR-95-09, 1995.<sup class="fn">162<span class="fn-text">http://www.ai.univie.ac.at/cgi-bin/tr-online?number+95-09</span></sup>
248248 This manual is roughly based on the manual of the above mentioned
249249 CLP(Q,R) implementation.
250250
503503
504504 <p>
505505 <li><i>Dumping constraints</i><br>
506 The first argument of <a id="idx:dump3:1951"></a><a class="pred" href="clpqr.html#dump/3">dump/3</a>
506 The first argument of <a id="idx:dump3:1954"></a><a class="pred" href="clpqr.html#dump/3">dump/3</a>
507507 has to be a list of free variables at call-time:
508508
509509 <pre class="code">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 2.4</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 2.4</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.7</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.7</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
255255 </dd>
256256 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="\=/2"><var>@Term1</var> <strong>\=</strong> <var>@Term2</var></a></dt>
257257 <dd class="defbody">
258 Equivalent to <code><code>\+</code>Term1 = Term2</code>. See also <a id="idx:dif2:576"></a><a class="pred" href="coroutining.html#dif/2">dif/2</a>.
258 Equivalent to <code><code>\+</code>Term1 = Term2</code>. See also <a id="idx:dif2:577"></a><a class="pred" href="coroutining.html#dif/2">dif/2</a>.
259259 </dd>
260260 </dl>
261261
325325 <a id="sec:unifyspecial"></a>
326326
327327 <p>This section describes special purpose variations on Prolog
328 unification. The predicate <a id="idx:unifywithoccurscheck2:577"></a><a class="pred" href="compare.html#unify_with_occurs_check/2">unify_with_occurs_check/2</a>
328 unification. The predicate <a id="idx:unifywithoccurscheck2:578"></a><a class="pred" href="compare.html#unify_with_occurs_check/2">unify_with_occurs_check/2</a>
329329 provides sound unification and is part of the ISO standard. The
330 predicate <a id="idx:subsumesterm2:578"></a><a class="pred" href="compare.html#subsumes_term/2">subsumes_term/2</a>
330 predicate <a id="idx:subsumesterm2:579"></a><a class="pred" href="compare.html#subsumes_term/2">subsumes_term/2</a>
331331 defines `one-sided unification' and is part of the ISO proposal
332 established in Edinburgh (2010). Finally, <a id="idx:unifiable3:579"></a><a class="pred" href="compare.html#unifiable/3">unifiable/3</a>
332 established in Edinburgh (2010). Finally, <a id="idx:unifiable3:580"></a><a class="pred" href="compare.html#unifiable/3">unifiable/3</a>
333333 is a `what-if' version of unification that is often used as a building
334334 block in constraint reasoners.
335335
349349 false.
350350 </pre>
351351
352 <p><a id="idx:occurscheck:580"></a>The first statement creates a <em>cyclic
352 <p><a id="idx:occurscheck:581"></a>The first statement creates a <em>cyclic
353353 term</em>, also called a
354354 <em>rational tree</em>. The second executes logically sound unification
355355 and thus fails. Note that the behaviour of unification through
356356 <a class="pred" href="compare.html#=/2">=/2</a> as well as implicit
357357 unification in the head can be changed using the Prolog flag <a class="flag" href="flags.html#flag:occurs_check">occurs_check</a>.
358358
359 <p>The SWI-Prolog implementation of <a id="idx:unifywithoccurscheck2:581"></a><a class="pred" href="compare.html#unify_with_occurs_check/2">unify_with_occurs_check/2</a>
359 <p>The SWI-Prolog implementation of <a id="idx:unifywithoccurscheck2:582"></a><a class="pred" href="compare.html#unify_with_occurs_check/2">unify_with_occurs_check/2</a>
360360 is cycle-safe and only guards against <em>creating</em> cycles, not
361361 against cycles that may already be present in one of the arguments. This
362362 is illustrated in the following two queries:
368368 X = Y, Y = f(Y).
369369 </pre>
370370
371 <p>Some other Prolog systems interpret <a id="idx:unifywithoccurscheck2:582"></a><a class="pred" href="compare.html#unify_with_occurs_check/2">unify_with_occurs_check/2</a>
371 <p>Some other Prolog systems interpret <a id="idx:unifywithoccurscheck2:583"></a><a class="pred" href="compare.html#unify_with_occurs_check/2">unify_with_occurs_check/2</a>
372372 as if defined by the clause below, causing failure on the above two
373 queries. Direct use of <a id="idx:acyclicterm1:583"></a><a class="pred" href="typetest.html#acyclic_term/1">acyclic_term/1</a>
373 queries. Direct use of <a id="idx:acyclicterm1:584"></a><a class="pred" href="typetest.html#acyclic_term/1">acyclic_term/1</a>
374374 is portable and more appropriate for such applications.
375375
376376 <pre class="code">
380380 </dd>
381381 <dt class="pubdef"><a id="=@=/2"><var>+Term1</var> <strong>=@=</strong> <var>+Term2</var></a></dt>
382382 <dd class="defbody">
383 <a id="idx:variant:584"></a>True if <var>Term1</var> is a <em>variant</em>
383 <a id="idx:variant:585"></a>True if <var>Term1</var> is a <em>variant</em>
384384 of (or <em>structurally equivalent</em> to) <var>Term2</var>. Testing
385385 for a variant is weaker than equivalence (<a class="pred" href="compare.html#==/2">==/2</a>),
386386 but stronger than unification (<a class="pred" href="compare.html#=/2">=/2</a>).
387387 Two terms <var>A</var> and <var>B</var> are variants iff there exists a
388388 renaming of the variables in <var>A</var> that makes <var>A</var>
389 equivalent (==) to <var>B</var> and vice versa.<sup class="fn">48<span class="fn-text">Row&nbsp;7
389 equivalent (==) to <var>B</var> and vice versa.<sup class="fn">49<span class="fn-text">Row&nbsp;7
390390 and 8 of this table may come as a surprise, but row&nbsp;8 is satisfied
391391 by (left-to-right) <var>A -&gt; C</var>, <var>B -&gt; A</var> and
392392 (right-to-left) <var>C -&gt; A</var>, <var>A -&gt; B</var>. If the same
408408 </blockquote>
409409
410410 <p>A term is always a variant of a copy of itself. Term copying takes
411 place in, e.g., <a id="idx:copyterm2:585"></a><a class="pred" href="manipterm.html#copy_term/2">copy_term/2</a>, <a id="idx:findall3:586"></a><a class="pred" href="allsolutions.html#findall/3">findall/3</a>
411 place in, e.g., <a id="idx:copyterm2:586"></a><a class="pred" href="manipterm.html#copy_term/2">copy_term/2</a>, <a id="idx:findall3:587"></a><a class="pred" href="allsolutions.html#findall/3">findall/3</a>
412412 or proving a clause added with
413 <a id="idx:asserta1:587"></a><a class="pred" href="db.html#asserta/1">asserta/1</a>.
413 <a id="idx:asserta1:588"></a><a class="pred" href="db.html#asserta/1">asserta/1</a>.
414414 In the pure Prolog world (i.e., without attributed variables), <a class="pred" href="compare.html#=@=/2">=@=/2</a>
415415 behaves as if defined below. With attributed variables, variant of the
416416 attributes is tested rather than trying to satisfy the constraints.
428428 variables that are shared between the left and right argument. Its
429429 performance is comparable to <a class="pred" href="compare.html#==/2">==/2</a>,
430430 both on success and (early) failure.
431 <sup class="fn">49<span class="fn-text">The current implementation is
431 <sup class="fn">50<span class="fn-text">The current implementation is
432432 contributed by Kuniaki Mukai.</span></sup>
433433
434434 <p>This predicate is known by the name <span class="pred-ext">variant/2</span>
435435 in some other Prolog systems. Be aware of possible differences in
436436 semantics if the arguments contain attributed variables or share
437 variables.<sup class="fn">50<span class="fn-text">In many systems
438 variant is implemented using two calls to <a id="idx:subsumesterm2:588"></a><a class="pred" href="compare.html#subsumes_term/2">subsumes_term/2</a>.</span></sup></dd>
437 variables.<sup class="fn">51<span class="fn-text">In many systems
438 variant is implemented using two calls to <a id="idx:subsumesterm2:589"></a><a class="pred" href="compare.html#subsumes_term/2">subsumes_term/2</a>.</span></sup></dd>
439439 <dt class="pubdef"><a id="\=@=/2"><var>+Term1</var> <strong>\=@=</strong> <var>+Term2</var></a></dt>
440440 <dd class="defbody">
441441 Equivalent to <code>`<code>\+</code>Term1 =@= Term2'</code>. See <a class="pred" href="compare.html#=@=/2">=@=/2</a>
446446 by only binding variables in <var>Generic</var>. The current
447447 implementation performs the unification and ensures that the variable
448448 set of <var>Specific</var> is not changed by the unification. On
449 success, the bindings are undone.<sup class="fn">51<span class="fn-text">This
450 predicate is often named <a id="idx:subsumeschk2:589"></a><span class="pred-ext">subsumes_chk/2</span>
449 success, the bindings are undone.<sup class="fn">52<span class="fn-text">This
450 predicate is often named <a id="idx:subsumeschk2:590"></a><span class="pred-ext">subsumes_chk/2</span>
451451 in older Prolog dialects. The current name was established in the ISO
452452 WG17 meeting in Edinburgh (2010). The <code>chk</code> postfix was
453 considered to refer to determinism as in e.g., <a id="idx:memberchk2:590"></a><a class="pred" href="builtinlist.html#memberchk/2">memberchk/2</a>.</span></sup>
453 considered to refer to determinism as in e.g., <a id="idx:memberchk2:591"></a><a class="pred" href="builtinlist.html#memberchk/2">memberchk/2</a>.</span></sup>
454454 This predicate respects constraints.</dd>
455455 <dt class="pubdef"><a id="term_subsumer/3"><strong>term_subsumer</strong>(<var>+Special1,
456456 +Special2, -General</var>)</a></dt>
464464 If <var>X</var> and <var>Y</var> can unify, unify <var>Unifier</var>
465465 with a list of
466466 <var>Var</var> = <var>Value</var>, representing the bindings required to
467 make <var>X</var> and <var>Y</var> equivalent.<sup class="fn">52<span class="fn-text">This
468 predicate was introduced for the implementation of <a id="idx:dif2:591"></a><a class="pred" href="coroutining.html#dif/2">dif/2</a>
469 and <a id="idx:when2:592"></a><a class="pred" href="coroutining.html#when/2">when/2</a>
467 make <var>X</var> and <var>Y</var> equivalent.<sup class="fn">53<span class="fn-text">This
468 predicate was introduced for the implementation of <a id="idx:dif2:592"></a><a class="pred" href="coroutining.html#dif/2">dif/2</a>
469 and <a id="idx:when2:593"></a><a class="pred" href="coroutining.html#when/2">when/2</a>
470470 after discussion with Tom Schrijvers and Bart Demoen. None of us is
471471 really happy with the name and therefore suggestions for a new name are
472472 welcome.</span></sup> This predicate can handle cyclic terms. Attributed
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 2.10</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 2.10</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.3</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.3</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
246246 <dd>
247247 Prolog source file contains Prolog clauses and directives, but no <em>module
248248 declaration</em> (see
249 <a id="idx:module1:327"></a><a class="pred" href="mtoplevel.html#module/1">module/1</a>).
250 They are normally loaded using <a id="idx:consult1:328"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>
251 or <a id="idx:ensureloaded1:329"></a><a class="pred" href="consulting.html#ensure_loaded/1">ensure_loaded/1</a>.
252 Currently, a non-module file can only be loaded into a single module.<sup class="fn">38<span class="fn-text">This
249 <a id="idx:module1:328"></a><a class="pred" href="mtoplevel.html#module/1">module/1</a>).
250 They are normally loaded using <a id="idx:consult1:329"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>
251 or <a id="idx:ensureloaded1:330"></a><a class="pred" href="consulting.html#ensure_loaded/1">ensure_loaded/1</a>.
252 Currently, a non-module file can only be loaded into a single module.<sup class="fn">39<span class="fn-text">This
253253 limitation may be lifted in the future. Existing limitations in
254254 SWI-Prolog's source code administration make this non-trivial.</span></sup></dd>
255255 <dt><b> A module</b></dt>
257257 Prolog source file starts with a module declaration. The subsequent
258258 Prolog code is loaded into the specified module, and only the <em>exported</em>
259259 predicates are made available to the context loading the module. Module
260 files are normally loaded with <a id="idx:usemodule12:330"></a><span class="pred-ext">use_module/[1,2]</span>.
260 files are normally loaded with <a id="idx:usemodule12:331"></a><span class="pred-ext">use_module/[1,2]</span>.
261261 See <a class="sec" href="modules.html">chapter 6</a> for details.</dd>
262262 <dt><b> An include</b></dt>
263263 <dd>
264 Prolog source file is loaded using the <a id="idx:include1:331"></a><a class="pred" href="consulting.html#include/1">include/1</a>
264 Prolog source file is loaded using the <a id="idx:include1:332"></a><a class="pred" href="consulting.html#include/1">include/1</a>
265265 directive, textually including Prolog text into another Prolog source. A
266266 file may be included into multiple source files and is typically used to
267267 share <em>declarations</em> such as multifile or dynamic between source
269269 </dd>
270270 </dl>
271271
272 <p>Prolog source files are located using <a id="idx:absolutefilename3:332"></a><a class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</a>
272 <p>Prolog source files are located using <a id="idx:absolutefilename3:333"></a><a class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</a>
273273 with the following options:
274274
275275 <pre class="code">
282282 </pre>
283283
284284 <p>The <code>file_type(prolog)</code> option is used to determine the
285 extension of the file using <a id="idx:prologfiletype2:333"></a><a class="pred" href="consulting.html#prolog_file_type/2">prolog_file_type/2</a>.
285 extension of the file using <a id="idx:prologfiletype2:334"></a><a class="pred" href="consulting.html#prolog_file_type/2">prolog_file_type/2</a>.
286286 The default extension is
287287 <code>.pl</code>. <var>Spec</var> allows for the <em>path alias</em>
288 construct defined by <a id="idx:absolutefilename3:334"></a><a class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</a>.
288 construct defined by <a id="idx:absolutefilename3:335"></a><a class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</a>.
289289 The most commonly used path alias is <code>library(LibraryFile)</code>.
290290 The example below loads the library file <code>ordsets.pl</code>
291291 (containing predicates for manipulating ordered sets).
294294 :- use_module(library(ordsets)).
295295 </pre>
296296
297 <p>SWI-Prolog recognises grammar rules (<a id="idx:DCG:335">DCG</a>) as
297 <p>SWI-Prolog recognises grammar rules (<a id="idx:DCG:336">DCG</a>) as
298298 defined in
299299 <cite><a class="cite" href="Bibliography.html#Clocksin:87">Clocksin &amp;
300300 Melish, 1987</a></cite>. The user may define additional compilation of
301301 the source file by defining the dynamic multifile predicates
302 <a id="idx:termexpansion2:336"></a><a class="pred" href="consulting.html#term_expansion/2">term_expansion/2</a>, <a id="idx:termexpansion4:337"></a><a class="pred" href="consulting.html#term_expansion/4">term_expansion/4</a>, <a id="idx:goalexpansion2:338"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a>
302 <a id="idx:termexpansion2:337"></a><a class="pred" href="consulting.html#term_expansion/2">term_expansion/2</a>, <a id="idx:termexpansion4:338"></a><a class="pred" href="consulting.html#term_expansion/4">term_expansion/4</a>, <a id="idx:goalexpansion2:339"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a>
303303 and
304 <a id="idx:goalexpansion4:339"></a><a class="pred" href="consulting.html#goal_expansion/4">goal_expansion/4</a>.
305 It is not allowed to use <a id="idx:assert1:340"></a><a class="pred" href="db.html#assert/1">assert/1</a>, <a id="idx:retract1:341"></a><a class="pred" href="db.html#retract/1">retract/1</a>
306 or any other database predicate in <a id="idx:termexpansion2:342"></a><a class="pred" href="consulting.html#term_expansion/2">term_expansion/2</a>
307 other than for local computational purposes.<sup class="fn">39<span class="fn-text">It
308 does work for normal loading, but not for <a id="idx:qcompile1:343"></a><a class="pred" href="consulting.html#qcompile/1">qcompile/1</a>.</span></sup>
309 Code that needs to create additional clauses must use <a id="idx:compileauxclauses1:344"></a><a class="pred" href="consulting.html#compile_aux_clauses/1">compile_aux_clauses/1</a>.
304 <a id="idx:goalexpansion4:340"></a><a class="pred" href="consulting.html#goal_expansion/4">goal_expansion/4</a>.
305 It is not allowed to use <a id="idx:assert1:341"></a><a class="pred" href="db.html#assert/1">assert/1</a>, <a id="idx:retract1:342"></a><a class="pred" href="db.html#retract/1">retract/1</a>
306 or any other database predicate in <a id="idx:termexpansion2:343"></a><a class="pred" href="consulting.html#term_expansion/2">term_expansion/2</a>
307 other than for local computational purposes.<sup class="fn">40<span class="fn-text">It
308 does work for normal loading, but not for <a id="idx:qcompile1:344"></a><a class="pred" href="consulting.html#qcompile/1">qcompile/1</a>.</span></sup>
309 Code that needs to create additional clauses must use <a id="idx:compileauxclauses1:345"></a><a class="pred" href="consulting.html#compile_aux_clauses/1">compile_aux_clauses/1</a>.
310310 See <code>library(library(apply_macros))</code> for an example.
311311
312312 <p>A <em>directive</em> is an instruction to the compiler. Directives
313313 are used to set (predicate) properties (see <a class="sec" href="dynamic.html">section
314 4.14</a>), set flags (see <a id="idx:setprologflag2:345"></a><a class="pred" href="flags.html#set_prolog_flag/2">set_prolog_flag/2</a>)
314 4.14</a>), set flags (see <a id="idx:setprologflag2:346"></a><a class="pred" href="flags.html#set_prolog_flag/2">set_prolog_flag/2</a>)
315315 and load files (this section). Directives are terms of the form <code><code>:-</code></code> &lt;<var>term</var>&gt;.
316316 . Here are some examples:
317317
321321 store/2. % Name, Value
322322 </pre>
323323
324 <p>The directive <a id="idx:initialization1:346"></a><a class="pred" href="consulting.html#initialization/1">initialization/1</a>
324 <p>The directive <a id="idx:initialization1:347"></a><a class="pred" href="consulting.html#initialization/1">initialization/1</a>
325325 can be used to run arbitrary Prolog goals. The specified goal is started <em>after</em>
326326 loading the file in which it appears has completed.
327327
331331 appears. It also accepts <code><code>?-</code></code> &lt;<var>term</var>&gt;.
332332 as a synonym.
333333
334 <p><a id="idx:reconsult:347"></a>SWI-Prolog does not have a separate
334 <p><a id="idx:reconsult:348"></a>SWI-Prolog does not have a separate
335335 reconsult/1 predicate. Reconsulting is implied automatically by the fact
336336 that a file is consulted which is already loaded.
337337
341341 4.3.2.2</a>) and reloading running code (<a class="sec" href="consulting.html">section
342342 4.3.2.3</a>).
343343
344 <p>The core of the family of loading predicates is <a id="idx:loadfiles2:348"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>.
344 <p>The core of the family of loading predicates is <a id="idx:loadfiles2:349"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>.
345345 The predicates
346 <a id="idx:consult1:349"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>, <a id="idx:ensureloaded1:350"></a><a class="pred" href="consulting.html#ensure_loaded/1">ensure_loaded/1</a>, <a id="idx:usemodule1:351"></a><a class="pred" href="import.html#use_module/1">use_module/1</a>, <a id="idx:usemodule2:352"></a><a class="pred" href="import.html#use_module/2">use_module/2</a>
347 and <a id="idx:reexport1:353"></a><a class="pred" href="reexport.html#reexport/1">reexport/1</a>
348 pass the file argument directly to <a id="idx:loadfiles2:354"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>
346 <a id="idx:consult1:350"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>, <a id="idx:ensureloaded1:351"></a><a class="pred" href="consulting.html#ensure_loaded/1">ensure_loaded/1</a>, <a id="idx:usemodule1:352"></a><a class="pred" href="import.html#use_module/1">use_module/1</a>, <a id="idx:usemodule2:353"></a><a class="pred" href="import.html#use_module/2">use_module/2</a>
347 and <a id="idx:reexport1:354"></a><a class="pred" href="reexport.html#reexport/1">reexport/1</a>
348 pass the file argument directly to <a id="idx:loadfiles2:355"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>
349349 and pass additional options as expressed in the <a class="tab" href="consulting.html#tab:loadpreds">table
350350 4</a>:
351351
352352 <p><table class="latex frame-hsides center">
353353 <tr><td><b>Predicate</b></td><td align=center><b>if</b></td><td align=center><b>must_be_module</b></td><td align=center><b>import </b></td></tr>
354 <tr class="hline"><td><a id="idx:consult1:355"></a><a class="pred" href="consulting.html#consult/1">consult/1</a> </td><td align=center><code>true</code> </td><td align=center><code>false</code> </td><td align=center>all </td></tr>
355 <tr><td><a id="idx:ensureloaded1:356"></a><a class="pred" href="consulting.html#ensure_loaded/1">ensure_loaded/1</a> </td><td align=center><code>not_loaded</code> </td><td align=center><code>false</code> </td><td align=center>all </td></tr>
356 <tr><td><a id="idx:usemodule1:357"></a><a class="pred" href="import.html#use_module/1">use_module/1</a> </td><td align=center><code>not_loaded</code> </td><td align=center><code>true</code> </td><td align=center>all</td></tr>
357 <tr><td><a id="idx:usemodule2:358"></a><a class="pred" href="import.html#use_module/2">use_module/2</a> </td><td align=center><code>not_loaded</code> </td><td align=center><code>true</code> </td><td align=center>specified </td></tr>
358 <tr><td><a id="idx:reexport1:359"></a><a class="pred" href="reexport.html#reexport/1">reexport/1</a> </td><td align=center><code>not_loaded</code> </td><td align=center><code>true</code> </td><td align=center>all </td></tr>
359 <tr><td><a id="idx:reexport2:360"></a><a class="pred" href="reexport.html#reexport/2">reexport/2</a> </td><td align=center><code>not_loaded</code> </td><td align=center><code>true</code> </td><td align=center>specified </td></tr>
354 <tr class="hline"><td><a id="idx:consult1:356"></a><a class="pred" href="consulting.html#consult/1">consult/1</a> </td><td align=center><code>true</code> </td><td align=center><code>false</code> </td><td align=center>all </td></tr>
355 <tr><td><a id="idx:ensureloaded1:357"></a><a class="pred" href="consulting.html#ensure_loaded/1">ensure_loaded/1</a> </td><td align=center><code>not_loaded</code> </td><td align=center><code>false</code> </td><td align=center>all </td></tr>
356 <tr><td><a id="idx:usemodule1:358"></a><a class="pred" href="import.html#use_module/1">use_module/1</a> </td><td align=center><code>not_loaded</code> </td><td align=center><code>true</code> </td><td align=center>all</td></tr>
357 <tr><td><a id="idx:usemodule2:359"></a><a class="pred" href="import.html#use_module/2">use_module/2</a> </td><td align=center><code>not_loaded</code> </td><td align=center><code>true</code> </td><td align=center>specified </td></tr>
358 <tr><td><a id="idx:reexport1:360"></a><a class="pred" href="reexport.html#reexport/1">reexport/1</a> </td><td align=center><code>not_loaded</code> </td><td align=center><code>true</code> </td><td align=center>all </td></tr>
359 <tr><td><a id="idx:reexport2:361"></a><a class="pred" href="reexport.html#reexport/2">reexport/2</a> </td><td align=center><code>not_loaded</code> </td><td align=center><code>true</code> </td><td align=center>specified </td></tr>
360360 </table>
361361 <div class="caption"><b>Table 4 : </b>Properties of the file-loading
362362 predicates. The <i>import</i> column specifies what is imported if the
366366 <dl class="latex">
367367 <dt class="pubdef"><a id="load_files/1"><strong>load_files</strong>(<var>:Files</var>)</a></dt>
368368 <dd class="defbody">
369 Equivalent to <code>load_files(Files,[])</code>. Same as <a id="idx:consult1:361"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>,
370 See <a id="idx:loadfiles2:362"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>
369 Equivalent to <code>load_files(Files,[])</code>. Same as <a id="idx:consult1:362"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>,
370 See <a id="idx:loadfiles2:363"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>
371371 for supported options.
372372 </dd>
373373 <dt class="pubdef"><a id="load_files/2"><strong>load_files</strong>(<var>:Files,
374374 +Options</var>)</a></dt>
375375 <dd class="defbody">
376 The predicate <a id="idx:loadfiles2:363"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>
377 is the parent of all the other loading predicates except for <a id="idx:include1:364"></a><a class="pred" href="consulting.html#include/1">include/1</a>.
378 It currently supports a subset of the options of Quintus <a id="idx:loadfiles2:365"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>. <var>Files</var>
376 The predicate <a id="idx:loadfiles2:364"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>
377 is the parent of all the other loading predicates except for <a id="idx:include1:365"></a><a class="pred" href="consulting.html#include/1">include/1</a>.
378 It currently supports a subset of the options of Quintus <a id="idx:loadfiles2:366"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>. <var>Files</var>
379379 is either a single source file or a list of source files. The
380 specification for a source file is handed to <a id="idx:absolutefilename2:366"></a><a class="pred" href="files.html#absolute_file_name/2">absolute_file_name/2</a>.
380 specification for a source file is handed to <a id="idx:absolutefilename2:367"></a><a class="pred" href="files.html#absolute_file_name/2">absolute_file_name/2</a>.
381381 See this predicate for the supported expansions. <var>Options</var> is a
382382 list of options using the format <var>OptionName</var>(<var>OptionValue</var>).
383383
391391 <em>demand</em> load. This implies that, depending on the setting of the
392392 Prolog flag <a class="flag" href="flags.html#flag:verbose_autoload">verbose_autoload</a>,
393393 the load action is printed at level <code>informational</code> or <code>silent</code>.
394 See also <a id="idx:printmessage2:367"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>
395 and <a id="idx:currentprologflag2:368"></a><a class="pred" href="flags.html#current_prolog_flag/2">current_prolog_flag/2</a>.</dd>
394 See also <a id="idx:printmessage2:368"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>
395 and <a id="idx:currentprologflag2:369"></a><a class="pred" href="flags.html#current_prolog_flag/2">current_prolog_flag/2</a>.</dd>
396396 <dt><strong>derived_from</strong>(<var>File</var>)</dt>
397397 <dd class="defbody">
398398 Indicate that the loaded file is derived from <var>File</var>. Used by
399 <a id="idx:make0:369"></a><a class="pred" href="consulting.html#make/0">make/0</a>
399 <a id="idx:make0:370"></a><a class="pred" href="consulting.html#make/0">make/0</a>
400400 to time-check and load the original file rather than the derived file.</dd>
401401 <dt><strong>dialect</strong>(<var>+Dialect</var>)</dt>
402402 <dd class="defbody">
403403 Load <var>Files</var> with enhanced compatibility with the target Prolog
404 system identified by <var>Dialect</var>. See <a id="idx:expectsdialect1:370"></a><a class="pred" href="dialect.html#expects_dialect/1">expects_dialect/1</a>
404 system identified by <var>Dialect</var>. See <a id="idx:expectsdialect1:371"></a><a class="pred" href="dialect.html#expects_dialect/1">expects_dialect/1</a>
405405 and
406406 <a class="sec" href="dialect.html">section C</a> for details.</dd>
407407 <dt><strong>encoding</strong>(<var>Encoding</var>)</dt>
411411 See <a class="sec" href="widechars.html">section 2.18.1</a> for details.</dd>
412412 <dt><strong>expand</strong>(<var>Bool</var>)</dt>
413413 <dd class="defbody">
414 If <code>true</code>, run the filenames through <a id="idx:expandfilename2:371"></a><a class="pred" href="files.html#expand_file_name/2">expand_file_name/2</a>
415 and load the returned files. Default is <code>false</code>, except for <a id="idx:consult1:372"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>
414 If <code>true</code>, run the filenames through <a id="idx:expandfilename2:372"></a><a class="pred" href="files.html#expand_file_name/2">expand_file_name/2</a>
415 and load the returned files. Default is <code>false</code>, except for <a id="idx:consult1:373"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>
416416 which is intended for interactive use. Flexible location of files is
417 defined by <a id="idx:filesearchpath2:373"></a><a class="pred" href="consulting.html#file_search_path/2">file_search_path/2</a>.</dd>
417 defined by <a id="idx:filesearchpath2:374"></a><a class="pred" href="consulting.html#file_search_path/2">file_search_path/2</a>.</dd>
418418 <dt><strong>format</strong>(<var>+Format</var>)</dt>
419419 <dd class="defbody">
420420 Used to specify the file format if data is loaded from a stream using
421421 the <code>stream(Stream)</code> option. Default is <code>source</code>,
422 loading Prolog source text. If <code>qlf</code>, load QLF data (see <a id="idx:qcompile1:374"></a><a class="pred" href="consulting.html#qcompile/1">qcompile/1</a>).</dd>
422 loading Prolog source text. If <code>qlf</code>, load QLF data (see <a id="idx:qcompile1:375"></a><a class="pred" href="consulting.html#qcompile/1">qcompile/1</a>).</dd>
423423 <dt><strong>if</strong>(<var>Condition</var>)</dt>
424424 <dd class="defbody">
425425 Load the file only if the specified condition is satisfied. The value
430430 <dt><strong>imports</strong>(<var>Import</var>)</dt>
431431 <dd class="defbody">
432432 Specify what to import from the loaded module. The default for
433 <a id="idx:usemodule1:375"></a><a class="pred" href="import.html#use_module/1">use_module/1</a>
433 <a id="idx:usemodule1:376"></a><a class="pred" href="import.html#use_module/1">use_module/1</a>
434434 is <code>all</code>. <var>Import</var> is passed from the second
435 argument of <a id="idx:usemodule2:376"></a><a class="pred" href="import.html#use_module/2">use_module/2</a>.
435 argument of <a id="idx:usemodule2:377"></a><a class="pred" href="import.html#use_module/2">use_module/2</a>.
436436 Traditionally it is a list of predicate indicators to import. As part of
437437 the SWI-Prolog/YAP integration, we also support <var>Pred</var> as <var>Name</var>
438438 to import a predicate under another name. Finally, <var>Import</var> can
439439 be the term <code>except(Exceptions)</code>, where <var>Exceptions</var>
440440 is a list of predicate indicators that specify predicates that are <em>not</em>
441441 imported or <var>Pred</var> as <var>Name</var> terms to denote renamed
442 predicates. See also <a id="idx:reexport2:377"></a><a class="pred" href="reexport.html#reexport/2">reexport/2</a>
442 predicates. See also <a id="idx:reexport2:378"></a><a class="pred" href="reexport.html#reexport/2">reexport/2</a>
443443 and
444 <a id="idx:usemodule2:378"></a><a class="pred" href="import.html#use_module/2">use_module/2</a>.<sup class="fn">bug<span class="fn-text"><var>Name</var>/<var>Arity</var>
444 <a id="idx:usemodule2:379"></a><a class="pred" href="import.html#use_module/2">use_module/2</a>.<sup class="fn">bug<span class="fn-text"><var>Name</var>/<var>Arity</var>
445445 as <var>NewName</var> is currently implemented using a <em>link clause</em>.
446446 This harms efficiency and does not allow for querying the relation
447 through <a id="idx:predicateproperty2:379"></a><a class="pred" href="examineprog.html#predicate_property/2">predicate_property/2</a>.</span></sup>
447 through <a id="idx:predicateproperty2:380"></a><a class="pred" href="examineprog.html#predicate_property/2">predicate_property/2</a>.</span></sup>
448448
449449 <p>If <var>Import</var> equals <code>all</code>, all operators are
450450 imported as well. Otherwise, operators are <em>not</em> imported.
473473 <dd class="defbody">
474474 If <code>true</code>, raise an error if the file is not a module file.
475475 Used by
476 <a id="idx:usemodule12:380"></a><span class="pred-ext">use_module/[1,2]</span>.</dd>
476 <a id="idx:usemodule12:381"></a><span class="pred-ext">use_module/[1,2]</span>.</dd>
477477 <dt><strong>qcompile</strong>(<var>Atom</var>)</dt>
478478 <dd class="defbody">
479 How to deal with quick-load-file compilation by <a id="idx:qcompile1:381"></a><a class="pred" href="consulting.html#qcompile/1">qcompile/1</a>.
479 How to deal with quick-load-file compilation by <a id="idx:qcompile1:382"></a><a class="pred" href="consulting.html#qcompile/1">qcompile/1</a>.
480480 Values are:
481481
482482 <dl class="latex">
495495 </dd>
496496 <dt><strong>part</strong></dt>
497497 <dd class="defbody">
498 If this <a id="idx:loadfile2:382"></a><span class="pred-ext">load_file/2</span>
498 If this <a id="idx:loadfile2:383"></a><span class="pred-ext">load_file/2</span>
499499 appears in a directive of a file that is compiled into Quick Load Format
500 using <a id="idx:qcompile1:383"></a><a class="pred" href="consulting.html#qcompile/1">qcompile/1</a>,
500 using <a id="idx:qcompile1:384"></a><a class="pred" href="consulting.html#qcompile/1">qcompile/1</a>,
501501 the contents of the argument files are included in the <code>.qlf</code>
502502 file instead of the loading directive.
503503 </dd>
510510 Defines what to do if a file is loaded that provides a module that is
511511 already loaded from another file. <var>Action</var> is one of <code>false</code>
512512 (default), which prints an error and refuses to load the file, or
513 <code>true</code>, which uses <a id="idx:unloadfile1:384"></a><a class="pred" href="consulting.html#unload_file/1">unload_file/1</a>
513 <code>true</code>, which uses <a id="idx:unloadfile1:385"></a><a class="pred" href="consulting.html#unload_file/1">unload_file/1</a>
514514 on the old file and then proceeds loading the new file. Finally, there
515515 is <code>ask</code>, which starts interaction with the user. <code>ask</code>
516516 is only provided if the stream <code>user_input</code> is associated
517517 with a terminal.</dd>
518518 <dt><strong>reexport</strong>(<var>Bool</var>)</dt>
519519 <dd class="defbody">
520 If <code>true</code> re-export the imported predicate. Used by <a id="idx:reexport1:385"></a><a class="pred" href="reexport.html#reexport/1">reexport/1</a>
521 and <a id="idx:reexport2:386"></a><a class="pred" href="reexport.html#reexport/2">reexport/2</a>.</dd>
520 If <code>true</code> re-export the imported predicate. Used by <a id="idx:reexport1:386"></a><a class="pred" href="reexport.html#reexport/1">reexport/1</a>
521 and <a id="idx:reexport2:387"></a><a class="pred" href="reexport.html#reexport/2">reexport/2</a>.</dd>
522522 <dt><strong>register</strong>(<var>Bool</var>)</dt>
523523 <dd class="defbody">
524524 If <code>false</code>, do not register the load location and options.
525 This option is used by <a id="idx:make0:387"></a><a class="pred" href="consulting.html#make/0">make/0</a>
526 and <a id="idx:loadhotfixes1:388"></a><span class="pred-ext">load_hotfixes/1</span>
527 to avoid polluting the load-context database. See <a id="idx:sourcefileproperty2:389"></a><a class="pred" href="consulting.html#source_file_property/2">source_file_property/2</a>.</dd>
525 This option is used by <a id="idx:make0:388"></a><a class="pred" href="consulting.html#make/0">make/0</a>
526 and <a id="idx:loadhotfixes1:389"></a><span class="pred-ext">load_hotfixes/1</span>
527 to avoid polluting the load-context database. See <a id="idx:sourcefileproperty2:390"></a><a class="pred" href="consulting.html#source_file_property/2">source_file_property/2</a>.</dd>
528528 <dt><strong>sandboxed</strong>(<var>Bool</var>)</dt>
529529 <dd class="defbody">
530530 Load the file in <em>sandboxed</em> mode. This option controls the flag <a class="flag" href="flags.html#flag:sandboxed_load">sandboxed_load</a>.
533533 Prolog flag is set to <code>true</code> raises a permission error.</dd>
534534 <dt><strong>scope_settings</strong>(<var>Bool</var>)</dt>
535535 <dd class="defbody">
536 Scope <a id="idx:stylecheck1:390"></a><a class="pred" href="debugger.html#style_check/1">style_check/1</a>
537 and <a id="idx:expectsdialect1:391"></a><a class="pred" href="dialect.html#expects_dialect/1">expects_dialect/1</a>
536 Scope <a id="idx:stylecheck1:391"></a><a class="pred" href="debugger.html#style_check/1">style_check/1</a>
537 and <a id="idx:expectsdialect1:392"></a><a class="pred" href="dialect.html#expects_dialect/1">expects_dialect/1</a>
538538 to the file and files loaded from the file after the directive. Default
539539 is <code>true</code>. The system and user initialization files (see <strong>-f</strong>
540540 and
554554 clauses as well as to remove all clauses if the data is reconsulted.
555555
556556 <p>This option is added to allow compiling from non-file locations such
557 as databases, the web, the <em>user</em> (see <a id="idx:consult1:392"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>)
557 as databases, the web, the <em>user</em> (see <a id="idx:consult1:393"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>)
558558 or other servers. It can be combined with <code>format(qlf)</code> to
559559 load QLF data from a stream.
560560 </dd>
561561 </dl>
562562
563 <p>The <a id="idx:loadfiles2:393"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>
563 <p>The <a id="idx:loadfiles2:394"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>
564564 predicate can be hooked to load other data or data from objects other
565 than files. See <a id="idx:prologloadfile2:394"></a><a class="pred" href="loadfilehook.html#prolog_load_file/2">prolog_load_file/2</a>
565 than files. See <a id="idx:prologloadfile2:395"></a><a class="pred" href="loadfilehook.html#prolog_load_file/2">prolog_load_file/2</a>
566566 for a description and
567 <code>library(http/http_load)</code> for an example. All hooks for <a id="idx:loadfiles2:395"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>
567 <code>library(http/http_load)</code> for an example. All hooks for <a id="idx:loadfiles2:396"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>
568568 are documented in <a class="sec" href="loadfilehook.html">section B.8</a>.</dd>
569569 <dt class="pubdef"><a id="consult/1"><strong>consult</strong>(<var>:File</var>)</a></dt>
570570 <dd class="defbody">
571 Read <var>File</var> as a Prolog source file. Calls to <a id="idx:consult1:396"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>
571 Read <var>File</var> as a Prolog source file. Calls to <a id="idx:consult1:397"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>
572572 may be abbreviated by just typing a number of filenames in a list.
573573 Examples:
574574
579579 <tr><td><code>?- [user].</code> </td><td>% Type program on the terminal </td></tr>
580580 </table>
581581
582 <p>The predicate <a id="idx:consult1:397"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>
582 <p>The predicate <a id="idx:consult1:398"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>
583583 is equivalent to <code>load_files(File, [])</code>, except for handling
584584 the special file <code>user</code>, which reads clauses from the
585585 terminal. See also the <code>stream(Input)</code> option of
586 <a id="idx:loadfiles2:398"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>.
586 <a id="idx:loadfiles2:399"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>.
587587 Abbreviation using <code>?- [file1,file2].</code> does
588588 <em>not</em> work for the empty list (<code>[]</code>). This facility is
589589 implemented by defining the list as a predicate. Applications may only
591591 directives.</dd>
592592 <dt class="pubdef"><a id="ensure_loaded/1"><strong>ensure_loaded</strong>(<var>:File</var>)</a></dt>
593593 <dd class="defbody">
594 If the file is not already loaded, this is equivalent to <a id="idx:consult1:399"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>.
594 If the file is not already loaded, this is equivalent to <a id="idx:consult1:400"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>.
595595 Otherwise, if the file defines a module, import all public predicates.
596596 Finally, if the file is already loaded, is not a module file, and the
597 context module is not the global user module, <a id="idx:ensureloaded1:400"></a><a class="pred" href="consulting.html#ensure_loaded/1">ensure_loaded/1</a>
598 will call <a id="idx:consult1:401"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>.
597 context module is not the global user module, <a id="idx:ensureloaded1:401"></a><a class="pred" href="consulting.html#ensure_loaded/1">ensure_loaded/1</a>
598 will call <a id="idx:consult1:402"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>.
599599
600600 <p>With this semantics, we hope to get as close as possible to the clear
601601 semantics without the presence of a module system. Applications using
602 modules should consider using <a id="idx:usemodule12:402"></a><span class="pred-ext">use_module/[1,2]</span>.
603
604 <p>Equivalent to <code>load_files(Files, [if(not_loaded)]).</code><sup class="fn">40<span class="fn-text">On
602 modules should consider using <a id="idx:usemodule12:403"></a><span class="pred-ext">use_module/[1,2]</span>.
603
604 <p>Equivalent to <code>load_files(Files, [if(not_loaded)]).</code><sup class="fn">41<span class="fn-text">On
605605 older versions the condition used to be <code>if(changed)</code>. Poor
606 time management on some machines or copying often caused problems. The <a id="idx:make0:403"></a><a class="pred" href="consulting.html#make/0">make/0</a>
606 time management on some machines or copying often caused problems. The <a id="idx:make0:404"></a><a class="pred" href="consulting.html#make/0">make/0</a>
607607 predicate deals with updating the running system after changing the
608608 source code.</span></sup></dd>
609609 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="include/1"><strong>include</strong>(<var>+File</var>)</a></dt>
613613 <em>directive</em> <code>:- include(File).</code> appears. The include
614614 construct is only honoured if it appears as a directive in a source
615615 file. <em>Textual</em> include (similar to C/C++ #include) is obviously
616 useful for sharing declarations such as <a id="idx:dynamic1:404"></a><a class="pred" href="dynamic.html#dynamic/1">dynamic/1</a>
616 useful for sharing declarations such as <a id="idx:dynamic1:405"></a><a class="pred" href="dynamic.html#dynamic/1">dynamic/1</a>
617617 or
618 <a id="idx:multifile1:405"></a><a class="pred" href="dynamic.html#multifile/1">multifile/1</a>
618 <a id="idx:multifile1:406"></a><a class="pred" href="dynamic.html#multifile/1">multifile/1</a>
619619 by including a file with directives from multiple files that use these
620620 predicates.
621621
622622 <p>Textual including files that contain clauses is less obvious.
623623 Normally, in SWI-Prolog, clauses are <em>owned</em> by the file in which
624624 they are defined. This information is used to <em>replace</em> the old
625 definition after the file has beeen modified and is reloaded by, e.g., <a id="idx:make0:406"></a><a class="pred" href="consulting.html#make/0">make/0</a>.
626 As we understand it, <a id="idx:include1:407"></a><a class="pred" href="consulting.html#include/1">include/1</a>
625 definition after the file has beeen modified and is reloaded by, e.g., <a id="idx:make0:407"></a><a class="pred" href="consulting.html#make/0">make/0</a>.
626 As we understand it, <a id="idx:include1:408"></a><a class="pred" href="consulting.html#include/1">include/1</a>
627627 is intended to include the same file multiple times. Including a file
628628 holding clauses multiple times into the same module is rather
629629 meaningless as it just duplicates the same clauses. Including a file
630630 holding clauses in multiple modules does not suffer from this problem,
631 but leads to multiple equivalent <em>copies</em> of predicates. Using <a id="idx:usemodule1:408"></a><a class="pred" href="import.html#use_module/1">use_module/1</a>
631 but leads to multiple equivalent <em>copies</em> of predicates. Using <a id="idx:usemodule1:409"></a><a class="pred" href="import.html#use_module/1">use_module/1</a>
632632 can achieve the same result while
633633 <em>sharing</em> the predicates.
634634
635 <p>Despite these observations, various projects seem to be using <a id="idx:include1:409"></a><a class="pred" href="consulting.html#include/1">include/1</a>
635 <p>Despite these observations, various projects seem to be using <a id="idx:include1:410"></a><a class="pred" href="consulting.html#include/1">include/1</a>
636636 to load files holding clauses, typically loading them only once. Such
637 usage would allow replacement by, e.g., <a id="idx:consult1:410"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>.
638 Unfortunately, the same project might use <a id="idx:include1:411"></a><a class="pred" href="consulting.html#include/1">include/1</a>
639 to share directives. Another example of a limitation of mapping to <a id="idx:consult1:412"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>
637 usage would allow replacement by, e.g., <a id="idx:consult1:411"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>.
638 Unfortunately, the same project might use <a id="idx:include1:412"></a><a class="pred" href="consulting.html#include/1">include/1</a>
639 to share directives. Another example of a limitation of mapping to <a id="idx:consult1:413"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>
640640 is that if the clauses of a predicate are distributed over two included
641 files, <a id="idx:discontiguous1:413"></a><a class="pred" href="dynamic.html#discontiguous/1">discontiguous/1</a>
641 files, <a id="idx:discontiguous1:414"></a><a class="pred" href="dynamic.html#discontiguous/1">discontiguous/1</a>
642642 is appropriate, while if they are distributed over two consulted files,
643 one must use <a id="idx:multifile1:414"></a><a class="pred" href="dynamic.html#multifile/1">multifile/1</a>.
643 one must use <a id="idx:multifile1:415"></a><a class="pred" href="dynamic.html#multifile/1">multifile/1</a>.
644644
645645 <p>To accommodate included files holding clauses, SWI-Prolog
646646 distinguishes between the source location of a clause (in this case the
647647 included file) and the <em>owner</em> of a clause (the file that
648648 includes the file holding the clause). The source location is used by,
649 e.g., <a id="idx:edit1:415"></a><a class="pred" href="edit.html#edit/1">edit/1</a>,
649 e.g., <a id="idx:edit1:416"></a><a class="pred" href="edit.html#edit/1">edit/1</a>,
650650 the graphical tracer, etc., while the owner is used to determine which
651651 clauses are removed if the file is modified. Relevant information is
652652 found with the following predicates:
653653
654654 <p>
655655 <ul class="latex">
656 <li><a id="idx:sourcefile2:416"></a><a class="pred" href="consulting.html#source_file/2">source_file/2</a>
656 <li><a id="idx:sourcefile2:417"></a><a class="pred" href="consulting.html#source_file/2">source_file/2</a>
657657 describes the owner relation.
658 <li><a id="idx:predicateproperty2:417"></a><a class="pred" href="examineprog.html#predicate_property/2">predicate_property/2</a>
658 <li><a id="idx:predicateproperty2:418"></a><a class="pred" href="examineprog.html#predicate_property/2">predicate_property/2</a>
659659 describes the source location (of the first clause).
660 <li><a id="idx:clauseproperty2:418"></a><a class="pred" href="examineprog.html#clause_property/2">clause_property/2</a>
660 <li><a id="idx:clauseproperty2:419"></a><a class="pred" href="examineprog.html#clause_property/2">clause_property/2</a>
661661 provides access to both source and ownership.
662 <li><a id="idx:sourcefileproperty2:419"></a><a class="pred" href="consulting.html#source_file_property/2">source_file_property/2</a>
662 <li><a id="idx:sourcefileproperty2:420"></a><a class="pred" href="consulting.html#source_file_property/2">source_file_property/2</a>
663663 can be used to query include relationships between files.
664664 </ul>
665665 </dd>
677677
678678 <p>SWI-Prolog, having autoloading, does <b>not</b> load the library.
679679 Instead it creates a procedure header for the predicate if it does not
680 exist. This will flag the predicate as `undefined'. See also <a id="idx:check0:420"></a><a class="pred" href="check.html#check/0">check/0</a>
680 exist. This will flag the predicate as `undefined'. See also <a id="idx:check0:421"></a><a class="pred" href="check.html#check/0">check/0</a>
681681 and
682 <a id="idx:autoload0:421"></a><a class="pred" href="runtime.html#autoload/0">autoload/0</a>.</dd>
682 <a id="idx:autoload0:422"></a><a class="pred" href="runtime.html#autoload/0">autoload/0</a>.</dd>
683683 <dt class="pubdef"><a id="encoding/1"><strong>encoding</strong>(<var>+Encoding</var>)</a></dt>
684684 <dd class="defbody">
685685 This directive can appear anywhere in a source file to define how
692692 Consult all source files that have been changed since they were
693693 consulted. It checks <var>all</var> loaded source files: files loaded
694694 into a compiled state using <code>pl -c ...</code> and files loaded
695 using <a id="idx:consult1:422"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>
696 or one of its derivatives. The predicate <a id="idx:make0:423"></a><a class="pred" href="consulting.html#make/0">make/0</a>
695 using <a id="idx:consult1:423"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>
696 or one of its derivatives. The predicate <a id="idx:make0:424"></a><a class="pred" href="consulting.html#make/0">make/0</a>
697697 is called after
698 <a id="idx:edit1:424"></a><a class="pred" href="edit.html#edit/1">edit/1</a>,
698 <a id="idx:edit1:425"></a><a class="pred" href="edit.html#edit/1">edit/1</a>,
699699 automatically reloading all modified files. If the user uses an external
700 editor (in a separate window), <a id="idx:make0:425"></a><a class="pred" href="consulting.html#make/0">make/0</a>
701 is normally used to update the program after editing. In addition, <a id="idx:make0:426"></a><a class="pred" href="consulting.html#make/0">make/0</a>
700 editor (in a separate window), <a id="idx:make0:426"></a><a class="pred" href="consulting.html#make/0">make/0</a>
701 is normally used to update the program after editing. In addition, <a id="idx:make0:427"></a><a class="pred" href="consulting.html#make/0">make/0</a>
702702 updates the autoload indices (see <a class="sec" href="autoload.html">section
703 2.13</a>) and runs <a id="idx:listundefined0:427"></a><a class="pred" href="check.html#list_undefined/0">list_undefined/0</a>
703 2.13</a>) and runs <a id="idx:listundefined0:428"></a><a class="pred" href="check.html#list_undefined/0">list_undefined/0</a>
704704 from the <code>library(check)</code> library to report on undefined
705705 predicates.</dd>
706706 <dt class="pubdef"><a id="library_directory/1"><strong>library_directory</strong>(<var>?Atom</var>)</a></dt>
708708 Dynamic predicate used to specify library directories. Default
709709 <code>./lib</code>, <code> /lib/prolog</code> and the system's library
710710 (in this order) are defined. The user may add library directories using
711 <a id="idx:assertz1:428"></a><a class="pred" href="db.html#assertz/1">assertz/1</a>, <a id="idx:asserta1:429"></a><a class="pred" href="db.html#asserta/1">asserta/1</a>
712 or remove system defaults using <a id="idx:retract1:430"></a><a class="pred" href="db.html#retract/1">retract/1</a>.
713 Deprecated. New code should use <a id="idx:filesearchpath2:431"></a><a class="pred" href="consulting.html#file_search_path/2">file_search_path/2</a>.</dd>
711 <a id="idx:assertz1:429"></a><a class="pred" href="db.html#assertz/1">assertz/1</a>, <a id="idx:asserta1:430"></a><a class="pred" href="db.html#asserta/1">asserta/1</a>
712 or remove system defaults using <a id="idx:retract1:431"></a><a class="pred" href="db.html#retract/1">retract/1</a>.
713 Deprecated. New code should use <a id="idx:filesearchpath2:432"></a><a class="pred" href="consulting.html#file_search_path/2">file_search_path/2</a>.</dd>
714714 <dt class="pubdef"><a id="file_search_path/2"><strong>file_search_path</strong>(<var>+Alias,
715715 ?Path</var>)</a></dt>
716716 <dd class="defbody">
723723
724724 <p>the file specification <code>demo(myfile)</code> will be expanded to
725725 <code>/usr/lib/prolog/demo/myfile</code>. The second argument of
726 <a id="idx:filesearchpath2:432"></a><a class="pred" href="consulting.html#file_search_path/2">file_search_path/2</a>
726 <a id="idx:filesearchpath2:433"></a><a class="pred" href="consulting.html#file_search_path/2">file_search_path/2</a>
727727 may be another alias.
728728
729729 <p>Below is the initial definition of the file search path. This path
731731 in the SWI-Prolog home directory. The alias <code>foreign(&lt;<var>Path</var>&gt;)</code>
732732 is intended for storing shared libraries (<code>.so</code> or <code>.DLL</code>
733733 files). See also
734 <a id="idx:useforeignlibrary1:433"></a><a class="pred" href="foreignlink.html#use_foreign_library/1">use_foreign_library/1</a>.
734 <a id="idx:useforeignlibrary1:434"></a><a class="pred" href="foreignlink.html#use_foreign_library/1">use_foreign_library/1</a>.
735735
736736 <pre class="code">
737737 user:file_search_path(library, X) :-
751751 member(Dir, Dirs).
752752 </pre>
753753
754 <p>The <a id="idx:filesearchpath2:434"></a><a class="pred" href="consulting.html#file_search_path/2">file_search_path/2</a>
755 expansion is used by all loading predicates as well as by <a id="idx:absolutefilename23:435"></a><span class="pred-ext">absolute_file_name/[2,3]</span>.
754 <p>The <a id="idx:filesearchpath2:435"></a><a class="pred" href="consulting.html#file_search_path/2">file_search_path/2</a>
755 expansion is used by all loading predicates as well as by <a id="idx:absolutefilename23:436"></a><span class="pred-ext">absolute_file_name/[2,3]</span>.
756756
757757 <p>The Prolog flag <a class="flag" href="flags.html#flag:verbose_file_search">verbose_file_search</a>
758758 can be set to <code>true</code> to help debugging Prolog's search for
761761 -Path</var>)</a></dt>
762762 <dd class="defbody">
763763 Unifies <var>Path</var> with all possible expansions of the filename
764 specification <var>Spec</var>. See also <a id="idx:absolutefilename3:436"></a><a class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</a>.</dd>
764 specification <var>Spec</var>. See also <a id="idx:absolutefilename3:437"></a><a class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</a>.</dd>
765765 <dt class="pubdef"><a id="prolog_file_type/2"><strong>prolog_file_type</strong>(<var>?Extension,
766766 ?Type</var>)</a></dt>
767767 <dd class="defbody">
768768 This dynamic multifile predicate defined in module <code>user</code>
769 determines the extensions considered by <a id="idx:filesearchpath2:437"></a><a class="pred" href="consulting.html#file_search_path/2">file_search_path/2</a>.
769 determines the extensions considered by <a id="idx:filesearchpath2:438"></a><a class="pred" href="consulting.html#file_search_path/2">file_search_path/2</a>.
770770 <var>Extension</var> is the filename extension without the leading dot,
771771 and
772772 <var>Type</var> denotes the type as used by the <code>file_type(Type)</code>
773 option of <a id="idx:filesearchpath2:438"></a><a class="pred" href="consulting.html#file_search_path/2">file_search_path/2</a>.
773 option of <a id="idx:filesearchpath2:439"></a><a class="pred" href="consulting.html#file_search_path/2">file_search_path/2</a>.
774774 Here is the initial definition of
775 <a id="idx:prologfiletype2:439"></a><a class="pred" href="consulting.html#prolog_file_type/2">prolog_file_type/2</a>:
775 <a id="idx:prologfiletype2:440"></a><a class="pred" href="consulting.html#prolog_file_type/2">prolog_file_type/2</a>:
776776
777777 <pre class="code">
778778 user:prolog_file_type(pl, prolog).
798798 <dd class="defbody">
799799 True if the predicate specified by <var>Pred</var> is owned by file
800800 <var>File</var>, where <var>File</var> is an absolute path name (see
801 <a id="idx:absolutefilename2:440"></a><a class="pred" href="files.html#absolute_file_name/2">absolute_file_name/2</a>).
801 <a id="idx:absolutefilename2:441"></a><a class="pred" href="files.html#absolute_file_name/2">absolute_file_name/2</a>).
802802 Can be used with any instantiation pattern, but the database only
803803 maintains the source file for each predicate. If
804804 <var>Pred</var> is a <em>multifile</em> predicate this predicate
805 succeeds for all files that contribute clauses to <var>Pred</var>.<sup class="fn">41<span class="fn-text">The
805 succeeds for all files that contribute clauses to <var>Pred</var>.<sup class="fn">42<span class="fn-text">The
806806 current implementation performs a linear scan through all clauses to
807 establish this set of files.</span></sup> See also <a id="idx:clauseproperty2:441"></a><a class="pred" href="examineprog.html#clause_property/2">clause_property/2</a>.
807 establish this set of files.</span></sup> See also <a id="idx:clauseproperty2:442"></a><a class="pred" href="examineprog.html#clause_property/2">clause_property/2</a>.
808808 Note that the relation between files and predicates is more complicated
809 if <a id="idx:include1:442"></a><a class="pred" href="consulting.html#include/1">include/1</a>
809 if <a id="idx:include1:443"></a><a class="pred" href="consulting.html#include/1">include/1</a>
810810 is used. The predicate describes the <em>owner</em> of the predicate.
811811 See
812 <a id="idx:include1:443"></a><a class="pred" href="consulting.html#include/1">include/1</a>
812 <a id="idx:include1:444"></a><a class="pred" href="consulting.html#include/1">include/1</a>
813813 for details.</dd>
814814 <dt class="pubdef"><a id="source_file_property/2"><strong>source_file_property</strong>(<var>?File,
815815 ?Property</var>)</a></dt>
816816 <dd class="defbody">
817817 True when <var>Property</var> is a property of the loaded file <var>File</var>.
818818 If <var>File</var> is non-var, it can be a file specification that is
819 valid for <a id="idx:loadfiles2:444"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>.
819 valid for <a id="idx:loadfiles2:445"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>.
820820 Defined properties are:
821821
822822 <dl class="latex">
826826 was last modified at time <var>OriginalModified</var> at the time it was
827827 loaded. This property is available if <var>File</var> was loaded using
828828 the
829 <code>derived_from(Original)</code> option to <a id="idx:loadfiles2:445"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>.</dd>
829 <code>derived_from(Original)</code> option to <a id="idx:loadfiles2:446"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>.</dd>
830830 <dt><strong>includes</strong>(<var>IncludedFile, IncludedFileModified</var>)</dt>
831831 <dd class="defbody">
832 <var>File</var> used <a id="idx:include1:446"></a><a class="pred" href="consulting.html#include/1">include/1</a>
832 <var>File</var> used <a id="idx:include1:447"></a><a class="pred" href="consulting.html#include/1">include/1</a>
833833 to include <var>IncludedFile</var>. The last modified time of <var>IncludedFile</var>
834834 was <var>IncludedFileModified</var> at the time it was included.</dd>
835835 <dt><strong>included_in</strong>(<var>MasterFile, Line</var>)</dt>
845845 the file was loaded. It is either a term &lt;<var>file</var>&gt;:&lt;<var>line</var>&gt;
846846 or the atom
847847 <code>user</code> if the file was loaded from the terminal or another
848 unknown source. <var>Options</var> are the options passed to <a id="idx:loadfiles2:447"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>.
849 Note that all predicates to load files are mapped to <a id="idx:loadfiles2:448"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>,
848 unknown source. <var>Options</var> are the options passed to <a id="idx:loadfiles2:448"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>.
849 Note that all predicates to load files are mapped to <a id="idx:loadfiles2:449"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>,
850850 using the option argument to specify the exact behaviour.</dd>
851851 <dt><strong>modified</strong>(<var>Stamp</var>)</dt>
852852 <dd class="defbody">
853853 File modification time when <var>File</var> was loaded. This is used by
854 <a id="idx:make0:449"></a><a class="pred" href="consulting.html#make/0">make/0</a>
854 <a id="idx:make0:450"></a><a class="pred" href="consulting.html#make/0">make/0</a>
855855 to find files whose modification time is different from when it was
856856 loaded.</dd>
857857 <dt><strong>module</strong>(<var>Module</var>)</dt>
866866 Remove all clauses loaded from <var>File</var>. If <var>File</var>
867867 loaded a module, clear the module's export list and disassociate it from
868868 the file. <var>File</var> is a canonical filename or a file indicator
869 that is valid for <a id="idx:loadfiles2:450"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>.
869 that is valid for <a id="idx:loadfiles2:451"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>.
870870
871871 <p>This predicate should be used with care. The multithreaded nature of
872872 SWI-Prolog makes removing static code unsafe. Attempts to do this should
878878 <dd class="defbody">
879879 Obtain context information during compilation. This predicate can be
880880 used from directives appearing in a source file to get information about
881 the file being loaded. See also <a id="idx:sourcelocation2:451"></a><a class="pred" href="consulting.html#source_location/2">source_location/2</a>
882 and <a id="idx:if1:452"></a><a class="pred" href="consulting.html#if/1">if/1</a>.
881 the file being loaded. See also <a id="idx:sourcelocation2:452"></a><a class="pred" href="consulting.html#source_location/2">source_location/2</a>
882 and <a id="idx:if1:453"></a><a class="pred" href="consulting.html#if/1">if/1</a>.
883883 The following keys are defined:
884884
885885 <p><table class="latex frame-box center">
893893 <tr><td><code>file</code> </td><td>Similar to <code>source</code>, but
894894 returns the file being included when called while an include file is
895895 being processed </td></tr>
896 <tr><td><code>stream</code> </td><td>Stream identifier (see <a id="idx:currentinput1:453"></a><a class="pred" href="IO.html#current_input/1">current_input/1</a>) </td></tr>
896 <tr><td><code>stream</code> </td><td>Stream identifier (see <a id="idx:currentinput1:454"></a><a class="pred" href="IO.html#current_input/1">current_input/1</a>) </td></tr>
897897 <tr><td><code>directory</code> </td><td>Directory in which <code>source</code>
898898 lives </td></tr>
899 <tr><td><code>dialect</code> </td><td>Compatibility mode. See <a id="idx:expectsdialect1:454"></a><a class="pred" href="dialect.html#expects_dialect/1">expects_dialect/1</a>. </td></tr>
899 <tr><td><code>dialect</code> </td><td>Compatibility mode. See <a id="idx:expectsdialect1:455"></a><a class="pred" href="dialect.html#expects_dialect/1">expects_dialect/1</a>. </td></tr>
900900 <tr><td><code>term_position</code> </td><td>Start position of last term
901901 read. See also
902 <a id="idx:streamproperty2:455"></a><a class="pred" href="IO.html#stream_property/2">stream_property/2</a>
902 <a id="idx:streamproperty2:456"></a><a class="pred" href="IO.html#stream_property/2">stream_property/2</a>
903903 (<code>position</code> property and
904 <a id="idx:streampositiondata3:456"></a><a class="pred" href="IO.html#stream_position_data/3">stream_position_data/3</a>.<sup class="fn">42<span class="fn-text">Up
904 <a id="idx:streampositiondata3:457"></a><a class="pred" href="IO.html#stream_position_data/3">stream_position_data/3</a>.<sup class="fn">43<span class="fn-text">Up
905905 to version 7.1.22, the position term carried fake data except for the <code>line_count</code>
906906 and had <b>five</b> arguments, where the position property of a stream
907907 only has <b>four</b>.</span></sup> </td></tr>
908908 <tr><td><code>variable_names</code></td><td>A list of `<var>Name</var> = <var>Var</var>'
909 of the last term read. See <a id="idx:readterm2:457"></a><a class="pred" href="termrw.html#read_term/2">read_term/2</a>
909 of the last term read. See <a id="idx:readterm2:458"></a><a class="pred" href="termrw.html#read_term/2">read_term/2</a>
910910 for details. </td></tr>
911911 <tr><td><code>script</code> </td><td>Boolean that indicates whether the
912912 file is loaded as a script file (see
913913 <strong>-s</strong>) </td></tr>
914914 </table>
915915
916 <p>The <code>directory</code> is commonly used to add rules to <a id="idx:filesearchpath2:458"></a><a class="pred" href="consulting.html#file_search_path/2">file_search_path/2</a>,
917 setting up a search path for finding files with <a id="idx:absolutefilename3:459"></a><a class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</a>.
916 <p>The <code>directory</code> is commonly used to add rules to <a id="idx:filesearchpath2:459"></a><a class="pred" href="consulting.html#file_search_path/2">file_search_path/2</a>,
917 setting up a search path for finding files with <a id="idx:absolutefilename3:460"></a><a class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</a>.
918918 For example:
919919
920920 <pre class="code">
937937 If the last term has been read from a physical file (i.e., not from the
938938 file <code>user</code> or a string), unify <var>File</var> with an
939939 absolute path to the file and <var>Line</var> with the line number in
940 the file. New code should use <a id="idx:prologloadcontext2:460"></a><a class="pred" href="consulting.html#prolog_load_context/2">prolog_load_context/2</a>.</dd>
940 the file. New code should use <a id="idx:prologloadcontext2:461"></a><a class="pred" href="consulting.html#prolog_load_context/2">prolog_load_context/2</a>.</dd>
941941 <dt class="pubdef"><a id="at_halt/1"><strong>at_halt</strong>(<var>:Goal</var>)</a></dt>
942942 <dd class="defbody">
943943 Register <var>Goal</var> to be run from <a class="func" href="foreigninclude.html#PL_cleanup()">PL_cleanup()</a>,
944944 which is called when the system halts. The hooks are run in the reverse
945945 order they were registered (FIFO). Success or failure executing a hook
946 is ignored. If the hook raises an exception this is printed using <a id="idx:printmessage2:461"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>.
947 An attempt to call <a id="idx:halt01:462"></a><span class="pred-ext">halt/[0,1]</span>
946 is ignored. If the hook raises an exception this is printed using <a id="idx:printmessage2:462"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>.
947 An attempt to call <a id="idx:halt01:463"></a><span class="pred-ext">halt/[0,1]</span>
948948 from a hook is ignored. Hooks may call
949 <a id="idx:cancelhalt1:463"></a><a class="pred" href="consulting.html#cancel_halt/1">cancel_halt/1</a>,
950 causing <a id="idx:halt0:464"></a><a class="pred" href="toplevel.html#halt/0">halt/0</a>
949 <a id="idx:cancelhalt1:464"></a><a class="pred" href="consulting.html#cancel_halt/1">cancel_halt/1</a>,
950 causing <a id="idx:halt0:465"></a><a class="pred" href="toplevel.html#halt/0">halt/0</a>
951951 and <a class="func" href="foreigninclude.html#PL_halt()">PL_halt(0)</a>
952952 to print a message indicating that halting the system has been
953953 cancelled.</dd>
954954 <dt class="pubdef"><a id="cancel_halt/1"><strong>cancel_halt</strong>(<var>+Reason</var>)</a></dt>
955955 <dd class="defbody">
956 If this predicate is called from a hook registered with <a id="idx:athalt1:465"></a><a class="pred" href="consulting.html#at_halt/1">at_halt/1</a>,
956 If this predicate is called from a hook registered with <a id="idx:athalt1:466"></a><a class="pred" href="consulting.html#at_halt/1">at_halt/1</a>,
957957 halting Prolog is cancelled and an informational message is printed that
958958 includes <var>Reason</var>. This is used by the development tools to
959959 cancel halting the system if the editor has unsafed data and the user
962962 <dd class="defbody">
963963 Call <var>Goal</var> <em>after</em> loading the source file in which
964964 this directive appears has been completed. In addition, <var>Goal</var>
965 is executed if a saved state created using <a id="idx:qsaveprogram1:466"></a><a class="pred" href="runtime.html#qsave_program/1">qsave_program/1</a>
965 is executed if a saved state created using <a id="idx:qsaveprogram1:467"></a><a class="pred" href="runtime.html#qsave_program/1">qsave_program/1</a>
966966 is restored.
967967
968968 <p>The ISO standard only allows for using <code>:- Term</code> if <var>Term</var>
969969 is a
970970 <em>directive</em>. This means that arbitrary goals can only be called
971 from a directive by means of the <a id="idx:initialization1:467"></a><a class="pred" href="consulting.html#initialization/1">initialization/1</a>
971 from a directive by means of the <a id="idx:initialization1:468"></a><a class="pred" href="consulting.html#initialization/1">initialization/1</a>
972972 directive. SWI-Prolog does not enforce this rule.
973973
974 <p>The <a id="idx:initialization1:468"></a><a class="pred" href="consulting.html#initialization/1">initialization/1</a>
975 directive must be used to do program initialization in saved states (see <a id="idx:qsaveprogram1:469"></a><a class="pred" href="runtime.html#qsave_program/1">qsave_program/1</a>).
974 <p>The <a id="idx:initialization1:469"></a><a class="pred" href="consulting.html#initialization/1">initialization/1</a>
975 directive must be used to do program initialization in saved states (see <a id="idx:qsaveprogram1:470"></a><a class="pred" href="runtime.html#qsave_program/1">qsave_program/1</a>).
976976 A saved state contains the predicates, Prolog flags and operators
977977 present at the moment the state was created. Other resources (records,
978 foreign resources, etc.) must be recreated using <a id="idx:initialization1:470"></a><a class="pred" href="consulting.html#initialization/1">initialization/1</a>
978 foreign resources, etc.) must be recreated using <a id="idx:initialization1:471"></a><a class="pred" href="consulting.html#initialization/1">initialization/1</a>
979979 directives or from the entry goal of the saved state.
980980
981981 <p>Up to SWI-Prolog 5.7.11, <var>Goal</var> was executed immediately
982982 rather than after loading the program text in which the directive
983983 appears as dictated by the ISO standard. In many cases the exact moment
984984 of execution is irrelevant, but there are exceptions. For example,
985 <a id="idx:loadforeignlibrary1:471"></a><a class="pred" href="foreignlink.html#load_foreign_library/1">load_foreign_library/1</a>
985 <a id="idx:loadforeignlibrary1:472"></a><a class="pred" href="foreignlink.html#load_foreign_library/1">load_foreign_library/1</a>
986986 must be executed immediately to make the loaded foreign predicates
987 available for exporting. SWI-Prolog now provides the directive <a id="idx:useforeignlibrary1:472"></a><a class="pred" href="foreignlink.html#use_foreign_library/1">use_foreign_library/1</a>
987 available for exporting. SWI-Prolog now provides the directive <a id="idx:useforeignlibrary1:473"></a><a class="pred" href="foreignlink.html#use_foreign_library/1">use_foreign_library/1</a>
988988 to ensure immediate loading as well as loading after restoring a saved
989989 state. If the system encounters a directive <code>:-
990990 initialization(load_foreign_library(...))</code>, it will load the
995995 <dt class="pubdef"><a id="initialization/2"><strong>initialization</strong>(<var>:Goal,
996996 +When</var>)</a></dt>
997997 <dd class="defbody">
998 Similar to <a id="idx:initialization1:473"></a><a class="pred" href="consulting.html#initialization/1">initialization/1</a>,
998 Similar to <a id="idx:initialization1:474"></a><a class="pred" href="consulting.html#initialization/1">initialization/1</a>,
999999 but allows for specifying when <var>Goal</var> is executed while loading
10001000 the program text:
10011001
10061006 </dd>
10071007 <dt><strong>after_load</strong></dt>
10081008 <dd class="defbody">
1009 Execute <var>Goal</var> after loading program text. This is the same as <a id="idx:initialization1:474"></a><a class="pred" href="consulting.html#initialization/1">initialization/1</a>.
1009 Execute <var>Goal</var> after loading program text. This is the same as <a id="idx:initialization1:475"></a><a class="pred" href="consulting.html#initialization/1">initialization/1</a>.
10101010 </dd>
10111011 <dt><strong>restore</strong></dt>
10121012 <dd class="defbody">
10191019 <dt class="pubdef"><a id="compiling/0"><strong>compiling</strong></a></dt>
10201020 <dd class="defbody">
10211021 True if the system is compiling source files with the <strong>-c</strong>
1022 option or <a id="idx:qcompile1:475"></a><a class="pred" href="consulting.html#qcompile/1">qcompile/1</a>
1022 option or <a id="idx:qcompile1:476"></a><a class="pred" href="consulting.html#qcompile/1">qcompile/1</a>
10231023 into an intermediate code file. Can be used to perform conditional code
1024 optimisations in <a id="idx:termexpansion2:476"></a><a class="pred" href="consulting.html#term_expansion/2">term_expansion/2</a>
1024 optimisations in <a id="idx:termexpansion2:477"></a><a class="pred" href="consulting.html#term_expansion/2">term_expansion/2</a>
10251025 (see also the
10261026 <strong>-O</strong> option) or to omit execution of directives during
10271027 compilation.
10331033
10341034 <a id="sec:progtransform"></a>
10351035
1036 <p><a id="idx:transformationofprogram:477"></a>ISO Prolog defines no way
1036 <p><a id="idx:transformationofprogram:478"></a>ISO Prolog defines no way
10371037 for program transformations such as macro expansion or conditional
1038 compilation. Expansion through <a id="idx:termexpansion2:478"></a><a class="pred" href="consulting.html#term_expansion/2">term_expansion/2</a>
1039 and <a id="idx:expandterm2:479"></a><a class="pred" href="consulting.html#expand_term/2">expand_term/2</a>
1038 compilation. Expansion through <a id="idx:termexpansion2:479"></a><a class="pred" href="consulting.html#term_expansion/2">term_expansion/2</a>
1039 and <a id="idx:expandterm2:480"></a><a class="pred" href="consulting.html#expand_term/2">expand_term/2</a>
10401040 can be seen as part of the de-facto standard. This mechanism can do
10411041 arbitrary translation between valid Prolog terms read from the source
10421042 file to Prolog terms handed to the compiler. As
1043 <a id="idx:termexpansion2:480"></a><a class="pred" href="consulting.html#term_expansion/2">term_expansion/2</a>
1043 <a id="idx:termexpansion2:481"></a><a class="pred" href="consulting.html#term_expansion/2">term_expansion/2</a>
10441044 can return a list, the transformation does not need to be term-to-term.
10451045
1046 <p>Various Prolog dialects provide the analogous <a id="idx:goalexpansion2:481"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a>
1046 <p>Various Prolog dialects provide the analogous <a id="idx:goalexpansion2:482"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a>
10471047 and
1048 <a id="idx:expandgoal2:482"></a><a class="pred" href="consulting.html#expand_goal/2">expand_goal/2</a>
1048 <a id="idx:expandgoal2:483"></a><a class="pred" href="consulting.html#expand_goal/2">expand_goal/2</a>
10491049 that allow for translation of individual body terms, freeing the user of
10501050 the task to disassemble each clause.
10511051
10671067 </blockquote>
10681068
10691069 <p>When compiling a module (see <a class="sec" href="modules.html">chapter
1070 6</a> and the directive <a id="idx:module2:483"></a><a class="pred" href="defmodule.html#module/2">module/2</a>),
1071 <a id="idx:expandterm2:484"></a><a class="pred" href="consulting.html#expand_term/2">expand_term/2</a>
1072 will first try <a id="idx:termexpansion2:485"></a><a class="pred" href="consulting.html#term_expansion/2">term_expansion/2</a>
1070 6</a> and the directive <a id="idx:module2:484"></a><a class="pred" href="defmodule.html#module/2">module/2</a>),
1071 <a id="idx:expandterm2:485"></a><a class="pred" href="consulting.html#expand_term/2">expand_term/2</a>
1072 will first try <a id="idx:termexpansion2:486"></a><a class="pred" href="consulting.html#term_expansion/2">term_expansion/2</a>
10731073 in the module being compiled to allow for term expansion rules that are
10741074 local to a module. If there is no local definition, or the local
1075 definition fails to translate the term, <a id="idx:expandterm2:486"></a><a class="pred" href="consulting.html#expand_term/2">expand_term/2</a>
1076 will try <a id="idx:termexpansion2:487"></a><a class="pred" href="consulting.html#term_expansion/2">term_expansion/2</a>
1075 definition fails to translate the term, <a id="idx:expandterm2:487"></a><a class="pred" href="consulting.html#expand_term/2">expand_term/2</a>
1076 will try <a id="idx:termexpansion2:488"></a><a class="pred" href="consulting.html#term_expansion/2">term_expansion/2</a>
10771077 in module
10781078 <code>user</code>. For compatibility with SICStus and Quintus Prolog,
1079 this feature should not be used. See also <a id="idx:expandterm2:488"></a><a class="pred" href="consulting.html#expand_term/2">expand_term/2</a>, <a id="idx:goalexpansion2:489"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a>
1079 this feature should not be used. See also <a id="idx:expandterm2:489"></a><a class="pred" href="consulting.html#expand_term/2">expand_term/2</a>, <a id="idx:goalexpansion2:490"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a>
10801080 and
1081 <a id="idx:expandgoal2:490"></a><a class="pred" href="consulting.html#expand_goal/2">expand_goal/2</a>.</dd>
1081 <a id="idx:expandgoal2:491"></a><a class="pred" href="consulting.html#expand_goal/2">expand_goal/2</a>.</dd>
10821082 <dt class="pubdef"><a id="expand_term/2"><strong>expand_term</strong>(<var>+Term1,
10831083 -Term2</var>)</a></dt>
10841084 <dd class="defbody">
10931093 4.3.1.2</a>.
10941094
10951095 <p>
1096 <li>Call <a id="idx:termexpansion2:491"></a><a class="pred" href="consulting.html#term_expansion/2">term_expansion/2</a>.
1096 <li>Call <a id="idx:termexpansion2:492"></a><a class="pred" href="consulting.html#term_expansion/2">term_expansion/2</a>.
10971097 This predicate is first tried in the module that is being compiled and
10981098 then in the module
10991099 <code>user</code>.
11001100
11011101 <p>
1102 <li>Call DCG expansion (<a id="idx:dcgtranslaterule2:492"></a><a class="pred" href="consulting.html#dcg_translate_rule/2">dcg_translate_rule/2</a>).
1102 <li>Call DCG expansion (<a id="idx:dcgtranslaterule2:493"></a><a class="pred" href="consulting.html#dcg_translate_rule/2">dcg_translate_rule/2</a>).
11031103
11041104 <p>
1105 <li>Call <a id="idx:expandgoal2:493"></a><a class="pred" href="consulting.html#expand_goal/2">expand_goal/2</a>
1105 <li>Call <a id="idx:expandgoal2:494"></a><a class="pred" href="consulting.html#expand_goal/2">expand_goal/2</a>
11061106 on each body term that appears in the output of the previous steps.
11071107 </ol>
11081108 </dd>
11091109 <dt class="pubdef"><a id="goal_expansion/2"><strong>goal_expansion</strong>(<var>+Goal1,
11101110 -Goal2</var>)</a></dt>
11111111 <dd class="defbody">
1112 Like <a id="idx:termexpansion2:494"></a><a class="pred" href="consulting.html#term_expansion/2">term_expansion/2</a>, <a id="idx:goalexpansion2:495"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a>
1113 provides for macro expansion of Prolog source code. Between <a id="idx:expandterm2:496"></a><a class="pred" href="consulting.html#expand_term/2">expand_term/2</a>
1112 Like <a id="idx:termexpansion2:495"></a><a class="pred" href="consulting.html#term_expansion/2">term_expansion/2</a>, <a id="idx:goalexpansion2:496"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a>
1113 provides for macro expansion of Prolog source code. Between <a id="idx:expandterm2:497"></a><a class="pred" href="consulting.html#expand_term/2">expand_term/2</a>
11141114 and the actual compilation, the body of clauses analysed and the goals
1115 are handed to <a id="idx:expandgoal2:497"></a><a class="pred" href="consulting.html#expand_goal/2">expand_goal/2</a>,
1116 which uses the <a id="idx:goalexpansion2:498"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a>
1115 are handed to <a id="idx:expandgoal2:498"></a><a class="pred" href="consulting.html#expand_goal/2">expand_goal/2</a>,
1116 which uses the <a id="idx:goalexpansion2:499"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a>
11171117 hook to do user-defined expansion.
11181118
1119 <p>The predicate <a id="idx:goalexpansion2:499"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a>
1119 <p>The predicate <a id="idx:goalexpansion2:500"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a>
11201120 is first called in the module that is being compiled, and then on the <code>user</code>
11211121 module. If <var>Goal</var> is of the form <var>Module</var>:<var>Goal</var>
11221122 where <var>Module</var> is instantiated,
1123 <a id="idx:goalexpansion2:500"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a>
1123 <a id="idx:goalexpansion2:501"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a>
11241124 is called on <var>Goal</var> using rules from module
11251125 <var>Module</var> followed by <code>user</code>.
11261126
11271127 <p>Only goals appearing in the body of clauses when reading a source
11281128 file are expanded using this mechanism, and only if they appear
11291129 literally in the clause, or as an argument to a defined meta-predicate
1130 that is annotated using `0' (see <a id="idx:metapredicate1:501"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>).
1130 that is annotated using `0' (see <a id="idx:metapredicate1:502"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>).
11311131 Other cases need a real predicate definition.</dd>
11321132 <dt class="pubdef"><a id="expand_goal/2"><strong>expand_goal</strong>(<var>+Goal1,
11331133 -Goal2</var>)</a></dt>
11341134 <dd class="defbody">
11351135 This predicate is normally called by the compiler to perform
1136 preprocessing using <a id="idx:goalexpansion2:502"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a>.
1136 preprocessing using <a id="idx:goalexpansion2:503"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a>.
11371137 The predicate computes a fixed-point by applying transformations until
11381138 there are no more changes. If optimisation is enabled (see <strong>-O</strong>
11391139 and
1140 <a class="flag" href="flags.html#flag:optimise">optimise</a>), <a id="idx:expandgoal2:503"></a><a class="pred" href="consulting.html#expand_goal/2">expand_goal/2</a>
1141 simplifies the result by removing unneeded calls to <a id="idx:true0:504"></a><a class="pred" href="control.html#true/0">true/0</a>
1142 and <a id="idx:fail0:505"></a><a class="pred" href="control.html#fail/0">fail/0</a>
1140 <a class="flag" href="flags.html#flag:optimise">optimise</a>), <a id="idx:expandgoal2:504"></a><a class="pred" href="consulting.html#expand_goal/2">expand_goal/2</a>
1141 simplifies the result by removing unneeded calls to <a id="idx:true0:505"></a><a class="pred" href="control.html#true/0">true/0</a>
1142 and <a id="idx:fail0:506"></a><a class="pred" href="control.html#fail/0">fail/0</a>
11431143 as well as unreachable branches.</dd>
11441144 <dt class="pubdef"><a id="compile_aux_clauses/1"><strong>compile_aux_clauses</strong>(<var>+Clauses</var>)</a></dt>
11451145 <dd class="defbody">
1146 Compile clauses on behalf of <a id="idx:goalexpansion2:506"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a>.
1146 Compile clauses on behalf of <a id="idx:goalexpansion2:507"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a>.
11471147 This predicate compiles the argument clauses into static predicates,
11481148 associating the predicates with the current file but avoids changing the
11491149 notion of current predicate and therefore discontiguous warnings.</dd>
11521152 <dd class="defbody">
11531153 This predicate performs the translation of a term <code>Head--&gt;Body</code>
11541154 into a normal Prolog clause. Normally this functionality should be
1155 accessed using <a id="idx:expandterm2:507"></a><a class="pred" href="consulting.html#expand_term/2">expand_term/2</a>.</dd>
1155 accessed using <a id="idx:expandterm2:508"></a><a class="pred" href="consulting.html#expand_term/2">expand_term/2</a>.</dd>
11561156 <dt class="pubdef"><a id="var_property/2"><strong>var_property</strong>(<var>+Var,
11571157 ?Property</var>)</a></dt>
11581158 <dd class="defbody">
11601160 properties are available during goal- and term-expansion. Defined
11611161 properties are below. Future versions are likely to provide more
11621162 properties, such as whether the variable is a singleton or whether the
1163 variable is referenced in the remainder of the term. See also <a id="idx:goalexpansion2:508"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a>.
1163 variable is referenced in the remainder of the term. See also <a id="idx:goalexpansion2:509"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a>.
11641164
11651165 <dl class="latex">
11661166 <dt><strong>fresh</strong>(<var>Bool</var>)</dt>
12111211 These versions are called <em>before</em> their 2-argument counterparts.
12121212 The input layout term is either a variable (if no layout information is
12131213 available) or a term carrying detailed layout information as returned by
1214 the <code>subterm_positions</code> of <a id="idx:readterm2:509"></a><a class="pred" href="termrw.html#read_term/2">read_term/2</a>.
1214 the <code>subterm_positions</code> of <a id="idx:readterm2:510"></a><a class="pred" href="termrw.html#read_term/2">read_term/2</a>.
12151215 </dd>
12161216 </dl>
12171217
12201220
12211221 <a id="sec:conditionalcompilation"></a>
12221222
1223 <p><a id="idx:ifdirective:510"></a>Conditional compilation builds on the
1223 <p><a id="idx:ifdirective:511"></a>Conditional compilation builds on the
12241224 same principle as
1225 <a id="idx:termexpansion2:511"></a><a class="pred" href="consulting.html#term_expansion/2">term_expansion/2</a>, <a id="idx:goalexpansion2:512"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a>
1225 <a id="idx:termexpansion2:512"></a><a class="pred" href="consulting.html#term_expansion/2">term_expansion/2</a>, <a id="idx:goalexpansion2:513"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a>
12261226 and the expansion of grammar rules to compile sections of the source
12271227 code conditionally. One of the reasons for introducing conditional
12281228 compilation is to simplify writing portable code. See <a class="sec" href="dialect.html">section
12531253 <dt class="pubdef"><a id="if/1">:- <strong>if</strong>(<var>:Goal</var>)</a></dt>
12541254 <dd class="defbody">
12551255 Compile subsequent code only if <var>Goal</var> succeeds. For enhanced
1256 portability, <var>Goal</var> is processed by <a id="idx:expandgoal2:513"></a><a class="pred" href="consulting.html#expand_goal/2">expand_goal/2</a>
1256 portability, <var>Goal</var> is processed by <a id="idx:expandgoal2:514"></a><a class="pred" href="consulting.html#expand_goal/2">expand_goal/2</a>
12571257 before execution. If an error occurs, the error is printed and
12581258 processing proceeds as if
12591259 <var>Goal</var> has failed.</dd>
12991299 <li>Trace a goal
13001300 <li>Find unexpected behaviour of a predicate
13011301 <li>Enter a <em>break</em> using the <b>b</b> command
1302 <li>Fix the sources and reload them using <a id="idx:make0:514"></a><a class="pred" href="consulting.html#make/0">make/0</a>
1302 <li>Fix the sources and reload them using <a id="idx:make0:515"></a><a class="pred" href="consulting.html#make/0">make/0</a>
13031303 <li>Exit the break, <em>retry</em> using the <b>r</b> command
13041304 </ul>
13051305
13091309 clauses of predicates that are active during the reload cannot be
13101310 reclaimed. Normally a small amount of dead clauses should not be an
13111311 issue during development. Such clauses can be reclaimed with
1312 <a id="idx:garbagecollectclauses0:515"></a><a class="pred" href="consulting.html#garbage_collect_clauses/0">garbage_collect_clauses/0</a>.
1312 <a id="idx:garbagecollectclauses0:516"></a><a class="pred" href="consulting.html#garbage_collect_clauses/0">garbage_collect_clauses/0</a>.
13131313
13141314 <dl class="latex">
13151315 <dt class="pubdef"><a id="garbage_collect_clauses/0"><strong>garbage_collect_clauses</strong></a></dt>
13171317 Clean up all <em>dirty</em> predicates, where dirty predicates are
13181318 defined to be predicates that have both old and new definitions due to
13191319 reloading a source file while the predicate was active. Of course,
1320 predicates that are active using <a id="idx:garbagecollectclauses0:516"></a><a class="pred" href="consulting.html#garbage_collect_clauses/0">garbage_collect_clauses/0</a>
1320 predicates that are active using <a id="idx:garbagecollectclauses0:517"></a><a class="pred" href="consulting.html#garbage_collect_clauses/0">garbage_collect_clauses/0</a>
13211321 cannot be reclaimed and remain <em>dirty</em>. Predicates are, like
13221322 atoms, shared resources and therefore all threads are suspended during
13231323 the execution of this predicate.
13331333 accesses predicates from file <var>B</var> which accesses predicates
13341334 from file
13351335 <var>A</var>, we consider this a mutual or circular dependency. If
1336 traditional load predicates (e.g., <a id="idx:consult1:517"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>)
1336 traditional load predicates (e.g., <a id="idx:consult1:518"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>)
13371337 are used to include file <var>B</var> from <var>A</var> and <var>A</var>
13381338 from <var>B</var>, loading either file results in a loop. This is
13391339 because
1340 <a id="idx:consult1:518"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>
1341 is mapped to <a id="idx:loadfiles2:519"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>
1340 <a id="idx:consult1:519"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>
1341 is mapped to <a id="idx:loadfiles2:520"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>
13421342 using the option <code>if(true)(if(true))</code> Such programs are
13431343 typically loaded using a <em>load file</em> that consults all required
13441344 (non-module) files. If modules are used, the dependencies are made
1345 explicit using <a id="idx:usemodule1:520"></a><a class="pred" href="import.html#use_module/1">use_module/1</a>
1345 explicit using <a id="idx:usemodule1:521"></a><a class="pred" href="import.html#use_module/1">use_module/1</a>
13461346 statements. The
1347 <a id="idx:usemodule1:521"></a><a class="pred" href="import.html#use_module/1">use_module/1</a>
1348 predicate, however, maps to <a id="idx:loadfiles2:522"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>
1347 <a id="idx:usemodule1:522"></a><a class="pred" href="import.html#use_module/1">use_module/1</a>
1348 predicate, however, maps to <a id="idx:loadfiles2:523"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>
13491349 with the option
1350 <code>if(not_loaded)(if(not_loaded))</code> A <a id="idx:usemodule1:523"></a><a class="pred" href="import.html#use_module/1">use_module/1</a>
1350 <code>if(not_loaded)(if(not_loaded))</code> A <a id="idx:usemodule1:524"></a><a class="pred" href="import.html#use_module/1">use_module/1</a>
13511351 on an already loaded file merely makes the public predicates of the used
13521352 module available.
13531353
13541354 <p>Summarizing, mutual dependency of source files is fully supported
13551355 with no precautions when using modules. Modules can use each other in an
1356 arbitrary dependency graph. When using <a id="idx:consult1:524"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>,
1356 arbitrary dependency graph. When using <a id="idx:consult1:525"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>,
13571357 predicate dependencies between loaded files can still be arbitrary, but
13581358 the consult relations between files must be a proper tree.
13591359
13661366 reloading, see <a class="sec" href="consulting.html">section 4.3.2.3</a>.
13671367
13681368 <p>In older versions, compilation was thread-safe due to a global
1369 <em>lock</em> in <a id="idx:loadfiles2:525"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>
1369 <em>lock</em> in <a id="idx:loadfiles2:526"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>
13701370 and the code dealing with
13711371 <em>autoloading</em> (see <a class="sec" href="autoload.html">section
13721372 2.13</a>). Besides unnecessary stalling when multiple threads trap
13731373 unrelated undefined predicates, this easily leads to deadlocks, notably
13741374 if threads are started from an
1375 <a id="idx:initialization1:526"></a><a class="pred" href="consulting.html#initialization/1">initialization/1</a>
1376 directive.<sup class="fn">43<span class="fn-text">Although such goals
1375 <a id="idx:initialization1:527"></a><a class="pred" href="consulting.html#initialization/1">initialization/1</a>
1376 directive.<sup class="fn">44<span class="fn-text">Although such goals
13771377 are started after loading the file in which they appear, the calling
13781378 thread is still likely to hold the `load' lock because it is compiling
13791379 the file from which the file holding the directive is loaded.</span></sup>
13811381 <p>Starting with version 5.11.27, the autoloader is no longer locked and
13821382 multiple threads can compile files concurrently. This requires special
13831383 precautions only if multiple threads wish to load the same file at the
1384 same time. Therefore, <a id="idx:loadfiles2:527"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>
1384 same time. Therefore, <a id="idx:loadfiles2:528"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>
13851385 checks automatically whether some other thread is already loading the
13861386 file. If not, it starts loading the file. If another thread is already
13871387 loading the file, the thread blocks until the other thread finishes
14141414 active predicates originating from the file being reloaded. The threads
14151415 are resumed after the file has been loaded. In addition, after
14161416 completing loading the outermost file, the system runs
1417 <a id="idx:garbagecollectclauses0:528"></a><a class="pred" href="consulting.html#garbage_collect_clauses/0">garbage_collect_clauses/0</a>.
1417 <a id="idx:garbagecollectclauses0:529"></a><a class="pred" href="consulting.html#garbage_collect_clauses/0">garbage_collect_clauses/0</a>.
14181418
14191419 <p>What does that mean? Unfortunately it does <em>not</em> mean we can
14201420 `hot-swap' modules. Consider the case where thread <var>A</var> is
14481448 are stored as virtual machine instructions. Changes to the compiler will
14491449 generally make old compiled files unusable.
14501450
1451 <p>Quick Load Files are created using <a id="idx:qcompile1:529"></a><a class="pred" href="consulting.html#qcompile/1">qcompile/1</a>.
1451 <p>Quick Load Files are created using <a id="idx:qcompile1:530"></a><a class="pred" href="consulting.html#qcompile/1">qcompile/1</a>.
14521452 They are loaded using
1453 <a id="idx:consult1:530"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>
1453 <a id="idx:consult1:531"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>
14541454 or one of the other file-loading predicates described in
1455 <a class="sec" href="consulting.html">section 4.3</a>. If <a id="idx:consult1:531"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>
1455 <a class="sec" href="consulting.html">section 4.3</a>. If <a id="idx:consult1:532"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>
14561456 is given an explicit <code>.pl</code> file, it will load the Prolog
14571457 source. When given a <code>.qlf</code> file, it will load the file. When
14581458 no extension is specified, it will load the
14621462 <dl class="latex">
14631463 <dt class="pubdef"><a id="qcompile/1"><strong>qcompile</strong>(<var>:File</var>)</a></dt>
14641464 <dd class="defbody">
1465 Takes a file specification as <a id="idx:consult1:532"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>,
1465 Takes a file specification as <a id="idx:consult1:533"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>,
14661466 etc., and, in addition to the normal compilation, creates a <em>Quick
14671467 Load File</em> from <var>File</var>. The file extension of this file is <code>.qlf</code>.
14681468 The basename of the Quick Load File is the same as the input file.
14761476 the
14771477 <code>.pl</code> file.
14781478
1479 <p>For <a id="idx:termexpansion2:533"></a><a class="pred" href="consulting.html#term_expansion/2">term_expansion/2</a>,
1479 <p>For <a id="idx:termexpansion2:534"></a><a class="pred" href="consulting.html#term_expansion/2">term_expansion/2</a>,
14801480 the same rules as described in
14811481 <a class="sec" href="compilation.html">section 2.10</a> apply.
14821482
14831483 <p>Conditional execution or optimisation may test the predicate
1484 <a id="idx:compiling0:534"></a><a class="pred" href="consulting.html#compiling/0">compiling/0</a>.
1485
1486 <p>Source references (<a id="idx:sourcefile2:535"></a><a class="pred" href="consulting.html#source_file/2">source_file/2</a>)
1484 <a id="idx:compiling0:535"></a><a class="pred" href="consulting.html#compiling/0">compiling/0</a>.
1485
1486 <p>Source references (<a id="idx:sourcefile2:536"></a><a class="pred" href="consulting.html#source_file/2">source_file/2</a>)
14871487 in the Quick Load File refer to the Prolog source file from which the
14881488 compiled code originates.</dd>
14891489 <dt class="pubdef"><a id="qcompile/2"><strong>qcompile</strong>(<var>:File,
14901490 +Options</var>)</a></dt>
14911491 <dd class="defbody">
1492 As <a id="idx:qcompile1:536"></a><a class="pred" href="consulting.html#qcompile/1">qcompile/1</a>,
1492 As <a id="idx:qcompile1:537"></a><a class="pred" href="consulting.html#qcompile/1">qcompile/1</a>,
14931493 but processes additional options as defined by
1494 <a id="idx:loadfiles2:537"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>.<sup class="fn">bug<span class="fn-text">Option
1494 <a id="idx:loadfiles2:538"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>.<sup class="fn">bug<span class="fn-text">Option
14951495 processing is currently incomplete.</span></sup>
14961496 </dd>
14971497 </dl>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section E.2</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section E.2</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.8</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.8</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
238238 <a id="sec:control"></a>
239239
240240 <p>The predicates of this section implement control structures. Normally
241 the constructs in this section, except for <a id="idx:repeat0:593"></a><a class="pred" href="control.html#repeat/0">repeat/0</a>,
241 the constructs in this section, except for <a id="idx:repeat0:594"></a><a class="pred" href="control.html#repeat/0">repeat/0</a>,
242242 are translated by the compiler. Please note that complex goals passed as
243 arguments to meta-predicates such as <a id="idx:findall3:594"></a><a class="pred" href="allsolutions.html#findall/3">findall/3</a>
243 arguments to meta-predicates such as <a id="idx:findall3:595"></a><a class="pred" href="allsolutions.html#findall/3">findall/3</a>
244244 below cause the goal to be compiled to a temporary location before
245245 execution. It is faster to define a sub-predicate (i.e. one_character_atoms/1
246246 in the example below) and make a call to this simple predicate.
253253 <dl class="latex">
254254 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="fail/0"><strong>fail</strong></a></dt>
255255 <dd class="defbody">
256 Always fail. The predicate <a id="idx:fail0:595"></a><a class="pred" href="control.html#fail/0">fail/0</a>
256 Always fail. The predicate <a id="idx:fail0:596"></a><a class="pred" href="control.html#fail/0">fail/0</a>
257257 is translated into a single virtual machine instruction.
258258 </dd>
259259 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="false/0"><strong>false</strong></a></dt>
262262 </dd>
263263 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="true/0"><strong>true</strong></a></dt>
264264 <dd class="defbody">
265 Always succeed. The predicate <a id="idx:true0:596"></a><a class="pred" href="control.html#true/0">true/0</a>
265 Always succeed. The predicate <a id="idx:true0:597"></a><a class="pred" href="control.html#true/0">true/0</a>
266266 is translated into a single virtual machine instruction.
267267 </dd>
268268 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="repeat/0"><strong>repeat</strong></a></dt>
275275 which the cut appears <em>and</em> discard choice points that have been
276276 created by goals to the left of the cut in the current clause. Meta
277277 calling is opaque to the cut. This implies that cuts that appear in a
278 term that is subject to meta-calling (<a id="idx:call1:597"></a><a class="pred" href="metacall.html#call/1">call/1</a>)
278 term that is subject to meta-calling (<a id="idx:call1:598"></a><a class="pred" href="metacall.html#call/1">call/1</a>)
279279 only affect choice points created by the meta-called term. The following
280280 control structures are transparent to the cut: <a class="pred" href="control.html#;/2">;/2</a>, <a class="pred" href="control.html#send_arrow/2">-&gt;/2</a>
281281 and
358358 an
359359 <var>Else</var> branch, is translated as the normal conjunction <var>A</var>,
360360 <var>B</var>.<sup class="fn">bug<span class="fn-text">The decompiler
361 implemented by <a id="idx:clause2:598"></a><a class="pred" href="examineprog.html#clause/2">clause/2</a>
361 implemented by <a id="idx:clause2:599"></a><a class="pred" href="examineprog.html#clause/2">clause/2</a>
362362 returns this construct as a normal conjunction too.</span></sup></dd>
363363 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="\+/1"><strong>\+</strong> <var>:Goal</var></a></dt>
364364 <dd class="defbody">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 7.2</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 7.2</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
242242 goal to execute immediately after a variable is bound can be used to
243243 avoid instantiation errors for some built-in predicates (e.g. arithmetic),
244244 do work <em>lazy</em>, prevent the binding of a variable to a particular
245 value, etc. Using <a id="idx:freeze2:1638"></a><a class="pred" href="coroutining.html#freeze/2">freeze/2</a>
245 value, etc. Using <a id="idx:freeze2:1640"></a><a class="pred" href="coroutining.html#freeze/2">freeze/2</a>
246246 for example we can define a variable that can only be assigned an even
247247 number:
248248
259259 Delay the execution of <var>Goal</var> until <var>Var</var> is bound
260260 (i.e. is not a variable or attributed variable). If <var>Var</var> is
261261 bound on entry
262 <a id="idx:freeze2:1639"></a><a class="pred" href="coroutining.html#freeze/2">freeze/2</a>
263 is equivalent to <a id="idx:call1:1640"></a><a class="pred" href="metacall.html#call/1">call/1</a>.
264 The <a id="idx:freeze2:1641"></a><a class="pred" href="coroutining.html#freeze/2">freeze/2</a>
262 <a id="idx:freeze2:1641"></a><a class="pred" href="coroutining.html#freeze/2">freeze/2</a>
263 is equivalent to <a id="idx:call1:1642"></a><a class="pred" href="metacall.html#call/1">call/1</a>.
264 The <a id="idx:freeze2:1643"></a><a class="pred" href="coroutining.html#freeze/2">freeze/2</a>
265265 predicate is realised using an attributed variable associated with the
266266 module <code>freeze</code>. Use <code>frozen(Var, Goal)</code> to find
267267 out whether and which goals are delayed on <var>Var</var>.</dd>
277277 Execute <var>Goal</var> when <var>Condition</var> becomes true. <var>Condition</var>
278278 is one of <code>?=(X, Y)</code>, <code>nonvar(X)</code>, <code>ground(X)</code>,
279279 <code><code>,</code>(Cond1, Cond2)</code> or <code><code>;</code>(Cond1,
280 Cond2)</code>. See also <a id="idx:freeze2:1642"></a><a class="pred" href="coroutining.html#freeze/2">freeze/2</a>
281 and <a id="idx:dif2:1643"></a><a class="pred" href="coroutining.html#dif/2">dif/2</a>.
280 Cond2)</code>. See also <a id="idx:freeze2:1644"></a><a class="pred" href="coroutining.html#freeze/2">freeze/2</a>
281 and <a id="idx:dif2:1645"></a><a class="pred" href="coroutining.html#dif/2">dif/2</a>.
282282 The implementation can deal with cyclic terms in <var>X</var> and <var>Y</var>.
283283
284 <p>The <a id="idx:when2:1644"></a><a class="pred" href="coroutining.html#when/2">when/2</a>
284 <p>The <a id="idx:when2:1646"></a><a class="pred" href="coroutining.html#when/2">when/2</a>
285285 predicate is realised using attributed variables associated with the
286286 module <code>when</code>. It is defined in the autoload library
287287 <code>library(when)</code>.</dd>
288288 <dt class="pubdef"><a id="dif/2"><strong>dif</strong>(<var>@A, @B</var>)</a></dt>
289289 <dd class="defbody">
290 The <a id="idx:dif2:1645"></a><a class="pred" href="coroutining.html#dif/2">dif/2</a>
290 The <a id="idx:dif2:1647"></a><a class="pred" href="coroutining.html#dif/2">dif/2</a>
291291 predicate provides a constraint stating that <var>A</var> and
292292 <var>B</var> are different terms. If <var>A</var> and <var>B</var> can
293293 never unify,
294 <a id="idx:dif2:1646"></a><a class="pred" href="coroutining.html#dif/2">dif/2</a>
294 <a id="idx:dif2:1648"></a><a class="pred" href="coroutining.html#dif/2">dif/2</a>
295295 succeeds deterministically. If <var>A</var> and <var>B</var> are
296296 identical it fails immediately, and finally, if <var>A</var> and <var>B</var>
297297 can unify, goals are delayed that prevent <var>A</var> and <var>B</var>
298298 to become equal. The
299 <a id="idx:dif2:1647"></a><a class="pred" href="coroutining.html#dif/2">dif/2</a>
299 <a id="idx:dif2:1649"></a><a class="pred" href="coroutining.html#dif/2">dif/2</a>
300300 predicate behaves as if defined by
301301 <code>dif(X, Y) :- when(?=(X, Y), X \== Y)</code>. See also <a class="pred" href="compare.html#?=/2">?=/2</a>.
302302 The implementation can deal with cyclic terms.
303303
304 <p>The <a id="idx:dif2:1648"></a><a class="pred" href="coroutining.html#dif/2">dif/2</a>
304 <p>The <a id="idx:dif2:1650"></a><a class="pred" href="coroutining.html#dif/2">dif/2</a>
305305 predicate is realised using attributed variables associated with the
306306 module <code>dif</code>. It is defined in the autoload library
307307 <code>library(dif)</code>.</dd>
314314 a variable. Such programs should fail, but sometimes succeed because the
315315 constraint solver is too weak to detect the contradiction. Ideally,
316316 delayed goals and constraints are all executed at the end of the
317 computation. The meta predicate <a id="idx:callresiduevars2:1649"></a><a class="pred" href="coroutining.html#call_residue_vars/2">call_residue_vars/2</a>
317 computation. The meta predicate <a id="idx:callresiduevars2:1651"></a><a class="pred" href="coroutining.html#call_residue_vars/2">call_residue_vars/2</a>
318318 finds variables that are given attribute variables or whose attributes
319 are modified<sup class="fn">136<span class="fn-text">Tracking
320 modifications is currently not complete and this feature may be dropped
321 completely in future versions.</span></sup> by <var>Goal</var>,
322 regardless of whether or not these variables are reachable from the
323 arguments of <var>Goal</var>.
324
325 <p>The predicate has considerable implications. During the execution of
326 <var>Goal</var>, the garbage collector does not reclaim attributed
327 variables. This causes some degradation of GC performance. In a
328 well-behaved program there are no such variables, so the space impact is
329 generally minimal. The actual collection of <var>Vars</var> is
330 implemented using a scan of the trail and global stacks.
319 are modified by <var>Goal</var>, regardless of whether or not these
320 variables are reachable from the arguments of
321 <var>Goal</var>.<sup class="fn">139<span class="fn-text">The
322 implementation of <a id="idx:callresiduevars2:1652"></a><a class="pred" href="coroutining.html#call_residue_vars/2">call_residue_vars/2</a>
323 is completely redone in version 7.3.2 (7.2.1) after discussion with Bart
324 Demoen. The current implementation no longer performs full scans of the
325 stacks. The overhead is proportional to the number of attributed
326 variables on the stack, dead or alive.</span></sup>.
331327 </dd>
332328 </dl>
333329
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.10</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.10</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 6.13</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 6.13</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
238238 <a id="sec:ctxmodule"></a>
239239
240240 <p><i>The `module-transparent' mechanism is still underlying the actual
241 implementation. Direct usage by programmers is deprecated. Please use <a id="idx:metapredicate1:1592"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>
241 implementation. Direct usage by programmers is deprecated. Please use <a id="idx:metapredicate1:1594"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>
242242 to deal with meta-predicates.</i>
243243
244244 <p>The qualification of module-sensitive arguments described in <a class="sec" href="metapred.html">section
258258 default, the context module is the definition module of the predicate
259259 running the goal. For transparent predicates, however, this is the
260260 context module of the goal inherited from the parent goal. Below, we
261 implement <a id="idx:maplist3:1593"></a><a class="pred" href="apply.html#maplist/3">maplist/3</a>
261 implement <a id="idx:maplist3:1595"></a><a class="pred" href="apply.html#maplist/3">maplist/3</a>
262262 using the transparent mechanism. The code of
263 <a id="idx:maplist3:1594"></a><a class="pred" href="apply.html#maplist/3">maplist/3</a>
264 and <a id="idx:maplist3:1595"></a><span class="pred-ext">maplist_/3</span>
263 <a id="idx:maplist3:1596"></a><a class="pred" href="apply.html#maplist/3">maplist/3</a>
264 and <a id="idx:maplist3:1597"></a><span class="pred-ext">maplist_/3</span>
265265 is the same as in <a class="sec" href="metapred.html">section 6.4</a>,
266266 but now we must declare both the main predicate and the helper as
267267 transparent to avoid changing the context module when calling the
288288 module-sensitive arguments. For example, the module below counts the
289289 number of unique atoms returned as bindings for a variable. It works as
290290 expected. If we use the directive
291 <code>:- module_transparent <a id="idx:countatomresults3:1596"></a><span class="pred-ext">count_atom_results/3</span>.</code>
291 <code>:- module_transparent <a id="idx:countatomresults3:1598"></a><span class="pred-ext">count_atom_results/3</span>.</code>
292292 instead,
293 <a id="idx:atomresult2:1597"></a><span class="pred-ext">atom_result/2</span>
293 <a id="idx:atomresult2:1599"></a><span class="pred-ext">atom_result/2</span>
294294 is called wrongly in the module <em>calling</em>
295 <a id="idx:countatomresults3:1598"></a><span class="pred-ext">count_atom_results/3</span>.
296 This can be solved using <a id="idx:stripmodule3:1599"></a><a class="pred" href="ctxmodule.html#strip_module/3">strip_module/3</a>
295 <a id="idx:countatomresults3:1600"></a><span class="pred-ext">count_atom_results/3</span>.
296 This can be solved using <a id="idx:stripmodule3:1601"></a><a class="pred" href="ctxmodule.html#strip_module/3">strip_module/3</a>
297297 to create a qualified goal and a non-transparent helper predicate that
298298 is defined in the same module.
299299
319319 <dt class="pubdef"><a id="module_transparent/1">:- <strong>module_transparent</strong>(<var>+Preds</var>)</a></dt>
320320 <dd class="defbody">
321321 <var>Preds</var> is a comma-separated list of name/arity pairs (like
322 <a id="idx:dynamic1:1600"></a><a class="pred" href="dynamic.html#dynamic/1">dynamic/1</a>).
322 <a id="idx:dynamic1:1602"></a><a class="pred" href="dynamic.html#dynamic/1">dynamic/1</a>).
323323 Each goal associated with a transparent-declared predicate will inherit
324324 the <em>context module</em> from its parent goal.</dd>
325325 <dt class="pubdef"><a id="context_module/1"><strong>context_module</strong>(<var>-Module</var>)</a></dt>
326326 <dd class="defbody">
327327 Unify <var>Module</var> with the context module of the current goal.
328 <a id="idx:contextmodule1:1601"></a><a class="pred" href="ctxmodule.html#context_module/1">context_module/1</a>
328 <a id="idx:contextmodule1:1603"></a><a class="pred" href="ctxmodule.html#context_module/1">context_module/1</a>
329329 itself is, of course, transparent.</dd>
330330 <dt class="pubdef"><a id="strip_module/3"><strong>strip_module</strong>(<var>+Term,
331331 -Module, -Plain</var>)</a></dt>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 2.16</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 2.16</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.13</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.13</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
238238
239239 <p>SWI-Prolog offers three different database mechanisms. The first one
240240 is the common assert/retract mechanism for manipulating the clause
241 database. As facts and clauses asserted using <a id="idx:assert1:715"></a><a class="pred" href="db.html#assert/1">assert/1</a>
241 database. As facts and clauses asserted using <a id="idx:assert1:716"></a><a class="pred" href="db.html#assert/1">assert/1</a>
242242 or one of its derivatives become part of the program, these predicates
243 compile the term given to them. <a id="idx:retract1:716"></a><a class="pred" href="db.html#retract/1">retract/1</a>
244 and <a id="idx:retractall1:717"></a><a class="pred" href="db.html#retractall/1">retractall/1</a>
243 compile the term given to them. <a id="idx:retract1:717"></a><a class="pred" href="db.html#retract/1">retract/1</a>
244 and <a id="idx:retractall1:718"></a><a class="pred" href="db.html#retractall/1">retractall/1</a>
245245 have to unify a term and therefore have to decompile the program. For
246246 these reasons the assert/retract mechanism is expensive. On the other
247247 hand, once compiled, queries to the database are faster than querying
248 the recorded database discussed below. See also <a id="idx:dynamic1:718"></a><a class="pred" href="dynamic.html#dynamic/1">dynamic/1</a>.
248 the recorded database discussed below. See also <a id="idx:dynamic1:719"></a><a class="pred" href="dynamic.html#dynamic/1">dynamic/1</a>.
249249
250250 <p>The second way of storing arbitrary terms in the database is using
251251 the `recorded database'. In this database terms are associated with a
273273 imported predicate only removes the import link; the predicate will keep
274274 its old definition in its definition module.
275275
276 <p>According to the ISO standard, <a id="idx:abolish1:719"></a><a class="pred" href="db.html#abolish/1">abolish/1</a>
276 <p>According to the ISO standard, <a id="idx:abolish1:720"></a><a class="pred" href="db.html#abolish/1">abolish/1</a>
277277 can only be applied to dynamic procedures. This is odd, as for dealing
278 with dynamic procedures there is already <a id="idx:retract1:720"></a><a class="pred" href="db.html#retract/1">retract/1</a>
279 and <a id="idx:retractall1:721"></a><a class="pred" href="db.html#retractall/1">retractall/1</a>.
280 The <a id="idx:abolish1:722"></a><a class="pred" href="db.html#abolish/1">abolish/1</a>
278 with dynamic procedures there is already <a id="idx:retract1:721"></a><a class="pred" href="db.html#retract/1">retract/1</a>
279 and <a id="idx:retractall1:722"></a><a class="pred" href="db.html#retractall/1">retractall/1</a>.
280 The <a id="idx:abolish1:723"></a><a class="pred" href="db.html#abolish/1">abolish/1</a>
281281 predicate was introduced in DEC-10 Prolog precisely for dealing with
282 static procedures. In SWI-Prolog, <a id="idx:abolish1:723"></a><a class="pred" href="db.html#abolish/1">abolish/1</a>
282 static procedures. In SWI-Prolog, <a id="idx:abolish1:724"></a><a class="pred" href="db.html#abolish/1">abolish/1</a>
283283 works on static procedures, unless the Prolog flag <a class="flag" href="flags.html#flag:iso">iso</a>
284284 is set to <code>true</code>.
285285
286 <p>It is advised to use <a id="idx:retractall1:724"></a><a class="pred" href="db.html#retractall/1">retractall/1</a>
286 <p>It is advised to use <a id="idx:retractall1:725"></a><a class="pred" href="db.html#retractall/1">retractall/1</a>
287287 for erasing all clauses of a dynamic predicate.</dd>
288288 <dt class="pubdef"><a id="abolish/2"><strong>abolish</strong>(<var>+Name,
289289 +Arity</var>)</a></dt>
290290 <dd class="defbody">
291 Same as <code>abolish(Name/Arity)</code>. The predicate <a id="idx:abolish2:725"></a><a class="pred" href="db.html#abolish/2">abolish/2</a>
292 conforms to the Edinburgh standard, while <a id="idx:abolish1:726"></a><a class="pred" href="db.html#abolish/1">abolish/1</a>
291 Same as <code>abolish(Name/Arity)</code>. The predicate <a id="idx:abolish2:726"></a><a class="pred" href="db.html#abolish/2">abolish/2</a>
292 conforms to the Edinburgh standard, while <a id="idx:abolish1:727"></a><a class="pred" href="db.html#abolish/1">abolish/1</a>
293293 is ISO compliant.</dd>
294294 <dt class="pubdef"><a id="copy_predicate_clauses/2"><strong>copy_predicate_clauses</strong>(<var>:From,
295295 :To</var>)</a></dt>
300300 undefined, it is created as a dynamic predicate holding a copy of the
301301 clauses of
302302 <var>From</var>. If <var>To</var> is a dynamic predicate, the clauses of
303 <var>From</var> are added (as in <a id="idx:assertz1:727"></a><a class="pred" href="db.html#assertz/1">assertz/1</a>)
303 <var>From</var> are added (as in <a id="idx:assertz1:728"></a><a class="pred" href="db.html#assertz/1">assertz/1</a>)
304304 to the clauses of <var>To</var>.
305305 <var>To</var> and <var>From</var> must have the same arity. Acts as if
306306 defined by the program below, but at a much better performance by
342342 All facts or clauses in the database for which the <var>head</var>
343343 unifies with <var>Head</var> are removed. If <var>Head</var> refers to a
344344 predicate that is not defined, it is implicitly created as a dynamic
345 predicate. See also <a id="idx:dynamic1:728"></a><a class="pred" href="dynamic.html#dynamic/1">dynamic/1</a>.<sup class="fn">61<span class="fn-text">The
346 ISO standard only allows using <a id="idx:dynamic1:729"></a><a class="pred" href="dynamic.html#dynamic/1">dynamic/1</a>
345 predicate. See also <a id="idx:dynamic1:729"></a><a class="pred" href="dynamic.html#dynamic/1">dynamic/1</a>.<sup class="fn">62<span class="fn-text">The
346 ISO standard only allows using <a id="idx:dynamic1:730"></a><a class="pred" href="dynamic.html#dynamic/1">dynamic/1</a>
347347 as a <em>directive</em>.</span></sup></dd>
348348 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="asserta/1"><strong>asserta</strong>(<var>+Term</var>)</a></dt>
349349 <dd class="defbody">
350350 Assert a fact or clause in the database. <var>Term</var> is asserted as
351351 the first fact or clause of the corresponding predicate. Equivalent to
352 <a id="idx:assert1:730"></a><a class="pred" href="db.html#assert/1">assert/1</a>,
352 <a id="idx:assert1:731"></a><a class="pred" href="db.html#assert/1">assert/1</a>,
353353 but <var>Term</var> is asserted as first clause or fact of the
354 predicate. If the program space for the target module is limited (see <a id="idx:setmodule1:731"></a><a class="pred" href="manipmodule.html#set_module/1">set_module/1</a>), <a id="idx:asserta1:732"></a><a class="pred" href="db.html#asserta/1">asserta/1</a>
354 predicate. If the program space for the target module is limited (see <a id="idx:setmodule1:732"></a><a class="pred" href="manipmodule.html#set_module/1">set_module/1</a>), <a id="idx:asserta1:733"></a><a class="pred" href="db.html#asserta/1">asserta/1</a>
355355 can raise a
356356 <code>resource_error(program_space)</code>.</dd>
357357 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="assertz/1"><strong>assertz</strong>(<var>+Term</var>)</a></dt>
358358 <dd class="defbody">
359 Equivalent to <a id="idx:asserta1:733"></a><a class="pred" href="db.html#asserta/1">asserta/1</a>,
359 Equivalent to <a id="idx:asserta1:734"></a><a class="pred" href="db.html#asserta/1">asserta/1</a>,
360360 but <var>Term</var> is asserted as the last clause or fact of the
361361 predicate.</dd>
362362 <dt class="pubdef"><a id="assert/1"><strong>assert</strong>(<var>+Term</var>)</a></dt>
363363 <dd class="defbody">
364 Equivalent to <a id="idx:assertz1:734"></a><a class="pred" href="db.html#assertz/1">assertz/1</a>.
365 Deprecated: new code should use <a id="idx:assertz1:735"></a><a class="pred" href="db.html#assertz/1">assertz/1</a>.</dd>
364 Equivalent to <a id="idx:assertz1:735"></a><a class="pred" href="db.html#assertz/1">assertz/1</a>.
365 Deprecated: new code should use <a id="idx:assertz1:736"></a><a class="pred" href="db.html#assertz/1">assertz/1</a>.</dd>
366366 <dt class="pubdef"><a id="asserta/2"><strong>asserta</strong>(<var>+Term,
367367 -Reference</var>)</a></dt>
368368 <dd class="defbody">
369 Asserts a clause as <a id="idx:asserta1:736"></a><a class="pred" href="db.html#asserta/1">asserta/1</a>
369 Asserts a clause as <a id="idx:asserta1:737"></a><a class="pred" href="db.html#asserta/1">asserta/1</a>
370370 and unifies <var>Reference</var> with a handle to this clause. The
371 handle can be used to access this specific clause using <a id="idx:clause3:737"></a><a class="pred" href="examineprog.html#clause/3">clause/3</a>
372 and <a id="idx:erase1:738"></a><a class="pred" href="db.html#erase/1">erase/1</a>.</dd>
371 handle can be used to access this specific clause using <a id="idx:clause3:738"></a><a class="pred" href="examineprog.html#clause/3">clause/3</a>
372 and <a id="idx:erase1:739"></a><a class="pred" href="db.html#erase/1">erase/1</a>.</dd>
373373 <dt class="pubdef"><a id="assertz/2"><strong>assertz</strong>(<var>+Term,
374374 -Reference</var>)</a></dt>
375375 <dd class="defbody">
376 Equivalent to <a id="idx:asserta1:739"></a><a class="pred" href="db.html#asserta/1">asserta/1</a>,
376 Equivalent to <a id="idx:asserta1:740"></a><a class="pred" href="db.html#asserta/1">asserta/1</a>,
377377 asserting the new clause as the last clause of the predicate.</dd>
378378 <dt class="pubdef"><a id="assert/2"><strong>assert</strong>(<var>+Term,
379379 -Reference</var>)</a></dt>
380380 <dd class="defbody">
381 Equivalent to <a id="idx:assertz2:740"></a><a class="pred" href="db.html#assertz/2">assertz/2</a>.
382 Deprecated: new code should use <a id="idx:assertz2:741"></a><a class="pred" href="db.html#assertz/2">assertz/2</a>.</dd>
381 Equivalent to <a id="idx:assertz2:741"></a><a class="pred" href="db.html#assertz/2">assertz/2</a>.
382 Deprecated: new code should use <a id="idx:assertz2:742"></a><a class="pred" href="db.html#assertz/2">assertz/2</a>.</dd>
383383 <dt class="pubdef"><a id="recorda/3"><strong>recorda</strong>(<var>+Key,
384384 +Term, -Reference</var>)</a></dt>
385385 <dd class="defbody">
389389 atom or compound term. If the key is a compound term, only the name and
390390 arity define the key.
391391 <var>Reference</var> is unified with an opaque handle to the record (see
392 <a id="idx:erase1:742"></a><a class="pred" href="db.html#erase/1">erase/1</a>).</dd>
392 <a id="idx:erase1:743"></a><a class="pred" href="db.html#erase/1">erase/1</a>).</dd>
393393 <dt class="pubdef"><a id="recorda/2"><strong>recorda</strong>(<var>+Key,
394394 +Term</var>)</a></dt>
395395 <dd class="defbody">
397397 <dt class="pubdef"><a id="recordz/3"><strong>recordz</strong>(<var>+Key,
398398 +Term, -Reference</var>)</a></dt>
399399 <dd class="defbody">
400 Equivalent to <a id="idx:recorda3:743"></a><a class="pred" href="db.html#recorda/3">recorda/3</a>,
400 Equivalent to <a id="idx:recorda3:744"></a><a class="pred" href="db.html#recorda/3">recorda/3</a>,
401401 but puts the <var>Term</var> at the tail of the terms recorded under <var>Key</var>.</dd>
402402 <dt class="pubdef"><a id="recordz/2"><strong>recordz</strong>(<var>+Key,
403403 +Term</var>)</a></dt>
410410 given database <var>Reference</var>. If <var>Reference</var> is given,
411411 this predicate is semi-deterministic. Otherwise, it must be considered
412412 non-deterministic. If neither <var>Reference</var> nor <var>Key</var> is
413 given, the triples are generated as in the code snippet below.<sup class="fn">62<span class="fn-text">Note
413 given, the triples are generated as in the code snippet below.<sup class="fn">63<span class="fn-text">Note
414414 that, without a given <var>Key</var>, some implementations return
415 triples in the order defined by <a id="idx:recorda2:744"></a><a class="pred" href="db.html#recorda/2">recorda/2</a>
416 and <a id="idx:recordz2:745"></a><a class="pred" href="db.html#recordz/2">recordz/2</a>.</span></sup>
417 See also <a id="idx:currentkey1:746"></a><a class="pred" href="examineprog.html#current_key/1">current_key/1</a>.
415 triples in the order defined by <a id="idx:recorda2:745"></a><a class="pred" href="db.html#recorda/2">recorda/2</a>
416 and <a id="idx:recordz2:746"></a><a class="pred" href="db.html#recordz/2">recordz/2</a>.</span></sup>
417 See also <a id="idx:currentkey1:747"></a><a class="pred" href="examineprog.html#current_key/1">current_key/1</a>.
418418
419419 <pre class="code">
420420 current_key(Key),
429429 <dt class="pubdef"><a id="erase/1"><strong>erase</strong>(<var>+Reference</var>)</a></dt>
430430 <dd class="defbody">
431431 Erase a record or clause from the database. <var>Reference</var> is a
432 db-reference returned by <a id="idx:recorda3:747"></a><a class="pred" href="db.html#recorda/3">recorda/3</a>, <a id="idx:recordz3:748"></a><a class="pred" href="db.html#recordz/3">recordz/3</a>
433 or <a id="idx:recorded3:749"></a><a class="pred" href="db.html#recorded/3">recorded/3</a>, <a id="idx:clause3:750"></a><a class="pred" href="examineprog.html#clause/3">clause/3</a>,
434 <a id="idx:assert2:751"></a><a class="pred" href="db.html#assert/2">assert/2</a>, <a id="idx:asserta2:752"></a><a class="pred" href="db.html#asserta/2">asserta/2</a>
435 or <a id="idx:assertz2:753"></a><a class="pred" href="db.html#assertz/2">assertz/2</a>.
432 db-reference returned by <a id="idx:recorda3:748"></a><a class="pred" href="db.html#recorda/3">recorda/3</a>, <a id="idx:recordz3:749"></a><a class="pred" href="db.html#recordz/3">recordz/3</a>
433 or <a id="idx:recorded3:750"></a><a class="pred" href="db.html#recorded/3">recorded/3</a>, <a id="idx:clause3:751"></a><a class="pred" href="examineprog.html#clause/3">clause/3</a>,
434 <a id="idx:assert2:752"></a><a class="pred" href="db.html#assert/2">assert/2</a>, <a id="idx:asserta2:753"></a><a class="pred" href="db.html#asserta/2">asserta/2</a>
435 or <a id="idx:assertz2:754"></a><a class="pred" href="db.html#assertz/2">assertz/2</a>.
436436 Fail silently if the referenced object no longer exists.</dd>
437437 <dt class="pubdef"><a id="instance/2"><strong>instance</strong>(<var>+Reference,
438438 -Term</var>)</a></dt>
448448 flag. Unify <var>Old</var> with the old value associated with <var>Key</var>.
449449 If the key is used for the first time <var>Old</var> is unified with the
450450 integer 0. Then store the value of <var>New</var>, which should be an
451 integer, float, atom or arithmetic expression, under <var>Key</var>. <a id="idx:flag3:754"></a><a class="pred" href="db.html#flag/3">flag/3</a>
451 integer, float, atom or arithmetic expression, under <var>Key</var>. <a id="idx:flag3:755"></a><a class="pred" href="db.html#flag/3">flag/3</a>
452452 is a fast mechanism for storing simple facts in the database. The flag
453453 database is shared between threads and updates are atomic, making it
454 suitable for generating unique integer counters.<sup class="fn">63<span class="fn-text">The <a id="idx:flag3:755"></a><a class="pred" href="db.html#flag/3">flag/3</a>
455 predicate is not portable. Non-backtrackable global variables (<a id="idx:nbsetval2:756"></a><a class="pred" href="gvar.html#nb_setval/2">nb_setval/2</a>)
456 and non-backtrackable assignment (<a id="idx:nbsetarg3:757"></a><a class="pred" href="manipterm.html#nb_setarg/3">nb_setarg/3</a>)
454 suitable for generating unique integer counters.<sup class="fn">64<span class="fn-text">The <a id="idx:flag3:756"></a><a class="pred" href="db.html#flag/3">flag/3</a>
455 predicate is not portable. Non-backtrackable global variables (<a id="idx:nbsetval2:757"></a><a class="pred" href="gvar.html#nb_setval/2">nb_setval/2</a>)
456 and non-backtrackable assignment (<a id="idx:nbsetarg3:758"></a><a class="pred" href="manipterm.html#nb_setarg/3">nb_setarg/3</a>)
457457 are more widely recognised special-purpose alternatives for
458458 non-backtrackable and/or global states.</span></sup>
459459 </dd>
464464
465465 <a id="sec:update"></a>
466466
467 <p><a id="idx:logicalupdateview:758"></a><a id="idx:immediateupdateview:759"></a><a id="idx:updateview:760"></a>Traditionally,
467 <p><a id="idx:logicalupdateview:759"></a><a id="idx:immediateupdateview:760"></a><a id="idx:updateview:761"></a>Traditionally,
468468 Prolog systems used the <em>immediate update view</em>: new clauses
469469 became visible to predicates backtracking over dynamic predicates
470470 immediately, and retracted clauses became invisible immediately.
471471
472472 <p>Starting with SWI-Prolog 3.3.0 we adhere to the <em>logical update
473473 view</em>, where backtrackable predicates that enter the definition of a
474 predicate will not see any changes (either caused by <a id="idx:assert1:761"></a><a class="pred" href="db.html#assert/1">assert/1</a>
474 predicate will not see any changes (either caused by <a id="idx:assert1:762"></a><a class="pred" href="db.html#assert/1">assert/1</a>
475475 or
476 <a id="idx:retract1:762"></a><a class="pred" href="db.html#retract/1">retract/1</a>)
476 <a id="idx:retract1:763"></a><a class="pred" href="db.html#retract/1">retract/1</a>)
477477 to the predicate. This view is the ISO standard, the most commonly used
478 and the most `safe'.<sup class="fn">64<span class="fn-text">For example,
478 and the most `safe'.<sup class="fn">65<span class="fn-text">For example,
479479 using the immediate update view, no call to a dynamic predicate is
480480 deterministic.</span></sup> Logical updates are realised by keeping
481481 reference counts on predicates and <em>generation</em> information on
491491
492492 <a id="sec:hashterm"></a>
493493
494 <p><a id="idx:indexingtermhashes:763"></a>The indexing capabilities of
494 <p><a id="idx:indexingtermhashes:764"></a>The indexing capabilities of
495495 SWI-Prolog are described in
496496 <a class="sec" href="jitindex.html">section 2.17</a>. Summarizing,
497497 SWI-Prolog creates indexes for any applicable argument, but only on one
499499 predicates below provide building blocks to circumvent the limitations
500500 of the current indexing system.
501501
502 <p>Programs that aim at portability should consider using <a id="idx:termhash2:764"></a><a class="pred" href="db.html#term_hash/2">term_hash/2</a>
502 <p>Programs that aim at portability should consider using <a id="idx:termhash2:765"></a><a class="pred" href="db.html#term_hash/2">term_hash/2</a>
503503 and
504 <a id="idx:termhash4:765"></a><a class="pred" href="db.html#term_hash/4">term_hash/4</a>
504 <a id="idx:termhash4:766"></a><a class="pred" href="db.html#term_hash/4">term_hash/4</a>
505505 to design their database such that indexing on constant or functor
506506 (name/arity reference) on the first argument is sufficient.
507507
509509 <dt class="pubdef"><span class="pred-tag">[det]</span><a id="term_hash/2"><strong>term_hash</strong>(<var>+Term,
510510 -HashKey</var>)</a></dt>
511511 <dd class="defbody">
512 If <var>Term</var> is a ground term (see <a id="idx:ground1:766"></a><a class="pred" href="typetest.html#ground/1">ground/1</a>), <var>HashKey</var>
512 If <var>Term</var> is a ground term (see <a id="idx:ground1:767"></a><a class="pred" href="typetest.html#ground/1">ground/1</a>), <var>HashKey</var>
513513 is unified with a positive integer value that may be used as a hash key
514514 to the value. If <var>Term</var> is not ground, the predicate leaves <var>HashKey</var>
515515 an unbound variable. Hash keys are in the range <var>0 ... 16,777,215</var>,
521521
522522 <p>The hash key does not rely on temporary information like addresses of
523523 atoms and may be assumed constant over different invocations and
524 versions of SWI-Prolog.<sup class="fn">65<span class="fn-text">Last
524 versions of SWI-Prolog.<sup class="fn">66<span class="fn-text">Last
525525 change: version 5.10.4</span></sup> Hashes differ between big and little
526 endian machines. The <a id="idx:termhash2:767"></a><a class="pred" href="db.html#term_hash/2">term_hash/2</a>
526 endian machines. The <a id="idx:termhash2:768"></a><a class="pred" href="db.html#term_hash/2">term_hash/2</a>
527527 predicate is cycle-safe.<sup class="fn">bug<span class="fn-text">All
528528 arguments that (indirectly) lead to a cycle have the same hash key.</span></sup></dd>
529529 <dt class="pubdef"><span class="pred-tag">[det]</span><a id="term_hash/4"><strong>term_hash</strong>(<var>+Term,
530530 +Depth, +Range, -HashKey</var>)</a></dt>
531531 <dd class="defbody">
532 As <a id="idx:termhash2:768"></a><a class="pred" href="db.html#term_hash/2">term_hash/2</a>,
532 As <a id="idx:termhash2:769"></a><a class="pred" href="db.html#term_hash/2">term_hash/2</a>,
533533 but only considers <var>Term</var> to the specified
534534 <var>Depth</var>. The top-level term has depth 1, its arguments have
535535 depth 2, etc. That is, <var><var>Depth</var> = 0</var> hashes nothing; <var><var>Depth</var>
543543 -SHA1</var>)</a></dt>
544544 <dd class="defbody">
545545 Compute a SHA1-hash from <var>Term</var>. The hash is represented as a
546 40-byte hexadecimal atom. Unlike <a id="idx:termhash2:769"></a><a class="pred" href="db.html#term_hash/2">term_hash/2</a>
546 40-byte hexadecimal atom. Unlike <a id="idx:termhash2:770"></a><a class="pred" href="db.html#term_hash/2">term_hash/2</a>
547547 and friends, this predicate produces a hash key for non-ground terms.
548548 The hash is invariant over variable-renaming (see <a class="pred" href="compare.html#=@=/2">=@=/2</a>)
549549 and constants over different invocations of Prolog.<sup class="fn">bug<span class="fn-text">The
552552
553553 <p>This predicate raises an exception when trying to compute the hash on
554554 a cyclic term or attributed term. Attributed terms are not handled
555 because <a id="idx:subsumeschk2:770"></a><span class="pred-ext">subsumes_chk/2</span>
555 because <a id="idx:subsumeschk2:771"></a><span class="pred-ext">subsumes_chk/2</span>
556556 is not considered well defined for attributed terms. Cyclic terms are
557557 not supported because this would require establishing a canonical cycle.
558558 That is, given A=[a|A] and B=[a,a|B],
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.11</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.11</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.37</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.37</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
242242 2.9</a>.
243243
244244 <p>If you have installed XPCE, you can use the graphical front-end of
245 the tracer. This front-end is installed using the predicate <a id="idx:guitracer0:1392"></a><a class="pred" href="guitracer.html#guitracer/0">guitracer/0</a>.
245 the tracer. This front-end is installed using the predicate <a id="idx:guitracer0:1394"></a><a class="pred" href="guitracer.html#guitracer/0">guitracer/0</a>.
246246
247247 <dl class="latex">
248248 <dt class="pubdef"><a id="trace/0"><strong>trace</strong></a></dt>
249249 <dd class="defbody">
250 Start the tracer. <a id="idx:trace0:1393"></a><a class="pred" href="debugger.html#trace/0">trace/0</a>
250 Start the tracer. <a id="idx:trace0:1395"></a><a class="pred" href="debugger.html#trace/0">trace/0</a>
251251 itself cannot be seen in the tracer. Note that the Prolog top level
252 treats <a id="idx:trace0:1394"></a><a class="pred" href="debugger.html#trace/0">trace/0</a>
252 treats <a id="idx:trace0:1396"></a><a class="pred" href="debugger.html#trace/0">trace/0</a>
253253 special; it means `trace the next goal'.
254254 </dd>
255255 <dt class="pubdef"><a id="tracing/0"><strong>tracing</strong></a></dt>
256256 <dd class="defbody">
257 True if the tracer is currently switched on. <a id="idx:tracing0:1395"></a><a class="pred" href="debugger.html#tracing/0">tracing/0</a>
257 True if the tracer is currently switched on. <a id="idx:tracing0:1397"></a><a class="pred" href="debugger.html#tracing/0">tracing/0</a>
258258 itself cannot be seen in the tracer.
259259 </dd>
260260 <dt class="pubdef"><a id="notrace/0"><strong>notrace</strong></a></dt>
261261 <dd class="defbody">
262 Stop the tracer. <a id="idx:notrace0:1396"></a><a class="pred" href="debugger.html#notrace/0">notrace/0</a>
262 Stop the tracer. <a id="idx:notrace0:1398"></a><a class="pred" href="debugger.html#notrace/0">notrace/0</a>
263263 itself cannot be seen in the tracer.
264264 </dd>
265265 <dt class="pubdef"><a id="guitracer/0"><strong>guitracer</strong></a></dt>
266266 <dd class="defbody">
267 Installs hooks (see <a id="idx:prologtraceinterception4:1397"></a><a class="pred" href="tracehook.html#prolog_trace_interception/4">prolog_trace_interception/4</a>)
267 Installs hooks (see <a id="idx:prologtraceinterception4:1399"></a><a class="pred" href="tracehook.html#prolog_trace_interception/4">prolog_trace_interception/4</a>)
268268 into the system that redirect tracing information to a GUI front-end
269269 providing structured access to variable bindings, graphical overview of
270270 the stack and highlighting of relevant source code.
288288 sign, the trace point is cleared for the port. If it is preceded by a <code><code>+</code></code>,
289289 the trace point is set.
290290
291 <p>The predicate <a id="idx:trace2:1398"></a><a class="pred" href="debugger.html#trace/2">trace/2</a>
292 activates debug mode (see <a id="idx:debug0:1399"></a><a class="pred" href="debugger.html#debug/0">debug/0</a>).
291 <p>The predicate <a id="idx:trace2:1400"></a><a class="pred" href="debugger.html#trace/2">trace/2</a>
292 activates debug mode (see <a id="idx:debug0:1401"></a><a class="pred" href="debugger.html#debug/0">debug/0</a>).
293293 Each time a port (of the 4-port model) is passed that has a trace point
294 set, the goal is printed as with <a id="idx:trace0:1400"></a><a class="pred" href="debugger.html#trace/0">trace/0</a>.
295 Unlike <a id="idx:trace0:1401"></a><a class="pred" href="debugger.html#trace/0">trace/0</a>,
294 set, the goal is printed as with <a id="idx:trace0:1402"></a><a class="pred" href="debugger.html#trace/0">trace/0</a>.
295 Unlike <a id="idx:trace0:1403"></a><a class="pred" href="debugger.html#trace/0">trace/0</a>,
296296 however, the execution is continued without asking for further
297297 information. Examples:
298298
304304 <tr><td><code>?- trace(bar/1, -all).</code> </td><td>Stop tracing bar/1.</td></tr>
305305 </table>
306306
307 <p>The predicate <a id="idx:debugging0:1402"></a><a class="pred" href="debugger.html#debugging/0">debugging/0</a>
307 <p>The predicate <a id="idx:debugging0:1404"></a><a class="pred" href="debugger.html#debugging/0">debugging/0</a>
308308 shows all currently defined trace points.</dd>
309309 <dt class="pubdef"><a id="notrace/1"><strong>notrace</strong>(<var>:Goal</var>)</a></dt>
310310 <dd class="defbody">
311311 Call <var>Goal</var>, but suspend the debugger while <var>Goal</var> is
312312 executing. The current implementation cuts the choice points of <var>Goal</var>
313 after successful completion. See <a id="idx:once1:1403"></a><a class="pred" href="metacall.html#once/1">once/1</a>.
314 Later implementations may have the same semantics as <a id="idx:call1:1404"></a><a class="pred" href="metacall.html#call/1">call/1</a>.</dd>
313 after successful completion. See <a id="idx:once1:1405"></a><a class="pred" href="metacall.html#once/1">once/1</a>.
314 Later implementations may have the same semantics as <a id="idx:call1:1406"></a><a class="pred" href="metacall.html#call/1">call/1</a>.</dd>
315315 <dt class="pubdef"><a id="debug/0"><strong>debug</strong></a></dt>
316316 <dd class="defbody">
317317 Start debugger. In debug mode, Prolog stops at spy and trace points,
323323 enlarged to 8&nbsp;K cells if debugging is switched off in order to
324324 avoid excessive GC. GC complicates tracing because it renames the <i>_G&lt;NNN&gt;</i>
325325 variables and replaces unreachable variables with the atom
326 <code>&lt;garbage_collected&gt;</code>. Calling <a id="idx:nodebug0:1405"></a><a class="pred" href="debugger.html#nodebug/0">nodebug/0</a>
326 <code>&lt;garbage_collected&gt;</code>. Calling <a id="idx:nodebug0:1407"></a><a class="pred" href="debugger.html#nodebug/0">nodebug/0</a>
327327 does <em>not</em> reset the initial free-margin because several parts of
328328 the top level and debugger disable debugging of system code regions. See
329 also <a id="idx:setprologstack2:1406"></a><a class="pred" href="memory.html#set_prolog_stack/2">set_prolog_stack/2</a>.</dd>
329 also <a id="idx:setprologstack2:1408"></a><a class="pred" href="memory.html#set_prolog_stack/2">set_prolog_stack/2</a>.</dd>
330330 <dt class="pubdef"><a id="nodebug/0"><strong>nodebug</strong></a></dt>
331331 <dd class="defbody">
332332 Stop debugger. Implemented by the Prolog flag <a class="flag" href="flags.html#flag:debug">debug</a>.
333 See also <a id="idx:debug0:1407"></a><a class="pred" href="debugger.html#debug/0">debug/0</a>.</dd>
333 See also <a id="idx:debug0:1409"></a><a class="pred" href="debugger.html#debug/0">debug/0</a>.</dd>
334334 <dt class="pubdef"><a id="debugging/0"><strong>debugging</strong></a></dt>
335335 <dd class="defbody">
336336 Print debug status and spy points on current output stream. See also the
368368 port.</dd>
369369 <dt class="pubdef"><a id="visible/1"><strong>visible</strong>(<var>+Ports</var>)</a></dt>
370370 <dd class="defbody">
371 Set the ports shown by the debugger. See <a id="idx:leash1:1408"></a><a class="pred" href="debugger.html#leash/1">leash/1</a>
371 Set the ports shown by the debugger. See <a id="idx:leash1:1410"></a><a class="pred" href="debugger.html#leash/1">leash/1</a>
372372 for a description of the <var>Ports</var> specification. Default is <code>full</code>.</dd>
373373 <dt class="pubdef"><a id="unknown/2"><strong>unknown</strong>(<var>-Old,
374374 +New</var>)</a></dt>
378378 are <code>trace</code> (meaning <code>error</code>) and <code>fail</code>.
379379 If the <a class="flag" href="flags.html#flag:unknown">unknown</a> flag
380380 is set to
381 <code>warning</code>, <a id="idx:unknown2:1409"></a><a class="pred" href="debugger.html#unknown/2">unknown/2</a>
381 <code>warning</code>, <a id="idx:unknown2:1411"></a><a class="pred" href="debugger.html#unknown/2">unknown/2</a>
382382 reports the value as <code>trace</code>.</dd>
383383 <dt class="pubdef"><a id="style_check/1"><strong>style_check</strong>(<var>+Spec</var>)</a></dt>
384384 <dd class="defbody">
393393 is unbound, all active style check options are returned on backtracking.
394394 </ul>
395395
396 <p>Loading a file using <a id="idx:loadfiles2:1410"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>
396 <p>Loading a file using <a id="idx:loadfiles2:1412"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>
397397 or one of its derived predicates reset the style checking options to
398398 their value before loading the file, scoping the option to the remainder
399399 of the file and all files loaded
402402 <dl class="latex">
403403 <dt><strong>singleton</strong>(<var>true</var>)</dt>
404404 <dd class="defbody">
405 The predicate <a id="idx:readclause3:1411"></a><a class="pred" href="termrw.html#read_clause/3">read_clause/3</a>
405 The predicate <a id="idx:readclause3:1413"></a><a class="pred" href="termrw.html#read_clause/3">read_clause/3</a>
406406 (used by the compiler to read source code) warns on variables appearing
407407 only once in a term (clause) which have a name not starting with an
408408 underscore. See <a class="sec" href="syntax.html">section 2.15.2.5</a>
453453 might be enhanced with a deeper analysis to be more precise.</dd>
454454 <dt><strong>atom</strong>(<var>true</var>)</dt>
455455 <dd class="defbody">
456 The predicate <a id="idx:read1:1412"></a><a class="pred" href="termrw.html#read/1">read/1</a>
456 The predicate <a id="idx:read1:1414"></a><a class="pred" href="termrw.html#read/1">read/1</a>
457457 and derived predicates produce an error message on quoted atoms or
458458 strings with more than 6 <em>unescaped</em> newlines. Newlines may be
459459 escaped with <code><code>\</code></code> or <code><code>\</code></code><code>c</code>.
465465 <dd class="defbody">
466466 Warn if the clauses for a predicate are not together in the same source
467467 file. It is advised to disable the warning for discontiguous predicates
468 using the <a id="idx:discontiguous1:1413"></a><a class="pred" href="dynamic.html#discontiguous/1">discontiguous/1</a>
468 using the <a id="idx:discontiguous1:1415"></a><a class="pred" href="dynamic.html#discontiguous/1">discontiguous/1</a>
469469 directive.</dd>
470470 <dt><strong>charset</strong>(<var>false</var>)</dt>
471471 <dd class="defbody">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 8.4</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 8.4</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
299299
300300 <p><h3 id="sec:chr-tracing"><a id="sec:8.4.2"><span class="sec-nr">8.4.2</span> <span class="sec-title">Tracing</span></a></h3>
301301
302 <a id="sec:chr-tracing"></a> Tracing is enabled with the <a id="idx:chrtrace0:1676"></a><a class="pred" href="debugging.html#chr_trace/0">chr_trace/0</a>
303 predicate and disabled with the <a id="idx:chrnotrace0:1677"></a><a class="pred" href="debugging.html#chr_notrace/0">chr_notrace/0</a>
302 <a id="sec:chr-tracing"></a> Tracing is enabled with the <a id="idx:chrtrace0:1679"></a><a class="pred" href="debugging.html#chr_trace/0">chr_trace/0</a>
303 predicate and disabled with the <a id="idx:chrnotrace0:1680"></a><a class="pred" href="debugging.html#chr_notrace/0">chr_notrace/0</a>
304304 predicate.
305305
306306 <p>When enabled the tracer will step through the <code>call</code>,
343343 </dd>
344344 <dt><strong>break</strong></dt>
345345 <dd class="defbody">
346 Enter a recursive Prolog top level. See <a id="idx:break0:1678"></a><a class="pred" href="toplevel.html#break/0">break/0</a>.
346 Enter a recursive Prolog top level. See <a id="idx:break0:1681"></a><a class="pred" href="toplevel.html#break/0">break/0</a>.
347347 </dd>
348348 <dt><strong>abort</strong></dt>
349349 <dd class="defbody">
350 Exit to the top level. See <a id="idx:abort0:1679"></a><a class="pred" href="toplevel.html#abort/0">abort/0</a>.
350 Exit to the top level. See <a id="idx:abort0:1682"></a><a class="pred" href="toplevel.html#abort/0">abort/0</a>.
351351 </dd>
352352 <dt><strong>fail</strong></dt>
353353 <dd class="defbody">
370370 <dt class="pubdef"><a id="chr_trace/0"><strong>chr_trace</strong></a></dt>
371371 <dd class="defbody">
372372 Activate the CHR tracer. By default the CHR tracer is activated and
373 deactivated automatically by the Prolog predicates <a id="idx:trace0:1680"></a><a class="pred" href="debugger.html#trace/0">trace/0</a>
373 deactivated automatically by the Prolog predicates <a id="idx:trace0:1683"></a><a class="pred" href="debugger.html#trace/0">trace/0</a>
374374 and
375 <a id="idx:notrace0:1681"></a><a class="pred" href="debugger.html#notrace/0">notrace/0</a>.</dd>
375 <a id="idx:notrace0:1684"></a><a class="pred" href="debugger.html#notrace/0">notrace/0</a>.</dd>
376376 <dt class="pubdef"><a id="chr_notrace/0"><strong>chr_notrace</strong></a></dt>
377377 <dd class="defbody">
378378 Deactivate the CHR tracer. By default the CHR tracer is activated and
379 deactivated automatically by the Prolog predicates <a id="idx:trace0:1682"></a><a class="pred" href="debugger.html#trace/0">trace/0</a>
379 deactivated automatically by the Prolog predicates <a id="idx:trace0:1685"></a><a class="pred" href="debugger.html#trace/0">trace/0</a>
380380 and
381 <a id="idx:notrace0:1683"></a><a class="pred" href="debugger.html#notrace/0">notrace/0</a>.</dd>
381 <a id="idx:notrace0:1686"></a><a class="pred" href="debugger.html#notrace/0">notrace/0</a>.</dd>
382382 <dt class="pubdef"><a id="chr_leash/1"><strong>chr_leash</strong>(<var>+Spec</var>)</a></dt>
383383 <dd class="defbody">
384384 Define the set of CHR ports on which the CHR tracer asks for user
388388 all ports, <code>none</code> or <code>off</code> to never stop, and <code>default</code>
389389 to stop at the <code>call</code>,
390390 <code>exit</code>, <code>fail</code>, <code>wake</code> and <code>apply</code>
391 ports. See also <a id="idx:leash1:1684"></a><a class="pred" href="debugger.html#leash/1">leash/1</a>.</dd>
391 ports. See also <a id="idx:leash1:1687"></a><a class="pred" href="debugger.html#leash/1">leash/1</a>.</dd>
392392 <dt class="pubdef"><a id="chr_show_store/1"><strong>chr_show_store</strong>(<var>+Mod</var>)</a></dt>
393393 <dd class="defbody">
394394 Prints all suspended constraints of module <var>Mod</var> to the
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 2.9</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 2.9</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 6.2</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 6.2</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
238238 <a id="sec:defmodule"></a>
239239
240240 <p>Modules are normally created by loading a <em>module file</em>. A
241 module file is a file holding a <a id="idx:module2:1517"></a><a class="pred" href="defmodule.html#module/2">module/2</a>
241 module file is a file holding a <a id="idx:module2:1519"></a><a class="pred" href="defmodule.html#module/2">module/2</a>
242242 directive as its first term. The
243 <a id="idx:module2:1518"></a><a class="pred" href="defmodule.html#module/2">module/2</a>
243 <a id="idx:module2:1520"></a><a class="pred" href="defmodule.html#module/2">module/2</a>
244244 directive declares the name and the public (i.e., externally visible)
245245 predicates of the module. The rest of the file is loaded into the
246 module. Below is an example of a module file, defining <a id="idx:reverse2:1519"></a><a class="pred" href="lists.html#reverse/2">reverse/2</a>
247 and hiding the helper predicate <a id="idx:rev3:1520"></a><span class="pred-ext">rev/3</span>.
246 module. Below is an example of a module file, defining <a id="idx:reverse2:1521"></a><a class="pred" href="lists.html#reverse/2">reverse/2</a>
247 and hiding the helper predicate <a id="idx:rev3:1522"></a><span class="pred-ext">rev/3</span>.
248248 A module can use all built-in predicates and, by default, cannot
249249 redefine system predicates.
250250
286286 <dt class="pubdef"><a id="module/3">:- <strong>module</strong>(<var>+Module,
287287 +PublicList, +Dialect</var>)</a></dt>
288288 <dd class="defbody">
289 Same as <a id="idx:module2:1521"></a><a class="pred" href="defmodule.html#module/2">module/2</a>.
289 Same as <a id="idx:module2:1523"></a><a class="pred" href="defmodule.html#module/2">module/2</a>.
290290 The additional <var>Dialect</var> argument provides a list of <em>language
291 options</em>. Each atom in the list <var>Dialect</var> is mapped to a <a id="idx:usemodule1:1522"></a><a class="pred" href="import.html#use_module/1">use_module/1</a>
291 options</em>. Each atom in the list <var>Dialect</var> is mapped to a <a id="idx:usemodule1:1524"></a><a class="pred" href="import.html#use_module/1">use_module/1</a>
292292 goal as given below. See also <a class="sec" href="dialect.html">section
293293 C</a>. The third argument is supported for compatibility with the
294294 <a class="url" href="http://prolog-commons.org/">Prolog Commons project</a>.
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
237237
238238 <a id="sec:dialect"></a>
239239
240 <p><a id="idx:YAPprolog:2047"></a><a id="idx:portableprologcode:2048"></a>This
240 <p><a id="idx:YAPprolog:2050"></a><a id="idx:portableprologcode:2051"></a>This
241241 chapter explains issues for writing portable Prolog programs. It was
242242 started after discussion with Vitor Santos Costa, the leading developer
243 of YAP Prolog<sup class="fn">164<span class="fn-text"><a class="url" href="http://yap.sourceforge.net/">http://yap.sourceforge.net/</a></span></sup>
243 of YAP Prolog<sup class="fn">167<span class="fn-text"><a class="url" href="http://yap.sourceforge.net/">http://yap.sourceforge.net/</a></span></sup>
244244 YAP and SWI-Prolog have expressed the ambition to enhance the
245245 portability beyond the trivial Prolog examples, including complex
246246 libraries involving foreign code.
270270 4.3.1.2</a>.
271271
272272 <p>
273 <li>The predicate <a id="idx:expectsdialect1:2049"></a><a class="pred" href="dialect.html#expects_dialect/1">expects_dialect/1</a>
273 <li>The predicate <a id="idx:expectsdialect1:2052"></a><a class="pred" href="dialect.html#expects_dialect/1">expects_dialect/1</a>
274274 allows for specifying for which Prolog system the code was written.
275275
276276 <p>
277 <li>The predicates <a id="idx:existssource1:2050"></a><a class="pred" href="dialect.html#exists_source/1">exists_source/1</a>
278 and <a id="idx:sourceexports2:2051"></a><a class="pred" href="dialect.html#source_exports/2">source_exports/2</a>
279 can be used to query the library content. The <a id="idx:require1:2052"></a><a class="pred" href="consulting.html#require/1">require/1</a>
277 <li>The predicates <a id="idx:existssource1:2053"></a><a class="pred" href="dialect.html#exists_source/1">exists_source/1</a>
278 and <a id="idx:sourceexports2:2054"></a><a class="pred" href="dialect.html#source_exports/2">source_exports/2</a>
279 can be used to query the library content. The <a id="idx:require1:2055"></a><a class="pred" href="consulting.html#require/1">require/1</a>
280280 directive can be used to get access to predicates without knowing their
281281 location.
282282
283283 <p>
284 <li>The module predicates <a id="idx:usemodule1:2053"></a><a class="pred" href="import.html#use_module/1">use_module/1</a>, <a id="idx:usemodule2:2054"></a><a class="pred" href="import.html#use_module/2">use_module/2</a>
284 <li>The module predicates <a id="idx:usemodule1:2056"></a><a class="pred" href="import.html#use_module/1">use_module/1</a>, <a id="idx:usemodule2:2057"></a><a class="pred" href="import.html#use_module/2">use_module/2</a>
285285 have been extended with a notion for `import-except' and `import-as'.
286 This is particularly useful together with <a id="idx:reexport1:2055"></a><a class="pred" href="reexport.html#reexport/1">reexport/1</a>
287 and <a id="idx:reexport2:2056"></a><a class="pred" href="reexport.html#reexport/2">reexport/2</a>
286 This is particularly useful together with <a id="idx:reexport1:2058"></a><a class="pred" href="reexport.html#reexport/1">reexport/1</a>
287 and <a id="idx:reexport2:2059"></a><a class="pred" href="reexport.html#reexport/2">reexport/2</a>
288288 to compose modules from other modules and mapping names.
289289
290290 <p>
298298 This directive states that the code following the directive is written
299299 for the given Prolog <var>Dialect</var>. See also <a class="flag" href="flags.html#flag:dialect">dialect</a>.
300300 The declaration holds until the end of the file in which it appears. The
301 current dialect is available using <a id="idx:prologloadcontext2:2057"></a><a class="pred" href="consulting.html#prolog_load_context/2">prolog_load_context/2</a>.
301 current dialect is available using <a id="idx:prologloadcontext2:2060"></a><a class="pred" href="consulting.html#prolog_load_context/2">prolog_load_context/2</a>.
302302
303303 <p>The exact behaviour of this predicate is still subject to discussion.
304304 Of course, if <var>Dialect</var> matches the running dialect the
311311 <li>Define system predicates of the requested dialect we do not have.
312312
313313 <p>
314 <li>Apply <a id="idx:goalexpansion2:2058"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a>
314 <li>Apply <a id="idx:goalexpansion2:2061"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a>
315315 rules that map conflicting predicates to versions emulating the
316316 requested dialect. These expansion rules reside in the dialect
317317 compatibility module, but are applied if prolog_load_context(dialect,
328328 <dt class="pubdef"><a id="exists_source/1"><strong>exists_source</strong>(<var>+Spec</var>)</a></dt>
329329 <dd class="defbody">
330330 Is true if <var>Spec</var> exists as a Prolog source. <var>Spec</var>
331 uses the same conventions as <a id="idx:loadfiles2:2059"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>.
331 uses the same conventions as <a id="idx:loadfiles2:2062"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>.
332332 Fails without error if <var>Spec</var> cannot be found.</dd>
333333 <dt class="pubdef"><a id="source_exports/2"><strong>source_exports</strong>(<var>+Spec,
334334 +Export</var>)</a></dt>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 5.4</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 5.4</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
336336
337337 <p>Note that expansion of <a class="function" href="arith.html#f-./2">./2</a>
338338 terms implies that such terms cannot be created by writing them
339 explicitly in your source code. Such terms can still be created with <a id="idx:functor3:1484"></a><a class="pred" href="manipterm.html#functor/3">functor/3</a>, <a class="pred" href="manipterm.html#=../2">=../2</a>,
340 <a id="idx:compoundnamearity3:1485"></a><a class="pred" href="manipterm.html#compound_name_arity/3">compound_name_arity/3</a>
339 explicitly in your source code. Such terms can still be created with <a id="idx:functor3:1486"></a><a class="pred" href="manipterm.html#functor/3">functor/3</a>, <a class="pred" href="manipterm.html#=../2">=../2</a>,
340 <a id="idx:compoundnamearity3:1487"></a><a class="pred" href="manipterm.html#compound_name_arity/3">compound_name_arity/3</a>
341341 and
342 <a id="idx:compoundnamearguments3:1486"></a><a class="pred" href="manipterm.html#compound_name_arguments/3">compound_name_arguments/3</a>.<sup class="fn">131<span class="fn-text">Traditional
342 <a id="idx:compoundnamearguments3:1488"></a><a class="pred" href="manipterm.html#compound_name_arguments/3">compound_name_arguments/3</a>.<sup class="fn">134<span class="fn-text">Traditional
343343 code is unlikely to use <a class="function" href="arith.html#f-./2">./2</a>
344344 terms because they were practically reserved for usage in lists. We do
345345 not provide a quoting mechanism as found in functional languages because
353353 <dd class="defbody">
354354 This predicate is called to evaluate <a class="function" href="arith.html#f-./2">./2</a>
355355 terms found in the arguments of a goal. This predicate evaluates the
356 field extraction described above, which is mapped to <a id="idx:getdictex3:1487"></a><span class="pred-ext">get_dict_ex/3</span>.
356 field extraction described above, which is mapped to <a id="idx:getdictex3:1489"></a><span class="pred-ext">get_dict_ex/3</span>.
357357 If <var>Function</var> is a compound term, it checks for the predefined
358358 functions on dicts described in <a class="sec" href="dicts.html">section
359359 5.4.1.2</a> or executes a user defined function as described in <a class="sec" href="dicts.html">section
377377 provides a more convenient syntax for representing the head of such
378378 predicates without worrying about the argument calling conventions. The
379379 code below defines a function <code>multiply(Times)</code> on a point
380 that creates a new point by multiplying both coordinates. and <code>len()</code><sup class="fn">132<span class="fn-text">as <code>length()</code>
381 would result in a predicate <a id="idx:length2:1488"></a><a class="pred" href="builtinlist.html#length/2">length/2</a>,
380 that creates a new point by multiplying both coordinates. and <code>len()</code><sup class="fn">135<span class="fn-text">as <code>length()</code>
381 would result in a predicate <a id="idx:length2:1490"></a><a class="pred" href="builtinlist.html#length/2">length/2</a>,
382382 this name cannot be used. This might change in future versions.</span></sup>
383383 to compute the length from the origin. The . and <code>:=</code>
384384 operators are used to abstract the location of the predicate arguments.
416416 <dl class="latex">
417417 <dt class="pubdef"><a id="m-get-1"><strong>get</strong>(<var>?Key</var>)</a></dt>
418418 <dd class="defbody">
419 Same as <var>Dict</var>.<var>Key</var>, but maps to <a id="idx:getdict3:1489"></a><a class="pred" href="dicts.html#get_dict/3">get_dict/3</a>
419 Same as <var>Dict</var>.<var>Key</var>, but maps to <a id="idx:getdict3:1491"></a><a class="pred" href="dicts.html#get_dict/3">get_dict/3</a>
420420 instead of
421 <a id="idx:getdictex3:1490"></a><span class="pred-ext">get_dict_ex/3</span>.
421 <a id="idx:getdictex3:1492"></a><span class="pred-ext">get_dict_ex/3</span>.
422422 This implies that the function evaluation fails silently if <var>Key</var>
423423 does not appear in <var>Dict</var>. See also
424424 <a class="pred" href="dicts.html#:</2">:&lt;/2</a>, which can be used to
436436 <dt class="pubdef"><a id="m-put-1"><strong>put</strong>(<var>+New</var>)</a></dt>
437437 <dd class="defbody">
438438 Evaluates to a new dict where the key-values in <var>New</var> replace
439 or extend the key-values in the original dict. See <a id="idx:putdict3:1491"></a><a class="pred" href="dicts.html#put_dict/3">put_dict/3</a>.</dd>
439 or extend the key-values in the original dict. See <a id="idx:putdict3:1493"></a><a class="pred" href="dicts.html#put_dict/3">put_dict/3</a>.</dd>
440440 <dt class="pubdef"><a id="m-put-2"><strong>put</strong>(<var>+KeyPath,
441441 +Value</var>)</a></dt>
442442 <dd class="defbody">
443443 Evaluates to a new dict where the <var>KeyPath</var>-<var>Value</var>
444444 replaces or extends the key-values in the original dict. <var>KeyPath</var>
445 is either a key or a term <var>KeyPath</var>/<var>Key</var>,<sup class="fn">133<span class="fn-text">Note
445 is either a key or a term <var>KeyPath</var>/<var>Key</var>,<sup class="fn">136<span class="fn-text">Note
446446 that we do not use the '.' functor here, because the <a class="function" href="arith.html#f-./2">./2</a>
447447 would <em>evaluate</em>.</span></sup> replacing the value associated
448448 with <var>Key</var> in a sub-dict of the dict on which the function
449 operates. See <a id="idx:putdict4:1492"></a><a class="pred" href="dicts.html#put_dict/4">put_dict/4</a>.
449 operates. See <a id="idx:putdict4:1494"></a><a class="pred" href="dicts.html#put_dict/4">put_dict/4</a>.
450450 Below are some examples:
451451
452452 <pre class="code">
529529 <dd class="defbody">
530530 <var>DictOut</var> is a new dict created by replacing or adding
531531 key-value pairs from <var>New</var> to <var>Dict</var>. <var>New</var>
532 is either a dict or a valid input for <a id="idx:dictcreate3:1493"></a><a class="pred" href="dicts.html#dict_create/3">dict_create/3</a>.
532 is either a dict or a valid input for <a id="idx:dictcreate3:1495"></a><a class="pred" href="dicts.html#dict_create/3">dict_create/3</a>.
533533 This predicate is normally accessed using the functional notation. Below
534534 are some examples:
535535
599599 R = _G1705{z:2}.
600600 </pre>
601601
602 <p>See also <a id="idx:selectdict2:1494"></a><span class="pred-ext">select_dict/2</span>
602 <p>See also <a id="idx:selectdict2:1496"></a><span class="pred-ext">select_dict/2</span>
603603 to ignore <var>Rest</var> and <a class="pred" href="dicts.html#>:</2">&gt;:&lt;/2</a>
604604 for a symmetric partial unification of two dicts.</dd>
605605 <dt class="pubdef"><a id=">:</2"><var>+Dict1</var> <strong>&gt;:&lt;</strong> <var>+Dict2</var></a></dt>
616616 Dict &gt;:&lt; point{x:0, y:Y}.
617617 </pre>
618618
619 <p>See also <a class="pred" href="dicts.html#:</2">:&lt;/2</a> and <a id="idx:selectdict3:1495"></a><a class="pred" href="dicts.html#select_dict/3">select_dict/3</a>.
619 <p>See also <a class="pred" href="dicts.html#:</2">:&lt;/2</a> and <a id="idx:selectdict3:1497"></a><a class="pred" href="dicts.html#select_dict/3">select_dict/3</a>.
620620 </dd>
621621 </dl>
622622
635635 with care because identical Prolog terms may be copied or shared add
636636 will of the system. Some of this behaviour can be avoided by adding an
637637 additional unbound value to the dict. This prevents unwanted sharing and
638 ensures that <a id="idx:copyterm2:1496"></a><a class="pred" href="manipterm.html#copy_term/2">copy_term/2</a>
638 ensures that <a id="idx:copyterm2:1498"></a><a class="pred" href="manipterm.html#copy_term/2">copy_term/2</a>
639639 actually copies the dict. This pitfall is demonstrated in the example
640640 below:
641641
656656 to
657657 <var>Value</var>. The update is trailed and undone on backtracking. This
658658 predicate raises an existence error if <var>Key</var> does not appear in
659 <var>Dict</var>. The update semantics are equivalent to <a id="idx:setarg3:1497"></a><a class="pred" href="manipterm.html#setarg/3">setarg/3</a>
659 <var>Dict</var>. The update semantics are equivalent to <a id="idx:setarg3:1499"></a><a class="pred" href="manipterm.html#setarg/3">setarg/3</a>
660660 and
661 <a id="idx:bsetval2:1498"></a><a class="pred" href="gvar.html#b_setval/2">b_setval/2</a>.</dd>
661 <a id="idx:bsetval2:1500"></a><a class="pred" href="gvar.html#b_setval/2">b_setval/2</a>.</dd>
662662 <dt class="pubdef"><span class="pred-tag">[det]</span><a id="nb_set_dict/3"><strong>nb_set_dict</strong>(<var>+Key,
663663 !Dict, +Value</var>)</a></dt>
664664 <dd class="defbody">
666666 to a copy of <var>Value</var>. The update is <em>not</em> undone on
667667 backtracking. This predicate raises an existence error if <var>Key</var>
668668 does not appear in
669 <var>Dict</var>. The update semantics are equivalent to <a id="idx:nbsetarg3:1499"></a><a class="pred" href="manipterm.html#nb_setarg/3">nb_setarg/3</a>
669 <var>Dict</var>. The update semantics are equivalent to <a id="idx:nbsetarg3:1501"></a><a class="pred" href="manipterm.html#nb_setarg/3">nb_setarg/3</a>
670670 and
671 <a id="idx:nbsetval2:1500"></a><a class="pred" href="gvar.html#nb_setval/2">nb_setval/2</a>.</dd>
671 <a id="idx:nbsetval2:1502"></a><a class="pred" href="gvar.html#nb_setval/2">nb_setval/2</a>.</dd>
672672 <dt class="pubdef"><span class="pred-tag">[det]</span><a id="nb_link_dict/3"><strong>nb_link_dict</strong>(<var>+Key,
673673 !Dict, +Value</var>)</a></dt>
674674 <dd class="defbody">
677677 <var>Value</var>. The update is <em>not</em> undone on backtracking.
678678 This predicate raises an existence error if <var>Key</var> does not
679679 appear in
680 <var>Dict</var>. The update semantics are equivalent to <a id="idx:blinkarg3:1501"></a><span class="pred-ext">b_linkarg/3</span>
680 <var>Dict</var>. The update semantics are equivalent to <a id="idx:blinkarg3:1503"></a><span class="pred-ext">b_linkarg/3</span>
681681 and
682 <a id="idx:nblinkval2:1502"></a><a class="pred" href="gvar.html#nb_linkval/2">nb_linkval/2</a>.
682 <a id="idx:nblinkval2:1504"></a><a class="pred" href="gvar.html#nb_linkval/2">nb_linkval/2</a>.
683683 Use with extreme care and consult the documentation of
684 <a id="idx:nblinkval2:1503"></a><a class="pred" href="gvar.html#nb_linkval/2">nb_linkval/2</a>
684 <a id="idx:nblinkval2:1505"></a><a class="pred" href="gvar.html#nb_linkval/2">nb_linkval/2</a>
685685 before use.
686686 </dd>
687687 </dl>
773773 code does not rely on ordered operations.</dd>
774774 <dt><b>Library <code>library(option)</code></b></dt>
775775 <dd>
776 Option lists are introduced by ISO Prolog, for example for <a id="idx:readterm3:1504"></a><a class="pred" href="termrw.html#read_term/3">read_term/3</a>,
777 <a id="idx:open4:1505"></a><a class="pred" href="IO.html#open/4">open/4</a>,
776 Option lists are introduced by ISO Prolog, for example for <a id="idx:readterm3:1506"></a><a class="pred" href="termrw.html#read_term/3">read_term/3</a>,
777 <a id="idx:open4:1507"></a><a class="pred" href="IO.html#open/4">open/4</a>,
778778 etc. The <code>library(option)</code> library provides operations to
779779 extract options, merge options lists, etc. Dicts are well suited to
780780 replace option lists because they are cheaper, can be processed faster
783783 <dd>
784784 This library is commonly used to process large name-value associations.
785785 In many cases this concerns short-lived datastructures that result from
786 <a id="idx:findall3:1506"></a><a class="pred" href="allsolutions.html#findall/3">findall/3</a>, <a id="idx:maplist3:1507"></a><a class="pred" href="apply.html#maplist/3">maplist/3</a>
786 <a id="idx:findall3:1508"></a><a class="pred" href="allsolutions.html#findall/3">findall/3</a>, <a id="idx:maplist3:1509"></a><a class="pred" href="apply.html#maplist/3">maplist/3</a>
787787 and similar list processing predicates. Dicts may play a role if
788788 frequent random key lookups are needed on the resulting association. For
789789 example, the skeleton `create a pairs list', `use
790 <a id="idx:listtoassoc2:1508"></a><a class="pred" href="assoc.html#list_to_assoc/2">list_to_assoc/2</a>
790 <a id="idx:listtoassoc2:1510"></a><a class="pred" href="assoc.html#list_to_assoc/2">list_to_assoc/2</a>
791791 to create an assoc', followed by frequent usage of
792 <a id="idx:getassoc2:1509"></a><span class="pred-ext">get_assoc/2</span>
793 to extract key values can be replaced using <a id="idx:dictpairs2:1510"></a><span class="pred-ext">dict_pairs/2</span>
792 <a id="idx:getassoc2:1511"></a><span class="pred-ext">get_assoc/2</span>
793 to extract key values can be replaced using <a id="idx:dictpairs2:1512"></a><span class="pred-ext">dict_pairs/2</span>
794794 and the dict access functions. Using dicts in this scenario is more
795795 efficient and provides a more pleasant access syntax.
796796 </dd>
830830 <code>library(assoc)</code> allows for efficient manipulation of
831831 changing associations, but the syntactical representation of an assoc is
832832 complex, which makes them unsuitable for e.g., <em>options lists</em> as
833 seen in predicates such as <a id="idx:open4:1511"></a><a class="pred" href="IO.html#open/4">open/4</a>.
833 seen in predicates such as <a id="idx:open4:1513"></a><a class="pred" href="IO.html#open/4">open/4</a>.
834834
835835 <p><h3 id="sec:ext-dicts-implementation"><a id="sec:5.4.5"><span class="sec-nr">5.4.5</span> <span class="sec-title">Implementation
836836 notes about dicts</span></a></h3>
845845 <p>Dicts are currently represented as a compound term using the functor
846846 <code>`dict`</code>. The first argument is the tag. The remaining
847847 arguments create an array of sorted key-value pairs. This representation
848 is compact and guarantees good locality. Lookup is order <var>(N)</var>,
849 while adding valuesm deleting values and merging with other dicts has
848 is compact and guarantees good locality. Lookup is order <var>log( N )</var>,
849 while adding values, deleting values and merging with other dicts has
850850 order
851851 <var>N</var>. The main disadvantage is that changing values in large
852852 dicts is costly, both in terms of memory and time.
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 6.12</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 6.12</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
262262
263263 <p>Import and export from a dynamically created world can be achieved
264264 using
265 <a id="idx:import1:1590"></a><a class="pred" href="altmoduleapi.html#import/1">import/1</a>
266 and <a id="idx:export1:1591"></a><a class="pred" href="altmoduleapi.html#export/1">export/1</a>
265 <a id="idx:import1:1592"></a><a class="pred" href="altmoduleapi.html#import/1">import/1</a>
266 and <a id="idx:export1:1593"></a><a class="pred" href="altmoduleapi.html#export/1">export/1</a>
267267 or by specifying the import module as described in
268268 <a class="sec" href="importmodule.html">section 6.9</a>.
269269
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.14</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.14</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
239239 <a id="sec:declare"></a>
240240
241241 <p>This section describes directives which manipulate attributes of
242 predicate definitions. The functors <a id="idx:dynamic1:771"></a><a class="pred" href="dynamic.html#dynamic/1">dynamic/1</a>, <a id="idx:multifile1:772"></a><a class="pred" href="dynamic.html#multifile/1">multifile/1</a>,
243 <a id="idx:discontiguous1:773"></a><a class="pred" href="dynamic.html#discontiguous/1">discontiguous/1</a>
244 and <a id="idx:public1:774"></a><a class="pred" href="dynamic.html#public/1">public/1</a>
245 are operators of priority 1150 (see <a id="idx:op3:775"></a><a class="pred" href="operators.html#op/3">op/3</a>),
242 predicate definitions. The functors <a id="idx:dynamic1:772"></a><a class="pred" href="dynamic.html#dynamic/1">dynamic/1</a>, <a id="idx:multifile1:773"></a><a class="pred" href="dynamic.html#multifile/1">multifile/1</a>,
243 <a id="idx:discontiguous1:774"></a><a class="pred" href="dynamic.html#discontiguous/1">discontiguous/1</a>
244 and <a id="idx:public1:775"></a><a class="pred" href="dynamic.html#public/1">public/1</a>
245 are operators of priority 1150 (see <a id="idx:op3:776"></a><a class="pred" href="operators.html#op/3">op/3</a>),
246246 which implies that the list of predicates they involve can just be a
247247 comma-separated list:
248248
261261 ...</var></a></dt>
262262 <dd class="defbody">
263263 Informs the interpreter that the definition of the predicate(s) may
264 change during execution (using <a id="idx:assert1:776"></a><a class="pred" href="db.html#assert/1">assert/1</a>
265 and/or <a id="idx:retract1:777"></a><a class="pred" href="db.html#retract/1">retract/1</a>).
264 change during execution (using <a id="idx:assert1:777"></a><a class="pred" href="db.html#assert/1">assert/1</a>
265 and/or <a id="idx:retract1:778"></a><a class="pred" href="db.html#retract/1">retract/1</a>).
266266 In the multithreaded version, the clauses of dynamic predicates are
267 shared between the threads. The directive <a id="idx:threadlocal1:778"></a><a class="pred" href="threadcom.html#thread_local/1">thread_local/1</a>
267 shared between the threads. The directive <a id="idx:threadlocal1:779"></a><a class="pred" href="threadcom.html#thread_local/1">thread_local/1</a>
268268 provides an alternative where each thread has its own clause list for
269269 the predicate. Dynamic predicates can be turned into static ones using
270 <a id="idx:compilepredicates1:779"></a><a class="pred" href="dynamic.html#compile_predicates/1">compile_predicates/1</a>.</dd>
270 <a id="idx:compilepredicates1:780"></a><a class="pred" href="dynamic.html#compile_predicates/1">compile_predicates/1</a>.</dd>
271271 <dt class="pubdef"><a id="compile_predicates/1"><strong>compile_predicates</strong>(<var>:ListOfPredicateIndicators</var>)</a></dt>
272272 <dd class="defbody">
273 Compile a list of specified dynamic predicates (see <a id="idx:dynamic1:780"></a><a class="pred" href="dynamic.html#dynamic/1">dynamic/1</a>
273 Compile a list of specified dynamic predicates (see <a id="idx:dynamic1:781"></a><a class="pred" href="dynamic.html#dynamic/1">dynamic/1</a>
274274 and
275 <a id="idx:assert1:781"></a><a class="pred" href="db.html#assert/1">assert/1</a>)
275 <a id="idx:assert1:782"></a><a class="pred" href="db.html#assert/1">assert/1</a>)
276276 into normal static predicates. This call tells the Prolog environment
277 the definition will not change anymore and further calls to <a id="idx:assert1:782"></a><a class="pred" href="db.html#assert/1">assert/1</a>
278 or <a id="idx:retract1:783"></a><a class="pred" href="db.html#retract/1">retract/1</a>
277 the definition will not change anymore and further calls to <a id="idx:assert1:783"></a><a class="pred" href="db.html#assert/1">assert/1</a>
278 or <a id="idx:retract1:784"></a><a class="pred" href="db.html#retract/1">retract/1</a>
279279 on the named predicates raise a permission error. This predicate is
280280 designed to deal with parts of the program that are generated at runtime
281 but do not change during the remainder of the program execution.<sup class="fn">66<span class="fn-text">The
281 but do not change during the remainder of the program execution.<sup class="fn">67<span class="fn-text">The
282282 specification of this predicate is from Richard O'Keefe. The
283283 implementation is allowed to optimise the predicate. This is not yet
284284 implemented. In multithreaded Prolog, however, static code runs faster
288288 ...</var></a></dt>
289289 <dd class="defbody">
290290 Informs the system that the specified predicate(s) may be defined over
291 more than one file. This stops <a id="idx:consult1:784"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>
291 more than one file. This stops <a id="idx:consult1:785"></a><a class="pred" href="consulting.html#consult/1">consult/1</a>
292292 from redefining a predicate when a new definition is found.</dd>
293293 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="discontiguous/1"><strong>discontiguous</strong> <var>:PredicateIndicator,
294294 ...</var></a></dt>
295295 <dd class="defbody">
296296 Informs the system that the clauses of the specified predicate(s) might
297 not be together in the source file. See also <a id="idx:stylecheck1:785"></a><a class="pred" href="debugger.html#style_check/1">style_check/1</a>.</dd>
297 not be together in the source file. See also <a id="idx:stylecheck1:786"></a><a class="pred" href="debugger.html#style_check/1">style_check/1</a>.</dd>
298298 <dt class="pubdef"><a id="public/1"><strong>public</strong> <var>:PredicateIndicator,
299299 ...</var></a></dt>
300300 <dd class="defbody">
301301 Instructs the cross-referencer that the predicate can be called. It has
302 no semantics.<sup class="fn">67<span class="fn-text">This declaration is
303 compatible with SICStus. In YAP, <a id="idx:public1:786"></a><a class="pred" href="dynamic.html#public/1">public/1</a>
302 no semantics.<sup class="fn">68<span class="fn-text">This declaration is
303 compatible with SICStus. In YAP, <a id="idx:public1:787"></a><a class="pred" href="dynamic.html#public/1">public/1</a>
304304 instructs the compiler to keep the source. As the source is always
305305 available in SWI-Prolog, our current interpretation also enhances the
306306 compatibility with YAP.</span></sup> The public declaration can be
307 queried using <a id="idx:predicateproperty2:787"></a><a class="pred" href="examineprog.html#predicate_property/2">predicate_property/2</a>.
308 The <a id="idx:public1:788"></a><a class="pred" href="dynamic.html#public/1">public/1</a>
307 queried using <a id="idx:predicateproperty2:788"></a><a class="pred" href="examineprog.html#predicate_property/2">predicate_property/2</a>.
308 The <a id="idx:public1:789"></a><a class="pred" href="dynamic.html#public/1">public/1</a>
309309 directive does
310 <em>not</em> export the predicate (see <a id="idx:module1:789"></a><a class="pred" href="mtoplevel.html#module/1">module/1</a>
311 and <a id="idx:export1:790"></a><a class="pred" href="altmoduleapi.html#export/1">export/1</a>).
310 <em>not</em> export the predicate (see <a id="idx:module1:790"></a><a class="pred" href="mtoplevel.html#module/1">module/1</a>
311 and <a id="idx:export1:791"></a><a class="pred" href="altmoduleapi.html#export/1">export/1</a>).
312312 The public directive is used for (1) direct calls into the module from,
313313 e.g., foreign code, (2) direct calls into the module from other modules,
314314 or (3) flag a predicate as being called if the call is generated by
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.4</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.4</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
239239
240240 <p>SWI-Prolog offers an extensible interface which allows the user to
241241 edit objects of the program: predicates, modules, files, etc. The editor
242 interface is implemented by <a id="idx:edit1:538"></a><a class="pred" href="edit.html#edit/1">edit/1</a>
242 interface is implemented by <a id="idx:edit1:539"></a><a class="pred" href="edit.html#edit/1">edit/1</a>
243243 and consists of three parts:
244244 <em>locating</em>, <em>selecting</em> and <em>starting</em> the editor.
245245 Any of these parts may be customized. See <a class="sec" href="edit.html">section
246246 4.4.1</a>.
247247
248 <p>The built-in edit specifications for <a id="idx:edit1:539"></a><a class="pred" href="edit.html#edit/1">edit/1</a>
248 <p>The built-in edit specifications for <a id="idx:edit1:540"></a><a class="pred" href="edit.html#edit/1">edit/1</a>
249249 (see prolog_edit:locate/3) are described in the table below:
250250
251251 <p><table class="latex frame-box center">
271271 into a list of <em>Locations</em>. If there is more than one `hit', the
272272 user is asked to select from the locations found. Finally,
273273 prolog_edit:edit_source/1 is used to invoke the user's preferred editor.
274 Typically, <a id="idx:edit1:540"></a><a class="pred" href="edit.html#edit/1">edit/1</a>
274 Typically, <a id="idx:edit1:541"></a><a class="pred" href="edit.html#edit/1">edit/1</a>
275275 can be handed the name of a predicate, module, basename of a file, XPCE
276276 class, XPCE method, etc.</dd>
277277 <dt class="pubdef"><a id="edit/0"><strong>edit</strong></a></dt>
278278 <dd class="defbody">
279 Edit the `default' file using <a id="idx:edit1:541"></a><a class="pred" href="edit.html#edit/1">edit/1</a>.
279 Edit the `default' file using <a id="idx:edit1:542"></a><a class="pred" href="edit.html#edit/1">edit/1</a>.
280280 The default file is the file loaded with the command line option <strong>-s</strong>
281281 or, in Windows, the file loaded by double-clicking from the Windows
282282 shell.
289289 <a id="sec:customedit"></a>
290290
291291 <p>The predicates described in this section are <em>hooks</em> that can
292 be defined to disambiguate specifications given to <a id="idx:edit1:542"></a><a class="pred" href="edit.html#edit/1">edit/1</a>,
292 be defined to disambiguate specifications given to <a id="idx:edit1:543"></a><a class="pred" href="edit.html#edit/1">edit/1</a>,
293293 find the related source, and open an editor at the given source
294294 location.
295295
297297 <dt class="pubdef"><a id="prolog_edit:locate/3"><strong>prolog_edit:locate</strong>(<var>+Spec,
298298 -FullSpec, -Location</var>)</a></dt>
299299 <dd class="defbody">
300 Where <var>Spec</var> is the specification provided through <a id="idx:edit1:543"></a><a class="pred" href="edit.html#edit/1">edit/1</a>.
300 Where <var>Spec</var> is the specification provided through <a id="idx:edit1:544"></a><a class="pred" href="edit.html#edit/1">edit/1</a>.
301301 This multifile predicate is used to enumerate locations where an object
302302 satisfying the given <var>Spec</var> can be found. <var>FullSpec</var>
303303 is unified with the complete specification for the object. This
318318 <dd class="defbody">
319319 Start editor on <var>Location</var>. See prolog_edit:locate/3 for the
320320 format of a location term. This multifile predicate is normally not
321 defined. If it succeeds, <a id="idx:edit1:544"></a><a class="pred" href="edit.html#edit/1">edit/1</a>
321 defined. If it succeeds, <a id="idx:edit1:545"></a><a class="pred" href="edit.html#edit/1">edit/1</a>
322322 assumes the editor is started.
323323
324 <p>If it fails, <a id="idx:edit1:545"></a><a class="pred" href="edit.html#edit/1">edit/1</a>
324 <p>If it fails, <a id="idx:edit1:546"></a><a class="pred" href="edit.html#edit/1">edit/1</a>
325325 uses its internal defaults, which are defined by the Prolog flag <a class="flag" href="flags.html#flag:editor">editor</a>
326326 and/or the environment variable
327327 <code>EDITOR</code>. The following rules apply. If the Prolog flag <a class="flag" href="flags.html#flag:editor">editor</a>
339339 <dt class="pubdef"><a id="prolog_edit:edit_command/2"><strong>prolog_edit:edit_command</strong>(<var>+Editor,
340340 -Command</var>)</a></dt>
341341 <dd class="defbody">
342 Determines how <var>Editor</var> is to be invoked using <a id="idx:shell1:546"></a><a class="pred" href="system.html#shell/1">shell/1</a>. <var>Editor</var>
343 is the determined editor (see <a id="idx:editsource1:547"></a><span class="pred-ext">edit_source/1</span>),
342 Determines how <var>Editor</var> is to be invoked using <a id="idx:shell1:547"></a><a class="pred" href="system.html#shell/1">shell/1</a>. <var>Editor</var>
343 is the determined editor (see <a id="idx:editsource1:548"></a><span class="pred-ext">edit_source/1</span>),
344344 without the full path specification, and without a possible (<code>.exe</code>)
345345 extension. <var>Command</var> is an atom describing the command. The
346346 following %-sequences are replaced in
347 <var>Command</var> before the result is handed to <a id="idx:shell1:548"></a><a class="pred" href="system.html#shell/1">shell/1</a>:
347 <var>Command</var> before the result is handed to <a id="idx:shell1:549"></a><a class="pred" href="system.html#shell/1">shell/1</a>:
348348
349349 <p><table class="latex frame-box center">
350350 <tr><td>%e</td><td>Replaced by the (OS) command name of the editor </td></tr>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 3.3</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 3.3</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 8.8</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 8.8</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.15</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.15</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
241241 <dt class="pubdef"><a id="current_atom/1"><strong>current_atom</strong>(<var>-Atom</var>)</a></dt>
242242 <dd class="defbody">
243243 Successively unifies <var>Atom</var> with all atoms known to the system.
244 Note that <a id="idx:currentatom1:791"></a><a class="pred" href="examineprog.html#current_atom/1">current_atom/1</a>
244 Note that <a id="idx:currentatom1:792"></a><a class="pred" href="examineprog.html#current_atom/1">current_atom/1</a>
245245 always succeeds if <var>Atom</var> is instantiated to an atom.</dd>
246246 <dt class="pubdef"><a id="current_blob/2"><strong>current_blob</strong>(<var>?Blob,
247247 ?Type</var>)</a></dt>
260260 <dd class="defbody">
261261 Successively unifies <var>FlagKey</var> with all keys used for flags
262262 (see
263 <a id="idx:flag3:792"></a><a class="pred" href="db.html#flag/3">flag/3</a>).</dd>
263 <a id="idx:flag3:793"></a><a class="pred" href="db.html#flag/3">flag/3</a>).</dd>
264264 <dt class="pubdef"><a id="current_key/1"><strong>current_key</strong>(<var>-Key</var>)</a></dt>
265265 <dd class="defbody">
266266 Successively unifies <var>Key</var> with all keys used for records (see
267 <a id="idx:recorda3:793"></a><a class="pred" href="db.html#recorda/3">recorda/3</a>,
267 <a id="idx:recorda3:794"></a><a class="pred" href="db.html#recorda/3">recorda/3</a>,
268268 etc.).</dd>
269269 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="current_predicate/1"><strong>current_predicate</strong>(<var>:PredicateIndicator</var>)</a></dt>
270270 <dd class="defbody">
272272 A predicate is considered defined if it exists in the specified module,
273273 is imported into the module or is defined in one of the modules from
274274 which the predicate will be imported if it is called (see
275 <a class="sec" href="importmodule.html">section 6.9</a>). Note that <a id="idx:currentpredicate1:794"></a><a class="pred" href="examineprog.html#current_predicate/1">current_predicate/1</a>
275 <a class="sec" href="importmodule.html">section 6.9</a>). Note that <a id="idx:currentpredicate1:795"></a><a class="pred" href="examineprog.html#current_predicate/1">current_predicate/1</a>
276276 does <em>not</em> succeed for predicates that can be <em>autoloaded</em>.
277277 See also
278 <a id="idx:currentpredicate2:795"></a><a class="pred" href="examineprog.html#current_predicate/2">current_predicate/2</a>
279 and <a id="idx:predicateproperty2:796"></a><a class="pred" href="examineprog.html#predicate_property/2">predicate_property/2</a>.
278 <a id="idx:currentpredicate2:796"></a><a class="pred" href="examineprog.html#current_predicate/2">current_predicate/2</a>
279 and <a id="idx:predicateproperty2:797"></a><a class="pred" href="examineprog.html#predicate_property/2">predicate_property/2</a>.
280280
281281 <p>If <var>PredicateIndicator</var> is not fully specified, the
282282 predicate only generates values that are defined in or already imported
283283 into the target module. Generating all callable predicates therefore
284 requires enumerating modules using <a id="idx:currentmodule1:797"></a><a class="pred" href="manipmodule.html#current_module/1">current_module/1</a>.
284 requires enumerating modules using <a id="idx:currentmodule1:798"></a><a class="pred" href="manipmodule.html#current_module/1">current_module/1</a>.
285285 Generating predicates callable in a given module requires enumerating
286 the import modules using <a id="idx:importmodule2:798"></a><a class="pred" href="importmodule.html#import_module/2">import_module/2</a>
286 the import modules using <a id="idx:importmodule2:799"></a><a class="pred" href="importmodule.html#import_module/2">import_module/2</a>
287287 and the autoloadable predicates using the
288 <a id="idx:predicateproperty2:799"></a><a class="pred" href="examineprog.html#predicate_property/2">predicate_property/2</a> <code>autoload</code>.</dd>
288 <a id="idx:predicateproperty2:800"></a><a class="pred" href="examineprog.html#predicate_property/2">predicate_property/2</a> <code>autoload</code>.</dd>
289289 <dt class="pubdef"><a id="current_predicate/2"><strong>current_predicate</strong>(<var>?Name,
290290 :Head</var>)</a></dt>
291291 <dd class="defbody">
292 Classical pre-ISO implementation of <a id="idx:currentpredicate1:800"></a><a class="pred" href="examineprog.html#current_predicate/1">current_predicate/1</a>,
292 Classical pre-ISO implementation of <a id="idx:currentpredicate1:801"></a><a class="pred" href="examineprog.html#current_predicate/1">current_predicate/1</a>,
293293 where the predicate is represented by the head term. The advantage is
294294 that this can be used for checking the existence of a predicate before
295 calling it without the need for <a id="idx:functor3:801"></a><a class="pred" href="manipterm.html#functor/3">functor/3</a>:
295 calling it without the need for <a id="idx:functor3:802"></a><a class="pred" href="manipterm.html#functor/3">functor/3</a>:
296296
297297 <pre class="code">
298298 call_if_exists(G) :-
300300 call(G).
301301 </pre>
302302
303 <p>Because of this intended usage, <a id="idx:currentpredicate2:802"></a><a class="pred" href="examineprog.html#current_predicate/2">current_predicate/2</a>
303 <p>Because of this intended usage, <a id="idx:currentpredicate2:803"></a><a class="pred" href="examineprog.html#current_predicate/2">current_predicate/2</a>
304304 also succeeds if the predicate can be autoloaded. Unfortunately,
305305 checking the autoloader makes this predicate relatively slow, in
306306 particular because a failed lookup of the autoloader will cause the
310310 <dd class="defbody">
311311 True when <var>Head</var> refers to a predicate that has property
312312 <var>Property</var>. With sufficiently instantiated <var>Head</var>,
313 <a id="idx:predicateproperty2:803"></a><a class="pred" href="examineprog.html#predicate_property/2">predicate_property/2</a>
313 <a id="idx:predicateproperty2:804"></a><a class="pred" href="examineprog.html#predicate_property/2">predicate_property/2</a>
314314 tries to resolve the predicate the same way as calling it would do: if
315 the predicate is not defined it scans the default modules (see <a id="idx:defaultmodule2:804"></a><a class="pred" href="importmodule.html#default_module/2">default_module/2</a>)
315 the predicate is not defined it scans the default modules (see <a id="idx:defaultmodule2:805"></a><a class="pred" href="importmodule.html#default_module/2">default_module/2</a>)
316316 and finally tries the autoloader. Unlike calling, failure to find the
317317 target predicate causes
318 <a id="idx:predicateproperty2:805"></a><a class="pred" href="examineprog.html#predicate_property/2">predicate_property/2</a>
318 <a id="idx:predicateproperty2:806"></a><a class="pred" href="examineprog.html#predicate_property/2">predicate_property/2</a>
319319 to fail silently. If <var>Head</var> is not sufficiently bound, only
320320 currently locally defined and already imported predicates are
321 enumerated. See <a id="idx:currentpredicate1:806"></a><a class="pred" href="examineprog.html#current_predicate/1">current_predicate/1</a>
321 enumerated. See <a id="idx:currentpredicate1:807"></a><a class="pred" href="examineprog.html#current_predicate/1">current_predicate/1</a>
322322 for enumerating all predicates. A common issue concerns <em>generating</em>
323323 all built-in predicates. This can be achieved using the code below:
324324
343343 seen in the tracer.</dd>
344344 <dt><strong>dynamic</strong></dt>
345345 <dd class="defbody">
346 True if <a id="idx:assert1:807"></a><a class="pred" href="db.html#assert/1">assert/1</a>
347 and <a id="idx:retract1:808"></a><a class="pred" href="db.html#retract/1">retract/1</a>
348 may be used to modify the predicate. This property is set using <a id="idx:dynamic1:809"></a><a class="pred" href="dynamic.html#dynamic/1">dynamic/1</a>.</dd>
346 True if <a id="idx:assert1:808"></a><a class="pred" href="db.html#assert/1">assert/1</a>
347 and <a id="idx:retract1:809"></a><a class="pred" href="db.html#retract/1">retract/1</a>
348 may be used to modify the predicate. This property is set using <a id="idx:dynamic1:810"></a><a class="pred" href="dynamic.html#dynamic/1">dynamic/1</a>.</dd>
349349 <dt><strong>exported</strong></dt>
350350 <dd class="defbody">
351351 True if the predicate is in the public list of the context module.
356356 <dt><strong>file</strong>(<var>FileName</var>)</dt>
357357 <dd class="defbody">
358358 Unify <var>FileName</var> with the name of the source file in which the
359 predicate is defined. See also <a id="idx:sourcefile2:810"></a><a class="pred" href="consulting.html#source_file/2">source_file/2</a>
359 predicate is defined. See also <a id="idx:sourcefile2:811"></a><a class="pred" href="consulting.html#source_file/2">source_file/2</a>
360360 and the property
361361 <code>line_count</code>. Note that this reports the file of the first
362 clause of a predicate. A more robust interface can be achieved using <a id="idx:nthclause3:811"></a><a class="pred" href="examineprog.html#nth_clause/3">nth_clause/3</a>
363 and <a id="idx:clauseproperty2:812"></a><a class="pred" href="examineprog.html#clause_property/2">clause_property/2</a>.</dd>
362 clause of a predicate. A more robust interface can be achieved using <a id="idx:nthclause3:812"></a><a class="pred" href="examineprog.html#nth_clause/3">nth_clause/3</a>
363 and <a id="idx:clauseproperty2:813"></a><a class="pred" href="examineprog.html#clause_property/2">clause_property/2</a>.</dd>
364364 <dt><strong>foreign</strong></dt>
365365 <dd class="defbody">
366366 True if the predicate is defined in the C language.</dd>
367367 <dt><strong>indexed</strong>(<var>Indexes</var>)</dt>
368368 <dd class="defbody">
369 <var>Indexes</var><sup class="fn">68<span class="fn-text">This predicate
369 <var>Indexes</var><sup class="fn">69<span class="fn-text">This predicate
370370 property should be used for analysis and statistics only. The exact
371371 representation of <var>Indexes</var> may change between versions.</span></sup>
372372 is a list of additional (hash) indexes on the predicate. Each element of
390390 <dd class="defbody">
391391 Unify <var>LineNumber</var> with the line number of the first clause of
392392 the predicate. Fails if the predicate is not associated with a file. See
393 also <a id="idx:sourcefile2:813"></a><a class="pred" href="consulting.html#source_file/2">source_file/2</a>.
394 See also the <code>file</code> property above, notably the reference to <a id="idx:clauseproperty2:814"></a><a class="pred" href="examineprog.html#clause_property/2">clause_property/2</a>.</dd>
393 also <a id="idx:sourcefile2:814"></a><a class="pred" href="consulting.html#source_file/2">source_file/2</a>.
394 See also the <code>file</code> property above, notably the reference to <a id="idx:clauseproperty2:815"></a><a class="pred" href="examineprog.html#clause_property/2">clause_property/2</a>.</dd>
395395 <dt><strong>multifile</strong></dt>
396396 <dd class="defbody">
397397 True if there may be multiple (or no) files providing clauses for the
398 predicate. This property is set using <a id="idx:multifile1:815"></a><a class="pred" href="dynamic.html#multifile/1">multifile/1</a>.</dd>
398 predicate. This property is set using <a id="idx:multifile1:816"></a><a class="pred" href="dynamic.html#multifile/1">multifile/1</a>.</dd>
399399 <dt><strong>meta_predicate</strong>(<var>Head</var>)</dt>
400400 <dd class="defbody">
401 If the predicate is declared as a meta-predicate using <a id="idx:metapredicate1:816"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>,
401 If the predicate is declared as a meta-predicate using <a id="idx:metapredicate1:817"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>,
402402 unify <var>Head</var> with the head-pattern. The head-pattern is a
403403 compound term with the same name and arity as the predicate where each
404 argument of the term is a meta-predicate specifier. See <a id="idx:metapredicate1:817"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>
404 argument of the term is a meta-predicate specifier. See <a id="idx:metapredicate1:818"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>
405405 for details.</dd>
406406 <dt><strong>nodebug</strong></dt>
407407 <dd class="defbody">
424424 only facts in <code>library(prolog_codewalk)</code>.</dd>
425425 <dt><strong>public</strong></dt>
426426 <dd class="defbody">
427 Predicate is declared public using <a id="idx:public1:818"></a><a class="pred" href="dynamic.html#public/1">public/1</a>.
427 Predicate is declared public using <a id="idx:public1:819"></a><a class="pred" href="dynamic.html#public/1">public/1</a>.
428428 Note that without further definition, public predicates are considered
429429 undefined and this property is <em>not</em> reported.</dd>
430430 <dt><strong>quasi_quotation_syntax</strong>(<var>quasi_quotation_syntax</var>)</dt>
431431 <dd class="defbody">
432432 he predicate (with arity&nbsp;4) is declared to provide quasi quotation
433 syntax with <a id="idx:quasiquotationsyntax1:819"></a><a class="pred" href="quasiquotations.html#quasi_quotation_syntax/1">quasi_quotation_syntax/1</a>.</dd>
433 syntax with <a id="idx:quasiquotationsyntax1:820"></a><a class="pred" href="quasiquotations.html#quasi_quotation_syntax/1">quasi_quotation_syntax/1</a>.</dd>
434434 <dt><strong>static</strong></dt>
435435 <dd class="defbody">
436 The definition can <em>not</em> be modified using <a id="idx:assertz1:820"></a><a class="pred" href="db.html#assertz/1">assertz/1</a>
436 The definition can <em>not</em> be modified using <a id="idx:assertz1:821"></a><a class="pred" href="db.html#assertz/1">assertz/1</a>
437437 and friends. This property is the opposite from <code>dynamic</code>,
438438 i.e., for each defined predicate, either <code>static</code> or <code>dynamic</code>
439439 is true but never both.</dd>
441441 <dd class="defbody">
442442 If true (only possible on the multithreaded version) each thread has its
443443 own clauses for the predicate. This property is set using
444 <a id="idx:threadlocal1:821"></a><a class="pred" href="threadcom.html#thread_local/1">thread_local/1</a>.</dd>
444 <a id="idx:threadlocal1:822"></a><a class="pred" href="threadcom.html#thread_local/1">thread_local/1</a>.</dd>
445445 <dt><strong>transparent</strong></dt>
446446 <dd class="defbody">
447447 True if the predicate is declared transparent using the
448 <a id="idx:moduletransparent1:822"></a><a class="pred" href="ctxmodule.html#module_transparent/1">module_transparent/1</a>
449 or <a id="idx:metapredicate1:823"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>
448 <a id="idx:moduletransparent1:823"></a><a class="pred" href="ctxmodule.html#module_transparent/1">module_transparent/1</a>
449 or <a id="idx:metapredicate1:824"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>
450450 declaration. In the latter case the property <code>meta_predicate(Head)</code>
451451 is also provided. See <a class="sec" href="modules.html">chapter 6</a>
452452 for details.</dd>
463463 <dd class="defbody">
464464 True when predicate can be called without raising a predicate existence
465465 error. This means that the predicate is (1) defined, (2) can be
466 inherited from one of the default modules (see <a id="idx:defaultmodule2:824"></a><a class="pred" href="importmodule.html#default_module/2">default_module/2</a>)
466 inherited from one of the default modules (see <a id="idx:defaultmodule2:825"></a><a class="pred" href="importmodule.html#default_module/2">default_module/2</a>)
467467 or (3) can be autoloaded. The behaviour is logically consistent iff the
468468 property
469469 <code>visible</code> is provided explicitly. If the property is left
470470 unbound, only defined predicates are enumerated.</dd>
471471 <dt><strong>volatile</strong></dt>
472472 <dd class="defbody">
473 If true, the clauses are not saved into a saved state by <a id="idx:qsaveprogram12:825"></a><span class="pred-ext">qsave_program/[1,2]</span>.
474 This property is set using <a id="idx:volatile1:826"></a><a class="pred" href="runtime.html#volatile/1">volatile/1</a>.
473 If true, the clauses are not saved into a saved state by <a id="idx:qsaveprogram12:826"></a><span class="pred-ext">qsave_program/[1,2]</span>.
474 This property is set using <a id="idx:volatile1:827"></a><a class="pred" href="runtime.html#volatile/1">volatile/1</a>.
475475 </dd>
476476 </dl>
477477
484484 is instantiated with the most general term built from <var>Name</var>
485485 and the arity of a defined predicate that matches the predicate
486486 specified by
487 <var>Term</var> in the `Do What I Mean' sense. See <a id="idx:dwimmatch2:827"></a><a class="pred" href="miscpreds.html#dwim_match/2">dwim_match/2</a>
487 <var>Term</var> in the `Do What I Mean' sense. See <a id="idx:dwimmatch2:828"></a><a class="pred" href="miscpreds.html#dwim_match/2">dwim_match/2</a>
488488 for `Do What I Mean' string matching. Internal system predicates are not
489489 generated, unless the access level is <code>system</code> (see
490490 <a class="flag" href="flags.html#flag:access_level">access_level</a>).
498498 <dt class="pubdef"><a id="clause/3"><strong>clause</strong>(<var>:Head,
499499 ?Body, ?Reference</var>)</a></dt>
500500 <dd class="defbody">
501 Equivalent to <a id="idx:clause2:828"></a><a class="pred" href="examineprog.html#clause/2">clause/2</a>,
501 Equivalent to <a id="idx:clause2:829"></a><a class="pred" href="examineprog.html#clause/2">clause/2</a>,
502502 but unifies <var>Reference</var> with a unique reference to the clause
503 (see also <a id="idx:assert2:829"></a><a class="pred" href="db.html#assert/2">assert/2</a>, <a id="idx:erase1:830"></a><a class="pred" href="db.html#erase/1">erase/1</a>).
503 (see also <a id="idx:assert2:830"></a><a class="pred" href="db.html#assert/2">assert/2</a>, <a id="idx:erase1:831"></a><a class="pred" href="db.html#erase/1">erase/1</a>).
504504 If <var>Reference</var> is instantiated to a reference the clause's head
505505 and body will be unified with <var>Head</var> and <var>Body</var>.</dd>
506506 <dt class="pubdef"><a id="nth_clause/3"><strong>nth_clause</strong>(<var>?Pred,
514514 is provided, <var>Reference</var> will be unified with the clause
515515 reference. If <var>Index</var> is unbound, backtracking will yield both
516516 the indexes and the references of all clauses of the predicate. The
517 following example finds the 2nd clause of <a id="idx:append3:831"></a><a class="pred" href="lists.html#append/3">append/3</a>:
517 following example finds the 2nd clause of <a id="idx:append3:832"></a><a class="pred" href="lists.html#append/3">append/3</a>:
518518
519519 <pre class="code">
520520 ?- use_module(library(lists)).
530530 -Property</var>)</a></dt>
531531 <dd class="defbody">
532532 Queries properties of a clause. <var>ClauseRef</var> is a reference to a
533 clause as produced by <a id="idx:clause3:832"></a><a class="pred" href="examineprog.html#clause/3">clause/3</a>, <a id="idx:nthclause3:833"></a><a class="pred" href="examineprog.html#nth_clause/3">nth_clause/3</a>
533 clause as produced by <a id="idx:clause3:833"></a><a class="pred" href="examineprog.html#clause/3">clause/3</a>, <a id="idx:nthclause3:834"></a><a class="pred" href="examineprog.html#nth_clause/3">nth_clause/3</a>
534534 or
535 <a id="idx:prologframeattribute3:834"></a><a class="pred" href="manipstack.html#prolog_frame_attribute/3">prolog_frame_attribute/3</a>.
536 Unlike most other predicates that access clause references, <a id="idx:clauseproperty2:835"></a><a class="pred" href="examineprog.html#clause_property/2">clause_property/2</a>
535 <a id="idx:prologframeattribute3:835"></a><a class="pred" href="manipstack.html#prolog_frame_attribute/3">prolog_frame_attribute/3</a>.
536 Unlike most other predicates that access clause references, <a id="idx:clauseproperty2:836"></a><a class="pred" href="examineprog.html#clause_property/2">clause_property/2</a>
537537 may be used to get information about erased clauses that have not yet
538538 been reclaimed. <var>Property</var> is one of the following:
539539
542542 <dd class="defbody">
543543 Unify <var>FileName</var> with the name of the file in which the clause
544544 textually appears. Fails if the clause is created by loading a file
545 (e.g., clauses added using <a id="idx:assertz1:836"></a><a class="pred" href="db.html#assertz/1">assertz/1</a>).
545 (e.g., clauses added using <a id="idx:assertz1:837"></a><a class="pred" href="db.html#assertz/1">assertz/1</a>).
546546 See also <code>source</code>.
547547 </dd>
548548 <dt><strong>line_count</strong>(<var>LineNumber</var>)</dt>
563563 the clause. This is the same as the <code>file</code> property, unless
564564 the file is loaded from a file that is textually included into source
565565 using
566 <a id="idx:include1:837"></a><a class="pred" href="consulting.html#include/1">include/1</a>.
566 <a id="idx:include1:838"></a><a class="pred" href="consulting.html#include/1">include/1</a>.
567567 In this scenario, <code>file</code> is the included file, while the <code>source</code>
568568 property refers to the <em>main</em> file.
569569 </dd>
580580 <dd class="defbody">
581581 <var>PredicateIndicator</var> denotes the predicate to which this clause
582582 belongs. This is needed to obtain information on erased clauses because
583 the usual way to obtain this information using <a id="idx:clause3:838"></a><a class="pred" href="examineprog.html#clause/3">clause/3</a>
583 the usual way to obtain this information using <a id="idx:clause3:839"></a><a class="pred" href="examineprog.html#clause/3">clause/3</a>
584584 fails for erased clauses.
585585 </dd>
586586 <dt><strong>module</strong>(<var>Module</var>)</dt>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 8.5</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 8.5</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section B.5</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section B.5</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
237237
238238 <a id="sec:excepthook"></a>
239239
240 <p>The hook <a id="idx:prologexceptionhook4:2007"></a><a class="pred" href="excepthook.html#prolog_exception_hook/4">prolog_exception_hook/4</a>
240 <p>The hook <a id="idx:prologexceptionhook4:2010"></a><a class="pred" href="excepthook.html#prolog_exception_hook/4">prolog_exception_hook/4</a>
241241 has been introduced in SWI-Prolog 5.6.5 to provide dedicated exception
242242 handling facilities for application frameworks, for example
243243 non-interactive server applications that wish to provide extensive
250250 This hook predicate, if defined in the module <code>user</code>, is
251251 between raising an exception and handling it. It is intended to allow a
252252 program adding additional context to an exception to simplify diagnosing
253 the problem. <var>ExceptionIn</var> is the exception term as raised by <a id="idx:throw1:2008"></a><a class="pred" href="exception.html#throw/1">throw/1</a>
253 the problem. <var>ExceptionIn</var> is the exception term as raised by <a id="idx:throw1:2011"></a><a class="pred" href="exception.html#throw/1">throw/1</a>
254254 or one of the built-in predicates. The output argument <var>ExceptionOut</var>
255255 describes the exception that is actually raised. <var>Frame</var> is the
256 innermost frame. See <a id="idx:prologframeattribute3:2009"></a><a class="pred" href="manipstack.html#prolog_frame_attribute/3">prolog_frame_attribute/3</a>
256 innermost frame. See <a id="idx:prologframeattribute3:2012"></a><a class="pred" href="manipstack.html#prolog_frame_attribute/3">prolog_frame_attribute/3</a>
257257 and the library
258258 <code>library(prolog_stack)</code> for getting information from this.
259259 <var>CatcherFrame</var> is a reference to the frame calling the matching
260 <a id="idx:catch3:2010"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
260 <a id="idx:catch3:2013"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
261261 or <code>none</code> if the exception is not caught.
262262
263263 <p>The hook is run in `nodebug' mode. If it succeeds, <var>ExceptionOut</var>
266266 recursively. The hook is <em>not</em> allowed to modify <var>ExceptionOut</var>
267267 in such a way that it no longer unifies with the catching frame.
268268
269 <p>Typically, <a id="idx:prologexceptionhook4:2011"></a><a class="pred" href="excepthook.html#prolog_exception_hook/4">prolog_exception_hook/4</a>
269 <p>Typically, <a id="idx:prologexceptionhook4:2014"></a><a class="pred" href="excepthook.html#prolog_exception_hook/4">prolog_exception_hook/4</a>
270270 is used to fill the second argument of <code>error(Formal, Context)</code>
271271 exceptions. <var>Formal</var> is defined by the ISO standard, while
272272 SWI-Prolog defines <var>Context</var> as a term <code>context(Location,
278278 a quick test of the environment before starting expensive gathering
279279 information on the state of the program.
280280
281 <p>The hook can call <a id="idx:trace0:2012"></a><a class="pred" href="debugger.html#trace/0">trace/0</a>
281 <p>The hook can call <a id="idx:trace0:2015"></a><a class="pred" href="debugger.html#trace/0">trace/0</a>
282282 to enter trace mode immediately. For example, imagine an application
283283 performing an unwanted division by zero while all other errors are
284284 expected and handled. We can force the debugger using the hook
285 definition below. Run the program in debug mode (see <a id="idx:debug0:2013"></a><a class="pred" href="debugger.html#debug/0">debug/0</a>)
285 definition below. Run the program in debug mode (see <a id="idx:debug0:2016"></a><a class="pred" href="debugger.html#debug/0">debug/0</a>)
286286 to preserve as much as possible of the error context.
287287
288288 <pre class="code">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.10</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.10</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
237237
238238 <a id="sec:exception"></a>
239239
240 <p>SWI-Prolog defines the predicates <a id="idx:catch3:627"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
241 and <a id="idx:throw1:628"></a><a class="pred" href="exception.html#throw/1">throw/1</a>
240 <p>SWI-Prolog defines the predicates <a id="idx:catch3:628"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
241 and <a id="idx:throw1:629"></a><a class="pred" href="exception.html#throw/1">throw/1</a>
242242 for ISO compliant raising and catching of exceptions. In the current
243243 implementation (as of 4.0.6), most of the built-in predicates generate
244244 exceptions, but some obscure predicates merely print a message, start
249249 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="catch/3"><strong>catch</strong>(<var>:Goal,
250250 +Catcher, :Recover</var>)</a></dt>
251251 <dd class="defbody">
252 Behaves as <a id="idx:call1:629"></a><a class="pred" href="metacall.html#call/1">call/1</a>
252 Behaves as <a id="idx:call1:630"></a><a class="pred" href="metacall.html#call/1">call/1</a>
253253 if no exception is raised when executing <var>Goal</var>. If an
254 exception is raised using <a id="idx:throw1:630"></a><a class="pred" href="exception.html#throw/1">throw/1</a>
254 exception is raised using <a id="idx:throw1:631"></a><a class="pred" href="exception.html#throw/1">throw/1</a>
255255 while <var>Goal</var> executes, and the <var>Goal</var> is the innermost
256 goal for which <var>Catcher</var> unifies with the argument of <a id="idx:throw1:631"></a><a class="pred" href="exception.html#throw/1">throw/1</a>,
256 goal for which <var>Catcher</var> unifies with the argument of <a id="idx:throw1:632"></a><a class="pred" href="exception.html#throw/1">throw/1</a>,
257257 all choice points generated by <var>Goal</var> are cut, the system
258 backtracks to the start of <a id="idx:catch3:632"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
258 backtracks to the start of <a id="idx:catch3:633"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
259259 while preserving the thrown exception term, and <var>Recover</var> is
260 called as in <a id="idx:call1:633"></a><a class="pred" href="metacall.html#call/1">call/1</a>.
261
262 <p>The overhead of calling a goal through <a id="idx:catch3:634"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
260 called as in <a id="idx:call1:634"></a><a class="pred" href="metacall.html#call/1">call/1</a>.
261
262 <p>The overhead of calling a goal through <a id="idx:catch3:635"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
263263 is comparable to
264 <a id="idx:call1:635"></a><a class="pred" href="metacall.html#call/1">call/1</a>.
264 <a id="idx:call1:636"></a><a class="pred" href="metacall.html#call/1">call/1</a>.
265265 Recovery from an exception is much slower, especially if the exception
266266 term is large due to the copying thereof.</dd>
267267 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="throw/1"><strong>throw</strong>(<var>+Exception</var>)</a></dt>
268268 <dd class="defbody">
269 Raise an exception. The system looks for the innermost <a id="idx:catch3:636"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
269 Raise an exception. The system looks for the innermost <a id="idx:catch3:637"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
270270 ancestor for which <var>Exception</var> unifies with the <var>Catcher</var>
271 argument of the <a id="idx:catch3:637"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
272 call. See <a id="idx:catch3:638"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
271 argument of the <a id="idx:catch3:638"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
272 call. See <a id="idx:catch3:639"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
273273 for details.
274274
275 <p>ISO demands that <a id="idx:throw1:639"></a><a class="pred" href="exception.html#throw/1">throw/1</a>
276 make a copy of <var>Exception</var>, walk up the stack to a <a id="idx:catch3:640"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
275 <p>ISO demands that <a id="idx:throw1:640"></a><a class="pred" href="exception.html#throw/1">throw/1</a>
276 make a copy of <var>Exception</var>, walk up the stack to a <a id="idx:catch3:641"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
277277 call, backtrack and try to unify the copy of
278278 <var>Exception</var> with <var>Catcher</var>. SWI-Prolog delays
279 backtracking until it actually finds a matching <a id="idx:catch3:641"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
279 backtracking until it actually finds a matching <a id="idx:catch3:642"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
280280 goal. The advantage is that we can start the debugger at the first
281281 possible location while preserving the entire exception context if there
282 is no matching <a id="idx:catch3:642"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
282 is no matching <a id="idx:catch3:643"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
283283 goal. This approach can lead to different behaviour if <var>Goal</var>
284 and <var>Catcher</var> of <a id="idx:catch3:643"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
284 and <var>Catcher</var> of <a id="idx:catch3:644"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
285285 call shared variables. We assume this to be highly unlikely and could
286 not think of a scenario where this is useful.<sup class="fn">56<span class="fn-text">I'd
286 not think of a scenario where this is useful.<sup class="fn">57<span class="fn-text">I'd
287287 like to acknowledge Bart Demoen for his clarifications on these matters.</span></sup>
288288
289 <p>In addition to explicit calls to <a id="idx:throw1:644"></a><a class="pred" href="exception.html#throw/1">throw/1</a>,
289 <p>In addition to explicit calls to <a id="idx:throw1:645"></a><a class="pred" href="exception.html#throw/1">throw/1</a>,
290290 many built-in predicates throw exceptions directly from C. If the <var>Exception</var>
291291 term cannot be copied due to lack of stack space, the following actions
292292 are tried in order:
297297 ImplementationDefined)</code>, try to raise the exception without the <var>ImplementationDefined</var>
298298 part.
299299 <li>Try to raise <code>error(<code>resource_error(stack)</code>, global)</code>.
300 <li>Abort (see <a id="idx:abort0:645"></a><a class="pred" href="toplevel.html#abort/0">abort/0</a>).
300 <li>Abort (see <a id="idx:abort0:646"></a><a class="pred" href="toplevel.html#abort/0">abort/0</a>).
301301 </ol>
302302
303303 <p>If an exception is raised in a call-back from C (see <a class="sec" href="foreign.html">chapter
311311
312312 <a id="sec:debugexceptions"></a>
313313
314 <p><a id="idx:exceptionsdebugging:646"></a><a id="idx:debuggingexceptions:647"></a>Before
314 <p><a id="idx:exceptionsdebugging:647"></a><a id="idx:debuggingexceptions:648"></a>Before
315315 the introduction of exceptions in SWI-Prolog a runtime error was handled
316316 by printing an error message, after which the predicate failed. If the
317317 Prolog flag <a class="flag" href="flags.html#flag:debug_on_error">debug_on_error</a>
320320 locate the error.
321321
322322 <p>With exception handling, things are different. A programmer may wish
323 to trap an exception using <a id="idx:catch3:648"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
323 to trap an exception using <a id="idx:catch3:649"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
324324 to avoid it reaching the user. If the exception is not handled by user
325325 code, the interactive top level will trap it to prevent termination.
326326
327327 <p>If we do not take special precautions, the context information
328328 associated with an unexpected exception (i.e., a programming error) is
329329 lost. Therefore, if an exception is raised which is not caught using
330 <a id="idx:catch3:649"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
330 <a id="idx:catch3:650"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
331331 and the top level is running, the error will be printed, and the system
332332 will enter trace mode.
333333
334334 <p>If the system is in a non-interactive call-back from foreign code and
335 there is no <a id="idx:catch3:650"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
335 there is no <a id="idx:catch3:651"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
336336 active in the current context, it cannot determine whether or not the
337337 exception will be caught by the external routine calling Prolog. It will
338338 then base its behaviour on the Prolog flag
350350 </ul>
351351
352352 <p>While looking for the context in which an exception takes place, it
353 is advised to switch on debug mode using the predicate <a id="idx:debug0:651"></a><a class="pred" href="debugger.html#debug/0">debug/0</a>.
353 is advised to switch on debug mode using the predicate <a id="idx:debug0:652"></a><a class="pred" href="debugger.html#debug/0">debug/0</a>.
354354 The hook
355 <a id="idx:prologexceptionhook4:652"></a><a class="pred" href="excepthook.html#prolog_exception_hook/4">prolog_exception_hook/4</a>
355 <a id="idx:prologexceptionhook4:653"></a><a class="pred" href="excepthook.html#prolog_exception_hook/4">prolog_exception_hook/4</a>
356356 can be used to add more debugging facilities to exceptions. An example
357357 is the library <code>library(http/http_error)</code>, generating a full
358358 stack trace on errors in the HTTP server library.
379379
380380 <a id="sec:printmsg"></a>
381381
382 <p>The predicate <a id="idx:printmessage2:653"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>
382 <p>The predicate <a id="idx:printmessage2:654"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>
383383 is used to print a message term in a human-readable format. The other
384384 predicates from this section allow the user to refine and extend the
385385 message system. A common usage of
386 <a id="idx:printmessage2:654"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>
386 <a id="idx:printmessage2:655"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>
387387 is to print error messages from exceptions. The code below prints errors
388388 encountered during the execution of <var>Goal</var>, without further
389389 propagating the exception and without starting the debugger.
397397 ...
398398 </pre>
399399
400 <p>Another common use is to define <a id="idx:messagehook3:655"></a><a class="pred" href="exception.html#message_hook/3">message_hook/3</a>
400 <p>Another common use is to define <a id="idx:messagehook3:656"></a><a class="pred" href="exception.html#message_hook/3">message_hook/3</a>
401401 for printing messages that are normally <em>silent</em>, suppressing
402402 messages, redirecting messages or make something happen in addition to
403403 printing the message.
406406 <dt class="pubdef"><a id="print_message/2"><strong>print_message</strong>(<var>+Kind,
407407 +Term</var>)</a></dt>
408408 <dd class="defbody">
409 The predicate <a id="idx:printmessage2:656"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>
409 The predicate <a id="idx:printmessage2:657"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>
410410 is used by the system and libraries to print messages. <var>Kind</var>
411411 describes the nature of the message, while
412412 <var>Term</var> is a Prolog term that describes the content. Printing
413 messages through this indirection instead of using <a id="idx:format3:657"></a><a class="pred" href="format.html#format/3">format/3</a>
413 messages through this indirection instead of using <a id="idx:format3:658"></a><a class="pred" href="format.html#format/3">format/3</a>
414414 to the stream <code>user_error</code> allows displaying the message
415415 appropriate to the application (terminal, logfile, graphics), acting on
416 messages based on their content instead of a string (see <a id="idx:messagehook3:658"></a><a class="pred" href="exception.html#message_hook/3">message_hook/3</a>)
416 messages based on their content instead of a string (see <a id="idx:messagehook3:659"></a><a class="pred" href="exception.html#message_hook/3">message_hook/3</a>)
417417 and creating language specific versions of the messages. See also
418418 <a class="sec" href="exception.html">section 4.10.3.1</a>. The following
419419 message kinds are known:
426426 to <code>silent</code>.</dd>
427427 <dt><strong>debug</strong>(<var>Topic</var>)</dt>
428428 <dd class="defbody">
429 Message from library(debug). See <a id="idx:debug3:659"></a><a class="pred" href="debug.html#debug/3">debug/3</a>.</dd>
429 Message from library(debug). See <a id="idx:debug3:660"></a><a class="pred" href="debug.html#debug/3">debug/3</a>.</dd>
430430 <dt><strong>error</strong></dt>
431431 <dd class="defbody">
432432 The message indicates an erroneous situation. This kind is used to print
439439 prompt.</dd>
440440 <dt><strong>information</strong></dt>
441441 <dd class="defbody">
442 Information that is requested by the user. An example is <a id="idx:statistics0:660"></a><a class="pred" href="statistics.html#statistics/0">statistics/0</a>.</dd>
442 Information that is requested by the user. An example is <a id="idx:statistics0:661"></a><a class="pred" href="statistics.html#statistics/0">statistics/0</a>.</dd>
443443 <dt><strong>informational</strong></dt>
444444 <dd class="defbody">
445445 Typically messages of events are progres that are considered useful to a
448448 <dt><strong>silent</strong></dt>
449449 <dd class="defbody">
450450 Message that is normally not printed. Applications may define
451 <a id="idx:messagehook3:661"></a><a class="pred" href="exception.html#message_hook/3">message_hook/3</a>
451 <a id="idx:messagehook3:662"></a><a class="pred" href="exception.html#message_hook/3">message_hook/3</a>
452452 to act upon such messages.</dd>
453453 <dt><strong>trace</strong></dt>
454454 <dd class="defbody">
456456 <dt><strong>warning</strong></dt>
457457 <dd class="defbody">
458458 The message indicates something dubious that is not considered fatal.
459 For example, discontiguous predicates (see <a id="idx:discontiguous1:662"></a><a class="pred" href="dynamic.html#discontiguous/1">discontiguous/1</a>).
459 For example, discontiguous predicates (see <a id="idx:discontiguous1:663"></a><a class="pred" href="dynamic.html#discontiguous/1">discontiguous/1</a>).
460460 </dd>
461461 </dl>
462462
463 <p>The predicate <a id="idx:printmessage2:663"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>
464 first translates the <var>Term</var> into a list of `message lines' (see <a id="idx:printmessagelines3:664"></a><a class="pred" href="exception.html#print_message_lines/3">print_message_lines/3</a>
465 for details). Next, it calls the hook <a id="idx:messagehook3:665"></a><a class="pred" href="exception.html#message_hook/3">message_hook/3</a>
466 to allow the user to intercept the message. If <a id="idx:messagehook3:666"></a><a class="pred" href="exception.html#message_hook/3">message_hook/3</a>
463 <p>The predicate <a id="idx:printmessage2:664"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>
464 first translates the <var>Term</var> into a list of `message lines' (see <a id="idx:printmessagelines3:665"></a><a class="pred" href="exception.html#print_message_lines/3">print_message_lines/3</a>
465 for details). Next, it calls the hook <a id="idx:messagehook3:666"></a><a class="pred" href="exception.html#message_hook/3">message_hook/3</a>
466 to allow the user to intercept the message. If <a id="idx:messagehook3:667"></a><a class="pred" href="exception.html#message_hook/3">message_hook/3</a>
467467 fails it prints the message unless <var>Kind</var> is silent.
468468
469 <p>The <a id="idx:printmessage2:667"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>
469 <p>The <a id="idx:printmessage2:668"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>
470470 predicate and its rules are in the file
471471 <code>&lt;<var>plhome</var>&gt;/boot/messages.pl</code>, which may be
472472 inspected for more information on the error messages and related error
478478 <a class="sec" href="exception.html">section 4.10.3.1</a> for a deeper
479479 discussion and examples.
480480
481 <p>See also <a id="idx:messagetostring2:668"></a><a class="pred" href="exception.html#message_to_string/2">message_to_string/2</a>.</dd>
481 <p>See also <a id="idx:messagetostring2:669"></a><a class="pred" href="exception.html#message_to_string/2">message_to_string/2</a>.</dd>
482482 <dt class="pubdef"><a id="print_message_lines/3"><strong>print_message_lines</strong>(<var>+Stream,
483483 +Prefix, +Lines</var>)</a></dt>
484484 <dd class="defbody">
485 Print a message (see <a id="idx:printmessage2:669"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>)
485 Print a message (see <a id="idx:printmessage2:670"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>)
486486 that has been translated to a list of message elements. The elements of
487487 this list are:
488488
490490 <dt><strong>&lt;<var>Format</var>&gt;-&lt;<var>Args</var>&gt;</strong></dt>
491491 <dd class="defbody">
492492 Where <var>Format</var> is an atom and <var>Args</var> is a list of
493 format arguments. Handed to <a id="idx:format3:670"></a><a class="pred" href="format.html#format/3">format/3</a>.
493 format arguments. Handed to <a id="idx:format3:671"></a><a class="pred" href="format.html#format/3">format/3</a>.
494494 </dd>
495495 <dt><strong>flush</strong></dt>
496496 <dd class="defbody">
497 If this appears as the last element, <var>Stream</var> is flushed (see <a id="idx:flushoutput1:671"></a><a class="pred" href="chario.html#flush_output/1">flush_output/1</a>)
497 If this appears as the last element, <var>Stream</var> is flushed (see <a id="idx:flushoutput1:672"></a><a class="pred" href="chario.html#flush_output/1">flush_output/1</a>)
498498 and no final newline is generated. This is combined with a subsequent
499499 message that starts with
500500 <code>at_same_line</code> to complete the line.
502502 <dt><strong>at_same_line</strong></dt>
503503 <dd class="defbody">
504504 If this appears as first element, no prefix is printed for the first
505 line and the line position is not forced to 0 (see <a id="idx:format1:672"></a><a class="pred" href="format.html#format/1">format/1</a>, <code>~N</code>).
505 line and the line position is not forced to 0 (see <a id="idx:format1:673"></a><a class="pred" href="format.html#format/1">format/1</a>, <code>~N</code>).
506506 </dd>
507507 <dt><strong>ansi</strong>(<var>+Attributes, +Format, +Args</var>)</dt>
508508 <dd class="defbody">
525525 </dd>
526526 <dt><strong>&lt;<var>Format</var>&gt;</strong></dt>
527527 <dd class="defbody">
528 Handed to <a id="idx:format3:673"></a><a class="pred" href="format.html#format/3">format/3</a>
528 Handed to <a id="idx:format3:674"></a><a class="pred" href="format.html#format/3">format/3</a>
529529 as <code>format(Stream, Format,[])</code>. Deprecated because it is
530530 ambiguous if <var>Format</var> collides with one of the atomic commands.
531531 </dd>
532532 </dl>
533533
534 <p>See also <a id="idx:printmessage2:674"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>
535 and <a id="idx:messagehook3:675"></a><a class="pred" href="exception.html#message_hook/3">message_hook/3</a>.</dd>
534 <p>See also <a id="idx:printmessage2:675"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>
535 and <a id="idx:messagehook3:676"></a><a class="pred" href="exception.html#message_hook/3">message_hook/3</a>.</dd>
536536 <dt class="pubdef"><a id="message_hook/3"><strong>message_hook</strong>(<var>+Term,
537537 +Kind, +Lines</var>)</a></dt>
538538 <dd class="defbody">
539539 Hook predicate that may be defined in the module <code>user</code> to
540 intercept messages from <a id="idx:printmessage2:676"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>. <var>Term</var>
541 and <var>Kind</var> are the same as passed to <a id="idx:printmessage2:677"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>. <var>Lines</var>
542 is a list of format statements as described with <a id="idx:printmessagelines3:678"></a><a class="pred" href="exception.html#print_message_lines/3">print_message_lines/3</a>.
540 intercept messages from <a id="idx:printmessage2:677"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>. <var>Term</var>
541 and <var>Kind</var> are the same as passed to <a id="idx:printmessage2:678"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>. <var>Lines</var>
542 is a list of format statements as described with <a id="idx:printmessagelines3:679"></a><a class="pred" href="exception.html#print_message_lines/3">print_message_lines/3</a>.
543543 See also
544 <a id="idx:messagetostring2:679"></a><a class="pred" href="exception.html#message_to_string/2">message_to_string/2</a>.
544 <a id="idx:messagetostring2:680"></a><a class="pred" href="exception.html#message_to_string/2">message_to_string/2</a>.
545545
546546 <p>This predicate must be defined dynamic and multifile to allow other
547547 modules defining clauses for it too.</dd>
548548 <dt class="pubdef"><a id="thread_message_hook/3"><strong>thread_message_hook</strong>(<var>+Term,
549549 +Kind, +Lines</var>)</a></dt>
550550 <dd class="defbody">
551 As <a id="idx:messagehook3:680"></a><a class="pred" href="exception.html#message_hook/3">message_hook/3</a>,
552 but this predicate is local to the calling thread (see <a id="idx:threadlocal1:681"></a><a class="pred" href="threadcom.html#thread_local/1">thread_local/1</a>).
553 This hook is called <em>before</em> <a id="idx:messagehook3:682"></a><a class="pred" href="exception.html#message_hook/3">message_hook/3</a>.
551 As <a id="idx:messagehook3:681"></a><a class="pred" href="exception.html#message_hook/3">message_hook/3</a>,
552 but this predicate is local to the calling thread (see <a id="idx:threadlocal1:682"></a><a class="pred" href="threadcom.html#thread_local/1">thread_local/1</a>).
553 This hook is called <em>before</em> <a id="idx:messagehook3:683"></a><a class="pred" href="exception.html#message_hook/3">message_hook/3</a>.
554554 The `pre-hook' is indented to catch messages they may be produced by
555555 calling some goal without affecting other threads.</dd>
556556 <dt class="pubdef"><a id="message_property/2"><strong>message_property</strong>(<var>+Kind,
562562 <dl class="latex">
563563 <dt><strong>color</strong>(<var>-Attributes</var>)</dt>
564564 <dd class="defbody">
565 Print message using ANSI terminal attributes. See <a id="idx:ansiformat3:683"></a><span class="pred-ext">ansi_format/3</span>
565 Print message using ANSI terminal attributes. See <a id="idx:ansiformat3:684"></a><span class="pred-ext">ansi_format/3</span>
566566 for details. Here is an example, printing help messages in blue:
567567
568568 <pre class="code">
574574 </dd>
575575 <dt><strong>prefix</strong>(<var>-Prefix</var>)</dt>
576576 <dd class="defbody">
577 Prefix printed before each line. This argument is handed to <a id="idx:format3:684"></a><a class="pred" href="format.html#format/3">format/3</a>.
577 Prefix printed before each line. This argument is handed to <a id="idx:format3:685"></a><a class="pred" href="format.html#format/3">format/3</a>.
578578 The default is <code>'~N'</code>. For example, messages of kind
579579 <code>warning</code> use <code>'~NWarning: '</code>.</dd>
580580 <dt><strong>location_prefix</strong>(<var>+Location, -FirstPrefix,
607607 +Term</var>)</a></dt>
608608 <dd class="defbody">
609609 This hook is called to print the individual elements of a message from
610 <a id="idx:printmessagelines3:685"></a><a class="pred" href="exception.html#print_message_lines/3">print_message_lines/3</a>.
610 <a id="idx:printmessagelines3:686"></a><a class="pred" href="exception.html#print_message_lines/3">print_message_lines/3</a>.
611611 This hook is used by e.g., library
612612 <code>library(ansi_term)</code> to colour messages on ANSI-capable
613613 terminals.</dd>
619619 <dt class="pubdef"><a id="version/0"><strong>version</strong></a></dt>
620620 <dd class="defbody">
621621 Write the SWI-Prolog banner message as well as additional messages
622 registered using <a id="idx:version1:686"></a><a class="pred" href="exception.html#version/1">version/1</a>.
622 registered using <a id="idx:version1:687"></a><a class="pred" href="exception.html#version/1">version/1</a>.
623623 This is the default <em>initialization goal</em> which can be modified
624624 using <strong>-g</strong>.</dd>
625625 <dt class="pubdef"><a id="version/1"><strong>version</strong>(<var>+Message</var>)</a></dt>
626626 <dd class="defbody">
627 Register additional messages to be printed by <a id="idx:version0:687"></a><a class="pred" href="exception.html#version/0">version/0</a>.
627 Register additional messages to be printed by <a id="idx:version0:688"></a><a class="pred" href="exception.html#version/0">version/0</a>.
628628 Each registered message is handed to the message translation DCG and can
629629 thus be defined using the hook prolog:message//1. If not defined, it is
630630 simply printed.
636636
637637 <a id="sec:libprintmsg"></a>
638638
639 <p>Libraries should <em>not</em> use <a id="idx:format3:688"></a><a class="pred" href="format.html#format/3">format/3</a>
639 <p>Libraries should <em>not</em> use <a id="idx:format3:689"></a><a class="pred" href="format.html#format/3">format/3</a>
640640 or other output predicates directly. Libraries that print informational
641641 output directly to the console are hard to use from code that depend on
642642 your textual output, such as a CGI script. The predicates in <a class="sec" href="exception.html">section
643643 4.10.3</a> define the API for dealing with messages. The idea behind
644644 this is that a library that wants to provide information about its
645 status, progress, events or problems calls <a id="idx:printmessage2:689"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>.
645 status, progress, events or problems calls <a id="idx:printmessage2:690"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>.
646646 The first argument is the
647 <em>level</em>. The supported levels are described with <a id="idx:printmessage2:690"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>.
647 <em>level</em>. The supported levels are described with <a id="idx:printmessage2:691"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>.
648648 Libraries typically use <code>informational</code> and <code>warning</code>,
649 while libraries should use exceptions for errors (see <a id="idx:throw1:691"></a><a class="pred" href="exception.html#throw/1">throw/1</a>, <a id="idx:typeerror2:692"></a><span class="pred-ext">type_error/2</span>,
649 while libraries should use exceptions for errors (see <a id="idx:throw1:692"></a><a class="pred" href="exception.html#throw/1">throw/1</a>, <a id="idx:typeerror2:693"></a><span class="pred-ext">type_error/2</span>,
650650 etc.).
651651
652652 <p>The second argument is an arbitrary Prolog term that carries the
657657 into a progress bar).
658658
659659 <p>For example, suppose we have a library that must download data from
660 the Internet (e.g., based on <a id="idx:httpopen3:693"></a><span class="pred-ext">http_open/3</span>).
660 the Internet (e.g., based on <a id="idx:httpopen3:694"></a><span class="pred-ext">http_open/3</span>).
661661 The library wants to print the progress after each downloaded file. The
662662 code below is a good skeleton:
663663
676676 different languages. This, and the user-hook example below are the
677677 reason to represent the message as a compound term rather than a string.
678678 This is similar to using message numbers in non-symbolic languages. The
679 documentation of <a id="idx:printmessagelines3:694"></a><a class="pred" href="exception.html#print_message_lines/3">print_message_lines/3</a>
679 documentation of <a id="idx:printmessagelines3:695"></a><a class="pred" href="exception.html#print_message_lines/3">print_message_lines/3</a>
680680 describes the elements that may appear in the output list.
681681
682682 <pre class="code">
688688 [ 'Downloaded ~w; ~D from ~D (~d%)'-[URL, I, Total, Perc] ].
689689 </pre>
690690
691 <p>A <em>user</em> of the library may define rules for <a id="idx:messagehook3:695"></a><a class="pred" href="exception.html#message_hook/3">message_hook/3</a>.
691 <p>A <em>user</em> of the library may define rules for <a id="idx:messagehook3:696"></a><a class="pred" href="exception.html#message_hook/3">message_hook/3</a>.
692692 The rule below acts on the message content. Other applications can act
693693 on the message level and, for example, popup a message box for warnings
694694 and errors.
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section B.6</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section B.6</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
237237
238238 <a id="sec:exception3"></a>
239239
240 <p>This section describes the predicate <a id="idx:exception3:2014"></a><a class="pred" href="exception3.html#exception/3">exception/3</a>,
240 <p>This section describes the predicate <a id="idx:exception3:2017"></a><a class="pred" href="exception3.html#exception/3">exception/3</a>,
241241 which can be defined by the user in the module <code>user</code> as a
242242 multifile predicate. Unlike the name suggests, this is actually a <em>hook</em>
243243 predicate that has no relation to Prolog exceptions as defined by the
244244 ISO predicates
245 <a id="idx:catch3:2015"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
246 and <a id="idx:throw1:2016"></a><a class="pred" href="exception.html#throw/1">throw/1</a>.
247
248 <p>The predicate <a id="idx:exception3:2017"></a><a class="pred" href="exception3.html#exception/3">exception/3</a>
245 <a id="idx:catch3:2018"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
246 and <a id="idx:throw1:2019"></a><a class="pred" href="exception.html#throw/1">throw/1</a>.
247
248 <p>The predicate <a id="idx:exception3:2020"></a><a class="pred" href="exception3.html#exception/3">exception/3</a>
249249 is called by the kernel on a couple of events, allowing the user to
250250 `fix' errors just-in-time. The mechanism allows for
251251 <em>lazy</em> creation of objects such as predicates.
256256 <dd class="defbody">
257257 Dynamic predicate, normally not defined. Called by the Prolog system on
258258 run-time exceptions that can be repaired `just-in-time'. The values for <var>Exception</var>
259 are described below. See also <a id="idx:catch3:2018"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
260 and <a id="idx:throw1:2019"></a><a class="pred" href="exception.html#throw/1">throw/1</a>.
259 are described below. See also <a id="idx:catch3:2021"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
260 and <a id="idx:throw1:2022"></a><a class="pred" href="exception.html#throw/1">throw/1</a>.
261261
262262 <p>If this hook predicate succeeds it must instantiate the <var>Action</var>
263263 argument to the atom <code>fail</code> to make the operation fail
279279 <dt><strong>undefined_global_variable</strong></dt>
280280 <dd class="defbody">
281281 <var>Context</var> is instantiated to the name of the missing global
282 variable. The hook must call <a id="idx:nbsetval2:2020"></a><a class="pred" href="gvar.html#nb_setval/2">nb_setval/2</a>
283 or <a id="idx:bsetval2:2021"></a><a class="pred" href="gvar.html#b_setval/2">b_setval/2</a>
282 variable. The hook must call <a id="idx:nbsetval2:2023"></a><a class="pred" href="gvar.html#nb_setval/2">nb_setval/2</a>
283 or <a id="idx:bsetval2:2024"></a><a class="pred" href="gvar.html#b_setval/2">b_setval/2</a>
284284 before returning with the action <code>retry</code>.
285285 </dd>
286286 </dl>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 5.5</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 5.5</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 5.6</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 5.6</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
249249 representations, a list of <em>character codes</em> (`codes' for short)
250250 and a list of <em>one-character atoms</em> (`chars' for short). There
251251 are two sets of predicates, named *_code(s) and *_char(s) that provide
252 the same functionality (e.g., <a id="idx:atomcodes2:1512"></a><a class="pred" href="manipatom.html#atom_codes/2">atom_codes/2</a>
253 and <a id="idx:atomchars2:1513"></a><a class="pred" href="manipatom.html#atom_chars/2">atom_chars/2</a>)
252 the same functionality (e.g., <a id="idx:atomcodes2:1514"></a><a class="pred" href="manipatom.html#atom_codes/2">atom_codes/2</a>
253 and <a id="idx:atomchars2:1515"></a><a class="pred" href="manipatom.html#atom_chars/2">atom_chars/2</a>)
254254 using their own representation of characters. Codes can be used in
255255 arithmetic expressions, while chars are more readable. Neither can
256256 unambiguously be interpreted as a representation for text because codes
275275
276276 <p><b>Lambda expressions</b>
277277
278 <p>Although many alternatives<sup class="fn">134<span class="fn-text">See
278 <p>Although many alternatives<sup class="fn">137<span class="fn-text">See
279279 e.g., <a class="url" href="http://www.complang.tuwien.ac.at/ulrich/Prolog-inedit/ISO-Hiord">http://www.complang.tuwien.ac.at/ulrich/Prolog-inedit/ISO-Hiord</a></span></sup>
280280 have been proposed, we still feel uneasy with them.
281281
285285 Prolog for simple iterations over data. ECLiPSe have proposed
286286 <em>logical loops</em> <cite><a class="cite" href="Bibliography.html#logicalloops:2002">Schimpf,
287287 2002</a></cite>, while B-Prolog introduced <em>declarative loops</em>
288 and <em>list comprehension</em><sup class="fn">135<span class="fn-text"><a class="url" href="http://www.probp.com/download/loops.pdf">http://www.probp.com/download/loops.pdf</a></span></sup>.
289 The above mentioned lambda expressions, combined with <a id="idx:maplist2:1514"></a><a class="pred" href="apply.html#maplist/2">maplist/2</a>
288 and <em>list comprehension</em><sup class="fn">138<span class="fn-text"><a class="url" href="http://www.probp.com/download/loops.pdf">http://www.probp.com/download/loops.pdf</a></span></sup>.
289 The above mentioned lambda expressions, combined with <a id="idx:maplist2:1516"></a><a class="pred" href="apply.html#maplist/2">maplist/2</a>
290290 can achieve similar results.
291291 </body></html>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 5.1</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 5.1</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
267267 are provided by
268268 <code>SWI-Prolog.h</code>.
269269
270 <p>Another place that is affected is <a id="idx:writecanonical1:1442"></a><a class="pred" href="termrw.html#write_canonical/1">write_canonical/1</a>.
271 Impact is minimized by using the list syntax for lists. The predicates <a id="idx:readterm2:1443"></a><a class="pred" href="termrw.html#read_term/2">read_term/2</a>
270 <p>Another place that is affected is <a id="idx:writecanonical1:1444"></a><a class="pred" href="termrw.html#write_canonical/1">write_canonical/1</a>.
271 Impact is minimized by using the list syntax for lists. The predicates <a id="idx:readterm2:1445"></a><a class="pred" href="termrw.html#read_term/2">read_term/2</a>
272272 and
273 <a id="idx:writeterm2:1444"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>
274 support the option <code>dot_lists(true)</code>, which causes
275 <a id="idx:readterm2:1445"></a><a class="pred" href="termrw.html#read_term/2">read_term/2</a>
276 to read <code>.(a,[])</code> as <code>[a]</code> and <a id="idx:writeterm2:1446"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>
273 <a id="idx:writeterm2:1446"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>
274 support the option <code>dotlists(true)</code>, which causes
275 <a id="idx:readterm2:1447"></a><a class="pred" href="termrw.html#read_term/2">read_term/2</a>
276 to read <code>.(a,[])</code> as <code>[a]</code> and <a id="idx:writeterm2:1448"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>
277277 to write <code>[a]</code> as <code>.(a,[])</code>.
278278
279279 <p><h3 id="sec:ext-list-motivation"><a id="sec:5.1.1"><span class="sec-nr">5.1.1</span> <span class="sec-title">Motivating
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 5.3</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 5.3</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
245245 <p>As of SWI-Prolog version&nbsp;7, quoted atoms loose their operator
246246 property. This means that expressions such as <code>A = 'dynamic'/1</code>
247247 are valid syntax, regardless of the operator definitions. From questions
248 on the mailinglist this is what people expect.<sup class="fn">127<span class="fn-text">We
248 on the mailinglist this is what people expect.<sup class="fn">130<span class="fn-text">We
249249 believe that most users expect an operator declaration to define a new
250250 token, which would explain why the operator name is often quoted in the
251251 declaration, but not while the operator is used. We are afraid that
254254 tokenization due to operator declarations would make it hard to support
255255 Prolog in such editors.</span></sup> To accomodate for real quoted
256256 operators, a quoted atom that <em>needs</em> quotes can still act as an
257 operator.<sup class="fn">128<span class="fn-text">Suggested by Joachim
258 Schimpf.</span></sup> A good use-case for this is a unit library<sup class="fn">129<span class="fn-text"><a class="url" href="https://groups.google.com/d/msg/comp.lang.prolog/ozqdzI-gi_g/2G16GYLIS0IJ">https://groups.google.com/d/msg/comp.lang.prolog/ozqdzI-gi_g/2G16GYLIS0IJ</a></span></sup>,
257 operator.<sup class="fn">131<span class="fn-text">Suggested by Joachim
258 Schimpf.</span></sup> A good use-case for this is a unit library<sup class="fn">132<span class="fn-text"><a class="url" href="https://groups.google.com/d/msg/comp.lang.prolog/ozqdzI-gi_g/2G16GYLIS0IJ">https://groups.google.com/d/msg/comp.lang.prolog/ozqdzI-gi_g/2G16GYLIS0IJ</a></span></sup>,
259259 which allows for expressions such as below.
260260
261261 <pre class="code">
272272 that have no arguments. This implies that e.g., <code>name()</code> is
273273 valid syntax. This extension aims at functions on dicts (see <a class="sec" href="dicts.html">section
274274 5.4</a>) as well as the implementation of domain specific languages
275 (DSLs). To minimise the consequences, the classic predicates <a id="idx:functor3:1478"></a><a class="pred" href="manipterm.html#functor/3">functor/3</a>
275 (DSLs). To minimise the consequences, the classic predicates <a id="idx:functor3:1480"></a><a class="pred" href="manipterm.html#functor/3">functor/3</a>
276276 and <a class="pred" href="manipterm.html#=../2">=../2</a> have not been
277 modified. The predicates <a id="idx:compoundnamearity3:1479"></a><a class="pred" href="manipterm.html#compound_name_arity/3">compound_name_arity/3</a>
277 modified. The predicates <a id="idx:compoundnamearity3:1481"></a><a class="pred" href="manipterm.html#compound_name_arity/3">compound_name_arity/3</a>
278278 and
279 <a id="idx:compoundnamearguments3:1480"></a><a class="pred" href="manipterm.html#compound_name_arguments/3">compound_name_arguments/3</a>
279 <a id="idx:compoundnamearguments3:1482"></a><a class="pred" href="manipterm.html#compound_name_arguments/3">compound_name_arguments/3</a>
280280 have been added. These predicates operate only on compound terms and
281281 behave consistently for compounds with zero arguments. Code that <em>generalises</em>
282 a term using the sequence below should generally be changed to use <a id="idx:compoundnamearity3:1481"></a><a class="pred" href="manipterm.html#compound_name_arity/3">compound_name_arity/3</a>.
282 a term using the sequence below should generally be changed to use <a id="idx:compoundnamearity3:1483"></a><a class="pred" href="manipterm.html#compound_name_arity/3">compound_name_arity/3</a>.
283283
284284 <pre class="code">
285285 ...,
289289 </pre>
290290
291291 <p>Replacement of <a class="pred" href="manipterm.html#=../2">=../2</a>
292 by <a id="idx:compoundnamearguments3:1482"></a><a class="pred" href="manipterm.html#compound_name_arguments/3">compound_name_arguments/3</a>
292 by <a id="idx:compoundnamearguments3:1484"></a><a class="pred" href="manipterm.html#compound_name_arguments/3">compound_name_arguments/3</a>
293293 is typically needed to deal with code that follow the skeleton below.
294294
295295 <pre class="code">
322322
323323 <p>Note that the <em>cannonical</em> representation of predicate heads
324324 and functions without arguments is an atom. Thus, <code>clause(go(),
325 Body)</code> returns the clauses for <a id="idx:go0:1483"></a><span class="pred-ext">go/0</span>,
325 Body)</code> returns the clauses for <a id="idx:go0:1485"></a><span class="pred-ext">go/0</span>,
326326 but <code>clause(-Head, -Body, +Ref)</code> unifies <var>Head</var> with
327327 an atom if the clause specified by <var>Ref</var> is part of a predicate
328328 with zero arguments.
332332
333333 <a id="sec:ext-blockop"></a>
334334
335 <p>Introducing curly bracket and array subscripting.<sup class="fn">130<span class="fn-text">Introducing
335 <p>Introducing curly bracket and array subscripting.<sup class="fn">133<span class="fn-text">Introducing
336336 block operators was proposed by Jose Morales. It was discussed in the
337337 Prolog standardization mailing list, but there were too many conflicts
338338 with existing extensions (ECLiPSe and B-Prolog) and doubt about their
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
252252
253253 <p>While many programs run unmodified in SWI-Prolog version&nbsp;7,
254254 especially those that pass double quoted strings to general purpose list
255 processing predicates require modifications. We provide a tool (<a id="idx:liststrings0:1441"></a><a class="pred" href="strings.html#list_strings/0">list_strings/0</a>)
255 processing predicates require modifications. We provide a tool (<a id="idx:liststrings0:1443"></a><a class="pred" href="strings.html#list_strings/0">list_strings/0</a>)
256256 that we used to port a huge code base in half a day.
257257
258258 <p>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
278278 <ul class="latex">
279279 <li>Constraints and cuts do not merge well. A cut after a goal that is
280280 delayed prunes the search space before the condition is true.
281 <li>Term-copying operations (<a id="idx:assert1:1614"></a><a class="pred" href="db.html#assert/1">assert/1</a>, <a id="idx:retract2:1615"></a><span class="pred-ext">retract/2</span>, <a id="idx:findall3:1616"></a><a class="pred" href="allsolutions.html#findall/3">findall/3</a>,
282 <a id="idx:copyterm2:1617"></a><a class="pred" href="manipterm.html#copy_term/2">copy_term/2</a>,
281 <li>Term-copying operations (<a id="idx:assert1:1616"></a><a class="pred" href="db.html#assert/1">assert/1</a>, <a id="idx:retract2:1617"></a><span class="pred-ext">retract/2</span>, <a id="idx:findall3:1618"></a><a class="pred" href="allsolutions.html#findall/3">findall/3</a>,
282 <a id="idx:copyterm2:1619"></a><a class="pred" href="manipterm.html#copy_term/2">copy_term/2</a>,
283283 etc.) generally also copy constraints. The effect varies from ok, silent
284284 copying of huge constraint networks to violations of the internal
285285 consistency of constraint networks. As a rule of thumb, copying terms
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.34</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.34</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
263263 name does not end in <code><code>/</code></code>. There are two special
264264 cases. The directory name of <code><code>/</code></code> is <code><code>/</code></code>
265265 itself, and the directory name is <code><code>.</code></code> if <var>File</var>
266 does not contain any <code><code>/</code></code> characters. See also <a id="idx:directoryfilepath3:1346"></a><span class="pred-ext">directory_file_path/3</span>
266 does not contain any <code><code>/</code></code> characters. If the <var>File</var>
267 argument ends with a <code><code>/</code></code>, e.g., <code>'/hello/'</code>,
268 it is not a valid file name. In this case the final <code><code>/</code></code>
269 is removed from <var>File</var>, e.g., <code>'/hello'</code>.
270
271 <p>See also <a id="idx:directoryfilepath3:1348"></a><span class="pred-ext">directory_file_path/3</span>
267272 from <code>library(filesex)</code>. The system ensures that for every
268273 valid <var>Path</var> using the Prolog (POSIX) directory separators,
269 following is true on systems with a sound implementation of <a id="idx:samefile2:1347"></a><a class="pred" href="files.html#same_file/2">same_file/2</a>.<sup class="fn">116<span class="fn-text">On
274 following is true on systems with a sound implementation of
275 <a id="idx:samefile2:1349"></a><a class="pred" href="files.html#same_file/2">same_file/2</a>.<sup class="fn">119<span class="fn-text">On
270276 some systems, <var>Path</var> and <var>Path2</var> refer to the same
271 entry in the file system, but <a id="idx:samefile2:1348"></a><a class="pred" href="files.html#same_file/2">same_file/2</a>
272 may fail.</span></sup> See also <a id="idx:prologtoosfilename2:1349"></a><a class="pred" href="files.html#prolog_to_os_filename/2">prolog_to_os_filename/2</a>.
277 entry in the file system, but <a id="idx:samefile2:1350"></a><a class="pred" href="files.html#same_file/2">same_file/2</a>
278 may fail.</span></sup> See also <a id="idx:prologtoosfilename2:1351"></a><a class="pred" href="files.html#prolog_to_os_filename/2">prolog_to_os_filename/2</a>.
273279
274280 <pre class="code">
275281 ...,
285291 <dd class="defbody">
286292 Extracts the filename part from a path specification. If <var>File</var>
287293 does not contain any directory separators, <var>File</var> is returned
288 in <var>BaseName</var>. See also <a id="idx:filedirectoryname2:1350"></a><a class="pred" href="files.html#file_directory_name/2">file_directory_name/2</a>.</dd>
294 in
295 <var>BaseName</var>. See also <a id="idx:filedirectoryname2:1352"></a><a class="pred" href="files.html#file_directory_name/2">file_directory_name/2</a>.
296 If the <var>File</var> arguments ends with a <code><code>/</code></code>,
297 e.g., <code>'/hello/'</code>, <var>BaseName</var> is unified with the
298 empty atom (<code>''</code>).</dd>
289299 <dt class="pubdef"><a id="same_file/2"><strong>same_file</strong>(<var>+File1,
290300 +File2</var>)</a></dt>
291301 <dd class="defbody">
293303 <var>File1</var> and <var>File2</var> are the same string or both names
294304 exist and point to the same file (due to hard or symbolic links and/or
295305 relative vs. absolute paths). On systems that provide stat() with
296 meaningful values for <code>st_dev</code> and <code>st_inode</code>, <a id="idx:samefile2:1351"></a><a class="pred" href="files.html#same_file/2">same_file/2</a>
306 meaningful values for <code>st_dev</code> and <code>st_inode</code>, <a id="idx:samefile2:1353"></a><a class="pred" href="files.html#same_file/2">same_file/2</a>
297307 is implemented by comparing the device and inode identifiers. On
298308 Windows,
299 <a id="idx:samefile2:1352"></a><a class="pred" href="files.html#same_file/2">same_file/2</a>
309 <a id="idx:samefile2:1354"></a><a class="pred" href="files.html#same_file/2">same_file/2</a>
300310 compares the strings returned by the GetFullPathName() system call.</dd>
301311 <dt class="pubdef"><a id="exists_directory/1"><strong>exists_directory</strong>(<var>+Directory</var>)</a></dt>
302312 <dd class="defbody">
322332 <dd class="defbody">
323333 Unify the last modification time of <var>File</var> with <var>Time</var>.
324334 <var>Time</var> is a floating point number expressing the seconds
325 elapsed since Jan&nbsp;1, 1970. See also <a id="idx:converttime28:1353"></a><span class="pred-ext">convert_time/[2,8]</span>
326 and <a id="idx:gettime1:1354"></a><a class="pred" href="system.html#get_time/1">get_time/1</a>.</dd>
335 elapsed since Jan&nbsp;1, 1970. See also <a id="idx:converttime28:1355"></a><span class="pred-ext">convert_time/[2,8]</span>
336 and <a id="idx:gettime1:1356"></a><a class="pred" href="system.html#get_time/1">get_time/1</a>.</dd>
327337 <dt class="pubdef"><a id="absolute_file_name/2"><strong>absolute_file_name</strong>(<var>+File,
328338 -Absolute</var>)</a></dt>
329339 <dd class="defbody">
332342 deleted. This predicate ensures that expanding a filename returns the
333343 same absolute path regardless of how the file is addressed. SWI-Prolog
334344 uses absolute filenames to register source files independent of the
335 current working directory. See also <a id="idx:absolutefilename3:1355"></a><a class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</a>.
345 current working directory. See also <a id="idx:absolutefilename3:1357"></a><a class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</a>.
336346 See also
337 <a id="idx:absolutefilename3:1356"></a><a class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</a>
338 and <a id="idx:expandfilename2:1357"></a><a class="pred" href="files.html#expand_file_name/2">expand_file_name/2</a>.</dd>
347 <a id="idx:absolutefilename3:1358"></a><a class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</a>
348 and <a id="idx:expandfilename2:1359"></a><a class="pred" href="files.html#expand_file_name/2">expand_file_name/2</a>.</dd>
339349 <dt class="pubdef"><a id="absolute_file_name/3"><strong>absolute_file_name</strong>(<var>+Spec,
340350 -Absolute, +Options</var>)</a></dt>
341351 <dd class="defbody">
349359 <dt><strong>extensions</strong>(<var>ListOfExtensions</var>)</dt>
350360 <dd class="defbody">
351361 List of file extensions to try. Default is <code>''</code>. For each
352 extension, <a id="idx:absolutefilename3:1358"></a><a class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</a>
362 extension, <a id="idx:absolutefilename3:1360"></a><a class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</a>
353363 will first add the extension and then verify the conditions imposed by
354364 the other options. If the condition fails, the next extension on the
355365 list is tried. Extensions may be specified both as <code>.ext</code> or
358368 <dd class="defbody">
359369 Resolve the path relative to the given directory or the directory
360370 holding the given file. Without this option, paths are resolved relative
361 to the working directory (see <a id="idx:workingdirectory2:1359"></a><a class="pred" href="files.html#working_directory/2">working_directory/2</a>)
362 or, if <var>Spec</var> is atomic and <a id="idx:absolutefilename23:1360"></a><span class="pred-ext">absolute_file_name/[2,3]</span>
371 to the working directory (see <a id="idx:workingdirectory2:1361"></a><a class="pred" href="files.html#working_directory/2">working_directory/2</a>)
372 or, if <var>Spec</var> is atomic and <a id="idx:absolutefilename23:1362"></a><span class="pred-ext">absolute_file_name/[2,3]</span>
363373 is executed in a directive, it uses the current source file as
364374 reference.</dd>
365375 <dt><strong>access</strong>(<var>Mode</var>)</dt>
366376 <dd class="defbody">
367377 Imposes the condition access_file(<var>File</var>, <var>Mode</var>). <var>Mode</var>
368378 is one of <code>read</code>, <code>write</code>, <code>append</code>,
369 <code>execute</code>, <code>exist</code> or <code>none</code>. See also <a id="idx:accessfile2:1361"></a><a class="pred" href="files.html#access_file/2">access_file/2</a>.</dd>
379 <code>execute</code>, <code>exist</code> or <code>none</code>. See also <a id="idx:accessfile2:1363"></a><a class="pred" href="files.html#access_file/2">access_file/2</a>.</dd>
370380 <dt><strong>file_type</strong>(<var>Type</var>)</dt>
371381 <dd class="defbody">
372382 Defines extensions. Current mapping: <code>txt</code> implies <code>['']</code>,
376386 and
377387 <code>directory</code> implies <code>['']</code>. The file type <code>source</code>
378388 is an alias for <code>prolog</code> for compatibility with SICStus
379 Prolog. See also <a id="idx:prologfiletype2:1362"></a><a class="pred" href="consulting.html#prolog_file_type/2">prolog_file_type/2</a>.
389 Prolog. See also <a id="idx:prologfiletype2:1364"></a><a class="pred" href="consulting.html#prolog_file_type/2">prolog_file_type/2</a>.
380390 This predicate only returns non-directories, unless the option <code>file_type(directory)</code>
381391 is specified.</dd>
382392 <dt><strong>file_errors</strong>(<var>fail/error</var>)</dt>
383393 <dd class="defbody">
384394 If <code>error</code> (default), throw an <code>existence_error</code>
385395 exception if the file cannot be found. If <code>fail</code>, stay
386 silent.<sup class="fn">117<span class="fn-text">Silent operation was the
396 silent.<sup class="fn">120<span class="fn-text">Silent operation was the
387397 default up to version 3.2.6.</span></sup></dd>
388398 <dt><strong>solutions</strong>(<var>first/all</var>)</dt>
389399 <dd class="defbody">
393403 <dt><strong>expand</strong>(<var>true/false</var>)</dt>
394404 <dd class="defbody">
395405 If <code>true</code> (default is <code>false</code>) and <var>Spec</var>
396 is atomic, call <a id="idx:expandfilename2:1363"></a><a class="pred" href="files.html#expand_file_name/2">expand_file_name/2</a>
397 followed by <a id="idx:member2:1364"></a><a class="pred" href="lists.html#member/2">member/2</a>
406 is atomic, call <a id="idx:expandfilename2:1365"></a><a class="pred" href="files.html#expand_file_name/2">expand_file_name/2</a>
407 followed by <a id="idx:member2:1366"></a><a class="pred" href="lists.html#member/2">member/2</a>
398408 on <var>Spec</var> before proceeding. This is a SWI-Prolog extension.
399409 </dd>
400410 </dl>
413423 systems, this implies the path starts with a `/'. For Microsoft-based
414424 systems this implies the path starts with <code>&lt;<var>letter</var>&gt;:</code>.
415425 This predicate is intended to provide platform-independent checking for
416 absolute paths. See also <a id="idx:absolutefilename2:1365"></a><a class="pred" href="files.html#absolute_file_name/2">absolute_file_name/2</a>
417 and <a id="idx:prologtoosfilename2:1366"></a><a class="pred" href="files.html#prolog_to_os_filename/2">prolog_to_os_filename/2</a>.</dd>
426 absolute paths. See also <a id="idx:absolutefilename2:1367"></a><a class="pred" href="files.html#absolute_file_name/2">absolute_file_name/2</a>
427 and <a id="idx:prologtoosfilename2:1368"></a><a class="pred" href="files.html#prolog_to_os_filename/2">prolog_to_os_filename/2</a>.</dd>
418428 <dt class="pubdef"><a id="file_name_extension/3"><strong>file_name_extension</strong>(<var>?Base,
419429 ?Extension, ?Name</var>)</a></dt>
420430 <dd class="defbody">
432442 to <var>Directory</var>. <var>Entries</var> contains all entries,
433443 including hidden files and, if supplied by the OS, the special entries <code><code>.</code></code>
434444 and
435 <code>..</code>. See also <a id="idx:expandfilename2:1367"></a><a class="pred" href="files.html#expand_file_name/2">expand_file_name/2</a>.<sup class="fn">118<span class="fn-text">This
445 <code>..</code>. See also <a id="idx:expandfilename2:1369"></a><a class="pred" href="files.html#expand_file_name/2">expand_file_name/2</a>.<sup class="fn">121<span class="fn-text">This
436446 predicate should be considered a misnomer because it returns entries
437447 rather than files. We stick to this name for compatibility with, e.g.,
438448 SICStus, Ciao and YAP.</span></sup></dd>
456466 <p>Before expanding wildcards, the construct <code>$<var>var</var></code>
457467 is expanded to the value of the environment variable <var>var</var>, and
458468 a possible leading <code>~</code> character is expanded to the user's
459 home directory.<sup class="fn">119<span class="fn-text">On Windows, the
469 home directory.<sup class="fn">122<span class="fn-text">On Windows, the
460470 home directory is determined as follows: if the environment variable <code>HOME</code>
461471 exists, this is used. If the variables <code>HOMEDRIVE</code> and <code>HOMEPATH</code>
462472 exist (Windows-NT), these are used. At initialisation, the system will
492502
493503 <p>Because it is possible to guess the generated filename, attackers may
494504 create the filesystem entry as a link and possibly create a security
495 issue. New code should use <a id="idx:tmpfilestream3:1368"></a><a class="pred" href="files.html#tmp_file_stream/3">tmp_file_stream/3</a>.</dd>
505 issue. New code should use <a id="idx:tmpfilestream3:1370"></a><a class="pred" href="files.html#tmp_file_stream/3">tmp_file_stream/3</a>.</dd>
496506 <dt class="pubdef"><a id="tmp_file_stream/3"><strong>tmp_file_stream</strong>(<var>+Encoding,
497507 -FileName, -Stream</var>)</a></dt>
498508 <dd class="defbody">
503513 supports it, the created file is only accessible to the current user. If
504514 the OS supports it, the file is created using the open()-flag <code>O_EXCL</code>,
505515 which guarantees that the file did not exist before this call. This
506 predicate is a safe replacement of <a id="idx:tmpfile2:1369"></a><a class="pred" href="files.html#tmp_file/2">tmp_file/2</a>.
516 predicate is a safe replacement of <a id="idx:tmpfile2:1371"></a><a class="pred" href="files.html#tmp_file/2">tmp_file/2</a>.
507517 Note that in those cases where the temporary file is needed to store
508518 output from an external command, the file must be closed first. E.g.,
509519 the following downloads a file from a URL to a temporary file and opens
520530 </pre>
521531
522532 <p>Temporary files created using this call are removed if the Prolog
523 process terminates <em>gracefully</em>. Calling <a id="idx:deletefile1:1370"></a><a class="pred" href="files.html#delete_file/1">delete_file/1</a>
533 process terminates <em>gracefully</em>. Calling <a id="idx:deletefile1:1372"></a><a class="pred" href="files.html#delete_file/1">delete_file/1</a>
524534 using
525535 <var>FileName</var> removes the file and removes the entry from the
526536 administration of files-to-be-deleted.</dd>
541551 directory and change working directory to <var>New</var>. Use the
542552 pattern
543553 <code>working_directory(CWD, CWD)</code> to get the current directory.
544 See also <a id="idx:absolutefilename2:1371"></a><a class="pred" href="files.html#absolute_file_name/2">absolute_file_name/2</a>
545 and <a id="idx:chdir1:1372"></a><a class="pred" href="files.html#chdir/1">chdir/1</a>.<sup class="fn">bug<span class="fn-text">Some
554 See also <a id="idx:absolutefilename2:1373"></a><a class="pred" href="files.html#absolute_file_name/2">absolute_file_name/2</a>
555 and <a id="idx:chdir1:1374"></a><a class="pred" href="files.html#chdir/1">chdir/1</a>.<sup class="fn">bug<span class="fn-text">Some
546556 of the file I/O predicates use local filenames. Changing directory while
547 file-bound streams are open causes wrong results on <a id="idx:telling1:1373"></a><a class="pred" href="IO.html#telling/1">telling/1</a>, <a id="idx:seeing1:1374"></a><a class="pred" href="IO.html#seeing/1">seeing/1</a>
548 and <a id="idx:currentstream3:1375"></a><a class="pred" href="IO.html#current_stream/3">current_stream/3</a>.</span></sup>
557 file-bound streams are open causes wrong results on <a id="idx:telling1:1375"></a><a class="pred" href="IO.html#telling/1">telling/1</a>, <a id="idx:seeing1:1376"></a><a class="pred" href="IO.html#seeing/1">seeing/1</a>
558 and <a id="idx:currentstream3:1377"></a><a class="pred" href="IO.html#current_stream/3">current_stream/3</a>.</span></sup>
549559 Note that the working directory is shared between all threads.</dd>
550560 <dt class="pubdef"><a id="chdir/1"><strong>chdir</strong>(<var>+Path</var>)</a></dt>
551561 <dd class="defbody">
552 Compatibility predicate. New code should use <a id="idx:workingdirectory2:1376"></a><a class="pred" href="files.html#working_directory/2">working_directory/2</a>.
562 Compatibility predicate. New code should use <a id="idx:workingdirectory2:1378"></a><a class="pred" href="files.html#working_directory/2">working_directory/2</a>.
553563 </dd>
554564 </dl>
555565
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 11.4</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 11.4</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
239239
240240 <p>If your application uses files that are not part of the saved program
241241 such as database files, configuration files, etc., the runtime version
242 has to be able to locate these files. The <a id="idx:filesearchpath2:1936"></a><a class="pred" href="consulting.html#file_search_path/2">file_search_path/2</a>
242 has to be able to locate these files. The <a id="idx:filesearchpath2:1939"></a><a class="pred" href="consulting.html#file_search_path/2">file_search_path/2</a>
243243 mechanism in combination with the <strong>-p</strong>alias command line
244244 argument is the preferred way to locate runtime files. The first step is
245245 to define an alias for the top-level directory of your application. We
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 10.6</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 10.6</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
239239
240240 <p>Executables embedding SWI-Prolog should be able to find the `home'
241241 directory of the development environment unless a self-contained saved
242 state has been added to the executable (see <a id="idx:qsaveprogram12:1897"></a><span class="pred-ext">qsave_program/[1,2]</span>
242 state has been added to the executable (see <a id="idx:qsaveprogram12:1900"></a><span class="pred-ext">qsave_program/[1,2]</span>
243243 and <a class="sec" href="plld.html">section 10.5</a>).
244244
245245 <p>If Prolog starts up, it will try to locate the development
268268 SWI-Prolog gives up. If a state is attached, the current working
269269 directory is used.
270270
271 <p>The <a id="idx:filesearchpath2:1898"></a><a class="pred" href="consulting.html#file_search_path/2">file_search_path/2</a>
271 <p>The <a id="idx:filesearchpath2:1901"></a><a class="pred" href="consulting.html#file_search_path/2">file_search_path/2</a>
272272 alias <code>swi</code> is set to point to the home directory located.
273273
274274 <p></body></html>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 2.11</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 2.11</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.30</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.30</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
250250 Result =:= Formula).
251251 </pre>
252252
253 <p>The predicate <a id="idx:forall2:1253"></a><a class="pred" href="forall2.html#forall/2">forall/2</a>
253 <p>The predicate <a id="idx:forall2:1255"></a><a class="pred" href="forall2.html#forall/2">forall/2</a>
254254 is implemented as <code>\+ ( Cond, \+ Action)</code>, i.e., <i>There is
255255 no instantiation of <var>Cond</var> for which <var>Action</var> is
256256 false.</i>. The use of double negation implies that
257 <a id="idx:forall2:1254"></a><a class="pred" href="forall2.html#forall/2">forall/2</a> <em>does
258 not change any variable bindings</em>. It proves a relation. The <a id="idx:forall2:1255"></a><a class="pred" href="forall2.html#forall/2">forall/2</a>
257 <a id="idx:forall2:1256"></a><a class="pred" href="forall2.html#forall/2">forall/2</a> <em>does
258 not change any variable bindings</em>. It proves a relation. The <a id="idx:forall2:1257"></a><a class="pred" href="forall2.html#forall/2">forall/2</a>
259259 control structure can be used for its side-effects. E.g., the following
260260 asserts relations in a list into the dynamic database:
261261
264264 assertz(child_of(Child, Parent))).
265265 </pre>
266266
267 <p>Using <a id="idx:forall2:1256"></a><a class="pred" href="forall2.html#forall/2">forall/2</a>
267 <p>Using <a id="idx:forall2:1258"></a><a class="pred" href="forall2.html#forall/2">forall/2</a>
268268 as <code>forall(Generator, SideEffect)</code> is preferred over the
269269 classical <em>failure driven loop</em> as shown below because it makes
270270 it explicit which part of the construct is the generator and which part
282282 )
283283 </pre>
284284
285 <p>If your intent is to create variable bindings, the <a id="idx:forall2:1257"></a><a class="pred" href="forall2.html#forall/2">forall/2</a>
286 control structure is inadequate. Possibly you are looking for <a id="idx:maplist2:1258"></a><a class="pred" href="apply.html#maplist/2">maplist/2</a>,
287 <a id="idx:findall3:1259"></a><a class="pred" href="allsolutions.html#findall/3">findall/3</a>
288 or <a id="idx:foreach2:1260"></a><a class="pred" href="aggregate.html#foreach/2">foreach/2</a>.
285 <p>If your intent is to create variable bindings, the <a id="idx:forall2:1259"></a><a class="pred" href="forall2.html#forall/2">forall/2</a>
286 control structure is inadequate. Possibly you are looking for <a id="idx:maplist2:1260"></a><a class="pred" href="apply.html#maplist/2">maplist/2</a>,
287 <a id="idx:findall3:1261"></a><a class="pred" href="allsolutions.html#findall/3">findall/3</a>
288 or <a id="idx:foreach2:1262"></a><a class="pred" href="aggregate.html#foreach/2">foreach/2</a>.
289289 </dd>
290290 </dl>
291291
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 10.4</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 10.4</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
350350 or <code>PL_PRUNED</code>).</dd>
351351 <dt class="pubdef"><a id="PL_foreign_context_address()"><var>void *</var> <strong>PL_foreign_context_address</strong>(<var>control_t</var>)</a></dt>
352352 <dd class="defbody">
353 Extracts an address as passed in by <a class="func" href="foreigninclude.html#PL_retry_address()">PL_retry_address()</a>.
353 Extracts an address as passed in by <a class="func" href="foreigninclude.html#PL_retry_address()">PL_retry_address()</a>.</dd>
354 <dt class="pubdef"><a id="PL_foreign_context_predicate()"><var>predicate_t</var> <strong>PL_foreign_context_predicate</strong>(<var>control_t</var>)</a></dt>
355 <dd class="defbody">
356
357 <p>Fetch the Prolog predicate that is executing this function. Note that
358 if the predicate is imported, the returned predicate refers to the final
359 definition rather than the imported predicate, i.e., the module reported
360 by <a class="func" href="foreigninclude.html#PL_predicate_info()">PL_predicate_info()</a>
361 is the module in which the predicate is defined rather than the module
362 where it was called. See also
363 <a class="func" href="foreigninclude.html#PL_predicate_info()">PL_predicate_info()</a>.
354364 </dd>
355365 </dl>
356366
486496 <dd class="defbody">
487497 Increment the reference count of the atom by one. <a class="func" href="foreigninclude.html#PL_new_atom()">PL_new_atom()</a>
488498 performs this automatically, returning an atom with a reference count of
489 at least one.<sup class="fn">148<span class="fn-text">Otherwise
499 at least one.<sup class="fn">151<span class="fn-text">Otherwise
490500 asynchronous atom garbage collection might destroy the atom before it is
491501 used.</span></sup></dd>
492502 <dt class="pubdef"><a id="PL_unregister_atom()"><var>void</var> <strong>PL_unregister_atom</strong>(<var>atom_t
518528 <p>Each argument of a foreign function (except for the control argument)
519529 is of type <code>term_t</code>, an opaque handle to a Prolog term. Three
520530 groups of functions are available for the analysis of terms. The first
521 just validates the type, like the Prolog predicates <a id="idx:var1:1828"></a><a class="pred" href="typetest.html#var/1">var/1</a>, <a id="idx:atom1:1829"></a><a class="pred" href="typetest.html#atom/1">atom/1</a>,
531 just validates the type, like the Prolog predicates <a id="idx:var1:1831"></a><a class="pred" href="typetest.html#var/1">var/1</a>, <a id="idx:atom1:1832"></a><a class="pred" href="typetest.html#atom/1">atom/1</a>,
522532 etc., and are called <code>PL_is_*()</code>. The second group attempts
523533 to translate the argument into a C primitive type. These predicates take
524534 a <code>term_t</code> and a pointer to the appropriate C type and return <code>TRUE</code>
595605 Returns non-zero if <var>term</var> is a variable.</dd>
596606 <dt class="pubdef"><a id="PL_is_ground()"><var>int</var> <strong>PL_is_ground</strong>(<var>term_t</var>)</a></dt>
597607 <dd class="defbody">
598 Returns non-zero if <var>term</var> is a ground term. See also <a id="idx:ground1:1830"></a><a class="pred" href="typetest.html#ground/1">ground/1</a>.
608 Returns non-zero if <var>term</var> is a ground term. See also <a id="idx:ground1:1833"></a><a class="pred" href="typetest.html#ground/1">ground/1</a>.
599609 This function is cycle-safe.</dd>
600610 <dt class="pubdef"><a id="PL_is_atom()"><var>int</var> <strong>PL_is_atom</strong>(<var>term_t</var>)</a></dt>
601611 <dd class="defbody">
611621 Returns non-zero if <var>term</var> is a float.</dd>
612622 <dt class="pubdef"><a id="PL_is_callable()"><var>int</var> <strong>PL_is_callable</strong>(<var>term_t</var>)</a></dt>
613623 <dd class="defbody">
614 Returns non-zero if <var>term</var> is a callable term. See <a id="idx:callable1:1831"></a><a class="pred" href="typetest.html#callable/1">callable/1</a>
624 Returns non-zero if <var>term</var> is a callable term. See <a id="idx:callable1:1834"></a><a class="pred" href="typetest.html#callable/1">callable/1</a>
615625 for details.</dd>
616626 <dt class="pubdef"><a id="PL_is_compound()"><var>int</var> <strong>PL_is_compound</strong>(<var>term_t</var>)</a></dt>
617627 <dd class="defbody">
719729 <dt><strong>CVT_FLOAT</strong></dt>
720730 <dd class="defbody">
721731 Convert if term is a float. The characters returned are the same as
722 <a id="idx:write1:1832"></a><a class="pred" href="termrw.html#write/1">write/1</a>
732 <a id="idx:write1:1835"></a><a class="pred" href="termrw.html#write/1">write/1</a>
723733 would write for the floating point number.</dd>
724734 <dt><strong>CVT_NUMBER</strong></dt>
725735 <dd class="defbody">
733743 <dt><strong>CVT_WRITE</strong></dt>
734744 <dd class="defbody">
735745 Convert any term that is not converted by any of the other flags using
736 <a id="idx:write1:1833"></a><a class="pred" href="termrw.html#write/1">write/1</a>.
746 <a id="idx:write1:1836"></a><a class="pred" href="termrw.html#write/1">write/1</a>.
737747 If no <code>BUF_*</code> is provided, <code>BUF_RING</code> is implied.</dd>
738748 <dt><strong>CVT_WRITE_CANONICAL</strong></dt>
739749 <dd class="defbody">
740 As <code>CVT_WRITE</code>, but using <a id="idx:writecanonical2:1834"></a><a class="pred" href="termrw.html#write_canonical/2">write_canonical/2</a>.</dd>
750 As <code>CVT_WRITE</code>, but using <a id="idx:writecanonical2:1837"></a><a class="pred" href="termrw.html#write_canonical/2">write_canonical/2</a>.</dd>
741751 <dt><strong>CVT_WRITEQ</strong></dt>
742752 <dd class="defbody">
743 As <code>CVT_WRITE</code>, but using <a id="idx:writeq2:1835"></a><a class="pred" href="termrw.html#writeq/2">writeq/2</a>.</dd>
753 As <code>CVT_WRITE</code>, but using <a id="idx:writeq2:1838"></a><a class="pred" href="termrw.html#writeq/2">writeq/2</a>.</dd>
744754 <dt><strong>CVT_ALL</strong></dt>
745755 <dd class="defbody">
746756 Convert if term is any of the above, except for <code>CVT_VARIABLE</code>
11141124 <a id="sec:foreign-write"></a>
11151125
11161126 <p><a class="fig" href="foreigninclude.html#fig:pl-display">Figure 7</a>
1117 shows a simplified definition of <a id="idx:write1:1837"></a><a class="pred" href="termrw.html#write/1">write/1</a>
1127 shows a simplified definition of <a id="idx:write1:1840"></a><a class="pred" href="termrw.html#write/1">write/1</a>
11181128 to illustrate the described functions. This simplified version does not
1119 deal with operators. It is called <a id="idx:display1:1838"></a><span class="pred-ext">display/1</span>,
1129 deal with operators. It is called <a id="idx:display1:1841"></a><span class="pred-ext">display/1</span>,
11201130 because it mimics closely the behaviour of this Edinburgh predicate.
11211131
11221132 <pre class="code">
11601170 }
11611171 </pre>
11621172
1163 <div class="caption"><b>Figure 7 : </b>A Foreign definition of <a id="idx:display1:1839"></a><span class="pred-ext">display/1</span></div>
1173 <div class="caption"><b>Figure 7 : </b>A Foreign definition of <a id="idx:display1:1842"></a><span class="pred-ext">display/1</span></div>
11641174 <a id="fig:pl-display"></a>
11651175
11661176 <p><h3 id="sec:foreign-term-construct"><a id="sec:10.4.4"><span class="sec-nr">10.4.4</span> <span class="sec-title">Constructing
11841194 -t</var>)</a></dt>
11851195 <dd class="defbody">
11861196 Put a fresh variable in the term, resetting the term reference to its
1187 initial state.<sup class="fn">149<span class="fn-text">Older versions
1197 initial state.<sup class="fn">152<span class="fn-text">Older versions
11881198 created a variable on the global stack.</span></sup>
11891199 </dd>
11901200 <dt class="pubdef"><a id="PL_put_atom()"><var>void</var> <strong>PL_put_atom</strong>(<var>term_t
17681778 full-stop (i.e., a dot followed by a blank). Returns <code>FALSE</code>
17691779 if a syntax error was encountered and <code>TRUE</code> after successful
17701780 completion. In addition to returning <code>FALSE</code>, the
1771 exception-term is returned in <var>t</var> on a syntax error. See also <a id="idx:termtoatom2:1840"></a><a class="pred" href="manipatom.html#term_to_atom/2">term_to_atom/2</a>.
1781 exception-term is returned in <var>t</var> on a syntax error. See also <a id="idx:termtoatom2:1843"></a><a class="pred" href="manipatom.html#term_to_atom/2">term_to_atom/2</a>.
17721782
17731783 <p>The following example builds a goal term from a string and calls it.
17741784
19561966 <dd class="defbody">
19571967 Raise <code>instantiation_error</code>. <var>Culprit</var> is ignored,
19581968 but should be bound to the term that is insufficiently instantiated. See
1959 <a id="idx:instantiationerror1:1841"></a><span class="pred-ext">instantiation_error/1</span>.</dd>
1969 <a id="idx:instantiationerror1:1844"></a><span class="pred-ext">instantiation_error/1</span>.</dd>
19601970 <dt class="pubdef"><a id="PL_uninstantiation_error()"><var>int</var> <strong>PL_uninstantiation_error</strong>(<var>term_t
19611971 culprit</var>)</a></dt>
19621972 <dd class="defbody">
19631973 Raise <code>uninstantiation_error(culprit)</code>. This should be called
19641974 if an argument that must be unbound at entry is bound to <var>culprit</var>.
19651975 This error is typically raised for a pure output arguments such as a
1966 newly created stream handle (e.g., the third argument of <a id="idx:open3:1842"></a><a class="pred" href="IO.html#open/3">open/3</a>).</dd>
1976 newly created stream handle (e.g., the third argument of <a id="idx:open3:1845"></a><a class="pred" href="IO.html#open/3">open/3</a>).</dd>
19671977 <dt class="pubdef"><a id="PL_representation_error()"><var>int</var> <strong>PL_representation_error</strong>(<var>const
19681978 char *resource</var>)</a></dt>
19691979 <dd class="defbody">
1970 Raise <code>representation_error(resource)</code>. See <a id="idx:representationerror1:1843"></a><span class="pred-ext">representation_error/1</span>.</dd>
1980 Raise <code>representation_error(resource)</code>. See <a id="idx:representationerror1:1846"></a><span class="pred-ext">representation_error/1</span>.</dd>
19711981 <dt class="pubdef"><a id="PL_type_error()"><var>int</var> <strong>PL_type_error</strong>(<var>const
19721982 char *expected, term_t culprit</var>)</a></dt>
19731983 <dd class="defbody">
1974 Raise <code>type_error(expected, culprit)</code>. See <a id="idx:typeerror2:1844"></a><span class="pred-ext">type_error/2</span>.</dd>
1984 Raise <code>type_error(expected, culprit)</code>. See <a id="idx:typeerror2:1847"></a><span class="pred-ext">type_error/2</span>.</dd>
19751985 <dt class="pubdef"><a id="PL_domain_error()"><var>int</var> <strong>PL_domain_error</strong>(<var>const
19761986 char *expected, term_t culprit</var>)</a></dt>
19771987 <dd class="defbody">
1978 Raise <code>domain_error(expected, culprit)</code>. See <a id="idx:domainerror2:1845"></a><span class="pred-ext">domain_error/2</span>.</dd>
1988 Raise <code>domain_error(expected, culprit)</code>. See <a id="idx:domainerror2:1848"></a><span class="pred-ext">domain_error/2</span>.</dd>
19791989 <dt class="pubdef"><a id="PL_existence_error()"><var>int</var> <strong>PL_existence_error</strong>(<var>const
19801990 char *type, term_t culprit</var>)</a></dt>
19811991 <dd class="defbody">
1982 Raise <code>existence_error(type, culprit)</code>. See <a id="idx:typeerror2:1846"></a><span class="pred-ext">type_error/2</span>.</dd>
1992 Raise <code>existence_error(type, culprit)</code>. See <a id="idx:typeerror2:1849"></a><span class="pred-ext">type_error/2</span>.</dd>
19831993 <dt class="pubdef"><a id="PL_permission_error()"><var>int</var> <strong>PL_permission_error</strong>(<var>const
19841994 char *operation, const char *type, term_t culprit</var>)</a></dt>
19851995 <dd class="defbody">
19861996 Raise <code>permission_error(operation, type, culprit)</code>. See
1987 <a id="idx:permissionerror3:1847"></a><span class="pred-ext">permission_error/3</span>.
1997 <a id="idx:permissionerror3:1850"></a><span class="pred-ext">permission_error/3</span>.
19881998 </dd>
19891999 <dt class="pubdef"><a id="PL_resource_error()"><var>int</var> <strong>PL_resource_error</strong>(<var>const
19902000 char *resource</var>)</a></dt>
19912001 <dd class="defbody">
1992 Raise <code>resource_error(resource)</code>. See <a id="idx:resourceerror1:1848"></a><span class="pred-ext">resource_error/1</span>.
2002 Raise <code>resource_error(resource)</code>. See <a id="idx:resourceerror1:1851"></a><span class="pred-ext">resource_error/1</span>.
19932003 </dd>
19942004 <dt class="pubdef"><a id="PL_syntax_error()"><var>int</var> <strong>PL_syntax_error</strong>(<var>const
19952005 char *message, IOSTREAM *in</var>)</a></dt>
20042014
20052015 <a id="sec:blob"></a>
20062016
2007 <p><a id="idx:Java:1849"></a><a id="idx:COM:1850"></a>SWI-Prolog atoms
2017 <p><a id="idx:Java:1852"></a><a id="idx:COM:1853"></a>SWI-Prolog atoms
20082018 as well as strings can represent arbitrary binary data of arbitrary
20092019 length. This facility is attractive for storing foreign data such as
20102020 images in an atom. An atom is a unique handle to this data and the atom
20702080 </dl>
20712081
20722082 <p>The <var>name</var> field represents the type name as available to
2073 Prolog. See also <a id="idx:currentblob2:1851"></a><a class="pred" href="examineprog.html#current_blob/2">current_blob/2</a>.
2083 Prolog. See also <a id="idx:currentblob2:1854"></a><a class="pred" href="examineprog.html#current_blob/2">current_blob/2</a>.
20742084 The other fields are function pointers that must be initialised to
20752085 proper functions or <code>NULL</code> to get the default behaviour of
20762086 built-in atoms. Below are the defined member functions:
21082118 undocumented <code>SWI-Stream.h</code> is included <em>before</em>
21092119 <code>SWI-Prolog.h</code>.
21102120
2111 <p>If this function is not provided, <a id="idx:write1:1852"></a><a class="pred" href="termrw.html#write/1">write/1</a>
2121 <p>If this function is not provided, <a id="idx:write1:1855"></a><a class="pred" href="termrw.html#write/1">write/1</a>
21122122 emits the content of the blob for blobs of type <code>PL_BLOB_TEXT</code>
21132123 or a string of the format <code>&lt;#</code><i>hex data</i><code>&gt;</code>
21142124 for binary blobs.
22832293
22842294 <p>The Prolog engine can be called from C. There are two interfaces for
22852295 this. For the first, a term is created that could be used as an argument
2286 to <a id="idx:call1:1853"></a><a class="pred" href="metacall.html#call/1">call/1</a>,
2296 to <a id="idx:call1:1856"></a><a class="pred" href="metacall.html#call/1">call/1</a>,
22872297 and then <a class="func" href="foreigninclude.html#PL_call()">PL_call()</a>
22882298 is used to call Prolog. This system is simple, but does not allow to
22892299 inspect the different answers to a non-deterministic goal and is
23602370 module</em> of the goal. When <code>NULL</code>, the context module of
23612371 the calling context will be used, or <code>user</code> if there is no
23622372 calling context (as may happen in embedded systems). Note that the
2363 context module only matters for <em>meta-predicates</em>. See <a id="idx:metapredicate1:1854"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>,
2364 <a id="idx:contextmodule1:1855"></a><a class="pred" href="ctxmodule.html#context_module/1">context_module/1</a>
2365 and <a id="idx:moduletransparent1:1856"></a><a class="pred" href="ctxmodule.html#module_transparent/1">module_transparent/1</a>.
2373 context module only matters for <em>meta-predicates</em>. See <a id="idx:metapredicate1:1857"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>,
2374 <a id="idx:contextmodule1:1858"></a><a class="pred" href="ctxmodule.html#context_module/1">context_module/1</a>
2375 and <a id="idx:moduletransparent1:1859"></a><a class="pred" href="ctxmodule.html#module_transparent/1">module_transparent/1</a>.
23662376 The <var>p</var> argument specifies the predicate, and should be the
23672377 result of a call to <a class="func" href="foreigninclude.html#PL_pred()">PL_pred()</a>
23682378 or <a class="func" href="foreigninclude.html#PL_predicate()">PL_predicate()</a>.
23802390 <dd class="defbody">
23812391 Normal operation. The debugger inherits its settings from the
23822392 environment. If an exception occurs that is not handled in Prolog, a
2383 message is printed and the tracer is started to debug the error.<sup class="fn">150<span class="fn-text">Do
2393 message is printed and the tracer is started to debug the error.<sup class="fn">153<span class="fn-text">Do
23842394 not pass the integer 0 for normal operation, as this is interpreted as <code>PL_Q_NODEBUG</code>
23852395 for backward compatibility reasons.</span></sup>
23862396 </dd>
23872397 <dt><b><code>PL_Q_NODEBUG</code></b></dt>
23882398 <dd class="defbody">
23892399 Switch off the debugger while executing the goal. This option is used by
2390 many calls to hook-predicates to avoid tracing the hooks. An example is <a id="idx:print1:1857"></a><a class="pred" href="termrw.html#print/1">print/1</a>
2391 calling <a id="idx:portray1:1858"></a><a class="pred" href="termrw.html#portray/1">portray/1</a>
2400 many calls to hook-predicates to avoid tracing the hooks. An example is <a id="idx:print1:1860"></a><a class="pred" href="termrw.html#print/1">print/1</a>
2401 calling <a id="idx:portray1:1861"></a><a class="pred" href="termrw.html#portray/1">portray/1</a>
23922402 from foreign code.
23932403 </dd>
23942404 <dt><b><code>PL_Q_CATCH_EXCEPTION</code></b></dt>
24642474 <dt class="pubdef"><a id="PL_call()"><var>int</var> <strong>PL_call</strong>(<var>term_t
24652475 t, module_t m</var>)</a></dt>
24662476 <dd class="defbody">
2467 Call term <var>t</var> just like the Prolog predicate <a id="idx:once1:1859"></a><a class="pred" href="metacall.html#once/1">once/1</a>. <var>t</var>
2477 Call term <var>t</var> just like the Prolog predicate <a id="idx:once1:1862"></a><a class="pred" href="metacall.html#once/1">once/1</a>. <var>t</var>
24682478 is called in the module <var>m</var>, or in the context module if <var>m</var>
24692479 == NULL. Returns <code>TRUE</code> if the call succeeds, <code>FALSE</code>
24702480 otherwise.
26292639 or
26302640 <a class="func" href="foreigninclude.html#PL_discard_foreign_frame()">PL_discard_foreign_frame()</a>
26312641 afterwards, as this will invalidate the exception term. Below is the
2632 code that calls a Prolog-defined arithmetic function (see <a id="idx:arithmeticfunction1:1860"></a><span class="pred-ext">arithmetic_function/1</span>).
2642 code that calls a Prolog-defined arithmetic function (see <a id="idx:arithmeticfunction1:1863"></a><span class="pred-ext">arithmetic_function/1</span>).
26332643
26342644 <p>If <a class="func" href="foreigninclude.html#PL_next_solution()">PL_next_solution()</a>
26352645 succeeds, the result is analysed and translated to a number, after which
26822692 <dt class="pubdef"><a id="PL_raise_exception()"><var>int</var> <strong>PL_raise_exception</strong>(<var>term_t
26832693 exception</var>)</a></dt>
26842694 <dd class="defbody">
2685 Generate an exception (as <a id="idx:throw1:1861"></a><a class="pred" href="exception.html#throw/1">throw/1</a>)
2695 Generate an exception (as <a id="idx:throw1:1864"></a><a class="pred" href="exception.html#throw/1">throw/1</a>)
26862696 and return <code>FALSE</code>. Below is an example returning an
26872697 exception from a foreign predicate:
26882698
27192729 <dd class="defbody">
27202730 If <a class="func" href="foreigninclude.html#PL_next_solution()">PL_next_solution()</a>
27212731 fails, this can be due to normal failure of the Prolog call, or because
2722 an exception was raised using <a id="idx:throw1:1862"></a><a class="pred" href="exception.html#throw/1">throw/1</a>.
2732 an exception was raised using <a id="idx:throw1:1865"></a><a class="pred" href="exception.html#throw/1">throw/1</a>.
27232733 This function returns a handle to the exception term if an exception was
27242734 raised, or 0 if the Prolog goal simply failed. If there is an exception,
27252735 <a class="func" href="foreigninclude.html#PL_exception()">PL_exception()</a>
27342744 <dd class="defbody">
27352745 Tells Prolog that the encountered exception must be ignored. This
27362746 function must be called if control remains in C after a previous API
2737 call fails with an exception.<sup class="fn">151<span class="fn-text">This
2747 call fails with an exception.<sup class="fn">154<span class="fn-text">This
27382748 feature is non-portable. Other Prolog systems (e.g., YAP) have no
27392749 facilities to ignore raised exceptions, and the design of YAP's
27402750 exception handling does not support such a facility.</span></sup>
27822792 which is checked by <a class="func" href="foreigninclude.html#PL_handle_signals()">PL_handle_signals()</a>
27832793 at the call- and redo-port. This behaviour is realised by <em>or</em>-ing <var>sig</var>
27842794 with the constant
2785 <code>PL_SIGSYNC</code>.<sup class="fn">152<span class="fn-text">A
2795 <code>PL_SIGSYNC</code>.<sup class="fn">155<span class="fn-text">A
27862796 better default would be to use synchronous handling, but this interface
27872797 preserves backward compatibility.</span></sup>
27882798
27972807 Register <var>sig</var> for <em>synchronous</em> handling by Prolog.
27982808 Synchronous signals are handled at the call-port or if foreign code
27992809 calls <a class="func" href="foreigninclude.html#PL_handle_signals()">PL_handle_signals()</a>.
2800 See also <a id="idx:threadsignal2:1863"></a><a class="pred" href="threadcom.html#thread_signal/2">thread_signal/2</a>.</dd>
2810 See also <a id="idx:threadsignal2:1866"></a><a class="pred" href="threadcom.html#thread_signal/2">thread_signal/2</a>.</dd>
28012811 <dt class="pubdef"><a id="PL_handle_signals()"><var>int</var> <strong>PL_handle_signals</strong>(<var>void</var>)</a></dt>
28022812 <dd class="defbody">
28032813 Handle any signals pending from <a class="func" href="foreigninclude.html#PL_raise()">PL_raise()</a>. <a class="func" href="foreigninclude.html#PL_handle_signals()">PL_handle_signals()</a>
28362846 t1, term_t t2</var>)</a></dt>
28372847 <dd class="defbody">
28382848 Compares two terms using the standard order of terms and returns -1, 0
2839 or 1. See also <a id="idx:compare3:1864"></a><a class="pred" href="compare.html#compare/3">compare/3</a>.
2849 or 1. See also <a id="idx:compare3:1867"></a><a class="pred" href="compare.html#compare/3">compare/3</a>.
28402850 </dd>
28412851 <dt class="pubdef"><a id="PL_same_compound()"><var>int</var> <strong>PL_same_compound</strong>(<var>term_t
28422852 t1, term_t t2</var>)</a></dt>
28632873
28642874 <p>Two groups of functions are provided. The first group (<a class="func" href="foreigninclude.html#PL_record()">PL_record()</a>
28652875 and friends) store Prolog terms on the Prolog heap for retrieval during
2866 the same session. These functions are also used by <a id="idx:recorda3:1865"></a><a class="pred" href="db.html#recorda/3">recorda/3</a>
2876 the same session. These functions are also used by <a id="idx:recorda3:1868"></a><a class="pred" href="db.html#recorda/3">recorda/3</a>
28672877 and friends. The recorded database may be used to communicate Prolog
28682878 terms between threads.
28692879
28712881 <dt class="pubdef"><a id="PL_record()"><var>record_t</var> <strong>PL_record</strong>(<var>term_t
28722882 +t</var>)</a></dt>
28732883 <dd class="defbody">
2874 Record the term <var>t</var> into the Prolog database as <a id="idx:recorda3:1866"></a><a class="pred" href="db.html#recorda/3">recorda/3</a>
2884 Record the term <var>t</var> into the Prolog database as <a id="idx:recorda3:1869"></a><a class="pred" href="db.html#recorda/3">recorda/3</a>
28752885 and return an opaque handle to the term. The returned handle remains
28762886 valid until <a class="func" href="foreigninclude.html#PL_erase()">PL_erase()</a>
28772887 is called on it. <a class="func" href="foreigninclude.html#PL_recorded()">PL_recorded()</a>
29262936 <dt class="pubdef"><a id="PL_record_external()"><var>char *</var> <strong>PL_record_external</strong>(<var>term_t
29272937 +t, size_t *len</var>)</a></dt>
29282938 <dd class="defbody">
2929 Record the term <var>t</var> into the Prolog database as <a id="idx:recorda3:1867"></a><a class="pred" href="db.html#recorda/3">recorda/3</a>
2939 Record the term <var>t</var> into the Prolog database as <a id="idx:recorda3:1870"></a><a class="pred" href="db.html#recorda/3">recorda/3</a>
29302940 and return an opaque handle to the term. The returned handle remains
29312941 valid until <a class="func" href="foreigninclude.html#PL_erase_external()">PL_erase_external()</a>
29322942 is called on it.
29622972
29632973 <p>The function <a class="func" href="foreigninclude.html#PL_get_file_name()">PL_get_file_name()</a>
29642974 provides access to Prolog filenames and its file-search mechanism
2965 described with <a id="idx:absolutefilename3:1868"></a><a class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</a>.
2975 described with <a id="idx:absolutefilename3:1871"></a><a class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</a>.
29662976 Its existence is motivated to realise a uniform interface to deal with
29672977 file properties, search, naming conventions, etc., from foreign code.
29682978
29913001 </dd>
29923002 <dt><b><code>PL_FILE_SEARCH</code></b></dt>
29933003 <dd class="defbody">
2994 Invoke <a id="idx:absolutefilename3:1869"></a><a class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</a>.
2995 This implies rules from <a id="idx:filesearchpath2:1870"></a><a class="pred" href="consulting.html#file_search_path/2">file_search_path/2</a>
3004 Invoke <a id="idx:absolutefilename3:1872"></a><a class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</a>.
3005 This implies rules from <a id="idx:filesearchpath2:1873"></a><a class="pred" href="consulting.html#file_search_path/2">file_search_path/2</a>
29963006 are used.
29973007 </dd>
29983008 <dt><b><code>PL_FILE_EXIST</code></b></dt>
30353045 <a id="sec:cprologflags"></a>
30363046
30373047 <p>Foreign code can set or create Prolog flags using <a class="func" href="foreigninclude.html#PL_set_prolog_flag()">PL_set_prolog_flag()</a>.
3038 See <a id="idx:setprologflag2:1871"></a><a class="pred" href="flags.html#set_prolog_flag/2">set_prolog_flag/2</a>
3039 and <a id="idx:createprologflag3:1872"></a><a class="pred" href="flags.html#create_prolog_flag/3">create_prolog_flag/3</a>.<sup class="fn">153<span class="fn-text">The
3048 See <a id="idx:setprologflag2:1874"></a><a class="pred" href="flags.html#set_prolog_flag/2">set_prolog_flag/2</a>
3049 and <a id="idx:createprologflag3:1875"></a><a class="pred" href="flags.html#create_prolog_flag/3">create_prolog_flag/3</a>.<sup class="fn">156<span class="fn-text">The
30403050 current C API does not provide for a dedicated mechanism for fetching
30413051 the value of Prolog flags. Relatively slow access is provided by calling <a class="func" href="foreigninclude.html#PL_call_predicate()">PL_call_predicate()</a>
3042 using <a id="idx:currentprologflag2:1873"></a><a class="pred" href="flags.html#current_prolog_flag/2">current_prolog_flag/2</a>.</span></sup>
3052 using <a id="idx:currentprologflag2:1876"></a><a class="pred" href="flags.html#current_prolog_flag/2">current_prolog_flag/2</a>.</span></sup>
30433053
30443054 <dl class="latex">
30453055 <dt class="pubdef"><a id="PL_set_prolog_flag()"><var>int</var> <strong>PL_set_prolog_flag</strong>(<var>const
31113121 <dl class="latex">
31123122 <dt><strong>PL_ACTION_TRACE</strong></dt>
31133123 <dd class="defbody">
3114 Start Prolog tracer (<a id="idx:trace0:1874"></a><a class="pred" href="debugger.html#trace/0">trace/0</a>).
3124 Start Prolog tracer (<a id="idx:trace0:1877"></a><a class="pred" href="debugger.html#trace/0">trace/0</a>).
31153125 Requires no arguments.</dd>
31163126 <dt><strong>PL_ACTION_DEBUG</strong></dt>
31173127 <dd class="defbody">
3118 Switch on Prolog debug mode (<a id="idx:debug0:1875"></a><a class="pred" href="debugger.html#debug/0">debug/0</a>).
3128 Switch on Prolog debug mode (<a id="idx:debug0:1878"></a><a class="pred" href="debugger.html#debug/0">debug/0</a>).
31193129 Requires no arguments.</dd>
31203130 <dt><strong>PL_ACTION_BACKTRACE</strong></dt>
31213131 <dd class="defbody">
31253135 <dd class="defbody">
31263136 Halt Prolog execution. This action should be called rather than Unix
31273137 exit() to give Prolog the opportunity to clean up. This call does not
3128 return. The argument (an <code>int</code>) is the exit code. See <a id="idx:halt1:1876"></a><a class="pred" href="toplevel.html#halt/1">halt/1</a>.</dd>
3138 return. The argument (an <code>int</code>) is the exit code. See <a id="idx:halt1:1879"></a><a class="pred" href="toplevel.html#halt/1">halt/1</a>.</dd>
31293139 <dt><strong>PL_ACTION_ABORT</strong></dt>
31303140 <dd class="defbody">
3131 Generate a Prolog abort (<a id="idx:abort0:1877"></a><a class="pred" href="toplevel.html#abort/0">abort/0</a>).
3141 Generate a Prolog abort (<a id="idx:abort0:1880"></a><a class="pred" href="toplevel.html#abort/0">abort/0</a>).
31323142 This call does not return. Requires no arguments.</dd>
31333143 <dt><strong>PL_ACTION_BREAK</strong></dt>
31343144 <dd class="defbody">
3135 Create a standard Prolog break environment (<a id="idx:break0:1878"></a><a class="pred" href="toplevel.html#break/0">break/0</a>).
3145 Create a standard Prolog break environment (<a id="idx:break0:1881"></a><a class="pred" href="toplevel.html#break/0">break/0</a>).
31363146 Returns after the user types the end-of-file character. Requires no
31373147 arguments.</dd>
31383148 <dt><strong>PL_ACTION_GUIAPP</strong></dt>
31553165 <dt><strong>PL_ACTION_ATTACH_CONSOLE</strong></dt>
31563166 <dd class="defbody">
31573167 Attach a console to a thread if it does not have one. See
3158 <a id="idx:attachconsole0:1879"></a><a class="pred" href="thutil.html#attach_console/0">attach_console/0</a>.</dd>
3168 <a id="idx:attachconsole0:1882"></a><a class="pred" href="thutil.html#attach_console/0">attach_console/0</a>.</dd>
31593169 <dt><strong>PL_GMP_SET_ALLOC_FUNCTIONS</strong></dt>
31603170 <dd class="defbody">
31613171 Takes an integer argument. If <code>TRUE</code>, the GMP allocations are
31793189 predicate, program counter and clause-number. For example, the dump
31803190 below indicates the frame is executing the 2nd clause of
31813191 <code>$autoload:load_library_index_p/0</code> at program pointer 25.
3182 This can be interpreted by dumping the virtual machine code using <a id="idx:vmlist1:1880"></a><span class="pred-ext">vm_list/1</span>.
3192 This can be interpreted by dumping the virtual machine code using <a id="idx:vmlist1:1883"></a><span class="pred-ext">vm_list/1</span>.
31833193
31843194 <pre class="code">
31853195 [34] $autoload:load_library_index_p/0 [PC=19 in clause 2]
32073217 <dd class="defbody">
32083218 Obtain status information on the Prolog system. The actual argument type
32093219 depends on the information required. <var>int</var> describes what
3210 information is wanted.<sup class="fn">154<span class="fn-text">Returning
3220 information is wanted.<sup class="fn">157<span class="fn-text">Returning
32113221 pointers and integers as a long is bad style. The signature of this
32123222 function should be changed.</span></sup> The options are given in <a class="tab" href="foreigninclude.html#tab:query">table
32133223 9</a>.
32793289 This string must be exactly as long as the number of arguments of the
32803290 predicate and filled with characters from the set <code>0-9:^-+?</code>.
32813291 See
3282 <a id="idx:metapredicate1:1881"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>
3292 <a id="idx:metapredicate1:1884"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>
32833293 for details. <code>PL_FA_TRANSPARENT</code> is implied if at least one
32843294 meta-argument is provided (<code>0-9:^</code>). Note that meta-arguments
32853295 are <em>not always</em> passed as &lt;<var>module</var>&gt;:&lt;<var>term</var>&gt;.
32863296 Always use <a class="func" href="foreigninclude.html#PL_strip_module()">PL_strip_module()</a>
3287 to extract the module and plain term from a meta-argument.<sup class="fn">155<span class="fn-text">It
3297 to extract the module and plain term from a meta-argument.<sup class="fn">158<span class="fn-text">It
32883298 is encouraged to pass an additional <code>NULL</code> pointer for
32893299 non-meta-predicates.</span></sup>
32903300
34123422 </dd>
34133423 <dt class="pubdef"><a id="PL_abort_hook()"><var>void</var> <strong>PL_abort_hook</strong>(<var>PL_abort_hook_t</var>)</a></dt>
34143424 <dd class="defbody">
3415 Install a hook when <a id="idx:abort0:1882"></a><a class="pred" href="toplevel.html#abort/0">abort/0</a>
3416 is executed. SWI-Prolog <a id="idx:abort0:1883"></a><a class="pred" href="toplevel.html#abort/0">abort/0</a>
3425 Install a hook when <a id="idx:abort0:1885"></a><a class="pred" href="toplevel.html#abort/0">abort/0</a>
3426 is executed. SWI-Prolog <a id="idx:abort0:1886"></a><a class="pred" href="toplevel.html#abort/0">abort/0</a>
34173427 is implemented using C setjmp()/longjmp() construct. The hooks are
34183428 executed in the reverse order of their registration after the longjmp()
34193429 took place and before the Prolog top level is reinvoked. The type
34373447 (0 if this cannot be determined) and the <var>closure</var> argument
34383448 passed to the <a class="func" href="foreigninclude.html#PL_on_halt()">PL_on_halt()</a>
34393449 call. Handlers <em>must</em> return 0. Other return values are reserved
3440 for future use. See also <a id="idx:athalt1:1884"></a><a class="pred" href="consulting.html#at_halt/1">at_halt/1</a>.<sup class="fn">bug<span class="fn-text">Although
3450 for future use. See also <a id="idx:athalt1:1887"></a><a class="pred" href="consulting.html#at_halt/1">at_halt/1</a>.<sup class="fn">bug<span class="fn-text">Although
34413451 both <a class="func" href="foreigninclude.html#PL_on_halt()">PL_on_halt()</a>
3442 and <a id="idx:athalt1:1885"></a><a class="pred" href="consulting.html#at_halt/1">at_halt/1</a>
3443 are called in FIFO order, <em>all</em> <a id="idx:athalt1:1886"></a><a class="pred" href="consulting.html#at_halt/1">at_halt/1</a>
3452 and <a id="idx:athalt1:1888"></a><a class="pred" href="consulting.html#at_halt/1">at_halt/1</a>
3453 are called in FIFO order, <em>all</em> <a id="idx:athalt1:1889"></a><a class="pred" href="consulting.html#at_halt/1">at_halt/1</a>
34443454 handlers are called before <em>all</em> <a class="func" href="foreigninclude.html#PL_on_halt()">PL_on_halt()</a>
34453455 handlers.</span></sup> These handlers are called <em>before</em> system
34463456 cleanup and can therefore access all normal Prolog resources. See also <a class="func" href="foreigninclude.html#PL_exit_hook()">PL_exit_hook()</a>.</dd>
34553465 new</var>)</a></dt>
34563466 <dd class="defbody">
34573467 Register a hook with the atom-garbage collector (see
3458 <a id="idx:garbagecollectatoms0:1887"></a><a class="pred" href="memory.html#garbage_collect_atoms/0">garbage_collect_atoms/0</a>)
3468 <a id="idx:garbagecollectatoms0:1890"></a><a class="pred" href="memory.html#garbage_collect_atoms/0">garbage_collect_atoms/0</a>)
34593469 that is called on any atom that is reclaimed. The old hook is returned.
34603470 If no hook is currently defined, <code>NULL</code> is returned. The
34613471 argument of the called hook is the atom that is to be garbage collected.
35263536 <a class="func" href="foreigninclude.html#PL_get_string_chars()">PL_get_string_chars()</a>.
35273537 It is good practice to wrap the string in a compound term with arity 1,
35283538 so Prolog can identify the type. The hook
3529 <a id="idx:portray1:1888"></a><a class="pred" href="termrw.html#portray/1">portray/1</a>
3539 <a id="idx:portray1:1891"></a><a class="pred" href="termrw.html#portray/1">portray/1</a>
35303540 rules may be used to streamline printing such terms during development.
35313541
35323542 <p>
37443754 argc, char **argv</var>)</a></dt>
37453755 <dd class="defbody">
37463756 Initialises the SWI-Prolog heap and stacks, restores the Prolog state,
3747 loads the system and personal initialisation files, runs the <a id="idx:initialization1:1889"></a><a class="pred" href="consulting.html#initialization/1">initialization/1</a>
3757 loads the system and personal initialisation files, runs the <a id="idx:initialization1:1892"></a><a class="pred" href="consulting.html#initialization/1">initialization/1</a>
37483758 hooks and finally runs the
37493759 <strong>-g</strong> <var>goal</var> hook.
37503760
37603770 <ul class="latex">
37613771 <li>See whether a Prolog saved state is appended to the file. If this is
37623772 the case, this state will be loaded instead of the default <code>boot.prc</code>
3763 file from the SWI-Prolog home directory. See also <a id="idx:qsaveprogram12:1890"></a><span class="pred-ext">qsave_program/[1,2]</span>
3773 file from the SWI-Prolog home directory. See also <a id="idx:qsaveprogram12:1893"></a><span class="pred-ext">qsave_program/[1,2]</span>
37643774 and <a class="sec" href="plld.html">section 10.5</a>.
37653775 <li>Find the Prolog home directory. This process is described in detail
37663776 in <a class="sec" href="findhome.html">section 10.6</a>.
38223832 <dt class="pubdef"><a id="PL_toplevel()"><var>int</var> <strong>PL_toplevel</strong>(<var></var>)</a></dt>
38233833 <dd class="defbody">
38243834 Runs the goal of the <strong>-t</strong> <var>toplevel</var> switch
3825 (default <a id="idx:prolog0:1891"></a><a class="pred" href="toplevel.html#prolog/0">prolog/0</a>)
3835 (default <a id="idx:prolog0:1894"></a><a class="pred" href="toplevel.html#prolog/0">prolog/0</a>)
38263836 and returns 1 if successful, 0 otherwise.</dd>
38273837 <dt class="pubdef"><a id="PL_cleanup()"><var>int</var> <strong>PL_cleanup</strong>(<var>int
38283838 status</var>)</a></dt>
38303840 This function performs the reverse of <a class="func" href="foreigninclude.html#PL_initialise()">PL_initialise()</a>.
38313841 It runs the
38323842 <a class="func" href="foreigninclude.html#PL_on_halt()">PL_on_halt()</a>
3833 and <a id="idx:athalt1:1892"></a><a class="pred" href="consulting.html#at_halt/1">at_halt/1</a>
3843 and <a id="idx:athalt1:1895"></a><a class="pred" href="consulting.html#at_halt/1">at_halt/1</a>
38343844 handlers, closes all streams (except for the `standard I/O' streams
38353845 which are flushed only), deallocates all memory and restores all signal
38363846 handlers. The <var>status</var> argument is passed to the various
38393849 <p>The function returns <code>TRUE</code> if successful and <code>FALSE</code>
38403850 otherwise. Currently, <code>FALSE</code> is returned when an attempt is
38413851 made to call <a class="func" href="foreigninclude.html#PL_cleanup()">PL_cleanup()</a>
3842 recursively or if one of the exit handlers cancels the termination using <a id="idx:cancelhalt1:1893"></a><a class="pred" href="consulting.html#cancel_halt/1">cancel_halt/1</a>.
3852 recursively or if one of the exit handlers cancels the termination using <a id="idx:cancelhalt1:1896"></a><a class="pred" href="consulting.html#cancel_halt/1">cancel_halt/1</a>.
38433853 Exit handlers may only cancel termination if <var>status</var> is 0.
38443854
38453855 <p>In theory, this function allows deleting and restarting the Prolog
38533863 (again) a separate process, modules or threads.</dd>
38543864 <dt class="pubdef"><a id="PL_cleanup_fork()"><var>void</var> <strong>PL_cleanup_fork</strong>(<var></var>)</a></dt>
38553865 <dd class="defbody">
3856 Stop intervaltimer that may be running on behalf of <a id="idx:profile1:1894"></a><a class="pred" href="profile.html#profile/1">profile/1</a>.
3866 Stop intervaltimer that may be running on behalf of <a id="idx:profile1:1897"></a><a class="pred" href="profile.html#profile/1">profile/1</a>.
38573867 The call is intended to be used in combination with fork():
38583868
38593869 <pre class="code">
39063916 <dd>
39073917 has an empty signal handler. This signal is sent to a thread after
39083918 sending a thread-signal (see
3909 <a id="idx:threadsignal2:1895"></a><a class="pred" href="threadcom.html#thread_signal/2">thread_signal/2</a>).
3919 <a id="idx:threadsignal2:1898"></a><a class="pred" href="threadcom.html#thread_signal/2">thread_signal/2</a>).
39103920 It causes blocking system calls to return with <code>EINTR</code>, which
39113921 gives them the opportunity to react to thread-signals.</dd>
39123922 <dt><b>SIGINT</b></dt>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 10.2</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 10.2</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
244244 executable. Using <em>dynamic linking</em>, the extensions are linked to
245245 a shared library (<code>.so</code> file on most Unix systems) or dynamic
246246 link library (<code>.DLL</code> file on Microsoft platforms) and loaded
247 into the running Prolog process.<sup class="fn">147<span class="fn-text">The
247 into the running Prolog process.<sup class="fn">150<span class="fn-text">The
248248 system also contains code to load <code>.o</code> files directly for
249249 some operating systems, notably Unix systems using the BSD <code>a.out</code>
250250 executable format. As the number of Unix platforms supporting this
251251 quickly gets smaller and this interface is difficult to port and slow,
252252 it is no longer described in this manual. The best alternative would be
253 to use the <a id="idx:dld:1820">dld</a> package on machines that do not
253 to use the <a id="idx:dld:1823">dld</a> package on machines that do not
254254 have shared libraries.</span></sup>
255255
256256 <p><h3 id="sec:foreign-linking"><a id="sec:10.2.1"><span class="sec-nr">10.2.1</span> <span class="sec-title">What
262262 SWI-Prolog. Whether or not dynamic linking is supported can be deduced
263263 from the Prolog flag <a class="flag" href="flags.html#flag:open_shared_object">open_shared_object</a>
264264 (see
265 <a id="idx:currentprologflag2:1821"></a><a class="pred" href="flags.html#current_prolog_flag/2">current_prolog_flag/2</a>).
265 <a id="idx:currentprologflag2:1824"></a><a class="pred" href="flags.html#current_prolog_flag/2">current_prolog_flag/2</a>).
266266 If this Prolog flag yields <code>true</code>,
267 <a id="idx:opensharedobject2:1822"></a><a class="pred" href="foreignlink.html#open_shared_object/2">open_shared_object/2</a>
267 <a id="idx:opensharedobject2:1825"></a><a class="pred" href="foreignlink.html#open_shared_object/2">open_shared_object/2</a>
268268 and related predicates are defined. See
269269 <a class="sec" href="foreignlink.html">section 10.2.3</a> for a suitable
270270 high-level interface to these predicates.
283283
284284 <p>Loading shared objects (DLL files on Windows) provides sharing and
285285 protection and is generally the best choice. If a saved state is created
286 using <a id="idx:qsaveprogram12:1823"></a><span class="pred-ext">qsave_program/[1,2]</span>,
287 an <a id="idx:initialization1:1824"></a><a class="pred" href="consulting.html#initialization/1">initialization/1</a>
286 using <a id="idx:qsaveprogram12:1826"></a><span class="pred-ext">qsave_program/[1,2]</span>,
287 an <a id="idx:initialization1:1827"></a><a class="pred" href="consulting.html#initialization/1">initialization/1</a>
288288 directive may be used to load the appropriate library at startup.
289289
290290 <p>Note that the definition of the foreign predicates is the same,
442442 This file is attached to the current process, and
443443 <var>Handle</var> is unified with a handle to the library. Equivalent to
444444 <code>open_shared_object(File, Handle, [])</code>. See also
445 <a id="idx:opensharedobject3:1825"></a><a class="pred" href="foreignlink.html#open_shared_object/3">open_shared_object/3</a>
446 and <a id="idx:loadforeignlibrary1:1826"></a><a class="pred" href="foreignlink.html#load_foreign_library/1">load_foreign_library/1</a>.
445 <a id="idx:opensharedobject3:1828"></a><a class="pred" href="foreignlink.html#open_shared_object/3">open_shared_object/3</a>
446 and <a id="idx:loadforeignlibrary1:1829"></a><a class="pred" href="foreignlink.html#load_foreign_library/1">load_foreign_library/1</a>.
447447
448448 <p>On errors, an exception <code>shared_object(Action, Message)</code>
449449 is raised. <var>Message</var> is the return value from dlerror().</dd>
450450 <dt class="pubdef"><a id="open_shared_object/3"><strong>open_shared_object</strong>(<var>+File,
451451 -Handle, +Options</var>)</a></dt>
452452 <dd class="defbody">
453 As <a id="idx:opensharedobject2:1827"></a><a class="pred" href="foreignlink.html#open_shared_object/2">open_shared_object/2</a>,
453 As <a id="idx:opensharedobject2:1830"></a><a class="pred" href="foreignlink.html#open_shared_object/2">open_shared_object/2</a>,
454454 but allows for additional flags to be passed.
455455 <var>Options</var> is a list of atoms. <code>now</code> implies the
456456 symbols are resolved immediately rather than lazy (default). <code>global</code>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 10.8</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 10.8</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
288288
289289 <a id="sec:boehm-gc"></a>
290290
291 <p><a id="idx:BoehmGC:1899"></a>To accommodate future use of the Boehm
292 garbage collector<sup class="fn">156<span class="fn-text"><a class="url" href="http://www.hpl.hp.com/personal/Hans_Boehm/gc/">http://www.hpl.hp.com/personal/Hans_Boehm/gc/</a></span></sup>
291 <p><a id="idx:BoehmGC:1902"></a>To accommodate future use of the Boehm
292 garbage collector<sup class="fn">159<span class="fn-text"><a class="url" href="http://www.hpl.hp.com/personal/Hans_Boehm/gc/">http://www.hpl.hp.com/personal/Hans_Boehm/gc/</a></span></sup>
293293 for heap memory allocation, the interface provides the functions
294294 described below. Foreign extensions that wish to use the Boehm-GC
295295 facilities can use these wrappers. Please note that if SWI-Prolog is not
330330 frequently used stream interface has been responsible for binary
331331 incompatibilities.
332332
333 <p><a id="idx:PLVERSION:1900"></a>Source code that relies on new
333 <p><a id="idx:PLVERSION:1903"></a>Source code that relies on new
334334 features of the foreign interface can use the macro <code>PLVERSION</code>
335335 to find the version of
336336 <code>SWI-Prolog.h</code> and <a class="func" href="foreigninclude.html#PL_query()">PL_query()</a>
343343
344344 <a id="sec:foreign-debug-and-profile"></a>
345345
346 <p><a id="idx:valgrind:1901"></a><a id="idx:profilingforeigncode:1902"></a>This
346 <p><a id="idx:valgrind:1904"></a><a id="idx:profilingforeigncode:1905"></a>This
347347 section is only relevant for Unix users on platforms supported by
348348 <a class="url" href="http://valgrind.org/">valgrind</a>. Valgrind is an
349349 excellent binary instrumentation platform. Unlike many other
356356 variable <code>VALGRIND</code> to <code>yes</code>, SWI-Prolog will <em>not</em>
357357 release loaded shared objects using dlclose(). This trick is required to
358358 get source information on the loaded library. Without, valgrind claims
359 that the shared object has no debugging information.<sup class="fn">157<span class="fn-text">Tested
359 that the shared object has no debugging information.<sup class="fn">160<span class="fn-text">Tested
360360 using valgrind version 3.2.3 on x64.</span></sup> Here is the complete
361361 sequence using <b>bash</b> as login shell:
362362
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 10.1</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 10.1</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 9.6</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 9.6</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
239239
240240 <p>All foreign code linked to the multithreading version of SWI-Prolog
241241 should be thread-safe (<em>reentrant</em>) or guarded in Prolog using
242 <a id="idx:withmutex2:1810"></a><a class="pred" href="threadsync.html#with_mutex/2">with_mutex/2</a>
242 <a id="idx:withmutex2:1813"></a><a class="pred" href="threadsync.html#with_mutex/2">with_mutex/2</a>
243243 from simultaneous access from multiple Prolog threads. If you want to
244244 write mixed multithreaded C and Prolog applications you should first
245245 familiarise yourself with writing multithreaded applications in C (C++).
343343 <em>for all threads</em>. Globally installed handlers are executed after
344344 the thread-local handlers. If the handler is installed local for the
345345 current thread only (<var>global</var> == <code>FALSE</code>) it is
346 stored in the same FIFO queue as used by <a id="idx:threadatexit1:1811"></a><a class="pred" href="threadcreate.html#thread_at_exit/1">thread_at_exit/1</a>.
346 stored in the same FIFO queue as used by <a id="idx:threadatexit1:1814"></a><a class="pred" href="threadcreate.html#thread_at_exit/1">thread_at_exit/1</a>.
347347 </dd>
348348 </dl>
349349
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 10.3</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 10.3</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 10.7</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 10.7</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.31</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.31</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
238238 <a id="sec:format"></a>
239239
240240 <p>The current version of SWI-Prolog provides two formatted write
241 predicates. The `writef' family (<a id="idx:writef1:1261"></a><a class="pred" href="format.html#writef/1">writef/1</a>, <a id="idx:writef2:1262"></a><a class="pred" href="format.html#writef/2">writef/2</a>, <a id="idx:swritef3:1263"></a><a class="pred" href="format.html#swritef/3">swritef/3</a>),
241 predicates. The `writef' family (<a id="idx:writef1:1263"></a><a class="pred" href="format.html#writef/1">writef/1</a>, <a id="idx:writef2:1264"></a><a class="pred" href="format.html#writef/2">writef/2</a>, <a id="idx:swritef3:1265"></a><a class="pred" href="format.html#swritef/3">swritef/3</a>),
242242 is compatible with Edinburgh C-Prolog and should be considered
243 <em>deprecated</em>. The `format' family (<a id="idx:format1:1264"></a><a class="pred" href="format.html#format/1">format/1</a>, <a id="idx:format2:1265"></a><a class="pred" href="format.html#format/2">format/2</a>, <a id="idx:format3:1266"></a><a class="pred" href="format.html#format/3">format/3</a>),
243 <em>deprecated</em>. The `format' family (<a id="idx:format1:1266"></a><a class="pred" href="format.html#format/1">format/1</a>, <a id="idx:format2:1267"></a><a class="pred" href="format.html#format/2">format/2</a>, <a id="idx:format3:1268"></a><a class="pred" href="format.html#format/3">format/3</a>),
244244 was defined by Quintus Prolog and currently available in many Prolog
245245 systems, although the details vary.
246246
251251 <dl class="latex">
252252 <dt class="pubdef"><span class="pred-tag">[deprecated]</span><a id="writef/1"><strong>writef</strong>(<var>+Atom</var>)</a></dt>
253253 <dd class="defbody">
254 Equivalent to <code>writef(Atom, []).</code> See <a id="idx:writef2:1267"></a><a class="pred" href="format.html#writef/2">writef/2</a>
254 Equivalent to <code>writef(Atom, []).</code> See <a id="idx:writef2:1269"></a><a class="pred" href="format.html#writef/2">writef/2</a>
255255 for details.
256256 </dd>
257257 <dt class="pubdef"><span class="pred-tag">[deprecated]</span><a id="writef/2"><strong>writef</strong>(<var>+Format,
266266 <p>Escape sequences to generate a single special character:
267267
268268 <p><table class="latex frame-box center">
269 <tr><td><code>\n</code> </td><td>Output a newline character (see also <a id="idx:nl01:1268"></a><span class="pred-ext">nl/[0,1]</span>) </td></tr>
269 <tr><td><code>\n</code> </td><td>Output a newline character (see also <a id="idx:nl01:1270"></a><span class="pred-ext">nl/[0,1]</span>) </td></tr>
270270 <tr><td><code>\l</code> </td><td>Output a line separator (same as <code>\n</code>) </td></tr>
271271 <tr><td><code>\r</code> </td><td>Output a carriage return character
272272 (ASCII 13) </td></tr>
290290 is formatted according to the specification.
291291
292292 <p><table class="latex frame-box center">
293 <tr><td><code>%t</code> </td><td><a id="idx:print1:1269"></a><a class="pred" href="termrw.html#print/1">print/1</a>
293 <tr><td><code>%t</code> </td><td><a id="idx:print1:1271"></a><a class="pred" href="termrw.html#print/1">print/1</a>
294294 the next item (mnemonic: term) </td></tr>
295 <tr><td><code>%w</code> </td><td><a id="idx:write1:1270"></a><a class="pred" href="termrw.html#write/1">write/1</a>
295 <tr><td><code>%w</code> </td><td><a id="idx:write1:1272"></a><a class="pred" href="termrw.html#write/1">write/1</a>
296296 the next item </td></tr>
297 <tr><td><code>%q</code> </td><td><a id="idx:writeq1:1271"></a><a class="pred" href="termrw.html#writeq/1">writeq/1</a>
297 <tr><td><code>%q</code> </td><td><a id="idx:writeq1:1273"></a><a class="pred" href="termrw.html#writeq/1">writeq/1</a>
298298 the next item </td></tr>
299299 <tr><td><code>%d</code> </td><td>Write the term, ignoring operators. See
300300 also
301 <a id="idx:writeterm2:1272"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>.
302 Mnemonic: old Edinburgh <a id="idx:display1:1273"></a><span class="pred-ext">display/1</span> </td></tr>
303 <tr><td><code>%p</code> </td><td><a id="idx:print1:1274"></a><a class="pred" href="termrw.html#print/1">print/1</a>
301 <a id="idx:writeterm2:1274"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>.
302 Mnemonic: old Edinburgh <a id="idx:display1:1275"></a><span class="pred-ext">display/1</span> </td></tr>
303 <tr><td><code>%p</code> </td><td><a id="idx:print1:1276"></a><a class="pred" href="termrw.html#print/1">print/1</a>
304304 the next item (identical to <code>%t</code>) </td></tr>
305305 <tr><td><code>%n</code> </td><td>Put the next item as a character (i.e.,
306306 it is a character code) </td></tr>
308308 the second item (an integer) </td></tr>
309309 <tr><td><code>%s</code> </td><td>Write the next item as a String (so it
310310 must be a list of characters) </td></tr>
311 <tr><td><code>%f</code> </td><td>Perform a <a id="idx:ttyflush0:1275"></a><a class="pred" href="chario.html#ttyflush/0">ttyflush/0</a>
311 <tr><td><code>%f</code> </td><td>Perform a <a id="idx:ttyflush0:1277"></a><a class="pred" href="chario.html#ttyflush/0">ttyflush/0</a>
312312 (no items used) </td></tr>
313313 <tr><td><code>%Nc</code> </td><td>Write the next item Centered in <var>N</var>
314314 columns </td></tr>
323323 <dt class="pubdef"><span class="pred-tag">[deprecated]</span><a id="swritef/3"><strong>swritef</strong>(<var>-String,
324324 +Format, +Arguments</var>)</a></dt>
325325 <dd class="defbody">
326 Equivalent to <a id="idx:writef2:1276"></a><a class="pred" href="format.html#writef/2">writef/2</a>,
326 Equivalent to <a id="idx:writef2:1278"></a><a class="pred" href="format.html#writef/2">writef/2</a>,
327327 but ``writes'' the result on <var>String</var> instead of the current
328328 output stream. Example:
329329
345345
346346 <a id="sec:format-predicates"></a>
347347
348 <p>The format family of predicates is the most versatile and portable<sup class="fn">109<span class="fn-text">Unfortunately
348 <p>The format family of predicates is the most versatile and portable<sup class="fn">112<span class="fn-text">Unfortunately
349349 not covered by any standard.</span></sup> way to produce textual output.
350350
351351 <dl class="latex">
352352 <dt class="pubdef"><a id="format/1"><strong>format</strong>(<var>+Format</var>)</a></dt>
353353 <dd class="defbody">
354354 Defined as `<code>format(Format) :- format(Format, []).</code>'. See
355 <a id="idx:format2:1277"></a><a class="pred" href="format.html#format/2">format/2</a>
355 <a id="idx:format2:1279"></a><a class="pred" href="format.html#format/2">format/2</a>
356356 for details.</dd>
357357 <dt class="pubdef"><a id="format/2"><strong>format</strong>(<var>+Format,
358358 :Arguments</var>)</a></dt>
367367 <p>Special sequences start with the tilde (<code><code>~</code></code>),
368368 followed by an optional numeric argument, optionally followed by a colon
369369 modifier (:),
370 <sup class="fn">110<span class="fn-text">The colon modifiers is a
370 <sup class="fn">113<span class="fn-text">The colon modifiers is a
371371 SWI-Prolog extension, proposed by Richard O'Keefe.</span></sup> followed
372372 by a character describing the action to be undertaken. A numeric
373373 argument is either a sequence of digits, representing a positive decimal
481481
482482 <p>
483483 <li><code>k</code><br>
484 Give the next argument to <a id="idx:writecanonical1:1278"></a><a class="pred" href="termrw.html#write_canonical/1">write_canonical/1</a>.
484 Give the next argument to <a id="idx:writecanonical1:1280"></a><a class="pred" href="termrw.html#write_canonical/1">write_canonical/1</a>.
485485 <li><code>n</code><br>
486486 Output a newline character.
487487 <li><code>N</code><br>
488488 Only output a newline if the last character output on this stream was
489489 not a newline. Not properly implemented yet.
490490 <li><code>p</code><br>
491 Give the next argument to <a id="idx:print1:1279"></a><a class="pred" href="termrw.html#print/1">print/1</a>.
491 Give the next argument to <a id="idx:print1:1281"></a><a class="pred" href="termrw.html#print/1">print/1</a>.
492492 <li><code>q</code><br>
493 Give the next argument to <a id="idx:writeq1:1280"></a><a class="pred" href="termrw.html#writeq/1">writeq/1</a>.
493 Give the next argument to <a id="idx:writeq1:1282"></a><a class="pred" href="termrw.html#writeq/1">writeq/1</a>.
494494
495495 <p>
496496 <li><code>r</code><br>
504504 <li><code>R</code><br>
505505 Same as <b>r</b>, but uses uppercase letters for digits above 9.
506506 <li><code>s</code><br>
507 Output text from a list of character codes or a string (see <a id="idx:string1:1281"></a><a class="pred" href="typetest.html#string/1">string/1</a>
507 Output text from a list of character codes or a string (see <a id="idx:string1:1283"></a><a class="pred" href="typetest.html#string/1">string/1</a>
508508 and
509509 <a class="sec" href="strings.html">section 5.2</a>) from the next
510 argument.<sup class="fn">111<span class="fn-text">The <b>s</b> modifier
510 argument.<sup class="fn">114<span class="fn-text">The <b>s</b> modifier
511511 also accepts an atom for compatibility. This is deprecated due to the
512512 ambiguity of <code>[]</code>.</span></sup>
513513 <li><code>@</code><br>
514514 Interpret the next argument as a goal and execute it. Output written to
515515 the <code>current_output</code> stream is inserted at this place. Goal
516 is called in the module calling <a id="idx:format3:1282"></a><a class="pred" href="format.html#format/3">format/3</a>.
516 is called in the module calling <a id="idx:format3:1284"></a><a class="pred" href="format.html#format/3">format/3</a>.
517517 This option is not present in the original definition by Quintus, but
518518 supported by some other Prolog systems.
519519 <li><code>t</code><br>
546546
547547 <p>
548548 <li><code>w</code><br>
549 Give the next argument to <a id="idx:write1:1283"></a><a class="pred" href="termrw.html#write/1">write/1</a>.
549 Give the next argument to <a id="idx:write1:1285"></a><a class="pred" href="termrw.html#write/1">write/1</a>.
550550 <li><code>W</code><br>
551 Give the next two arguments to <a id="idx:writeterm2:1284"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>.
551 Give the next two arguments to <a id="idx:writeterm2:1286"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>.
552552 For example,
553553 <code>format('~W', [Term, [numbervars(true)]])</code>. This option is
554554 SWI-Prolog specific.
577577 <dt class="pubdef"><a id="format/3"><strong>format</strong>(<var>+Output,
578578 +Format, :Arguments</var>)</a></dt>
579579 <dd class="defbody">
580 As <a id="idx:format2:1285"></a><a class="pred" href="format.html#format/2">format/2</a>,
580 As <a id="idx:format2:1287"></a><a class="pred" href="format.html#format/2">format/2</a>,
581581 but write the output on the given <var>Output</var>. The de-facto
582582 standard only allows <var>Output</var> to be a stream. The SWI-Prolog
583583 implementation allows all valid arguments for
584 <a id="idx:withoutputto2:1286"></a><a class="pred" href="IO.html#with_output_to/2">with_output_to/2</a>.<sup class="fn">112<span class="fn-text">Earlier
584 <a id="idx:withoutputto2:1288"></a><a class="pred" href="IO.html#with_output_to/2">with_output_to/2</a>.<sup class="fn">115<span class="fn-text">Earlier
585585 versions defined sformat/3 . These predicates have been moved to the
586586 library <code>library(backcomp)</code>.</span></sup> For example:
587587
603603 +Head</var>)</a></dt>
604604 <dd class="defbody">
605605 If a sequence <code>~c</code> (tilde, followed by some character) is
606 found, the <a id="idx:format3:1287"></a><a class="pred" href="format.html#format/3">format/3</a>
606 found, the <a id="idx:format3:1289"></a><a class="pred" href="format.html#format/3">format/3</a>
607607 and friends first check whether the user has defined a predicate to
608608 handle the format. If not, the built-in formatting rules described above
609609 are used. <var>Char</var> is either a character code or a one-character
614614 if no argument is specified. The remaining arguments are filled from the
615615 argument list. The example below defines <code>~T</code> to print a
616616 timestamp in ISO8601 format (see
617 <a id="idx:formattime3:1288"></a><a class="pred" href="system.html#format_time/3">format_time/3</a>).
617 <a id="idx:formattime3:1290"></a><a class="pred" href="system.html#format_time/3">format_time/3</a>).
618618 The subsequent block illustrates a possible call.
619619
620620 <pre class="code">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section F.3</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section F.3</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
315315 integer below argument</td></tr>
316316 <tr><td><a class="function" href="arith.html#f-gcd/2">gcd/2</a></td><td>Greatest
317317 common divisor</td></tr>
318 <tr><td><a class="function" href="arith.html#f-getbit/2">getbit/2</a></td><td>Get
319 bit at index from large integer</td></tr>
318320 <tr><td><a class="function" href="arith.html#f-integer/1">integer/1</a></td><td>Round
319321 to nearest integer</td></tr>
320322 <tr><td><a class="function" href="arith.html#f-lgamma/1">lgamma/1</a></td><td>Log
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 2.14</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 2.14</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 2.5</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 2.5</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.12</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.12</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
240240 <dl class="latex">
241241 <dt><a id="gloss:anonymou"><strong>anonymous [variable]</strong></a></dt>
242242 <dd class="defbody">
243 <a id="idx:anonymousvariable:2070"></a><a id="idx:variableanonymous:2071"></a>The
243 <a id="idx:anonymousvariable:2073"></a><a id="idx:variableanonymous:2074"></a>The
244244 variable <code>_</code> is called the <a class="gloss" href="glossary.html#gloss:anonymou">anonymous</a>
245245 variable. Multiple occurrences of <code>_</code> in a single <a class="gloss" href="glossary.html#gloss:term">term</a>
246246 are not <a class="gloss" href="glossary.html#gloss:shared">shared</a>.</dd>
252252 <code>myterm(A1, a2)</code>.</dd>
253253 <dt><a id="gloss:arity"><strong>arity</strong></a></dt>
254254 <dd class="defbody">
255 <a id="idx:arity:2072"></a>Argument count (= number of arguments) of a <a class="gloss" href="glossary.html#gloss:compound">compound</a> <a class="gloss" href="glossary.html#gloss:term">term</a>.</dd>
255 <a id="idx:arity:2075"></a>Argument count (= number of arguments) of a <a class="gloss" href="glossary.html#gloss:compound">compound</a> <a class="gloss" href="glossary.html#gloss:term">term</a>.</dd>
256256 <dt><a id="gloss:assert"><strong>assert</strong></a></dt>
257257 <dd class="defbody">
258 <a id="idx:assert:2073"></a>Add a <a class="gloss" href="glossary.html#gloss:clause">clause</a>
258 <a id="idx:assert:2076"></a>Add a <a class="gloss" href="glossary.html#gloss:clause">clause</a>
259259 to a <a class="gloss" href="glossary.html#gloss:predicate">predicate</a>.
260260 Clauses can be added at either end of the clause-list of a <a class="gloss" href="glossary.html#gloss:predicate">predicate</a>.
261 See <a id="idx:asserta1:2074"></a><a class="pred" href="db.html#asserta/1">asserta/1</a>
262 and <a id="idx:assertz1:2075"></a><a class="pred" href="db.html#assertz/1">assertz/1</a>.</dd>
261 See <a id="idx:asserta1:2077"></a><a class="pred" href="db.html#asserta/1">asserta/1</a>
262 and <a id="idx:assertz1:2078"></a><a class="pred" href="db.html#assertz/1">assertz/1</a>.</dd>
263263 <dt><a id="gloss:atom"><strong>atom</strong></a></dt>
264264 <dd class="defbody">
265 <a id="idx:atom:2076"></a>Textual constant. Used as name for <a class="gloss" href="glossary.html#gloss:compound">compound</a>
265 <a id="idx:atom:2079"></a>Textual constant. Used as name for <a class="gloss" href="glossary.html#gloss:compound">compound</a>
266266 terms, to represent constants or text.</dd>
267267 <dt><a id="gloss:backtracking"><strong>backtracking</strong></a></dt>
268268 <dd class="defbody">
269 <a id="idx:backtracking:2077"></a>Search process used by Prolog. If a
269 <a id="idx:backtracking:2080"></a>Search process used by Prolog. If a
270270 predicate offers multiple
271271 <a class="gloss" href="glossary.html#gloss:clause">clauses</a> to solve
272272 a <a class="gloss" href="glossary.html#gloss:goal">goal</a>, they are
279279 and try the next one.</dd>
280280 <dt><a id="gloss:binding"><strong>binding [of a variable]</strong></a></dt>
281281 <dd class="defbody">
282 <a id="idx:binding:2078"></a>Current value of the <a class="gloss" href="glossary.html#gloss:variable">variable</a>.
282 <a id="idx:binding:2081"></a>Current value of the <a class="gloss" href="glossary.html#gloss:variable">variable</a>.
283283 See also <a class="gloss" href="glossary.html#gloss:backtracking">backtracking</a>
284284 and
285285 <a class="gloss" href="glossary.html#gloss:query">query</a>.</dd>
286286 <dt><a id="gloss:built-in"><strong>built-in [predicate]</strong></a></dt>
287287 <dd class="defbody">
288 <a id="idx:builtinpredicate:2079"></a>Predicate that is part of the
288 <a id="idx:builtinpredicate:2082"></a>Predicate that is part of the
289289 Prolog system. Built-in predicates cannot be redefined by the user,
290290 unless this is overruled using
291 <a id="idx:redefinesystempredicate1:2080"></a><a class="pred" href="db.html#redefine_system_predicate/1">redefine_system_predicate/1</a>.</dd>
291 <a id="idx:redefinesystempredicate1:2083"></a><a class="pred" href="db.html#redefine_system_predicate/1">redefine_system_predicate/1</a>.</dd>
292292 <dt><a id="gloss:body"><strong>body</strong></a></dt>
293293 <dd class="defbody">
294 <a id="idx:body:2081"></a>Part of a <a class="gloss" href="glossary.html#gloss:clause">clause</a>
294 <a id="idx:body:2084"></a>Part of a <a class="gloss" href="glossary.html#gloss:clause">clause</a>
295295 behind the <a class="gloss" href="glossary.html#gloss:neck">neck</a>
296296 operator (<code><code>:-</code></code>).</dd>
297297 <dt><a id="gloss:choice-point"><strong>choice point</strong></a></dt>
298298 <dd class="defbody">
299 <a id="idx:choicepoint:2082"></a>A <a class="gloss" href="glossary.html#gloss:choice-point">choice point</a>
299 <a id="idx:choicepoint:2085"></a>A <a class="gloss" href="glossary.html#gloss:choice-point">choice point</a>
300300 represents a choice in the search for a <a class="gloss" href="glossary.html#gloss:solution">solution</a>.
301301 Choice points are created if multiple clauses match a <a class="gloss" href="glossary.html#gloss:query">query</a>
302302 or using disjunction (<a class="pred" href="control.html#;/2">;/2</a>).
307307 <a class="pred" href="control.html#;/2">;/2</a>).</dd>
308308 <dt><a id="gloss:clause"><strong>clause</strong></a></dt>
309309 <dd class="defbody">
310 <a id="idx:clause:2083"></a>`Sentence' of a Prolog program. A <a class="gloss" href="glossary.html#gloss:clause">clause</a>
310 <a id="idx:clause:2086"></a>`Sentence' of a Prolog program. A <a class="gloss" href="glossary.html#gloss:clause">clause</a>
311311 consists of a <a class="gloss" href="glossary.html#gloss:head">head</a>
312312 and
313313 <a class="gloss" href="glossary.html#gloss:body">body</a> separated by
329329 SWI-Prolog always compiles your program before executing it.</dd>
330330 <dt><a id="gloss:compound"><strong>compound [term]</strong></a></dt>
331331 <dd class="defbody">
332 <a id="idx:compound:2084"></a>Also called <a class="gloss" href="glossary.html#gloss:structure">structure</a>.
332 <a id="idx:compound:2087"></a>Also called <a class="gloss" href="glossary.html#gloss:structure">structure</a>.
333333 It consists of a name followed by <var>N</var>
334334 <a class="gloss" href="glossary.html#gloss:argument">arguments</a>, each
335335 of which are <a class="gloss" href="glossary.html#gloss:term">terms</a>. <var>N</var>
337337 <a class="gloss" href="glossary.html#gloss:arity">arity</a> of the term.</dd>
338338 <dt><a id="gloss:context-module"><strong>context module</strong></a></dt>
339339 <dd class="defbody">
340 <a id="idx:contextmodule:2085"></a><a id="idx:modulecontex:2086"></a>If
340 <a id="idx:contextmodule:2088"></a><a id="idx:modulecontex:2089"></a>If
341341 a <a class="gloss" href="glossary.html#gloss:term">term</a> is referring
342342 to a <a class="gloss" href="glossary.html#gloss:predicate">predicate</a>
343343 in a <a class="gloss" href="glossary.html#gloss:module">module</a>, the
348348 is <a class="gloss" href="glossary.html#gloss:module-transparent">module transparent</a>,
349349 in which case the <a class="gloss" href="glossary.html#gloss:context-module">context module</a>
350350 is inherited from the parent
351 <a class="gloss" href="glossary.html#gloss:goal">goal</a>. See also <a id="idx:moduletransparent1:2087"></a><a class="pred" href="ctxmodule.html#module_transparent/1">module_transparent/1</a>
351 <a class="gloss" href="glossary.html#gloss:goal">goal</a>. See also <a id="idx:moduletransparent1:2090"></a><a class="pred" href="ctxmodule.html#module_transparent/1">module_transparent/1</a>
352352 and <a class="gloss" href="glossary.html#gloss:meta-predicate">meta-predicate</a>.</dd>
353 <dt><a id="gloss:det"><strong>det</strong></a></dt>
354 <dd class="defbody">
355 <a id="idx:det:2088"></a>Short for <a class="gloss" href="glossary.html#gloss:deterministic">deterministic</a>.</dd>
353 <dt><a id="gloss:det"><strong>det [determinism]</strong></a></dt>
354 <dd class="defbody">
355 <a id="idx:det:2091"></a>Short for <a class="gloss" href="glossary.html#gloss:deterministic">deterministic</a>.</dd>
356 <dt><a id="gloss:determinism"><strong>determinism</strong></a></dt>
357 <dd class="defbody">
358 <a id="idx:determinism:2092"></a>How many solutions a <a class="gloss" href="glossary.html#gloss:goal">goal</a>
359 can provide. Values are `nondet' (zero to infinite), `multi' (one to
360 infinite), `det' (exactly one) and `semidet' (zero or one).</dd>
356361 <dt><a id="gloss:deterministic"><strong>deterministic</strong></a></dt>
357362 <dd class="defbody">
358 <a id="idx:deterministic:2089"></a>A <a class="gloss" href="glossary.html#gloss:predicate">predicate</a>
363 <a id="idx:deterministic:2093"></a>A <a class="gloss" href="glossary.html#gloss:predicate">predicate</a>
359364 is <a class="gloss" href="glossary.html#gloss:deterministic">deterministic</a>
360365 if it succeeds exactly one time without leaving a <a class="gloss" href="glossary.html#gloss:choice-point">choice point</a>.</dd>
361366 <dt><a id="gloss:dynamic"><strong>dynamic [predicate]</strong></a></dt>
362367 <dd class="defbody">
363 <a id="idx:dynamicpredicate:2090"></a><a id="idx:predicatedynamic:2091"></a>A <a class="gloss" href="glossary.html#gloss:dynamic">dynamic</a>
368 <a id="idx:dynamicpredicate:2094"></a><a id="idx:predicatedynamic:2095"></a>A <a class="gloss" href="glossary.html#gloss:dynamic">dynamic</a>
364369 predicate is a predicate to which <a class="gloss" href="glossary.html#gloss:clause">clauses</a>
365370 may be
366371 <a class="gloss" href="glossary.html#gloss:assert">assert</a>ed and from
369374 while the program is running. See also <a class="gloss" href="glossary.html#gloss:update-view">update view</a>.</dd>
370375 <dt><a id="gloss:exported"><strong>exported [predicate]</strong></a></dt>
371376 <dd class="defbody">
372 <a id="idx:exportedpredicate:2092"></a><a id="idx:predicateexported:2093"></a>A <a class="gloss" href="glossary.html#gloss:predicate">predicate</a>
377 <a id="idx:exportedpredicate:2096"></a><a id="idx:predicateexported:2097"></a>A <a class="gloss" href="glossary.html#gloss:predicate">predicate</a>
373378 is said to be <a class="gloss" href="glossary.html#gloss:exported">exported</a>
374379 from a <a class="gloss" href="glossary.html#gloss:module">module</a> if
375380 it appears in the <a class="gloss" href="glossary.html#gloss:public-list">public list</a>.
376381 This implies that the predicate can be <a class="gloss" href="glossary.html#gloss:imported">imported</a>
377 into another module to make it visible there. See also <a id="idx:usemodule12:2094"></a><span class="pred-ext">use_module/[1,2]</span>.</dd>
382 into another module to make it visible there. See also <a id="idx:usemodule12:2098"></a><span class="pred-ext">use_module/[1,2]</span>.</dd>
378383 <dt><a id="gloss:fact"><strong>fact</strong></a></dt>
379384 <dd class="defbody">
380 <a id="idx:fact:2095"></a><a class="gloss" href="glossary.html#gloss:clause">Clause</a>
385 <a id="idx:fact:2099"></a><a class="gloss" href="glossary.html#gloss:clause">Clause</a>
381386 without a <a class="gloss" href="glossary.html#gloss:body">body</a>.
382387 This is called a fact because, interpreted as logic, there is no
383388 condition to be satisfied. The example below states <code>john</code> is
402407 only cooperate directly with the C and C++ computer languages.</dd>
403408 <dt><a id="gloss:functor"><strong>functor</strong></a></dt>
404409 <dd class="defbody">
405 <a id="idx:functor:2096"></a>Combination of name and <a class="gloss" href="glossary.html#gloss:arity">arity</a>
410 <a id="idx:functor:2100"></a>Combination of name and <a class="gloss" href="glossary.html#gloss:arity">arity</a>
406411 of a <a class="gloss" href="glossary.html#gloss:compound">compound</a>
407412 term. The term
408413 <code>foo(a, b, c)</code> is said to be a term belonging to the functor
410415 <code>foo</code>.</dd>
411416 <dt><a id="gloss:goal"><strong>goal</strong></a></dt>
412417 <dd class="defbody">
413 <a id="idx:goal:2097"></a><a id="idx:query:2098"></a>Question stated to
418 <a id="idx:goal:2101"></a><a id="idx:query:2102"></a>Question stated to
414419 the Prolog engine. A <a class="gloss" href="glossary.html#gloss:goal">goal</a>
415420 is either an <a class="gloss" href="glossary.html#gloss:atom">atom</a>
416421 or a <a class="gloss" href="glossary.html#gloss:compound">compound</a>
423428 Prolog fails to prove it.</dd>
424429 <dt><a id="gloss:hashing"><strong>hashing</strong></a></dt>
425430 <dd class="defbody">
426 <a id="idx:hashing:2099"></a><a class="gloss" href="glossary.html#gloss:indexing">Indexing</a>
431 <a id="idx:hashing:2103"></a><a class="gloss" href="glossary.html#gloss:indexing">Indexing</a>
427432 technique used for quick lookup.</dd>
428433 <dt><a id="gloss:head"><strong>head</strong></a></dt>
429434 <dd class="defbody">
430 <a id="idx:head:2100"></a>Part of a <a class="gloss" href="glossary.html#gloss:clause">clause</a>
435 <a id="idx:head:2104"></a>Part of a <a class="gloss" href="glossary.html#gloss:clause">clause</a>
431436 before the <a class="gloss" href="glossary.html#gloss:neck">neck</a>
432437 operator (<code><code>:-</code></code>). This is an <a class="gloss" href="glossary.html#gloss:atom">atom</a>
433438 or <a class="gloss" href="glossary.html#gloss:compound">compound</a>
434439 term.</dd>
435440 <dt><a id="gloss:imported"><strong>imported [predicate]</strong></a></dt>
436441 <dd class="defbody">
437 <a id="idx:importedpredicate:2101"></a><a id="idx:predicateimported:2102"></a>A <a class="gloss" href="glossary.html#gloss:predicate">predicate</a>
442 <a id="idx:importedpredicate:2105"></a><a id="idx:predicateimported:2106"></a>A <a class="gloss" href="glossary.html#gloss:predicate">predicate</a>
438443 is said to be <a class="gloss" href="glossary.html#gloss:imported">imported</a>
439444 into a <a class="gloss" href="glossary.html#gloss:module">module</a> if
440445 it is defined in another <a class="gloss" href="glossary.html#gloss:module">module</a>
442447 See also <a class="sec" href="modules.html">chapter 6</a>.</dd>
443448 <dt><a id="gloss:indexing"><strong>indexing</strong></a></dt>
444449 <dd class="defbody">
445 <a id="idx:indexing:2103"></a>Indexing is a technique used to quickly
450 <a id="idx:indexing:2107"></a>Indexing is a technique used to quickly
446451 select candidate <a class="gloss" href="glossary.html#gloss:clause">clauses</a>
447452 of a <a class="gloss" href="glossary.html#gloss:predicate">predicate</a>
448453 for a specific <a class="gloss" href="glossary.html#gloss:goal">goal</a>.
459464 2.17</a>.</dd>
460465 <dt><a id="gloss:integer"><strong>integer</strong></a></dt>
461466 <dd class="defbody">
462 <a id="idx:integer:2104"></a>Whole number. On all implementations of
467 <a id="idx:integer:2108"></a>Whole number. On all implementations of
463468 SWI-Prolog integers are at least 64-bit signed values. When linked to
464 the GNU GMP library, integer arithmetic is unbounded. See also <a id="idx:currentprologflag2:2105"></a><a class="pred" href="flags.html#current_prolog_flag/2">current_prolog_flag/2</a>,
469 the GNU GMP library, integer arithmetic is unbounded. See also <a id="idx:currentprologflag2:2109"></a><a class="pred" href="flags.html#current_prolog_flag/2">current_prolog_flag/2</a>,
465470 flags <a class="flag" href="flags.html#flag:bounded">bounded</a>, <a class="flag" href="flags.html#flag:max_integer">max_integer</a>
466471 and <a class="flag" href="flags.html#flag:min_integer">min_integer</a>.</dd>
467472 <dt><a id="gloss:interpreted"><strong>interpreted</strong></a></dt>
468473 <dd class="defbody">
469 <a id="idx:interpreted:2106"></a>As opposed to <a class="gloss" href="glossary.html#gloss:compile">compiled</a>,
474 <a id="idx:interpreted:2110"></a>As opposed to <a class="gloss" href="glossary.html#gloss:compile">compiled</a>,
470475 interpreted means the Prolog system attempts to prove a <a class="gloss" href="glossary.html#gloss:goal">goal</a>
471476 by directly reading the <a class="gloss" href="glossary.html#gloss:clause">clauses</a>
472477 rather than executing instructions from an (abstract) instruction set
473478 that is not or only indirectly related to Prolog.</dd>
479 <dt><a id="gloss:instantiation"><strong>instantiation [of an argument]</strong></a></dt>
480 <dd class="defbody">
481 <a id="idx:instantiation:2111"></a>To what extend a term is bound to a
482 value. Typical levels are `unbound' (a <a class="gloss" href="glossary.html#gloss:variable">variable</a>),
483 `ground' (term without variables) or `partially bound' (term with
484 embedded variables).</dd>
474485 <dt><a id="gloss:meta-predicate"><strong>meta-predicate</strong></a></dt>
475486 <dd class="defbody">
476 <a id="idx:metapredicate:2107"></a>A <a class="gloss" href="glossary.html#gloss:predicate">predicate</a>
487 <a id="idx:metapredicate:2112"></a>A <a class="gloss" href="glossary.html#gloss:predicate">predicate</a>
477488 that reasons about other <a class="gloss" href="glossary.html#gloss:predicate">predicates</a>,
478489 either by calling them, (re)defining them or querying <a class="gloss" href="glossary.html#gloss:property">properties</a>.</dd>
490 <dt><a id="gloss:mode"><strong>mode [declaration]</strong></a></dt>
491 <dd class="defbody">
492 <a id="idx:mode:2113"></a>Declaration of an argument <a class="gloss" href="glossary.html#gloss:instantiation">instantiation</a>
493 pattern for a
494 <a class="gloss" href="glossary.html#gloss:predicate">predicate</a>,
495 often accompanied with a <a class="gloss" href="glossary.html#gloss:determinism">determinism</a>.</dd>
479496 <dt><a id="gloss:module"><strong>module</strong></a></dt>
480497 <dd class="defbody">
481 <a id="idx:module:2108"></a>Collection of predicates. Each module
498 <a id="idx:module:2114"></a>Collection of predicates. Each module
482499 defines a name-space for predicates. <a class="gloss" href="glossary.html#gloss:built-in">built-in</a>
483500 predicates are accessible from all modules. Predicates can be published
484501 (<a class="gloss" href="glossary.html#gloss:exported">exported</a>) and <a class="gloss" href="glossary.html#gloss:imported">imported</a>
485502 to make their definition available to other modules.</dd>
486503 <dt><a id="gloss:module-transparent"><strong>module transparent [predicate]</strong></a></dt>
487504 <dd class="defbody">
488 <a id="idx:moduletransparent:2109"></a><a id="idx:transparent:2110"></a>A <a class="gloss" href="glossary.html#gloss:predicate">predicate</a>
505 <a id="idx:moduletransparent:2115"></a><a id="idx:transparent:2116"></a>A <a class="gloss" href="glossary.html#gloss:predicate">predicate</a>
489506 that does not change the <a class="gloss" href="glossary.html#gloss:context-module">context module</a>.
490507 Sometimes also called a <a class="gloss" href="glossary.html#gloss:meta-predicate">meta-predicate</a>.</dd>
508 <dt><a id="gloss:multi"><strong>multi [determinism]</strong></a></dt>
509 <dd class="defbody">
510 <a id="idx:multi:2117"></a>A <a class="gloss" href="glossary.html#gloss:predicate">predicate</a>
511 is said to have <a class="gloss" href="glossary.html#gloss:determinism">determinism</a>
512 multi if it generates at
513 <em>least</em> one answer.</dd>
491514 <dt><a id="gloss:multifile"><strong>multifile [predicate]</strong></a></dt>
492515 <dd class="defbody">
493516 Predicate for which the definition is distributed over multiple source
494 files. See <a id="idx:multifile1:2111"></a><a class="pred" href="dynamic.html#multifile/1">multifile/1</a>.</dd>
517 files. See <a id="idx:multifile1:2118"></a><a class="pred" href="dynamic.html#multifile/1">multifile/1</a>.</dd>
495518 <dt><a id="gloss:neck"><strong>neck</strong></a></dt>
496519 <dd class="defbody">
497 <a id="idx:neck:2112"></a>Operator (<code><code>:-</code></code>)
520 <a id="idx:neck:2119"></a>Operator (<code><code>:-</code></code>)
498521 separating <a class="gloss" href="glossary.html#gloss:head">head</a>
499522 from <a class="gloss" href="glossary.html#gloss:body">body</a> in a <a class="gloss" href="glossary.html#gloss:clause">clause</a>.</dd>
500523 <dt><a id="gloss:nondet"><strong>nondet</strong></a></dt>
501524 <dd class="defbody">
502 <a id="idx:nondet:2113"></a>Short for <a class="gloss" href="glossary.html#gloss:non-deterministic">non deterministic</a>.</dd>
525 <a id="idx:nondet:2120"></a>Short for <a class="gloss" href="glossary.html#gloss:non-deterministic">non deterministic</a>.</dd>
503526 <dt><a id="gloss:non-deterministic"><strong>non deterministic</strong></a></dt>
504527 <dd class="defbody">
505 <a id="idx:nondeterministic:2114"></a>A <a class="gloss" href="glossary.html#gloss:non-deterministic">non deterministic</a>
528 <a id="idx:nondeterministic:2121"></a>A <a class="gloss" href="glossary.html#gloss:non-deterministic">non deterministic</a>
506529 predicate is a predicate that mail fail or succeed any number of times.</dd>
507530 <dt><a id="gloss:operator"><strong>operator</strong></a></dt>
508531 <dd class="defbody">
509 <a id="idx:operator:2115"></a>Symbol (<a class="gloss" href="glossary.html#gloss:atom">atom</a>)
532 <a id="idx:operator:2122"></a>Symbol (<a class="gloss" href="glossary.html#gloss:atom">atom</a>)
510533 that may be placed before its <a class="gloss" href="glossary.html#gloss:operand">operand</a>
511534 (prefix), after its <a class="gloss" href="glossary.html#gloss:operand">operand</a>
512535 (postfix) or between its two <a class="gloss" href="glossary.html#gloss:operand">operands</a>
516539 canonical term <code>+(a,b)</code>.</dd>
517540 <dt><a id="gloss:operand"><strong>operand</strong></a></dt>
518541 <dd class="defbody">
519 <a id="idx:operand:2116"></a><a class="gloss" href="glossary.html#gloss:argument">Argument</a>
542 <a id="idx:operand:2123"></a><a class="gloss" href="glossary.html#gloss:argument">Argument</a>
520543 of an <a class="gloss" href="glossary.html#gloss:operator">operator</a>.</dd>
521544 <dt><a id="gloss:precedence"><strong>precedence</strong></a></dt>
522545 <dd class="defbody">
523 <a id="idx:precedence:2117"></a>The <a class="gloss" href="glossary.html#gloss:priority">priority</a>
546 <a id="idx:precedence:2124"></a>The <a class="gloss" href="glossary.html#gloss:priority">priority</a>
524547 of an <a class="gloss" href="glossary.html#gloss:operator">operator</a>.
525548 Operator precedence is used to interpret <code>a+b*c</code> as <code>+(a, *(b,c))</code>.</dd>
526549 <dt><a id="gloss:predicate"><strong>predicate</strong></a></dt>
527550 <dd class="defbody">
528 <a id="idx:predicate:2118"></a>Collection of <a class="gloss" href="glossary.html#gloss:clause">clauses</a>
551 <a id="idx:predicate:2125"></a>Collection of <a class="gloss" href="glossary.html#gloss:clause">clauses</a>
529552 with the same <a class="gloss" href="glossary.html#gloss:functor">functor</a>
530553 (name/<a class="gloss" href="glossary.html#gloss:arity">arity</a>). If a <a class="gloss" href="glossary.html#gloss:goal">goal</a>
531554 is proved, the system looks for a <a class="gloss" href="glossary.html#gloss:predicate">predicate</a>
535558 one-by-one. See also <a class="gloss" href="glossary.html#gloss:backtracking">backtracking</a>.</dd>
536559 <dt><a id="gloss:predicate-indicator"><strong>predicate indicator</strong></a></dt>
537560 <dd class="defbody">
538 <a id="idx:predicateindicator:2119"></a>Term of the form Name/Arity
561 <a id="idx:predicateindicator:2126"></a>Term of the form Name/Arity
539562 (traditional) or Name//Arity (ISO DCG proposal), where Name is an atom
540563 and Arity a non-negative integer. It acts as an <em>indicator</em> (or
541564 reference) to a predicate or
542565 <b>DCG</b> rule.</dd>
543566 <dt><a id="gloss:priority"><strong>priority</strong></a></dt>
544567 <dd class="defbody">
545 <a id="idx:priority:2120"></a>In the context of <a class="gloss" href="glossary.html#gloss:operator">operators</a>
568 <a id="idx:priority:2127"></a>In the context of <a class="gloss" href="glossary.html#gloss:operator">operators</a>
546569 a synonym for <a class="gloss" href="glossary.html#gloss:precedence">precedence</a>.</dd>
547570 <dt><a id="gloss:program"><strong>program</strong></a></dt>
548571 <dd class="defbody">
549 <a id="idx:program:2121"></a>Collection of <a class="gloss" href="glossary.html#gloss:predicate">predicates</a>.</dd>
572 <a id="idx:program:2128"></a>Collection of <a class="gloss" href="glossary.html#gloss:predicate">predicates</a>.</dd>
550573 <dt><a id="gloss:property"><strong>property</strong></a></dt>
551574 <dd class="defbody">
552 <a id="idx:property:2122"></a>Attribute of an object. SWI-Prolog defines
575 <a id="idx:property:2129"></a>Attribute of an object. SWI-Prolog defines
553576 various <em>*_property</em> predicates to query the status of
554577 predicates, clauses. etc.</dd>
555578 <dt><a id="gloss:prove"><strong>prove</strong></a></dt>
556579 <dd class="defbody">
557 <a id="idx:prove:2123"></a>Process where Prolog attempts to prove a <a class="gloss" href="glossary.html#gloss:query">query</a>
580 <a id="idx:prove:2130"></a>Process where Prolog attempts to prove a <a class="gloss" href="glossary.html#gloss:query">query</a>
558581 using the available
559582 <a class="gloss" href="glossary.html#gloss:predicate">predicates</a>.</dd>
560583 <dt><a id="gloss:public-list"><strong>public list</strong></a></dt>
561584 <dd class="defbody">
562 <a id="idx:publiclist:2124"></a>List of <a class="gloss" href="glossary.html#gloss:predicate">predicates</a>
585 <a id="idx:publiclist:2131"></a>List of <a class="gloss" href="glossary.html#gloss:predicate">predicates</a>
563586 exported from a <a class="gloss" href="glossary.html#gloss:module">module</a>.</dd>
564587 <dt><a id="gloss:query"><strong>query</strong></a></dt>
565588 <dd class="defbody">
566589 See <a class="gloss" href="glossary.html#gloss:goal">goal</a>.</dd>
567590 <dt><a id="gloss:retract"><strong>retract</strong></a></dt>
568591 <dd class="defbody">
569 <a id="idx:retract:2125"></a>Remove a <a class="gloss" href="glossary.html#gloss:clause">clause</a>
592 <a id="idx:retract:2132"></a>Remove a <a class="gloss" href="glossary.html#gloss:clause">clause</a>
570593 from a <a class="gloss" href="glossary.html#gloss:predicate">predicate</a>.
571594 See also <a class="gloss" href="glossary.html#gloss:dynamic">dynamic</a>,
572595 <a class="gloss" href="glossary.html#gloss:update-view">update view</a>
573596 and <a class="gloss" href="glossary.html#gloss:assert">assert</a>.</dd>
574597 <dt><a id="gloss:semidet"><strong>semidet</strong></a></dt>
575598 <dd class="defbody">
576 <a id="idx:semidet:2126"></a>Shorthand for </dd>
599 <a id="idx:semidet:2133"></a>Shorthand for </dd>
577600 <dt><a id="gloss:semi-deterministic"><strong>semi deterministic</strong></a></dt>
578601 <dd class="defbody">
579602 .</dd>
580603 <dt><a id="gloss:semi-deterministic"><strong>semi deterministic</strong></a></dt>
581604 <dd class="defbody">
582 <a id="idx:semideterministic:2127"></a>A <a class="gloss" href="glossary.html#gloss:predicate">predicate</a>
605 <a id="idx:semideterministic:2134"></a>A <a class="gloss" href="glossary.html#gloss:predicate">predicate</a>
583606 that is <a class="gloss" href="glossary.html#gloss:semi-deterministic">semi deterministic</a>
584607 either fails or succeeds exactly once without a <a class="gloss" href="glossary.html#gloss:choice-point">choice point</a>.
585608 See also
586609 <a class="gloss" href="glossary.html#gloss:deterministic">deterministic</a>.</dd>
587610 <dt><a id="gloss:shared"><strong>shared</strong></a></dt>
588611 <dd class="defbody">
589 <a id="idx:shared:2128"></a>Two <a class="gloss" href="glossary.html#gloss:variable">variables</a>
612 <a id="idx:shared:2135"></a>Two <a class="gloss" href="glossary.html#gloss:variable">variables</a>
590613 are called <a class="gloss" href="glossary.html#gloss:shared">shared</a>
591614 after they are <a class="gloss" href="glossary.html#gloss:unify">unified</a>.
592615 This implies if either of them is <a class="gloss" href="glossary.html#gloss:binding">bound</a>,
600623 </dd>
601624 <dt><a id="gloss:singleton"><strong>singleton [variable]</strong></a></dt>
602625 <dd class="defbody">
603 <a id="idx:singleton:2129"></a><a class="gloss" href="glossary.html#gloss:variable">Variable</a>
626 <a id="idx:singleton:2136"></a><a class="gloss" href="glossary.html#gloss:variable">Variable</a>
604627 appearing only one time in a <a class="gloss" href="glossary.html#gloss:clause">clause</a>.
605628 SWI-Prolog normally warns for this to avoid you making spelling
606629 mistakes. If a variable appears on purpose only once in a clause, write
609632 2.15.2.5</a>.</dd>
610633 <dt><a id="gloss:solution"><strong>solution</strong></a></dt>
611634 <dd class="defbody">
612 <a id="idx:solution:2130"></a><a class="gloss" href="glossary.html#gloss:binding">Bindings</a>
635 <a id="idx:solution:2137"></a><a class="gloss" href="glossary.html#gloss:binding">Bindings</a>
613636 resulting from a successfully <a class="gloss" href="glossary.html#gloss:prove">prove</a>n <a class="gloss" href="glossary.html#gloss:goal">goal</a>.</dd>
614637 <dt><a id="gloss:structure"><strong>structure</strong></a></dt>
615638 <dd class="defbody">
616 <a id="idx:structure:2131"></a>Synonym for <a class="gloss" href="glossary.html#gloss:compound">compound</a>
639 <a id="idx:structure:2138"></a>Synonym for <a class="gloss" href="glossary.html#gloss:compound">compound</a>
617640 term.</dd>
618641 <dt><a id="gloss:string"><strong>string</strong></a></dt>
619642 <dd class="defbody">
622645 one-character <a class="gloss" href="glossary.html#gloss:atom">atoms</a>.</dd>
623646 <dt><a id="gloss:succeed"><strong>succeed</strong></a></dt>
624647 <dd class="defbody">
625 <a id="idx:succeed:2132"></a>A <a class="gloss" href="glossary.html#gloss:goal">goal</a>
648 <a id="idx:succeed:2139"></a>A <a class="gloss" href="glossary.html#gloss:goal">goal</a>
626649 is said to have <a class="gloss" href="glossary.html#gloss:succeed">succeeded</a>
627650 if it has been <a class="gloss" href="glossary.html#gloss:prove">proven</a>.</dd>
628651 <dt><a id="gloss:term"><strong>term</strong></a></dt>
629652 <dd class="defbody">
630 <a id="idx:term:2133"></a>Value in Prolog. A <a class="gloss" href="glossary.html#gloss:term">term</a>
653 <a id="idx:term:2140"></a>Value in Prolog. A <a class="gloss" href="glossary.html#gloss:term">term</a>
631654 is either a <a class="gloss" href="glossary.html#gloss:variable">variable</a>, <a class="gloss" href="glossary.html#gloss:atom">atom</a>, <a class="gloss" href="glossary.html#gloss:integer">integer</a>,
632655 <a class="gloss" href="glossary.html#gloss:float">float</a> or <a class="gloss" href="glossary.html#gloss:compound">compound</a>
633656 term. In addition, SWI-Prolog also defines the type <a class="gloss" href="glossary.html#gloss:string">string</a>.</dd>
636659 See <a class="gloss" href="glossary.html#gloss:module-transparent">module transparent</a>.</dd>
637660 <dt><a id="gloss:unify"><strong>unify</strong></a></dt>
638661 <dd class="defbody">
639 <a id="idx:unify:2134"></a>Prolog process to make two terms equal by
662 <a id="idx:unify:2141"></a>Prolog process to make two terms equal by
640663 assigning variables in one term to values at the corresponding location
641664 of the other term. For example:
642665
650673 not directed.</dd>
651674 <dt><a id="gloss:update-view"><strong>update view</strong></a></dt>
652675 <dd class="defbody">
653 <a id="idx:updateview:2135"></a><a id="idx:viewupdate:2136"></a>How
676 <a id="idx:updateview:2142"></a><a id="idx:viewupdate:2143"></a>How
654677 Prolog behaves when a <a class="gloss" href="glossary.html#gloss:dynamic">dynamic</a> <a class="gloss" href="glossary.html#gloss:predicate">predicate</a>
655678 is changed while it is running. There are two models. In most older
656679 Prolog systems the change becomes immediately visible to the <a class="gloss" href="glossary.html#gloss:goal">goal</a>,
659682 `see' the new definition.</dd>
660683 <dt><a id="gloss:variable"><strong>variable</strong></a></dt>
661684 <dd class="defbody">
662 <a id="idx:variable:2137"></a>A Prolog variable is a value that `is not
685 <a id="idx:variable:2144"></a>A Prolog variable is a value that `is not
663686 yet bound'. After <a class="gloss" href="glossary.html#gloss:binding">binding</a>
664687 a variable, it cannot be modified. <a class="gloss" href="glossary.html#gloss:backtracking">Backtracking</a>
665688 to a point in the execution before the variable was bound will turn it
680703 <p></dd>
681704 </dl>
682705
683 <p></body></html>
706 </body></html>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 8.7</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 8.7</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
272272 into Prolog code. When you disable optimizations the CHR compiler will
273273 be a lot quicker, but you may lose performance. Alternatively, you can
274274 just use SWI-Prolog's
275 <a id="idx:qcompile1:1688"></a><a class="pred" href="consulting.html#qcompile/1">qcompile/1</a>
275 <a id="idx:qcompile1:1691"></a><a class="pred" href="consulting.html#qcompile/1">qcompile/1</a>
276276 to generate a <code>.qlf</code> file once from your
277277 <code>.pl</code> file. This <code>.qlf</code> contains the generated
278278 code of the CHR compiler (be it in a binary format). When you consult
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 3.5</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 3.5</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 7.3</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 7.3</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
238238 <a id="sec:gvar"></a>
239239
240240 <p>Global variables are associations between names (atoms) and terms.
241 They differ in various ways from storing information using <a id="idx:assert1:1650"></a><a class="pred" href="db.html#assert/1">assert/1</a>
242 or <a id="idx:recorda3:1651"></a><a class="pred" href="db.html#recorda/3">recorda/3</a>.
241 They differ in various ways from storing information using <a id="idx:assert1:1653"></a><a class="pred" href="db.html#assert/1">assert/1</a>
242 or <a id="idx:recorda3:1654"></a><a class="pred" href="db.html#recorda/3">recorda/3</a>.
243243
244244 <p>
245245 <ul class="latex">
249249 the CHR global constraint store.
250250
251251 <p>
252 <li>They support both global assignment using <a id="idx:nbsetval2:1652"></a><a class="pred" href="gvar.html#nb_setval/2">nb_setval/2</a>
253 and backtrackable assignment using <a id="idx:bsetval2:1653"></a><a class="pred" href="gvar.html#b_setval/2">b_setval/2</a>.
252 <li>They support both global assignment using <a id="idx:nbsetval2:1655"></a><a class="pred" href="gvar.html#nb_setval/2">nb_setval/2</a>
253 and backtrackable assignment using <a id="idx:bsetval2:1656"></a><a class="pred" href="gvar.html#b_setval/2">b_setval/2</a>.
254254
255255 <p>
256256 <li>Only one value (which can be an arbitrary complex Prolog term) can
265265 module scoping in future versions.
266266 </ul>
267267
268 <p>Both <a id="idx:bsetval2:1654"></a><a class="pred" href="gvar.html#b_setval/2">b_setval/2</a>
269 and <a id="idx:nbsetval2:1655"></a><a class="pred" href="gvar.html#nb_setval/2">nb_setval/2</a>
268 <p>Both <a id="idx:bsetval2:1657"></a><a class="pred" href="gvar.html#b_setval/2">b_setval/2</a>
269 and <a id="idx:nbsetval2:1658"></a><a class="pred" href="gvar.html#nb_setval/2">nb_setval/2</a>
270270 implicitly create a variable if the referenced name does not already
271271 refer to a variable.
272272
273273 <p>Global variables may be initialised from directives to make them
274274 available during the program lifetime, but some considerations are
275275 necessary for saved states and threads. Saved states do not store global
276 variables, which implies they have to be declared with <a id="idx:initialization1:1656"></a><a class="pred" href="consulting.html#initialization/1">initialization/1</a>
276 variables, which implies they have to be declared with <a id="idx:initialization1:1659"></a><a class="pred" href="consulting.html#initialization/1">initialization/1</a>
277277 to recreate them after loading the saved state. Each thread has its own
278278 set of global variables, starting with an empty set. Using
279 <a id="idx:threadinitialization1:1657"></a><a class="pred" href="threadcreate.html#thread_initialization/1">thread_initialization/1</a>
279 <a id="idx:threadinitialization1:1660"></a><a class="pred" href="threadcreate.html#thread_initialization/1">thread_initialization/1</a>
280280 to define a global variable it will be defined, restored after reloading
281281 a saved state and created in all threads that are created <em>after</em>
282282 the registration. Finally, global variables can be initialised using the
283283 exception hook
284 <a id="idx:exception3:1658"></a><a class="pred" href="exception3.html#exception/3">exception/3</a>.
284 <a id="idx:exception3:1661"></a><a class="pred" href="exception3.html#exception/3">exception/3</a>.
285285 The latter technique is used by CHR (see <a class="sec" href="chr.html">chapter
286286 8</a>).
287287
301301 Get the value associated with the global variable <var>Name</var> and
302302 unify it with <var>Value</var>. Note that this unification may further
303303 instantiate the value of the global variable. If this is undesirable the
304 normal precautions (double negation or <a id="idx:copyterm2:1659"></a><a class="pred" href="manipterm.html#copy_term/2">copy_term/2</a>)
304 normal precautions (double negation or <a id="idx:copyterm2:1662"></a><a class="pred" href="manipterm.html#copy_term/2">copy_term/2</a>)
305305 must be taken. The
306 <a id="idx:bgetval2:1660"></a><a class="pred" href="gvar.html#b_getval/2">b_getval/2</a>
306 <a id="idx:bgetval2:1663"></a><a class="pred" href="gvar.html#b_getval/2">b_getval/2</a>
307307 predicate generates errors if <var>Name</var> is not an atom or the
308308 requested variable does not exist.
309309 </dd>
313313 <dt class="pubdef"><a id="nb_setval/2"><strong>nb_setval</strong>(<var>+Name,
314314 +Value</var>)</a></dt>
315315 <dd class="defbody">
316 Associates a copy of <var>Value</var> created with <a id="idx:duplicateterm2:1661"></a><a class="pred" href="manipterm.html#duplicate_term/2">duplicate_term/2</a>
316 Associates a copy of <var>Value</var> created with <a id="idx:duplicateterm2:1664"></a><a class="pred" href="manipterm.html#duplicate_term/2">duplicate_term/2</a>
317317 with the atom <var>Name</var>. Note that this can be used to set an
318318 initial value other than <code>[]</code> prior to backtrackable
319319 assignment.</dd>
320320 <dt class="pubdef"><a id="nb_getval/2"><strong>nb_getval</strong>(<var>+Name,
321321 -Value</var>)</a></dt>
322322 <dd class="defbody">
323 The <a id="idx:nbgetval2:1662"></a><a class="pred" href="gvar.html#nb_getval/2">nb_getval/2</a>
324 predicate is a synonym for <a id="idx:bgetval2:1663"></a><a class="pred" href="gvar.html#b_getval/2">b_getval/2</a>,
323 The <a id="idx:nbgetval2:1665"></a><a class="pred" href="gvar.html#nb_getval/2">nb_getval/2</a>
324 predicate is a synonym for <a id="idx:bgetval2:1666"></a><a class="pred" href="gvar.html#b_getval/2">b_getval/2</a>,
325325 introduced for compatibility and symmetry. As most scenarios will use a
326326 particular global variable using either non-backtrackable or
327 backtrackable assignment, using <a id="idx:nbgetval2:1664"></a><a class="pred" href="gvar.html#nb_getval/2">nb_getval/2</a>
327 backtrackable assignment, using <a id="idx:nbgetval2:1667"></a><a class="pred" href="gvar.html#nb_getval/2">nb_getval/2</a>
328328 can be used to document that the variable is non-backtrackable. Raises <code>existence_error(variable,
329329 Name)</code> if the variable does not exist.</dd>
330330 <dt class="pubdef"><a id="nb_linkval/2"><strong>nb_linkval</strong>(<var>+Name,
331331 +Value</var>)</a></dt>
332332 <dd class="defbody">
333333 Associates the term <var>Value</var> with the atom <var>Name</var>
334 without copying it. This is a fast special-purpose variation of <a id="idx:nbsetval2:1665"></a><a class="pred" href="gvar.html#nb_setval/2">nb_setval/2</a>
334 without copying it. This is a fast special-purpose variation of <a id="idx:nbsetval2:1668"></a><a class="pred" href="gvar.html#nb_setval/2">nb_setval/2</a>
335335 intended for expert users only because the semantics on backtracking to
336336 a point before creating the link are poorly defined for compound terms.
337337 The principal term is always left untouched, but backtracking behaviour
356356 ?Value</var>)</a></dt>
357357 <dd class="defbody">
358358 Enumerate all defined variables with their value. The order of
359 enumeration is undefined. Note that <a id="idx:nbcurrent2:1666"></a><a class="pred" href="gvar.html#nb_current/2">nb_current/2</a>
360 can be used as an alternative for <a id="idx:nbgetval2:1667"></a><a class="pred" href="gvar.html#nb_getval/2">nb_getval/2</a>
359 enumeration is undefined. Note that <a id="idx:nbcurrent2:1669"></a><a class="pred" href="gvar.html#nb_current/2">nb_current/2</a>
360 can be used as an alternative for <a id="idx:nbgetval2:1670"></a><a class="pred" href="gvar.html#nb_getval/2">nb_getval/2</a>
361361 to request the value of a variable and fail silently if the variable
362362 does not exists.</dd>
363363 <dt class="pubdef"><a id="nb_delete/1"><strong>nb_delete</strong>(<var>+Name</var>)</a></dt>
375375 <p>Global variables have been introduced by various Prolog
376376 implementations recently. The implementation of them in SWI-Prolog is
377377 based on hProlog by Bart Demoen. In discussion with Bart it was decided
378 that the semantics of hProlog <a id="idx:nbsetval2:1668"></a><a class="pred" href="gvar.html#nb_setval/2">nb_setval/2</a>,
379 which is equivalent to <a id="idx:nblinkval2:1669"></a><a class="pred" href="gvar.html#nb_linkval/2">nb_linkval/2</a>,
378 that the semantics of hProlog <a id="idx:nbsetval2:1671"></a><a class="pred" href="gvar.html#nb_setval/2">nb_setval/2</a>,
379 which is equivalent to <a id="idx:nblinkval2:1672"></a><a class="pred" href="gvar.html#nb_linkval/2">nb_linkval/2</a>,
380380 is not acceptable for normal Prolog users as the behaviour is influenced
381 by how built-in predicates that construct terms (<a id="idx:read1:1670"></a><a class="pred" href="termrw.html#read/1">read/1</a>,
381 by how built-in predicates that construct terms (<a id="idx:read1:1673"></a><a class="pred" href="termrw.html#read/1">read/1</a>,
382382 =../2, etc.) are implemented.
383383
384384 <p>GNU-Prolog provides a rich set of global variables, including arrays.
385 Arrays can be implemented easily in SWI-Prolog using <a id="idx:functor3:1671"></a><a class="pred" href="manipterm.html#functor/3">functor/3</a>
385 Arrays can be implemented easily in SWI-Prolog using <a id="idx:functor3:1674"></a><a class="pred" href="manipterm.html#functor/3">functor/3</a>
386386 and
387 <a id="idx:setarg3:1672"></a><a class="pred" href="manipterm.html#setarg/3">setarg/3</a>
387 <a id="idx:setarg3:1675"></a><a class="pred" href="manipterm.html#setarg/3">setarg/3</a>
388388 due to the unrestricted arity of compound terms.
389389
390390 <p></body></html>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 2.6</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 2.6</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 2.7</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 2.7</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 2.12</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 2.12</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 3.8</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 3.8</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 3.9</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 3.9</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 1.5</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 1.5</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 6.3</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 6.3</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
244244 module in which it has been defined.
245245
246246 <p>Importing the predicates from another module is achieved using the
247 directives <a id="idx:usemodule1:1523"></a><a class="pred" href="import.html#use_module/1">use_module/1</a>
248 or <a id="idx:usemodule2:1524"></a><a class="pred" href="import.html#use_module/2">use_module/2</a>.
247 directives <a id="idx:usemodule1:1525"></a><a class="pred" href="import.html#use_module/1">use_module/1</a>
248 or <a id="idx:usemodule2:1526"></a><a class="pred" href="import.html#use_module/2">use_module/2</a>.
249249 Note that both directives take
250250 <var>filename(s)</var> as arguments. That is, modules are imported based
251251 on their filename rather than their module name.
253253 <dl class="latex">
254254 <dt class="pubdef"><a id="use_module/1"><strong>use_module</strong>(<var>+Files</var>)</a></dt>
255255 <dd class="defbody">
256 Load the file(s) specified with <var>Files</var> just like <a id="idx:ensureloaded1:1525"></a><a class="pred" href="consulting.html#ensure_loaded/1">ensure_loaded/1</a>.
256 Load the file(s) specified with <var>Files</var> just like <a id="idx:ensureloaded1:1527"></a><a class="pred" href="consulting.html#ensure_loaded/1">ensure_loaded/1</a>.
257257 The files must all be module files. All exported predicates from the
258258 loaded files are imported into the module from which this predicate is
259 called. This predicate is equivalent to <a id="idx:ensureloaded1:1526"></a><a class="pred" href="consulting.html#ensure_loaded/1">ensure_loaded/1</a>,
259 called. This predicate is equivalent to <a id="idx:ensureloaded1:1528"></a><a class="pred" href="consulting.html#ensure_loaded/1">ensure_loaded/1</a>,
260260 except that it raises an error if <var>Files</var> are not module files.
261261
262262 <p>The imported predicates act as <em>weak symbols</em> in the module
264264 predicate overrides (clobbers) the imported definition. If the flag
265265 <a class="flag" href="flags.html#flag:warn_override_implicit_import">warn_override_implicit_import</a>
266266 is <code>true</code> (default), a warning is printed. Below is an
267 example of a module that uses library(lists), but redefines <a id="idx:flatten2:1527"></a><a class="pred" href="lists.html#flatten/2">flatten/2</a>,
267 example of a module that uses library(lists), but redefines <a id="idx:flatten2:1529"></a><a class="pred" href="lists.html#flatten/2">flatten/2</a>,
268268 giving it a totally different meaning:
269269
270270 <pre class="code">
283283 overrides weak import from lists
284284 </pre>
285285
286 <p>This warning can be avoided by (1) using <a id="idx:usemodule2:1528"></a><a class="pred" href="import.html#use_module/2">use_module/2</a>
286 <p>This warning can be avoided by (1) using <a id="idx:usemodule2:1530"></a><a class="pred" href="import.html#use_module/2">use_module/2</a>
287287 to only import the predicates from the <code>lists</code> library that
288288 are actually used in the `shapes' module, (2) using the <code>except([flatten/2])</code>
289 option of <a id="idx:usemodule2:1529"></a><a class="pred" href="import.html#use_module/2">use_module/2</a>,
289 option of <a id="idx:usemodule2:1531"></a><a class="pred" href="import.html#use_module/2">use_module/2</a>,
290290 (3) use
291 <code>:- abolish(<a id="idx:flatten2:1530"></a><a class="pred" href="lists.html#flatten/2">flatten/2</a>).</code>
291 <code>:- abolish(<a id="idx:flatten2:1532"></a><a class="pred" href="lists.html#flatten/2">flatten/2</a>).</code>
292292 before the local definition or (4) setting
293293 <a class="flag" href="flags.html#flag:warn_override_implicit_import">warn_override_implicit_import</a>
294294 to <code>false</code>. Globally disabling this warning is only
296296 design choices or the program is ported from a system that silently
297297 overrides imported predicates.
298298
299 <p>Note that it is always an error to import two modules with <a id="idx:usemodule1:1531"></a><a class="pred" href="import.html#use_module/1">use_module/1</a>
299 <p>Note that it is always an error to import two modules with <a id="idx:usemodule1:1533"></a><a class="pred" href="import.html#use_module/1">use_module/1</a>
300300 that export the same predicate. Such conflicts must be resolved with
301 <a id="idx:usemodule2:1532"></a><a class="pred" href="import.html#use_module/2">use_module/2</a>
301 <a id="idx:usemodule2:1534"></a><a class="pred" href="import.html#use_module/2">use_module/2</a>
302302 as described above.</dd>
303303 <dt class="pubdef"><a id="use_module/2"><strong>use_module</strong>(<var>+File,
304304 +ImportList</var>)</a></dt>
309309 imported from the loaded module. <var>ImportList</var> also allows for
310310 renaming or import-everything-except. See also the <code>import</code>
311311 option of
312 <a id="idx:loadfiles2:1533"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>.
313 The first example below loads <a id="idx:member2:1534"></a><a class="pred" href="lists.html#member/2">member/2</a>
314 from the <code>lists</code> library and <a id="idx:append2:1535"></a><a class="pred" href="lists.html#append/2">append/2</a>
312 <a id="idx:loadfiles2:1535"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>.
313 The first example below loads <a id="idx:member2:1536"></a><a class="pred" href="lists.html#member/2">member/2</a>
314 from the <code>lists</code> library and <a id="idx:append2:1537"></a><a class="pred" href="lists.html#append/2">append/2</a>
315315 under the name <code>list_concat</code>, which is how this predicate is
316316 named in YAP. The second example loads all exports from library <code>option</code>
317 except for <a id="idx:metaoptions3:1536"></a><a class="pred" href="option.html#meta_options/3">meta_options/3</a>.
317 except for <a id="idx:metaoptions3:1538"></a><a class="pred" href="option.html#meta_options/3">meta_options/3</a>.
318318 These renaming facilities are generally used to deal with portability
319319 issues with as few changes as possible to the actual code. See also <a class="sec" href="dialect.html">section
320320 C</a> and
330330 <p></dd>
331331 </dl>
332332
333 <p>The <a id="idx:module2:1537"></a><a class="pred" href="defmodule.html#module/2">module/2</a>, <a id="idx:usemodule1:1538"></a><a class="pred" href="import.html#use_module/1">use_module/1</a>
334 and <a id="idx:usemodule2:1539"></a><a class="pred" href="import.html#use_module/2">use_module/2</a>
333 <p>The <a id="idx:module2:1539"></a><a class="pred" href="defmodule.html#module/2">module/2</a>, <a id="idx:usemodule1:1540"></a><a class="pred" href="import.html#use_module/1">use_module/1</a>
334 and <a id="idx:usemodule2:1541"></a><a class="pred" href="import.html#use_module/2">use_module/2</a>
335335 directives are sufficient to partition a simple Prolog program into
336 modules. The SWI-Prolog graphical cross-referencing tool <a id="idx:gxref0:1540"></a><a class="pred" href="xref.html#gxref/0">gxref/0</a>
336 modules. The SWI-Prolog graphical cross-referencing tool <a id="idx:gxref0:1542"></a><a class="pred" href="xref.html#gxref/0">gxref/0</a>
337337 can be used to analyse the dependencies between non-module files and
338338 propose module declarations for each file.
339339
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 6.9</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 6.9</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
255255 6.10</a>.
256256
257257 <p>The list of import modules can be manipulated and queried using the
258 following predicates, as well as using <a id="idx:setmodule1:1574"></a><a class="pred" href="manipmodule.html#set_module/1">set_module/1</a>.
258 following predicates, as well as using <a id="idx:setmodule1:1576"></a><a class="pred" href="manipmodule.html#set_module/1">set_module/1</a>.
259259
260260 <dl class="latex">
261261 <dt class="pubdef"><span class="pred-tag">[nondet]</span><a id="import_module/2"><strong>import_module</strong>(<var>+Module,
263263 <dd class="defbody">
264264 True if <var>Module</var> inherits directly from <var>Import</var>. All
265265 normal modules only import from <code>user</code>, which imports from
266 <code>system</code>. The predicates <a id="idx:addimportmodule3:1575"></a><a class="pred" href="importmodule.html#add_import_module/3">add_import_module/3</a>
266 <code>system</code>. The predicates <a id="idx:addimportmodule3:1577"></a><a class="pred" href="importmodule.html#add_import_module/3">add_import_module/3</a>
267267 and
268 <a id="idx:deleteimportmodule2:1576"></a><a class="pred" href="importmodule.html#delete_import_module/2">delete_import_module/2</a>
269 can be used to manipulate the import list. See also <a id="idx:defaultmodule2:1577"></a><a class="pred" href="importmodule.html#default_module/2">default_module/2</a>.</dd>
268 <a id="idx:deleteimportmodule2:1578"></a><a class="pred" href="importmodule.html#delete_import_module/2">delete_import_module/2</a>
269 can be used to manipulate the import list. See also <a id="idx:defaultmodule2:1579"></a><a class="pred" href="importmodule.html#default_module/2">default_module/2</a>.</dd>
270270 <dt class="pubdef"><span class="pred-tag">[multi]</span><a id="default_module/2"><strong>default_module</strong>(<var>+Module,
271271 -Default</var>)</a></dt>
272272 <dd class="defbody">
274274 <var>Module</var>. Modules are returned in the same search order used
275275 for predicates and operators. That is, <var>Default</var> is first
276276 unified with <var>Module</var>, followed by the depth-first transitive
277 closure of <a id="idx:importmodule2:1578"></a><a class="pred" href="importmodule.html#import_module/2">import_module/2</a>.</dd>
277 closure of <a id="idx:importmodule2:1580"></a><a class="pred" href="importmodule.html#import_module/2">import_module/2</a>.</dd>
278278 <dt class="pubdef"><a id="add_import_module/3"><strong>add_import_module</strong>(<var>+Module,
279279 +Import, +StartOrEnd</var>)</a></dt>
280280 <dd class="defbody">
281281 If <var>Import</var> is not already an import module for <var>Module</var>,
282282 add it to this list at the <code>start</code> or <code>end</code>
283283 depending on
284 <var>StartOrEnd</var>. See also <a id="idx:importmodule2:1579"></a><a class="pred" href="importmodule.html#import_module/2">import_module/2</a>
285 and <a id="idx:deleteimportmodule2:1580"></a><a class="pred" href="importmodule.html#delete_import_module/2">delete_import_module/2</a>.</dd>
284 <var>StartOrEnd</var>. See also <a id="idx:importmodule2:1581"></a><a class="pred" href="importmodule.html#import_module/2">import_module/2</a>
285 and <a id="idx:deleteimportmodule2:1582"></a><a class="pred" href="importmodule.html#delete_import_module/2">delete_import_module/2</a>.</dd>
286286 <dt class="pubdef"><a id="delete_import_module/2"><strong>delete_import_module</strong>(<var>+Module,
287287 +Import</var>)</a></dt>
288288 <dd class="defbody">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual</title><link rel="contents" href="Contents.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual</title><link rel="contents" href="Contents.html">
55 <link rel="index" href="DocIndex.html">
66 <link rel="summary" href="summary.html">
77 <link rel="next" href="Contents.html">
228228 <a class="nav" href="summary.html"><img src="info.gif" alt="Summary"></a>
229229 <a class="nav" href="Contents.html"><img src="next.gif" alt="Next"></a>
230230 </div>
231 <div class="title">SWI-Prolog 7.3.1 Reference Manual</div>
231 <div class="title">SWI-Prolog 7.3.6 Reference Manual</div>
232232 <div class="author"><a class="url" href="mailto:J.Wielemaker@vu.nl">Jan
233233 Wielemaker</a> <br>
234234 Department of Computer Science <br>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 2.2</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 2.2</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 2.3</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 2.3</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section B.7</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section B.7</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
251251 the tracer in the module <code>user</code> to list the currently called
252252 predicate. This hook may be defined to list only relevant clauses of the
253253 indicated <var>Goal</var> and/or show the actual source code in an
254 editor. See also <a id="idx:portray1:2022"></a><a class="pred" href="termrw.html#portray/1">portray/1</a>
255 and <a id="idx:multifile1:2023"></a><a class="pred" href="dynamic.html#multifile/1">multifile/1</a>.</dd>
254 editor. See also <a id="idx:portray1:2025"></a><a class="pred" href="termrw.html#portray/1">portray/1</a>
255 and <a id="idx:multifile1:2026"></a><a class="pred" href="dynamic.html#multifile/1">multifile/1</a>.</dd>
256256 <dt class="pubdef"><a id="prolog:debug_control_hook/1"><strong>prolog:debug_control_hook</strong>(<var>:Action</var>)</a></dt>
257257 <dd class="defbody">
258258 Hook for the debugger control predicates that allows the creator of more
263263 <dl class="latex">
264264 <dt><strong>spy</strong>(<var>Spec</var>)</dt>
265265 <dd class="defbody">
266 Hook in <a id="idx:spy1:2024"></a><a class="pred" href="debugger.html#spy/1">spy/1</a>.
267 If the hook succeeds <a id="idx:spy1:2025"></a><a class="pred" href="debugger.html#spy/1">spy/1</a>
266 Hook in <a id="idx:spy1:2027"></a><a class="pred" href="debugger.html#spy/1">spy/1</a>.
267 If the hook succeeds <a id="idx:spy1:2028"></a><a class="pred" href="debugger.html#spy/1">spy/1</a>
268268 takes no further action.
269269 </dd>
270270 <dt><strong>nospy</strong>(<var>Spec</var>)</dt>
271271 <dd class="defbody">
272 Hook in <a id="idx:nospy1:2026"></a><a class="pred" href="debugger.html#nospy/1">nospy/1</a>.
273 If the hook succeeds <a id="idx:nospy1:2027"></a><a class="pred" href="debugger.html#nospy/1">nospy/1</a>
274 takes no further action. If <a id="idx:spy1:2028"></a><a class="pred" href="debugger.html#spy/1">spy/1</a>
272 Hook in <a id="idx:nospy1:2029"></a><a class="pred" href="debugger.html#nospy/1">nospy/1</a>.
273 If the hook succeeds <a id="idx:nospy1:2030"></a><a class="pred" href="debugger.html#nospy/1">nospy/1</a>
274 takes no further action. If <a id="idx:spy1:2031"></a><a class="pred" href="debugger.html#spy/1">spy/1</a>
275275 is hooked, it is advised to place a complementary hook for
276 <a id="idx:nospy1:2029"></a><a class="pred" href="debugger.html#nospy/1">nospy/1</a>.
276 <a id="idx:nospy1:2032"></a><a class="pred" href="debugger.html#nospy/1">nospy/1</a>.
277277 </dd>
278278 <dt><strong>nospyall</strong></dt>
279279 <dd class="defbody">
280 Hook in <a id="idx:nospyall0:2030"></a><a class="pred" href="debugger.html#nospyall/0">nospyall/0</a>.
280 Hook in <a id="idx:nospyall0:2033"></a><a class="pred" href="debugger.html#nospyall/0">nospyall/0</a>.
281281 Should remove all spy points. This hook is called in a failure-driven
282282 loop.
283283 </dd>
284284 <dt><strong>debugging</strong></dt>
285285 <dd class="defbody">
286 Hook in <a id="idx:debugging0:2031"></a><a class="pred" href="debugger.html#debugging/0">debugging/0</a>.
286 Hook in <a id="idx:debugging0:2034"></a><a class="pred" href="debugger.html#debugging/0">debugging/0</a>.
287287 It can be used in two ways. It can report the status of the additional
288288 debug points controlled by the above hooks and fail to let the system
289 report the others, or it succeeds, overruling the entire behaviour of <a id="idx:debugging0:2032"></a><a class="pred" href="debugger.html#debugging/0">debugging/0</a>.
289 report the others, or it succeeds, overruling the entire behaviour of <a id="idx:debugging0:2035"></a><a class="pred" href="debugger.html#debugging/0">debugging/0</a>.
290290 </dd>
291291 </dl>
292292
293293 </dd>
294294 <dt class="pubdef"><a id="prolog:help_hook/1"><strong>prolog:help_hook</strong>(<var>+Action</var>)</a></dt>
295295 <dd class="defbody">
296 Hook into <a id="idx:help0:2033"></a><a class="pred" href="help.html#help/0">help/0</a>
297 and <a id="idx:help1:2034"></a><a class="pred" href="help.html#help/1">help/1</a>.
296 Hook into <a id="idx:help0:2036"></a><a class="pred" href="help.html#help/0">help/0</a>
297 and <a id="idx:help1:2037"></a><a class="pred" href="help.html#help/1">help/1</a>.
298298 If the hook succeeds, the built-in actions are not executed. For
299299 example, <code>?- help(picture).</code> is caught by the XPCE help hook
300300 to give help on the class <em>picture</em>. Defined actions are:
302302 <dl class="latex">
303303 <dt><strong>help</strong></dt>
304304 <dd class="defbody">
305 User entered plain <a id="idx:help0:2035"></a><a class="pred" href="help.html#help/0">help/0</a>
305 User entered plain <a id="idx:help0:2038"></a><a class="pred" href="help.html#help/0">help/0</a>
306306 to give default help. The default performs
307 <code>help(<a id="idx:help1:2036"></a><a class="pred" href="help.html#help/1">help/1</a>)</code>,
307 <code>help(<a id="idx:help1:2039"></a><a class="pred" href="help.html#help/1">help/1</a>)</code>,
308308 giving help on help.
309309 </dd>
310310 <dt><strong>help</strong>(<var>What</var>)</dt>
311311 <dd class="defbody">
312 Hook in <a id="idx:help1:2037"></a><a class="pred" href="help.html#help/1">help/1</a>
312 Hook in <a id="idx:help1:2040"></a><a class="pred" href="help.html#help/1">help/1</a>
313313 on the topic <var>What</var>.
314314 </dd>
315315 <dt><strong>apropos</strong>(<var>What</var>)</dt>
316316 <dd class="defbody">
317 Hook in <a id="idx:apropos1:2038"></a><a class="pred" href="help.html#apropos/1">apropos/1</a>
317 Hook in <a id="idx:apropos1:2041"></a><a class="pred" href="help.html#apropos/1">apropos/1</a>
318318 on the topic <var>What</var>.
319319 </dd>
320320 </dl>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.13</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.13</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 2.17</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 2.17</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
250250
251251 <p>
252252 <li>If autoloading is disabled explicitly or because trapping unknown
253 predicates is disabled (see <a id="idx:unknown2:1937"></a><a class="pred" href="debugger.html#unknown/2">unknown/2</a>
253 predicates is disabled (see <a id="idx:unknown2:1940"></a><a class="pred" href="debugger.html#unknown/2">unknown/2</a>
254254 and
255 <a id="idx:currentprologflag2:1938"></a><a class="pred" href="flags.html#current_prolog_flag/2">current_prolog_flag/2</a>),
255 <a id="idx:currentprologflag2:1941"></a><a class="pred" href="flags.html#current_prolog_flag/2">current_prolog_flag/2</a>),
256256 library predicates must be loaded explicitly.
257257
258258 <p>
306306 <div class="toc-h4"><a class="sec" href="clpfd.html#sec:A.8.6"><span class="sec-nr">A.8.6</span> <span class="sec-title">Examples</span></a></div>
307307 <div class="toc-h4"><a class="sec" href="clpfd.html#sec:A.8.7"><span class="sec-nr">A.8.7</span> <span class="sec-title">Enumeration
308308 predicates and search</span></a></div>
309 <div class="toc-h4"><a class="sec" href="clpfd.html#sec:A.8.8"><span class="sec-nr">A.8.8</span> <span class="sec-title">Advanced
309 <div class="toc-h4"><a class="sec" href="clpfd.html#sec:A.8.8"><span class="sec-nr">A.8.8</span> <span class="sec-title">Optimisation</span></a></div>
310 <div class="toc-h4"><a class="sec" href="clpfd.html#sec:A.8.9"><span class="sec-nr">A.8.9</span> <span class="sec-title">Advanced
310311 topics</span></a></div>
311312 <div class="toc-h2"><a class="sec" href="clpqr.html"><span class="sec-nr">A.9</span> <span class="sec-title">library(clpqr):
312313 Constraint Logic Programming over Rationals and Reals</span></a></div>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section F.2</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section F.2</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
578578 to opt_parse(OptsSpec, ApplArgs, Opts, PositionalArgs, []).</td></tr>
579579 <tr><td><a class="pred" href="optparse.html#opt_parse/5">opt_parse/5</a></td><td>Parse
580580 the arguments Args (as list of atoms) according to OptsSpec.</td></tr>
581 <tr><td><a class="pred" href="optparse.html#parse_type/3">parse_type/3</a></td><td>Hook
582 to parse option text Codes to an object of type Type.</td></tr>
581583 </table>
582584
583585 <p><h3 id="sec:summary-lib-ordsets"><a id="sec:F.2.14"><span class="sec-nr">F.2.14</span> <span class="sec-title">library(ordsets)</span></a></h3>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 2.19</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 2.19</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.5</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.5</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
250250
251251 <p>A listing is produced by enumerating the clauses of the predicate
252252 using
253 <a id="idx:clause2:549"></a><a class="pred" href="examineprog.html#clause/2">clause/2</a>
254 and printing each clause using <a id="idx:portrayclause1:550"></a><a class="pred" href="listing.html#portray_clause/1">portray_clause/1</a>.
253 <a id="idx:clause2:550"></a><a class="pred" href="examineprog.html#clause/2">clause/2</a>
254 and printing each clause using <a id="idx:portrayclause1:551"></a><a class="pred" href="listing.html#portray_clause/1">portray_clause/1</a>.
255255 This implies that the variable names are generated (<var>A</var>, <var>B</var>,
256 ... ) and the layout is defined by rules in <a id="idx:portrayclause1:551"></a><a class="pred" href="listing.html#portray_clause/1">portray_clause/1</a>.</dd>
256 ... ) and the layout is defined by rules in <a id="idx:portrayclause1:552"></a><a class="pred" href="listing.html#portray_clause/1">portray_clause/1</a>.</dd>
257257 <dt class="pubdef"><a id="listing/0"><strong>listing</strong></a></dt>
258258 <dd class="defbody">
259 List all predicates from the calling module using <a id="idx:listing1:552"></a><a class="pred" href="listing.html#listing/1">listing/1</a>.
259 List all predicates from the calling module using <a id="idx:listing1:553"></a><a class="pred" href="listing.html#listing/1">listing/1</a>.
260260 For example,
261261 <code>?- listing.</code> lists clauses in the default <code>user</code>
262262 module and <code>?- lists:listing.</code> lists the clauses in the
268268 :- &lt;<var>Body</var>&gt;</code>'. Facts are represented as `<code>&lt;<var>Head</var>&gt;
269269 :- true</code>' or simply <code>&lt;<var>Head</var>&gt;</code>.
270270 Variables in the clause are written as <var>A</var>, <var>B</var>, ... .
271 Singleton variables are written as <code>_</code>. See also <a id="idx:portrayclause2:553"></a><a class="pred" href="listing.html#portray_clause/2">portray_clause/2</a>.</dd>
271 Singleton variables are written as <code>_</code>. See also <a id="idx:portrayclause2:554"></a><a class="pred" href="listing.html#portray_clause/2">portray_clause/2</a>.</dd>
272272 <dt class="pubdef"><a id="portray_clause/2"><strong>portray_clause</strong>(<var>+Stream,
273273 +Clause</var>)</a></dt>
274274 <dd class="defbody">
275 Pretty print a clause to <var>Stream</var>. See <a id="idx:portrayclause1:554"></a><a class="pred" href="listing.html#portray_clause/1">portray_clause/1</a>
275 Pretty print a clause to <var>Stream</var>. See <a id="idx:portrayclause1:555"></a><a class="pred" href="listing.html#portray_clause/1">portray_clause/1</a>
276276 for details.
277277 </dd>
278278 </dl>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.14</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.14</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section B.8</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section B.8</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
237237
238238 <a id="sec:loadfilehook"></a>
239239
240 <p>All loading of source files is achieved by <a id="idx:loadfiles2:2039"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>.
240 <p>All loading of source files is achieved by <a id="idx:loadfiles2:2042"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>.
241241 The hook
242 <a id="idx:prologloadfile2:2040"></a><a class="pred" href="loadfilehook.html#prolog_load_file/2">prolog_load_file/2</a>
242 <a id="idx:prologloadfile2:2043"></a><a class="pred" href="loadfilehook.html#prolog_load_file/2">prolog_load_file/2</a>
243243 can be used to load Prolog code from non-files or even load entirely
244244 different information, such as foreign files.
245245
247247 <dt class="pubdef"><a id="prolog_load_file/2"><strong>prolog_load_file</strong>(<var>+Spec,
248248 +Options</var>)</a></dt>
249249 <dd class="defbody">
250 Load a single object. If this call succeeds, <a id="idx:loadfiles2:2041"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>
250 Load a single object. If this call succeeds, <a id="idx:loadfiles2:2044"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>
251251 assumes the action has been taken care of. This hook is only called if <var>Options</var>
252252 does not contain the <code>stream(Input)</code> option. The hook must be
253253 defined in the module <code>user</code>.
261261 +Pos, +Term</var>)</a></dt>
262262 <dd class="defbody">
263263 This hook allows for processing comments encountered by the compiler. If
264 this hook is defined, the compiler calls <a id="idx:readterm2:2042"></a><a class="pred" href="termrw.html#read_term/2">read_term/2</a>
264 this hook is defined, the compiler calls <a id="idx:readterm2:2045"></a><a class="pred" href="termrw.html#read_term/2">read_term/2</a>
265265 with the option
266266 <code>comments(Comments)</code>. If the list of comments returned by
267 <a id="idx:readterm2:2043"></a><a class="pred" href="termrw.html#read_term/2">read_term/2</a>
267 <a id="idx:readterm2:2046"></a><a class="pred" href="termrw.html#read_term/2">read_term/2</a>
268268 is not empty it calls this comment hook with the following arguments.
269269
270270 <p>
280280 </ul>
281281
282282 <p>This hook is exploited by the documentation system. See
283 <a id="idx:streampositiondata3:2044"></a><a class="pred" href="IO.html#stream_position_data/3">stream_position_data/3</a>.
284 See also <a id="idx:readterm3:2045"></a><a class="pred" href="termrw.html#read_term/3">read_term/3</a>.
283 <a id="idx:streampositiondata3:2047"></a><a class="pred" href="IO.html#stream_position_data/3">stream_position_data/3</a>.
284 See also <a id="idx:readterm3:2048"></a><a class="pred" href="termrw.html#read_term/3">read_term/3</a>.
285285 </dd>
286286 </dl>
287287
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.22</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.22</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
242242
243243 <p>
244244 <ul class="latex">
245 <li>The predicates <a id="idx:chartype2:1160"></a><a class="pred" href="chartype.html#char_type/2">char_type/2</a>
246 and <a id="idx:codetype2:1161"></a><a class="pred" href="chartype.html#code_type/2">code_type/2</a>
245 <li>The predicates <a id="idx:chartype2:1161"></a><a class="pred" href="chartype.html#char_type/2">char_type/2</a>
246 and <a id="idx:codetype2:1162"></a><a class="pred" href="chartype.html#code_type/2">code_type/2</a>
247247 query character classes depending on the locale.
248 <li>The predicates <a id="idx:collationkey2:1162"></a><a class="pred" href="chartype.html#collation_key/2">collation_key/2</a>
249 and <a id="idx:localesort2:1163"></a><a class="pred" href="chartype.html#locale_sort/2">locale_sort/2</a>
248 <li>The predicates <a id="idx:collationkey2:1163"></a><a class="pred" href="chartype.html#collation_key/2">collation_key/2</a>
249 and <a id="idx:localesort2:1164"></a><a class="pred" href="chartype.html#locale_sort/2">locale_sort/2</a>
250250 can be used for locale dependent sorting of atoms.
251 <li>The predicate <a id="idx:formattime3:1164"></a><a class="pred" href="system.html#format_time/3">format_time/3</a>
251 <li>The predicate <a id="idx:formattime3:1165"></a><a class="pred" href="system.html#format_time/3">format_time/3</a>
252252 can be used to format time and date representations, where some of the
253253 specifiers are locale dependent.
254 <li>The predicate <a id="idx:format2:1165"></a><a class="pred" href="format.html#format/2">format/2</a>
254 <li>The predicate <a id="idx:format2:1166"></a><a class="pred" href="format.html#format/2">format/2</a>
255255 provides locale-specific formating of numbers. This functionality is
256256 based on a more fine-grained localization model that is the subject of
257257 this section.
258258 </ul>
259259
260260 <p>A locale is a (optionally named) read-only object that provides
261 information to locale specific functions.<sup class="fn">93<span class="fn-text">The
262 locale interface described in this section and its effect on <a id="idx:format2:1166"></a><a class="pred" href="format.html#format/2">format/2</a>
261 information to locale specific functions.<sup class="fn">94<span class="fn-text">The
262 locale interface described in this section and its effect on <a id="idx:format2:1167"></a><a class="pred" href="format.html#format/2">format/2</a>
263263 and reading integers from digit groups was discussed on the SWI-Prolog
264264 mailinglist. Most input in this discussion is from Ulrich Neumerkel and
265265 Richard O'Keefe. The predicates in this section were designed by Jan
267267 named
268268 <code>default</code> from the system locale. This locale is used as the
269269 initial locale for the three standard streams as well as the
270 <code>main</code> thread. Locale sensitive output predicates such as <a id="idx:format3:1167"></a><a class="pred" href="format.html#format/3">format/3</a>
270 <code>main</code> thread. Locale sensitive output predicates such as <a id="idx:format3:1168"></a><a class="pred" href="format.html#format/3">format/3</a>
271271 get their locale from the stream to which they deliver their output. New
272272 streams get their locale from the thread that created the stream.
273273 Threads get their locale from the thread that created them.
314314 [ decimal_point('.'), thousands_sep(','), grouping([repeat(3)]) ]
315315 </pre>
316316
317 <p>Named locales exists until they are destroyed using <a id="idx:localedestroy1:1168"></a><a class="pred" href="locale.html#locale_destroy/1">locale_destroy/1</a>
317 <p>Named locales exists until they are destroyed using <a id="idx:localedestroy1:1169"></a><a class="pred" href="locale.html#locale_destroy/1">locale_destroy/1</a>
318318 and they are no longer referenced. Unnamed locales are subject to (atom)
319319 garbage collection.</dd>
320320 <dt class="pubdef"><a id="locale_destroy/1"><strong>locale_destroy</strong>(<var>+Locale</var>)</a></dt>
326326 ?Property</var>)</a></dt>
327327 <dd class="defbody">
328328 True when <var>Locale</var> has <var>Property</var>. Properties are the
329 same as the <var>Options</var> described with <a id="idx:localecreate3:1169"></a><a class="pred" href="locale.html#locale_create/3">locale_create/3</a>.</dd>
329 same as the <var>Options</var> described with <a id="idx:localecreate3:1170"></a><a class="pred" href="locale.html#locale_create/3">locale_create/3</a>.</dd>
330330 <dt class="pubdef"><a id="set_locale/1"><strong>set_locale</strong>(<var>+Locale</var>)</a></dt>
331331 <dd class="defbody">
332332 Set the default locale for the current thread, as well as the locale for
333333 the standard streams (<code>user_input</code>, <code>user_output</code>,
334334 <code>user_error</code>, <code>current_output</code> and <code>current_input</code>.
335335 This locale is used for new streams, unless overruled using the
336 <code>locale(Locale)</code> option of <a id="idx:open4:1170"></a><a class="pred" href="IO.html#open/4">open/4</a>
337 or <a id="idx:setstream2:1171"></a><a class="pred" href="IO.html#set_stream/2">set_stream/2</a>.</dd>
336 <code>locale(Locale)</code> option of <a id="idx:open4:1171"></a><a class="pred" href="IO.html#open/4">open/4</a>
337 or <a id="idx:setstream2:1172"></a><a class="pred" href="IO.html#set_stream/2">set_stream/2</a>.</dd>
338338 <dt class="pubdef"><a id="current_locale/1"><strong>current_locale</strong>(<var>-Locale</var>)</a></dt>
339339 <dd class="defbody">
340340 True when <var>Locale</var> is the locale of the calling thread.
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.21</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.21</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
238238 <a id="sec:manipatom"></a>
239239
240240 <p>These predicates convert between Prolog constants and lists of
241 character codes. The predicates <a id="idx:atomcodes2:1117"></a><a class="pred" href="manipatom.html#atom_codes/2">atom_codes/2</a>, <a id="idx:numbercodes2:1118"></a><a class="pred" href="manipatom.html#number_codes/2">number_codes/2</a>
242 and <a id="idx:name2:1119"></a><a class="pred" href="manipatom.html#name/2">name/2</a>
241 character codes. The predicates <a id="idx:atomcodes2:1118"></a><a class="pred" href="manipatom.html#atom_codes/2">atom_codes/2</a>, <a id="idx:numbercodes2:1119"></a><a class="pred" href="manipatom.html#number_codes/2">number_codes/2</a>
242 and <a id="idx:name2:1120"></a><a class="pred" href="manipatom.html#name/2">name/2</a>
243243 behave the same when converting from a constant to a list of character
244 codes. When converting the other way around, <a id="idx:atomcodes2:1120"></a><a class="pred" href="manipatom.html#atom_codes/2">atom_codes/2</a>
245 will generate an atom, <a id="idx:numbercodes2:1121"></a><a class="pred" href="manipatom.html#number_codes/2">number_codes/2</a>
246 will generate a number or exception and <a id="idx:name2:1122"></a><a class="pred" href="manipatom.html#name/2">name/2</a>
244 codes. When converting the other way around, <a id="idx:atomcodes2:1121"></a><a class="pred" href="manipatom.html#atom_codes/2">atom_codes/2</a>
245 will generate an atom, <a id="idx:numbercodes2:1122"></a><a class="pred" href="manipatom.html#number_codes/2">number_codes/2</a>
246 will generate a number or exception and <a id="idx:name2:1123"></a><a class="pred" href="manipatom.html#name/2">name/2</a>
247247 will return a number if possible and an atom otherwise.
248248
249 <p>The ISO standard defines <a id="idx:atomchars2:1123"></a><a class="pred" href="manipatom.html#atom_chars/2">atom_chars/2</a>
249 <p>The ISO standard defines <a id="idx:atomchars2:1124"></a><a class="pred" href="manipatom.html#atom_chars/2">atom_chars/2</a>
250250 to describe the `broken-up' atom as a list of one-character atoms
251 instead of a list of codes. Up to version 3.2.x, SWI-Prolog's <a id="idx:atomchars2:1124"></a><a class="pred" href="manipatom.html#atom_chars/2">atom_chars/2</a>
251 instead of a list of codes. Up to version 3.2.x, SWI-Prolog's <a id="idx:atomchars2:1125"></a><a class="pred" href="manipatom.html#atom_chars/2">atom_chars/2</a>
252252 behaved like atom_codes, compatible with Quintus and SICStus Prolog. As
253253 of 3.3.x, SWI-Prolog
254 <a id="idx:atomcodes2:1125"></a><a class="pred" href="manipatom.html#atom_codes/2">atom_codes/2</a>
255 and <a id="idx:atomchars2:1126"></a><a class="pred" href="manipatom.html#atom_chars/2">atom_chars/2</a>
254 <a id="idx:atomcodes2:1126"></a><a class="pred" href="manipatom.html#atom_codes/2">atom_codes/2</a>
255 and <a id="idx:atomchars2:1127"></a><a class="pred" href="manipatom.html#atom_chars/2">atom_chars/2</a>
256256 are compliant to the ISO standard.
257257
258258 <p>To ease the pain of all variations in the Prolog community, all
272272 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="atom_chars/2"><strong>atom_chars</strong>(<var>?Atom,
273273 ?CharList</var>)</a></dt>
274274 <dd class="defbody">
275 As <a id="idx:atomcodes2:1127"></a><a class="pred" href="manipatom.html#atom_codes/2">atom_codes/2</a>,
275 As <a id="idx:atomcodes2:1128"></a><a class="pred" href="manipatom.html#atom_codes/2">atom_codes/2</a>,
276276 but <var>CharList</var> is a list of one-character atoms rather than a
277 list of character codes.<sup class="fn">87<span class="fn-text">Up to
278 version 3.2.x, <a id="idx:atomchars2:1128"></a><a class="pred" href="manipatom.html#atom_chars/2">atom_chars/2</a>
279 behaved as the current <a id="idx:atomcodes2:1129"></a><a class="pred" href="manipatom.html#atom_codes/2">atom_codes/2</a>.
277 list of character codes.<sup class="fn">88<span class="fn-text">Up to
278 version 3.2.x, <a id="idx:atomchars2:1129"></a><a class="pred" href="manipatom.html#atom_chars/2">atom_chars/2</a>
279 behaved as the current <a id="idx:atomcodes2:1130"></a><a class="pred" href="manipatom.html#atom_codes/2">atom_codes/2</a>.
280280 The current definition is compliant with the ISO standard.</span></sup>
281281
282282 <pre class="code">
289289 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="char_code/2"><strong>char_code</strong>(<var>?Atom,
290290 ?Code</var>)</a></dt>
291291 <dd class="defbody">
292 Convert between character and character code for a single character.<sup class="fn">88<span class="fn-text">This
292 Convert between character and character code for a single character.<sup class="fn">89<span class="fn-text">This
293293 is also called atom_char/2 in older versions of SWI-Prolog as well as
294294 some other Prolog implementations. The atom_char/2 predicate is
295295 available from the library <code>backcomp.pl</code></span></sup></dd>
296296 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="number_chars/2"><strong>number_chars</strong>(<var>?Number,
297297 ?CharList</var>)</a></dt>
298298 <dd class="defbody">
299 Similar to <a id="idx:atomchars2:1130"></a><a class="pred" href="manipatom.html#atom_chars/2">atom_chars/2</a>,
299 Similar to <a id="idx:atomchars2:1131"></a><a class="pred" href="manipatom.html#atom_chars/2">atom_chars/2</a>,
300300 but converts between a number and its representation as a list of
301301 one-character atoms. Fails with a
302302 <code>syntax_error</code> if <var>Number</var> is unbound or <var>CharList</var>
303303 does not describe a number. Following the ISO standard, it allows for
304304 <em>leading</em> white space (including newlines) and does not allow for
305 <em>trailing</em> white space.<sup class="fn">89<span class="fn-text">ISO
305 <em>trailing</em> white space.<sup class="fn">90<span class="fn-text">ISO
306306 also allows for Prolog comments in leading white space. We--and most
307307 other implementations--believe this is incorrect. We also beleive it
308308 would have been better not to allow for white space, or to allow for
309309 both leading and trailing white space. Prolog syntax-based conversion
310 can be achieved using <a id="idx:format3:1131"></a><a class="pred" href="format.html#format/3">format/3</a>
311 and <a id="idx:readfromchars2:1132"></a><a class="pred" href="charsio.html#read_from_chars/2">read_from_chars/2</a>.</span></sup></dd>
310 can be achieved using <a id="idx:format3:1132"></a><a class="pred" href="format.html#format/3">format/3</a>
311 and <a id="idx:readfromchars2:1133"></a><a class="pred" href="charsio.html#read_from_chars/2">read_from_chars/2</a>.</span></sup></dd>
312312 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="number_codes/2"><strong>number_codes</strong>(<var>?Number,
313313 ?CodeList</var>)</a></dt>
314314 <dd class="defbody">
315 As <a id="idx:numberchars2:1133"></a><a class="pred" href="manipatom.html#number_chars/2">number_chars/2</a>,
315 As <a id="idx:numberchars2:1134"></a><a class="pred" href="manipatom.html#number_chars/2">number_chars/2</a>,
316316 but converts to a list of character codes rather than one-character
317317 atoms. In the mode (-, +), both predicates behave identically to improve
318318 handling of non-ISO source.</dd>
319319 <dt class="pubdef"><a id="atom_number/2"><strong>atom_number</strong>(<var>?Atom,
320320 ?Number</var>)</a></dt>
321321 <dd class="defbody">
322 Realises the popular combination of <a id="idx:atomcodes2:1134"></a><a class="pred" href="manipatom.html#atom_codes/2">atom_codes/2</a>
323 and <a id="idx:numbercodes2:1135"></a><a class="pred" href="manipatom.html#number_codes/2">number_codes/2</a>
322 Realises the popular combination of <a id="idx:atomcodes2:1135"></a><a class="pred" href="manipatom.html#atom_codes/2">atom_codes/2</a>
323 and <a id="idx:numbercodes2:1136"></a><a class="pred" href="manipatom.html#number_codes/2">number_codes/2</a>
324324 to convert between atom and number (integer or float) in one predicate,
325 avoiding the intermediate list. Unlike the ISO <a id="idx:numbercodes2:1136"></a><a class="pred" href="manipatom.html#number_codes/2">number_codes/2</a>
326 predicates, <a id="idx:atomnumber2:1137"></a><a class="pred" href="manipatom.html#atom_number/2">atom_number/2</a>
325 avoiding the intermediate list. Unlike the ISO <a id="idx:numbercodes2:1137"></a><a class="pred" href="manipatom.html#number_codes/2">number_codes/2</a>
326 predicates, <a id="idx:atomnumber2:1138"></a><a class="pred" href="manipatom.html#atom_number/2">atom_number/2</a>
327327 fails silently in mode (+,-) if <var>Atom</var> does not represent a
328 number.<sup class="fn">90<span class="fn-text">Versions prior to 6.1.7
329 raise a syntax error, compliant to <a id="idx:numbercodes2:1138"></a><a class="pred" href="manipatom.html#number_codes/2">number_codes/2</a></span></sup>
330 See also <a id="idx:atomiclistconcat2:1139"></a><a class="pred" href="manipatom.html#atomic_list_concat/2">atomic_list_concat/2</a>
328 number.<sup class="fn">91<span class="fn-text">Versions prior to 6.1.7
329 raise a syntax error, compliant to <a id="idx:numbercodes2:1139"></a><a class="pred" href="manipatom.html#number_codes/2">number_codes/2</a></span></sup>
330 See also <a id="idx:atomiclistconcat2:1140"></a><a class="pred" href="manipatom.html#atomic_list_concat/2">atomic_list_concat/2</a>
331331 for assembling an atom from atoms and numbers.</dd>
332332 <dt class="pubdef"><a id="name/2"><strong>name</strong>(<var>?Atomic,
333333 ?CodeList</var>)</a></dt>
345345 the unquoted print representation of it as a character code list will be
346346 unified with <var>CodeList</var>.
347347
348 <p>Note that it is not possible to produce the atom '300' using <a id="idx:name2:1140"></a><a class="pred" href="manipatom.html#name/2">name/2</a>,
348 <p>Note that it is not possible to produce the atom '300' using <a id="idx:name2:1141"></a><a class="pred" href="manipatom.html#name/2">name/2</a>,
349349 and that <code>name(300, CodeList), name('300', CodeList)</code>
350350 succeeds. For these reasons, new code should consider using the ISO
351 predicates <a id="idx:atomcodes2:1141"></a><a class="pred" href="manipatom.html#atom_codes/2">atom_codes/2</a>
352 or <a id="idx:numbercodes2:1142"></a><a class="pred" href="manipatom.html#number_codes/2">number_codes/2</a>.<sup class="fn">91<span class="fn-text">Unfortunately,
351 predicates <a id="idx:atomcodes2:1142"></a><a class="pred" href="manipatom.html#atom_codes/2">atom_codes/2</a>
352 or <a id="idx:numbercodes2:1143"></a><a class="pred" href="manipatom.html#number_codes/2">number_codes/2</a>.<sup class="fn">92<span class="fn-text">Unfortunately,
353353 the ISO predicates provide no neat way to check that a string can be
354 interpreted as a number. The most sensible way is to use <a id="idx:catch3:1143"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
355 to catch the exception from <a id="idx:numbercodes2:1144"></a><a class="pred" href="manipatom.html#number_codes/2">number_codes/2</a>;
354 interpreted as a number. The most sensible way is to use <a id="idx:catch3:1144"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
355 to catch the exception from <a id="idx:numbercodes2:1145"></a><a class="pred" href="manipatom.html#number_codes/2">number_codes/2</a>;
356356 however, this is both slow and cumbersome. We consider making, e.g., <code>number_codes(N,
357 "abc")</code> fail silently in future versions.</span></sup> See also <a id="idx:atomnumber2:1145"></a><a class="pred" href="manipatom.html#atom_number/2">atom_number/2</a>.</dd>
357 "abc")</code> fail silently in future versions.</span></sup> See also <a id="idx:atomnumber2:1146"></a><a class="pred" href="manipatom.html#atom_number/2">atom_number/2</a>.</dd>
358358 <dt class="pubdef"><a id="term_to_atom/2"><strong>term_to_atom</strong>(<var>?Term,
359359 ?Atom</var>)</a></dt>
360360 <dd class="defbody">
364364 result unified with <var>Term</var>. If <var>Atom</var> has no valid
365365 syntax, a
366366 <code>syntax_error</code> exception is raised. Otherwise <var>Term</var>
367 is ``written'' on <var>Atom</var> using <a id="idx:writeterm2:1146"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>
367 is ``written'' on <var>Atom</var> using <a id="idx:writeterm2:1147"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>
368368 with the option
369 <code>quoted(true)</code>. See also <a id="idx:format3:1147"></a><a class="pred" href="format.html#format/3">format/3</a>, <a id="idx:withoutputto2:1148"></a><a class="pred" href="IO.html#with_output_to/2">with_output_to/2</a>
369 <code>quoted(true)</code>. See also <a id="idx:format3:1148"></a><a class="pred" href="format.html#format/3">format/3</a>, <a id="idx:withoutputto2:1149"></a><a class="pred" href="IO.html#with_output_to/2">with_output_to/2</a>
370370 and
371 <a id="idx:termstring2:1149"></a><a class="pred" href="strings.html#term_string/2">term_string/2</a>.</dd>
371 <a id="idx:termstring2:1150"></a><a class="pred" href="strings.html#term_string/2">term_string/2</a>.</dd>
372372 <dt class="pubdef"><span class="pred-tag">[deprecated]</span><a id="atom_to_term/3"><strong>atom_to_term</strong>(<var>+Atom,
373373 -Term, -Bindings</var>)</a></dt>
374374 <dd class="defbody">
375 Use <var>Atom</var> as input to <a id="idx:readterm2:1150"></a><a class="pred" href="termrw.html#read_term/2">read_term/2</a>
375 Use <var>Atom</var> as input to <a id="idx:readterm2:1151"></a><a class="pred" href="termrw.html#read_term/2">read_term/2</a>
376376 using the option
377377 <code>variable_names</code> and return the read term in <var>Term</var>
378378 and the variable bindings in <var>Bindings</var>. <var>Bindings</var> is
379379 a list of
380380 <var><var>Name</var> = <var>Var</var></var> couples, thus providing
381 access to the actual variable names. See also <a id="idx:readterm2:1151"></a><a class="pred" href="termrw.html#read_term/2">read_term/2</a>.
381 access to the actual variable names. See also <a id="idx:readterm2:1152"></a><a class="pred" href="termrw.html#read_term/2">read_term/2</a>.
382382 If <var>Atom</var> has no valid syntax, a <code>syntax_error</code>
383383 exception is raised. New code should use
384 <a id="idx:readtermfromatom3:1152"></a><a class="pred" href="termrw.html#read_term_from_atom/3">read_term_from_atom/3</a>.</dd>
384 <a id="idx:readtermfromatom3:1153"></a><a class="pred" href="termrw.html#read_term_from_atom/3">read_term_from_atom/3</a>.</dd>
385385 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="atom_concat/3"><strong>atom_concat</strong>(<var>?Atom1,
386386 ?Atom2, ?Atom3</var>)</a></dt>
387387 <dd class="defbody">
388388 <var>Atom3</var> forms the concatenation of <var>Atom1</var> and <var>Atom2</var>.
389389 At least two of the arguments must be instantiated to atoms. This
390390 predicate also allows for the mode (-,-,+), non-deterministically
391 splitting the 3rd argument into two parts (as <a id="idx:append3:1153"></a><a class="pred" href="lists.html#append/3">append/3</a>
391 splitting the 3rd argument into two parts (as <a id="idx:append3:1154"></a><a class="pred" href="lists.html#append/3">append/3</a>
392392 does for lists). SWI-Prolog allows for atomic arguments. Portable code
393 must use <a id="idx:atomicconcat3:1154"></a><a class="pred" href="manipatom.html#atomic_concat/3">atomic_concat/3</a>
393 must use <a id="idx:atomicconcat3:1155"></a><a class="pred" href="manipatom.html#atomic_concat/3">atomic_concat/3</a>
394394 if non-atom arguments are involved.</dd>
395395 <dt class="pubdef"><a id="atomic_concat/3"><strong>atomic_concat</strong>(<var>+Atomic1,
396396 +Atomic2, -Atom</var>)</a></dt>
415415 <dt class="pubdef"><span class="pred-tag">[commons]</span><a id="atomic_list_concat/3"><strong>atomic_list_concat</strong>(<var>+List,
416416 +Separator, -Atom</var>)</a></dt>
417417 <dd class="defbody">
418 Creates an atom just like <a id="idx:atomiclistconcat2:1155"></a><a class="pred" href="manipatom.html#atomic_list_concat/2">atomic_list_concat/2</a>,
418 Creates an atom just like <a id="idx:atomiclistconcat2:1156"></a><a class="pred" href="manipatom.html#atomic_list_concat/2">atomic_list_concat/2</a>,
419419 but inserts <var>Separator</var> between each pair of inputs. For
420420 example:
421421
428428 <p>The SWI-Prolog version of this predicate can also be used to split
429429 atoms by instantiating <var>Separator</var> and <var>Atom</var> as shown
430430 below. We kept this functionality to simplify porting old SWI-Prolog
431 code where this predicate was called <a id="idx:concatatom3:1156"></a><span class="pred-ext">concat_atom/3</span>.
431 code where this predicate was called <a id="idx:concatatom3:1157"></a><span class="pred-ext">concat_atom/3</span>.
432432 When used in mode (-,+,+),
433 <var>Separator</var> must be a non-empty atom. See also <a id="idx:splitstring4:1157"></a><a class="pred" href="strings.html#split_string/4">split_string/4</a>.
433 <var>Separator</var> must be a non-empty atom. See also <a id="idx:splitstring4:1158"></a><a class="pred" href="strings.html#split_string/4">split_string/4</a>.
434434
435435 <pre class="code">
436436 ?- atomic_list_concat(L, -, 'gnu-gnat').
445445 True if <var>Atom</var> is an atom of <var>Length</var> characters. The
446446 SWI-Prolog version accepts all atomic types, as well as code-lists and
447447 character-lists. New code should avoid this feature and use
448 <a id="idx:writelength3:1158"></a><a class="pred" href="termrw.html#write_length/3">write_length/3</a>
448 <a id="idx:writelength3:1159"></a><a class="pred" href="termrw.html#write_length/3">write_length/3</a>
449449 to get the number of characters that would be written if the argument
450 was handed to <a id="idx:writeterm3:1159"></a><a class="pred" href="termrw.html#write_term/3">write_term/3</a>.</dd>
450 was handed to <a id="idx:writeterm3:1160"></a><a class="pred" href="termrw.html#write_term/3">write_term/3</a>.</dd>
451451 <dt class="pubdef"><span class="pred-tag">[deprecated]</span><a id="atom_prefix/2"><strong>atom_prefix</strong>(<var>+Atom,
452452 +Prefix</var>)</a></dt>
453453 <dd class="defbody">
482482 letters in <var>Needle</var> only match themselves, while lowercase
483483 letters in <var>Needle</var> match case insensitively. <var>Start</var>
484484 is the first 0-based offset inside <var>Haystack</var> where <var>Needle</var>
485 matches.<sup class="fn">92<span class="fn-text">This predicate replaces $apropos_match/2,
485 matches.<sup class="fn">93<span class="fn-text">This predicate replaces $apropos_match/2,
486486 used by the help system, while extending it with locating the (first)
487487 match and performing case insensitive prefix matching. We are still not
488488 happy with the name and interface.</span></sup>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 6.14</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 6.14</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
301301 indicators are in canonical form (i.e., always using name/arity and
302302 never the DCG form name//arity). Future versions may also use the DCG
303303 form and include public operators. See also
304 <a id="idx:predicateproperty2:1602"></a><a class="pred" href="examineprog.html#predicate_property/2">predicate_property/2</a>.
304 <a id="idx:predicateproperty2:1604"></a><a class="pred" href="examineprog.html#predicate_property/2">predicate_property/2</a>.
305305 </dd>
306306 <dt><strong>exported_operators</strong>(<var>-ListOfOperators</var>)</dt>
307307 <dd class="defbody">
317317 <dt><strong>program_space</strong>(<var>-Bytes</var>)</dt>
318318 <dd class="defbody">
319319 If present, this number limits the <code>program_size</code>. See
320 <a id="idx:setmodule1:1603"></a><a class="pred" href="manipmodule.html#set_module/1">set_module/1</a>.
320 <a id="idx:setmodule1:1605"></a><a class="pred" href="manipmodule.html#set_module/1">set_module/1</a>.
321321 </dd>
322322 </dl>
323323
337337 </dd>
338338 <dt><strong>class</strong>(<var>+Class</var>)</dt>
339339 <dd class="defbody">
340 Set the class of the module. See <a id="idx:moduleproperty2:1604"></a><a class="pred" href="manipmodule.html#module_property/2">module_property/2</a>.
340 Set the class of the module. See <a id="idx:moduleproperty2:1606"></a><a class="pred" href="manipmodule.html#module_property/2">module_property/2</a>.
341341 </dd>
342342 <dt><strong>program_space</strong>(<var>+Bytes</var>)</dt>
343343 <dd class="defbody">
345345 module. Raises a permission error if the current usage is above the
346346 requested limit. Setting the limit to 0 (zero) removes the limit. An
347347 attempt to assert clauses that causes the limit to be exceeded causes a
348 <code>resource_error(program_space)</code> exception. See <a id="idx:assertz1:1605"></a><a class="pred" href="db.html#assertz/1">assertz/1</a>
348 <code>resource_error(program_space)</code> exception. See <a id="idx:assertz1:1607"></a><a class="pred" href="db.html#assertz/1">assertz/1</a>
349349 and
350 <a id="idx:moduleproperty2:1606"></a><a class="pred" href="manipmodule.html#module_property/2">module_property/2</a>.
350 <a id="idx:moduleproperty2:1608"></a><a class="pred" href="manipmodule.html#module_property/2">module_property/2</a>.
351351 </dd>
352352 </dl>
353353
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section B.1</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section B.1</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
248248 <dd class="defbody">
249249 Unify <var>Choice</var> with an integer provided a reference to the last
250250 choice point. Fails if the current environment has no choice points. See
251 also <a id="idx:prologchoiceattribute3:1981"></a><a class="pred" href="manipstack.html#prolog_choice_attribute/3">prolog_choice_attribute/3</a>.</dd>
251 also <a id="idx:prologchoiceattribute3:1984"></a><a class="pred" href="manipstack.html#prolog_choice_attribute/3">prolog_choice_attribute/3</a>.</dd>
252252 <dt class="pubdef"><a id="prolog_frame_attribute/3"><strong>prolog_frame_attribute</strong>(<var>+Frame,
253253 +Key, :Value</var>)</a></dt>
254254 <dd class="defbody">
255255 Obtain information about the local stack frame <var>Frame</var>. <var>Frame</var>
256 is a frame reference as obtained through <a id="idx:prologcurrentframe1:1982"></a><a class="pred" href="manipstack.html#prolog_current_frame/1">prolog_current_frame/1</a>,
257 <a id="idx:prologtraceinterception4:1983"></a><a class="pred" href="tracehook.html#prolog_trace_interception/4">prolog_trace_interception/4</a>
256 is a frame reference as obtained through <a id="idx:prologcurrentframe1:1985"></a><a class="pred" href="manipstack.html#prolog_current_frame/1">prolog_current_frame/1</a>,
257 <a id="idx:prologtraceinterception4:1986"></a><a class="pred" href="tracehook.html#prolog_trace_interception/4">prolog_trace_interception/4</a>
258258 or this predicate. The key values are described below.
259259
260260 <dl class="latex">
274274 context, the goal is represented as <code>&lt;<var>module</var>&gt;:&lt;<var>goal</var>&gt;</code>.
275275 Do not instantiate variables in this goal unless you <b>know</b> what
276276 you are doing! Note that the returned term may contain references to the
277 frame and should be discarded before the frame terminates.<sup class="fn">161<span class="fn-text">The
277 frame and should be discarded before the frame terminates.<sup class="fn">164<span class="fn-text">The
278278 returned term is actually an illegal Prolog term that may hold
279279 references from the global to the local stack to preserve the variable
280280 names.</span></sup></dd>
296296 <dd class="defbody">
297297 <var>Value</var> is unified with a reference to the currently running
298298 clause. Fails if the current goal is associated with a foreign (C)
299 defined predicate. See also <a id="idx:nthclause3:1984"></a><a class="pred" href="examineprog.html#nth_clause/3">nth_clause/3</a>
300 and <a id="idx:clauseproperty2:1985"></a><a class="pred" href="examineprog.html#clause_property/2">clause_property/2</a>.</dd>
299 defined predicate. See also <a id="idx:nthclause3:1987"></a><a class="pred" href="examineprog.html#nth_clause/3">nth_clause/3</a>
300 and <a id="idx:clauseproperty2:1988"></a><a class="pred" href="examineprog.html#clause_property/2">clause_property/2</a>.</dd>
301301 <dt><strong>level</strong></dt>
302302 <dd class="defbody">
303303 <var>Value</var> is unified with the recursion level of <var>Frame</var>.
345345 +Key, -Value</var>)</a></dt>
346346 <dd class="defbody">
347347 Extract attributes of a choice point. <var>ChoicePoint</var> is a
348 reference to a choice point as passed to <a id="idx:prologtraceinterception4:1986"></a><a class="pred" href="tracehook.html#prolog_trace_interception/4">prolog_trace_interception/4</a>
349 on the 3rd argument or obtained using <a id="idx:prologcurrentchoice1:1987"></a><a class="pred" href="manipstack.html#prolog_current_choice/1">prolog_current_choice/1</a>. <var>Key</var>
348 reference to a choice point as passed to <a id="idx:prologtraceinterception4:1989"></a><a class="pred" href="tracehook.html#prolog_trace_interception/4">prolog_trace_interception/4</a>
349 on the 3rd argument or obtained using <a id="idx:prologcurrentchoice1:1990"></a><a class="pred" href="manipstack.html#prolog_current_choice/1">prolog_current_choice/1</a>. <var>Key</var>
350350 specifies the requested information:
351351
352352 <dl class="latex">
363363 Requests the type. Defined values are <code>clause</code> (the goal has
364364 alternative clauses), <code>foreign</code> (non-deterministic foreign
365365 predicate), <code>jump</code> (clause internal choice point), <code>top</code>
366 (first dummy choice point), <code>catch</code> (<a id="idx:catch3:1988"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
366 (first dummy choice point), <code>catch</code> (<a id="idx:catch3:1991"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
367367 to allow for undo),
368368 <code>debug</code> (help the debugger), or <code>none</code> (has been
369369 deleted).
378378 that is more recent than the entry of the clause in which it appears.
379379 There are few realistic situations for using this predicate. It is used
380380 by the
381 <a id="idx:prolog0:1989"></a><a class="pred" href="toplevel.html#prolog/0">prolog/0</a>
381 <a id="idx:prolog0:1992"></a><a class="pred" href="toplevel.html#prolog/0">prolog/0</a>
382382 top level to check whether Prolog should prompt the user for
383383 alternatives. Similar results can be achieved in a more portable fashion
384 using <a id="idx:callcleanup2:1990"></a><a class="pred" href="metacall.html#call_cleanup/2">call_cleanup/2</a>.
384 using <a id="idx:callcleanup2:1993"></a><a class="pred" href="metacall.html#call_cleanup/2">call_cleanup/2</a>.
385385 </dd>
386386 </dl>
387387
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.20</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.20</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
254254 (see
255255 <a class="sec" href="extensions.html">section 5</a>. Such terms must be
256256 processed using
257 <a id="idx:compoundnamearity3:1073"></a><a class="pred" href="manipterm.html#compound_name_arity/3">compound_name_arity/3</a>.
258 The predicate <a id="idx:functor3:1074"></a><a class="pred" href="manipterm.html#functor/3">functor/3</a>
257 <a id="idx:compoundnamearity3:1074"></a><a class="pred" href="manipterm.html#compound_name_arity/3">compound_name_arity/3</a>.
258 The predicate <a id="idx:functor3:1075"></a><a class="pred" href="manipterm.html#functor/3">functor/3</a>
259259 and <a class="pred" href="manipterm.html#=../2">=../2</a> raise a <code>domain_error</code>
260260 when faced with these terms. Without this precaution, the inconsistency
261 demonstrated below could happen silently.<sup class="fn">83<span class="fn-text">Raising
261 demonstrated below could happen silently.<sup class="fn">84<span class="fn-text">Raising
262262 a domain error was suggested by Jeff Schultz.</span></sup>
263263
264264 <pre class="code">
279279 be unbound. In this case <var>Value</var> will be unified with the
280280 successive arguments of the term. On successful unification, <var>Arg</var>
281281 is unified with the argument number. Backtracking yields alternative
282 solutions.<sup class="fn">84<span class="fn-text">The instantiation
282 solutions.<sup class="fn">85<span class="fn-text">The instantiation
283283 pattern (-, +, ?) is an extension to `standard' Prolog. Some systems
284 provide genarg/3 that covers this pattern.</span></sup> The predicate <a id="idx:arg3:1075"></a><a class="pred" href="manipterm.html#arg/3">arg/3</a>
284 provide genarg/3 that covers this pattern.</span></sup> The predicate <a id="idx:arg3:1076"></a><a class="pred" href="manipterm.html#arg/3">arg/3</a>
285285 fails silently if <var><var>Arg</var> = 0</var> or
286286 <var><var>Arg</var> &gt; <em>arity</em></var> and raises the exception
287287 <code>domain_error(not_less_than_zero, <var>Arg</var>)</code> if <var><var>Arg</var>
305305 (see
306306 <a class="sec" href="extensions.html">section 5</a>. Such terms must be
307307 processed using
308 <a id="idx:compoundnamearguments3:1076"></a><a class="pred" href="manipterm.html#compound_name_arguments/3">compound_name_arguments/3</a>.
309 This predicate raises a domain error as shown below. See also <a id="idx:functor3:1077"></a><a class="pred" href="manipterm.html#functor/3">functor/3</a>.
308 <a id="idx:compoundnamearguments3:1077"></a><a class="pred" href="manipterm.html#compound_name_arguments/3">compound_name_arguments/3</a>.
309 This predicate raises a domain error as shown below. See also <a id="idx:functor3:1078"></a><a class="pred" href="manipterm.html#functor/3">functor/3</a>.
310310
311311 <pre class="code">
312312 ?- a() =.. L.
317317 <dt class="pubdef"><a id="compound_name_arity/3"><strong>compound_name_arity</strong>(<var>?Compound,
318318 ?Name, ?Arity</var>)</a></dt>
319319 <dd class="defbody">
320 Rationalized version of <a id="idx:functor3:1078"></a><a class="pred" href="manipterm.html#functor/3">functor/3</a>
320 Rationalized version of <a id="idx:functor3:1079"></a><a class="pred" href="manipterm.html#functor/3">functor/3</a>
321321 that only works for compound terms and can examine and create compound
322322 terms with zero arguments (e.g,
323 <code>name()</code>. See also <a id="idx:compoundnamearguments3:1079"></a><a class="pred" href="manipterm.html#compound_name_arguments/3">compound_name_arguments/3</a>.</dd>
323 <code>name()</code>. See also <a id="idx:compoundnamearguments3:1080"></a><a class="pred" href="manipterm.html#compound_name_arguments/3">compound_name_arguments/3</a>.</dd>
324324 <dt class="pubdef"><a id="compound_name_arguments/3"><strong>compound_name_arguments</strong>(<var>?Compound,
325325 ?Name, ?Arguments</var>)</a></dt>
326326 <dd class="defbody">
327327 Rationalized version of <a class="pred" href="manipterm.html#=../2">=../2</a>
328328 that can compose and decompose compound terms with zero arguments. See
329 also <a id="idx:compoundnamearity3:1080"></a><a class="pred" href="manipterm.html#compound_name_arity/3">compound_name_arity/3</a>.</dd>
329 also <a id="idx:compoundnamearity3:1081"></a><a class="pred" href="manipterm.html#compound_name_arity/3">compound_name_arity/3</a>.</dd>
330330 <dt class="pubdef"><a id="numbervars/3"><strong>numbervars</strong>(<var>+Term,
331331 +Start, -End</var>)</a></dt>
332332 <dd class="defbody">
333333 Unify the free variables in <var>Term</var> with a term <code>$VAR(N)</code>,
334334 where <var>N</var> is the number of the variable. Counting starts at
335335 <var>Start</var>. <var>End</var> is unified with the number that should
336 be given to the next variable. The example below illustrates this. Note
337 that the toplevel prints <code>'$VAR'(0)</code> as <var>A</var> due to
338 the
336 be given to the next variable.<sup class="fn">bug<span class="fn-text">Only <em>tagged
337 integers</em> are supported (see the Prolog flag <a class="flag" href="flags.html#flag:max_tagged_integer">max_tagged_integer</a>).
338 This suffices to count all variables that can appear in the largest term
339 that can be represented, but does not support arbitrary large integer
340 values for <var>Start</var>. On overflow, a <code>representation_error(tagged_integer)</code>
341 exception is raised.</span></sup> The example below illustrates this.
342 Note that the toplevel prints <code>'$VAR'(0)</code> as <var>A</var> due
343 to the
339344 <code>numbervars(true)</code> option used to print answers.
340345
341346 <pre class="code">
342 ?- Term = foo(X,Y,Z),
347 ?- Term = f(X,Y,X),
343348 numbervars(Term, 0, End),
344349 write_canonical(Term), nl.
345 foo('$VAR'(0),'$VAR'(1),'$VAR'(0))
346 Term = foo(A, B, A),
350 f('$VAR'(0),'$VAR'(1),'$VAR'(0))
351 Term = f(A, B, A),
347352 X = A,
348353 Y = B,
349354 End = 2.
350355 </pre>
351356
352 <p>See also the <code>numbervars</code> option to <a id="idx:writeterm3:1081"></a><a class="pred" href="termrw.html#write_term/3">write_term/3</a>
353 and <a id="idx:numbervars4:1082"></a><a class="pred" href="manipterm.html#numbervars/4">numbervars/4</a>.</dd>
357 <p>See also the <code>numbervars</code> option to <a id="idx:writeterm3:1082"></a><a class="pred" href="termrw.html#write_term/3">write_term/3</a>
358 and <a id="idx:numbervars4:1083"></a><a class="pred" href="manipterm.html#numbervars/4">numbervars/4</a>.</dd>
354359 <dt class="pubdef"><a id="numbervars/4"><strong>numbervars</strong>(<var>+Term,
355360 +Start, -End, +Options</var>)</a></dt>
356361 <dd class="defbody">
357 As <a id="idx:numbervars3:1083"></a><a class="pred" href="manipterm.html#numbervars/3">numbervars/3</a>,
358 but providing the following options:
362 As <a id="idx:numbervars3:1084"></a><a class="pred" href="manipterm.html#numbervars/3">numbervars/3</a>,
363 providing the following options:
359364
360365 <dl class="latex">
361366 <dt><strong>functor_name</strong>(<var>+Atom</var>)</dt>
364369 <dt><strong>attvar</strong>(<var>+Action</var>)</dt>
365370 <dd class="defbody">
366371 What to do if an attributed variable is encountered. Options are
367 <code>skip</code>, which causes <a id="idx:numbervars3:1084"></a><a class="pred" href="manipterm.html#numbervars/3">numbervars/3</a>
372 <code>skip</code>, which causes <a id="idx:numbervars3:1085"></a><a class="pred" href="manipterm.html#numbervars/3">numbervars/3</a>
368373 to ignore the attributed variable, <code>bind</code> which causes it to
369374 thread it as a normal variable and assign the next <code>'$VAR'</code>(N)
370375 term to it, or (default)
371 <code>error</code> which raises a <code>type_error</code> exception.<sup class="fn">85<span class="fn-text">This
376 <code>error</code> which raises a <code>type_error</code> exception.<sup class="fn">86<span class="fn-text">This
372377 behaviour was decided after a long discussion between David Reitter,
373378 Richard O'Keefe, Bart Demoen and Tom Schrijvers.</span></sup></dd>
374379 <dt><strong>singletons</strong>(<var>+Bool</var>)</dt>
375380 <dd class="defbody">
376 If <code>true</code> (default <code>false</code>), <a id="idx:numbervars4:1085"></a><a class="pred" href="manipterm.html#numbervars/4">numbervars/4</a>
381 If <code>true</code> (default <code>false</code>), <a id="idx:numbervars4:1086"></a><a class="pred" href="manipterm.html#numbervars/4">numbervars/4</a>
377382 does singleton detection. Singleton variables are unified with <code>'$VAR'('_')</code>,
378 causing them to be printed as <code>_</code> by <a id="idx:writeterm2:1086"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>
379 using the numbervars option. This option is exploited by <a id="idx:portrayclause2:1087"></a><a class="pred" href="listing.html#portray_clause/2">portray_clause/2</a>
380 and <a id="idx:writecanonical2:1088"></a><a class="pred" href="termrw.html#write_canonical/2">write_canonical/2</a>.<sup class="fn">bug<span class="fn-text">Currently
383 causing them to be printed as <code>_</code> by <a id="idx:writeterm2:1087"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>
384 using the numbervars option. This option is exploited by <a id="idx:portrayclause2:1088"></a><a class="pred" href="listing.html#portray_clause/2">portray_clause/2</a>
385 and <a id="idx:writecanonical2:1089"></a><a class="pred" href="termrw.html#write_canonical/2">write_canonical/2</a>.<sup class="fn">bug<span class="fn-text">Currently
381386 this option is ignored for cyclic terms.</span></sup>
382387 </dd>
383388 </dl>
386391 <dt class="pubdef"><a id="var_number/2"><strong>var_number</strong>(<var>@Term,
387392 -VarNumber</var>)</a></dt>
388393 <dd class="defbody">
389 True if <var>Term</var> is numbered by <a id="idx:numbervars3:1089"></a><a class="pred" href="manipterm.html#numbervars/3">numbervars/3</a>
394 True if <var>Term</var> is numbered by <a id="idx:numbervars3:1090"></a><a class="pred" href="manipterm.html#numbervars/3">numbervars/3</a>
390395 and <var>VarNumber</var> is the number given to this variable. This
391396 predicate avoids the need for unification with <code>'$VAR'(X)</code>
392397 and opens the path for replacing this valid Prolog term by an internal
395400 -List</var>)</a></dt>
396401 <dd class="defbody">
397402 Unify <var>List</var> with a list of variables, each sharing with a
398 unique variable of <var>Term</var>.<sup class="fn">86<span class="fn-text">This
399 predicate used to be called free_variables/2 . The name <a id="idx:termvariables2:1090"></a><a class="pred" href="manipterm.html#term_variables/2">term_variables/2</a>
403 unique variable of <var>Term</var>.<sup class="fn">87<span class="fn-text">This
404 predicate used to be called free_variables/2 . The name <a id="idx:termvariables2:1091"></a><a class="pred" href="manipterm.html#term_variables/2">term_variables/2</a>
400405 is more widely used. The old predicate is still available from the
401406 library <code>library(backcomp)</code>.</span></sup> The variables in <var>List</var>
402407 are ordered in order of appearance traversing <var>Term</var>
403408 depth-first and left-to-right. See also
404 <a id="idx:termvariables3:1091"></a><a class="pred" href="manipterm.html#term_variables/3">term_variables/3</a>.
409 <a id="idx:termvariables3:1092"></a><a class="pred" href="manipterm.html#term_variables/3">term_variables/3</a>.
405410 For example:
406411
407412 <pre class="code">
413418 <dt class="pubdef"><a id="term_variables/3"><strong>term_variables</strong>(<var>+Term,
414419 -List, ?Tail</var>)</a></dt>
415420 <dd class="defbody">
416 Difference list version of <a id="idx:termvariables2:1092"></a><a class="pred" href="manipterm.html#term_variables/2">term_variables/2</a>.
421 Difference list version of <a id="idx:termvariables2:1093"></a><a class="pred" href="manipterm.html#term_variables/2">term_variables/2</a>.
417422 That is, <var>Tail</var> is the tail of the variable list <var>List</var>.</dd>
418423 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="copy_term/2"><strong>copy_term</strong>(<var>+In,
419424 -Out</var>)</a></dt>
420425 <dd class="defbody">
421426 Create a version of <var>In</var> with renamed (fresh) variables and
422427 unify it to <var>Out</var>. Attributed variables (see <a class="sec" href="attvar.html">section
423 7.1</a>) have their attributes copied. The implementation of <a id="idx:copyterm2:1093"></a><a class="pred" href="manipterm.html#copy_term/2">copy_term/2</a>
428 7.1</a>) have their attributes copied. The implementation of <a id="idx:copyterm2:1094"></a><a class="pred" href="manipterm.html#copy_term/2">copy_term/2</a>
424429 can deal with infinite trees (cyclic terms). As pure Prolog cannot
425430 distinguish a ground term from another ground term with exactly the same
426431 structure, ground sub-terms are <em>shared</em> between <var>In</var>
427 and <var>Out</var>. Sharing ground terms does affect <a id="idx:setarg3:1094"></a><a class="pred" href="manipterm.html#setarg/3">setarg/3</a>.
432 and <var>Out</var>. Sharing ground terms does affect <a id="idx:setarg3:1095"></a><a class="pred" href="manipterm.html#setarg/3">setarg/3</a>.
428433 SWI-Prolog provides
429 <a id="idx:duplicateterm2:1095"></a><a class="pred" href="manipterm.html#duplicate_term/2">duplicate_term/2</a>
434 <a id="idx:duplicateterm2:1096"></a><a class="pred" href="manipterm.html#duplicate_term/2">duplicate_term/2</a>
430435 to create a true copy of a term.
431436 </dd>
432437 </dl>
450455 Extra-logical predicate. Assigns the <var>Arg</var>-th argument of the
451456 compound term <var>Term</var> with the given <var>Value</var>. The
452457 assignment is undone if backtracking brings the state back into a
453 position before the <a id="idx:setarg3:1096"></a><a class="pred" href="manipterm.html#setarg/3">setarg/3</a>
454 call. See also <a id="idx:nbsetarg3:1097"></a><a class="pred" href="manipterm.html#nb_setarg/3">nb_setarg/3</a>.
458 position before the <a id="idx:setarg3:1097"></a><a class="pred" href="manipterm.html#setarg/3">setarg/3</a>
459 call. See also <a id="idx:nbsetarg3:1098"></a><a class="pred" href="manipterm.html#nb_setarg/3">nb_setarg/3</a>.
455460
456461 <p>This predicate may be used for destructive assignment to terms, using
457462 them as an extra-logical storage bin. Always try hard to avoid the use
458 of <a id="idx:setarg3:1098"></a><a class="pred" href="manipterm.html#setarg/3">setarg/3</a>
463 of <a id="idx:setarg3:1099"></a><a class="pred" href="manipterm.html#setarg/3">setarg/3</a>
459464 as it is not supported by many Prolog systems and one has to be very
460465 careful about unexpected copying as well as unexpected noncopying of
461466 terms. A good practice to improve somewhat on this situation is to make
462 sure that terms whose arguments are subject to <a id="idx:setarg3:1099"></a><a class="pred" href="manipterm.html#setarg/3">setarg/3</a>
467 sure that terms whose arguments are subject to <a id="idx:setarg3:1100"></a><a class="pred" href="manipterm.html#setarg/3">setarg/3</a>
463468 have one unused and unshared variable in addition to the used arguments.
464 This variable avoids unwanted sharing in, e.g., <a id="idx:copyterm2:1100"></a><a class="pred" href="manipterm.html#copy_term/2">copy_term/2</a>,
469 This variable avoids unwanted sharing in, e.g., <a id="idx:copyterm2:1101"></a><a class="pred" href="manipterm.html#copy_term/2">copy_term/2</a>,
465470 and causes the term to be considered as non-ground.</dd>
466471 <dt class="pubdef"><a id="nb_setarg/3"><strong>nb_setarg</strong>(<var>+Arg,
467472 +Term, +Value</var>)</a></dt>
468473 <dd class="defbody">
469474 Assigns the <var>Arg</var>-th argument of the compound term <var>Term</var>
470 with the given <var>Value</var> as <a id="idx:setarg3:1101"></a><a class="pred" href="manipterm.html#setarg/3">setarg/3</a>,
475 with the given <var>Value</var> as <a id="idx:setarg3:1102"></a><a class="pred" href="manipterm.html#setarg/3">setarg/3</a>,
471476 but on backtracking the assignment is <em>not</em> reversed. If <var>Value</var>
472 is not atomic, it is duplicated using <a id="idx:duplicateterm2:1102"></a><a class="pred" href="manipterm.html#duplicate_term/2">duplicate_term/2</a>.
477 is not atomic, it is duplicated using <a id="idx:duplicateterm2:1103"></a><a class="pred" href="manipterm.html#duplicate_term/2">duplicate_term/2</a>.
473478 This predicate uses the same technique as
474 <a id="idx:nbsetval2:1103"></a><a class="pred" href="gvar.html#nb_setval/2">nb_setval/2</a>.
475 We therefore refer to the description of <a id="idx:nbsetval2:1104"></a><a class="pred" href="gvar.html#nb_setval/2">nb_setval/2</a>
479 <a id="idx:nbsetval2:1104"></a><a class="pred" href="gvar.html#nb_setval/2">nb_setval/2</a>.
480 We therefore refer to the description of <a id="idx:nbsetval2:1105"></a><a class="pred" href="gvar.html#nb_setval/2">nb_setval/2</a>
476481 for details on non-backtrackable assignment of terms. This predicate is
477482 compatible with GNU-Prolog <code>setarg(A,T,V,false)</code>, removing
478 the type restriction on <var>Value</var>. See also <a id="idx:nblinkarg3:1105"></a><a class="pred" href="manipterm.html#nb_linkarg/3">nb_linkarg/3</a>.
483 the type restriction on <var>Value</var>. See also <a id="idx:nblinkarg3:1106"></a><a class="pred" href="manipterm.html#nb_linkarg/3">nb_linkarg/3</a>.
479484 Below is an example for counting the number of solutions of a goal. Note
480485 that this implementation is thread-safe, reentrant and capable of
481486 handling exceptions. Realising these features with a traditional
482 implementation based on assert/retract or <a id="idx:flag3:1106"></a><a class="pred" href="db.html#flag/3">flag/3</a>
487 implementation based on assert/retract or <a id="idx:flag3:1107"></a><a class="pred" href="db.html#flag/3">flag/3</a>
483488 is much more complicated.
484489
485490 <pre class="code">
501506 <dt class="pubdef"><a id="nb_linkarg/3"><strong>nb_linkarg</strong>(<var>+Arg,
502507 +Term, +Value</var>)</a></dt>
503508 <dd class="defbody">
504 As <a id="idx:nbsetarg3:1107"></a><a class="pred" href="manipterm.html#nb_setarg/3">nb_setarg/3</a>,
505 but like <a id="idx:nblinkval2:1108"></a><a class="pred" href="gvar.html#nb_linkval/2">nb_linkval/2</a>
509 As <a id="idx:nbsetarg3:1108"></a><a class="pred" href="manipterm.html#nb_setarg/3">nb_setarg/3</a>,
510 but like <a id="idx:nblinkval2:1109"></a><a class="pred" href="gvar.html#nb_linkval/2">nb_linkval/2</a>
506511 it does <em>not</em> duplicate
507 <var>Value</var>. Use with extreme care and consult the documentation of <a id="idx:nblinkval2:1109"></a><a class="pred" href="gvar.html#nb_linkval/2">nb_linkval/2</a>
512 <var>Value</var>. Use with extreme care and consult the documentation of <a id="idx:nblinkval2:1110"></a><a class="pred" href="gvar.html#nb_linkval/2">nb_linkval/2</a>
508513 before use.</dd>
509514 <dt class="pubdef"><a id="duplicate_term/2"><strong>duplicate_term</strong>(<var>+In,
510515 -Out</var>)</a></dt>
511516 <dd class="defbody">
512 Version of <a id="idx:copyterm2:1110"></a><a class="pred" href="manipterm.html#copy_term/2">copy_term/2</a>
517 Version of <a id="idx:copyterm2:1111"></a><a class="pred" href="manipterm.html#copy_term/2">copy_term/2</a>
513518 that also copies ground terms and therefore ensures that destructive
514 modification using <a id="idx:setarg3:1111"></a><a class="pred" href="manipterm.html#setarg/3">setarg/3</a>
515 does not affect the copy. See also <a id="idx:nbsetval2:1112"></a><a class="pred" href="gvar.html#nb_setval/2">nb_setval/2</a>, <a id="idx:nblinkval2:1113"></a><a class="pred" href="gvar.html#nb_linkval/2">nb_linkval/2</a>, <a id="idx:nbsetarg3:1114"></a><a class="pred" href="manipterm.html#nb_setarg/3">nb_setarg/3</a>
516 and <a id="idx:nblinkarg3:1115"></a><a class="pred" href="manipterm.html#nb_linkarg/3">nb_linkarg/3</a>.</dd>
519 modification using <a id="idx:setarg3:1112"></a><a class="pred" href="manipterm.html#setarg/3">setarg/3</a>
520 does not affect the copy. See also <a id="idx:nbsetval2:1113"></a><a class="pred" href="gvar.html#nb_setval/2">nb_setval/2</a>, <a id="idx:nblinkval2:1114"></a><a class="pred" href="gvar.html#nb_linkval/2">nb_linkval/2</a>, <a id="idx:nbsetarg3:1115"></a><a class="pred" href="manipterm.html#nb_setarg/3">nb_setarg/3</a>
521 and <a id="idx:nblinkarg3:1116"></a><a class="pred" href="manipterm.html#nb_linkarg/3">nb_linkarg/3</a>.</dd>
517522 <dt class="pubdef"><span class="pred-tag">[semidet]</span><a id="same_term/2"><strong>same_term</strong>(<var>@T1,
518523 @T2</var>)</a></dt>
519524 <dd class="defbody">
520525 True if <var>T1</var> and <var>T2</var> are equivalent and will remain
521 equivalent, even if <a id="idx:setarg3:1116"></a><a class="pred" href="manipterm.html#setarg/3">setarg/3</a>
526 equivalent, even if <a id="idx:setarg3:1117"></a><a class="pred" href="manipterm.html#setarg/3">setarg/3</a>
522527 is used on either of them. This means
523528 <var>T1</var> and <var>T2</var> are the same variable, equivalent atomic
524529 data or a compound term allocated at the same address.
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.40</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.40</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
244244 garbage collector is invoked automatically if necessary. Explicit
245245 invocation might be useful to reduce the need for garbage collections in
246246 time-critical segments of the code. After the garbage collection
247 <a id="idx:trimstacks0:1428"></a><a class="pred" href="memory.html#trim_stacks/0">trim_stacks/0</a>
247 <a id="idx:trimstacks0:1430"></a><a class="pred" href="memory.html#trim_stacks/0">trim_stacks/0</a>
248248 is invoked to release the collected memory resources.</dd>
249249 <dt class="pubdef"><a id="garbage_collect_atoms/0"><strong>garbage_collect_atoms</strong></a></dt>
250250 <dd class="defbody">
251251 Reclaim unused atoms. Normally invoked after <a class="flag" href="flags.html#flag:agc_margin">agc_margin</a>
252252 (a Prolog flag) atoms have been created. On multithreaded versions the
253253 actual collection is delayed until there are no threads performing
254 normal garbage collection. In this case <a id="idx:garbagecollectatoms0:1429"></a><a class="pred" href="memory.html#garbage_collect_atoms/0">garbage_collect_atoms/0</a>
254 normal garbage collection. In this case <a id="idx:garbagecollectatoms0:1431"></a><a class="pred" href="memory.html#garbage_collect_atoms/0">garbage_collect_atoms/0</a>
255255 returns immediately. Note that there is no guarantee it will <em>ever</em>
256256 happen, as there may always be threads performing garbage collection.</dd>
257257 <dt class="pubdef"><a id="trim_stacks/0"><strong>trim_stacks</strong></a></dt>
285285 ?- set_prolog_stack(global, limit(2*10**9)).
286286 </pre>
287287
288 <p>Current settings can be retrieved with <a id="idx:prologstackproperty2:1430"></a><a class="pred" href="memory.html#prolog_stack_property/2">prolog_stack_property/2</a>.
288 <p>Current settings can be retrieved with <a id="idx:prologstackproperty2:1432"></a><a class="pred" href="memory.html#prolog_stack_property/2">prolog_stack_property/2</a>.
289289
290290 <dl class="latex">
291291 <dt><strong>limit</strong>(<var>+Bytes</var>)</dt>
302302 amount is reported and specified in `cells'. A cell is 4 bytes in the
303303 32-bit version and 8 bytes on the 64-bit version. See
304304 <a class="flag" href="flags.html#flag:address_bits">address_bits</a>.
305 See also <a id="idx:trimstacks0:1431"></a><a class="pred" href="memory.html#trim_stacks/0">trim_stacks/0</a>
306 and <a id="idx:debug0:1432"></a><a class="pred" href="debugger.html#debug/0">debug/0</a>.</dd>
305 See also <a id="idx:trimstacks0:1433"></a><a class="pred" href="memory.html#trim_stacks/0">trim_stacks/0</a>
306 and <a id="idx:debug0:1434"></a><a class="pred" href="debugger.html#debug/0">debug/0</a>.</dd>
307307 <dt><strong>spare</strong>(<var>+Cells</var>)</dt>
308308 <dd class="defbody">
309309 All stacks trigger overflow before actually reaching the limit, so the
310310 resulting error can be handled gracefully. The spare stack is used for
311 <a id="idx:printmessage2:1433"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>
311 <a id="idx:printmessage2:1435"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>
312312 from the garbage collector and for handling exceptions. The default
313313 suffices, unless the user redefines related hooks. Do
314314 <b>not</b> specify large values for this because it reduces the amount
315315 of memory available for your real task.
316316
317 <p>Related hooks are <a id="idx:messagehook3:1434"></a><a class="pred" href="exception.html#message_hook/3">message_hook/3</a>
317 <p>Related hooks are <a id="idx:messagehook3:1436"></a><a class="pred" href="exception.html#message_hook/3">message_hook/3</a>
318318 (redefining GC messages),
319 <a id="idx:prologtraceinterception4:1435"></a><a class="pred" href="tracehook.html#prolog_trace_interception/4">prolog_trace_interception/4</a>
320 and <a id="idx:prologexceptionhook4:1436"></a><a class="pred" href="excepthook.html#prolog_exception_hook/4">prolog_exception_hook/4</a>.
319 <a id="idx:prologtraceinterception4:1437"></a><a class="pred" href="tracehook.html#prolog_trace_interception/4">prolog_trace_interception/4</a>
320 and <a id="idx:prologexceptionhook4:1438"></a><a class="pred" href="excepthook.html#prolog_exception_hook/4">prolog_exception_hook/4</a>.
321321 </dd>
322322 </dl>
323323
327327 <dd class="defbody">
328328 True if <var>KeyValue</var> is a current property of <var>Stack</var>.
329329 See
330 <a id="idx:setprologstack2:1437"></a><a class="pred" href="memory.html#set_prolog_stack/2">set_prolog_stack/2</a>
330 <a id="idx:setprologstack2:1439"></a><a class="pred" href="memory.html#set_prolog_stack/2">set_prolog_stack/2</a>
331331 for defined properties.
332332 </dd>
333333 </dl>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.9</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.9</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
248248 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="call/1"><strong>call</strong>(<var>:Goal</var>)</a></dt>
249249 <dd class="defbody">
250250 Invoke <var>Goal</var> as a goal. Note that clauses may have variables
251 as subclauses, which is identical to <a id="idx:call1:599"></a><a class="pred" href="metacall.html#call/1">call/1</a>.</dd>
251 as subclauses, which is identical to <a id="idx:call1:600"></a><a class="pred" href="metacall.html#call/1">call/1</a>.</dd>
252252 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="call/2"><strong>call</strong>(<var>:Goal,
253253 +ExtraArg1, ...</var>)</a></dt>
254254 <dd class="defbody">
258258 3.
259259
260260 <p>The call/[2..] construct is handled by the compiler. The predicates
261 <a id="idx:call28:600"></a><span class="pred-ext">call/[2-8]</span> are
261 <a id="idx:call28:601"></a><span class="pred-ext">call/[2-8]</span> are
262262 defined as real (meta-)predicates and are available to inspection
263 through <a id="idx:currentpredicate1:601"></a><a class="pred" href="examineprog.html#current_predicate/1">current_predicate/1</a>, <a id="idx:predicateproperty2:602"></a><a class="pred" href="examineprog.html#predicate_property/2">predicate_property/2</a>,
264 etc.<sup class="fn">53<span class="fn-text">Arities 2..8 are demanded by
263 through <a id="idx:currentpredicate1:602"></a><a class="pred" href="examineprog.html#current_predicate/1">current_predicate/1</a>, <a id="idx:predicateproperty2:603"></a><a class="pred" href="examineprog.html#predicate_property/2">predicate_property/2</a>,
264 etc.<sup class="fn">54<span class="fn-text">Arities 2..8 are demanded by
265265 ISO/IEC 13211-1:1995/Cor.2:2012.</span></sup> Higher arities are handled
266266 by the compiler and runtime system, but the predicates are not
267 accessible for inspection.<sup class="fn">54<span class="fn-text">Future
267 accessible for inspection.<sup class="fn">55<span class="fn-text">Future
268268 versions of the reflective predicate may fake the presence of call/9.. .
269269 Full logical behaviour, generating all these pseudo predicates, is
270270 probably undesirable and will become impossible if <em>max_arity</em> is
291291 Goal, !.
292292 </pre>
293293
294 <p><a id="idx:once1:603"></a><a class="pred" href="metacall.html#once/1">once/1</a>
294 <p><a id="idx:once1:604"></a><a class="pred" href="metacall.html#once/1">once/1</a>
295295 can in many cases be replaced with <a class="pred" href="control.html#send_arrow/2">-&gt;/2</a>.
296296 The only difference is how the cut behaves (see !/0). The following two
297297 clauses are identical:
304304 </dd>
305305 <dt class="pubdef"><a id="ignore/1"><strong>ignore</strong>(<var>:Goal</var>)</a></dt>
306306 <dd class="defbody">
307 Calls <var>Goal</var> as <a id="idx:once1:604"></a><a class="pred" href="metacall.html#once/1">once/1</a>,
307 Calls <var>Goal</var> as <a id="idx:once1:605"></a><a class="pred" href="metacall.html#once/1">once/1</a>,
308308 but succeeds, regardless of whether
309309 <var>Goal</var> succeeded or not. Defined as:
310310
319319 +Limit, -Result</var>)</a></dt>
320320 <dd class="defbody">
321321 If <var>Goal</var> can be proven without recursion deeper than <var>Limit</var>
322 levels, <a id="idx:callwithdepthlimit3:605"></a><a class="pred" href="metacall.html#call_with_depth_limit/3">call_with_depth_limit/3</a>
322 levels, <a id="idx:callwithdepthlimit3:606"></a><a class="pred" href="metacall.html#call_with_depth_limit/3">call_with_depth_limit/3</a>
323323 succeeds, binding <var>Result</var> to the deepest recursion level used
324324 during the proof. Otherwise, <var>Result</var> is unified with <code>depth_limit_exceeded</code>
325325 if the limit was exceeded during the proof, or the entire predicate
327327
328328 <p>The depth limit is guarded by the internal machinery. This may differ
329329 from the depth computed based on a theoretical model. For example,
330 <a id="idx:true0:606"></a><a class="pred" href="control.html#true/0">true/0</a>
330 <a id="idx:true0:607"></a><a class="pred" href="control.html#true/0">true/0</a>
331331 is translated into an inline virtual machine instruction. Also,
332 <a id="idx:repeat0:607"></a><a class="pred" href="control.html#repeat/0">repeat/0</a>
332 <a id="idx:repeat0:608"></a><a class="pred" href="control.html#repeat/0">repeat/0</a>
333333 is not implemented as below, but as a non-deterministic foreign
334334 predicate.
335335
339339 repeat.
340340 </pre>
341341
342 <p>As a result, <a id="idx:callwithdepthlimit3:608"></a><a class="pred" href="metacall.html#call_with_depth_limit/3">call_with_depth_limit/3</a>
342 <p>As a result, <a id="idx:callwithdepthlimit3:609"></a><a class="pred" href="metacall.html#call_with_depth_limit/3">call_with_depth_limit/3</a>
343343 may still loop infinitely on programs that should theoretically finish
344344 in finite time. This problem can be cured by using Prolog equivalents to
345345 such built-in predicates.
346346
347347 <p>This predicate may be used for theorem provers to realise techniques
348 like <em>iterative deepening</em>. See also <a id="idx:callwithinferencelimit3:609"></a><a class="pred" href="metacall.html#call_with_inference_limit/3">call_with_inference_limit/3</a>.
348 like <em>iterative deepening</em>. See also <a id="idx:callwithinferencelimit3:610"></a><a class="pred" href="metacall.html#call_with_inference_limit/3">call_with_inference_limit/3</a>.
349349 It was implemented after discussion with Steve Moyle
350350 <a class="url" href="mailto:smoyle@ermine.ox.ac.uk">smoyle@ermine.ox.ac.uk</a>.</dd>
351351 <dt class="pubdef"><a id="call_with_inference_limit/3"><strong>call_with_inference_limit</strong>(<var>:Goal,
353353 <dd class="defbody">
354354 Equivalent to <code>call(Goal)</code>, but limits the number of
355355 inferences
356 <em>for each solution of <var>Goal</var></em>.<sup class="fn">55<span class="fn-text">This
356 <em>for each solution of <var>Goal</var></em>.<sup class="fn">56<span class="fn-text">This
357357 predicate was realised after discussion with Ulrich Neumerkel and Markus
358358 Triska.</span></sup>. Execution may terminate as follows:
359359
365365 <var>Result</var> is unified with the atom
366366 <code>inference_limit_exceeded</code>.
367367 <i>Otherwise</i>,
368 <li>If <var>Goal</var> fails, <a id="idx:callwithinferencelimit3:610"></a><a class="pred" href="metacall.html#call_with_inference_limit/3">call_with_inference_limit/3</a>
368 <li>If <var>Goal</var> fails, <a id="idx:callwithinferencelimit3:611"></a><a class="pred" href="metacall.html#call_with_inference_limit/3">call_with_inference_limit/3</a>
369369 fails.
370370 <li>If <var>Goal</var> succeeds <em>without a choice point</em>,
371371 <var>Result</var> is unified with <code><code>!</code></code>.
372372 <li>If <var>Goal</var> succeeds <em>with a choice point</em>,
373373 <var>Result</var> is unified with <code>true</code>.
374 <li>If <var>Goal</var> throws an exception, <a id="idx:callwithinferencelimit3:611"></a><a class="pred" href="metacall.html#call_with_inference_limit/3">call_with_inference_limit/3</a>
374 <li>If <var>Goal</var> throws an exception, <a id="idx:callwithinferencelimit3:612"></a><a class="pred" href="metacall.html#call_with_inference_limit/3">call_with_inference_limit/3</a>
375375 re-throws the exception.
376376 </ul>
377377
380380 instructions for which inferences are not counted. The execution of
381381 predicates defined in other languages (e.g., C, C++) count as a single
382382 inference. This includes potentially expensive built-in predicates such
383 as <a id="idx:sort2:612"></a><a class="pred" href="builtinlist.html#sort/2">sort/2</a>.
383 as <a id="idx:sort2:613"></a><a class="pred" href="builtinlist.html#sort/2">sort/2</a>.
384384
385385 <p>Calls to this predicate may be nested. An inner call that sets the
386386 limit below the current is honoured. An inner call that would terminate
387387 after the current limit does not change the effective limit. See also
388 <a id="idx:callwithdepthlimit3:613"></a><a class="pred" href="metacall.html#call_with_depth_limit/3">call_with_depth_limit/3</a>
389 and <a id="idx:callwithtimelimit2:614"></a><span class="pred-ext">call_with_time_limit/2</span>.</dd>
388 <a id="idx:callwithdepthlimit3:614"></a><a class="pred" href="metacall.html#call_with_depth_limit/3">call_with_depth_limit/3</a>
389 and <a id="idx:callwithtimelimit2:615"></a><span class="pred-ext">call_with_time_limit/2</span>.</dd>
390390 <dt class="pubdef"><a id="setup_call_cleanup/3"><strong>setup_call_cleanup</strong>(<var>:Setup,
391391 :Goal, :Cleanup</var>)</a></dt>
392392 <dd class="defbody">
395395 failure, deterministic success, commit, or an exception. The execution
396396 of
397397 <var>Setup</var> is protected from asynchronous interrupts like
398 <a id="idx:callwithtimelimit2:615"></a><span class="pred-ext">call_with_time_limit/2</span>
399 (package clib) or <a id="idx:threadsignal2:616"></a><a class="pred" href="threadcom.html#thread_signal/2">thread_signal/2</a>.
398 <a id="idx:callwithtimelimit2:616"></a><span class="pred-ext">call_with_time_limit/2</span>
399 (package clib) or <a id="idx:threadsignal2:617"></a><a class="pred" href="threadcom.html#thread_signal/2">thread_signal/2</a>.
400400 In most uses,
401401 <var>Setup</var> will perform temporary side-effects required by <var>Goal</var>
402402 that are finally undone by <var>Cleanup</var>.
403403
404404 <p>Success or failure of <var>Cleanup</var> is ignored, and choice
405 points it created are destroyed (as <a id="idx:once1:617"></a><a class="pred" href="metacall.html#once/1">once/1</a>).
405 points it created are destroyed (as <a id="idx:once1:618"></a><a class="pred" href="metacall.html#once/1">once/1</a>).
406406 If <var>Cleanup</var> throws an exception, this is executed as normal.<sup class="fn">bug<span class="fn-text">During
407407 the execution of <var>Cleanup</var>, garbage collection and stack-shifts
408408 are disabled.</span></sup>
429429
430430 <p>Note that it is impossible to implement this predicate in Prolog. The
431431 closest approximation would be to read all terms into a list, close the
432 file and call <a id="idx:member2:618"></a><a class="pred" href="lists.html#member/2">member/2</a>.
433 Without <a id="idx:setupcallcleanup3:619"></a><a class="pred" href="metacall.html#setup_call_cleanup/3">setup_call_cleanup/3</a>
434 there is no way to gain control if the choice point left by <a id="idx:repeat0:620"></a><a class="pred" href="control.html#repeat/0">repeat/0</a>
432 file and call <a id="idx:member2:619"></a><a class="pred" href="lists.html#member/2">member/2</a>.
433 Without <a id="idx:setupcallcleanup3:620"></a><a class="pred" href="metacall.html#setup_call_cleanup/3">setup_call_cleanup/3</a>
434 there is no way to gain control if the choice point left by <a id="idx:repeat0:621"></a><a class="pred" href="control.html#repeat/0">repeat/0</a>
435435 is removed by a cut or an exception.
436436
437 <p><a id="idx:setupcallcleanup3:621"></a><a class="pred" href="metacall.html#setup_call_cleanup/3">setup_call_cleanup/3</a>
437 <p><a id="idx:setupcallcleanup3:622"></a><a class="pred" href="metacall.html#setup_call_cleanup/3">setup_call_cleanup/3</a>
438438 can also be used to test determinism of a goal, providing a portable
439 alternative to <a id="idx:deterministic1:622"></a><a class="pred" href="manipstack.html#deterministic/1">deterministic/1</a>:
439 alternative to <a id="idx:deterministic1:623"></a><a class="pred" href="manipstack.html#deterministic/1">deterministic/1</a>:
440440
441441 <pre class="code">
442442 ?- setup_call_cleanup(true,(X=1;X=2), Det=yes).
448448 </pre>
449449
450450 <p>This predicate is under consideration for inclusion into the ISO
451 standard. For compatibility with other Prolog implementations see <a id="idx:callcleanup2:623"></a><a class="pred" href="metacall.html#call_cleanup/2">call_cleanup/2</a>.</dd>
451 standard. For compatibility with other Prolog implementations see <a id="idx:callcleanup2:624"></a><a class="pred" href="metacall.html#call_cleanup/2">call_cleanup/2</a>.</dd>
452452 <dt class="pubdef"><a id="setup_call_catcher_cleanup/4"><strong>setup_call_catcher_cleanup</strong>(<var>:Setup,
453453 :Goal, +Catcher, :Cleanup</var>)</a></dt>
454454 <dd class="defbody">
496496 <dd class="defbody">
497497 Same as <code>setup_call_cleanup(true, Goal, Cleanup)</code>. This is
498498 provided for compatibility with a number of other Prolog implementations
499 only. Do not use <a id="idx:callcleanup2:624"></a><a class="pred" href="metacall.html#call_cleanup/2">call_cleanup/2</a>
499 only. Do not use <a id="idx:callcleanup2:625"></a><a class="pred" href="metacall.html#call_cleanup/2">call_cleanup/2</a>
500500 if you perform side-effects prior to calling that will be undone by <var>Cleanup</var>.
501501 Instead, use
502 <a id="idx:setupcallcleanup3:625"></a><a class="pred" href="metacall.html#setup_call_cleanup/3">setup_call_cleanup/3</a>
502 <a id="idx:setupcallcleanup3:626"></a><a class="pred" href="metacall.html#setup_call_cleanup/3">setup_call_cleanup/3</a>
503503 with an appropriate first argument to perform those side-effects.</dd>
504504 <dt class="pubdef"><a id="call_cleanup/3"><strong>call_cleanup</strong>(<var>:Goal,
505505 +Catcher, :Cleanup</var>)</a></dt>
506506 <dd class="defbody">
507507 Same as <code>setup_call_catcher_cleanup(true, Goal, Catcher, Cleanup)</code>.
508 The same warning as for <a id="idx:callcleanup2:626"></a><a class="pred" href="metacall.html#call_cleanup/2">call_cleanup/2</a>
508 The same warning as for <a id="idx:callcleanup2:627"></a><a class="pred" href="metacall.html#call_cleanup/2">call_cleanup/2</a>
509509 applies.
510510 </dd>
511511 </dl>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 6.4</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 6.4</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
241241 dynamically, modifies a predicate, or reasons about properties of a
242242 predicate. Such predicates use either a compound term or a <em>predicate
243243 indicator</em> to describe the predicate they address, e.g., <code>assert(name(jan))</code>
244 or <code>abolish(<a id="idx:name1:1541"></a><span class="pred-ext">name/1</span>)</code>.
244 or <code>abolish(<a id="idx:name1:1543"></a><span class="pred-ext">name/1</span>)</code>.
245245 With modules, this simple schema no longer works as each module defines
246246 its own mapping from name+arity to predicate. This is resolved by
247247 wrapping the original description in a term &lt;<var>module</var>&gt;:&lt;<var>term</var>&gt;,
248248 e.g., <code>assert(person:name(jan))</code> or
249249 <code>abolish(person:name/1)</code>.
250250
251 <p>Of course, when calling <a id="idx:assert1:1542"></a><a class="pred" href="db.html#assert/1">assert/1</a>
251 <p>Of course, when calling <a id="idx:assert1:1544"></a><a class="pred" href="db.html#assert/1">assert/1</a>
252252 from inside a module, we expect to assert to a predicate local to this
253253 module. In other words, we do not wish to provide this <code><code>:</code>/2</code>
254 wrapper by hand. The <a id="idx:metapredicate1:1543"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>
254 wrapper by hand. The <a id="idx:metapredicate1:1545"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>
255255 directive tells the compiler that certain arguments are terms that will
256256 be used to look up a predicate and thus need to be wrapped (qualified)
257257 with &lt;<var>module</var>&gt;:&lt;<var>term</var>&gt;, unless they are
258258 already wrapped.
259259
260 <p>In the example below, we use this to define <a id="idx:maplist3:1544"></a><a class="pred" href="apply.html#maplist/3">maplist/3</a>
260 <p>In the example below, we use this to define <a id="idx:maplist3:1546"></a><a class="pred" href="apply.html#maplist/3">maplist/3</a>
261261 inside a module. The argument `2' in the meta_predicate declaration
262262 means that the argument is module-sensitive and refers to a predicate
263263 with an arity that is two more than the term that is passed in. The
266266 and <code><code>?</code></code>, which denote
267267 <em>modes</em>. The values 0..9 are used by the
268268 <em>cross-referencer</em> and syntax highlighting. Note that the helper
269 predicate <a id="idx:maplist3:1545"></a><span class="pred-ext">maplist_/3</span>
270 does not need to be declared as a meta-predicate because the <a id="idx:maplist3:1546"></a><a class="pred" href="apply.html#maplist/3">maplist/3</a>
269 predicate <a id="idx:maplist3:1547"></a><span class="pred-ext">maplist_/3</span>
270 does not need to be declared as a meta-predicate because the <a id="idx:maplist3:1548"></a><a class="pred" href="apply.html#maplist/3">maplist/3</a>
271271 wrapper already ensures that
272272 <var>Goal</var> is qualified as &lt;<var>module</var>&gt;:<var>Goal</var>.
273273 See the description of
274 <a id="idx:metapredicate1:1547"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>
274 <a id="idx:metapredicate1:1549"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>
275275 for details.
276276
277277 <pre class="code">
328328 <dd class="defbody">
329329 The argument is not module-sensitive and the mode is unspecified. The
330330 specification <code><code>*</code></code> is equivalent to <code><code>?</code></code>.
331 It is accepted for compatibility reasons. The predicate <a id="idx:predicateproperty2:1548"></a><a class="pred" href="examineprog.html#predicate_property/2">predicate_property/2</a>
331 It is accepted for compatibility reasons. The predicate <a id="idx:predicateproperty2:1550"></a><a class="pred" href="examineprog.html#predicate_property/2">predicate_property/2</a>
332332 reports arguments declared using <code><code>*</code></code> with <code><code>?</code></code>.
333333 </dd>
334334 <dt><strong><code>+</code></strong></dt>
339339 <dd class="defbody">
340340 This extension is used to denote the possibly <code>^</code>-annotated
341341 goal of
342 <a id="idx:setof3:1549"></a><a class="pred" href="allsolutions.html#setof/3">setof/3</a>, <a id="idx:bagof3:1550"></a><a class="pred" href="allsolutions.html#bagof/3">bagof/3</a>, <a id="idx:aggregate3:1551"></a><a class="pred" href="aggregate.html#aggregate/3">aggregate/3</a>
343 and <a id="idx:aggregate4:1552"></a><a class="pred" href="aggregate.html#aggregate/4">aggregate/4</a>.
342 <a id="idx:setof3:1551"></a><a class="pred" href="allsolutions.html#setof/3">setof/3</a>, <a id="idx:bagof3:1552"></a><a class="pred" href="allsolutions.html#bagof/3">bagof/3</a>, <a id="idx:aggregate3:1553"></a><a class="pred" href="aggregate.html#aggregate/3">aggregate/3</a>
343 and <a id="idx:aggregate4:1554"></a><a class="pred" href="aggregate.html#aggregate/4">aggregate/4</a>.
344344 It is processed similar to `0', but leaving the <code><code>^</code></code>/2
345345 intact.
346346 </dd>
347347 <dt><strong><code>//</code></strong></dt>
348348 <dd class="defbody">
349 The argument is a DCG body. See <a id="idx:phrase3:1553"></a><a class="pred" href="DCG.html#phrase/3">phrase/3</a>.
349 The argument is a DCG body. See <a id="idx:phrase3:1555"></a><a class="pred" href="DCG.html#phrase/3">phrase/3</a>.
350350 </dd>
351351 </dl>
352352
383383 Module=42, Term = test
384384 </pre>
385385
386 <p>The <a id="idx:metapredicate1:1554"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>
386 <p>The <a id="idx:metapredicate1:1556"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>
387387 declaration is the portable mechanism for defining meta-predicates and
388388 replaces the old SWI-Prolog specific mechanism provided by the
389 deprecated predicates <a id="idx:moduletransparent1:1555"></a><a class="pred" href="ctxmodule.html#module_transparent/1">module_transparent/1</a>,
390 <a id="idx:contextmodule1:1556"></a><a class="pred" href="ctxmodule.html#context_module/1">context_module/1</a>
391 and <a id="idx:stripmodule3:1557"></a><a class="pred" href="ctxmodule.html#strip_module/3">strip_module/3</a>.
389 deprecated predicates <a id="idx:moduletransparent1:1557"></a><a class="pred" href="ctxmodule.html#module_transparent/1">module_transparent/1</a>,
390 <a id="idx:contextmodule1:1558"></a><a class="pred" href="ctxmodule.html#context_module/1">context_module/1</a>
391 and <a id="idx:stripmodule3:1559"></a><a class="pred" href="ctxmodule.html#strip_module/3">strip_module/3</a>.
392392 See also <a class="sec" href="modulecompat.html">section 6.15</a>.
393393 </dd>
394394 </dl>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.27</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.27</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
265265 </dd>
266266 <dt><strong>state</strong>(<var>+State</var>)</dt>
267267 <dd class="defbody">
268 Set the generator to a state fetched using the state property of <a id="idx:randomproperty1:1218"></a><a class="pred" href="miscarith.html#random_property/1">random_property/1</a>.
269 Using other values may lead to undefined behaviour.<sup class="fn">101<span class="fn-text">The
268 Set the generator to a state fetched using the state property of <a id="idx:randomproperty1:1220"></a><a class="pred" href="miscarith.html#random_property/1">random_property/1</a>.
269 Using other values may lead to undefined behaviour.<sup class="fn">104<span class="fn-text">The
270270 limitations of the underlying (GMP) library are unknown, which makes it
271271 impossible to validate the <var>State</var>.</span></sup>
272272 </dd>
285285 Describes the current state of the random generator. State is a normal
286286 Prolog term that can be asserted or written to a file. Applications
287287 should make no other assumptions about its representation. The only
288 meaningful operation is to use as argument to <a id="idx:setrandom1:1219"></a><a class="pred" href="miscarith.html#set_random/1">set_random/1</a>
288 meaningful operation is to use as argument to <a id="idx:setrandom1:1221"></a><a class="pred" href="miscarith.html#set_random/1">set_random/1</a>
289289 using the
290290 <code>state(State)</code> option.<sup class="fn">bug<span class="fn-text">GMP
291291 provides no portable mechanism to fetch and restore the state. The
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.42</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.42</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
257257 <dt class="pubdef"><a id="dwim_match/3"><strong>dwim_match</strong>(<var>+Atom1,
258258 +Atom2, -Difference</var>)</a></dt>
259259 <dd class="defbody">
260 Equivalent to <a id="idx:dwimmatch2:1439"></a><a class="pred" href="miscpreds.html#dwim_match/2">dwim_match/2</a>,
260 Equivalent to <a id="idx:dwimmatch2:1441"></a><a class="pred" href="miscpreds.html#dwim_match/2">dwim_match/2</a>,
261261 but unifies <var>Difference</var> with an atom identifying the
262262 difference between <var>Atom1</var> and <var>Atom2</var>. The return
263263 values are (in the same order as above): <code>equal</code>,
300300 immediately. On most non-realtime operating systems we can only ensure
301301 execution is suspended for <b>at least</b> <var>Time</var> seconds.
302302
303 <p>On Unix systems the <a id="idx:sleep1:1440"></a><a class="pred" href="miscpreds.html#sleep/1">sleep/1</a>
303 <p>On Unix systems the <a id="idx:sleep1:1442"></a><a class="pred" href="miscpreds.html#sleep/1">sleep/1</a>
304304 predicate is realised ---in order of preference--- by nanosleep(),
305305 usleep(), select() if the time is below 1 minute, or sleep(). On Windows
306306 systems Sleep() is used.
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 6.15</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 6.15</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
240240 <p>The SWI-Prolog module system is largely derived from the Quintus
241241 Prolog module system, which is also adopted by SICStus, Ciao and YAP.
242242 Originally, the mechanism for defining meta-predicates in SWI-Prolog was
243 based on the <a id="idx:moduletransparent1:1607"></a><a class="pred" href="ctxmodule.html#module_transparent/1">module_transparent/1</a>
244 directive and <a id="idx:stripmodule3:1608"></a><a class="pred" href="ctxmodule.html#strip_module/3">strip_module/3</a>.
245 Since 5.7.4 it supports the de-facto standard <a id="idx:metapredicate1:1609"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>
243 based on the <a id="idx:moduletransparent1:1609"></a><a class="pred" href="ctxmodule.html#module_transparent/1">module_transparent/1</a>
244 directive and <a id="idx:stripmodule3:1610"></a><a class="pred" href="ctxmodule.html#strip_module/3">strip_module/3</a>.
245 Since 5.7.4 it supports the de-facto standard <a id="idx:metapredicate1:1611"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>
246246 directive for implementing meta-predicates, providing much better
247247 compatibility.
248248
249 <p>The support for the <a id="idx:metapredicate1:1610"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>
249 <p>The support for the <a id="idx:metapredicate1:1612"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>
250250 mechanism, however, is considerably different. On most systems, the <em>caller</em>
251251 of a meta-predicate is compiled differently to provide the required &lt;<var>module</var>&gt;:&lt;<var>term</var>&gt;
252252 qualification. This implies that the meta-declaration must be available
258258 <ul class="latex">
259259 <li>Modules that provide meta-predicates for a module to be compiled
260260 must be loaded explicitly by that module.
261 <li>The meta-predicate directives of exported predicates must follow the <a id="idx:module2:1611"></a><a class="pred" href="defmodule.html#module/2">module/2</a>
261 <li>The meta-predicate directives of exported predicates must follow the <a id="idx:module2:1613"></a><a class="pred" href="defmodule.html#module/2">module/2</a>
262262 directive immediately.
263263 <li>After changing a meta-declaration, all modules that <em>call</em>
264264 the modified predicates need to be recompiled.
280280 user-defined module is the <code>user</code> module. In turn, the
281281 <code>user</code> module imports from the module <code>system</code>
282282 that provides all built-in predicates. The auto-import hierarchy can be
283 changed using <a id="idx:addimportmodule3:1612"></a><a class="pred" href="importmodule.html#add_import_module/3">add_import_module/3</a>
284 and <a id="idx:deleteimportmodule2:1613"></a><a class="pred" href="importmodule.html#delete_import_module/2">delete_import_module/2</a>.
283 changed using <a id="idx:addimportmodule3:1614"></a><a class="pred" href="importmodule.html#add_import_module/3">add_import_module/3</a>
284 and <a id="idx:deleteimportmodule2:1615"></a><a class="pred" href="importmodule.html#delete_import_module/2">delete_import_module/2</a>.
285285
286286 <p>This mechanism can be used to realise a simple object-oriented system
287287 or a hierarchical module system.
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 6.8</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 6.8</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
245245 Name)</code>. Inheritance from the public table can be restored using <code>:-
246246 op(-1, Type, Name)</code>.
247247
248 <p>In addition to using the <a id="idx:op3:1572"></a><a class="pred" href="operators.html#op/3">op/3</a>
249 directive, operators can be declared in the <a id="idx:module2:1573"></a><a class="pred" href="defmodule.html#module/2">module/2</a>
248 <p>In addition to using the <a id="idx:op3:1574"></a><a class="pred" href="operators.html#op/3">op/3</a>
249 directive, operators can be declared in the <a id="idx:module2:1575"></a><a class="pred" href="defmodule.html#module/2">module/2</a>
250250 directive as shown below. Such operator declarations are visible inside
251251 the module, and importing such a module makes the operators visible in
252252 the target module. Exporting operators is typically used by modules that
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
253253 <a class="sec" href="defmodule.html">section 6.2</a> and <a class="sec" href="import.html">section
254254 6.3</a>. The primitives defined in these sections suffice for basic
255255 usage until one needs to export predicates that call or manage other
256 predicates dynamically (e.g., use <a id="idx:call1:1515"></a><a class="pred" href="metacall.html#call/1">call/1</a>,
257 <a id="idx:assert1:1516"></a><a class="pred" href="db.html#assert/1">assert/1</a>,
256 predicates dynamically (e.g., use <a id="idx:call1:1517"></a><a class="pred" href="metacall.html#call/1">call/1</a>,
257 <a id="idx:assert1:1518"></a><a class="pred" href="db.html#assert/1">assert/1</a>,
258258 etc.). Such predicates are called <em>meta predicates</em> and are
259259 discussed in <a class="sec" href="metapred.html">section 6.4</a>. <a class="sec" href="overrule.html">Section
260260 6.5</a> to <a class="sec" href="moduleop.html">section 6.8</a> describe
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 9.7</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 9.7</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
251251 <p>Traditionally, XPCE runs in the foreground (<code>main</code>)
252252 thread. We are working towards a situation where XPCE can run
253253 comfortably in a separate thread. A separate XPCE thread can be created
254 using <a id="idx:pcedispatch1:1812"></a><a class="pred" href="mt-xpce.html#pce_dispatch/1">pce_dispatch/1</a>.
254 using <a id="idx:pcedispatch1:1815"></a><a class="pred" href="mt-xpce.html#pce_dispatch/1">pce_dispatch/1</a>.
255255 It is also possible to create this thread as the <code>library(1)</code>pce)
256256 is loaded by setting the <b>xpce_threaded</b> to <code>true</code>.
257257
263263 <dd class="defbody">
264264 Assuming XPCE is running in the foreground thread, this call gives
265265 background threads the opportunity to make calls to the XPCE thread. A
266 call to <a id="idx:inpcethread1:1813"></a><a class="pred" href="mt-xpce.html#in_pce_thread/1">in_pce_thread/1</a>
266 call to <a id="idx:inpcethread1:1816"></a><a class="pred" href="mt-xpce.html#in_pce_thread/1">in_pce_thread/1</a>
267267 succeeds immediately, copying <var>Goal</var> to the XPCE thread. <var>Goal</var>
268268 is added to the XPCE event queue and executed synchronous to normal user
269269 events like typing and clicking.</dd>
270270 <dt class="pubdef"><span class="pred-tag">[semidet]</span><a id="in_pce_thread_sync/1"><strong>in_pce_thread_sync</strong>(<var>:Goal</var>)</a></dt>
271271 <dd class="defbody">
272 Same as <a id="idx:inpcethread1:1814"></a><a class="pred" href="mt-xpce.html#in_pce_thread/1">in_pce_thread/1</a>,
272 Same as <a id="idx:inpcethread1:1817"></a><a class="pred" href="mt-xpce.html#in_pce_thread/1">in_pce_thread/1</a>,
273273 but wait for <var>Goal</var> to be completed. Success depends on the
274274 success of executing <var>Goal</var>. Variable bindings inside <var>Goal</var>
275275 are visible to the caller, but it should be noted that the values are
276276 being <em>copied</em>. If <var>Goal</var> throws an exception, this
277 exception is re-thrown by <a id="idx:inpcethread1:1815"></a><a class="pred" href="mt-xpce.html#in_pce_thread/1">in_pce_thread/1</a>.
278 If the calling thread is the `pce thread', <a id="idx:inpcethreadsync1:1816"></a><a class="pred" href="mt-xpce.html#in_pce_thread_sync/1">in_pce_thread_sync/1</a>
279 executes a direct meta-call. See also <a id="idx:pcethread1:1817"></a><span class="pred-ext">pce_thread/1</span>.
280
281 <p>Note that <a id="idx:inpcethreadsync1:1818"></a><a class="pred" href="mt-xpce.html#in_pce_thread_sync/1">in_pce_thread_sync/1</a>
277 exception is re-thrown by <a id="idx:inpcethread1:1818"></a><a class="pred" href="mt-xpce.html#in_pce_thread/1">in_pce_thread/1</a>.
278 If the calling thread is the `pce thread', <a id="idx:inpcethreadsync1:1819"></a><a class="pred" href="mt-xpce.html#in_pce_thread_sync/1">in_pce_thread_sync/1</a>
279 executes a direct meta-call. See also <a id="idx:pcethread1:1820"></a><span class="pred-ext">pce_thread/1</span>.
280
281 <p>Note that <a id="idx:inpcethreadsync1:1821"></a><a class="pred" href="mt-xpce.html#in_pce_thread_sync/1">in_pce_thread_sync/1</a>
282282 is expensive because it requires copying and thread communication. For
283283 example, <code>in_pce_thread_synctrue</code> runs at approximately
284284 50,000 calls per second (AMD Phenom 9600B, Ubuntu 11.04).</dd>
289289 executes the X11 event-dispatch loop. In MS-Windows it creates a thread
290290 that executes a windows event-dispatch loop. The XPCE event-handling
291291 thread has the alias <code>pce</code>. <var>Options</var> specifies the
292 thread attributes as <a id="idx:threadcreate3:1819"></a><a class="pred" href="threadcreate.html#thread_create/3">thread_create/3</a>.
292 thread attributes as <a id="idx:threadcreate3:1822"></a><a class="pred" href="threadcreate.html#thread_create/3">thread_create/3</a>.
293293 </dd>
294294 </dl>
295295
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 6.6</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 6.6</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
241241 modules: running them, setting spy points on them, etc. This can be
242242 achieved using the &lt;<var>module</var>&gt;:&lt;<var>term</var>&gt;
243243 construct explicitly as described above. In SWI-Prolog, you may also
244 wish to omit the module qualification. Setting a spy point (<a id="idx:spy1:1561"></a><a class="pred" href="debugger.html#spy/1">spy/1</a>)
244 wish to omit the module qualification. Setting a spy point (<a id="idx:spy1:1563"></a><a class="pred" href="debugger.html#spy/1">spy/1</a>)
245245 on a plain predicate sets a spy point on any predicate with that name in
246 any module. Editing (<a id="idx:edit1:1562"></a><a class="pred" href="edit.html#edit/1">edit/1</a>)
246 any module. Editing (<a id="idx:edit1:1564"></a><a class="pred" href="edit.html#edit/1">edit/1</a>)
247247 or calling an unqualified predicate invokes the DWIM (Do What I Mean)
248248 mechanism, which generally suggests the correct qualified query.
249249
250 <p>Mainly for compatibility, we provide <a id="idx:module1:1563"></a><a class="pred" href="mtoplevel.html#module/1">module/1</a>
250 <p>Mainly for compatibility, we provide <a id="idx:module1:1565"></a><a class="pred" href="mtoplevel.html#module/1">module/1</a>
251251 to switch the module with which the interactive top level interacts:
252252
253253 <dl class="latex">
254254 <dt class="pubdef"><a id="module/1"><strong>module</strong>(<var>+Module</var>)</a></dt>
255255 <dd class="defbody">
256256 The call <code>module(<var>Module</var>)</code> may be used to switch
257 the default working module for the interactive top level (see <a id="idx:prolog0:1564"></a><a class="pred" href="toplevel.html#prolog/0">prolog/0</a>).
257 the default working module for the interactive top level (see <a id="idx:prolog0:1566"></a><a class="pred" href="toplevel.html#prolog/0">prolog/0</a>).
258258 This may be used when debugging a module. The example below lists the
259 clauses of <a id="idx:fileoflabel2:1565"></a><span class="pred-ext">file_of_label/2</span>
259 clauses of <a id="idx:fileoflabel2:1567"></a><span class="pred-ext">file_of_label/2</span>
260260 in the module <code>tex</code>.
261261
262262 <pre class="code">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 3.6</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 3.6</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.15</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.15</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
239239
240240 <p>The library <code>library(nb_set)</code> defines <em>non-backtrackable
241241 sets</em>, implemented as binary trees. The sets are represented as
242 compound terms and manipulated using <a id="idx:nbsetarg3:1952"></a><a class="pred" href="manipterm.html#nb_setarg/3">nb_setarg/3</a>.
242 compound terms and manipulated using <a id="idx:nbsetarg3:1955"></a><a class="pred" href="manipterm.html#nb_setarg/3">nb_setarg/3</a>.
243243 Non-backtrackable manipulation of datastructures is not supported by a
244244 large number of Prolog implementations, but it has several advantages
245245 over using the database. It produces less garbage, is thread-safe,
270270 <dd class="defbody">
271271 Add <var>Key</var> to <var>Set</var>. If <var>Key</var> is already a
272272 member of
273 <var>Set</var>, <a id="idx:addnbset3:1953"></a><a class="pred" href="nb_set.html#add_nb_set/3">add_nb_set/3</a>
273 <var>Set</var>, <a id="idx:addnbset3:1956"></a><a class="pred" href="nb_set.html#add_nb_set/3">add_nb_set/3</a>
274274 succeeds without modifying <var>Set</var>.</dd>
275275 <dt class="pubdef"><a id="add_nb_set/3"><strong>add_nb_set</strong>(<var>+Key,
276276 !Set, ?New</var>)</a></dt>
292292 -Key</var>)</a></dt>
293293 <dd class="defbody">
294294 Generate all members of <var>Set</var> on backtracking in the standard
295 order of terms. To test membership, use <a id="idx:addnbset3:1954"></a><a class="pred" href="nb_set.html#add_nb_set/3">add_nb_set/3</a>.</dd>
295 order of terms. To test membership, use <a id="idx:addnbset3:1957"></a><a class="pred" href="nb_set.html#add_nb_set/3">add_nb_set/3</a>.</dd>
296296 <dt class="pubdef"><a id="size_nb_set/2"><strong>size_nb_set</strong>(<var>+Set,
297297 -Size</var>)</a></dt>
298298 <dd class="defbody">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.24</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.24</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
242242 have been predefined. All operators, except for the comma (,) can be
243243 redefined by the user.
244244
245 <p><a id="idx:operatorandmodules:1194"></a>Some care has to be taken
245 <p><a id="idx:operatorandmodules:1195"></a>Some care has to be taken
246246 before defining new operators. Defining too many operators might make
247247 your source `natural' looking, but at the same time make it hard to
248248 understand the limits of your syntax. To ease the pain, as of SWI-Prolog
250250 Operators can be exported from modules using a term
251251 <code>op(Precedence, Type, Name)</code> in the export list as specified
252252 by
253 <a id="idx:module2:1195"></a><a class="pred" href="defmodule.html#module/2">module/2</a>.
253 <a id="idx:module2:1196"></a><a class="pred" href="defmodule.html#module/2">module/2</a>.
254254 Many modern Prolog systems have module specific operators.
255255 Unfortunately, there is no established interface for exporting and
256256 importing operators. SWI-Prolog's convention has been addopted by YAP.
317317 <p>In SWI-Prolog, operators are <em>local</em> to a module (see also
318318 <a class="sec" href="moduleop.html">section 6.8</a>). Keeping operators
319319 in modules and using controlled import/export of operators as described
320 with the <a id="idx:module2:1196"></a><a class="pred" href="defmodule.html#module/2">module/2</a>
320 with the <a id="idx:module2:1197"></a><a class="pred" href="defmodule.html#module/2">module/2</a>
321321 directive keep the issues manageable. The module <code>system</code>
322322 provides the operators from <a class="tab" href="operators.html#tab:operators">table
323323 5</a> and these operators cannot be modified. Files that are loaded from
362362 ?Type, ?:Name</var>)</a></dt>
363363 <dd class="defbody">
364364 True if <var>Name</var> is currently defined as an operator of type <var>Type</var>
365 with precedence <var>Precedence</var>. See also <a id="idx:op3:1197"></a><a class="pred" href="operators.html#op/3">op/3</a>.
365 with precedence <var>Precedence</var>. See also <a id="idx:op3:1198"></a><a class="pred" href="operators.html#op/3">op/3</a>.
366366 </dd>
367367 </dl>
368368
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section F.4</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section F.4</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.17</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.17</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.18</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.18</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
633633 <dt class="pubdef"><span class="pred-tag">[det]</span><a id="opt_help/2"><strong>opt_help</strong>(<var>+OptsSpec,
634634 -Help:atom</var>)</a></dt>
635635 <dd class="defbody">
636 True when <var>Help</var> is a help string synthesized from <var>OptsSpec</var>.
636 True when <var>Help</var> is a help string synthesized from <var>OptsSpec</var>.</dd>
637 <dt class="multidef"><span class="pred-tag">[semidet,multifile]</span><a id="parse_type/3"><strong>parse_type</strong>(<var>+Type,
638 +Codes:list(code), -Result</var>)</a></dt>
639 <dd class="defbody">
640 Hook to parse option text <var>Codes</var> to an object of type <var>Type</var>.
637641 </dd>
638642 </dl>
639643
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.19</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.19</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section E.4</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section E.4</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
242242
243243 <a id="sec:cryptlicense"></a>
244244
245 <p>Cryptographic routines are used in <a id="idx:variantsha12:2141"></a><a class="pred" href="db.html#variant_sha1/2">variant_sha1/2</a>
245 <p>Cryptographic routines are used in <a id="idx:variantsha12:2148"></a><a class="pred" href="db.html#variant_sha1/2">variant_sha1/2</a>
246246 and <code>library(crypt)</code>. These routines are provided under the
247247 following conditions:
248248
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 6.5</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 6.5</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
263263
264264 <p>Note that the second example is the same due to the Prolog flag
265265 <a class="flag" href="flags.html#flag:colon_sets_calling_context">colon_sets_calling_context</a>.
266 The system predicate <a id="idx:asserta1:1558"></a><a class="pred" href="db.html#asserta/1">asserta/1</a>
266 The system predicate <a id="idx:asserta1:1560"></a><a class="pred" href="db.html#asserta/1">asserta/1</a>
267267 is called in the module <code>world</code>, which is possible because
268268 system predicates are <em>visible</em> in all modules. At the same time,
269269 the
290290 Setting the calling context affects meta-predicates, for which meta
291291 arguments are qualified with <var>Module</var> and transparent
292292 predicates (see
293 <a id="idx:moduletransparent1:1559"></a><a class="pred" href="ctxmodule.html#module_transparent/1">module_transparent/1</a>).
293 <a id="idx:moduletransparent1:1561"></a><a class="pred" href="ctxmodule.html#module_transparent/1">module_transparent/1</a>).
294294 It has no implications for other predicates.
295295
296296 <p>For example, the code <code>asserta(done)@world</code> is the same as
297297 <code>asserta(world:done)</code>. Unlike in <code>world:asserta(done)</code>,
298 <a id="idx:asserta1:1560"></a><a class="pred" href="db.html#asserta/1">asserta/1</a>
298 <a id="idx:asserta1:1562"></a><a class="pred" href="db.html#asserta/1">asserta/1</a>
299299 is resolved in the current module rather than the module
300300 <code>world</code>. This makes no difference for system predicates, but
301301 usually does make a difference for user predicates.
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.20</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.20</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 3.4</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 3.4</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.21</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.21</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.22</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.22</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 10.5</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 10.5</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
308308 <dt><strong>-shared</strong> <var></var></dt>
309309 <dd class="defbody">
310310 Link C, C++ or object files into a shared object (DLL) that can be
311 loaded by the <a id="idx:loadforeignlibrary1:1896"></a><a class="pred" href="foreignlink.html#load_foreign_library/1">load_foreign_library/1</a>
311 loaded by the <a id="idx:loadforeignlibrary1:1899"></a><a class="pred" href="foreignlink.html#load_foreign_library/1">load_foreign_library/1</a>
312312 predicate. If used with
313313 <strong>-c</strong> it sets the proper options to compile a C or C++
314314 file ready for linking into a shared object.</dd>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section C.1</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section C.1</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
251251 the defined semantics are those of dialect <var>X</var>. Emulating all
252252 extreme cases and full error handling compatibility may be tedious and
253253 result in a much slower implementation that needed. Take for example
254 <a id="idx:callcleanup2:2060"></a><a class="pred" href="metacall.html#call_cleanup/2">call_cleanup/2</a>.
254 <a id="idx:callcleanup2:2063"></a><a class="pred" href="metacall.html#call_cleanup/2">call_cleanup/2</a>.
255255 The SICStus definition is fundamentally different from the SWI
256256 definition, but 99% of the applications just want to make calls like
257257 below to guarantee <var>StreamIn</var> is closed, even if <span class="pred-ext">process/1</span>
289289 dialects today. Writing a portable C program can only be achieved using
290290 cpp, the C preprocessor. The C preprocessor performs two tasks: macro
291291 expansion and conditional compilation. Prolog realises macro expansion
292 through <a id="idx:termexpansion2:2061"></a><a class="pred" href="consulting.html#term_expansion/2">term_expansion/2</a>
293 and <a id="idx:goalexpansion2:2062"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a>.
292 through <a id="idx:termexpansion2:2064"></a><a class="pred" href="consulting.html#term_expansion/2">term_expansion/2</a>
293 and <a id="idx:goalexpansion2:2065"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a>.
294294 Conditional compilation is achieved using <code>:- if(Condition)</code>
295295 as explained in
296296 <a class="sec" href="consulting.html">section 4.3.1.2</a>. The situation
312312
313313 <p>We must learn from the distinction to test for features instead of
314314 platform (dialect), as this makes the platform-specific code robust for
315 future changes of the dialect. Suppose we need <a id="idx:compare3:2063"></a><a class="pred" href="compare.html#compare/3">compare/3</a>
316 as defined in this manual. The <a id="idx:compare3:2064"></a><a class="pred" href="compare.html#compare/3">compare/3</a>
315 future changes of the dialect. Suppose we need <a id="idx:compare3:2066"></a><a class="pred" href="compare.html#compare/3">compare/3</a>
316 as defined in this manual. The <a id="idx:compare3:2067"></a><a class="pred" href="compare.html#compare/3">compare/3</a>
317317 predicate is not part of the ISO standard, but many systems support it
318318 and it is not unlikely it will become ISO standard or the intended
319319 dialect will start supporting it. GNU autoconf strongly advises to test
334334 dialect and, possibly at least as important, will provide compatibility
335335 with dialects you didn't even consider porting to right now.
336336
337 <p>In a more challenging case, the target Prolog has <a id="idx:compare3:2065"></a><a class="pred" href="compare.html#compare/3">compare/3</a>,
337 <p>In a more challenging case, the target Prolog has <a id="idx:compare3:2068"></a><a class="pred" href="compare.html#compare/3">compare/3</a>,
338338 but the semantics are different. What to do? One option is to write a
339 <a id="idx:mycompare3:2066"></a><span class="pred-ext">my_compare/3</span>
339 <a id="idx:mycompare3:2069"></a><span class="pred-ext">my_compare/3</span>
340340 and change all occurrences in the code. Alternatively you can rename
341 calls using <a id="idx:goalexpansion2:2067"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a>
341 calls using <a id="idx:goalexpansion2:2070"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a>
342342 like below. This construct will not only deal with Prolog dialects
343 lacking <a id="idx:compare3:2068"></a><a class="pred" href="compare.html#compare/3">compare/3</a>
343 lacking <a id="idx:compare3:2071"></a><a class="pred" href="compare.html#compare/3">compare/3</a>
344344 as well as those that only implement it for numeric comparison or have
345345 changed the argument order. Of course, writing rock-solid code would
346346 require a complete test-suite, but this example will probably cover all
347347 Prolog dialects that allow for conditional compilation, have core ISO
348 facilities and provide <a id="idx:goalexpansion2:2069"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a>,
348 facilities and provide <a id="idx:goalexpansion2:2072"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a>,
349349 the things we claim a Prolog dialect should have to start writing
350350 portable code for it.
351351
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 8.3</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 8.3</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
254254 <dt class="pubdef"><a id="chr_constraint/1">:- <strong>chr_constraint</strong>(<var>+Specifier</var>)</a></dt>
255255 <dd class="defbody">
256256 Every constraint used in CHR rules has to be declared with a
257 <a id="idx:chrconstraint1:1673"></a><a class="pred" href="practical.html#chr_constraint/1">chr_constraint/1</a>
257 <a id="idx:chrconstraint1:1676"></a><a class="pred" href="practical.html#chr_constraint/1">chr_constraint/1</a>
258258 declaration by the <em>constraint specifier</em>. For convenience
259259 multiple constraints may be declared at once with the same
260260 <a class="pred" href="practical.html#chr_constraint/1">chr_constraint/1</a>
356356 <dd class="defbody">
357357 User-defined types are algebraic data types, similar to those in Haskell
358358 or the discriminated unions in Mercury. An algebraic data type is
359 defined using <a id="idx:chrtype1:1674"></a><a class="pred" href="practical.html#chr_type/1">chr_type/1</a>:
359 defined using <a id="idx:chrtype1:1677"></a><a class="pred" href="practical.html#chr_type/1">chr_type/1</a>:
360360
361361 <pre class="code">
362362 :- chr_type type ---&gt; body.
492492
493493 <p><h3 id="sec:chr-compilation"><a id="sec:8.3.3"><span class="sec-nr">8.3.3</span> <span class="sec-title">Compilation</span></a></h3>
494494
495 <a id="sec:chr-compilation"></a> The SWI-Prolog CHR compiler exploits <a id="idx:termexpansion2:1675"></a><a class="pred" href="consulting.html#term_expansion/2">term_expansion/2</a>
495 <a id="sec:chr-compilation"></a> The SWI-Prolog CHR compiler exploits <a id="idx:termexpansion2:1678"></a><a class="pred" href="consulting.html#term_expansion/2">term_expansion/2</a>
496496 rules to translate the constraint handling rules to plain Prolog. These
497497 rules are loaded from the library <code>library(chr)</code>. They are
498498 activated if the compiled file has the <code>.chr</code> extension or
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.1</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.1</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
248248 by <code><code>+</code></code>.</span></sup>
249249
250250 <p><table class="latex frame-hsides center">
251 <tr><td>++</td><td>Argument must be ground, i.e., the argument may not
252 contain a variable anywhere. </td></tr>
251253 <tr><td>+</td><td>Argument must be fully instantiated to a term that
252 satisfies the required argument type. Think of the argument as <em>input</em>. </td></tr>
253 <tr><td>-</td><td>Argument must be unbound. Think of the argument as <em>output</em>. </td></tr>
254 satisfies the type. This is not necessarily <em>ground</em>, e.g., the
255 term
256 <code>[_]</code> is a <em>list</em>, although its only member is
257 unbound. </td></tr>
258 <tr><td>-</td><td>Argument is an <em>output</em> argument. Unless
259 specified otherwise, output arguments need not to be unbound. For
260 example, the goal <code>findall(X, Goal, [T])</code> is good style and
261 equivalent to <code>findall(X, Goal, Xs), Xs = [T]</code><sup class="fn">38<span class="fn-text">The
262 ISO standard dictates that <code>findall(X, Goal, 1)</code> raises a <code>type_error</code>
263 exception, breaking this semantic relation. SWI-Prolog does not follow
264 the standard here.</span></sup> Note that the
265 <em>determinism</em> specification, e.g., ``det'' only applies if this
266 argument is unbound. </td></tr>
267 <tr><td>--</td><td>Argument must be unbound. Typically used by
268 predicates that create `something' and return a handle to the created
269 object, such as <a id="idx:open3:304"></a><a class="pred" href="IO.html#open/3">open/3</a>
270 which creates a <em>stream</em>. </td></tr>
254271 <tr><td>?</td><td>Argument must be bound to a <em>partial term</em> of
255272 the indicated type. Note that a variable is a partial term for any type.
256273 Think of the argument as either <em>input</em> or <em>output</em> or
265282 for type tests.</td></tr>
266283 <tr><td>!</td><td>Argument contains a mutable structure that may be
267284 modified using
268 <a id="idx:setarg3:304"></a><a class="pred" href="manipterm.html#setarg/3">setarg/3</a>
269 or <a id="idx:nbsetarg3:305"></a><a class="pred" href="manipterm.html#nb_setarg/3">nb_setarg/3</a>. </td></tr>
285 <a id="idx:setarg3:305"></a><a class="pred" href="manipterm.html#setarg/3">setarg/3</a>
286 or <a id="idx:nbsetarg3:306"></a><a class="pred" href="manipterm.html#nb_setarg/3">nb_setarg/3</a>. </td></tr>
270287 </table>
271288
272 <p><a id="idx:predicateindicator:306"></a>Referring to a predicate in
289 <p><a id="idx:predicateindicator:307"></a>Referring to a predicate in
273290 running text is done using a
274291 <em>predicate indicator</em>. The canonical and most generic form of a
275292 predicate indicator is a term &lt;<var>module</var>&gt;:&lt;<var>name</var>&gt;/&lt;<var>arity</var>&gt;.
283300 regardless of whether or not the referenced predicate is defined or can
284301 be used as a grammar rule. The //-notation can be used in all places
285302 that traditionally allow for a predicate indicator, e.g., the module
286 declaration, <a id="idx:spy1:307"></a><a class="pred" href="debugger.html#spy/1">spy/1</a>,
287 and <a id="idx:dynamic1:308"></a><a class="pred" href="dynamic.html#dynamic/1">dynamic/1</a>.
303 declaration, <a id="idx:spy1:308"></a><a class="pred" href="debugger.html#spy/1">spy/1</a>,
304 and <a id="idx:dynamic1:309"></a><a class="pred" href="dynamic.html#dynamic/1">dynamic/1</a>.
288305
289306 <p></body></html>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.23</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.23</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section F.1</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section F.1</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
236236
237237 <a id="sec:predsummary"></a>
238238
239 <p>The predicate summary is used by the Prolog predicate <a id="idx:apropos1:2142"></a><a class="pred" href="help.html#apropos/1">apropos/1</a>
239 <p>The predicate summary is used by the Prolog predicate <a id="idx:apropos1:2149"></a><a class="pred" href="help.html#apropos/1">apropos/1</a>
240240 to suggest predicates from a keyword.
241241 <table>
242242 <tr><td><a class="pred" href="overrule.html#@/2">@/2</a></td><td>Call
286286 <tr><td><a class="pred" href="compare.html#@>=/2">@&gt;=/2</a></td><td>Standard
287287 order larger or equal</td></tr>
288288 <tr><td><a class="pred" href="control.html#\+/1">\+/1</a></td><td>Negation
289 by failure. Same as <a id="idx:not1:2143"></a><a class="pred" href="metacall.html#not/1">not/1</a></td></tr>
289 by failure. Same as <a id="idx:not1:2150"></a><a class="pred" href="metacall.html#not/1">not/1</a></td></tr>
290290 <tr><td><a class="pred" href="compare.html#\=/2">\=/2</a></td><td>True
291291 if arguments cannot be unified</td></tr>
292292 <tr><td><a class="pred" href="compare.html#\==/2">\==/2</a></td><td>True
294294 <tr><td><a class="pred" href="compare.html#\=@=/2">\=@=/2</a></td><td>Not
295295 structural identical</td></tr>
296296 <tr><td><span class="pred-ext">^/2</span></td><td>Existential
297 quantification (<a id="idx:bagof3:2144"></a><a class="pred" href="allsolutions.html#bagof/3">bagof/3</a>, <a id="idx:setof3:2145"></a><a class="pred" href="allsolutions.html#setof/3">setof/3</a>)</td></tr>
297 quantification (<a id="idx:bagof3:2151"></a><a class="pred" href="allsolutions.html#bagof/3">bagof/3</a>, <a id="idx:setof3:2152"></a><a class="pred" href="allsolutions.html#setof/3">setof/3</a>)</td></tr>
298298 <tr><td><a class="pred" href="control.html#|/2">|/2</a></td><td>Disjunction
299299 in DCGs. Same as <a class="pred" href="control.html#;/2">;/2</a></td></tr>
300300 <tr><td><span class="pred-ext">/1</span></td><td>DCG escape; constraints</td></tr>
357357 <tr><td><a class="pred" href="chario.html#at_end_of_stream/1">at_end_of_stream/1</a></td><td>Test
358358 for end of file on stream</td></tr>
359359 <tr><td><a class="pred" href="consulting.html#at_halt/1">at_halt/1</a></td><td>Register
360 goal to run at <a id="idx:halt1:2146"></a><a class="pred" href="toplevel.html#halt/1">halt/1</a></td></tr>
360 goal to run at <a id="idx:halt1:2153"></a><a class="pred" href="toplevel.html#halt/1">halt/1</a></td></tr>
361361 <tr><td><a class="pred" href="typetest.html#atom/1">atom/1</a></td><td>Type
362362 check for an atom</td></tr>
363363 <tr><td><a class="pred" href="manipatom.html#atom_chars/2">atom_chars/2</a></td><td>Convert
418418 a goal with a cleaup-handler</td></tr>
419419 <tr><td><a class="pred" href="metacall.html#call_cleanup/2">call_cleanup/2</a></td><td>Guard
420420 a goal with a cleaup-handler</td></tr>
421 <tr><td><a class="pred" href="DCG.html#call_dcg/3">call_dcg/3</a></td><td>As <a id="idx:phrase3:2147"></a><a class="pred" href="DCG.html#phrase/3">phrase/3</a>
421 <tr><td><a class="pred" href="DCG.html#call_dcg/3">call_dcg/3</a></td><td>As <a id="idx:phrase3:2154"></a><a class="pred" href="DCG.html#phrase/3">phrase/3</a>
422422 without type checking</td></tr>
423423 <tr><td><a class="pred" href="coroutining.html#call_residue_vars/2">call_residue_vars/2</a></td><td>Find
424424 residual attributed variables</td></tr>
430430 goal in limited inferences</td></tr>
431431 <tr><td><a class="pred" href="typetest.html#callable/1">callable/1</a></td><td>Test
432432 for atom or compound term</td></tr>
433 <tr><td><a class="pred" href="consulting.html#cancel_halt/1">cancel_halt/1</a></td><td>Cancel <a id="idx:halt0:2148"></a><a class="pred" href="toplevel.html#halt/0">halt/0</a>
434 from an <a id="idx:athalt1:2149"></a><a class="pred" href="consulting.html#at_halt/1">at_halt/1</a>
433 <tr><td><a class="pred" href="consulting.html#cancel_halt/1">cancel_halt/1</a></td><td>Cancel <a id="idx:halt0:2155"></a><a class="pred" href="toplevel.html#halt/0">halt/0</a>
434 from an <a id="idx:athalt1:2156"></a><a class="pred" href="consulting.html#at_halt/1">at_halt/1</a>
435435 hook</td></tr>
436436 <tr><td><a class="pred" href="exception.html#catch/3">catch/3</a></td><td>Call
437437 goal, watching for exceptions</td></tr>
480480 <tr><td><a class="pred" href="compare.html#compare/3">compare/3</a></td><td>Compare,
481481 using a predicate to determine the order</td></tr>
482482 <tr><td><a class="pred" href="consulting.html#compile_aux_clauses/1">compile_aux_clauses/1</a></td><td>Compile
483 predicates for <a id="idx:goalexpansion2:2150"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a></td></tr>
483 predicates for <a id="idx:goalexpansion2:2157"></a><a class="pred" href="consulting.html#goal_expansion/2">goal_expansion/2</a></td></tr>
484484 <tr><td><a class="pred" href="dynamic.html#compile_predicates/1">compile_predicates/1</a></td><td>Compile
485485 dynamic code to static</td></tr>
486486 <tr><td><a class="pred" href="consulting.html#compiling/0">compiling/0</a></td><td>Is
584584 <tr><td><a class="pred" href="debug.html#debug/3">debug/3</a></td><td>Print
585585 debugging message on topic</td></tr>
586586 <tr><td><span class="pred-ext">debug_control_hook/1</span></td><td><i>(hook)</i>
587 Extend <a id="idx:spy1:2151"></a><a class="pred" href="debugger.html#spy/1">spy/1</a>,
587 Extend <a id="idx:spy1:2158"></a><a class="pred" href="debugger.html#spy/1">spy/1</a>,
588588 etc.</td></tr>
589589 <tr><td><a class="pred" href="debugger.html#debugging/0">debugging/0</a></td><td>Show
590590 debugger status</td></tr>
612612 entries of a directory/folder</td></tr>
613613 <tr><td><a class="pred" href="dynamic.html#discontiguous/1">discontiguous/1</a></td><td>Indicate
614614 distributed definition of a predicate</td></tr>
615 <tr><td><a class="pred" href="arith.html#divmod/4">divmod/4</a></td><td>Compute
616 quotient and remainder of two integers</td></tr>
615617 <tr><td><a class="pred" href="chartype.html#downcase_atom/2">downcase_atom/2</a></td><td>Convert
616618 atom to lower-case</td></tr>
617619 <tr><td><a class="pred" href="manipterm.html#duplicate_term/2">duplicate_term/2</a></td><td>Create
697699 <tr><td><a class="pred" href="allsolutions.html#findall/3">findall/3</a></td><td>Find
698700 all solutions to a goal</td></tr>
699701 <tr><td><a class="pred" href="allsolutions.html#findall/4">findall/4</a></td><td>Difference
700 list version of <a id="idx:findall3:2152"></a><a class="pred" href="allsolutions.html#findall/3">findall/3</a></td></tr>
702 list version of <a id="idx:findall3:2159"></a><a class="pred" href="allsolutions.html#findall/3">findall/3</a></td></tr>
701703 <tr><td><a class="pred" href="allsolutions.html#findnsols/4">findnsols/4</a></td><td>Find
702704 first <var>N</var> solutions</td></tr>
703705 <tr><td><a class="pred" href="allsolutions.html#findnsols/5">findnsols/5</a></td><td>Difference
704 list version of <a id="idx:findsols4:2153"></a><span class="pred-ext">findsols/4</span></td></tr>
706 list version of <a id="idx:findsols4:2160"></a><span class="pred-ext">findsols/4</span></td></tr>
705707 <tr><td><a class="pred" href="db.html#flag/3">flag/3</a></td><td>Simple
706708 global variable system</td></tr>
707709 <tr><td><a class="pred" href="typetest.html#float/1">float/1</a></td><td>Type
722724 strftime() like date/time formatter</td></tr>
723725 <tr><td><a class="pred" href="system.html#format_time/4">format_time/4</a></td><td>date/time
724726 formatter with explicit locale</td></tr>
725 <tr><td><a class="pred" href="format.html#format_predicate/2">format_predicate/2</a></td><td>Program <a id="idx:format12:2154"></a><span class="pred-ext">format/[1,2]</span></td></tr>
727 <tr><td><a class="pred" href="format.html#format_predicate/2">format_predicate/2</a></td><td>Program <a id="idx:format12:2161"></a><span class="pred-ext">format/[1,2]</span></td></tr>
726728 <tr><td><a class="pred" href="attvar.html#term_attvars/2">term_attvars/2</a></td><td>Find
727729 attributed variables in a term</td></tr>
728730 <tr><td><a class="pred" href="manipterm.html#term_variables/2">term_variables/2</a></td><td>Find
923925 between dict and list of pairs</td></tr>
924926 <tr><td><a class="pred" href="assoc.html#max_assoc/3">max_assoc/3</a></td><td>Highest
925927 key in association tree</td></tr>
926 <tr><td><a class="pred" href="builtinlist.html#memberchk/2">memberchk/2</a></td><td>Deterministic <a id="idx:member2:2155"></a><a class="pred" href="lists.html#member/2">member/2</a></td></tr>
927 <tr><td><a class="pred" href="exception.html#message_hook/3">message_hook/3</a></td><td>Intercept <a id="idx:printmessage2:2156"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a></td></tr>
928 <tr><td><a class="pred" href="builtinlist.html#memberchk/2">memberchk/2</a></td><td>Deterministic <a id="idx:member2:2162"></a><a class="pred" href="lists.html#member/2">member/2</a></td></tr>
929 <tr><td><a class="pred" href="exception.html#message_hook/3">message_hook/3</a></td><td>Intercept <a id="idx:printmessage2:2163"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a></td></tr>
928930 <tr><td><span class="pred-ext">message_line_element/2</span></td><td><i>(hook)</i>
929 Intercept <a id="idx:printmessagelines3:2157"></a><a class="pred" href="exception.html#print_message_lines/3">print_message_lines/3</a></td></tr>
931 Intercept <a id="idx:printmessagelines3:2164"></a><a class="pred" href="exception.html#print_message_lines/3">print_message_lines/3</a></td></tr>
930932 <tr><td><a class="pred" href="exception.html#message_property/2">message_property/2</a></td><td><i>(hook)</i>
931933 Define display of a message</td></tr>
932934 <tr><td><a class="pred" href="threadcom.html#message_queue_create/1">message_queue_create/1</a></td><td>Create
10271029 not debug argument goal</td></tr>
10281030 <tr><td><a class="pred" href="examineprog.html#nth_clause/3">nth_clause/3</a></td><td>N-th
10291031 clause of a predicate</td></tr>
1032 <tr><td><a class="pred" href="arith.html#nth_integer_root_and_remainder/4">nth_integer_root_and_remainder/4</a></td><td>Integer
1033 root and remainder</td></tr>
10301034 <tr><td><a class="pred" href="typetest.html#number/1">number/1</a></td><td>Type
10311035 check for integer or float</td></tr>
10321036 <tr><td><a class="pred" href="manipatom.html#number_chars/2">number_chars/2</a></td><td>Convert
10961100 <tr><td><a class="pred" href="arith.html#plus/3">plus/3</a></td><td>Logical
10971101 integer addition</td></tr>
10981102 <tr><td><a class="pred" href="termrw.html#portray/1">portray/1</a></td><td><i>(hook)</i>
1099 Modify behaviour of <a id="idx:print1:2158"></a><a class="pred" href="termrw.html#print/1">print/1</a></td></tr>
1103 Modify behaviour of <a id="idx:print1:2165"></a><a class="pred" href="termrw.html#print/1">print/1</a></td></tr>
11001104 <tr><td><a class="pred" href="listing.html#portray_clause/1">portray_clause/1</a></td><td>Pretty
11011105 print a clause</td></tr>
11021106 <tr><td><a class="pred" href="listing.html#portray_clause/2">portray_clause/2</a></td><td>Pretty
11321136 <tr><td><a class="pred" href="ancestral-cut.html#prolog_cut_to/1">prolog_cut_to/1</a></td><td>Realise
11331137 global cuts</td></tr>
11341138 <tr><td><a class="pred" href="edit.html#prolog_edit:locate/2">prolog_edit:locate/2</a></td><td>Locate
1135 targets for <a id="idx:edit1:2159"></a><a class="pred" href="edit.html#edit/1">edit/1</a></td></tr>
1139 targets for <a id="idx:edit1:2166"></a><a class="pred" href="edit.html#edit/1">edit/1</a></td></tr>
11361140 <tr><td><a class="pred" href="edit.html#prolog_edit:locate/3">prolog_edit:locate/3</a></td><td>Locate
1137 targets for <a id="idx:edit1:2160"></a><a class="pred" href="edit.html#edit/1">edit/1</a></td></tr>
1141 targets for <a id="idx:edit1:2167"></a><a class="pred" href="edit.html#edit/1">edit/1</a></td></tr>
11381142 <tr><td><a class="pred" href="edit.html#prolog_edit:edit_source/1">prolog_edit:edit_source/1</a></td><td>Call
1139 editor for <a id="idx:edit1:2161"></a><a class="pred" href="edit.html#edit/1">edit/1</a></td></tr>
1143 editor for <a id="idx:edit1:2168"></a><a class="pred" href="edit.html#edit/1">edit/1</a></td></tr>
11401144 <tr><td><a class="pred" href="edit.html#prolog_edit:edit_command/2">prolog_edit:edit_command/2</a></td><td>Specify
11411145 editor activation</td></tr>
1142 <tr><td><a class="pred" href="edit.html#prolog_edit:load/0">prolog_edit:load/0</a></td><td>Load <a id="idx:edit1:2162"></a><a class="pred" href="edit.html#edit/1">edit/1</a>
1146 <tr><td><a class="pred" href="edit.html#prolog_edit:load/0">prolog_edit:load/0</a></td><td>Load <a id="idx:edit1:2169"></a><a class="pred" href="edit.html#edit/1">edit/1</a>
11431147 extensions</td></tr>
11441148 <tr><td><a class="pred" href="excepthook.html#prolog_exception_hook/4">prolog_exception_hook/4</a></td><td>Rewrite
11451149 exceptions</td></tr>
11541158 <tr><td><a class="pred" href="consulting.html#prolog_load_context/2">prolog_load_context/2</a></td><td>Context
11551159 information for directives</td></tr>
11561160 <tr><td><a class="pred" href="loadfilehook.html#prolog_load_file/2">prolog_load_file/2</a></td><td><i>(hook)</i>
1157 Program <a id="idx:loadfiles2:2163"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a></td></tr>
1161 Program <a id="idx:loadfiles2:2170"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a></td></tr>
11581162 <tr><td><a class="pred" href="tracehook.html#prolog_skip_level/2">prolog_skip_level/2</a></td><td>Indicate
11591163 deepest recursion to trace</td></tr>
11601164 <tr><td><a class="pred" href="tracehook.html#prolog_skip_frame/1">prolog_skip_frame/1</a></td><td>Perform
11701174 <tr><td><a class="pred" href="termrw.html#prompt1/1">prompt1/1</a></td><td>Change
11711175 prompt for 1 line</td></tr>
11721176 <tr><td><a class="pred" href="termrw.html#prompt/2">prompt/2</a></td><td>Change
1173 the prompt used by <a id="idx:read1:2164"></a><a class="pred" href="termrw.html#read/1">read/1</a></td></tr>
1177 the prompt used by <a id="idx:read1:2171"></a><a class="pred" href="termrw.html#read/1">read/1</a></td></tr>
11741178 <tr><td><a class="pred" href="protocol.html#protocol/1">protocol/1</a></td><td>Make
11751179 a log of the user interaction</td></tr>
11761180 <tr><td><a class="pred" href="protocol.html#protocola/1">protocola/1</a></td><td>Append
14721476 <tr><td><a class="pred" href="threadcom.html#thread_local/1">thread_local/1</a></td><td>Declare
14731477 thread-specific clauses for a predicate</td></tr>
14741478 <tr><td><a class="pred" href="exception.html#thread_message_hook/3">thread_message_hook/3</a></td><td>Thread
1475 local <a id="idx:messagehook3:2165"></a><a class="pred" href="exception.html#message_hook/3">message_hook/3</a></td></tr>
1479 local <a id="idx:messagehook3:2172"></a><a class="pred" href="exception.html#message_hook/3">message_hook/3</a></td></tr>
14761480 <tr><td><a class="pred" href="threadcom.html#thread_peek_message/1">thread_peek_message/1</a></td><td>Test
14771481 for message</td></tr>
14781482 <tr><td><a class="pred" href="threadcom.html#thread_peek_message/2">thread_peek_message/2</a></td><td>Test
14941498 <tr><td><a class="pred" href="thutil.html#threads/0">threads/0</a></td><td>List
14951499 running threads</td></tr>
14961500 <tr><td><a class="pred" href="exception.html#throw/1">throw/1</a></td><td>Raise
1497 an exception (see <a id="idx:catch3:2166"></a><a class="pred" href="exception.html#catch/3">catch/3</a>)</td></tr>
1501 an exception (see <a id="idx:catch3:2173"></a><a class="pred" href="exception.html#catch/3">catch/3</a>)</td></tr>
14981502 <tr><td><a class="pred" href="statistics.html#time/1">time/1</a></td><td>Determine
14991503 time needed to execute goal</td></tr>
15001504 <tr><td><a class="pred" href="files.html#time_file/2">time_file/2</a></td><td>Get
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.39</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.39</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
241241 profiler is based on ideas from <b>gprof</b> described in
242242 <cite><a class="cite" href="Bibliography.html#graham82gprof">Graham <em>et
243243 al.</em>, 1982</a></cite>. The profiler consists of two parts: the
244 information-gathering component built into the kernel,<sup class="fn">121<span class="fn-text">There
244 information-gathering component built into the kernel,<sup class="fn">124<span class="fn-text">There
245245 are two implementations; one based on setitimer() using the <code>SIGPROF</code>
246246 signal and one using Windows Multi Media (MM) timers. On other systems
247247 the profiler is not provided.</span></sup> and a presentation component
260260 <dl class="latex">
261261 <dt class="pubdef"><a id="profile/1"><strong>profile</strong>(<var>:Goal</var>)</a></dt>
262262 <dd class="defbody">
263 Execute <var>Goal</var> just like <a id="idx:once1:1419"></a><a class="pred" href="metacall.html#once/1">once/1</a>,
263 Execute <var>Goal</var> just like <a id="idx:once1:1421"></a><a class="pred" href="metacall.html#once/1">once/1</a>,
264264 collecting profiling statistics, and call <code>show_profile([])</code>.
265265 With XPCE installed this opens a graphical interface to examine the
266266 collected profiling data.</dd>
267267 <dt class="pubdef"><a id="profile/3"><strong>profile</strong>(<var>:Goal,
268268 +Options</var>)</a></dt>
269269 <dd class="defbody">
270 Execute <var>Goal</var> just like <a id="idx:once1:1420"></a><a class="pred" href="metacall.html#once/1">once/1</a>.
271 Collect profiling statistics according to <var>Options</var> and call <a id="idx:showprofile1:1421"></a><a class="pred" href="profile.html#show_profile/1">show_profile/1</a>
270 Execute <var>Goal</var> just like <a id="idx:once1:1422"></a><a class="pred" href="metacall.html#once/1">once/1</a>.
271 Collect profiling statistics according to <var>Options</var> and call <a id="idx:showprofile1:1423"></a><a class="pred" href="profile.html#show_profile/1">show_profile/1</a>
272272 with <var>Options</var>. The default collects CPU profiling and opens a
273273 graphical interface when provided, printing the `plain' time usage of
274274 the top 25 predicates as a ballback. Options are described below.
275 Remaining options are passed to <a id="idx:showprofile1:1422"></a><a class="pred" href="profile.html#show_profile/1">show_profile/1</a>.
275 Remaining options are passed to <a id="idx:showprofile1:1424"></a><a class="pred" href="profile.html#show_profile/1">show_profile/1</a>.
276276
277277 <dl class="latex">
278278 <dt><strong>time</strong>(<var>+Which</var>)</dt>
337337 Declares the predicate <var>Name</var>/<var>Arity</var> to be invisible
338338 to the profiler. The time spent in the named predicate is added to the
339339 caller, and the callees are linked directly to the caller. This is
340 particularly useful for simple meta-predicates such as <a id="idx:call1:1423"></a><a class="pred" href="metacall.html#call/1">call/1</a>, <a id="idx:ignore1:1424"></a><a class="pred" href="metacall.html#ignore/1">ignore/1</a>, <a id="idx:catch3:1425"></a><a class="pred" href="exception.html#catch/3">catch/3</a>,
340 particularly useful for simple meta-predicates such as <a id="idx:call1:1425"></a><a class="pred" href="metacall.html#call/1">call/1</a>, <a id="idx:ignore1:1426"></a><a class="pred" href="metacall.html#ignore/1">ignore/1</a>, <a id="idx:catch3:1427"></a><a class="pred" href="exception.html#catch/3">catch/3</a>,
341341 etc.
342342 </dd>
343343 </dl>
427427 to recursion. For this reason the system performs detection of
428428 recursion. In the simplest case, recursive procedures increment the
429429 `recursive' count on the current node. Mutual recursion, however, is not
430 easily detected. For example, <a id="idx:call1:1426"></a><a class="pred" href="metacall.html#call/1">call/1</a>
431 can call a predicate that uses <a id="idx:call1:1427"></a><a class="pred" href="metacall.html#call/1">call/1</a>
430 easily detected. For example, <a id="idx:call1:1428"></a><a class="pred" href="metacall.html#call/1">call/1</a>
431 can call a predicate that uses <a id="idx:call1:1429"></a><a class="pred" href="metacall.html#call/1">call/1</a>
432432 itself. This can be viewed as a recursive invocation, but this is
433433 generally not desirable. Recursion is currently assumed if the same
434434 predicate <em>with the same parent</em> appears higher in the
449449 <a id="sec:winprofile"></a>
450450
451451 <p>Profiling in the Windows version is similar, but as profiling is a
452 statistical process it is good to be aware of the implementation<sup class="fn">122<span class="fn-text">We
452 statistical process it is good to be aware of the implementation<sup class="fn">125<span class="fn-text">We
453453 hereby acknowledge Lionel Fourquaux, who suggested the design described
454454 here after a newsnet enquiry.</span></sup> for proper interpretation of
455455 the results.
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 3.1</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 3.1</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.25</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.25</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
255255 consider this interface rock-solid.</b>
256256
257257 <p>The library is exploited by two graphical tools in the SWI-Prolog
258 environment: the XPCE front-end started by <a id="idx:gxref0:1958"></a><a class="pred" href="xref.html#gxref/0">gxref/0</a>
258 environment: the XPCE front-end started by <a id="idx:gxref0:1961"></a><a class="pred" href="xref.html#gxref/0">gxref/0</a>
259259 and described in
260260 <a class="sec" href="xref.html">section 3.7</a>, and PceEmacs (<a class="sec" href="pceemacs.html">section
261261 3.4</a>), which exploits this library for its syntax colouring.
262262
263263 <p>For all predicates described below, <var>Source</var> is the source
264264 that is processed. This is normally a filename in any notation
265 acceptable to the file loading predicates (see <a id="idx:loadfiles2:1959"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>).
265 acceptable to the file loading predicates (see <a id="idx:loadfiles2:1962"></a><a class="pred" href="consulting.html#load_files/2">load_files/2</a>).
266266 Using the hooks defined in <a class="sec" href="prolog_xref.html">section
267267 A.25.1</a> it can be anything else that can be translated into a Prolog
268268 stream holding Prolog source text. <var>Callable</var> is a callable
269 term (see <a id="idx:callable1:1960"></a><a class="pred" href="typetest.html#callable/1">callable/1</a>).
269 term (see <a id="idx:callable1:1963"></a><a class="pred" href="typetest.html#callable/1">callable/1</a>).
270270 Callables do not carry a module qualifier unless the referred predicate
271271 is not in the module defined
272272 <var>Source</var>.
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.24</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.24</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.36</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.36</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
238238 <a id="sec:protocol"></a>
239239
240240 <p>SWI-Prolog offers the possibility to log the interaction with the
241 user on a file.<sup class="fn">120<span class="fn-text">A similar
241 user on a file.<sup class="fn">123<span class="fn-text">A similar
242242 facility was added to Edinburgh C-Prolog by Wouter Jansweijer.</span></sup>
243243 All Prolog interaction, including warnings and tracer output, are
244244 written to the protocol file.
252252 </dd>
253253 <dt class="pubdef"><a id="protocola/1"><strong>protocola</strong>(<var>+File</var>)</a></dt>
254254 <dd class="defbody">
255 Equivalent to <a id="idx:protocol1:1389"></a><a class="pred" href="protocol.html#protocol/1">protocol/1</a>,
255 Equivalent to <a id="idx:protocol1:1391"></a><a class="pred" href="protocol.html#protocol/1">protocol/1</a>,
256256 but does not truncate the <var>File</var> if it exists.
257257 </dd>
258258 <dt class="pubdef"><a id="noprotocol/0"><strong>noprotocol</strong></a></dt>
262262 </dd>
263263 <dt class="pubdef"><a id="protocolling/1"><strong>protocolling</strong>(<var>-File</var>)</a></dt>
264264 <dd class="defbody">
265 True if a protocol was started with <a id="idx:protocol1:1390"></a><a class="pred" href="protocol.html#protocol/1">protocol/1</a>
266 or <a id="idx:protocola1:1391"></a><a class="pred" href="protocol.html#protocola/1">protocola/1</a>
265 True if a protocol was started with <a id="idx:protocol1:1392"></a><a class="pred" href="protocol.html#protocol/1">protocol/1</a>
266 or <a id="idx:protocola1:1393"></a><a class="pred" href="protocol.html#protocola/1">protocola/1</a>
267267 and unifies <var>File</var> with the current protocol output file.
268268 </dd>
269269 </dl>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 11.2</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 11.2</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
264264 have a source file <code>myextension.c</code> defining the installation
265265 function install().
266266
267 <p>If this file is compiled into a shared library, <a id="idx:loadforeignlibrary1:1923"></a><a class="pred" href="foreignlink.html#load_foreign_library/1">load_foreign_library/1</a>
267 <p>If this file is compiled into a shared library, <a id="idx:loadforeignlibrary1:1926"></a><a class="pred" href="foreignlink.html#load_foreign_library/1">load_foreign_library/1</a>
268268 will load this library and call the installation function to initialise
269269 the foreign code. If it is loaded as a static extension, define
270270 install() as the predicate install/0 :
298298 :- initialization load_foreign_extensions.
299299 </pre>
300300
301 <p>The path alias <code>foreign</code> is defined by <a id="idx:filesearchpath2:1924"></a><a class="pred" href="consulting.html#file_search_path/2">file_search_path/2</a>.
301 <p>The path alias <code>foreign</code> is defined by <a id="idx:filesearchpath2:1927"></a><a class="pred" href="consulting.html#file_search_path/2">file_search_path/2</a>.
302302 By default it searches the directories <code>&lt;<var>home</var>&gt;/lib/&lt;<var>arch</var>&gt;</code>
303303 and
304304 <code>&lt;<var>home</var>&gt;/lib</code>. The application can specify
305305 additional rules for
306 <a id="idx:filesearchpath2:1925"></a><a class="pred" href="consulting.html#file_search_path/2">file_search_path/2</a>.
306 <a id="idx:filesearchpath2:1928"></a><a class="pred" href="consulting.html#file_search_path/2">file_search_path/2</a>.
307307
308308 <p></body></html>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 11.1</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 11.1</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
238238 <a id="sec:qsavelimits"></a>
239239
240240 <p>There are three areas that require special attention when using
241 <a id="idx:qsaveprogram12:1919"></a><span class="pred-ext">qsave_program/[1,2]</span>.
241 <a id="idx:qsaveprogram12:1922"></a><span class="pred-ext">qsave_program/[1,2]</span>.
242242
243243 <p>
244244 <ul class="latex">
251251 <li>If the program uses directives (<code>:- goal.</code> lines) that
252252 perform other actions than setting predicate attributes (dynamic,
253253 volatile, etc.) or loading files (consult, etc.), the directive may need
254 to be prefixed with <a id="idx:initialization1:1920"></a><a class="pred" href="consulting.html#initialization/1">initialization/1</a>.
254 to be prefixed with <a id="idx:initialization1:1923"></a><a class="pred" href="consulting.html#initialization/1">initialization/1</a>.
255255
256256 <p>
257 <li>Database references as returned by <a id="idx:clause3:1921"></a><a class="pred" href="examineprog.html#clause/3">clause/3</a>, <a id="idx:recorded3:1922"></a><a class="pred" href="db.html#recorded/3">recorded/3</a>,
257 <li>Database references as returned by <a id="idx:clause3:1924"></a><a class="pred" href="examineprog.html#clause/3">clause/3</a>, <a id="idx:recorded3:1925"></a><a class="pred" href="db.html#recorded/3">recorded/3</a>,
258258 etc., are not preserved and may thus not be part of the database when
259259 saved.
260260 </ul>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.26</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.26</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 2.1</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 2.1</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.27</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.27</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section B.9</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section B.9</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
239239
240240 <p>The following predicates are available if SWI-Prolog is linked to the
241241 GNU readline library. This is by default the case on non-Windows
242 installations and indicated by the Prolog flag <a class="flag" href="flags.html#flag:readline">readline</a>.<sup class="fn">163<span class="fn-text"><b>swipl-win.exe</b>
242 installations and indicated by the Prolog flag <a class="flag" href="flags.html#flag:readline">readline</a>.<sup class="fn">166<span class="fn-text"><b>swipl-win.exe</b>
243243 uses its own history system and does <em>not</em> support these
244244 predicates.</span></sup> See also <strong>readline</strong>(3).
245245
255255 library.</dd>
256256 <dt class="pubdef"><a id="rl_write_history/1"><strong>rl_write_history</strong>(<var>+FileName</var>)</a></dt>
257257 <dd class="defbody">
258 Write current history to <var>FileName</var>. Can be used from <a id="idx:athalt1:2046"></a><a class="pred" href="consulting.html#at_halt/1">at_halt/1</a>
258 Write current history to <var>FileName</var>. Can be used from <a id="idx:athalt1:2049"></a><a class="pred" href="consulting.html#at_halt/1">at_halt/1</a>
259259 to save the history.</dd>
260260 <dt class="pubdef"><a id="rl_read_history/1"><strong>rl_read_history</strong>(<var>+FileName</var>)</a></dt>
261261 <dd class="defbody">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.28</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.28</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
252252 Read the next line of input from <var>Stream</var> and unify the result
253253 with
254254 <var>Codes</var> <em>after</em> the line has been read. A line is ended
255 by a newline character or end-of-file. Unlike <a id="idx:readlinetocodes3:1961"></a><a class="pred" href="readutil.html#read_line_to_codes/3">read_line_to_codes/3</a>,
255 by a newline character or end-of-file. Unlike <a id="idx:readlinetocodes3:1964"></a><a class="pred" href="readutil.html#read_line_to_codes/3">read_line_to_codes/3</a>,
256256 this predicate removes a trailing newline character.
257257
258258 <p>On end-of-file the atom <code>end_of_file</code> is returned. See
259259 also
260 <a id="idx:atendofstream01:1962"></a><span class="pred-ext">at_end_of_stream/[0,1]</span>.</dd>
260 <a id="idx:atendofstream01:1965"></a><span class="pred-ext">at_end_of_stream/[0,1]</span>.</dd>
261261 <dt class="pubdef"><a id="read_line_to_codes/3"><strong>read_line_to_codes</strong>(<var>+Stream,
262262 -Codes, ?Tail</var>)</a></dt>
263263 <dd class="defbody">
264264 Difference-list version to read an input line to a list of character
265 codes. Reading stops at the newline or end-of-file character, but unlike <a id="idx:readlinetocodes2:1963"></a><a class="pred" href="readutil.html#read_line_to_codes/2">read_line_to_codes/2</a>,
265 codes. Reading stops at the newline or end-of-file character, but unlike <a id="idx:readlinetocodes2:1966"></a><a class="pred" href="readutil.html#read_line_to_codes/2">read_line_to_codes/2</a>,
266266 the newline is retained in the output. This predicate is especially
267267 useful for reading a block of lines up to some delimiter. The following
268268 example reads an HTTP header ended by a blank line:
288288 <dt class="pubdef"><a id="read_stream_to_codes/3"><strong>read_stream_to_codes</strong>(<var>+Stream,
289289 -Codes, ?Tail</var>)</a></dt>
290290 <dd class="defbody">
291 Difference-list version of <a id="idx:readstreamtocodes2:1964"></a><a class="pred" href="readutil.html#read_stream_to_codes/2">read_stream_to_codes/2</a>.</dd>
291 Difference-list version of <a id="idx:readstreamtocodes2:1967"></a><a class="pred" href="readutil.html#read_stream_to_codes/2">read_stream_to_codes/2</a>.</dd>
292292 <dt class="pubdef"><a id="read_file_to_codes/3"><strong>read_file_to_codes</strong>(<var>+Spec,
293293 -Codes, +Options</var>)</a></dt>
294294 <dd class="defbody">
295295 Read a file to a list of character codes. <var>Spec</var> is a file
296 specification for <a id="idx:absolutefilename3:1965"></a><a class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</a>. <var>Codes</var>
296 specification for <a id="idx:absolutefilename3:1968"></a><a class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</a>. <var>Codes</var>
297297 is the resulting code list. <var>Options</var> is a list of options for
298 <a id="idx:absolutefilename3:1966"></a><a class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</a>
299 and <a id="idx:open4:1967"></a><a class="pred" href="IO.html#open/4">open/4</a>.
298 <a id="idx:absolutefilename3:1969"></a><a class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</a>
299 and <a id="idx:open4:1970"></a><a class="pred" href="IO.html#open/4">open/4</a>.
300300 In addition, the option
301301 <code>tail(Tail)</code> is defined, forming a difference-list.</dd>
302302 <dt class="pubdef"><a id="read_file_to_terms/3"><strong>read_file_to_terms</strong>(<var>+Spec,
303303 -Terms, +Options</var>)</a></dt>
304304 <dd class="defbody">
305 Read a file to a list of Prolog terms (see <a id="idx:read1:1968"></a><a class="pred" href="termrw.html#read/1">read/1</a>). <var>Spec</var>
306 is a file specification for <a id="idx:absolutefilename3:1969"></a><a class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</a>. <var>Terms</var>
305 Read a file to a list of Prolog terms (see <a id="idx:read1:1971"></a><a class="pred" href="termrw.html#read/1">read/1</a>). <var>Spec</var>
306 is a file specification for <a id="idx:absolutefilename3:1972"></a><a class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</a>. <var>Terms</var>
307307 is the resulting list of Prolog terms. <var>Options</var> is a list of
308308 options for
309 <a id="idx:absolutefilename3:1970"></a><a class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</a>
310 and <a id="idx:open4:1971"></a><a class="pred" href="IO.html#open/4">open/4</a>.
309 <a id="idx:absolutefilename3:1973"></a><a class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</a>
310 and <a id="idx:open4:1974"></a><a class="pred" href="IO.html#open/4">open/4</a>.
311311 In addition, the option
312312 <code>tail(Tail)</code> is defined, forming a difference-list.
313313 </dd>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.29</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.29</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
251251 predicates, an optimizing compiler can easily inline them for optimal
252252 preformance.
253253
254 <p>A record is defined using the directive <a id="idx:record1:1972"></a><a class="pred" href="record.html#record/1">record/1</a>.
254 <p>A record is defined using the directive <a id="idx:record1:1975"></a><a class="pred" href="record.html#record/1">record/1</a>.
255255 We introduce the library with a short example:
256256
257257 <pre class="code">
274274
275275 <p>In this definition, &lt;<var>name</var>&gt; is an atom defining the
276276 name of the argument,
277 &lt;<var>type</var>&gt; is an optional type specification as defined by <a id="idx:mustbe2:1973"></a><span class="pred-ext">must_be/2</span>
277 &lt;<var>type</var>&gt; is an optional type specification as defined by <a id="idx:mustbe2:1976"></a><span class="pred-ext">must_be/2</span>
278278 from library <code>library(error)</code>, and &lt;<var>default</var>&gt;
279279 is the default initial value. The
280280 &lt;<var>type</var>&gt; defaults to <code>any</code>. If no default
310310 <p>
311311 <li><i>&lt;<var>constructor</var>&gt;_&lt;<var>name</var>&gt;(Record,
312312 Value)</i><br>
313 Unify <var>Value</var> with argument in <var>Record</var> named &lt;<var>name</var>&gt;.<sup class="fn">160<span class="fn-text">Note
313 Unify <var>Value</var> with argument in <var>Record</var> named &lt;<var>name</var>&gt;.<sup class="fn">163<span class="fn-text">Note
314314 this is not called `get_' as it performs unification and can perfectly
315315 well instantiate the argument.</span></sup>
316316
330330 !Record)</i><br>
331331 Destructively replace the argument &lt;<var>name</var>&gt; in <var>Record</var>
332332 by
333 <var>Value</var> based on <a id="idx:setarg3:1974"></a><a class="pred" href="manipterm.html#setarg/3">setarg/3</a>.
333 <var>Value</var> based on <a id="idx:setarg3:1977"></a><a class="pred" href="manipterm.html#setarg/3">setarg/3</a>.
334334 Use with care.
335335
336336 <p>
337337 <li><i>nb_set_&lt;<var>name</var>&gt;_of_&lt;<var>constructor</var>&gt;(+Value,
338338 !Record)</i><br>
339 As above, but using non-backtrackable assignment based on <a id="idx:nbsetarg3:1975"></a><a class="pred" href="manipterm.html#nb_setarg/3">nb_setarg/3</a>.
339 As above, but using non-backtrackable assignment based on <a id="idx:nbsetarg3:1978"></a><a class="pred" href="manipterm.html#nb_setarg/3">nb_setarg/3</a>.
340340 Use with <em>extreme</em> care.
341341
342342 <p>
363363 <dd class="defbody">
364364 The construct <code>:- record Spec, ...</code> is used to define access
365365 to named fields in a compound. It is subject to term-expansion (see
366 <a id="idx:expandterm2:1976"></a><a class="pred" href="consulting.html#expand_term/2">expand_term/2</a>)
366 <a id="idx:expandterm2:1979"></a><a class="pred" href="consulting.html#expand_term/2">expand_term/2</a>)
367367 and cannot be called as a predicate. See
368368 <a class="sec" href="record.html">section A.29</a> for details.
369369 </dd>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 6.7</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 6.7</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
240240 <p>The predicates in this section are intended to create new modules
241241 from the content of other modules. Below is an example to define a
242242 <em>composite</em> module. The example exports all public predicates of <code>module_1</code>, <code>module_2</code>
243 and <code>module_3</code>, <a id="idx:pred1:1566"></a><span class="pred-ext">pred/1</span>
243 and <code>module_3</code>, <a id="idx:pred1:1568"></a><span class="pred-ext">pred/1</span>
244244 from <code>module_4</code>, all predicates from <code>module_5</code>
245245 except
246 <a id="idx:donotuse1:1567"></a><span class="pred-ext">do_not_use/1</span>
246 <a id="idx:donotuse1:1569"></a><span class="pred-ext">do_not_use/1</span>
247247 and all predicates from <code>module_6</code> while renaming
248 <a id="idx:pred1:1568"></a><span class="pred-ext">pred/1</span> into <a id="idx:mypred1:1569"></a><span class="pred-ext">mypred/1</span>.
248 <a id="idx:pred1:1570"></a><span class="pred-ext">pred/1</span> into <a id="idx:mypred1:1571"></a><span class="pred-ext">mypred/1</span>.
249249
250250 <pre class="code">
251251 :- module(my_composite, []).
261261 <dl class="latex">
262262 <dt class="pubdef"><a id="reexport/1"><strong>reexport</strong>(<var>+Files</var>)</a></dt>
263263 <dd class="defbody">
264 Load and import predicates as <a id="idx:usemodule1:1570"></a><a class="pred" href="import.html#use_module/1">use_module/1</a>
264 Load and import predicates as <a id="idx:usemodule1:1572"></a><a class="pred" href="import.html#use_module/1">use_module/1</a>
265265 and re-export all imported predicates. The reexport declarations must
266266 immediately follow the module declaration.</dd>
267267 <dt class="pubdef"><a id="reexport/2"><strong>reexport</strong>(<var>+File,
268268 +Import</var>)</a></dt>
269269 <dd class="defbody">
270 Import from <var>File</var> as <a id="idx:usemodule2:1571"></a><a class="pred" href="import.html#use_module/2">use_module/2</a>
270 Import from <var>File</var> as <a id="idx:usemodule2:1573"></a><a class="pred" href="import.html#use_module/2">use_module/2</a>
271271 and re-export the imported predicates. The reexport declarations must
272272 immediately follow the module declaration.
273273 </dd>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.30</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.30</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
289289 +Action, +Service, +Topic, +Command, +IfNotRunning</var>)</a></dt>
290290 <dd class="defbody">
291291 Associate DDE actions to a type. <var>Type</var> is the same type as
292 used for the 2nd argument of <a id="idx:shellregisterfiletype4:1977"></a><a class="pred" href="registry.html#shell_register_file_type/4">shell_register_file_type/4</a>, <var>Action</var>
292 used for the 2nd argument of <a id="idx:shellregisterfiletype4:1980"></a><a class="pred" href="registry.html#shell_register_file_type/4">shell_register_file_type/4</a>, <var>Action</var>
293293 is the action to perform, <var>Service</var> and <var>Topic</var>
294294 specify the DDE topic to address, and <var>Command</var> is the command
295295 to execute on this topic. Finally, <var>IfNotRunning</var> defines the
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 6.10</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 6.10</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
249249 implies they can use all predicates imported into <code>user</code>
250250 without explicitly importing them. If an application loads all modules
251251 from the
252 <code>user</code> module using <a id="idx:usemodule1:1581"></a><a class="pred" href="import.html#use_module/1">use_module/1</a>,
252 <code>user</code> module using <a id="idx:usemodule1:1583"></a><a class="pred" href="import.html#use_module/1">use_module/1</a>,
253253 one achieves a scoping system similar to the C-language, where every
254254 module can access all exported predicates without any special
255255 precautions.
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
245245 The first part is the <em>emulator</em>, which is machine-dependent. The
246246 second part is the <em>resource archive</em>, which contains the
247247 compiled program in a machine-independent format, startup options and
248 possibly user-defined <em>resources</em>; see <a id="idx:resource3:1903"></a><a class="pred" href="useresource.html#resource/3">resource/3</a>
248 possibly user-defined <em>resources</em>; see <a id="idx:resource3:1906"></a><a class="pred" href="useresource.html#resource/3">resource/3</a>
249249 and
250 <a id="idx:openresource3:1904"></a><a class="pred" href="useresource.html#open_resource/3">open_resource/3</a>.
250 <a id="idx:openresource3:1907"></a><a class="pred" href="useresource.html#open_resource/3">open_resource/3</a>.
251251
252252 <p>These two parts can be connected in various ways. The most common way
253253 for distributed runtime applications is to <em>concatenate</em> the two
254254 parts. This can be achieved using external commands (Unix:
255255 <b>cat</b>, Windows: <b>copy</b>), or using the
256 <code>stand_alone</code> option to <a id="idx:qsaveprogram2:1905"></a><a class="pred" href="runtime.html#qsave_program/2">qsave_program/2</a>.
256 <code>stand_alone</code> option to <a id="idx:qsaveprogram2:1908"></a><a class="pred" href="runtime.html#qsave_program/2">qsave_program/2</a>.
257257 The second option is to attach a startup script in front of the resource
258258 that starts the emulator with the proper options. This is the default
259259 under Unix. Finally, an emulator can be told to use a specified resource
305305 If
306306 <code>kernel</code>, lock all predicates as system predicates. If
307307 <code>development</code>, save the predicates in their current state and
308 keep reading resources from their source (if present). See also <a id="idx:resource3:1906"></a><a class="pred" href="useresource.html#resource/3">resource/3</a>.
308 keep reading resources from their source (if present). See also <a id="idx:resource3:1909"></a><a class="pred" href="useresource.html#resource/3">resource/3</a>.
309309 </dd>
310310 <dt><strong>autoload</strong>(<var>+Boolean</var>)</dt>
311311 <dd class="defbody">
312 If <code>true</code> (default), run <a id="idx:autoload0:1907"></a><a class="pred" href="runtime.html#autoload/0">autoload/0</a>
312 If <code>true</code> (default), run <a id="idx:autoload0:1910"></a><a class="pred" href="runtime.html#autoload/0">autoload/0</a>
313313 first.
314314 </dd>
315315 <dt><strong>map</strong>(<var>+File</var>)</dt>
339339 <dd class="defbody">
340340 If <code>save</code>, include shared objects (DLLs) into the saved
341341 state. See
342 <a id="idx:currentforeignlibrary2:1908"></a><a class="pred" href="foreignlink.html#current_foreign_library/2">current_foreign_library/2</a>.
342 <a id="idx:currentforeignlibrary2:1911"></a><a class="pred" href="foreignlink.html#current_foreign_library/2">current_foreign_library/2</a>.
343343 If the program <b>strip</b> is available, this is first used to reduce
344 the size of the shared object. If a state is started, <a id="idx:useforeignlibrary1:1909"></a><a class="pred" href="foreignlink.html#use_foreign_library/1">use_foreign_library/1</a>
344 the size of the shared object. If a state is started, <a id="idx:useforeignlibrary1:1912"></a><a class="pred" href="foreignlink.html#use_foreign_library/1">use_foreign_library/1</a>
345345 first tries to locate the foreign resource in the executable. When found
346346 it copies the content of the resource to a temporary file and loads it.
347347 If possible (Unix), the temporary object is deleted immediately after
348 opening.<sup class="fn">158<span class="fn-text">This option is
348 opening.<sup class="fn">161<span class="fn-text">This option is
349349 experimental and currently disabled by default. It will become the
350350 default if it proves robust.</span></sup>
351351 </dd>
361361 are undefined and have a definition in the Prolog library. Load the
362362 appropriate libraries.
363363
364 <p>This predicate is used by <a id="idx:qsaveprogram12:1910"></a><span class="pred-ext">qsave_program/[1,2]</span>
364 <p>This predicate is used by <a id="idx:qsaveprogram12:1913"></a><span class="pred-ext">qsave_program/[1,2]</span>
365365 to ensure the saved state does not depend on availability of the
366366 libraries. The predicate
367 <a id="idx:autoload0:1911"></a><a class="pred" href="runtime.html#autoload/0">autoload/0</a>
367 <a id="idx:autoload0:1914"></a><a class="pred" href="runtime.html#autoload/0">autoload/0</a>
368368 examines all clauses of the loaded program (obtained with
369 <a id="idx:clause2:1912"></a><a class="pred" href="examineprog.html#clause/2">clause/2</a>)
369 <a id="idx:clause2:1915"></a><a class="pred" href="examineprog.html#clause/2">clause/2</a>)
370370 and analyzes the body for referenced goals. Such an analysis cannot be
371371 complete in Prolog, which allows for the creation of arbitrary terms at
372372 runtime and the use of them as a goal. The current analysis is limited
376376 <ul class="latex">
377377 <li>Direct goals appearing in the body
378378 <li>Arguments of declared meta-predicates that are marked with an
379 integer (0..9). See <a id="idx:metapredicate1:1913"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>.
379 integer (0..9). See <a id="idx:metapredicate1:1916"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>.
380380 </ul>
381381
382382 <p>The analysis of meta-predicate arguments is limited to cases where
393393
394394 <p>But, the calls to prove_simple/1 and prove_complex/1 in the example
395395 below are <em>not</em> discovered by the analysis and therefore the
396 modules that define these predicates must be loaded explicitly using <a id="idx:usemodule1:1914"></a><a class="pred" href="import.html#use_module/1">use_module/1</a>,2.
396 modules that define these predicates must be loaded explicitly using <a id="idx:usemodule1:1917"></a><a class="pred" href="import.html#use_module/1">use_module/1</a>,2.
397397
398398 <pre class="code">
399399 ...,
404404 Goal)),
405405 </pre>
406406
407 <p>It is good practice to use <a id="idx:gxref0:1915"></a><a class="pred" href="xref.html#gxref/0">gxref/0</a>
407 <p>It is good practice to use <a id="idx:gxref0:1918"></a><a class="pred" href="xref.html#gxref/0">gxref/0</a>
408408 to make sure that the program has sufficient declarations such that the
409409 analaysis tools can verify that all required predicates can be resolved
410 and that all code is called. See <a id="idx:metapredicate1:1916"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>, <a id="idx:dynamic1:1917"></a><a class="pred" href="dynamic.html#dynamic/1">dynamic/1</a>, <a id="idx:public1:1918"></a><a class="pred" href="dynamic.html#public/1">public/1</a>
410 and that all code is called. See <a id="idx:metapredicate1:1919"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>, <a id="idx:dynamic1:1920"></a><a class="pred" href="dynamic.html#dynamic/1">dynamic/1</a>, <a id="idx:public1:1921"></a><a class="pred" href="dynamic.html#public/1">public/1</a>
411411 and prolog:called_by/2.</dd>
412412 <dt class="pubdef"><a id="volatile/1"><strong>volatile</strong> <var>+Name/Arity,
413413 ...</var></a></dt>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 8.6</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 8.6</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
257257 <ul class="latex">
258258 <li><i>The constraints/1 declaration</i><br>
259259 This declaration is deprecated. It has been replaced with the
260 <a id="idx:chrconstraint1:1685"></a><a class="pred" href="practical.html#chr_constraint/1">chr_constraint/1</a>
260 <a id="idx:chrconstraint1:1688"></a><a class="pred" href="practical.html#chr_constraint/1">chr_constraint/1</a>
261261 declaration.
262262
263263 <p>
264264 <li><i>The option/2 declaration</i><br>
265265 This declaration is deprecated. It has been replaced with the
266 <a id="idx:chroption2:1686"></a><a class="pred" href="SyntaxAndSemantics.html#chr_option/2">chr_option/2</a>
266 <a id="idx:chroption2:1689"></a><a class="pred" href="SyntaxAndSemantics.html#chr_option/2">chr_option/2</a>
267267 declaration.
268268
269269 <p>
283283 <li><i>Guard bindings</i><br>
284284 The <code>check_guard_bindings</code> option only turns invalid calls to
285285 unification into failure. In SICStus this option does more: it
286 intercepts instantiation errors from Prolog built-ins such as <a id="idx:is2:1687"></a><a class="pred" href="arith.html#is/2">is/2</a>
286 intercepts instantiation errors from Prolog built-ins such as <a id="idx:is2:1690"></a><a class="pred" href="arith.html#is/2">is/2</a>
287287 and turns them into failure. In SWI-Prolog, we do not go this far, as we
288288 like to separate concerns more. The CHR compiler is aware of the CHR
289289 code, the Prolog system, and the programmer should be aware of the
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.11</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.11</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
262262 retrieved using <code>on_signal(Signal, Current, Current)</code>.
263263
264264 <p>The action description is an atom denoting the name of the predicate
265 that will be called if <var>Signal</var> arrives. <a id="idx:onsignal3:696"></a><a class="pred" href="signal.html#on_signal/3">on_signal/3</a>
265 that will be called if <var>Signal</var> arrives. <a id="idx:onsignal3:697"></a><a class="pred" href="signal.html#on_signal/3">on_signal/3</a>
266266 is a meta-predicate, which implies that &lt;<var>Module</var>&gt;:&lt;<var>Name</var>&gt;
267267 refers to &lt;<var>Name</var>&gt;/1 in module &lt;<var>Module</var>&gt;.
268268 The handler is called with a single argument: the name of the signal as
284284
285285 <p>The signal names are defined by the POSIX standard as symbols of the
286286 form <code>SIG</code>&lt;SIGNAME&gt;. The Prolog name for a signal is
287 the lowercase version of &lt;SIGNAME&gt;. The predicate <a id="idx:currentsignal3:697"></a><a class="pred" href="signal.html#current_signal/3">current_signal/3</a>
287 the lowercase version of &lt;SIGNAME&gt;. The predicate <a id="idx:currentsignal3:698"></a><a class="pred" href="signal.html#current_signal/3">current_signal/3</a>
288288 may be used to map between names and signals.
289289
290290 <p>Initially, some signals are mapped to <code>throw</code>, while all
297297 <dd class="defbody">
298298 Enumerate the currently defined signal handling. <var>Name</var> is the
299299 signal name, <var>Id</var> is the numerical identifier and <var>Handler</var>
300 is the currently defined handler (see <a id="idx:onsignal3:698"></a><a class="pred" href="signal.html#on_signal/3">on_signal/3</a>).
300 is the currently defined handler (see <a id="idx:onsignal3:699"></a><a class="pred" href="signal.html#on_signal/3">on_signal/3</a>).
301301 </dd>
302302 </dl>
303303
315315 On MS-Windows, the signal interface is severely limited. Different Unix
316316 brands support different sets of signals, and the relation between
317317 signal name and number may vary. Currently, the system only supports
318 signals numbered 1 to 32<sup class="fn">57<span class="fn-text">TBD: the
318 signals numbered 1 to 32<sup class="fn">58<span class="fn-text">TBD: the
319319 system should support the Unix realtime signals</span></sup>. Installing
320320 a signal outside the limited set of supported signals in MS-Windows
321321 crashes the application.
326326 foreign functions called from a handler cannot safely use the SWI-Prolog
327327 API and cannot use C longjmp(). Handlers defined as <code>throw</code>
328328 are unsafe. Handlers defined to call a predicate are safe. Note that the
329 predicate can call <a id="idx:throw1:699"></a><a class="pred" href="exception.html#throw/1">throw/1</a>,
329 predicate can call <a id="idx:throw1:700"></a><a class="pred" href="exception.html#throw/1">throw/1</a>,
330330 but the delivery is delayed until Prolog is in a safe state.
331331
332332 <p>The C-interface described in <a class="sec" href="foreigninclude.html">section
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.31</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.31</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
284284 <dt class="pubdef"><a id="constraint/4"><strong>constraint</strong>(<var>+Name,
285285 +Constraint, +S0, -S</var>)</a></dt>
286286 <dd class="defbody">
287 Like <a id="idx:constraint3:1978"></a><a class="pred" href="simplex.html#constraint/3">constraint/3</a>,
287 Like <a id="idx:constraint3:1981"></a><a class="pred" href="simplex.html#constraint/3">constraint/3</a>,
288288 and attaches the name <var>Name</var> (an atom or compound term) to the
289289 new constraint.</dd>
290290 <dt class="pubdef"><a id="constraint_add/4"><strong>constraint_add</strong>(<var>+Name,
306306 <dt class="pubdef"><a id="minimize/3"><strong>minimize</strong>(<var>+Objective,
307307 +S0, -S</var>)</a></dt>
308308 <dd class="defbody">
309 Analogous to <a id="idx:maximize3:1979"></a><a class="pred" href="simplex.html#maximize/3">maximize/3</a>.</dd>
309 Analogous to <a id="idx:maximize3:1982"></a><a class="pred" href="simplex.html#maximize/3">maximize/3</a>.</dd>
310310 <dt class="pubdef"><a id="objective/2"><strong>objective</strong>(<var>+State,
311311 -Objective</var>)</a></dt>
312312 <dd class="defbody">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section E.3</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section E.3</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
238238 <a id="sec:softlicense"></a>
239239
240240 <p>Given the above, it is possible that SWI-Prolog packages and
241 extensions will rely on the GPL.<sup class="fn">165<span class="fn-text">On
241 extensions will rely on the GPL.<sup class="fn">168<span class="fn-text">On
242242 the Unix version, the default toplevel uses the GNU readline library for
243243 command line editing. This library is distributed under the GPL. In
244244 practice this problem is small as most final applications have Prolog
245245 embedded, without direct access to the command line and therefore
246246 without need for <code>libreadline</code>.</span></sup> The predicates
247247 below allow for registering license requirements for Prolog files and
248 foreign modules. The predicate <a id="idx:evallicense0:2138"></a><a class="pred" href="softlicense.html#eval_license/0">eval_license/0</a>
248 foreign modules. The predicate <a id="idx:evallicense0:2145"></a><a class="pred" href="softlicense.html#eval_license/0">eval_license/0</a>
249249 reports which components from the currently configured system are
250250 distributed under copy-left and open source enforcing licenses (the GPL)
251251 and therefore must be replaced before distributing linked applications
270270 <dt><strong>swipl</strong></dt>
271271 <dd class="defbody">
272272 Indicates this module is distributed under the GNU General Public
273 License (GPL) with the SWI-Prolog exception:<sup class="fn">166<span class="fn-text">This
273 License (GPL) with the SWI-Prolog exception:<sup class="fn">169<span class="fn-text">This
274274 exception is a straight re-phrasing of the license used for <code>libgcc</code>,
275275 the GNU C runtime library facing similar technical issues.</span></sup>
276276 <blockquote><i>As a special exception, if you link this library with
308308 example. The second argument is either <code>gpl</code> or <code>lgpl</code>
309309 to indicate compatibility with these licenses. Other values cause the
310310 license to be interpreted as <em>proprietary</em>. Proprietary licenses
311 are reported by <a id="idx:evallicense0:2139"></a><a class="pred" href="softlicense.html#eval_license/0">eval_license/0</a>.
311 are reported by <a id="idx:evallicense0:2146"></a><a class="pred" href="softlicense.html#eval_license/0">eval_license/0</a>.
312312 See the file <code>boot/license.pl</code> for details.
313313
314314 <pre class="code">
326326 <dt class="pubdef"><a id="license/1"><strong>license</strong>(<var>+LicenseId</var>)</a></dt>
327327 <dd class="defbody">
328328 Intended as a directive in Prolog source files. It takes the current
329 filename and calls <a id="idx:license2:2140"></a><a class="pred" href="softlicense.html#license/2">license/2</a>.</dd>
329 filename and calls <a id="idx:license2:2147"></a><a class="pred" href="softlicense.html#license/2">license/2</a>.</dd>
330330 <dt class="pubdef"><a id="PL_license()"><var>void</var> <strong>PL_license</strong>(<var>const
331331 char *LicenseId, const char *Component</var>)</a></dt>
332332 <dd class="defbody">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.32</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.32</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 1.4</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 1.4</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.38</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.38</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
264264 <tr><td>heapused</td><td>Bytes of heap in use by Prolog (0 if not
265265 maintained) </td></tr>
266266 <tr><td>heap_gc</td><td>Number of heap garbage collections performed.
267 Only provided if SWI-Prolog is configured with Boehm-GC. See also <a id="idx:garbagecollectheap0:1414"></a><span class="pred-ext">garbage_collect_heap/0</span>. </td></tr>
267 Only provided if SWI-Prolog is configured with Boehm-GC. See also <a id="idx:garbagecollectheap0:1416"></a><span class="pred-ext">garbage_collect_heap/0</span>. </td></tr>
268268 <tr><td>c_stack</td><td>System (C-) stack limit. 0 if not known. </td></tr>
269269 <tr><td>stack</td><td>Total memory in use for stacks in all threads </td></tr>
270270 <tr><td>local</td><td>Allocated size of the local stack in bytes </td></tr>
294294 finished threads. Supported on Windows-NT and later, Linux and possibly
295295 a few more. Verify it gives plausible results before using. </td></tr>
296296 </table>
297 <div class="caption"><b>Table 6 : </b>Keys for <a id="idx:statistics2:1415"></a><a class="pred" href="statistics.html#statistics/2">statistics/2</a>.
297 <div class="caption"><b>Table 6 : </b>Keys for <a id="idx:statistics2:1417"></a><a class="pred" href="statistics.html#statistics/2">statistics/2</a>.
298298 Space is expressed in bytes. Time is expressed in seconds, represented
299299 as a floating point number.</div>
300300 <a id="tab:statistics"></a>
307307 <tr><td>system_time</td><td>[ System CPU time, System CPU time since
308308 last ] (milliseconds)</td></tr>
309309 <tr><td>real_time</td><td>[ Wall time, Wall time since last ] (integer
310 seconds. See <a id="idx:gettime1:1416"></a><a class="pred" href="system.html#get_time/1">get_time/1</a>) </td></tr>
310 seconds. See <a id="idx:gettime1:1418"></a><a class="pred" href="system.html#get_time/1">get_time/1</a>) </td></tr>
311311 <tr><td>walltime</td><td>[ Wall time since start, Wall time since last]
312312 (milliseconds, SICStus compatibility) </td></tr>
313313 <tr><td>memory</td><td>[ Total unshared data, free memory ] (Uses
328328 time spent ] </td></tr>
329329 <tr><td>core</td><td>Same as memory </td></tr>
330330 </table>
331 <div class="caption"><b>Table 7 : </b>Compatibility keys for <a id="idx:statistics2:1417"></a><a class="pred" href="statistics.html#statistics/2">statistics/2</a>.
331 <div class="caption"><b>Table 7 : </b>Compatibility keys for <a id="idx:statistics2:1419"></a><a class="pred" href="statistics.html#statistics/2">statistics/2</a>.
332332 Time is expressed in milliseconds.</div>
333333 <a id="tab:qpstatistics"></a>
334334 </dd>
337337 Display a table of system statistics on the stream <code>user_error</code>.</dd>
338338 <dt class="pubdef"><a id="time/1"><strong>time</strong>(<var>:Goal</var>)</a></dt>
339339 <dd class="defbody">
340 Execute <var>Goal</var> just like <a id="idx:call1:1418"></a><a class="pred" href="metacall.html#call/1">call/1</a>
340 Execute <var>Goal</var> just like <a id="idx:call1:1420"></a><a class="pred" href="metacall.html#call/1">call/1</a>
341341 and print time used, number of logical inferences and the average number
342342 of <var>lips</var> (logical inferences per second). Note that SWI-Prolog
343343 counts the actual executed number of inferences rather than the number
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 1.2</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 1.2</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
237237
238238 <a id="sec:status"></a>
239239
240 <p>This manual describes version 7.3.1 of SWI-Prolog. SWI-Prolog is
240 <p>This manual describes version 7.3.6 of SWI-Prolog. SWI-Prolog is
241241 widely considered to be a robust and scalable implementation of the
242242 Prolog language. It is widely used in education and research. In
243243 addition, it is in use for <var>24 &times; 7</var> mission critical
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.17</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.17</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
243243 <dd class="defbody">
244244 Wait for input on one of the streams in <var>ListOfStreams</var> and
245245 return a list of streams on which input is available in <var>ReadyList</var>.
246 <a id="idx:waitforinput3:952"></a><a class="pred" href="streamstat.html#wait_for_input/3">wait_for_input/3</a>
246 <a id="idx:waitforinput3:953"></a><a class="pred" href="streamstat.html#wait_for_input/3">wait_for_input/3</a>
247247 waits for at most <var>TimeOut</var> seconds. <var>Timeout</var> may be
248248 specified as a floating point number to specify fractions of a second.
249 If <var>Timeout</var> equals <code>infinite</code>, <a id="idx:waitforinput3:953"></a><a class="pred" href="streamstat.html#wait_for_input/3">wait_for_input/3</a>
250 waits indefinitely.<sup class="fn">78<span class="fn-text">For
249 If <var>Timeout</var> equals <code>infinite</code>, <a id="idx:waitforinput3:954"></a><a class="pred" href="streamstat.html#wait_for_input/3">wait_for_input/3</a>
250 waits indefinitely.<sup class="fn">79<span class="fn-text">For
251251 compatibility reasons, a <var>Timeout</var> value of 0 (integer) also
252252 waits indefinitely. To call select() without giving up the CPU, pass the
253253 float 0.0. If compatibility with versions older than 5.1.3 is desired,
264264 wait_for_input([user_input, P4], Inputs, 0).
265265 </pre>
266266
267 <p><a id="idx:select:954"></a>This predicate relies on the select() call
267 <p><a id="idx:select:955"></a>This predicate relies on the select() call
268268 on most operating systems. On Unix this call is implemented for any
269269 stream referring to a file handle, which implies all OS-based streams:
270270 sockets, terminals, pipes, etc. On non-Unix systems select() is
271271 generally only implemented for socket-based streams. See also <code>library(socket)</code>
272272 from the <code>clib</code> package.
273273
274 <p>Note that <a id="idx:waitforinput3:955"></a><a class="pred" href="streamstat.html#wait_for_input/3">wait_for_input/3</a>
274 <p>Note that <a id="idx:waitforinput3:956"></a><a class="pred" href="streamstat.html#wait_for_input/3">wait_for_input/3</a>
275275 returns streams that have data waiting. This does not mean you can, for
276 example, call <a id="idx:read2:956"></a><a class="pred" href="termrw.html#read/2">read/2</a>
276 example, call <a id="idx:read2:957"></a><a class="pred" href="termrw.html#read/2">read/2</a>
277277 on the stream without blocking as the stream might hold an incomplete
278278 term. The predicate
279 <a id="idx:setstream2:957"></a><a class="pred" href="IO.html#set_stream/2">set_stream/2</a>
279 <a id="idx:setstream2:958"></a><a class="pred" href="IO.html#set_stream/2">set_stream/2</a>
280280 using the option <code>timeout(Seconds)</code> can be used to make the
281281 stream generate an exception if no new data arrives within the timeout
282282 period. Suppose two processes communicate by exchanging Prolog terms.
297297 -Count</var>)</a></dt>
298298 <dd class="defbody">
299299 Byte position in <var>Stream</var>. For binary streams this is the same
300 as <a id="idx:charactercount2:958"></a><a class="pred" href="streamstat.html#character_count/2">character_count/2</a>.
300 as <a id="idx:charactercount2:959"></a><a class="pred" href="streamstat.html#character_count/2">character_count/2</a>.
301301 For text files the number may be different due to multi-byte encodings
302302 or additional record separators (such as Control-M in Windows).</dd>
303303 <dt class="pubdef"><a id="character_count/2"><strong>character_count</strong>(<var>+Stream,
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 5.2</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 5.2</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
244244 on the global (term) stack. Strings represent sequences of Unicode
245245 characters including the character code 0 (zero). The length strings is
246246 limited by the available space on the global (term) stack (see
247 <a id="idx:setprologstack2:1447"></a><a class="pred" href="memory.html#set_prolog_stack/2">set_prolog_stack/2</a>).
247 <a id="idx:setprologstack2:1449"></a><a class="pred" href="memory.html#set_prolog_stack/2">set_prolog_stack/2</a>).
248248 Strings are distinct from lists, which makes it possible to detect them
249249 at runtime and print them using the string syntax, as illustrated below:
250250
283283 <a id="sec:string-predicates"></a>
284284
285285 <p>Strings may be manipulated by a set of predicates that is similar to
286 the manipulation of atoms. In addition to the list below, <a id="idx:string1:1448"></a><a class="pred" href="typetest.html#string/1">string/1</a>
286 the manipulation of atoms. In addition to the list below, <a id="idx:string1:1450"></a><a class="pred" href="typetest.html#string/1">string/1</a>
287287 performs the type check for this type and is described in <a class="sec" href="typetest.html">section
288288 4.6</a>.
289289
312312 Bi-directional conversion between a number and a string. At least one of
313313 the two arguments must be instantiated. Besides the type used to
314314 represent the text, this predicate differs in several ways from its ISO
315 cousin:<sup class="fn">125<span class="fn-text">Note that SWI-Prolog's
315 cousin:<sup class="fn">128<span class="fn-text">Note that SWI-Prolog's
316316 syntax for numbers is not ISO compatible either.</span></sup>
317317
318318 <p>
337337 <dt class="pubdef"><a id="term_string/3"><strong>term_string</strong>(<var>?Term,
338338 ?String, +Options</var>)</a></dt>
339339 <dd class="defbody">
340 As <a id="idx:termstring2:1449"></a><a class="pred" href="strings.html#term_string/2">term_string/2</a>,
341 passing <var>Options</var> to either <a id="idx:readterm2:1450"></a><a class="pred" href="termrw.html#read_term/2">read_term/2</a>
342 or <a id="idx:writeterm2:1451"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>.
340 As <a id="idx:termstring2:1451"></a><a class="pred" href="strings.html#term_string/2">term_string/2</a>,
341 passing <var>Options</var> to either <a id="idx:readterm2:1452"></a><a class="pred" href="termrw.html#read_term/2">read_term/2</a>
342 or <a id="idx:writeterm2:1453"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>.
343343 For example:
344344
345345 <pre class="code">
371371 -Length</var>)</a></dt>
372372 <dd class="defbody">
373373 Unify <var>Length</var> with the number of characters in <var>String</var>.
374 This predicate is functionally equivalent to <a id="idx:atomlength2:1452"></a><a class="pred" href="manipatom.html#atom_length/2">atom_length/2</a>
374 This predicate is functionally equivalent to <a id="idx:atomlength2:1454"></a><a class="pred" href="manipatom.html#atom_length/2">atom_length/2</a>
375375 and also accepts atoms, integers and floats as its first argument.</dd>
376376 <dt class="pubdef"><a id="string_code/3"><strong>string_code</strong>(<var>?Index,
377377 +String, ?Code</var>)</a></dt>
384384 <var>String</var>. The mode <code>string_code(-,+,+)</code> is
385385 deterministic if the searched-for <var>Code</var> appears only once in <var>String</var>.
386386 See also
387 <a id="idx:substring5:1453"></a><a class="pred" href="strings.html#sub_string/5">sub_string/5</a>.</dd>
387 <a id="idx:substring5:1455"></a><a class="pred" href="strings.html#sub_string/5">sub_string/5</a>.</dd>
388388 <dt class="pubdef"><a id="get_string_code/3"><strong>get_string_code</strong>(<var>+Index,
389389 +String, -Code</var>)</a></dt>
390390 <dd class="defbody">
391 Semi-deterministic version of <a id="idx:stringcode3:1454"></a><a class="pred" href="strings.html#string_code/3">string_code/3</a>.
391 Semi-deterministic version of <a id="idx:stringcode3:1456"></a><a class="pred" href="strings.html#string_code/3">string_code/3</a>.
392392 In addition, this version provides strict range checking, throwing a
393393 domain error if <var>Index</var> is less than 1 or greater than the
394394 length of <var>String</var>. ECLiPSe provides this to support <code>String[Index]</code>
396396 <dt class="pubdef"><a id="string_concat/3"><strong>string_concat</strong>(<var>?String1,
397397 ?String2, ?String3</var>)</a></dt>
398398 <dd class="defbody">
399 Similar to <a id="idx:atomconcat3:1455"></a><a class="pred" href="manipatom.html#atom_concat/3">atom_concat/3</a>,
399 Similar to <a id="idx:atomconcat3:1457"></a><a class="pred" href="manipatom.html#atom_concat/3">atom_concat/3</a>,
400400 but the unbound argument will be unified with a string object rather
401401 than an atom. Also, if both <var>String1</var> and
402402 <var>String2</var> are unbound and <var>String3</var> is bound to text,
442442 <var>PadChars</var> or is equivalent to handle multiple adjacent
443443 separators as a single (often white space). The behaviour with partially
444444 overlapping sets of padding and separators should be considered
445 undefined. See also <a id="idx:readstring5:1456"></a><a class="pred" href="strings.html#read_string/5">read_string/5</a>.</dd>
445 undefined. See also <a id="idx:readstring5:1458"></a><a class="pred" href="strings.html#read_string/5">read_string/5</a>.</dd>
446446 <dt class="pubdef"><a id="sub_string/5"><strong>sub_string</strong>(<var>+String,
447447 ?Before, ?Length, ?After, ?SubString</var>)</a></dt>
448448 <dd class="defbody">
451451 contains <var>Length</var> character and is followed by <var>After</var>
452452 characters in <var>String</var>. If not enough information is provided
453453 to compute the start of the match, <var>String</var> is scanned
454 left-to-right. This predicate is functionally equivalent to <a id="idx:subatom5:1457"></a><a class="pred" href="manipatom.html#sub_atom/5">sub_atom/5</a>,
454 left-to-right. This predicate is functionally equivalent to <a id="idx:subatom5:1459"></a><a class="pred" href="manipatom.html#sub_atom/5">sub_atom/5</a>,
455455 but operates on strings. The following example splits a string of the
456456 form
457457 &lt;<var>name</var>&gt;=&lt;<var>value</var>&gt; into the name part (an
476476 <dt class="pubdef"><a id="atomics_to_string/3"><strong>atomics_to_string</strong>(<var>+List,
477477 +Separator, -String</var>)</a></dt>
478478 <dd class="defbody">
479 Creates a string just like <a id="idx:atomicstostring2:1458"></a><a class="pred" href="strings.html#atomics_to_string/2">atomics_to_string/2</a>,
479 Creates a string just like <a id="idx:atomicstostring2:1460"></a><a class="pred" href="strings.html#atomics_to_string/2">atomics_to_string/2</a>,
480480 but inserts
481481 <var>Separator</var> between each pair of inputs. For example:
482482
508508 +SepChars, +PadChars, -Sep, -String</var>)</a></dt>
509509 <dd class="defbody">
510510 Read a string from <var>Stream</var>, providing functionality similar to
511 <a id="idx:splitstring4:1459"></a><a class="pred" href="strings.html#split_string/4">split_string/4</a>.
511 <a id="idx:splitstring4:1461"></a><a class="pred" href="strings.html#split_string/4">split_string/4</a>.
512512 The predicate performs the following steps:
513513
514514 <p>
523523 terminated by the end of the input, <var>Sep</var> is unified with -1.
524524 </ol>
525525
526 <p>The predicate <a id="idx:readstring5:1460"></a><a class="pred" href="strings.html#read_string/5">read_string/5</a>
526 <p>The predicate <a id="idx:readstring5:1462"></a><a class="pred" href="strings.html#read_string/5">read_string/5</a>
527527 called repeatedly on an input until
528528 <var>Sep</var> is -1 (end of file) is equivalent to reading the entire
529 file into a string and calling <a id="idx:splitstring4:1461"></a><a class="pred" href="strings.html#split_string/4">split_string/4</a>,
529 file into a string and calling <a id="idx:splitstring4:1463"></a><a class="pred" href="strings.html#split_string/4">split_string/4</a>,
530530 provided that <var>SepChars</var> and <var>PadChars</var> are not <em>partially
531 overlapping</em>.<sup class="fn">126<span class="fn-text">Behaviour that
531 overlapping</em>.<sup class="fn">129<span class="fn-text">Behaviour that
532532 is fully compatible would requite unlimited look-ahead.</span></sup>
533533 Below are some examples:
534534
568568 <dt><b>Lists of character codes</b></dt>
569569 <dd>
570570 is what you need if you want to <em>parse</em> text using Prolog grammar
571 rules (DCGs, see <a id="idx:phrase3:1462"></a><a class="pred" href="DCG.html#phrase/3">phrase/3</a>).
571 rules (DCGs, see <a id="idx:phrase3:1464"></a><a class="pred" href="DCG.html#phrase/3">phrase/3</a>).
572572 Most of the text reading predicates (e.g.,
573 <a id="idx:readlinetocodes2:1463"></a><a class="pred" href="readutil.html#read_line_to_codes/2">read_line_to_codes/2</a>)
573 <a id="idx:readlinetocodes2:1465"></a><a class="pred" href="readutil.html#read_line_to_codes/2">read_line_to_codes/2</a>)
574574 return a list of character codes because most applications need to parse
575575 these lines before the data can be processed.</dd>
576576 <dt><b>Atoms</b></dt>
588588 <dd>
589589 typically represents text that is processed as a unit most of the time,
590590 but which is not an identifier for something. Format specifications for
591 <a id="idx:format3:1464"></a><a class="pred" href="format.html#format/3">format/3</a>
591 <a id="idx:format3:1466"></a><a class="pred" href="format.html#format/3">format/3</a>
592592 is a good example. Another example is a descriptive text provided in an
593 application. Strings may be composed and decomposed using e.g., <a id="idx:stringconcat3:1465"></a><a class="pred" href="strings.html#string_concat/3">string_concat/3</a>
594 and <a id="idx:substring5:1466"></a><a class="pred" href="strings.html#sub_string/5">sub_string/5</a>
595 or converted for parsing using <a id="idx:stringcodes2:1467"></a><a class="pred" href="strings.html#string_codes/2">string_codes/2</a>
596 or created from codes generated by a generative grammar rule, also using <a id="idx:stringcodes2:1468"></a><a class="pred" href="strings.html#string_codes/2">string_codes/2</a>.
593 application. Strings may be composed and decomposed using e.g., <a id="idx:stringconcat3:1467"></a><a class="pred" href="strings.html#string_concat/3">string_concat/3</a>
594 and <a id="idx:substring5:1468"></a><a class="pred" href="strings.html#sub_string/5">sub_string/5</a>
595 or converted for parsing using <a id="idx:stringcodes2:1469"></a><a class="pred" href="strings.html#string_codes/2">string_codes/2</a>
596 or created from codes generated by a generative grammar rule, also using <a id="idx:stringcodes2:1470"></a><a class="pred" href="strings.html#string_codes/2">string_codes/2</a>.
597597 </dd>
598598 </dl>
599599
612612 This predicate may be used to assess compatibility issues due to the
613613 representation of double quoted text as string objects. See
614614 <a class="sec" href="strings.html">section 5.2</a> and <a class="sec" href="strings.html">section
615 5.2.4</a>. To use it, load your program into Prolog and run <a id="idx:liststrings0:1469"></a><a class="pred" href="strings.html#list_strings/0">list_strings/0</a>.
615 5.2.4</a>. To use it, load your program into Prolog and run <a id="idx:liststrings0:1471"></a><a class="pred" href="strings.html#list_strings/0">list_strings/0</a>.
616616 The predicate lists source locations of string objects encountered in
617617 the program that are not considered safe. Such string need to be
618618 examined manually, after which one of the actions below may be
636636 command line option and code exploiting this mapping is also not
637637 portable to ISO compliant systems.
638638 <li>If the strings appear in facts and usage is safe, add a clause to
639 the multifile predicate check:string_predicate/1 to silence <a id="idx:liststrings0:1470"></a><a class="pred" href="strings.html#list_strings/0">list_strings/0</a>
639 the multifile predicate check:string_predicate/1 to silence <a id="idx:liststrings0:1472"></a><a class="pred" href="strings.html#list_strings/0">list_strings/0</a>
640640 on all clauses of that predicate.
641641 <li>If the strings appear as an argument to a predicate that can handle
642642 string objects, add a clause to the multifile predicate
643 check:valid_string_goal/1 to silence <a id="idx:liststrings0:1471"></a><a class="pred" href="strings.html#list_strings/0">list_strings/0</a>.
643 check:valid_string_goal/1 to silence <a id="idx:liststrings0:1473"></a><a class="pred" href="strings.html#list_strings/0">list_strings/0</a>.
644644 </ul>
645645 </dd>
646646 <dt class="pubdef"><a id="check:string_predicate/1"><strong>check:string_predicate</strong>(<var>:PredicateIndicator</var>)</a></dt>
650650 help_info/2 , where the second argument contains a double quoted string
651651 that is handled properly by the predicates of the applications' help
652652 system, add the following declaration to stop
653 <a id="idx:liststrings0:1472"></a><a class="pred" href="strings.html#list_strings/0">list_strings/0</a>
653 <a id="idx:liststrings0:1474"></a><a class="pred" href="strings.html#list_strings/0">list_strings/0</a>
654654 from complaining:
655655
656656 <pre class="code">
664664 <dd class="defbody">
665665 Declare that calls to <var>Goal</var> are safe. The module qualification
666666 is the actual module in which <var>Goal</var> is defined. For example, a
667 call to <a id="idx:format3:1473"></a><a class="pred" href="format.html#format/3">format/3</a>
667 call to <a id="idx:format3:1475"></a><a class="pred" href="format.html#format/3">format/3</a>
668668 is resolved by the predicate system:format/3. and the code below
669669 specifies that the second argument may be a string (system predicates
670670 that accept strings are defined in the library).
722722
723723 <p>Lacking runtime information, debuggers and the toplevel can only use
724724 heuristics to decide whether to print a list of integers as such or as a
725 string (see <a id="idx:portraytext1:1474"></a><span class="pred-ext">portray_text/1</span>).
725 string (see <a id="idx:portraytext1:1476"></a><span class="pred-ext">portray_text/1</span>).
726726
727727 <p>While experienced Prolog programmers have learned to cope with this,
728728 we still consider this an unfortunate situation.
790790 my_class(_).
791791 </pre>
792792
793 <p>Finally, the predicate <a id="idx:stringcode3:1475"></a><a class="pred" href="strings.html#string_code/3">string_code/3</a>
794 can be exploited directly as a replacement for the <a id="idx:memberchk2:1476"></a><a class="pred" href="builtinlist.html#memberchk/2">memberchk/2</a>
793 <p>Finally, the predicate <a id="idx:stringcode3:1477"></a><a class="pred" href="strings.html#string_code/3">string_code/3</a>
794 can be exploited directly as a replacement for the <a id="idx:memberchk2:1478"></a><a class="pred" href="builtinlist.html#memberchk/2">memberchk/2</a>
795795 on a list of codes. Although the string is still pushed onto the stack,
796796 it is more compact and only a single entity.
797797 </dd>
798798 </dl>
799799
800 <p>We offer the predicate <a id="idx:liststrings0:1477"></a><a class="pred" href="strings.html#list_strings/0">list_strings/0</a>
800 <p>We offer the predicate <a id="idx:liststrings0:1479"></a><a class="pred" href="strings.html#list_strings/0">list_strings/0</a>
801801 to help porting your program.
802802
803803 <p></body></html>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 1.3</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 1.3</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 1.1</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 1.1</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
279279 Some libraries are copied from the YAP<sup class="fn">1<span class="fn-text"><a class="url" href="http://www.dcc.fc.up.pt/\~{}vsc/Yap/">http://www.dcc.fc.up.pt/\~{}vsc/Yap/</a></span></sup>
280280 system. Together with YAP we developed a portability framework (see
281281 <a class="sec" href="dialect.html">section C</a>). This framework has
282 been filled for SICStus Prolog, YAP and IF/Prolog.
282 been filled for SICStus Prolog, YAP, IF/Prolog and Ciao. SWI-Prolog
283 version&nbsp;7 introduces various extensions to the Prolog language (see <a class="sec" href="extensions.html">section
284 5</a>). The
285 <em>string</em> data type and its supporting set of built-in predicates
286 is compatibility with ECLiPSe.
283287
284288 <p></body></html>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 2.15</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 2.15</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
421421 Escapes the backslash itself. Thus, <code>'\\'</code> is an atom
422422 consisting of a single <code><code>\</code></code>.
423423 </dd>
424 <dt><code>\quote</code></dt>
425 <dd class="defbody">
426 If the current quote (<code>"</code> or <code>'</code>) is preceded by a
427 backslash, it is copied verbatim. Thus, <code>'\''</code> and <code>''''</code>
428 both describe the atom with a single&nbsp;<code>'</code>.
424 <dt><code>\'</code></dt>
425 <dd class="defbody">
426 Single quote. Note that <code>'\''</code> and <code>''''</code> both
427 describe the atom with a single&nbsp;<code>'</code>, i.e., <code>'\'' == ''''</code>
428 is true.
429 </dd>
430 <dt><code>\"</code></dt>
431 <dd class="defbody">
432 Double quote.
433 </dd>
434 <dt><code>\`</code></dt>
435 <dd class="defbody">
436 Back quote.
429437 </dd>
430438 </dl>
431439
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.33</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.33</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
245245 is given to the Bourne shell (/bin/sh). <var>Status</var> is unified
246246 with the exit status of the command.
247247
248 <p>On Windows, <a id="idx:shell12:1294"></a><span class="pred-ext">shell/[1,2]</span>
248 <p>On Windows, <a id="idx:shell12:1296"></a><span class="pred-ext">shell/[1,2]</span>
249249 executes the command using the CreateProcess() API and waits for the
250250 command to terminate. If the command ends with a
251251 <code>&amp;</code> sign, the command is handed to the WinExec() API,
252 which does not wait for the new task to terminate. See also <a id="idx:winexec2:1295"></a><a class="pred" href="system.html#win_exec/2">win_exec/2</a>
252 which does not wait for the new task to terminate. See also <a id="idx:winexec2:1297"></a><a class="pred" href="system.html#win_exec/2">win_exec/2</a>
253253 and
254 <a id="idx:winshell2:1296"></a><a class="pred" href="system.html#win_shell/2">win_shell/2</a>.
254 <a id="idx:winshell2:1298"></a><a class="pred" href="system.html#win_shell/2">win_shell/2</a>.
255255 Please note that the CreateProcess() API does <b>not</b> imply the
256256 Windows command interpreter (<b>cmd.exe</b> and therefore commands that
257257 are built in the command interpreter can only be activated using the
264264
265265 <p>Note that many of the operations that can be achieved using the shell
266266 built-in commands can easily be achieved using Prolog primitives. See
267 <a id="idx:makedirectory1:1297"></a><a class="pred" href="files.html#make_directory/1">make_directory/1</a>, <a id="idx:deletefile1:1298"></a><a class="pred" href="files.html#delete_file/1">delete_file/1</a>, <a id="idx:renamefile2:1299"></a><a class="pred" href="files.html#rename_file/2">rename_file/2</a>,
267 <a id="idx:makedirectory1:1299"></a><a class="pred" href="files.html#make_directory/1">make_directory/1</a>, <a id="idx:deletefile1:1300"></a><a class="pred" href="files.html#delete_file/1">delete_file/1</a>, <a id="idx:renamefile2:1301"></a><a class="pred" href="files.html#rename_file/2">rename_file/2</a>,
268268 etc. The clib package provides <code>library(filesex)</code>,
269 implementing various high level file operations such as <a id="idx:copyfile2:1300"></a><span class="pred-ext">copy_file/2</span>.
269 implementing various high level file operations such as <a id="idx:copyfile2:1302"></a><span class="pred-ext">copy_file/2</span>.
270270 Using Prolog primitives instead of shell commands improves the
271271 portability of your program.
272272
273 <p>The library <code>library(process)</code> provides <a id="idx:processcreate3:1301"></a><span class="pred-ext">process_create/3</span>
273 <p>The library <code>library(process)</code> provides <a id="idx:processcreate3:1303"></a><span class="pred-ext">process_create/3</span>
274274 and several related primitives that support more fine-grained
275275 interaction with processes, including I/O redirection and management of
276276 asynchronous processes.</dd>
293293 <dd class="defbody">
294294 Set an environment variable. <var>Name</var> and <var>Value</var> must
295295 be instantiated to atoms or integers. The environment variable will be
296 passed to <a id="idx:shell02:1302"></a><span class="pred-ext">shell/[0-2]</span>
297 and can be requested using <a id="idx:getenv2:1303"></a><a class="pred" href="system.html#getenv/2">getenv/2</a>.
298 They also influence <a id="idx:expandfilename2:1304"></a><a class="pred" href="files.html#expand_file_name/2">expand_file_name/2</a>.
296 passed to <a id="idx:shell02:1304"></a><span class="pred-ext">shell/[0-2]</span>
297 and can be requested using <a id="idx:getenv2:1305"></a><a class="pred" href="system.html#getenv/2">getenv/2</a>.
298 They also influence <a id="idx:expandfilename2:1306"></a><a class="pred" href="files.html#expand_file_name/2">expand_file_name/2</a>.
299299 Environment variables are shared between threads. Depending on the
300 underlying C library, <a id="idx:setenv2:1305"></a><a class="pred" href="system.html#setenv/2">setenv/2</a>
301 and <a id="idx:unsetenv1:1306"></a><a class="pred" href="system.html#unsetenv/1">unsetenv/1</a>
300 underlying C library, <a id="idx:setenv2:1307"></a><a class="pred" href="system.html#setenv/2">setenv/2</a>
301 and <a id="idx:unsetenv1:1308"></a><a class="pred" href="system.html#unsetenv/1">unsetenv/1</a>
302302 may not be thread-safe and may cause memory leaks. Only changing the
303303 environment once and before starting threads is safe in all versions of
304304 SWI-Prolog.</dd>
305305 <dt class="pubdef"><a id="unsetenv/1"><strong>unsetenv</strong>(<var>+Name</var>)</a></dt>
306306 <dd class="defbody">
307307 Remove an environment variable from the environment. Some systems lack
308 the underlying unsetenv() library function. On these systems <a id="idx:unsetenv1:1307"></a><a class="pred" href="system.html#unsetenv/1">unsetenv/1</a>
308 the underlying unsetenv() library function. On these systems <a id="idx:unsetenv1:1309"></a><a class="pred" href="system.html#unsetenv/1">unsetenv/1</a>
309309 sets the variable to the empty string.</dd>
310310 <dt class="pubdef"><a id="setlocale/3"><strong>setlocale</strong>(<var>+Category,
311311 -Old, +New</var>)</a></dt>
316316 <code>monetary</code>, <code>numeric</code> or <code>time</code>. For
317317 details, please consult the C library locale documentation. See also <a class="sec" href="widechars.html">section
318318 2.18.1</a>. Please note that the locale is shared between all threads
319 and thread-safe usage of <a id="idx:setlocale3:1308"></a><a class="pred" href="system.html#setlocale/3">setlocale/3</a>
319 and thread-safe usage of <a id="idx:setlocale3:1310"></a><a class="pred" href="system.html#setlocale/3">setlocale/3</a>
320320 is in general not possible. Do locale operations before starting threads
321321 or thoroughly study threading aspects of locale support in your
322322 environment before using in multithreaded environments. Locale settings
323 are used by <a id="idx:formattime3:1309"></a><a class="pred" href="system.html#format_time/3">format_time/3</a>, <a id="idx:collationkey2:1310"></a><a class="pred" href="chartype.html#collation_key/2">collation_key/2</a>
324 and <a id="idx:localesort2:1311"></a><a class="pred" href="chartype.html#locale_sort/2">locale_sort/2</a>.</dd>
323 are used by <a id="idx:formattime3:1311"></a><a class="pred" href="system.html#format_time/3">format_time/3</a>, <a id="idx:collationkey2:1312"></a><a class="pred" href="chartype.html#collation_key/2">collation_key/2</a>
324 and <a id="idx:localesort2:1313"></a><a class="pred" href="chartype.html#locale_sort/2">locale_sort/2</a>.</dd>
325325 <dt class="pubdef"><a id="unix/1"><strong>unix</strong>(<var>+Command</var>)</a></dt>
326326 <dd class="defbody">
327327 This predicate comes from the Quintus compatibility library and provides
332332 <dl class="latex">
333333 <dt><strong>system</strong>(<var>+Command</var>)</dt>
334334 <dd class="defbody">
335 Equivalent to calling <a id="idx:shell1:1312"></a><a class="pred" href="system.html#shell/1">shell/1</a>.
335 Equivalent to calling <a id="idx:shell1:1314"></a><a class="pred" href="system.html#shell/1">shell/1</a>.
336336 Use for compatibility only.</dd>
337337 <dt><strong>shell</strong>(<var>+Command</var>)</dt>
338338 <dd class="defbody">
339 Equivalent to calling <a id="idx:shell1:1313"></a><a class="pred" href="system.html#shell/1">shell/1</a>.
339 Equivalent to calling <a id="idx:shell1:1315"></a><a class="pred" href="system.html#shell/1">shell/1</a>.
340340 Use for compatibility only.</dd>
341341 <dt><strong>shell</strong></dt>
342342 <dd class="defbody">
343 Equivalent to calling <a id="idx:shell0:1314"></a><a class="pred" href="system.html#shell/0">shell/0</a>.
343 Equivalent to calling <a id="idx:shell0:1316"></a><a class="pred" href="system.html#shell/0">shell/0</a>.
344344 Use for compatibility only.</dd>
345345 <dt><strong>cd</strong></dt>
346346 <dd class="defbody">
347 Equivalent to calling <a id="idx:workingdirectory2:1315"></a><a class="pred" href="files.html#working_directory/2">working_directory/2</a>
347 Equivalent to calling <a id="idx:workingdirectory2:1317"></a><a class="pred" href="files.html#working_directory/2">working_directory/2</a>
348348 to the expansion (see
349 <a id="idx:expandfilename2:1316"></a><a class="pred" href="files.html#expand_file_name/2">expand_file_name/2</a>)
349 <a id="idx:expandfilename2:1318"></a><a class="pred" href="files.html#expand_file_name/2">expand_file_name/2</a>)
350350 of <code><code>~</code></code>. For compatibility only.</dd>
351351 <dt><strong>cd</strong>(<var>+Directory</var>)</dt>
352352 <dd class="defbody">
353 Equivalent to calling <a id="idx:workingdirectory2:1317"></a><a class="pred" href="files.html#working_directory/2">working_directory/2</a>.
353 Equivalent to calling <a id="idx:workingdirectory2:1319"></a><a class="pred" href="files.html#working_directory/2">working_directory/2</a>.
354354 Use for compatibility only.</dd>
355355 <dt><strong>argv</strong>(<var>-Argv</var>)</dt>
356356 <dd class="defbody">
387387
388388 <p>The predicates in this section are only available on the Windows
389389 version of SWI-Prolog. Their use is discouraged if there are portably
390 alternatives. For example, <a id="idx:winexec2:1318"></a><a class="pred" href="system.html#win_exec/2">win_exec/2</a>
391 and <a id="idx:winshell2:1319"></a><a class="pred" href="system.html#win_shell/2">win_shell/2</a>
392 can often be replaced by the more portable <a id="idx:shell2:1320"></a><a class="pred" href="system.html#shell/2">shell/2</a>
390 alternatives. For example, <a id="idx:winexec2:1320"></a><a class="pred" href="system.html#win_exec/2">win_exec/2</a>
391 and <a id="idx:winshell2:1321"></a><a class="pred" href="system.html#win_shell/2">win_shell/2</a>
392 can often be replaced by the more portable <a id="idx:shell2:1322"></a><a class="pred" href="system.html#shell/2">shell/2</a>
393393 or the more powerful
394 <a id="idx:processcreate3:1321"></a><span class="pred-ext">process_create/3</span>.
394 <a id="idx:processcreate3:1323"></a><span class="pred-ext">process_create/3</span>.
395395
396396 <dl class="latex">
397397 <dt class="pubdef"><a id="win_exec/2"><strong>win_exec</strong>(<var>+Command,
421421 rules for doing so. <var>Operation</var> is one of <code>open</code>,
422422 <code>print</code> or <code>explore</code> or another operation
423423 registered with the shell for the given document type. On modern systems
424 it is also possible to pass a <a id="idx:URL:1322"></a>URL as <var>File</var>,
424 it is also possible to pass a <a id="idx:URL:1324"></a>URL as <var>File</var>,
425425 opening the URL in Windows default browser. This call interfaces to the
426426 Win32 API ShellExecute(). The <var>Show</var> argument determines the
427 initial state of the opened window (if any). See <a id="idx:winexec2:1323"></a><a class="pred" href="system.html#win_exec/2">win_exec/2</a>
427 initial state of the opened window (if any). See <a id="idx:winexec2:1325"></a><a class="pred" href="system.html#win_exec/2">win_exec/2</a>
428428 for defined values.</dd>
429429 <dt class="pubdef"><a id="win_shell/2"><strong>win_shell</strong>(<var>+Operation,
430430 +File</var>)</a></dt>
478478 <dt class="pubdef"><a id="win_add_dll_directory/1"><strong>win_add_dll_directory</strong>(<var>+AbsDir</var>)</a></dt>
479479 <dd class="defbody">
480480 This predicate adds a directory to the search path for dependent DLL
481 files. If possible, this is achieved with <a id="idx:winadddlldirectory2:1324"></a><a class="pred" href="system.html#win_add_dll_directory/2">win_add_dll_directory/2</a>.
481 files. If possible, this is achieved with <a id="idx:winadddlldirectory2:1326"></a><a class="pred" href="system.html#win_add_dll_directory/2">win_add_dll_directory/2</a>.
482482 Otherwise, <code>%PATH%</code> is extended with the provided directory.
483483 <var>AbsDir</var> may be specified in the Prolog canonical syntax. See
484 <a id="idx:prologtoosfilename2:1325"></a><a class="pred" href="files.html#prolog_to_os_filename/2">prolog_to_os_filename/2</a>.
485 Note that <a id="idx:useforeignlibrary1:1326"></a><a class="pred" href="foreignlink.html#use_foreign_library/1">use_foreign_library/1</a>
484 <a id="idx:prologtoosfilename2:1327"></a><a class="pred" href="files.html#prolog_to_os_filename/2">prolog_to_os_filename/2</a>.
485 Note that <a id="idx:useforeignlibrary1:1328"></a><a class="pred" href="foreignlink.html#use_foreign_library/1">use_foreign_library/1</a>
486486 passes an absolute path to the DLL if the destination DLL can be located
487 from the specification using <a id="idx:absolutefilename3:1327"></a><a class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</a>.</dd>
487 from the specification using <a id="idx:absolutefilename3:1329"></a><a class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</a>.</dd>
488488 <dt class="pubdef"><a id="win_add_dll_directory/2"><strong>win_add_dll_directory</strong>(<var>+AbsDir,
489489 -Cookie</var>)</a></dt>
490490 <dd class="defbody">
491491 This predicate adds a directory to the search path for dependent DLL
492492 files. If the call is successful it unifies <var>Cookie</var> with a
493 handle that must be passed to <a id="idx:winremovedlldirectory1:1328"></a><a class="pred" href="system.html#win_remove_dll_directory/1">win_remove_dll_directory/1</a>
493 handle that must be passed to <a id="idx:winremovedlldirectory1:1330"></a><a class="pred" href="system.html#win_remove_dll_directory/1">win_remove_dll_directory/1</a>
494494 to remove the directory from the search path. Error conditions:
495495
496496 <p>
504504 or the underlying Windows API returns an error.
505505 </ul>
506506
507 <p>If <a id="idx:opensharedobject2:1329"></a><a class="pred" href="foreignlink.html#open_shared_object/2">open_shared_object/2</a>
507 <p>If <a id="idx:opensharedobject2:1331"></a><a class="pred" href="foreignlink.html#open_shared_object/2">open_shared_object/2</a>
508508 is passed an <em>absolute</em> path to a DLL on a Windows installation
509 that supports AddDllDirectory() and friends,<sup class="fn">113<span class="fn-text">Windows&nbsp;7
509 that supports AddDllDirectory() and friends,<sup class="fn">116<span class="fn-text">Windows&nbsp;7
510510 with up-to-date patches or Windows&nbsp;8.</span></sup> SWI-Prolog uses
511511 LoadLibraryEx() with the flags
512512 <code>LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR</code> and
513513 <code>LOAD_LIBRARY_SEARCH_DEFAULT_DIRS</code>. In this scenario,
514514 directories from <code>%PATH%</code> and <em>not</em> searched.
515 Additional directories can be added using <a id="idx:winadddlldirectory2:1330"></a><a class="pred" href="system.html#win_add_dll_directory/2">win_add_dll_directory/2</a>.</dd>
515 Additional directories can be added using <a id="idx:winadddlldirectory2:1332"></a><a class="pred" href="system.html#win_add_dll_directory/2">win_add_dll_directory/2</a>.</dd>
516516 <dt class="pubdef"><a id="win_remove_dll_directory/1"><strong>win_remove_dll_directory</strong>(<var>-Cookie</var>)</a></dt>
517517 <dd class="defbody">
518 Remove a DLL search directory installed using <a id="idx:winadddlldirectory2:1331"></a><a class="pred" href="system.html#win_add_dll_directory/2">win_add_dll_directory/2</a>.
518 Remove a DLL search directory installed using <a id="idx:winadddlldirectory2:1333"></a><a class="pred" href="system.html#win_add_dll_directory/2">win_add_dll_directory/2</a>.
519519 </dd>
520520 </dl>
521521
550550 opinion, using a floating point number is a more natural choice as we
551551 can use a natural unit and the interface does not need to be changed if
552552 a higher resolution is required in the future. Our unit of choice is the
553 second as it is the scientific unit.<sup class="fn">114<span class="fn-text">Using
553 second as it is the scientific unit.<sup class="fn">117<span class="fn-text">Using
554554 Julian days is a choice made by the Eclipse team. As conversion to dates
555555 is needed for a human readable notation of time and Julian days cannot
556556 deal naturally with leap seconds, we decided for the second as our unit.</span></sup>
583583 and minute (0..59). The <var>S</var> field holds the seconds as a
584584 floating point number between 0.0 and 60.0. <var>Off</var> is an integer
585585 representing the offset relative to UTC in seconds, where positive
586 values are west of Greenwich. If converted from local time (see <a id="idx:stampdatetime3:1332"></a><a class="pred" href="system.html#stamp_date_time/3">stamp_date_time/3</a>),
586 values are west of Greenwich. If converted from local time (see <a id="idx:stampdatetime3:1334"></a><a class="pred" href="system.html#stamp_date_time/3">stamp_date_time/3</a>),
587587 <var>TZ</var> holds the name of the local timezone. If the timezone is
588588 not known, <var>TZ</var> is the atom <code><code>-</code></code>. <var>DST</var>
589589 is <code>true</code> if daylight saving time applies to the current
593593 <dt><strong>date</strong>(<var>Y,M,D</var>)</dt>
594594 <dd class="defbody">
595595 Date using the same values as described above. Extracted using
596 <a id="idx:datetimevalue3:1333"></a><a class="pred" href="system.html#date_time_value/3">date_time_value/3</a>.</dd>
596 <a id="idx:datetimevalue3:1335"></a><a class="pred" href="system.html#date_time_value/3">date_time_value/3</a>.</dd>
597597 <dt><strong>time</strong>(<var>H,Mn,S</var>)</dt>
598598 <dd class="defbody">
599599 Time using the same values as described above. Extracted using
600 <a id="idx:datetimevalue3:1334"></a><a class="pred" href="system.html#date_time_value/3">date_time_value/3</a>.
600 <a id="idx:datetimevalue3:1336"></a><a class="pred" href="system.html#date_time_value/3">date_time_value/3</a>.
601601 </dd>
602602 </dl>
603603
626626 Compute the timestamp from a date/9 term. Values for month, day, hour,
627627 minute or second need not be normalized. This flexibility allows for
628628 easy computation of the time at any given number of these units from a
629 given timestamp. Normalization can be achieved following this call with <a id="idx:stampdatetime3:1335"></a><a class="pred" href="system.html#stamp_date_time/3">stamp_date_time/3</a>.
629 given timestamp. Normalization can be achieved following this call with <a id="idx:stampdatetime3:1337"></a><a class="pred" href="system.html#stamp_date_time/3">stamp_date_time/3</a>.
630630 This example computes the date 200 days after 2006-7-14:
631631
632632 <pre class="code">
697697 +Format, +StampOrDateTime</var>)</a></dt>
698698 <dd class="defbody">
699699 Modelled after POSIX strftime(), using GNU extensions. <var>Out</var> is
700 a destination as specified with <a id="idx:withoutputto2:1336"></a><a class="pred" href="IO.html#with_output_to/2">with_output_to/2</a>. <var>Format</var>
700 a destination as specified with <a id="idx:withoutputto2:1338"></a><a class="pred" href="IO.html#with_output_to/2">with_output_to/2</a>. <var>Format</var>
701701 is an atom or string with the following conversions. Conversions start
702 with a tilde (%) character.<sup class="fn">115<span class="fn-text">Descriptions
702 with a tilde (%) character.<sup class="fn">118<span class="fn-text">Descriptions
703703 taken from Linux Programmer's Manual</span></sup>
704704 <var>StampOrDateTime</var> is either a numeric time-stamp, a term
705705 <code>date(Y,M,D,H,M,S,O,TZ,DST)</code> or a term <code>date(Y,M,D)</code>.
708708 <ul class="latex">
709709 <li><code>a</code><br>
710710 The abbreviated weekday name according to the current locale. Use
711 <a id="idx:formattime4:1337"></a><a class="pred" href="system.html#format_time/4">format_time/4</a>
711 <a id="idx:formattime4:1339"></a><a class="pred" href="system.html#format_time/4">format_time/4</a>
712712 for POSIX locale.
713713 <li><code>A</code><br>
714714 The full weekday name according to the current locale. Use
715 <a id="idx:formattime4:1338"></a><a class="pred" href="system.html#format_time/4">format_time/4</a>
715 <a id="idx:formattime4:1340"></a><a class="pred" href="system.html#format_time/4">format_time/4</a>
716716 for POSIX locale.
717717 <li><code>b</code><br>
718718 The abbreviated month name according to the current locale. Use
719 <a id="idx:formattime4:1339"></a><a class="pred" href="system.html#format_time/4">format_time/4</a>
719 <a id="idx:formattime4:1341"></a><a class="pred" href="system.html#format_time/4">format_time/4</a>
720720 for POSIX locale.
721721 <li><code>B</code><br>
722722 The full month name according to the current locale. Use
723 <a id="idx:formattime4:1340"></a><a class="pred" href="system.html#format_time/4">format_time/4</a>
723 <a id="idx:formattime4:1342"></a><a class="pred" href="system.html#format_time/4">format_time/4</a>
724724 for POSIX locale.
725725 <li><code>c</code><br>
726726 The preferred date and time representation for the current locale.
841841
842842 <p>The table below gives some format strings for popular time
843843 representations. RFC1123 is used by HTTP. The full implementation of
844 <a id="idx:httptimestamp2:1341"></a><span class="pred-ext">http_timestamp/2</span>
844 <a id="idx:httptimestamp2:1343"></a><span class="pred-ext">http_timestamp/2</span>
845845 as available from <code>library(http/http_header)</code> is here.
846846
847847 <pre class="code">
874874 <dt class="pubdef"><a id="parse_time/2"><strong>parse_time</strong>(<var>+Text,
875875 -Stamp</var>)</a></dt>
876876 <dd class="defbody">
877 Same as <code>parse_time(Text, _Format, Stamp)</code>. See <a id="idx:parsetime3:1342"></a><a class="pred" href="system.html#parse_time/3">parse_time/3</a>.</dd>
877 Same as <code>parse_time(Text, _Format, Stamp)</code>. See <a id="idx:parsetime3:1344"></a><a class="pred" href="system.html#parse_time/3">parse_time/3</a>.</dd>
878878 <dt class="pubdef"><a id="parse_time/3"><strong>parse_time</strong>(<var>+Text,
879879 ?Format, -Stamp</var>)</a></dt>
880880 <dd class="defbody">
964964 </dd>
965965 <dt class="pubdef"><a id="win_has_menu/0"><strong>win_has_menu</strong></a></dt>
966966 <dd class="defbody">
967 True if <a id="idx:wininsertmenu2:1343"></a><a class="pred" href="system.html#win_insert_menu/2">win_insert_menu/2</a>
968 and <a id="idx:wininsertmenuitem4:1344"></a><a class="pred" href="system.html#win_insert_menu_item/4">win_insert_menu_item/4</a>
967 True if <a id="idx:wininsertmenu2:1345"></a><a class="pred" href="system.html#win_insert_menu/2">win_insert_menu/2</a>
968 and <a id="idx:wininsertmenuitem4:1346"></a><a class="pred" href="system.html#win_insert_menu_item/4">win_insert_menu_item/4</a>
969969 are present.</dd>
970970 <dt class="pubdef"><a id="win_insert_menu/2"><strong>win_insert_menu</strong>(<var>+Label,
971971 +Before</var>)</a></dt>
987987 +Label, +Before, :Goal</var>)</a></dt>
988988 <dd class="defbody">
989989 Add an item to the named <var>Pulldown</var> menu. <var>Label</var> and
990 <var>Before</var> are handled as in <a id="idx:wininsertmenu2:1345"></a><a class="pred" href="system.html#win_insert_menu/2">win_insert_menu/2</a>,
990 <var>Before</var> are handled as in <a id="idx:wininsertmenu2:1347"></a><a class="pred" href="system.html#win_insert_menu/2">win_insert_menu/2</a>,
991991 but the label <code><code>-</code></code> inserts a <em>separator</em>. <var>Goal</var>
992992 is called if the user selects the item.
993993 </dd>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.19</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.19</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
238238 <a id="sec:termrw"></a>
239239
240240 <p>This section describes the basic term reading and writing predicates.
241 The predicates <a id="idx:format12:997"></a><span class="pred-ext">format/[1,2]</span>
242 and <a id="idx:writef2:998"></a><a class="pred" href="format.html#writef/2">writef/2</a>
241 The predicates <a id="idx:format12:998"></a><span class="pred-ext">format/[1,2]</span>
242 and <a id="idx:writef2:999"></a><a class="pred" href="format.html#writef/2">writef/2</a>
243243 provide formatted output. Writing to Prolog data structures such as
244 atoms or code-lists is supported by <a id="idx:withoutputto2:999"></a><a class="pred" href="IO.html#with_output_to/2">with_output_to/2</a>
245 and <a id="idx:format3:1000"></a><a class="pred" href="format.html#format/3">format/3</a>.
244 atoms or code-lists is supported by <a id="idx:withoutputto2:1000"></a><a class="pred" href="IO.html#with_output_to/2">with_output_to/2</a>
245 and <a id="idx:format3:1001"></a><a class="pred" href="format.html#format/3">format/3</a>.
246246
247247 <p>Reading is sensitive to the Prolog flag <a class="flag" href="flags.html#flag:character_escapes">character_escapes</a>,
248248 which controls the interpretation of the <code><code>\</code></code>
252252 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="write_term/2"><strong>write_term</strong>(<var>+Term,
253253 +Options</var>)</a></dt>
254254 <dd class="defbody">
255 The predicate <a id="idx:writeterm2:1001"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>
255 The predicate <a id="idx:writeterm2:1002"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>
256256 is the generic form of all Prolog term-write predicates. Valid options
257257 are:
258258
263263 7.1</a>) are written. The default is determined by the Prolog flag <a class="flag" href="flags.html#flag:write_attributes">write_attributes</a>.
264264 Defined values are <code>ignore</code> (ignore the attribute), <code>dots</code>
265265 (write the attributes as <code>{...}</code>), <code>write</code> (simply
266 hand the attributes recursively to <a id="idx:writeterm2:1002"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>)
267 and <code>portray</code> (hand the attributes to <a id="idx:attrportrayhook2:1003"></a><a class="pred" href="attvar.html#attr_portray_hook/2">attr_portray_hook/2</a>).</dd>
266 hand the attributes recursively to <a id="idx:writeterm2:1003"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>)
267 and <code>portray</code> (hand the attributes to <a id="idx:attrportrayhook2:1004"></a><a class="pred" href="attvar.html#attr_portray_hook/2">attr_portray_hook/2</a>).</dd>
268268 <dt><strong>back_quotes</strong>(<var>Atom</var>)</dt>
269269 <dd class="defbody">
270270 Fulfills the same role as the <a class="flag" href="flags.html#flag:back_quotes">back_quotes</a>
281281 <dd class="defbody">
282282 Define how non-text blobs are handled. By default, this is left to the
283283 write handler specified with the blob type. Using <code>portray</code>,
284 <a id="idx:portray1:1004"></a><a class="pred" href="termrw.html#portray/1">portray/1</a>
284 <a id="idx:portray1:1005"></a><a class="pred" href="termrw.html#portray/1">portray/1</a>
285285 is called for each blob encountered. See <a class="sec" href="foreigninclude.html">section
286286 10.4.7</a>.</dd>
287287 <dt><strong>character_escapes</strong>(<var>Bool</var>)</dt>
295295 <code>@(Template, Substitutions)</code>, where <var>Substitutions</var>
296296 is a list
297297 <var>Var</var> = <var>Value</var>. If <code>cycles</code> is <code>false</code>,
298 <code>max_depth</code> is not given, and <var>Term</var> is cyclic, <a id="idx:writeterm2:1005"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>
299 raises a <code>domain_error</code>.<sup class="fn">79<span class="fn-text">The
298 <code>max_depth</code> is not given, and <var>Term</var> is cyclic, <a id="idx:writeterm2:1006"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>
299 raises a <code>domain_error</code>.<sup class="fn">80<span class="fn-text">The
300300 cycles option and the cyclic term representation using the @-term are
301301 copied from SICStus Prolog. However, the default in SICStus is set to <code>false</code>
302302 and SICStus writes an infinite term if not protected by, e.g., the <code>depth_limit</code>
303303 option.</span></sup> See also the <code>cycles</code> option in
304 <a id="idx:readterm2:1006"></a><a class="pred" href="termrw.html#read_term/2">read_term/2</a>.</dd>
304 <a id="idx:readterm2:1007"></a><a class="pred" href="termrw.html#read_term/2">read_term/2</a>.</dd>
305305 <dt><strong>dotlists</strong>(<var>Bool</var>)</dt>
306306 <dd class="defbody">
307307 If <code>true</code> (default <code>false</code>), write lists using the
308 dotted term notation rather than the list notation.<sup class="fn">80<span class="fn-text">Copied
308 dotted term notation rather than the list notation.<sup class="fn">81<span class="fn-text">Copied
309309 from ECLiPSe.</span></sup> Note that as of version&nbsp;7, the list
310310 constructor is
311 <code>'[|]'</code>. Using <code>dotlists(true)</code>, <a id="idx:writeterm2:1007"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>
311 <code>'[|]'</code>. Using <code>dotlists(true)</code>, <a id="idx:writeterm2:1008"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>
312312 writes a list using `.' as constructor. This is intended for
313313 communication with programs such as other Prolog systems, that rely on
314314 this notation.</dd>
317317 If <code>true</code> (default <code>false</code>), add a fullstop token
318318 to the output. The dot is preceeded by a space if needed and followed by
319319 a space (default) or newline if the <code>nl(true)</code> option is also
320 given.<sup class="fn">81<span class="fn-text">Compatible with <a class="url" href="http://eclipseclp.org/doc/bips/kernel/ioterm/write_term-3.html">ECLiPSe</a></span></sup></dd>
320 given.<sup class="fn">82<span class="fn-text">Compatible with <a class="url" href="http://eclipseclp.org/doc/bips/kernel/ioterm/write_term-3.html">ECLiPSe</a></span></sup></dd>
321321 <dt><strong>ignore_ops</strong>(<var>Bool</var>)</dt>
322322 <dd class="defbody">
323323 If <code>true</code>, the generic term representation (&lt;<var>functor</var>&gt;(&lt;<var>args</var>&gt;
324324 ... )) will be used for all terms. Otherwise (default), operators will
325 be used where appropriate.<sup class="fn">82<span class="fn-text">In
325 be used where appropriate.<sup class="fn">83<span class="fn-text">In
326326 traditional systems this flag also stops the syntactic sugar notation
327327 for lists and brace terms. In SWI-Prolog, these are controlled by the
328328 separate options <code>dotlists</code> and <code>brace_terms</code></span></sup>.</dd>
348348 <dd class="defbody">
349349 Define the reference module (default <code>user</code>). This defines
350350 the default value for the <a class="flag" href="flags.html#flag:character_escapes">character_escapes</a>
351 option as well as the operator definitions to use. See also <a id="idx:op3:1008"></a><a class="pred" href="operators.html#op/3">op/3</a>.</dd>
351 option as well as the operator definitions to use. See also <a id="idx:op3:1009"></a><a class="pred" href="operators.html#op/3">op/3</a>.</dd>
352352 <dt><strong>nl</strong>(<var>Bool</var>)</dt>
353353 <dd class="defbody">
354354 Add a newline to the output. See also the <code>fullstop</code> option.</dd>
358358 is a non-negative integer, will be written as a variable name. If <var>N</var>
359359 is an atom it is written without quotes. This extension allows for
360360 writing variables with user-provided names. The default is <code>false</code>.
361 See also <a id="idx:numbervars3:1009"></a><a class="pred" href="manipterm.html#numbervars/3">numbervars/3</a>
361 See also <a id="idx:numbervars3:1010"></a><a class="pred" href="manipterm.html#numbervars/3">numbervars/3</a>
362362 and the option <code>variable_names</code>.</dd>
363363 <dt><strong>partial</strong>(<var>Bool</var>)</dt>
364364 <dd class="defbody">
367367 is intended to solve the problems with the code below. Calling <code>write_value(<code>.</code>)</code>
368368 writes <code>..</code>, which cannot be read. By adding <code>partial(true)</code>
369369 to the option list, it correctly emits <code>. .</code>. Similar
370 problems appear when emitting operators using multiple calls to <a id="idx:writeterm3:1010"></a><a class="pred" href="termrw.html#write_term/3">write_term/3</a>.
370 problems appear when emitting operators using multiple calls to <a id="idx:writeterm3:1011"></a><a class="pred" href="termrw.html#write_term/3">write_term/3</a>.
371371
372372 <pre class="code">
373373 write_value(Value) :-
382382 <dt><strong>portray_goal</strong>(<var>:Goal</var>)</dt>
383383 <dd class="defbody">
384384 Implies <code>portray(true)</code>, but calls <var>Goal</var> rather
385 than the predefined hook <a id="idx:portray1:1011"></a><a class="pred" href="termrw.html#portray/1">portray/1</a>. <var>Goal</var>
386 is called through <a id="idx:call3:1012"></a><span class="pred-ext">call/3</span>,
385 than the predefined hook <a id="idx:portray1:1012"></a><a class="pred" href="termrw.html#portray/1">portray/1</a>. <var>Goal</var>
386 is called through <a id="idx:call3:1013"></a><span class="pred-ext">call/3</span>,
387387 where the first argument is <var>Goal</var>, the second is the term to
388388 be printed and the 3rd argument is the current write option list. The
389389 write option list is copied from the write_term call, but the list is
391391 current priority.</dd>
392392 <dt><strong>portrayed</strong>(<var>Bool</var>)</dt>
393393 <dd class="defbody">
394 If <code>true</code>, the hook <a id="idx:portray1:1013"></a><a class="pred" href="termrw.html#portray/1">portray/1</a>
395 is called before printing a term that is not a variable. If <a id="idx:portray1:1014"></a><a class="pred" href="termrw.html#portray/1">portray/1</a>
396 succeeds, the term is considered printed. See also <a id="idx:print1:1015"></a><a class="pred" href="termrw.html#print/1">print/1</a>.
394 If <code>true</code>, the hook <a id="idx:portray1:1014"></a><a class="pred" href="termrw.html#portray/1">portray/1</a>
395 is called before printing a term that is not a variable. If <a id="idx:portray1:1015"></a><a class="pred" href="termrw.html#portray/1">portray/1</a>
396 succeeds, the term is considered printed. See also <a id="idx:print1:1016"></a><a class="pred" href="termrw.html#print/1">print/1</a>.
397397 The default is <code>false</code>. This option is an extension to the
398398 ISO write_term options.</dd>
399399 <dt><strong>priority</strong>(<var>Integer</var>)</dt>
416416 <dd class="defbody">
417417 Determines whether and where extra white space is added to enhance
418418 readability. The default is <code>standard</code>, adding only space
419 where needed for proper tokenization by <a id="idx:readterm3:1016"></a><a class="pred" href="termrw.html#read_term/3">read_term/3</a>.
419 where needed for proper tokenization by <a id="idx:readterm3:1017"></a><a class="pred" href="termrw.html#read_term/3">read_term/3</a>.
420420 Currently, the only other value is <code>next_argument</code>, adding a
421421 space after a comma used to separate arguments in a term or list.</dd>
422422 <dt><strong>variable_names</strong>(<var>+List</var>)</dt>
432432 <var>Name</var> does not represent a valid Prolog variable name.
433433
434434 <p>The implementation binds the variables from <var>List</var> to a term
435 <code>'$VAR'</code>(<var>Name</var>). Like <a id="idx:writecanonical1:1017"></a><a class="pred" href="termrw.html#write_canonical/1">write_canonical/1</a>,
435 <code>'$VAR'</code>(<var>Name</var>). Like <a id="idx:writecanonical1:1018"></a><a class="pred" href="termrw.html#write_canonical/1">write_canonical/1</a>,
436436 terms that where already bound to <code>'$VAR'</code>(<var>X</var>)
437 before <a id="idx:writeterm2:1018"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>
437 before <a id="idx:writeterm2:1019"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>
438438 are printed normally, unless the option <code>numbervars(true)</code> is
439439 also provided. If the option <code>numbervars(true)</code> is used, the
440440 user is responsible for avoiding collisions between assigned names and
441441 numbered names. See also the <code>variable_names</code> option of
442 <a id="idx:readterm2:1019"></a><a class="pred" href="termrw.html#read_term/2">read_term/2</a>.
442 <a id="idx:readterm2:1020"></a><a class="pred" href="termrw.html#read_term/2">read_term/2</a>.
443443
444444 <p>Possible variable attributes (see <a class="sec" href="extvar.html">section
445 7</a>) are ignored. In most cases one should use <a id="idx:copyterm3:1020"></a><a class="pred" href="attvar.html#copy_term/3">copy_term/3</a>
445 7</a>) are ignored. In most cases one should use <a id="idx:copyterm3:1021"></a><a class="pred" href="attvar.html#copy_term/3">copy_term/3</a>
446446 to obtain a copy that is free of attributed variables and handle the
447447 associated constraints as appropriate for the use-case.
448448 </dd>
452452 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="write_term/3"><strong>write_term</strong>(<var>+Stream,
453453 +Term, +Options</var>)</a></dt>
454454 <dd class="defbody">
455 As <a id="idx:writeterm2:1021"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>,
455 As <a id="idx:writeterm2:1022"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>,
456456 but output is sent to <var>Stream</var> rather than the current output.</dd>
457457 <dt class="pubdef"><span class="pred-tag">[semidet]</span><a id="write_length/3"><strong>write_length</strong>(<var>+Term,
458458 -Length, +Options</var>)</a></dt>
459459 <dd class="defbody">
460460 True when <var>Length</var> is the number of characters emitted for
461461 <var>write_term</var>Term, Options . In addition to valid options for
462 <a id="idx:writeterm2:1022"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>,
462 <a id="idx:writeterm2:1023"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>,
463463 it processes the option:
464464
465465 <dl class="latex">
478478 parenthesised prefix notation (i.e., ignoring operator declarations).
479479 Atoms that need quotes are quoted. Terms written with this predicate can
480480 always be read back, regardless of current operator declarations.
481 Equivalent to <a id="idx:writeterm2:1023"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>
481 Equivalent to <a id="idx:writeterm2:1024"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>
482482 using the options <code>ignore_ops</code>,
483 <code>quoted</code> and <code>numbervars</code> after <a id="idx:numbervars4:1024"></a><a class="pred" href="manipterm.html#numbervars/4">numbervars/4</a>
483 <code>quoted</code> and <code>numbervars</code> after <a id="idx:numbervars4:1025"></a><a class="pred" href="manipterm.html#numbervars/4">numbervars/4</a>
484484 using the
485485 <code>singletons</code> option.
486486
487 <p>Note that due to the use of <a id="idx:numbervars4:1025"></a><a class="pred" href="manipterm.html#numbervars/4">numbervars/4</a>,
488 non-ground terms must be written using a <em>single</em> <a id="idx:writecanonical1:1026"></a><a class="pred" href="termrw.html#write_canonical/1">write_canonical/1</a>
487 <p>Note that due to the use of <a id="idx:numbervars4:1026"></a><a class="pred" href="manipterm.html#numbervars/4">numbervars/4</a>,
488 non-ground terms must be written using a <em>single</em> <a id="idx:writecanonical1:1027"></a><a class="pred" href="termrw.html#write_canonical/1">write_canonical/1</a>
489489 call. This used to be the case anyhow, as garbage collection between
490490 multiple calls to one of the write predicates can change the <code>_G</code>&lt;NNN&gt;
491491 identity of the variables.</dd>
505505 <dd class="defbody">
506506 Write <var>Term</var> to the current output, using brackets and
507507 operators where appropriate. Atoms that need quotes are quoted. Terms
508 written with this predicate can be read back with <a id="idx:read1:1027"></a><a class="pred" href="termrw.html#read/1">read/1</a>
508 written with this predicate can be read back with <a id="idx:read1:1028"></a><a class="pred" href="termrw.html#read/1">read/1</a>
509509 provided the currently active operator declarations are identical.</dd>
510510 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="writeq/2"><strong>writeq</strong>(<var>+Stream,
511511 +Term</var>)</a></dt>
524524 between the term and newline.</dd>
525525 <dt class="pubdef"><a id="print/1"><strong>print</strong>(<var>+Term</var>)</a></dt>
526526 <dd class="defbody">
527 Print a term for debugging porposes. The predicate <a id="idx:print1:1028"></a><a class="pred" href="termrw.html#print/1">print/1</a>
527 Print a term for debugging porposes. The predicate <a id="idx:print1:1029"></a><a class="pred" href="termrw.html#print/1">print/1</a>
528528 acts as if defined as below.
529529
530530 <pre class="code">
538538 ]).
539539 </pre>
540540
541 <p>The <a id="idx:print1:1029"></a><a class="pred" href="termrw.html#print/1">print/1</a>
541 <p>The <a id="idx:print1:1030"></a><a class="pred" href="termrw.html#print/1">print/1</a>
542542 predicate is used primarily through the <code>~p</code> escape sequence
543 of <a id="idx:format2:1030"></a><a class="pred" href="format.html#format/2">format/2</a>,
543 of <a id="idx:format2:1031"></a><a class="pred" href="format.html#format/2">format/2</a>,
544544 which is commonly used in the recipies used by
545 <a id="idx:printmessage2:1031"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>
545 <a id="idx:printmessage2:1032"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>
546546 to emit messages.
547547
548548 <p>The classical definition of this predicate is equivalent to the ISO
549 predicate <a id="idx:writeterm2:1032"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>
549 predicate <a id="idx:writeterm2:1033"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>
550550 using the options <code>portray(true)</code> and
551551 <code>numbervars(true)</code>. The <code>portray(true)</code> options
552552 allows the user to implement application-specific printing of terms
553553 printed during debugging to facilitate easy understanding of the output.
554554 See also
555 <a id="idx:portray1:1033"></a><a class="pred" href="termrw.html#portray/1">portray/1</a>
555 <a id="idx:portray1:1034"></a><a class="pred" href="termrw.html#portray/1">portray/1</a>
556556 and <code>library(portray_text)</code>. SWI-Prolog adds <code>quoted(true)</code>
557 to facilitate copy/paste of terms not affected by <a id="idx:portray1:1034"></a><a class="pred" href="termrw.html#portray/1">portray/1</a>
557 to facilitate copy/paste of terms not affected by <a id="idx:portray1:1035"></a><a class="pred" href="termrw.html#portray/1">portray/1</a>
558558 and better distinguishing of e.g., <code>42</code>, <code>'42'</code>
559559 and <code>"42"</code>, a number, atom and string.</dd>
560560 <dt class="pubdef"><a id="print/2"><strong>print</strong>(<var>+Stream,
564564 <dt class="pubdef"><a id="portray/1"><strong>portray</strong>(<var>+Term</var>)</a></dt>
565565 <dd class="defbody">
566566 A dynamic predicate, which can be defined by the user to change the
567 behaviour of <a id="idx:print1:1035"></a><a class="pred" href="termrw.html#print/1">print/1</a>
568 on (sub)terms. For each subterm encountered that is not a variable <a id="idx:print1:1036"></a><a class="pred" href="termrw.html#print/1">print/1</a>
569 first calls <a id="idx:portray1:1037"></a><a class="pred" href="termrw.html#portray/1">portray/1</a>
567 behaviour of <a id="idx:print1:1036"></a><a class="pred" href="termrw.html#print/1">print/1</a>
568 on (sub)terms. For each subterm encountered that is not a variable <a id="idx:print1:1037"></a><a class="pred" href="termrw.html#print/1">print/1</a>
569 first calls <a id="idx:portray1:1038"></a><a class="pred" href="termrw.html#portray/1">portray/1</a>
570570 using the term as argument. For lists, only the list as a whole is given
571 to <a id="idx:portray1:1038"></a><a class="pred" href="termrw.html#portray/1">portray/1</a>.
571 to <a id="idx:portray1:1039"></a><a class="pred" href="termrw.html#portray/1">portray/1</a>.
572572 If
573 <a id="idx:portray1:1039"></a><a class="pred" href="termrw.html#portray/1">portray/1</a>
574 succeeds <a id="idx:print1:1040"></a><a class="pred" href="termrw.html#print/1">print/1</a>
573 <a id="idx:portray1:1040"></a><a class="pred" href="termrw.html#portray/1">portray/1</a>
574 succeeds <a id="idx:print1:1041"></a><a class="pred" href="termrw.html#print/1">print/1</a>
575575 assumes the term has been written.</dd>
576576 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="read/1"><strong>read</strong>(<var>-Term</var>)</a></dt>
577577 <dd class="defbody">
578578 Read the next Prolog term from the current input stream and unify it
579 with <var>Term</var>. On a syntax error <a id="idx:read1:1041"></a><a class="pred" href="termrw.html#read/1">read/1</a>
579 with <var>Term</var>. On a syntax error <a id="idx:read1:1042"></a><a class="pred" href="termrw.html#read/1">read/1</a>
580580 displays an error message, attempts to skip the erroneous term and
581581 fails. On reaching end-of-file
582582 <var>Term</var> is unified with the atom <code>end_of_file</code>.</dd>
587587 <dt class="pubdef"><a id="read_clause/3"><strong>read_clause</strong>(<var>+Stream,
588588 -Term, +Options</var>)</a></dt>
589589 <dd class="defbody">
590 Equivalent to <a id="idx:readterm3:1042"></a><a class="pred" href="termrw.html#read_term/3">read_term/3</a>,
590 Equivalent to <a id="idx:readterm3:1043"></a><a class="pred" href="termrw.html#read_term/3">read_term/3</a>,
591591 but sets options according to the current compilation context and
592592 optionally processes comments. Defined options:
593593
594594 <dl class="latex">
595595 <dt><strong>syntax_errors</strong>(<var>+Atom</var>)</dt>
596596 <dd class="defbody">
597 See <a id="idx:readterm3:1043"></a><a class="pred" href="termrw.html#read_term/3">read_term/3</a>,
597 See <a id="idx:readterm3:1044"></a><a class="pred" href="termrw.html#read_term/3">read_term/3</a>,
598598 but the default is <code>dec10</code> (report and restart).</dd>
599599 <dt><strong>term_position</strong>(<var>-TermPos</var>)</dt>
600600 <dd class="defbody">
601 Same as for <a id="idx:readterm3:1044"></a><a class="pred" href="termrw.html#read_term/3">read_term/3</a>.</dd>
601 Same as for <a id="idx:readterm3:1045"></a><a class="pred" href="termrw.html#read_term/3">read_term/3</a>.</dd>
602602 <dt><strong>subterm_positions</strong>(<var>-TermPos</var>)</dt>
603603 <dd class="defbody">
604 Same as for <a id="idx:readterm3:1045"></a><a class="pred" href="termrw.html#read_term/3">read_term/3</a>.</dd>
604 Same as for <a id="idx:readterm3:1046"></a><a class="pred" href="termrw.html#read_term/3">read_term/3</a>.</dd>
605605 <dt><strong>variable_names</strong>(<var>-Bindings</var>)</dt>
606606 <dd class="defbody">
607 Same as for <a id="idx:readterm3:1046"></a><a class="pred" href="termrw.html#read_term/3">read_term/3</a>.</dd>
607 Same as for <a id="idx:readterm3:1047"></a><a class="pred" href="termrw.html#read_term/3">read_term/3</a>.</dd>
608608 <dt><strong>process_comment</strong>(<var>+Boolean</var>)</dt>
609609 <dd class="defbody">
610610 If <code>true</code> (default), call
619619 </dd>
620620 </dl>
621621
622 <p>The <code>singletons</code> option of <a id="idx:readterm3:1047"></a><a class="pred" href="termrw.html#read_term/3">read_term/3</a>
622 <p>The <code>singletons</code> option of <a id="idx:readterm3:1048"></a><a class="pred" href="termrw.html#read_term/3">read_term/3</a>
623623 is initialised from the active style-checking mode. The <code>module</code>
624 option is initialised to the current compilation module (see <a id="idx:prologloadcontext2:1048"></a><a class="pred" href="consulting.html#prolog_load_context/2">prolog_load_context/2</a>).</dd>
624 option is initialised to the current compilation module (see <a id="idx:prologloadcontext2:1049"></a><a class="pred" href="consulting.html#prolog_load_context/2">prolog_load_context/2</a>).</dd>
625625 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="read_term/2"><strong>read_term</strong>(<var>-Term,
626626 +Options</var>)</a></dt>
627627 <dd class="defbody">
629629 <var>Term</var>. The reading is controlled by options from the list of
630630 <var>Options</var>. If this list is empty, the behaviour is the same as
631631 for
632 <a id="idx:read1:1049"></a><a class="pred" href="termrw.html#read/1">read/1</a>.
632 <a id="idx:read1:1050"></a><a class="pred" href="termrw.html#read/1">read/1</a>.
633633 The options are upward compatible with Quintus Prolog. The argument
634634 order is according to the ISO standard. Syntax errors are always
635 reported using exception-handling (see <a id="idx:catch3:1050"></a><a class="pred" href="exception.html#catch/3">catch/3</a>).
635 reported using exception-handling (see <a id="idx:catch3:1051"></a><a class="pred" href="exception.html#catch/3">catch/3</a>).
636636 Options:
637637
638638 <dl class="latex">
647647 <dd class="defbody">
648648 Defines how to read <code>\</code> escape sequences in quoted atoms. See
649649 the Prolog flag <a class="flag" href="flags.html#flag:character_escapes">character_escapes</a>
650 in <a id="idx:currentprologflag2:1051"></a><a class="pred" href="flags.html#current_prolog_flag/2">current_prolog_flag/2</a>.
650 in <a id="idx:currentprologflag2:1052"></a><a class="pred" href="flags.html#current_prolog_flag/2">current_prolog_flag/2</a>.
651651 (SWI-Prolog).</dd>
652652 <dt><strong>comments</strong>(<var>-Comments</var>)</dt>
653653 <dd class="defbody">
654654 Unify <var>Comments</var> with a list of <var>Position</var>-<var>Comment</var>,
655655 where
656 <var>Position</var> is a stream position object (see <a id="idx:streampositiondata3:1052"></a><a class="pred" href="IO.html#stream_position_data/3">stream_position_data/3</a>)
656 <var>Position</var> is a stream position object (see <a id="idx:streampositiondata3:1053"></a><a class="pred" href="IO.html#stream_position_data/3">stream_position_data/3</a>)
657657 indicating the start of a comment and <var>Comment</var> is a string
658658 object containing the text including delimiters of a comment. It returns
659 all comments from where the <a id="idx:readterm2:1053"></a><a class="pred" href="termrw.html#read_term/2">read_term/2</a>
659 all comments from where the <a id="idx:readterm2:1054"></a><a class="pred" href="termrw.html#read_term/2">read_term/2</a>
660660 call started up to the end of the term read.</dd>
661661 <dt><strong>cycles</strong>(<var>Bool</var>)</dt>
662662 <dd class="defbody">
663663 If <code>true</code> (default <code>false</code>), re-instantiate
664 templates as produced by the corresponding <a id="idx:writeterm2:1054"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>
664 templates as produced by the corresponding <a id="idx:writeterm2:1055"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>
665665 option. Note that the default is <code>false</code> to avoid
666666 misinterpretation of <code>@(Template, Substutions)</code>, while the
667 default of <a id="idx:writeterm2:1055"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>
667 default of <a id="idx:writeterm2:1056"></a><a class="pred" href="termrw.html#write_term/2">write_term/2</a>
668668 is <code>true</code> because emitting cyclic terms without using the
669669 template construct produces an infinitely large term (read: it will
670670 generate an error after producing a huge amount of output).</dd>
672672 <dd class="defbody">
673673 If <code>true</code> (default <code>false</code>), read <code>.(a,[])</code>
674674 as a list, even if lists are internally nor constructed using the dot as
675 functor. This is primarily intended to read the output from <a id="idx:writecanonical1:1056"></a><a class="pred" href="termrw.html#write_canonical/1">write_canonical/1</a>
675 functor. This is primarily intended to read the output from <a id="idx:writecanonical1:1057"></a><a class="pred" href="termrw.html#write_canonical/1">write_canonical/1</a>
676676 from other Prolog systems. See <a class="sec" href="ext-lists.html">section
677677 5.1</a>.</dd>
678678 <dt><strong>double_quotes</strong>(<var>Atom</var>)</dt>
684684 <dd class="defbody">
685685 Specify <var>Module</var> for operators, <a class="flag" href="flags.html#flag:character_escapes">character_escapes</a>
686686 flag and <a class="flag" href="flags.html#flag:double_quotes">double_quotes</a>
687 flag. The value of the latter two is overruled if the corresponding <a id="idx:readterm3:1057"></a><a class="pred" href="termrw.html#read_term/3">read_term/3</a>
687 flag. The value of the latter two is overruled if the corresponding <a id="idx:readterm3:1058"></a><a class="pred" href="termrw.html#read_term/3">read_term/3</a>
688688 option is provided. If no module is specified, the current `source
689689 module' is used. (SWI-Prolog).</dd>
690690 <dt><strong>quasi_quotations</strong>(<var>-List</var>)</dt>
694694 evaluating quasi quotations. Each quasi quotation is a term <code>quasi_quotation(+Syntax,
695695 +Quotation, +VarDict, -Result)</code>, where <var>Syntax</var> is the
696696 term in
697 <code>{|Syntax||</code>, <var>Quotation</var> is a list of character
697 <code>{|Syntax||..|}</code>, <var>Quotation</var> is a list of character
698698 codes that represent the quotation, <var>VarDict</var> is a list of
699699 <var>Name</var>=<var>Variable</var> and <var>Result</var> is a variable
700700 that shares with the place where the quotation must be inserted. This
706706 underscore (`<code>_</code>') are not included in this list. (ISO). If <var>Vars</var>
707707 is the constant <code>warning</code>, singleton variables are reported
708708 using
709 <a id="idx:printmessage2:1058"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>.
709 <a id="idx:printmessage2:1059"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>.
710710 The variables appear in the order they have been read.</dd>
711711 <dt><strong>syntax_errors</strong>(<var>Atom</var>)</dt>
712712 <dd class="defbody">
713713 If <code>error</code> (default), throw an exception on a syntax error.
714714 Other values are <code>fail</code>, which causes a message to be printed
715715 using
716 <a id="idx:printmessage2:1059"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>,
716 <a id="idx:printmessage2:1060"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>,
717717 after which the predicate fails, <code>quiet</code> which causes the
718718 predicate to fail silently, and <code>dec10</code> which causes syntax
719 errors to be printed, after which <a id="idx:readterm23:1060"></a><span class="pred-ext">read_term/[2,3]</span>
720 continues reading the next term. Using <code>dec10</code>, <a id="idx:readterm23:1061"></a><span class="pred-ext">read_term/[2,3]</span>
719 errors to be printed, after which <a id="idx:readterm23:1061"></a><span class="pred-ext">read_term/[2,3]</span>
720 continues reading the next term. Using <code>dec10</code>, <a id="idx:readterm23:1062"></a><span class="pred-ext">read_term/[2,3]</span>
721721 never fails. (Quintus, SICStus).</dd>
722722 <dt><strong>subterm_positions</strong>(<var>TermPos</var>)</dt>
723723 <dd class="defbody">
771771 <dt><strong>term_position</strong>(<var>Pos</var>)</dt>
772772 <dd class="defbody">
773773 Unifies <var>Pos</var> with the starting position of the term read. <var>Pos</var>
774 is of the same format as used by <a id="idx:streamproperty2:1062"></a><a class="pred" href="IO.html#stream_property/2">stream_property/2</a>.</dd>
774 is of the same format as used by <a id="idx:streamproperty2:1063"></a><a class="pred" href="IO.html#stream_property/2">stream_property/2</a>.</dd>
775775 <dt><strong>variables</strong>(<var>Vars</var>)</dt>
776776 <dd class="defbody">
777777 Unify <var>Vars</var> with a list of variables in the term. The
778 variables appear in the order they have been read. See also <a id="idx:termvariables2:1063"></a><a class="pred" href="manipterm.html#term_variables/2">term_variables/2</a>.
778 variables appear in the order they have been read. See also <a id="idx:termvariables2:1064"></a><a class="pred" href="manipterm.html#term_variables/2">term_variables/2</a>.
779779 (ISO).</dd>
780780 <dt><strong>variable_names</strong>(<var>Vars</var>)</dt>
781781 <dd class="defbody">
791791 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="read_term/3"><strong>read_term</strong>(<var>+Stream,
792792 -Term, +Options</var>)</a></dt>
793793 <dd class="defbody">
794 Read term with options from <var>Stream</var>. See <a id="idx:readterm2:1064"></a><a class="pred" href="termrw.html#read_term/2">read_term/2</a>.</dd>
794 Read term with options from <var>Stream</var>. See <a id="idx:readterm2:1065"></a><a class="pred" href="termrw.html#read_term/2">read_term/2</a>.</dd>
795795 <dt class="pubdef"><a id="read_term_from_atom/3"><strong>read_term_from_atom</strong>(<var>+Atom,
796796 -Term, +Options</var>)</a></dt>
797797 <dd class="defbody">
798 Use <a id="idx:readterm3:1065"></a><a class="pred" href="termrw.html#read_term/3">read_term/3</a>
798 Use <a id="idx:readterm3:1066"></a><a class="pred" href="termrw.html#read_term/3">read_term/3</a>
799799 to read the next term from <var>Atom</var>. <var>Atom</var> is either an
800800 atom or a string object (see <a class="sec" href="strings.html">section
801801 5.2</a>). It is not required for <var>Atom</var> to end with a
802 full-stop. This predicate supersedes <a id="idx:atomtoterm3:1066"></a><a class="pred" href="manipatom.html#atom_to_term/3">atom_to_term/3</a>.</dd>
802 full-stop. This predicate supersedes <a id="idx:atomtoterm3:1067"></a><a class="pred" href="manipatom.html#atom_to_term/3">atom_to_term/3</a>.</dd>
803803 <dt class="pubdef"><a id="read_history/6"><strong>read_history</strong>(<var>+Show,
804804 +Help, +Special, +Prompt, -Term, -Bindings</var>)</a></dt>
805805 <dd class="defbody">
806 Similar to <a id="idx:readterm2:1067"></a><a class="pred" href="termrw.html#read_term/2">read_term/2</a>
806 Similar to <a id="idx:readterm2:1068"></a><a class="pred" href="termrw.html#read_term/2">read_term/2</a>
807807 using the option <code>variable_names</code>, but allows for history
808 substitutions. <a id="idx:readhistory6:1068"></a><a class="pred" href="termrw.html#read_history/6">read_history/6</a>
808 substitutions. <a id="idx:readhistory6:1069"></a><a class="pred" href="termrw.html#read_history/6">read_history/6</a>
809809 is used by the top level to read the user's actions. <var>Show</var> is
810810 the command the user should type to show the saved events. <var>Help</var>
811811 is the command to get an overview of the capabilities. <var>Special</var>
812812 is a list of commands that are not saved in the history. <var>Prompt</var>
813813 is the first prompt given. Continuation prompts for more lines are
814 determined by <a id="idx:prompt2:1069"></a><a class="pred" href="termrw.html#prompt/2">prompt/2</a>.
814 determined by <a id="idx:prompt2:1070"></a><a class="pred" href="termrw.html#prompt/2">prompt/2</a>.
815815 A
816816 <code>%w</code> in the prompt is substituted by the event number. See
817817 <a class="sec" href="history.html">section 2.7</a> for available
818818 substitutions.
819819
820 <p>SWI-Prolog calls <a id="idx:readhistory6:1070"></a><a class="pred" href="termrw.html#read_history/6">read_history/6</a>
820 <p>SWI-Prolog calls <a id="idx:readhistory6:1071"></a><a class="pred" href="termrw.html#read_history/6">read_history/6</a>
821821 as follows:
822822
823823 <pre class="code">
828828 <dt class="pubdef"><a id="prompt/2"><strong>prompt</strong>(<var>-Old,
829829 +New</var>)</a></dt>
830830 <dd class="defbody">
831 Set prompt associated with <a id="idx:read1:1071"></a><a class="pred" href="termrw.html#read/1">read/1</a>
831 Set prompt associated with <a id="idx:read1:1072"></a><a class="pred" href="termrw.html#read/1">read/1</a>
832832 and its derivatives. <var>Old</var> is first unified with the current
833833 prompt. On success the prompt will be set to <var>New</var> if this is
834834 an atom. Otherwise an error message is displayed. A prompt is printed if
839839 <dt class="pubdef"><a id="prompt1/1"><strong>prompt1</strong>(<var>+Prompt</var>)</a></dt>
840840 <dd class="defbody">
841841 Sets the prompt for the next line to be read. Continuation lines will be
842 read using the prompt defined by <a id="idx:prompt2:1072"></a><a class="pred" href="termrw.html#prompt/2">prompt/2</a>.
842 read using the prompt defined by <a id="idx:prompt2:1073"></a><a class="pred" href="termrw.html#prompt/2">prompt/2</a>.
843843 </dd>
844844 </dl>
845845
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 9.2</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 9.2</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
240240 <p>Normal multithreaded applications should not need the predicates from
241241 this section because almost any usage of these predicates is unsafe. For
242242 example checking the existence of a thread before signalling it is of no
243 use as it may vanish between the two calls. Catching exceptions using <a id="idx:catch3:1729"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
243 use as it may vanish between the two calls. Catching exceptions using <a id="idx:catch3:1732"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
244244 is the only safe way to deal with thread-existence errors.
245245
246246 <p>These predicates are provided for diagnosis and monitoring tasks. See
253253 <dd class="defbody">
254254 True if thread <var>Id</var> has <var>Property</var>. Either or both
255255 arguments may be unbound, enumerating all relations on backtracking.
256 Calling <a id="idx:threadproperty2:1730"></a><a class="pred" href="thmonitor.html#thread_property/2">thread_property/2</a>
256 Calling <a id="idx:threadproperty2:1733"></a><a class="pred" href="thmonitor.html#thread_property/2">thread_property/2</a>
257257 does not influence any thread. See also
258 <a id="idx:threadjoin2:1731"></a><a class="pred" href="threadcreate.html#thread_join/2">thread_join/2</a>.
258 <a id="idx:threadjoin2:1734"></a><a class="pred" href="threadcreate.html#thread_join/2">thread_join/2</a>.
259259 For threads that have an alias name, this name is returned in <var>Id</var>
260260 instead of the opaque thread identifier. Defined properties are:
261261
285285 The <var>Goal</var> of the thread has been completed and succeeded.</dd>
286286 <dt><strong>exited</strong>(<var>Term</var>)</dt>
287287 <dd class="defbody">
288 The <var>Goal</var> of the thread has been terminated using <a id="idx:threadexit1:1732"></a><a class="pred" href="threadcreate.html#thread_exit/1">thread_exit/1</a>
288 The <var>Goal</var> of the thread has been terminated using <a id="idx:threadexit1:1735"></a><a class="pred" href="threadcreate.html#thread_exit/1">thread_exit/1</a>
289289 with <var>Term</var> as argument. If the underlying native thread has
290290 exited (using pthread_exit()) <var>Term</var> is unbound.</dd>
291291 <dt><strong>exception</strong>(<var>Term</var>)</dt>
292292 <dd class="defbody">
293293 The <var>Goal</var> of the thread has been terminated due to an uncaught
294 exception (see <a id="idx:throw1:1733"></a><a class="pred" href="exception.html#throw/1">throw/1</a>
295 and <a id="idx:catch3:1734"></a><a class="pred" href="exception.html#catch/3">catch/3</a>).
294 exception (see <a id="idx:throw1:1736"></a><a class="pred" href="exception.html#throw/1">throw/1</a>
295 and <a id="idx:catch3:1737"></a><a class="pred" href="exception.html#catch/3">catch/3</a>).
296296 </dd>
297297 </dl>
298298
299299 </dd>
300300 </dl>
301301
302 <p>See also <a id="idx:threadstatistics3:1735"></a><a class="pred" href="thmonitor.html#thread_statistics/3">thread_statistics/3</a>
302 <p>See also <a id="idx:threadstatistics3:1738"></a><a class="pred" href="thmonitor.html#thread_statistics/3">thread_statistics/3</a>
303303 to obtain resource usage information and
304 <a id="idx:messagequeueproperty2:1736"></a><a class="pred" href="threadcom.html#message_queue_property/2">message_queue_property/2</a>
304 <a id="idx:messagequeueproperty2:1739"></a><a class="pred" href="threadcom.html#message_queue_property/2">message_queue_property/2</a>
305305 to get the number of queued messages for a thread.</dd>
306306 <dt class="pubdef"><a id="thread_statistics/3"><strong>thread_statistics</strong>(<var>+Id,
307307 +Key, -Value</var>)</a></dt>
308308 <dd class="defbody">
309 Obtains statistical information on thread <var>Id</var> as <a id="idx:statistics2:1737"></a><a class="pred" href="statistics.html#statistics/2">statistics/2</a>
310 does in single-threaded applications. This call supports all keys of <a id="idx:statistics2:1738"></a><a class="pred" href="statistics.html#statistics/2">statistics/2</a>,
309 Obtains statistical information on thread <var>Id</var> as <a id="idx:statistics2:1740"></a><a class="pred" href="statistics.html#statistics/2">statistics/2</a>
310 does in single-threaded applications. This call supports all keys of <a id="idx:statistics2:1741"></a><a class="pred" href="statistics.html#statistics/2">statistics/2</a>,
311311 although only stack sizes, <code>cputime</code>,
312312 <code>inferences</code> and <code>epoch</code> yield different values
313 for each thread.<sup class="fn">141<span class="fn-text">There is no
313 for each thread.<sup class="fn">144<span class="fn-text">There is no
314314 portable interface to obtain thread-specific CPU time and some operating
315315 systems provide no access to this information at all. On such systems
316316 the total process CPU is returned. Thread CPU time is supported on
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 9.3</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 9.3</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
249249 threads to wait for data or conditions without using the CPU.
250250
251251 <p>Each thread has a message queue attached to it that is identified by
252 the thread. Additional queues are created using <a id="idx:messagequeuecreate1:1739"></a><a class="pred" href="threadcom.html#message_queue_create/1">message_queue_create/1</a>.
252 the thread. Additional queues are created using <a id="idx:messagequeuecreate1:1742"></a><a class="pred" href="threadcom.html#message_queue_create/1">message_queue_create/1</a>.
253253 Explicitly created queues come in two flavours. When given an
254254 <em>alias</em>, they must be destroyed by the user. <em>Anonymous</em>
255255 message queues are identified by a <em>blob</em> (see <a class="sec" href="foreigninclude.html">section
261261 <dd class="defbody">
262262 Place <var>Term</var> in the given queue or default queue of the
263263 indicated thread (which can even be the message queue of itself, see
264 <a id="idx:threadself1:1740"></a><a class="pred" href="threadcreate.html#thread_self/1">thread_self/1</a>).
264 <a id="idx:threadself1:1743"></a><a class="pred" href="threadcreate.html#thread_self/1">thread_self/1</a>).
265265 Any term can be placed in a message queue, but note that the term is
266266 copied to the receiving thread and variable bindings are thus lost. This
267267 call returns immediately.
274274 the same queue as all-but-the-winner perform a useless scan of the
275275 queue. If there is only one waiting thread or all waiting threads wait
276276 with an unbound variable, an arbitrary thread is restarted to scan the
277 queue.<sup class="fn">142<span class="fn-text">See the documentation for
277 queue.<sup class="fn">145<span class="fn-text">See the documentation for
278278 the POSIX thread functions pthread_cond_signal() v.s. pthread_cond_broadcast()
279279 for background information.</span></sup></dd>
280280 <dt class="pubdef"><span class="pred-tag">[semidet]</span><a id="thread_send_message/3"><strong>thread_send_message</strong>(<var>+Queue,
281281 +Term, +Options</var>)</a></dt>
282282 <dd class="defbody">
283 As <a id="idx:threadsendmessage2:1741"></a><a class="pred" href="threadcom.html#thread_send_message/2">thread_send_message/2</a>,
283 As <a id="idx:threadsendmessage2:1744"></a><a class="pred" href="threadcom.html#thread_send_message/2">thread_send_message/2</a>,
284284 but providing additional <var>Options</var>. These are to deal with the
285 case that the queue has a finite maximum size and is full: whereas <a id="idx:threadsendmessage2:1742"></a><a class="pred" href="threadcom.html#thread_send_message/2">thread_send_message/2</a>
285 case that the queue has a finite maximum size and is full: whereas <a id="idx:threadsendmessage2:1745"></a><a class="pred" href="threadcom.html#thread_send_message/2">thread_send_message/2</a>
286286 will block until the queue has drained sufficiently to accept a new
287 message, <a id="idx:threadsendmessage3:1743"></a><a class="pred" href="threadcom.html#thread_send_message/3">thread_send_message/3</a>
288 can accept a time-out or deadline analogously to <a id="idx:threadgetmessage3:1744"></a><a class="pred" href="threadcom.html#thread_get_message/3">thread_get_message/3</a>.
287 message, <a id="idx:threadsendmessage3:1746"></a><a class="pred" href="threadcom.html#thread_send_message/3">thread_send_message/3</a>
288 can accept a time-out or deadline analogously to <a id="idx:threadgetmessage3:1747"></a><a class="pred" href="threadcom.html#thread_get_message/3">thread_get_message/3</a>.
289289 The options are:
290290
291291 <dl class="latex">
292292 <dt><strong>deadline</strong>(<var>+AbsTime</var>)</dt>
293293 <dd class="defbody">
294294 The call fails (silently) if no space has become available before
295 <var>AbsTime</var>. See <a id="idx:gettime1:1745"></a><a class="pred" href="system.html#get_time/1">get_time/1</a>
295 <var>AbsTime</var>. See <a id="idx:gettime1:1748"></a><a class="pred" href="system.html#get_time/1">get_time/1</a>
296296 for the representation of absolute time. If <var>AbsTime</var> is
297 earlier then the current time, <a id="idx:threadsendmessage3:1746"></a><a class="pred" href="threadcom.html#thread_send_message/3">thread_send_message/3</a>
297 earlier then the current time, <a id="idx:threadsendmessage3:1749"></a><a class="pred" href="threadcom.html#thread_send_message/3">thread_send_message/3</a>
298298 fails immediately. Both resolution and maximum wait time is
299 platform-dependent.<sup class="fn">143<span class="fn-text">The
299 platform-dependent.<sup class="fn">146<span class="fn-text">The
300300 implementation uses MsgWaitForMultipleObjects() on MS-Windows and
301301 pthread_cond_timedwait() on other systems.</span></sup></dd>
302302 <dt><strong>timeout</strong>(<var>+Time</var>)</dt>
305305 wait in seconds. This is a relative-time version of the <code>deadline</code>
306306 option. If both options are provided, the earlier time is effective.
307307
308 <p>If <var>Time</var> is 0 or 0.0, <a id="idx:threadsendmessage3:1747"></a><a class="pred" href="threadcom.html#thread_send_message/3">thread_send_message/3</a>
308 <p>If <var>Time</var> is 0 or 0.0, <a id="idx:threadsendmessage3:1750"></a><a class="pred" href="threadcom.html#thread_send_message/3">thread_send_message/3</a>
309309 examines the queue and sends the message if space is availabel, but does
310310 not suspend if no space is available, failing immediately instead.
311311
312 <p>If <var>Time</var> <var>&lt; 0</var>, <a id="idx:threadsendmessage3:1748"></a><a class="pred" href="threadcom.html#thread_send_message/3">thread_send_message/3</a>
312 <p>If <var>Time</var> <var>&lt; 0</var>, <a id="idx:threadsendmessage3:1751"></a><a class="pred" href="threadcom.html#thread_send_message/3">thread_send_message/3</a>
313313 fails immediately without sending the message.
314314 </dd>
315315 </dl>
335335 thread_send_message(Thread_1, a(gnat)),
336336 </pre>
337337
338 <p>See also <a id="idx:threadpeekmessage1:1749"></a><a class="pred" href="threadcom.html#thread_peek_message/1">thread_peek_message/1</a>.</dd>
338 <p>See also <a id="idx:threadpeekmessage1:1752"></a><a class="pred" href="threadcom.html#thread_peek_message/1">thread_peek_message/1</a>.</dd>
339339 <dt class="pubdef"><a id="thread_peek_message/1"><strong>thread_peek_message</strong>(<var>?Term</var>)</a></dt>
340340 <dd class="defbody">
341341 Examines the thread message queue and compares the queued terms with <var>Term</var>
343343 case the call succeeds, possibly instantiating
344344 <var>Term</var>. If no term from the queue unifies, this call fails.
345345 I.e.,
346 <a id="idx:threadpeekmessage1:1750"></a><a class="pred" href="threadcom.html#thread_peek_message/1">thread_peek_message/1</a>
347 never waits and does not remove any term from the queue. See also <a id="idx:threadgetmessage3:1751"></a><a class="pred" href="threadcom.html#thread_get_message/3">thread_get_message/3</a>.</dd>
346 <a id="idx:threadpeekmessage1:1753"></a><a class="pred" href="threadcom.html#thread_peek_message/1">thread_peek_message/1</a>
347 never waits and does not remove any term from the queue. See also <a id="idx:threadgetmessage3:1754"></a><a class="pred" href="threadcom.html#thread_get_message/3">thread_get_message/3</a>.</dd>
348348 <dt class="pubdef"><a id="message_queue_create/1"><strong>message_queue_create</strong>(<var>?Queue</var>)</a></dt>
349349 <dd class="defbody">
350350 Equivalent to <code>message_queue_create(Queue,[])</code>. For
352352 equivalent to
353353 <code>message_queue_create(Queue, [alias(Atom)])</code>. New code should
354354 use
355 <a id="idx:messagequeuecreate2:1752"></a><a class="pred" href="threadcom.html#message_queue_create/2">message_queue_create/2</a>
355 <a id="idx:messagequeuecreate2:1755"></a><a class="pred" href="threadcom.html#message_queue_create/2">message_queue_create/2</a>
356356 to create a named queue.</dd>
357357 <dt class="pubdef"><a id="message_queue_create/2"><strong>message_queue_create</strong>(<var>-Queue,
358358 +Options</var>)</a></dt>
366366 Message queues created this way must be explicitly destroyed by the
367367 user. If the alias option is omitted, an <em>Anonymous</em> queue is
368368 created that is indentified by a <em>blob</em> (see <a class="sec" href="foreigninclude.html">section
369 10.4.7</a>) and subject to garbage collection.<sup class="fn">144<span class="fn-text">Garbage
369 10.4.7</a>) and subject to garbage collection.<sup class="fn">147<span class="fn-text">Garbage
370370 collecting anonymous message queues is not part of the ISO proposal and
371371 most likely not a widely implemented feature.</span></sup></dd>
372372 <dt><strong>max_size</strong>(<var>+Size</var>)</dt>
373373 <dd class="defbody">
374374 Maximum number of terms in the queue. If this number is reached,
375 <a id="idx:threadsendmessage2:1753"></a><a class="pred" href="threadcom.html#thread_send_message/2">thread_send_message/2</a>
375 <a id="idx:threadsendmessage2:1756"></a><a class="pred" href="threadcom.html#thread_send_message/2">thread_send_message/2</a>
376376 will suspend until the queue is drained. The option can be used if the
377377 source, sending messages to the queue, is faster than the drain,
378378 consuming the messages.
382382 </dd>
383383 <dt class="pubdef"><span class="pred-tag">[det]</span><a id="message_queue_destroy/1"><strong>message_queue_destroy</strong>(<var>+Queue</var>)</a></dt>
384384 <dd class="defbody">
385 Destroy a message queue created with <a id="idx:messagequeuecreate1:1754"></a><a class="pred" href="threadcom.html#message_queue_create/1">message_queue_create/1</a>.
385 Destroy a message queue created with <a id="idx:messagequeuecreate1:1757"></a><a class="pred" href="threadcom.html#message_queue_create/1">message_queue_create/1</a>.
386386 A permission error is raised if <var>Queue</var> refers to (the default
387387 queue of) a thread. Other threads that are waiting for <var>Queue</var>
388388 using
389 <a id="idx:threadgetmessage2:1755"></a><a class="pred" href="threadcom.html#thread_get_message/2">thread_get_message/2</a>
389 <a id="idx:threadgetmessage2:1758"></a><a class="pred" href="threadcom.html#thread_get_message/2">thread_get_message/2</a>
390390 receive an existence error.</dd>
391391 <dt class="pubdef"><span class="pred-tag">[det]</span><a id="thread_get_message/2"><strong>thread_get_message</strong>(<var>+Queue,
392392 ?Term</var>)</a></dt>
393393 <dd class="defbody">
394 As <a id="idx:threadgetmessage1:1756"></a><a class="pred" href="threadcom.html#thread_get_message/1">thread_get_message/1</a>,
394 As <a id="idx:threadgetmessage1:1759"></a><a class="pred" href="threadcom.html#thread_get_message/1">thread_get_message/1</a>,
395395 operating on a given queue. It is allowed (but not advised) to get
396396 messages from the queue of other threads. This predicate raises an
397397 existence error exception if <var>Queue</var> doesn't exist or is
398 destroyed using <a id="idx:messagequeuedestroy1:1757"></a><a class="pred" href="threadcom.html#message_queue_destroy/1">message_queue_destroy/1</a>
398 destroyed using <a id="idx:messagequeuedestroy1:1760"></a><a class="pred" href="threadcom.html#message_queue_destroy/1">message_queue_destroy/1</a>
399399 while this predicate is waiting.</dd>
400400 <dt class="pubdef"><span class="pred-tag">[semidet]</span><a id="thread_get_message/3"><strong>thread_get_message</strong>(<var>+Queue,
401401 ?Term, +Options</var>)</a></dt>
402402 <dd class="defbody">
403 As <a id="idx:threadgetmessage2:1758"></a><a class="pred" href="threadcom.html#thread_get_message/2">thread_get_message/2</a>,
403 As <a id="idx:threadgetmessage2:1761"></a><a class="pred" href="threadcom.html#thread_get_message/2">thread_get_message/2</a>,
404404 but providing additional <var>Options</var>:
405405
406406 <dl class="latex">
407407 <dt><strong>deadline</strong>(<var>+AbsTime</var>)</dt>
408408 <dd class="defbody">
409409 The call fails (silently) if no message has arrived before
410 <var>AbsTime</var>. See <a id="idx:gettime1:1759"></a><a class="pred" href="system.html#get_time/1">get_time/1</a>
410 <var>AbsTime</var>. See <a id="idx:gettime1:1762"></a><a class="pred" href="system.html#get_time/1">get_time/1</a>
411411 for the representation of absolute time. If <var>AbsTime</var> is
412 earlier then the current time, <a id="idx:threadgetmessage3:1760"></a><a class="pred" href="threadcom.html#thread_get_message/3">thread_get_message/3</a>
412 earlier then the current time, <a id="idx:threadgetmessage3:1763"></a><a class="pred" href="threadcom.html#thread_get_message/3">thread_get_message/3</a>
413413 fails immediately. Both resolution and maximum wait time is
414 platform-dependent.<sup class="fn">145<span class="fn-text">The
414 platform-dependent.<sup class="fn">148<span class="fn-text">The
415415 implementation uses MsgWaitForMultipleObjects() on MS-Windows and
416416 pthread_cond_timedwait() on other systems.</span></sup></dd>
417417 <dt><strong>timeout</strong>(<var>+Time</var>)</dt>
420420 wait in seconds. This is a relative-time version of the <code>deadline</code>
421421 option. If both options are provided, the earlier time is effective.
422422
423 <p>If <var>Time</var> is 0 or 0.0, <a id="idx:threadgetmessage3:1761"></a><a class="pred" href="threadcom.html#thread_get_message/3">thread_get_message/3</a>
423 <p>If <var>Time</var> is 0 or 0.0, <a id="idx:threadgetmessage3:1764"></a><a class="pred" href="threadcom.html#thread_get_message/3">thread_get_message/3</a>
424424 examines the queue but does not suspend if no matching term is
425425 available. Note that unlike
426 <a id="idx:threadpeekmessage2:1762"></a><a class="pred" href="threadcom.html#thread_peek_message/2">thread_peek_message/2</a>,
426 <a id="idx:threadpeekmessage2:1765"></a><a class="pred" href="threadcom.html#thread_peek_message/2">thread_peek_message/2</a>,
427427 a matching term is removed from the queue.
428428
429 <p>If <var>Time</var> <var>&lt; 0</var>, <a id="idx:threadgetmessage3:1763"></a><a class="pred" href="threadcom.html#thread_get_message/3">thread_get_message/3</a>
429 <p>If <var>Time</var> <var>&lt; 0</var>, <a id="idx:threadgetmessage3:1766"></a><a class="pred" href="threadcom.html#thread_get_message/3">thread_get_message/3</a>
430430 fails immediately without removing any message from the queue.
431431 </dd>
432432 </dl>
435435 <dt class="pubdef"><span class="pred-tag">[semidet]</span><a id="thread_peek_message/2"><strong>thread_peek_message</strong>(<var>+Queue,
436436 ?Term</var>)</a></dt>
437437 <dd class="defbody">
438 As <a id="idx:threadpeekmessage1:1764"></a><a class="pred" href="threadcom.html#thread_peek_message/1">thread_peek_message/1</a>,
438 As <a id="idx:threadpeekmessage1:1767"></a><a class="pred" href="threadcom.html#thread_peek_message/1">thread_peek_message/1</a>,
439439 operating on a given queue. It is allowed to peek into another thread's
440440 message queue, an operation that can be used to check whether a thread
441441 has swallowed a message sent to it.</dd>
453453 <dt><strong>max_size</strong>(<var>Size</var>)</dt>
454454 <dd class="defbody">
455455 Maximum number of terms that can be in the queue. See
456 <a id="idx:messagequeuecreate2:1765"></a><a class="pred" href="threadcom.html#message_queue_create/2">message_queue_create/2</a>.
456 <a id="idx:messagequeuecreate2:1768"></a><a class="pred" href="threadcom.html#message_queue_create/2">message_queue_create/2</a>.
457457 This property is not present if there is no limit (default).
458458 </dd>
459459 <dt><strong>size</strong>(<var>Size</var>)</dt>
518518 some goal as an <em>interrupt</em>. Signalling threads is safe as these
519519 interrupts are only checked at safe points in the virtual machine.
520520 Nevertheless, signalling in multithreaded environments should be handled
521 with care as the receiving thread may hold a <em>mutex</em> (see <a id="idx:withmutex2:1766"></a><a class="pred" href="threadsync.html#with_mutex/2">with_mutex/2</a>).
521 with care as the receiving thread may hold a <em>mutex</em> (see <a id="idx:withmutex2:1769"></a><a class="pred" href="threadsync.html#with_mutex/2">with_mutex/2</a>).
522522 Signalling probably only makes sense to start debugging threads and to
523 cancel no-longer-needed threads with <a id="idx:throw1:1767"></a><a class="pred" href="exception.html#throw/1">throw/1</a>,
523 cancel no-longer-needed threads with <a id="idx:throw1:1770"></a><a class="pred" href="exception.html#throw/1">throw/1</a>,
524524 where the receiving thread should be designed carefully to handle
525525 exceptions at any point.
526526
530530 <dd class="defbody">
531531 Make thread <var>ThreadId</var> execute <var>Goal</var> at the first
532532 opportunity. In the current implementation, this implies at the first
533 pass through the <em>Call port</em>. The predicate <a id="idx:threadsignal2:1768"></a><a class="pred" href="threadcom.html#thread_signal/2">thread_signal/2</a>
533 pass through the <em>Call port</em>. The predicate <a id="idx:threadsignal2:1771"></a><a class="pred" href="threadcom.html#thread_signal/2">thread_signal/2</a>
534534 itself places <var>Goal</var> into the signalled thread's signal queue
535535 and returns immediately.
536536
539539 guaranteed easily. At the call port, the Prolog virtual machine holds no
540540 locks and therefore the asynchronous execution is safe.
541541
542 <p><var>Goal</var> can be any valid Prolog goal, including <a id="idx:throw1:1769"></a><a class="pred" href="exception.html#throw/1">throw/1</a>
543 to make the receiving thread generate an exception, and <a id="idx:trace0:1770"></a><a class="pred" href="debugger.html#trace/0">trace/0</a>
542 <p><var>Goal</var> can be any valid Prolog goal, including <a id="idx:throw1:1772"></a><a class="pred" href="exception.html#throw/1">throw/1</a>
543 to make the receiving thread generate an exception, and <a id="idx:trace0:1773"></a><a class="pred" href="debugger.html#trace/0">trace/0</a>
544544 to start tracing the receiving thread.
545545
546546 <p>In the Windows version, the receiving thread immediately executes the
558558 threads can share and exchange data using dynamic predicates. The
559559 multithreaded version knows about two types of dynamic predicates. By
560560 default, a predicate declared
561 <em>dynamic</em> (see <a id="idx:dynamic1:1771"></a><a class="pred" href="dynamic.html#dynamic/1">dynamic/1</a>)
561 <em>dynamic</em> (see <a id="idx:dynamic1:1774"></a><a class="pred" href="dynamic.html#dynamic/1">dynamic/1</a>)
562562 is shared by all threads. Each thread may assert, retract and run the
563563 dynamic predicate. Synchronisation inside Prolog guarantees the
564564 consistency of the predicate. Updates are
569569
570570 <p>Besides shared predicates, dynamic predicates can be declared with
571571 the
572 <a id="idx:threadlocal1:1772"></a><a class="pred" href="threadcom.html#thread_local/1">thread_local/1</a>
572 <a id="idx:threadlocal1:1775"></a><a class="pred" href="threadcom.html#thread_local/1">thread_local/1</a>
573573 directive. Such predicates share their attributes, but the clause list
574574 is different in each thread.
575575
577577 <dt class="pubdef"><a id="thread_local/1"><strong>thread_local</strong> <var>+Functor/+Arity,
578578 ...</var></a></dt>
579579 <dd class="defbody">
580 This directive is related to the <a id="idx:dynamic1:1773"></a><a class="pred" href="dynamic.html#dynamic/1">dynamic/1</a>
581 directive. It tells the system that the predicate may be modified using <a id="idx:assert1:1774"></a><a class="pred" href="db.html#assert/1">assert/1</a>, <a id="idx:retract1:1775"></a><a class="pred" href="db.html#retract/1">retract/1</a>,
580 This directive is related to the <a id="idx:dynamic1:1776"></a><a class="pred" href="dynamic.html#dynamic/1">dynamic/1</a>
581 directive. It tells the system that the predicate may be modified using <a id="idx:assert1:1777"></a><a class="pred" href="db.html#assert/1">assert/1</a>, <a id="idx:retract1:1778"></a><a class="pred" href="db.html#retract/1">retract/1</a>,
582582 etc., during execution of the program. Unlike normal shared dynamic
583583 data, however, each thread has its own clause list for the predicate. As
584584 a thread starts, this clause list is empty. If there are still clauses
585585 when the thread terminates, these are automatically reclaimed by the
586 system (see also <a id="idx:volatile1:1776"></a><a class="pred" href="runtime.html#volatile/1">volatile/1</a>).
586 system (see also <a id="idx:volatile1:1779"></a><a class="pred" href="runtime.html#volatile/1">volatile/1</a>).
587587 The thread_local property implies the properties <em>dynamic</em> and <em>volatile</em>.
588588
589589 <p>Thread-local dynamic predicates are intended for maintaining
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 9.1</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 9.1</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
254254 <dt><strong>alias</strong>(<var>AliasName</var>)</dt>
255255 <dd class="defbody">
256256 Associate an `alias name' with the thread. This name may be used to
257 refer to the thread and remains valid until the thread is joined (see <a id="idx:threadjoin2:1689"></a><a class="pred" href="threadcreate.html#thread_join/2">thread_join/2</a>).</dd>
257 refer to the thread and remains valid until the thread is joined (see <a id="idx:threadjoin2:1692"></a><a class="pred" href="threadcreate.html#thread_join/2">thread_join/2</a>).</dd>
258258 <dt><strong>at_exit</strong>(<var>:AtExit</var>)</dt>
259259 <dd class="defbody">
260 Register <var>AtExit</var> as using <a id="idx:threadatexit1:1690"></a><a class="pred" href="threadcreate.html#thread_at_exit/1">thread_at_exit/1</a>
261 before entering the thread goal. Unlike calling <a id="idx:threadatexit1:1691"></a><a class="pred" href="threadcreate.html#thread_at_exit/1">thread_at_exit/1</a>
260 Register <var>AtExit</var> as using <a id="idx:threadatexit1:1693"></a><a class="pred" href="threadcreate.html#thread_at_exit/1">thread_at_exit/1</a>
261 before entering the thread goal. Unlike calling <a id="idx:threadatexit1:1694"></a><a class="pred" href="threadcreate.html#thread_at_exit/1">thread_at_exit/1</a>
262262 as part of the normal
263263 <var>Goal</var>, this <em>ensures</em> the <var>AtExit</var> is called.
264264 Using
265 <a id="idx:threadatexit1:1692"></a><a class="pred" href="threadcreate.html#thread_at_exit/1">thread_at_exit/1</a>,
266 the thread may be signalled or run out of resources before <a id="idx:threadatexit1:1693"></a><a class="pred" href="threadcreate.html#thread_at_exit/1">thread_at_exit/1</a>
265 <a id="idx:threadatexit1:1695"></a><a class="pred" href="threadcreate.html#thread_at_exit/1">thread_at_exit/1</a>,
266 the thread may be signalled or run out of resources before <a id="idx:threadatexit1:1696"></a><a class="pred" href="threadcreate.html#thread_at_exit/1">thread_at_exit/1</a>
267267 is reached.</dd>
268268 <dt><strong>debug</strong>(<var>+Bool</var>)</dt>
269269 <dd class="defbody">
270270 Enable/disable debugging the new thread. If <code>false</code> (default
271271 <code>true</code>), the new thread is created with the property
272272 <code>debug(false)</code> and debugging is disabled before the new
273 thread is started. The thread debugging predicates such as <a id="idx:tspy1:1694"></a><a class="pred" href="thutil.html#tspy/1">tspy/1</a>
274 and <a id="idx:tdebug0:1695"></a><a class="pred" href="thutil.html#tdebug/0">tdebug/0</a>
273 thread is started. The thread debugging predicates such as <a id="idx:tspy1:1697"></a><a class="pred" href="thutil.html#tspy/1">tspy/1</a>
274 and <a id="idx:tdebug0:1698"></a><a class="pred" href="thutil.html#tdebug/0">tdebug/0</a>
275275 do not signal threads with the debug property set to
276 <code>false</code>.<sup class="fn">139<span class="fn-text">Currently,
276 <code>false</code>.<sup class="fn">142<span class="fn-text">Currently,
277277 the flag is only used as a hint for the the various debugging
278278 primitives, i.e., the system does not really enforce that the target
279279 thread stays in <em>nodebug</em> mode.</span></sup></dd>
280280 <dt><strong>detached</strong>(<var>Bool</var>)</dt>
281281 <dd class="defbody">
282282 If <code>false</code> (default), the thread can be waited for using
283 <a id="idx:threadjoin2:1696"></a><a class="pred" href="threadcreate.html#thread_join/2">thread_join/2</a>. <a id="idx:threadjoin2:1697"></a><a class="pred" href="threadcreate.html#thread_join/2">thread_join/2</a>
283 <a id="idx:threadjoin2:1699"></a><a class="pred" href="threadcreate.html#thread_join/2">thread_join/2</a>. <a id="idx:threadjoin2:1700"></a><a class="pred" href="threadcreate.html#thread_join/2">thread_join/2</a>
284284 must be called on this thread to reclaim all resources associated with
285285 the thread. If <code>true</code>, the system will reclaim all associated
286286 resources automatically after the thread finishes. Please note that
287287 thread identifiers are freed for reuse after a detached thread finishes
288 or a normal thread has been joined. See also <a id="idx:threadjoin2:1698"></a><a class="pred" href="threadcreate.html#thread_join/2">thread_join/2</a>
289 and <a id="idx:threaddetach1:1699"></a><a class="pred" href="threadcreate.html#thread_detach/1">thread_detach/1</a>.
288 or a normal thread has been joined. See also <a id="idx:threadjoin2:1701"></a><a class="pred" href="threadcreate.html#thread_join/2">thread_join/2</a>
289 and <a id="idx:threaddetach1:1702"></a><a class="pred" href="threadcreate.html#thread_detach/1">thread_detach/1</a>.
290290
291291 <p>If a detached thread dies due to failure or exception of the initial
292 goal, the thread prints a message using <a id="idx:printmessage2:1700"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>.
292 goal, the thread prints a message using <a id="idx:printmessage2:1703"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>.
293293 If such termination is considered normal, the code must be wrapped using
294 <a id="idx:ignore1:1701"></a><a class="pred" href="metacall.html#ignore/1">ignore/1</a>
295 and/or <a id="idx:catch3:1702"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
294 <a id="idx:ignore1:1704"></a><a class="pred" href="metacall.html#ignore/1">ignore/1</a>
295 and/or <a id="idx:catch3:1705"></a><a class="pred" href="exception.html#catch/3">catch/3</a>
296296 to ensure successful completion.</dd>
297297 <dt><strong>inherit_from</strong>(<var>+ThreadId</var>)</dt>
298298 <dd class="defbody">
299299 Inherit defaults from the given <var>ThreadId</var> instead of the
300300 calling thread. This option was added to ensure that the
301 <code>__thread_pool_manager</code> (see <a id="idx:threadcreateinpool4:1703"></a><a class="pred" href="threadpool.html#thread_create_in_pool/4">thread_create_in_pool/4</a>),
301 <code>__thread_pool_manager</code> (see <a id="idx:threadcreateinpool4:1706"></a><a class="pred" href="threadpool.html#thread_create_in_pool/4">thread_create_in_pool/4</a>),
302302 which is created lazily, has a predictable state. The following
303303 properties are inherited:
304304
305305 <p>
306306 <ul class="latex">
307 <li>The prompt (see <a id="idx:prompt2:1704"></a><a class="pred" href="termrw.html#prompt/2">prompt/2</a>)
308 <li>The <em>typein</em> module (see <a id="idx:module1:1705"></a><a class="pred" href="mtoplevel.html#module/1">module/1</a>)
307 <li>The prompt (see <a id="idx:prompt2:1707"></a><a class="pred" href="termrw.html#prompt/2">prompt/2</a>)
308 <li>The <em>typein</em> module (see <a id="idx:module1:1708"></a><a class="pred" href="mtoplevel.html#module/1">module/1</a>)
309309 <li>The standard streams (<code>user_input</code>, etc.)
310310 <li>The default encoding (see <a class="flag" href="flags.html#flag:encoding">encoding</a>)
311 <li>The default locale (see <a id="idx:setlocale1:1706"></a><span class="pred-ext">setlocale/1</span>)
311 <li>The default locale (see <a id="idx:setlocale1:1709"></a><span class="pred-ext">setlocale/1</span>)
312312 <li>All prolog flags
313 <li>The limits of Prolog stacks (see <a id="idx:setprologstack2:1707"></a><a class="pred" href="memory.html#set_prolog_stack/2">set_prolog_stack/2</a>)
313 <li>The limits of Prolog stacks (see <a id="idx:setprologstack2:1710"></a><a class="pred" href="memory.html#set_prolog_stack/2">set_prolog_stack/2</a>)
314314 </ul>
315315 </dd>
316316 <dt><strong>global</strong>(<var>K-Bytes</var>)</dt>
326326 <dt><strong>c_stack</strong>(<var>K-Bytes</var>)</dt>
327327 <dd class="defbody">
328328 Set the limit to which the system stack of this thread may grow. The
329 default, minimum and maximum values are system-dependent.<sup class="fn">140<span class="fn-text">Older
329 default, minimum and maximum values are system-dependent.<sup class="fn">143<span class="fn-text">Older
330330 versions used <code>stack</code>. This is still accepted as a synonym.</span></sup></dd>
331331 <dt><strong>trail</strong>(<var>K-Bytes</var>)</dt>
332332 <dd class="defbody">
351351 Then unify the result status of the thread with <var>Status</var>. After
352352 this call, <var>Id</var> becomes invalid and all resources associated
353353 with the thread are reclaimed. Note that threads with the attribute
354 <code>detached(true)</code> cannot be joined. See also <a id="idx:threadproperty2:1708"></a><a class="pred" href="thmonitor.html#thread_property/2">thread_property/2</a>.
355
356 <p>A thread that has been completed without <a id="idx:threadjoin2:1709"></a><a class="pred" href="threadcreate.html#thread_join/2">thread_join/2</a>
354 <code>detached(true)</code> cannot be joined. See also <a id="idx:threadproperty2:1711"></a><a class="pred" href="thmonitor.html#thread_property/2">thread_property/2</a>.
355
356 <p>A thread that has been completed without <a id="idx:threadjoin2:1712"></a><a class="pred" href="threadcreate.html#thread_join/2">thread_join/2</a>
357357 being called on it is partly reclaimed: the Prolog stacks are released
358358 and the C thread is destroyed. A small data structure representing the
359 exit status of the thread is retained until <a id="idx:threadjoin2:1710"></a><a class="pred" href="threadcreate.html#thread_join/2">thread_join/2</a>
359 exit status of the thread is retained until <a id="idx:threadjoin2:1713"></a><a class="pred" href="threadcreate.html#thread_join/2">thread_join/2</a>
360360 is called on the thread. Defined values for <var>Status</var> are:
361361
362362 <dl class="latex">
368368 The goal has failed.</dd>
369369 <dt><strong>exception</strong>(<var>Term</var>)</dt>
370370 <dd class="defbody">
371 The thread is terminated on an exception. See <a id="idx:printmessage2:1711"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>
371 The thread is terminated on an exception. See <a id="idx:printmessage2:1714"></a><a class="pred" href="exception.html#print_message/2">print_message/2</a>
372372 to turn system exceptions into readable messages.</dd>
373373 <dt><strong>exited</strong>(<var>Term</var>)</dt>
374374 <dd class="defbody">
375 The thread is terminated on <a id="idx:threadexit1:1712"></a><a class="pred" href="threadcreate.html#thread_exit/1">thread_exit/1</a>
375 The thread is terminated on <a id="idx:threadexit1:1715"></a><a class="pred" href="threadcreate.html#thread_exit/1">thread_exit/1</a>
376376 using the argument <var>Term</var>.
377377 </dd>
378378 </dl>
382382 <dd class="defbody">
383383 Switch thread into detached state (see <code>detached(Bool)</code>
384384 option at
385 <a id="idx:threadcreate3:1713"></a><a class="pred" href="threadcreate.html#thread_create/3">thread_create/3</a>)
385 <a id="idx:threadcreate3:1716"></a><a class="pred" href="threadcreate.html#thread_create/3">thread_create/3</a>)
386386 at runtime. <var>Id</var> is the identifier of the thread placed in
387 detached state. This may be the result of <a id="idx:threadself1:1714"></a><a class="pred" href="threadcreate.html#thread_self/1">thread_self/1</a>.
387 detached state. This may be the result of <a id="idx:threadself1:1717"></a><a class="pred" href="threadcreate.html#thread_self/1">thread_self/1</a>.
388388
389389 <p>One of the possible applications is to simplify debugging. Threads
390390 that are created as <em>detached</em> leave no traces if they crash. For
391391 non-detached threads the status can be inspected using
392 <a id="idx:threadproperty2:1715"></a><a class="pred" href="thmonitor.html#thread_property/2">thread_property/2</a>.
392 <a id="idx:threadproperty2:1718"></a><a class="pred" href="thmonitor.html#thread_property/2">thread_property/2</a>.
393393 Threads nobody is waiting for may be created normally and detach
394394 themselves just before completion. This way they leave no traces on
395395 normal completion and their reason for failure can be inspected.</dd>
396396 <dt class="pubdef"><span class="pred-tag">[deprecated]</span><a id="thread_exit/1"><strong>thread_exit</strong>(<var>+Term</var>)</a></dt>
397397 <dd class="defbody">
398398 Terminates the thread immediately, leaving <code>exited(Term)</code> as
399 result state for <a id="idx:threadjoin2:1716"></a><a class="pred" href="threadcreate.html#thread_join/2">thread_join/2</a>.
399 result state for <a id="idx:threadjoin2:1719"></a><a class="pred" href="threadcreate.html#thread_join/2">thread_join/2</a>.
400400 If the thread has the attribute
401401 <code>detached(true)</code> it terminates, but its exit status cannot be
402 retrieved using <a id="idx:threadjoin2:1717"></a><a class="pred" href="threadcreate.html#thread_join/2">thread_join/2</a>,
402 retrieved using <a id="idx:threadjoin2:1720"></a><a class="pred" href="threadcreate.html#thread_join/2">thread_join/2</a>,
403403 making the value of <var>Term</var> irrelevant. The Prolog stacks and C
404404 thread are reclaimed.
405405
406406 <p>The current implementation does not guarantee proper releasing of all
407 mutexes and proper cleanup in <a id="idx:setupcallcleanup3:1718"></a><a class="pred" href="metacall.html#setup_call_cleanup/3">setup_call_cleanup/3</a>,
408 etc. Please use the exception mechanism (<a id="idx:throw1:1719"></a><a class="pred" href="exception.html#throw/1">throw/1</a>)
407 mutexes and proper cleanup in <a id="idx:setupcallcleanup3:1721"></a><a class="pred" href="metacall.html#setup_call_cleanup/3">setup_call_cleanup/3</a>,
408 etc. Please use the exception mechanism (<a id="idx:throw1:1722"></a><a class="pred" href="exception.html#throw/1">throw/1</a>)
409409 to abort execution using non-standard control.</dd>
410410 <dt class="pubdef"><a id="thread_initialization/1"><strong>thread_initialization</strong>(<var>:Goal</var>)</a></dt>
411411 <dd class="defbody">
412412 Run <var>Goal</var> when thread is started. This predicate is similar to
413 <a id="idx:initialization1:1720"></a><a class="pred" href="consulting.html#initialization/1">initialization/1</a>,
413 <a id="idx:initialization1:1723"></a><a class="pred" href="consulting.html#initialization/1">initialization/1</a>,
414414 but is intended for initialization operations of the runtime stacks,
415415 such as setting global variables as described in
416416 <a class="sec" href="gvar.html">section 7.3</a>. <var>Goal</var> is run
418418 state, on starting a new thread and on creating a Prolog engine through
419419 the C interface. On loading a saved state, <var>Goal</var> is executed <em>after</em>
420420 running the
421 <a id="idx:initialization1:1721"></a><a class="pred" href="consulting.html#initialization/1">initialization/1</a>
421 <a id="idx:initialization1:1724"></a><a class="pred" href="consulting.html#initialization/1">initialization/1</a>
422422 hooks.</dd>
423423 <dt class="pubdef"><a id="thread_at_exit/1"><strong>thread_at_exit</strong>(<var>:Goal</var>)</a></dt>
424424 <dd class="defbody">
425425 Run <var>Goal</var> just before releasing the thread resources. This is
426 to be compared to <a id="idx:athalt1:1722"></a><a class="pred" href="consulting.html#at_halt/1">at_halt/1</a>,
426 to be compared to <a id="idx:athalt1:1725"></a><a class="pred" href="consulting.html#at_halt/1">at_halt/1</a>,
427427 but only for the current thread. These hooks are run regardless of why
428428 the execution of the thread has been completed. When these hooks are
429429 run, the return code is already available through
430 <a id="idx:threadproperty2:1723"></a><a class="pred" href="thmonitor.html#thread_property/2">thread_property/2</a>
431 using the result of <a id="idx:threadself1:1724"></a><a class="pred" href="threadcreate.html#thread_self/1">thread_self/1</a>
430 <a id="idx:threadproperty2:1726"></a><a class="pred" href="thmonitor.html#thread_property/2">thread_property/2</a>
431 using the result of <a id="idx:threadself1:1727"></a><a class="pred" href="threadcreate.html#thread_self/1">thread_self/1</a>
432432 as thread identifier. Note that there are two scenarios for using exit
433 hooks. Using <a id="idx:threadatexit1:1725"></a><a class="pred" href="threadcreate.html#thread_at_exit/1">thread_at_exit/1</a>
433 hooks. Using <a id="idx:threadatexit1:1728"></a><a class="pred" href="threadcreate.html#thread_at_exit/1">thread_at_exit/1</a>
434434 is typically used if the thread creates a side-effect that must be
435435 reverted if the thread dies. Another scenario is where the creator of
436436 the thread wants to be informed when the thread ends. That cannot be
437 guaranteed by means of <a id="idx:threadatexit1:1726"></a><a class="pred" href="threadcreate.html#thread_at_exit/1">thread_at_exit/1</a>
437 guaranteed by means of <a id="idx:threadatexit1:1729"></a><a class="pred" href="threadcreate.html#thread_at_exit/1">thread_at_exit/1</a>
438438 because it is possible that the thread cannot be created or dies almost
439439 instantly due to a signal or resource error. The <code>at_exit(Goal)</code>
440440 option of
441 <a id="idx:threadcreate3:1727"></a><a class="pred" href="threadcreate.html#thread_create/3">thread_create/3</a>
441 <a id="idx:threadcreate3:1730"></a><a class="pred" href="threadcreate.html#thread_create/3">thread_create/3</a>
442442 is designed to deal with this scenario.</dd>
443443 <dt class="pubdef"><a id="thread_setconcurrency/2"><strong>thread_setconcurrency</strong>(<var>-Old,
444444 +New</var>)</a></dt>
445445 <dd class="defbody">
446 <a id="idx:Solaris:1728"></a>Determine the concurrency of the process,
446 <a id="idx:Solaris:1731"></a>Determine the concurrency of the process,
447447 which is defined as the maximum number of concurrently active threads.
448448 `Active' here means they are using CPU time. This option is provided if
449449 the thread implementation provides pthread_setconcurrency(). Solaris is
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.33</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.33</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
251251 applications. Such applications often have need for communication
252252 between services and/or fast non-blocking service to multiple concurrent
253253 clients. The shared heap provides fast communication, and thread
254 creation is relatively cheap.<sup class="fn">137<span class="fn-text">On
254 creation is relatively cheap.<sup class="fn">140<span class="fn-text">On
255255 an Intel i7-2600K, running Ubuntu Linux 12.04, SWI-Prolog 6.2 creates
256256 and joins 32,000 threads per second elapsed time.</span></sup>
257257
280280 emulation of POSIX threads mixed with the Windows native API for
281281 smoother and faster operation. The SWI-Prolog thread implementation has
282282 been discussed in the ISO WG17 working group and is largely addopted by
283 YAP and XSB Prolog.<sup class="fn">138<span class="fn-text">The latest
283 YAP and XSB Prolog.<sup class="fn">141<span class="fn-text">The latest
284284 version of the ISO draft can be found at <a class="url" href="http://logtalk.org/plstd/threads.pdf">http://logtalk.org/plstd/threads.pdf</a>.
285285 It appears to have dropped from the ISO WG17 agenda.</span></sup>
286286
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 9.4</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 9.4</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
256256 assert/retract order.
257257
258258 <p>The code below provides a solution to this problem based on
259 <a id="idx:withmutex2:1777"></a><a class="pred" href="threadsync.html#with_mutex/2">with_mutex/2</a>.
259 <a id="idx:withmutex2:1780"></a><a class="pred" href="threadsync.html#with_mutex/2">with_mutex/2</a>.
260260 It also illustrates the problem of mutexes. The predicate
261 <a id="idx:withmutex2:1778"></a><a class="pred" href="threadsync.html#with_mutex/2">with_mutex/2</a>
262 behaves as <a id="idx:once1:1779"></a><a class="pred" href="metacall.html#once/1">once/1</a>
261 <a id="idx:withmutex2:1781"></a><a class="pred" href="threadsync.html#with_mutex/2">with_mutex/2</a>
262 behaves as <a id="idx:once1:1782"></a><a class="pred" href="metacall.html#once/1">once/1</a>
263263 with respect to the guarded goal. This means that our predicate
264264 address/2 is no longer a nice logical non-deterministic relation. This
265 could be solved by explicit locking and unlocking a mutex using <a id="idx:setupcallcleanup2:1780"></a><span class="pred-ext">setup_call_cleanup/2</span>,
265 could be solved by explicit locking and unlocking a mutex using <a id="idx:setupcallcleanup2:1783"></a><span class="pred-ext">setup_call_cleanup/2</span>,
266266 but at the risk of deadlocking the program if the choice point is left
267267 open by accident.
268268
278278 address_db(Id, Address)).
279279 </pre>
280280
281 <p>Message queues (see <a id="idx:messagequeuecreate3:1781"></a><span class="pred-ext">message_queue_create/3</span>)
281 <p>Message queues (see <a id="idx:messagequeuecreate3:1784"></a><span class="pred-ext">message_queue_create/3</span>)
282282 often provide simpler and more robust ways for threads to communicate.
283283 Still, mutexes can be a sensible solution and are therefore provided.
284284
313313 :Goal</var>)</a></dt>
314314 <dd class="defbody">
315315 Execute <var>Goal</var> while holding <var>MutexId</var>. If <var>Goal</var>
316 leaves choice points, these are destroyed (as in <a id="idx:once1:1782"></a><a class="pred" href="metacall.html#once/1">once/1</a>).
316 leaves choice points, these are destroyed (as in <a id="idx:once1:1785"></a><a class="pred" href="metacall.html#once/1">once/1</a>).
317317 The mutex is unlocked regardless of whether <var>Goal</var> succeeds,
318318 fails or raises an exception. An exception thrown by <var>Goal</var> is
319 re-thrown after the mutex has been successfully unlocked. See also <a id="idx:mutexcreate1:1783"></a><a class="pred" href="threadsync.html#mutex_create/1">mutex_create/1</a>
320 and <a id="idx:setupcallcleanup3:1784"></a><a class="pred" href="metacall.html#setup_call_cleanup/3">setup_call_cleanup/3</a>.
319 re-thrown after the mutex has been successfully unlocked. See also <a id="idx:mutexcreate1:1786"></a><a class="pred" href="threadsync.html#mutex_create/1">mutex_create/1</a>
320 and <a id="idx:setupcallcleanup3:1787"></a><a class="pred" href="metacall.html#setup_call_cleanup/3">setup_call_cleanup/3</a>.
321321
322322 <p>Although described in the thread section, this predicate is also
323323 available in the single-threaded version, where it behaves simply as
324 <a id="idx:once1:1785"></a><a class="pred" href="metacall.html#once/1">once/1</a>.</dd>
324 <a id="idx:once1:1788"></a><a class="pred" href="metacall.html#once/1">once/1</a>.</dd>
325325 <dt class="pubdef"><a id="mutex_lock/1"><strong>mutex_lock</strong>(<var>+MutexId</var>)</a></dt>
326326 <dd class="defbody">
327327 Lock the mutex. Prolog mutexes are <em>recursive</em> mutexes: they can
331331 thread is suspended until the mutex is unlocked.
332332
333333 <p>If <var>MutexId</var> is an atom, and there is no current mutex with
334 that name, the mutex is created automatically using <a id="idx:mutexcreate1:1786"></a><a class="pred" href="threadsync.html#mutex_create/1">mutex_create/1</a>.
334 that name, the mutex is created automatically using <a id="idx:mutexcreate1:1789"></a><a class="pred" href="threadsync.html#mutex_create/1">mutex_create/1</a>.
335335 This implies named mutexes need not be declared explicitly.
336336
337337 <p>Please note that locking and unlocking mutexes should be paired
338338 carefully. Especially make sure to unlock mutexes even if the protected
339339 code fails or raises an exception. For most common cases, use
340 <a id="idx:withmutex2:1787"></a><a class="pred" href="threadsync.html#with_mutex/2">with_mutex/2</a>,
340 <a id="idx:withmutex2:1790"></a><a class="pred" href="threadsync.html#with_mutex/2">with_mutex/2</a>,
341341 which provides a safer way for handling Prolog-level mutexes. The
342 predicate <a id="idx:setupcallcleanup3:1788"></a><a class="pred" href="metacall.html#setup_call_cleanup/3">setup_call_cleanup/3</a>
342 predicate <a id="idx:setupcallcleanup3:1791"></a><a class="pred" href="metacall.html#setup_call_cleanup/3">setup_call_cleanup/3</a>
343343 is another way to guarantee that the mutex is unlocked while retaining
344344 non-determinism.</dd>
345345 <dt class="pubdef"><a id="mutex_trylock/1"><strong>mutex_trylock</strong>(<var>+MutexId</var>)</a></dt>
346346 <dd class="defbody">
347 As <a id="idx:mutexlock1:1789"></a><a class="pred" href="threadsync.html#mutex_lock/1">mutex_lock/1</a>,
347 As <a id="idx:mutexlock1:1792"></a><a class="pred" href="threadsync.html#mutex_lock/1">mutex_lock/1</a>,
348348 but if the mutex is held by another thread, this predicates fails
349349 immediately.</dd>
350350 <dt class="pubdef"><a id="mutex_unlock/1"><strong>mutex_unlock</strong>(<var>+MutexId</var>)</a></dt>
355355 <dt class="pubdef"><span class="pred-tag">[deprecated]</span><a id="mutex_unlock_all/0"><strong>mutex_unlock_all</strong></a></dt>
356356 <dd class="defbody">
357357 Unlock all mutexes held by the current thread. This predicate should not
358 be needed if mutex unlocking is guaranteed with <a id="idx:withmutex2:1790"></a><a class="pred" href="threadsync.html#with_mutex/2">with_mutex/2</a>
358 be needed if mutex unlocking is guaranteed with <a id="idx:withmutex2:1793"></a><a class="pred" href="threadsync.html#with_mutex/2">with_mutex/2</a>
359359 or
360 <a id="idx:setupcallcleanup3:1791"></a><a class="pred" href="metacall.html#setup_call_cleanup/3">setup_call_cleanup/3</a>.<sup class="fn">146<span class="fn-text">The
361 also deprecated <a id="idx:threadexit1:1792"></a><a class="pred" href="threadcreate.html#thread_exit/1">thread_exit/1</a>
360 <a id="idx:setupcallcleanup3:1794"></a><a class="pred" href="metacall.html#setup_call_cleanup/3">setup_call_cleanup/3</a>.<sup class="fn">149<span class="fn-text">The
361 also deprecated <a id="idx:threadexit1:1795"></a><a class="pred" href="threadcreate.html#thread_exit/1">thread_exit/1</a>
362362 bypasses the automatic cleanup.</span></sup></dd>
363363 <dt class="pubdef"><a id="mutex_property/2"><strong>mutex_property</strong>(<var>?MutexId,
364364 ?Property</var>)</a></dt>
369369 <dl class="latex">
370370 <dt><strong>alias</strong>(<var>Alias</var>)</dt>
371371 <dd class="defbody">
372 Mutex has the defined alias name. See <a id="idx:mutexcreate2:1793"></a><a class="pred" href="threadsync.html#mutex_create/2">mutex_create/2</a>
372 Mutex has the defined alias name. See <a id="idx:mutexcreate2:1796"></a><a class="pred" href="threadsync.html#mutex_create/2">mutex_create/2</a>
373373 using the `alias' option.</dd>
374374 <dt><strong>status</strong>(<var>Status</var>)</dt>
375375 <dd class="defbody">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 9.5</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 9.5</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
250250 Join all terminated threads. For normal applications, dealing with
251251 terminated threads must be part of the application logic, either
252252 detaching the thread before termination or making sure it will be
253 joined. The predicate <a id="idx:jointhreads0:1794"></a><a class="pred" href="thutil.html#join_threads/0">join_threads/0</a>
253 joined. The predicate <a id="idx:jointhreads0:1797"></a><a class="pred" href="thutil.html#join_threads/0">join_threads/0</a>
254254 is intended for interactive sessions to reclaim resources from threads
255255 that died unexpectedly during development.</dd>
256256 <dt class="pubdef"><a id="interactor/0"><strong>interactor</strong></a></dt>
257257 <dd class="defbody">
258258 Create a new console and run the Prolog top level in this new console.
259 See also <a id="idx:attachconsole0:1795"></a><a class="pred" href="thutil.html#attach_console/0">attach_console/0</a>.
259 See also <a id="idx:attachconsole0:1798"></a><a class="pred" href="thutil.html#attach_console/0">attach_console/0</a>.
260260 In the Windows version a new interactor can also be created from the <b>Run/New
261261 thread</b> menu.
262262 </dd>
270270 <p>Support for debugging threads is still very limited. Debug and trace
271271 mode are flags that are local to each thread. Individual threads can be
272272 debugged either using the graphical debugger described in
273 <a class="sec" href="guitracer.html">section 3.5</a> (see <a id="idx:tspy1:1796"></a><a class="pred" href="thutil.html#tspy/1">tspy/1</a>
273 <a class="sec" href="guitracer.html">section 3.5</a> (see <a id="idx:tspy1:1799"></a><a class="pred" href="thutil.html#tspy/1">tspy/1</a>
274274 and friends) or by attaching a console to the thread and running the
275275 traditional command line debugger (see
276 <a id="idx:attachconsole0:1797"></a><a class="pred" href="thutil.html#attach_console/0">attach_console/0</a>).
276 <a id="idx:attachconsole0:1800"></a><a class="pred" href="thutil.html#attach_console/0">attach_console/0</a>).
277277 When using the graphical debugger, the debugger must be <em>loaded</em>
278 from the main thread (for example using guitracer) before <a id="idx:gtrace0:1798"></a><a class="pred" href="guitracer.html#gtrace/0">gtrace/0</a>
278 from the main thread (for example using guitracer) before <a id="idx:gtrace0:1801"></a><a class="pred" href="guitracer.html#gtrace/0">gtrace/0</a>
279279 can be called from a thread.
280280
281281 <dl class="latex">
301301 <dd class="defbody">
302302 Prepare <var>ThreadId</var> for debugging using the graphical tracer.
303303 This implies installing the tracer hooks in the thread and switching the
304 thread to debug mode using <a id="idx:debug0:1799"></a><a class="pred" href="debugger.html#debug/0">debug/0</a>.
305 The call is injected into the thread using <a id="idx:threadsignal2:1800"></a><a class="pred" href="threadcom.html#thread_signal/2">thread_signal/2</a>.
304 thread to debug mode using <a id="idx:debug0:1802"></a><a class="pred" href="debugger.html#debug/0">debug/0</a>.
305 The call is injected into the thread using <a id="idx:threadsignal2:1803"></a><a class="pred" href="threadcom.html#thread_signal/2">thread_signal/2</a>.
306306 We refer to the documentation of this predicate for asynchronous
307307 interaction with threads. New threads created inherit their debug mode
308308 from the thread that created them.</dd>
309309 <dt class="pubdef"><a id="tdebug/0"><strong>tdebug</strong></a></dt>
310310 <dd class="defbody">
311 Call <a id="idx:tdebug1:1801"></a><a class="pred" href="thutil.html#tdebug/1">tdebug/1</a>
311 Call <a id="idx:tdebug1:1804"></a><a class="pred" href="thutil.html#tdebug/1">tdebug/1</a>
312312 in all running threads.</dd>
313313 <dt class="pubdef"><a id="tnodebug/1"><strong>tnodebug</strong>(<var>+ThreadId</var>)</a></dt>
314314 <dd class="defbody">
319319 <dt class="pubdef"><a id="tspy/2"><strong>tspy</strong>(<var>:Spec,
320320 +ThreadId</var>)</a></dt>
321321 <dd class="defbody">
322 Set a spy point as <a id="idx:spy1:1802"></a><a class="pred" href="debugger.html#spy/1">spy/1</a>
322 Set a spy point as <a id="idx:spy1:1805"></a><a class="pred" href="debugger.html#spy/1">spy/1</a>
323323 and enable the thread for debugging using
324 <a id="idx:tdebug1:1803"></a><a class="pred" href="thutil.html#tdebug/1">tdebug/1</a>.
324 <a id="idx:tdebug1:1806"></a><a class="pred" href="thutil.html#tdebug/1">tdebug/1</a>.
325325 Note that a spy point is a global flag on a predicate that is visible
326326 from all threads. Spy points are honoured in all threads that are in
327327 debug mode and ignored in threads that are in nodebug mode.</dd>
328328 <dt class="pubdef"><a id="tspy/1"><strong>tspy</strong>(<var>:Spec</var>)</a></dt>
329329 <dd class="defbody">
330 Set a spy point as <a id="idx:spy1:1804"></a><a class="pred" href="debugger.html#spy/1">spy/1</a>
330 Set a spy point as <a id="idx:spy1:1807"></a><a class="pred" href="debugger.html#spy/1">spy/1</a>
331331 and enable debugging in all threads using
332 <a id="idx:tdebug0:1805"></a><a class="pred" href="thutil.html#tdebug/0">tdebug/0</a>.
333 Note that removing spy points can be done using <a id="idx:nospy1:1806"></a><a class="pred" href="debugger.html#nospy/1">nospy/1</a>.
334 Disabling spy points in a specific thread is achieved by <a id="idx:tnodebug1:1807"></a><a class="pred" href="thutil.html#tnodebug/1">tnodebug/1</a>.
332 <a id="idx:tdebug0:1808"></a><a class="pred" href="thutil.html#tdebug/0">tdebug/0</a>.
333 Note that removing spy points can be done using <a id="idx:nospy1:1809"></a><a class="pred" href="debugger.html#nospy/1">nospy/1</a>.
334 Disabling spy points in a specific thread is achieved by <a id="idx:tnodebug1:1810"></a><a class="pred" href="thutil.html#tnodebug/1">tnodebug/1</a>.
335335 </dd>
336336 </dl>
337337
341341 <a id="sec:tprofile"></a>
342342
343343 <p>In the current implementation, at most one thread can be profiled at
344 any moment. Any thread can call <a id="idx:profile1:1808"></a><a class="pred" href="profile.html#profile/1">profile/1</a>
345 to profile the execution of some part of its code. The predicate <a id="idx:tprofile1:1809"></a><a class="pred" href="thutil.html#tprofile/1">tprofile/1</a>
344 any moment. Any thread can call <a id="idx:profile1:1811"></a><a class="pred" href="profile.html#profile/1">profile/1</a>
345 to profile the execution of some part of its code. The predicate <a id="idx:tprofile1:1812"></a><a class="pred" href="thutil.html#tprofile/1">tprofile/1</a>
346346 allows for profiling the execution of another thread until the user
347347 stops collecting profile data.
348348
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.35</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.35</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
247247 end-of-file character (control-D). If the
248248 <strong>-t</strong> <var>toplevel</var> command line option is given,
249249 this goal is started instead of entering the default interactive top
250 level (<a id="idx:prolog0:1377"></a><a class="pred" href="toplevel.html#prolog/0">prolog/0</a>).</dd>
250 level (<a id="idx:prolog0:1379"></a><a class="pred" href="toplevel.html#prolog/0">prolog/0</a>).</dd>
251251 <dt class="pubdef"><a id="abort/0"><strong>abort</strong></a></dt>
252252 <dd class="defbody">
253253 Abort the Prolog execution and restart the top level. If the
256256 level.
257257
258258 <p>Aborting is implemented by throwing the reserved exception
259 <code>'$aborted'</code>. This exception can be caught using <a id="idx:catch3:1378"></a><a class="pred" href="exception.html#catch/3">catch/3</a>,
259 <code>'$aborted'</code>. This exception can be caught using <a id="idx:catch3:1380"></a><a class="pred" href="exception.html#catch/3">catch/3</a>,
260260 but the recovery goal is wrapped with a predicate that prunes the choice
261 points of the recovery goal (i.e., as <a id="idx:once1:1379"></a><a class="pred" href="metacall.html#once/1">once/1</a>)
261 points of the recovery goal (i.e., as <a id="idx:once1:1381"></a><a class="pred" href="metacall.html#once/1">once/1</a>)
262262 and re-throws the exception. This is illustrated in the example below,
263263 where we press control-C and `a'.
264264
273273 <dd class="defbody">
274274 Terminate Prolog execution. This is the same as <code>halt(0)</code>.
275275 See
276 <a id="idx:halt1:1380"></a><a class="pred" href="toplevel.html#halt/1">halt/1</a>
276 <a id="idx:halt1:1382"></a><a class="pred" href="toplevel.html#halt/1">halt/1</a>
277277 for details.</dd>
278278 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="halt/1"><strong>halt</strong>(<var>+Status</var>)</a></dt>
279279 <dd class="defbody">
287287 to <var>Status</var>.
288288
289289 <p>
290 <li>Call all hooks registered using <a id="idx:athalt1:1381"></a><a class="pred" href="consulting.html#at_halt/1">at_halt/1</a>.
291 If <var>Status</var> equals 0 (zero), any of these hooks calls <a id="idx:cancelhalt1:1382"></a><a class="pred" href="consulting.html#cancel_halt/1">cancel_halt/1</a>,
290 <li>Call all hooks registered using <a id="idx:athalt1:1383"></a><a class="pred" href="consulting.html#at_halt/1">at_halt/1</a>.
291 If <var>Status</var> equals 0 (zero), any of these hooks calls <a id="idx:cancelhalt1:1384"></a><a class="pred" href="consulting.html#cancel_halt/1">cancel_halt/1</a>,
292292 termination is cancelled.
293293
294294 <p>
301301
302302 <p>
303303 <ul class="latex">
304 <li>Cancel all threads, calling <a id="idx:threadatexit1:1383"></a><a class="pred" href="threadcreate.html#thread_at_exit/1">thread_at_exit/1</a>
304 <li>Cancel all threads, calling <a id="idx:threadatexit1:1385"></a><a class="pred" href="threadcreate.html#thread_at_exit/1">thread_at_exit/1</a>
305305 registered termination hooks. Threads not responding within 1 second are
306306 cancelled forcefully.
307307 <li>Flush I/O and close all streams except for standard I/O.
318318 <dd class="defbody">
319319 This goal starts the default interactive top level. Queries are read
320320 from the stream <code>user_input</code>. See also the Prolog flag
321 <a class="flag" href="flags.html#flag:history">history</a>. The <a id="idx:prolog0:1384"></a><a class="pred" href="toplevel.html#prolog/0">prolog/0</a>
321 <a class="flag" href="flags.html#flag:history">history</a>. The <a id="idx:prolog0:1386"></a><a class="pred" href="toplevel.html#prolog/0">prolog/0</a>
322322 predicate is terminated (succeeds) by typing the end-of-file character
323323 (typically control-D).
324324 </dd>
336336 Hook in module <code>user</code>, normally not defined. <var>Query</var>
337337 and
338338 <var>Bindings</var> represents the query read from the user and the
339 names of the free variables as obtained using <a id="idx:readterm3:1385"></a><a class="pred" href="termrw.html#read_term/3">read_term/3</a>.
339 names of the free variables as obtained using <a id="idx:readterm3:1387"></a><a class="pred" href="termrw.html#read_term/3">read_term/3</a>.
340340 If this predicate succeeds, it should bind <var>Expanded</var> and <var>ExpandedBindings</var>
341341 to the query and bindings to be executed by the top level. This
342 predicate is used by the top level (<a id="idx:prolog0:1386"></a><a class="pred" href="toplevel.html#prolog/0">prolog/0</a>).
343 See also <a id="idx:expandanswer2:1387"></a><a class="pred" href="toplevel.html#expand_answer/2">expand_answer/2</a>
342 predicate is used by the top level (<a id="idx:prolog0:1388"></a><a class="pred" href="toplevel.html#prolog/0">prolog/0</a>).
343 See also <a id="idx:expandanswer2:1389"></a><a class="pred" href="toplevel.html#expand_answer/2">expand_answer/2</a>
344344 and
345 <a id="idx:termexpansion2:1388"></a><a class="pred" href="consulting.html#term_expansion/2">term_expansion/2</a>.</dd>
345 <a id="idx:termexpansion2:1390"></a><a class="pred" href="consulting.html#term_expansion/2">term_expansion/2</a>.</dd>
346346 <dt class="pubdef"><a id="expand_answer/2"><strong>expand_answer</strong>(<var>+Bindings,
347347 -ExpandedBindings</var>)</a></dt>
348348 <dd class="defbody">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 2.8</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 2.8</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section B.3</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section B.3</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
269269 <dd class="defbody">
270270 The unify port represents the <em>neck</em> instruction, signalling the
271271 end of the head-matching process. This port is normally invisible. See
272 <a id="idx:leash1:1992"></a><a class="pred" href="debugger.html#leash/1">leash/1</a>
273 and <a id="idx:visible1:1993"></a><a class="pred" href="debugger.html#visible/1">visible/1</a>.</dd>
272 <a id="idx:leash1:1995"></a><a class="pred" href="debugger.html#leash/1">leash/1</a>
273 and <a id="idx:visible1:1996"></a><a class="pred" href="debugger.html#visible/1">visible/1</a>.</dd>
274274 <dt><strong>exit</strong></dt>
275275 <dd class="defbody">
276276 The exit port signals the goal is proved. It is possible for the goal to
277 have alternatives. See <a id="idx:prologframeattribute3:1994"></a><a class="pred" href="manipstack.html#prolog_frame_attribute/3">prolog_frame_attribute/3</a>
277 have alternatives. See <a id="idx:prologframeattribute3:1997"></a><a class="pred" href="manipstack.html#prolog_frame_attribute/3">prolog_frame_attribute/3</a>
278278 to examine the goal stack.</dd>
279279 <dt><strong>fail</strong></dt>
280280 <dd class="defbody">
301301 </dl>
302302
303303 <p><var>Frame</var> is a reference to the current local stack frame,
304 which can be examined using <a id="idx:prologframeattribute3:1995"></a><a class="pred" href="manipstack.html#prolog_frame_attribute/3">prolog_frame_attribute/3</a>. <var>Choice</var>
304 which can be examined using <a id="idx:prologframeattribute3:1998"></a><a class="pred" href="manipstack.html#prolog_frame_attribute/3">prolog_frame_attribute/3</a>. <var>Choice</var>
305305 is a reference to the last choice point and can be examined using
306 <a id="idx:prologchoiceattribute3:1996"></a><a class="pred" href="manipstack.html#prolog_choice_attribute/3">prolog_choice_attribute/3</a>. <var>Action</var>
306 <a id="idx:prologchoiceattribute3:1999"></a><a class="pred" href="manipstack.html#prolog_choice_attribute/3">prolog_choice_attribute/3</a>. <var>Action</var>
307307 must be unified with a term that specifies how execution must continue.
308308 The following actions are defined:
309309
310310 <dl class="latex">
311311 <dt><strong>abort</strong></dt>
312312 <dd class="defbody">
313 Abort execution. See <a id="idx:abort0:1997"></a><a class="pred" href="toplevel.html#abort/0">abort/0</a>.
313 Abort execution. See <a id="idx:abort0:2000"></a><a class="pred" href="toplevel.html#abort/0">abort/0</a>.
314314 </dd>
315315 <dt><strong>continue</strong></dt>
316316 <dd class="defbody">
326326 </dd>
327327 <dt><strong>nodebug</strong></dt>
328328 <dd class="defbody">
329 Continue execution in normal nodebugging mode. See <a id="idx:nodebug0:1998"></a><a class="pred" href="debugger.html#nodebug/0">nodebug/0</a>.
329 Continue execution in normal nodebugging mode. See <a id="idx:nodebug0:2001"></a><a class="pred" href="debugger.html#nodebug/0">nodebug/0</a>.
330330 </dd>
331331 <dt><strong>retry</strong></dt>
332332 <dd class="defbody">
374374 <dd class="defbody">
375375 Indicate <var>Frame</var> as a skipped frame and set the `skip level'
376376 (see
377 <a id="idx:prologskiplevel2:1999"></a><a class="pred" href="tracehook.html#prolog_skip_level/2">prolog_skip_level/2</a>
377 <a id="idx:prologskiplevel2:2002"></a><a class="pred" href="tracehook.html#prolog_skip_level/2">prolog_skip_level/2</a>
378378 to the recursion depth of <var>Frame</var>. The effect of the skipped
379379 flag is that a redo on a child of this frame is handled differently.
380380 First, a <code>redo</code> trace is called for the child, where the skip
387387 this level according to <var>New</var>. <var>New</var> is an integer,
388388 the atom
389389 <code>very_deep</code> (meaning don't skip) or the atom <code>skip_in_redo</code>
390 (see <a id="idx:prologskipframe1:2000"></a><a class="pred" href="tracehook.html#prolog_skip_frame/1">prolog_skip_frame/1</a>).
390 (see <a id="idx:prologskipframe1:2003"></a><a class="pred" href="tracehook.html#prolog_skip_frame/1">prolog_skip_frame/1</a>).
391391 The `skip level' is a setting of each Prolog thread that disables the
392392 debugger on all recursion levels deeper than the level of the variable.
393 See also <a id="idx:prologskipframe1:2001"></a><a class="pred" href="tracehook.html#prolog_skip_frame/1">prolog_skip_frame/1</a>.
393 See also <a id="idx:prologskipframe1:2004"></a><a class="pred" href="tracehook.html#prolog_skip_frame/1">prolog_skip_frame/1</a>.
394394 </dd>
395395 </dl>
396396
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.32</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.32</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
261261 <dd class="defbody">
262262 Goto position (<var>X</var>, <var>Y</var>) on the screen. Note that the
263263 predicates
264 <a id="idx:linecount2:1289"></a><a class="pred" href="streamstat.html#line_count/2">line_count/2</a>
265 and <a id="idx:lineposition2:1290"></a><a class="pred" href="streamstat.html#line_position/2">line_position/2</a>
264 <a id="idx:linecount2:1291"></a><a class="pred" href="streamstat.html#line_count/2">line_count/2</a>
265 and <a id="idx:lineposition2:1292"></a><a class="pred" href="streamstat.html#line_position/2">line_position/2</a>
266266 will not have a well-defined behaviour while using this predicate.
267267 </dd>
268268 <dt class="pubdef"><a id="tty_put/2"><strong>tty_put</strong>(<var>+Atom,
269269 +Lines</var>)</a></dt>
270270 <dd class="defbody">
271271 Put an atom via the termcap library function tputs(). This function
272 decodes padding information in the strings returned by <a id="idx:ttygetcapability3:1291"></a><a class="pred" href="tty.html#tty_get_capability/3">tty_get_capability/3</a>
272 decodes padding information in the strings returned by <a id="idx:ttygetcapability3:1293"></a><a class="pred" href="tty.html#tty_get_capability/3">tty_get_capability/3</a>
273273 and should be used to output these strings. <var>Lines</var> is the
274274 number of lines affected by the operation, or 1 if not applicable (as in
275275 almost all cases).
282282 <dl class="latex">
283283 <dt><b>Unix</b></dt>
284284 <dd>
285 If the system provides <em>ioctl</em> calls for this, these are used and <a id="idx:ttysize2:1292"></a><a class="pred" href="tty.html#tty_size/2">tty_size/2</a>
285 If the system provides <em>ioctl</em> calls for this, these are used and <a id="idx:ttysize2:1294"></a><a class="pred" href="tty.html#tty_size/2">tty_size/2</a>
286286 properly reflects the actual size after a user resize of the window. As
287287 a fallback, the system uses
288 <a id="idx:ttygetcapability3:1293"></a><a class="pred" href="tty.html#tty_get_capability/3">tty_get_capability/3</a>
288 <a id="idx:ttygetcapability3:1295"></a><a class="pred" href="tty.html#tty_get_capability/3">tty_get_capability/3</a>
289289 using <code>li</code> and <code>co</code> capabilities. In this case the
290290 reported size reflects the size at the first call and is not updated
291291 after a user-initiated resize of the terminal.</dd>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 4.6</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 4.6</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
276276 </dd>
277277 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="number/1"><strong>number</strong>(<var>@Term</var>)</a></dt>
278278 <dd class="defbody">
279 True if <var>Term</var> is bound to an integer or floating point number.<sup class="fn">44<span class="fn-text">As
279 True if <var>Term</var> is bound to an integer or floating point number.<sup class="fn">45<span class="fn-text">As
280280 rational numbers are not atomic in the current implementation and we do
281 not want to break the rule that <a id="idx:number1:555"></a><a class="pred" href="typetest.html#number/1">number/1</a>
282 implies <a id="idx:atomic1:556"></a><a class="pred" href="typetest.html#atomic/1">atomic/1</a>, <a id="idx:number1:557"></a><a class="pred" href="typetest.html#number/1">number/1</a>
281 not want to break the rule that <a id="idx:number1:556"></a><a class="pred" href="typetest.html#number/1">number/1</a>
282 implies <a id="idx:atomic1:557"></a><a class="pred" href="typetest.html#atomic/1">atomic/1</a>, <a id="idx:number1:558"></a><a class="pred" href="typetest.html#number/1">number/1</a>
283283 fails on rational numbers. This will change if rational numbers become
284284 atomic.</span></sup></dd>
285285 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="atom/1"><strong>atom</strong>(<var>@Term</var>)</a></dt>
295295 True if <var>Term</var> is bound to a string. Note that string here
296296 refers to the built-in atomic type string as described in <a class="sec" href="strings.html">section
297297 5.2</a>. Starting with version&nbsp;7, the syntax for a string object is
298 text between double quotes, such as <code>"hello"</code>.<sup class="fn">45<span class="fn-text">In
298 text between double quotes, such as <code>"hello"</code>.<sup class="fn">46<span class="fn-text">In
299299 traditional Prolog systems, double quoted text is often mapped to a list
300300 of <em>character codes</em>.</span></sup> See also the Prolog flag
301301 <a class="flag" href="flags.html#flag:double_quotes">double_quotes</a>.</dd>
310310 \+ compound(Term).
311311 </pre>
312312
313 <p>SWI-Prolog defines the following atomic datatypes: atom (<a id="idx:atom1:558"></a><a class="pred" href="typetest.html#atom/1">atom/1</a>),
314 string (<a id="idx:string1:559"></a><a class="pred" href="typetest.html#string/1">string/1</a>),
315 integer (<a id="idx:integer1:560"></a><a class="pred" href="typetest.html#integer/1">integer/1</a>),
316 floating point number (<a id="idx:float1:561"></a><a class="pred" href="typetest.html#float/1">float/1</a>)
317 and blob (<a id="idx:blob2:562"></a><a class="pred" href="typetest.html#blob/2">blob/2</a>).
313 <p>SWI-Prolog defines the following atomic datatypes: atom (<a id="idx:atom1:559"></a><a class="pred" href="typetest.html#atom/1">atom/1</a>),
314 string (<a id="idx:string1:560"></a><a class="pred" href="typetest.html#string/1">string/1</a>),
315 integer (<a id="idx:integer1:561"></a><a class="pred" href="typetest.html#integer/1">integer/1</a>),
316 floating point number (<a id="idx:float1:562"></a><a class="pred" href="typetest.html#float/1">float/1</a>)
317 and blob (<a id="idx:blob2:563"></a><a class="pred" href="typetest.html#blob/2">blob/2</a>).
318318 In addition, the symbol <code>[]</code> (empty list) is atomic, but not
319319 an atom. See <a class="sec" href="ext-lists.html">section 5.1</a>.</dd>
320320 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="compound/1"><strong>compound</strong>(<var>@Term</var>)</a></dt>
321321 <dd class="defbody">
322 True if <var>Term</var> is bound to a compound term. See also <a id="idx:functor3:563"></a><a class="pred" href="manipterm.html#functor/3">functor/3</a>
323 =../2, <a id="idx:compoundnamearity3:564"></a><a class="pred" href="manipterm.html#compound_name_arity/3">compound_name_arity/3</a>
324 and <a id="idx:compoundnamearguments3:565"></a><a class="pred" href="manipterm.html#compound_name_arguments/3">compound_name_arguments/3</a>.</dd>
322 True if <var>Term</var> is bound to a compound term. See also <a id="idx:functor3:564"></a><a class="pred" href="manipterm.html#functor/3">functor/3</a>
323 =../2, <a id="idx:compoundnamearity3:565"></a><a class="pred" href="manipterm.html#compound_name_arity/3">compound_name_arity/3</a>
324 and <a id="idx:compoundnamearguments3:566"></a><a class="pred" href="manipterm.html#compound_name_arguments/3">compound_name_arguments/3</a>.</dd>
325325 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="callable/1"><strong>callable</strong>(<var>@Term</var>)</a></dt>
326326 <dd class="defbody">
327327 True if <var>Term</var> is bound to an atom or a compound term. This was
328 intended as a type-test for arguments to <a id="idx:call1:566"></a><a class="pred" href="metacall.html#call/1">call/1</a>
329 and <a id="idx:call2:567"></a><a class="pred" href="metacall.html#call/2">call/2</a>..
328 intended as a type-test for arguments to <a id="idx:call1:567"></a><a class="pred" href="metacall.html#call/1">call/1</a>
329 and <a id="idx:call2:568"></a><a class="pred" href="metacall.html#call/2">call/2</a>..
330330 Note that callable only tests the <em>surface term</em>. Terms such as
331 (22,true) are considered callable, but cause <a id="idx:call1:568"></a><a class="pred" href="metacall.html#call/1">call/1</a>
332 to raise a type error. Module-qualification of meta-argument (see <a id="idx:metapredicate1:569"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>)
331 (22,true) are considered callable, but cause <a id="idx:call1:569"></a><a class="pred" href="metacall.html#call/1">call/1</a>
332 to raise a type error. Module-qualification of meta-argument (see <a id="idx:metapredicate1:570"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>)
333333 using
334 <b>:/2</b> causes callable to succeed on any meta-argument.<sup class="fn">46<span class="fn-text">We
335 think that <a id="idx:callable1:570"></a><a class="pred" href="typetest.html#callable/1">callable/1</a>
334 <b>:/2</b> causes callable to succeed on any meta-argument.<sup class="fn">47<span class="fn-text">We
335 think that <a id="idx:callable1:571"></a><a class="pred" href="typetest.html#callable/1">callable/1</a>
336336 should be deprecated and there should be two new predicates, one
337337 performing a test for callable that is minimally module aware and
338 possibly consistent with type-checking in <a id="idx:call1:571"></a><a class="pred" href="metacall.html#call/1">call/1</a>
338 possibly consistent with type-checking in <a id="idx:call1:572"></a><a class="pred" href="metacall.html#call/1">call/1</a>
339339 and a second predicate that tests for atom or compound.</span></sup>
340340 Consider the program and query below:
341341
357357 <dt class="pubdef"><a id="cyclic_term/1"><strong>cyclic_term</strong>(<var>@Term</var>)</a></dt>
358358 <dd class="defbody">
359359 True if <var>Term</var> contains cycles, i.e. is an infinite term. See
360 also <a id="idx:acyclicterm1:572"></a><a class="pred" href="typetest.html#acyclic_term/1">acyclic_term/1</a>
361 and <a class="sec" href="cyclic.html">section 2.16</a>.<sup class="fn">47<span class="fn-text">The
362 predicates <a id="idx:cyclicterm1:573"></a><a class="pred" href="typetest.html#cyclic_term/1">cyclic_term/1</a>
363 and <a id="idx:acyclicterm1:574"></a><a class="pred" href="typetest.html#acyclic_term/1">acyclic_term/1</a>
360 also <a id="idx:acyclicterm1:573"></a><a class="pred" href="typetest.html#acyclic_term/1">acyclic_term/1</a>
361 and <a class="sec" href="cyclic.html">section 2.16</a>.<sup class="fn">48<span class="fn-text">The
362 predicates <a id="idx:cyclicterm1:574"></a><a class="pred" href="typetest.html#cyclic_term/1">cyclic_term/1</a>
363 and <a id="idx:acyclicterm1:575"></a><a class="pred" href="typetest.html#acyclic_term/1">acyclic_term/1</a>
364364 are compatible with SICStus Prolog. Some Prolog systems supporting
365365 cyclic terms use is_cyclic/1 .</span></sup></dd>
366366 <dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="acyclic_term/1"><strong>acyclic_term</strong>(<var>@Term</var>)</a></dt>
367367 <dd class="defbody">
368368 True if <var>Term</var> does not contain cycles, i.e. can be processed
369 recursively in finite time. See also <a id="idx:cyclicterm1:575"></a><a class="pred" href="typetest.html#cyclic_term/1">cyclic_term/1</a>
369 recursively in finite time. See also <a id="idx:cyclicterm1:576"></a><a class="pred" href="typetest.html#cyclic_term/1">cyclic_term/1</a>
370370 and <a class="sec" href="cyclic.html">section 2.16</a>.
371371 </dd>
372372 </dl>
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.34</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.34</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
409409 <dt class="pubdef"><a id="neighbors/3"><strong>neighbors</strong>(<var>+Vertex,
410410 +Graph, -Vertices</var>)</a></dt>
411411 <dd class="defbody">
412 American version of <a id="idx:neighbours3:1980"></a><a class="pred" href="ugraphs.html#neighbours/3">neighbours/3</a>.</dd>
412 American version of <a id="idx:neighbours3:1983"></a><a class="pred" href="ugraphs.html#neighbours/3">neighbours/3</a>.</dd>
413413 <dt class="pubdef"><a id="complement/2"><strong>complement</strong>(<var>+Graph,
414414 -NewGraph</var>)</a></dt>
415415 <dd class="defbody">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.35</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.35</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
296296 <tr><td><var>Location</var> </td><td>Atom or list of character codes. </td></tr>
297297 </table>
298298 </dd>
299 <dt class="pubdef"><span class="pred-tag">[det]</span><a id="parse_url/2"><strong>parse_url</strong>(<var>+URL,
300 -Attributes</var>)</a></dt>
299 <dt class="pubdef"><span class="pred-tag">[det]</span><a id="parse_url/2"><strong>parse_url</strong>(<var>?URL,
300 ?Attributes</var>)</a></dt>
301301 <dd class="defbody">
302302 Construct or analyse a <var>URL</var>. <var>URL</var> is an atom holding
303303 a <var>URL</var> or a variable. <var>Attributes</var> is a list of
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 11.3</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 11.3</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
239239
240240 <p>A <em>resource</em> is very similar to a file. Resources, however,
241241 can be represented in two different formats: on files, as well as part
242 of the resource <em>archive</em> of a saved state (see <a id="idx:qsaveprogram2:1926"></a><a class="pred" href="runtime.html#qsave_program/2">qsave_program/2</a>).
242 of the resource <em>archive</em> of a saved state (see <a id="idx:qsaveprogram2:1929"></a><a class="pred" href="runtime.html#qsave_program/2">qsave_program/2</a>).
243243
244244 <p>A resource has a <em>name</em> and a <em>class</em>. The <em>source</em>
245245 data of the resource is a file. Resources are declared by declaring the
246 predicate <a id="idx:resource3:1927"></a><a class="pred" href="useresource.html#resource/3">resource/3</a>.
246 predicate <a id="idx:resource3:1930"></a><a class="pred" href="useresource.html#resource/3">resource/3</a>.
247247 They are accessed using the predicate
248 <a id="idx:openresource3:1928"></a><a class="pred" href="useresource.html#open_resource/3">open_resource/3</a>.
248 <a id="idx:openresource3:1931"></a><a class="pred" href="useresource.html#open_resource/3">open_resource/3</a>.
249249
250250 <p>Before going into details, let us start with an example. Short texts
251251 can easily be expressed in Prolog source code, but long texts are
264264 close(In)).
265265 </pre>
266266
267 <p>The predicate <a id="idx:help0:1929"></a><a class="pred" href="help.html#help/0">help/0</a>
267 <p>The predicate <a id="idx:help0:1932"></a><a class="pred" href="help.html#help/0">help/0</a>
268268 opens the resource as a Prolog stream. If we are executing this from the
269269 development environment, this will actually return a stream to the file <code>help.txt</code>
270270 itself. When executed from the saved state, the stream will actually be
287287 :, which are reserved for internal usage by the resource library. <var>Class</var>
288288 describes the kind of object stored in the resource. In the current
289289 implementation, it is just an atom. <var>FileSpec</var> is a file
290 specification that may exploit <a id="idx:filesearchpath2:1930"></a><a class="pred" href="consulting.html#file_search_path/2">file_search_path/2</a>
290 specification that may exploit <a id="idx:filesearchpath2:1933"></a><a class="pred" href="consulting.html#file_search_path/2">file_search_path/2</a>
291291 (see
292 <a id="idx:absolutefilename2:1931"></a><a class="pred" href="files.html#absolute_file_name/2">absolute_file_name/2</a>).
292 <a id="idx:absolutefilename2:1934"></a><a class="pred" href="files.html#absolute_file_name/2">absolute_file_name/2</a>).
293293
294294 <p>Normally, resources are defined as unit clauses (facts), but the
295295 definition of this predicate also allows for rules. For proper
299299
300300 <p>Dynamic rules are useful to turn all files in a certain directory
301301 into resources, without specifying a resource for each file. For
302 example, assume the <a id="idx:filesearchpath2:1932"></a><a class="pred" href="consulting.html#file_search_path/2">file_search_path/2</a> <code>icons</code>
302 example, assume the <a id="idx:filesearchpath2:1935"></a><a class="pred" href="consulting.html#file_search_path/2">file_search_path/2</a> <code>icons</code>
303303 refers to the resource directory containing icon files. The following
304304 definition makes all these images available as resources:
305305
325325 <var>Stream</var> becomes a handle to a binary input stream, providing
326326 access to the content of the resource.
327327
328 <p>The predicate <a id="idx:openresource3:1933"></a><a class="pred" href="useresource.html#open_resource/3">open_resource/3</a>
329 first checks <a id="idx:resource3:1934"></a><a class="pred" href="useresource.html#resource/3">resource/3</a>.
328 <p>The predicate <a id="idx:openresource3:1936"></a><a class="pred" href="useresource.html#open_resource/3">open_resource/3</a>
329 first checks <a id="idx:resource3:1937"></a><a class="pred" href="useresource.html#resource/3">resource/3</a>.
330330 When successful it will open the returned resource source file.
331331 Otherwise it will look in the program's resource database. When creating
332332 a saved state, the system normally saves the resource contents into the
333333 resource archive, but does not save the resource clauses.
334334
335335 <p>This way, the development environment uses the files (and
336 modifications) to the <a id="idx:resource3:1935"></a><a class="pred" href="useresource.html#resource/3">resource/3</a>
336 modifications) to the <a id="idx:resource3:1938"></a><a class="pred" href="useresource.html#resource/3">resource/3</a>
337337 declarations and/or files containing resource info, thus immediately
338338 affecting the running environment, while the runtime system quickly
339339 accesses the system resources.
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 3.2</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 3.2</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.36</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.36</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 6.1</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 6.1</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 2.18</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 2.18</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section A.16</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section A.16</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
251251 <p>
252252 <ul class="latex">
253253 <li><i>MS-Windows</i><br>
254 If it detects MS-Windows it uses <a id="idx:winshell2:1955"></a><a class="pred" href="system.html#win_shell/2">win_shell/2</a>
254 If it detects MS-Windows it uses <a id="idx:winshell2:1958"></a><a class="pred" href="system.html#win_shell/2">win_shell/2</a>
255255 to open the <var>URL</var>. The behaviour and browser started depends on
256256 the version of Windows and Windows-shell configuration, but in general
257257 it should be the behaviour expected by the user.
258258
259259 <p>
260260 <li><i>Other platforms</i><br>
261 On other platforms it tests the environment variable (see <a id="idx:getenv2:1956"></a><a class="pred" href="system.html#getenv/2">getenv/2</a>)
261 On other platforms it tests the environment variable (see <a id="idx:getenv2:1959"></a><a class="pred" href="system.html#getenv/2">getenv/2</a>)
262262 named <code>BROWSER</code> or uses <b>netscape</b> if this variable is
263263 not set. If the browser is either <code>mozilla</code> or <code>netscape</code>,
264 <a id="idx:wwwopenurl1:1957"></a><a class="pred" href="www_browser.html#www_open_url/1">www_open_url/1</a>
264 <a id="idx:wwwopenurl1:1960"></a><a class="pred" href="www_browser.html#www_open_url/1">www_open_url/1</a>
265265 first tries to open a new window on a running browser using the <code>-remote</code>
266266 option of Netscape. If this fails or the browser is not <code>mozilla</code>
267267 or <code>netscape</code> the system simply passes the URL as first
11
22 <html>
33 <head>
4 <title>SWI-Prolog 7.3.1 Reference Manual: Section 3.7</title><link rel="home" href="index.html">
4 <title>SWI-Prolog 7.3.6 Reference Manual: Section 3.7</title><link rel="home" href="index.html">
55 <link rel="contents" href="Contents.html">
66 <link rel="index" href="DocIndex.html">
77 <link rel="summary" href="summary.html">
323323 solver is too weak to detect the contradiction. Ideally, delayed goals
324324 and constraints are all executed at the end of the computation. The meta
325325 predicate call_residue_vars/2 finds variables that are given attribute
326 variables or whose attributes are modified%
327 \footnote{Tracking modifications is currently not complete and
328 this feature may be dropped completely in future
329 versions.}
330 by \arg{Goal}, regardless of whether or not these variables are reachable
331 from the arguments of \arg{Goal}.
332
333 The predicate has considerable implications. During the execution of
334 \arg{Goal}, the garbage collector does not reclaim attributed variables.
335 This causes some degradation of GC performance. In a well-behaved
336 program there are no such variables, so the space impact is generally
337 minimal. The actual collection of \arg{Vars} is implemented using a scan
338 of the trail and global stacks.
326 variables or whose attributes are modified by \arg{Goal}, regardless of
327 whether or not these variables are reachable from the arguments of
328 \arg{Goal}.\footnote{The implementation of call_residue_vars/2 is
329 completely redone in version 7.3.2 (7.2.1) after discussion with Bart
330 Demoen. The current implementation no longer performs full scans of the
331 stacks. The overhead is proportional to the number of attributed
332 variables on the stack, dead or alive.}.
339333 \end{description}
340334
341335
1515 \begin{center}
1616 \begin{tabular}{lp{0.7\linewidth}}
1717 \hline
18 ++& Argument must be ground, i.e., the argument may not contain a
19 variable anywhere. \\
1820 + & Argument must be fully instantiated to a term that satisfies the
19 required argument type. Think of the argument as \jargon{input}. \\
20 - & Argument must be unbound. Think of the argument as \jargon{output}. \\
21 type. This is not necessarily \jargon{ground}, e.g., the term
22 \exam{[_]} is a \jargon{list}, although its only member is
23 unbound. \\
24 - & Argument is an \emph{output} argument. Unless specified
25 otherwise, output arguments need not to be unbound. For
26 example, the goal \exam{findall(X, Goal, [T])} is good style and
27 equivalent to \exam{findall(X, Goal, Xs), Xs = [T]}\footnote{The
28 ISO standard dictates that \exam{findall(X, Goal, 1)} raises a
29 \const{type_error} exception, breaking this semantic relation.
30 SWI-Prolog does not follow the standard here.} Note that the
31 \jargon{determinism} specification, e.g., ``det'' only applies
32 if this argument is unbound. \\
33 --& Argument must be unbound. Typically used by predicates that
34 create `something' and return a handle to the created object,
35 such as open/3 which creates a \jargon{stream}. \\
2136 ? & Argument must be bound to a \emph{partial term} of the indicated
2237 type. Note that a variable is a partial term for any type.
2338 Think of the argument as either \jargon{input} or \jargon{output} or
33733388
33743389
33753390 \begin{description}
3376 \predicate[ISO]{open}{4}{+SrcDest, +Mode, -Stream, +Options}
3391 \predicate[ISO]{open}{4}{+SrcDest, +Mode, --Stream, +Options}
33773392 True when \arg{SrcDest} can be opened in \arg{Mode} and \arg{Stream} is
33783393 an I/O stream to/from the object. \arg{SrcDest} is normally the name of
33793394 a file, represented as an atom or string. \arg{Mode} is one of
35093524 The option \const{reposition} is not supported in SWI-Prolog. All streams
35103525 connected to a file may be repositioned.
35113526
3512 \predicate[ISO]{open}{3}{+SrcDest, +Mode, ?Stream}
3527 \predicate[ISO]{open}{3}{+SrcDest, +Mode, --Stream}
35133528 Equivalent to open/4 with an empty option list.
35143529
3515 \predicate{open_null_stream}{1}{?Stream}
3530 \predicate{open_null_stream}{1}{--Stream}
35163531 Open an output stream that produces no output. All counting functions
35173532 are enabled on such a stream. It can be used to discard output (like
35183533 Unix \file{/dev/null}) or exploit the counting properties. The initial
47414756 \secref{quasiquotations} instead of evaluating quasi quotations.
47424757 Each quasi quotation is a term \term{quasi_quotation}{+Syntax,
47434758 +Quotation, +VarDict, -Result}, where \arg{Syntax} is the term in
4744 \verb${|Syntax||$, \arg{Quotation} is a list of character codes that
4759 \verb${|Syntax||..|}$, \arg{Quotation} is a list of character codes that
47454760 represent the quotation, \arg{VarDict} is a list of
47464761 \arg{Name}=\arg{Variable} and \arg{Result} is a variable that shares
47474762 with the place where the quotation must be inserted. This option is
49484963 Unify the free variables in \arg{Term} with a term \term{\$VAR}{N},
49494964 where \arg{N} is the number of the variable. Counting starts at
49504965 \arg{Start}. \arg{End} is unified with the number that should be given
4951 to the next variable. The example below illustrates this. Note that the
4966 to the next variable.\bug{Only \jargon{tagged integers} are supported
4967 (see the Prolog flag \prologflag{max_tagged_integer}). This suffices to
4968 count all variables that can appear in the largest term that can be
4969 represented, but does not support arbitrary large integer values for
4970 \arg{Start}. On overflow, a \term{representation_error}{tagged_integer}
4971 exception is raised.} The example below illustrates this. Note that the
49524972 toplevel prints \verb!'$VAR'(0)! as \arg{A} due to the
49534973 \term{numbervars}{true} option used to print answers.
49544974
49554975 \begin{code}
4956 ?- Term = foo(X,Y,Z),
4976 ?- Term = f(X,Y,X),
49574977 numbervars(Term, 0, End),
49584978 write_canonical(Term), nl.
4959 foo('$VAR'(0),'$VAR'(1),'$VAR'(0))
4960 Term = foo(A, B, A),
4979 f('$VAR'(0),'$VAR'(1),'$VAR'(0))
4980 Term = f(A, B, A),
49614981 X = A,
49624982 Y = B,
49634983 End = 2.
49664986 See also the \const{numbervars} option to write_term/3 and numbervars/4.
49674987
49684988 \predicate{numbervars}{4}{+Term, +Start, -End, +Options}
4969 As numbervars/3, but providing the following options:
4989 As numbervars/3, providing the following options:
49704990
49714991 \begin{description}
49724992 \termitem{functor_name}{+Atom}
57545774 \predicate{plus}{3}{?Int1, ?Int2, ?Int3}
57555775 True if $\arg{Int3} = \arg{Int1} + \arg{Int2}$. At least two of the
57565776 three arguments must be instantiated to integers.
5777
5778 \predicate{divmod}{4}{+Dividend, +Divisor, -Quotient, -Remainder}
5779 This predicate is a shorthand for computing both the \arg{Quotient} and
5780 \arg{Remainder} of two integers in a single operation. This allows for
5781 exploiting the fact that the low level implementation for computing the
5782 quotient also produces the remainder. Timing confirms that this
5783 predicate is almost twice as fast as performing the steps independently.
5784 Semantically, divmod/4 is defined as below.
5785
5786 \begin{code}
5787 divmod(Dividend, Divisor, Quotient, Remainder) :-
5788 Quotient is Dividend div Divisor,
5789 Remainder is Dividend mod Divisor.
5790 \end{code}
5791
5792 Note that this predicate is only available if SWI-Prolog is compiled
5793 with unbounded integer support. This is the case for all packaged
5794 versions.
5795
5796 \predicate{nth_integer_root_and_remainder}{4}{+N, +I, -Root, -Remainder}
5797 True when $\pow{Root}{N} + Remainder = I$. \arg{N} and \arg{I} must be
5798 integers.\footnote{This predicate was suggested by Markus Triska. The
5799 final name and argument order is by Richard O'Keefe. The decision to
5800 include the remainder is by Jan Wielemaker. Including the remainder
5801 makes this predicate about twice as slow if \arg{Root} is not exact.}
5802 \arg{N} must be one or more. If \arg{I} is negative and
5803 \arg{N} is \jargon{odd}, \arg{Root} and \arg{Remainder} are negative,
5804 i.e., the following holds for $\arg{I} < 0$:
5805
5806 \begin{code}
5807 % I < 0,
5808 % N mod 2 =\= 0,
5809 nth_integer_root_and_remainder(
5810 N, I, Root, Remainder),
5811 IPos is -I,
5812 nth_integer_root_and_remainder(
5813 N, IPos, RootPos, RemainderPos),
5814 Root =:= -RootPos,
5815 Remainder =:= -RemainderPos.
5816 \end{code}
57575817 \end{description}
57585818
57595819
60656125
60666126 \function[ISO]{round}{1}{+Expr}
60676127 Evaluate \arg{Expr} and round the result to the nearest integer.
6128 According to ISO, \funcref{round}{1} is defined as
6129 \term{floor}{Expr+1/2}, i.e., rounding \emph{down}. This is an
6130 unconventional choice and under which the relation
6131 \verb$round(Expr) == -round(-Expr)$ does not hold. SWI-Prolog
6132 rounds \emph{outward}, e.g., \exam{round(1.5) =:= 2} and round
6133 \exam{round(-1.5) =:= -2}.
60686134
60696135 \function{integer}{1}{+Expr}
60706136 Same as \funcref{round}{1} (backward compatibility).
62986364 \paragraph{Bitvector functions}
62996365
63006366 The functions below are not covered by the standard. The
6301 \funcref{msb}{1} function is compatible with hProlog. The others are
6302 private extensions that improve handling of ---unbounded--- integers as
6303 bit-vectors.
6367 \funcref{msb}{1} function also appears in hProlog and SICStus Prolog.
6368 The \funcref{getbit}{2} function also appears in ECLiPSe, which also
6369 provides \term{setbit}{Vector,Index} and \term{clrbit}{Vector,Index}.
6370 The others are SWI-Prolog extensions that improve handling of
6371 ---unbounded--- integers as bit-vectors.
63046372
63056373 \begin{description}
63066374 \function{msb}{1}{+IntExpr}
63186386 \function{popcount}{1}{+IntExpr}
63196387 Return the number of 1s in the binary representation of the
63206388 non-negative integer \arg{IntExpr}.
6389
6390 \function{getbit}{2}{+IntExprV, +IntExprI}
6391 Evaluates to the bit value (0 or 1) of the \arg{IntExprI}-th bit of
6392 \arg{IntExprV}. Both arguments must evaluate to non-negative integers.
6393 The result is equivalent to \verb$(IntExprV >> IntExprI)/\1$, but more
6394 efficient because materialization of the shifted value is avoided.
6395 Future versions will optimise \verb$(IntExprV >> IntExprI)/\1$ to a call
6396 to \funcref{getbit}{2}, providing both portability and
6397 performance.\footnote{This issue was fiercely debated at the ISO
6398 standard mailinglist. The name \textit{getbit} was selected for
6399 compatibility with ECLiPSe, the only system providing this support.
6400 Richard O'Keefe disliked the name and argued that efficient handling of
6401 the above implementation is the best choice for this functionality.}
63216402 \end{description}
63226403
63236404
77777858 Extracts the directory part of \arg{File}. The returned \arg{Directory}
77787859 name does not end in \const{/}. There are two special cases. The
77797860 directory name of \const{/} is \const{/} itself, and the directory name
7780 is \const{.} if \arg{File} does not contain any \const{/} characters.
7861 is \const{.} if \arg{File} does not contain any \const{/} characters. If
7862 the \arg{File} argument ends with a \const{/}, e.g., \exam{'/hello/'},
7863 it is not a valid file name. In this case the final \const{/} is removed
7864 from \arg{File}, e.g., \exam{'/hello'}.
7865
77817866 See also directory_file_path/3 from \pllib{filesex}. The system ensures
77827867 that for every valid \arg{Path} using the Prolog (POSIX) directory
7783 separators, following is true on systems with a sound implementation
7784 of same_file/2.\footnote{On some systems, \arg{Path} and
7785 \arg{Path2} refer to the same entry in the file system, but same_file/2
7786 may fail.} See also prolog_to_os_filename/2.
7868 separators, following is true on systems with a sound implementation of
7869 same_file/2.\footnote{On some systems, \arg{Path} and \arg{Path2} refer
7870 to the same entry in the file system, but same_file/2 may fail.} See
7871 also prolog_to_os_filename/2.
77877872
77887873 \begin{code}
77897874 ...,
77957880
77967881 \predicate{file_base_name}{2}{+File, -BaseName}
77977882 Extracts the filename part from a path specification. If \arg{File} does
7798 not contain any directory separators, \arg{File} is returned in \arg{BaseName}.
7799 See also file_directory_name/2.
7883 not contain any directory separators, \arg{File} is returned in
7884 \arg{BaseName}. See also file_directory_name/2. If the \arg{File}
7885 arguments ends with a \const{/}, e.g., \exam{'/hello/'}, \arg{BaseName}
7886 is unified with the empty atom (\const{''}).
78007887
78017888 \predicate{same_file}{2}{+File1, +File2}
78027889 True if both filenames refer to the same physical file. That is, if
5252
5353 Another place that is affected is write_canonical/1. Impact is minimized
5454 by using the list syntax for lists. The predicates read_term/2 and
55 write_term/2 support the option \term{dot_lists}{true}, which causes
55 write_term/2 support the option \term{dotlists}{true}, which causes
5656 read_term/2 to read \verb$.(a,[])$ as \verb$[a]$ and write_term/2 to
5757 write \verb$[a]$ as \verb$.(a,[])$.
5858
12571257 Dicts are currently represented as a compound term using the functor
12581258 \verb$`dict`$. The first argument is the tag. The remaining arguments
12591259 create an array of sorted key-value pairs. This representation is
1260 compact and guarantees good locality. Lookup is order $\log(N)$, while
1261 adding valuesm deleting values and merging with other dicts has order
1260 compact and guarantees good locality. Lookup is order $\log{N}$, while
1261 adding values, deleting values and merging with other dicts has order
12621262 $N$. The main disadvantage is that changing values in large dicts is
12631263 costly, both in terms of memory and time.
12641264
463463
464464 \cmacro{void *}{PL_foreign_context_address}{control_t}
465465 Extracts an address as passed in by PL_retry_address().
466
467 \cmacro{predicate_t}{PL_foreign_context_predicate}{control_t}
468
469 Fetch the Prolog predicate that is executing this function. Note that if
470 the predicate is imported, the returned predicate refers to the final
471 definition rather than the imported predicate, i.e., the module reported
472 by PL_predicate_info() is the module in which the predicate is defined
473 rather than the module where it was called. See also
474 PL_predicate_info().
466475 \end{description}
467476
468477 Note: If a non-deterministic foreign function returns using PL_succeed()
8383 which case the \g{context module} is inherited from the parent
8484 \g{goal}. See also module_transparent/1 and \g{meta-predicate}.
8585
86 \glossitem{det}\index{det}%
86 \glossitem{det [determinism]}\index{det}%
8787 Short for \g{deterministic}.
88
89 \glossitem{determinism}\index{determinism}%
90 How many solutions a \g{goal} can provide. Values are `nondet' (zero
91 to infinite), `multi' (one to infinite), `det' (exactly one) and
92 `semidet' (zero or one).
8893
8994 \glossitem{deterministic}\index{deterministic}%
9095 A \g{predicate} is \g{deterministic} if it succeeds exactly one time
168173 executing instructions from an (abstract) instruction set that is not
169174 or only indirectly related to Prolog.
170175
176 \glossitem{instantiation [of an argument]}\index{instantiation}%
177 To what extend a term is bound to a value. Typical levels are
178 `unbound' (a \g{variable}), `ground' (term without variables) or
179 `partially bound' (term with embedded variables).
180
171181 \glossitem{meta-predicate}\index{meta-predicate}%
172182 A \g{predicate} that reasons about other \g{predicates}, either by
173183 calling them, (re)defining them or querying \g{properties}.
184
185 \glossitem{mode [declaration]}\index{mode}%
186 Declaration of an argument \g{instantiation} pattern for a
187 \g{predicate}, often accompanied with a \g{determinism}.
174188
175189 \glossitem{module}\index{module}%
176190 Collection of predicates. Each module defines a name-space for
181195 \glossitem{module transparent [predicate]}\index{module transparent}\index{transparent}%
182196 A \g{predicate} that does not change the \g{context module}. Sometimes
183197 also called a \g{meta-predicate}.
198
199 \glossitem{multi [determinism]}\index{multi}%
200 A \g{predicate} is said to have \g{determinism} multi if it generates at
201 \emph{least} one answer.
184202
185203 \glossitem{multifile [predicate]}
186204 Predicate for which the definition is distributed over multiple
333351 See also \g{unify}.
334352
335353 \end{description}
336
337
338
339
340
341
342
343
344
345
346
347
5151 YAP\footnote{\url{http://www.dcc.fc.up.pt/\~{}vsc/Yap/}} system.
5252 Together with YAP we developed a portability framework (see
5353 \secref{dialect}). This framework has been filled for SICStus Prolog,
54 YAP and IF/Prolog.
54 YAP, IF/Prolog and Ciao. SWI-Prolog version~7 introduces various
55 extensions to the Prolog language (see \secref{extensions}). The
56 \jargon{string} data type and its supporting set of built-in predicates
57 is compatibility with ECLiPSe.
5558
5659 \section{Status and releases} \label{sec:status}
5760
5858
5959 \newcommand{\vmajor}{7}
6060 \newcommand{\vminor}{2}
61 \newcommand{\vpatch}{0}
62 \newcommand{\vmonth}{May}
61 \newcommand{\vpatch}{3}
62 \newcommand{\vmonth}{August}
6363 \newcommand{\vyear}{2015}
6464
6565 #ifdef BOOK
20612061 \escapeitem{\}
20622062 Escapes the backslash itself. Thus, \verb$'\\'$ is an atom
20632063 consisting of a single \chr{\}.
2064 \escapeitem{quote}
2065 If the current quote (\chr{"} or \chr{'}) is preceded by a backslash,
2066 it is copied verbatim. Thus, \verb$'\''$ and \verb$''''$ both describe
2067 the atom with a single~\verb$'$.
2064 \escapeitem{'}
2065 Single quote. Note that \verb$'\''$ and \verb$''''$ both describe
2066 the atom with a single~\chr{'}, i.e., \verb$'\'' == ''''$ is true.
2067 \escapeitem{"}
2068 Double quote.
2069 \escapeitem{`}
2070 Back quote.
20682071 \end{description}
20692072
20702073 Character escaping is only available if
22 Author: Jan Wielemaker
33 E-mail: J.Wielemaker@vu.nl
44 WWW: http://www.swi-prolog.org
5 Copyright (C): 1995-2011, University of Amsterdam
5 Copyright (C): 1995-2015, University of Amsterdam
66 VU University Amsterdam
77
88 This program is free software; you can redistribute it and/or
439439 predarg(1) -->
440440 "[]".
441441
442 mode -->
443 "?:", !.
442 mode --> "?:", !.
443 mode --> "--", !.
444 mode --> "++", !.
444445 mode -->
445446 char(C),
446447 { string_code(_, "+-?:@!", C) }, !.
1414 \renewcommand{\arctan}[1]{\mbox{inverse tangus of #1}}
1515 \renewcommand{\ln}[1]{\mbox{natural logarithm of #1}}
1616 \renewcommand{\lg}[1]{\mbox{10 base logarithm of #1}}
17 \renewcommand{\log}[1]{\mbox{log(#1)}}
1718 \renewcommand{\pow}[2]{\mbox{#1 to the power #2}}
1819 \renewcommand{\pi}{\mbox{pi}}
1920 \renewcommand{\times}[2]{#1 * #2}
158158 $appbase/correctindex $doc.idx
159159 fi
160160 if [ -r $appbase/makeindex.ist ]; then
161 makeindex -s $appbase/makeindex.ist $doc
161 makeindex -s $appbase/makeindex.ist $doc.idx
162162 else
163 makeindex $doc
163 makeindex $doc.idx
164164 fi
165165 fi
166166 if test -r $doc.aux && grep -qw bibdata $doc.aux; then
202202 \predicatesummary{dif}{2}{Constrain two terms to be different}
203203 \predicatesummary{directory_files}{2}{Get entries of a directory/folder}
204204 \oppredsummary{discontiguous}{1}{fx}{1150}{Indicate distributed definition of a predicate}
205 \predicatesummary{divmod}{4}{Compute quotient and remainder of two integers}
205206 \predicatesummary{downcase_atom}{2}{Convert atom to lower-case}
206207 \predicatesummary{duplicate_term}{2}{Create a copy of a term}
207208 \predicatesummary{dwim_match}{2}{Atoms match in ``Do What I Mean'' sense}
411412 \predicatesummary{notrace}{0}{Stop tracing}
412413 \predicatesummary{notrace}{1}{Do not debug argument goal}
413414 \predicatesummary{nth_clause}{3}{N-th clause of a predicate}
415 \predicatesummary{nth_integer_root_and_remainder}{4}{Integer root and remainder}
414416 \predicatesummary{number}{1}{Type check for integer or float}
415417 \predicatesummary{number_chars}{2}{Convert between number and one-char atoms}
416418 \predicatesummary{number_codes}{2}{Convert between number and character codes}
771773 \functionsummary{float_integer_part}{1}{Integer part of a float}
772774 \functionsummary{floor}{1}{Largest integer below argument}
773775 \functionsummary{gcd}{2}{Greatest common divisor}
776 \functionsummary{getbit}{2}{Get bit at index from large integer}
774777 \functionsummary{integer}{1}{Round to nearest integer}
775778 \functionsummary{lgamma}{1}{Log of gamma function}
776779 \functionsummary{log}{1}{Natural logarithm}
Binary diff not shown
267267 { archive_wrapper *ar = cdata;
268268
269269 PL_release_stream(ar->data);
270 if ( ar->close_parent )
270 if ( ar->close_parent && ar->archive )
271271 { if ( Sclose(ar->data) != 0 )
272272 { archive_set_error(ar->archive, errno, "Close failed");
273273 ar->data = NULL;
934934 { archive_wrapper *ar = handle;
935935
936936 if ( ar->closed_archive )
937 { struct archive *a = ar->archive;
938
939 ar->archive = NULL;
940 ar->entry = NULL;
941 ar->archive = NULL;
942 ar->symbol = 0;
943
944 archive_read_free(a);
937 { if ( ar->archive )
938 { int rc;
939
940 if ( (rc=archive_read_free(ar->archive)) == ARCHIVE_OK )
941 { ar->entry = NULL;
942 ar->archive = NULL;
943 ar->symbol = 0;
944 } else
945 return -1;
946 }
945947 }
946948 if ( ar->status == AR_OPENED_ENTRY )
947949 { PL_unregister_atom(ar->symbol);
629629 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
630630
631631 'chr sbag_member'( Element, [Head|Tail]) :-
632 sbag_member( Element, Tail, Head).
632 sbag_member( Tail, Element, Head).
633633
634634 % auxiliary to avoid choicepoint for last element
635 % does it really avoid the choicepoint? -jon
636 sbag_member( E, _, E).
637 sbag_member( E, [Head|Tail], _) :-
638 sbag_member( E, Tail, Head).
635 sbag_member( _, E, E).
636 sbag_member( [Head|Tail], E, _) :-
637 sbag_member( Tail, E, Head).
639638
640639 'chr sbag_del_element'( [], _, []).
641640 'chr sbag_del_element'( [X|Xs], Elem, Set2) :-
909908 Event =.. [Type|Rest],
910909 ( Type \== call,
911910 Type \== wake ->
912 handle_debug_command('c',Event,Depth)
911 handle_debug_command(creep,Event,Depth)
913912 ;
914913 Rest = [Susp],
915914 set_chr_debug(skip(Susp,Depth))
4141 udpbroadcast.tex
4242 syslog.tex
4343 socket.tex
44 prologstream.tex
4445 maildrop/rfc2045/rfc2045charset.h
4546 stamp-h1
2020 MIMELIBS=maildrop/rfc2045/librfc2045.a maildrop/rfc822/librfc822.a
2121
2222 LIBPL= @PLTARGETS@ streaminfo.pl process.pl prolog_server.pl sha.pl \
23 uri.pl udp_broadcast.pl
23 uri.pl udp_broadcast.pl prolog_stream.pl
2424 TARGETS= @TARGETS@ readutil.@SO@ streaminfo.@SO@ process.@SO@ \
25 sha4pl.@SO@ uri.@SO@
25 sha4pl.@SO@ uri.@SO@ prolog_stream.@SO@
2626
2727 UNXOBJ= error.o unix.o
2828 SOCKOBJ= error.o socket.o nonblockio.o
3939 READUTILOBJ= readutil.o
4040 PROCESSOBJ= error.o process.o
4141 STREAMINFOOBJ= error.o streaminfo.o
42 PROLOGSTREAMOBJ=prolog_stream.o
4243 SHAOBJ= error.o sha4pl.o sha1/sha1.o sha1/sha2.o \
4344 sha1/hmac_sha1.o sha1/hmac_sha256.o
4445 UUIDOBJ= uuid.o
6970 $(LD) $(LDSOFLAGS) -o $@ $(PROCESSOBJ) $(LIBPLSO)
7071 streaminfo.@SO@: $(STREAMINFOOBJ)
7172 $(LD) $(LDSOFLAGS) -o $@ $(STREAMINFOOBJ) $(LIBPLSO)
73 prolog_stream.@SO@: $(PROLOGSTREAMOBJ)
74 $(LD) $(LDSOFLAGS) -o $@ $(PROLOGSTREAMOBJ) $(LIBPLSO)
7275 sha4pl.@SO@: $(SHAOBJ)
7376 $(LD) $(LDSOFLAGS) -o $@ $(SHAOBJ) $(LIBPLSO)
7477 syslog.@SO@: $(SYSLOGOBJ)
160163 ################################################################
161164
162165 TEXEXTRA=process.tex uri.tex filesex.tex uid.tex mime.tex udpbroadcast.tex \
163 uuid.tex unix.tex syslog.tex socket.tex
166 uuid.tex unix.tex syslog.tex socket.tex prologstream.tex
164167 $(TEX): $(TEXEXTRA)
165168
166169 uri.tex: uri.pl
183186 $(PLTOTEX) 'library(socket)'
184187 udpbroadcast.tex: udp_broadcast.pl
185188 $(PLTOTEX) 'library(udp_broadcast)'
189 prologstream.tex: prolog_stream.pl
190 $(PLTOTEX) 'library(prolog_stream)'
186191
187192 ################################################################
188193 # Clean
708708 \end{description}
709709
710710 \input{udpbroadcast.tex}
711 \input{prologstream.tex}
712
711713 \section*{NetBSD Crypt license}
712714
713715 \begin{code}
248248 <div class="toc-h2"><a class="sec" href="#sec:18"><span class="sec-nr">18</span> <span class="sec-title">library(udp_broadcast):
249249 A UDP Broadcast Bridge</span></a></div>
250250 <div class="toc-h3"><a class="sec" href="#sec:18.1"><span class="sec-nr">18.1</span> <span class="sec-title">Caveats</span></a></div>
251 <div class="toc-h2"><a class="sec" href="#sec:19"><span class="sec-nr">19</span> <span class="sec-title">library(prolog_stream):
252 A stream with Prolog callbacks</span></a></div>
251253 </div>
252254
253255 <p><h2 id="sec:clib-intro"><a name="sec:1"><span class="sec-nr">1</span> <span class="sec-title">Introduction</span></a></h2>
638640 </dd>
639641 <dt class="pubdef"><span class="pred-tag">[det]</span><a name="relative_file_name/3"><strong>relative_file_name</strong>(<var>+Path:atom,
640642 +RelTo:atom, -RelPath:atom</var>)</a></dt>
643 <dt class="pubdef"><span class="pred-tag">[det]</span><a name="relative_file_name/3"><strong>relative_file_name</strong>(<var>-Path:atom,
644 +RelTo:atom, +RelPath:atom</var>)</a></dt>
641645 <dd class="defbody">
642646 True when <var>RelPath</var> is <var>Path</var>, relative to <var>RelTo</var>. <var>Path</var>
643647 and <var>RelTo</var> are first handed to <span class="pred-ext">absolute_file_name/2</span>,
644648 which makes the absolute
645 <b>and</b> canonical. Below is an example:
649 <b>and</b> canonical. Below are two examples:
646650
647651 <pre class="code">
648652 ?- relative_file_name('/home/janw/nice',
649653 '/home/janw/deep/dir/file', Path).
650654 Path = '../../nice'.
655
656 ?- relative_file_name(Path, '/home/janw/deep/dir/file', '../../nice').
657 Path = '/home/janw/nice'.
651658 </pre>
652659
653660 <table class="arglist">
30393046 </dd>
30403047 </dl>
30413048
3049 <p><h2 id="sec:prologstream"><a name="sec:19"><span class="sec-nr">19</span> <span class="sec-title">library(prolog_stream):
3050 A stream with Prolog callbacks</span></a></h2>
3051
3052 <p><a name="sec:prologstream"></a>
3053
3054 <p>This library defines a Prolog stream that realises its low-level I/O
3055 with callbacks to Prolog. The library was developed to bind normal
3056 Prolog I/O to Pengines I/O. This type of I/O redirection is probably the
3057 primary use case.
3058
3059 <dl class="latex">
3060 <dt class="pubdef"><a name="open_prolog_stream/4"><strong>open_prolog_stream</strong>(<var>+Module,
3061 +Mode, -Stream, +Options</var>)</a></dt>
3062 <dd class="defbody">
3063 Create a new stream that implements its I/O by calling predicates in <var>Module</var>.
3064 The called predicates are:
3065
3066 <dl class="latex">
3067 <dt><var><var>Module</var></var> <strong><code>:</code></strong> <var><code>stream_write(+Stream,
3068 +String)</code></var></dt>
3069 <dd class="defbody">
3070 Called for a <code>Mode = write</code> stream if data is available.
3071 <var>String</var> contains the (textual) data that is written to <var>Stream</var>.
3072 The callback is called if the buffer of
3073 <var>Stream</var> overflows, the user calls <code>flush_output(Stream)</code>
3074 or <var>Stream</var> is closed and there is buffered data.
3075 </dd>
3076 <dt><var><var>Module</var></var> <strong><code>:</code></strong> <var><code>stream_read(+Stream,
3077 -Term)</code></var></dt>
3078 <dd class="defbody">
3079 Called for a <code>Mode == read</code> stream to get new data. On
3080 success the stream extracts text from the provided <var>Term</var>.
3081 <var>Term</var> is typically a string, atom, code or character list. If
3082 term is not one of the above, it is handed to <span class="pred-ext">writeq/1</span>.
3083 To signal end-of-file, unify stream with an empty text, e.g., <code>stream_read(Stream, "")</code>.
3084 </dd>
3085 <dt><var><var>Module</var></var> <strong><code>:</code></strong> <var><code>stream_close(+Stream)</code></var></dt>
3086 <dd class="defbody">
3087 Called when the stream is closed. This predicate must succeed. The
3088 callback can be used to cleanup associated resources.
3089 </dd>
3090 </dl>
3091
3092 <p>The current implementation only deals with text streams. The stream
3093 uses the <code>wchar_t</code> encoding. The buffer size must be a
3094 multiple of <code>wchar_t</code>, i.e., a multiple of four for
3095 portability. The <i>newline</i> mode of the stream is <code>posix</code>
3096 on all platforms, disabling the translation <code>"\n" --&gt; "\r\n"</code>.
3097 <table class="arglist">
3098 <tr valign="top"><td><var>Options</var> </td><td>is currently ignored. </td></tr>
3099 </table>
3100
3101 <dl class="tags">
3102 <dt class="tag">bug</dt>
3103 <dd>
3104 Futher versions might require additional callbacks. As we demand all
3105 callbacks to be defined, existing code needs to implement the new
3106 callbacks.
3107 </dd>
3108 </dl>
3109
3110 </dd>
3111 </dl>
3112
30423113 <h2>NetBSD Crypt license</h2>
30433114
30443115 <pre class="code">
31973268 <dd>
31983269 <a class="idx" href="#idx:openmemoryfile3:24">14</a></dd>
31993270 <dt><a class="idx" href="#open_memory_file/4">open_memory_file/4</a></dt>
3271 <dt><a class="idx" href="#open_prolog_stream/4">open_prolog_stream/4</a></dt>
32003272 <dt><a class="idx" href="#openlog/3">openlog/3</a></dt>
32013273 <dt><a class="idx" href="#pipe/2">pipe/2</a></dt>
32023274 <dt><a class="idx" href="#prctl/1">prctl/1</a></dt>
Binary diff not shown
3030 :- module(files_ex,
3131 [ set_time_file/3, % +File, -OldTimes, +NewTimes
3232 link_file/3, % +OldPath, +NewPath, +Type
33 relative_file_name/3, % +AbsPath, +RelTo, -RelPath
33 relative_file_name/3, % ?AbsPath, +RelTo, ?RelPath
3434 directory_file_path/3, % +Dir, +File, -Path
3535 copy_file/2, % +From, +To
3636 make_directory_path/1, % +Directory
9898 % is unknown or not supported on the target OS.
9999
100100 %% relative_file_name(+Path:atom, +RelTo:atom, -RelPath:atom) is det.
101 %% relative_file_name(-Path:atom, +RelTo:atom, +RelPath:atom) is det.
101102 %
102103 % True when RelPath is Path, relative to RelTo. Path and RelTo are
103104 % first handed to absolute_file_name/2, which makes the absolute
104 % *and* canonical. Below is an example:
105 % *and* canonical. Below are two examples:
105106 %
106107 % ==
107108 % ?- relative_file_name('/home/janw/nice',
108109 % '/home/janw/deep/dir/file', Path).
109110 % Path = '../../nice'.
111 %
112 % ?- relative_file_name(Path, '/home/janw/deep/dir/file', '../../nice').
113 % Path = '/home/janw/nice'.
110114 % ==
111115 %
112116 % @param All paths must be in canonical POSIX notation, i.e.,
114118 % prolog_to_os_filename/2.
115119 % @bug This predicate is defined as a _syntactical_ operation.
116120
117 relative_file_name(Path, RelTo, RelPath) :-
121 relative_file_name(Path, RelTo, RelPath) :- % +,+,-
122 nonvar(Path), !,
118123 absolute_file_name(Path, AbsPath),
119124 absolute_file_name(RelTo, AbsRelTo),
120125 atomic_list_concat(PL, /, AbsPath),
122127 delete_common_prefix(PL, RL, PL1, PL2),
123128 to_dot_dot(PL2, DotDot, PL1),
124129 atomic_list_concat(DotDot, /, RelPath).
130 relative_file_name(Path, RelTo, RelPath) :-
131 ( is_absolute_file_name(RelPath)
132 -> Path = RelPath
133 ; file_directory_name(RelTo, RelToDir),
134 directory_file_path(RelToDir, RelPath, Path0),
135 absolute_file_name(Path0, Path)
136 ).
125137
126138 delete_common_prefix([H|T01], [H|T02], T1, T2) :- !,
127139 delete_common_prefix(T01, T02, T1, T2).
219219 nbio_request request; /* our request */
220220 DWORD thread; /* waiting thread */
221221 DWORD error; /* error while executing request */
222 DWORD close_timeout; /* Time to reap socket if FD_CLOSE is not received */
223222 int done; /* request completed */
224223 int w32_flags; /* or of received FD_* */
225224 CRITICAL_SECTION socket_mutex; /* synchronization mutex */
267266 static plsocket *allocSocket(SOCKET socket);
268267 #ifdef __WINDOWS__
269268 static plsocket *lookupOSSocket(SOCKET socket);
270 static int socketIsPendingClose(plsocket *s);
271269 static const char *WinSockError(unsigned long eno);
272 #endif
270 static int releaseSocketWhenPossible(plsocket *s);
271 #endif
272 static int freeSocket(plsocket *s);
273273
274274 #ifndef __WINDOWS__
275275 static int
332332 case REQ_WRITE: return "req_write";
333333 case REQ_RECVFROM:return "req_recvfrom";
334334 case REQ_SENDTO: return "req_sendto";
335 case REQ_DEALLOCATE:return "req_deallocate";
335336 default: return "req_???";
336337 }
337338 }
872873 doneRequest(s);
873874 }
874875 break;
876 case REQ_DEALLOCATE:
877 freeSocket(s);
875878 }
876879
877880 return TRUE;
953956 allow for the case when FD_CLOSE never comes, and then
954957 continue as normal
955958 */
956 socketIsPendingClose(s);
959 releaseSocketWhenPossible(s);
957960 }
958961
959962 switch(s->request)
977980 case REQ_SENDTO:
978981 s->rdata.sendto.bytes = -1;
979982 break;
983 case REQ_DEALLOCATE:
984 break;
980985 }
981986 doneRequest(s);
982987 } else if ( s->socket >= 0 )
12881293 size_t i;
12891294
12901295 #ifdef __WINDOWS__
1291 DWORD now = GetTickCount();
12921296
12931297 if ( (p=lookupOSSocket(socket)) )
1294 { DEBUG(1, Sdprintf("WinSock %d already registered on %d; tmo=%ld, now=%ld\n",
1295 (int)socket, p->id, (long)p->close_timeout, (long)now));
1298 { DEBUG(1, Sdprintf("WinSock %d already registered on %d\n",
1299 (int)socket, p->id));
12961300 p->socket = (SOCKET)-1;
12971301 }
12981302 #endif
13181322 { sockets[i] = p = PL_malloc(sizeof(*p));
13191323 socks_count++;
13201324 break;
1321 #ifdef __WINDOWS__
1322 } else
1323 { if ( p->close_timeout && p->close_timeout < now )
1324 { SOCKET sock;
1325
1326 p->close_timeout = 0;
1327 if ( (sock=p->socket) ) /* is this ever the case? */
1328 { int rval;
1329
1330 do
1331 { rval = closesocket(sock);
1332 } while(rval == SOCKET_ERROR && errno == EINTR);
1333 }
1334 break;
1335 }
1336 #endif
13371325 }
13381326 }
13391327 UNLOCK();
13591347 }
13601348
13611349
1362 #ifndef __WINDOWS__
13631350 static int
13641351 freeSocket(plsocket *s)
13651352 { int rval;
13991386
14001387 return rval;
14011388 }
1402 #endif
14031389
14041390
14051391 /*******************************
16681654 }
16691655
16701656 #ifdef __WINDOWS__
1671
1672 /* socketIsPendingClose() is called if a Windows socket is closed, but
1673 we did not yet see an FD_CLOSE message for it. We will reuse this
1674 socket using lookupTimedOutSocket() if we have not seen the FD_CLOSE
1675 after 30 seconds. This is a random time. Are we guaranteed to get
1676 an FD_CLOSE?
1677 */
1678
16791657 static int
1680 socketIsPendingClose(plsocket *s)
1681 { s->close_timeout = GetTickCount() + 30 * 1000;
1658 releaseSocketWhenPossible(plsocket *s)
1659 {
1660 LOCK_SOCKET(s);
16821661 shutdown(s->socket, SD_BOTH);
1683 DEBUG(2, Sdprintf("Setting close_timeout on socket %d... to %ld\n",
1684 s->id, (long)s->close_timeout));
1685
1662 s->flags |= PLSOCK_WAITING;
1663 s->done = FALSE;
1664 s->error = 0;
1665 s->thread = GetCurrentThreadId();
1666 s->request = REQ_DEALLOCATE;
1667 UNLOCK_SOCKET(s);
1668 SendMessage(State()->hwnd, WM_REQUEST, 1, (LPARAM)&s);
16861669 return 0;
16871670 }
1688
1689 #endif /*__WINDOWS__*/
1671 #endif
16901672
16911673 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
16921674 socket(-Socket)
17431725 {
17441726 // We cannot free the socket in Windows since we might subsequently get an FD_CLOSE. Instead set the timeout
17451727 #ifdef __WINDOWS__
1746 socketIsPendingClose(s);
1728 releaseSocketWhenPossible(s);
17471729 #else
17481730 freeSocket(s);
17491731 #endif
23422324 s->input = NULL;
23432325 if ( !(s->flags & (PLSOCK_INSTREAM|PLSOCK_OUTSTREAM)) )
23442326 #ifdef __WINDOWS__
2345 return socketIsPendingClose(s);
2327 return releaseSocketWhenPossible(s);
23462328 #else
23472329 return freeSocket(s);
23482330 #endif
23802362 s->output = NULL;
23812363 if ( !(s->flags & (PLSOCK_INSTREAM|PLSOCK_OUTSTREAM)) )
23822364 #ifdef __WINDOWS__
2383 return socketIsPendingClose(s);
2365 return releaseSocketWhenPossible(s);
23842366 #else
23852367 return freeSocket(s);
23862368 #endif
105105 REQ_WRITE,
106106 REQ_RECVFROM,
107107 REQ_SENDTO
108 #ifdef __WINDOWS__
109 , REQ_DEALLOCATE
110 #endif
108111 } nbio_request;
109112
110113 /* nbio_get_flags() mask */
0 /* Part of SWI-Prolog
1
2 Author: Jan Wielemaker
3 E-mail: J.Wielemaker@vu.nl
4 WWW: http://www.swi-prolog.org
5 Copyright (C): 2015, University of Amsterdam
6 VU University Amsterdam
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23 #include <SWI-Stream.h>
24 #include <SWI-Prolog.h>
25 #include <string.h>
26
27 static atom_t ATOM_read;
28 static atom_t ATOM_write;
29 static functor_t FUNCTOR_stream_write2;
30 static functor_t FUNCTOR_stream_read2;
31 static functor_t FUNCTOR_stream_close1;
32
33 typedef struct stream_context
34 { IOSTREAM *stream; /* Stream I'm handle of */
35 module_t module; /* Associated module */
36 predicate_t pred_write; /* write handler */
37 predicate_t pred_read; /* read handler */
38 char *buffered; /* buffered read chars */
39 size_t buflen; /* length of buffered */
40 size_t sent; /* sent buffered chars */
41 } stream_context;
42
43 static stream_context*
44 alloc_stream_context(void)
45 { stream_context *ctx = PL_malloc(sizeof(*ctx));
46
47 memset(ctx, 0, sizeof(*ctx));
48
49 return ctx;
50 }
51
52 static void
53 free_stream_context(stream_context *ctx)
54 { if ( ctx->buffered )
55 PL_free(ctx->buffered);
56
57 PL_free(ctx);
58 }
59
60 static ssize_t
61 stream_read(void *handle, char *buf, size_t size)
62 { stream_context *ctx = handle;
63 ssize_t rc = -1;
64
65 if ( !ctx->pred_read )
66 ctx->pred_read = PL_pred(FUNCTOR_stream_read2, ctx->module);
67
68 if ( !ctx->buffered )
69 { fid_t fid = 0;
70 term_t av;
71 wchar_t *ws;
72 size_t len;
73
74 if ( (fid = PL_open_foreign_frame()) &&
75 (av = PL_new_term_refs(2)) &&
76 PL_unify_stream(av+0, ctx->stream) &&
77 PL_call_predicate(ctx->module, PL_Q_NORMAL, ctx->pred_read, av) &&
78 PL_get_wchars(av+1, &len, &ws,
79 CVT_ALL|CVT_WRITEQ|CVT_EXCEPTION|BUF_MALLOC) )
80 { if ( len == 0 )
81 rc = 0; /* EOF */
82 ctx->buffered = (char*)ws;
83 ctx->buflen = len*sizeof(wchar_t);
84 } else
85 { term_t ex;
86
87 if ( (ex = PL_exception(0)) )
88 { Sset_exception(ctx->stream, ex);
89 } else
90 { Sseterr(ctx->stream, SIO_FERR, "Prolog read handler failed");
91 }
92 }
93
94 if ( fid )
95 PL_close_foreign_frame(fid);
96 }
97
98 if ( ctx->buffered )
99 { size_t left = ctx->buflen - ctx->sent;
100
101 if ( left < size )
102 { memcpy(buf, &ctx->buffered[ctx->sent], left);
103 PL_free(ctx->buffered);
104 ctx->buffered = NULL;
105 rc = left;
106 } else
107 { memcpy(buf, &ctx->buffered[ctx->sent], size);
108 ctx->sent += size;
109 rc = size;
110 }
111 }
112
113 return rc;
114 }
115
116
117 static ssize_t
118 stream_write(void *handle, char *buf, size_t size)
119 { stream_context *ctx = handle;
120 fid_t fid = 0;
121 term_t av;
122 int rc;
123
124 if ( !ctx->pred_write )
125 ctx->pred_write = PL_pred(FUNCTOR_stream_write2, ctx->module);
126
127 if ( (fid = PL_open_foreign_frame()) &&
128 (av = PL_new_term_refs(2)) &&
129 PL_unify_stream(av+0, ctx->stream) &&
130 PL_unify_wchars(av+1, PL_STRING, size/sizeof(wchar_t), (wchar_t*)buf) &&
131 PL_call_predicate(ctx->module, PL_Q_NORMAL, ctx->pred_write, av) )
132 { rc = size;
133 } else
134 { term_t ex;
135
136 if ( (ex = PL_exception(0)) )
137 { Sset_exception(ctx->stream, ex);
138 } else
139 { Sseterr(ctx->stream, SIO_FERR, "Prolog write handler failed");
140 }
141
142 rc = -1;
143 }
144
145 if ( fid )
146 PL_close_foreign_frame(fid);
147
148 return rc;
149 }
150
151 static int64_t
152 stream_seek64(void *handle, int64_t pos, int whence)
153 { stream_context *ctx = handle;
154
155 (void)ctx;
156
157 return -1;
158 }
159
160 static int
161 stream_control(void *handle, int op, void *data)
162 { stream_context *ctx = handle;
163
164 (void)ctx;
165 switch(op)
166 { case SIO_FLUSHOUTPUT:
167 return 0;
168 }
169
170 return -1;
171 }
172
173 static int
174 stream_close(void *handle)
175 { stream_context *ctx = handle;
176 fid_t fid = 0;
177 term_t av;
178 int rc;
179 predicate_t pred_close = PL_pred(FUNCTOR_stream_close1, ctx->module);
180
181 if ( (fid = PL_open_foreign_frame()) &&
182 (av = PL_new_term_refs(1)) &&
183 PL_unify_stream(av+0, ctx->stream) &&
184 PL_call_predicate(ctx->module, PL_Q_NORMAL, pred_close, av) )
185 { rc = 0;
186 } else
187 { term_t ex;
188
189 if ( (ex = PL_exception(0)) )
190 { Sset_exception(ctx->stream, ex);
191 } else
192 { Sseterr(ctx->stream, SIO_FERR, "Prolog write handler failed");
193 }
194
195 rc = -1;
196 }
197
198 if ( fid )
199 PL_close_foreign_frame(fid);
200
201 free_stream_context(ctx);
202 return rc;
203 }
204
205 static IOFUNCTIONS stream_functions =
206 { stream_read,
207 stream_write,
208 NULL,
209 stream_close,
210 stream_control,
211 stream_seek64
212 };
213
214 static foreign_t
215 open_prolog_stream(term_t module, term_t mode, term_t stream, term_t options)
216 { IOSTREAM *s;
217 stream_context *ctx;
218 int flags = SIO_TEXT|SIO_RECORDPOS|SIO_FBUF;
219 atom_t a;
220 module_t m;
221
222 if ( !PL_get_atom_ex(mode, &a) )
223 return FALSE;
224 if ( a == ATOM_read )
225 flags |= SIO_INPUT;
226 else if ( a == ATOM_write )
227 flags |= SIO_OUTPUT;
228 else
229 return PL_domain_error("io_mode", mode);
230
231 if ( !PL_get_atom_ex(module, &a) )
232 return FALSE;
233 m = PL_new_module(a);
234
235 ctx = alloc_stream_context();
236 s = Snew(ctx, flags, &stream_functions);
237 ctx->stream = s;
238 ctx->module = m;
239 s->encoding = ENC_WCHAR;
240 s->newline = SIO_NL_POSIX;
241
242 if ( PL_unify_stream(stream, s) )
243 { return TRUE;
244 } else
245 { Sclose(s);
246 return PL_uninstantiation_error(stream);
247 }
248 }
249
250
251 install_t
252 install_prolog_stream(void)
253 { ATOM_read = PL_new_atom("read");
254 ATOM_write = PL_new_atom("write");
255 FUNCTOR_stream_write2 = PL_new_functor(PL_new_atom("stream_write"), 2);
256 FUNCTOR_stream_read2 = PL_new_functor(PL_new_atom("stream_read"), 2);
257 FUNCTOR_stream_close1 = PL_new_functor(PL_new_atom("stream_close"), 1);
258
259 PL_register_foreign("open_prolog_stream", 4, open_prolog_stream, 0);
260 }
0 /* Part of SWI-Prolog
1
2 Author: Jan Wielemaker
3 E-mail: J.Wielemaker@cs.vu.nl
4 WWW: http://www.swi-prolog.org
5 Copyright (C): 2015, VU University Amsterdam
6
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
21 As a special exception, if you link this library with other files,
22 compiled with a Free Software compiler, to produce an executable, this
23 library does not by itself cause the resulting executable to be covered
24 by the GNU General Public License. This exception does not however
25 invalidate any other reasons why the executable file might be covered by
26 the GNU General Public License.
27 */
28
29 :- module(prolog_stream,
30 [ open_prolog_stream/4 % +Module, +Mode, -Stream, +Data
31 ]).
32 :- use_module(library(shlib)).
33 :- use_foreign_library(foreign(prolog_stream)).
34
35 /** <module> A stream with Prolog callbacks
36
37 This library defines a Prolog stream that realises its low-level I/O
38 with callbacks to Prolog. The library was developed to bind normal
39 Prolog I/O to Pengines I/O. This type of I/O redirection is probably the
40 primary use case.
41 */
42
43 %% open_prolog_stream(+Module, +Mode, -Stream, +Options)
44 %
45 % Create a new stream that implements its I/O by calling
46 % predicates in Module. The called predicates are:
47 %
48 % - Module:stream_write(+Stream, +String)
49 % Called for a `Mode = write` stream if data is available.
50 % String contains the (textual) data that is written
51 % to Stream. The callback is called if the buffer of
52 % Stream overflows, the user calls flush_output(Stream)
53 % or Stream is closed and there is buffered data.
54 % - Module:stream_read(+Stream, -Term)
55 % Called for a `Mode == read` stream to get new data. On
56 % success the stream extracts text from the provided Term.
57 % Term is typically a string, atom, code or character list.
58 % If term is not one of the above, it is handed to writeq/1.
59 % To signal end-of-file, unify stream with an empty text,
60 % e.g., `stream_read(Stream, "")`.
61 % - Module:stream_close(+Stream)
62 % Called when the stream is closed. This predicate must
63 % succeed. The callback can be used to cleanup associated
64 % resources.
65 %
66 % The current implementation only deals with text streams. The
67 % stream uses the =wchar_t= encoding. The buffer size must be a
68 % multiple of =wchar_t=, i.e., a multiple of four for portability.
69 % The _newline_ mode of the stream is =posix= on all platforms,
70 % disabling the translation `"\n" --> "\r\n"`.
71 %
72 % @arg Options is currently ignored.
73 % @bug Futher versions might require additional callbacks. As we
74 % demand all callbacks to be defined, existing code needs
75 % to implement the new callbacks.
0 /* $Id$
1
2 Part of SWI-Prolog
0 /* Part of SWI-Prolog
31
42 Author: Jan Wielemaker
5 E-mail: jan@science.uva.nl
3 E-mail: J.Wielemaker@vu.nl
64 WWW: http://www.swi-prolog.org
7 Copyright (C): 1985-2005, University of Amsterdam
5 Copyright (C): 1985-2015, University of Amsterdam
6 VU University Amsterdam
87
98 This program is free software; you can redistribute it and/or
109 modify it under the terms of the GNU General Public License
6362 { int c = Sgetcode(s);
6463
6564 if ( c == EOF )
66 { if ( (s->flags & SIO_FERR) )
65 { if ( Sferror(s) || PL_exception(0) )
6766 goto out; /* error */
6867
6968 if ( tail == 0 && o == buf )
129128 { if ( !PL_release_stream(s) )
130129 return FALSE; /* error */
131130
131 if ( PL_exception(0) )
132 return FALSE;
133
132134 if ( tail )
133135 { if ( PL_unify_wchars_diff(cl, cl, PL_CODE_LIST, o-buf, buf) &&
134136 PL_unify(cl, tail) )
0 :- module(test_stream,
1 [ test_stream/0
2 ]).
3
4 :- asserta(user:file_search_path(foreign, '.')).
5 :- asserta(user:file_search_path(library, '.')).
6 :- asserta(user:file_search_path(library, '../plunit')).
7
8 :- use_module(library(plunit)).
9 :- use_module(library(debug)).
10 :- use_module(prolog_stream).
11
12 test_stream :-
13 run_tests([ prolog_stream
14 ]).
15
16 :- thread_local
17 msg/1,
18 data/2.
19
20 stream_read(Stream, String) :-
21 debug(event, "Got ~q", [stream_read(Stream, String)]),
22 ( retract(data(Stream, String))
23 -> true
24 ; String = ""
25 ),
26 debug(event, "Reply ~q", [stream_read(Stream, String)]).
27
28 stream_write(Stream, String) :-
29 debug(event, "Got ~q", [stream_write(Stream, String)]),
30 assertz(msg(write(Stream, String))).
31
32 stream_close(Stream) :-
33 assertz(msg(close(Stream))).
34
35 messages(Messages) :-
36 findall(Msg, retract(msg(Msg)), Messages).
37
38 set_data(Stream, Data) :-
39 assertz(data(Stream, Data)).
40
41 :- begin_tests(prolog_stream, [sto(rational_trees)]).
42
43 test(write, Messages == [write(Out, "Hello world"), close(Out)]) :-
44 open_prolog_stream(test_stream, write, Out, []),
45 write(Out, 'Hello world'),
46 close(Out),
47 messages(Messages).
48 test(read, Reply == "Hello world") :-
49 open_prolog_stream(test_stream, read, In, []),
50 set_data(In, "Hello world"),
51 read_string(In, _, Reply),
52 close(In).
53
54 :- end_tests(prolog_stream).
Binary diff not shown
Binary diff not shown
3838 mkdir -p $(DESTDIR)$(PKGPLLIBDIR)
3939 mkdir -p $(DESTDIR)$(PKGPLLIBDIR)/web/icons
4040 mkdir -p $(DESTDIR)$(PKGPLLIBDIR)/web/css
41 mkdir -p $(DESTDIR)$(PKGPLLIBDIR)/web/js
4142 $(INSTALL_DATA) $(LIBPL) $(DESTDIR)$(PKGPLLIBDIR)
4243 $(INSTALL_DATA) README $(DESTDIR)$(PKGPLLIBDIR)/README$(TXTEXT)
4344 $(INSTALL_DATA) web/icons/*.png $(DESTDIR)$(PKGPLLIBDIR)/web/icons
4445 $(INSTALL_DATA) web/css/*.css $(DESTDIR)$(PKGPLLIBDIR)/web/css
46 $(INSTALL_DATA) web/js/*.js $(DESTDIR)$(PKGPLLIBDIR)/web/js
4547 $(MKPKGINDEX)
4648 $(MKINDEX)
4749
1212 http_openid.pl js_write.pl js_grammar.pl http_cookie.pl \
1313 http_files.pl http_cors.pl http_unix_daemon.pl \
1414 yadis.pl ax.pl html_quasiquotations.pl http_load.pl \
15 websocket.pl hub.pl http_multipart_plugin.pl
15 websocket.pl hub.pl http_multipart_plugin.pl jquery.pl
1616 EXAMPLES= demo_body.pl demo_client.pl demo_threads.pl demo_xpce.pl \
1717 calc.pl demo_files.pl demo_pwp.pl demo_openid.pl \
1818 demo_daemon.pl
22 Author: Jan Wielemaker
33 E-mail: J.Wielemaker@vu.nl
44 WWW: http://www.swi-prolog.org
5 Copyright (C): 2009-2013, University of Amsterdam
5 Copyright (C): 2009-2015, University of Amsterdam
66 VU University Amsterdam
77
88 This program is free software; you can redistribute it and/or
9898 :- dynamic
9999 html_resource/3. % Resource, Source, Properties
100100 :- multifile
101 html_resource/3.
101 html_resource/3,
102 mime_include//2. % +Mime, +Path
102103
103104 %% html_resource(+About, +Properties) is det.
104105 %
147148 assert_resource(About, -, Properties).
148149
149150 assert_resource(About, Location, Properties) :-
151 retractall(html_resource(About, _, _)),
150152 assert(html_resource(About, Location, Properties)),
151153 clean_cache(About, Properties).
152154
549551 { file_mime_type(Path, Mime) }, !,
550552 html_include(Mime, Path).
551553
554 html_include(Mime, Path) -->
555 mime_include(Mime, Path), !. % user hook
552556 html_include(text/css, Path) --> !,
553557 html(link([ rel(stylesheet),
554558 type('text/css'),
562566 { print_message(warning, html_include(dont_know, Mime, Path))
563567 }.
564568
569 %% mime_include(+Mime, +Path)// is semidet.
570 %
571 % Hook called to include a link to an HTML resource of type Mime
572 % into the HTML head. The Mime type is computed from Path using
573 % file_mime_type/2. If the hook fails, two built-in rules for
574 % `text/css` and `text/javascript` are tried. For example, to
575 % include a =.pl= files as a Prolog script, use:
576 %
577 % ```
578 % :- multifile
579 % html_head:mime_include//2.
580 %
581 % html_head:mime_include(text/'x-prolog', Path) --> !,
582 % html(script([ type('text/x-prolog'),
583 % src(Path)
584 % ], [])).
585 %
586 % ```
565587
566588 /*******************************
567589 * CACHE CLEANUP *
754754 Here is an example:
755755
756756 \begin{code}
757 ?- http_read_request(user, X).
757 ?- http_read_request(user_input, X).
758758 |: GET /mydb?class=person HTTP/1.0
759759 |: Host: gollem
760760 |:
551551 </dl>
552552
553553 <p>The hook <a class="pred" href="#http:open_options/2">http:open_options/2</a>
554 can be used to provide default options based on the broken-down <var>URL</var>.
554 can be used to provide default options based on the broken-down <var>URL</var>.
555 The option
556 <code>status_code(-Code)</code> is particularly useful to query <b>REST</b>
557 interfaces that commonly return status codes other than <code>200</code>
558 that need to be be processed by the client code.
555559 <table class="arglist">
556560 <tr valign="top"><td><var>URL</var> </td><td>is either an atom (url) or
557561 a list of <i>parts</i>. If this list is provided, it may contain the
28042808 <p>Here is an example:
28052809
28062810 <pre class="code">
2807 ?- http_read_request(user, X).
2811 ?- http_read_request(user_input, X).
28082812 |: GET /mydb?class=person HTTP/1.0
28092813 |: Host: gollem
28102814 |:
47874791 Include <var>ResourceOrList</var> and all dependencies derived from it
47884792 and add them to the HTML <code>head</code> using <a class="pred" href="#html_post/2">html_post/2</a>.
47894793 The actual dependencies are computed during the HTML output phase by
4790 <span class="pred-ext">html_insert_resource/3</span>.
4791 </dd>
4794 <span class="pred-ext">html_insert_resource/3</span>.</dd>
4795 <dt class="pubdef"><span class="pred-tag">[semidet,multifile]</span><a name="mime_include/2"><strong>mime_include</strong>(<var>+Mime,
4796 +Path</var>)</a><code>//</code></dt>
4797 <dd class="defbody">
4798 Hook called to include a link to an HTML resource of type <var>Mime</var>
4799 into the HTML head. The <var>Mime</var> type is computed from <var>Path</var>
4800 using
4801 <span class="pred-ext">file_mime_type/2</span>. If the hook fails, two
4802 built-in rules for
4803 <code>text/css</code> and <code>text/javascript</code> are tried. For
4804 example, to include a =.pl= files as a Prolog script, use:
4805
4806 <pre class="code">
4807 :- multifile
4808 html_head:mime_include//2.
4809
4810 html_head:mime_include(text/'x-prolog', Path) --&gt; !,
4811 html(script([ type('text/x-prolog'),
4812 src(Path)
4813 ], [])).
4814 </pre>
4815
4816 <p></dd>
47924817 </dl>
47934818
47944819 <p><h3 id="sec:httppwp"><a name="sec:3.22"><span class="sec-nr">3.22</span> <span class="sec-title">library(http/http_pwp):
60256050 </dl>
60266051
60276052 </dd>
6028 <dt class="multidef"><span class="pred-tag">[semidet,multifile]</span><a name="json_type/1"><strong>json_type</strong>(<var>?MIMEType:atom</var>)</a></dt>
6029 <dd class="defbody">
6030 True if <var>MIMEType</var> is a JSON mimetype. <span class="pred-ext">http_json:json_type/1</span>
6053 <dt class="multidef"><span class="pred-tag">[semidet,multifile]</span><a name="json_type/1"><strong>json_type</strong>(<var>?MediaType</var>)</a></dt>
6054 <dd class="defbody">
6055 True if <var>MediaType</var> is a JSON media type. <span class="pred-ext">http_json:json_type/1</span>
60316056 is a multifile predicate and may be extended to facilitate
6032 non-conforming clients.</dd>
6057 non-conforming clients.
6058 <table class="arglist">
6059 <tr valign="top"><td><var>MediaType</var> </td><td>is a term <var>Type</var>/<var>SubType</var>,
6060 where both <var>Type</var> and
6061 <var>SubType</var> are atoms. </td></tr>
6062 </table>
6063 </dd>
60336064 <dt class="multidef"><span class="pred-tag">[semidet,multifile]</span><a name="http_client:post_data_hook/3"><span class="module">http_client</span>:<strong>post_data_hook</strong>(<var>+Data,
60346065 +Out:stream, +HdrExtra</var>)</a></dt>
60356066 <dd class="defbody">
65756606 <dt>load_structure/3</dt>
65766607 <dd>
65776608 <a class="idx" href="#idx:loadstructure3:14">2.2.2</a> <a class="idx" href="#idx:loadstructure3:15">2.2.2</a> <a class="idx" href="#idx:loadstructure3:16">2.2.2</a></dd>
6609 <dt><a class="idx" href="#mime_include/2">mime_include/2</a></dt>
65786610 <dt><a class="idx" href="#mime_pack/3">mime_pack/3</a></dt>
65796611 <dd>
65806612 <a class="idx" href="#idx:mimepack3:12">2.2</a> <a class="idx" href="#idx:mimepack3:13">2.2</a></dd>
Binary diff not shown
0 /* $Id$
1
2 Part of SWI-Prolog
0 /* Part of SWI-Prolog
31
42 Author: Jan Wielemaker
53 E-mail: J.Wielemaker@cs.vu.nl
64 WWW: http://www.swi-prolog.org
7 Copyright (C): 1985-2011, University of Amsterdam,
5 Copyright (C): 1985-2015, University of Amsterdam,
86 VU University Amsterdam
97
108 This program is free software; you can redistribute it and/or
5654 http_convert_data/4, % http_read_data plugin-hook
5755 post_data_hook/3, % http_post_data/3 hook
5856 open_connection/4, % do_connect/5 hook
59 close_connection/4.
57 close_connection/4,
58 http:open_options/2. % +Parts, -Options (shared with http_open.pl)
6059
6160 :- predicate_options(http_get/3, 3,
6261 [ connection(oneof([close,'Keep-alive'])),
138137 debug(http(client), 'http_client: Connecting to ~p ...', [Address]),
139138 ( open_connection(Protocol, Address, In, Out)
140139 -> true
141 ; tcp_socket(Socket),
142 catch(tcp_connect(Socket, Address, In, Out),
143 E,
144 ( tcp_close_socket(Socket),
145 throw(E)
146 ))
140 ; tcp_connect(Address, StreamPair, []),
141 stream_pair(StreamPair, In, Out)
147142 ),
148143 debug(http(client), '\tok ~p --> ~p', [In, Out]),
149144 ( memberchk(timeout(Timeout), Options)
246241 disconnect(Parts),
247242 fail
248243 )), !.
249 http_get(Parts, Data, Options) :-
244 http_get(Parts, Data, Options0) :-
245 findall(OpenOptions, http:open_options(Parts,OpenOptions), AllOpenOptions),
246 foldl(merge_options_rev, AllOpenOptions, Options0, Options),
250247 address(Parts, Address, Protocol, Options),
251248 do_connect(Address, Protocol, Read, Write, Options),
252249 call_cleanup(http_do_get([socket(Read, Write)|Parts], Data, Options),
254251
255252 http_do_get(Parts, Data, Options) :-
256253 connect(Parts, Read, Write, Options),
257 ( select(proxy(_,_), Options, Options1)
254 ( ( select(proxy(_,_), Options, Options1)
255 ; select(proxy(_:_), Options, Options1)
256 )
258257 -> parse_url(Location, Parts)
259258 ; http_location(Parts, Location),
260259 Options1 = Options
461460 memory_file_to(atom, MemFile, Encoding, Data) :-
462461 memory_file_to_atom(MemFile, Data, Encoding).
463462 memory_file_to(string, MemFile, Encoding, Data) :-
464 memory_file_to_atom(MemFile, Data, Encoding).
463 memory_file_to_string(MemFile, Data, Encoding).
465464 memory_file_to(codes, MemFile, Encoding, Data) :-
466465 memory_file_to_codes(MemFile, Data, Encoding).
467466
519518 ( disconnect(Parts),
520519 fail
521520 )), !.
522 http_post(Parts, In, Out, Options) :-
521 http_post(Parts, In, Out, Options0) :-
522 findall(OpenOptions, http:open_options(Parts,OpenOptions), AllOpenOptions),
523 foldl(merge_options_rev, AllOpenOptions, Options0, Options),
523524 address(Parts, Address, Protocol, Options),
524525 do_connect(Address, Protocol, Read, Write, Options),
525526 call_cleanup(http_do_post([socket(Read, Write)|Parts],
528529
529530 http_do_post(Parts, In, Out, Options) :-
530531 connect(Parts, Read, Write, Options),
531 ( memberchk(proxy(_,_), Options)
532 ( ( select(proxy(_,_), Options, Options1)
533 ; select(proxy(_:_), Options, Options1)
534 )
532535 -> parse_url(Location, Parts)
533 ; http_location(Parts, Location)
536 ; http_location(Parts, Location),
537 Options1 = Options
534538 ),
535539 memberchk(host(Host), Parts),
536 split_options(Options, PostOptions, ReplyOptions),
540 split_options(Options1, PostOptions, ReplyOptions),
537541 write_post_header(Write, Location, Host, In, PostOptions),
538542 http_read_reply(Read, Out, ReplyOptions).
539543
555559 split_options(T, P, R).
556560 split_options([H|T], P, [H|R]) :-
557561 split_options(T, P, R).
562
563 merge_options_rev(Old, New, Merged) :-
564 merge_options(New, Old, Merged).
565
6060 http_client:post_data_hook/3,
6161 json_type/1.
6262
63 :- public
64 json_type/1.
65
6366 :- predicate_options(http_read_json/3, 3,
6467 [ content_type(any),
6568 false(ground),
148151 ).
149152
150153
151 is_json_type(Type) :-
154 is_json_type(String) :-
155 http_parse_header_value(content_type, String,
156 media(Type, _Attributes)),
152157 json_type(Type), !.
153 is_json_type(ContentType) :-
154 json_type(Type),
155 sub_atom(ContentType, 0, _, _, Type), !,
156 strip_utf8(ContentType, Plain),
157 json_type(Plain).
158158
159159 :- if(current_predicate(is_dict/1)).
160160 json_read_to(In, Data, Options) :-
164164 json_read_to(In, Data, Options) :-
165165 json_read(In, Data, Options).
166166
167 %% strip_utf8(+ContentTypeIn, -ContentType) is det.
168 %
169 % Strip an optional =|; charset=UTF-8|=. JSON data is always
170 % UTF-8, but some clients seem to insist in sending this.
171
172 strip_utf8(ContentType, Plain) :-
173 sub_atom(ContentType, B, _, A, ;),
174 sub_atom(ContentType, _, A, 0, Ext),
175 normalize_space(atom(Charset), Ext),
176 downcase_atom(Charset, 'charset=utf-8'), !,
177 sub_atom(ContentType, 0, B, _, CT),
178 normalize_space(atom(Plain), CT).
179 strip_utf8(ContentType, ContentType).
180
181
182 %% json_type(?MIMEType:atom) is semidet.
183 %
184 % True if MIMEType is a JSON mimetype. http_json:json_type/1 is a
185 % multifile predicate and may be extended to facilitate
167 %% json_type(?MediaType) is semidet.
168 %
169 % True if MediaType is a JSON media type. http_json:json_type/1 is
170 % a multifile predicate and may be extended to facilitate
186171 % non-conforming clients.
187
188 json_type('application/jsonrequest').
189 json_type('application/json').
172 %
173 % @arg MediaType is a term `Type`/`SubType`, where both `Type` and
174 % `SubType` are atoms.
175
176 json_type(application/jsonrequest).
177 json_type(application/json).
190178
191179
192180 %% http_client:post_data_hook(+Data, +Out:stream, +HdrExtra) is semidet.
237237 % Defines the value of the =|User-Agent|= field of the HTTP
238238 % header. Default is =SWI-Prolog=.
239239 %
240 % The hook http:open_options/2 can be used to provide default
241 % options based on the broken-down URL.
240 % The hook http:open_options/2 can be used to provide default
241 % options based on the broken-down URL. The option
242 % status_code(-Code) is particularly useful to query *REST*
243 % interfaces that commonly return status codes other than `200`
244 % that need to be be processed by the client code.
242245 %
243246 % @param URL is either an atom (url) or a list of _parts_.
244247 % If this list is provided, it may contain the fields
0 /* Part of SWI-Prolog
1
2 Author: Jan Wielemaker
3 E-mail: J.Wielemaker@cs.vu.nl
4 WWW: http://www.swi-prolog.org
5 Copyright (C): 2015, VU University Amsterdam
6
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
21 As a special exception, if you link this library with other files,
22 compiled with a Free Software compiler, to produce an executable, this
23 library does not by itself cause the resulting executable to be covered
24 by the GNU General Public License. This exception does not however
25 invalidate any other reasons why the executable file might be covered by
26 the GNU General Public License.
27 */
28
29 :- module(jquery, []).
30 :- use_module(library(http/html_head)).
31 :- use_module(library(http/http_server_files)).
32 :- use_module(library(settings)).
33 :- use_module(library(broadcast)).
34
35 :- setting(version, atom, '1.11.3.min',
36 'Version of jquery served by the html resource "jquery"').
37
38 /** <module> Provide JQuery
39
40 This module provides the HTML resource `jquery`. To get the default
41 version of jquery included in a web page, make sure this file is loaded
42 and include the following into the HTML generation DCG.
43
44 ==
45 html_requires(jquery),
46 ==
47
48 The file served is determined by the setting `jquery:version` and loaded
49 from the file search path `js`, the default for which is provided by
50 library(http/http_server_files).
51
52 Note that including jquery into the HTTP infrastructure is not ideal.
53 However, components, such as PlDoc and Pengines as well as user
54 applications require jquery, causing this JavaScript to be installed in
55 many places. That is even worse.
56
57 # Using your own copy
58
59 To use your own copy of jquery, add your jquery file to a directory in
60 the `js` file search path (see file_search_path/2 and
61 absolute_file_name/3) and set `jquery:version` to the file version you
62 provided. Alternatively, you can define the html resource `jquery`
63 before loading this file.
64 */
65
66 register_jquery :-
67 setting(version, Version),
68 atomic_list_concat(['jquery-', Version, '.js'], JQuery),
69 html_resource(jquery,
70 [ virtual(true),
71 requires([ js(JQuery)
72 ])
73 ]).
74
75 :- if(\+html_current_resource(jquery)).
76 :- initialization register_jquery.
77 :- listen(settings(changed(jquery:version, _, _)),
78 register_jquery).
79 :- endif.
80
841841 'pool that fits the usage-profile.'
842842 ].
843843
844 http_root(Host:Port) --> !,
845 http_scheme(Host:Port),
846 { http_absolute_location(root(.), URI, []) },
847 [ '~w:~w~w'-[Host, Port, URI] ].
844848 http_root(Port) -->
845849 http_scheme(Port),
846850 { http_absolute_location(root(.), URI, []) },
0 /*! jQuery v1.11.3 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */
1 !function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.3",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b="length"in a&&a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,aa=/[+~]/,ba=/'|\\/g,ca=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),da=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ea=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fa){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(ba,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+ra(o[l]);w=aa.test(a)&&pa(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",ea,!1):e.attachEvent&&e.attachEvent("onunload",ea)),p=!f(g),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\f]' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?la(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ca,da),a[3]=(a[3]||a[4]||a[5]||"").replace(ca,da),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ca,da).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(ca,da),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return W.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(ca,da).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:oa(function(){return[0]}),last:oa(function(a,b){return[b-1]}),eq:oa(function(a,b,c){return[0>c?c+b:c]}),even:oa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:oa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:oa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:oa(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=ma(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=na(b);function qa(){}qa.prototype=d.filters=d.pseudos,d.setFilters=new qa,g=ga.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?ga.error(a):z(a,i).slice(0)};function ra(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function sa(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function ta(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ua(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function va(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wa(a,b,c,d,e,f){return d&&!d[u]&&(d=wa(d)),e&&!e[u]&&(e=wa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ua(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:va(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=va(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=va(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sa(function(a){return a===b},h,!0),l=sa(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sa(ta(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wa(i>1&&ta(m),i>1&&ra(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xa(a.slice(i,e)),f>e&&xa(a=a.slice(e)),f>e&&ra(a))}m.push(c)}return ta(m)}function ya(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=va(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&ga.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,ya(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ca,da),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ca,da),aa.test(j[0].type)&&pa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&ra(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,aa.test(a)&&pa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ja(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;
2
3 return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?m.queue(this[0],a):void 0===b?this:this.each(function(){var c=m.queue(this,a,b);m._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&m.dequeue(this,a)})},dequeue:function(a){return this.each(function(){m.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=m.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=m._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=["Top","Right","Bottom","Left"],U=function(a,b){return a=b||a,"none"===m.css(a,"display")||!m.contains(a.ownerDocument,a)},V=m.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===m.type(c)){e=!0;for(h in c)m.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,m.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(m(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav></:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function aa(){return!0}function ba(){return!1}function ca(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[m.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=Z.test(e)?this.mouseHooks:Y.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new m.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||y),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button,g=b.fromElement;return null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||y,e=d.documentElement,c=d.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==ca()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===ca()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return m.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return m.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=m.extend(new m.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?m.event.trigger(e,null,b):m.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},m.removeEvent=y.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===K&&(a[d]=null),a.detachEvent(d,c))},m.Event=function(a,b){return this instanceof m.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?aa:ba):this.type=a,b&&m.extend(this,b),this.timeStamp=a&&a.timeStamp||m.now(),void(this[m.expando]=!0)):new m.Event(a,b)},m.Event.prototype={isDefaultPrevented:ba,isPropagationStopped:ba,isImmediatePropagationStopped:ba,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=aa,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=aa,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=aa,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},m.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){m.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!m.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.submitBubbles||(m.event.special.submit={setup:function(){return m.nodeName(this,"form")?!1:void m.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=m.nodeName(b,"input")||m.nodeName(b,"button")?b.form:void 0;c&&!m._data(c,"submitBubbles")&&(m.event.add(c,"submit._submit",function(a){a._submit_bubble=!0}),m._data(c,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&m.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return m.nodeName(this,"form")?!1:void m.event.remove(this,"._submit")}}),k.changeBubbles||(m.event.special.change={setup:function(){return X.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(m.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),m.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),m.event.simulate("change",this,a,!0)})),!1):void m.event.add(this,"beforeactivate._change",function(a){var b=a.target;X.test(b.nodeName)&&!m._data(b,"changeBubbles")&&(m.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||m.event.simulate("change",this.parentNode,a,!0)}),m._data(b,"changeBubbles",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return m.event.remove(this,"._change"),!X.test(this.nodeName)}}),k.focusinBubbles||m.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){m.event.simulate(b,a.target,m.event.fix(a),!0)};m.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=m._data(d,b);e||d.addEventListener(a,c,!0),m._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=m._data(d,b)-1;e?m._data(d,b,e):(d.removeEventListener(a,c,!0),m._removeData(d,b))}}}),m.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(f in a)this.on(f,b,c,a[f],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=ba;else if(!d)return this;return 1===e&&(g=d,d=function(a){return m().off(a),g.apply(this,arguments)},d.guid=g.guid||(g.guid=m.guid++)),this.each(function(){m.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,m(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=ba),this.each(function(){m.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){m.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?m.event.trigger(a,b,c,!0):void 0}});function da(a){var b=ea.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}var ea="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",fa=/ jQuery\d+="(?:null|\d+)"/g,ga=new RegExp("<(?:"+ea+")[\\s/>]","i"),ha=/^\s+/,ia=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ja=/<([\w:]+)/,ka=/<tbody/i,la=/<|&#?\w+;/,ma=/<(?:script|style|link)/i,na=/checked\s*(?:[^=]|=\s*.checked.)/i,oa=/^$|\/(?:java|ecma)script/i,pa=/^true\/(.*)/,qa=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ra={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:k.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},sa=da(y),ta=sa.appendChild(y.createElement("div"));ra.optgroup=ra.option,ra.tbody=ra.tfoot=ra.colgroup=ra.caption=ra.thead,ra.th=ra.td;function ua(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ua(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function va(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wa(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xa(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function ya(a){var b=pa.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function za(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Aa(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Ba(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xa(b).text=a.text,ya(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!ga.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(ta.innerHTML=a.outerHTML,ta.removeChild(f=ta.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ua(f),h=ua(a),g=0;null!=(e=h[g]);++g)d[g]&&Ba(e,d[g]);if(b)if(c)for(h=h||ua(a),d=d||ua(f),g=0;null!=(e=h[g]);g++)Aa(e,d[g]);else Aa(a,f);return d=ua(f,"script"),d.length>0&&za(d,!i&&ua(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=da(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(la.test(f)){h=h||o.appendChild(b.createElement("div")),i=(ja.exec(f)||["",""])[1].toLowerCase(),l=ra[i]||ra._default,h.innerHTML=l[1]+f.replace(ia,"<$1></$2>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&ha.test(f)&&p.push(b.createTextNode(ha.exec(f)[0])),!k.tbody){f="table"!==i||ka.test(f)?"<table>"!==l[1]||ka.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ua(p,"input"),va),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ua(o.appendChild(f),"script"),g&&za(h),c)){e=0;while(f=h[e++])oa.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ua(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&za(ua(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ua(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fa,""):void 0;if(!("string"!=typeof a||ma.test(a)||!k.htmlSerialize&&ga.test(a)||!k.leadingWhitespace&&ha.test(a)||ra[(ja.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ia,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ua(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ua(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&na.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ua(i,"script"),xa),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ua(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,ya),j=0;f>j;j++)d=g[j],oa.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qa,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Ca,Da={};function Ea(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fa(a){var b=y,c=Da[a];return c||(c=Ea(a,b),"none"!==c&&c||(Ca=(Ca||m("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Ca[0].contentWindow||Ca[0].contentDocument).document,b.write(),b.close(),c=Ea(a,b),Ca.detach()),Da[a]=c),c}!function(){var a;k.shrinkWrapBlocks=function(){if(null!=a)return a;a=!1;var b,c,d;return c=y.getElementsByTagName("body")[0],c&&c.style?(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",b.appendChild(y.createElement("div")).style.width="5px",a=3!==b.offsetWidth),c.removeChild(d),a):void 0}}();var Ga=/^margin/,Ha=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ia,Ja,Ka=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ia=function(b){return b.ownerDocument.defaultView.opener?b.ownerDocument.defaultView.getComputedStyle(b,null):a.getComputedStyle(b,null)},Ja=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ia(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||m.contains(a.ownerDocument,a)||(g=m.style(a,b)),Ha.test(g)&&Ga.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+""}):y.documentElement.currentStyle&&(Ia=function(a){return a.currentStyle},Ja=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ia(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Ha.test(g)&&!Ka.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function La(a,b){return{get:function(){var c=a();if(null!=c)return c?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d,e,f,g,h;if(b=y.createElement("div"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=d&&d.style){c.cssText="float:left;opacity:.5",k.opacity="0.5"===c.opacity,k.cssFloat=!!c.cssFloat,b.style.backgroundClip="content-box",b.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===b.style.backgroundClip,k.boxSizing=""===c.boxSizing||""===c.MozBoxSizing||""===c.WebkitBoxSizing,m.extend(k,{reliableHiddenOffsets:function(){return null==g&&i(),g},boxSizingReliable:function(){return null==f&&i(),f},pixelPosition:function(){return null==e&&i(),e},reliableMarginRight:function(){return null==h&&i(),h}});function i(){var b,c,d,i;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),b.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",e=f=!1,h=!0,a.getComputedStyle&&(e="1%"!==(a.getComputedStyle(b,null)||{}).top,f="4px"===(a.getComputedStyle(b,null)||{width:"4px"}).width,i=b.appendChild(y.createElement("div")),i.style.cssText=b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",i.style.marginRight=i.style.width="0",b.style.width="1px",h=!parseFloat((a.getComputedStyle(i,null)||{}).marginRight),b.removeChild(i)),b.innerHTML="<table><tr><td></td><td>t</td></tr></table>",i=b.getElementsByTagName("td"),i[0].style.cssText="margin:0;border:0;padding:0;display:none",g=0===i[0].offsetHeight,g&&(i[0].style.display="",i[1].style.display="none",g=0===i[0].offsetHeight),c.removeChild(d))}}}(),m.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var Ma=/alpha\([^)]*\)/i,Na=/opacity\s*=\s*([^)]*)/,Oa=/^(none|table(?!-c[ea]).+)/,Pa=new RegExp("^("+S+")(.*)$","i"),Qa=new RegExp("^([+-])=("+S+")","i"),Ra={position:"absolute",visibility:"hidden",display:"block"},Sa={letterSpacing:"0",fontWeight:"400"},Ta=["Webkit","O","Moz","ms"];function Ua(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Ta.length;while(e--)if(b=Ta[e]+c,b in a)return b;return d}function Va(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=m._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&U(d)&&(f[g]=m._data(d,"olddisplay",Fa(d.nodeName)))):(e=U(d),(c&&"none"!==c||!e)&&m._data(d,"olddisplay",e?c:m.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function Wa(a,b,c){var d=Pa.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Xa(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=m.css(a,c+T[f],!0,e)),d?("content"===c&&(g-=m.css(a,"padding"+T[f],!0,e)),"margin"!==c&&(g-=m.css(a,"border"+T[f]+"Width",!0,e))):(g+=m.css(a,"padding"+T[f],!0,e),"padding"!==c&&(g+=m.css(a,"border"+T[f]+"Width",!0,e)));return g}function Ya(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ia(a),g=k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Ja(a,b,f),(0>e||null==e)&&(e=a.style[b]),Ha.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Xa(a,b,c||(g?"border":"content"),d,f)+"px"}m.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Ja(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":k.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=m.camelCase(b),i=a.style;if(b=m.cssProps[h]||(m.cssProps[h]=Ua(i,h)),g=m.cssHooks[b]||m.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=Qa.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(m.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||m.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=m.camelCase(b);return b=m.cssProps[h]||(m.cssProps[h]=Ua(a.style,h)),g=m.cssHooks[b]||m.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Ja(a,b,d)),"normal"===f&&b in Sa&&(f=Sa[b]),""===c||c?(e=parseFloat(f),c===!0||m.isNumeric(e)?e||0:f):f}}),m.each(["height","width"],function(a,b){m.cssHooks[b]={get:function(a,c,d){return c?Oa.test(m.css(a,"display"))&&0===a.offsetWidth?m.swap(a,Ra,function(){return Ya(a,b,d)}):Ya(a,b,d):void 0},set:function(a,c,d){var e=d&&Ia(a);return Wa(a,c,d?Xa(a,b,d,k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,e),e):0)}}}),k.opacity||(m.cssHooks.opacity={get:function(a,b){return Na.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=m.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===m.trim(f.replace(Ma,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Ma.test(f)?f.replace(Ma,e):f+" "+e)}}),m.cssHooks.marginRight=La(k.reliableMarginRight,function(a,b){return b?m.swap(a,{display:"inline-block"},Ja,[a,"marginRight"]):void 0}),m.each({margin:"",padding:"",border:"Width"},function(a,b){m.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+T[d]+b]=f[d]||f[d-2]||f[0];return e}},Ga.test(a)||(m.cssHooks[a+b].set=Wa)}),m.fn.extend({css:function(a,b){return V(this,function(a,b,c){var d,e,f={},g=0;if(m.isArray(b)){for(d=Ia(a),e=b.length;e>g;g++)f[b[g]]=m.css(a,b[g],!1,d);return f}return void 0!==c?m.style(a,b,c):m.css(a,b)},a,b,arguments.length>1)},show:function(){return Va(this,!0)},hide:function(){return Va(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){U(this)?m(this).show():m(this).hide()})}});function Za(a,b,c,d,e){
4 return new Za.prototype.init(a,b,c,d,e)}m.Tween=Za,Za.prototype={constructor:Za,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(m.cssNumber[c]?"":"px")},cur:function(){var a=Za.propHooks[this.prop];return a&&a.get?a.get(this):Za.propHooks._default.get(this)},run:function(a){var b,c=Za.propHooks[this.prop];return this.options.duration?this.pos=b=m.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Za.propHooks._default.set(this),this}},Za.prototype.init.prototype=Za.prototype,Za.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=m.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){m.fx.step[a.prop]?m.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[m.cssProps[a.prop]]||m.cssHooks[a.prop])?m.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Za.propHooks.scrollTop=Za.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},m.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},m.fx=Za.prototype.init,m.fx.step={};var $a,_a,ab=/^(?:toggle|show|hide)$/,bb=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),cb=/queueHooks$/,db=[ib],eb={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=bb.exec(b),f=e&&e[3]||(m.cssNumber[a]?"":"px"),g=(m.cssNumber[a]||"px"!==f&&+d)&&bb.exec(m.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,m.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function fb(){return setTimeout(function(){$a=void 0}),$a=m.now()}function gb(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=T[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function hb(a,b,c){for(var d,e=(eb[b]||[]).concat(eb["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ib(a,b,c){var d,e,f,g,h,i,j,l,n=this,o={},p=a.style,q=a.nodeType&&U(a),r=m._data(a,"fxshow");c.queue||(h=m._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,n.always(function(){n.always(function(){h.unqueued--,m.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=m.css(a,"display"),l="none"===j?m._data(a,"olddisplay")||Fa(a.nodeName):j,"inline"===l&&"none"===m.css(a,"float")&&(k.inlineBlockNeedsLayout&&"inline"!==Fa(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",k.shrinkWrapBlocks()||n.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],ab.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||m.style(a,d)}else j=void 0;if(m.isEmptyObject(o))"inline"===("none"===j?Fa(a.nodeName):j)&&(p.display=j);else{r?"hidden"in r&&(q=r.hidden):r=m._data(a,"fxshow",{}),f&&(r.hidden=!q),q?m(a).show():n.done(function(){m(a).hide()}),n.done(function(){var b;m._removeData(a,"fxshow");for(b in o)m.style(a,b,o[b])});for(d in o)g=hb(q?r[d]:0,d,n),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function jb(a,b){var c,d,e,f,g;for(c in a)if(d=m.camelCase(c),e=b[d],f=a[c],m.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=m.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function kb(a,b,c){var d,e,f=0,g=db.length,h=m.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=$a||fb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:m.extend({},b),opts:m.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:$a||fb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=m.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(jb(k,j.opts.specialEasing);g>f;f++)if(d=db[f].call(j,a,k,j.opts))return d;return m.map(k,hb,j),m.isFunction(j.opts.start)&&j.opts.start.call(a,j),m.fx.timer(m.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}m.Animation=m.extend(kb,{tweener:function(a,b){m.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],eb[c]=eb[c]||[],eb[c].unshift(b)},prefilter:function(a,b){b?db.unshift(a):db.push(a)}}),m.speed=function(a,b,c){var d=a&&"object"==typeof a?m.extend({},a):{complete:c||!c&&b||m.isFunction(a)&&a,duration:a,easing:c&&b||b&&!m.isFunction(b)&&b};return d.duration=m.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in m.fx.speeds?m.fx.speeds[d.duration]:m.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){m.isFunction(d.old)&&d.old.call(this),d.queue&&m.dequeue(this,d.queue)},d},m.fn.extend({fadeTo:function(a,b,c,d){return this.filter(U).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=m.isEmptyObject(a),f=m.speed(b,c,d),g=function(){var b=kb(this,m.extend({},a),f);(e||m._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=m.timers,g=m._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&cb.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&m.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=m._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=m.timers,g=d?d.length:0;for(c.finish=!0,m.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),m.each(["toggle","show","hide"],function(a,b){var c=m.fn[b];m.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(gb(b,!0),a,d,e)}}),m.each({slideDown:gb("show"),slideUp:gb("hide"),slideToggle:gb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){m.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),m.timers=[],m.fx.tick=function(){var a,b=m.timers,c=0;for($a=m.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||m.fx.stop(),$a=void 0},m.fx.timer=function(a){m.timers.push(a),a()?m.fx.start():m.timers.pop()},m.fx.interval=13,m.fx.start=function(){_a||(_a=setInterval(m.fx.tick,m.fx.interval))},m.fx.stop=function(){clearInterval(_a),_a=null},m.fx.speeds={slow:600,fast:200,_default:400},m.fn.delay=function(a,b){return a=m.fx?m.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a,b,c,d,e;b=y.createElement("div"),b.setAttribute("className","t"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=y.createElement("select"),e=c.appendChild(y.createElement("option")),a=b.getElementsByTagName("input")[0],d.style.cssText="top:1px",k.getSetAttribute="t"!==b.className,k.style=/top/.test(d.getAttribute("style")),k.hrefNormalized="/a"===d.getAttribute("href"),k.checkOn=!!a.value,k.optSelected=e.selected,k.enctype=!!y.createElement("form").enctype,c.disabled=!0,k.optDisabled=!e.disabled,a=y.createElement("input"),a.setAttribute("value",""),k.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),k.radioValue="t"===a.value}();var lb=/\r/g;m.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=m.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,m(this).val()):a,null==e?e="":"number"==typeof e?e+="":m.isArray(e)&&(e=m.map(e,function(a){return null==a?"":a+""})),b=m.valHooks[this.type]||m.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=m.valHooks[e.type]||m.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(lb,""):null==c?"":c)}}}),m.extend({valHooks:{option:{get:function(a){var b=m.find.attr(a,"value");return null!=b?b:m.trim(m.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&m.nodeName(c.parentNode,"optgroup"))){if(b=m(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=m.makeArray(b),g=e.length;while(g--)if(d=e[g],m.inArray(m.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),m.each(["radio","checkbox"],function(){m.valHooks[this]={set:function(a,b){return m.isArray(b)?a.checked=m.inArray(m(a).val(),b)>=0:void 0}},k.checkOn||(m.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var mb,nb,ob=m.expr.attrHandle,pb=/^(?:checked|selected)$/i,qb=k.getSetAttribute,rb=k.input;m.fn.extend({attr:function(a,b){return V(this,m.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){m.removeAttr(this,a)})}}),m.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===K?m.prop(a,b,c):(1===f&&m.isXMLDoc(a)||(b=b.toLowerCase(),d=m.attrHooks[b]||(m.expr.match.bool.test(b)?nb:mb)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=m.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void m.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=m.propFix[c]||c,m.expr.match.bool.test(c)?rb&&qb||!pb.test(c)?a[d]=!1:a[m.camelCase("default-"+c)]=a[d]=!1:m.attr(a,c,""),a.removeAttribute(qb?c:d)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&m.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),nb={set:function(a,b,c){return b===!1?m.removeAttr(a,c):rb&&qb||!pb.test(c)?a.setAttribute(!qb&&m.propFix[c]||c,c):a[m.camelCase("default-"+c)]=a[c]=!0,c}},m.each(m.expr.match.bool.source.match(/\w+/g),function(a,b){var c=ob[b]||m.find.attr;ob[b]=rb&&qb||!pb.test(b)?function(a,b,d){var e,f;return d||(f=ob[b],ob[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,ob[b]=f),e}:function(a,b,c){return c?void 0:a[m.camelCase("default-"+b)]?b.toLowerCase():null}}),rb&&qb||(m.attrHooks.value={set:function(a,b,c){return m.nodeName(a,"input")?void(a.defaultValue=b):mb&&mb.set(a,b,c)}}),qb||(mb={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},ob.id=ob.name=ob.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},m.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:mb.set},m.attrHooks.contenteditable={set:function(a,b,c){mb.set(a,""===b?!1:b,c)}},m.each(["width","height"],function(a,b){m.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),k.style||(m.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var sb=/^(?:input|select|textarea|button|object)$/i,tb=/^(?:a|area)$/i;m.fn.extend({prop:function(a,b){return V(this,m.prop,a,b,arguments.length>1)},removeProp:function(a){return a=m.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),m.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!m.isXMLDoc(a),f&&(b=m.propFix[b]||b,e=m.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=m.find.attr(a,"tabindex");return b?parseInt(b,10):sb.test(a.nodeName)||tb.test(a.nodeName)&&a.href?0:-1}}}}),k.hrefNormalized||m.each(["href","src"],function(a,b){m.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),k.optSelected||(m.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),m.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){m.propFix[this.toLowerCase()]=this}),k.enctype||(m.propFix.enctype="encoding");var ub=/[\t\r\n\f]/g;m.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j="string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ub," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=m.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||"string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ub," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?m.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(m.isFunction(a)?function(c){m(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=m(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===K||"boolean"===c)&&(this.className&&m._data(this,"__className__",this.className),this.className=this.className||a===!1?"":m._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(ub," ").indexOf(b)>=0)return!0;return!1}}),m.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){m.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),m.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var vb=m.now(),wb=/\?/,xb=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;m.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=m.trim(b+"");return e&&!m.trim(e.replace(xb,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():m.error("Invalid JSON: "+b)},m.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||m.error("Invalid XML: "+b),c};var yb,zb,Ab=/#.*$/,Bb=/([?&])_=[^&]*/,Cb=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Db=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Eb=/^(?:GET|HEAD)$/,Fb=/^\/\//,Gb=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Hb={},Ib={},Jb="*/".concat("*");try{zb=location.href}catch(Kb){zb=y.createElement("a"),zb.href="",zb=zb.href}yb=Gb.exec(zb.toLowerCase())||[];function Lb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(m.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Mb(a,b,c,d){var e={},f=a===Ib;function g(h){var i;return e[h]=!0,m.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Nb(a,b){var c,d,e=m.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&m.extend(!0,a,c),a}function Ob(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Pb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}m.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:zb,type:"GET",isLocal:Db.test(yb[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Jb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":m.parseJSON,"text xml":m.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Nb(Nb(a,m.ajaxSettings),b):Nb(m.ajaxSettings,a)},ajaxPrefilter:Lb(Hb),ajaxTransport:Lb(Ib),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=m.ajaxSetup({},b),l=k.context||k,n=k.context&&(l.nodeType||l.jquery)?m(l):m.event,o=m.Deferred(),p=m.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!j){j={};while(b=Cb.exec(f))j[b[1].toLowerCase()]=b[2]}b=j[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return i&&i.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||zb)+"").replace(Ab,"").replace(Fb,yb[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=m.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(c=Gb.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===yb[1]&&c[2]===yb[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(yb[3]||("http:"===yb[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=m.param(k.data,k.traditional)),Mb(Hb,k,b,v),2===t)return v;h=m.event&&k.global,h&&0===m.active++&&m.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!Eb.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(wb.test(e)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=Bb.test(e)?e.replace(Bb,"$1_="+vb++):e+(wb.test(e)?"&":"?")+"_="+vb++)),k.ifModified&&(m.lastModified[e]&&v.setRequestHeader("If-Modified-Since",m.lastModified[e]),m.etag[e]&&v.setRequestHeader("If-None-Match",m.etag[e])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+Jb+"; q=0.01":""):k.accepts["*"]);for(d in k.headers)v.setRequestHeader(d,k.headers[d]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(d in{success:1,error:1,complete:1})v[d](k[d]);if(i=Mb(Ib,k,b,v)){v.readyState=1,h&&n.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,i.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,c,d){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),i=void 0,f=d||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,c&&(u=Ob(k,v,c)),u=Pb(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(m.lastModified[e]=w),w=v.getResponseHeader("etag"),w&&(m.etag[e]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,h&&n.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),h&&(n.trigger("ajaxComplete",[v,k]),--m.active||m.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return m.get(a,b,c,"json")},getScript:function(a,b){return m.get(a,void 0,b,"script")}}),m.each(["get","post"],function(a,b){m[b]=function(a,c,d,e){return m.isFunction(c)&&(e=e||d,d=c,c=void 0),m.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),m._evalUrl=function(a){return m.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},m.fn.extend({wrapAll:function(a){if(m.isFunction(a))return this.each(function(b){m(this).wrapAll(a.call(this,b))});if(this[0]){var b=m(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(m.isFunction(a)?function(b){m(this).wrapInner(a.call(this,b))}:function(){var b=m(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=m.isFunction(a);return this.each(function(c){m(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){m.nodeName(this,"body")||m(this).replaceWith(this.childNodes)}).end()}}),m.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!k.reliableHiddenOffsets()&&"none"===(a.style&&a.style.display||m.css(a,"display"))},m.expr.filters.visible=function(a){return!m.expr.filters.hidden(a)};var Qb=/%20/g,Rb=/\[\]$/,Sb=/\r?\n/g,Tb=/^(?:submit|button|image|reset|file)$/i,Ub=/^(?:input|select|textarea|keygen)/i;function Vb(a,b,c,d){var e;if(m.isArray(b))m.each(b,function(b,e){c||Rb.test(a)?d(a,e):Vb(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==m.type(b))d(a,b);else for(e in b)Vb(a+"["+e+"]",b[e],c,d)}m.param=function(a,b){var c,d=[],e=function(a,b){b=m.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=m.ajaxSettings&&m.ajaxSettings.traditional),m.isArray(a)||a.jquery&&!m.isPlainObject(a))m.each(a,function(){e(this.name,this.value)});else for(c in a)Vb(c,a[c],b,e);return d.join("&").replace(Qb,"+")},m.fn.extend({serialize:function(){return m.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=m.prop(this,"elements");return a?m.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!m(this).is(":disabled")&&Ub.test(this.nodeName)&&!Tb.test(a)&&(this.checked||!W.test(a))}).map(function(a,b){var c=m(this).val();return null==c?null:m.isArray(c)?m.map(c,function(a){return{name:b.name,value:a.replace(Sb,"\r\n")}}):{name:b.name,value:c.replace(Sb,"\r\n")}}).get()}}),m.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&Zb()||$b()}:Zb;var Wb=0,Xb={},Yb=m.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in Xb)Xb[a](void 0,!0)}),k.cors=!!Yb&&"withCredentials"in Yb,Yb=k.ajax=!!Yb,Yb&&m.ajaxTransport(function(a){if(!a.crossDomain||k.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Wb;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+"");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete Xb[g],b=void 0,f.onreadystatechange=m.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,"string"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=""}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=Xb[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function Zb(){try{return new a.XMLHttpRequest}catch(b){}}function $b(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}m.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return m.globalEval(a),a}}}),m.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),m.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=y.head||m("head")[0]||y.documentElement;return{send:function(d,e){b=y.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||e(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var _b=[],ac=/(=)\?(?=&|$)|\?\?/;m.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=_b.pop()||m.expando+"_"+vb++;return this[a]=!0,a}}),m.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(ac.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&ac.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=m.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(ac,"$1"+e):b.jsonp!==!1&&(b.url+=(wb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||m.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,_b.push(e)),g&&m.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),m.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||y;var d=u.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=m.buildFragment([a],b,e),e&&e.length&&m(e).remove(),m.merge([],d.childNodes))};var bc=m.fn.load;m.fn.load=function(a,b,c){if("string"!=typeof a&&bc)return bc.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=m.trim(a.slice(h,a.length)),a=a.slice(0,h)),m.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(f="POST"),g.length>0&&m.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){e=arguments,g.html(d?m("<div>").append(m.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},m.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){m.fn[b]=function(a){return this.on(b,a)}}),m.expr.filters.animated=function(a){return m.grep(m.timers,function(b){return a===b.elem}).length};var cc=a.document.documentElement;function dc(a){return m.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}m.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=m.css(a,"position"),l=m(a),n={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=m.css(a,"top"),i=m.css(a,"left"),j=("absolute"===k||"fixed"===k)&&m.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),m.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(n.top=b.top-h.top+g),null!=b.left&&(n.left=b.left-h.left+e),"using"in b?b.using.call(a,n):l.css(n)}},m.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){m.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,m.contains(b,e)?(typeof e.getBoundingClientRect!==K&&(d=e.getBoundingClientRect()),c=dc(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===m.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),m.nodeName(a[0],"html")||(c=a.offset()),c.top+=m.css(a[0],"borderTopWidth",!0),c.left+=m.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-m.css(d,"marginTop",!0),left:b.left-c.left-m.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||cc;while(a&&!m.nodeName(a,"html")&&"static"===m.css(a,"position"))a=a.offsetParent;return a||cc})}}),m.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);m.fn[a]=function(d){return V(this,function(a,d,e){var f=dc(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?m(f).scrollLeft():e,c?e:m(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),m.each(["top","left"],function(a,b){m.cssHooks[b]=La(k.pixelPosition,function(a,c){return c?(c=Ja(a,b),Ha.test(c)?m(a).position()[b]+"px":c):void 0})}),m.each({Height:"height",Width:"width"},function(a,b){m.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){m.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return V(this,function(b,c,d){var e;return m.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?m.css(b,c,g):m.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),m.fn.size=function(){return this.length},m.fn.andSelf=m.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return m});var ec=a.jQuery,fc=a.$;return m.noConflict=function(b){return a.$===m&&(a.$=fc),b&&a.jQuery===m&&(a.jQuery=ec),m},typeof b===K&&(a.jQuery=a.$=m),m});
3333 jpl.bbl
3434 jpl.blg
3535 src/java/Makefile
36 src/java/.class-senitel
3637 jpltest.jar
3738 jpldoc.tex
3839 *.$$$
7272 ################################################################
7373
7474 DOCDIRS= . ./java_api ./java_api/javadoc ./java_api/javadoc/jpl \
75 ./java_api/javadoc/jpl/class-use \
76 ./java_api/javadoc/jpl/fli \
77 ./java_api/javadoc/jpl/fli/class-use \
75 ./java_api/javadoc/org/jpl7 \
76 ./java_api/javadoc/org/jpl7/fli \
7877 ./java_api/javadoc/resources \
7978 ./prolog_api \
8079 ./prolog_api/overview
46984698 case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
46994699
47004700
4701 if test "x$JAVACFLAGS" = x; then
4702 JAVACFLAGS="-target 5 -source 5"
4703 fi
4704
47014705
47024706
47034707
48514855 JAVA_TEST=Test.java
48524856 CLASS_TEST=Test.class
48534857 cat << \EOF > $JAVA_TEST
4854 /* #line 4855 "configure" */
4858 /* #line 4859 "configure" */
48554859 public class Test {
48564860 }
48574861 EOF
50275031 if uudecode$EXEEXT Test.uue; then
50285032 ac_cv_prog_uudecode_base64=yes
50295033 else
5030 echo "configure: 5031: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
5034 echo "configure: 5035: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
50315035 echo "configure: failed file was:" >&5
50325036 cat Test.uue >&5
50335037 ac_cv_prog_uudecode_base64=no
51585162 JAVA_TEST=Test.java
51595163 CLASS_TEST=Test.class
51605164 cat << \EOF > $JAVA_TEST
5161 /* #line 5162 "configure" */
5165 /* #line 5166 "configure" */
51625166 public class Test {
51635167 }
51645168 EOF
51935197 CLASS_TEST=Test.class
51945198 TEST=Test
51955199 cat << \EOF > $JAVA_TEST
5196 /* [#]line 5197 "configure" */
5200 /* [#]line 5201 "configure" */
51975201 public class Test {
51985202 public static void main (String args[]) {
51995203 System.exit (0);
5555 dnl ================================================================
5656
5757 AC_CANONICAL_HOST dnl needed to get $host_os
58
59 if test "x$JAVACFLAGS" = x; then
60 JAVACFLAGS="-target 5 -source 5"
61 fi
5862
5963 m4_include([ac/ac_prog_java.m4])
6064 m4_include([ac/ac_prog_java_works.m4])
0 //tabstop=4
0 import org.jpl7.Query;
11
2 import jpl.Query; // empirically, we need this, but I don't know why...
3 import jpl.fli.Prolog;
4 import jpl.*;
5
6 public class Exceptions
7 {
8 public static void
9 main( java.lang.String argv[] )
10 {
2 public class Exceptions {
3 public static void main(String argv[]) {
114 // currently, SWI-Prolog's default args are suited to interactive use with an attached console,
125 // not to embedded use like this, so we override them before they are used
136 // (by JPL, when it necessarily initialises Prolog when .hasSolution() is first called)
14
15 Prolog.set_default_init_args(
16 new String[] {
17 "libpl.dll",
18 "-f", "none",
19 "-g", "set_prolog_flag(debug_on_error,false)",
20 "-q"
21 }
22 );
23
24 System.out.print( "calling\n\n");
25 System.out.print( "?- X is Y.\n\n");
26 System.out.print( "in Prolog to force a Prolog 'instantiation_error' exception,\n" );
27 System.out.print( "which should be returned via Java as an uncaught jpl.PrologException in thread \"main\":\n\n" );
28
29 (new Query("X is Y")).hasSolution();
7 // Prolog.set_default_init_args(new String[] { "libpl.dll", "-f", "none", "-g", "set_prolog_flag(debug_on_error,false)", "-q" });
8 System.out.print("calling\n\n");
9 System.out.print("?- X is Y.\n\n");
10 System.out.print("in Prolog to force a Prolog 'instantiation_error' exception,\n");
11 System.out.print("which should be returned via Java as an uncaught org.jpl7.PrologException in thread \"main\":\n\n");
12 Query.hasSolution("X is Y");
3013 }
31
3214 }
0 //tabstop=4
0 import org.jpl7.PrologException;
1 import org.jpl7.Query;
12
2 import jpl.fli.Prolog;
3 import jpl.*;
4
5 public class Exceptions2
6 {
7 public static void
8 main( java.lang.String argv[] )
9 {
10
11 Prolog.set_default_init_args(
12 new String[] {
13 "libpl.dll",
14 "-f", "none",
15 "-g", "set_prolog_flag(debug_on_error,false)",
16 "-q"
17 }
18 );
19
20 System.out.print( "Calling\n\n");
21 System.out.print( "?- X is Y.\n\n");
22 System.out.print( "in Prolog to force an 'instantiation_error' exception,\n" );
23 System.out.print( "whose getMessage() will be println-ed to System.out.\n\n" );
24
3 public class Exceptions2 {
4 public static void main(String argv[]) {
5 // Prolog.set_default_init_args(new String[] { "libpl.dll", "-f", "none", "-g", "set_prolog_flag(debug_on_error,false)", "-q" });
6 System.out.print("Calling\n\n");
7 System.out.print("?- X is Y.\n\n");
8 System.out.print("in Prolog to force an 'instantiation_error' exception,\n");
9 System.out.print("whose getMessage() will be println-ed to System.out.\n\n");
2510 try {
26 (new Query("X is Y")).hasSolution();
27 } catch (jpl.PrologException e) {
28 System.out.println( e.getMessage());
11 Query.hasSolution("X is Y");
12 } catch (PrologException e) {
13 System.out.println(e.getMessage());
2914 }
30
3115 }
32
3316 }
0 import java.util.Hashtable;
1 import jpl.*;
2 import jpl.Query;
0 import java.util.Map;
31
4 public class Family
5 {
6 public static void
7 main( String argv[] )
8 {
2 import org.jpl7.JPL;
3 import org.jpl7.Query;
4 import org.jpl7.Term;
95
6 public class Family {
7 public static void main(String argv[]) {
8 // JPL.setTraditional();
9 //
10 Query.hasSolution("use_module(library(jpl))"); // only because we call e.g. jpl_pl_syntax/1 below
11 Term swi = Query.oneSolution("current_prolog_flag(version_data,Swi)").get("Swi");
12 System.out.println("swipl.version = " + swi.arg(1) + "." + swi.arg(2) + "." + swi.arg(3));
13 System.out.println("swipl.syntax = " + Query.oneSolution("jpl_pl_syntax(Syntax)").get("Syntax"));
14 System.out.println("swipl.home = " + Query.oneSolution("current_prolog_flag(home,Home)").get("Home").name());
15 System.out.println("jpl.jar = " + JPL.version_string());
16 System.out.println("jpl.dll = " + org.jpl7.fli.Prolog.get_c_lib_version());
17 System.out.println("jpl.pl = " + Query.oneSolution("jpl_pl_lib_version(V)").get("V").name());
18 //
1019 String t1 = "consult('family.pl')";
11 Query q1 = new Query(t1);
12
13 System.out.println( t1 + " " + (q1.hasSolution() ? "succeeded" : "failed") );
14
15 //--------------------------------------------------
16
20 System.out.println(t1 + " " + (Query.hasSolution(t1) ? "succeeded" : "failed"));
21 //
1722 String t2 = "child_of(joe, ralf)";
18 Query q2 = new Query(t2);
19
20 System.out.println( t2 + " is " + (q2.hasSolution() ? "provable" : "not provable") );
21
22 //--------------------------------------------------
23
23 System.out.println(t2 + " is " + (Query.hasSolution(t2) ? "provable" : "not provable"));
24 //
2425 String t3 = "descendent_of(steve, ralf)";
25 Query q3 = new Query(t3);
26
27 System.out.println( t3 + " is " +(q3.hasSolution() ? "provable" : "not provable") );
28
29 //--------------------------------------------------
30
26 System.out.println(t3 + " is " + (Query.hasSolution(t3) ? "provable" : "not provable"));
27 //
3128 String t4 = "descendent_of(X, ralf)";
29 System.out.println("first solution of " + t4 + ": X = " + Query.oneSolution(t4).get("X"));
30 Map<String, Term>[] ss4 = Query.allSolutions(t4);
31 System.out.println("all solutions of " + t4);
32 for (int i = 0; i < ss4.length; i++) {
33 System.out.println("X = " + ss4[i].get("X"));
34 }
35 System.out.println("each solution of " + t4);
3236 Query q4 = new Query(t4);
33
34 System.out.println( "first solution of " + t4 + ": X = " + q4.oneSolution().get("X"));
35
36 //--------------------------------------------------
37
38 java.util.Hashtable[] ss4 = q4.allSolutions();
39
40 System.out.println( "all solutions of " + t4);
41 for ( int i=0 ; i<ss4.length ; i++ ) {
42 System.out.println( "X = " + ss4[i].get("X"));
37 while (q4.hasMoreSolutions()) {
38 Map<String, Term> s4 = q4.nextSolution();
39 System.out.println("X = " + s4.get("X"));
4340 }
44
45 //--------------------------------------------------
46
47 System.out.println( "each solution of " + t4);
48 while ( q4.hasMoreSolutions() ){
49 java.util.Hashtable s4 = q4.nextSolution();
50 System.out.println( "X = " + s4.get("X"));
51 }
52
53 //--------------------------------------------------
54
41 //
5542 String t5 = "descendent_of(X,Y)";
5643 Query q5 = new Query(t5);
57
58 System.out.println( "each solution of " + t5 );
59 while ( q5.hasMoreSolutions() ){
60 java.util.Hashtable s5 = q5.nextSolution();
61 System.out.println( "X = " + s5.get("X") + ", Y = " + s5.get("Y"));
44 System.out.println("each solution of " + t5);
45 while (q5.hasMoreSolutions()) {
46 Map<String, Term> s5 = q5.nextSolution();
47 System.out.println("X = " + s5.get("X") + ", Y = " + s5.get("Y"));
6248 }
63
64
6549 }
66
6750 }
68
69
0 import jpl.*;
0 import java.util.Map;
1
2 import org.jpl7.Compound;
3 import org.jpl7.Query;
4 import org.jpl7.Term;
15
26 public class FamilyMT extends Thread {
3
47 int id; // client thread id
58 private static final int delay = 0;
6 private static final Term delayGoal = new Compound("sleep", new Term[] { new jpl.Integer(delay)});
9 private static final Term delayGoal = new Compound("sleep", new Term[] { new org.jpl7.Integer(delay) });
710
811 FamilyMT(int i) {
912 this.id = i;
1417 }
1518
1619 public static void main(String argv[]) {
17
1820 Query q1 = new Query("consult(family)");
1921 System.err.println("consult " + (q1.hasSolution() ? "succeeded" : "failed"));
20
2122 for (int i = 0; i < 20; i++) {
2223 System.out.println("spawning client[" + i + "]");
2324 new FamilyMT(i).start();
2425 }
25
2626 }
2727
2828 public void run() {
29 java.util.Hashtable solution;
30 Variable X = new Variable("X");
31
32 //--------------------------------------------------
33
29 Map<String, Term> solution;
30 // Variable X = new Variable("X");
31 //
3432 Query q2 = new Query("child_of(joe,ralf)");
35
3633 System.err.println("child_of(joe,ralf) is " + (q2.hasSolution() ? "provable" : "not provable"));
37
38 new Query("sleep(?)", new Term[] {new jpl.Integer(delay)}).hasSolution();
39
40 //--------------------------------------------------
41
34 new Query("sleep(?)", new Term[] { new org.jpl7.Integer(delay) }).hasSolution();
35 //
4236 Query q3 = new Query("descendent_of(steve,ralf)");
43
4437 System.err.println("descendent_of(steve,ralf) is " + (q3.hasSolution() ? "provable" : "not provable"));
45
4638 delay();
47
48 //--------------------------------------------------
49
39 //
5040 Query q4 = new Query("descendent_of(X, ralf)");
51
5241 solution = q4.oneSolution();
53
5442 System.err.println("first solution of descendent_of(X, ralf)");
5543 System.err.println("X = " + solution.get("X"));
56
5744 delay();
58
59 //--------------------------------------------------
60
61 java.util.Hashtable[] solutions = q4.allSolutions();
62
45 //
46 Map<String, Term>[] solutions = q4.allSolutions();
6347 System.err.println("all solutions of descendent_of(X, ralf)");
6448 for (int i = 0; i < solutions.length; i++) {
6549 System.err.println("X = " + solutions[i].get("X"));
6650 }
67
6851 delay();
69
70 //--------------------------------------------------
71
52 //
7253 System.err.println("each solution of descendent_of(X, ralf)");
7354 while (q4.hasMoreSolutions()) {
7455 solution = q4.nextSolution();
7556 System.err.println("X = " + solution.get("X"));
7657 }
77
7858 delay();
79
80 //--------------------------------------------------
81
59 //
8260 Query q5 = new Query("descendent_of(X, Y)");
83
8461 System.err.println(id + ": each solution of descendent_of(X, Y)");
8562 while (q5.hasMoreSolutions()) {
8663 solution = q5.nextSolution();
8764 System.err.println(id + ": X = " + solution.get("X") + ", Y = " + solution.get("Y"));
88
8965 delay();
9066 }
91
9267 }
93
94 }
68 }
0 import java.util.Hashtable;
1 import jpl.*;
2 import jpl.Query;
0 import java.util.Map;
31
4 public class SemWeb
5 { public static void
6 main(String argv[])
7 { String t1 = "use_module(library('semweb/rdf_db'))";
8 Query q1 = new Query(t1);
9
10 System.out.println( t1 + " " + (q1.hasSolution() ? "succeeded" : "failed") );
2 import org.jpl7.Query;
3 import org.jpl7.Term;
114
12 Query ql = new Query("rdf_load('test.rdf')");
13 System.out.println(ql.hasSolution() ? "loaded" : "load failed");
14
15 String t2 = "rdf(S,P,O)";
16 Query q2 = new Query(t2);
17 while ( q2.hasMoreSolutions() )
18 { java.util.Hashtable s2 = q2.nextSolution();
19 System.out.println("{" + s2.get("S") +
20 ", " + s2.get("P") +
21 ", " + s2.get("O") + "}");
22 }
23 }
24
5 public class SemWeb {
6 public static void main(String argv[]) {
7 String t1 = "use_module(library('semweb/rdf_db'))";
8 System.out.println(t1 + " " + (Query.hasSolution(t1) ? "succeeded" : "failed"));
9 //
10 String t2 = "rdf_load('test.rdf')";
11 System.out.println(Query.hasSolution(t2) ? "loaded" : "load failed");
12 //
13 String t3 = "rdf(S,P,O)";
14 Query q3 = new Query(t3);
15 while (q3.hasMoreSolutions()) {
16 Map<String, Term> s3 = q3.nextSolution();
17 System.out.println("{" + s3.get("S") + ", " + s3.get("P") + ", " + s3.get("O") + "}");
18 }
19 }
2520 }
26
27
0 //tabstop=4
1 //*****************************************************************************/
2 // Project: jpl
3 //
4 // File: $Id$
5 // Date: $Date$
6 // Author: Fred Dushin <fadushin@syr.edu>
7 //
8 //
9 // Description:
10 //
11 //
12 // -------------------------------------------------------------------------
13 // Copyright (c) 1998 Fred Dushin
14 // All rights reserved.
15 //
16 // This library is free software; you can redistribute it and/or
17 // modify it under the terms of the GNU Library Public License
18 // as published by the Free Software Foundation; either version 2
19 // of the License, or (at your option) any later version.
20 //
21 // This library is distributed in the hope that it will be useful,
22 // but WITHOUT ANY WARRANTY; without even the implied warranty of
23 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 // GNU Library Public License for more details.
25 //*****************************************************************************/
26
27
28
29 import java.util.Hashtable;
30 import jpl.Query; // empirically, we need this, but I don't know why...
31 import jpl.*;
32
33 public class Test
34 {
35 public static void
36 main( java.lang.String argv[] )
37 {
38 // JPL.init(); // we don't need this with the current JPL (lazy init-on-demand)
39
0 import java.util.Map;
1
2 import org.jpl7.Atom;
3 import org.jpl7.Compound;
4 import org.jpl7.JPLException;
5 import org.jpl7.PrologException;
6 import org.jpl7.Query;
7 import org.jpl7.Term;
8 import org.jpl7.Util;
9 import org.jpl7.Variable;
10
11 public class Test {
12 public static void main(String argv[]) {
4013 run_tests();
4114 }
42
43 static void
44 run_tests()
45 {
15
16 static void run_tests() {
4617 test_0();
4718 test_1();
4819 test_2();
5526 test_9();
5627 test_10();
5728 test_11();
58
5929 test_101();
6030 }
61
62 static void
63 test_0()
64 {
65 System.out.print( "test 0..." );
66
67 Query query =
68 new Query("consult('test.pl')");
69
70 if ( !query.hasSolution() ){
71 System.out.println( "consult('test.pl') failed" );
72 System.exit( 1 );
73 }
74 System.out.println( "passed." );
75 }
76
77 static Term a =
78 new Atom( "a" );
79 static Term b =
80 new Atom( "b" );
81 static Term f_a =
82 new Compound(
83 "f",
84 new Term[] {a}
85 );
86 static Term pair_a_b =
87 new Compound(
88 "-",
89 new Term[] {a,b}
90 );
91
92 static void
93 test_1()
94 {
95 System.out.print( "test 1..." );
96 Query query =
97 new Query("p(a)");
98
99 if ( !query.hasSolution() ){
100 System.out.println( "p(a) failed" );
101 System.exit( 1 );
102 }
103 System.out.println( "passed." );
104 }
105
106 static void
107 test_2()
108 {
109 System.out.print( "test 2..." );
110 Query query =
111 new Query(
112 "p",
113 new Term[] {f_a}
114 );
115
116 if ( !query.hasSolution() ){
117 System.out.println( "p(f(a)) failed" );
118 System.exit( 1 );
119 }
120 System.out.println( "passed." );
121 }
122
123 static void
124 test_3()
125 {
126 System.out.print( "test 3..." );
127 Query query =
128 new Query(
129 "p",
130 new Term[] {pair_a_b}
131 );
132
133 if ( !query.hasSolution() ){
134 System.out.println( "p( a-b ) failed" );
135 System.exit( 1 );
136 }
137 System.out.println( "passed." );
138 }
139
140 static void
141 test_4()
142 {
143 System.out.print( "test 4..." );
31
32 static void test_0() {
33 System.out.print("test 0...");
34 String t0 = "consult('test.pl')";
35 if (!Query.hasSolution(t0)) {
36 System.out.println(t0 + " failed");
37 // System.exit(1);
38 }
39 System.out.println("passed");
40 }
41
42 static Term a = new Atom("a");
43 static Term b = new Atom("b");
44 static Term f_a = new Compound("f", new Term[] { a });
45 static Term pair_a_b = new Compound("-", new Term[] { a, b });
46
47 static void test_1() {
48 System.out.print("test 1...");
49 String t1 = "p(a)";
50 if (!Query.hasSolution(t1)) {
51 System.out.println(t1 + " failed");
52 // System.exit(1);
53 }
54 System.out.println("passed");
55 }
56
57 static void test_2() {
58 System.out.print("test 2...");
59 Query q2 = new Query("p", new Term[] { f_a });
60 if (!q2.hasSolution()) {
61 System.out.println("p(f(a)) failed");
62 // System.exit(1);
63 }
64 System.out.println("passed");
65 }
66
67 static void test_3() {
68 System.out.print("test 3...");
69 Query q3 = new Query("p", new Term[] { pair_a_b });
70 if (!q3.hasSolution()) {
71 System.out.println("p(a-b) failed");
72 // System.exit(1);
73 }
74 System.out.println("passed");
75 }
76
77 static void test_4() {
78 System.out.print("test 4...");
14479 Variable X = new Variable("X");
145 Query query =
146 new Query(
147 "p",
148 new Term[] {X}
149 );
150
151 Term[] target = new Term[] {a,f_a,pair_a_b,new Variable("_")};
152
153 Hashtable[] solutions = query.allSolutions();
154
155 if ( solutions.length != 4 ){
156 System.out.println( "p(X) failed:" );
157 System.out.println( "\tExpected: 4 solutions" );
158 System.out.println( "\tGot: " + solutions.length );
159 System.exit( 1 );
160 }
161
162 for ( int i = 0; i < solutions.length-1; ++i ){
163 Term binding = (Term)solutions[i].get( "X" );
164 if ( ! binding.equals( target[i] ) ){
165 System.out.println( "p(X) failed" );
166 System.out.println( "\tExpected: " + target[i]);
167 System.out.println( "\tGot: " + binding);
168 System.exit( 1 );
169 }
170 }
171
172 System.out.println( "passed." );
173 }
174
175 static void
176 test_5()
177 {
178 System.out.print( "test 5..." );
80 Query q4 = new Query("p", new Term[] { X });
81 Term[] target = new Term[] { a, f_a, pair_a_b, new Variable("_") };
82 Map<String, Term>[] solutions = q4.allSolutions();
83 if (solutions.length != 4) {
84 System.out.println("p(X) failed:");
85 System.out.println("\tExpected: 4 solutions");
86 System.out.println("\tGot: " + solutions.length);
87 // System.exit(1);
88 }
89 for (int i = 0; i < solutions.length - 1; ++i) {
90 Term binding = (Term) solutions[i].get("X");
91 if (!binding.equals(target[i])) {
92 System.out.println("p(X) failed");
93 System.out.println("\tExpected: " + target[i]);
94 System.out.println("\tGot: " + binding);
95 // System.exit(1);
96 }
97 }
98 System.out.println("passed");
99 }
100
101 static void test_5() {
102 System.out.print("test 5...");
179103 Variable X = new Variable("X");
180104 Variable Y = new Variable("Y");
181 Query query =
182 new Query(
183 "p",
184 new Term[] {X,Y}
185 );
186
187 Term[] x_target = new Term[] {a,a};
188 Term[] y_target = new Term[] {a,b};
189
190 Hashtable[] solutions = query.allSolutions();
191
192 if ( solutions.length != 2 ){
193 System.out.println( "p(X, Y) failed:" );
194 System.out.println( "\tExpected: 2 solutions" );
195 System.out.println( "\tGot: " + solutions.length );
196 System.exit( 1 );
197 }
198
199 for ( int i = 0; i < solutions.length; ++i ){
105 Query q5 = new Query("p", new Term[] { X, Y });
106 Term[] x_target = new Term[] { a, a };
107 Term[] y_target = new Term[] { a, b };
108 Map<String, Term>[] solutions = q5.allSolutions();
109 if (solutions.length != 2) {
110 System.out.println("p(X, Y) failed:");
111 System.out.println("\tExpected: 2 solutions");
112 System.out.println("\tGot: " + solutions.length);
113 // System.exit(1);
114 }
115 for (int i = 0; i < solutions.length; ++i) {
116 Term x_binding = solutions[i].get("X");
117 if (!x_binding.equals(x_target[i])) {
118 System.out.println("p(X, Y) failed:");
119 System.out.println("\tExpected: " + x_target[i]);
120 System.out.println("\tGot: " + x_binding);
121 // System.exit(1);
122 }
123 Term y_binding = solutions[i].get("Y");
124 if (!y_binding.equals(y_target[i])) {
125 System.out.println("p( X, Y ) failed:");
126 System.out.println("\tExpected: " + y_target[i]);
127 System.out.println("\tGot: " + y_binding);
128 // System.exit(1);
129 }
130 }
131 System.out.println("passed");
132 }
133
134 static void test_6() {
135 System.out.print("test 6...");
136 Variable X = new Variable("X");
137 Query q6 = new Query("p", new Term[] { X, X });
138 Term[] x_target = new Term[] { a };
139 Map<String, Term>[] solutions = q6.allSolutions();
140 if (solutions.length != 1) {
141 System.out.println("p(X, X) failed:");
142 System.out.println("\tExpected: 1 solution");
143 System.out.println("\tGot: " + solutions.length);
144 // System.exit(1);
145 }
146 for (int i = 0; i < solutions.length; ++i) {
200147 Object x_binding = solutions[i].get("X");
201 if ( ! x_binding.equals( x_target[i] ) ){
202 System.out.println( "p(X, Y) failed:" );
203 System.out.println( "\tExpected: " + x_target[i] );
204 System.out.println( "\tGot: " + x_binding );
205 System.exit( 1 );
206 }
207 Object y_binding = solutions[i].get("Y");
208 if ( ! y_binding.equals( y_target[i] ) ){
209 System.out.println( "p( X, Y ) failed:" );
210 System.out.println( "\tExpected: " + y_target[i] );
211 System.out.println( "\tGot: " + y_binding );
212 System.exit( 1 );
213 }
214 }
215 System.out.println( "passed." );
216 }
217
218 static void
219 test_6()
220 {
221 System.out.print( "test 6..." );
222 Variable X = new Variable("X");
223 Query query =
224 new Query(
225 "p",
226 new Term[] {X,X}
227 );
228
229 Term[] x_target = new Term[] {a};
230
231 Hashtable[] solutions = query.allSolutions();
232
233 if ( solutions.length != 1 ){
234 System.out.println( "p(X, X) failed:" );
235 System.out.println( "\tExpected: 1 solution" );
236 System.out.println( "\tGot: " + solutions.length );
237 System.exit( 1 );
238 }
239
240 for ( int i = 0; i < solutions.length; ++i ){
241 Object x_binding = solutions[i].get("X");
242 if ( ! x_binding.equals( x_target[i] ) ){
243 System.out.println( "p(X, X) failed:" );
244 System.out.println( "\tExpected: " + x_target[i] );
245 System.out.println( "\tGot: " + x_binding );
246 System.exit( 1 );
247 }
248 }
249 System.out.println( "passed." );
250 }
251
252 static void
253 test_7()
254 {
255 System.out.print( "test 7..." );
256 Variable X = new Variable("X");
257 Variable Y = new Variable("Y");
258 Query query =
259 new Query(
260 "r",
261 new Term[] {
262 new Compound(
263 "f",
264 new Term[] {X,X}
265 ),
266 Y
267 }
268 );
269
270 Hashtable[] solutions = query.allSolutions();
271
272 if ( solutions.length != 2 ){
273 System.out.println( "r(f(X,X), Y) failed:" );
274 System.out.println( "\tExpected: 2 solutions" );
275 System.out.println( "\tGot: " + solutions.length );
276 System.exit( 1 );
277 }
278
279 Object x_binding, y_binding;
280
281 x_binding = solutions[0].get("X");
282 y_binding = solutions[0].get("Y");
283 if ( x_binding != y_binding ){
284 System.out.println( "r(f(X,X), Y) failed:" );
285 System.out.println( Util.toString( solutions[0] ) );
286 System.out.println( "\tThe variables to which X and Y are bound in the first solution should be identical." );
287 System.exit( 1 );
288 }
289
290 x_binding = solutions[1].get("X");
291 y_binding = solutions[1].get("Y");
292 if ( x_binding == y_binding ){
293 System.out.println( "r(f(X,X), Y) failed:" );
294 System.out.println( Util.toString( solutions[1] ) );
295 System.out.println( "\tThe variables to which X and Y are bound in the second solution should be distinct." );
296 System.exit( 1 );
297 }
298 if ( x_binding.equals( y_binding ) ){
299 System.out.println( "r(f(X,X), Y) failed:" );
300 System.out.println( Util.toString( solutions[1] ) );
301 System.out.println( "\tThe variables to which X and Y are bound in the second solution should not be \"equal\"." );
302 System.exit( 1 );
303 }
304 /*
305 if ( ! solutions[0].get("X").equals( solutions[1].get("X") ) ){
306 System.out.println( "r(f(X,X), Y) failed:" );
307 System.out.println( Util.toString( solutions[0] ) );
308 System.out.println(
309 "\tThe variable to which X is bound in the first solution (" + solutions[0].get("X") + ")\n" +
310 "\tshould be equal to the variable to which X is bound in the second (" + solutions[1].get("X") + ")");
311 System.exit( 1 );
312 }
313 */
314 System.out.println( "passed." );
315 }
316
317 static void
318 test_8()
319 {
320 System.out.print( "test 8..." );
321 Variable X = new Variable("X");
322 Query query =
323 new Query(
324 "r",
325 new Term[] {
326 new Compound(
327 "f",
328 new Term[] {X,X}
329 ),
330 X
331 }
332 );
333
334 Hashtable[] solutions = query.allSolutions();
335
336 if ( solutions.length != 2 ){
337 System.out.println( "r( f( X, X ), X ) failed:" );
338 System.out.println( "\tExpected: 2 solutions" );
339 System.out.println( "\tGot: " + solutions.length );
340 System.exit( 1 );
341 }
342 /*
343 if ( ! solutions[0].get("X").equals( solutions[1].get("X") ) ){
344 System.out.println( "r( f( X, X ), X ) failed:" );
345 System.out.println( Util.toString( solutions[0] ) );
346 System.out.println(
347 "\tThe variable to which X is bound in the first solution\n" +
348 "\tshould be equal to the variable to which X is bound in the second." );
349 System.exit( 1 );
350 }
351 */
352 System.out.println( "passed." );
353 }
354
148 if (!x_binding.equals(x_target[i])) {
149 System.out.println("p(X, X) failed:");
150 System.out.println("\tExpected: " + x_target[i]);
151 System.out.println("\tGot: " + x_binding);
152 // System.exit(1);
153 }
154 }
155 System.out.println("passed");
156 }
157
158 static void test_7() {
159 System.out.print("test 7...");
160
161 String t7 = "r(f(X,X), Y)";
162
163 Variable vX = new Variable("X");
164 Variable vY = new Variable("Y");
165 Query q7 = new Query("r", new Term[] { new Compound("f", new Term[] { vX, vX }), vY });
166 Map<String, Term>[] solutions = q7.allSolutions();
167
168 // Hashtable<String, Term>[] solutions = Query.allSolutions(t7);
169
170 if (solutions.length != 2) {
171 System.out.println(t7 + " failed:");
172 System.out.println("\tExpected: 2 solutions");
173 System.out.println("\tGot: " + solutions.length);
174 // System.exit(1);
175 }
176 Term X = solutions[0].get("X");
177 Term Y = solutions[0].get("Y");
178 if (X != Y) {
179 System.out.println(t7 + " failed:");
180 System.out.println(Util.toString(solutions[0]));
181 System.out.println("\tThe variables to which X and Y are bound in the first solution should be identical.");
182 // System.exit(1);
183 }
184 X = solutions[1].get("X");
185 Y = solutions[1].get("Y");
186 if (X == Y) {
187 System.out.println(t7 + " failed:");
188 System.out.println(Util.toString(solutions[1]));
189 System.out.println("\tThe variables to which X and Y are bound in the second solution should be distinct.");
190 // System.exit(1);
191 }
192 if (X.equals(Y)) {
193 System.out.println(t7 + " failed:");
194 System.out.println(Util.toString(solutions[1]));
195 System.out.println("\tThe variables to which X and Y are bound in the second solution should not be \"equal\".");
196 // System.exit(1);
197 }
198 System.out.println("passed");
199 }
200
201 static void test_8() {
202 System.out.print("test 8...");
203 // Variable X = new Variable("X");
204 // Query query = new Query("r", new Term[] { new Compound("f", new Term[] { X, X }), X });
205 String t8 = "r(f(X,X), X)";
206 Map<String, Term>[] solutions = Query.allSolutions(t8);
207 if (solutions.length != 2) {
208 System.out.println(t8 + " failed:");
209 System.out.println("\tExpected: 2 solutions");
210 System.out.println("\tGot: " + solutions.length);
211 // System.exit(1);
212 }
213 System.out.println("passed");
214 }
215
355216 // corresponds with Prolog List: [a-a,a-b]
356 static Term test_9_solution =
357 Util.termArrayToList(
358 new Term[] {
359 new Compound( "-", new Term[] {a,a}),
360 new Compound( "-", new Term[] {a,b})
361 }
362 );
363
364 static void
365 test_9()
366 {
367 System.out.print( "test 9..." );
368 Variable X = new Variable("X");
369 Variable Y = new Variable("Y");
370 Variable XYs = new Variable("XYs");
371 Query query =
372 new Query(
373 "bagof",
374 new Term[] {
375 new Compound(
376 "-",
377 new Term[] {X,Y}
378 ),
379 new Compound(
380 "p",
381 new Term[] {X,Y}
382 ),
383 XYs
384 }
385 );
386
387 Hashtable[] solutions = query.allSolutions();
388
389 if ( solutions.length != 1 ){
390 System.out.println( "bagof(X-Y, p(X,Y), XYs) failed:" );
391 System.out.println( "\tExpected: 1 solution" );
392 System.out.println( "\tGot: " + solutions.length );
393 System.exit( 1 );
394 }
395
396 Term term = (Term) solutions[0].get("XYs");
397
398 // if ( ! (term instanceof List) ){
399 if ( ! (term instanceof Compound && ".".equals(((Compound)term).name()) && ((Compound)term).arity()==2) ){
400 System.out.println( "bagof(X-Y, p(X,Y), XYs) failed:" );
401 System.out.println( "\tExpected: XYs to be a List" );
402 System.out.println( "\tGot: " + term );
403 System.exit( 1 );
404 }
405
406 if ( ! term.equals( test_9_solution ) ){
407 System.out.println( "bagof(X-Y, p(X,Y), XYs) failed:" );
408 System.out.println( "\tExpected: " + test_9_solution );
409 System.out.println( "\tGot: " + term );
410 System.exit( 1 );
411 }
412
413 System.out.println( "passed." );
414 }
415
416 static void
417 test_10()
418 {
419 System.out.print( "test 10..." );
420 Query query =
421 new Query( "t" );
422
217 static Term test_9_solution = Util.termArrayToList(new Term[] { new Compound("-", new Term[] { a, a }), new Compound("-", new Term[] { a, b }) });
218
219 static void test_9() {
220 System.out.print("test 9...");
221 String t9 = "bagof(X-Y, p(X,Y), XYs)";
222 Map<String, Term>[] solutions = Query.allSolutions(t9);
223 if (solutions.length != 1) {
224 System.out.println(t9 + " failed:");
225 System.out.println("\tExpected: 1 solution");
226 System.out.println("\tGot: " + solutions.length);
227 // System.exit(1);
228 }
229 Term term = solutions[0].get("XYs");
230 if (!term.isListPair()) {
231 System.out.println(t9 + " failed:");
232 System.out.println("\tExpected: XYs to be a List");
233 System.out.println("\tGot: " + term);
234 // System.exit(1);
235 }
236 if (!term.equals(test_9_solution)) {
237 System.out.println(t9 + " failed:");
238 System.out.println("\tExpected: " + test_9_solution);
239 System.out.println("\tGot: " + term);
240 // System.exit(1);
241 }
242 System.out.println("passed");
243 }
244
245 static void test_10() {
246 System.out.print("test 10...");
247 String t10 = "t";
423248 try {
424 boolean b = query.hasSolution();
425 System.out.println( "t failed:" );
426 System.out.println( "\tExpected: JPLException" );
427 System.out.println( "\tGot: " + b );
428 System.exit( 1 );
429 } catch ( PrologException e ){
430 }
431
432 System.out.println( "passed." );
433 }
434
435 static void
436 test_11()
437 {
438 System.out.print( "test 11..." );
439 Term tuple =
440 new Compound(
441 "t",
442 new Term[]{
443 new Atom( "a" ),
444 new Atom( "b" ),
445 new Atom( "c" ),
446 new Atom( "d" ),
447 new Atom( "e" )
448 }
449 );
450
249 boolean b = Query.hasSolution(t10);
250 System.out.println(t10 + " failed:");
251 System.out.println("\tExpected: PrologException");
252 System.out.println("\tGot: " + b);
253 // System.exit(1);
254 } catch (PrologException e) {
255 System.out.println("passed");
256 } catch (Exception e) {
257 System.out.println("wrong exception class thrown");
258 }
259 }
260
261 static void test_11() {
262 System.out.print("test 11...");
263 Term tuple = new Compound("t", new Term[] { new Atom("a"), new Atom("b"), new Atom("c"), new Atom("d"), new Atom("e") });
451264 try {
452 Variable X = new Variable("X");
453 Query query = new Query( "tuple", new Term[] {X} );
454
455 java.util.Hashtable solution = query.oneSolution();
456
457 Term result = (Term) solution.get("X");
458
459 if ( result == null || ! result.equals( tuple ) ){
460 System.out.println( "failed:" );
461 System.out.println( "\tresult: " + result );
462 System.out.println( "\ttuple: " + tuple );
463 System.exit( 1 );
464 }
465
466 Term term;
467
468 term = new Atom( "a" );
469 if ( ((Compound)result).arg( 1 ) == null || !((Compound)result).arg( 1 ).equals( term ) ){
470 System.out.println( "failed:" );
471 System.out.println( "\t((Compound)result).arg( 1 ): " + ((Compound)result).arg( 1 ) );
472 System.out.println( "\tterm : " + term );
473 System.exit( 1 );
474 }
475 term = new Atom( "b" );
476 if ( ((Compound)result).arg( 2 ) == null || !((Compound)result).arg( 2 ).equals( term ) ){
477 System.out.println( "failed:" );
478 System.out.println( "\t((Compound)result).arg( 2 ): " + ((Compound)result).arg( 2 ) );
479 System.out.println( "\tterm : " + term );
480 System.exit( 1 );
481 }
482 term = new Atom( "e" );
483 if ( ((Compound)result).arg( 5 ) == null || !((Compound)result).arg( 5 ).equals( term ) ){
484 System.out.println( "failed:" );
485 System.out.println( "\t((Compound)result).arg( 5 ): " + ((Compound)result).arg( 5 ) );
486 System.out.println( "\tterm : " + term );
487 System.exit( 1 );
265 Variable X = new Variable("X");
266 Query q11 = new Query("tuple", new Term[] { X });
267 Term result = q11.oneSolution().get("X");
268 if (result == null || !result.equals(tuple)) {
269 System.out.println("failed:");
270 System.out.println("\tresult: " + result);
271 System.out.println("\ttuple: " + tuple);
272 // System.exit(1);
273 }
274 if (result.arg(1) == null || !result.arg(1).equals(new Atom("a"))) {
275 System.out.println("failed:");
276 System.out.println("\tresult.arg(1): " + result.arg(1));
277 // System.exit(1);
278 }
279 if (result.arg(2) == null || !result.arg(2).equals(new Atom("b"))) {
280 System.out.println("failed:");
281 System.out.println("\tresult.arg(2): " + result.arg(2));
282 // System.exit(1);
283 }
284 if (result.arg(5) == null || !result.arg(5).equals(new Atom("e"))) {
285 System.out.println("failed:");
286 System.out.println("\tresult.arg(5): " + result.arg(5));
287 // System.exit(1);
488288 }
489289 // arg0(6) throws an exception, as I'd expect it to...
490 // if ( ((Compound)result).arg( 7 ) != null ){
491 // System.out.println( "failed:" );
492 // System.out.println( "\t((Compound)result).arg( 7 ): " + ((Compound)result).arg( 7 ) );
493 // System.out.println( "\tshould be null" );
494 // System.exit( 1 );
495 // }
496 } catch ( PrologException e ){
497 System.out.println( "failed" );
290 // if ( ((Compound)result).arg( 7 ) != null ){
291 // System.out.println( "failed:" );
292 // System.out.println( "\t((Compound)result).arg( 7 ): " + ((Compound)result).arg( 7 ) );
293 // System.out.println( "\tshould be null" );
294 // System.exit( 1 );
295 // }
296 } catch (PrologException e) {
297 System.out.println("failed");
498298 e.printStackTrace();
499 System.exit( 1 );
500 }
501
502 System.out.println( "passed." );
503 }
504
505 static void
506 test_101()
507 {
508 System.out.print( "test 101..." );
299 // System.exit(1);
300 }
301 System.out.println("passed");
302 }
303
304 static void test_101() {
305 System.out.print("test 101...");
509306 Thread[] threads = new Thread[10];
510
511 for ( int i = 0; i < threads.length; ++i ){
512 threads[i] = new QueryThread( i );
513 }
514 for ( int i = 0; i < threads.length; ++i ){
307 for (int i = 0; i < threads.length; ++i) {
308 threads[i] = new QueryThread(i);
309 }
310 for (int i = 0; i < threads.length; ++i) {
515311 threads[i].start();
516312 }
517 for ( int i = 0; i < threads.length; ++i ){
313 for (int i = 0; i < threads.length; ++i) {
518314 try {
519315 threads[i].join();
520 } catch ( InterruptedException ie ){
316 } catch (InterruptedException ie) {
521317 ie.printStackTrace();
522 System.exit( 1 );
523 }
524 }
525 System.out.println( "passed." );
526 }
527
528 private static class
529 QueryThread extends Thread
530 {
318 // System.exit(1);
319 }
320 }
321 System.out.println("passed");
322 }
323
324 private static class QueryThread extends Thread {
531325 private int id_ = -1;
532326
533 public
534 QueryThread( int id )
535 {
327 public QueryThread(int id) {
536328 this.id_ = id;
537329 }
538330
539 public java.lang.String
540 toString()
541 {
331 public java.lang.String toString() {
542332 return "(QueryThread id=" + id_ + ")";
543333 }
544
545
546 public void
547 run()
548 {
549 Query query =
550 new Query(
551 "p",
552 new Term[] {
553 new Atom("a"),
554 new Atom("a")
555 }
556 );
557
558 for ( int i = 0; i < 10; ++i ){
334
335 public void run() {
336 Query query = new Query("p", new Term[] { new Atom("a"), new Atom("a") });
337 for (int i = 0; i < 10; ++i) {
559338 try {
560339 query.hasSolution();
561 } catch ( jpl.JPLException e ){
562 System.out.println( "Threaded p( a, a ) threw exception: " + e);
563 System.exit( 1 );
340 } catch (JPLException e) {
341 System.out.println("Threaded p(a, a) threw exception: " + e);
342 System.exit(1);
564343 }
565 System.out.print( id_ );
344 System.out.print(id_);
566345 Thread.yield();
567346 }
568 for ( int i = 0; i < 10; ++i ){
569 // synchronized ( Query.lock() ){
570 try {
571 while ( query.hasMoreSolutions() ){
572 Thread.yield();
573 query.nextSolution();
574 }
575 } catch ( jpl.JPLException e ){
576 System.out.println( "Threaded p( a, a ) threw exception: " + e);
577 System.exit( 1 );
347 for (int i = 0; i < 10; ++i) {
348 try {
349 while (query.hasMoreSolutions()) {
350 Thread.yield();
351 query.nextSolution();
578352 }
579 System.out.print( id_ );
580 // }
581 }
582 }
583 }
584
585
586 // more to come??
353 } catch (JPLException e) {
354 System.out.println("Threaded p(a, a) threw exception: " + e);
355 System.exit(1);
356 }
357 System.out.print(id_);
358 }
359 }
360 }
587361 }
0 //tabstop=4
0 import org.jpl7.Compound;
1 import org.jpl7.Query;
2 import org.jpl7.Term;
3 import org.jpl7.Variable;
14
2 import jpl.*;
5 public class Test2 {
6 public static int fac(int n) {
7 if (n == 1) {
8 return 1;
9 } else {
10 return n * ((org.jpl7.Integer) new Query(new Compound("jpl_test_fac", new Term[] { new org.jpl7.Integer(n - 1), new Variable("F") })).oneSolution().get("F")).intValue();
11 }
12 }
313
4 public class Test2
5 { public static int fac(int n)
6 { if (n == 1)
7 { return 1;
8 } else
9 { return n * ((jpl.Integer)
10 new Query(new Compound("jpl_test_fac", new Term[]
11 { new jpl.Integer(n - 1),
12 new Variable("F")
13 })).oneSolution().get("F")).intValue();
14 }
15 }
16
17 public static void
18 main( java.lang.String argv[] )
19 { new Query("consult('test2.pl')").oneSolution();
20
21 System.out.print( "calling Prolog to call Java to call Prolog...\n" );
22
23 System.out.println( "factorial(10) = " + fac(10));
24 }
14 public static void main(String argv[]) {
15 Query.oneSolution("consult('test2.pl')");
16 System.out.print("calling Prolog to call Java to call Prolog...\n");
17 System.out.println("factorial(10) = " + fac(10));
18 }
2519 }
0 //tabstop=4
1 //*****************************************************************************/
2 // Project: jpl
3 //
4 // File: $Id$
5 // Date: $Date$
6 // Author: Fred Dushin <fadushin@syr.edu>
7 //
8 //
9 // Description:
10 //
11 //
12 // -------------------------------------------------------------------------
13 // Copyright (c) 1998 Fred Dushin
14 // All rights reserved.
15 //
16 // This library is free software; you can redistribute it and/or
17 // modify it under the terms of the GNU Library Public License
18 // as published by the Free Software Foundation; either version 2
19 // of the License, or (at your option) any later version.
20 //
21 // This library is distributed in the hope that it will be useful,
22 // but WITHOUT ANY WARRANTY; without even the implied warranty of
23 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 // GNU Library Public License for more details.
25 //*****************************************************************************/
26
27
28
29 import java.util.Hashtable;
30 import jpl.Query; // empirically, we need this, but I don't know why...
31 import jpl.*;
32
33 public class Time
34 {
35 static int tree_depth = 10;
36 static int num_tests = 5;
37 static int num_trials = 10;
38 static long[][] data = null;
39 static Term tree = null;
40 static Atom empty_tree = new Atom("t");
41 static Timer timer = new Timer();
42
43 public static void
44 main( java.lang.String argv[] )
45 {
46 parse_params( argv );
47
0 import org.jpl7.Atom;
1 import org.jpl7.Compound;
2 import org.jpl7.JPL;
3 import org.jpl7.Query;
4 import org.jpl7.Term;
5 import org.jpl7.Variable;
6
7 public class Time {
8 static int tree_depth = 10;
9 static int num_tests = 5;
10 static int num_trials = 10;
11 static long[][] data = null;
12 static Term tree = null;
13 static Atom empty_tree = new Atom("t");
14 static Timer timer = new Timer();
15
16 public static void main(String argv[]) {
17 parse_params(argv);
4818 JPL.init();
49
5019 run_tests();
5120 }
52
53 static void
54 parse_params( java.lang.String argv[] )
55 {
21
22 static void parse_params(String argv[]) {
5623 int i = 0;
57
58 while ( i < argv.length ){
59 if ( argv[i].equals( "-help" ) ){
24 while (i < argv.length) {
25 if (argv[i].equals("-help")) {
6026 print_help();
61 System.exit( 1 );
62 } else if ( argv[i].equals( "-num_trials" ) ){
63 num_trials = java.lang.Integer.valueOf( argv[i+1] ).intValue();
27 System.exit(1);
28 } else if (argv[i].equals("-num_trials")) {
29 num_trials = java.lang.Integer.valueOf(argv[i + 1]).intValue();
6430 i += 2;
65 } else if ( argv[i].equals( "-tree_depth" ) ){
66 tree_depth = java.lang.Integer.valueOf( argv[i+1] ).intValue();
31 } else if (argv[i].equals("-tree_depth")) {
32 tree_depth = java.lang.Integer.valueOf(argv[i + 1]).intValue();
6733 i += 2;
6834 } else {
69 System.err.println( "Unrecognized option: " + argv[i] );
35 System.err.println("Unrecognized option: " + argv[i]);
7036 print_help();
71 System.exit( 1 );
37 System.exit(1);
7238 }
7339 }
7440 data = new long[num_tests][num_trials];
7541 }
76
77 static void
78 print_help()
79 {
80 System.out.println(
81 "java Time\n" +
82 "\t-help print this screen\n" +
83 "\t-num_trials <num> specify number of trials (default: 10)\n" +
84 "\t-tree_depth <num> specify depth of binary tree (default: 10)\n" +
85 "" );
86 }
87
88 static void
89 run_tests()
90 {
42
43 static void print_help() {
44 System.out.println("java Time\n" + "\t-help print this screen\n" + "\t-num_trials <num> specify number of trials (default: 10)\n"
45 + "\t-tree_depth <num> specify depth of binary tree (default: 10)\n" + "");
46 }
47
48 static void run_tests() {
9149 test_0();
9250 test_1();
9351 test_2();
9452 test_3();
9553 test_4();
96
9754 print_results();
9855 }
99
100 static void
101 test_0()
102 {
103 System.out.print( "test 0..." );
104 Query query =
105 new Query("consult('time.pl')");
106
107 if ( !query.hasSolution() ){
108 System.out.println( "consult('time.pl') failed" );
109 System.exit( 1 );
110 }
111 System.out.println( "passed." );
112
113 System.out.print( "trees" );
114 for ( int i = 0; i < num_trials; ++i ){
115 timer.start();
116 tree = create_tree();
117 timer.stop();
118
119 data[0][i] = timer.getElapsedTimeInMillis();
120 System.out.print( "." );
121 }
122 System.out.println( "done." );
123 }
124
125 static void
126 test_1()
127 {
128 Query query = new Query( "traverse", new Term[]{tree} );
129
130 System.out.print( "traverse" );
131 for ( int i = 0; i < num_trials; ++i ){
132
56
57 static void test_0() {
58 System.out.print("test 0...");
59 String t0 = "consult('time.pl')";
60 if (!Query.hasSolution(t0)) {
61 System.out.println(t0 + " failed");
62 } else {
63 System.out.println("passed");
64 System.out.print("trees");
65 for (int i = 0; i < num_trials; ++i) {
66 timer.start();
67 tree = create_tree();
68 timer.stop();
69 data[0][i] = timer.getElapsedTimeInMillis();
70 System.out.print(".");
71 }
72 System.out.println("done");
73 }
74 }
75
76 static void test_1() {
77 Query query = new Query("traverse", new Term[] { tree });
78 System.out.print("traverse");
79 for (int i = 0; i < num_trials; ++i) {
13380 timer.start();
13481 query.hasSolution();
13582 timer.stop();
136
13783 data[1][i] = timer.getElapsedTimeInMillis();
138 System.out.print( "." );
139 }
140 System.out.println( "done." );
141 }
142
143 static void
144 test_2()
145 {
146 Query query = new Query( "noop", new Term[]{tree} );
147
148 System.out.print( "noop" );
149 for ( int i = 0; i < num_trials; ++i ){
150
151 timer.start();
152 java.util.Hashtable solution = query.oneSolution();
153 timer.stop();
154
84 System.out.print(".");
85 }
86 System.out.println("done");
87 }
88
89 static void test_2() {
90 Query query = new Query("noop", new Term[] { tree });
91 System.out.print("noop");
92 for (int i = 0; i < num_trials; ++i) {
93 timer.start();
94 query.oneSolution();
95 timer.stop();
15596 data[2][i] = timer.getElapsedTimeInMillis();
156 System.out.print( "." );
157 }
158 System.out.println( "done." );
159 }
160
161 static void
162 test_3()
163 {
164 Variable Y = new Variable("Y");
165 Query query = new Query( "noop_nobind", new Term[]{tree,Y} );
166
167 System.out.print( "noop_nobind" );
168 for ( int i = 0; i < num_trials; ++i ){
169
170 timer.start();
171 boolean ok = query.hasSolution();
172 timer.stop();
173
97 System.out.print(".");
98 }
99 System.out.println("done");
100 }
101
102 static void test_3() {
103 Variable Y = new Variable("Y");
104 Query query = new Query("noop_nobind", new Term[] { tree, Y });
105 System.out.print("noop_nobind");
106 for (int i = 0; i < num_trials; ++i) {
107 timer.start();
108 query.hasSolution();
109 timer.stop();
174110 data[3][i] = timer.getElapsedTimeInMillis();
175 System.out.print( "." );
176 }
177 System.out.println( "done." );
178 }
179
180 static void
181 test_4()
182 {
183 Variable Y = new Variable("Y");
184 Query query = new Query( "noop_bind", new Term[]{tree,Y} );
185
186 System.out.print( "noop_bind" );
187 for ( int i = 0; i < num_trials; ++i ){
188
189 timer.start();
190 java.util.Hashtable solution = query.oneSolution();
191 timer.stop();
192
111 System.out.print(".");
112 }
113 System.out.println("done");
114 }
115
116 static void test_4() {
117 Variable Y = new Variable("Y");
118 Query query = new Query("noop_bind", new Term[] { tree, Y });
119 System.out.print("noop_bind");
120 for (int i = 0; i < num_trials; ++i) {
121 timer.start();
122 query.oneSolution();
123 timer.stop();
193124 data[4][i] = timer.getElapsedTimeInMillis();
194 System.out.print( "." );
195 }
196 System.out.println( "done." );
197 }
198
199 static java.text.NumberFormat format =
200 java.text.NumberFormat.getInstance();
125 System.out.print(".");
126 }
127 System.out.println("done");
128 }
129
130 static java.text.NumberFormat format = java.text.NumberFormat.getInstance();
201131 static {
202132 format.setMaximumFractionDigits(3);
203133 }
204
205
206 static void
207 print_results()
208 {
209 long num_terms = (long)(Math.pow( 2, tree_depth ) + 1);
210 System.out.println();
211 System.out.println( "num_trials: " + num_trials );
212 System.out.println( "tree_depth: " + tree_depth +
213 " (= " + num_terms + " terms)" );
214 System.out.println();
215
216 for ( int j = 0; j < num_tests; ++j ){
217 System.out.print( "test_" + j + "\t\t" );
218 }
219 System.out.println( "\n" );
220 for ( int i = 0; i < num_trials; ++i ){
221 for ( int j = 0; j < num_tests; ++j ){
222 System.out.print( data[j][i] + "\t\t" );
134
135 static void print_results() {
136 long num_terms = (long) (Math.pow(2, tree_depth) + 1);
137 System.out.println();
138 System.out.println("num_trials: " + num_trials);
139 System.out.println("tree_depth: " + tree_depth + " (= " + num_terms + " terms)");
140 System.out.println();
141 for (int j = 0; j < num_tests; ++j) {
142 System.out.print("test_" + j + "\t\t");
143 }
144 System.out.println();
145 for (int i = 0; i < num_trials; ++i) {
146 for (int j = 0; j < num_tests; ++j) {
147 System.out.print(data[j][i] + "\t\t");
223148 }
224149 System.out.println();
225150 }
226 System.out.println( "\n" );
227
228 for ( int j = 0; j < num_tests; ++j ){
229 System.out.println(
230 "test_" + j + ": " +
231 "avg: " + format.format( avg( j ) ) + "ms\t\t" +
232 format.format( avg( j )/num_terms ) + "ms/term"
233 );
234 }
235 }
236
237 static double
238 avg( int test )
239 {
240 long min = java.lang.Long.MAX_VALUE,
241 max = java.lang.Long.MIN_VALUE;
242
151 System.out.println();
152 for (int j = 0; j < num_tests; ++j) {
153 System.out.println("test_" + j + ": " + "avg: " + format.format(avg(j)) + "ms\t\t" + format.format(avg(j) / num_terms) + "ms/term");
154 }
155 }
156
157 static double avg(int test) {
158 long min = java.lang.Long.MAX_VALUE;
159 long max = java.lang.Long.MIN_VALUE;
243160 long sum = 0L;
244 for ( int i = 0; i < num_trials; ++i ){
161 for (int i = 0; i < num_trials; ++i) {
245162 sum += data[test][i];
246 if ( min < data[test][i] ){
163 if (min < data[test][i]) {
247164 min = data[test][i];
248165 }
249 if ( max > data[test][i] ){
166 if (max > data[test][i]) {
250167 max = data[test][i];
251168 }
252169 }
253 //sum -= (min+max);
254
255 return sum/(num_trials/*-2*/);
256 }
257
258
259 static Term
260 create_tree()
261 {
262 return binary_tree( tree_depth );
263 }
264
265 static Term
266 binary_tree( int depth )
267 {
268 if ( depth <= 0 ){
170 return sum / num_trials;
171 }
172
173 static Term create_tree() {
174 return binary_tree(tree_depth);
175 }
176
177 static Term binary_tree(int depth) {
178 if (depth <= 0) {
269179 return empty_tree;
270180 } else {
271 return
272 new Compound(
273 "t",
274 new Term[]{
275 binary_tree( depth - 1 ),
276 binary_tree( depth - 1 )
277 }
278 );
279 }
280 }
281
282
283 static class Timer
284 {
285 private java.util.Calendar calendar = java.util.Calendar.getInstance();
286
287 private long start_time = 0L,
288 stop_time = 0L;
289
181 return new Compound("t", new Term[] { binary_tree(depth - 1), binary_tree(depth - 1) });
182 }
183 }
184
185 static class Timer {
186 private long start_time = 0L, stop_time = 0L;
290187 boolean running = false;
291188
292 public
293 Timer()
294 {
295 }
296
297 public void
298 start()
299 {
300 if ( !running ){
189 public Timer() {
190 }
191
192 public void start() {
193 if (!running) {
301194 start_time = getMillis();
302 running = true;
303 }
304 }
305
306 private long
307 getMillis()
308 {
195 running = true;
196 }
197 }
198
199 private long getMillis() {
309200 return System.currentTimeMillis();
310201 }
311202
312 public void
313 stop()
314 {
315 if ( running ){
203 public void stop() {
204 if (running) {
316205 stop_time = getMillis();
317 running = false;
318 }
319 }
320
321 public long
322 getElapsedTimeInMillis()
323 {
324 if ( running ){
206 running = false;
207 }
208 }
209
210 public long getElapsedTimeInMillis() {
211 if (running) {
325212 return getMillis() - start_time;
326213 } else {
327214 return stop_time - start_time;
328215 }
329216 }
330217
331 public double
332 getElapsedTimeInSeconds()
333 {
334 return getElapsedTimeInMillis()/1000;
218 public double getElapsedTimeInSeconds() {
219 return getElapsedTimeInMillis() / 1000;
335220 }
336221 }
337222 }
0 import java.util.Hashtable;
1 import jpl.*;
0 import org.jpl7.JPL;
1 import org.jpl7.Query;
2 import org.jpl7.Term;
3 import org.jpl7.fli.Prolog;
24
3 public class Versions
4 {
5 public static void
6 main( String argv[] )
7 {
8
9 String prologVersion = ((Term) (new Query("jpl_pl_lib_version(V)")).oneSolution().get("V")).name();
10 String javaVersion = jpl.JPL.version_string();
11 String cVersion = jpl.fli.Prolog.get_c_lib_version();
12
13 System.out.println( "prolog library version; " + prologVersion );
14 System.out.println( " java library version; " + javaVersion );
15 System.out.println( " c library version; " + cVersion );
16
17 if ( prologVersion.equals(javaVersion) && javaVersion.equals(cVersion) ) {
18 System.out.println( "BINGO! you appear to have the same version of each library installed");
5 public class Versions {
6 public static void main(String argv[]) {
7 String pVersion = ((Term) (new Query("jpl_pl_lib_version(V)")).oneSolution().get("V")).name();
8 String jVersion = JPL.version_string();
9 String cVersion = Prolog.get_c_lib_version();
10 System.out.println("prolog library version; " + pVersion);
11 System.out.println(" java library version; " + jVersion);
12 System.out.println(" c library version; " + cVersion);
13 if (pVersion.equals(jVersion) && jVersion.equals(cVersion)) {
14 System.out.println("BINGO! you appear to have the same version of each library installed");
1915 } else {
20 System.out.println( "WHOOPS! you appear not to have the same version of each library installed");
16 System.out.println("WHOOPS! you appear not to have the same version of each library installed");
2117 }
22
2318 }
24
2519 }
26
27
0 //tabstop=4
1 //*****************************************************************************/
2 // Project: jpl
3 //
4 // File: $Id$
5 // Date: $Date$
6 // Author: Fred Dushin <fadushin@syr.edu>
7 //
8 //
9 // Description:
10 //
11 //
12 // -------------------------------------------------------------------------
13 // Copyright (c) 1998 Fred Dushin
14 // All rights reserved.
15 //
16 // This library is free software; you can redistribute it and/or
17 // modify it under the terms of the GNU Library Public License
18 // as published by the Free Software Foundation; either version 2
19 // of the License, or (at your option) any later version.
20 //
21 // This library is distributed in the hope that it will be useful,
22 // but WITHOUT ANY WARRANTY; without even the implied warranty of
23 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 // GNU Library Public License for more details.
25 //*****************************************************************************/
0 import java.util.Map;
261
27 // calls gen([t(c,q,[]),t(v,[],a)],ANSWER).
2 import org.jpl7.Atom;
3 import org.jpl7.Compound;
4 import org.jpl7.Query;
5 import org.jpl7.Term;
6 import org.jpl7.Variable;
287
29 import java.util.Hashtable;
30 import jpl.*;
31
32 public class Zahed
33 {
34 public static void
35 main( java.lang.String argv[] )
36 {
37
38 System.out.println( "starting..." );
39
8 public class Zahed {
9 public static void main(java.lang.String argv[]) {
10 System.out.println("starting...");
4011 Compound goal1 = new Compound("consult", new Term[] { new Atom("zahed.pl") });
4112 Query q1 = new Query(goal1);
42 if ( !q1.hasSolution() ){
43 System.out.println( "consult('zahed.pl') failed" );
13 if (!q1.hasSolution()) {
14 System.out.println("consult('zahed.pl') failed");
4415 return;
4516 }
46
4717 Term t2 = new Compound("t", new Term[] { new Atom("v"), new Atom("[]"), new Atom("a") });
4818 Compound list2 = new Compound(".", new Term[] { t2, new Atom("[]") });
49
5019 Compound t1 = new Compound("t", new Term[] { new Atom("c"), new Atom("q"), new Atom("[]") });
5120 Compound list1 = new Compound(".", new Term[] { t1, list2 });
52
5321 Variable answer = new Variable("A");
54
5522 Compound goal2 = new Compound("gen", new Term[] { list1, answer });
56
5723 Query q2 = new Query(goal2);
58 Hashtable solution = q2.oneSolution();
59 if ( solution == null ) {
60 System.out.println( "failed" );
24 Map<String, Term> solution = q2.oneSolution();
25 if (solution == null) {
26 System.out.println("failed");
6127 } else {
62 System.out.println( solution.get("A").toString());
28 System.out.println(solution.get("A").toString());
6329 }
64 System.out.println( "finished" );
30 System.out.println("finished");
6531 }
6632 }
33 :- use_module(library(jpl)).
44
55 jpl_colour_choose_demo :-
6 jpl_new( 'javax.swing.JFrame', ['frame with dialog'], F),
7 jpl_call( F, setLocation, [400,300], _),
8 jpl_call( F, setSize, [400,300], _),
9 jpl_call( F, setVisible, [@(true)], _),
10 jpl_call( F, toFront, [], _),
11 jpl_call( F, getContentPane, [], CP),
12 jpl_get( 'java.awt.Color', pink, Pink),
13 jpl_call( 'javax.swing.JColorChooser', showDialog, [CP,'pick a colo(u)r',Pink], C),
14 jpl_call( F, dispose, [], _),
6 jpl_new('javax.swing.JFrame', ['frame with dialog'], F),
7 jpl_call(F, setLocation, [400,300], _),
8 jpl_call(F, setSize, [400,300], _),
9 jpl_call(F, setVisible, [@(true)], _),
10 jpl_call(F, toFront, [], _),
11 jpl_call(F, getContentPane, [], CP),
12 jpl_get('java.awt.Color', pink, Pink),
13 jpl_call('javax.swing.JColorChooser', showDialog, [CP,'pick a colo(u)r',Pink], C),
14 jpl_call(F, dispose, [], _),
1515 ( C == @(null)
16 -> write( 'you cancelled')
17 ; write( 'you chose '), write( C)
16 -> write('you cancelled')
17 ; write('you chose '), write(C)
1818 ),
1919 nl.
2020
00 :- use_module(library(jpl)).
11
22 jpl_jlist_demo :-
3 jpl_new( 'javax.swing.JFrame', ['modules'], F),
4 jpl_new( 'javax.swing.DefaultListModel', [], DLM),
5 jpl_new( 'javax.swing.JList', [DLM], L),
6 jpl_call( F, getContentPane, [], CP),
7 jpl_call( CP, add, [L], _),
8 ( current_module( M),
9 jpl_call( DLM, addElement, [M], _),
3 jpl_new('javax.swing.JFrame', ['modules'], F),
4 jpl_new('javax.swing.DefaultListModel', [], DLM),
5 jpl_new('javax.swing.JList', [DLM], L),
6 jpl_call(F, getContentPane, [], CP),
7 jpl_call(CP, add, [L], _),
8 ( current_module(M),
9 jpl_call(DLM, addElement, [M], _),
1010 fail
1111 ; true
1212 ),
13 jpl_call( F, pack, [], _),
14 jpl_call( F, getHeight, [], H),
15 jpl_call( F, setSize, [150,H], _),
16 jpl_call( F, setVisible, [@(true)], _).
13 jpl_call(F, pack, [], _),
14 jpl_call(F, getHeight, [], H),
15 jpl_call(F, setSize, [150,H], _),
16 jpl_call(F, setVisible, [@(true)], _).
1717
1818
1919 % this directive runs the above demo
+0
-32
packages/jpl/examples/prolog/jpl_midi_demo.pl less more
0 :- use_module(library(jpl)).
1
2 jpl_midi_demo :-
3 jpl_midi_demo( 20). % play 20 random notes
4
5
6 jpl_midi_demo( N) :-
7 jpl_call( 'javax.sound.midi.MidiSystem', getSynthesizer, [], Synth),
8 jpl_call( Synth, open, [], _),
9 jpl_call( Synth, getChannels, [], Channels),
10 jpl_get( Channels, 0, Channel0), % i.e. Channel0 = Channels[0]
11 jpl_midi_demo( N, Channel0),
12 jpl_call( Synth, close, [], _).
13
14
15 jpl_midi_demo( N, Channel) :-
16 ( N @> 0
17 -> Note is 50+random(50), % see MIDI docs for pitch relationship
18 Velocity is 100, % arbitrary value > 0
19 jpl_call( Channel, noteOn, [Note,Velocity], _),
20 sleep( 0.5), % play note for approx 0.5 seconds
21 jpl_call( Channel, noteOff, [Note], _),
22 Nx is N-1,
23 jpl_midi_demo( Nx, Channel) % play remaining notes
24 ; true
25 ).
26
27
28 % this directive runs the above demo
29
30 :- jpl_midi_demo.
31
66 jpl_table_demo :-
77 findall(
88 Ar,
9 ( current_prolog_flag( N, V), % assume atom(N)
10 term_to_atom( V, Va),
11 jpl_list_to_array( [N,Va], Ar) % or jpl_new( '[Ljava.lang.String;', [N,Va], Ar)
9 ( current_prolog_flag(N, V), % assume atom(N)
10 term_to_atom(V, Va),
11 jpl_list_to_array([N,Va], Ar) % or jpl_new('[Ljava.lang.String;', [N,Va], Ar)
1212 ),
1313 Ars
1414 ),
15 jpl_list_to_array( Ars, Ac), % or jpl_new( '[[Ljava.lang.String;', Ars, Ac)
16 jpl_list_to_array( [name,value], Ah),
17 jpl_new( 'javax.swing.JFrame', ['current_prolog_flag'], F),
18 jpl_call( F, getContentPane, [], CP),
19 jpl_new( 'javax.swing.JTable', [Ac,Ah], T),
20 jpl_new( 'javax.swing.JScrollPane', [T], SP),
21 jpl_call( CP, add, [SP,'Center'], _),
22 jpl_call( F, setSize, [600,400], _),
23 jpl_call( F, setVisible, [@(true)], _).
15 jpl_list_to_array(Ars, Ac), % or jpl_new('[[Ljava.lang.String;', Ars, Ac)
16 jpl_list_to_array([name,value], Ah),
17 jpl_new('javax.swing.JFrame', ['current_prolog_flag'], F),
18 jpl_call(F, getContentPane, [], CP),
19 jpl_new('javax.swing.JTable', [Ac,Ah], T),
20 jpl_new('javax.swing.JScrollPane', [T], SP),
21 jpl_call(CP, add, [SP,'Center'], _),
22 jpl_call(F, setSize, [600,400], _),
23 jpl_call(F, setVisible, [@(true)], _).
2424
2525
2626 % this directive runs the above demo
33 % and awaits text entry and OK/Cancel button click
44
55 jpl_text_entry_demo :-
6 jpl_new( 'javax.swing.JFrame', ['frame with dialog'], F),
7 jpl_call( F, setLocation, [400,300], _),
8 jpl_call( F, setSize, [400,300], _),
9 jpl_call( F, setVisible, [@(true)], _),
10 jpl_call( F, toFront, [], _),
11 jpl_call( 'javax.swing.JOptionPane', showInputDialog, [F,'type your name'], N),
12 jpl_call( F, dispose, [], _),
6 jpl_new('javax.swing.JFrame', ['frame with dialog'], F),
7 jpl_call(F, setLocation, [400,300], _),
8 jpl_call(F, setSize, [400,300], _),
9 jpl_call(F, setVisible, [@(true)], _),
10 jpl_call(F, toFront, [], _),
11 jpl_call('javax.swing.JOptionPane', showInputDialog, [F,'type your name'], N),
12 jpl_call(F, dispose, [], _),
1313 ( N == @(null)
14 -> write( 'you cancelled')
15 ; write( 'you typed '), write( N)
14 -> write('you cancelled')
15 ; write('you typed '), write(N)
1616 ),
1717 nl.
1818
00 :- use_module(library(jpl)).
11
22 jpl_versions_demo :-
3 jpl_call( 'jpl.JPL', version_string, [], Vj),
4 jpl_c_lib_version( Vc),
5 jpl_pl_lib_version( Vp),
6
3 jpl_call('org.jpl7.JPL', version_string, [], Vj),
4 jpl_c_lib_version(Vc),
5 jpl_pl_lib_version(Vp),
76 nl,
8 write( 'prolog library version: '), write( Vp), nl,
9 write( ' java library version: '), write( Vj), nl,
10 write( ' c library version: '), write( Vc), nl,
7 write('prolog library version: '), write( Vp), nl,
8 write(' java library version: '), write( Vj), nl,
9 write(' c library version: '), write( Vc), nl,
1110 ( Vp == Vj,
1211 Vj == Vc
13 -> write( 'BINGO! you appear to have the same version of each library installed'), nl
14 ; write( 'WHOOPS! you appear not to have the same version of each library installed'), nl
12 -> write('BINGO! you appear to have the same version of each library installed'), nl
13 ; write('WHOOPS! you appear not to have the same version of each library installed'), nl
1514 ),
1615 nl.
1716
826826 This exemplifies an alternative (to jpl_servlet_byref) tactic for
827827 implementing a servlet in Prolog; most Request fields are extracted in
828828 Java before this is called, and passed in as a multimap (a map, some of
829 whose values are maps).
829 whose values are maps).</dd>
830 <dt class="pubdef"><a name="jpl_pl_syntax/1"><strong>jpl_pl_syntax</strong>(<var>-Syntax:atom</var>)</a></dt>
831 <dd class="defbody">
832 unifies <var>Syntax</var> with 'traditional' or 'modern' according to
833 the mode in which SWI Prolog 7.x was started
830834 </dd>
831835 </dl>
832836
868872 <dt><a class="idx" href="#jpl_object_to_class/2">jpl_object_to_class/2</a></dt>
869873 <dt><a class="idx" href="#jpl_object_to_type/2">jpl_object_to_type/2</a></dt>
870874 <dt><a class="idx" href="#jpl_pl_lib_version/1">jpl_pl_lib_version/1</a></dt>
875 <dt><a class="idx" href="#jpl_pl_syntax/1">jpl_pl_syntax/1</a></dt>
871876 <dt><a class="idx" href="#jpl_primitive_type/1">jpl_primitive_type/1</a></dt>
872877 <dt><a class="idx" href="#jpl_ref_to_type/2">jpl_ref_to_type/2</a></dt>
873878 <dt><a class="idx" href="#jpl_servlet_byref/3">jpl_servlet_byref/3</a></dt>
3434 jpl_get_actual_jvm_opts/1,
3535 jpl_pl_lib_version/1,
3636 jpl_c_lib_version/1,
37 jpl_pl_syntax/1,
3738 jpl_new/3,
3839 jpl_call/4,
3940 jpl_get/3,
12291230 % Status = alpha.
12301231 % ==
12311232
1232 jpl_pl_lib_version(7, 0, 0, alpha).
1233 jpl_pl_lib_version(7, 0, 1, alpha). % 15/Jun/2015
12331234
12341235 %! jpl_c_lib_version(-Version)
12351236 %
25872588 -> ( cyclic_term(Term)
25882589 -> throw(error(type_error(acyclic,Term),context(jpl_datum_to_type/2,'must be acyclic')))
25892590 ; atom(Term)
2590 -> T = class([jpl],['Atom'])
2591 -> T = class([org,jpl7],['Atom'])
25912592 ; integer(Term)
2592 -> T = class([jpl],['Integer'])
2593 -> T = class([org,jpl7],['Integer'])
25932594 ; float(Term)
2594 -> T = class([jpl],['Float'])
2595 -> T = class([org,jpl7],['Float'])
25952596 ; var(Term)
2596 -> T = class([jpl],['Variable'])
2597 ; T = class([jpl],['Compound'])
2597 -> T = class([org,jpl7],['Variable'])
2598 ; T = class([org,jpl7],['Compound'])
25982599 )
25992600 ).
26002601
35483549
35493550 jpl_terms_to_array(Ts, A) :-
35503551 jpl_terms_to_array_1(Ts, Ts2),
3551 jpl_new(array(class([jpl],['Term'])), Ts2, A).
3552 jpl_new(array(class([org,jpl7],['Term'])), Ts2, A).
35523553
35533554
35543555 jpl_terms_to_array_1([], []).
38483849
38493850 %! to_atom(+Term, -Atom)
38503851 %
3851 % unifies Atom with a printed representation of Term.
3852 % unifies Atom with a printed representation of Term.
38523853 %
38533854 % @tbd Sort of quoting requirements and use format(codes(Codes),...)
38543855
38583859 ; term_to_atom(Term, Atom)
38593860 ).
38603861
3862 %! jpl_pl_syntax(-Syntax:atom)
3863 %
3864 % unifies Syntax with 'traditional' or 'modern' according to the mode in which SWI Prolog 7.x was started
3865
3866 jpl_pl_syntax(Syntax) :-
3867 ( [] == '[]'
3868 -> Syntax = traditional
3869 ; Syntax = modern
3870 ).
38613871
38623872 /*******************************
38633873 * MESSAGES *
4141 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
4242
4343 /* update this to distinguish releases of this C library: */
44 #define JPL_C_LIB_VERSION "7.0.0-alpha"
44 #define JPL_C_LIB_VERSION "7.0.1-alpha"
4545 #define JPL_C_LIB_VERSION_MAJOR 7
4646 #define JPL_C_LIB_VERSION_MINOR 0
47 #define JPL_C_LIB_VERSION_PATCH 0
47 #define JPL_C_LIB_VERSION_PATCH 1
4848 #define JPL_C_LIB_VERSION_STATUS "alpha"
4949
5050 /*#define DEBUG(n, g) ((void)0) */
441441 /*=== JPL initialisation macros (typically succeed cheaply) ======================================== */
442442
443443 /* outcomes: */
444 /* fail to find jpl.*, jpl.fli.* classes or to convert init args to String[]: exception, FALSE */
444 /* fail to find org.jpl7.*, org.jpl7.fli.* classes or to convert init args to String[]: exception, FALSE */
445445 /* JPL is (newly or already) out of RAW state: TRUE */
446446 #define jpl_ensure_jpl_init(e) ( jpl_status != JPL_INIT_RAW \
447447 || jpl_ensure_jpl_init_1(e) \
532532 static jclass c_class; /* java.lang.Class (rename to jClass_c ?) */
533533 static jmethodID c_getName; /* java.lang.Class' getName() (rename to jClassGetName_m ?) */
534534 static jclass str_class; /* java.lang.String (this duplicates jString_c below) */
535 static jclass term_class; /* jpl.Term */
536 static jclass termt_class; /* jpl.fli.term_t */
535 static jclass term_class; /* org.jpl7.Term */
536 static jclass termt_class; /* org.jpl7.fli.term_t */
537537
538538 static jclass sys_class; /* java.lang.System (rename to jSystem_c ?) */
539539 static jmethodID sys_ihc; /* java.lang.System's identityHashCode() (rename to jSystemIdentityHashCode_m ?) */
540 static jmethodID term_getTerm; /* jpl.Term's getTerm() */
541 static jmethodID term_put; /* jpl.Term's put() */
542 static jmethodID term_putTerm; /* jpl.Term's static putTerm(Term,term_t) */
540 static jmethodID term_getTerm; /* org.jpl7.Term's getTerm() */
541 static jmethodID term_put; /* org.jpl7.Term's put() */
542 static jmethodID term_putTerm; /* org.jpl7.Term's static putTerm(Term,term_t) */
543543
544544
545545 /*=== JPL's reusable global class object refs, initialised by jpl_ensure_jpl_init() ================ */
582582 const char *default_args[] = { "swipl",
583583 "-g", "true",
584584 "-nosignals",
585 "--traditional",
586585 NULL
587586 }; /* *must* have final NULL */
588587
857856 /* NB this delivers an atom_t, not a term_t */
858857 /* returns FALSE if the String arg is NULL */
859858 static bool
860 jni_String_to_atom( /* called from JNI_jobject_to_term(J,T) and jpl.fli.Prolog#new_atom() */
859 jni_String_to_atom( /* called from JNI_jobject_to_term(J,T) and org.jpl7.fli.Prolog#new_atom() */
861860 JNIEnv *env,
862861 jobject s,
863862 atom_t *a
14101409 && ( (*env)->DeleteLocalRef(env,lref), TRUE)
14111410 && (sys_ihc=(*env)->GetStaticMethodID(env,sys_class,"identityHashCode","(Ljava/lang/Object;)I")) != NULL
14121411
1413 && (lref=(*env)->FindClass(env,"jpl/Term")) != NULL
1412 && (lref=(*env)->FindClass(env,"org/jpl7/Term")) != NULL
14141413 && (term_class=(*env)->NewGlobalRef(env,lref)) != NULL
14151414 && ( (*env)->DeleteLocalRef(env,lref), TRUE)
1416 && (term_getTerm=(*env)->GetStaticMethodID(env,term_class,"getTerm","(Ljpl/fli/term_t;)Ljpl/Term;")) != NULL
1417 && (term_put=(*env)->GetMethodID(env,term_class,"put","(Ljpl/fli/term_t;)V")) != NULL
1418 && (term_putTerm=(*env)->GetStaticMethodID(env,term_class,"putTerm","(Ljava/lang/Object;Ljpl/fli/term_t;)V")) != NULL
1419
1420 && (lref=(*env)->FindClass(env,"jpl/fli/term_t")) != NULL
1415 && (term_getTerm=(*env)->GetStaticMethodID(env,term_class,"getTerm","(Lorg/jpl7/fli/term_t;)Lorg/jpl7/Term;")) != NULL
1416 && (term_put=(*env)->GetMethodID(env,term_class,"put","(Lorg/jpl7/fli/term_t;)V")) != NULL
1417 && (term_putTerm=(*env)->GetStaticMethodID(env,term_class,"putTerm","(Ljava/lang/Object;Lorg/jpl7/fli/term_t;)V")) != NULL
1418
1419 && (lref=(*env)->FindClass(env,"org/jpl7/fli/term_t")) != NULL
14211420 && (termt_class=(*env)->NewGlobalRef(env,lref)) != NULL
14221421 && ( (*env)->DeleteLocalRef(env,lref), TRUE)
14231422
32663265
32673266
32683267 /* outcomes: */
3269 /* fail to find jpl.*, jpl.fli.* classes or to convert init args to String[]: exception, FALSE */
3268 /* fail to find org.jpl7.*, org.jpl7.fli.* classes or to convert init args to String[]: exception, FALSE */
32703269 /* all OK: TRUE */
32713270 static bool
32723271 jpl_do_jpl_init( /* to be called once only, after PL init, before any JPL calls */
33103309 (*env)->SetObjectArrayElement(env,pvm_dia,i,to); /* any errors/exceptions to be handled here? */
33113310 }
33123311
3313 if ( (tc=(*env)->FindClass(env,"jpl/JPLException")) == NULL
3312 if ( (tc=(*env)->FindClass(env,"org/jpl7/JPLException")) == NULL
33143313 || (jJPLException_c=(*env)->NewGlobalRef(env,tc)) == NULL
33153314 || ( (*env)->DeleteLocalRef(env,tc), FALSE)
33163315
3317 || (tc=(*env)->FindClass(env,"jpl/fli/term_t")) == NULL
3316 || (tc=(*env)->FindClass(env,"org/jpl7/fli/term_t")) == NULL
33183317 || (jTermT_c=(*env)->NewGlobalRef(env,tc)) == NULL
33193318 || ( (*env)->DeleteLocalRef(env,tc), FALSE)
33203319
3321 || (tc=(*env)->FindClass(env,"jpl/fli/atom_t")) == NULL
3320 || (tc=(*env)->FindClass(env,"org/jpl7/fli/atom_t")) == NULL
33223321 || (jAtomT_c=(*env)->NewGlobalRef(env,tc)) == NULL
33233322 || ( (*env)->DeleteLocalRef(env,tc), FALSE)
33243323
3325 || (tc=(*env)->FindClass(env,"jpl/fli/functor_t")) == NULL
3324 || (tc=(*env)->FindClass(env,"org/jpl7/fli/functor_t")) == NULL
33263325 || (jFunctorT_c=(*env)->NewGlobalRef(env,tc)) == NULL
33273326 || ( (*env)->DeleteLocalRef(env,tc), FALSE)
33283327
3329 || (tc=(*env)->FindClass(env,"jpl/fli/fid_t")) == NULL
3328 || (tc=(*env)->FindClass(env,"org/jpl7/fli/fid_t")) == NULL
33303329 || (jFidT_c=(*env)->NewGlobalRef(env,tc)) == NULL
33313330 || ( (*env)->DeleteLocalRef(env,tc), FALSE)
33323331
3333 || (tc=(*env)->FindClass(env,"jpl/fli/predicate_t")) == NULL
3332 || (tc=(*env)->FindClass(env,"org/jpl7/fli/predicate_t")) == NULL
33343333 || (jPredicateT_c=(*env)->NewGlobalRef(env,tc)) == NULL
33353334 || ( (*env)->DeleteLocalRef(env,tc), FALSE)
33363335
3337 || (tc=(*env)->FindClass(env,"jpl/fli/qid_t")) == NULL
3336 || (tc=(*env)->FindClass(env,"org/jpl7/fli/qid_t")) == NULL
33383337 || (jQidT_c=(*env)->NewGlobalRef(env,tc)) == NULL
33393338 || ( (*env)->DeleteLocalRef(env,tc), FALSE)
33403339
3341 || (tc=(*env)->FindClass(env,"jpl/fli/module_t")) == NULL
3340 || (tc=(*env)->FindClass(env,"org/jpl7/fli/module_t")) == NULL
33423341 || (jModuleT_c=(*env)->NewGlobalRef(env,tc)) == NULL
33433342 || ( (*env)->DeleteLocalRef(env,tc), FALSE)
33443343
3345 || (tc=(*env)->FindClass(env,"jpl/fli/engine_t")) == NULL
3344 || (tc=(*env)->FindClass(env,"org/jpl7/fli/engine_t")) == NULL
33463345 || (jEngineT_c=(*env)->NewGlobalRef(env,tc)) == NULL
33473346 || ( (*env)->DeleteLocalRef(env,tc), FALSE)
33483347
3349 || (tc=(*env)->FindClass(env,"jpl/fli/LongHolder")) == NULL
3348 || (tc=(*env)->FindClass(env,"org/jpl7/fli/LongHolder")) == NULL
33503349 || (jLongHolder_c=(*env)->NewGlobalRef(env,tc)) == NULL
33513350 || ( (*env)->DeleteLocalRef(env,tc), FALSE)
33523351
3353 || (tc=(*env)->FindClass(env,"jpl/fli/PointerHolder")) == NULL
3352 || (tc=(*env)->FindClass(env,"org/jpl7/fli/PointerHolder")) == NULL
33543353 || (jPointerHolder_c=(*env)->NewGlobalRef(env,tc)) == NULL
33553354 || ( (*env)->DeleteLocalRef(env,tc), FALSE)
33563355
3357 || (tc=(*env)->FindClass(env,"jpl/fli/IntHolder")) == NULL
3356 || (tc=(*env)->FindClass(env,"org/jpl7/fli/IntHolder")) == NULL
33583357 || (jIntHolder_c=(*env)->NewGlobalRef(env,tc)) == NULL
33593358 || ( (*env)->DeleteLocalRef(env,tc), FALSE)
33603359
3361 || (tc=(*env)->FindClass(env,"jpl/fli/Int64Holder")) == NULL
3360 || (tc=(*env)->FindClass(env,"org/jpl7/fli/Int64Holder")) == NULL
33623361 || (jInt64Holder_c=(*env)->NewGlobalRef(env,tc)) == NULL
33633362 || ( (*env)->DeleteLocalRef(env,tc), FALSE)
33643363
3365 || (tc=(*env)->FindClass(env,"jpl/fli/DoubleHolder")) == NULL
3364 || (tc=(*env)->FindClass(env,"org/jpl7/fli/DoubleHolder")) == NULL
33663365 || (jDoubleHolder_c=(*env)->NewGlobalRef(env,tc)) == NULL
33673366 || ( (*env)->DeleteLocalRef(env,tc), FALSE)
33683367
3369 || (tc=(*env)->FindClass(env,"jpl/fli/StringHolder")) == NULL
3368 || (tc=(*env)->FindClass(env,"org/jpl7/fli/StringHolder")) == NULL
33703369 || (jStringHolder_c=(*env)->NewGlobalRef(env,tc)) == NULL
33713370 || ( (*env)->DeleteLocalRef(env,tc), FALSE)
33723371
3373 || (tc=(*env)->FindClass(env,"jpl/fli/ObjectHolder")) == NULL
3372 || (tc=(*env)->FindClass(env,"org/jpl7/fli/ObjectHolder")) == NULL
33743373 || (jObjectHolder_c=(*env)->NewGlobalRef(env,tc)) == NULL
33753374 || ( (*env)->DeleteLocalRef(env,tc), FALSE)
33763375
3377 || (tc=(*env)->FindClass(env,"jpl/fli/BooleanHolder")) == NULL
3376 || (tc=(*env)->FindClass(env,"org/jpl7/fli/BooleanHolder")) == NULL
33783377 || (jBooleanHolder_c=(*env)->NewGlobalRef(env,tc)) == NULL
33793378 || ( (*env)->DeleteLocalRef(env,tc), FALSE)
33803379
33953394 || (jBooleanHolderValue_f=(*env)->GetFieldID(env,jBooleanHolder_c,"value","Z")) == NULL
33963395 )
33973396 {
3398 msg = "jpl_do_jpl_init(): failed to find jpl.* or jpl.fli.* classes";
3397 msg = "jpl_do_jpl_init(): failed to find org.jpl7.* or org.jpl7.fli.* classes";
33993398 goto err;
34003399 }
34013400
36233622 }
36243623
36253624
3626 /*=== initialisation-related native Java methods of jpl.fli.Prolog ================================= */
3625 /*=== initialisation-related native Java methods of org.jpl7.fli.Prolog ================================= */
36273626
36283627 /*
3629 * Class: jpl_fli_Prolog
3628 * Class: org_jpl7_fli_Prolog
36303629 * Method: get_default_init_args
36313630 * Signature: ()[Ljava/lang/String;
36323631 */
36343633 /* if already init then return NULL */
36353634 /* if already failed to init then throw an exception */
36363635 JNIEXPORT jobject JNICALL
3637 Java_jpl_fli_Prolog_get_1default_1init_1args(
3636 Java_org_jpl7_fli_Prolog_get_1default_1init_1args(
36383637 JNIEnv *env,
36393638 jclass jProlog
36403639 )
36463645
36473646 if ( jpl_status==JPL_INIT_JPL_FAILED || jpl_status==JPL_INIT_PVM_FAILED )
36483647 {
3649 msg = "jpl.fli.Prolog.set_default_init_args(): initialisation has already failed";
3648 msg = "org.jpl7.fli.Prolog.set_default_init_args(): initialisation has already failed";
36503649 goto err;
36513650 }
36523651
36623661
36633662
36643663 /*
3665 * Class: jpl_fli_Prolog
3664 * Class: org_jpl7_fli_Prolog
36663665 * Method: set_default_init_args
36673666 * Signature: ([Ljava/lang/String;)Z
36683667 */
36713670 /* if not yet init then set default init args from jargs and return TRUE */
36723671 /* if already init then return FALSE */
36733672 JNIEXPORT jboolean JNICALL
3674 Java_jpl_fli_Prolog_set_1default_1init_1args(
3673 Java_org_jpl7_fli_Prolog_set_1default_1init_1args(
36753674 JNIEnv *env,
36763675 jclass jProlog,
36773676 jobject jargs /* oughta be proper array, perhaps zero-length */
36843683
36853684 if ( jargs == NULL ) /* improper call */
36863685 {
3687 msg = "jpl.fli.Prolog.set_default_init_args() called with NULL arg";
3686 msg = "org.jpl7.fli.Prolog.set_default_init_args() called with NULL arg";
36883687 goto err;
36893688 }
36903689
36913690 if ( jpl_status==JPL_INIT_JPL_FAILED || jpl_status==JPL_INIT_PVM_FAILED )
36923691 {
3693 msg = "jpl.fli.Prolog.set_default_init_args(): initialisation has already failed";
3692 msg = "org.jpl7.fli.Prolog.set_default_init_args(): initialisation has already failed";
36943693 goto err;
36953694 }
36963695
37123711
37133712
37143713 /*
3715 * Class: jpl_fli_Prolog
3714 * Class: org_jpl7_fli_Prolog
37163715 * Method: get_actual_init_args
37173716 * Signature: ()[Ljava/lang/String;
37183717 */
37203719 /* if already init then return actual init args as String[] */
37213720 /* if already failed to init then throw an exception */
37223721 JNIEXPORT jobject JNICALL
3723 Java_jpl_fli_Prolog_get_1actual_1init_1args(
3722 Java_org_jpl7_fli_Prolog_get_1actual_1init_1args(
37243723 JNIEnv *env,
37253724 jclass jProlog
37263725 )
37323731
37333732 if ( jpl_status==JPL_INIT_JPL_FAILED || jpl_status==JPL_INIT_PVM_FAILED )
37343733 {
3735 msg = "jpl.fli.Prolog.get_actual_init_args(): initialisation has already failed";
3734 msg = "org.jpl7.fli.Prolog.get_actual_init_args(): initialisation has already failed";
37363735 goto err;
37373736 }
37383737
37483747
37493748
37503749 /*
3751 * Class: jpl_fli_Prolog
3750 * Class: org_jpl7_fli_Prolog
37523751 * Method: initialise
37533752 * Signature: ()Z
37543753 */
37563755 /* if already failed to init then throw an exception */
37573756 /* else attempt to init and if success then return TRUE else throw an exception */
37583757 JNIEXPORT jboolean JNICALL
3759 Java_jpl_fli_Prolog_initialise(
3758 Java_org_jpl7_fli_Prolog_initialise(
37603759 JNIEnv *env,
37613760 jclass jProlog
37623761 )
37683767
37693768 if ( jpl_status==JPL_INIT_JPL_FAILED || jpl_status==JPL_INIT_PVM_FAILED )
37703769 {
3771 msg = "jpl.fli.Prolog.initialise(): initialisation has already failed";
3770 msg = "org.jpl7.fli.Prolog.initialise(): initialisation has already failed";
37723771 goto err;
37733772 }
37743773
37893788
37903789
37913790 /*
3792 * Class: jpl_fli_Prolog
3791 * Class: org_jpl7_fli_Prolog
37933792 * Method: halt
37943793 * Signature: (I)V
37953794 */
37963795 JNIEXPORT void JNICALL
3797 Java_jpl_fli_Prolog_halt(
3796 Java_org_jpl7_fli_Prolog_halt(
37983797 JNIEnv *env,
37993798 jclass jProlog,
38003799 jint jstatus
38113810 /*-----------------------------------------------------------------------
38123811 * getLongValue
38133812 *
3814 * Retrieves the value in a jpl.fli.LongHolder (or subclass) instance
3813 * Retrieves the value in a org.jpl7.fli.LongHolder (or subclass) instance
38153814 *
38163815 * @param env Java environment
38173816 * @param jlong_holder the LongHolder class instance, or null
38313830 *lv = 0L;
38323831 return FALSE;
38333832 }
3834 else /* Java compilation ensures it's a jpl.fli.LongHolder instance */
3833 else /* Java compilation ensures it's a org.jpl7.fli.LongHolder instance */
38353834 {
38363835 *lv = (*env)->GetLongField(env,jlong_holder,jLongHolderValue_f);
38373836 return TRUE;
38673866 /*-----------------------------------------------------------------------
38683867 * getPointerValue
38693868 *
3870 * Retrieves the value in a jpl.fli.PointerHolder instance
3869 * Retrieves the value in a org.jpl7.fli.PointerHolder instance
38713870 *
38723871 * @param env Java environment
38733872 * @param jpointer_holder the PointerHolder class instance, or null
38873886 *pv = (pointer)NULL;
38883887 return FALSE;
38893888 }
3890 else /* Java compilation ensures it's a jpl.fli.PointerHolder instance */
3889 else /* Java compilation ensures it's a org.jpl7.fli.PointerHolder instance */
38913890 {
38923891 *pv = (pointer)(*env)->GetLongField(env,jpointer_holder,jPointerHolderValue_f);
38933892 return TRUE;
38983897 /*-----------------------------------------------------------------------
38993898 * setPointerValue
39003899 *
3901 * Sets the value in a jpl.fli.Pointer class instance (unless it's null)
3900 * Sets the value in a org.jpl7.fli.Pointer class instance (unless it's null)
39023901 * to the supplied value (maybe 0L)
39033902 *
39043903 * @param env Java environment
41734172
41744173
41754174 /*
4176 * Class: jpl_fli_Prolog
4175 * Class: org_jpl7_fli_Prolog
41774176 * Method: action_abort
41784177 * Signature: ()I
41794178 */
41804179 JNIEXPORT int JNICALL
4181 Java_jpl_fli_Prolog_action_1abort(
4180 Java_org_jpl7_fli_Prolog_action_1abort(
41824181 JNIEnv *env,
41834182 jclass jProlog
41844183 )
41964195
41974196
41984197 /*
4199 * Class: jpl_fli_Prolog
4198 * Class: org_jpl7_fli_Prolog
42004199 * Method: atom_chars
4201 * Signature: (Ljpl/fli/atom_t;)Ljava/lang/String;
4200 * Signature: (Lorg/jpl7/fli/atom_t;)Ljava/lang/String;
42024201 */
42034202 JNIEXPORT jstring JNICALL /* the local ref goes out of scope, */
4204 Java_jpl_fli_Prolog_atom_1chars( /* but the string itself doesn't */
4203 Java_org_jpl7_fli_Prolog_atom_1chars( /* but the string itself doesn't */
42054204 JNIEnv *env,
42064205 jclass jProlog,
42074206 jobject jatom
42214220
42224221
42234222 /*
4224 * Class: jpl_fli_Prolog
4223 * Class: org_jpl7_fli_Prolog
42254224 * Method: attach_engine
4226 * Signature: (Ljpl/fli/engine_t;)I
4225 * Signature: (Lorg/jpl7/fli/engine_t;)I
42274226 */
42284227 JNIEXPORT int JNICALL
4229 Java_jpl_fli_Prolog_attach_1engine(
4228 Java_org_jpl7_fli_Prolog_attach_1engine(
42304229 JNIEnv *env,
42314230 jclass jProlog,
42324231 jobject jengine
42634262
42644263
42654264 /*
4266 * Class: jpl_fli_Prolog
4265 * Class: org_jpl7_fli_Prolog
42674266 * Method: close_query
4268 * Signature: (Ljpl/fli/qid_t;)V
4267 * Signature: (Lorg/jpl7/fli/qid_t;)V
42694268 */
42704269 JNIEXPORT void JNICALL
4271 Java_jpl_fli_Prolog_close_1query(
4270 Java_org_jpl7_fli_Prolog_close_1query(
42724271 JNIEnv *env,
42734272 jclass jProlog,
42744273 jobject jqid
42894288
42904289
42914290 /*
4292 * Class: jpl_fli_Prolog
4291 * Class: org_jpl7_fli_Prolog
42934292 * Method: compare
4294 * Signature: (Ljpl/fli/term_t;Ljpl/fli/term_t;)I
4293 * Signature: (Lorg/jpl7/fli/term_t;Lorg/jpl7/fli/term_t;)I
42954294 */
42964295 JNIEXPORT jint JNICALL /* returns -1, 0 or 1 (or -2 for error) */
4297 Java_jpl_fli_Prolog_compare(
4296 Java_org_jpl7_fli_Prolog_compare(
42984297 JNIEnv *env,
42994298 jclass jProlog,
43004299 jobject jterm1,
43214320
43224321
43234322 /*
4324 * Class: jpl_fli_Prolog
4323 * Class: org_jpl7_fli_Prolog
43254324 * Method: cons_functor_v
4326 * Signature: (Ljpl/fli/term_t;Ljpl/fli/functor_t;Ljpl/fli/term_t;)V
4325 * Signature: (Lorg/jpl7/fli/term_t;Lorg/jpl7/fli/functor_t;Lorg/jpl7/fli/term_t;)V
43274326 */
43284327 JNIEXPORT jboolean JNICALL
4329 Java_jpl_fli_Prolog_cons_1functor_1v(
4328 Java_org_jpl7_fli_Prolog_cons_1functor_1v(
43304329 JNIEnv *env,
43314330 jclass jProlog,
43324331 jobject jterm,
43514350
43524351
43534352 /*
4354 * Class: jpl_fli_Prolog
4353 * Class: org_jpl7_fli_Prolog
43554354 * Method: copy_term_ref
4356 * Signature: (Ljpl/fli/term_t;)Ljpl/fli/term_t;
4355 * Signature: (Lorg/jpl7/fli/term_t;)Lorg/jpl7/fli/term_t;
43574356 */
43584357 JNIEXPORT jobject JNICALL
4359 Java_jpl_fli_Prolog_copy_1term_1ref(
4358 Java_org_jpl7_fli_Prolog_copy_1term_1ref(
43604359 JNIEnv *env,
43614360 jclass jProlog,
43624361 jobject jfrom
43804379
43814380
43824381 /*
4383 * Class: jpl_fli_Prolog
4382 * Class: org_jpl7_fli_Prolog
43844383 * Method: current_engine
4385 * Signature: ()Ljpl/fli/engine_t;
4384 * Signature: ()Lorg/jpl7/fli/engine_t;
43864385 */
43874386 JNIEXPORT jobject JNICALL
4388 Java_jpl_fli_Prolog_current_1engine(
4387 Java_org_jpl7_fli_Prolog_current_1engine(
43894388 JNIEnv *env,
43904389 jclass jProlog
43914390 )
44064405
44074406
44084407 /*
4409 * Class: jpl_fli_Prolog
4408 * Class: org_jpl7_fli_Prolog
44104409 * Method: current_engine_is_pool
44114410 * Signature: ()Z
44124411 */
44134412 JNIEXPORT jboolean JNICALL
4414 Java_jpl_fli_Prolog_current_1engine_1is_1pool(
4413 Java_org_jpl7_fli_Prolog_current_1engine_1is_1pool(
44154414 JNIEnv *env,
44164415 jclass jProlog
44174416 )
44294428
44304429
44314430 /*
4432 * Class: jpl_fli_Prolog
4431 * Class: org_jpl7_fli_Prolog
44334432 * Method: exception
4434 * Signature: (Ljpl/fli/qid_t;)Ljpl/fli/term_t;
4433 * Signature: (Lorg/jpl7/fli/qid_t;)Lorg/jpl7/fli/term_t;
44354434 */
44364435 JNIEXPORT jobject JNICALL
4437 Java_jpl_fli_Prolog_exception(
4436 Java_org_jpl7_fli_Prolog_exception(
44384437 JNIEnv *env,
44394438 jclass jProlog,
44404439 jobject jqid
44684467
44694468
44704469 /*
4471 * Class: jpl_fli_Prolog
4470 * Class: org_jpl7_fli_Prolog
44724471 * Method: get_arg
4473 * Signature: (ILjpl/fli/term_t;Ljpl/fli/term_t;)Z
4472 * Signature: (ILorg/jpl7/fli/term_t;Lorg/jpl7/fli/term_t;)Z
44744473 */
44754474 JNIEXPORT jboolean JNICALL
4476 Java_jpl_fli_Prolog_get_1arg(
4475 Java_org_jpl7_fli_Prolog_get_1arg(
44774476 JNIEnv *env,
44784477 jclass jProlog,
44794478 jint jindex,
44954494
44964495
44974496 /*
4498 * Class: jpl_fli_Prolog
4497 * Class: org_jpl7_fli_Prolog
44994498 * Method: get_atom_chars
4500 * Signature: (Ljpl/fli/term_t;Ljpl/fli/StringHolder;)Z
4499 * Signature: (Lorg/jpl7/fli/term_t;Lorg/jpl7/fli/StringHolder;)Z
45014500 */
45024501 JNIEXPORT jboolean JNICALL
4503 Java_jpl_fli_Prolog_get_1atom_1chars(
4502 Java_org_jpl7_fli_Prolog_get_1atom_1chars(
45044503 JNIEnv *env,
45054504 jclass jProlog,
45064505 jobject jterm,
45224521
45234522
45244523 /*
4525 * Class: jpl_fli_Prolog
4524 * Class: org_jpl7_fli_Prolog
45264525 * Method: get_c_lib_version
45274526 * Signature: ()Ljava/lang/String;
45284527 */
45294528 JNIEXPORT jobject JNICALL
4530 Java_jpl_fli_Prolog_get_1c_1lib_1version(
4529 Java_org_jpl7_fli_Prolog_get_1c_1lib_1version(
45314530 JNIEnv *env,
45324531 jclass jProlog
45334532 )
45384537
45394538
45404539 /*
4541 * Class: jpl_fli_Prolog
4540 * Class: org_jpl7_fli_Prolog
45424541 * Method: get_float
4543 * Signature: (Ljpl/fli/term_t;Ljpl/fli/DoubleHolder;)Z
4542 * Signature: (Lorg/jpl7/fli/term_t;Lorg/jpl7/fli/DoubleHolder;)Z
45444543 */
45454544 JNIEXPORT jboolean JNICALL
4546 Java_jpl_fli_Prolog_get_1float(
4545 Java_org_jpl7_fli_Prolog_get_1float(
45474546 JNIEnv *env,
45484547 jclass jProlog,
45494548 jobject jterm,
45634562
45644563
45654564 /*
4566 * Class: jpl_fli_Prolog
4565 * Class: org_jpl7_fli_Prolog
45674566 * Method: get_integer
4568 * Signature: (Ljpl/fli/term_t;Ljpl/fli/Int64Holder;)Z
4567 * Signature: (Lorg/jpl7/fli/term_t;Lorg/jpl7/fli/Int64Holder;)Z
45694568 */
45704569 JNIEXPORT jboolean JNICALL
4571 Java_jpl_fli_Prolog_get_1integer(
4570 Java_org_jpl7_fli_Prolog_get_1integer(
45724571 JNIEnv *env,
45734572 jclass jProlog,
45744573 jobject jterm,
45884587
45894588
45904589 /*
4591 * Class: jpl_fli_Prolog
4592 * Method: get_name_arity
4593 * Signature: (Ljpl/fli/term_t;Ljpl/fli/StringHolder;Ljpl/fli/IntHolder;)Z
4590 * Class: org_jpl7_fli_Prolog
4591 * Method: get_integer_big
4592 * Signature: (Lorg/jpl7/fli/term_t;Lorg/jpl7/fli/StringHolder;)Z
45944593 */
45954594 JNIEXPORT jboolean JNICALL
4596 Java_jpl_fli_Prolog_get_1name_1arity(
4595 Java_org_jpl7_fli_Prolog_get_1integer_1big(
4596 JNIEnv *env,
4597 jclass jProlog,
4598 jobject jterm,
4599 jobject jbigint_holder /* we trust this is a StringHolder */
4600 )
4601 {
4602 term_t term;
4603 char *bigint;
4604 jstring jbigint;
4605
4606 return jpl_ensure_pvm_init(env)
4607 && jbigint_holder != NULL /* don't proceed if this holder is null */
4608 && getUIntPtrValue(env,jterm,&term) /* confirms that jterm isn't null */
4609 && PL_get_chars(term,&bigint,CVT_INTEGER) /* must copy chars pronto */
4610 && ( jbigint=(*env)->NewStringUTF(env,bigint) , TRUE ) /* this copies the chars */
4611 && setStringValue(env,jbigint_holder,jbigint) /* stash String ref in holder */
4612 ;
4613 }
4614
4615
4616 /*
4617 * Class: org_jpl7_fli_Prolog
4618 * Method: get_name_arity
4619 * Signature: (Lorg/jpl7/fli/term_t;Lorg/jpl7/fli/StringHolder;Lorg/jpl7/fli/IntHolder;)Z
4620 */
4621 JNIEXPORT jboolean JNICALL
4622 Java_org_jpl7_fli_Prolog_get_1name_1arity(
45974623 JNIEnv *env,
45984624 jclass jProlog,
45994625 jobject jterm,
46194645
46204646
46214647 /*
4622 * Class: jpl_fli_Prolog
4648 * Class: org_jpl7_fli_Prolog
46234649 * Method: get_string_chars
4624 * Signature: (Ljpl/fli/term_t;Ljpl/fli/StringHolder;)Z
4650 * Signature: (Lorg/jpl7/fli/term_t;Lorg/jpl7/fli/StringHolder;)Z
46254651 */
46264652 JNIEXPORT jboolean JNICALL
4627 Java_jpl_fli_Prolog_get_1string_1chars(
4653 Java_org_jpl7_fli_Prolog_get_1string_1chars(
46284654 JNIEnv *env,
46294655 jclass jProlog,
46304656 jobject jterm,
46444670
46454671
46464672 /*
4647 * Class: jpl_fli_Prolog
4673 * Class: org_jpl7_fli_Prolog
46484674 * Method: new_atom
4649 * Signature: (Ljava/lang/String;)Ljpl/fli/atom_t;
4675 * Signature: (Ljava/lang/String;)Lorg/jpl7/fli/atom_t;
46504676 */
46514677 JNIEXPORT jobject JNICALL
4652 Java_jpl_fli_Prolog_new_1atom(
4678 Java_org_jpl7_fli_Prolog_new_1atom(
46534679 JNIEnv *env,
46544680 jclass jProlog,
46554681 jstring jname
46714697
46724698
46734699 /*
4674 * Class: jpl_fli_Prolog
4700 * Class: org_jpl7_fli_Prolog
46754701 * Method: new_functor
4676 * Signature: (Ljpl/fli/atom_t;I)Ljpl/fli/functor_t;
4702 * Signature: (Lorg/jpl7/fli/atom_t;I)Lorg/jpl7/fli/functor_t;
46774703 */
46784704 JNIEXPORT jobject JNICALL
4679 Java_jpl_fli_Prolog_new_1functor(
4705 Java_org_jpl7_fli_Prolog_new_1functor(
46804706 JNIEnv *env,
46814707 jclass jProlog,
46824708 jobject jatom, /* read-only */
47014727
47024728
47034729 /*
4704 * Class: jpl_fli_Prolog
4730 * Class: org_jpl7_fli_Prolog
47054731 * Method: new_module
4706 * Signature: (Ljpl/fli/atom_t;)Ljpl/fli/module_t;
4732 * Signature: (Lorg/jpl7/fli/atom_t;)Lorg/jpl7/fli/module_t;
47074733 */
47084734 JNIEXPORT jobject JNICALL
4709 Java_jpl_fli_Prolog_new_1module(
4735 Java_org_jpl7_fli_Prolog_new_1module(
47104736 JNIEnv *env,
47114737 jclass jProlog,
47124738 jobject jatom
47294755
47304756
47314757 /*
4732 * Class: jpl_fli_Prolog
4758 * Class: org_jpl7_fli_Prolog
47334759 * Method: new_term_ref
4734 * Signature: ()Ljpl/fli/term_t;
4760 * Signature: ()Lorg/jpl7/fli/term_t;
47354761 */
47364762 JNIEXPORT jobject JNICALL
4737 Java_jpl_fli_Prolog_new_1term_1ref(
4763 Java_org_jpl7_fli_Prolog_new_1term_1ref(
47384764 JNIEnv *env,
47394765 jclass jProlog
47404766 )
47524778
47534779
47544780 /*
4755 * Class: jpl_fli_Prolog
4781 * Class: org_jpl7_fli_Prolog
47564782 * Method: new_term_refs
4757 * Signature: (I)Ljpl/fli/term_t;
4783 * Signature: (I)Lorg/jpl7/fli/term_t;
47584784 */
47594785 JNIEXPORT jobject JNICALL
4760 Java_jpl_fli_Prolog_new_1term_1refs(
4786 Java_org_jpl7_fli_Prolog_new_1term_1refs(
47614787 JNIEnv *env,
47624788 jclass jProlog,
47634789 jint jn
47834809
47844810
47854811 /*
4786 * Class: jpl_fli_Prolog
4812 * Class: org_jpl7_fli_Prolog
47874813 * Method: next_solution
4788 * Signature: (Ljpl/fli/qid_t;)Z
4814 * Signature: (Lorg/jpl7/fli/qid_t;)Z
47894815 */
47904816 JNIEXPORT jboolean JNICALL
4791 Java_jpl_fli_Prolog_next_1solution(
4817 Java_org_jpl7_fli_Prolog_next_1solution(
47924818 JNIEnv *env,
47934819 jclass jProlog,
47944820 jobject jqid /* read */
48134839
48144840
48154841 /*
4816 * Class: jpl_fli_Prolog
4842 * Class: org_jpl7_fli_Prolog
48174843 * Method: object_to_tag
48184844 * Signature: (Ljava/lang/Object;)Ljava/lang/String;
48194845 */
48204846 JNIEXPORT jobject JNICALL
4821 Java_jpl_fli_Prolog_object_1to_1tag(
4847 Java_org_jpl7_fli_Prolog_object_1to_1tag(
48224848 JNIEnv *env,
48234849 jclass jProlog,
48244850 jobject jobj
48564882
48574883
48584884 /*
4859 * Class: jpl_fli_Prolog
4885 * Class: org_jpl7_fli_Prolog
48604886 * Method: open_query
4861 * Signature: (Ljpl/fli/module_t;ILjpl/fli/predicate_t;Ljpl/fli/term_t;)Ljpl/fli/qid_t;
4887 * Signature: (Lorg/jpl7/fli/module_t;ILorg/jpl7/fli/predicate_t;Lorg/jpl7/fli/term_t;)Lorg/jpl7/fli/qid_t;
48624888 */
48634889 JNIEXPORT jobject JNICALL
4864 Java_jpl_fli_Prolog_open_1query(
4890 Java_org_jpl7_fli_Prolog_open_1query(
48654891 JNIEnv *env,
48664892 jclass jProlog,
48674893 jobject jmodule, /* read */
49024928
49034929
49044930 /*
4905 * Class: jpl_fli_Prolog
4931 * Class: org_jpl7_fli_Prolog
49064932 * Method: predicate
4907 * Signature: (Ljava/lang/String;ILjava/lang/String;)Ljpl/fli/predicate_t;
4933 * Signature: (Ljava/lang/String;ILjava/lang/String;)Lorg/jpl7/fli/predicate_t;
49084934 */
49094935 JNIEXPORT jobject JNICALL
4910 Java_jpl_fli_Prolog_predicate(
4936 Java_org_jpl7_fli_Prolog_predicate(
49114937 JNIEnv *env,
49124938 jclass jProlog,
49134939 jstring jname, /* ought not be null */
49474973
49484974
49494975 /*
4950 * Class: jpl_fli_Prolog
4976 * Class: org_jpl7_fli_Prolog
49514977 * Method: put_float
4952 * Signature: (Ljpl/fli/term_t;D)V
4978 * Signature: (Lorg/jpl7/fli/term_t;D)V
49534979 */
49544980 JNIEXPORT jboolean JNICALL
4955 Java_jpl_fli_Prolog_put_1float(JNIEnv *env,
4981 Java_org_jpl7_fli_Prolog_put_1float(JNIEnv *env,
49564982 jclass jProlog,
49574983 jobject jterm,
49584984 jdouble jf)
49684994
49694995
49704996 /*
4971 * Class: jpl_fli_Prolog
4997 * Class: org_jpl7_fli_Prolog
49724998 * Method: put_integer
4973 * Signature: (Ljpl/fli/term_t;J)V
4999 * Signature: (Lorg/jpl7/fli/term_t;J)V
49745000 */
49755001 JNIEXPORT jboolean JNICALL
4976 Java_jpl_fli_Prolog_put_1integer(JNIEnv *env,
5002 Java_org_jpl7_fli_Prolog_put_1integer(JNIEnv *env,
49775003 jclass jProlog,
49785004 jobject jterm,
49795005 jlong ji)
49895015
49905016
49915017 /*
4992 * Class: jpl_fli_Prolog
4993 * Method: put_nil
4994 * Signature: (Ljpl/fli/term_t;)V
5018 * Class: org_jpl7_fli_Prolog
5019 * Method: put_integer_big
5020 * Signature: (Lorg/jpl7/fli/term_t;Ljava/lang/String;)V
49955021 */
49965022 JNIEXPORT jboolean JNICALL
4997 Java_jpl_fli_Prolog_put_1nil(JNIEnv *env, // 1/Feb/2015
5023 Java_org_jpl7_fli_Prolog_put_1integer_1big(
5024 JNIEnv *env,
5025 jclass jProlog,
5026 jobject jterm,
5027 jstring jvalue
5028 )
5029 {
5030 term_t term;
5031
5032 if( jpl_ensure_pvm_init(env)
5033 && getUIntPtrValue(env, jterm, &term)
5034 ) {
5035 return PL_chars_to_term((char*)(*env)->GetStringUTFChars(env,jvalue,0), term);
5036 } else {
5037 return FALSE;
5038 }
5039 }
5040
5041
5042 /*
5043 * Class: org_jpl7_fli_Prolog
5044 * Method: put_nil
5045 * Signature: (Lorg/jpl7/fli/term_t;)V
5046 */
5047 JNIEXPORT jboolean JNICALL
5048 Java_org_jpl7_fli_Prolog_put_1nil(JNIEnv *env, // 1/Feb/2015
49985049 jclass jProlog,
49995050 jobject jterm)
50005051 { term_t term;
50095060
50105061
50115062 /*
5012 * Class: jpl_fli_Prolog
5063 * Class: org_jpl7_fli_Prolog
50135064 * Method: put_term
5014 * Signature: (Ljpl/fli/term_t;Ljpl/fli/term_t;)V
5065 * Signature: (Lorg/jpl7/fli/term_t;Lorg/jpl7/fli/term_t;)V
50155066 */
50165067 JNIEXPORT void JNICALL /* maybe oughta return jboolean (false iff given object is null) */
5017 Java_jpl_fli_Prolog_put_1term(
5068 Java_org_jpl7_fli_Prolog_put_1term(
50185069 JNIEnv *env,
50195070 jclass jProlog,
50205071 jobject jterm1,
50355086
50365087
50375088 /*
5038 * Class: jpl_fli_Prolog
5089 * Class: org_jpl7_fli_Prolog
50395090 * Method: put_jref
5040 * Signature: (Ljpl/fli/term_t;Ljava/lang/Object;)V
5091 * Signature: (Lorg/jpl7/fli/term_t;Ljava/lang/Object;)V
50415092 */
5042 /* added 29/1/2007 PS to support restored but now deprecated jpl.JRef for Rick Moynihan */
5093 /* added 29/1/2007 PS to support restored but now deprecated org.jpl7.JRef for Rick Moynihan */
50435094 JNIEXPORT void JNICALL
5044 Java_jpl_fli_Prolog_put_1jref(
5095 Java_org_jpl7_fli_Prolog_put_1jref(
50455096 JNIEnv *env,
50465097 jclass jProlog,
50475098 jobject jterm,
50645115
50655116
50665117 /*
5067 * Class: jpl_fli_Prolog
5118 * Class: org_jpl7_fli_Prolog
50685119 * Method: tag_to_object
50695120 * Signature: (Ljava/lang/String;)Ljava/lang/Object;
50705121 */
5071 /* added 29/5/2008 PS to support alternative to deprecated jpl.JRef */
5122 /* added 29/5/2008 PS to support alternative to deprecated org.jpl7.JRef */
50725123 JNIEXPORT jobject JNICALL
5073 Java_jpl_fli_Prolog_tag_1to_1object(
5124 Java_org_jpl7_fli_Prolog_tag_1to_1object(
50745125 JNIEnv *env,
50755126 jclass jProlog,
50765127 jstring tag
50905141
50915142
50925143 /*
5093 * Class: jpl_fli_Prolog
5144 * Class: org_jpl7_fli_Prolog
50945145 * Method: is_tag
50955146 * Signature: (Ljava/lang/String;)Z
50965147 */
50975148 JNIEXPORT jboolean JNICALL
5098 Java_jpl_fli_Prolog_is_1tag(
5149 Java_org_jpl7_fli_Prolog_is_1tag(
50995150 JNIEnv *env,
51005151 jclass jProlog,
51015152 jstring tag
51165167
51175168
51185169 /*
5119 * Class: jpl_fli_Prolog
5170 * Class: org_jpl7_fli_Prolog
51205171 * Method: put_variable
5121 * Signature: (Ljpl/fli/term_t;)V
5172 * Signature: (Lorg/jpl7/fli/term_t;)V
51225173 */
51235174 JNIEXPORT void JNICALL /* maybe oughta return jboolean (false iff given object is null) */
5124 Java_jpl_fli_Prolog_put_1variable(
5175 Java_org_jpl7_fli_Prolog_put_1variable(
51255176 JNIEnv *env,
51265177 jclass jProlog,
51275178 jobject jterm
51395190
51405191
51415192 /*
5142 * Class: jpl_fli_Prolog
5193 * Class: org_jpl7_fli_Prolog
51435194 * Method: term_type
5144 * Signature: (Ljpl/fli/term_t;)I
5195 * Signature: (Lorg/jpl7/fli/term_t;)I
51455196 */
51465197 JNIEXPORT jint JNICALL
5147 Java_jpl_fli_Prolog_term_1type(
5198 Java_org_jpl7_fli_Prolog_term_1type(
51485199 JNIEnv *env,
51495200 jclass jProlog,
51505201 jobject jterm
51625213
51635214
51645215 /*
5165 * Class: jpl_fli_Prolog
5216 * Class: org_jpl7_fli_Prolog
51665217 * Method: unregister_atom
5167 * Signature: (Ljpl/fli/atom_t;)V
5218 * Signature: (Lorg/jpl7/fli/atom_t;)V
51685219 */
51695220 JNIEXPORT void JNICALL
5170 Java_jpl_fli_Prolog_unregister_1atom(
5221 Java_org_jpl7_fli_Prolog_unregister_1atom(
51715222 JNIEnv *env,
51725223 jclass jProlog,
51735224 jobject jatom
51895240
51905241
51915242 /*
5192 * Class: jpl_fli_Prolog
5243 * Class: org_jpl7_fli_Prolog
51935244 * Method: open_foreign_frame
5194 * Signature: ()Ljpl/fli/fid_t;
5245 * Signature: ()Lorg/jpl7/fli/fid_t;
51955246 */
51965247 JNIEXPORT jobject JNICALL
5197 Java_jpl_fli_Prolog_open_1foreign_1frame(
5248 Java_org_jpl7_fli_Prolog_open_1foreign_1frame(
51985249 JNIEnv *env,
51995250 jclass jProlog
52005251 )
52165267
52175268
52185269 /*
5219 * Class: jpl_fli_Prolog
5270 * Class: org_jpl7_fli_Prolog
52205271 * Method: discard_foreign_frame
5221 * Signature: (Ljpl/fli/fid_t;)V
5272 * Signature: (Lorg/jpl7/fli/fid_t;)V
52225273 */
52235274 JNIEXPORT void JNICALL
5224 Java_jpl_fli_Prolog_discard_1foreign_1frame(
5275 Java_org_jpl7_fli_Prolog_discard_1foreign_1frame(
52255276 JNIEnv *env,
52265277 jclass jProlog,
52275278 jobject jfid
52415292 /*=== JPL's Prolog engine pool and thread management =============================================== */
52425293
52435294 /*
5244 * Class: jpl_fli_Prolog
5295 * Class: org_jpl7_fli_Prolog
52455296 * Method: thread_self
52465297 * Signature: ()I
52475298 */
52485299 JNIEXPORT jint JNICALL
5249 Java_jpl_fli_Prolog_thread_1self(
5300 Java_org_jpl7_fli_Prolog_thread_1self(
52505301 JNIEnv *env,
52515302 jclass jProlog
52525303 )
52955346
52965347
52975348 /*
5298 * Class: jpl_fli_Prolog
5349 * Class: org_jpl7_fli_Prolog
52995350 * Method: attach_pool_engine
5300 * Signature: ()Ljpl/fli/engine_t;
5351 * Signature: ()Lorg/jpl7/fli/engine_t;
53015352 */
53025353 JNIEXPORT jobject JNICALL
5303 Java_jpl_fli_Prolog_attach_1pool_1engine(
5354 Java_org_jpl7_fli_Prolog_attach_1pool_1engine(
53045355 JNIEnv *env,
53055356 jclass jProlog
53065357 )
54105461
54115462 /* returns pool_index (0+) of given engine (else -1) */
54125463 /*
5413 * Class: jpl_fli_Prolog
5464 * Class: org_jpl7_fli_Prolog
54145465 * Method: pool_engine_id
5415 * Signature: (Ljpl/fli/engine_t;)I
5466 * Signature: (Lorg/jpl7/fli/engine_t;)I
54165467 */
54175468 JNIEXPORT int JNICALL
5418 Java_jpl_fli_Prolog_pool_1engine_1id(
5469 Java_org_jpl7_fli_Prolog_pool_1engine_1id(
54195470 JNIEnv *env,
54205471 jclass jProlog,
54215472 jobject jengine
54365487
54375488
54385489 /*
5439 * Class: jpl_fli_Prolog
5490 * Class: org_jpl7_fli_Prolog
54405491 * Method: release_pool_engine
54415492 * Signature: ()I
54425493 */
54435494 JNIEXPORT int JNICALL
5444 Java_jpl_fli_Prolog_release_1pool_1engine(
5495 Java_org_jpl7_fli_Prolog_release_1pool_1engine(
54455496 JNIEnv *env,
54465497 jclass jProlog
54475498 )
54735524 static foreign_t
54745525 jni_term_to_jref_plc(
54755526 term_t tref1, /* +term: AnyPrologTerm */
5476 term_t tref2 /* -term: JRef to a jpl.Term instance which represents that term */
5527 term_t tref2 /* -term: JRef to a org.jpl7.Term instance which represents that term */
54775528 )
54785529 {
54795530 jobject term1;
54955546 static bool
54965547 jni_jobject_to_term_byval(
54975548 JNIEnv *env,
5498 jobject jobj, /* this must be an instance of one of jpl.Term's subclasses */
5549 jobject jobj, /* this must be an instance of one of org.jpl7.Term's subclasses */
54995550 term_t term /* a Prolog term, as represented by jobj, is *put* into this term ref */
55005551 )
55015552 {
5502 jobject termt; /* a temporary instance of jpl.fli.term_t (i.e. a "term holder") */
5553 jobject termt; /* a temporary instance of org.jpl7.fli.term_t (i.e. a "term holder") */
55035554
55045555 return /* jni_ensure_jvm() && jpl_ensure_pvm_init(env) && */
55055556 (termt=(*env)->AllocObject(env,termt_class)) != NULL
55105561 }
55115562
55125563
5513 /* if the first arg is a jref i.e. @(Tag) which refers to a jpl.Term instance, */
5564 /* if the first arg is a jref i.e. @(Tag) which refers to a org.jpl7.Term instance, */
55145565 /* then the 2nd arg will be matched with a corresponding newly constructed term */
55155566 static foreign_t
55165567 jni_jref_to_term_plc(
5517 term_t jref, /* +term: JRef to a jpl.Term instance */
5568 term_t jref, /* +term: JRef to a org.jpl7.Term instance */
55185569 term_t termIn /* -term: term as represented by the JRef */
55195570 )
55205571 {
56815732
56825733
56835734 /*
5684 * Class: jpl_fli_Prolog
5735 * Class: org_jpl7_fli_Prolog
56855736 * Method: get_syntax
56865737 * Signature: ()I
56875738 */
56885739 JNIEXPORT jint JNICALL
5689 Java_jpl_fli_Prolog_get_1syntax(
5740 Java_org_jpl7_fli_Prolog_get_1syntax(
56905741 JNIEnv *env,
56915742 jclass jProlog
56925743 )
1313 TSTJAR=../../jpltest.jar
1414 JPLDOC=../../docs/java_api/javadoc
1515
16 CLS= jpl/Atom.java \
17 jpl/Compound.java \
18 jpl/Float.java \
19 jpl/Integer.java \
20 jpl/JRef.java \
21 jpl/JPLException.java \
22 jpl/JPL.java \
23 jpl/PrologException.java \
24 jpl/Query.java \
25 jpl/Term.java \
26 jpl/Util.java \
27 jpl/Variable.java \
28 jpl/Version.java
16 CLS= org/jpl7/Atom.java \
17 org/jpl7/Compound.java \
18 org/jpl7/Float.java \
19 org/jpl7/Integer.java \
20 org/jpl7/JRef.java \
21 org/jpl7/JPLException.java \
22 org/jpl7/JPL.java \
23 org/jpl7/PrologException.java \
24 org/jpl7/Query.java \
25 org/jpl7/Term.java \
26 org/jpl7/Util.java \
27 org/jpl7/Variable.java \
28 org/jpl7/Version.java
2929
30 FLI= jpl/fli/atom_t.java \
31 jpl/fli/BooleanHolder.java \
32 jpl/fli/DoubleHolder.java \
33 jpl/fli/engine_t.java \
34 jpl/fli/fid_t.java \
35 jpl/fli/functor_t.java \
36 jpl/fli/IntHolder.java \
37 jpl/fli/Int64Holder.java \
38 jpl/fli/LongHolder.java \
39 jpl/fli/module_t.java \
40 jpl/fli/ObjectHolder.java \
41 jpl/fli/PointerHolder.java \
42 jpl/fli/predicate_t.java \
43 jpl/fli/Prolog.java \
44 jpl/fli/qid_t.java \
45 jpl/fli/StringHolder.java \
46 jpl/fli/term_t.java
30 FLI= org/jpl7/fli/atom_t.java \
31 org/jpl7/fli/BooleanHolder.java \
32 org/jpl7/fli/DoubleHolder.java \
33 org/jpl7/fli/engine_t.java \
34 org/jpl7/fli/fid_t.java \
35 org/jpl7/fli/functor_t.java \
36 org/jpl7/fli/IntHolder.java \
37 org/jpl7/fli/Int64Holder.java \
38 org/jpl7/fli/LongHolder.java \
39 org/jpl7/fli/module_t.java \
40 org/jpl7/fli/ObjectHolder.java \
41 org/jpl7/fli/PointerHolder.java \
42 org/jpl7/fli/predicate_t.java \
43 org/jpl7/fli/Prolog.java \
44 org/jpl7/fli/qid_t.java \
45 org/jpl7/fli/StringHolder.java \
46 org/jpl7/fli/term_t.java
4747
48 TEST= jpl/test/Family.java \
49 jpl/test/FetchBigTree.java \
50 jpl/test/FetchLongList.java \
51 jpl/test/Ga2.java \
52 jpl/test/Ga.java \
53 jpl/test/Garbo.java \
54 jpl/test/Masstest.java \
55 jpl/test/MaxObjects.java \
56 jpl/test/ShadowA.java \
57 jpl/test/ShadowB.java \
58 jpl/test/SyntaxError.java \
59 jpl/test/Test.java \
60 jpl/test/TestJUnit.java \
61 jpl/test/TestOLD.java
48 TEST= org/jpl7/test/Family.java \
49 org/jpl7/test/FetchBigTree.java \
50 org/jpl7/test/FetchLongList.java \
51 org/jpl7/test/Ga2.java \
52 org/jpl7/test/Ga.java \
53 org/jpl7/test/Garbo.java \
54 org/jpl7/test/Masstest.java \
55 org/jpl7/test/MaxObjects.java \
56 org/jpl7/test/ShadowA.java \
57 org/jpl7/test/ShadowB.java \
58 org/jpl7/test/SyntaxError.java \
59 org/jpl7/test/Test.java \
60 org/jpl7/test/TestJUnit.java \
61 org/jpl7/test/TestOLD.java
6262
6363 JPLJAVA=$(CLS) $(FLI)
6464 TSTJAVA=$(TEST)
6969 test_jar: $(TSTJAR)
7070 jpl_doc: $(JPLDOC)
7171
72 $(JPLJAR): $(JPLJAVA)
72 .class-senitel: $(JPLJAVA)
7373 "$(JAVAC)" $(JAVACFLAGS) $(JPLJAVA)
74 touch $@
75
76 $(JPLJAR): .class-senitel
7477 "$(JAR)" cf $(JPLJAR) $(foreach basename,$(JPLJAVA:.java=),$(basename).class $(subst $$,\$$,$(wildcard $(basename)$$*.class)))
7578
7679 ifneq ($(JUNIT),)
8588 "$(JAVADOC)" $(JAVADOCFLAGS) -public -d $(JPLDOC) $(JPLJAVA)
8689
8790 clean::
88 rm -f *~ jpl/*.class jpl/test/*.class jpl/fli/*.class
91 rm -f .class-senitel *~ org/jpl7/*.class org/jpl7/test/*.class org/jpl7/fli/*.class
8992
9093 distclean: clean
9194 rm -f $(JPLJAR) $(TSTJAR) Makefile
+0
-2
packages/jpl/src/java/jpl/.cvsignore less more
0 *.class
1 Makefile
+0
-114
packages/jpl/src/java/jpl/Atom.java less more
0 package jpl;
1
2 import java.util.Map;
3
4 import jpl.fli.Prolog;
5 import jpl.fli.StringHolder;
6 import jpl.fli.term_t;
7
8 /**
9 * Atom is a specialised Compound with zero arguments, representing a Prolog atom with the same name. An Atom is constructed with a String parameter (its name, unquoted), which cannot thereafter be
10 * changed.
11 *
12 * <pre>
13 * Atom a = new Atom(&quot;hello&quot;);
14 * </pre>
15 *
16 * An Atom can be used (and re-used) as an argument of Compound Terms. Two Atom instances are equal (by equals()) iff they have equal names.
17 *
18 * <hr>
19 * <i> Copyright (C) 2004 Paul Singleton
20 * <p>
21 * Copyright (C) 1998 Fred Dushin
22 * <p>
23 *
24 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
25 * License, or (at your option) any later version.
26 * <p>
27 *
28 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29 * Library Public License for more details.
30 * <p>
31 * </i>
32 * <hr>
33 *
34 * @see jpl.Term
35 * @see jpl.Compound
36 */
37 public class Atom extends Compound {
38
39 protected final String blobType; // should this be private?
40
41 /**
42 * @param name
43 * the Atom's name (unquoted)
44 */
45 public Atom(String name) {
46 super(name);
47 this.blobType = "text";
48 }
49
50 public Atom(String name, String blobType) {
51 super(name);
52 if (blobType == null) {
53 throw new JPLException("cannot construct with null blobType");
54 } else {
55 this.blobType = blobType;
56 }
57 }
58
59 public final int type() {
60 return Prolog.ATOM;
61 }
62
63 public final String blobType() {
64 return this.blobType;
65 }
66
67 /**
68 * whether this Term denotes (syntax-specifically) an empty list
69 */
70 public boolean isListNil() {
71 return this.equals(JPL.LIST_NIL);
72 }
73
74 /**
75 * returns the name of the type of this term, as "Atom"
76 *
77 * @return the name of the type of this term, as "Atom"
78 */
79 public String typeName() { // overrides same in jpl.Term
80 return "Atom";
81 }
82
83 public Object jrefToObject() {
84 throw new JPLException("Atom.jrefToObject: term is not a JRef");
85 }
86
87 /**
88 * Returns a debug-friendly String representation of an Atom.
89 *
90 * @return a debug-friendly String representation of an Atom
91 * @deprecated
92 */
93 public String debugString() {
94 return "(Atom " + toString() + ")";
95 }
96
97 /**
98 * Converts a Prolog term (as a term_t), which is known to be a SWI-Prolog string, to a new jpl.Atom, by creating a new Atom object initialised with the string's value. JPL users should avoid
99 * SWI-Prolog's non-ISO strings, but in some obscure circumstances they are returned unavoidably, so we have to handle them (and this is how).
100 *
101 * @param vars_to_Vars
102 * A Map from Prolog variables to JPL Variables.
103 * @param term
104 * The term_t to convert
105 * @return A new Atom instance
106 */
107 protected static Term getString(Map<term_t, Variable> vars_to_Vars, term_t term) {
108 StringHolder holder = new StringHolder();
109 Prolog.get_string_chars(term, holder); // ignore return val; assume success...
110 return new Atom(holder.value);
111 }
112
113 }
+0
-370
packages/jpl/src/java/jpl/Compound.java less more
0 package jpl;
1
2 import java.util.Map;
3
4 import jpl.fli.Prolog;
5 import jpl.fli.term_t;
6
7 /**
8 * A Compound represents a structured term, comprising a functor and arguments (Terms). Atom is a subclass of Compound, whose instances have zero arguments. Direct instances of Compound must have one
9 * or more arguments (it is an error to attempt to construct a Compound with zero args; a JPLException will be thrown). For example, this Java expression yields a representation of the term f(a):
10 *
11 * <pre>
12 * new Compound(&quot;f&quot;, new Term[] { new Atom(&quot;a&quot;) })
13 * </pre>
14 *
15 * Note the use of the "anonymous array" notation to denote the arguments (an anonymous array of Term). <br>
16 * Alternatively, construct the Term from Prolog source syntax:
17 *
18 * <pre>
19 * Util.textToTerm(&quot;f(a)&quot;)
20 * </pre>
21 *
22 * The <i>arity</i> of a Compound is the quantity of its arguments. Once constructed, neither the name nor the arity of a Compound can be altered. An argument of a Compound can be replaced with the
23 * setArg() method.
24 * <hr>
25 * <i> Copyright (C) 2004 Paul Singleton
26 * <p>
27 * Copyright (C) 1998 Fred Dushin
28 * <p>
29 *
30 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
31 * License, or (at your option) any later version.
32 * <p>
33 *
34 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
35 * Library Public License for more details.
36 * <p>
37 * </i>
38 * <hr>
39 *
40 * @see jpl.Term
41 * @see jpl.Atom
42 */
43 public class Compound extends Term {
44 /**
45 * the name of this Compound
46 */
47 protected final String name;
48 /**
49 * the arguments of this Compound
50 */
51 protected final Term[] args;
52
53 /**
54 * Creates a Compound with name but no args (i.e. an Atom). This constructor is protected (from illegal public use) and is used only by Atom, which inherits it.
55 *
56 * @param name
57 * the name of this Compound
58 * @param args
59 * the arguments of this Compound
60 */
61 protected Compound(String name) {
62 if (name == null) {
63 throw new JPLException("jpl." + this.typeName() + ": cannot construct with null name");
64 } else {
65 this.name = name;
66 this.args = new Term[] {};
67 }
68 }
69
70 /**
71 * Creates a Compound with name and args.
72 *
73 * @param name
74 * the name of this Compound
75 * @param args
76 * the (one or more) arguments of this Compound
77 */
78 public Compound(String name, Term[] args) {
79 if (name == null) {
80 throw new JPLException("jpl.Compound: cannot construct with null name");
81 } else if (args == null) {
82 throw new JPLException("jpl.Compound: cannot construct with null args");
83 } else if (args.length == 0) {
84 throw new JPLException("jpl.Compound: cannot construct with zero args");
85 } else {
86 this.name = name;
87 this.args = args;
88 }
89 }
90
91 /**
92 * Creates a Compound with name and arity. This constructor, along with the setArg method, serves the new, native Prolog-term-to-Java-term routine, and is public only so as to be accessible via
93 * JNI: it is not intended for general use.
94 *
95 * @param name
96 * the name of this Compound
97 * @param arity
98 * the arity of this Compound
99 */
100 public Compound(String name, int arity) {
101 if (name == null) {
102 throw new JPLException("jpl.Compound: cannot construct with null name");
103 } else if (arity < 0) {
104 throw new JPLException("jpl.Compound: cannot construct with negative arity");
105 } else {
106 this.name = name;
107 this.args = new Term[arity];
108 }
109 }
110
111 /**
112 * Returns the ith argument (counting from 1) of this Compound; throws an ArrayIndexOutOfBoundsException if i is inappropriate.
113 *
114 * @return the ith argument (counting from 1) of this Compound
115 */
116 public final Term arg(int i) {
117 return args[i - 1];
118 }
119
120 /**
121 * Tests whether this Compound's functor has (String) 'name' and 'arity'.
122 *
123 * @return whether this Compound's functor has (String) 'name' and 'arity'
124 */
125 public final boolean hasFunctor(String name, int arity) {
126 return name.equals(this.name) && arity == args.length; // BUGFIX: was just name.equals(name)
127 }
128
129 /**
130 * whether this Term is a 'jboolean' structure denoting Java's false, i.e. @(false)
131 *
132 * @return whether this Term is a 'jboolean' structure denoting Java's false, i.e. @(false)
133 */
134 public boolean isJFalse() {
135 return hasFunctor("@", 1) && arg(1).hasFunctor("false", 0);
136 }
137
138 /**
139 * whether this Term is a 'jboolean' structure denoting Java's true, i.e. @(fatruelse)
140 *
141 * @return whether this Term is a 'jboolean' structure denoting Java's true, i.e. @(fatruelse)
142 */
143 public boolean isJTrue() {
144 return hasFunctor("@", 1) && arg(1).hasFunctor("true", 0);
145 }
146
147 /**
148 * whether this Term is a 'jnull' structure, i.e. @(null)
149 *
150 * @return whether this Term is a 'jnull' structure, i.e. @(null)
151 */
152 public boolean isJNull() {
153 return hasFunctor("@", 1) && arg(1).hasFunctor("null", 0);
154 }
155
156 /**
157 * whether this Term is a 'jvoid' structure, i.e. @(void)
158 *
159 * @return whether this Term is a 'jvoid' structure, i.e. @(void)
160 */
161 public boolean isJVoid() {
162 return hasFunctor("@", 1) && arg(1).hasFunctor("void", 0);
163 }
164
165 /**
166 * whether this Term is a 'jobject' structure, i.e. @(Tag)
167 *
168 * @return whether this Term is a 'jobject' structure, i.e. @(Tag)
169 */
170 public boolean isJObject() {
171 return hasFunctor("@", 1) && arg(1).isAtom() && JPL.isTag(arg(1).name());
172 }
173
174 /**
175 * whether this Term is a 'jref' structure, i.e. @(Tag) or @(null)
176 *
177 * @return whether this Term is a 'jref' structure, i.e. @(Tag) or @(null)
178 */
179 public boolean isJRef() {
180 return isJObject() || isJNull();
181 }
182
183 public final boolean isListPair() {
184 return args.length == 2 && name.equals(JPL.LIST_PAIR);
185 }
186
187 public Object jrefToObject() {
188 if (this.isJObject()) {
189 return Prolog.tag_to_object(arg(1).name());
190 } else if (this.isJNull()) {
191 return null;
192 } else {
193 throw new JPLException("Term.jrefToObject: term is not a JRef");
194 }
195 }
196
197 /**
198 * Returns the name (unquoted) of this Compound.
199 *
200 * @return the name (unquoted) of this Compound
201 */
202 public final String name() {
203 return name;
204 }
205
206 /**
207 * Returns the arity (1+) of this Compound.
208 *
209 * @return the arity (1+) of this Compound
210 */
211 public final int arity() {
212 return args.length;
213 }
214
215 /**
216 * Returns a prefix functional representation of a Compound of the form name(arg1,...), where 'name' is quoted iff necessary (to be valid Prolog soutce text) and each argument is represented
217 * according to its toString() method.
218 *
219 * @return string representation of an Compound
220 */
221 public String toString() {
222 return quotedName() + (args.length > 0 ? "(" + Term.toString(args) + ")" : "");
223 // return name() + (args.length > 0 ? "(" + Term.toString(args) + ")" : "");
224 }
225
226 /**
227 * Two Compounds are equal if they are identical (same object) or their names and arities are equal and their respective arguments are equal.
228 *
229 * @param obj
230 * the Object to compare (not necessarily another Compound)
231 * @return true if the Object satisfies the above condition
232 */
233 public final boolean equals(Object obj) {
234 return (this == obj || (obj instanceof Compound && name.equals(((Compound) obj).name) && Term.terms_equals(args, ((Compound) obj).args)));
235 }
236
237 /**
238 * returns the type of this term, as jpl.fli.Prolog.COMPOUND
239 *
240 * @return the type of this term, as jpl.fli.Prolog.COMPOUND
241 */
242 public int type() {
243 return Prolog.COMPOUND;
244 }
245
246 /**
247 * returns the name of the type of this term, as "Compound"
248 *
249 * @return the name of the type of this term, as "Compound"
250 */
251 public String typeName() {
252 return "Compound";
253 }
254
255 /**
256 * Sets the i-th (from 1) arg of this Compound to the given Term instance. This method, along with the Compound(name,arity) constructor, serves the new, native Prolog-term-to-Java-term routine,
257 * and is public only so as to be accessible via JNI: it is not intended for general use.
258 *
259 * @param i
260 * the index (1+) of the arg to be set
261 * @param arg
262 * the Term which is to become the i-th (from 1) arg of this Compound
263 */
264 public void setArg(int i, Term arg) {
265 if (i <= 0) {
266 throw new JPLException("jpl.Compound#setArg: bad (non-positive) argument index");
267 } else if (i > args.length) {
268 throw new JPLException("jpl.Compound#setArg: bad (out-of-range) argument index");
269 } else if (arg == null) {
270 throw new JPLException("jpl.Compound#setArg: bad (null) argument");
271 } else {
272 args[i - 1] = arg;
273 }
274 }
275
276 /**
277 * Returns a quoted (iff necessary) form of the Atom's name, as understood by Prolog read/1 (I suspect that there are more efficient ways of doing this)
278 *
279 * @return a quoted form of the Atom's name, as understood by Prolog read/1
280 */
281 protected String quotedName() {
282 // return ((Atom) (new Query(new Compound("sformat", new Term[] { new Variable("S"), new Atom("~q"), new Compound(".", new Term[] { new Atom(this.name), new Atom("[]") })
283 // }))).oneSolution().get(
284 // "S")).name;
285 // return ((Atom) (new Query(new Compound("sformat", new Term[] { new Variable("S"), new Atom("~q"), new Compound(JPL.LIST_PAIR, new Term[] { new Atom(this.name), JPL.LIST_NIL }) })))
286 // .oneSolution().get("S")).name;
287 return (isSimpleName(name) ? name : "'" + name + "'");
288 }
289
290 private boolean isSimpleName(String s) {
291 if (s == null) {
292 throw new java.lang.NullPointerException(); // JPL won't call it this way
293 }
294 int len = s.length();
295 if (len == 0) {
296 return false;
297 }
298 char c = s.charAt(0);
299 if (c < 'a' || c > 'z') {
300 return false;
301 }
302 for (int i = 1; i < len; i++) {
303 c = s.charAt(i);
304 if (!(c == '_' || c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z' || c >= '0' && c <= '9')) {
305 return false;
306 }
307 }
308 return true;
309 }
310
311 /**
312 * Returns the arguments of this Compound (1..arity) of this Compound as an array[0..arity-1] of Term.
313 *
314 * @return the arguments (1..arity) of this Compound as an array[0..arity-1] of Term
315 * @deprecated
316 */
317 public final Term[] args() {
318 return args;
319 }
320
321 /**
322 * Returns the ith argument (counting from 0) of this Compound.
323 *
324 * @return the ith argument (counting from 0) of this Compound
325 * @deprecated
326 */
327 public final Term arg0(int i) {
328 return args[i];
329 }
330
331 /**
332 * Returns a debug-friendly representation of a Compound.
333 *
334 * @return a debug-friendly representation of a Compound
335 * @deprecated
336 */
337 public String debugString() {
338 return "(Compound " + name + " " + Term.debugString(args) + ")";
339 }
340
341 /**
342 * To put a Compound in a term, we create a sequence of term_t references from the Term.terms_to_term_ts() method, and then use the Prolog.cons_functor_v() method to create a Prolog compound term.
343 *
344 * @param varnames_to_vars
345 * A Map from variable names to Prolog variables
346 * @param term
347 * A (previously created) term_t which is to be set to a Prolog term corresponding to the Term subtype (Atom, Variable, Compound, etc.) on which the method is invoked.
348 */
349 protected void put(Map<String, term_t> varnames_to_vars, term_t term) {
350 if (this instanceof Atom && this.equals(JPL.LIST_NIL)) {
351 Prolog.put_nil(term);
352 } else {
353 Prolog.cons_functor_v(term, Prolog.new_functor(Prolog.new_atom(name), args.length), Term.putTerms(varnames_to_vars, args));
354 }
355 }
356
357 /**
358 * Nothing needs to be done except to pass the buck to this Compound's args.
359 *
360 * @param varnames_to_Terms
361 * A Map from variable names to JPL Terms
362 * @param vars_to_Vars
363 * A Map from Prolog variables to JPL Variables
364 */
365 protected final void getSubst(Map<String, Term> varnames_to_Terms, Map<term_t, Variable> vars_to_Vars) {
366 Term.getSubsts(varnames_to_Terms, vars_to_Vars, args);
367 }
368
369 }
+0
-162
packages/jpl/src/java/jpl/Float.java less more
0 package jpl;
1
2 import java.util.Map;
3
4 import jpl.fli.Prolog;
5 import jpl.fli.term_t;
6
7 /**
8 * Float is a specialised Term with a double field, representing a Prolog 64-bit ISO/IEC floating point value. Once constructed, a Float's value cannot be altered.
9 *
10 * <pre>
11 * Float f = new Float(3.14159265);
12 * </pre>
13 *
14 * A Float can be used (and re-used) in Compound Terms. Two Float instances are equal (by .equals()) iff their (double) values are equal.
15 *
16 * <hr>
17 * <i> Copyright (C) 2004 Paul Singleton
18 * <p>
19 * Copyright (C) 1998 Fred Dushin
20 * <p>
21 *
22 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
23 * License, or (at your option) any later version.
24 * <p>
25 *
26 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 * Library Public License for more details.
28 * <p>
29 * </i>
30 * <hr>
31 *
32 * @see jpl.Term
33 * @see jpl.Compound
34 */
35 public class Float extends Term {
36
37 /**
38 * this Float's immutable value
39 */
40 protected final double value;
41
42 /**
43 * construct a Float with the supplied (double) value.
44 *
45 * @param value
46 * this Float's value
47 */
48 public Float(double value) {
49 this.value = value;
50 }
51
52 /**
53 * Tests whether this Float's functor has (double) 'name' and 'arity'
54 *
55 * @return whether this Float's functor has (double) 'name' and 'arity'
56 */
57 public final boolean hasFunctor(double val, int arity) {
58 return val == this.value && arity == 0;
59 }
60
61 /**
62 * returns the (double) value of this Float, converted to an int
63 *
64 * @return the (double) value of this Float, converted to an int
65 */
66 public final int intValue() {
67 return (new Double(value)).intValue();
68 }
69
70 /**
71 * returns the (double) value of this Float, converted to a long
72 *
73 * @return the (double) value of this Float, converted to a long
74 */
75 public final long longValue() {
76 return (new Double(value)).longValue();
77 }
78
79 /**
80 * returns the (double) value of this Float, converted to a float
81 *
82 * @return the (double) value of this Float, converted to a float
83 */
84 public final float floatValue() {
85 return (new Double(value)).floatValue();
86 }
87
88 /**
89 * returns the (double) value of this Float
90 *
91 * @return the (double) value of this Float
92 */
93 public final double doubleValue() {
94 return this.value;
95 }
96
97 public final int type() {
98 return Prolog.FLOAT;
99 }
100
101 public String typeName() {
102 return "Float";
103 }
104
105 /**
106 * Returns a Prolog source text representation of this Float
107 *
108 * @return a Prolog source text representation of this Float
109 */
110 public String toString() {
111 return "" + value + "";
112 }
113
114 /**
115 * Two Floats are equal if they are the same object, or their values are equal
116 *
117 * @param obj
118 * The Object to compare
119 * @return true if the Object satisfies the above condition
120 */
121 public final boolean equals(Object obj) {
122 return this == obj || (obj instanceof Float && value == ((Float) obj).value);
123 }
124
125 public Object jrefToObject() {
126 throw new JPLException("Float.jrefToObject: term is not a JRef");
127 }
128
129 /**
130 * The immutable value of this jpl.Float object, as a Java double
131 *
132 * @return the Float's value
133 * @deprecated use one of doubleValue(), floatValue(), intValue(), longValue()
134 */
135 public double value() {
136 return value;
137 }
138
139 /**
140 * Returns a debug-friendly String representation of this Float
141 *
142 * @return a debug-friendly String representation of this Float
143 * @deprecated
144 */
145 public String debugString() {
146 return "(Float " + toString() + ")";
147 }
148
149 /**
150 * To convert a JPL Float to a Prolog term, we put its value field into the term_t as a float.
151 *
152 * @param varnames_to_vars
153 * A Map from variable names to Prolog variables.
154 * @param term
155 * A (previously created) term_t which is to be set to a Prolog float corresponding to this Float's value
156 */
157 protected final void put(Map<String, term_t> varnames_to_vars, term_t term) {
158 Prolog.put_float(term, value);
159 }
160
161 }
+0
-166
packages/jpl/src/java/jpl/Integer.java less more
0 package jpl;
1
2 import java.util.Map;
3
4 import jpl.fli.Prolog;
5 import jpl.fli.term_t;
6
7 /**
8 * Integer is a specialised Term with a long field, representing a Prolog integer value.
9 *
10 * <pre>
11 * Integer i = new Integer(1024);
12 * </pre>
13 *
14 * Once constructed, the value of an Integer instance cannot be altered. An Integer can be used (and re-used) as an argument of Compounds. Beware confusing jpl.Integer with java.lang.Integer.
15 *
16 * <hr>
17 * <i> Copyright (C) 2004 Paul Singleton
18 * <p>
19 * Copyright (C) 1998 Fred Dushin
20 * <p>
21 *
22 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
23 * License, or (at your option) any later version.
24 * <p>
25 *
26 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 * Library Public License for more details.
28 * <p>
29 * </i>
30 * <hr>
31 *
32 * @see jpl.Term
33 * @see jpl.Compound
34 */
35 public class Integer extends Term {
36
37 /**
38 * the Integer's immutable long value
39 */
40 protected final long value;
41
42 /**
43 * @param value
44 * This Integer's (long) value
45 */
46 public Integer(long value) {
47 this.value = value;
48 }
49
50 /**
51 * Tests whether this Integer's functor has (int) 'name' and 'arity' (c.f. functor/3)
52 *
53 * @return whether this Integer's functor has (int) 'name' and 'arity'
54 */
55 public final boolean hasFunctor(int val, int arity) {
56 return val == this.value && arity == 0;
57 }
58
59 /**
60 * Returns the value of this Integer as an int if possible, else throws a JPLException
61 *
62 * @throws JPLException
63 * if the value of this Integer is too great to be represented as a Java int
64 * @return the int value of this Integer
65 */
66 public final int intValue() {
67 if (value < java.lang.Integer.MIN_VALUE || value > java.lang.Integer.MAX_VALUE) {
68 throw new JPLException("cannot represent Integer value as an int");
69 } else {
70 return (int) value;
71 }
72 }
73
74 /**
75 * Returns the value of this Integer as a long
76 *
77 * @return the value of this Integer as a long
78 */
79 public final long longValue() {
80 return value;
81 }
82
83 /**
84 * Returns the value of this Integer converted to a float
85 *
86 * @return the value of this Integer converted to a float
87 */
88 public final float floatValue() {
89 return (new java.lang.Long(value)).floatValue(); // safe but inefficient...
90 }
91
92 /**
93 * Returns the value of this Integer converted to a double
94 *
95 * @return the value of this Integer converted to a double
96 */
97 public final double doubleValue() {
98 return (new java.lang.Long(value)).doubleValue(); // safe but inefficient...
99 }
100
101 public final int type() {
102 return Prolog.INTEGER;
103 }
104
105 public String typeName() {
106 return "Integer";
107 }
108
109 /**
110 * Returns a Prolog source text representation of this Integer's value
111 *
112 * @return a Prolog source text representation of this Integer's value
113 */
114 public String toString() {
115 return "" + value; // hopefully invokes Integer.toString() or equivalent
116 }
117
118 /**
119 * Two Integer instances are equal if they are the same object, or if their values are equal
120 *
121 * @param obj
122 * The Object to compare (not necessarily an Integer)
123 * @return true if the Object satisfies the above condition
124 */
125 public final boolean equals(Object obj) {
126 return this == obj || (obj instanceof Integer && value == ((Integer) obj).value);
127 }
128
129 /**
130 * Returns the int value of this jpl.Integer
131 *
132 * @return the Integer's value
133 * @deprecated use one of floatValue(), intValue(), longValue()
134 */
135 public final int value() {
136 return (int) value;
137 }
138
139 /**
140 * Returns a debug-friendly representation of this Integer's value
141 *
142 * @return a debug-friendly representation of this Integer's value
143 * @deprecated
144 */
145 public String debugString() {
146 return "(Integer " + toString() + ")";
147 }
148
149 /**
150 * To convert an Integer into a Prolog term, we put its value into the term_t.
151 *
152 * @param varnames_to_vars
153 * A Map from variable names to Prolog variables.
154 * @param term
155 * A (previously created) term_t which is to be set to a Prolog integer
156 */
157 protected final void put(Map<String, term_t> varnames_to_vars, term_t term) {
158 Prolog.put_integer(term, value);
159 }
160
161 public Object jrefToObject() {
162 throw new JPLException("Integer.jrefToObject(): term is not a jref");
163 }
164
165 }
+0
-232
packages/jpl/src/java/jpl/JPL.java less more
0 package jpl;
1
2 import java.io.File;
3 import jpl.fli.Prolog;
4
5 /**
6 * The jpl.JPL class contains methods which allow (i) inspection and alteration of the "default" initialisation arguments (ii) explicit initialisation (iii) discovery of whether the Prolog engine is
7 * already initialised, and if so, with what arguments. The Prolog engine must be initialized before any queries are made, but this will happen automatically (upon the first call to a Prolog FLI
8 * routine) if it has not already been done explicitly.
9 *
10 * <hr>
11 * <i> Copyright (C) 2004 Paul Singleton
12 * <p>
13 * Copyright (C) 1998 Fred Dushin
14 * <p>
15 *
16 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
17 * License, or (at your option) any later version.
18 * <p>
19 *
20 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Library Public License for more details.
22 * <p>
23 * </i>
24 * <hr>
25 *
26 */
27 public class JPL {
28 protected static final boolean DEBUG = false;
29
30 public static final Term JFALSE = new Compound("@", new Term[] { new Atom("false") });
31 public static final Term JTRUE = new Compound("@", new Term[] { new Atom("true") });
32 public static final Term JNULL = new Compound("@", new Term[] { new Atom("null") });
33 public static final Term JVOID = new Compound("@", new Term[] { new Atom("void") });
34
35 protected static boolean modeDontTellMe = true;
36
37 protected static final Atom LIST_NIL_MODERN = new Atom("[]", "reserved_symbol"); // NB an actual Atom (see LIST_PAIR_MODERN below)
38 protected static final Atom LIST_NIL_TRADITIONAL = new Atom("[]", "text");
39 public static Atom LIST_NIL = LIST_NIL_MODERN; // default unless/until setTraditional() is called successfully
40
41 protected static final String LIST_PAIR_MODERN = "[|]"; // NB just the name of the functor (see LIST_NIL_MODERN above)
42 protected static final String LIST_PAIR_TRADITIONAL = ".";
43 public static String LIST_PAIR = LIST_PAIR_MODERN; // default unless/until setTraditional() is called successfully
44
45 private static String nativeLibraryName = "jpl";
46 private static String nativeLibraryDir = null;
47 private static String nativeLibraryPath = null;
48
49 public static String setNativeLibraryName(String newName) {
50 if (newName == null) {
51 throw new NullPointerException("newName cannot be null");
52 } else {
53 String oldName = nativeLibraryName;
54 nativeLibraryName = newName;
55 return oldName;
56 }
57 }
58
59 public static String setNativeLibraryDir(String newDir) {
60 String oldDir = nativeLibraryDir;
61 nativeLibraryDir = newDir;
62 return oldDir;
63 }
64
65 public static String setNativeLibraryPath(String newPath) {
66 String oldPath = nativeLibraryPath;
67 nativeLibraryPath = newPath;
68 return oldPath;
69 }
70
71 public static void loadNativeLibrary() {
72 if (nativeLibraryPath != null) {
73 System.load((new File(nativeLibraryPath)).getAbsolutePath());
74 } else if (nativeLibraryDir != null) {
75 System.load((new File(nativeLibraryDir, System.mapLibraryName(nativeLibraryName))).getAbsolutePath());
76 } else {
77 System.loadLibrary(nativeLibraryName); // as resolved somewhere on system property 'java.library.path'
78 }
79 }
80
81 /**
82 * Sets the global "dont-tell-me" mode (default value: true). When 'true', bindings will *not* be returned for any variable (in a Query's goal) whose name begins with an underscore character
83 * (except for "anonymous" variables, i.e. those whose name comprises just the underscore character, whose bindings are never returned). When 'false', bindings are returned for *all* variables
84 * except anonymous ones; this mode may be useful when traditional top-level interpreter behaviour is wanted, e.g. in a Java-based Prolog IDE or debugger.
85 * <p>
86 * This method should be regarded as experimental, and may subsequently be deprecated in favour of some more general mechanism for setting options, perhaps per-Query and per-call as well as
87 * globally.
88 *
89 * @param dtm
90 * new "dont-tell-me" mode value
91 */
92 public static void setDTMMode(boolean dtm) {
93 modeDontTellMe = dtm;
94 }
95
96 public static void setTraditional() {
97 if (getActualInitArgs() == null) { // i.e. Prolog is not yet initialised
98 setTraditionalAnyway();
99 } else if (LIST_PAIR.equals(LIST_PAIR_MODERN)) {
100 throw new JPLException("cannot switch to traditional syntax after Prolog is initialised");
101 } else {
102 // benign attempt to set traditional syntax when Prolog has been so initialised
103 }
104 }
105
106 public static void setTraditionalAnyway() {
107 LIST_NIL = LIST_NIL_TRADITIONAL;
108 LIST_PAIR = LIST_PAIR_TRADITIONAL;
109 }
110
111 public static String getSyntax() {
112 if (LIST_PAIR.equals(LIST_PAIR_MODERN)) {
113 return "modern";
114 } else if (LIST_PAIR.equals(LIST_PAIR_TRADITIONAL)) {
115 return "traditional";
116 } else {
117 return "undefined";
118 }
119 }
120
121 /**
122 * Returns, in an array of String, the sequence of command-line arguments that would be used if the Prolog engine were to be initialised now. Returns null if the Prolog VM has already been
123 * initialised (in which case the default init args are irrelevant and the actual init args are of interest)
124 * <p>
125 *
126 * @see jpl.JPL#getActualInitArgs
127 * @return current default initialisation arguments, or null if already initialised
128 */
129 public static String[] getDefaultInitArgs() {
130 return Prolog.get_default_init_args();
131 }
132
133 /**
134 * Specifies, in an array of String, the sequence of command-line arguments that should be used if the Prolog engine is subsequently initialised.
135 * <p>
136 *
137 * @param args
138 * new default initialization arguments
139 */
140 public static void setDefaultInitArgs(String[] args) {
141 Prolog.set_default_init_args(args);
142 }
143
144 /**
145 * Returns, in an array of String, the sequence of command-line arguments that were actually used when the Prolog engine was formerly initialised.
146 *
147 * This method returns null if the Prolog engine has not yet been initialised, and thus may be used to test this condition.
148 *
149 * @return actual initialization arguments
150 */
151 public static String[] getActualInitArgs() {
152 return Prolog.get_actual_init_args();
153 }
154
155 /**
156 * Initializes the Prolog engine, using the String argument parameters passed. This method need be called only if you want to both (i) initialise the Prolog engine with parameters other than the
157 * default ones and (ii) force initialisation to occur (rather than allow it to occur automatically at the first query). For parameter options, consult your local Prolog documentation. The
158 * parameter values are passed directly to initialization routines for the Prolog environment.
159 * <p>
160 *
161 * This method must be called before making any queries.
162 *
163 * @param args
164 * Initialization parameter list
165 */
166 public static boolean init(String[] args) {
167 return Prolog.set_default_init_args(args) && init();
168 }
169
170 /**
171 * Initialises the Prolog engine using the current default initialisation parameters, and returns 'true' (or 'false' if already initialised).
172 */
173 public static boolean init() {
174 return Prolog.initialise();
175 }
176
177 /**
178 * whether the String arg is a plausible tag, e.g. "J#0123456789".
179 */
180 public static boolean isTag(String s) {
181 return s.length() == 22 && s.charAt(0) == 'J' && s.charAt(1) == '#' && Character.isDigit(s.charAt(2)) && Character.isDigit(s.charAt(3)) && Character.isDigit(s.charAt(4))
182 && Character.isDigit(s.charAt(5)) && Character.isDigit(s.charAt(6)) && Character.isDigit(s.charAt(7)) && Character.isDigit(s.charAt(8)) && Character.isDigit(s.charAt(9))
183 && Character.isDigit(s.charAt(10)) && Character.isDigit(s.charAt(11)) && Character.isDigit(s.charAt(12)) && Character.isDigit(s.charAt(13)) && Character.isDigit(s.charAt(14))
184 && Character.isDigit(s.charAt(15)) && Character.isDigit(s.charAt(16)) && Character.isDigit(s.charAt(17)) && Character.isDigit(s.charAt(18)) && Character.isDigit(s.charAt(19))
185 && Character.isDigit(s.charAt(20)) && Character.isDigit(s.charAt(21));
186 }
187
188 /**
189 * returns a new Term instance which represents the given object
190 */
191 public static Term newJRef(Object obj) {
192 return new Compound("@", new Term[] { new Atom(Prolog.object_to_tag(obj)) });
193 }
194
195 /**
196 * Terminates the Prolog session.
197 * <p>
198 *
199 * <b>Note.</b> This method calls the FLI halt() method with a status of 0, but the halt method currently is a no-op in SWI.
200 *
201 * @deprecated
202 */
203 public static void halt() {
204 Prolog.halt(0);
205 }
206
207 // a static reference to the current Version
208 private static final Version version_ = new Version();
209
210 /**
211 * Returns (as a Version) an identification of this version of JPL.
212 *
213 * @return the running version of JPL.
214 */
215 public static Version version() {
216 return version_;
217 }
218
219 /**
220 * Returns a String (eg "3.0.0-alpha") identifying this version of JPL.
221 *
222 * @return a String (eg "3.0.0-alpha") identifying this version of JPL.
223 */
224 public static String version_string() {
225 return version_.major + "." + version_.minor + "." + version_.patch + "-" + version_.status;
226 }
227
228 public static void main(String[] args) {
229 System.out.println(version_string());
230 }
231 }
+0
-35
packages/jpl/src/java/jpl/JPLException.java less more
0 package jpl;
1
2 /**
3 * This is the base class for exceptions thrown by JPL's Java-calls-Prolog interface. Such exceptions represent errors and exceptional conditions within the interface code itself; see
4 * jpl.PrologException for the way Prolog exceptions are returned to calling Java code.
5 * <hr>
6 * <i> Copyright (C) 2004 Paul Singleton
7 * <p>
8 * Copyright (C) 1998 Fred Dushin
9 * <p>
10 *
11 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
12 * License, or (at your option) any later version.
13 * <p>
14 *
15 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library Public License for more details.
17 * <p>
18 * </i>
19 * <hr>
20 *
21 * @author Fred Dushin <fadushin@syr.edu>
22 * @version $Revision$
23 */
24 public class JPLException extends RuntimeException {
25 private static final long serialVersionUID = 1L;
26
27 public JPLException() {
28 super();
29 }
30
31 public JPLException(String s) {
32 super(s);
33 }
34 }
+0
-131
packages/jpl/src/java/jpl/JRef.java less more
0 package jpl;
1
2 import java.util.Map;
3 import jpl.fli.Prolog;
4 import jpl.fli.term_t;
5
6 /**
7 * JRef is a specialised Term with an Object field, representing JPL's Prolog references to Java objects (or to null).
8 *
9 * <pre>
10 * JRef r = new JRef(non_String_object_or_null);
11 * </pre>
12 *
13 * A JRef can be used (and re-used) in Compound Terms.
14 *
15 * <hr>
16 * <i> Copyright (C) 2004 Paul Singleton
17 * <p>
18 * Copyright (C) 1998 Fred Dushin
19 * <p>
20 *
21 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
22 * License, or (at your option) any later version.
23 * <p>
24 *
25 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26 * Library Public License for more details.
27 * <p>
28 * </i>
29 * <hr>
30 *
31 * @author Fred Dushin <fadushin@syr.edu>
32 * @version $Revision$
33 * @see jpl.Term
34 * @see jpl.Compound
35 *
36 * @deprecated
37 */
38 public class JRef extends Term {
39
40 /**
41 * the JRef's value (a non-String Object or null)
42 */
43 protected final Object ref;
44
45 /**
46 * This constructor creates a JRef, initialized with the supplied non-String object (or null).
47 *
48 * @param ref
49 * this JRef's value (a non-String object, or null)
50 */
51 public JRef(Object ref) {
52 if (ref instanceof String) {
53 throw new JPLException("a JRef cannot have a String value (String maps to atom)");
54 } else {
55 this.ref = ref;
56 }
57 }
58
59 public Term arg(int ano) {
60 return (ano == 1 ? new Atom(jpl.fli.Prolog.object_to_tag(ref)) : null);
61 }
62
63 /**
64 * Returns a Prolog source text representation of this JRef
65 *
66 * @return a Prolog source text representation of this JRef
67 */
68 public String toString() {
69 return "" + ref + ""; // WRONG
70 }
71
72 /**
73 * Two JRefs are equal if their references are identical (?)
74 *
75 * @param obj
76 * The Object to compare
77 * @return true if the Object satisfies the above condition
78 */
79 public final boolean equals(Object obj) {
80 return this == obj || (obj instanceof JRef && ref == ((JRef) obj).ref);
81 }
82
83 public final int type() {
84 return Prolog.JREF;
85 }
86
87 public String typeName() {
88 return "JRef";
89 }
90
91 /**
92 * The non-String object (or null) which this jpl.JRef represents
93 *
94 * @return the non-String object (or null) which this jpl.JRef represents
95 */
96 public Object ref() {
97 return ref;
98 }
99
100 /**
101 * Returns a debug-friendly representation of this JRef
102 *
103 * @return a debug-friendly representation of this JRef
104 * @deprecated
105 */
106 public String debugString() {
107 return "(JRef " + toString() + ")";
108 }
109
110 /**
111 * To convert a JRef to a term, we put its Object field (.value) into the term_t as a JPL ref (i.e. @/1) structure.
112 *
113 * @param varnames_to_vars
114 * A Map from variable names to Prolog variables.
115 * @param term
116 * A (newly created) term_t which is to be set to a Prolog 'ref' (i.e. @/1) structure denoting the .value of this JRef instance
117 */
118 protected final void put(Map<String, term_t> varnames_to_vars, term_t term) {
119 Prolog.put_jref(term, ref);
120 }
121
122 public boolean hasFunctor(String name, int arity) {
123 return name != null && name.equals("@") && arity == 1;
124 }
125
126 public Object jrefToObject() {
127 return ref;
128 }
129
130 }
+0
-45
packages/jpl/src/java/jpl/PrologException.java less more
0 package jpl;
1
2 /**
3 * PrologException instances wrap Prolog exceptions thrown (either by a Prolog engine or by user code) in the course of finding a solution to a Query. See JPLException for the handling of errors
4 * within the JPL Java-calls-Prolog interface.
5 * <p>
6 * This class allows Java code which uses JPL's Java-calls-Prolog API to handle Prolog exceptions, which is in general necessary for hybrid Java+Prolog programming.
7 * <p>
8 * Use the term() accessor to obtain a Term representation of the term that was thrown from within Prolog.
9 *
10 * <hr>
11 * <i> Copyright (C) 2004 Paul Singleton
12 * <p>
13 * Copyright (C) 1998 Fred Dushin
14 * <p>
15 *
16 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
17 * License, or (at your option) any later version.
18 * <p>
19 *
20 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Library Public License for more details.
22 * <p>
23 * </i>
24 * <hr>
25 *
26 * @author Fred Dushin <fadushin@syr.edu>
27 * @version $Revision$
28 */
29 public final class PrologException extends JPLException {
30 private static final long serialVersionUID = 1L;
31 private Term term_ = null;
32
33 protected PrologException(Term term) {
34 super("PrologException: " + term.toString());
35 this.term_ = term;
36 }
37
38 /**
39 * @return a reference to the Term thrown by the call to throw/1
40 */
41 public Term term() {
42 return this.term_;
43 }
44 }
+0
-805
packages/jpl/src/java/jpl/Query.java less more
0 package jpl;
1
2 import java.util.Enumeration;
3 import java.util.Hashtable;
4 import java.util.Map;
5 import java.util.Vector;
6 import jpl.fli.*;
7
8 /**
9 * A Query instance is created by an application in order to query the Prolog database (or to invoke a built-in predicate). It is initialised with a Compound (or Atom) denoting the goal which is to be
10 * called, and also contains assorted private state relating to solutions. In some future version, it may contain details of the module in which the goal is to be called.
11 * <p>
12 * A Query is either open or closed: when closed, it has no connection to the Prolog system; when open, it is linked to an active goal within a Prolog engine.
13 * <p>
14 * The Query class implements the Enumeration interface, through which one can obtain successive solutions. The Enumeration hasMoreElements() method returns true if the call or redo succeeded
15 * (otherwise false), and if the call or redo did succeed, the nextElement() method returns a Hashtable representing variable bindings; the elements in the Hashtable are Terms, indexed by the (String)
16 * names of the Variables with which they are associated. For example, if <i>p(a)</i> and <i>p(b)</i> are facts in the Prolog database, then the following is equivalent to printing all the solutions
17 * to the Prolog query <i>p(X)</i>:
18 *
19 * <pre>
20 * Variable X = new Variable(&quot;X&quot;);
21 * Term arg[] = { X };
22 * Query q = new Query(&quot;p&quot;, arg);
23 *
24 * while (q.hasMoreElements()) {
25 * Term bound_to_x = ((Hashtable) q.nextElement()).get(&quot;X&quot;);
26 * System.out.println(bound_to_x);
27 * }
28 * </pre>
29 *
30 * Make sure to close the Query (using the close() method) if you do not need any further solutions which it may have. It is safe (although redundant) to close a Query whose solutions are already
31 * exhausted, or which is already closed.
32 *
33 * To obtain just one solution from a Query, use the oneSolution() method.
34 *
35 * To obtain all solutions, use the allSolutions() method.
36 *
37 * To obtain at most N solutions, use the nSolutions() method.
38 *
39 * To determine merely whether the Query is provable, use the hasSolution() method (i.e. has at least one solution).
40 * <hr>
41 * <i> Copyright (C) 2007 Paul Singleton
42 * <p>
43 * Copyright (C) 1998 Fred Dushin
44 * <p>
45 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
46 * License, or (at your option) any later version.
47 * <p>
48 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
49 * Library Public License for more details.
50 * <p>
51 * </i>
52 * <hr>
53 *
54 * @author Fred Dushin <fadushin@syr.edu>
55 * @version $Revision$
56 */
57 public class Query implements Enumeration<Object> {
58 private static Map<Long, Query> m = new Hashtable<Long, Query>(); // maps (engine_t) engine handle to (Query) topmost query
59 /**
60 * the Compound (hence perhaps an Atom, but not Integer, Float or Variable) corresponding to the goal of this Query
61 */
62 protected final Compound goal_; // set by all initialisers
63 protected final String hostModule = "user"; // until revised constructors allow this to be specified
64 protected final String contextModule = "user"; // until revised constructors allow this to be specified
65
66 /**
67 * @deprecated use .goal().name() instead
68 * @return the name of this Query's goal
69 */
70 public final String name() {
71 return goal_.name(); // it can only be a Compound or Atom
72 }
73
74 /**
75 * @deprecated use .goal().args() instead
76 * @return the arguments of this Query's goal
77 */
78 public final Term[] args() {
79 return goal_.args();
80 }
81
82 /**
83 * Returns the Compound (hence perhaps an Atom) which is the goal of this Query
84 *
85 * @return a Term representing the goal of this Query
86 */
87 public final Compound goal() {
88 return goal_;
89 }
90
91 /**
92 * This constructor creates a Query whose goal is the specified Term. The Query is initially closed. <b>NB</b> Creating an instance of the Query class does not result in a call to a Prolog engine.
93 * <b>NB</b> The goal can be a Compound or an Atom (Atom extends Compound), but cannot be an instance of jpl.Float, jpl.Integer or jpl.Variable.
94 *
95 * @param t
96 * the goal of this Query
97 */
98 public Query(Term t) { // formerly insisted (confusingly) on a Compound (or Atom)
99 this.goal_ = Query1(t);
100 }
101
102 private Compound Query1(Term t) {
103 if (t instanceof Compound) {
104 return (Compound) t;
105 } else if (t instanceof Integer) {
106 throw new JPLException("a Query's goal must be an Atom or Compound (not an Integer)");
107 } else if (t instanceof Float) {
108 throw new JPLException("a Query's goal must be an Atom or Compound (not a Float)");
109 } else if (t instanceof Variable) {
110 throw new JPLException("a Query's goal must be an Atom or Compound (not a Variable)");
111 } else {
112 throw new JPLException("a Query's goal must be an Atom or Compound");
113 }
114 }
115
116 /**
117 * If text denotes an atom, this constructor is shorthand for <font face="monospace">new Query(new Compound(name,args))</font>, but if text denotes a term containing N query (?) symbols and there
118 * are N args, each query is replaced by its corresponding arg to provide the new Query's goal.
119 *
120 * @param text
121 * the name of the principal functor of this Query's goal
122 * @param args
123 * the arguments of this Query's goal
124 */
125 public Query(String text, Term[] args) {
126 this(Query1(text, args));
127 }
128
129 // convenience case for a single arg
130 public Query(String text, Term arg) {
131 this(Query1(text, new Term[] { arg }));
132 }
133
134 private static Term Query1(String text, Term[] args) {
135 Term t = Util.textToTerm(text);
136 if (t instanceof Atom) {
137 return new Compound(text, args);
138 } else {
139 return t.putParams(args);
140 }
141 }
142
143 /**
144 * This constructor builds a Query from the given Prolog source text. Throws PrologException containing error(syntax_error(_),_) if text is invalid.
145 *
146 * @param text
147 * the Prolog source text of this Query
148 */
149 public Query(String text) {
150 this(Util.textToTerm(text));
151 }
152
153 /**
154 * These variables are used and set across the hasMoreElements and nextElement Enumeration interface implementation
155 */
156 private boolean open = false;
157 // the following state variables are used and defined only if this query is open:
158 // private boolean called = false; // open/get/close vs. hasMoreSolutions/nextSolution
159 private engine_t engine = null; // handle of attached Prolog engine iff open, else null
160 private Query subQuery = null; // the open Query (if any) on top of which this open Query is stacked, else null
161 private predicate_t predicate = null; // handle of this Query's predicate iff open, else undefined
162 private fid_t fid = null; // id of current Prolog foreign frame iff open, else null
163 private term_t term0 = null; // term refs of this Query's args iff open, else undefined
164 private qid_t qid = null; // id of current Prolog query iff open, else null
165
166 //
167 /**
168 * isOpen() returns true iff the query is open.
169 *
170 * @return true if the query is open, otherwise false.
171 */
172 public synchronized final boolean isOpen() {
173 return open;
174 }
175
176 /**
177 * This method returns true if JPL was able to initiate a "call" of this Query within a Prolog engine. It is designed to be used with the nextSolution() method to retrieve one or more
178 * substitutions in the form of Hashtables. To iterate through all the solutions to a Query, for example, one might write
179 *
180 * <pre>
181 * Query q = // obtain Query reference
182 * while (q.hasMoreSolutions()) {
183 * Hashtable solution = q.nextSolution();
184 * // process solution...
185 * }
186 * </pre>
187 *
188 * To ensure thread-safety, you should wrap sequential calls to this method in a synchronized block, using the static lock method to obtain the monitor.
189 *
190 * <pre>
191 * Query q = // obtain Query reference
192 * synchronized ( jpl.Query.lock() ){
193 * while ( q.hasMoreElements() ){
194 * Hashtable solution = q.nextSolution();
195 * // process solution...
196 * }
197 * }
198 * </pre>
199 *
200 * @return true if the Prolog query succeeds; otherwise false.
201 */
202 public synchronized final boolean hasMoreSolutions() {
203 if (!open) {
204 open();
205 }
206 return get1();
207 }
208
209 /**
210 * This method returns true if JPL was able to initiate a "call" of this Query within the Prolog engine. It is designed to be used with the getSolution() and close() methods to retrieve one or
211 * more substitutions in the form of Hashtables.
212 *
213 * <pre>
214 * Query q = // obtain Query reference
215 * Hashtable soln;
216 * q.open();
217 * while ((soln = q.getSolution()) != null) {
218 * // process solution...
219 * }
220 * </pre>
221 * <p>
222 * If this method is called on an already-open Query, or if the query cannot be set up for whatever reason, then a JPLException will be thrown.
223 */
224 public synchronized final void open() {
225 if (open) {
226 throw new JPLException("Query is already open");
227 }
228 // int self = Prolog.thread_self();
229 // System.out.println("JPL thread_self()=" + self);
230 if (Prolog.thread_self() == -1) { // this Java thread has no attached Prolog engine?
231 engine = Prolog.attach_pool_engine(); // may block for a while, or fail
232 // System.out.println("JPL attaching engine[" + engine.value + "] for " + this.hashCode() + ":" + this.toString());
233 } else { // this Java thread has an attached engine
234 engine = Prolog.current_engine();
235 // System.out.println("JPL reusing engine[" + engine.value + "] for " + this.hashCode() + ":" + this.toString());
236 }
237 if (m.containsKey(new Long(engine.value))) {
238 subQuery = m.get(new Long(engine.value)); // get this engine's previous topmost query
239 // System.out.println("JPL reusing engine[" + engine.value + "] pushing " + subQuery.hashCode() + ":" + subQuery.toString());
240 } else {
241 subQuery = null;
242 }
243 m.put(new Long(engine.value), this); // update this engine's topmost query
244 //
245 // here, we must check for a module prefis, e.g. jpl:jpl_modifier_bit(volatile,T)
246 String module;
247 Term goal;
248 if (goal_.hasFunctor(":", 2)) {
249 if (goal_.arg(1).isAtom()) {
250 module = goal_.arg(1).name();
251 } else if (goal_.arg(1).isVariable()) {
252 throw new PrologException(Util.textParamsToTerm("error(instantiation_error,?)", new Term[] { goal_ }));
253 } else {
254 throw new PrologException(Util.textParamsToTerm("error(type_error(atom,?),?)", new Term[] { goal_.arg(1), goal_ }));
255 }
256 goal = goal_.arg(2);
257 } else {
258 module = contextModule;
259 goal = goal_;
260 }
261 predicate = Prolog.predicate(goal.name(), goal.arity(), module); // was hostModule
262 fid = Prolog.open_foreign_frame();
263 Map<String, term_t> varnames_to_vars = new Hashtable<String, term_t>();
264 term0 = Term.putTerms(varnames_to_vars, goal.args());
265 // THINKS: invert varnames_to_Vars and use it when getting substitutions?
266 qid = Prolog.open_query(Prolog.new_module(Prolog.new_atom(contextModule)), Prolog.Q_CATCH_EXCEPTION, predicate, term0);
267 open = true;
268 // called = false;
269 }
270
271 private final boolean get1() { // try to get the next solution; if none, close the query;
272 if (Prolog.next_solution(qid)) {
273 // called = true; // OK to call get2()
274 return true;
275 } else {
276 // if failure was due to throw/1, build exception term and throw it
277 term_t exception_term_t = Prolog.exception(qid);
278 if (exception_term_t.value != 0L) {
279 Term exception_term = Term.getTerm(new Hashtable<term_t, Variable>(), exception_term_t);
280 close();
281 throw new PrologException(exception_term);
282 } else {
283 close();
284 return false;
285 }
286 }
287 }
288
289 /**
290 * This method returns a java.util.Hashtable, which represents a set of bindings from the names of query variables to terms within the solution.
291 * <p>
292 * For example, if a Query has an occurrence of a jpl.Variable, say, named "X", one can obtain the Term bound to "X" in the solution by looking up "X" in the Hashtable.
293 *
294 * <pre>
295 * Variable x = new Variable("X");
296 * Query q = // obtain Query reference (with x in the Term array)
297 * while (q.hasMoreSolutions()) {
298 * Hashtable solution = q.nextSolution();
299 * // make t the Term bound to "X" in the solution
300 * Term t = (Term) solution.get("X");
301 * // ...
302 * }
303 * </pre>
304 *
305 * Programmers should obey the following rules when using this method. <menu>
306 * <li>The nextSolution() method should only be called after the hasMoreSolutions() method returns true; otherwise a JPLException will be raised, indicating that the Query is no longer open.
307 * <li>The nextSolution() and hasMoreSolutions() should be called in the same thread of execution, for a given Query instance. </menu>
308 *
309 * This method will throw a JPLException if Query is not open.
310 *
311 * @return A Hashtable representing a substitution, or null
312 */
313 public synchronized final Hashtable<String, Term> getSolution() {
314 // oughta check: thread has query's engine
315 if (!open) {
316 throw new JPLException("Query is not open");
317 } else if (get1()) {
318 return get2();
319 } else {
320 return null;
321 }
322 }
323
324 public synchronized final Hashtable<String, Term> getSubstWithNameVars() {
325 // oughta check: thread has query's engine
326 if (!open) {
327 throw new JPLException("Query is not open");
328 } else if (get1()) {
329 return get2WithNameVars();
330 } else {
331 return null;
332 }
333 }
334
335 /**
336 * This method returns a java.util.Hashtable, which represents a binding from the names of query variables to terms within the solution.
337 * <p>
338 * For example, if a Query has an occurrence of a jpl.Variable, say, named "X", one can obtain the Term bound to "X" in the solution by looking up "X" in the Hashtable.
339 *
340 * <pre>
341 * Variable x = new Variable("X");
342 * Query q = // obtain Query reference (with x in the Term array)
343 * while (q.hasMoreSolutions()) {
344 * Hashtable solution = q.nextSolution();
345 * // make t the Term bound to "X" in the solution
346 * Term t = (Term) solution.get("X");
347 * // ...
348 * }
349 * </pre>
350 *
351 * Programmers should obey the following rules when using this method. <menu>
352 * <li>The nextSolution() method should only be called after the hasMoreSolutions() method returns true; otherwise a JPLException will be raised, indicating that the Query is no longer open.
353 * <li>The nextSolution() and hasMoreSolutions() should be called in the same thread of execution, for a given Query instance. </menu>
354 *
355 * This method will throw a JPLException if Query is not open.
356 *
357 * @return A Hashtable representing a substitution.
358 */
359 public synchronized final Hashtable<String, Term> nextSolution() {
360 return get2();
361 }
362
363 private final Hashtable<String, Term> get2() {
364 if (!open) {
365 throw new JPLException("Query is not open");
366 } else {
367 Hashtable<String, Term> substitution = new Hashtable<String, Term>();
368 // NB I reckon computeSubstitutions needn't be in Term (but where else?)
369 Term.getSubsts(substitution, new Hashtable<term_t, Variable>(), goal_.args);
370 return substitution;
371 }
372 }
373
374 // assumes that Query's last arg is a Variable which will be bound to a [Name=Var,..] dict
375 private final Hashtable<String, Term> get2WithNameVars() {
376 if (!open) {
377 throw new JPLException("Query is not open");
378 } else {
379 Term[] args = goal_.args; // for slight convenience below
380 Term argNV = args[args.length - 1]; // the Query's last arg
381 String nameNV = ((Variable) argNV).name; // its name
382 // get the [Name=Var,..] dict from the last arg
383 Map<String, Term> varnames_to_Terms1 = new Hashtable<String, Term>();
384 Map<term_t, Variable> vars_to_Vars1 = new Hashtable<term_t, Variable>();
385 args[args.length - 1].getSubst(varnames_to_Terms1, vars_to_Vars1);
386 Hashtable<String, Term> varnames_to_Terms2 = new Hashtable<String, Term>();
387 Term nvs = varnames_to_Terms1.get(nameNV);
388 Map<term_t, Variable> vars_to_Vars2 = Util.namevarsToMap(nvs);
389 for (int i = 0; i < args.length - 1; ++i) {
390 args[i].getSubst(varnames_to_Terms2, vars_to_Vars2);
391 }
392 return varnames_to_Terms2;
393 }
394 }
395
396 /**
397 * This method implements part of the java.util.Enumeration interface. It is a wrapper for hasMoreSolutions.
398 *
399 * @return true if the Prolog query yields a (or another) solution, else false.
400 */
401 public synchronized final boolean hasMoreElements() {
402 return hasMoreSolutions();
403 }
404
405 /**
406 * This method implements part of the java.util.Enumeration interface. It is a wrapper for nextSolution.
407 * <p>
408 *
409 * @return A Hashtable representing a substitution.
410 */
411 public synchronized final Object nextElement() {
412 return nextSolution();
413 }
414
415 public synchronized final void rewind() {
416 close();
417 }
418
419 /**
420 * This method can be used to close an open query before its solutions are exhausted. It is called automatically when solutions are exhausted, i.e. when hasMoreSolutions() fails. Calling close()
421 * on an already closed Query is harmless (has no effect).
422 * <p>
423 *
424 * Here is one way to get the first three solutions to a Query:
425 *
426 * <pre>
427 * Query q = new Query(predicate, args);
428 * Hashtable sub1 = (Hashtable) q.nextSolution();
429 * Hashtable sub2 = (Hashtable) q.nextSolution();
430 * Hashtable sub3 = (Hashtable) q.nextSolution();
431 * q.close();
432 * </pre>
433 * <p>
434 */
435 public synchronized final void close() {
436 if (!open) {
437 return; // it is not an error to attempt to close a closed Query
438 }
439 if (Prolog.thread_self() == -1) {
440 throw new JPLException("no engine is attached to this thread");
441 }
442 if (Prolog.current_engine().value != engine.value) {
443 throw new JPLException("this Query's engine is not that which is attached to this thread");
444 }
445 Query topmost = m.get(new Long(engine.value));
446 if (topmost != this) {
447 throw new JPLException("this Query (" + this.hashCode() + ":" + this.toString() + ") is not topmost (" + topmost.hashCode() + ":" + topmost.toString() + ") within its engine["
448 + engine.value + "]");
449 }
450 Prolog.close_query(qid);
451 qid = null; // for tidiness
452 jpl.fli.Prolog.discard_foreign_frame(fid);
453 fid = null; // for tidiness
454 m.remove(new Long(engine.value));
455 if (subQuery == null) { // only Query open in this engine?
456 if (Prolog.current_engine_is_pool()) { // this (Query's) engine is from the pool?
457 Prolog.release_pool_engine();
458 // System.out.println("JPL releasing engine[" + engine.value + "]");
459 } else {
460 // System.out.println("JPL leaving engine[" + engine.value + "]");
461 }
462 } else {
463 m.put(new Long(engine.value), subQuery);
464 // System.out.println("JPL retaining engine[" + engine.value + "] popping subQuery(" + subQuery.hashCode() + ":" + subQuery.toString() + ")");
465 }
466 open = false; // this Query is now closed
467 engine = null; // this Query, being closed, is no longer associated with any Prolog engine
468 subQuery = null; // this Query, being closed, is not stacked upon any other Query
469 }
470
471 /**
472 * calls the Query's goal to exhaustion and returns an array of zero or more Hashtables of zero or more variablename-to-term bindings (each Hashtable represents a solution, in the order in which
473 * they were found).
474 *
475 * @return an array of zero or more Hashtables of zero or more variablename-to-term bindings (each Hashtable represents a solution, in the order in which they were found) <b>NB</b> in JPL 1.0.1,
476 * this method (inconsistently) returned null when a Query had no solutions; in JPL 2.x onwards it returns an empty array (thus the length of the array is, in every case, the quantity of
477 * solutions).
478 * <p>
479 * <b>NB</b> in JPL 1.0.1, bindings were keyed (awkwardly) by Variable instances; in JPL 2.x onwards they are keyed by the (String) names of variables, which is consistent with the Term
480 * type being just a concrete syntax for terms (and hence queries).
481 * <p>
482 */
483 public synchronized final Hashtable<String, Term>[] allSolutions() {
484 if (open) {
485 throw new JPLException("Query is already open");
486 } else {
487 // get a vector of solutions:
488 Vector<Hashtable<String, Term>> v = new Vector<Hashtable<String, Term>>();
489 while (hasMoreSolutions()) {
490 v.addElement(nextSolution());
491 }
492 // turn the vector into an array:
493 @SuppressWarnings("unchecked")
494 Hashtable<String, Term> solutions[] = (Hashtable<String, Term>[]) new Hashtable[v.size()]; // 0 solutions -> Hashtable[0]
495 v.copyInto(solutions);
496 return solutions;
497 }
498 }
499
500 /**
501 * This static method creates a Query whose goal is the given Term, calls it to exhaustion, and returns an array of zero or more Hashtables of zero or more variablename-to-term bindings (each
502 * Hashtable represents a solution, in the order in which they were found). Throws JPLException if goal is neither a jpl.Atom nor a jpl.Compound.
503 *
504 * @return an array of zero or more Hashtables of zero or more variablename-to-term bindings (each Hashtable represents a solution, in the order in which they were found)
505 *
506 * @param goal
507 * the goal of this Query
508 */
509 public static final Hashtable<String, Term>[] allSolutions(Term goal) {
510 return (new Query(goal)).allSolutions();
511 }
512
513 /**
514 * This static method creates a Query from the given Prolog source text fragment, calls it to exhaustion, and returns an array of zero or more Hashtables of zero or more variablename-to-term
515 * bindings (each Hashtable represents a solution, in the order in which they were found). Throws PrologException containing error(syntax_error(_),_) if text is invalid.
516 *
517 * @return an array of zero or more Hashtables of zero or more variablename-to-term bindings (each Hashtable represents a solution, in the order in which they were found)
518 *
519 * @param text
520 * a Prolog source text fragment denoting a goal
521 */
522 public static final Hashtable<String, Term>[] allSolutions(String text) {
523 return (new Query(text)).allSolutions();
524 }
525
526 /**
527 * If text denotes (in traditional Prolog source syntax) a term containing N questionmark (?) symbols and there are N accompanying Term params, this static method replaces each questionmark symbol
528 * by its respective param, calls the resulting goal to exhaustion, and returns an array of zero or more Hashtables of zero or more variablename-to-term bindings (each Hashtable represents a
529 * solution, in the order in which they were found).
530 *
531 * Otherwise, if text denotes an atom, this static method creates a Query where text is the name of the goal and params are the args; the resulting goal is then called as above. This letter mode
532 * is redundant, deprecated (informally), and retained only for backward compatibility.
533 *
534 * @return an array of zero or more Hashtables of zero or more variablename-to-term bindings (each Hashtable represents a solution, in the order in which they were found)
535 *
536 * @param text
537 * the Prolog source text of a goal, in which questionmarks are regarded as substitutible parameters
538 * @param params
539 * terms to be substituted for the respective questionmarks in the query text
540 */
541 public static final Hashtable<String, Term>[] allSolutions(String text, Term[] params) {
542 return (new Query(text, params)).allSolutions();
543 }
544
545 /**
546 * calls the Query's goal to exhaustion or until N solutions are found, whichever is sooner, and returns an array containing (as possibly empty Hashtables of variablename-to-term bindings) every
547 * found solution (in the order in which they were found).
548 *
549 * @return an array of Hashtables (possibly none), each of which is a solution (in the order in which they were found) of the Query; at most 'n' solutions will be found and returned. <b>NB</b> in
550 * JPL 1.0.1, this method (inconsistently) returned null when a Query had no solutions; in JPL 2.x onwards it returns an empty array (thus the length of the array is, in every case, the
551 * quantity of solutions).
552 * <p>
553 * <b>NB</b> in JPL 1.0.1, bindings were keyed (awkwardly) by Variable instances; in JPL 2.x onwards they are keyed by the (String) names of variables, which is consistent with the Term
554 * type being just a concrete syntax for terms (and hence queries).
555 * <p>
556 */
557 public synchronized final Hashtable<String, Term>[] nSolutions(long n) {
558 if (open) {
559 throw new JPLException("Query is already open");
560 } else {
561 // get a vector of solutions:
562 Vector<Hashtable<String, Term>> v = new Vector<Hashtable<String, Term>>();
563 for (long i = 0; i++ < n && hasMoreSolutions();) {
564 v.addElement(nextSolution());
565 }
566 // turn the vector into an array:
567 @SuppressWarnings("unchecked")
568 Hashtable<String, Term> solutions[] = (Hashtable<String, Term>[]) new Hashtable[v.size()]; // 0 solutions -> Hashtable[0]
569 v.copyInto(solutions);
570 return solutions;
571 }
572 }
573
574 /**
575 * This static method creates a Query whose goal is the given Term, calls it to exhaustion or until N solutions are found, whichever is sooner, and returns an array containing (as possibly empty
576 * Hashtables of variablename-to-term bindings) every found solution (in the order in which they were found). Throws JPLException if goal is neither a jpl.Atom nor a jpl.Compound.
577 *
578 * @param goal
579 * the goal of this Query
580 */
581 public static final Hashtable<String, Term>[] nSolutions(Term goal, long n) {
582 return (new Query(goal)).nSolutions(n);
583 }
584
585 /**
586 * This static method creates a Query from the given Prolog source text fragment, calls it to exhaustion or until N solutions are found, whichever is sooner, and returns an array containing (as
587 * possibly empty Hashtables of variablename-to-term bindings) every found solution (in the order in which they were found). Throws PrologException containing error(syntax_error(_),_) if text is
588 * invalid.
589 *
590 * @param text
591 * a Prolog source text fragment denoting a goal
592 */
593 public static final Hashtable<String, Term>[] nSolutions(String text, long n) {
594 return (new Query(text)).nSolutions(n);
595 }
596
597 /**
598 * If text denotes (in traditional Prolog source syntax) a term containing N questionmark (?) symbols and there are N accompanying params, this static method replaces each questionmark symbol by
599 * its respective param, calls the resulting goal to exhaustion or until N solutions are found, whichever is sooner, and returns an array containing (as possibly empty Hashtables of
600 * variablename-to-term bindings) every found solution (in the order in which they were found).
601 *
602 * Otherwise, if text denotes an atom, this static method creates a Query where text is the name of the goal and params are the args; the resulting goal is then called as above. This latter mode
603 * is redundant, deprecated (informally), and retained only for backward compatibility.
604 *
605 * @param text
606 * the Prolog source text of a goal, in which questionmarks are regarded as substitutible parameters
607 * @param params
608 * terms to be substituted for the respective questionmarks in the query text
609 */
610 public static final Hashtable<String, Term>[] nSolutions(String text, Term[] params, long n) {
611 return (new Query(text, params)).nSolutions(n);
612 }
613
614 /**
615 * Returns the first solution, if any, as a (possibly empty) Hashtable of variablename-to-term bindings, else null.
616 *
617 * This method will throw a JPLException if this Query is already open (and the Query will remain open as before). Otherwise, upon return, the Query will be closed.
618 *
619 * @return the first solution, if the query has one, as a (possibly empty) Hashtable. If the return value is null, this means that the Query has no solutions.
620 * <p>
621 */
622 public synchronized final Hashtable<String, Term> oneSolution() {
623 if (open) {
624 throw new JPLException("Query is already open");
625 } else {
626 Hashtable<String, Term> solution;
627 if (hasMoreSolutions()) {
628 solution = nextSolution();
629 close(); // safe, whether or not this is the only solution
630 } else {
631 solution = null;
632 }
633 return solution;
634 }
635 }
636
637 /**
638 * This static method creates a Query (whose goal is the specified Term) and calls it at most once, returning the first solution, if there is one, as a (possibly empty) Hashtable, else null. The
639 * goal can be a jpl.Atom or a jpl.Compound, but cannot be an instance of jpl.Float, jpl.Integer or jpl.Variable.
640 *
641 * @param goal
642 * the goal of this Query
643 */
644 public static final Hashtable<String, Term> oneSolution(Term goal) {
645 return (new Query(goal)).oneSolution();
646 }
647
648 /**
649 * This static method creates a Query from the given Prolog source text fragment, and calls it at most once, returning the first solution, if there is one, as a (possibly empty) Hashtable, else
650 * null. Throws PrologException containing error(syntax_error(_),_) if text is invalid.
651 *
652 * @param text
653 * a Prolog source text fragment denoting a goal
654 */
655 public static final Hashtable<String, Term> oneSolution(String text) {
656 return (new Query(text)).oneSolution();
657 }
658
659 /**
660 * If text denotes (in traditional Prolog source syntax) a term containing N questionmark (?) symbols and there are N params, each questionmark symbol is replaced by its respective param to
661 * provide the goal of this query: the resulting goal is then called (at most once) and the first solution, if there is one, is returned as a (possibly empty) Hashtable, else null.
662 *
663 * Otherwise, if text denotes an atom, this static method creates a Query where text is the name of the goal and params are the args; the resulting goal is then called as above. This latter mode
664 * is redundant, deprecated (informally), and retained only for backward compatibility.
665 *
666 * @param text
667 * the Prolog source text of a goal, in which questionmarks are regarded as substitutible parameters
668 * @param params
669 * terms to be substituted for the respective questionmarks in the query text
670 */
671 public static final Hashtable<String, Term> oneSolution(String text, Term[] params) {
672 return (new Query(text, params)).oneSolution();
673 }
674
675 /**
676 * This method will attempt to call this Query's goal within an available Prolog engine.
677 *
678 * @return the provability of the Query, i.e. 'true' if it has at least one solution, 'false' if the call fails without finding a solution.
679 * <p>
680 *
681 * Only the first solution (if there is one) will be found; any bindings will be discarded, and the Query will be closed.
682 * <p>
683 * This method will throw a JPLException if this Query is already open.
684 *
685 * @deprecated Use .hasSolution() instead.
686 */
687 public synchronized final boolean query() {
688 return oneSolution() != null;
689 }
690
691 /**
692 * This method will attempt to call this Query's goal within an available Prolog engine.
693 *
694 * @return the provability of the Query, i.e. 'true' if it has at least one solution, 'false' if the call fails without finding a solution.
695 * <p>
696 *
697 * Only the first solution (if there is one) will be found; any bindings will be discarded, and the Query will be closed.
698 * <p>
699 * This method will throw a JPLException if this Query is already open.
700 */
701 public synchronized final boolean hasSolution() {
702 return oneSolution() != null;
703 }
704
705 /**
706 * This static method creates a Query (whose goal is the specified Term) and calls it at most once, returning true if a solution was found, else false. The goal can be a jpl.Atom or a
707 * jpl.Compound, but cannot be an instance of jpl.Float, jpl.Integer or jpl.Variable.
708 *
709 * @param goal
710 * the goal of this Query
711 */
712 public static final boolean hasSolution(Term goal) {
713 return (new Query(goal)).hasSolution();
714 }
715
716 /**
717 * This static method creates a Query from the given Prolog source text and calls it at most once, returning true if a solution was found, else false. Throws PrologException containing
718 * error(syntax_error(_),_) if text is invalid.
719 *
720 * @param text
721 * the goal of this Query, as Prolog source text
722 */
723 public static final boolean hasSolution(String text) {
724 return (new Query(text)).hasSolution();
725 }
726
727 /**
728 * If text denotes (in traditional Prolog source syntax) a term containing N questionmark (?) symbols and there are N params, each questionmark symbol is replaced by its corresponding arg to
729 * provide the new Query's goal: the resulting Query is called as described above.
730 *
731 * Otherwise, if text denotes an atom, this static method creates a Query where text is the name of its goal and args are its args; it then calls this goal (at most once) and returns true if a
732 * solution was found, else false. This latter mode is redundant, deprecated (informally), and retained only for backward compatibility.
733 *
734 * @param text
735 * the Prolog source text of a goal, in which questionmarks are regarded as substitutible parameters
736 * @param params
737 * terms to be substituted for the respective questionmarks in the query text
738 */
739 public static final boolean hasSolution(String text, Term[] params) {
740 return (new Query(text, params)).hasSolution();
741 }
742
743 // this method doesn't work, but is intended to be called from another thread,
744 // to abort a Query which is open and possibly currently executing nextSolution() or similar
745 public final int abort() {
746 if (open) {
747 (new Thread(new Runnable() {
748 public void run() {
749 try {
750 int rc1 = Prolog.attach_engine(engine);
751 System.out.println("q.abort(): attach_engine() returns " + rc1);
752 int rc2 = Prolog.action_abort();
753 System.out.println("q.abort(): action_abort() returns " + rc2);
754 // int rc3 = Prolog.release_pool_engine();
755 // System.out.println("q.abort(): release_pool_engine() returns " + rc3);
756 } catch (Exception e) {
757 }
758 }
759 })).start(); // call the query in a separate thread
760 /*
761 * int rc0a = Prolog.pool_engine_id(this.engine); System.out.println("q.abort(): this.engine has id=" + rc0a);
762 *
763 * engine_t e = Prolog.current_engine(); System.out.println("q.abort(): " + (e == null ? "no current engine" : "current engine id=" + Prolog.pool_engine_id(e)));
764 *
765 * int rc0b = Prolog.release_pool_engine(); System.err.println("q.abort(): release_pool_engine() returns " + rc0b);
766 *
767 * engine_t e2 = Prolog.current_engine(); System.out.println("q.abort(): " + (e == null ? "no current engine" : "current engine id=" + Prolog.pool_engine_id(e2)));
768 *
769 * int rc1 = Prolog.attach_engine(this.engine); System.out.println("q.abort(): attach_engine() returns " + rc1);
770 *
771 * engine_t e3 = Prolog.current_engine(); System.out.println("q.abort(): " + (e == null ? "no current engine" : "current engine id=" + Prolog.pool_engine_id(e3)));
772 *
773 * int rc2 = Prolog.action_abort(); System.out.println("q.abort(): action_abort() returns " + rc2);
774 *
775 * int rc3 = Prolog.release_pool_engine(); System.out.println("q.abort(): release_pool_engine() returns " + rc3);
776 *
777 * int rc4 = Prolog.attach_engine(e); System.out.println("q.abort(): attach_engine() returns " + rc4);
778 */
779 return 0;
780 } else {
781 System.out.println("q.abort(): query is not open");
782 return -1;
783 }
784 }
785
786 /**
787 * Returns a crude String representation of a Query.
788 *
789 * @return a crude String representation of a Query
790 */
791 public String toString() {
792 return goal_.name + "( " + Term.toString(goal_.args) + " )";
793 }
794
795 /**
796 * Returns a debug-friendly representation of a Query
797 *
798 * @return a debug-friendly representation of a Query
799 * @deprecated
800 */
801 public String debugString() {
802 return "(Query " + goal_.name + " " + Term.debugString(goal_.args) + ")";
803 }
804 }
+0
-648
packages/jpl/src/java/jpl/Term.java less more
0 package jpl;
1
2 import java.util.Hashtable;
3 import java.util.Iterator;
4 import java.util.Map;
5 import jpl.fli.DoubleHolder;
6 import jpl.fli.Int64Holder;
7 import jpl.fli.IntHolder;
8 import jpl.fli.Prolog;
9 import jpl.fli.StringHolder;
10 import jpl.fli.term_t;
11
12 /**
13 * Term is the abstract base class for Compound, Atom, Variable, Integer and Float, which comprise a Java-oriented concrete syntax for Prolog. You cannot create instances of Term directly; rather, you
14 * should create instances of Term's concrete subclasses. Alternatively, use textToTerm() to construct a Term from its conventional Prolog source text representation.
15 *
16 * <hr>
17 * <i> Copyright (C) 2004 Paul Singleton
18 * <p>
19 * Copyright (C) 1998 Fred Dushin
20 * <p>
21 *
22 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
23 * License, or (at your option) any later version.
24 * <p>
25 *
26 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 * Library Public License for more details.
28 * <p>
29 * </i>
30 * <hr>
31 *
32 * @author Fred Dushin <fadushin@syr.edu>
33 * @version $Revision$
34 */
35 public abstract class Term {
36
37 /**
38 * This default constructor enables subclasses to define their own default constructors
39 */
40 protected Term() {
41 }
42
43 /**
44 * returns the i-th (1+) argument of a Term; defined only for Compound (and hence Atom); throws a JPLException for other Term subclasses
45 *
46 * @return the i-th argument of a (Compound) Term
47 */
48 public Term arg(int i) { // overridden in Compound
49 throw new JPLException("arg(int) is undefined for " + this.typeName() + " instances");
50 }
51
52 /**
53 * returns, as a Term[], the arguments of a Compound returns an empty Term[] from an Atom, Integer or Float throws a JPLException from a Variable
54 *
55 * @return the arguments of a Compound as a Term[
56 */
57 public Term[] args() { // overridden in Compound
58 return new Term[] {};
59 }
60
61 public String blobType() { // overridden in Atom
62 return null;
63 }
64
65 /**
66 * Tests whether this Term's functor has (String) 'name' and 'arity' Returns false if called inappropriately
67 *
68 * @return whether this Term's functor has (String) 'name' and 'arity'
69 */
70 public boolean hasFunctor(String name, int arity) { // overridden in Compound
71 return false;
72 }
73
74 /**
75 * Tests whether this Term's functor has (int) 'name' and 'arity' Returns false if called inappropriately
76 *
77 * @return whether this Term's functor has (int) 'name' and 'arity'
78 */
79 public boolean hasFunctor(int value, int arity) {
80 return false;
81 }
82
83 /**
84 * Tests whether this Term's functor has (double) 'name' and 'arity' Returns false if called inappropriately
85 *
86 * @return whether this Term's functor has (double) 'name' and 'arity'
87 */
88 public boolean hasFunctor(double value, int arity) {
89 return false;
90 }
91
92 /**
93 * returns, as a String, the name of a Compound, Atom or Variable throws a JPLException from an Integer or Float
94 *
95 * @return the name of a Compound, Atom or Variable
96 */
97 public String name() { // overridden in Compound, Variable
98 throw new JPLException("name() is undefined for " + this.typeName() + " instances");
99 };
100
101 /**
102 * returns, as an int, the arity of a Compound, Atom, Integer or Float; throws a JPLException from a Variable
103 *
104 * @return the arity of a Compound, Atom, Integer or Float
105 */
106 public int arity() { // overridden in Compound, Variable
107 return 0;
108 };
109
110 /**
111 * returns the value (as an int) of an Integer or Float throws a JPLException from a Compound, Atom or Variable
112 *
113 * @return the value (as an int) of an Integer or Float
114 */
115 public int intValue() {
116 throw new JPLException("jpl." + this.typeName() + ".intValue() is undefined");
117 }
118
119 /**
120 * returns the value (as a long) of an Integer or Float throws a JPLException from a Compound, Atom or Variable
121 *
122 * @return the value (as a long) of an Integer or Float
123 */
124 public long longValue() {
125 throw new JPLException("jpl." + this.typeName() + ".longValue() is undefined");
126 }
127
128 /**
129 * returns the value (as a float) of an Integer or Float throws a JPLException from a Compound, Atom or Variable
130 *
131 * @return the value (as a float) of an Integer or Float
132 */
133 public float floatValue() {
134 throw new JPLException("jpl." + this.typeName() + ".floatValue() is undefined");
135 }
136
137 /**
138 * returns the value (as a double) of an Integer or Float throws a JPLException from any other subclass
139 *
140 * @return the value (as an double) of an Integer or Float
141 */
142 public double doubleValue() {
143 throw new JPLException("jpl." + this.typeName() + ".doubleValue() is undefined");
144 }
145
146 /**
147 * returns the type of this term, as one of jpl.fli.Prolog.COMPOUND, .ATOM, .VARIABLE, .INTEGER, .FLOAT etc
148 *
149 * @return the type of this term, as one of jpl.fli.Prolog.COMPOUND, .ATOM, .VARIABLE, .INTEGER, .FLOAT etc
150 */
151 public abstract int type();
152
153 /**
154 * returns the name of the type of this term, as one of "Compound", "Atom", "Variable", "Integer", "Float" etc
155 *
156 * @return the name of the type of this term, as one of "Compound", "Atom", "Variable", "Integer", "Float" etc
157 */
158 public abstract String typeName();
159
160 /**
161 * whether this Term represents an atom
162 *
163 * @return whether this Term represents an atom
164 */
165 public boolean isAtom() {
166 return this instanceof Atom;
167 }
168
169 /**
170 * whether this Term represents a compound term
171 *
172 * @return whether this Term represents a compound atom
173 */
174 public boolean isCompound() {
175 return this instanceof Compound;
176 }
177
178 /**
179 * whether this Term represents an atom
180 *
181 * @return whether this Term represents an atom
182 */
183 public boolean isFloat() {
184 return this instanceof Float;
185 }
186
187 /**
188 * whether this Term represents an atom
189 *
190 * @return whether this Term represents an atom
191 */
192 public boolean isInteger() {
193 return this instanceof Integer;
194 }
195
196 /**
197 * whether this Term is a variable
198 *
199 * @return whether this Term is a variable
200 */
201 public boolean isVariable() {
202 return this instanceof Variable;
203 }
204
205 /**
206 * whether this Term denotes (syntax-specifically) an empty list
207 *
208 * @return whether this Term denotes (syntax-specifically) an empty list
209 */
210 public boolean isListNil() { // overridden in Atom
211 return false;
212 }
213
214 /**
215 * whether this Term denotes (syntax-specifically) a list pair
216 *
217 * @return whether this Term denotes (syntax-specifically) a list pair
218 */
219 public boolean isListPair() { // overridden in Compound
220 return false;
221 }
222
223 /**
224 * whether this Term is a 'jfalse' structure, i.e. @(false)
225 *
226 * @return whether this Term is a 'jfalse' structure, i.e. @(false)
227 */
228 public boolean isJFalse() {
229 return false; // overridden in Compound, where it might sometimes be true
230 }
231
232 /**
233 * whether this Term is a 'jtrue' structure, i.e. @(true)
234 *
235 * @return whether this Term is a 'jtrue' structure, i.e. @(true)
236 */
237 public boolean isJTrue() {
238 return false; // overridden in Compound, where it might sometimes be true
239 }
240
241 /**
242 * whether this Term is a 'jnull' structure, i.e. @(null)
243 *
244 * @return whether this Term is a 'jnull' structure, i.e. @(null)
245 */
246 public boolean isJNull() {
247 return false; // overridden in Compound, where it might sometimes be true
248 }
249
250 /**
251 * whether this Term is a 'jvoid' structure, i.e. @(void)
252 *
253 * @return whether this Term is a 'jvoid' structure, i.e. @(void)
254 */
255 public boolean isJVoid() {
256 return false; // overridden in Compound, where it might sometimes be true
257 }
258
259 /**
260 * whether this Term is a 'jobject' structure, i.e. @(Tag)
261 *
262 * @return whether this Term is a 'jobject' structure, i.e. @(Tag)
263 */
264 public boolean isJObject() {
265 return false; // overridden in Compound, where it might sometimes be true
266 }
267
268 /**
269 * whether this Term is a 'jref' structure, i.e. @(Tag) or @(null)
270 *
271 * @return whether this Term is a 'jref' structure, i.e. @(Tag) or @(null)
272 */
273 public boolean isJRef() {
274 return false; // overridden in Compound, where it might sometimes be true
275 }
276
277 public abstract Object jrefToObject();
278
279 /**
280 * returns a new Term instance which represents the given object
281 */
282 public static Term objectToJRef(Object obj) {
283 return new Compound("@", new Term[] { new Atom(Prolog.object_to_tag(obj)) });
284 }
285
286 public Term putParams(Term[] ps) {
287 IntHolder next = new IntHolder();
288 next.value = 0;
289 Term t2 = this.putParams1(next, ps);
290 if (next.value != ps.length) {
291 throw new JPLException("Term.putParams: more actual params than formal");
292 }
293 return t2;
294 }
295
296 public Term putParams(Term plist) {
297 Term[] ps = plist.toTermArray();
298 return putParams(ps);
299 }
300
301 protected Term putParams1(IntHolder next, Term[] ps) {
302 switch (this.type()) {
303 case Prolog.COMPOUND:
304 return new Compound(this.name(), putParams2(this.args(), next, ps));
305 case Prolog.ATOM:
306 if (!this.name().equals("?")) {
307 return this;
308 } else if (next.value >= ps.length) {
309 throw new JPLException("Term.putParams: fewer actual params than formal params");
310 } else {
311 return ps[next.value++];
312 }
313 default:
314 return this;
315 }
316 }
317
318 static protected Term[] putParams2(Term[] ts, IntHolder next, Term[] ps) {
319 int n = ts.length;
320 Term[] ts2 = new Term[n];
321 for (int i = 0; i < n; i++) {
322 ts2[i] = ts[i].putParams1(next, ps);
323 }
324 return ts2;
325 }
326
327 /**
328 * the length of this list, iff it is one, else an exception is thrown
329 *
330 * @throws JPLException
331 * @return the length (as an int) of this list, iff it is one
332 */
333 public int listLength() {
334 if (this.isListPair()) { // was .hasFunctor(".", 2)
335 return 1 + this.arg(2).listLength(); // TODO eliminate recursion
336 } else if (this.isListNil()) { // was .hasFunctor("[]", 0)
337 return 0;
338 } else {
339 throw new JPLException("Term.listLength: term is not a list");
340 }
341 }
342
343 /**
344 * returns an array of terms which are the successive members of this list, if it is a list, else throws an exception
345 *
346 * @throws JPLException
347 * @return an array of terms which are the successive members of this list, if it is a list
348 */
349 public Term[] toTermArray() {
350 try {
351 int len = this.listLength(); // exception if not LIST
352 Term[] ts = new Term[len];
353 Term t = this;
354 for (int i = 0; i < len; i++) {
355 ts[i] = t.arg(1);
356 t = t.arg(2);
357 }
358 return ts;
359 } catch (JPLException e) {
360 throw new JPLException("Term.toTermArray: term is not a proper list");
361 }
362 }
363
364 /**
365 * Returns a debug-friendly representation of a Term
366 *
367 * @return a debug-friendly representation of a Term
368 * @deprecated
369 */
370 public abstract String debugString();
371
372 /**
373 * Returns a debug-friendly representation of a list of Terms
374 *
375 * @return a debug-friendly representation of a list of Terms
376 * @deprecated
377 */
378 public static String debugString(Term arg[]) {
379 String s = "[";
380 for (int i = 0; i < arg.length; ++i) {
381 s += arg[i].debugString();
382 if (i != arg.length - 1) {
383 s += ", ";
384 }
385 }
386 return s + "]";
387 }
388
389 // ==================================================================/
390 // Converting JPL Terms to Prolog terms
391 //
392 // To convert a Term to a term_t, we need to traverse the Term
393 // structure and build a corresponding Prolog term_t object.
394 // There are some issues:
395 //
396 // - Prolog term_ts rely on the *consecutive* nature of term_t
397 // references. In particular, to build a compound structure
398 // in the Prolog FLI, one must *first* determine the arity of the
399 // compound, create a *sequence* of term_t references, and then
400 // put atoms, functors, etc. into those term references. We
401 // do this in these methods by first determining the arity of the
402 // Compound, and then by "put"-ing a type into a term_t.
403 // The "put" method is implemented differently in each of Term's
404 // five subclasses.
405 //
406 // - What if we are trying to make a term_t from a Term, but the
407 // Term has several same-named Variables? We want
408 // to ensure that one Prolog variable will be created and shared, or else
409 // queries will give incorrect answers. We thus pass a Hashtable
410 // (var_table) through these methods. The table contains term_t
411 // instances, keyed on Variable names.
412 // ==================================================================/
413
414 public void put(term_t term) {
415 put(new Hashtable<String, term_t>(), term);
416 }
417
418 /**
419 * Cache the reference to the Prolog term_t here.
420 *
421 * @param varnames_to_vars
422 * A Map from variable names to JPL Variables.
423 * @param term
424 * A (previously created) term_t which is to be put with a Prolog term-type appropriate to the Term type (e.g., Atom, Variable, Compound, etc.) on which the method is invoked.)
425 */
426 protected abstract void put(Map<String, term_t> varnames_to_vars, term_t term);
427
428 /**
429 * This static method converts an array of Terms to a *consecutive* sequence of term_t objects. Note that the first term_t object returned is a term_t class (structure); the succeeding term_t
430 * objects are consecutive references obtained by incrementing the *value* field of the term_t.
431 *
432 * @param varnames_to_vars
433 * Map from variable names to JPL Variables.
434 * @param args
435 * An array of jpl.Term references.
436 * @return consecutive term_t references (first of which is a structure)
437 */
438 protected static term_t putTerms(Map<String, term_t> varnames_to_vars, Term[] args) {
439 // first create a sequence of term_ts. The 0th term_t
440 // will be a jpl.fli.term_t. Successive Prolog term_t
441 // references will reside in the Prolog engine, and
442 // can be obtained by term0.value+i.
443 term_t term0 = Prolog.new_term_refs(args.length);
444 // for each new term reference, construct a Prolog term
445 // by putting an appropriate Prolog type into the reference.
446 long ith_term_t = term0.value;
447 for (int i = 0; i < args.length; ++i, ++ith_term_t) {
448 term_t term = new term_t();
449 term.value = ith_term_t;
450 args[i].put(varnames_to_vars, term); // each subclass defines its own put()
451 }
452 return term0;
453 }
454
455 // experiment: for jni_jobject_to_term_byval/2 in jpl.c
456 public static void putTerm(Object obj, term_t termref) {
457 if (obj instanceof Term) {
458 ((Term) obj).put(termref);
459 } else {
460 throw new JPLException("not a Term");
461 }
462 }
463
464 /**
465 * This method calls from_term_t on each term in the n consecutive term_ts. A temporary jpl.term_t "holder" (byref) structure must be created in order to extract type information from the Prolog
466 * engine.
467 *
468 * @param vars_to_Vars
469 * A Map from Prolog variables to jpl.Variable instances
470 * @param n
471 * The number of consecutive term_ts
472 * @param term0
473 * The 0th term_t (structure); subsequent term_ts are not structures.
474 * @return An array of converted Terms
475 */
476 /*
477 * protected static Term[] from_term_ts(Map vars_to_Vars, int n, term_t term0) {
478 *
479 * // create an (uninitialised) array of n Term references Term[] terms = new Term[n];
480 *
481 * // for each term_t (from 0...n-1), create a term_t // (temporary) structure and dispatch the translation // to a Term to the static from_term_t method of the Term // class. This will perform
482 * (Prolog) type analysis on the // term_t and call the appropriate static method to create // a Term of the right type (e.g., Atom, Variable, List, etc.) // long ith_term_t = term0.value; for
483 * (int i = 0; i < n; ++i, ++ith_term_t) { term_t term = new term_t(); term.value = ith_term_t;
484 *
485 * terms[i] = Term.from_term_t(vars_to_Vars, term); }
486 *
487 * return terms; }
488 */
489
490 /**
491 * create and return a jpl.Term representation of the given Prolog term
492 *
493 * @param vars_to_Vars
494 * A Map from Prolog variables to jpl.Variable instances
495 * @param term
496 * The Prolog term (in a term_t holder) to convert
497 * @return The converted Term subclass instance.
498 */
499 protected static Term getTerm(Map<term_t, Variable> vars_to_Vars, term_t term) {
500 StringHolder hString;
501 IntHolder hInt;
502 Int64Holder hInt64;
503 switch (Prolog.term_type(term)) {
504 case Prolog.VARIABLE:
505 for (Iterator<term_t> i = vars_to_Vars.keySet().iterator(); i.hasNext();) {
506 term_t varX = (term_t) i.next(); // a previously seen Prolog variable
507 if (Prolog.compare(varX, term) == 0) { // identical Prolog variables?
508 return (Term) vars_to_Vars.get(varX); // return the associated JPL Variable
509 }
510 }
511 // otherwise, the Prolog variable in term has not been seen before
512 Variable Var = new Variable(); // allocate a new (sequentially named) Variable to represent it
513 Var.term_ = term; // this should become redundant...
514 vars_to_Vars.put(term, Var); // use Hashtable(var,null), but only need set(var)
515 return Var;
516 case Prolog.ATOM:
517 hString = new StringHolder();
518 Prolog.get_atom_chars(term, hString); // ignore return val; assume success...
519 return new Atom(hString.value, "text");
520 case Prolog.STRING:
521 hString = new StringHolder();
522 Prolog.get_string_chars(term, hString); // ignore return val; assume success...
523 return new Atom(hString.value, "string");
524 case Prolog.INTEGER:
525 hInt64 = new Int64Holder();
526 Prolog.get_integer(term, hInt64); // assume it succeeds...
527 return new jpl.Integer(hInt64.value);
528 case Prolog.FLOAT:
529 DoubleHolder hFloatValue = new DoubleHolder();
530 Prolog.get_float(term, hFloatValue); // assume it succeeds...
531 return new jpl.Float(hFloatValue.value);
532 case Prolog.COMPOUND:
533 case Prolog.LIST_PAIR:
534 hString = new StringHolder();
535 hInt = new IntHolder();
536 Prolog.get_name_arity(term, hString, hInt); // assume it succeeds
537 Term args[] = new Term[hInt.value];
538 // term_t term1 = Prolog.new_term_refs(hArity.value);
539 for (int i = 1; i <= hInt.value; i++) {
540 term_t termi = Prolog.new_term_ref();
541 Prolog.get_arg(i, term, termi);
542 args[i - 1] = Term.getTerm(vars_to_Vars, termi);
543 }
544 return new Compound(hString.value, args);
545 case Prolog.LIST_NIL:
546 return JPL.LIST_NIL;
547 default:
548 throw new JPLException("Term.from_term_t: unknown term type=" + Prolog.term_type(term)); // should never happen...
549 }
550 }
551
552 protected static Term getTerm(term_t term) {
553 return getTerm(new Hashtable<term_t, Variable>(), term);
554 }
555
556 // ==================================================================/
557 // Computing Substitutions
558 //
559 // Once a solution has been found, the Prolog term_t references
560 // will have been instantiated and will refer to new terms. To compute
561 // a substitution, we traverse the (original) Term structure, looking
562 // at the term_t reference in the Term. The only case we really care
563 // about is if the (original) Term is a Variable; if so, the term_t
564 // back in the Prolog engine may be instantiated (non Variable parts
565 // of the original Term cannot change or become uninstantiated). In
566 // this case, we can store this term in a Hashtable, keyed by the
567 // Variable with which the term was unified.
568 // ==================================================================/
569
570 /**
571 * This method computes a substitution from a Term. The bindings Hashtable stores Terms, keyed by names of Variables. Thus, a substitution is as it is in mathematical logic, a sequence of the form
572 * \sigma = {t_0/x_0, ..., t_n/x_n}. Once the substitution is computed, the substitution should satisfy
573 *
574 * \sigma T = t
575 *
576 * where T is the Term from which the substitution is computed, and t is the term_t which results from the Prolog query.
577 * <p>
578 *
579 * A second Hashtable, vars, is required; this table holds the Variables that occur (thus far) in the unified term. The Variable instances in this table are guaranteed to be unique and are keyed
580 * on Strings which are Prolog internal representations of the variables.
581 *
582 * @param bindings
583 * table holding Term substitutions, keyed on names of Variables.
584 * @param vars
585 * A Hashtable holding the Variables that occur thus far in the term; keyed by internal (Prolog) string rep.
586 */
587 protected void getSubst(Map<String, Term> varnames_to_Terms, Map<term_t, Variable> vars_to_Vars) { // overridden in Compound, Variable
588 }
589
590 /**
591 * Just calls computeSubstitution for each Term in the array.
592 *
593 * @param varnames_to_Terms
594 * a Map from variable names to Terms
595 * @param vars_to_Vars
596 * a Map from Prolog variables to JPL Variables
597 * @param args
598 * an array of Terms
599 */
600 protected static void getSubsts(Map<String, Term> varnames_to_Terms, Map<term_t, Variable> vars_to_Vars, Term[] args) {
601 for (int i = 0; i < args.length; ++i) {
602 args[i].getSubst(varnames_to_Terms, vars_to_Vars);
603 }
604 }
605
606 /**
607 * This method is used (by Compound.equals) to determine the Terms in two Term arrays are pairwise equal, where two Terms are equal if they satisfy the equals predicate (defined differently in
608 * each Term subclass).
609 *
610 * @param t1
611 * an array of Terms
612 * @param t2
613 * another array of Terms
614 * @return true if all of the Terms in the (same-length) arrays are pairwise equal
615 */
616 protected static boolean terms_equals(Term[] t1, Term[] t2) {
617 if (t1.length != t2.length) {
618 return false;
619 } else {
620 for (int i = 0; i < t1.length; ++i) {
621 if (!t1[i].equals(t2[i])) {
622 return false;
623 }
624 }
625 return true;
626 }
627 }
628
629 /**
630 * Converts a list of Terms to a String.
631 *
632 * @param args
633 * An array of Terms to convert
634 * @return String representation of a list of Terms
635 */
636 public static String toString(Term[] args) {
637 String s = "";
638 for (int i = 0; i < args.length; ++i) {
639 s += args[i].toString();
640 if (i != args.length - 1) {
641 s += ", ";
642 }
643 }
644 return s;
645 }
646
647 }
+0
-237
packages/jpl/src/java/jpl/Util.java less more
0 package jpl;
1
2 import java.util.Hashtable;
3 import java.util.Iterator;
4 import java.util.Map;
5
6 import jpl.fli.term_t;
7
8 /**
9 * This class provides a bunch of static utility methods for the JPL High-Level Interface.
10 *
11 * <hr>
12 * <i> Copyright (C) 2004 Paul Singleton
13 * <p>
14 * Copyright (C) 1998 Fred Dushin
15 * <p>
16 *
17 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
18 * License, or (at your option) any later version.
19 * <p>
20 *
21 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Library Public License for more details.
23 * <p>
24 * </i>
25 * <hr>
26 *
27 * @author Fred Dushin <fadushin@syr.edu>
28 * @version $Revision$
29 */
30 public final class Util {
31 /**
32 * Converts an array of Terms to a JPL representation of a Prolog list of terms whose members correspond to the respective array elements.
33 *
34 * @param terms
35 * An array of Term
36 * @return Term a list of the array elements
37 */
38 public static Term termArrayToList(Term[] terms) {
39 Term list = JPL.LIST_NIL; // was new Atom("[]")
40 for (int i = terms.length - 1; i >= 0; --i) {
41 list = new Compound(JPL.LIST_PAIR, new Term[] { terms[i], list });
42 }
43 return list;
44 }
45
46 /**
47 * Converts a solution hashtable to an array of Terms.
48 *
49 * @param varnames_to_Terms
50 * A Map from variable names to Terms
51 * @return Term[] An array of the Terms to which successive variables are bound
52 */
53 public static Term[] bindingsToTermArray(Map<Variable, Term> varnames_to_Terms) {
54 Term[] ts = new Term[varnames_to_Terms.size()];
55 for (Iterator<Variable> i = varnames_to_Terms.keySet().iterator(); i.hasNext();) {
56 Variable k = i.next();
57 ts[k.index] = (varnames_to_Terms.get(k));
58 }
59 return ts;
60 }
61
62 /**
63 * Converts a substitution, in the form of a Map from variable names to Terms, to a String.
64 *
65 * @param varnames_to_Terms
66 * A Map from variable names to Terms.
67 * @return String A String representation of the variable bindings
68 */
69 public static String toString(Map<String, Term> varnames_to_Terms) {
70 if (varnames_to_Terms == null) {
71 return "[no solution]";
72 } else {
73 Iterator<String> varnames = varnames_to_Terms.keySet().iterator();
74 String s = "Bindings: ";
75 while (varnames.hasNext()) {
76 String varname = varnames.next();
77 s += varname + "=" + varnames_to_Terms.get(varname).toString() + "; ";
78 }
79 return s;
80 }
81 }
82
83 /**
84 * Converts a (JPL) list of Name=Var pairs (as yielded by atom_to_term/3) to a Map from Prolog variables (necessarily in term_t holders) to named JPL Variables
85 *
86 * @param nvs
87 * A JPL list of Name=Var pairs (as yielded by atom_to_term/3)
88 * @return Map A Map from Prolog variables (necessarily in term_t holders) to named JPL Variables
89 */
90 public static Map<term_t, Variable> namevarsToMap(Term nvs) {
91 try {
92 Map<term_t, Variable> vars_to_Vars = new Hashtable<term_t, Variable>();
93 while (nvs.isListPair() && nvs.arg(1).hasFunctor("=", 2)) {
94 // the cast to Variable is necessary to access the (protected) .term_ field
95 vars_to_Vars.put(((Variable) nvs.arg(1).arg(2)).term_, new Variable(nvs.arg(1).arg(1).name())); // map the Prolog variable to a new, named Variable
96 nvs = nvs.arg(2); // advance to next list cell
97 }
98 // maybe oughta check that nvs is [] ?
99 return vars_to_Vars;
100 } catch (java.lang.ClassCastException e) { // nvs is not of the expected structure
101 return null;
102 }
103 }
104
105 /**
106 * Converts a Prolog source text to a corresponding JPL Term (in which each Variable has the appropriate name from the source text). Throws PrologException containing error(syntax_error(_),_) if
107 * text is invalid.
108 *
109 * @param text
110 * A Prolog source text denoting a term
111 * @return Term a JPL Term equivalent to the given source text
112 */
113 public static Term textToTerm(String text) {
114 // it might be better to use PL_chars_to_term()
115 Query q = new Query(new Compound("atom_to_term", new Term[] { new Atom(text), new Variable("Term"), new Variable("NVdict") }));
116 q.open();
117 Map<String, Term> s = q.getSubstWithNameVars();
118 if (s != null) {
119 q.close();
120 return (Term) s.get("Term");
121 } else {
122 return null;
123 }
124 }
125
126 /**
127 * Converts a Prolog source text to a corresponding JPL Term (in which each Variable has the appropriate name from the source text), replacing successive occurrences of ? in the text by the
128 * corresponding element of Term[] params. (New in JPL 3.0.4)
129 *
130 * Throws PrologException containing error(syntax_error(_),_) if text is invalid.
131 *
132 * @param text
133 * A Prolog source text denoting a term
134 * @return Term a JPL Term equivalent to the given source text
135 */
136 public static Term textParamsToTerm(String text, Term[] params) {
137 return Util.textToTerm(text).putParams(params);
138 }
139
140 /**
141 * Converts an array of String to a corresponding JPL list
142 *
143 * @param a
144 * An array of String objects
145 * @return Term a JPL list corresponding to the given String array
146 */
147 public static Term stringArrayToList(String[] a) {
148 Term list = JPL.LIST_NIL; // was new Atom("[]");
149 for (int i = a.length - 1; i >= 0; i--) {
150 list = new Compound(JPL.LIST_PAIR, new Term[] { new Atom(a[i]), list });
151 }
152 return list;
153 }
154
155 /**
156 * Converts an array of int to a corresponding JPL list
157 *
158 * @param a
159 * An array of int values
160 * @return Term a JPL list corresponding to the given int array
161 */
162 public static Term intArrayToList(int[] a) {
163 Term list = JPL.LIST_NIL; // was new Atom("[]");
164 for (int i = a.length - 1; i >= 0; i--) {
165 list = new Compound(JPL.LIST_PAIR, new Term[] { new jpl.Integer(a[i]), list });
166 }
167 return list;
168 }
169
170 /**
171 * Converts an array of arrays of int to a corresponding JPL list of lists
172 *
173 * @param a
174 * An array of arrays of int values
175 * @return Term a JPL list of lists corresponding to the given int array of arrays
176 */
177 public static Term intArrayArrayToList(int[][] a) {
178 Term list = JPL.LIST_NIL; // was new Atom("[]");
179 for (int i = a.length - 1; i >= 0; i--) {
180 list = new Compound(JPL.LIST_PAIR, new Term[] { intArrayToList(a[i]), list });
181 }
182 return list;
183 }
184
185 public static int listToLength(Term t) {
186 int length = 0;
187 Term head = t;
188 while (head.isListPair()) {
189 length++;
190 head = head.arg(2);
191 }
192 return (head.isListNil() ? length : -1);
193 }
194
195 /**
196 * converts a proper list to an array of terms, else throws an exception
197 *
198 * @throws JPLException
199 * @return an array of terms whose successive elements are the corresponding members of the list (if it is a list)
200 */
201 public static Term[] listToTermArray(Term t) {
202 try {
203 int len = t.listLength(); // exception if not a list
204 Term[] ts = new Term[len];
205 for (int i = 0; i < len; i++) {
206 ts[i] = t.arg(1);
207 t = t.arg(2);
208 }
209 return ts;
210 } catch (JPLException e) {
211 throw new JPLException("Util.listToTermArray: term is not a proper list");
212 }
213 }
214
215 public static String[] atomListToStringArray(Term t) {
216 int n = listToLength(t);
217 String[] a;
218 if (n < 0) {
219 return null;
220 } else {
221 a = new String[n];
222 }
223 int i = 0;
224 Term head = t;
225 while (head.isListPair()) {
226 Term x = head.arg(1);
227 if (x.isAtom()) {
228 a[i++] = x.name();
229 } else {
230 return null;
231 }
232 head = head.arg(2);
233 }
234 return (head.isListNil() ? a : null);
235 }
236 }
+0
-242
packages/jpl/src/java/jpl/Variable.java less more
0 package jpl;
1
2 import java.util.Map;
3
4 import jpl.fli.Prolog;
5 import jpl.fli.term_t;
6
7 /**
8 * This class supports Java representations of Prolog variables.
9 * <p>
10 *
11 * A jpl.Variable instance is equivalent to a variable in a fragment of Prolog source text: it is *not* a "live" variable within a Prolog stack or heap. A corresponding Prolog variable is created only
12 * upon opening a Query whose goal refers to a Variable (and then only temporarily).
13 *
14 * <hr>
15 * <i> Copyright (C) 2004 Paul Singleton
16 * <p>
17 * Copyright (C) 1998 Fred Dushin
18 * <p>
19 *
20 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
21 * License, or (at your option) any later version.
22 * <p>
23 *
24 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 * Library Public License for more details.
26 * <p>
27 * </i>
28 * <hr>
29 *
30 * @author Fred Dushin <fadushin@syr.edu>
31 * @version $Revision$
32 */
33 public class Variable extends Term {
34 private static long n = 0; // the integral part of the next automatic variable name to be allocated
35 public final String name; // the name of this Variable
36 protected transient term_t term_ = null; // defined between Query.open() and Query.get2()
37 protected transient int index; // only used by (redundant?)
38
39 /**
40 * Create a new Variable with 'name' (which must not be null or ""), and may one day be constrained to comply with traditional Prolog syntax.
41 *
42 * @param name
43 * the source name of this Variable
44 */
45 public Variable(String name) {
46 if (name == null) {
47 throw new JPLException("constructor jpl.Variable(name): name cannot be null");
48 }
49 if (!isValidName(name)) {
50 throw new JPLException("constructor jpl.Variable(name): name cannot be empty String");
51 }
52 this.name = name;
53 }
54
55 /**
56 * Create a new Variable with new sequential name of the form "_261".
57 *
58 */
59 public Variable() {
60 this.name = "_" + Long.toString(n++); // e.g. _0, _1 etc.
61 }
62
63 /**
64 * The (nonexistent) args of this Variable
65 *
66 * @throws JPLException
67 *
68 * @return the (nonexistent) args of this Variable (never)
69 */
70 public Term[] args() {
71 throw new JPLException("jpl.Variable#args(): call is improper");
72 }
73
74 /**
75 * returns, as an int, the arity of a Term
76 *
77 * @return the arity of a Term
78 */
79 public int arity() {
80 throw new JPLException("arity() is undefined for Variable");
81 };
82
83 public boolean hasFunctor(String name, int arity) {
84 throw new JPLException("jpl.Variable#hasFunctor(): term is not sufficiently instantiated");
85 }
86
87 public boolean hasFunctor(int value, int arity) {
88 throw new JPLException("jpl.Variable#hasFunctor(): term is not sufficiently instantiated");
89 }
90
91 public boolean hasFunctor(double value, int arity) {
92 throw new JPLException("jpl.Variable#hasFunctor(): term is not sufficiently instantiated");
93 }
94
95 public Object jrefToObject() {
96 throw new JPLException("jpl.Variable#jrefToObject(): term is not a jref");
97 }
98
99 /**
100 * returns the lexical name of this Variable
101 *
102 * @return the lexical name of this Variable
103 */
104 public final String name() {
105 return this.name;
106 }
107
108 /**
109 * returns the type of this subclass of Term, i.e. Prolog.VARIABLE
110 *
111 * @return the type of this subclass of Term, i.e. Prolog.VARIABLE
112 */
113 public final int type() {
114 return Prolog.VARIABLE;
115 }
116
117 /**
118 * returns the typeName of this subclass of Term, i.e. "Variable"
119 *
120 * @return the typeName of this subclass of Term, i.e. "Variable"
121 */
122 public String typeName() {
123 return "Variable";
124 }
125
126 /**
127 * Returns a Prolog source text representation of this Variable
128 *
129 * @return a Prolog source text representation of this Variable
130 */
131 public String toString() {
132 return this.name;
133 }
134
135 /**
136 * A Variable is equal to another if their names are the same and they are not anonymous.
137 *
138 * @param obj
139 * The Object to compare.
140 * @return true if the Object is a Variable and the above condition apply.
141 */
142 public final boolean equals(Object obj) {
143 return obj instanceof Variable && !this.name.equals("_") && this.name.equals(((Variable) obj).name);
144 }
145
146 /**
147 * throws a JPLException (arg(int) is defined only for Compound and Atom)
148 *
149 * @return the ith argument (counting from 1) of this Variable (never)
150 */
151 public final Term arg(int i) {
152 throw new JPLException("jpl.Variable#arg(int) is undefined");
153 }
154
155 /**
156 * Tests the lexical validity of s as a variable's name
157 *
158 * @return the lexical validity of s as a variable's name
159 * @deprecated
160 */
161 private boolean isValidName(String s) {
162 if (s == null) {
163 throw new java.lang.NullPointerException(); // JPL won't call it this way
164 }
165 int len = s.length();
166 if (len == 0) {
167 throw new JPLException("invalid variable name");
168 }
169 char c = s.charAt(0);
170 if (!(c == '_' || c >= 'A' && c <= 'Z')) {
171 return false;
172 }
173 for (int i = 1; i < len; i++) {
174 c = s.charAt(i);
175 if (!(c == '_' || c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z' || c >= '0' && c <= '9')) {
176 return false;
177 }
178 }
179 return true;
180 }
181
182 /**
183 * Returns a debug-friendly String representation of an Atom.
184 *
185 * @return a debug-friendly String representation of an Atom
186 * @deprecated
187 */
188 public String debugString() {
189 return "(Variable " + toString() + ")";
190 }
191
192 /**
193 * To put a Variable, we must check whether a (non-anonymous) variable with the same name has already been put in the Term. If one has, then the corresponding Prolog variable has been stashed in
194 * the varnames_to_vars Map, keyed by the Variable name, so we can look it up and reuse it (this way, the sharing of variables in the Prolog term reflects the sharing of Variable names in the
195 * Term. Otherwise, if this Variable name has not already been seen in the Term, then we put a new Prolog variable and add it into the Map (keyed by this Variable name).
196 *
197 * @param varnames_to_vars
198 * A Map from variable names to Prolog variables.
199 * @param term
200 * A (previously created) term_t which is to be set to a (new or reused) Prolog variable.
201 */
202 protected final void put(Map<String, term_t> varnames_to_vars, term_t term) {
203 term_t var;
204 // if this var is anonymous or as yet unseen, put a new Prolog variable
205 if (this.name.equals("_") || (var = (term_t) varnames_to_vars.get(this.name)) == null) {
206 this.term_ = term;
207 this.index = varnames_to_vars.size(); // i.e. first var in is #0 etc.
208 Prolog.put_variable(term);
209 if (!this.name.equals("_")) {
210 varnames_to_vars.put(this.name, term);
211 }
212 } else {
213 this.term_ = var;
214 Prolog.put_term(term, var);
215 }
216 }
217
218 /**
219 * If this Variable instance is not an anonymous or (in dont-tell-me mode) a dont-tell-me variable, and its binding is not already in the varnames_to_Terms Map, put the result of converting the
220 * term_t to which this variable has been unified to a Term in the Map, keyed on this Variable's name.
221 *
222 * @param varnames_to_Terms
223 * A Map of bindings from variable names to JPL Terms.
224 * @param vars_to_Vars
225 * A Map from Prolog variables to JPL Variables.
226 */
227 protected final void getSubst(Map<String, Term> varnames_to_Terms, Map<term_t, Variable> vars_to_Vars) {
228 // NB a Variable.name cannot be "" i.e. of 0 length
229 // if (!(this.name.charAt(0) == '_') && varnames_to_Terms.get(this.name) == null) {
230 if (tellThem() && varnames_to_Terms.get(this.name) == null) {
231 varnames_to_Terms.put(this.name, Term.getTerm(vars_to_Vars, this.term_));
232 }
233 }
234
235 // whether, according to prevailing policy and this Variable's name,
236 // any binding should be returned
237 // (yes, unless it's anonymous or we're in dont-tell-me mode and its a dont-tell-me variable)
238 private final boolean tellThem() {
239 return !(this.name.equals("_") || jpl.JPL.modeDontTellMe && this.name.charAt(0) == '_');
240 }
241 }
+0
-9
packages/jpl/src/java/jpl/Version.java less more
0 // $Id$
1 package jpl;
2
3 class Version {
4 public final int major = 7;
5 public final int minor = 0;
6 public final int patch = 0;
7 public final String status = "alpha";
8 }
+0
-1
packages/jpl/src/java/jpl/fli/.cvsignore less more
0 *.class
+0
-25
packages/jpl/src/java/jpl/fli/BooleanHolder.java less more
0 package jpl.fli;
1
2 /**
3 * A BooleanHolder is merely a Holder class for a boolean value.
4 *
5 * <hr>
6 * <i> Copyright (C) 1998 Fred Dushin
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Fred Dushin <fadushin@syr.edu>
20 * @version $Revision$
21 */
22 public class BooleanHolder {
23 public boolean value;
24 }
+0
-25
packages/jpl/src/java/jpl/fli/DoubleHolder.java less more
0 package jpl.fli;
1
2 /**
3 * A DoubleHolder is merely a Holder class for a double value.
4 *
5 * <hr>
6 * <i> Copyright (C) 1998 Fred Dushin
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Fred Dushin <fadushin@syr.edu>
20 * @version $Revision$
21 */
22 public class DoubleHolder {
23 public double value;
24 }
+0
-25
packages/jpl/src/java/jpl/fli/Int64Holder.java less more
0 package jpl.fli;
1
2 /**
3 * An Int64Holder is merely a Holder class for an int64 value.
4 *
5 * <hr>
6 * <i> Copyright (C) 2005 Paul Singleton
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Paul Singleton <paul@jbgb.com>
20 * @version $Revision$
21 */
22 public class Int64Holder {
23 public long value;
24 }
+0
-25
packages/jpl/src/java/jpl/fli/IntHolder.java less more
0 package jpl.fli;
1
2 /**
3 * An IntHolder is merely a Holder class for an Int value.
4 *
5 * <hr>
6 * <i> Copyright (C) 1998 Fred Dushin
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Fred Dushin <fadushin@syr.edu>
20 * @version $Revision$
21 */
22 public class IntHolder {
23 public int value;
24 }
+0
-29
packages/jpl/src/java/jpl/fli/LongHolder.java less more
0 package jpl.fli;
1
2 /**
3 * A Long Holder merely holds a long value.
4 *
5 * <hr>
6 * <i> Copyright (C) 1998 Fred Dushin
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Fred Dushin <fadushin@syr.edu>
20 * @version $Revision$
21 */
22 public class LongHolder {
23 public long value = 0L;
24
25 public boolean equals(LongHolder lh) {
26 return lh.value == this.value;
27 }
28 }
+0
-25
packages/jpl/src/java/jpl/fli/ObjectHolder.java less more
0 package jpl.fli;
1
2 /**
3 * A ObjectHolder is merely a Holder class for an Object reference (or null).
4 *
5 * <hr>
6 * <i> Copyright (C) 1998 Fred Dushin
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Fred Dushin <fadushin@syr.edu>
20 * @version $Revision$
21 */
22 public class ObjectHolder {
23 public Object value;
24 }
+0
-29
packages/jpl/src/java/jpl/fli/PointerHolder.java less more
0 package jpl.fli;
1
2 /**
3 * A PointerHolder is a trivial extension of a LongHolder. This is sort of a no-no in Java, as the long value stored herein is sometimes a machine address. (Don't tell Sun.)
4 *
5 * <hr>
6 * <i> Copyright (C) 1998 Fred Dushin
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Fred Dushin <fadushin@syr.edu>
20 * @version $Revision$
21 */
22 // Implementation notes:
23 // There could be issues in the future with signedness, since Java
24 // does not have an unsigned type; make sure not to do any arithmetic
25 // with the stored value.
26 // ----------------------------------------------------------------------/
27 public class PointerHolder extends LongHolder {
28 }
+0
-205
packages/jpl/src/java/jpl/fli/Prolog.java less more
0 package jpl.fli;
1
2 import jpl.JPL;
3
4 /**
5 * This class consists only of constants (static finals) and static native methods. The constants and methods defined herein are in (almost) strict 1-1 correspondence with the functions in the Prolog
6 * FLI by the same name (except without the PL_, SQ_, etc. prefixes).
7 * <p>
8 *
9 * See the file jpl.c for the native (ANSI C) implementations of these methods. Refer to your local Prolog FLI documentations for the meanings of these methods, and observe the following:
10 * <p>
11 *
12 * <menu>
13 * <li>The types and signatures of the following methods are almost in 1-1 correspondence with the Prolog FLI. The Prolog types term_t, atom_t, functor_t, etc. are mirrored in this package with
14 * classes by the same name, making the C and Java uses of these interfaces similar.</li>
15 * <li>As term_t, functor_t, etc. types are Java classes, they are passed to these methods <b>by value</b>; however, calling these methods on such class instances does have side effects. In general,
16 * the value fields of these instances will be modified, in much the same way the term_t, functor_t, etc. Prolog instances would be modified.</li>
17 * <li>The exceptions to this rule occur when maintaining the same signature would be impossible, e.g., when the Prolog FLI functions require <i>pointers</i>; in this case, the signatures have been
18 * modified to take *Holder classes (Int, Double, String, etc.), to indicate a call by reference parameter.
19 * <li>Functions which take variable-length argument lists in C take arrays in Java; from Java 1.1 onwards, anonymous arrays can be used e.g. Term[] { new Atom("a"), new Atom ("b") } </menu>
20 *
21 * <hr>
22 * <i> Copyright (C) 1998 Fred Dushin
23 * <p>
24 *
25 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
26 * License, or (at your option) any later version.
27 * <p>
28 *
29 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 * Library Public License for more details.
31 * <p>
32 * </i>
33 * <hr>
34 *
35 * @author Fred Dushin <fadushin@syr.edu>
36 * @version $Revision$
37 */
38 public final class Prolog {
39 static {
40 JPL.loadNativeLibrary();
41 }
42
43 /* term types */
44 public static final int VARIABLE = 1; // PL_VARIABLE
45 public static final int ATOM = 2; // PL_ATOM
46 public static final int INTEGER = 3; // PL_INTEGER
47 public static final int FLOAT = 4; // PL_FLOAT
48 public static final int STRING = 5; // PL_STRING
49 public static final int COMPOUND = 6; // PL_TERM
50
51 public static final int LIST_NIL = 7; // PL_NIL
52 public static final int LIST_PAIR = 9; // PL_LIST_PAIR
53 public static final int BLOB = 8; // PL_BLOB
54 public static final int DICT = 44; // PL_DICT
55
56 public static final int JBOOLEAN = 101;
57 public static final int JREF = 102;
58 public static final int JVOID = 103;
59
60 /**
61 * @deprecated use Prolog.COMPOUND
62 */
63 public static final int TERM = 6;
64
65 public static final int succeed = 1;
66 public static final int fail = 0;
67
68 /* query flags */
69 public static final int Q_NORMAL = 0x02;
70 public static final int Q_NODEBUG = 0x04;
71 public static final int Q_CATCH_EXCEPTION = 0x08;
72 public static final int Q_PASS_EXCEPTION = 0x10;
73
74 /* conversion flags */
75 public static final int CVT_ATOM = 0x0001;
76 public static final int CVT_STRING = 0x0002;
77 public static final int CVT_LIST = 0x0004;
78 public static final int CVT_INTEGER = 0x0008;
79 public static final int CVT_FLOAT = 0x0010;
80 public static final int CVT_VARIABLE = 0x0020;
81 public static final int CVT_NUMBER = (CVT_INTEGER | CVT_FLOAT);
82 public static final int CVT_ATOMIC = (CVT_NUMBER | CVT_ATOM | CVT_STRING);
83 public static final int CVT_ALL = 0x00ff;
84 public static final int BUF_DISCARDABLE = 0x0000;
85 public static final int BUF_RING = 0x0100;
86 public static final int BUF_MALLOC = 0x0200;
87
88 /* syntax flavours */
89 public static final int SYNTAX_TRADITIONAL = 202;
90 public static final int SYNTAX_MODERN = 203;
91
92 /* new, for revised term_t-to-Variable stuff */
93 public static native int compare(term_t t1, term_t t2); // returns -1, 0 or 1
94
95 /* Creating and destroying term-refs */
96 public static native term_t new_term_ref();
97
98 public static native term_t new_term_refs(int n);
99
100 public static native term_t copy_term_ref(term_t from); // NOT USED
101
102 /* Constants */
103 public static native atom_t new_atom(String s);
104
105 public static native String atom_chars(atom_t a);
106
107 public static native functor_t new_functor(atom_t f, int a);
108
109 public static native void unregister_atom(atom_t a); // called from atom_t's finalize()
110
111 /* Get Java-values from Prolog terms */
112 public static native boolean get_atom_chars(term_t t, StringHolder a);
113
114 public static native boolean get_string_chars(term_t t, StringHolder s);
115
116 public static native boolean get_integer(term_t t, Int64Holder i);
117
118 public static native boolean get_float(term_t t, DoubleHolder d);
119
120 public static native boolean get_name_arity(term_t t, StringHolder name, IntHolder arity);
121
122 public static native boolean get_arg(int index, term_t t, term_t a);
123
124 public static native String object_to_tag(Object obj);
125
126 public static native Object tag_to_object(String tag); // 29/May/2008
127
128 public static native boolean is_tag(String tag); // 30/May/2008
129
130 /* Verify types */
131 public static native int term_type(term_t t);
132
133 /* Assign to term-references */
134 public static native void put_variable(term_t t);
135
136 public static native void put_integer(term_t t, long i);
137
138 public static native void put_float(term_t t, double f);
139
140 public static native void put_term(term_t t1, term_t t2);
141
142 public static native void put_jref(term_t t, Object ref);
143
144 public static native void put_atom_chars(term_t t, String name);
145
146 public static native void put_nil(term_t t);
147
148 /* ... */
149 public static native void cons_functor_v(term_t h, functor_t fd, term_t a0);
150
151 // predicates:
152 public static native predicate_t predicate(String name, int arity, String module);
153
154 // querying (general):
155 public static native qid_t open_query(module_t m, int flags, predicate_t pred, term_t t0);
156
157 public static native boolean next_solution(qid_t qid);
158
159 public static native void close_query(qid_t qid);
160
161 // modules:
162 public static native module_t new_module(atom_t name);
163
164 // exceptions:
165 public static native term_t exception(qid_t qid);
166
167 // initialisation:
168 public static native String[] get_default_init_args();
169
170 public static native boolean set_default_init_args(String argv[]);
171
172 public static native boolean initialise();
173
174 public static native String[] get_actual_init_args();
175
176 public static native void halt(int status);
177
178 // thread & engine management:
179 public static native int thread_self();
180
181 public static native engine_t attach_pool_engine();
182
183 public static native int release_pool_engine();
184
185 public static native engine_t current_engine();
186
187 public static native boolean current_engine_is_pool();
188
189 public static native int attach_engine(engine_t e);
190
191 // misc.
192 public static native String get_c_lib_version();
193
194 // not yet working:
195 public static native int action_abort();
196
197 // revived 17/Jun/2008:
198 public static native fid_t open_foreign_frame();
199
200 public static native void discard_foreign_frame(fid_t cid);
201
202 // syntax enquiry:
203 public static native int get_syntax();
204 }
+0
-25
packages/jpl/src/java/jpl/fli/StringHolder.java less more
0 package jpl.fli;
1
2 /**
3 * A StringHolder is merely a Holder class for a String value.
4 *
5 * <hr>
6 * <i> Copyright (C) 1998 Fred Dushin
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Fred Dushin <fadushin@syr.edu>
20 * @version $Revision$
21 */
22 public class StringHolder {
23 public String value;
24 }
+0
-37
packages/jpl/src/java/jpl/fli/atom_t.java less more
0 package jpl.fli;
1
2 /**
3 * An atom_t is a specialised LongHolder which decrements its atom's reference count when garbage-collected (finalized).
4 *
5 * <hr>
6 * <i> Copyright (C) 1998 Fred Dushin
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Fred Dushin <fadushin@syr.edu>
20 * @version $Revision$
21 */
22 public class atom_t extends LongHolder {
23 /**
24 * The String representation of an atom_t is just the atom's name.
25 *
26 * @return atom's name
27 */
28 public String toString() {
29 return Prolog.atom_chars(this);
30 }
31
32 protected void finalize() throws Throwable {
33 super.finalize();
34 Prolog.unregister_atom(this);
35 }
36 }
+0
-24
packages/jpl/src/java/jpl/fli/engine_t.java less more
0 package jpl.fli;
1
2 /**
3 * A engine_t holds a reference to a Prolog engine.
4 *
5 * <hr>
6 * <i> Copyright (C) 1998 Fred Dushin
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Fred Dushin <fadushin@syr.edu>
20 * @version $Revision$
21 */
22 public class engine_t extends LongHolder {
23 }
+0
-24
packages/jpl/src/java/jpl/fli/fid_t.java less more
0 package jpl.fli;
1
2 /**
3 * An fid_t holds the value of a frame id in the Prolog Engine.
4 *
5 * <hr>
6 * <i> Copyright (C) 1998 Fred Dushin
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Fred Dushin <fadushin@syr.edu>
20 * @version $Revision$
21 */
22 public class fid_t extends LongHolder {
23 }
+0
-24
packages/jpl/src/java/jpl/fli/functor_t.java less more
0 package jpl.fli;
1
2 /**
3 * A functor_t holds a reference to a Prolog functor_t in the Prolog engine.
4 *
5 * <hr>
6 * <i> Copyright (C) 1998 Fred Dushin
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Fred Dushin <fadushin@syr.edu>
20 * @version $Revision$
21 */
22 public class functor_t extends LongHolder {
23 }
+0
-24
packages/jpl/src/java/jpl/fli/module_t.java less more
0 package jpl.fli;
1
2 /**
3 * A module_t is a PointerHolder type which holds a reference to a Prolog module_t reference.
4 *
5 * <hr>
6 * <i> Copyright (C) 1998 Fred Dushin
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Fred Dushin <fadushin@syr.edu>
20 * @version $Revision$
21 */
22 public class module_t extends PointerHolder {
23 }
+0
-24
packages/jpl/src/java/jpl/fli/predicate_t.java less more
0 package jpl.fli;
1
2 /**
3 * A predicate_t is a PointerHolder class whose value is a reference to a Prolog predicate_t.
4 *
5 * <hr>
6 * <i> Copyright (C) 1998 Fred Dushin
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Fred Dushin <fadushin@syr.edu>
20 * @version $Revision$
21 */
22 public class predicate_t extends PointerHolder {
23 }
+0
-24
packages/jpl/src/java/jpl/fli/qid_t.java less more
0 package jpl.fli;
1
2 /**
3 * A qid_t holds a reference to a Prolog qid_t.
4 *
5 * <hr>
6 * <i> Copyright (C) 1998 Fred Dushin
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Fred Dushin <fadushin@syr.edu>
20 * @version $Revision$
21 */
22 public class qid_t extends LongHolder {
23 }
+0
-68
packages/jpl/src/java/jpl/fli/term_t.java less more
0 package jpl.fli;
1
2 /**
3 * A term_t is a simple class which mirrors the term_t type in the Prolog FLI. All it really does is hold a term reference, which is an internal representation of a term in the Prolog Engine.
4 *
5 * <hr>
6 * <i> Copyright (C) 1998 Fred Dushin
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Fred Dushin <fadushin@syr.edu>
20 * @version $Revision$
21 */
22 public class term_t extends LongHolder {
23 public static final long UNASSIGNED = -1L;
24
25 public term_t() {
26 value = UNASSIGNED;
27 }
28
29 /**
30 * This static method converts a term_t, which is assumed to contain a reference to a *consecutive* list of term_t references to a String representation of a list of terms, in this case, a comma
31 * separated list.
32 *
33 * @param n
34 * the number of consecutive term_ts
35 * @param term0
36 * a term_t whose value is the 0th term_t.
37 */
38 public static String toString(int n, term_t term0) {
39 String s = "";
40 int i;
41 long ith_term_t;
42 for (i = 0, ith_term_t = term0.value; i < n; ++i, ++ith_term_t) {
43 term_t term = new term_t();
44 term.value = ith_term_t;
45 s += term.toString();
46 if (i != n - 1) {
47 s += ", ";
48 }
49 }
50 return s;
51 }
52
53 /**
54 * Instances of term_ts are stored in Term objects (see jpl.Term), and these term_ts are in some cases stored in Hashtables. Supplying this predicate provides the right behavior in Hashtable
55 * lookup (see the rules for Hashtable lookup in java.util).
56 * <p>
57 *
58 * Note. Two term_ts are *not* equal if their values have not been assigned. (Since Prolog FLI term_ts are unsigned values and the UNASSIGNED value is -1, this should work).
59 *
60 * @param obj
61 * the Object to comapre.
62 * @return true if the supplied object is a term_t instances and the long values are the same
63 */
64 public boolean equals(Object obj) {
65 return (obj instanceof term_t) && this.value == ((term_t) obj).value && this.value != UNASSIGNED;
66 }
67 }
+0
-1
packages/jpl/src/java/jpl/test/.cvsignore less more
0 *.class
+0
-84
packages/jpl/src/java/jpl/test/CelsiusConverter.java less more
0 package jpl.test;
1
2 /**
3 * CelsiusConverter.java is a 1.4 application that
4 * demonstrates the use of JButton, JTextField and
5 * JLabel. It requires no other files.
6 */
7 import java.awt.*;
8 import java.awt.event.*;
9 import javax.swing.*;
10
11 public class CelsiusConverter implements ActionListener {
12 JFrame converterFrame;
13 JPanel converterPanel;
14 JTextField tempCelsius;
15 JLabel celsiusLabel, fahrenheitLabel;
16 JButton convertTemp;
17
18 public CelsiusConverter() { // initially locate the window at top-left of desktop
19 this(0, 0);
20 }
21
22 public CelsiusConverter(int left, int top) { // initially locate the window at top-left of desktop
23 // create and set up the window
24 converterFrame = new JFrame("Convert Celsius to Fahrenheit");
25 converterFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
26 converterFrame.setSize(new Dimension(120, 40));
27 converterFrame.setLocation(left, top);
28 // create and set up the panel
29 converterPanel = new JPanel(new GridLayout(2, 2));
30 // create widgets
31 tempCelsius = new JTextField(2);
32 celsiusLabel = new JLabel("Celsius", SwingConstants.LEFT);
33 celsiusLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
34 //
35 convertTemp = new JButton("Convert");
36 fahrenheitLabel = new JLabel("Fahrenheit", SwingConstants.LEFT);
37 // listen to events from the Convert button
38 convertTemp.addActionListener(this);
39 // add the widgets to the container
40 converterPanel.add(tempCelsius);
41 converterPanel.add(celsiusLabel);
42 converterPanel.add(convertTemp);
43 converterPanel.add(fahrenheitLabel);
44 fahrenheitLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
45 converterFrame.getRootPane().setDefaultButton(convertTemp); // make "convert" the window's default button
46 // add the panel to the window
47 converterFrame.getContentPane().add(converterPanel, BorderLayout.CENTER);
48 // display the window
49 converterFrame.pack();
50 converterFrame.setVisible(true);
51 }
52
53 public void actionPerformed(ActionEvent event) {
54 // parse degrees Celsius as a double
55 double tC = (Double.parseDouble(tempCelsius.getText()));
56 //
57 // convert to Fahrenheit (in Java)
58 // int tempFahr = (int) (tC * 1.8 + 32);
59 //
60 // convert to Fahrenheit (in Prolog, via JPL)
61 int tempFahr = ((jpl.Float) jpl.Query.oneSolution("TF is ? * 1.8 + 32", new jpl.Term[] { new jpl.Float(tC) }).get("TF")).intValue();
62 //
63 // display the result
64 fahrenheitLabel.setText(tempFahr + " Fahrenheit");
65 }
66
67 public static void spawnGUI(final int left, final int top) {
68 // schedule a job for the event-dispatching thread: create and show an instance of this application at (left,top)
69 javax.swing.SwingUtilities.invokeLater(new Runnable() {
70 int x = left;
71 int y = top;
72
73 public void run() {
74 new CelsiusConverter(x, y); // can we be sure this won't be garbage collected?
75 }
76 });
77 }
78
79 public static void main(String[] args) {
80 // just for fun, we ask Prolog to start five instances of this class (at stepped offsets from top-left of display)
81 jpl.Query.allSolutions("between(1, 5, N), X is 10*N, Y is 20*N, jpl_call('jpl.test.CelsiusConverter', spawnGUI, [X,Y], _)");
82 }
83 }
+0
-94
packages/jpl/src/java/jpl/test/Family.java less more
0 package jpl.test;
1
2 import jpl.Atom;
3 import jpl.Query;
4 import jpl.Term;
5 import jpl.Variable;
6
7 public class Family extends Thread {
8
9 int id; // client thread id
10 private static final int delay = 0;
11
12 Family(int i) {
13 this.id = i;
14 }
15
16 public static void main(String argv[]) {
17 Query q1 = new Query("consult", new Term[] { new Atom("jpl/test/family.pl") });
18 System.err.println("consult " + (q1.hasSolution() ? "succeeded" : "failed"));
19 for (int i = 0; i < 20; i++) {
20 System.out.println("spawning client[" + i + "]");
21 new Family(i).start();
22 }
23 }
24
25 public void run() {
26 java.util.Hashtable<String, Term> solution;
27 Variable X = new Variable("X");
28
29 // --------------------------------------------------
30
31 Query q2 = new Query("child_of", new Term[] { new Atom("joe"), new Atom("ralf") });
32
33 System.err.println("child_of(joe,ralf) is " + (q2.hasSolution() ? "provable" : "not provable"));
34
35 new Query("sleep", new Term[] { new jpl.Integer(delay) }).hasSolution();
36
37 // --------------------------------------------------
38
39 Query q3 = new Query("descendent_of", new Term[] { new Atom("steve"), new Atom("ralf") });
40
41 System.err.println("descendent_of(steve,ralf) is " + (q3.hasSolution() ? "provable" : "not provable"));
42
43 new Query("sleep", new Term[] { new jpl.Integer(delay) }).hasSolution();
44
45 // --------------------------------------------------
46
47 Query q4 = new Query("descendent_of", new Term[] { X, new Atom("ralf") });
48
49 solution = q4.oneSolution();
50
51 System.err.println("first solution of descendent_of(X, ralf)");
52 System.err.println("X = " + solution.get(X.name));
53
54 new Query("sleep", new Term[] { new jpl.Integer(delay) }).hasSolution();
55
56 // --------------------------------------------------
57
58 java.util.Hashtable<String, Term>[] solutions = q4.allSolutions();
59
60 System.err.println("all solutions of descendent_of(X, ralf)");
61 for (int i = 0; i < solutions.length; i++) {
62 System.err.println("X = " + solutions[i].get(X.name));
63 }
64
65 new Query("sleep", new Term[] { new jpl.Integer(delay) }).hasSolution();
66
67 // --------------------------------------------------
68
69 System.err.println("each solution of descendent_of(X, ralf)");
70 while (q4.hasMoreSolutions()) {
71 solution = q4.nextSolution();
72 System.err.println("X = " + solution.get(X.name));
73 }
74
75 new Query("sleep", new Term[] { new jpl.Integer(delay) }).hasSolution();
76
77 // --------------------------------------------------
78
79 Variable Y = new Variable("Y");
80
81 Query q5 = new Query("descendent_of", new Term[] { X, Y });
82
83 System.err.println(id + ": each solution of descendent_of(X, Y)");
84 while (q5.hasMoreSolutions()) {
85 solution = q5.nextSolution();
86 System.err.println(id + ": X = " + solution.get(X.name) + ", Y = " + solution.get(Y.name));
87
88 new Query("sleep", new Term[] { new jpl.Integer(delay) }).hasSolution();
89 }
90
91 }
92
93 }
+0
-18
packages/jpl/src/java/jpl/test/FetchBigTree.java less more
0 package jpl.test;
1
2 import jpl.Query;
3 import jpl.Term;
4
5 public class FetchBigTree {
6 public static void main(String[] args) {
7 // Prolog.set_default_init_args(new String[] { "libpl.dll", "-f", "D:/pcm/bin/pcm.ini", "-g", "pcm_2000" });
8 (new Query("consult('jpl/test/test.pl')")).oneSolution();
9 Term t = (Term) ((new Query("p(18,T)")).oneSolution().get("T"));
10 int i = 1;
11 while (t.hasFunctor("a", 2)) {
12 t = t.arg(2);
13 i = i + 1;
14 }
15 System.err.println("got a tree of " + i + " generations");
16 }
17 }
+0
-17
packages/jpl/src/java/jpl/test/FetchLongList.java less more
0 package jpl.test;
1
2 import jpl.Query;
3 import jpl.Term;
4
5 public class FetchLongList {
6 public static void main(String[] args) {
7 // Prolog.set_default_init_args(new String[] { "libpl.dll", "-f", "D:/pcm/bin/pcm.ini", "-g", "pcm_2000" });
8 Term t = (Term) ((new Query("findall(foo(N,bar),between(1,2308,N),L)")).oneSolution().get("L"));
9 int i = 0;
10 while (t.hasFunctor(".", 2)) {
11 t = t.arg(2);
12 i = i + 1;
13 }
14 System.err.println("got a list of " + i + " members");
15 }
16 }
+0
-23
packages/jpl/src/java/jpl/test/Ga.java less more
0 package jpl.test;
1
2 import jpl.Query;
3
4 public class Ga {
5 public static void main(String argv[]) {
6 // Prolog.set_default_init_args(new String[] { "libpl.dll", "-f", "D:/pcm/bin/pcm.ini", "-g", "pcm_2000" });
7 // (new Query("loadall(jpl_test:jr)")).hasSolution();
8 // System.err.println("jr " + ((new Query("jr")).hasSolution() ? "succeeded" : "failed"));
9 // System.err.println( "something " + (new Query("statistics(atoms,X)")).oneSolution().get("X"));
10 // Query.hasSolution("statistics");
11 // (new Query("x")).hasSolution();
12 // (new Query("statistics,x")).hasSolution();
13 // (new Query(new Atom("statistics"))).hasSolution();
14 // Query.hasSolution("write(hello),nl");
15 // Query.hasSolution("write(hello),nl");
16
17 // (new Query("nl")).hasSolution();
18 (new Query("nl,nl")).hasSolution();
19
20 // (new Query("user:nl")).hasSolution();
21 }
22 }
+0
-10
packages/jpl/src/java/jpl/test/Ga2.java less more
0 package jpl.test;
1
2 import jpl.Query;
3
4 public class Ga2 {
5 public static void main(String argv[]) {
6 // Prolog.set_default_init_args(new String[] { "libpl.dll", "-f", "D:/pcm/bin/pcm.ini", "-g", "pcm_2000" });
7 (new Query("current_prolog_flag(K,V),write(K-V),nl,fail")).oneSolution();
8 }
9 }
+0
-21
packages/jpl/src/java/jpl/test/Garbo.java less more
0 package jpl.test;
1
2 public class Garbo {
3 public static int created = 0;
4 public static int destroyed = 0;
5 //
6 public final int i;
7
8 public Garbo() {
9 this.i = created++;
10 }
11
12 protected void finalize() throws Throwable {
13 try {
14 destroyed++;
15 // System.out.println("gced["+i+"]");
16 } finally {
17 super.finalize();
18 }
19 }
20 }
+0
-91
packages/jpl/src/java/jpl/test/JPLTest.java less more
0 /*
1 * JPLTest.java
2 * JUnit based test
3 *
4 * Created on 13 February 2006, 11:31
5 */
6 package jpl.test;
7
8 import java.util.concurrent.CountDownLatch;
9 import java.util.concurrent.TimeUnit;
10
11 import jpl.Query;
12 import junit.framework.TestCase;
13
14 /**
15 *
16 * @author rick
17 */
18 public class JPLTest extends TestCase {
19 // private static final Logger logger = Logger.getLogger(JPLTest.class.getName());
20 private CountDownLatch latch;
21
22 public JPLTest(String testName) {
23 super(testName);
24 }
25
26 protected void setUp() throws Exception {
27 /*
28 * Prolog file can be an empty file. The JVM seems to crash with a SIGSEGV if you don't consult a file prior to interacting with JPL.
29 *
30 * final String prologFile = "jpl/test/test.pl"; // was "/home/rick/temp/test.pl"; System.out.println("prolog file is: " + prologFile); String qString = "consult('" + prologFile + "')";
31 * System.out.println("about to: " + qString); Query query = new Query(qString); System.out.println("Generated Query: " + query); if (!query.hasSolution()) { System.out.println(qString +
32 * " failed"); fail("Failed to consult prolog file."); }
33 *
34 * (new Query("true")).hasSolution();
35 */
36 }
37
38 public void testThreadedAdds() {
39 latch = new CountDownLatch(4);
40 final AddWithThreads[] addTasks = { new AddWithThreads("a", latch), new AddWithThreads("b", latch), new AddWithThreads("c", latch), new AddWithThreads("d", latch) };
41 // System.out.println("Starting threads...");
42 for (int i = 0; i < addTasks.length; i++) {
43 addTasks[i].start();
44 }
45 try {
46 // System.out.println("Latch is waiting");
47 assertTrue("Timed out waiting for action to execute", latch.await(20, TimeUnit.SECONDS));
48 // System.out.println("Latch has been flipped");
49 } catch (final InterruptedException e) {
50 fail("Waiting thread was interrupted: " + e);
51 }
52 for (int i = 0; i < AddWithThreads.REPS; i++) {
53 for (int j = 0; j < addTasks.length; j++) {
54 Query query = new Query(addTasks[j].getNamespace() + "(test('" + i + "'))");
55 // System.out.println("query: " + query);
56 // boolean ret = query.hasMoreElements();
57 query.close();
58 }
59 }
60 }
61 }
62
63 class AddWithThreads extends Thread {
64 private final CountDownLatch latch;
65 private final String namespace;
66 // private static final Logger logger = Logger.getLogger(JPLTest.class.getName());
67 public static final int REPS = 2000; // was 200
68
69 public AddWithThreads(final String namespace, final CountDownLatch latch) {
70 this.latch = latch;
71 this.namespace = namespace;
72 setName("namespace" + namespace); // set thread name for debugging
73 }
74
75 public String getNamespace() {
76 return namespace;
77 }
78
79 public void run() {
80 for (int i = 0; i < REPS; i++) {
81 // System.out.println("Asserting test('" + i + "')");
82 Query queryA = new Query("assert(" + namespace + "(test('" + i + "')))");
83 Thread.yield();
84 // System.out.println("adding query: " + queryA);
85 // boolean retA = queryA.hasMoreElements();
86 queryA.close();
87 }
88 latch.countDown();
89 }
90 }
+0
-43
packages/jpl/src/java/jpl/test/Masstest.java less more
0 package jpl.test;
1
2 import jpl.Query;
3
4 public class Masstest extends Thread {
5 public static void main(String[] args) {
6 // String[] dia = Prolog.get_default_init_args();
7 // String s = "default init args: ";
8 // for (int i = 0; i < dia.length; i++) {
9 // s += " " + dia[i];
10 // }
11 // System.out.println(s);
12 //
13 // Prolog.set_default_init_args(new String[] { "libpl.dll", "-f", "none", "-g", "true", "-q" });
14 // empirically, needs this at least:
15 // Prolog.set_default_init_args(new String[] { "libpl.dll" });
16 // Prolog.set_default_init_args(new String[] { "pl" });
17 //
18 // (new Query("assert(diagnose_declaration(_,_,_,[not,a,real,error]))")).hasSolution();
19 //
20 int STUDENTSNUMBER = 5;
21 Masstest[] threads = new Masstest[STUDENTSNUMBER];
22 for (int i = 0; i < STUDENTSNUMBER; i++) {
23 threads[i] = new Masstest();
24 threads[i].start();
25 }
26 }
27
28 public void predQuery() {
29 String st = "diagnose_declaration(1,[(sp, 'prefix', [('arg1', '+', 'list', 'Liste1'), ('arg2', '+', 'list', 'Liste2')])], DecMap, ErrorList)";
30 Query stQuery = new Query(st);
31 String errString = stQuery.oneSolution().get("ErrorList").toString();
32 System.out.println("errString=" + errString);
33 }
34
35 public void run() {
36 try {
37 predQuery();
38 } catch (Exception e) {
39 System.err.println("ERROR: " + e);
40 }
41 }
42 }
+0
-4
packages/jpl/src/java/jpl/test/MaxObjects.java less more
0 package jpl.test;
1
2 public class MaxObjects {
3 }
+0
-12
packages/jpl/src/java/jpl/test/ShadowA.java less more
0 /*
1 * Created on 22-Nov-2004
2 *
3 * TODO To change the template for this generated file go to
4 * Window - Preferences - Java - Code Style - Code Templates
5 */
6 package jpl.test;
7
8 public class ShadowA {
9 public int shadow = -1;
10 public static int fieldStaticInt;
11 }
+0
-17
packages/jpl/src/java/jpl/test/ShadowB.java less more
0 /*
1 * Created on 22-Nov-2004
2 *
3 * TODO To change the template for this generated file go to
4 * Window - Preferences - Java - Code Style - Code Templates
5 */
6 package jpl.test;
7
8 public class ShadowB extends ShadowA {
9 public String shadow;
10
11 public ShadowB(String s) {
12 shadow = s;
13 }
14
15 public static int fieldStaticInt;
16 }
+0
-10
packages/jpl/src/java/jpl/test/SyntaxError.java less more
0 package jpl.test;
1
2 import jpl.Query;
3
4 public class SyntaxError {
5 public static void main(String argv[]) {
6 Query q = new Query("syntax)error");
7 System.err.println(q.hasSolution() ? "yes" : "no");
8 }
9 }
+0
-325
packages/jpl/src/java/jpl/test/Test.java less more
0 package jpl.test;
1
2 import jpl.Compound;
3 import jpl.Query;
4 import jpl.Term;
5
6 // This class contains members which support those tests which are performed from Prolog.
7 // See also TestJUnit
8 public class Test {
9 public Test() {
10 }
11
12 public Test(Term t) {
13 this.termFromConstructor = t;
14 }
15
16 public Term termFromConstructor;
17 //
18 public static boolean fieldStaticBoolean;
19 public static final boolean fieldStaticBoolean1 = false;
20 public static final boolean fieldStaticBoolean2 = true;
21 //
22 public static char fieldStaticChar;
23 public static final char fieldStaticChar1 = '\u0000';
24 public static final char fieldStaticChar2 = '\uFFFF';
25 //
26 public static byte fieldStaticByte;
27 public static final byte fieldStaticByte1 = -(1 << 7);
28 public static final byte fieldStaticByte2 = -1;
29 public static final byte fieldStaticByte3 = 0;
30 public static final byte fieldStaticByte4 = 1;
31 public static final byte fieldStaticByte5 = (1 << 7) - 1;
32 //
33 public static short fieldStaticShort;
34 public static final short fieldStaticShort1 = -(1 << 15);
35 public static final short fieldStaticShort2 = -(1 << 7);
36 public static final short fieldStaticShort3 = -1;
37 public static final short fieldStaticShort4 = 0;
38 public static final short fieldStaticShort5 = 1;
39 public static final short fieldStaticShort6 = (1 << 7) - 1;
40 public static final short fieldStaticShort7 = (1 << 15) - 1;
41 //
42 public static int fieldStaticInt;
43 public static final int fieldStaticInt1 = -(1 << 31);
44 public static final int fieldStaticInt2 = -(1 << 15);
45 public static final int fieldStaticInt3 = -(1 << 7);
46 public static final int fieldStaticInt4 = -1;
47 public static final int fieldStaticInt5 = 0;
48 public static final int fieldStaticInt6 = 1;
49 public static final int fieldStaticInt7 = (1 << 7) - 1;
50 public static final int fieldStaticInt8 = (1 << 15) - 1;
51 public static final int fieldStaticInt9 = (1 << 31) - 1;
52 //
53 public static long fieldStaticLong;
54 public static final long fieldStaticLong1 = -(1 << 63);
55 public static final long fieldStaticLong2 = -(1 << 31);
56 public static final long fieldStaticLong3 = -(1 << 15);
57 public static final long fieldStaticLong4 = -(1 << 7);
58 public static final long fieldStaticLong5 = -1;
59 public static final long fieldStaticLong6 = 0;
60 public static final long fieldStaticLong7 = 1;
61 public static final long fieldStaticLong8 = (1 << 7) - 1;
62 public static final long fieldStaticLong9 = (1 << 15) - 1;
63 public static final long fieldStaticLong10 = (1 << 31) - 1;
64 public static final long fieldStaticLong11 = (1 << 63) - 1;
65 //
66 public static float fieldStaticFloat;
67 public static final float fieldStaticFloat1 = 12345.6789F;
68 public static final float fieldStaticFloat2 = 3.4e+38F; // nearly MAX_VALUE
69 public static final float fieldStaticFloat3 = 1.4e-45F; // nearly MIN_VALUE
70 public static final float fieldStaticFloat4 = 0.0F;
71 public static final float fieldStaticFloat5 = java.lang.Float.MIN_VALUE;
72 public static final float fieldStaticFloat6 = java.lang.Float.MAX_VALUE;
73 public static final float fieldStaticFloat7 = java.lang.Float.NEGATIVE_INFINITY;
74 public static final float fieldStaticFloat8 = java.lang.Float.POSITIVE_INFINITY;
75 public static final float fieldStaticFloat9 = java.lang.Float.NaN;
76 //
77 public static double fieldStaticDouble;
78 public static final double fieldStaticDouble1 = 12345.6789D;
79 public static final double fieldStaticDouble2 = 2.3456789e+100D;
80 public static final double fieldStaticDouble3 = 3.456789e-100D;
81 public static final double fieldStaticDouble4 = 0.0D;
82 public static final double fieldStaticDouble5 = Double.MIN_VALUE;
83 public static final double fieldStaticDouble6 = Double.MAX_VALUE;
84 public static final double fieldStaticDouble7 = Double.NEGATIVE_INFINITY;
85 public static final double fieldStaticDouble8 = Double.POSITIVE_INFINITY;
86 public static final double fieldStaticDouble9 = Double.NaN;
87 //
88 public static Object[] fieldStaticObjectArray; // can assign e.g. String[]
89 public static long[] fieldStaticLongArray; // cannot assign e.g. int[]
90
91 //
92 public static long fac(long n) { // complements jpl:jpl_test_fac(+integer,-integer)
93 if (n == 1) {
94 return 1;
95 } else if (n > 1) {
96 // return n * ((Integer) new Query(new Compound("jpl_test_fac", new Term[] { new Integer(n - 1), new Variable("F") })).oneSolution().get("F")).intValue();
97 return n * ((jpl.Integer) Query.oneSolution("jpl_test_fac(?,F)", new Term[] { new jpl.Integer(n - 1) }).get("F")).longValue();
98 } else {
99 return 0;
100 }
101 }
102
103 static void packageMethod() { // not callable via JPL
104 return;
105 }
106
107 public static void publicMethod() {
108 return;
109 }
110
111 protected static void protectedMethod() { // not callable via JPL
112 return;
113 }
114
115 @SuppressWarnings("unused")
116 private static void privateMethod() { // not callable via JPL
117 return;
118 }
119
120 public boolean fieldInstanceBoolean;
121 public final boolean fieldInstanceBoolean1 = false;
122 public final boolean fieldInstanceBoolean2 = true;
123 public byte fieldInstanceByte;
124 public final byte fieldInstanceByte1 = -(1 << 7);
125 public final byte fieldInstanceByte2 = -1;
126 public final byte fieldInstanceByte3 = 0;
127 public final byte fieldInstanceByte4 = 1;
128 public final byte fieldInstanceByte5 = (1 << 7) - 1;
129 public char fieldInstanceChar;
130 public final char fieldInstanceChar1 = '\u0000';
131 public final char fieldInstanceChar2 = '\uFFFF';
132 public double fieldInstanceDouble;
133 public final double fieldInstanceDouble1 = 12345.6789D;
134 public final double fieldInstanceDouble2 = 2.3456789e+100D;
135 public final double fieldInstanceDouble3 = 3.456789e-100D;
136 public final double fieldInstanceDouble4 = 0.0D;
137 public final double fieldInstanceDouble5 = Double.MIN_VALUE;
138 public final double fieldInstanceDouble6 = Double.MAX_VALUE;
139 public final double fieldInstanceDouble7 = Double.NEGATIVE_INFINITY;
140 public final double fieldInstanceDouble8 = Double.POSITIVE_INFINITY;
141 public final double fieldInstanceDouble9 = Double.NaN;
142 public float fieldInstanceFloat;
143 public final float fieldInstanceFloat1 = 12345.6789F;
144 public final float fieldInstanceFloat2 = 3.4e+38F;
145 public final float fieldInstanceFloat3 = 1.4e-45F;
146 public final float fieldInstanceFloat4 = 0.0F;
147 public final float fieldInstanceFloat5 = java.lang.Float.MIN_VALUE;
148 public final float fieldInstanceFloat6 = java.lang.Float.MAX_VALUE;
149 public final float fieldInstanceFloat7 = java.lang.Float.NEGATIVE_INFINITY;
150 public final float fieldInstanceFloat8 = java.lang.Float.POSITIVE_INFINITY;
151 public final float fieldInstanceFloat9 = java.lang.Float.NaN;
152 public int fieldInstanceInt;
153 public final int fieldInstanceInt1 = -(1 << 31);
154 public final int fieldInstanceInt2 = -(1 << 15);
155 public final int fieldInstanceInt3 = -(1 << 7);
156 public final int fieldInstanceInt4 = -1;
157 public final int fieldInstanceInt5 = 0;
158 public final int fieldInstanceInt6 = 1;
159 public final int fieldInstanceInt7 = (1 << 7) - 1;
160 public final int fieldInstanceInt8 = (1 << 15) - 1;
161 public final int fieldInstanceInt9 = (1 << 31) - 1;
162 public long fieldInstanceLong;
163 public final long fieldInstanceLong1 = -(1 << 63);
164 public final long fieldInstanceLong10 = (1 << 31) - 1;
165 public final long fieldInstanceLong11 = (1 << 63) - 1;
166 public final long fieldInstanceLong2 = -(1 << 31);
167 public final long fieldInstanceLong3 = -(1 << 15);
168 public final long fieldInstanceLong4 = -(1 << 7);
169 public final long fieldInstanceLong5 = -1;
170 public final long fieldInstanceLong6 = 0;
171 public final long fieldInstanceLong7 = 1;
172 public final long fieldInstanceLong8 = (1 << 7) - 1;
173 public final long fieldInstanceLong9 = (1 << 15) - 1;
174 public short fieldInstanceShort;
175 public final short fieldInstanceShort1 = -(1 << 15);
176 public final short fieldInstanceShort2 = -(1 << 7);
177 public final short fieldInstanceShort3 = -1;
178 public final short fieldInstanceShort4 = 0;
179 public final short fieldInstanceShort5 = 1;
180 public final short fieldInstanceShort6 = (1 << 7) - 1;
181 public final short fieldInstanceShort7 = (1 << 15) - 1;
182
183 public Term term; // obsolete
184 public static Term staticTerm;
185 public Term instanceTerm;
186
187 // for testing accessibility of non-public fields:
188 static boolean fieldPackageStaticBoolean;
189 protected static boolean fieldProtectedStaticBoolean;
190
191 @SuppressWarnings("unused")
192 private static boolean fieldPrivateStaticBoolean;
193
194 // for testing update of final field:
195 public static final int fieldStaticFinalInt = 7;
196
197 // for testing passing general terms in from Prolog:
198 public static Term fieldStaticTerm;
199 public Term fieldInstanceTerm;
200
201 public static boolean methodStaticTerm(Term t) {
202 return t != null;
203 }
204
205 public boolean methodInstanceTerm(Term t) {
206 return t != null;
207 }
208
209 public static Term methodStaticEchoTerm(Term t) {
210 return t;
211 }
212
213 public static boolean methodStaticEchoBoolean(boolean v) {
214 return v;
215 }
216
217 public static char methodStaticEchoChar(char v) {
218 return v;
219 }
220
221 public static byte methodStaticEchoByte(byte v) {
222 return v;
223 }
224
225 public static short methodStaticEchoShort(short v) {
226 return v;
227 }
228
229 public static int methodStaticEchoInt(int v) {
230 return v;
231 }
232
233 public static long methodStaticEchoLong(long v) {
234 return v;
235 }
236
237 public static float methodStaticEchoFloat(float v) {
238 return v;
239 }
240
241 public static double methodStaticEchoDouble(double v) {
242 return v;
243 }
244
245 public Term methodInstanceTermEcho(Term t) {
246 return t;
247 }
248
249 public static boolean methodStaticTermIsJNull(Term t) {
250 return t.hasFunctor("@", 1) && t.arg(1).hasFunctor("null", 0);
251 }
252
253 public boolean methodInstanceTermIsJNull(Term t) {
254 return t.hasFunctor("@", 1) && t.arg(1).hasFunctor("null", 0);
255 }
256
257 public static void hello() {
258 System.out.println("hello");
259 }
260
261 public static boolean[] newArrayBooleanFromValue(boolean v) {
262 boolean[] a = new boolean[1];
263 a[0] = v;
264 return a;
265 }
266
267 public static byte[] newArrayByteFromValue(byte v) {
268 byte[] a = new byte[1];
269 a[0] = v;
270 return a;
271 }
272
273 public static char[] newArrayCharFromValue(char v) {
274 char[] a = new char[1];
275 a[0] = v;
276 return a;
277 }
278
279 public static short[] newArrayShortFromValue(short v) {
280 short[] a = new short[1];
281 a[0] = v;
282 return a;
283 }
284
285 public static int[] newArrayIntFromValue(int v) {
286 int[] a = new int[1];
287 a[0] = v;
288 return a;
289 }
290
291 public static long[] newArrayLongFromValue(long v) {
292 long[] a = new long[1];
293 a[0] = v;
294 return a;
295 }
296
297 public static float[] newArrayFloatFromValue(float v) {
298 float[] a = new float[1];
299 a[0] = v;
300 return a;
301 }
302
303 public static double[] newArrayDoubleFromValue(double v) {
304 double[] a = new double[1];
305 a[0] = v;
306 return a;
307 }
308
309 public static String methodStaticArray(long[] a) {
310 return "long[]";
311 }
312
313 public static String methodStaticArray(int[] a) {
314 return "int[]";
315 }
316
317 public static String methodStaticArray(short[] a) {
318 return "short[]";
319 }
320
321 public static Term wrapTerm(Term in) { // for dmiles 11/Jul/2008
322 return new Compound("javaWrap", new Term[] { in });
323 }
324 }
+0
-823
packages/jpl/src/java/jpl/test/TestJUnit.java less more
0 // Created on 25-Jul-2004
1 package jpl.test;
2
3 import java.util.Map;
4
5 import jpl.Atom;
6 import jpl.Compound;
7 import jpl.Integer;
8 import jpl.JPL;
9 import jpl.PrologException;
10 import jpl.Query;
11 import jpl.Term;
12 import jpl.Util;
13 import jpl.Variable;
14 import jpl.fli.Prolog;
15 import junit.framework.TestCase;
16 import junit.framework.TestSuite;
17
18 // This class defines all the tests which are run from Java.
19 // It needs junit.framework.TestCase and junit.framework.TestSuite, which are not supplied with JPL.
20 public class TestJUnit extends TestCase {
21 public static final String startup = (System.getenv("SWIPL_BOOT_FILE") == null ? "../../src/swipl.prc" : System.getenv("SWIPL_BOOT_FILE"));
22 public static final String test_jpl = (System.getenv("TEST_JPL") == null ? "test_jpl.pl" : System.getenv("TEST_JPL"));
23 public static final String syntax = (System.getenv("SWIPL_SYNTAX") == null ? "traditional" : System.getenv("SWIPL_SYNTAX"));
24
25 public static long fac(long n) { // complements jpl:jpl_test_fac(+integer,-integer)
26 if (n == 1) {
27 return 1;
28 } else if (n > 1) {
29 return n * ((jpl.Integer) Query.oneSolution("jpl_test_fac(?,F)", new Term[] { new jpl.Integer(n - 1) }).get("F")).longValue();
30 } else {
31 return 0;
32 }
33 }
34
35 public TestJUnit(String name) { // called for each public void test*() method
36 super(name);
37 }
38
39 public static junit.framework.Test suite() {
40 if (syntax.equals("traditional")) {
41 JPL.setTraditional();
42 Prolog.set_default_init_args(new String[] { "swipl.dll", "-x", startup, "-f", "none", "-g", "true", "--traditional", "-q", "--home=../.." });
43 } else {
44 Prolog.set_default_init_args(new String[] { "swipl.dll", "-x", startup, "-f", "none", "-g", "true", "-q", "--home=../.." });
45 }
46 assertTrue((new Query("consult", new Term[] { new Atom(test_jpl) })).hasSolution());
47 assertTrue((new Query("use_module(library(jpl))")).hasSolution());
48 return new TestSuite(TestJUnit.class);
49 }
50
51 public static void main(String args[]) {
52 junit.textui.TestRunner.run(suite());
53 }
54
55 protected void setUp() {
56 }
57
58 protected void tearDown() {
59 // cleanup code
60 }
61
62 public void testSyntaxSet1() {
63 if (syntax.equals("traditional")) {
64 try {
65 JPL.setTraditional(); // should succeed silently
66 } catch (Exception e) {
67 fail("setTraditional() under traditional syntax threw exception: " + e);
68 }
69 } else {
70 try {
71 JPL.setTraditional();
72 } catch (jpl.JPLException e) { // expected exception class, but is it correct in detail?
73 if (e.getMessage().endsWith("traditional syntax after Prolog is initialised")) {
74 // OK: an appropriate exception was thrown
75 } else {
76 fail("setTraditional() under modern syntax threw incorrect JPLException: " + e);
77 }
78 } catch (Exception e) {
79 fail("setTraditional() under modern syntax threw unexpected class of exception: " + e);
80 }
81 }
82 }
83
84 public void testMasstest() {
85 assertTrue((new Query("assert(diagnose_declaration(_,_,_,[not,a,real,error]))")).hasSolution());
86 }
87
88 // public void testSwiPrologHome() {
89 // System.out.println("home = " + Query.oneSolution("current_prolog_flag(home,Home)").get("Home"));
90 // }
91
92 // public void testSwiPrologVersion() {
93 // Term swi = Query.oneSolution("current_prolog_flag(version_data,Swi)").get("Swi");
94 // System.out.println("version = " + swi.arg(1) + "." + swi.arg(2) + "." + swi.arg(3));
95 // }
96
97 public void testSameLibVersions1() {
98 String java_lib_version = JPL.version_string();
99 String c_lib_version = jpl.fli.Prolog.get_c_lib_version();
100 assertTrue("java_lib_version(" + java_lib_version + ") is same as c_lib_version(" + c_lib_version + ")", java_lib_version.equals(c_lib_version));
101 }
102
103 public void testSameLibVersions2() {
104 String java_lib_version = JPL.version_string();
105 String pl_lib_version = Query.oneSolution("jpl_pl_lib_version(V)").get("V").name();
106 assertTrue("java_lib_version(" + java_lib_version + ") is same as pl_lib_version(" + pl_lib_version + ")", java_lib_version.equals(pl_lib_version));
107 }
108
109 public void testAtomName1() {
110 String name = "fred";
111 Atom a = new Atom(name);
112 assertEquals("an Atom's name is that with which it was created", a.name(), name);
113 }
114
115 public void testAtomName2() {
116 String name = "ha ha";
117 Atom a = new Atom(name);
118 assertEquals("an Atom's name is that with which it was created", a.name(), name);
119 }
120
121 public void testAtomName3() {
122 String name = "3";
123 Atom a = new Atom(name);
124 assertEquals("an Atom's name is that with which it was created", a.name(), name);
125 }
126
127 public void testAtomToString1() {
128 String name = "fred";
129 String toString = "fred";
130 Atom a = new Atom(name);
131 assertEquals("an Atom's .toString() value is quoted iff appropriate", a.toString(), toString);
132 }
133
134 public void testAtomToString2() {
135 String name = "ha ha";
136 String toString = "'ha ha'";
137 Atom a = new Atom(name);
138 assertEquals("an Atom's .toString() value is quoted iff appropriate", a.toString(), toString);
139 }
140
141 public void testAtomToString3() {
142 String name = "3";
143 String toString = "'3'";
144 Atom a = new Atom(name);
145 assertEquals("an Atom's .toString() value is quoted iff appropriate", a.toString(), toString);
146 }
147
148 public void testAtomArity() {
149 Atom a = new Atom("willy");
150 assertEquals("an Atom has arity zero", a.arity(), 0);
151 }
152
153 public void testAtomEquality1() {
154 String name = "fred";
155 Atom a1 = new Atom(name);
156 Atom a2 = new Atom(name);
157 assertEquals("two Atoms created with the same name are equal", a1, a2);
158 }
159
160 public void testAtomIdentity() { // how could this fail?!
161 String name = "fred";
162 Atom a1 = new Atom(name);
163 Atom a2 = new Atom(name);
164 assertNotSame("two Atoms created with the same name are not identical", a1, a2);
165 }
166
167 public void testAtomHasFunctorNameZero() {
168 String name = "sam";
169 Atom a = new Atom(name);
170 assertTrue(a.hasFunctor(name, 0));
171 }
172
173 public void testAtomHasFunctorWrongName() {
174 assertFalse("an Atom does not have a functor whose name is other than that with which the Atom was created", new Atom("wally").hasFunctor("poo", 0));
175 }
176
177 public void testAtomHasFunctorWrongArity() {
178 String name = "ted";
179 assertFalse("an Atom does not have a functor whose arity is other than zero", new Atom(name).hasFunctor(name, 1));
180 }
181
182 public void testVariableBinding1() {
183 Term lhs = new Compound("p", new Term[] { new Variable("X"), new Variable("Y") });
184 Term rhs = new Compound("p", new Term[] { new Atom("a"), new Atom("b") });
185 Term goal = new Compound("=", new Term[] { lhs, rhs });
186 Map<String, Term> soln = new Query(goal).oneSolution();
187 assertTrue("two variables with different names can bind to distinct atoms", soln != null && (soln.get("X")).name().equals("a") && (soln.get("Y")).name().equals("b"));
188 }
189
190 public void testVariableBinding2() {
191 Term lhs = new Compound("p", new Term[] { new Variable("X"), new Variable("X") });
192 Term rhs = new Compound("p", new Term[] { new Atom("a"), new Atom("b") });
193 Term goal = new Compound("=", new Term[] { lhs, rhs });
194 assertFalse("two distinct Variables with same name cannot unify with distinct atoms", new Query(goal).hasSolution());
195 }
196
197 public void testVariableBinding3() {
198 Variable X = new Variable("X");
199 Term lhs = new Compound("p", new Term[] { X, X });
200 Term rhs = new Compound("p", new Term[] { new Atom("a"), new Atom("b") });
201 Term goal = new Compound("=", new Term[] { lhs, rhs });
202 assertFalse("two occurrences of same named Variable cannot unify with distinct atoms", new Query(goal).hasSolution());
203 }
204
205 public void testVariableBinding4() {
206 Term lhs = new Compound("p", new Term[] { new Variable("_"), new Variable("_") });
207 Term rhs = new Compound("p", new Term[] { new Atom("a"), new Atom("b") });
208 Term goal = new Compound("=", new Term[] { lhs, rhs });
209 assertTrue("two distinct anonymous Variables can unify with distinct atoms", new Query(goal).hasSolution());
210 }
211
212 public void testVariableBinding5() {
213 Variable Anon = new Variable("_");
214 Term lhs = new Compound("p", new Term[] { Anon, Anon });
215 Term rhs = new Compound("p", new Term[] { new Atom("a"), new Atom("b") });
216 Term goal = new Compound("=", new Term[] { lhs, rhs });
217 assertTrue("two occurrences of same anonymous Variable can unify with distinct atoms", new Query(goal).hasSolution());
218 }
219
220 public void testAtomEquality2() {
221 Atom a = new Atom("a");
222 assertTrue("two occurrences of same Atom are equal by .equals()", a.equals(a));
223 }
224
225 public void testAtomEquality3() {
226 assertTrue("two distinct Atoms with same names are equal by .equals()", (new Atom("a")).equals(new Atom("a")));
227 }
228
229 public void testTextToTerm1() {
230 String text = "fred(B,p(A),[A,B,C])";
231 Term t = Util.textToTerm(text);
232 assertTrue("Util.textToTerm() converts \"fred(B,p(A),[A,B,C])\" to a corresponding Term", t.hasFunctor("fred", 3) && t.arg(1).isVariable() && t.arg(1).name().equals("B")
233 && t.arg(2).hasFunctor("p", 1) && t.arg(2).arg(1).isVariable() && t.arg(2).arg(1).name().equals("A"));
234 }
235
236 public void testArrayToList1() {
237 Term l2 = Util.termArrayToList(new Term[] { new Atom("a"), new Atom("b"), new Atom("c"), new Atom("d"), new Atom("e") });
238 Query q9 = new Query(new Compound("append", new Term[] { new Variable("Xs"), new Variable("Ys"), l2 }));
239 assertTrue("append(Xs,Ys,[a,b,c,d,e]) has 6 solutions", q9.allSolutions().length == 6);
240 }
241
242 public void testArrayToList2() {
243 String goal = "append(Xs,Ys,[a,b,c,d,e])";
244 assertTrue(goal + " has 6 solutions", Query.allSolutions(goal).length == 6);
245 }
246
247 public void testLength1() {
248 Query q5 = new Query(new Compound("length", new Term[] { new Variable("Zs"), new jpl.Integer(2) }));
249 Term zs = q5.oneSolution().get("Zs");
250 assertTrue("length(Zs,2) binds Zs to a list of two distinct variables " + zs.toString(), zs.isListPair() && zs.arg(1).isVariable() && zs.arg(2).isListPair() && zs.arg(2).arg(1).isVariable()
251 && zs.arg(2).arg(2).isListNil() && !zs.arg(1).name().equals(zs.arg(2).arg(1).name()));
252 }
253
254 public void testGenerate1() { // we chickened out of verifying each solution :-)
255 String goal = "append(Xs,Ys,[_,_,_,_,_])";
256 assertTrue(goal + " has 6 solutions", Query.allSolutions(goal).length == 6);
257 }
258
259 public void testPrologException1() {
260 try {
261 new Query("p(]"); // writes junk to stderr and enters debugger unless flag debug_on_error = false
262 } catch (PrologException e) {
263 assertTrue("new Query(\"p(]\") throws a PrologException " + e.toString(), true);
264 return;
265 }
266 fail("new Query(\"p(]\") oughta throw a PrologException");
267 }
268
269 public void testAtom1() {
270 assertTrue("new Atom(\"3 3\")" + (new Atom("3 3")).toString(), true);
271 }
272
273 public void testTextToTerm2() {
274 String text1 = "fred(?,2,?)";
275 String text2 = "[first(x,y),A]";
276 Term plist = Util.textToTerm(text2);
277 Term[] ps = plist.toTermArray();
278 Term t = Util.textToTerm(text1).putParams(ps);
279 assertTrue("fred(?,2,?) .putParams( [first(x,y),A] )", t.hasFunctor("fred", 3) && t.arg(1).hasFunctor("first", 2) && t.arg(1).arg(1).hasFunctor("x", 0) && t.arg(1).arg(2).hasFunctor("y", 0)
280 && t.arg(2).hasFunctor(2, 0) && t.arg(3).isVariable() && t.arg(3).name().equals("A"));
281 }
282
283 public void testDontTellMeMode1() {
284 final Query q = new Query("setof(_M,current_module(_M),_Ms),length(_Ms,N)");
285 JPL.setDTMMode(true);
286 assertTrue("in dont-tell-me mode, setof(_M,current_module(_M),_Ms),length(_Ms,N) returns binding for just one variable", q.oneSolution().keySet().size() == 1);
287 }
288
289 public void testDontTellMeMode2() {
290 final Query q = new Query("setof(_M,current_module(_M),_Ms),length(_Ms,N)");
291 JPL.setDTMMode(false);
292 assertTrue("not in dont-tell-me mode, setof(_M,current_module(_M),_Ms),length(_Ms,N) returns binding for three variables", q.oneSolution().keySet().size() == 3);
293 }
294
295 public void testModulePrefix1() {
296 assertTrue(Query.hasSolution("call(user:true)"));
297 }
298
299 private void testMutualRecursion(int n, long f) { // f is the expected result for fac(n)
300 try {
301 assertEquals("mutual recursive Java<->Prolog factorial: fac(" + n + ") = " + f, fac(n), f);
302 } catch (Exception e) {
303 fail("fac(" + n + ") threw " + e);
304 }
305 }
306
307 public void testMutualRecursion1() {
308 testMutualRecursion(1, 1);
309 }
310
311 public void testMutualRecursion2() {
312 testMutualRecursion(2, 2);
313 }
314
315 public void testMutualRecursion3() {
316 testMutualRecursion(3, 6);
317 }
318
319 public void testMutualRecursion10() {
320 testMutualRecursion(10, 3628800);
321 }
322
323 public void testIsJNull1() {
324 Term atNull = new Compound("@", new Term[] { new Atom("null") });
325 Query q = new Query("=", new Term[] { new Variable("X"), atNull });
326 assertTrue(q.oneSolution().get("X").isJNull());
327 }
328
329 public void testIsJNull2() {
330 Term t = Query.oneSolution("X = @(3)").get("X");
331 assertFalse("@(3) . isJNull() fails", t.isJNull());
332 }
333
334 public void testIsJNull3() {
335 Term t = Query.oneSolution("X = _").get("X");
336 assertFalse("_ . isJNull() fails", t.isJNull());
337 }
338
339 public void testIsJNull4() {
340 Term t = Query.oneSolution("X = @(true)").get("X");
341 assertFalse("@(true) . isJNull() fails", t.isJNull());
342 }
343
344 public void testIsJNull5() {
345 Term t = Query.oneSolution("X = @(false)").get("X");
346 assertFalse("@(false) . isJNull() fails", t.isJNull());
347 }
348
349 public void testIsJTrue1() {
350 Term t = Query.oneSolution("X = @(true)").get("X");
351 assertTrue("@(true) . isJTrue() succeeds", t.isJTrue());
352 }
353
354 public void testIsJTrue2() {
355 Term t = Query.oneSolution("X = @(3)").get("X");
356 assertFalse("@(3) . isJTrue() fails", t.isJTrue());
357 }
358
359 public void testIsJTrue3() {
360 Term t = Query.oneSolution("X = _").get("X");
361 assertFalse("_ . isJTrue() fails", t.isJTrue());
362 }
363
364 public void testIsJTrue4() {
365 Term t = Query.oneSolution("X = @(false)").get("X");
366 assertFalse("@(false) . isJTrue() fails", t.isJTrue());
367 }
368
369 public void testIsJVoid1() {
370 Term t = Query.oneSolution("X = @(void)").get("X");
371 assertTrue("@(void) . isJVoid() succeeds", t.isJVoid());
372 }
373
374 public void testIsJVoid2() {
375 Term t = Query.oneSolution("X = @(3)").get("X");
376 assertFalse("@(3) . isJVoid() fails", t.isJVoid());
377 }
378
379 public void testIsJVoid3() {
380 Term t = Query.oneSolution("X = _").get("X");
381 assertFalse("_ . isJVoid() fails", t.isJVoid());
382 }
383
384 public void testTypeName1() {
385 assertEquals("Y = foo binds Y to an Atom", Query.oneSolution("Y = foo").get("Y").typeName(), "Atom");
386 }
387
388 public void testTypeName2() {
389 assertEquals("Y = 3.14159 binds Y to a Float", Query.oneSolution("Y = 3.14159").get("Y").typeName(), "Float");
390 }
391
392 public void testTypeName4() {
393 assertEquals("Y = 6 binds Y to an Integer", Query.oneSolution("Y = 6").get("Y").typeName(), "Integer");
394 }
395
396 public void testTypeName5() {
397 assertEquals("Y = _ binds Y to a Variable", Query.oneSolution("Y = _").get("Y").typeName(), "Variable");
398 }
399
400 public void testTypeName3() {
401 assertEquals("Y = f(x) binds Y to a Compound", Query.oneSolution("Y = f(x)").get("Y").typeName(), "Compound");
402 }
403
404 public void testGoalWithModulePrefix1() {
405 String goal = "jpl:jpl_modifier_bit(volatile,I)";
406 assertTrue(goal + " binds I to an integer", Query.oneSolution(goal).get("I").isInteger());
407 }
408
409 public void testGoalWithModulePrefix2() {
410 String goal = "user:length([],0)";
411 assertTrue(goal + " succeeds", Query.hasSolution(goal));
412 }
413
414 public void testGoalWithModulePrefix3() {
415 String goal = "3:length([],0)";
416 try {
417 Query.hasSolution(goal); // should throw exception
418 fail(goal + " (numeric module prefix) didn't throw exception"); // shouldn't get to here
419 } catch (jpl.PrologException e) { // expected exception class
420 if (e.term().hasFunctor("error", 2) && e.term().arg(1).hasFunctor("type_error", 2) && e.term().arg(1).arg(1).hasFunctor("atom", 0)) {
421 // OK: an appropriate exception was thrown
422 } else {
423 fail(goal + " (numeric module prefix) threw incorrect PrologException: " + e);
424 }
425 } catch (Exception e) {
426 fail(goal + " (numeric module prefix) threw wrong class of exception: " + e);
427 }
428 }
429
430 public void testGoalWithModulePrefix4() {
431 String goal = "_:length([],0)";
432 try {
433 Query.hasSolution(goal); // should throw exception
434 fail(goal + " (unbound module prefix) wrongly succeeded"); // shouldn't get to here
435 } catch (jpl.PrologException e) { // expected exception class
436 if (e.term().hasFunctor("error", 2) && e.term().arg(1).hasFunctor("instantiation_error", 0)) {
437 // OK: an appropriate exception was thrown
438 } else {
439 fail(goal + " (unbound module prefix) threw wrong PrologException: " + e);
440 }
441 } catch (Exception e) {
442 fail(goal + " (unbound module prefix) threw wrong exception class: " + e);
443 }
444 }
445
446 public void testGoalWithModulePrefix5() {
447 String goal = "f(x):length([],0)";
448 try {
449 Query.hasSolution(goal); // should throw exception
450 fail(goal + " (compound module prefix) wrongly succeeded"); // shouldn't get to here
451 } catch (jpl.PrologException e) { // correct exception class
452 if (e.term().hasFunctor("error", 2) && e.term().arg(1).hasFunctor("type_error", 2) && e.term().arg(1).arg(1).hasFunctor("atom", 0)) {
453 // OK: an appropriate exception was thrown
454 } else {
455 fail(goal + " (compound module prefix) threw wrong PrologException: " + e);
456 }
457 } catch (Exception e) {
458 fail(goal + " (compound module prefix) threw wrong exception class: " + e);
459 }
460 }
461
462 public void testGoalWithModulePrefix6() {
463 String goal = "no_such_module:no_such_predicate(0)";
464 try {
465 Query.hasSolution(goal); // should throw exception
466 fail(goal + " (nonexistent module prefix) wrongly succeeded"); // shouldn't get to here
467 } catch (jpl.PrologException e) { // expected exception class
468 if (e.term().hasFunctor("error", 2) && e.term().arg(1).hasFunctor("existence_error", 2) && e.term().arg(1).arg(1).hasFunctor("procedure", 0)) {
469 // OK: an appropriate exception was thrown
470 } else {
471 fail(goal + " (nonexistent module prefix) threw wrong PrologException: " + e);
472 }
473 } catch (Exception e) {
474 fail(goal + " (nonexistent module prefix) threw wrong exception class: " + e);
475 }
476 }
477
478 // public void testFetchCyclicTerm(){
479 // assertTrue((new Query("X=f(X)")).hasSolution());
480 // }
481 public void testFetchLongList0() {
482 assertTrue((new Query("findall(foo(N),between(0,10,N),L)")).hasSolution());
483 }
484
485 public void testFetchLongList1() {
486 assertTrue((new Query("findall(foo(N),between(0,100,N),L)")).hasSolution());
487 }
488
489 public void testFetchLongList2() {
490 assertTrue((new Query("findall(foo(N),between(0,1000,N),L)")).hasSolution());
491 }
492
493 public void testFetchLongList2c() {
494 assertTrue((new Query("findall(foo(N),between(0,1023,N),L)")).hasSolution());
495 }
496
497 // public void testFetchLongList2a() { /* leads to stack overflow */
498 // assertTrue((new Query("findall(foo(N),between(0,2000,N),L)")).hasSolution());
499 // }
500 // public void testFetchLongList2b() {
501 // assertTrue((new Query("findall(foo(N),between(0,3000,N),L)")).hasSolution());
502 // }
503 // public void testFetchLongList3() {
504 // assertTrue((new Query("findall(foo(N),between(0,10000,N),L)")).hasSolution());
505 // }
506 public void testUnicode0() {
507 assertTrue(Query.hasSolution("atom_codes(?,[32])", new Term[] { new Atom(" ") }));
508 }
509
510 public void testUnicode0a() {
511 assertTrue(Query.hasSolution("atom_codes(?,[32])", new Term[] { new Atom("\u0020") }));
512 }
513
514 public void testUnicode0b() {
515 assertTrue(Query.hasSolution("atom_codes(?,[0])", new Term[] { new Atom("\u0000") }));
516 }
517
518 public void testUnicode0c() {
519 assertTrue(Query.hasSolution("atom_codes(?,[1])", new Term[] { new Atom("\u0001") }));
520 }
521
522 public void testUnicode0d() {
523 assertTrue(Query.hasSolution("atom_codes(?,[127])", new Term[] { new Atom("\u007F") }));
524 }
525
526 public void testUnicode0e() {
527 assertTrue(Query.hasSolution("atom_codes(?,[128])", new Term[] { new Atom("\u0080") }));
528 }
529
530 public void testUnicode0f() {
531 assertTrue(Query.hasSolution("atom_codes(?,[255])", new Term[] { new Atom("\u00FF") }));
532 }
533
534 public void testUnicode0g() {
535 assertTrue(Query.hasSolution("atom_codes(?,[256])", new Term[] { new Atom("\u0100") }));
536 }
537
538 public void testUnicode1() {
539 assertTrue(Query.hasSolution("atom_codes(?,[0,127,128,255])", new Term[] { new Atom("\u0000\u007F\u0080\u00FF") }));
540 }
541
542 public void testUnicode2() {
543 assertTrue(Query.hasSolution("atom_codes(?,[256,32767,32768,65535])", new Term[] { new Atom("\u0100\u7FFF\u8000\uFFFF") }));
544 }
545
546 public void testStringXput1() {
547 Term a = Query.oneSolution("string_concat(foo,bar,S)").get("S");
548 assertEquals("foobar", a.name());
549 assertEquals("string", a.blobType());
550 }
551
552 public void testStringXput2() {
553 String s1 = "\u0000\u007F\u0080\u00FF";
554 String s2 = "\u0100\u7FFF\u8000\uFFFF";
555 String s = s1 + s2; // concatenate in Java
556 Term a = Query.oneSolution("string_concat(?,?,S)", new Term[] { new Atom(s1), new Atom(s2) }).get("S"); // concatenate in Prolog
557 assertEquals(s, a.name());
558 assertEquals("string", a.blobType());
559 }
560
561 // public void testMaxInteger1() {
562 // assertEquals(Query.oneSolution("current_prolog_flag(max_integer,I)").get("I").longValue(), java.lang.Long.MAX_VALUE); // i.e. 9223372036854775807L
563 // }
564
565 // public void testSingleton1() {
566 // assertTrue(Query.hasSolution("style_check(-singleton),consult('test_singleton.pl')"));
567 // }
568
569 public void testStaticQueryInvalidSourceText2() {
570 String goal = "p(]";
571 try {
572 Query.hasSolution(goal); // should throw exception
573 fail(goal + " (bad syntax) succeeded"); // shouldn't get to here
574 } catch (jpl.PrologException e) { // expected exception
575 if (e.term().hasFunctor("error", 2) && e.term().arg(1).hasFunctor("syntax_error", 1) && e.term().arg(1).arg(1).hasFunctor("cannot_start_term", 0)) {
576 // OK: an appropriate exception was thrown
577 } else {
578 fail(goal + " (bad syntax) threw wrong PrologException: " + e);
579 }
580 } catch (Exception e) {
581 fail(goal + " (bad syntax) threw wrong exception class: " + e);
582 }
583 }
584
585 public void testStaticQueryInvalidSourceText1() {
586 String goal = "bad goal";
587 try {
588 Query.hasSolution(goal); // should throw exception
589 fail(goal + " (bad syntax) succeeded"); // shouldn't get to here
590 } catch (jpl.PrologException e) { // expected exception
591 if (e.term().hasFunctor("error", 2) && e.term().arg(1).hasFunctor("syntax_error", 1) && e.term().arg(1).arg(1).hasFunctor("operator_expected", 0)) {
592 // OK: an appropriate exception was thrown
593 } else {
594 fail(goal + " (bad syntax) threw wrong PrologException: " + e);
595 }
596 } catch (Exception e) {
597 fail(goal + " (bad syntax) threw wrong exception class: " + e);
598 }
599 }
600
601 public void testStaticQueryNSolutions1() {
602 String goal = "member(X, [0,1,2,3,4,5,6,7,8,9])";
603 int n = 5;
604 assertTrue("Query.nSolutions(" + goal + ", " + n + ") returns " + n + " solutions", Query.nSolutions(goal, n).length == n);
605 }
606
607 public void testStaticQueryNSolutions2() {
608 String goal = "member(X, [0,1,2,3,4,5,6,7,8,9])";
609 int n = 0;
610 assertTrue("Query.nSolutions(" + goal + ", " + n + ") returns " + n + " solutions", Query.nSolutions(goal, n).length == n);
611 }
612
613 public void testStaticQueryNSolutions3() {
614 String goal = "member(X, [0,1,2,3,4,5,6,7,8,9])";
615 int n = 20;
616 assertTrue("Query.nSolutions(" + goal + ", " + n + ") returns 10 solutions", Query.nSolutions(goal, n).length == 10);
617 }
618
619 public void testStaticQueryAllSolutions1() {
620 String goal = "member(X, [0,1,2,3,4,5,6,7,8,9])";
621 assertTrue("Query.allSolutions(" + goal + ") returns 10 solutions", Query.allSolutions(goal).length == 10);
622 }
623
624 public void testStaticQueryHasSolution1() {
625 String goal = "memberchk(13, [?,?,?])";
626 Term[] params = new Term[] { new Integer(12), new Integer(13), new Integer(14) };
627 assertTrue(Query.hasSolution(goal, params));
628 }
629
630 public void testStaticQueryHasSolution2() {
631 String goal = "memberchk(23, [?,?,?])";
632 Term[] params = new Term[] { new Integer(12), new Integer(13), new Integer(14) };
633 assertFalse(Query.hasSolution(goal, params));
634 }
635
636 public void testUtilListToTermArray1() {
637 String goal = "T = [a,b,c]";
638 Term list = Query.oneSolution(goal).get("T");
639 Term[] array = Util.listToTermArray(list);
640 assertTrue(array[2].isAtom() && array[2].name().equals("c"));
641 }
642
643 public void testTermToTermArray1() {
644 String goal = "T = [a,b,c]";
645 Term list = Query.oneSolution(goal).get("T");
646 Term[] array = list.toTermArray();
647 assertTrue(array[2].isAtom() && array[2].name().equals("c"));
648 }
649
650 public void testJRef1() {
651 int i = 76543;
652 Integer I = new Integer(i);
653 Query q = new Query("jpl_call(?,intValue,[],I2)", new Term[] { Term.objectToJRef(I) });
654 Term I2 = q.oneSolution().get("I2");
655 assertTrue(I2.isInteger() && I2.intValue() == i);
656 }
657
658 public void testBerhhard1() {
659 assertTrue(Query.allSolutions("consult(library('lists'))").length == 1);
660 }
661
662 public void testJRef2() {
663 int i = 76543;
664 Integer I = new Integer(i);
665 Query q = new Query("jpl_call(?,intValue,[],I2)", jpl.JPL.newJRef(I));
666 Term I2 = q.oneSolution().get("I2");
667 assertTrue(I2.isInteger() && I2.intValue() == i);
668 }
669
670 public void testJRef3() {
671 StringBuffer sb = new StringBuffer();
672 Query.oneSolution("jpl_call(?,append,['xyz'],_)", new Term[] { JPL.newJRef(sb) });
673 assertTrue(sb.toString().equals("xyz"));
674 }
675
676 public void testJRef4() {
677 Term jrefSB = Query.oneSolution("jpl_new('java.lang.StringBuffer',['abc'],SB)").get("SB");
678 assertTrue(jrefSB.isJRef() && ((StringBuffer) jrefSB.jrefToObject()).toString().equals("abc"));
679 }
680
681 public void testJRef5() {
682 String token = "foobar345";
683 Term a = Query.oneSolution("jpl_new('java.lang.StringBuffer',[?],A)", new Term[] { new Atom(token) }).get("A");
684 assertTrue(((java.lang.StringBuffer) (a.jrefToObject())).toString().equals(token));
685 }
686
687 public void testRef6() {
688 Term nullJRef = new Compound("@", new Term[] { new Atom("null") });
689 Object nullObject = nullJRef.jrefToObject();
690 assertNull("@(null) .jrefToObject() yields null", nullObject);
691 }
692
693 public void testRef7() {
694 Term badJRef = new Compound("@", new Term[] { new Atom("foobar") });
695 try {
696 badJRef.jrefToObject(); // should throw exception
697 fail("@(foobar) .jrefToObject() shoulda thrown JPLException"); // shouldn't get to here
698 } catch (jpl.JPLException e) { // expected exception class
699 if (e.getMessage().endsWith("term is not a JRef")) {
700 // OK: an appropriate exception was thrown
701 } else {
702 fail("@(foobar) .jrefToObject() threw wrong JPLException: " + e);
703 }
704 } catch (Exception e) {
705 fail("@(foobar) .jrefToObject() threw wrong exception class: " + e);
706 }
707 }
708
709 public void testForeignFrame1() {
710 int ls1 = Query.oneSolution("statistics(localused,LS)").get("LS").intValue();
711 int ls2 = Query.oneSolution("statistics(localused,LS)").get("LS").intValue();
712 assertTrue("local stack size unchanged after query", ls1 == ls2);
713 }
714
715 public void testOpenGetClose1() {
716 StringBuffer sb = new StringBuffer();
717 Query q = new Query("atom_chars(prolog, Cs), member(C, Cs)");
718 Map<String, Term> soln;
719 q.open();
720 while ((soln = q.getSolution()) != null) {
721 sb.append(((Atom) soln.get("C")).name());
722 }
723 q.close();
724 assertEquals("prolog", sb.toString());
725 }
726
727 public void testOpenGetClose2() {
728 Query q = new Query("dummy"); // we're not going to open this...
729 try {
730 q.getSolution(); // should throw exception (query not open)
731 fail("getSolution() succeeds on unopened Query"); // shouldn't get to here
732 } catch (jpl.JPLException e) { // expected exception class
733 if (e.getMessage().endsWith("Query is not open")) {
734 // OK: an appropriate exception was thrown
735 } else {
736 fail("jpl.Query#getSolution() threw wrong JPLException: " + e);
737 }
738 } catch (Exception e) {
739 fail("jpl.Query#getSolution() threw wrong exception class: " + e);
740 }
741 }
742
743 public void testOpen1() {
744 Query q = new Query("dummy");
745 assertTrue("a newly created query is not open", !q.isOpen());
746 }
747
748 public void testOpen2() {
749 Query q = new Query("fail");
750 q.open();
751 assertTrue("a newly opened query which has no solutions is open", q.isOpen());
752 }
753
754 public void testGetSolution1() {
755 Query q = new Query("fail");
756 q.open();
757 q.getSolution();
758 assertTrue("an opened query on which getSolution has failed once is closed", !q.isOpen());
759 }
760
761 public void testGetSolution2() {
762 Query q = new Query("fail"); // this query has no solutions
763 q.open(); // this opens the query
764 q.getSolution(); // this finds no solution, and closes the query
765 try {
766 q.getSolution(); // this call is invalid, as the query is closed
767 // shouldn't get to here
768 fail("jpl.Query#getSolution() shoulda thrown JPLException");
769 } catch (jpl.JPLException e) { // correct exception class, but is it correct in detail?
770 if (e.getMessage().endsWith("Query is not open")) { // ...which should throw a JPLException like this
771 // OK: an appropriate exception was thrown
772 } else {
773 fail("jpl.Query#getSolution() threw incorrect JPLException: " + e);
774 }
775 } catch (Exception e) {
776 fail("jpl.Query#getSolution() threw wrong class of exception: " + e);
777 }
778 }
779
780 public void testHasMoreSolutions1() {
781 StringBuffer sb = new StringBuffer();
782 Query q = new Query("atom_chars(prolog, Cs), member(C, Cs)");
783 Map<String, Term> soln;
784 q.open();
785 while (q.hasMoreSolutions()) {
786 soln = q.nextSolution();
787 sb.append(((Atom) soln.get("C")).name());
788 }
789 q.close();
790 assertEquals("Query#hasMoreSolutions() + Query#nextSolution() work as intended", "prolog", sb.toString());
791 }
792
793 @SuppressWarnings("unchecked")
794 public void testHasMoreElements1() {
795 StringBuffer sb = new StringBuffer();
796 Query q = new Query("atom_chars(prolog, Cs), member(C, Cs)");
797 Map<String, Term> soln;
798 q.open();
799 while (q.hasMoreElements()) {
800 soln = (Map<String, Term>) q.nextElement();
801 sb.append(((Atom) soln.get("C")).name());
802 }
803 q.close();
804 assertEquals("Query#hasMoreElements() + Query#nextElement() work as intended", "prolog", sb.toString());
805 }
806
807 public void testStackedQueries1() {
808 StringBuffer sb = new StringBuffer();
809 Query q = new Query("atom_chars(prolog, Cs), member(C, Cs)");
810 Map<String, Term> soln;
811 q.open();
812 while ((soln = q.getSolution()) != null) {
813 Atom a = (Atom) soln.get("C");
814 if (Query.hasSolution("memberchk(?, [l,o,r])", new Term[] { a })) { // this query opens and closes while an earlier query is still open
815 sb.append(((Atom) soln.get("C")).name());
816 }
817 }
818 assertTrue(!q.isOpen()); // q will have been closed by the final getSolution()
819 assertEquals("rolo", sb.toString());
820 }
821
822 }
+0
-151
packages/jpl/src/java/jpl/test/TestOLD.java less more
0 package jpl.test;
1
2 import java.util.Map;
3
4 import jpl.Atom;
5 import jpl.Compound;
6 import jpl.Integer;
7 import jpl.JPL;
8 import jpl.Query;
9 import jpl.Term;
10 import jpl.Util;
11 import jpl.Variable;
12 import jpl.fli.Prolog;
13
14 // This class is nearly obsolete; most of its tests have been migrated to TestJUnit.
15 public class TestOLD {
16 private static void test10() {
17 System.err.println("test10:");
18 System.err.println(" java_lib_version = " + JPL.version_string());
19 System.err.println(" c_lib_version = " + jpl.fli.Prolog.get_c_lib_version());
20 System.err.println(" pl_lib_version = " + new Query(new Compound("jpl_pl_lib_version", new Term[] { new Variable("V") })).oneSolution().get("V"));
21 System.err.println(" java.version = " + System.getProperty("java.version"));
22 System.err.println(" os.name = " + System.getProperty("os.name"));
23 System.err.println(" os.arch = " + System.getProperty("os.arch"));
24 System.err.println(" os.version = " + System.getProperty("os.version"));
25 System.err.println();
26 }
27
28 private static void test10j() {
29 Term l2 = Util.termArrayToList(new Term[] { new Atom("a"), new Atom("b"), new Atom("c"), new Atom("d"), new Atom("e") });
30 Query q9 = new Query(new Compound("append", new Term[] { new Variable("Xs"), new Variable("Ys"), l2 }));
31 Map<String, Term>[] s9s = q9.allSolutions();
32 System.err.println("test10j:");
33 for (int i = 0; i < s9s.length; i++) {
34 System.err.println(" append(Xs,Ys,[a,b,c,d,e]) -> " + Util.toString(s9s[i]));
35 }
36 System.err.println();
37 }
38
39 private static void test10k() {
40 String[] args = jpl.fli.Prolog.get_default_init_args();
41 String which;
42 String s = "";
43 System.err.println("test10k:");
44 if (args == null) {
45 args = jpl.fli.Prolog.get_actual_init_args();
46 which = "actual";
47 } else {
48 which = "default";
49 }
50 for (int i = 0; i < args.length; i++) {
51 s = s + args[i] + " ";
52 }
53 System.err.println(" " + which + "_init_args = " + s + '\n');
54 }
55
56 private static void test10l() {
57 Query q5 = new Query(new Compound("length", new Term[] { new Variable("Zs"), new jpl.Integer(5) }));
58 Map<String, Term> s5 = q5.oneSolution();
59 System.err.println("test10l:");
60 System.err.println(" length(Zs,5)");
61 System.err.println(" " + Util.toString(s5));
62 System.err.println(" Zs = " + (Term) s5.get("Zs"));
63 System.err.println();
64 }
65
66 private static void test10m() {
67 String text = "append(Xs,Ys,[_,_,_,_,_])";
68 Query q = new Query(text);
69 Map<String, Term>[] ss = q.allSolutions();
70 System.err.println("test10m:");
71 System.err.println(" all solutions of " + text);
72 for (int i = 0; i < ss.length; i++) {
73 System.err.println(" " + Util.toString(ss[i]));
74 }
75 System.err.println();
76 }
77
78 private static void test10o() {
79 System.err.println("test10o:");
80 Term l2b = Util.termArrayToList(new Term[] { new Variable("A"), new Variable("B"), new Variable("C"), new Variable("D"), new Variable("E") });
81 Query q9b = new Query(new Compound("append", new Term[] { new Variable("Xs"), new Variable("Ys"), l2b }));
82 Map<String, Term>[] s9bs = q9b.allSolutions();
83 for (int i = 0; i < s9bs.length; i++) {
84 System.err.println(" append(Xs,Ys,[A,B,C,D,E]) -> " + Util.toString(s9bs[i]));
85 }
86 System.err.println();
87 }
88
89 private static void test10q() {
90 System.err.println("test10q:");
91 System.err.println((new Compound("Bad Name", new Term[] { new Atom("3 3") })).toString());
92 System.err.println();
93 }
94
95 @SuppressWarnings("unused")
96 private static void test10s() {
97 final Query q = new Query("jpl_slow_goal"); // 10 successive sleep(1)
98 System.err.println("test10s:");
99 Thread t = new Thread(new Runnable() {
100 public void run() {
101 try {
102 System.err.println("q.hasSolution() ... ");
103 System.err.println(q.hasSolution() ? "finished" : "failed");
104 } catch (Exception e) {
105 System.err.println("q.hasSolution() threw " + e);
106 }
107 }
108 });
109 t.start(); // call the query in a separate thread
110 System.err.println("pausing for 2 secs...");
111 try {
112 Thread.sleep(2000);
113 } catch (InterruptedException e) {
114 ;
115 } // wait a coupla seconds for it to get started
116 // (new Query("set_prolog_flag(abort_with_exception, true)")).hasSolution();
117 System.err.println("calling q.abort()...");
118 q.abort();
119 System.err.println();
120 }
121
122 public static void main(String argv[]) {
123 Prolog.set_default_init_args(new String[] { "libpl.dll", "-f", "none", "-g", "set_prolog_flag(debug_on_error,false)", "-q" });
124 System.err.println("tag = " + Prolog.object_to_tag(new Query("hello")));
125 test10k();
126 test10();
127 // test10h();
128 // test10i();
129 test10j();
130 test10k();
131 test10l();
132 test10m();
133 // test10n();
134 test10o();
135 // test10p();
136 test10q();
137 // test10r();
138 // test10s();
139 // test10t();
140 // test10u();
141 // test10v();
142 String s = new String("" + '\0' + '\377');
143 System.err.println("s.length = " + s.length());
144 for (int i = 0; i < s.length(); i++) {
145 System.err.print((new Integer(s.charAt(i))).toString() + " ");
146 }
147 System.err.println();
148 System.err.println(new Query("atom_codes(A,[127,128,255,0])").oneSolution().toString());
149 }
150 }
+0
-21
packages/jpl/src/java/jpl/test/family.pl less more
0 % a simple database for Family.java
1
2 child_of( joe, ralf ).
3 child_of( mary, joe ).
4 child_of( steve, joe ).
5
6 descendent_of( X, Y ) :-
7 child_of( X, Y ).
8 descendent_of( X, Y ) :-
9 child_of( Z, Y ),
10 descendent_of( X, Z ).
11
12 p( A, B) :-
13 ( q( A, B)
14 -> write( 'OK'-q(A,B)), nl
15 ; write( 'FAIL'-q(A,B)), nl
16 ).
17
18 q( 3, 4).
19
20 r( 5, 5).
+0
-9
packages/jpl/src/java/jpl/test/test.pl less more
0 p( N, T) :-
1 ( N > 1
2 -> Nx is N-1,
3 p( Nx, Tx),
4 T = a(Tx,Tx)
5 ; N == 1
6 -> T = a
7 ).
8
+0
-1
packages/jpl/src/java/jpl/util/.cvsignore less more
0 *.class
+0
-45
packages/jpl/src/java/jpl/util/Getenv.java less more
0 package jpl.util;
1
2 import java.io.BufferedReader;
3 import java.io.InputStream;
4 import java.io.InputStreamReader;
5
6 public class Getenv {
7
8 public static void main(String args[]) {
9
10 try {
11 getenv();
12 } catch (java.io.IOException e) {
13 }
14 }
15
16 public static void getenv() throws java.io.IOException, java.io.UnsupportedEncodingException {
17 Runtime rt = Runtime.getRuntime();
18
19 String a[] = new String[3];
20 a[0] = "CMD";
21 a[1] = "/C";
22 a[2] = "SET";
23
24 Process p = rt.exec(a);
25
26 InputStream is = p.getInputStream();
27
28 InputStreamReader isr = new InputStreamReader(is, "UTF8");
29
30 BufferedReader br = new BufferedReader(isr);
31
32 getenv1(br);
33 }
34
35 static void getenv1(BufferedReader br) throws java.io.IOException {
36
37 String s = br.readLine();
38
39 if (s != null) {
40 System.out.println(s);
41 getenv1(br);
42 }
43 }
44 }
+0
-135
packages/jpl/src/java/jpl/util/HashedRefs.java less more
0 package jpl.util;
1
2 /**
3 * HashedRefs collision list.
4 */
5 class HashedRefsEntry {
6 int hash;
7 Object obj;
8 public int iref;
9 public HashedRefsEntry next;
10 }
11
12 public class HashedRefs {
13 /**
14 * The hash table data.
15 */
16 public transient HashedRefsEntry table[];
17
18 /**
19 * The total number of entries in the hash table.
20 */
21 private transient int count;
22
23 /**
24 * Rehashes the table when count exceeds this threshold.
25 */
26 private int threshold;
27
28 /**
29 * The load factor for the hashtable.
30 */
31 private float loadFactor;
32
33 public HashedRefs(int initialCapacity, float loadFactor) {
34 if ((initialCapacity <= 0) || (loadFactor <= 0.0)) {
35 throw new IllegalArgumentException();
36 }
37 this.loadFactor = loadFactor;
38 table = new HashedRefsEntry[initialCapacity];
39 threshold = (int) (initialCapacity * loadFactor);
40 }
41
42 public HashedRefs(int initialCapacity) {
43 this(initialCapacity, 0.75f);
44 }
45
46 public HashedRefs() {
47 this(101, 0.75f);
48 }
49
50 public int size() {
51 return count;
52 }
53
54 protected void rehash() {
55 int oldCapacity = table.length;
56 HashedRefsEntry oldTable[] = table;
57
58 int newCapacity = oldCapacity * 2 + 1;
59 HashedRefsEntry newTable[] = new HashedRefsEntry[newCapacity];
60
61 threshold = (int) (newCapacity * loadFactor);
62 table = newTable;
63
64 for (int i = oldCapacity; i-- > 0;) {
65 for (HashedRefsEntry old = oldTable[i]; old != null;) {
66 HashedRefsEntry e = old;
67 old = old.next;
68
69 int index = (e.hash & 0x7FFFFFFF) % newCapacity;
70 e.next = newTable[index];
71 newTable[index] = e;
72 }
73 }
74 }
75
76 public synchronized int add(Object obj, int iref) {
77 // Make sure the object reference is not null
78 if (obj == null) {
79 throw new NullPointerException();
80 }
81
82 // check whether object is already in the hashtable...
83 HashedRefsEntry tab[] = table;
84 int hash = java.lang.System.identityHashCode(obj);
85 int index = (hash & 0x7FFFFFFF) % tab.length;
86 for (HashedRefsEntry e = tab[index]; e != null; e = e.next) {
87 if ((e.hash == hash) && (e.obj == obj)) {
88 return e.iref; // existing global reference to this object
89 }
90 }
91
92 if (count >= threshold) {
93 // Rehash the table if the threshold is exceeded
94 rehash();
95 return add(obj, iref);
96 }
97
98 // create a new entry...
99 HashedRefsEntry e = new HashedRefsEntry();
100 e.hash = hash;
101 e.obj = obj;
102 e.iref = iref;
103 e.next = tab[index];
104 tab[index] = e;
105 count++;
106 return 0; // indicates this reference has been added
107 }
108
109 public synchronized boolean del(Object obj) {
110 HashedRefsEntry tab[] = table;
111 int hash = java.lang.System.identityHashCode(obj);
112 int index = (hash & 0x7FFFFFFF) % tab.length;
113 for (HashedRefsEntry e = tab[index], prev = null; e != null; prev = e, e = e.next) {
114 if ((e.hash == hash) && (e.obj == obj)) {
115 if (prev != null) {
116 prev.next = e.next;
117 } else {
118 tab[index] = e.next;
119 }
120 count--;
121 return true;
122 }
123 }
124 return false;
125 }
126
127 public synchronized void clear() {
128 HashedRefsEntry tab[] = table;
129 for (int index = tab.length; --index >= 0;)
130 tab[index] = null;
131 count = 0;
132 }
133
134 }
+0
-13
packages/jpl/src/java/jpl/util/Mod.java less more
0 package jpl.util;
1
2 public class Mod {
3 public static void main(String args[]) {
4
5 System.out.println(" 17 % 5 = " + (17 % 5));
6 System.out.println(" 17 % -5 = " + (17 % -5));
7 System.out.println("-17 % 5 = " + (-17 % 5));
8 System.out.println("-17 % -5 = " + (-17 % -5));
9 while (true)
10 ;
11 }
12 }
+0
-13
packages/jpl/src/java/jpl/util/Overload.java less more
0 package jpl.util;
1
2 public class Overload {
3 static void m1(int a1, long a2) {
4 }
5
6 static void m1(long a1, int a2) {
7 }
8
9 public static void main(String[] args) {
10 m1((long) 0, 0);
11 }
12 }
+0
-10
packages/jpl/src/java/jpl/util/Overload2.java less more
0 package jpl.util;
1
2 public class Overload2 {
3 // experiment (why not read the language reference?)
4 public static int fred;
5
6 public static int fred() {
7 return fred;
8 }
9 }
+0
-119
packages/jpl/src/java/jpl/util/PopupMenuDemo.java less more
0 package jpl.util;
1
2 import java.awt.Point;
3 import java.awt.event.ActionEvent;
4 import java.awt.event.ActionListener;
5 import javax.swing.JFrame;
6 import javax.swing.JMenu;
7 import javax.swing.JMenuItem;
8 import javax.swing.JPopupMenu;
9
10 /*
11 * Adapted from a Swing Connection demo
12 * see pcm's jpl_demo:jpl_popup_demo/0
13 */
14 public class PopupMenuDemo extends JFrame implements ActionListener {
15 private static final long serialVersionUID = 1L;
16 // JTextArea output;
17 public JPopupMenu popup;
18 JMenuItem source;
19 int mi;
20
21 public PopupMenuDemo() {
22
23 // Add regular components to the window, using the default BorderLayout.
24 // output = new JTextArea(5, 30);
25 // output.setEditable(false);
26 // getContentPane().add(new JScrollPane(output), BorderLayout.CENTER);
27 }
28
29 /*
30 * JPopupMenu +- JMenuItem +- JMenuItem +- JMenu ----- JPopupMenu | +- JMenuItem | +- JMenuItem +- JMenuItem +- JMenuItem
31 */
32 public boolean search(JPopupMenu p) {
33 Object[] mes = p.getSubElements(); // array of JMenuItem or JMenu (see diagram)
34 int i;
35
36 for (i = 0; i < mes.length; i++) {
37 if (mes[i] == source) { // it's the clicked JMenuItem
38 return true;
39 } else if (mes[i] instanceof JMenu) { // it's a submenu
40 if (search((JPopupMenu) (((JMenu) mes[i]).getSubElements())[0])) {
41 return true; // clicked JMenuItem was within this submenu tree
42 }
43 } else { // it's a non-matching leaf element
44 mi++; // next JMenuItemm will be the mi-th
45 }
46 }
47 return false;
48 }
49
50 public void actionPerformed(ActionEvent e) {
51 source = (JMenuItem) (e.getSource());
52 // output.append("action event source: " + source.getText()
53 // + " (an instance of " + getClassName(source) + ")\n");
54 mi = 1;
55 if (search(popup)) {
56 // output.append("clicked " + mi + "\n");
57 if ((new jpl.Query("jpl_popup_demo_callback", new jpl.Term[] { new jpl.Integer(mi) })).hasSolution()) {
58 // output.append("succeeded\n");
59 } else {
60 // output.append("failed\n");
61 }
62 }
63 // output.append("jpl_popup_demo_callback(" + mi + ")\n");
64 }
65
66 // protected String getClassName(Object o) { // Returns just the class name -- no package info.
67 // String classString = o.getClass().getName();
68 // int dotIndex = classString.lastIndexOf(".");
69 // return classString.substring(dotIndex+1);
70 // }
71
72 public JPopupMenu buildPopupMenu(Object[] mis) {
73 int i;
74 JPopupMenu m = new JPopupMenu((String) mis[0]);
75 JMenuItem mi;
76
77 for (i = 1; i < mis.length; i++) {
78 if (mis[i] instanceof String) {
79 mi = new JMenuItem((String) mis[i]);
80 mi.addActionListener(this);
81 m.add(mi);
82 } else if (mis[i] instanceof Object[]) {
83 m.add(buildSubMenu((Object[]) mis[i]));
84 } else {
85 return null; // bad menuitems array
86 }
87 }
88 return m;
89 }
90
91 public JMenu buildSubMenu(Object[] mis) {
92 int i;
93 JMenu m = new JMenu((String) mis[0]);
94 JMenuItem mi;
95
96 for (i = 1; i < mis.length; i++) {
97 if (mis[i] instanceof String) {
98 mi = new JMenuItem((String) mis[i]);
99 mi.addActionListener(this);
100 m.add(mi);
101 } else if (mis[i] instanceof Object[]) {
102 m.add(buildSubMenu((Object[]) mis[i]));
103 } else {
104 return null; // bad menuitems array
105 }
106 }
107 return m;
108 }
109
110 public void showPopup(Object[] mis, int x, int y) {
111 Point p = getLocationOnScreen(); // on-screen location of origin of this Frame
112
113 popup = buildPopupMenu(mis); // discarding any previous one...
114 setVisible(true); // ensure this Frame thingy is visible (else we get an error)
115 popup.show(this, x - p.x, y - p.y); // must show over some Component (e.g. this)
116 }
117
118 }
+0
-50
packages/jpl/src/java/jpl/util/Prog.java less more
0 package jpl.util;
1
2 public class Prog {
3 public static int i_am_static_1 = 1;
4
5 public int i_am_not_static_2 = 2;
6
7 public static java.lang.String S = "hello";
8
9 public static class Inside {
10 public int intErnal;
11 }
12
13 public static void main(String[] args) {
14 System.out.println("Hello World");
15 }
16
17 public static float div0() {
18 return (float) (1.234);
19 }
20
21 public static String welcome() {
22 return "Welcome to JSP!";
23 }
24
25 public float div1(int d) {
26 return i_am_static_1 / d;
27 }
28
29 public double div2(int d) {
30 return i_am_not_static_2 / d;
31 }
32
33 public static int add_ints(int i1, int i2, int i3) {
34 return i1 + i2 + i3;
35 }
36
37 public static float floats_to_float(float f1, float f2, float f3) {
38 return f1 + f2 + f3;
39 }
40
41 public static double floats_to_double(float f1, float f2, float f3) {
42 return f1 + f2 + f3;
43 }
44
45 public static String double_to_string(double d) {
46 return "The answer is " + d;
47 }
48
49 }
+0
-78
packages/jpl/src/java/jpl/util/SwingGadget.java less more
0 package jpl.util;
1
2 import java.awt.BorderLayout;
3 import java.awt.GridLayout;
4 import java.awt.event.ActionEvent;
5 import java.awt.event.ActionListener;
6 import java.awt.event.WindowAdapter;
7 import java.awt.event.WindowEvent;
8 import javax.swing.BorderFactory;
9 import javax.swing.JButton;
10 import javax.swing.JFrame;
11 import javax.swing.JLabel;
12 import javax.swing.JPanel;
13 import javax.swing.UIManager;
14
15 public class SwingGadget extends JFrame {
16 private static final long serialVersionUID = 1L;
17
18 public int numClicks = 0; // can be changed e.g. from Prolog
19
20 private static String labelPrefix = "Number of button clicks: ";
21 final JLabel label = new JLabel(labelPrefix + "0 ");
22
23 public SwingGadget(String caption) {
24 super(caption); // call the JFrame contructor
25
26 JButton button = new JButton("I'm a Swing button!");
27
28 button.addActionListener(new ActionListener() {
29 public void actionPerformed(ActionEvent e) {
30 inc();
31 }
32 });
33
34 label.setLabelFor(button);
35
36 JPanel pane = new JPanel();
37 pane.setBorder(BorderFactory.createEmptyBorder(30, 30, 10, 30));
38 pane.setLayout(new GridLayout(0, 1));
39 pane.add(button);
40 pane.add(label);
41
42 try {
43 UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
44 } catch (Exception e) {
45 }
46
47 getContentPane().add(pane, BorderLayout.CENTER);
48
49 addWindowListener(new WindowAdapter() {
50 public void windowClosing(WindowEvent e) {
51 // System.exit(0);
52 setVisible(false);
53 }
54 });
55 pack();
56 setVisible(true);
57 }
58
59 public synchronized void inc() {
60 numClicks++;
61 label.setText(labelPrefix + numClicks);
62 notifyAll();
63 }
64
65 public synchronized boolean dec() {
66 try {
67 while (numClicks <= 0) {
68 wait();
69 }
70 numClicks--;
71 label.setText(labelPrefix + numClicks);
72 return true;
73 } catch (InterruptedException e) {
74 return false;
75 }
76 }
77 }
+0
-79
packages/jpl/src/java/jpl/util/SwingGadget2.java less more
0 package jpl.util;
1
2 import java.awt.BorderLayout;
3 import java.awt.event.ActionEvent;
4 import java.awt.event.ActionListener;
5 import javax.swing.JFrame;
6 import javax.swing.JPanel;
7 import javax.swing.UIManager;
8
9 public class SwingGadget2 extends JFrame {
10 private static final long serialVersionUID = 1L;
11 private Qev head;
12 private Qev tail;
13 public JPanel pane;
14
15 public ActionListener al = new ActionListener() {
16 public void actionPerformed(ActionEvent e) {
17 inc(e);
18 }
19 };
20
21 public SwingGadget2(String caption) {
22 super(caption); // call the JFrame contructor
23 try {
24 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
25 } catch (Exception e) {
26 }
27 pane = new JPanel();
28 getContentPane().add(pane, BorderLayout.CENTER);
29
30 // JButton button1 = new JButton("click me");
31 // JButton button2 = new JButton("...or me");
32
33 // button1.addActionListener( al);
34 // button2.addActionListener( al);
35
36 // pane.add(button1);
37 // pane.add(button2);
38
39 pack();
40 setVisible(true);
41 }
42
43 public synchronized void inc(Object e) {
44 if (head == null) {
45 head = new Qev(e);
46 head.next = null;
47 tail = head;
48 } else {
49 tail.next = new Qev(e);
50 tail = tail.next;
51 }
52 notifyAll();
53 }
54
55 public synchronized Object dec() {
56 Qev t;
57
58 try {
59 while (head == null) {
60 wait();
61 }
62 t = head;
63 head = head.next;
64 return t.ev;
65 } catch (InterruptedException e) {
66 return null;
67 }
68 }
69
70 public class Qev {
71 public Object ev;
72 public Qev next;
73
74 public Qev(Object e) {
75 ev = e;
76 }
77 }
78 }
+0
-165
packages/jpl/src/java/jpl/util/Test1.java less more
0 package jpl.util;
1
2 public class Test1 {
3
4 public static String booleans_to_string(boolean p0, boolean p1) {
5 return "{" + p0 + "," + p1 + "}";
6 }
7
8 public static String chars_to_string(char p0, char p1) {
9 return "{" + p0 + "," + p1 + "}";
10 }
11
12 public static String bytes_to_string(byte p0, byte p1) {
13 return "{" + p0 + "," + p1 + "}";
14 }
15
16 public static String shorts_to_string(short p0, short p1) {
17 return "{" + p0 + "," + p1 + "}";
18 }
19
20 public static String ints_to_string(int p0, int p1) {
21 return "{" + p0 + "," + p1 + "}";
22 }
23
24 public static String longs_to_string(long p0, long p1) {
25 return "{" + p0 + "," + p1 + "}";
26 }
27
28 public static String floats_to_string(float p0, float p1) {
29 return "{" + p0 + "," + p1 + "}";
30 }
31
32 public static String doubles_to_string(double p0, double p1) {
33 return "{" + p0 + "," + p1 + "}";
34 }
35
36 public static String boolean_to_string(boolean p) {
37 return "{" + p + "}";
38 }
39
40 public static String char_to_string(char p) {
41 return "{" + p + "}";
42 }
43
44 public static String byte_to_string(byte p) {
45 return "{" + p + "}";
46 }
47
48 public static String short_to_string(short p) {
49 return "{" + p + "}";
50 }
51
52 public static String int_to_string(int p) {
53 return "{" + p + "}";
54 }
55
56 public static String long_to_string(long p) {
57 return "{" + p + "}";
58 }
59
60 public static String float_to_string(float p) {
61 return "{" + p + "}";
62 }
63
64 public static String double_to_string(double p) {
65 return "{" + p + "}";
66 }
67
68 public static boolean boolean_1() {
69 return false;
70 }
71
72 public static boolean boolean_2() {
73 return true;
74 }
75
76 public static char char_1() {
77 return '\uFFFF';
78 }
79
80 public static byte byte_1() {
81 return 127;
82 }
83
84 public static short short_1() {
85 return 32767;
86 }
87
88 public static int int_1() {
89 return 0x01234567; /* 19088743 */
90 }
91
92 public static int int_2() {
93 return 0x89ABCDEF; /* -1985229329 */
94 }
95
96 public static long long_1() {
97 return 0x0123456789ABCDEFL; /* jlong(19088743,-1985229329) */
98 }
99
100 public static long long_2() {
101 return 0xFFFFFFFFFFFFFFFEL; /* jlong(-1,-2) */
102 }
103
104 public static long long_3() {
105 return 0x0000000100000002L; /* jlong(1,2) */
106 }
107
108 public static long long_4() {
109 return 0xFFFFFFFF00000000L; /* jlong(-1,0) */
110 }
111
112 public static long long_5() {
113 return 0x00000000FFFFFFFFL; /* -1 */
114 }
115
116 public static long long_6() {
117 return 0x0000000080000000L; /* -2147483648 */
118 }
119
120 public static long long_7() {
121 return 0x000000007FFFFFFFL; /* 2147483647 */
122 }
123
124 public static float float_1() {
125 return 12345.6789F;
126 }
127
128 public static double double_1() {
129 return 12345.6789D;
130 }
131
132 public static double double_1a() {
133 return 2.3456789e+100D;
134 }
135
136 public static double double_1b() {
137 return 3.456789e-100D;
138 }
139
140 public static double double_1c() {
141 return 0.0D;
142 }
143
144 public static double double_2() {
145 return Double.MIN_VALUE;
146 }
147
148 public static double double_3() {
149 return Double.MAX_VALUE;
150 }
151
152 public static double double_4() {
153 return Double.NEGATIVE_INFINITY;
154 }
155
156 public static double double_5() {
157 return Double.POSITIVE_INFINITY;
158 }
159
160 public static double double_6() {
161 return Double.NaN;
162 }
163
164 }
+0
-123
packages/jpl/src/java/jpl/util/Test2.java less more
0 package jpl.util;
1
2 public class Test2 {
3 public static boolean boolean_field;
4 public static char char_field;
5 public static byte byte_field;
6 public static short short_field;
7 public static int int_field;
8 public static long long_field;
9 public static float float_field;
10 public static double double_field;
11
12 public static boolean get_boolean_field() {
13 return boolean_field;
14 }
15
16 public static char get_char_field() {
17 return char_field;
18 }
19
20 public static byte get_byte_field() {
21 return byte_field;
22 }
23
24 public static short get_short_field() {
25 return short_field;
26 }
27
28 public static int get_int_field() {
29 return int_field;
30 }
31
32 public static long get_long_field() {
33 return long_field;
34 }
35
36 public static float get_float_field() {
37 return float_field;
38 }
39
40 public static double get_double_field() {
41 return double_field;
42 }
43
44 /*-------------------------------------------------------------------------------*/
45 public static void set_boolean_field(boolean v) {
46 boolean_field = v;
47 }
48
49 public static void set_char_field(char v) {
50 char_field = v;
51 }
52
53 public static void set_byte_field(byte v) {
54 byte_field = v;
55 }
56
57 public static void set_short_field(short v) {
58 short_field = v;
59 }
60
61 public static void set_int_field(int v) {
62 int_field = v;
63 }
64
65 public static void set_long_field(long v) {
66 long_field = v;
67 }
68
69 public static void set_float_field(float v) {
70 float_field = v;
71 }
72
73 public static void set_double_field(double v) {
74 double_field = v;
75 }
76
77 public static String boolean_field_to_string() {
78 return "{" + boolean_field + "}";
79 }
80
81 public static String char_field_to_string() {
82 return "{" + char_field + "}";
83 }
84
85 public static String byte_field_to_string() {
86 return "{" + byte_field + "}";
87 }
88
89 public static String short_field_to_string() {
90 return "{" + short_field + "}";
91 }
92
93 public static String int_field_to_string() {
94 return "{" + int_field + "}";
95 }
96
97 public static String long_field_to_string() {
98 return "{" + long_field + "}";
99 }
100
101 public static String float_field_to_string() {
102 return "{" + float_field + "}";
103 }
104
105 public static String double_field_to_string() {
106 return "{" + double_field + "}";
107 }
108
109 public static String echo_2_and_3(Object a1, int a2, int a3) {
110 return "a2=" + a2 + ", a3=" + a3;
111 }
112
113 public static String set_bytes_to_7(byte[] a, int offset, int count) {
114 for (int i = 0; i < count; i++)
115 a[offset + i] = 7;
116 return "offset=" + offset + ", count=" + count;
117 }
118
119 public static String lotsa_args(byte[] a, int a1, int a2, int a3, int a4, int a5, int a6) { // this illustrated a bug in the MS JVM's JNI
120 return "a1=" + a1 + ", a2=" + a2 + ", a3=" + a3 + ", a4=" + a4 + ", a5=" + a5 + ", a6=" + a6;
121 }
122 }
+0
-332
packages/jpl/src/java/jpl/util/Util.java less more
0 package jpl.util;
1
2 import java.io.File;
3 import java.io.FileInputStream;
4 import java.io.FileNotFoundException;
5 import java.io.FileOutputStream;
6 import java.io.IOException;
7 import java.util.NoSuchElementException;
8 import java.util.Random;
9 import java.util.StringTokenizer;
10
11 public class Util {
12 private static Random r = new Random();
13
14 public static String[] dir_to_members(String dir) {
15 String[] ns = (new File(dir)).list();
16 int len = ns.length;
17 String[] ps = new String[len];
18 for (int i = 0; i < len; i++) {
19 try {
20 ps[i] = (new File(dir, ns[i])).getCanonicalPath().toString();
21 } catch (IOException e) {
22 ps[i] = "";
23 }
24 }
25 return ps;
26 }
27
28 public static String[] dir_to_member_paths(String dir) {
29 String[] ns = (new File(dir)).list();
30 int len = ns.length;
31 String[] ps = new String[len];
32 for (int i = 0; i < len; i++) {
33 try {
34 ps[i] = (new File(dir, ns[i])).getCanonicalPath();
35 } catch (IOException e) {
36 ps[i] = "";
37 }
38 }
39 return ps;
40 }
41
42 public static String[] dir_to_member_names(String dir) {
43 String[] ns = (new File(dir)).list();
44 int len = ns.length;
45 String[] ps = new String[len];
46 for (int i = 0; i < len; i++) {
47 ps[i] = (new File(dir, ns[i])).getName();
48 }
49 return ps;
50 }
51
52 public static int spawn_in_out_err(String command, String infile, String outfile, String errfile) {
53 Process p;
54
55 try {
56 p = Runtime.getRuntime().exec(command);
57 } catch (IOException e) {
58 return -1;
59 }
60
61 try {
62 if (infile != null) {
63 (new Xfer(new FileInputStream(infile), p.getOutputStream())).start();
64 }
65 if (outfile != null) {
66 (new Xfer(p.getInputStream(), new FileOutputStream(outfile))).start();
67 }
68 if (errfile != null) {
69 (new Xfer(p.getErrorStream(), new FileOutputStream(errfile))).start();
70 }
71 return p.waitFor();
72 } catch (FileNotFoundException e) {
73 return -2;
74 } catch (InterruptedException e) {
75 return -4;
76 }
77 }
78
79 public static int spawn_in_out_err_wait(String command, String infile, String outfile, String errfile, boolean wait) {
80 Process p;
81
82 try {
83 p = Runtime.getRuntime().exec(command);
84 } catch (IOException e) {
85 return -1;
86 }
87
88 try {
89 if (infile != null) {
90 (new Xfer(new FileInputStream(infile), p.getOutputStream())).start();
91 }
92 if (outfile != null) {
93 (new Xfer(p.getInputStream(), new FileOutputStream(outfile))).start();
94 }
95 if (errfile != null) {
96 (new Xfer(p.getErrorStream(), new FileOutputStream(errfile))).start();
97 }
98 if (wait)
99 return p.waitFor();
100 else
101 return 0;
102 } catch (FileNotFoundException e) {
103 return -2;
104 } catch (InterruptedException e) {
105 return -4;
106 }
107 }
108
109 public static int spawn(String command) {
110
111 return spawn_wait(command, true);
112 }
113
114 public static int spawn_wait(String command, boolean wait) {
115 Process p;
116
117 try {
118 p = java.lang.Runtime.getRuntime().exec(command);
119 } catch (IOException e) {
120 return -77;
121 }
122 if (wait) {
123 try {
124 return p.waitFor();
125 } catch (InterruptedException e) {
126 return -78;
127 }
128 } else {
129 return 0;
130 }
131 }
132
133 public static String new_scratch_file(String dir) {
134 return new_scratch_file(dir, "nsf");
135 }
136
137 public static String new_scratch_file(String dir, String suffix) {
138 int n = (int) (r.nextFloat() * 900000 + 100000);
139 File f = new File(dir, n + "." + suffix);
140
141 if (f.exists()) {
142 return new_scratch_file(dir, suffix);
143 } else {
144 try {
145 (new FileOutputStream(f)).close();
146 if (f.exists()) {
147 return f.getCanonicalPath().toString();
148 } else {
149 return null;
150 }
151 } catch (IOException e) {
152 return null;
153 }
154 }
155 }
156
157 public static String new_scratch_dir(String dir) {
158 int n = (int) (r.nextFloat() * 900000 + 100000);
159 File d = new File(dir, n + ".nsd");
160
161 if (d.exists()) {
162 return new_scratch_dir(dir);
163 } else {
164 try {
165 if (d.mkdir()) {
166 return d.getCanonicalPath().toString();
167 } else {
168 return null;
169 }
170 } catch (IOException e) {
171 return null;
172 }
173 }
174 }
175
176 public static String new_scratch_suffix_file(String dir, String suffix) {
177 int n = (int) (r.nextFloat() * 900000 + 100000);
178 File f = new File(dir, n + "." + suffix);
179
180 if (f.exists()) {
181 return new_scratch_suffix_file(dir, suffix);
182 } else {
183 try {
184 (new FileOutputStream(f)).close();
185 if (f.exists()) {
186 return f.getCanonicalPath().toString();
187 } else {
188 return null;
189 }
190 } catch (IOException e) {
191 return null;
192 }
193 }
194 }
195
196 public static String new_scratch_suffix_dir(String dir, String suffix) {
197 int n = (int) (r.nextFloat() * 900000 + 100000);
198 File d = new File(dir, n + "." + suffix);
199
200 if (d.exists()) {
201 return new_scratch_suffix_dir(dir, suffix);
202 } else {
203 try {
204 if (d.mkdir()) {
205 return d.getCanonicalPath().toString();
206 } else {
207 return null;
208 }
209 } catch (IOException e) {
210 return null;
211 }
212 }
213 }
214
215 public static boolean create_file(String file) {
216 File f = new File(file);
217
218 try {
219 (new FileOutputStream(f)).close();
220 return f.exists();
221 } catch (IOException e) {
222 return false;
223 }
224 }
225
226 public static boolean create_dir(String dir) {
227 try {
228 return (new File(dir)).mkdir();
229 } catch (SecurityException e) {
230 return false;
231 }
232 }
233
234 public static boolean file_exists(String f) {
235 return (new File(f)).exists();
236 }
237
238 public static boolean file_can_read(String f) {
239 return (new File(f)).canRead();
240 }
241
242 public static boolean file_can_write(String f) {
243 return (new File(f)).canWrite();
244 }
245
246 public static boolean file_is_file(String f) {
247 return (new File(f)).isFile();
248 }
249
250 public static boolean file_is_dir(String f) {
251 return (new File(f)).isDirectory();
252 }
253
254 public static long file_last_modified(String f) {
255 return (new File(f)).lastModified();
256 }
257
258 public static long file_to_length(String f) {
259 return (new File(f)).length();
260 }
261
262 public static boolean delete_file(String f) {
263 try {
264 return (new File(f)).delete();
265 } catch (SecurityException e) {
266 return false;
267 }
268 }
269
270 public static String[] classpath_parts() {
271 String cp = java.lang.System.getProperty("java.class.path");
272 StringTokenizer p = new StringTokenizer(cp, File.pathSeparator);
273 String a[] = new String[p.countTokens()];
274 int i = 0;
275 String s;
276 String[] r;
277
278 try {
279 while (p.hasMoreTokens()) {
280 s = (new File(p.nextToken())).getCanonicalPath().toString();
281 if (!strings_contains_string(a, i, s)) {
282 a[i++] = s;
283 }
284 }
285 } catch (NoSuchElementException e) {
286 return null;
287 } catch (IOException e) {
288 return null;
289 } finally {
290 r = new String[i];
291 java.lang.System.arraycopy(a, 0, r, 0, i);
292 }
293 return r;
294 }
295
296 private static boolean strings_contains_string(String[] ss, int n, String s) {
297 int i;
298
299 for (i = 0; i < n; i++) {
300 if (ss[i].equals(s))
301 return true;
302 }
303 return false;
304 }
305
306 public static byte[] filename_to_byte_array(String f) {
307 try {
308 FileInputStream s = new FileInputStream(f);
309 int length = s.available();
310 byte[] buf = new byte[length];
311 s.read(buf);
312 s.close(); // to release file for e.g. deletion...
313 return buf;
314 } catch (FileNotFoundException e) {
315 return null;
316 } catch (IOException e) {
317 return null;
318 }
319 }
320
321 public static boolean rename_file_to_file(String n1, String n2) {
322 try {
323 File f1 = new File(n1);
324 File f2 = new File(n2);
325 return (f1 != null && f2 != null ? f1.renameTo(f2) : false);
326 } catch (SecurityException e) {
327 return false;
328 }
329 }
330
331 }
+0
-175
packages/jpl/src/java/jpl/util/Util2.java less more
0 package jpl.util;
1
2 import java.io.File;
3 import java.io.FileInputStream;
4 import java.io.FileNotFoundException;
5 import java.io.FileOutputStream;
6 import java.io.IOException;
7 import java.util.NoSuchElementException;
8 import java.util.Random;
9 import java.util.StringTokenizer;
10
11 public class Util2 {
12 private static Random r = new Random();
13
14 public static String[] dir_to_members(String dir) {
15 String[] ns = (new File(dir)).list();
16 int len = ns.length;
17 String[] ps = new String[len];
18 for (int i = 0; i < len; i++) {
19 try {
20 ps[i] = (new File(dir, ns[i])).getCanonicalPath().toString();
21 } catch (IOException e) {
22 ps[i] = "";
23 }
24 }
25 return ps;
26 }
27
28 public static int spawn_in_out_err(String command, String infile, String outfile, String errfile) {
29 Process p;
30
31 try {
32 p = Runtime.getRuntime().exec(command);
33 } catch (IOException e) {
34 return -1;
35 }
36
37 try {
38 if (infile != null) {
39 (new Xfer(new FileInputStream(infile), p.getOutputStream())).start();
40 }
41 if (outfile != null) {
42 (new Xfer(p.getInputStream(), new FileOutputStream(outfile))).start();
43 }
44 if (errfile != null) {
45 (new Xfer(p.getErrorStream(), new FileOutputStream(errfile))).start();
46 }
47 return p.waitFor();
48 } catch (FileNotFoundException e) {
49 return -2;
50 } catch (InterruptedException e) {
51 return -4;
52 }
53 }
54
55 public static int spawn(String command) {
56
57 try {
58 return java.lang.Runtime.getRuntime().exec(command).waitFor();
59 } catch (IOException e) {
60 return -77;
61 } catch (InterruptedException e) {
62 return -78;
63 }
64 }
65
66 public static String new_scratch_file(String dir) {
67 int n = (int) (r.nextFloat() * 900000 + 100000);
68 File f = new File(dir, "newscratchfile." + n);
69
70 if (f.exists()) {
71 return new_scratch_file(dir);
72 } else {
73 try {
74 (new FileOutputStream(f)).close();
75 if (f.exists()) {
76 return f.getCanonicalPath().toString();
77 } else {
78 return null;
79 }
80 } catch (IOException e) {
81 return null;
82 }
83 }
84 }
85
86 public static boolean create_dir(String dir) {
87 try {
88 return (new File(dir)).mkdir();
89 } catch (SecurityException e) {
90 return false;
91 }
92 }
93
94 public static boolean file_exists(String f) {
95 return (new File(f)).exists();
96 }
97
98 public static boolean file_can_read(String f) {
99 return (new File(f)).canRead();
100 }
101
102 public static boolean file_can_write(String f) {
103 return (new File(f)).canWrite();
104 }
105
106 public static boolean file_is_file(String f) {
107 return (new File(f)).isFile();
108 }
109
110 public static boolean file_is_dir(String f) {
111 return (new File(f)).isDirectory();
112 }
113
114 public static long file_last_modified(String f) {
115 return (new File(f)).lastModified();
116 }
117
118 public static boolean delete_file(String f) {
119 try {
120 return (new File(f)).delete();
121 } catch (SecurityException e) {
122 return false;
123 }
124 }
125
126 public static String[] classpath_parts() {
127 String cp = java.lang.System.getProperty("java.class.path");
128 StringTokenizer p = new StringTokenizer(cp, File.pathSeparator);
129 String a[] = new String[p.countTokens()];
130 int i = 0;
131 String s;
132
133 try {
134 while (p.hasMoreTokens()) {
135 s = (new File(p.nextToken())).getCanonicalPath().toString();
136 if (!strings_contains_string(a, i, s)) {
137 a[i++] = s;
138 }
139 }
140 } catch (NoSuchElementException e) {
141 return null;
142 } catch (IOException e) {
143 return null;
144 }
145 String r[] = new String[i];
146 java.lang.System.arraycopy(a, 0, r, 0, i);
147 return r;
148 }
149
150 private static boolean strings_contains_string(String[] ss, int n, String s) {
151 int i;
152
153 for (i = 0; i < n; i++) {
154 if (ss[i].equals(s))
155 return true;
156 }
157 return false;
158 }
159
160 public static byte[] filename_to_byte_array(String f) {
161 try {
162 FileInputStream s = new FileInputStream(f);
163 int length = s.available();
164 byte[] buf = new byte[length];
165 s.read(buf);
166 s.close(); // to release file for e.g. deletion...
167 return buf;
168 } catch (FileNotFoundException e) {
169 return null;
170 } catch (IOException e) {
171 return null;
172 }
173 }
174 }
+0
-29
packages/jpl/src/java/jpl/util/Xfer.java less more
0 package jpl.util;
1
2 import java.io.IOException;
3 import java.io.InputStream;
4 import java.io.OutputStream;
5
6 public class Xfer extends Thread {
7 private InputStream in;
8
9 private OutputStream out;
10
11 public Xfer(InputStream s1, OutputStream s2) {
12 in = s1;
13 out = s2;
14 }
15
16 public void run() {
17 int c;
18
19 try {
20 while ((c = in.read()) != -1) {
21 out.write(c);
22 }
23 in.close();
24 out.close();
25 } catch (IOException e) {
26 }
27 }
28 }
0 package org.jpl7;
1
2 import java.util.Map;
3
4 import org.jpl7.fli.Prolog;
5 import org.jpl7.fli.term_t;
6
7 /**
8 * Atom is a specialised Compound with zero arguments, representing a Prolog atom with the same name. An Atom is constructed with a String parameter (its name, unquoted), which cannot thereafter be
9 * changed.
10 *
11 * <pre>
12 * Atom a = new Atom(&quot;hello&quot;);
13 * </pre>
14 *
15 * An Atom can be used (and re-used) as an argument of Compound Terms. Two Atom instances are equal (by equals()) iff they have equal names.
16 *
17 * <hr>
18 * <i> Copyright (C) 2004 Paul Singleton
19 * <p>
20 * Copyright (C) 1998 Fred Dushin
21 * <p>
22 *
23 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
24 * License, or (at your option) any later version.
25 * <p>
26 *
27 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28 * Library Public License for more details.
29 * <p>
30 * </i>
31 * <hr>
32 *
33 * @see org.jpl7.Term
34 * @see org.jpl7.Compound
35 */
36 public class Atom extends Term { // was extends Compound
37
38 /**
39 * the name of this Compound
40 */
41 protected final String name;
42
43 protected final String type; // should this be private?
44
45 /**
46 * @param name
47 * the Atom's name (unquoted)
48 */
49 public Atom(String name) {
50 if (name == null) {
51 throw new JPLException("cannot construct with null name");
52 } else {
53 this.name = name;
54 this.type = "text";
55 }
56 }
57
58 public Atom(String name, String type) {
59 if (name == null) {
60 throw new JPLException("cannot construct with null name");
61 } else if (type == null) {
62 throw new JPLException("cannot construct with null type");
63 } else {
64 this.name = name;
65 this.type = type;
66 }
67 }
68
69 /**
70 * the (zero) arguments of an Atom, as a (zero-length) Term[]
71 *
72 * @return the (zero) arguments of an Atom, as a (zero-length) Term[]
73 */
74 public Term[] args() {
75 return new Term[] {};
76 }
77
78 public final String atomType() {
79 return this.type;
80 }
81
82 /**
83 * Two Atoms are equal if they are identical (same object) or their respective names and blobTypes are equal
84 *
85 * @param obj
86 * the Object to compare (not necessarily another Atom)
87 * @return true if the Object satisfies the above condition
88 */
89 public final boolean equals(Object obj) {
90 return (this == obj || obj instanceof Atom && name.equals(((Atom) obj).name)
91 && type.equals(((Atom) obj).type));
92 }
93
94 /**
95 * Tests whether this Compound's functor has (String) 'name' and 'arity'.
96 *
97 * @return whether this Compound's functor has (String) 'name' and 'arity'
98 */
99 public final boolean hasFunctor(String name, int arity) {
100 return name.equals(this.name) && arity == 0;
101 }
102
103 /**
104 * whether this Term denotes (syntax-specifically) an empty list
105 */
106 public boolean isListNil() {
107 return this.equals(JPL.LIST_NIL);
108 }
109
110 /**
111 * the name (unquoted) of this Compound
112 *
113 * @return the name (unquoted) of this Compound
114 */
115 public final String name() {
116 return name;
117 }
118
119 /**
120 * To put an Atom in a term, we create a sequence of term_t references from the Term.terms_to_term_ts() method, and then use the Prolog.cons_functor_v() method to create a Prolog compound term.
121 *
122 * @param varnames_to_vars
123 * A Map from variable names to Prolog variables
124 * @param term
125 * A (previously created) term_t which is to be set to a Prolog term corresponding to the Term subtype (Atom, Variable, Compound, etc.) on which the method is invoked.
126 */
127 protected void put(Map<String, term_t> varnames_to_vars, term_t term) {
128 if (this.equals(JPL.LIST_NIL)) {
129 Prolog.put_nil(term);
130 } else {
131 Term[] args = new Term[] {};
132 Prolog.cons_functor_v(term, Prolog.new_functor(Prolog.new_atom(name), args.length),
133 Term.putTerms(varnames_to_vars, args));
134 }
135 }
136
137 /**
138 * an Atom's name is quoted if it is not a simple identifier.
139 *
140 * @return string representation of an Atom
141 */
142 public String toString() {
143 return (JPL.isSimpleName(name) ? name : "'" + name + "'");
144 }
145
146 /**
147 * returns the type of this term, as "Prolog.ATOM"
148 *
149 * @return the type of this term, as "Prolog.ATOM"
150 */
151 public final int type() {
152 return Prolog.ATOM;
153 }
154
155 /**
156 * returns the name of the type of this term, as "Atom"
157 *
158 * @return the name of the type of this term, as "Atom"
159 */
160 public String typeName() { // overrides same in jpl.Term
161 return "Atom";
162 }
163
164 }
0 package org.jpl7;
1
2 import java.util.Map;
3
4 import org.jpl7.fli.Prolog;
5 import org.jpl7.fli.term_t;
6
7 /**
8 * A Compound represents a structured term, comprising a functor and arguments (Terms). Atom is a subclass of Compound, whose instances have zero arguments. Direct instances of Compound must have one
9 * or more arguments (it is an error to attempt to construct a Compound with zero args; a JPLException will be thrown). For example, this Java expression yields a representation of the term f(a):
10 *
11 * <pre>
12 * new Compound(&quot;f&quot;, new Term[] { new Atom(&quot;a&quot;) })
13 * </pre>
14 *
15 * Note the use of the "anonymous array" notation to denote the arguments (an anonymous array of Term). <br>
16 * Alternatively, construct the Term from Prolog source syntax:
17 *
18 * <pre>
19 * Util.textToTerm(&quot;f(a)&quot;)
20 * </pre>
21 *
22 * The <i>arity</i> of a Compound is the quantity of its arguments. Once constructed, neither the name nor the arity of a Compound can be altered. An argument of a Compound can be replaced with the
23 * setArg() method.
24 * <hr>
25 * <i> Copyright (C) 2004 Paul Singleton
26 * <p>
27 * Copyright (C) 1998 Fred Dushin
28 * <p>
29 *
30 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
31 * License, or (at your option) any later version.
32 * <p>
33 *
34 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
35 * Library Public License for more details.
36 * <p>
37 * </i>
38 * <hr>
39 *
40 * @see org.jpl7.Term
41 * @see org.jpl7.Atom
42 */
43 public class Compound extends Term {
44 /**
45 * the arguments of this Compound
46 */
47 protected final Term[] args;
48
49 /**
50 * the name of this Compound
51 */
52 protected final String name;
53
54 /**
55 * Creates a Compound with name and no args. This constructor is protected (from illegal public use) and is used only by Atom, which inherits it.
56 *
57 * @param name
58 * the name of this Compound
59 */
60 public Compound(String name) {
61 if (name == null) {
62 throw new JPLException("cannot construct with null name");
63 } else {
64 this.name = name;
65 this.args = new Term[] {};
66 }
67 }
68
69 /**
70 * Creates a Compound with name and arity. This constructor, along with the setArg method, serves the new, native Prolog-term-to-Java-term routine, and is public only so as to be accessible via
71 * JNI: it is not intended for general use.
72 *
73 * @param name
74 * the name of this Compound
75 * @param arity
76 * the arity of this Compound
77 */
78 protected Compound(String name, int arity) {
79 if (name == null) {
80 throw new JPLException("cannot construct with null name");
81 } else if (arity < 0) {
82 throw new JPLException("cannot construct with negative arity");
83 // } else if (arity == 0 && JPL.getSyntax().equals("traditional")) {
84 // throw new JPLException("cannot construct with zero args");
85 } else {
86 this.name = name;
87 this.args = new Term[arity];
88 }
89 }
90
91 /**
92 * Creates a Compound with name and args.
93 *
94 * @param name
95 * the name of this Compound
96 * @param args
97 * the (one or more) arguments of this Compound
98 */
99 public Compound(String name, Term[] args) {
100 if (name == null) {
101 throw new JPLException("cannot construct with null name");
102 } else if (args == null) {
103 throw new JPLException("cannot construct with null args");
104 // } else if (args.length == 0 && JPL.getSyntax().equals("traditional")) {
105 // throw new JPLException("cannot construct with zero args");
106 } else {
107 this.name = name;
108 this.args = args;
109 }
110 }
111
112 /**
113 * Returns the ith argument (counting from 1) of this Compound; throws an ArrayIndexOutOfBoundsException if i is inappropriate.
114 *
115 * @return the ith argument (counting from 1) of this Compound
116 */
117 public final Term arg(int i) {
118 return args[i - 1];
119 }
120
121 /**
122 * Returns the arguments of this Compound (1..arity) of this Compound as an array[0..arity-1] of Term.
123 *
124 * @return the arguments (1..arity) of this Compound as an array[0..arity-1] of Term
125 */
126 public final Term[] args() {
127 return args;
128 }
129
130 /**
131 * Returns the arity (1+) of this Compound.
132 *
133 * @return the arity (1+) of this Compound
134 */
135 public final int arity() {
136 return args.length;
137 }
138
139 /**
140 * Two Compounds are equal if they are identical (same object) or their names and arities are equal and their respective arguments are equal.
141 *
142 * @param obj
143 * the Object to compare (not necessarily another Compound)
144 * @return true if the Object satisfies the above condition
145 */
146 public final boolean equals(Object obj) {
147 return (this == obj || (obj instanceof Compound && name.equals(((Compound) obj).name) && Term.terms_equals(args, ((Compound) obj).args)));
148 }
149
150 /**
151 * Nothing needs to be done except to pass the buck to this Compound's args.
152 *
153 * @param varnames_to_Terms
154 * A Map from variable names to JPL Terms
155 * @param vars_to_Vars
156 * A Map from Prolog variables to JPL Variables
157 */
158 protected final void getSubst(Map<String, Term> varnames_to_Terms, Map<term_t, Variable> vars_to_Vars) {
159 Term.getSubsts(varnames_to_Terms, vars_to_Vars, args);
160 }
161
162 /**
163 * Tests whether this Compound's functor has (String) 'name' and 'arity'.
164 *
165 * @return whether this Compound's functor has (String) 'name' and 'arity'
166 */
167 public final boolean hasFunctor(String name, int arity) {
168 return name.equals(this.name) && arity == args.length;
169 }
170
171 /**
172 * whether this Term is a 'jboolean' structure denoting Java's false, i.e. @(false)
173 *
174 * @return whether this Term is a 'jboolean' structure denoting Java's false, i.e. @(false)
175 */
176 public boolean isJFalse() {
177 return hasFunctor("@", 1) && arg(1).hasFunctor("false", 0);
178 }
179
180 /**
181 * whether this Term is a 'jnull' structure, i.e. @(null)
182 *
183 * @return whether this Term is a 'jnull' structure, i.e. @(null)
184 */
185 public boolean isJNull() {
186 return hasFunctor("@", 1) && arg(1).hasFunctor("null", 0);
187 }
188
189 /**
190 * whether this Term is a 'jobject' structure, i.e. @(Tag)
191 *
192 * @return whether this Term is a 'jobject' structure, i.e. @(Tag)
193 */
194 public boolean isJObject() {
195 return hasFunctor("@", 1) && arg(1).isAtom() && JPL.isTag(arg(1).name());
196 }
197
198 /**
199 * whether this Term is a 'jref' structure, i.e. @(Tag) or @(null)
200 *
201 * @return whether this Term is a 'jref' structure, i.e. @(Tag) or @(null)
202 */
203 public boolean isJRef() {
204 return isJObject() || isJNull();
205 }
206
207 /**
208 * whether this Term is a 'jboolean' structure denoting Java's true, i.e. @(true)
209 *
210 * @return whether this Term is a 'jboolean' structure denoting Java's true, i.e. @(true)
211 */
212 public boolean isJTrue() {
213 return hasFunctor("@", 1) && arg(1).hasFunctor("true", 0);
214 }
215
216 /**
217 * whether this Term is a 'jvoid' structure, i.e. @(void)
218 *
219 * @return whether this Term is a 'jvoid' structure, i.e. @(void)
220 */
221 public boolean isJVoid() {
222 return hasFunctor("@", 1) && arg(1).hasFunctor("void", 0);
223 }
224
225 /**
226 * whether this Term denotes (syntax-specifically) a list cell
227 *
228 * @return whether this Term denotes (syntax-specifically) a list cell
229 */
230 public final boolean isListPair() {
231 return args.length == 2 && name.equals(JPL.LIST_PAIR);
232 }
233
234 public Object jrefToObject() {
235 if (this.isJObject()) {
236 return Prolog.tag_to_object(arg(1).name());
237 } else if (this.isJNull()) {
238 return null;
239 } else {
240 throw new JPLException("term is not a JRef");
241 }
242 }
243
244 /**
245 * the name (unquoted) of this Compound
246 *
247 * @return the name (unquoted) of this Compound
248 */
249 public final String name() {
250 return name;
251 }
252
253 /**
254 * To put a Compound in a term, we create a sequence of term_t references from the Term.terms_to_term_ts() method, and then use the Prolog.cons_functor_v() method to create a Prolog compound term.
255 *
256 * @param varnames_to_vars
257 * A Map from variable names to Prolog variables
258 * @param term
259 * A (previously created) term_t which is to be set to a Prolog term corresponding to the Term subtype (Atom, Variable, Compound, etc.) on which the method is invoked.
260 */
261 protected void put(Map<String, term_t> varnames_to_vars, term_t term) {
262 // if (this instanceof Atom && this.equals(JPL.LIST_NIL)) {
263 // Prolog.put_nil(term);
264 // } else {
265 // Prolog.cons_functor_v(term, Prolog.new_functor(Prolog.new_atom(name), args.length), Term.putTerms(varnames_to_vars, args));
266 // }
267 Prolog.cons_functor_v(term, Prolog.new_functor(Prolog.new_atom(name), args.length), Term.putTerms(varnames_to_vars, args));
268 }
269
270 /**
271 * Sets the i-th (from 1) arg of this Compound to the given Term instance. This method, along with the Compound(name,arity) constructor, serves the new, native Prolog-term-to-Java-term routine,
272 * and is public only so as to be accessible via JNI: it is not intended for general use.
273 *
274 * @param i
275 * the index (1+) of the arg to be set
276 * @param arg
277 * the Term which is to become the i-th (from 1) arg of this Compound
278 */
279 public void setArg(int i, Term arg) {
280 if (i <= 0) {
281 throw new JPLException("bad (non-positive) argument index");
282 } else if (i > args.length) {
283 throw new JPLException("bad (out-of-range) argument index");
284 } else if (arg == null) {
285 throw new JPLException("bad (null) argument");
286 } else {
287 args[i - 1] = arg;
288 }
289 }
290
291 /**
292 * a prefix functional representation of a Compound of the form name(arg1,...), where 'name' is quoted iff necessary (to be valid Prolog soutce text) and each argument is represented according to
293 * its toString() method.
294 *
295 * @return string representation of an Compound
296 */
297 public String toString() {
298 return JPL.quotedName(name) + (args.length > 0 ? "(" + Term.toString(args) + ")" : "");
299 // return name() + (args.length > 0 ? "(" + Term.toString(args) + ")" : "");
300 }
301
302 /**
303 * the type of this term, as jpl.fli.Prolog.COMPOUND
304 *
305 * @return the type of this term, as jpl.fli.Prolog.COMPOUND
306 */
307 public int type() {
308 return Prolog.COMPOUND;
309 }
310
311 /**
312 * the name of the type of this term, as "Compound"
313 *
314 * @return the name of the type of this term, as "Compound"
315 */
316 public String typeName() {
317 return "Compound";
318 }
319
320 // /**
321 // * Returns the ith argument (counting from 0) of this Compound.
322 // *
323 // * @return the ith argument (counting from 0) of this Compound
324 // * @deprecated
325 // */
326 // public final Term arg0(int i) {
327 // return args[i];
328 // }
329
330 // /**
331 // * Returns a debug-friendly representation of a Compound.
332 // *
333 // * @return a debug-friendly representation of a Compound
334 // * @deprecated
335 // */
336 // public String debugString() {
337 // return "(Compound " + name + " " + Term.debugString(args) + ")";
338 // }
339
340 }
0 package org.jpl7;
1
2 import java.util.Map;
3
4 import org.jpl7.fli.Prolog;
5 import org.jpl7.fli.term_t;
6
7 /**
8 * Float is a specialised Term with a double field, representing a Prolog 64-bit ISO/IEC floating point value. Once constructed, a Float's value cannot be altered.
9 *
10 * <pre>
11 * Float f = new Float(3.14159265);
12 * </pre>
13 *
14 * A Float can be used (and re-used) in Compound Terms. Two Float instances are equal (by .equals()) iff their (double) values are equal.
15 *
16 * <hr>
17 * <i> Copyright (C) 2004 Paul Singleton
18 * <p>
19 * Copyright (C) 1998 Fred Dushin
20 * <p>
21 *
22 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
23 * License, or (at your option) any later version.
24 * <p>
25 *
26 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 * Library Public License for more details.
28 * <p>
29 * </i>
30 * <hr>
31 *
32 * @see org.jpl7.Term
33 * @see org.jpl7.Compound
34 */
35 public class Float extends Term {
36
37 /**
38 * this Float's immutable (double) value
39 */
40 protected final double value;
41
42 /**
43 * construct a Float with the supplied (double) value
44 *
45 * @param value
46 * this Float's value
47 */
48 public Float(double value) {
49 this.value = value;
50 }
51
52 /**
53 * the (zero) arguments of a Float, as a (zero-length) Term[]
54 *
55 * @return the (zero) arguments of a Float, as a (zero-length) Term[]
56 */
57 public Term[] args() {
58 return new Term[] {};
59 }
60
61 /**
62 * returns the (double) value of this Float
63 *
64 * @return the (double) value of this Float
65 */
66 public final double doubleValue() {
67 return this.value;
68 }
69
70 /**
71 * Two Floats are equal if they are the same object, or their values are equal
72 *
73 * @param obj
74 * The Object to compare
75 * @return true if the Object satisfies the above condition
76 */
77 public final boolean equals(Object obj) {
78 return this == obj || (obj instanceof Float && value == ((Float) obj).value);
79 }
80
81 /**
82 * returns the (double) value of this Float, converted to a float
83 *
84 * @return the (double) value of this Float, converted to a float
85 */
86 public final float floatValue() {
87 return (new Double(value)).floatValue();
88 }
89
90 /**
91 * Tests whether this Float's functor has (double) 'name' and 'arity'
92 *
93 * @return whether this Float's functor has (double) 'name' and 'arity'
94 */
95 public final boolean hasFunctor(double val, int arity) {
96 return val == this.value && arity == 0;
97 }
98
99 /**
100 * returns the (double) value of this Float, converted to an int
101 *
102 * @return the (double) value of this Float, converted to an int
103 */
104 public final int intValue() {
105 return (new Double(value)).intValue();
106 }
107
108 public Object jrefToObject() {
109 throw new JPLException("term is not a JRef");
110 }
111
112 /**
113 * returns the (double) value of this Float, converted to a long
114 *
115 * @return the (double) value of this Float, converted to a long
116 */
117 public final long longValue() {
118 return (new Double(value)).longValue();
119 }
120
121 /**
122 * To convert a JPL Float to a Prolog term, we put its value field into the term_t as a float.
123 *
124 * @param varnames_to_vars
125 * A Map from variable names to Prolog variables.
126 * @param term
127 * A (previously created) term_t which is to be set to a Prolog float corresponding to this Float's value
128 */
129 protected final void put(Map<String, term_t> varnames_to_vars, term_t term) {
130 Prolog.put_float(term, value);
131 }
132
133 /**
134 * Returns a Prolog source text representation of this Float
135 *
136 * @return a Prolog source text representation of this Float
137 */
138 public String toString() {
139 return "" + value + "";
140 }
141
142 public final int type() {
143 return Prolog.FLOAT;
144 }
145
146 public String typeName() {
147 return "Float";
148 }
149
150 // /**
151 // * The immutable value of this jpl.Float object, as a Java double
152 // *
153 // * @return the Float's value
154 // * @deprecated use one of doubleValue(), floatValue(), intValue(), longValue()
155 // */
156 // public double value() {
157 // return value;
158 // }
159
160 // /**
161 // * Returns a debug-friendly String representation of this Float
162 // *
163 // * @return a debug-friendly String representation of this Float
164 // * @deprecated
165 // */
166 // public String debugString() {
167 // return "(Float " + toString() + ")";
168 // }
169
170 }
0 package org.jpl7;
1
2 import java.math.BigInteger;
3 import java.util.Map;
4
5 import org.jpl7.fli.Prolog;
6 import org.jpl7.fli.term_t;
7
8 /**
9 * Integer is a specialised Term with a long field, representing a Prolog integer value.
10 *
11 * <pre>
12 * Integer i = new Integer(1024);
13 * </pre>
14 *
15 * Once constructed, the value of an Integer instance cannot be altered. An Integer can be used (and re-used) as an argument of Compounds. Beware confusing jpl.Integer with java.lang.Integer.
16 *
17 * <hr>
18 * <i> Copyright (C) 2004 Paul Singleton
19 * <p>
20 * Copyright (C) 1998 Fred Dushin
21 * <p>
22 *
23 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
24 * License, or (at your option) any later version.
25 * <p>
26 *
27 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28 * Library Public License for more details.
29 * <p>
30 * </i>
31 * <hr>
32 *
33 * @see org.jpl7.Term
34 * @see org.jpl7.Compound
35 */
36 public class Integer extends Term {
37 private static BigInteger BIG_MIN_LONG = BigInteger.valueOf(java.lang.Long.MIN_VALUE);
38 private static BigInteger BIG_MAX_LONG = BigInteger.valueOf(java.lang.Long.MAX_VALUE);
39
40 /**
41 * the Integer's immutable long value, iff small enough
42 */
43 protected final long value;
44
45 /**
46 * the Integer's immutable BigInteger value, iff too big for a long
47 */
48 protected final BigInteger bigValue;
49
50 /**
51 * @param value
52 * This Integer's intended (long) value
53 */
54 public Integer(long value) {
55 this.bigValue = null; // value fits in a long
56 this.value = value;
57 }
58
59 /**
60 * @param value
61 * This Integer's intended (BigInteger) value
62 */
63 public Integer(BigInteger value) {
64 if (value == null) {
65 throw new NullPointerException();
66 } else if (value.compareTo(BIG_MIN_LONG) >= 0 && value.compareTo(BIG_MAX_LONG) <= 0) { // BIG_MIN_LONG =< value =< BIG_MAX_LONG
67 this.bigValue = null; // value fits in a long
68 this.value = value.longValue();
69 } else {
70 this.bigValue = value;
71 this.value = 0; // undefined, but 0 by convention, iff bigValue != null
72 }
73 }
74
75 /**
76 * the (zero) arguments of an Integer, as a (zero-length) Term[]
77 *
78 * @return the (zero) arguments of an Integer, as a (zero-length) Term[]
79 */
80 public Term[] args() {
81 return new Term[] {};
82 }
83
84 /**
85 * Returns the value of this Integer converted to a double
86 *
87 * @return the value of this Integer converted to a double
88 */
89 public final double doubleValue() {
90 if (bigValue == null) {
91 return value;
92 } else {
93 return bigValue.doubleValue();
94 }
95 }
96
97 /**
98 * two Integer instances are equal if they are the same object, or if their values are equal
99 *
100 * @param obj
101 * The Object to compare (not necessarily an Integer)
102 * @return true if the Object satisfies the above condition
103 */
104 public final boolean equals(Object obj) {
105 return this == obj || (obj instanceof Integer && value == ((Integer) obj).value);
106 }
107
108 /**
109 * Returns the value of this Integer converted to a float
110 *
111 * @return the value of this Integer converted to a float
112 */
113 public final float floatValue() {
114 if (bigValue == null) {
115 return value;
116 } else {
117 return bigValue.floatValue();
118 }
119 }
120
121 /**
122 * whether this Integer's functor has (int) 'name' and 'arity' (c.f. traditional functor/3)
123 *
124 * @return whether this Integer's functor has (int) 'name' and 'arity'
125 */
126 public final boolean hasFunctor(int val, int arity) {
127 return val == this.value && arity == 0;
128 }
129
130 /**
131 * Returns the value of this Integer as an int if possible, else throws a JPLException
132 *
133 * @throws JPLException
134 * if the value of this Integer is too great to be represented as a Java int
135 * @return the int value of this Integer
136 */
137 public final int intValue() {
138 if (bigValue != null || value < java.lang.Integer.MIN_VALUE || value > java.lang.Integer.MAX_VALUE) {
139 throw new JPLException("cannot represent value as an int");
140 } else {
141 return (int) value;
142 }
143 }
144
145 /**
146 * @return whether this Integer's value is too big to represent as a long
147 */
148 protected final boolean isBig() {
149 return bigValue != null; // always canonical
150 }
151
152 public Object jrefToObject() {
153 throw new JPLException("term is not a jref");
154 }
155
156 /**
157 * Returns the value of this Integer as a long
158 *
159 * @return the value of this Integer as a long
160 */
161 public final long longValue() {
162 if (bigValue != null) { // iff value too big for a long (always canonical)
163 throw new JPLException("cannot represent value as a long");
164 } else {
165 return value;
166 }
167 }
168
169 /**
170 * Returns the value of this Integer as a java.math.BigInteger, whether or not it fits in a long
171 *
172 * @return the value of this Integer as a java.math.BigInteger, whether or not it fits in a long
173 */
174 public final BigInteger bigValue() {
175 if (bigValue == null) {
176 return new BigInteger(Long.toString(value)); // oddly (?) cannot construct directly from a long
177 } else {
178 return bigValue;
179 }
180 }
181
182 /**
183 * To convert an Integer into a Prolog term, we put its value into the term_t.
184 *
185 * @param varnames_to_vars
186 * A Map from variable names to Prolog variables.
187 * @param term
188 * A (previously created) term_t which is to be set to a Prolog integer
189 */
190 protected final void put(Map<String, term_t> varnames_to_vars, term_t term) {
191 if (isBig()) {
192 Prolog.put_integer_big(term, bigValue.toString());
193 } else {
194 Prolog.put_integer(term, value);
195 }
196 }
197
198 /**
199 * a Prolog source text representation of this Integer's value
200 *
201 * @return a Prolog source text representation of this Integer's value
202 */
203 public String toString() {
204 if (bigValue == null) {
205 return Long.toString(value);
206 } else {
207 return bigValue.toString(10);
208 }
209 }
210
211 /**
212 * the type of this term, as "Prolog.INTEGER"
213 *
214 * @return the type of this term, as "Prolog.INTEGER"
215 */
216 public final int type() {
217 return Prolog.INTEGER;
218 }
219
220 /**
221 * the name of the type of this term, as "Integer"
222 *
223 * @return the name of the type of this term, as "Integer"
224 */
225 public String typeName() {
226 return "Integer";
227 }
228
229 // /**
230 // * Returns the int value of this jpl.Integer
231 // *
232 // * @return the Integer's value
233 // * @deprecated use one of floatValue(), intValue(), longValue()
234 // */
235 // public final int value() {
236 // return (int) value;
237 // }
238
239 // /**
240 // * Returns a debug-friendly representation of this Integer's value
241 // *
242 // * @return a debug-friendly representation of this Integer's value
243 // * @deprecated
244 // */
245 // public String debugString() {
246 // return "(Integer " + toString() + ")";
247 // }
248
249 }
0 package org.jpl7;
1
2 import java.io.File;
3
4 import org.jpl7.fli.Prolog;
5
6 /**
7 * The jpl.JPL class contains methods which allow (i) inspection and alteration of the "default" initialisation arguments (ii) explicit initialisation (iii) discovery of whether the Prolog engine is
8 * already initialised, and if so, with what arguments. The Prolog engine must be initialized before any queries are made, but this will happen automatically (upon the first call to a Prolog FLI
9 * routine) if it has not already been done explicitly.
10 *
11 * <hr>
12 * <i> Copyright (C) 2004 Paul Singleton
13 * <p>
14 * Copyright (C) 1998 Fred Dushin
15 * <p>
16 *
17 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
18 * License, or (at your option) any later version.
19 * <p>
20 *
21 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Library Public License for more details.
23 * <p>
24 * </i>
25 * <hr>
26 *
27 */
28 public class JPL {
29 protected static final boolean DEBUG = false;
30
31 public static final Term JFALSE = new Compound("@", new Term[] { new Atom("false") });
32 public static final Term JTRUE = new Compound("@", new Term[] { new Atom("true") });
33 public static final Term JNULL = new Compound("@", new Term[] { new Atom("null") });
34 public static final Term JVOID = new Compound("@", new Term[] { new Atom("void") });
35
36 protected static boolean modeDontTellMe = true;
37
38 protected static final Atom LIST_NIL_MODERN = new Atom("[]", "reserved_symbol"); // NB an actual Atom (see LIST_PAIR_MODERN below)
39 protected static final Atom LIST_NIL_TRADITIONAL = new Atom("[]", "text");
40 public static Atom LIST_NIL = LIST_NIL_MODERN; // default unless/until setTraditional() is called successfully
41
42 protected static final String LIST_PAIR_MODERN = "[|]"; // NB just the name of the functor (see LIST_NIL_MODERN above)
43 protected static final String LIST_PAIR_TRADITIONAL = ".";
44 public static String LIST_PAIR = LIST_PAIR_MODERN; // default unless/until setTraditional() is called successfully
45
46 private static String nativeLibraryName = "jpl";
47 private static String nativeLibraryDir = null;
48 private static String nativeLibraryPath = null;
49
50 public static String setNativeLibraryName(String newName) {
51 if (newName == null) {
52 throw new NullPointerException("newName cannot be null");
53 } else {
54 String oldName = nativeLibraryName;
55 nativeLibraryName = newName;
56 return oldName;
57 }
58 }
59
60 public static String setNativeLibraryDir(String newDir) {
61 String oldDir = nativeLibraryDir;
62 nativeLibraryDir = newDir;
63 return oldDir;
64 }
65
66 public static String setNativeLibraryPath(String newPath) {
67 String oldPath = nativeLibraryPath;
68 nativeLibraryPath = newPath;
69 return oldPath;
70 }
71
72 public static void loadNativeLibrary() {
73 if (nativeLibraryPath != null) {
74 System.load((new File(nativeLibraryPath)).getAbsolutePath());
75 } else if (nativeLibraryDir != null) {
76 System.load((new File(nativeLibraryDir, System.mapLibraryName(nativeLibraryName))).getAbsolutePath());
77 } else {
78 System.loadLibrary(nativeLibraryName); // as resolved somewhere on system property 'java.library.path'
79 }
80 }
81
82 public static String jarPath() {
83 try {
84 return Class.forName("org.jpl7.JPL").getProtectionDomain().getCodeSource().getLocation().toString();
85 } catch (ClassNotFoundException e) {
86 return "";
87 }
88 }
89
90 /**
91 * Sets the global "dont-tell-me" mode (default value: true). When 'true', bindings will *not* be returned for any variable (in a Query's goal) whose name begins with an underscore character
92 * (except for "anonymous" variables, i.e. those whose name comprises just the underscore character, whose bindings are never returned). When 'false', bindings are returned for *all* variables
93 * except anonymous ones; this mode may be useful when traditional top-level interpreter behaviour is wanted, e.g. in a Java-based Prolog IDE or debugger.
94 * <p>
95 * This method should be regarded as experimental, and may subsequently be deprecated in favour of some more general mechanism for setting options, perhaps per-Query and per-call as well as
96 * globally.
97 *
98 * @param dtm
99 * new "dont-tell-me" mode value
100 */
101 public static void setDTMMode(boolean dtm) {
102 modeDontTellMe = dtm;
103 }
104
105 public static void setTraditional() {
106 if (getSyntax().equals("modern")) {
107 if (getActualInitArgs() == null) { // i.e. Prolog is not yet initialised
108 LIST_NIL = LIST_NIL_TRADITIONAL;
109 LIST_PAIR = LIST_PAIR_TRADITIONAL;
110 setDefaultInitArgs(argsEnsureSyntax(getDefaultInitArgs())); // ensure that default init args contain "--traditional"
111 } else {
112 throw new JPLException("cannot switch to traditional syntax after Prolog is initialised");
113 }
114 } else {
115 // benign attempt to set traditional when already using that syntax
116 }
117 }
118
119 public static void setTraditionalAnyway() {
120 LIST_NIL = LIST_NIL_TRADITIONAL;
121 LIST_PAIR = LIST_PAIR_TRADITIONAL;
122 }
123
124 public static String getSyntax() {
125 if (LIST_PAIR.equals(LIST_PAIR_MODERN)) {
126 return "modern";
127 } else if (LIST_PAIR.equals(LIST_PAIR_TRADITIONAL)) {
128 return "traditional";
129 } else {
130 throw new JPLException("syntax is neither traditional nor modern");
131 }
132 }
133
134 /**
135 * Returns, in an array of String, the sequence of command-line arguments that would be used if the Prolog engine were to be initialised now. Returns null if the Prolog VM has already been
136 * initialised (in which case the default init args are irrelevant and the actual init args are of interest)
137 * <p>
138 *
139 * @see org.jpl7.JPL#getActualInitArgs
140 * @return current default initialisation arguments, or null if already initialised
141 */
142 public static String[] getDefaultInitArgs() {
143 return Prolog.get_default_init_args();
144 }
145
146 /**
147 * Specifies, in an array of String, the sequence of command-line arguments that should be used if the Prolog engine is subsequently initialised.
148 * <p>
149 *
150 * @param args
151 * new default initialization arguments
152 */
153 public static void setDefaultInitArgs(String[] args) {
154 Prolog.set_default_init_args(argsEnsureSyntax(args));
155 }
156
157 private static String[] argsEnsureSyntax(String[] argsA) {
158 String[] argsC; // return value
159 int qtyTrad = 0; // provisional # occurrences of "--traditional" in given args (oughta be 0 or 1, but we cope with 2+)
160 for (int iA = 0; iA < argsA.length; iA++) {
161 if (argsA[iA].equals("--traditional")) {
162 qtyTrad++;
163 }
164 }
165 String argsB[] = new String[argsA.length - qtyTrad]; // for given args stripped of all "--traditional"
166 for (int iA = 0, iB = 0; iA < argsA.length; iA++) {
167 if (!argsA[iA].equals("--traditional")) {
168 argsB[iB++] = argsA[iA];
169 }
170 }
171 if (getSyntax().equals("modern")) {
172 argsC = argsB;
173 } else {
174 argsC = new String[argsB.length + 1];
175 argsC[0] = argsB[0]; // e.g. "swipl"
176 argsC[1] = "--traditional";
177 for (int iB = 1, iC = 2; iB < argsB.length; iB++) {
178 argsC[iC++] = argsB[iB];
179 }
180 }
181 return argsC;
182 }
183
184 /**
185 * Returns, in an array of String, the sequence of command-line arguments that were actually used when the Prolog engine was formerly initialised.
186 *
187 * This method returns null if the Prolog engine has not yet been initialised, and thus may be used to test this condition.
188 *
189 * @return actual initialization arguments
190 */
191 public static String[] getActualInitArgs() {
192 return Prolog.get_actual_init_args();
193 }
194
195 /**
196 * Initializes the Prolog engine, using the String argument parameters passed. This method need be called only if you want to both (i) initialise the Prolog engine with parameters other than the
197 * default ones and (ii) force initialisation to occur (rather than allow it to occur automatically at the first query). For parameter options, consult your local Prolog documentation. The
198 * parameter values are passed directly to initialization routines for the Prolog environment.
199 * <p>
200 *
201 * This method must be called before making any queries.
202 *
203 * @param args
204 * Initialization parameter list
205 */
206 public static boolean init(String[] args) {
207 return Prolog.set_default_init_args(args) && init();
208 }
209
210 /**
211 * Initialises the Prolog engine using the current default initialisation parameters, and returns 'true' (or 'false' if already initialised).
212 */
213 public static boolean init() {
214 return Prolog.initialise();
215 }
216
217 /**
218 * @param s
219 * @return whether s is a simple name, i.e. which needs no quoting in source text
220 */
221 protected static boolean isSimpleName(String s) {
222 int len;
223 char c;
224 if (s == null) {
225 throw new java.lang.NullPointerException(); // JPL won't call it this way
226 } else if ((len = s.length()) == 0) {
227 return false;
228 } else if ((c = s.charAt(0)) < 'a' || c > 'z') {
229 return false;
230 } else {
231 for (int i = 1; i < len; i++) {
232 c = s.charAt(i);
233 if (!(c == '_' || c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z' || c >= '0' && c <= '9')) {
234 return false;
235 }
236 }
237 return true;
238 }
239 }
240
241 /**
242 * whether the String arg is a plausible tag, e.g. "J#0123456789".
243 */
244 public static boolean isTag(String s) {
245 return s.length() == 22 && s.charAt(0) == 'J' && s.charAt(1) == '#' && Character.isDigit(s.charAt(2)) && Character.isDigit(s.charAt(3)) && Character.isDigit(s.charAt(4))
246 && Character.isDigit(s.charAt(5)) && Character.isDigit(s.charAt(6)) && Character.isDigit(s.charAt(7)) && Character.isDigit(s.charAt(8)) && Character.isDigit(s.charAt(9))
247 && Character.isDigit(s.charAt(10)) && Character.isDigit(s.charAt(11)) && Character.isDigit(s.charAt(12)) && Character.isDigit(s.charAt(13)) && Character.isDigit(s.charAt(14))
248 && Character.isDigit(s.charAt(15)) && Character.isDigit(s.charAt(16)) && Character.isDigit(s.charAt(17)) && Character.isDigit(s.charAt(18)) && Character.isDigit(s.charAt(19))
249 && Character.isDigit(s.charAt(20)) && Character.isDigit(s.charAt(21));
250 }
251
252 /**
253 * returns a new Term instance which represents the given object
254 */
255 public static Term newJRef(Object obj) {
256 return new Compound("@", new Term[] { new Atom(Prolog.object_to_tag(obj)) });
257 }
258
259 /**
260 * Returns a quoted (iff necessary) form of the Atom's name, as understood by Prolog read/1
261 *
262 * @return a quoted form of the Atom's name, as understood by Prolog read/1
263 */
264 protected static String quotedName(String name) {
265 return (isSimpleName(name) ? name : "'" + name + "'");
266 }
267
268 /**
269 * Terminates the Prolog session.
270 * <p>
271 *
272 * <b>Note.</b> This method calls the FLI halt() method with a status of 0, but the halt method currently is a no-op in SWI.
273 *
274 * @deprecated
275 */
276 public static void halt() {
277 Prolog.halt(0);
278 }
279
280 // a static reference to the current Version
281 private static final Version version_ = new Version();
282
283 /**
284 * Returns (as a Version) an identification of this version of JPL.
285 *
286 * @return the running version of JPL.
287 */
288 public static Version version() {
289 return version_;
290 }
291
292 /**
293 * Returns a String (eg "3.0.0-alpha") identifying this version of JPL.
294 *
295 * @return a String (eg "3.0.0-alpha") identifying this version of JPL.
296 */
297 public static String version_string() {
298 return version_.major + "." + version_.minor + "." + version_.patch + "-" + version_.status;
299 }
300
301 public static void main(String[] args) {
302 System.out.println(version_string());
303 }
304 }
0 package org.jpl7;
1
2 /**
3 * This is the base class for exceptions thrown by JPL's Java-calls-Prolog interface. Such exceptions represent errors and exceptional conditions within the interface code itself; see
4 * jpl.PrologException for the way Prolog exceptions are returned to calling Java code.
5 * <hr>
6 * <i> Copyright (C) 2004 Paul Singleton
7 * <p>
8 * Copyright (C) 1998 Fred Dushin
9 * <p>
10 *
11 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
12 * License, or (at your option) any later version.
13 * <p>
14 *
15 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library Public License for more details.
17 * <p>
18 * </i>
19 * <hr>
20 *
21 * @author Fred Dushin <fadushin@syr.edu>
22 * @version $Revision$
23 */
24 public class JPLException extends RuntimeException {
25 private static final long serialVersionUID = 1L;
26
27 public JPLException() {
28 super();
29 }
30
31 public JPLException(String s) {
32 super(s);
33 }
34 }
0 package org.jpl7;
1
2 import java.util.Map;
3
4 import org.jpl7.fli.Prolog;
5 import org.jpl7.fli.term_t;
6
7 /**
8 * JRef is a specialised Term with an Object field, representing JPL's Prolog references to Java objects (or to null).
9 *
10 * <pre>
11 * JRef r = new JRef(non_String_object_or_null);
12 * </pre>
13 *
14 * A JRef can be used (and re-used) in Compound Terms.
15 *
16 * <hr>
17 * <i> Copyright (C) 2004 Paul Singleton
18 * <p>
19 * Copyright (C) 1998 Fred Dushin
20 * <p>
21 *
22 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
23 * License, or (at your option) any later version.
24 * <p>
25 *
26 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 * Library Public License for more details.
28 * <p>
29 * </i>
30 * <hr>
31 *
32 * @author Fred Dushin <fadushin@syr.edu>
33 * @version $Revision$
34 * @see org.jpl7.Term
35 * @see org.jpl7.Compound
36 *
37 * @deprecated
38 */
39 public class JRef extends Term {
40
41 /**
42 * the JRef's value (a non-String Object or null)
43 */
44 protected final Object ref;
45
46 /**
47 * This constructor creates a JRef, initialized with the supplied non-String object (or null).
48 *
49 * @param ref
50 * this JRef's value (a non-String object, or null)
51 */
52 public JRef(Object ref) {
53 if (ref instanceof String) {
54 throw new JPLException("a JRef cannot have a String value (String maps to atom)");
55 } else {
56 this.ref = ref;
57 }
58 }
59
60 public Term arg(int ano) {
61 return (ano == 1 ? new Atom(org.jpl7.fli.Prolog.object_to_tag(ref)) : null);
62 }
63
64 /**
65 * Two JRefs are equal if their references are identical (?)
66 *
67 * @param obj
68 * The Object to compare
69 * @return true if the Object satisfies the above condition
70 */
71 public final boolean equals(Object obj) {
72 return this == obj || (obj instanceof JRef && ref == ((JRef) obj).ref);
73 }
74
75 public boolean hasFunctor(String name, int arity) {
76 return name != null && name.equals("@") && arity == 1;
77 }
78
79 public Object jrefToObject() {
80 return ref;
81 }
82
83 /**
84 * To convert a JRef to a term, we put its Object field (.value) into the term_t as a JPL ref (i.e. @/1) structure.
85 *
86 * @param varnames_to_vars
87 * A Map from variable names to Prolog variables.
88 * @param term
89 * A (newly created) term_t which is to be set to a Prolog 'ref' (i.e. @/1) structure denoting the .value of this JRef instance
90 */
91 protected final void put(Map<String, term_t> varnames_to_vars, term_t term) {
92 Prolog.put_jref(term, ref);
93 }
94
95 /**
96 * The non-String object (or null) which this jpl.JRef represents
97 *
98 * @return the non-String object (or null) which this jpl.JRef represents
99 */
100 public Object ref() {
101 return ref;
102 }
103
104 /**
105 * Returns a Prolog source text representation of this JRef
106 *
107 * @return a Prolog source text representation of this JRef
108 */
109 public String toString() {
110 return "" + ref + ""; // WRONG
111 }
112
113 public final int type() {
114 return Prolog.JREF;
115 }
116
117 public String typeName() {
118 return "JRef";
119 }
120
121 // /**
122 // * Returns a debug-friendly representation of this JRef
123 // *
124 // * @return a debug-friendly representation of this JRef
125 // * @deprecated
126 // */
127 // public String debugString() {
128 // return "(JRef " + toString() + ")";
129 // }
130
131 }
0 package org.jpl7;
1
2 /**
3 * PrologException instances wrap Prolog exceptions thrown (either by a Prolog engine or by user code) in the course of finding a solution to a Query. See JPLException for the handling of errors
4 * within the JPL Java-calls-Prolog interface.
5 * <p>
6 * This class allows Java code which uses JPL's Java-calls-Prolog API to handle Prolog exceptions, which is in general necessary for hybrid Java+Prolog programming.
7 * <p>
8 * Use the term() accessor to obtain a Term representation of the term that was thrown from within Prolog.
9 *
10 * <hr>
11 * <i> Copyright (C) 2004 Paul Singleton
12 * <p>
13 * Copyright (C) 1998 Fred Dushin
14 * <p>
15 *
16 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
17 * License, or (at your option) any later version.
18 * <p>
19 *
20 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Library Public License for more details.
22 * <p>
23 * </i>
24 * <hr>
25 *
26 * @author Fred Dushin <fadushin@syr.edu>
27 * @version $Revision$
28 */
29 public final class PrologException extends JPLException {
30 private static final long serialVersionUID = 1L;
31 private Term term_ = null;
32
33 protected PrologException(Term term) {
34 super("PrologException: " + term.toString());
35 this.term_ = term;
36 }
37
38 /**
39 * @return a reference to the Term thrown by the call to throw/1
40 */
41 public Term term() {
42 return this.term_;
43 }
44 }
0 package org.jpl7;
1
2 import java.util.ArrayList;
3 import java.util.HashMap;
4 import java.util.Iterator;
5 import java.util.List;
6 import java.util.Map;
7
8 import org.jpl7.fli.Prolog;
9 import org.jpl7.fli.engine_t;
10 import org.jpl7.fli.fid_t;
11 import org.jpl7.fli.predicate_t;
12 import org.jpl7.fli.qid_t;
13 import org.jpl7.fli.term_t;
14
15 /**
16 * A Query instance is created by an application in order to query the Prolog database (or to invoke a built-in predicate). It is initialised with a Compound (or Atom) denoting the goal which is to be
17 * called, and also contains assorted private state relating to solutions. In some future version, it may contain details of the module in which the goal is to be called.
18 * <p>
19 * A Query is either open or closed: when closed, it has no connection to the Prolog system; when open, it is linked to an active goal within a Prolog engine.
20 * <p>
21 * The Query class implements the Enumeration interface, through which one can obtain successive solutions. The Enumeration hasMoreElements() method returns true if the call or redo succeeded
22 * (otherwise false), and if the call or redo did succeed, the nextElement() method returns a Map representing variable bindings; the elements in the Map are Terms, indexed by the (String) names of
23 * the Variables with which they are associated. For example, if <i>p(a)</i> and <i>p(b)</i> are facts in the Prolog database, then the following is equivalent to printing all the solutions to the
24 * Prolog query <i>p(X)</i>:
25 *
26 * <pre>
27 * Variable X = new Variable(&quot;X&quot;);
28 * Term arg[] = { X };
29 * Query q = new Query(&quot;p&quot;, arg);
30 *
31 * while (q.hasMoreElements()) {
32 * Term bound_to_x = ((Map) q.nextElement()).get(&quot;X&quot;);
33 * System.out.println(bound_to_x);
34 * }
35 * </pre>
36 *
37 * Make sure to close the Query (using the close() method) if you do not need any further solutions which it may have. It is safe (although redundant) to close a Query whose solutions are already
38 * exhausted, or which is already closed.
39 *
40 * To obtain just one solution from a Query, use the oneSolution() method.
41 *
42 * To obtain all solutions, use the allSolutions() method.
43 *
44 * To obtain at most N solutions, use the nSolutions() method.
45 *
46 * To determine merely whether the Query is provable, use the hasSolution() method (i.e. has at least one solution).
47 * <hr>
48 * <i> Copyright (C) 2007 Paul Singleton
49 * <p>
50 * Copyright (C) 1998 Fred Dushin
51 * <p>
52 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
53 * License, or (at your option) any later version.
54 * <p>
55 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
56 * Library Public License for more details.
57 * <p>
58 * </i>
59 * <hr>
60 *
61 * @author Fred Dushin <fadushin@syr.edu>
62 * @version $Revision$
63 */
64 public class Query implements Iterable<Map<String, Term>>, Iterator<Map<String, Term>> { // was Enumeration<Object>
65 private static Map<Long, Query> m = new HashMap<Long, Query>(); // maps (engine_t) engine handle to (Query) topmost query
66 /**
67 * the Compound or Atom (but not Dict, Float, Integer or Variable) corresponding to the goal of this Query
68 */
69 protected final Term goal_; // an Atom or Compound; set by all initialisers
70 protected final String hostModule = "user"; // until revised constructors allow this to be specified
71 protected final String contextModule = "user"; // until revised constructors allow this to be specified
72
73 /**
74 * Returns the Term (Atom or Compound) which is the goal of this Query
75 *
76 * @return a Term representing the goal of this Query
77 */
78 public final Term goal() {
79 return goal_;
80 }
81
82 /**
83 * This constructor creates a Query whose goal is the specified Term. The Query is initially closed. <b>NB</b> Creating an instance of the Query class does not result in a call to a Prolog engine.
84 * <b>NB</b> The goal can be a Compound or an Atom (Atom extends Compound), but cannot be an instance of jpl.Float, jpl.Integer or jpl.Variable.
85 *
86 * @param t
87 * the goal of this Query
88 */
89 public Query(Term t) { // formerly insisted (confusingly) on a Compound (or Atom)
90 this.goal_ = Query1(t);
91 }
92
93 private Term Query1(Term t) {
94 if (t instanceof Atom) {
95 return t;
96 } else if (t instanceof Compound) {
97 return t;
98 } else if (t instanceof Float) {
99 throw new JPLException("a Query's goal must be an Atom or Compound (not a Float)");
100 } else if (t instanceof Integer) {
101 throw new JPLException("a Query's goal must be an Atom or Compound (not an Integer)");
102 } else if (t instanceof Variable) {
103 throw new JPLException("a Query's goal must be an Atom or Compound (not a Variable)");
104 } else {
105 throw new JPLException("a Query's goal must be an Atom or Compound");
106 }
107 }
108
109 /**
110 * If text denotes an atom, this constructor is shorthand for <font face="monospace">new Query(new Compound(name,args))</font>, but if text denotes a term containing N query (?) symbols and there
111 * are N args, each query is replaced by its corresponding arg to provide the new Query's goal.
112 *
113 * @param text
114 * the name of the principal functor of this Query's goal
115 * @param args
116 * the arguments of this Query's goal
117 */
118 public Query(String text, Term[] args) {
119 this(Query1(text, args));
120 }
121
122 // convenience case for a single arg
123 public Query(String text, Term arg) {
124 this(Query1(text, new Term[] { arg }));
125 }
126
127 private static Term Query1(String text, Term[] args) {
128 Term t = Util.textToTerm(text);
129 if (t instanceof Atom) {
130 return new Compound(text, args);
131 } else {
132 return t.putParams(args);
133 }
134 }
135
136 /**
137 * This constructor builds a Query from the given Prolog source text. Throws PrologException containing error(syntax_error(_),_) if text is invalid.
138 *
139 * @param text
140 * the Prolog source text of this Query
141 */
142 public Query(String text) {
143 this(Util.textToTerm(text));
144 }
145
146 /**
147 * a Query is its own Iterator
148 *
149 * @see java.lang.Iterable#iterator()
150 */
151 public Iterator<Map<String, Term>> iterator() {
152 return this;
153 }
154
155 /**
156 * whether this Query has a (further) solution
157 *
158 * @see java.util.Iterator#hasNext()
159 */
160 public boolean hasNext() {
161 if (!open) { // lazily open the Query, enabling it to be its own iterator
162 open();
163 }
164 return get1();
165 }
166
167 /**
168 * this Query's next solution
169 *
170 * @see java.util.Iterator#next()
171 */
172 public Map<String, Term> next() {
173 return nextSolution();
174 }
175
176 /**
177 * this method (required by Iterator interface) is a no-op
178 *
179 * @see java.util.Iterator#remove()
180 */
181 public void remove() {
182 // no op
183 }
184
185 /**
186 * These variables are used and set across the hasMoreElements and nextElement Enumeration interface implementation
187 */
188 private boolean open = false;
189 // the following state variables are used and defined only if this query is open:
190 private engine_t engine = null; // handle of attached Prolog engine iff open, else null
191 private Query subQuery = null; // the open Query (if any) on top of which this open Query is stacked, else null
192 private predicate_t predicate = null; // handle of this Query's predicate iff open, else undefined
193 private fid_t fid = null; // id of current Prolog foreign frame iff open, else null
194 private term_t term0 = null; // term refs of this Query's args iff open, else undefined
195 private qid_t qid = null; // id of current Prolog query iff open, else null
196
197 //
198 /**
199 * isOpen() returns true iff the query is open.
200 *
201 * @return true if the query is open, otherwise false.
202 */
203 public synchronized final boolean isOpen() {
204 return open;
205 }
206
207 /**
208 * This method returns true if JPL was able to initiate a "call" of this Query within a Prolog engine. It is designed to be used with the nextSolution() method to retrieve one or more
209 * substitutions in the form of Maps. To iterate through all the solutions to a Query, for example, one might write
210 *
211 * <pre>
212 * Query q = // obtain Query reference
213 * while (q.hasMoreSolutions()) {
214 * Map solution = q.nextSolution();
215 * // process solution...
216 * }
217 * </pre>
218 *
219 * To ensure thread-safety, you should wrap sequential calls to this method in a synchronized block, using the static lock method to obtain the monitor.
220 *
221 * <pre>
222 * Query q = // obtain Query reference
223 * synchronized ( jpl.Query.lock() ){
224 * while ( q.hasMoreElements() ){
225 * Map solution = q.nextSolution();
226 * // process solution...
227 * }
228 * }
229 * </pre>
230 *
231 * @return true if the Prolog query succeeds; otherwise false.
232 */
233 public synchronized final boolean hasMoreSolutions() {
234 if (!open) {
235 open();
236 }
237 return get1();
238 }
239
240 /**
241 * This method returns true if JPL was able to initiate a "call" of this Query within the Prolog engine. It is designed to be used with the getSolution() and close() methods to retrieve one or
242 * more substitutions in the form of Maps.
243 *
244 * <pre>
245 * Query q = // obtain Query reference
246 * Map soln;
247 * q.open();
248 * while ((soln = q.getSolution()) != null) {
249 * // process solution...
250 * }
251 * </pre>
252 * <p>
253 * If this method is called on an already-open Query, or if the query cannot be set up for whatever reason, then a JPLException will be thrown.
254 */
255 public synchronized final void open() {
256 if (open) {
257 throw new JPLException("Query is already open");
258 }
259 if (Prolog.thread_self() == -1) { // this Java thread has no attached Prolog engine?
260 engine = Prolog.attach_pool_engine(); // may block for a while, or fail
261 // System.out.println("JPL attaching engine[" + engine.value + "] for " + this.hashCode() + ":" + this.toString());
262 } else { // this Java thread has an attached engine
263 engine = Prolog.current_engine();
264 // System.out.println("JPL reusing engine[" + engine.value + "] for " + this.hashCode() + ":" + this.toString());
265 }
266 if (m.containsKey(new Long(engine.value))) {
267 subQuery = m.get(new Long(engine.value)); // get this engine's previous topmost query
268 // System.out.println("JPL reusing engine[" + engine.value + "] pushing " + subQuery.hashCode() + ":" + subQuery.toString());
269 } else {
270 subQuery = null;
271 }
272 m.put(new Long(engine.value), this); // update this engine's topmost query
273 //
274 // here, we must check for a module prefix, e.g. jpl:jpl_modifier_bit(volatile,T)
275 String module;
276 Term goal;
277 if (goal_.hasFunctor(":", 2)) {
278 if (goal_.arg(1).isAtom()) {
279 module = goal_.arg(1).name();
280 } else if (goal_.arg(1).isVariable()) {
281 throw new PrologException(Util.textParamsToTerm("error(instantiation_error,?)", new Term[] { goal_ }));
282 } else {
283 throw new PrologException(Util.textParamsToTerm("error(type_error(atom,?),?)", new Term[] { goal_.arg(1), goal_ }));
284 }
285 goal = goal_.arg(2);
286 } else {
287 module = contextModule;
288 goal = goal_;
289 }
290 predicate = Prolog.predicate(goal.name(), goal.arity(), module); // was hostModule
291 fid = Prolog.open_foreign_frame();
292 Map<String, term_t> varnames_to_vars = new HashMap<String, term_t>();
293 term0 = Term.putTerms(varnames_to_vars, goal.args());
294 // THINKS: invert varnames_to_Vars and use it when getting substitutions?
295 qid = Prolog.open_query(Prolog.new_module(Prolog.new_atom(contextModule)), Prolog.Q_CATCH_EXCEPTION, predicate, term0);
296 open = true;
297 }
298
299 private final boolean get1() { // try to get the next solution; if none, close the query;
300 if (Prolog.next_solution(qid)) {
301 return true;
302 } else { // if failure was due to throw/1, build exception term and throw it
303 term_t exception_term_t = Prolog.exception(qid);
304 if (exception_term_t.value != 0L) {
305 Term exception_term = Term.getTerm(new HashMap<term_t, Variable>(), exception_term_t);
306 close();
307 throw new PrologException(exception_term);
308 } else {
309 close();
310 return false;
311 }
312 }
313 }
314
315 /**
316 * This method returns a java.util.Map, which represents a set of bindings from the names of query variables to terms within the solution.
317 * <p>
318 * For example, if a Query has an occurrence of a jpl.Variable, say, named "X", one can obtain the Term bound to "X" in the solution by looking up "X" in the Map.
319 *
320 * <pre>
321 * Variable x = new Variable("X");
322 * Query q = // obtain Query reference (with x in the Term array)
323 * while (q.hasMoreSolutions()) {
324 * Map solution = q.nextSolution();
325 * // make t the Term bound to "X" in the solution
326 * Term t = (Term) solution.get("X");
327 * // ...
328 * }
329 * </pre>
330 *
331 * Programmers should obey the following rules when using this method. <menu>
332 * <li>The nextSolution() method should only be called after the hasMoreSolutions() method returns true; otherwise a JPLException will be raised, indicating that the Query is no longer open.
333 * <li>The nextSolution() and hasMoreSolutions() should be called in the same thread of execution, for a given Query instance. </menu>
334 *
335 * This method will throw a JPLException if Query is not open.
336 *
337 * @return A Map representing a substitution, or null
338 */
339 public synchronized final Map<String, Term> getSolution() {
340 // oughta check: thread has query's engine
341 if (!open) {
342 throw new JPLException("Query is not open");
343 } else if (get1()) {
344 return get2();
345 } else {
346 return null;
347 }
348 }
349
350 public synchronized final Map<String, Term> getSubstWithNameVars() {
351 // oughta check: thread has query's engine
352 if (!open) {
353 throw new JPLException("Query is not open");
354 } else if (get1()) {
355 return get2WithNameVars();
356 } else {
357 return null;
358 }
359 }
360
361 /**
362 * This method returns a java.util.Map, which represents a binding from the names of query variables to terms within the solution.
363 * <p>
364 * For example, if a Query has an occurrence of a jpl.Variable, say, named "X", one can obtain the Term bound to "X" in the solution by looking up "X" in the Map.
365 *
366 * <pre>
367 * Variable x = new Variable("X");
368 * Query q = // obtain Query reference (with x in the Term array)
369 * while (q.hasMoreSolutions()) {
370 * Map solution = q.nextSolution();
371 * // make t the Term bound to "X" in the solution
372 * Term t = (Term) solution.get("X");
373 * // ...
374 * }
375 * </pre>
376 *
377 * Programmers should obey the following rules when using this method. <menu>
378 * <li>The nextSolution() method should only be called after the hasMoreSolutions() method returns true; otherwise a JPLException will be raised, indicating that the Query is no longer open.
379 * <li>The nextSolution() and hasMoreSolutions() should be called in the same thread of execution, for a given Query instance. </menu>
380 *
381 * This method will throw a JPLException if Query is not open.
382 *
383 * @return A Map representing a substitution.
384 */
385 public synchronized final Map<String, Term> nextSolution() {
386 return get2();
387 }
388
389 private final Map<String, Term> get2() {
390 if (!open) {
391 throw new JPLException("Query is not open");
392 } else {
393 Map<String, Term> substitution = new HashMap<String, Term>();
394 Term.getSubsts(substitution, new HashMap<term_t, Variable>(), goal_.args()); // NB I reckon getSubsts needn't be in Term (but where else?)
395 return substitution;
396 }
397 }
398
399 // assumes that Query's last arg is a Variable which will be bound to [Name=Var,..]
400 private final Map<String, Term> get2WithNameVars() {
401 if (!open) {
402 throw new JPLException("Query is not open");
403 } else {
404 Term[] args = goal_.args(); // for slight convenience below
405 Term argNV = args[args.length - 1]; // the Query's last arg
406 String nameNV = ((Variable) argNV).name; // its name
407 // get [Name=Var,..] from the last arg
408 Map<String, Term> varnames_to_Terms1 = new HashMap<String, Term>();
409 Map<term_t, Variable> vars_to_Vars1 = new HashMap<term_t, Variable>();
410 args[args.length - 1].getSubst(varnames_to_Terms1, vars_to_Vars1);
411 Map<String, Term> varnames_to_Terms2 = new HashMap<String, Term>();
412 Term nvs = varnames_to_Terms1.get(nameNV);
413 Map<term_t, Variable> vars_to_Vars2 = Util.namevarsToMap(nvs);
414 for (int i = 0; i < args.length - 1; ++i) {
415 args[i].getSubst(varnames_to_Terms2, vars_to_Vars2);
416 }
417 return varnames_to_Terms2;
418 }
419 }
420
421 /**
422 * This method implements part of the java.util.Enumeration interface. It is a wrapper for hasMoreSolutions.
423 *
424 * @return true if the Prolog query yields a (or another) solution, else false.
425 */
426 public synchronized final boolean hasMoreElements() {
427 return hasMoreSolutions();
428 }
429
430 /**
431 * This method implements part of the java.util.Enumeration interface. It is a wrapper for nextSolution.
432 * <p>
433 *
434 * @return A Map representing a substitution.
435 */
436 public synchronized final Object nextElement() {
437 return nextSolution();
438 }
439
440 /**
441 * This method can be used to close an open query before its solutions are exhausted. It is called automatically when solutions are exhausted. Calling close() on an already closed Query has no
442 * effect.
443 * <p>
444 *
445 * Here is one way to get the first three solutions to a Query:
446 *
447 * <pre>
448 * Query q = new Query(predicate, args);
449 * Map&lt;String, Term&gt; sub1 = q.nextSolution();
450 * Map&lt;String, Term&gt; sub2 = q.nextSolution();
451 * Map&lt;String, Term&gt; sub3 = q.nextSolution();
452 * q.close();
453 * </pre>
454 * <p>
455 */
456 public synchronized final void close() {
457 if (!open) {
458 return; // it is not an error to attempt to close a closed Query
459 }
460 if (Prolog.thread_self() == -1) {
461 throw new JPLException("no engine is attached to this thread");
462 }
463 if (Prolog.current_engine().value != engine.value) {
464 throw new JPLException("this Query's engine is not that which is attached to this thread");
465 }
466 Query topmost = m.get(new Long(engine.value));
467 if (topmost != this) {
468 throw new JPLException("this Query (" + this.hashCode() + ":" + this.toString() + ") is not topmost (" + topmost.hashCode() + ":" + topmost.toString() + ") within its engine["
469 + engine.value + "]");
470 }
471 Prolog.close_query(qid);
472 qid = null; // for tidiness
473 org.jpl7.fli.Prolog.discard_foreign_frame(fid);
474 fid = null; // for tidiness
475 m.remove(new Long(engine.value));
476 if (subQuery == null) { // only Query open in this engine?
477 if (Prolog.current_engine_is_pool()) { // this (Query's) engine is from the pool?
478 Prolog.release_pool_engine();
479 // System.out.println("JPL releasing engine[" + engine.value + "]");
480 } else {
481 // System.out.println("JPL leaving engine[" + engine.value + "]");
482 }
483 } else {
484 m.put(new Long(engine.value), subQuery);
485 // System.out.println("JPL retaining engine[" + engine.value + "] popping subQuery(" + subQuery.hashCode() + ":" + subQuery.toString() + ")");
486 }
487 open = false; // this Query is now closed
488 engine = null; // this Query, being closed, is no longer associated with any Prolog engine
489 subQuery = null; // this Query, being closed, is not stacked upon any other Query
490 }
491
492 /**
493 * calls the Query's goal to exhaustion and returns an array of zero or more Maps of zero or more variablename-to-term bindings (each Map represents a solution, in the order in which they were
494 * found).
495 *
496 * @return an array of zero or more Maps of zero or more variablename-to-term bindings (each Map represents a solution, in the order in which they were found) <b>NB</b> in JPL 1.0.1, this method
497 * (inconsistently) returned null when a Query had no solutions; in JPL 2.x onwards it returns an empty array (thus the length of the array is, in every case, the quantity of solutions).
498 * <p>
499 * <b>NB</b> in JPL 1.0.1, bindings were keyed (awkwardly) by Variable instances; in JPL 2.x onwards they are keyed by the (String) names of variables, which is consistent with the Term
500 * type being just a concrete syntax for terms (and hence queries).
501 * <p>
502 */
503 public synchronized final Map<String, Term>[] allSolutions() {
504 if (open) {
505 throw new JPLException("Query is already open");
506 } else { // get a vector of solutions, then turn it into an array
507 // Vector<Map<String, Term>> v = new Vector<Map<String, Term>>();
508 // while (hasMoreSolutions()) {
509 // v.addElement(nextSolution());
510 // }
511 // @SuppressWarnings("unchecked")
512 // Map<String, Term> solutions[] = (Map<String, Term>[]) new HashMap[v.size()]; // 0 solutions -> Map[0]
513 // v.copyInto(solutions);
514 // return solutions;
515 // get a List of solutions:
516 List<Map<String, Term>> l = new ArrayList<Map<String, Term>>();
517 while (hasNext()) {
518 l.add(next());
519 }
520 @SuppressWarnings("unchecked")
521 Map<String, Term> t[] = (Map<String, Term>[]) new HashMap[0];
522 return l.toArray(t);
523 }
524 }
525
526 /**
527 * This static method creates a Query whose goal is the given Term, calls it to exhaustion, and returns an array of zero or more Maps of zero or more variablename-to-term bindings (each Map
528 * represents a solution, in the order in which they were found). Throws JPLException if goal is neither a jpl.Atom nor a jpl.Compound.
529 *
530 * @return an array of zero or more Maps of zero or more variablename-to-term bindings (each Map represents a solution, in the order in which they were found)
531 *
532 * @param goal
533 * the goal of this Query
534 */
535 public static final Map<String, Term>[] allSolutions(Term goal) {
536 return (new Query(goal)).allSolutions();
537 }
538
539 /**
540 * This static method creates a Query from the given Prolog source text fragment, calls it to exhaustion, and returns an array of zero or more Maps of zero or more variablename-to-term bindings
541 * (each Map represents a solution, in the order in which they were found). Throws PrologException containing error(syntax_error(_),_) if text is invalid.
542 *
543 * @return an array of zero or more Maps of zero or more variablename-to-term bindings (each Map represents a solution, in the order in which they were found)
544 *
545 * @param text
546 * a Prolog source text fragment denoting a goal
547 */
548 public static final Map<String, Term>[] allSolutions(String text) {
549 return (new Query(text)).allSolutions();
550 }
551
552 /**
553 * If text denotes (in traditional Prolog source syntax) a term containing N questionmark (?) symbols and there are N accompanying Term params, this static method replaces each questionmark symbol
554 * by its respective param, calls the resulting goal to exhaustion, and returns an array of zero or more Maps of zero or more variablename-to-term bindings (each Map represents a solution, in the
555 * order in which they were found).
556 *
557 * Otherwise, if text denotes an atom, this static method creates a Query where text is the name of the goal and params are the args; the resulting goal is then called as above. This letter mode
558 * is redundant, deprecated (informally), and retained only for backward compatibility.
559 *
560 * @return an array of zero or more Maps of zero or more variablename-to-term bindings (each Map represents a solution, in the order in which they were found)
561 *
562 * @param text
563 * the Prolog source text of a goal, in which questionmarks are regarded as substitutible parameters
564 * @param params
565 * terms to be substituted for the respective questionmarks in the query text
566 */
567 public static final Map<String, Term>[] allSolutions(String text, Term[] params) {
568 return (new Query(text, params)).allSolutions();
569 }
570
571 /**
572 * calls the Query's goal to exhaustion or until N solutions are found, whichever is sooner, and returns an array containing (as possibly empty Maps of variablename-to-term bindings) every found
573 * solution (in the order in which they were found).
574 *
575 * @return an array of Maps (possibly none), each of which is a solution (in the order in which they were found) of the Query; at most 'n' solutions will be found and returned. <b>NB</b> in JPL
576 * 1.0.1, this method (inconsistently) returned null when a Query had no solutions; in JPL 2.x onwards it returns an empty array (thus the length of the array is, in every case, the
577 * quantity of solutions).
578 * <p>
579 * <b>NB</b> in JPL 1.0.1, bindings were keyed (awkwardly) by Variable instances; in JPL 2.x onwards they are keyed by the (String) names of variables, which is consistent with the Term
580 * type being just a concrete syntax for terms (and hence queries).
581 * <p>
582 */
583 public synchronized final Map<String, Term>[] nSolutions(long n) {
584 if (open) {
585 throw new JPLException("Query is already open");
586 } else { // get a vector of solutions, then turn it into an array
587 // Vector<Map<String, Term>> v = new Vector<Map<String, Term>>();
588 // for (long i = 0; i++ < n && hasMoreSolutions();) {
589 // v.addElement(nextSolution());
590 // }
591 // @SuppressWarnings("unchecked")
592 // Map<String, Term> solutions[] = (Map<String, Term>[]) new Map[v.size()]; // 0 solutions -> Map[0]
593 // v.copyInto(solutions);
594 // return solutions;
595 List<Map<String, Term>> l = new ArrayList<Map<String, Term>>();
596 for (long i = 0; i++ < n && hasMoreSolutions();) {
597 l.add(next());
598 }
599 @SuppressWarnings("unchecked")
600 Map<String, Term> t[] = (Map<String, Term>[]) new HashMap[0];
601 return l.toArray(t);
602 }
603 }
604
605 /**
606 * This static method creates a Query whose goal is the given Term, calls it to exhaustion or until N solutions are found, whichever is sooner, and returns an array containing (as possibly empty
607 * Maps of variablename-to-term bindings) every found solution (in the order in which they were found). Throws JPLException if goal is neither a jpl.Atom nor a jpl.Compound.
608 *
609 * @param goal
610 * the goal of this Query
611 */
612 public static final Map<String, Term>[] nSolutions(Term goal, long n) {
613 return (new Query(goal)).nSolutions(n);
614 }
615
616 /**
617 * This static method creates a Query from the given Prolog source text fragment, calls it to exhaustion or until N solutions are found, whichever is sooner, and returns an array containing (as
618 * possibly empty Maps of variablename-to-term bindings) every found solution (in the order in which they were found). Throws PrologException containing error(syntax_error(_),_) if text is
619 * invalid.
620 *
621 * @param text
622 * a Prolog source text fragment denoting a goal
623 */
624 public static final Map<String, Term>[] nSolutions(String text, long n) {
625 return (new Query(text)).nSolutions(n);
626 }
627
628 /**
629 * If text denotes (in traditional Prolog source syntax) a term containing N questionmark (?) symbols and there are N accompanying params, this static method replaces each questionmark symbol by
630 * its respective param, calls the resulting goal to exhaustion or until N solutions are found, whichever is sooner, and returns an array containing (as possibly empty Maps of variablename-to-term
631 * bindings) every found solution (in the order in which they were found).
632 *
633 * Otherwise, if text denotes an atom, this static method creates a Query where text is the name of the goal and params are the args; the resulting goal is then called as above. This latter mode
634 * is redundant, deprecated (informally), and retained only for backward compatibility.
635 *
636 * @param text
637 * the Prolog source text of a goal, in which questionmarks are regarded as substitutible parameters
638 * @param params
639 * terms to be substituted for the respective questionmarks in the query text
640 */
641 public static final Map<String, Term>[] nSolutions(String text, Term[] params, long n) {
642 return (new Query(text, params)).nSolutions(n);
643 }
644
645 /**
646 * Returns the first solution, if any, as a (possibly empty) Map of variablename-to-term bindings, else null.
647 *
648 * This method will throw a JPLException if this Query is already open (and the Query will remain open as before). Otherwise, upon return, the Query will be closed.
649 *
650 * @return the first solution, if the query has one, as a (possibly empty) Map. If the return value is null, this means that the Query has no solutions.
651 * <p>
652 */
653 public synchronized final Map<String, Term> oneSolution() {
654 if (open) {
655 throw new JPLException("Query is already open");
656 } else {
657 Map<String, Term> solution;
658 if (hasMoreSolutions()) {
659 solution = nextSolution();
660 close(); // safe, whether or not this is the only solution
661 } else {
662 solution = null;
663 }
664 return solution;
665 }
666 }
667
668 /**
669 * This static method creates a Query (whose goal is the specified Term) and calls it at most once, returning the first solution, if there is one, as a (possibly empty) Map, else null. The goal
670 * can be a jpl.Atom or a jpl.Compound, but cannot be an instance of jpl.Float, jpl.Integer or jpl.Variable.
671 *
672 * @param goal
673 * the goal of this Query
674 */
675 public static final Map<String, Term> oneSolution(Term goal) {
676 return (new Query(goal)).oneSolution();
677 }
678
679 /**
680 * This static method creates a Query from the given Prolog source text fragment, and calls it at most once, returning the first solution, if there is one, as a (possibly empty) Map, else null.
681 * Throws PrologException containing error(syntax_error(_),_) if text is invalid.
682 *
683 * @param text
684 * a Prolog source text fragment denoting a goal
685 */
686 public static final Map<String, Term> oneSolution(String text) {
687 return (new Query(text)).oneSolution();
688 }
689
690 /**
691 * If text denotes (in traditional Prolog source syntax) a term containing N questionmark (?) symbols and there are N params, each questionmark symbol is replaced by its respective param to
692 * provide the goal of this query: the resulting goal is then called (at most once) and the first solution, if there is one, is returned as a (possibly empty) Map, else null.
693 *
694 * Otherwise, if text denotes an atom, this static method creates a Query where text is the name of the goal and params are the args; the resulting goal is then called as above. This latter mode
695 * is redundant, deprecated (informally), and retained only for backward compatibility.
696 *
697 * @param text
698 * the Prolog source text of a goal, in which questionmarks are regarded as substitutible parameters
699 * @param params
700 * terms to be substituted for the respective questionmarks in the query text
701 */
702 public static final Map<String, Term> oneSolution(String text, Term[] params) {
703 return (new Query(text, params)).oneSolution();
704 }
705
706 /**
707 * This method will attempt to call this Query's goal within an available Prolog engine.
708 *
709 * @return the provability of the Query, i.e. 'true' if it has at least one solution, 'false' if the call fails without finding a solution.
710 * <p>
711 *
712 * Only the first solution (if there is one) will be found; any bindings will be discarded, and the Query will be closed.
713 * <p>
714 * This method will throw a JPLException if this Query is already open.
715 */
716 public synchronized final boolean hasSolution() {
717 return oneSolution() != null;
718 }
719
720 /**
721 * This static method creates a Query (whose goal is the specified Term) and calls it at most once, returning true if a solution was found, else false. The goal can be a jpl.Atom or a
722 * jpl.Compound, but cannot be an instance of jpl.Float, jpl.Integer or jpl.Variable.
723 *
724 * @param goal
725 * the goal of this Query
726 */
727 public static final boolean hasSolution(Term goal) {
728 return (new Query(goal)).hasSolution();
729 }
730
731 /**
732 * This static method creates a Query from the given Prolog source text and calls it at most once, returning true if a solution was found, else false. Throws PrologException containing
733 * error(syntax_error(_),_) if text is invalid.
734 *
735 * @param text
736 * the goal of this Query, as Prolog source text
737 */
738 public static final boolean hasSolution(String text) {
739 return (new Query(text)).hasSolution();
740 }
741
742 /**
743 * If text denotes (in traditional Prolog source syntax) a term containing N questionmark (?) symbols and there are N params, each questionmark symbol is replaced by its corresponding arg to
744 * provide the new Query's goal: the resulting Query is called as described above.
745 *
746 * Otherwise, if text denotes an atom, this static method creates a Query where text is the name of its goal and args are its args; it then calls this goal (at most once) and returns true if a
747 * solution was found, else false. This latter mode is redundant, deprecated (informally), and retained only for backward compatibility.
748 *
749 * @param text
750 * the Prolog source text of a goal, in which questionmarks are regarded as substitutible parameters
751 * @param params
752 * terms to be substituted for the respective questionmarks in the query text
753 */
754 public static final boolean hasSolution(String text, Term[] params) {
755 return (new Query(text, params)).hasSolution();
756 }
757
758 /**
759 * Returns a crude String representation of a Query.
760 *
761 * @return a crude String representation of a Query
762 */
763 public String toString() {
764 return goal_.name() + "( " + Term.toString(goal_.args()) + " )";
765 }
766 }
0 package org.jpl7;
1
2 import java.math.BigInteger;
3 import java.util.HashMap;
4 import java.util.Iterator;
5 import java.util.Map;
6
7 import org.jpl7.fli.DoubleHolder;
8 import org.jpl7.fli.Int64Holder;
9 import org.jpl7.fli.IntHolder;
10 import org.jpl7.fli.Prolog;
11 import org.jpl7.fli.StringHolder;
12 import org.jpl7.fli.term_t;
13
14 /**
15 * Term is the abstract base class for Compound, Atom, Variable, Integer and Float, which comprise a Java-oriented concrete syntax for Prolog. You cannot create instances of Term directly; rather, you
16 * should create instances of Term's concrete subclasses. Alternatively, use textToTerm() to construct a Term from its conventional Prolog source text representation.
17 *
18 * <hr>
19 * <i> Copyright (C) 2004 Paul Singleton
20 * <p>
21 * Copyright (C) 1998 Fred Dushin
22 * <p>
23 *
24 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
25 * License, or (at your option) any later version.
26 * <p>
27 *
28 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29 * Library Public License for more details.
30 * <p>
31 * </i>
32 * <hr>
33 *
34 * @author Fred Dushin <fadushin@syr.edu>
35 * @version $Revision$
36 */
37 public abstract class Term {
38
39 /**
40 * This default constructor enables subclasses to define their own default constructors
41 */
42 protected Term() {
43 }
44
45 /**
46 * returns the i-th (1+) argument of a Term; defined only for Compound (and hence Atom); throws a JPLException for other Term subclasses
47 *
48 * @return the i-th argument of a (Compound) Term
49 */
50 public Term arg(int i) { // overridden in Compound
51 throw new JPLException("arg(int) is undefined for " + this.typeName() + " instances");
52 }
53
54 /**
55 * returns, as a Term[], the arguments of a Compound returns an empty Term[] from an Atom, Integer or Float throws a JPLException from a Variable
56 *
57 * @return the arguments of a Compound as a Term[
58 */
59 public Term[] args() { // overridden in Compound
60 return new Term[] {};
61 }
62
63 public String atomType() { // overridden in Atom
64 return null;
65 }
66
67 /**
68 * Tests whether this Term's functor has (String) 'name' and 'arity' Returns false if called inappropriately
69 *
70 * @return whether this Term's functor has (String) 'name' and 'arity'
71 */
72 public boolean hasFunctor(String name, int arity) { // overridden in Compound
73 return false;
74 }
75
76 /**
77 * Tests whether this Term's functor has (int) 'name' and 'arity' Returns false if called inappropriately
78 *
79 * @return whether this Term's functor has (int) 'name' and 'arity'
80 */
81 public boolean hasFunctor(int value, int arity) {
82 return false;
83 }
84
85 /**
86 * Tests whether this Term's functor has (double) 'name' and 'arity' Returns false if called inappropriately
87 *
88 * @return whether this Term's functor has (double) 'name' and 'arity'
89 */
90 public boolean hasFunctor(double value, int arity) {
91 return false;
92 }
93
94 /**
95 * returns, as a String, the name of a Compound, Atom or Variable throws a JPLException from an Integer or Float
96 *
97 * @return the name of a Compound, Atom or Variable
98 */
99 public String name() { // overridden in Compound, Variable
100 throw new JPLException("name() is undefined for " + this.typeName());
101 };
102
103 /**
104 * returns, as an int, the arity of a Compound, Atom, Integer or Float; throws a JPLException from a Variable
105 *
106 * @return the arity of a Compound, Atom, Integer or Float
107 */
108 public int arity() { // overridden in Compound, Variable
109 return 0;
110 };
111
112 /**
113 * returns the value (as an int) of an Integer or Float throws a JPLException from a Compound, Atom or Variable
114 *
115 * @return the value (as an int) of an Integer or Float
116 */
117 public int intValue() {
118 throw new JPLException("intValue() is undefined for " + this.typeName());
119 }
120
121 /**
122 * returns the value (as a long) of an Integer or Float throws a JPLException from a Compound, Atom or Variable
123 *
124 * @return the value (as a long) of an Integer or Float
125 */
126 public long longValue() {
127 throw new JPLException("longValue() is undefined for " + this.typeName());
128 }
129
130 /**
131 * returns the value (as a float) of an Integer or Float throws a JPLException from a Compound, Atom or Variable
132 *
133 * @return the value (as a float) of an Integer or Float
134 */
135 public float floatValue() {
136 throw new JPLException("floatValue() is undefined for " + this.typeName());
137 }
138
139 /**
140 * returns the value (as a java.math.BigInteger) of an Integer; throws a JPLException from a Compound, Atom, Float or Variable
141 *
142 * @return the value (as a java.math.BigInteger) of an Integer; throws a JPLException from a Compound, Atom, Float or Variable
143 */
144 public BigInteger bigValue() {
145 throw new JPLException("bigValue() is undefined for " + this.typeName());
146 }
147
148 /**
149 * returns the value (as a double) of an Integer or Float throws a JPLException from any other subclass
150 *
151 * @return the value (as an double) of an Integer or Float
152 */
153 public double doubleValue() {
154 throw new JPLException("doubleValue() is undefined for " + this.typeName());
155 }
156
157 /**
158 * returns the type of this term, as one of org.jpl7.fli.Prolog.COMPOUND, .ATOM, .VARIABLE, .INTEGER, .FLOAT etc
159 *
160 * @return the type of this term, as one of org.jpl7.fli.Prolog.COMPOUND, .ATOM, .VARIABLE, .INTEGER, .FLOAT etc
161 */
162 public abstract int type();
163
164 /**
165 * returns the name of the type of this term, as one of "Compound", "Atom", "Variable", "Integer", "Float" etc
166 *
167 * @return the name of the type of this term, as one of "Compound", "Atom", "Variable", "Integer", "Float" etc
168 */
169 public abstract String typeName();
170
171 /**
172 * whether this Term is an Atom (of some kind)
173 *
174 * @return whether this Term is an Atom (of some kind)
175 */
176 public boolean isAtom() {
177 return this instanceof Atom;
178 }
179
180 /**
181 * whether this Term is an Integer whose value is too big to represent as a long
182 *
183 * @return whether this Term is an Integer whose value is too big to represent as a long
184 */
185 public boolean isBigInteger() {
186 return this instanceof Integer && ((Integer) this).isBig();
187 }
188
189 /**
190 * whether this Term represents a compound term
191 *
192 * @return whether this Term represents a compound atom
193 */
194 public boolean isCompound() {
195 return this instanceof Compound;
196 }
197
198 /**
199 * whether this Term represents a float
200 *
201 * @return whether this Term represents a float
202 */
203 public boolean isFloat() {
204 return this instanceof Float;
205 }
206
207 /**
208 * whether this Term represents an integer
209 *
210 * @return whether this Term represents an integer
211 */
212 public boolean isInteger() {
213 return this instanceof Integer;
214 }
215
216 /**
217 * whether this Term is a variable
218 *
219 * @return whether this Term is a variable
220 */
221 public boolean isVariable() {
222 return this instanceof Variable;
223 }
224
225 /**
226 * whether this Term denotes (syntax-specifically) an empty list
227 *
228 * @return whether this Term denotes (syntax-specifically) an empty list
229 */
230 public boolean isListNil() { // overridden in Atom
231 return false;
232 }
233
234 /**
235 * whether this Term denotes (syntax-specifically) a list pair
236 *
237 * @return whether this Term denotes (syntax-specifically) a list pair
238 */
239 public boolean isListPair() { // overridden in Compound
240 return false;
241 }
242
243 /**
244 * whether this Term is a 'jfalse' structure, i.e. @(false)
245 *
246 * @return whether this Term is a 'jfalse' structure, i.e. @(false)
247 */
248 public boolean isJFalse() {
249 return false; // overridden in Compound, where it might sometimes be true
250 }
251
252 /**
253 * whether this Term is a 'jnull' structure, i.e. @(null)
254 *
255 * @return whether this Term is a 'jnull' structure, i.e. @(null)
256 */
257 public boolean isJNull() {
258 return false; // overridden in Compound, where it might sometimes be true
259 }
260
261 /**
262 * whether this Term is a 'jobject' structure, i.e. @(Tag)
263 *
264 * @return whether this Term is a 'jobject' structure, i.e. @(Tag)
265 */
266 public boolean isJObject() {
267 return false; // overridden in Compound, where it might sometimes be true
268 }
269
270 /**
271 * whether this Term is a 'jref' structure, i.e. @(Tag) or @(null)
272 *
273 * @return whether this Term is a 'jref' structure, i.e. @(Tag) or @(null)
274 */
275 public boolean isJRef() {
276 return false; // overridden in Compound, where it might sometimes be true
277 }
278
279 /**
280 * whether this Term is a 'jtrue' structure, i.e. @(true)
281 *
282 * @return whether this Term is a 'jtrue' structure, i.e. @(true)
283 */
284 public boolean isJTrue() {
285 return false; // overridden in Compound, where it might sometimes be true
286 }
287
288 /**
289 * whether this Term is a 'jvoid' structure, i.e. @(void)
290 *
291 * @return whether this Term is a 'jvoid' structure, i.e. @(void)
292 */
293 public boolean isJVoid() {
294 return false; // overridden in Compound, where it might sometimes be true
295 }
296
297 // public abstract Object jrefToObject();
298 public Object jrefToObject() {
299 throw new JPLException("term is not a JRef");
300 }
301
302 /**
303 * returns a new Term instance which represents the given object
304 */
305 public static Term objectToJRef(Object obj) {
306 return new Compound("@", new Term[] { new Atom(Prolog.object_to_tag(obj)) });
307 }
308
309 public Term putParams(Term[] ps) { // necessarily (?) public
310 IntHolder next = new IntHolder();
311 next.value = 0;
312 Term t2 = this.putParams1(next, ps);
313 if (next.value != ps.length) {
314 throw new JPLException("more actual params than formal");
315 }
316 return t2;
317 }
318
319 protected Term putParams(Term plist) { // was public
320 Term[] ps = plist.toTermArray();
321 return putParams(ps);
322 }
323
324 protected Term putParams1(IntHolder next, Term[] ps) {
325 switch (this.type()) {
326 case Prolog.COMPOUND:
327 return new Compound(this.name(), putParams2(this.args(), next, ps));
328 case Prolog.ATOM:
329 if (!this.name().equals("?")) {
330 return this;
331 } else if (next.value >= ps.length) {
332 throw new JPLException("fewer actual params than formal params");
333 } else {
334 return ps[next.value++];
335 }
336 default:
337 return this;
338 }
339 }
340
341 static protected Term[] putParams2(Term[] ts, IntHolder next, Term[] ps) {
342 int n = ts.length;
343 Term[] ts2 = new Term[n];
344 for (int i = 0; i < n; i++) {
345 ts2[i] = ts[i].putParams1(next, ps);
346 }
347 return ts2;
348 }
349
350 /**
351 * the length of this list, iff it is one, else an exception is thrown
352 *
353 * @throws JPLException
354 * @return the length (as an int) of this list, iff it is one
355 */
356 public int listLength() {
357 if (this.isListPair()) { // was .hasFunctor(".", 2)
358 return 1 + this.arg(2).listLength(); // TODO eliminate recursion
359 } else if (this.isListNil()) { // was .hasFunctor("[]", 0)
360 return 0;
361 } else {
362 throw new JPLException("term is not a list");
363 }
364 }
365
366 /**
367 * returns an array of terms which are the successive members of this list, if it is a list, else throws an exception
368 *
369 * @throws JPLException
370 * @return an array of terms which are the successive members of this list, if it is a list
371 */
372 public Term[] toTermArray() {
373 try {
374 int len = this.listLength(); // exception if not a well formed list
375 Term[] ts = new Term[len];
376 Term t = this;
377 for (int i = 0; i < len; i++) { // no need to check functor (listLength did)
378 ts[i] = t.arg(1);
379 t = t.arg(2);
380 }
381 return ts;
382 } catch (JPLException e) {
383 throw new JPLException("term is not a proper list");
384 }
385 }
386
387 // /**
388 // * Returns a debug-friendly representation of a Term
389 // *
390 // * @return a debug-friendly representation of a Term
391 // * @deprecated
392 // */
393 // public abstract String debugString();
394
395 // /**
396 // * Returns a debug-friendly representation of a list of Terms
397 // *
398 // * @return a debug-friendly representation of a list of Terms
399 // * @deprecated
400 // */
401 // public static String debugString(Term arg[]) {
402 // String s = "[";
403 // for (int i = 0; i < arg.length; ++i) {
404 // s += arg[i].debugString();
405 // if (i != arg.length - 1) {
406 // s += ", ";
407 // }
408 // }
409 // return s + "]";
410 // }
411
412 // ==================================================================/
413 // Converting JPL Terms to Prolog terms
414 //
415 // To convert a Term to a term_t, we need to traverse the Term
416 // structure and build a corresponding Prolog term_t object.
417 // There are some issues:
418 //
419 // - Prolog term_ts rely on the *consecutive* nature of term_t
420 // references. In particular, to build a compound structure
421 // in the Prolog FLI, one must *first* determine the arity of the
422 // compound, create a *sequence* of term_t references, and then
423 // put atoms, functors, etc. into those term references. We
424 // do this in these methods by first determining the arity of the
425 // Compound, and then by "put"-ing a type into a term_t.
426 // The "put" method is implemented differently in each of Term's
427 // five subclasses.
428 //
429 // - What if we are trying to make a term_t from a Term, but the
430 // Term has several same-named Variables? We want
431 // to ensure that one Prolog variable will be created and shared, or else
432 // queries will give incorrect answers. We thus pass a Map
433 // (var_table) through these methods. The table contains term_t
434 // instances, keyed on Variable names.
435 // ==================================================================/
436
437 protected void put(term_t term) { // was public
438 put(new HashMap<String, term_t>(), term);
439 }
440
441 /**
442 * Cache the reference to the Prolog term_t here.
443 *
444 * @param varnames_to_vars
445 * A Map from variable names to JPL Variables.
446 * @param term
447 * A (previously created) term_t which is to be put with a Prolog term-type appropriate to the Term type (e.g., Atom, Variable, Compound, etc.) on which the method is invoked.)
448 */
449 protected abstract void put(Map<String, term_t> varnames_to_vars, term_t term);
450
451 /**
452 * This static method converts an array of Terms to a *consecutive* sequence of term_t objects. Note that the first term_t object returned is a term_t class (structure); the succeeding term_t
453 * objects are consecutive references obtained by incrementing the *value* field of the term_t.
454 *
455 * @param varnames_to_vars
456 * Map from variable names to JPL Variables.
457 * @param args
458 * An array of org.jpl7.Term references.
459 * @return consecutive term_t references (first of which is a structure)
460 */
461 protected static term_t putTerms(Map<String, term_t> varnames_to_vars, Term[] args) {
462 // First create a sequence of term_ts. The 0th term_t will be a org.jpl7.fli.term_t.
463 // Successive Prolog term_t references will reside in the Prolog engine, and can be obtained by term0.value+i.
464 term_t term0 = Prolog.new_term_refs(args.length);
465 // for each new term reference, construct a Prolog term by putting an appropriate Prolog type into the reference.
466 long ith_term_t = term0.value;
467 for (int i = 0; i < args.length; ++i, ++ith_term_t) {
468 term_t term = new term_t();
469 term.value = ith_term_t;
470 args[i].put(varnames_to_vars, term); // each subclass defines its own put()
471 }
472 return term0;
473 }
474
475 // experiment: for jni_jobject_to_term_byval/2 in jpl.c
476 public static void putTerm(Object obj, term_t termref) {
477 if (obj instanceof Term) {
478 ((Term) obj).put(termref);
479 } else {
480 throw new JPLException("not a Term");
481 }
482 }
483
484 /**
485 * This method calls from_term_t on each term in the n consecutive term_ts. A temporary term_t "holder" (byref) structure must be created in order to extract type information from the Prolog
486 * engine.
487 *
488 * @param vars_to_Vars
489 * A Map from Prolog variables to org.jpl7.Variable instances
490 * @param n
491 * The number of consecutive term_ts
492 * @param term0
493 * The 0th term_t (structure); subsequent term_ts are not structures.
494 * @return An array of converted Terms
495 */
496 /*
497 * protected static Term[] from_term_ts(Map vars_to_Vars, int n, term_t term0) {
498 *
499 * // create an (uninitialised) array of n Term references Term[] terms = new Term[n];
500 *
501 * // for each term_t (from 0...n-1), create a term_t // (temporary) structure and dispatch the translation // to a Term to the static from_term_t method of the Term // class. This will perform
502 * (Prolog) type analysis on the // term_t and call the appropriate static method to create // a Term of the right type (e.g., Atom, Variable, List, etc.) // long ith_term_t = term0.value; for
503 * (int i = 0; i < n; ++i, ++ith_term_t) { term_t term = new term_t(); term.value = ith_term_t;
504 *
505 * terms[i] = Term.from_term_t(vars_to_Vars, term); }
506 *
507 * return terms; }
508 */
509
510 /**
511 * create and return a org.jpl7.Term representation of the given Prolog term
512 *
513 * @param vars_to_Vars
514 * A Map from Prolog variables to org.jpl7.Variable instances
515 * @param term
516 * The Prolog term (in a term_t holder) to convert
517 * @return The converted Term subclass instance.
518 */
519 protected static Term getTerm(Map<term_t, Variable> vars_to_Vars, term_t term) {
520 StringHolder hString;
521 IntHolder hInt;
522 Int64Holder hInt64;
523 switch (Prolog.term_type(term)) {
524 case Prolog.VARIABLE:
525 for (Iterator<term_t> i = vars_to_Vars.keySet().iterator(); i.hasNext();) {
526 term_t varX = (term_t) i.next(); // a previously seen Prolog variable
527 if (Prolog.compare(varX, term) == 0) { // identical Prolog variables?
528 return (Term) vars_to_Vars.get(varX); // return the associated JPL Variable
529 }
530 }
531 // otherwise, the Prolog variable in term has not been seen before
532 Variable Var = new Variable(); // allocate a new (sequentially named) Variable to represent it
533 Var.term_ = term; // this should become redundant...
534 vars_to_Vars.put(term, Var); // use Hashtable(var,null), but only need set(var)
535 return Var;
536 case Prolog.ATOM:
537 hString = new StringHolder();
538 Prolog.get_atom_chars(term, hString); // ignore return val; assume success...
539 return new Atom(hString.value, "text");
540 case Prolog.STRING:
541 hString = new StringHolder();
542 Prolog.get_string_chars(term, hString); // ignore return val; assume success...
543 return new Atom(hString.value, "string");
544 case Prolog.INTEGER:
545 hInt64 = new Int64Holder();
546 if (Prolog.get_integer(term, hInt64)) { // assume it fails if Prolog integer is bigger than a Java long...
547 return new org.jpl7.Integer(hInt64.value);
548 } else {
549 hString = new StringHolder();
550 if (Prolog.get_integer_big(term, hString)) {
551 // System.out.println("bigint = " + hString.value);
552 return new org.jpl7.Integer(new java.math.BigInteger(hString.value));
553 } else {
554 return new org.jpl7.Integer(-3); // arbitrary
555 }
556 }
557 case Prolog.FLOAT:
558 DoubleHolder hFloatValue = new DoubleHolder();
559 Prolog.get_float(term, hFloatValue); // assume it succeeds...
560 return new org.jpl7.Float(hFloatValue.value);
561 case Prolog.COMPOUND:
562 case Prolog.LIST_PAIR:
563 hString = new StringHolder();
564 hInt = new IntHolder();
565 Prolog.get_name_arity(term, hString, hInt); // assume it succeeds
566 Term args[] = new Term[hInt.value];
567 // term_t term1 = Prolog.new_term_refs(hArity.value);
568 for (int i = 1; i <= hInt.value; i++) {
569 term_t termi = Prolog.new_term_ref();
570 Prolog.get_arg(i, term, termi);
571 args[i - 1] = Term.getTerm(vars_to_Vars, termi);
572 }
573 return new Compound(hString.value, args);
574 case Prolog.LIST_NIL:
575 return JPL.LIST_NIL;
576 default:
577 throw new JPLException("unknown term type=" + Prolog.term_type(term)); // should never happen...
578 }
579 }
580
581 protected static Term getTerm(term_t term) {
582 return getTerm(new HashMap<term_t, Variable>(), term);
583 }
584
585 // ==================================================================/
586 // Computing Substitutions
587 //
588 // Once a solution has been found, the Prolog term_t references
589 // will have been instantiated and will refer to new terms. To compute
590 // a substitution, we traverse the (original) Term structure, looking
591 // at the term_t reference in the Term. The only case we really care
592 // about is if the (original) Term is a Variable; if so, the term_t
593 // back in the Prolog engine may be instantiated (non Variable parts
594 // of the original Term cannot change or become uninstantiated). In
595 // this case, we can store this term in a Map, keyed by the
596 // Variable with which the term was unified.
597 // ==================================================================/
598
599 /**
600 * This method computes a substitution from a Term. The bindings Map stores Terms, keyed by names of Variables. Thus, a substitution is as it is in mathematical logic, a sequence of the form
601 * \sigma = {t_0/x_0, ..., t_n/x_n}. Once the substitution is computed, the substitution should satisfy
602 *
603 * \sigma T = t
604 *
605 * where T is the Term from which the substitution is computed, and t is the term_t which results from the Prolog query.
606 * <p>
607 *
608 * A second Map, vars, is required; this table holds the Variables that occur (thus far) in the unified term. The Variable instances in this table are guaranteed to be unique and are keyed on
609 * Strings which are Prolog internal representations of the variables.
610 *
611 * @param bindings
612 * table holding Term substitutions, keyed on names of Variables.
613 * @param vars
614 * A Map holding the Variables that occur thus far in the term; keyed by internal (Prolog) string rep.
615 */
616 protected void getSubst(Map<String, Term> varnames_to_Terms, Map<term_t, Variable> vars_to_Vars) { // overridden in Compound, Variable
617 }
618
619 /**
620 * Just calls computeSubstitution for each Term in the array.
621 *
622 * @param varnames_to_Terms
623 * a Map from variable names to Terms
624 * @param vars_to_Vars
625 * a Map from Prolog variables to JPL Variables
626 * @param args
627 * an array of Terms
628 */
629 protected static void getSubsts(Map<String, Term> varnames_to_Terms, Map<term_t, Variable> vars_to_Vars, Term[] args) {
630 for (int i = 0; i < args.length; ++i) {
631 args[i].getSubst(varnames_to_Terms, vars_to_Vars);
632 }
633 }
634
635 /**
636 * This method is used (by Compound.equals) to determine the Terms in two Term arrays are pairwise equal, where two Terms are equal if they satisfy the equals predicate (defined differently in
637 * each Term subclass).
638 *
639 * @param t1
640 * an array of Terms
641 * @param t2
642 * another array of Terms
643 * @return true if all of the Terms in the (same-length) arrays are pairwise equal
644 */
645 protected static boolean terms_equals(Term[] t1, Term[] t2) {
646 if (t1.length != t2.length) {
647 return false;
648 } else {
649 for (int i = 0; i < t1.length; ++i) {
650 if (!t1[i].equals(t2[i])) {
651 return false;
652 }
653 }
654 return true;
655 }
656 }
657
658 /**
659 * Converts a list of Terms to a String.
660 *
661 * @param args
662 * An array of Terms to convert
663 * @return String representation of a list of Terms
664 */
665 public static String toString(Term[] args) {
666 String s = "";
667 for (int i = 0; i < args.length; ++i) {
668 s += args[i].toString();
669 if (i != args.length - 1) {
670 s += ", ";
671 }
672 }
673 return s;
674 }
675
676 }
0 package org.jpl7;
1
2 import java.util.HashMap;
3 import java.util.Iterator;
4 import java.util.Map;
5
6 import org.jpl7.fli.term_t;
7
8 /**
9 * This class provides a bunch of static utility methods to support JPL's Java API.
10 *
11 * <hr>
12 * <i> Copyright (C) 2004 Paul Singleton
13 * <p>
14 * Copyright (C) 1998 Fred Dushin
15 * <p>
16 *
17 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
18 * License, or (at your option) any later version.
19 * <p>
20 *
21 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Library Public License for more details.
23 * <p>
24 * </i>
25 * <hr>
26 *
27 * @author Fred Dushin <fadushin@syr.edu>
28 * @version $Revision$
29 */
30 public final class Util {
31 /**
32 * Converts an array of Terms to a JPL representation of a Prolog list of terms whose members correspond to the respective array elements.
33 *
34 * @param terms
35 * An array of Term
36 * @return Term a list of the array elements
37 */
38 public static Term termArrayToList(Term[] terms) {
39 Term list = JPL.LIST_NIL; // was new Atom("[]")
40 for (int i = terms.length - 1; i >= 0; --i) {
41 list = new Compound(JPL.LIST_PAIR, new Term[] { terms[i], list });
42 }
43 return list;
44 }
45
46 /**
47 * Converts a substitution, in the form of a Map from variable names to Terms, to a String.
48 *
49 * @param varnames_to_Terms
50 * A Map from variable names to Terms.
51 * @return String A String representation of the variable bindings
52 */
53 public static String toString(Map<String, Term> varnames_to_Terms) {
54 if (varnames_to_Terms == null) {
55 return "[no solution]";
56 } else {
57 Iterator<String> varnames = varnames_to_Terms.keySet().iterator();
58 String s = "Bindings: ";
59 while (varnames.hasNext()) {
60 String varname = varnames.next();
61 s += varname + "=" + varnames_to_Terms.get(varname).toString() + "; ";
62 }
63 return s;
64 }
65 }
66
67 /**
68 * Converts a (JPL) list of Name=Var pairs (as yielded by atom_to_term/3) to a Map from Prolog variables (necessarily in term_t holders) to named JPL Variables
69 *
70 * @param nvs
71 * A JPL list of Name=Var pairs (as yielded by atom_to_term/3)
72 * @return Map A Map from Prolog variables (necessarily in term_t holders) to named JPL Variables
73 */
74 public static Map<term_t, Variable> namevarsToMap(Term nvs) {
75 try {
76 Map<term_t, Variable> vars_to_Vars = new HashMap<term_t, Variable>();
77 // while (nvs.isListPair() && nvs.arg(1).hasFunctor("=", 2)) {
78 while (nvs.arity() == 2 && (nvs.name().equals(JPL.LIST_PAIR_MODERN) || nvs.name().equals(JPL.LIST_PAIR_TRADITIONAL)) && nvs.arg(1).hasFunctor("=", 2)) {
79 // the cast to Variable is necessary to access the (protected) .term_ field
80 vars_to_Vars.put(((Variable) nvs.arg(1).arg(2)).term_, new Variable(nvs.arg(1).arg(1).name())); // map the Prolog variable to a new, named Variable
81 nvs = nvs.arg(2); // advance to next list cell
82 }
83 // maybe oughta check that nvs is [] ?
84 return vars_to_Vars;
85 } catch (java.lang.ClassCastException e) { // nvs is not of the expected structure
86 return null;
87 }
88 }
89
90 /**
91 * Converts a Prolog source text to a corresponding JPL Term (in which each Variable has the appropriate name from the source text). Throws PrologException containing error(syntax_error(_),_) if
92 * text is invalid.
93 *
94 * @param text
95 * A Prolog source text denoting a term
96 * @return Term a JPL Term equivalent to the given source text
97 */
98 public static Term textToTerm(String text) {
99 // it might be better to use PL_chars_to_term()
100 Query q = new Query(new Compound("atom_to_term", new Term[] { new Atom(text), new Variable("Term"), new Variable("NVdict") }));
101 q.open();
102 Map<String, Term> s = q.getSubstWithNameVars();
103 if (s != null) {
104 q.close();
105 return (Term) s.get("Term");
106 } else {
107 return null;
108 }
109 }
110
111 /**
112 * Converts a Prolog source text to a corresponding JPL Term (in which each Variable has the appropriate name from the source text), replacing successive occurrences of ? in the text by the
113 * corresponding element of Term[] params. (New in JPL 3.0.4)
114 *
115 * Throws PrologException containing error(syntax_error(_),_) if text is invalid.
116 *
117 * @param text
118 * A Prolog source text denoting a term
119 * @return Term a JPL Term equivalent to the given source text
120 */
121 public static Term textParamsToTerm(String text, Term[] params) {
122 return Util.textToTerm(text).putParams(params);
123 }
124
125 /**
126 * Converts an array of String to a corresponding JPL list
127 *
128 * @param a
129 * An array of String objects
130 * @return Term a JPL list corresponding to the given String array
131 */
132 public static Term stringArrayToList(String[] a) {
133 Term list = JPL.LIST_NIL; // was new Atom("[]");
134 for (int i = a.length - 1; i >= 0; i--) {
135 list = new Compound(JPL.LIST_PAIR, new Term[] { new Atom(a[i]), list });
136 }
137 return list;
138 }
139
140 /**
141 * Converts an array of int to a corresponding JPL list
142 *
143 * @param a
144 * An array of int values
145 * @return Term a JPL list corresponding to the given int array
146 */
147 public static Term intArrayToList(int[] a) {
148 Term list = JPL.LIST_NIL; // was new Atom("[]");
149 for (int i = a.length - 1; i >= 0; i--) {
150 list = new Compound(JPL.LIST_PAIR, new Term[] { new org.jpl7.Integer(a[i]), list });
151 }
152 return list;
153 }
154
155 /**
156 * Converts an array of arrays of int to a corresponding JPL list of lists
157 *
158 * @param a
159 * An array of arrays of int values
160 * @return Term a JPL list of lists corresponding to the given int array of arrays
161 */
162 public static Term intArrayArrayToList(int[][] a) {
163 Term list = JPL.LIST_NIL; // was new Atom("[]");
164 for (int i = a.length - 1; i >= 0; i--) {
165 list = new Compound(JPL.LIST_PAIR, new Term[] { intArrayToList(a[i]), list });
166 }
167 return list;
168 }
169
170 public static int listToLength(Term t) {
171 int length = 0;
172 Term head = t;
173 while (head.isListPair()) {
174 length++;
175 head = head.arg(2);
176 }
177 return (head.isListNil() ? length : -1);
178 }
179
180 /**
181 * converts a proper list to an array of terms, else throws an exception
182 *
183 * @throws JPLException
184 * @return an array of terms whose successive elements are the corresponding members of the list (if it is a list)
185 */
186 public static Term[] listToTermArray(Term t) {
187 try {
188 int len = t.listLength(); // exception if not a list
189 Term[] ts = new Term[len];
190 for (int i = 0; i < len; i++) {
191 ts[i] = t.arg(1);
192 t = t.arg(2);
193 }
194 return ts;
195 } catch (JPLException e) {
196 throw new JPLException("term is not a proper list");
197 }
198 }
199
200 public static String[] atomListToStringArray(Term t) {
201 int n = listToLength(t);
202 String[] a;
203 if (n < 0) {
204 return null;
205 } else {
206 a = new String[n];
207 }
208 int i = 0;
209 Term head = t;
210 while (head.isListPair()) {
211 Term x = head.arg(1);
212 if (x.isAtom()) {
213 a[i++] = x.name();
214 } else {
215 return null;
216 }
217 head = head.arg(2);
218 }
219 return (head.isListNil() ? a : null);
220 }
221 }
0 package org.jpl7;
1
2 import java.util.Map;
3
4 import org.jpl7.fli.Prolog;
5 import org.jpl7.fli.term_t;
6
7 /**
8 * This class supports Java representations of Prolog variables.
9 * <p>
10 *
11 * A jpl.Variable instance is equivalent to a variable in a fragment of Prolog source text: it is *not* a "live" variable within a Prolog stack or heap. A corresponding Prolog variable is created only
12 * upon opening a Query whose goal refers to a Variable (and then only temporarily).
13 *
14 * <hr>
15 * <i> Copyright (C) 2004 Paul Singleton
16 * <p>
17 * Copyright (C) 1998 Fred Dushin
18 * <p>
19 *
20 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
21 * License, or (at your option) any later version.
22 * <p>
23 *
24 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 * Library Public License for more details.
26 * <p>
27 * </i>
28 * <hr>
29 *
30 * @author Fred Dushin <fadushin@syr.edu>
31 * @version $Revision$
32 */
33 public class Variable extends Term {
34 /**
35 * the integral part of the next automatic variable name to be allocated
36 */
37 private static long n = 0;
38
39 protected transient int index; // only used by (redundant?)
40
41 /**
42 * the name of this Variable
43 */
44 public final String name;
45
46 /**
47 * defined between Query.open() and Query.get2()
48 */
49 protected transient term_t term_ = null;
50
51 /**
52 * Create a new Variable with new sequential name of the form "_261".
53 *
54 */
55 public Variable() {
56 this.name = "_" + Long.toString(n++); // e.g. _0, _1 etc.
57 }
58
59 /**
60 * Create a new Variable with 'name' (which must not be null or ""), and may one day be constrained to comply with traditional Prolog syntax.
61 *
62 * @param name
63 * the source name of this Variable
64 */
65 public Variable(String name) {
66 if (name == null) {
67 throw new JPLException("name cannot be null");
68 } else if (name.equals("")) {
69 throw new JPLException("name cannot be empty String");
70 } else {
71 this.name = name;
72 }
73 }
74
75 /**
76 * The (nonexistent) args of this Variable
77 *
78 * @throws JPLException
79 *
80 * @return the (nonexistent) args of this Variable (never)
81 */
82 public Term[] args() {
83 throw new JPLException("args() is undefined for Variable");
84 }
85
86 /**
87 * returns, as an int, the arity of a Term
88 *
89 * @return the arity of a Term
90 */
91 public int arity() {
92 throw new JPLException("arity() is undefined for Variable");
93 };
94
95 /**
96 * A Variable is equal to another if their names are the same and they are not anonymous.
97 *
98 * @param obj
99 * The Object to compare.
100 * @return true if the Object is a Variable and the above condition apply.
101 */
102 public final boolean equals(Object obj) {
103 return obj instanceof Variable && !this.name.equals("_")
104 && this.name.equals(((Variable) obj).name);
105 }
106
107 /**
108 * If this Variable instance is not an anonymous or (in dont-tell-me mode) a dont-tell-me variable, and its binding is not already in the varnames_to_Terms Map, put the result of converting the
109 * term_t to which this variable has been unified to a Term in the Map, keyed on this Variable's name.
110 *
111 * @param varnames_to_Terms
112 * A Map of bindings from variable names to JPL Terms.
113 * @param vars_to_Vars
114 * A Map from Prolog variables to JPL Variables.
115 */
116 protected final void getSubst(Map<String, Term> varnames_to_Terms,
117 Map<term_t, Variable> vars_to_Vars) {
118 // NB a Variable.name cannot be "" i.e. of 0 length
119 // if (!(this.name.charAt(0) == '_') && varnames_to_Terms.get(this.name) == null) {
120 if (tellThem() && varnames_to_Terms.get(this.name) == null) {
121 varnames_to_Terms.put(this.name, Term.getTerm(vars_to_Vars, this.term_));
122 }
123 }
124
125 public boolean hasFunctor(String name, int arity) {
126 throw new JPLException("hasFunctor() is undefined for Variable");
127 }
128
129 public boolean hasFunctor(int value, int arity) {
130 throw new JPLException("hasFunctor() is undefined for Variable");
131 }
132
133 public boolean hasFunctor(double value, int arity) {
134 throw new JPLException("hasFunctor() is undefined for Variable");
135 }
136
137 /**
138 * the lexical name of this Variable
139 *
140 * @return the lexical name of this Variable
141 */
142 public final String name() {
143 return this.name;
144 }
145
146 /**
147 * To put a Variable, we must check whether a (non-anonymous) variable with the same name has already been put in the Term. If one has, then the corresponding Prolog variable has been stashed in
148 * the varnames_to_vars Map, keyed by the Variable name, so we can look it up and reuse it (this way, the sharing of variables in the Prolog term reflects the sharing of Variable names in the
149 * Term. Otherwise, if this Variable name has not already been seen in the Term, then we put a new Prolog variable and add it into the Map (keyed by this Variable name).
150 *
151 * @param varnames_to_vars
152 * A Map from variable names to Prolog variables.
153 * @param term
154 * A (previously created) term_t which is to be set to a (new or reused) Prolog variable.
155 */
156 protected final void put(Map<String, term_t> varnames_to_vars, term_t term) {
157 term_t var;
158 // if this var is anonymous or as yet unseen, put a new Prolog variable
159 if (this.name.equals("_") || (var = (term_t) varnames_to_vars.get(this.name)) == null) {
160 this.term_ = term;
161 this.index = varnames_to_vars.size(); // i.e. first var in is #0 etc.
162 Prolog.put_variable(term);
163 if (!this.name.equals("_")) {
164 varnames_to_vars.put(this.name, term);
165 }
166 } else {
167 this.term_ = var;
168 Prolog.put_term(term, var);
169 }
170 }
171
172 /**
173 * whether, according to prevailing policy and this Variable's name, its binding (if any) should be returned in a substitution (i.e. unless it's anonymous or we're in dont-tell-me mode and its a
174 * dont-tell-me variable)
175 *
176 * @return whether, according to prevailing policy and this Variable's name, its binding (if any) should be returned in a substitution
177 */
178 private final boolean tellThem() {
179 return !(this.name.equals("_") || org.jpl7.JPL.modeDontTellMe && this.name.charAt(0) == '_');
180 }
181
182 /**
183 * Returns a Prolog source text representation of this Variable
184 *
185 * @return a Prolog source text representation of this Variable
186 */
187 public String toString() {
188 return this.name;
189 }
190
191 /**
192 * returns the type of this subclass of Term, i.e. Prolog.VARIABLE
193 *
194 * @return the type of this subclass of Term, i.e. Prolog.VARIABLE
195 */
196 public final int type() {
197 return Prolog.VARIABLE;
198 }
199
200 /**
201 * returns the typeName of this subclass of Term, i.e. "Variable"
202 *
203 * @return the typeName of this subclass of Term, i.e. "Variable"
204 */
205 public String typeName() {
206 return "Variable";
207 }
208
209 // public Object jrefToObject() {
210 // throw new JPLException("jpl.Variable#jrefToObject(): term is not a jref");
211 // }
212
213 // /**
214 // * throws a JPLException (arg(int) is defined only for Compound and Atom)
215 // *
216 // * @return the ith argument (counting from 1) of this Variable (never)
217 // */
218 // public final Term arg(int i) {
219 // throw new JPLException("jpl.Variable#arg(int) is undefined");
220 // }
221
222 // /**
223 // * Tests the lexical validity of s as a variable's name
224 // *
225 // * @return the lexical validity of s as a variable's name
226 // * @deprecated
227 // */
228 // private boolean isValidName(String s) {
229 // if (s == null) {
230 // throw new java.lang.NullPointerException(); // JPL won't call it this way
231 // }
232 // int len = s.length();
233 // if (len == 0) {
234 // throw new JPLException("invalid variable name");
235 // }
236 // char c = s.charAt(0);
237 // if (!(c == '_' || c >= 'A' && c <= 'Z')) {
238 // return false;
239 // }
240 // for (int i = 1; i < len; i++) {
241 // c = s.charAt(i);
242 // if (!(c == '_' || c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z' || c >= '0' && c <= '9')) {
243 // return false;
244 // }
245 // }
246 // return true;
247 // }
248
249 // /**
250 // * Returns a debug-friendly String representation of an Atom.
251 // *
252 // * @return a debug-friendly String representation of an Atom
253 // * @deprecated
254 // */
255 // public String debugString() {
256 // return "(Variable " + toString() + ")";
257 // }
258
259 }
0 // $Id$
1 package org.jpl7;
2
3 class Version {
4 public final int major = 7;
5 public final int minor = 0;
6 public final int patch = 1; // 15/Jun/2015
7 public final String status = "alpha";
8 }
0 package org.jpl7.fli;
1
2 /**
3 * A BooleanHolder is merely a Holder class for a boolean value.
4 *
5 * <hr>
6 * <i> Copyright (C) 1998 Fred Dushin
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Fred Dushin <fadushin@syr.edu>
20 * @version $Revision$
21 */
22 public class BooleanHolder {
23 public boolean value;
24 }
0 package org.jpl7.fli;
1
2 /**
3 * A DoubleHolder is merely a Holder class for a double value.
4 *
5 * <hr>
6 * <i> Copyright (C) 1998 Fred Dushin
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Fred Dushin <fadushin@syr.edu>
20 * @version $Revision$
21 */
22 public class DoubleHolder {
23 public double value;
24 }
0 package org.jpl7.fli;
1
2 /**
3 * An Int64Holder is merely a Holder class for an int64 value.
4 *
5 * <hr>
6 * <i> Copyright (C) 2005 Paul Singleton
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Paul Singleton <paul@jbgb.com>
20 * @version $Revision$
21 */
22 public class Int64Holder {
23 public long value;
24 }
0 package org.jpl7.fli;
1
2 /**
3 * An IntHolder is merely a Holder class for an Int value.
4 *
5 * <hr>
6 * <i> Copyright (C) 1998 Fred Dushin
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Fred Dushin <fadushin@syr.edu>
20 * @version $Revision$
21 */
22 public class IntHolder {
23 public int value;
24 }
0 package org.jpl7.fli;
1
2 /**
3 * A Long Holder merely holds a long value.
4 *
5 * <hr>
6 * <i> Copyright (C) 1998 Fred Dushin
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Fred Dushin <fadushin@syr.edu>
20 * @version $Revision$
21 */
22 public class LongHolder {
23 public long value = 0L;
24
25 public boolean equals(LongHolder lh) {
26 return lh.value == this.value;
27 }
28 }
0 package org.jpl7.fli;
1
2 /**
3 * A ObjectHolder is merely a Holder class for an Object reference (or null).
4 *
5 * <hr>
6 * <i> Copyright (C) 1998 Fred Dushin
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Fred Dushin <fadushin@syr.edu>
20 * @version $Revision$
21 */
22 public class ObjectHolder {
23 public Object value;
24 }
0 package org.jpl7.fli;
1
2 /**
3 * A PointerHolder is a trivial extension of a LongHolder. This is sort of a no-no in Java, as the long value stored herein is sometimes a machine address. (Don't tell Sun.)
4 *
5 * <hr>
6 * <i> Copyright (C) 1998 Fred Dushin
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Fred Dushin <fadushin@syr.edu>
20 * @version $Revision$
21 */
22 // Implementation notes:
23 // There could be issues in the future with signedness, since Java
24 // does not have an unsigned type; make sure not to do any arithmetic
25 // with the stored value.
26 // ----------------------------------------------------------------------/
27 public class PointerHolder extends LongHolder {
28 }
0 package org.jpl7.fli;
1
2 import org.jpl7.JPL;
3
4 /**
5 * This class consists only of constants (static finals) and static native methods. The constants and methods defined herein are in (almost) strict 1-1 correspondence with the functions in the Prolog
6 * FLI by the same name (except without the PL_, SQ_, etc. prefixes).
7 * <p>
8 *
9 * See the file jpl.c for the native (ANSI C) implementations of these methods. Refer to your local Prolog FLI documentations for the meanings of these methods, and observe the following:
10 * <p>
11 *
12 * <menu>
13 * <li>The types and signatures of the following methods are almost in 1-1 correspondence with the Prolog FLI. The Prolog types term_t, atom_t, functor_t, etc. are mirrored in this package with
14 * classes by the same name, making the C and Java uses of these interfaces similar.</li>
15 * <li>As term_t, functor_t, etc. types are Java classes, they are passed to these methods <b>by value</b>; however, calling these methods on such class instances does have side effects. In general,
16 * the value fields of these instances will be modified, in much the same way the term_t, functor_t, etc. Prolog instances would be modified.</li>
17 * <li>The exceptions to this rule occur when maintaining the same signature would be impossible, e.g., when the Prolog FLI functions require <i>pointers</i>; in this case, the signatures have been
18 * modified to take *Holder classes (Int, Double, String, etc.), to indicate a call by reference parameter.
19 * <li>Functions which take variable-length argument lists in C take arrays in Java; from Java 1.1 onwards, anonymous arrays can be used e.g. Term[] { new Atom("a"), new Atom ("b") } </menu>
20 *
21 * <hr>
22 * <i> Copyright (C) 1998 Fred Dushin
23 * <p>
24 *
25 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
26 * License, or (at your option) any later version.
27 * <p>
28 *
29 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 * Library Public License for more details.
31 * <p>
32 * </i>
33 * <hr>
34 *
35 * @author Fred Dushin <fadushin@syr.edu>
36 * @version $Revision$
37 */
38 public final class Prolog {
39 static {
40 JPL.loadNativeLibrary();
41 }
42
43 /* term types */
44 public static final int VARIABLE = 1; // PL_VARIABLE
45 public static final int ATOM = 2; // PL_ATOM
46 public static final int INTEGER = 3; // PL_INTEGER
47 public static final int FLOAT = 4; // PL_FLOAT
48 public static final int STRING = 5; // PL_STRING
49 public static final int COMPOUND = 6; // PL_TERM
50
51 public static final int LIST_NIL = 7; // PL_NIL
52 public static final int LIST_PAIR = 9; // PL_LIST_PAIR
53 public static final int BLOB = 8; // PL_BLOB
54 public static final int DICT = 44; // PL_DICT
55
56 public static final int JBOOLEAN = 101;
57 public static final int JREF = 102;
58 public static final int JVOID = 103;
59
60 public static final int succeed = 1;
61 public static final int fail = 0;
62
63 /* query flags */
64 public static final int Q_NORMAL = 0x02;
65 public static final int Q_NODEBUG = 0x04;
66 public static final int Q_CATCH_EXCEPTION = 0x08;
67 public static final int Q_PASS_EXCEPTION = 0x10;
68
69 /* conversion flags */
70 public static final int CVT_ATOM = 0x0001;
71 public static final int CVT_STRING = 0x0002;
72 public static final int CVT_LIST = 0x0004;
73 public static final int CVT_INTEGER = 0x0008;
74 public static final int CVT_FLOAT = 0x0010;
75 public static final int CVT_VARIABLE = 0x0020;
76 public static final int CVT_NUMBER = (CVT_INTEGER | CVT_FLOAT);
77 public static final int CVT_ATOMIC = (CVT_NUMBER | CVT_ATOM | CVT_STRING);
78 public static final int CVT_ALL = 0x00ff;
79 public static final int BUF_DISCARDABLE = 0x0000;
80 public static final int BUF_RING = 0x0100;
81 public static final int BUF_MALLOC = 0x0200;
82
83 /* syntax flavours */
84 public static final int SYNTAX_TRADITIONAL = 202;
85 public static final int SYNTAX_MODERN = 203;
86
87 /* new, for revised term_t-to-Variable stuff */
88 public static native int compare(term_t t1, term_t t2); // returns -1, 0 or 1
89
90 /* Creating and destroying term-refs */
91 public static native term_t new_term_ref();
92
93 public static native term_t new_term_refs(int n);
94
95 public static native term_t copy_term_ref(term_t from); // NOT USED
96
97 /* Constants */
98 public static native atom_t new_atom(String s);
99
100 public static native String atom_chars(atom_t a);
101
102 public static native functor_t new_functor(atom_t f, int a);
103
104 public static native void unregister_atom(atom_t a); // called from atom_t's finalize()
105
106 /* Get Java-values from Prolog terms */
107 public static native boolean get_atom_chars(term_t t, StringHolder a);
108
109 public static native boolean get_string_chars(term_t t, StringHolder s);
110
111 public static native boolean get_integer(term_t t, Int64Holder i);
112
113 public static native boolean get_integer_big(term_t t, StringHolder s);
114
115 public static native boolean get_float(term_t t, DoubleHolder d);
116
117 public static native boolean get_name_arity(term_t t, StringHolder name, IntHolder arity);
118
119 public static native boolean get_arg(int index, term_t t, term_t a);
120
121 public static native String object_to_tag(Object obj);
122
123 public static native Object tag_to_object(String tag); // 29/May/2008
124
125 public static native boolean is_tag(String tag); // 30/May/2008
126
127 /* Verify types */
128 public static native int term_type(term_t t);
129
130 /* Assign to term-references */
131 public static native void put_variable(term_t t);
132
133 public static native void put_integer(term_t t, long i);
134
135 public static native void put_integer_big(term_t t, String i);
136
137 public static native void put_float(term_t t, double f);
138
139 public static native void put_term(term_t t1, term_t t2);
140
141 public static native void put_jref(term_t t, Object ref);
142
143 // public static native void put_atom_chars(term_t t, String name);
144
145 public static native void put_nil(term_t t);
146
147 /* ... */
148 public static native void cons_functor_v(term_t h, functor_t fd, term_t a0);
149
150 // predicates:
151 public static native predicate_t predicate(String name, int arity, String module);
152
153 // querying (general):
154 public static native qid_t open_query(module_t m, int flags, predicate_t pred, term_t t0);
155
156 public static native boolean next_solution(qid_t qid);
157
158 public static native void close_query(qid_t qid);
159
160 // modules:
161 public static native module_t new_module(atom_t name);
162
163 // exceptions:
164 public static native term_t exception(qid_t qid);
165
166 // initialisation:
167 public static native String[] get_default_init_args();
168
169 public static native boolean set_default_init_args(String argv[]);
170
171 public static native boolean initialise();
172
173 public static native String[] get_actual_init_args();
174
175 public static native void halt(int status);
176
177 // thread & engine management:
178 public static native int thread_self();
179
180 public static native engine_t attach_pool_engine();
181
182 public static native int release_pool_engine();
183
184 public static native engine_t current_engine();
185
186 public static native boolean current_engine_is_pool();
187
188 public static native int attach_engine(engine_t e);
189
190 // misc.
191 public static native String get_c_lib_version();
192
193 // not yet working:
194 public static native int action_abort();
195
196 // revived 17/Jun/2008:
197 public static native fid_t open_foreign_frame();
198
199 public static native void discard_foreign_frame(fid_t cid);
200
201 // syntax enquiry:
202 public static native int get_syntax();
203 }
0 package org.jpl7.fli;
1
2 /**
3 * A StringHolder is merely a Holder class for a String value.
4 *
5 * <hr>
6 * <i> Copyright (C) 1998 Fred Dushin
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Fred Dushin <fadushin@syr.edu>
20 * @version $Revision$
21 */
22 public class StringHolder {
23 public String value;
24 }
0 package org.jpl7.fli;
1
2 /**
3 * An atom_t is a specialised LongHolder which decrements its atom's reference count when garbage-collected (finalized).
4 *
5 * <hr>
6 * <i> Copyright (C) 1998 Fred Dushin
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Fred Dushin <fadushin@syr.edu>
20 * @version $Revision$
21 */
22 public class atom_t extends LongHolder {
23 /**
24 * The String representation of an atom_t is just the atom's name.
25 *
26 * @return atom's name
27 */
28 public String toString() {
29 return Prolog.atom_chars(this);
30 }
31
32 protected void finalize() throws Throwable {
33 super.finalize();
34 Prolog.unregister_atom(this);
35 }
36 }
0 package org.jpl7.fli;
1
2 /**
3 * A engine_t holds a reference to a Prolog engine.
4 *
5 * <hr>
6 * <i> Copyright (C) 1998 Fred Dushin
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Fred Dushin <fadushin@syr.edu>
20 * @version $Revision$
21 */
22 public class engine_t extends LongHolder {
23 }
0 package org.jpl7.fli;
1
2 /**
3 * An fid_t holds the value of a frame id in the Prolog Engine.
4 *
5 * <hr>
6 * <i> Copyright (C) 1998 Fred Dushin
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Fred Dushin <fadushin@syr.edu>
20 * @version $Revision$
21 */
22 public class fid_t extends LongHolder {
23 }
0 package org.jpl7.fli;
1
2 /**
3 * A functor_t holds a reference to a Prolog functor_t in the Prolog engine.
4 *
5 * <hr>
6 * <i> Copyright (C) 1998 Fred Dushin
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Fred Dushin <fadushin@syr.edu>
20 * @version $Revision$
21 */
22 public class functor_t extends LongHolder {
23 }
0 package org.jpl7.fli;
1
2 /**
3 * A module_t is a PointerHolder type which holds a reference to a Prolog module_t reference.
4 *
5 * <hr>
6 * <i> Copyright (C) 1998 Fred Dushin
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Fred Dushin <fadushin@syr.edu>
20 * @version $Revision$
21 */
22 public class module_t extends PointerHolder {
23 }
0 package org.jpl7.fli;
1
2 /**
3 * A predicate_t is a PointerHolder class whose value is a reference to a Prolog predicate_t.
4 *
5 * <hr>
6 * <i> Copyright (C) 1998 Fred Dushin
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Fred Dushin <fadushin@syr.edu>
20 * @version $Revision$
21 */
22 public class predicate_t extends PointerHolder {
23 }
0 package org.jpl7.fli;
1
2 /**
3 * A qid_t holds a reference to a Prolog qid_t.
4 *
5 * <hr>
6 * <i> Copyright (C) 1998 Fred Dushin
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Fred Dushin <fadushin@syr.edu>
20 * @version $Revision$
21 */
22 public class qid_t extends LongHolder {
23 }
0 package org.jpl7.fli;
1
2 /**
3 * A term_t is a simple class which mirrors the term_t type in the Prolog FLI. All it really does is hold a term reference, which is an internal representation of a term in the Prolog Engine.
4 *
5 * <hr>
6 * <i> Copyright (C) 1998 Fred Dushin
7 * <p>
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 * <p>
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library Public License for more details.
15 * <p>
16 * </i>
17 * <hr>
18 *
19 * @author Fred Dushin <fadushin@syr.edu>
20 * @version $Revision$
21 */
22 public class term_t extends LongHolder {
23 public static final long UNASSIGNED = -1L;
24
25 public term_t() {
26 value = UNASSIGNED;
27 }
28
29 /**
30 * This static method converts a term_t, which is assumed to contain a reference to a *consecutive* list of term_t references to a String representation of a list of terms, in this case, a comma
31 * separated list.
32 *
33 * @param n
34 * the number of consecutive term_ts
35 * @param term0
36 * a term_t whose value is the 0th term_t.
37 */
38 public static String toString(int n, term_t term0) {
39 String s = "";
40 int i;
41 long ith_term_t;
42 for (i = 0, ith_term_t = term0.value; i < n; ++i, ++ith_term_t) {
43 term_t term = new term_t();
44 term.value = ith_term_t;
45 s += term.toString();
46 if (i != n - 1) {
47 s += ", ";
48 }
49 }
50 return s;
51 }
52
53 /**
54 * Instances of term_ts are stored in Term objects (see jpl.Term), and these term_ts are in some cases stored in Hashtables. Supplying this predicate provides the right behavior in Hashtable
55 * lookup (see the rules for Hashtable lookup in java.util).
56 * <p>
57 *
58 * Note. Two term_ts are *not* equal if their values have not been assigned. (Since Prolog FLI term_ts are unsigned values and the UNASSIGNED value is -1, this should work).
59 *
60 * @param obj
61 * the Object to comapre.
62 * @return true if the supplied object is a term_t instances and the long values are the same
63 */
64 public boolean equals(Object obj) {
65 return (obj instanceof term_t) && this.value == ((term_t) obj).value
66 && this.value != UNASSIGNED;
67 }
68 }
0 package org.jpl7.test;
1
2 /**
3 * CelsiusConverter.java is a 1.4 application that
4 * demonstrates the use of JButton, JTextField and
5 * JLabel. It requires no other files.
6 */
7 import java.awt.*;
8 import java.awt.event.*;
9 import javax.swing.*;
10
11 public class CelsiusConverter implements ActionListener {
12 JFrame converterFrame;
13 JPanel converterPanel;
14 JTextField tempCelsius;
15 JLabel celsiusLabel, fahrenheitLabel;
16 JButton convertTemp;
17
18 public CelsiusConverter() { // initially locate the window at top-left of desktop
19 this(0, 0);
20 }
21
22 public CelsiusConverter(int left, int top) { // initially locate the window at top-left of desktop
23 // create and set up the window
24 converterFrame = new JFrame("Convert Celsius to Fahrenheit");
25 converterFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
26 converterFrame.setSize(new Dimension(120, 40));
27 converterFrame.setLocation(left, top);
28 // create and set up the panel
29 converterPanel = new JPanel(new GridLayout(2, 2));
30 // create widgets
31 tempCelsius = new JTextField(2);
32 celsiusLabel = new JLabel("Celsius", SwingConstants.LEFT);
33 celsiusLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
34 //
35 convertTemp = new JButton("Convert");
36 fahrenheitLabel = new JLabel("Fahrenheit", SwingConstants.LEFT);
37 // listen to events from the Convert button
38 convertTemp.addActionListener(this);
39 // add the widgets to the container
40 converterPanel.add(tempCelsius);
41 converterPanel.add(celsiusLabel);
42 converterPanel.add(convertTemp);
43 converterPanel.add(fahrenheitLabel);
44 fahrenheitLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
45 converterFrame.getRootPane().setDefaultButton(convertTemp); // make "convert" the window's default button
46 // add the panel to the window
47 converterFrame.getContentPane().add(converterPanel, BorderLayout.CENTER);
48 // display the window
49 converterFrame.pack();
50 converterFrame.setVisible(true);
51 }
52
53 public void actionPerformed(ActionEvent event) {
54 // parse degrees Celsius as a double
55 double tC = (Double.parseDouble(tempCelsius.getText()));
56 //
57 // convert to Fahrenheit (in Java)
58 // int tempFahr = (int) (tC * 1.8 + 32);
59 //
60 // convert to Fahrenheit (in Prolog, via JPL)
61 int tempFahr = ((org.jpl7.Float) org.jpl7.Query.oneSolution("TF is ? * 1.8 + 32", new org.jpl7.Term[] { new org.jpl7.Float(tC) }).get("TF")).intValue();
62 //
63 // display the result
64 fahrenheitLabel.setText(tempFahr + " Fahrenheit");
65 }
66
67 public static void spawnGUI(final int left, final int top) {
68 // schedule a job for the event-dispatching thread: create and show an instance of this application at (left,top)
69 javax.swing.SwingUtilities.invokeLater(new Runnable() {
70 int x = left;
71 int y = top;
72
73 public void run() {
74 new CelsiusConverter(x, y); // can we be sure this won't be garbage collected?
75 }
76 });
77 }
78
79 public static void main(String[] args) {
80 // just for fun, we ask Prolog to start five instances of this class (at stepped offsets from top-left of display)
81 org.jpl7.Query.allSolutions("between(1, 5, N), X is 10*N, Y is 20*N, jpl_call('jpl.test.CelsiusConverter', spawnGUI, [X,Y], _)");
82 }
83 }
0 package org.jpl7.test;
1
2 import java.util.Map;
3
4 import org.jpl7.Atom;
5 import org.jpl7.Query;
6 import org.jpl7.Term;
7 import org.jpl7.Variable;
8
9 public class Family extends Thread {
10
11 int id; // client thread id
12 private static final int delay = 0;
13
14 Family(int i) {
15 this.id = i;
16 }
17
18 public static void main(String argv[]) {
19 Query q1 = new Query("consult", new Term[] { new Atom("jpl/test/family.pl") });
20 System.err.println("consult " + (q1.hasSolution() ? "succeeded" : "failed"));
21 for (int i = 0; i < 20; i++) {
22 System.out.println("spawning client[" + i + "]");
23 new Family(i).start();
24 }
25 }
26
27 public void run() {
28 Map<String, Term> solution;
29 Variable X = new Variable("X");
30
31 // --------------------------------------------------
32
33 Query q2 = new Query("child_of", new Term[] { new Atom("joe"), new Atom("ralf") });
34
35 System.err.println("child_of(joe,ralf) is " + (q2.hasSolution() ? "provable" : "not provable"));
36
37 new Query("sleep", new Term[] { new org.jpl7.Integer(delay) }).hasSolution();
38
39 // --------------------------------------------------
40
41 Query q3 = new Query("descendent_of", new Term[] { new Atom("steve"), new Atom("ralf") });
42
43 System.err.println("descendent_of(steve,ralf) is " + (q3.hasSolution() ? "provable" : "not provable"));
44
45 new Query("sleep", new Term[] { new org.jpl7.Integer(delay) }).hasSolution();
46
47 // --------------------------------------------------
48
49 Query q4 = new Query("descendent_of", new Term[] { X, new Atom("ralf") });
50
51 solution = q4.oneSolution();
52
53 System.err.println("first solution of descendent_of(X, ralf)");
54 System.err.println("X = " + solution.get(X.name));
55
56 new Query("sleep", new Term[] { new org.jpl7.Integer(delay) }).hasSolution();
57
58 // --------------------------------------------------
59
60 Map<String, Term>[] solutions = q4.allSolutions();
61
62 System.err.println("all solutions of descendent_of(X, ralf)");
63 for (int i = 0; i < solutions.length; i++) {
64 System.err.println("X = " + solutions[i].get(X.name));
65 }
66
67 new Query("sleep", new Term[] { new org.jpl7.Integer(delay) }).hasSolution();
68
69 // --------------------------------------------------
70
71 System.err.println("each solution of descendent_of(X, ralf)");
72 while (q4.hasMoreSolutions()) {
73 solution = q4.nextSolution();
74 System.err.println("X = " + solution.get(X.name));
75 }
76
77 new Query("sleep", new Term[] { new org.jpl7.Integer(delay) }).hasSolution();
78
79 // --------------------------------------------------
80
81 Variable Y = new Variable("Y");
82
83 Query q5 = new Query("descendent_of", new Term[] { X, Y });
84
85 System.err.println(id + ": each solution of descendent_of(X, Y)");
86 while (q5.hasMoreSolutions()) {
87 solution = q5.nextSolution();
88 System.err.println(id + ": X = " + solution.get(X.name) + ", Y = " + solution.get(Y.name));
89
90 new Query("sleep", new Term[] { new org.jpl7.Integer(delay) }).hasSolution();
91 }
92
93 }
94
95 }
0 package org.jpl7.test;
1
2 import org.jpl7.Query;
3 import org.jpl7.Term;
4
5 public class FetchBigTree {
6 public static void main(String[] args) {
7 // Prolog.set_default_init_args(new String[] { "libpl.dll", "-f", "D:/pcm/bin/pcm.ini", "-g", "pcm_2000" });
8 (new Query("consult('jpl/test/test.pl')")).oneSolution();
9 Term t = (Term) ((new Query("p(18,T)")).oneSolution().get("T"));
10 int i = 1;
11 while (t.hasFunctor("a", 2)) {
12 t = t.arg(2);
13 i = i + 1;
14 }
15 System.err.println("got a tree of " + i + " generations");
16 }
17 }
0 package org.jpl7.test;
1
2 import org.jpl7.Query;
3 import org.jpl7.Term;
4
5 public class FetchLongList {
6 public static void main(String[] args) {
7 // Prolog.set_default_init_args(new String[] { "libpl.dll", "-f", "D:/pcm/bin/pcm.ini", "-g", "pcm_2000" });
8 Term t = (Term) ((new Query("findall(foo(N,bar),between(1,2308,N),L)")).oneSolution().get("L"));
9 int i = 0;
10 while (t.hasFunctor(".", 2)) {
11 t = t.arg(2);
12 i = i + 1;
13 }
14 System.err.println("got a list of " + i + " members");
15 }
16 }
0 package org.jpl7.test;
1
2 import org.jpl7.Query;
3
4 public class Ga {
5 public static void main(String argv[]) {
6 // Prolog.set_default_init_args(new String[] { "libpl.dll", "-f", "D:/pcm/bin/pcm.ini", "-g", "pcm_2000" });
7 // (new Query("loadall(jpl_test:jr)")).hasSolution();
8 // System.err.println("jr " + ((new Query("jr")).hasSolution() ? "succeeded" : "failed"));
9 // System.err.println( "something " + (new Query("statistics(atoms,X)")).oneSolution().get("X"));
10 // Query.hasSolution("statistics");
11 // (new Query("x")).hasSolution();
12 // (new Query("statistics,x")).hasSolution();
13 // (new Query(new Atom("statistics"))).hasSolution();
14 // Query.hasSolution("write(hello),nl");
15 // Query.hasSolution("write(hello),nl");
16
17 // (new Query("nl")).hasSolution();
18 (new Query("nl,nl")).hasSolution();
19
20 // (new Query("user:nl")).hasSolution();
21 }
22 }
0 package org.jpl7.test;
1
2 import org.jpl7.Query;
3
4 public class Ga2 {
5 public static void main(String argv[]) {
6 // Prolog.set_default_init_args(new String[] { "libpl.dll", "-f", "D:/pcm/bin/pcm.ini", "-g", "pcm_2000" });
7 (new Query("current_prolog_flag(K,V),write(K-V),nl,fail")).oneSolution();
8 }
9 }
0 package org.jpl7.test;
1
2 public class Garbo {
3 public static int created = 0;
4 public static int destroyed = 0;
5 //
6 public final int i;
7
8 public Garbo() {
9 this.i = created++;
10 }
11
12 protected void finalize() throws Throwable {
13 try {
14 destroyed++;
15 // System.out.println("gced["+i+"]");
16 } finally {
17 super.finalize();
18 }
19 }
20 }
0 /*
1 * JPLTest.java
2 * JUnit based test
3 *
4 * Created on 13 February 2006, 11:31
5 */
6 package org.jpl7.test;
7
8 import java.util.concurrent.CountDownLatch;
9 import java.util.concurrent.TimeUnit;
10
11 import org.jpl7.Query;
12
13 import junit.framework.TestCase;
14
15 /**
16 *
17 * @author rick
18 */
19 public class JPLTest extends TestCase {
20 // private static final Logger logger = Logger.getLogger(JPLTest.class.getName());
21 private CountDownLatch latch;
22
23 public JPLTest(String testName) {
24 super(testName);
25 }
26
27 protected void setUp() throws Exception {
28 /*
29 * Prolog file can be an empty file. The JVM seems to crash with a SIGSEGV if you don't consult a file prior to interacting with JPL.
30 *
31 * final String prologFile = "jpl/test/test.pl"; // was "/home/rick/temp/test.pl"; System.out.println("prolog file is: " + prologFile); String qString = "consult('" + prologFile + "')";
32 * System.out.println("about to: " + qString); Query query = new Query(qString); System.out.println("Generated Query: " + query); if (!query.hasSolution()) { System.out.println(qString +
33 * " failed"); fail("Failed to consult prolog file."); }
34 *
35 * (new Query("true")).hasSolution();
36 */
37 }
38
39 public void testThreadedAdds() {
40 latch = new CountDownLatch(4);
41 final AddWithThreads[] addTasks = { new AddWithThreads("a", latch), new AddWithThreads("b", latch), new AddWithThreads("c", latch), new AddWithThreads("d", latch) };
42 // System.out.println("Starting threads...");
43 for (int i = 0; i < addTasks.length; i++) {
44 addTasks[i].start();
45 }
46 try {
47 // System.out.println("Latch is waiting");
48 assertTrue("Timed out waiting for action to execute", latch.await(20, TimeUnit.SECONDS));
49 // System.out.println("Latch has been flipped");
50 } catch (final InterruptedException e) {
51 fail("Waiting thread was interrupted: " + e);
52 }
53 for (int i = 0; i < AddWithThreads.REPS; i++) {
54 for (int j = 0; j < addTasks.length; j++) {
55 Query query = new Query(addTasks[j].getNamespace() + "(test('" + i + "'))");
56 // System.out.println("query: " + query);
57 // boolean ret = query.hasMoreElements();
58 query.close();
59 }
60 }
61 }
62 }
63
64 class AddWithThreads extends Thread {
65 private final CountDownLatch latch;
66 private final String namespace;
67 // private static final Logger logger = Logger.getLogger(JPLTest.class.getName());
68 public static final int REPS = 2000; // was 200
69
70 public AddWithThreads(final String namespace, final CountDownLatch latch) {
71 this.latch = latch;
72 this.namespace = namespace;
73 setName("namespace" + namespace); // set thread name for debugging
74 }
75
76 public String getNamespace() {
77 return namespace;
78 }
79
80 public void run() {
81 for (int i = 0; i < REPS; i++) {
82 // System.out.println("Asserting test('" + i + "')");
83 Query queryA = new Query("assert(" + namespace + "(test('" + i + "')))");
84 Thread.yield();
85 // System.out.println("adding query: " + queryA);
86 // boolean retA = queryA.hasMoreElements();
87 queryA.close();
88 }
89 latch.countDown();
90 }
91 }
0 package org.jpl7.test;
1
2 import org.jpl7.Query;
3
4 public class Masstest extends Thread {
5 public static void main(String[] args) {
6 // String[] dia = Prolog.get_default_init_args();
7 // String s = "default init args: ";
8 // for (int i = 0; i < dia.length; i++) {
9 // s += " " + dia[i];
10 // }
11 // System.out.println(s);
12 //
13 // Prolog.set_default_init_args(new String[] { "libpl.dll", "-f", "none", "-g", "true", "-q" });
14 // empirically, needs this at least:
15 // Prolog.set_default_init_args(new String[] { "libpl.dll" });
16 // Prolog.set_default_init_args(new String[] { "pl" });
17 //
18 // (new Query("assert(diagnose_declaration(_,_,_,[not,a,real,error]))")).hasSolution();
19 //
20 int STUDENTSNUMBER = 5;
21 Masstest[] threads = new Masstest[STUDENTSNUMBER];
22 for (int i = 0; i < STUDENTSNUMBER; i++) {
23 threads[i] = new Masstest();
24 threads[i].start();
25 }
26 }
27
28 public void predQuery() {
29 String st = "diagnose_declaration(1,[(sp, 'prefix', [('arg1', '+', 'list', 'Liste1'), ('arg2', '+', 'list', 'Liste2')])], DecMap, ErrorList)";
30 Query stQuery = new Query(st);
31 String errString = stQuery.oneSolution().get("ErrorList").toString();
32 System.out.println("errString=" + errString);
33 }
34
35 public void run() {
36 try {
37 predQuery();
38 } catch (Exception e) {
39 System.err.println("ERROR: " + e);
40 }
41 }
42 }
0 package org.jpl7.test;
1
2 public class MaxObjects {
3 }
0 /*
1 * Created on 22-Nov-2004
2 *
3 * TODO To change the template for this generated file go to
4 * Window - Preferences - Java - Code Style - Code Templates
5 */
6 package org.jpl7.test;
7
8 public class ShadowA {
9 public int shadow = -1;
10 public static int fieldStaticInt;
11 }
0 /*
1 * Created on 22-Nov-2004
2 *
3 * TODO To change the template for this generated file go to
4 * Window - Preferences - Java - Code Style - Code Templates
5 */
6 package org.jpl7.test;
7
8 public class ShadowB extends ShadowA {
9 public String shadow;
10
11 public ShadowB(String s) {
12 shadow = s;
13 }
14
15 public static int fieldStaticInt;
16 }
0 package org.jpl7.test;
1
2 import org.jpl7.Query;
3
4 public class SyntaxError {
5 public static void main(String argv[]) {
6 Query q = new Query("syntax)error");
7 System.err.println(q.hasSolution() ? "yes" : "no");
8 }
9 }
0 package org.jpl7.test;
1
2 import org.jpl7.Compound;
3 import org.jpl7.Query;
4 import org.jpl7.Term;
5
6 // This class contains members which support those tests which are performed from Prolog.
7 // See also TestJUnit
8 public class Test {
9 public Test() {
10 }
11
12 public Test(Term t) {
13 this.termFromConstructor = t;
14 }
15
16 public Term termFromConstructor;
17 //
18 public static boolean fieldStaticBoolean;
19 public static final boolean fieldStaticBoolean1 = false;
20 public static final boolean fieldStaticBoolean2 = true;
21 //
22 public static char fieldStaticChar;
23 public static final char fieldStaticChar1 = '\u0000';
24 public static final char fieldStaticChar2 = '\uFFFF';
25 //
26 public static byte fieldStaticByte;
27 public static final byte fieldStaticByte1 = -(1 << 7);
28 public static final byte fieldStaticByte2 = -1;
29 public static final byte fieldStaticByte3 = 0;
30 public static final byte fieldStaticByte4 = 1;
31 public static final byte fieldStaticByte5 = (1 << 7) - 1;
32 //
33 public static short fieldStaticShort;
34 public static final short fieldStaticShort1 = -(1 << 15);
35 public static final short fieldStaticShort2 = -(1 << 7);
36 public static final short fieldStaticShort3 = -1;
37 public static final short fieldStaticShort4 = 0;
38 public static final short fieldStaticShort5 = 1;
39 public static final short fieldStaticShort6 = (1 << 7) - 1;
40 public static final short fieldStaticShort7 = (1 << 15) - 1;
41 //
42 public static int fieldStaticInt;
43 public static final int fieldStaticInt1 = -(1 << 31);
44 public static final int fieldStaticInt2 = -(1 << 15);
45 public static final int fieldStaticInt3 = -(1 << 7);
46 public static final int fieldStaticInt4 = -1;
47 public static final int fieldStaticInt5 = 0;
48 public static final int fieldStaticInt6 = 1;
49 public static final int fieldStaticInt7 = (1 << 7) - 1;
50 public static final int fieldStaticInt8 = (1 << 15) - 1;
51 public static final int fieldStaticInt9 = (1 << 31) - 1;
52 //
53 public static long fieldStaticLong;
54 public static final long fieldStaticLong1 = -(1 << 63);
55 public static final long fieldStaticLong2 = -(1 << 31);
56 public static final long fieldStaticLong3 = -(1 << 15);
57 public static final long fieldStaticLong4 = -(1 << 7);
58 public static final long fieldStaticLong5 = -1;
59 public static final long fieldStaticLong6 = 0;
60 public static final long fieldStaticLong7 = 1;
61 public static final long fieldStaticLong8 = (1 << 7) - 1;
62 public static final long fieldStaticLong9 = (1 << 15) - 1;
63 public static final long fieldStaticLong10 = (1 << 31) - 1;
64 public static final long fieldStaticLong11 = (1 << 63) - 1;
65 //
66 public static float fieldStaticFloat;
67 public static final float fieldStaticFloat1 = 12345.6789F;
68 public static final float fieldStaticFloat2 = 3.4e+38F; // nearly MAX_VALUE
69 public static final float fieldStaticFloat3 = 1.4e-45F; // nearly MIN_VALUE
70 public static final float fieldStaticFloat4 = 0.0F;
71 public static final float fieldStaticFloat5 = java.lang.Float.MIN_VALUE;
72 public static final float fieldStaticFloat6 = java.lang.Float.MAX_VALUE;
73 public static final float fieldStaticFloat7 = java.lang.Float.NEGATIVE_INFINITY;
74 public static final float fieldStaticFloat8 = java.lang.Float.POSITIVE_INFINITY;
75 public static final float fieldStaticFloat9 = java.lang.Float.NaN;
76 //
77 public static double fieldStaticDouble;
78 public static final double fieldStaticDouble1 = 12345.6789D;
79 public static final double fieldStaticDouble2 = 2.3456789e+100D;
80 public static final double fieldStaticDouble3 = 3.456789e-100D;
81 public static final double fieldStaticDouble4 = 0.0D;
82 public static final double fieldStaticDouble5 = Double.MIN_VALUE;
83 public static final double fieldStaticDouble6 = Double.MAX_VALUE;
84 public static final double fieldStaticDouble7 = Double.NEGATIVE_INFINITY;
85 public static final double fieldStaticDouble8 = Double.POSITIVE_INFINITY;
86 public static final double fieldStaticDouble9 = Double.NaN;
87 //
88 public static Object[] fieldStaticObjectArray; // can assign e.g. String[]
89 public static long[] fieldStaticLongArray; // cannot assign e.g. int[]
90
91 //
92 public static long fac(long n) { // complements jpl:jpl_test_fac(+integer,-integer)
93 if (n == 1) {
94 return 1;
95 } else if (n > 1) {
96 // return n * ((Integer) new Query(new Compound("jpl_test_fac", new Term[] { new Integer(n - 1), new Variable("F") })).oneSolution().get("F")).intValue();
97 return n * ((org.jpl7.Integer) Query.oneSolution("jpl_test_fac(?,F)", new Term[] { new org.jpl7.Integer(n - 1) }).get("F")).longValue();
98 } else {
99 return 0;
100 }
101 }
102
103 static void packageMethod() { // not callable via JPL
104 return;
105 }
106
107 public static void publicMethod() {
108 return;
109 }
110
111 protected static void protectedMethod() { // not callable via JPL
112 return;
113 }
114
115 @SuppressWarnings("unused")
116 private static void privateMethod() { // not callable via JPL
117 return;
118 }
119
120 public boolean fieldInstanceBoolean;
121 public final boolean fieldInstanceBoolean1 = false;
122 public final boolean fieldInstanceBoolean2 = true;
123 public byte fieldInstanceByte;
124 public final byte fieldInstanceByte1 = -(1 << 7);
125 public final byte fieldInstanceByte2 = -1;
126 public final byte fieldInstanceByte3 = 0;
127 public final byte fieldInstanceByte4 = 1;
128 public final byte fieldInstanceByte5 = (1 << 7) - 1;
129 public char fieldInstanceChar;
130 public final char fieldInstanceChar1 = '\u0000';
131 public final char fieldInstanceChar2 = '\uFFFF';
132 public double fieldInstanceDouble;
133 public final double fieldInstanceDouble1 = 12345.6789D;
134 public final double fieldInstanceDouble2 = 2.3456789e+100D;
135 public final double fieldInstanceDouble3 = 3.456789e-100D;
136 public final double fieldInstanceDouble4 = 0.0D;
137 public final double fieldInstanceDouble5 = Double.MIN_VALUE;
138 public final double fieldInstanceDouble6 = Double.MAX_VALUE;
139 public final double fieldInstanceDouble7 = Double.NEGATIVE_INFINITY;
140 public final double fieldInstanceDouble8 = Double.POSITIVE_INFINITY;
141 public final double fieldInstanceDouble9 = Double.NaN;
142 public float fieldInstanceFloat;
143 public final float fieldInstanceFloat1 = 12345.6789F;
144 public final float fieldInstanceFloat2 = 3.4e+38F;
145 public final float fieldInstanceFloat3 = 1.4e-45F;
146 public final float fieldInstanceFloat4 = 0.0F;
147 public final float fieldInstanceFloat5 = java.lang.Float.MIN_VALUE;
148 public final float fieldInstanceFloat6 = java.lang.Float.MAX_VALUE;
149 public final float fieldInstanceFloat7 = java.lang.Float.NEGATIVE_INFINITY;
150 public final float fieldInstanceFloat8 = java.lang.Float.POSITIVE_INFINITY;
151 public final float fieldInstanceFloat9 = java.lang.Float.NaN;
152 public int fieldInstanceInt;
153 public final int fieldInstanceInt1 = -(1 << 31);
154 public final int fieldInstanceInt2 = -(1 << 15);
155 public final int fieldInstanceInt3 = -(1 << 7);
156 public final int fieldInstanceInt4 = -1;
157 public final int fieldInstanceInt5 = 0;
158 public final int fieldInstanceInt6 = 1;
159 public final int fieldInstanceInt7 = (1 << 7) - 1;
160 public final int fieldInstanceInt8 = (1 << 15) - 1;
161 public final int fieldInstanceInt9 = (1 << 31) - 1;
162 public long fieldInstanceLong;
163 public final long fieldInstanceLong1 = -(1 << 63);
164 public final long fieldInstanceLong10 = (1 << 31) - 1;
165 public final long fieldInstanceLong11 = (1 << 63) - 1;
166 public final long fieldInstanceLong2 = -(1 << 31);
167 public final long fieldInstanceLong3 = -(1 << 15);
168 public final long fieldInstanceLong4 = -(1 << 7);
169 public final long fieldInstanceLong5 = -1;
170 public final long fieldInstanceLong6 = 0;
171 public final long fieldInstanceLong7 = 1;
172 public final long fieldInstanceLong8 = (1 << 7) - 1;
173 public final long fieldInstanceLong9 = (1 << 15) - 1;
174 public short fieldInstanceShort;
175 public final short fieldInstanceShort1 = -(1 << 15);
176 public final short fieldInstanceShort2 = -(1 << 7);
177 public final short fieldInstanceShort3 = -1;
178 public final short fieldInstanceShort4 = 0;
179 public final short fieldInstanceShort5 = 1;
180 public final short fieldInstanceShort6 = (1 << 7) - 1;
181 public final short fieldInstanceShort7 = (1 << 15) - 1;
182
183 public Term term; // obsolete
184 public static Term staticTerm;
185 public Term instanceTerm;
186
187 // for testing accessibility of non-public fields:
188 static boolean fieldPackageStaticBoolean;
189 protected static boolean fieldProtectedStaticBoolean;
190
191 @SuppressWarnings("unused")
192 private static boolean fieldPrivateStaticBoolean;
193
194 // for testing update of final field:
195 public static final int fieldStaticFinalInt = 7;
196
197 // for testing passing general terms in from Prolog:
198 public static Term fieldStaticTerm;
199 public Term fieldInstanceTerm;
200
201 public static boolean methodStaticTerm(Term t) {
202 return t != null;
203 }
204
205 public boolean methodInstanceTerm(Term t) {
206 return t != null;
207 }
208
209 public static Term methodStaticEchoTerm(Term t) {
210 return t;
211 }
212
213 public static boolean methodStaticEchoBoolean(boolean v) {
214 return v;
215 }
216
217 public static char methodStaticEchoChar(char v) {
218 return v;
219 }
220
221 public static byte methodStaticEchoByte(byte v) {
222 return v;
223 }
224
225 public static short methodStaticEchoShort(short v) {
226 return v;
227 }
228
229 public static int methodStaticEchoInt(int v) {
230 return v;
231 }
232
233 public static long methodStaticEchoLong(long v) {
234 return v;
235 }
236
237 public static float methodStaticEchoFloat(float v) {
238 return v;
239 }
240
241 public static double methodStaticEchoDouble(double v) {
242 return v;
243 }
244
245 public Term methodInstanceTermEcho(Term t) {
246 return t;
247 }
248
249 public static boolean methodStaticTermIsJNull(Term t) {
250 return t.hasFunctor("@", 1) && t.arg(1).hasFunctor("null", 0);
251 }
252
253 public boolean methodInstanceTermIsJNull(Term t) {
254 return t.hasFunctor("@", 1) && t.arg(1).hasFunctor("null", 0);
255 }
256
257 public static void hello() {
258 System.out.println("hello");
259 }
260
261 public static boolean[] newArrayBooleanFromValue(boolean v) {
262 boolean[] a = new boolean[1];
263 a[0] = v;
264 return a;
265 }
266
267 public static byte[] newArrayByteFromValue(byte v) {
268 byte[] a = new byte[1];
269 a[0] = v;
270 return a;
271 }
272
273 public static char[] newArrayCharFromValue(char v) {
274 char[] a = new char[1];
275 a[0] = v;
276 return a;
277 }
278
279 public static short[] newArrayShortFromValue(short v) {
280 short[] a = new short[1];
281 a[0] = v;
282 return a;
283 }
284
285 public static int[] newArrayIntFromValue(int v) {
286 int[] a = new int[1];
287 a[0] = v;
288 return a;
289 }
290
291 public static long[] newArrayLongFromValue(long v) {
292 long[] a = new long[1];
293 a[0] = v;
294 return a;
295 }
296
297 public static float[] newArrayFloatFromValue(float v) {
298 float[] a = new float[1];
299 a[0] = v;
300 return a;
301 }
302
303 public static double[] newArrayDoubleFromValue(double v) {
304 double[] a = new double[1];
305 a[0] = v;
306 return a;
307 }
308
309 public static String methodStaticArray(long[] a) {
310 return "long[]";
311 }
312
313 public static String methodStaticArray(int[] a) {
314 return "int[]";
315 }
316
317 public static String methodStaticArray(short[] a) {
318 return "short[]";
319 }
320
321 public static Term wrapTerm(Term in) { // for dmiles 11/Jul/2008
322 return new Compound("javaWrap", new Term[] { in });
323 }
324 }
0 package org.jpl7.test;
1
2 import java.math.BigInteger;
3 import java.util.Map;
4
5 import junit.framework.TestCase;
6 import junit.framework.TestSuite;
7
8 import org.jpl7.Atom;
9 import org.jpl7.Compound;
10 import org.jpl7.Integer;
11 import org.jpl7.JPL;
12 import org.jpl7.JPLException;
13 import org.jpl7.PrologException;
14 import org.jpl7.Query;
15 import org.jpl7.Term;
16 import org.jpl7.Util;
17 import org.jpl7.Variable;
18 import org.jpl7.fli.Prolog;
19
20 // This class defines all the tests which are run from Java.
21 // It needs junit.framework.TestCase and junit.framework.TestSuite, which are not supplied with JPL.
22 public class TestJUnit extends TestCase {
23 public static final String startup = (System.getenv("SWIPL_BOOT_FILE") == null ? "../../src/swipl.prc" : System.getenv("SWIPL_BOOT_FILE"));
24 public static final String test_jpl = (System.getenv("TEST_JPL") == null ? "test_jpl.pl" : System.getenv("TEST_JPL"));
25 public static final String syntax = (System.getenv("SWIPL_SYNTAX") == null ? "modern" : System.getenv("SWIPL_SYNTAX"));
26
27 public TestJUnit(String name) { // called for each public void test*() method
28 super(name);
29 }
30
31 public static junit.framework.Test suite() {
32 if (syntax.equals("traditional")) {
33 JPL.setTraditional();
34 Prolog.set_default_init_args(new String[] { "swipl.dll", "-x", startup, "-f", "none", "-g", "true", "--traditional", "-q", "--home=../.." });
35 } else {
36 Prolog.set_default_init_args(new String[] { "swipl.dll", "-x", startup, "-f", "none", "-g", "true", "-q", "--home=../.." });
37 }
38 assertTrue((new Query("consult", new Term[] { new Atom(test_jpl) })).hasSolution());
39 assertTrue((new Query("use_module(library(jpl))")).hasSolution());
40 return new TestSuite(TestJUnit.class);
41 }
42
43 public static void main(String args[]) {
44 junit.textui.TestRunner.run(suite());
45 }
46
47 protected void setUp() {
48 }
49
50 protected void tearDown() {
51 // cleanup code
52 }
53
54 // supporting code:
55
56 public static long fac(long n) { // complements jpl:jpl_test_fac(+integer,-integer); indirectly supports testMutualRecursion
57 if (n == 1) {
58 return 1;
59 } else if (n > 1) {
60 return n * ((org.jpl7.Integer) Query.oneSolution("jpl_test_fac(?,F)", new Term[] { new org.jpl7.Integer(n - 1) }).get("F")).longValue();
61 } else {
62 return 0;
63 }
64 }
65
66 // the tests; all public void test*()
67
68 public void testInfo() {
69 Term swi = Query.oneSolution("current_prolog_flag(version_data,Swi)").get("Swi");
70 System.out.println("version = " + swi.arg(1) + "." + swi.arg(2) + "." + swi.arg(3));
71 System.out.println("syntax = " + Query.oneSolution("jpl:jpl_pl_syntax(Syntax)").get("Syntax"));
72 System.out.println("jpl.jar = " + JPL.version_string() + " " + JPL.jarPath());
73 System.out.println("jpl.dll = " + org.jpl7.fli.Prolog.get_c_lib_version());
74 System.out.println("jpl.pl = " + Query.oneSolution("jpl:jpl_pl_lib_version(V)").get("V").name() + " " + Query.oneSolution("module_property(jpl, file(F))").get("F").name());
75 System.out.println("home = " + Query.oneSolution("current_prolog_flag(home,Home)").get("Home").name());
76 }
77
78 public void testEmptyParentheses() {
79 Term t = Query.oneSolution("T = a()").get("T"); // valid in both traditional and modern syntax in SWI Prolog 7.x
80 assertTrue("T is not bound to an atom", t.isAtom());
81 assertTrue("the atom's name is not \"a\"", t.name().equals("a"));
82 }
83
84 public void testIntegerFromByte1() {
85 byte b = (byte) 127; // -128..127
86 Integer i = new Integer(b);
87 assertTrue(i.intValue() == b);
88 }
89
90 public void testIntegerFromChar1() {
91 char c = (char) 64; // 0..65535
92 // System.out.println("c = " + c);
93 Integer i = new Integer(c);
94 assertTrue(i.intValue() == c);
95 }
96
97 public void testInteger1() {
98 try {
99 Term i = Query.oneSolution("I is 2**40").get("I"); // long but not int
100 i.intValue();
101 fail("intValue() of bigger-than-int value failed to throw an exception");
102 } catch (JPLException e) {
103 if (e.getMessage().endsWith("cannot represent value as an int")) {
104 // OK: an appropriate exception was thrown
105 } else {
106 fail("intValue() of bigger-than-int value threw incorrect JPLException: " + e);
107 }
108 } catch (Exception e) {
109 fail("intValue() of bigger-than-int value threw unexpected class of exception: " + e);
110 }
111 }
112
113 public void testIterable1() {
114 // System.out.println("iterating over array of solutions");
115 // for (Map<String, Term> m : Query.allSolutions("current_module(M)")) { // iterating over array of solutions
116 // System.out.println(m.get("M"));
117 // }
118 // System.out.println();
119 }
120
121 public void testIterable2() {
122 // System.out.println("iterating over successively fetched solutions");
123 // for (Map<String, Term> m : new Query("current_module(M)")) { // iterating over successively fetched solutions
124 // System.out.println(m.get("M"));
125 // }
126 // System.out.println();
127 }
128
129 public void testBigInteger1() {
130 BigInteger a = new BigInteger(Long.toString(51L));
131 BigInteger b = a.pow(51); // 51**51, too big for a long
132 Term x = Query.oneSolution("X is 51**51").get("X");
133 assertTrue("X is an org.jpl7.Integer", x.isInteger());
134 // System.out.println("X.bigValue() = " + x.bigValue().toString());
135 // System.out.println("b.bigValue() = " + b.toString());
136 assertTrue("X is a big integer", x.isBigInteger());
137 assertTrue("X's big value is 51**51", x.bigValue().equals(b));
138 }
139
140 public void testBigInteger2() {
141 BigInteger b = new BigInteger("12345678901234567890123456789");
142 Term i = new Integer(b); // too big for a long
143 Term g = new Compound("is", new Term[] { new Variable("X"), i });
144 Term x = Query.oneSolution(g).get("X");
145 assertTrue("X is an org.jpl7.Integer", x.isInteger());
146 assertTrue("X is a big org.jpl7.Integer", x.isBigInteger());
147 assertTrue("X's value is as expected", x.bigValue().equals(b));
148 }
149
150 public void testCompoundZeroArity1() {
151 Term t = new Compound("foo", new Term[] {});
152 assertTrue(t.isCompound());
153 assertFalse(t.isAtom());
154 assertTrue(t.name().equals("foo"));
155 assertTrue(t.arity() == 0);
156 }
157
158 public void testCompoundZeroArity2() {
159 Term t = Query.oneSolution("T = foo()").get("T");
160 // System.out.println("type = " + t.typeName());
161 assertTrue(t.name().equals("foo"));
162 assertTrue(t.arity() == 0);
163 }
164
165 // public void testCompoundZeroArity3() {
166 // Term t = Query.oneSolution("T = foo()").get("T");
167 // assertTrue("term is a compound", t.isCompound());
168 // assertFalse("term is an atom", t.isAtom());
169 // }
170
171 public void testMap1() {
172 Map<String, Term> h = Query.oneSolution("p(a,b) = p(X,Y)");
173 assertTrue(h.get("X").name().equals("a"));
174 assertTrue(h.get("Y").name().equals("b"));
175 }
176
177 public void testMap2() {
178 Map<String, Term>[] hs = Query.allSolutions("p(a,b) = p(X,Y)");
179 assertTrue(hs.length == 1);
180 assertTrue(hs[0].get("X").name().equals("a"));
181 assertTrue(hs[0].get("Y").name().equals("b"));
182 }
183
184 public void testSyntaxSet1() {
185 if (syntax.equals("traditional")) {
186 try {
187 JPL.setTraditional(); // should succeed silently
188 } catch (Exception e) {
189 fail("setTraditional() under traditional syntax threw exception: " + e);
190 }
191 } else {
192 try {
193 JPL.setTraditional();
194 } catch (JPLException e) { // expected exception class, but is it correct in detail?
195 if (e.getMessage().endsWith("traditional syntax after Prolog is initialised")) {
196 // OK: an appropriate exception was thrown
197 } else {
198 fail("setTraditional() under modern syntax threw incorrect JPLException: " + e);
199 }
200 } catch (Exception e) {
201 fail("setTraditional() under modern syntax threw unexpected class of exception: " + e);
202 }
203 }
204 }
205
206 public void testMasstest() {
207 assertTrue((new Query("assert(diagnose_declaration(_,_,_,[not,a,real,error]))")).hasSolution());
208 }
209
210 public void testSameLibVersions1() {
211 String java_lib_version = JPL.version_string();
212 String c_lib_version = org.jpl7.fli.Prolog.get_c_lib_version();
213 assertTrue("java_lib_version(" + java_lib_version + ") is same as c_lib_version(" + c_lib_version + ")", java_lib_version.equals(c_lib_version));
214 }
215
216 public void testSameLibVersions2() {
217 String java_lib_version = JPL.version_string();
218 String pl_lib_version = Query.oneSolution("jpl_pl_lib_version(V)").get("V").name();
219 assertTrue("java_lib_version(" + java_lib_version + ") is same as pl_lib_version(" + pl_lib_version + ")", java_lib_version.equals(pl_lib_version));
220 }
221
222 public void testAtomName1() {
223 String name = "fred";
224 Atom a = new Atom(name);
225 assertEquals("an Atom's name is that with which it was created", a.name(), name);
226 }
227
228 public void testAtomName2() {
229 String name = "ha ha";
230 Atom a = new Atom(name);
231 assertEquals("an Atom's name is that with which it was created", a.name(), name);
232 }
233
234 public void testAtomName3() {
235 String name = "3";
236 Atom a = new Atom(name);
237 assertEquals("an Atom's name is that with which it was created", a.name(), name);
238 }
239
240 public void testAtomToString1() {
241 String name = "fred";
242 String toString = "fred";
243 Atom a = new Atom(name);
244 assertEquals("an Atom's .toString() value is quoted iff appropriate", a.toString(), toString);
245 }
246
247 public void testAtomToString2() {
248 String name = "ha ha";
249 String toString = "'ha ha'";
250 Atom a = new Atom(name);
251 assertEquals("an Atom's .toString() value is quoted iff appropriate", a.toString(), toString);
252 }
253
254 public void testAtomToString3() {
255 String name = "3";
256 String toString = "'3'";
257 Atom a = new Atom(name);
258 assertEquals("an Atom's .toString() value is quoted iff appropriate", a.toString(), toString);
259 }
260
261 public void testAtomArity() {
262 Atom a = new Atom("willy");
263 assertEquals("an Atom has arity zero", a.arity(), 0);
264 }
265
266 public void testAtomEquality1() {
267 String name = "fred";
268 Atom a1 = new Atom(name);
269 Atom a2 = new Atom(name);
270 assertEquals("two Atoms created with the same name are equal", a1, a2);
271 }
272
273 public void testAtomIdentity() { // how could this fail?!
274 String name = "fred";
275 Atom a1 = new Atom(name);
276 Atom a2 = new Atom(name);
277 assertNotSame("two Atoms created with the same name are not identical", a1, a2);
278 }
279
280 public void testAtomHasFunctorNameZero() {
281 String name = "sam";
282 Atom a = new Atom(name);
283 assertTrue("a text atom has a functor whose name is the name of the atom, and whose arity is zero", a.hasFunctor(name, 0));
284 }
285
286 public void testAtomHasFunctorWrongName() {
287 assertFalse("an Atom does not have a functor whose name is other than that with which the Atom was created", new Atom("wally").hasFunctor("poo", 0));
288 }
289
290 public void testAtomHasFunctorWrongArity() {
291 String name = "ted";
292 assertFalse("an Atom does not have a functor whose arity is other than zero", new Atom(name).hasFunctor(name, 1));
293 }
294
295 public void testVariableBinding1() {
296 Term lhs = new Compound("p", new Term[] { new Variable("X"), new Variable("Y") });
297 Term rhs = new Compound("p", new Term[] { new Atom("a"), new Atom("b") });
298 Term goal = new Compound("=", new Term[] { lhs, rhs });
299 Map<String, Term> soln = new Query(goal).oneSolution();
300 assertTrue("two Variables with different names can bind to distinct atoms", soln != null && (soln.get("X")).name().equals("a") && (soln.get("Y")).name().equals("b"));
301 }
302
303 public void testVariableBinding2() {
304 Term lhs = new Compound("p", new Term[] { new Variable("X"), new Variable("X") });
305 Term rhs = new Compound("p", new Term[] { new Atom("a"), new Atom("b") });
306 Term goal = new Compound("=", new Term[] { lhs, rhs });
307 assertFalse("two distinct Variables with same name cannot unify with distinct atoms", new Query(goal).hasSolution());
308 }
309
310 public void testVariableBinding3() {
311 Variable X = new Variable("X");
312 Term lhs = new Compound("p", new Term[] { X, X });
313 Term rhs = new Compound("p", new Term[] { new Atom("a"), new Atom("b") });
314 Term goal = new Compound("=", new Term[] { lhs, rhs });
315 assertFalse("two references to the same (named) Variable cannot unify with differing atoms", new Query(goal).hasSolution());
316 }
317
318 public void testVariableBinding4() {
319 Term lhs = new Compound("p", new Term[] { new Variable("_"), new Variable("_") });
320 Term rhs = new Compound("p", new Term[] { new Atom("a"), new Atom("b") });
321 Term goal = new Compound("=", new Term[] { lhs, rhs });
322 assertTrue("two distinct anonymous Variables can unify with distinct atoms", new Query(goal).hasSolution());
323 }
324
325 public void testVariableBinding5() {
326 Variable Anon = new Variable("_");
327 Term lhs = new Compound("p", new Term[] { Anon, Anon });
328 Term rhs = new Compound("p", new Term[] { new Atom("a"), new Atom("b") });
329 Term goal = new Compound("=", new Term[] { lhs, rhs });
330 assertTrue("two references to an anonymous Variable can unify with differing atoms", new Query(goal).hasSolution());
331 }
332
333 public void testAtomEquality2() {
334 Atom a = new Atom("a");
335 assertTrue("two references to an Atom are equal by .equals()", a.equals(a));
336 }
337
338 public void testAtomEquality3() {
339 assertTrue("two distinct, same-named Atoms are equal by .equals()", (new Atom("a")).equals(new Atom("a")));
340 }
341
342 public void testTextToTerm1() {
343 String text = "fred(B,p(A))";
344 Term t = Util.textToTerm(text);
345 assertTrue("Util.textToTerm() converts \"fred(B,p(A))\" to a corresponding Term", t.hasFunctor("fred", 2) && t.arg(1).isVariable() && t.arg(1).name().equals("B")
346 && t.arg(2).hasFunctor("p", 1) && t.arg(2).arg(1).isVariable() && t.arg(2).arg(1).name().equals("A"));
347 }
348
349 public void testArrayToList1() {
350 Term l2 = Util.termArrayToList(new Term[] { new Atom("a"), new Atom("b"), new Atom("c"), new Atom("d"), new Atom("e") });
351 Query q9 = new Query(new Compound("append", new Term[] { new Variable("Xs"), new Variable("Ys"), l2 }));
352 assertTrue("append(Xs,Ys,[a,b,c,d,e]) has 6 solutions", q9.allSolutions().length == 6);
353 }
354
355 public void testArrayToList2() {
356 String goal = "append(Xs,Ys,[a,b,c,d,e])";
357 assertTrue(goal + " has 6 solutions", Query.allSolutions(goal).length == 6);
358 }
359
360 public void testLength1() {
361 Query q5 = new Query(new Compound("length", new Term[] { new Variable("Zs"), new org.jpl7.Integer(2) }));
362 Term zs = q5.oneSolution().get("Zs");
363 assertTrue("length(Zs,2) binds Zs to a list of two distinct variables " + zs.toString(), zs.isListPair() && zs.arg(1).isVariable() && zs.arg(2).isListPair() && zs.arg(2).arg(1).isVariable()
364 && zs.arg(2).arg(2).isListNil() && !zs.arg(1).name().equals(zs.arg(2).arg(1).name()));
365 }
366
367 public void testListNil1() {
368 Term x = Query.oneSolution("X = []").get("X");
369 if (syntax.equals("traditional")) {
370 assertTrue("empty list is text atom []", x.isAtom() && x.atomType().equals("text") && x.name().equals("[]"));
371 } else {
372 assertTrue("empty list is reserved atom []", x.isAtom() && x.atomType().equals("reserved_symbol") && x.name().equals("[]"));
373 }
374 }
375
376 public void testListCons1() {
377 Term x = Query.oneSolution("X = [a]").get("X");
378 if (syntax.equals("traditional")) {
379 assertTrue("list constructor is ./2", x.isCompound() && x.name().equals("."));
380 } else {
381 assertTrue("list constructor is [|]/2", x.isCompound() && x.name().equals("[|]"));
382 }
383 }
384
385 public void testGenerate1() { // we chickened out of verifying each solution :-)
386 String goal = "append(Xs,Ys,[_,_,_,_,_])";
387 assertTrue(goal + " has 6 solutions", Query.allSolutions(goal).length == 6);
388 }
389
390 public void testPrologException1() {
391 try {
392 new Query("p(]"); // writes junk to stderr and enters debugger unless flag debug_on_error = false
393 } catch (PrologException e) {
394 assertTrue("new Query(\"p(]\") throws a PrologException " + e.toString(), true);
395 return;
396 }
397 fail("new Query(\"p(]\") oughta throw a PrologException");
398 }
399
400 public void testAtom1() {
401 assertTrue("new Atom(\"3 3\")" + (new Atom("3 3")).toString(), true);
402 }
403
404 public void testTextToTerm2() {
405 String text1 = "fred(?,2,?)";
406 String text2 = "[first(x,y),A]";
407 Term plist = Util.textToTerm(text2);
408 Term[] ps = plist.toTermArray();
409 Term t = Util.textToTerm(text1).putParams(ps);
410 assertTrue("fred(?,2,?) .putParams( [first(x,y),A] )", t.hasFunctor("fred", 3) && t.arg(1).hasFunctor("first", 2) && t.arg(1).arg(1).hasFunctor("x", 0) && t.arg(1).arg(2).hasFunctor("y", 0)
411 && t.arg(2).hasFunctor(2, 0) && t.arg(3).isVariable() && t.arg(3).name().equals("A"));
412 }
413
414 public void testDontTellMeMode1() {
415 final Query q = new Query("setof(_M,current_module(_M),_Ms),length(_Ms,N)");
416 JPL.setDTMMode(true);
417 assertTrue("in dont-tell-me mode, setof(_M,current_module(_M),_Ms),length(_Ms,N) returns binding for just one variable", q.oneSolution().keySet().size() == 1);
418 }
419
420 public void testDontTellMeMode2() {
421 final Query q = new Query("setof(_M,current_module(_M),_Ms),length(_Ms,N)");
422 JPL.setDTMMode(false);
423 assertTrue("not in dont-tell-me mode, setof(_M,current_module(_M),_Ms),length(_Ms,N) returns binding for three variables", q.oneSolution().keySet().size() == 3);
424 }
425
426 public void testModulePrefix1() {
427 assertTrue(Query.hasSolution("call(user:true)"));
428 }
429
430 private void testMutualRecursion(int n, long f) { // f is the expected result for fac(n)
431 try {
432 assertEquals("mutual recursive Java<->Prolog factorial: fac(" + n + ") = " + f, fac(n), f);
433 } catch (Exception e) {
434 fail("fac(" + n + ") threw " + e);
435 }
436 }
437
438 public void testMutualRecursion1() {
439 testMutualRecursion(1, 1);
440 }
441
442 public void testMutualRecursion2() {
443 testMutualRecursion(2, 2);
444 }
445
446 public void testMutualRecursion3() {
447 testMutualRecursion(3, 6);
448 }
449
450 public void testMutualRecursion10() {
451 testMutualRecursion(10, 3628800);
452 }
453
454 public void testIsJNull1() {
455 Term atNull = new Compound("@", new Term[] { new Atom("null") });
456 Query q = new Query("=", new Term[] { new Variable("X"), atNull });
457 assertTrue(q.oneSolution().get("X").isJNull());
458 }
459
460 public void testIsJNull2() {
461 Term t = Query.oneSolution("X = @(3)").get("X");
462 assertFalse("@(3) . isJNull() fails", t.isJNull());
463 }
464
465 public void testIsJNull3() {
466 Term t = Query.oneSolution("X = _").get("X");
467 assertFalse("_ . isJNull() fails", t.isJNull());
468 }
469
470 public void testIsJNull4() {
471 Term t = Query.oneSolution("X = @(true)").get("X");
472 assertFalse("@(true) . isJNull() fails", t.isJNull());
473 }
474
475 public void testIsJNull5() {
476 Term t = Query.oneSolution("X = @(false)").get("X");
477 assertFalse("@(false) . isJNull() fails", t.isJNull());
478 }
479
480 public void testIsJTrue1() {
481 Term t = Query.oneSolution("X = @(true)").get("X");
482 assertTrue("@(true) . isJTrue() succeeds", t.isJTrue());
483 }
484
485 public void testIsJTrue2() {
486 Term t = Query.oneSolution("X = @(3)").get("X");
487 assertFalse("@(3) . isJTrue() fails", t.isJTrue());
488 }
489
490 public void testIsJTrue3() {
491 Term t = Query.oneSolution("X = _").get("X");
492 assertFalse("_ . isJTrue() fails", t.isJTrue());
493 }
494
495 public void testIsJTrue4() {
496 Term t = Query.oneSolution("X = @(false)").get("X");
497 assertFalse("@(false) . isJTrue() fails", t.isJTrue());
498 }
499
500 public void testIsJVoid1() {
501 Term t = Query.oneSolution("X = @(void)").get("X");
502 assertTrue("@(void) . isJVoid() succeeds", t.isJVoid());
503 }
504
505 public void testIsJVoid2() {
506 Term t = Query.oneSolution("X = @(3)").get("X");
507 assertFalse("@(3) . isJVoid() fails", t.isJVoid());
508 }
509
510 public void testIsJVoid3() {
511 Term t = Query.oneSolution("X = _").get("X");
512 assertFalse("_ . isJVoid() fails", t.isJVoid());
513 }
514
515 public void testTypeName1() {
516 assertEquals("Y = foo binds Y to an Atom", Query.oneSolution("Y = foo").get("Y").typeName(), "Atom");
517 }
518
519 public void testTypeName2() {
520 assertEquals("Y = 3.14159 binds Y to a Float", Query.oneSolution("Y = 3.14159").get("Y").typeName(), "Float");
521 }
522
523 public void testTypeName4() {
524 assertEquals("Y = 6 binds Y to an Integer", Query.oneSolution("Y = 6").get("Y").typeName(), "Integer");
525 }
526
527 public void testTypeName5() {
528 assertEquals("Y = _ binds Y to a Variable", Query.oneSolution("Y = _").get("Y").typeName(), "Variable");
529 }
530
531 public void testTypeName3() {
532 assertEquals("Y = f(x) binds Y to a Compound", Query.oneSolution("Y = f(x)").get("Y").typeName(), "Compound");
533 }
534
535 public void testGoalWithModulePrefix1() {
536 String goal = "jpl:jpl_modifier_bit(volatile,I)";
537 assertTrue(goal + " binds I to an integer", Query.oneSolution(goal).get("I").isInteger());
538 }
539
540 public void testGoalWithModulePrefix2() {
541 String goal = "user:length([],0)";
542 assertTrue(goal + " succeeds", Query.hasSolution(goal));
543 }
544
545 public void testGoalWithModulePrefix3() {
546 String goal = "3:length([],0)";
547 try {
548 Query.hasSolution(goal); // should throw exception
549 fail(goal + " (numeric module prefix) didn't throw exception"); // shouldn't get to here
550 } catch (org.jpl7.PrologException e) { // expected exception class
551 if (e.term().hasFunctor("error", 2) && e.term().arg(1).hasFunctor("type_error", 2) && e.term().arg(1).arg(1).hasFunctor("atom", 0)) {
552 // OK: an appropriate exception was thrown
553 } else {
554 fail(goal + " (numeric module prefix) threw incorrect PrologException: " + e);
555 }
556 } catch (Exception e) {
557 fail(goal + " (numeric module prefix) threw wrong class of exception: " + e);
558 }
559 }
560
561 public void testGoalWithModulePrefix4() {
562 String goal = "_:length([],0)";
563 try {
564 Query.hasSolution(goal); // should throw exception
565 fail(goal + " (unbound module prefix) wrongly succeeded"); // shouldn't get to here
566 } catch (org.jpl7.PrologException e) { // expected exception class
567 if (e.term().hasFunctor("error", 2) && e.term().arg(1).hasFunctor("instantiation_error", 0)) {
568 // OK: an appropriate exception was thrown
569 } else {
570 fail(goal + " (unbound module prefix) threw wrong PrologException: " + e);
571 }
572 } catch (Exception e) {
573 fail(goal + " (unbound module prefix) threw wrong exception class: " + e);
574 }
575 }
576
577 public void testGoalWithModulePrefix5() {
578 String goal = "f(x):length([],0)";
579 try {
580 Query.hasSolution(goal); // should throw exception
581 fail(goal + " (compound module prefix) wrongly succeeded"); // shouldn't get to here
582 } catch (org.jpl7.PrologException e) { // correct exception class
583 if (e.term().hasFunctor("error", 2) && e.term().arg(1).hasFunctor("type_error", 2) && e.term().arg(1).arg(1).hasFunctor("atom", 0)) {
584 // OK: an appropriate exception was thrown
585 } else {
586 fail(goal + " (compound module prefix) threw wrong PrologException: " + e);
587 }
588 } catch (Exception e) {
589 fail(goal + " (compound module prefix) threw wrong exception class: " + e);
590 }
591 }
592
593 public void testGoalWithModulePrefix6() {
594 String goal = "no_such_module:no_such_predicate(0)";
595 try {
596 Query.hasSolution(goal); // should throw exception
597 fail(goal + " (nonexistent module prefix) wrongly succeeded"); // shouldn't get to here
598 } catch (org.jpl7.PrologException e) { // expected exception class
599 if (e.term().hasFunctor("error", 2) && e.term().arg(1).hasFunctor("existence_error", 2) && e.term().arg(1).arg(1).hasFunctor("procedure", 0)) {
600 // OK: an appropriate exception was thrown
601 } else {
602 fail(goal + " (nonexistent module prefix) threw wrong PrologException: " + e);
603 }
604 } catch (Exception e) {
605 fail(goal + " (nonexistent module prefix) threw wrong exception class: " + e);
606 }
607 }
608
609 // public void testFetchCyclicTerm(){
610 // assertTrue((new Query("X=f(X)")).hasSolution());
611 // }
612 public void testFetchLongList0() {
613 assertTrue((new Query("findall(foo(N),between(0,10,N),L)")).hasSolution());
614 }
615
616 public void testFetchLongList1() {
617 assertTrue((new Query("findall(foo(N),between(0,100,N),L)")).hasSolution());
618 }
619
620 public void testFetchLongList2() {
621 assertTrue((new Query("findall(foo(N),between(0,1000,N),L)")).hasSolution());
622 }
623
624 public void testFetchLongList2c() {
625 assertTrue((new Query("findall(foo(N),between(0,1023,N),L)")).hasSolution());
626 }
627
628 // public void testFetchLongList2a() { /* leads to stack overflow */
629 // assertTrue((new Query("findall(foo(N),between(0,2000,N),L)")).hasSolution());
630 // }
631 // public void testFetchLongList2b() {
632 // assertTrue((new Query("findall(foo(N),between(0,3000,N),L)")).hasSolution());
633 // }
634 // public void testFetchLongList3() {
635 // assertTrue((new Query("findall(foo(N),between(0,10000,N),L)")).hasSolution());
636 // }
637 public void testUnicode0() {
638 assertTrue(Query.hasSolution("atom_codes(?,[32])", new Term[] { new Atom(" ") }));
639 }
640
641 public void testUnicode0a() {
642 assertTrue(Query.hasSolution("atom_codes(?,[32])", new Term[] { new Atom("\u0020") }));
643 }
644
645 public void testUnicode0b() {
646 assertTrue(Query.hasSolution("atom_codes(?,[0])", new Term[] { new Atom("\u0000") }));
647 }
648
649 public void testUnicode0c() {
650 assertTrue(Query.hasSolution("atom_codes(?,[1])", new Term[] { new Atom("\u0001") }));
651 }
652
653 public void testUnicode0d() {
654 assertTrue(Query.hasSolution("atom_codes(?,[127])", new Term[] { new Atom("\u007F") }));
655 }
656
657 public void testUnicode0e() {
658 assertTrue(Query.hasSolution("atom_codes(?,[128])", new Term[] { new Atom("\u0080") }));
659 }
660
661 public void testUnicode0f() {
662 assertTrue(Query.hasSolution("atom_codes(?,[255])", new Term[] { new Atom("\u00FF") }));
663 }
664
665 public void testUnicode0g() {
666 assertTrue(Query.hasSolution("atom_codes(?,[256])", new Term[] { new Atom("\u0100") }));
667 }
668
669 public void testUnicode1() {
670 assertTrue(Query.hasSolution("atom_codes(?,[0,127,128,255])", new Term[] { new Atom("\u0000\u007F\u0080\u00FF") }));
671 }
672
673 public void testUnicode2() {
674 assertTrue(Query.hasSolution("atom_codes(?,[256,32767,32768,65535])", new Term[] { new Atom("\u0100\u7FFF\u8000\uFFFF") }));
675 }
676
677 public void testStringXput1() {
678 Term a = Query.oneSolution("string_concat(foo,bar,S)").get("S");
679 assertEquals("foobar", a.name());
680 assertEquals("string", a.atomType());
681 }
682
683 public void testStringXput2() {
684 String s1 = "\u0000\u007F\u0080\u00FF";
685 String s2 = "\u0100\u7FFF\u8000\uFFFF";
686 String s = s1 + s2; // concatenate in Java
687 Term a = Query.oneSolution("string_concat(?,?,S)", new Term[] { new Atom(s1), new Atom(s2) }).get("S"); // concatenate in Prolog
688 assertEquals(s, a.name());
689 assertEquals("string", a.atomType());
690 }
691
692 // public void testMaxInteger1() {
693 // assertEquals(Query.oneSolution("current_prolog_flag(max_integer,I)").get("I").longValue(), java.lang.Long.MAX_VALUE); // i.e. 9223372036854775807L
694 // }
695
696 // public void testSingleton1() {
697 // assertTrue(Query.hasSolution("style_check(-singleton),consult('test_singleton.pl')"));
698 // }
699
700 public void testStaticQueryInvalidSourceText2() {
701 String goal = "p(]";
702 try {
703 Query.hasSolution(goal); // should throw exception
704 fail(goal + " (bad syntax) succeeded"); // shouldn't get to here
705 } catch (org.jpl7.PrologException e) { // expected exception
706 if (e.term().hasFunctor("error", 2) && e.term().arg(1).hasFunctor("syntax_error", 1) && e.term().arg(1).arg(1).hasFunctor("cannot_start_term", 0)) {
707 // OK: an appropriate exception was thrown
708 } else {
709 fail(goal + " (bad syntax) threw wrong PrologException: " + e);
710 }
711 } catch (Exception e) {
712 fail(goal + " (bad syntax) threw wrong exception class: " + e);
713 }
714 }
715
716 public void testStaticQueryInvalidSourceText1() {
717 String goal = "bad goal";
718 try {
719 Query.hasSolution(goal); // should throw exception
720 fail(goal + " (bad syntax) succeeded"); // shouldn't get to here
721 } catch (org.jpl7.PrologException e) { // expected exception
722 if (e.term().hasFunctor("error", 2) && e.term().arg(1).hasFunctor("syntax_error", 1) && e.term().arg(1).arg(1).hasFunctor("operator_expected", 0)) {
723 // OK: an appropriate exception was thrown
724 } else {
725 fail(goal + " (bad syntax) threw wrong PrologException: " + e);
726 }
727 } catch (Exception e) {
728 fail(goal + " (bad syntax) threw wrong exception class: " + e);
729 }
730 }
731
732 public void testStaticQueryNSolutions1() {
733 String goal = "member(X, [0,1,2,3,4,5,6,7,8,9])";
734 int n = 5;
735 assertTrue("Query.nSolutions(" + goal + ", " + n + ") returns " + n + " solutions", Query.nSolutions(goal, n).length == n);
736 }
737
738 public void testStaticQueryNSolutions2() {
739 String goal = "member(X, [0,1,2,3,4,5,6,7,8,9])";
740 int n = 0;
741 assertTrue("Query.nSolutions(" + goal + ", " + n + ") returns " + n + " solutions", Query.nSolutions(goal, n).length == n);
742 }
743
744 public void testStaticQueryNSolutions3() {
745 String goal = "member(X, [0,1,2,3,4,5,6,7,8,9])";
746 int n = 20;
747 assertTrue("Query.nSolutions(" + goal + ", " + n + ") returns 10 solutions", Query.nSolutions(goal, n).length == 10);
748 }
749
750 public void testStaticQueryAllSolutions1() {
751 String goal = "member(X, [0,1,2,3,4,5,6,7,8,9])";
752 assertTrue("Query.allSolutions(" + goal + ") returns 10 solutions", Query.allSolutions(goal).length == 10);
753 }
754
755 public void testStaticQueryHasSolution1() {
756 String goal = "memberchk(13, [?,?,?])";
757 Term[] params = new Term[] { new Integer(12), new Integer(13), new Integer(14) };
758 assertTrue(Query.hasSolution(goal, params));
759 }
760
761 public void testStaticQueryHasSolution2() {
762 String goal = "memberchk(23, [?,?,?])";
763 Term[] params = new Term[] { new Integer(12), new Integer(13), new Integer(14) };
764 assertFalse(Query.hasSolution(goal, params));
765 }
766
767 public void testUtilListToTermArray1() {
768 String goal = "T = [a,b,c]";
769 Term list = Query.oneSolution(goal).get("T");
770 Term[] array = Util.listToTermArray(list);
771 assertTrue(array[2].isAtom() && array[2].name().equals("c"));
772 }
773
774 public void testTermToTermArray1() {
775 String goal = "T = [a,b,c]";
776 Term list = Query.oneSolution(goal).get("T");
777 Term[] array = list.toTermArray();
778 assertTrue(array[2].isAtom() && array[2].name().equals("c"));
779 }
780
781 public void testJRef1() {
782 int i = 76543;
783 Integer I = new Integer(i);
784 Query q = new Query("jpl_call(?,intValue,[],I2)", new Term[] { Term.objectToJRef(I) });
785 Term I2 = q.oneSolution().get("I2");
786 assertTrue(I2.isInteger() && I2.intValue() == i);
787 }
788
789 public void testBerhhard1() {
790 assertTrue(Query.allSolutions("consult(library('lists'))").length == 1);
791 }
792
793 public void testWouter1() { // Wouter says this fails under OS X Mavericks 10.9 x86-64
794 long n = 7381783232223l; // too big for an int
795 Compound term = new org.jpl7.Compound("is", new org.jpl7.Term[] { new org.jpl7.Variable("X"), new org.jpl7.Integer(n) });
796 Map<String, Term>[] solutions = new Query(term).allSolutions();
797 assertEquals(1, solutions.length);
798 Map<String, Term> solution = solutions[0];
799 assertTrue(solution.containsKey("X"));
800 Object result = solution.get("X");
801 assertTrue(result instanceof org.jpl7.Integer);
802 assertEquals(n, ((org.jpl7.Integer) result).longValue());
803 }
804
805 public void testJRef2() {
806 int i = 76543;
807 Integer I = new Integer(i);
808 Query q = new Query("jpl_call(?,intValue,[],I2)", org.jpl7.JPL.newJRef(I));
809 Term I2 = q.oneSolution().get("I2");
810 assertTrue(I2.isInteger() && I2.intValue() == i);
811 }
812
813 public void testJRef3() {
814 StringBuffer sb = new StringBuffer();
815 Query.oneSolution("jpl_call(?,append,['xyz'],_)", new Term[] { JPL.newJRef(sb) });
816 assertTrue(sb.toString().equals("xyz"));
817 }
818
819 public void testJRef4() {
820 Term jrefSB = Query.oneSolution("jpl_new('java.lang.StringBuffer',['abc'],SB)").get("SB");
821 assertTrue(jrefSB.isJRef() && ((StringBuffer) jrefSB.jrefToObject()).toString().equals("abc"));
822 }
823
824 public void testJRef5() {
825 String token = "foobar345";
826 Term a = Query.oneSolution("jpl_new('java.lang.StringBuffer',[?],A)", new Term[] { new Atom(token) }).get("A");
827 assertTrue(((java.lang.StringBuffer) (a.jrefToObject())).toString().equals(token));
828 }
829
830 public void testRef6() {
831 Term nullJRef = new Compound("@", new Term[] { new Atom("null") });
832 Object nullObject = nullJRef.jrefToObject();
833 assertNull("@(null) .jrefToObject() yields null", nullObject);
834 }
835
836 public void testRef7() {
837 Term badJRef = new Compound("@", new Term[] { new Atom("foobar") });
838 try {
839 badJRef.jrefToObject(); // should throw exception
840 fail("@(foobar) .jrefToObject() shoulda thrown JPLException"); // shouldn't get to here
841 } catch (JPLException e) { // expected exception class
842 if (e.getMessage().endsWith("term is not a JRef")) {
843 // OK: an appropriate exception was thrown
844 } else {
845 fail("@(foobar) .jrefToObject() threw wrong JPLException: " + e);
846 }
847 } catch (Exception e) {
848 fail("@(foobar) .jrefToObject() threw wrong exception class: " + e);
849 }
850 }
851
852 public void testForeignFrame1() {
853 int ls1 = Query.oneSolution("statistics(localused,LS)").get("LS").intValue();
854 int ls2 = Query.oneSolution("statistics(localused,LS)").get("LS").intValue();
855 assertTrue("local stack size unchanged after query", ls1 == ls2);
856 }
857
858 public void testOpenGetClose1() {
859 StringBuffer sb = new StringBuffer();
860 Query q = new Query("atom_chars(prolog, Cs), member(C, Cs)");
861 Map<String, Term> soln;
862 q.open();
863 while ((soln = q.getSolution()) != null) {
864 sb.append(((Atom) soln.get("C")).name());
865 }
866 q.close();
867 assertEquals("prolog", sb.toString());
868 }
869
870 public void testOpenGetClose2() {
871 Query q = new Query("dummy"); // we're not going to open this...
872 try {
873 q.getSolution(); // should throw exception (query not open)
874 fail("getSolution() succeeds on unopened Query"); // shouldn't get to here
875 } catch (JPLException e) { // expected exception class
876 if (e.getMessage().endsWith("Query is not open")) {
877 // OK: an appropriate exception was thrown
878 } else {
879 fail("jpl.Query#getSolution() threw wrong JPLException: " + e);
880 }
881 } catch (Exception e) {
882 fail("jpl.Query#getSolution() threw wrong exception class: " + e);
883 }
884 }
885
886 public void testOpen1() {
887 Query q = new Query("dummy");
888 assertTrue("a newly created query is not open", !q.isOpen());
889 }
890
891 public void testOpen2() {
892 Query q = new Query("fail");
893 q.open();
894 assertTrue("a newly opened query which has no solutions is open", q.isOpen());
895 }
896
897 public void testGetSolution1() {
898 Query q = new Query("fail");
899 q.open();
900 q.getSolution();
901 assertTrue("an opened query on which getSolution has failed once is closed", !q.isOpen());
902 }
903
904 public void testGetSolution2() {
905 Query q = new Query("fail"); // this query has no solutions
906 q.open(); // this opens the query
907 q.getSolution(); // this finds no solution, and closes the query
908 try {
909 q.getSolution(); // this call is invalid, as the query is closed
910 // shouldn't get to here
911 fail("jpl.Query#getSolution() shoulda thrown JPLException");
912 } catch (JPLException e) { // correct exception class, but is it correct in detail?
913 if (e.getMessage().endsWith("Query is not open")) { // ...which should throw a JPLException like this
914 // OK: an appropriate exception was thrown
915 } else {
916 fail("jpl.Query#getSolution() threw incorrect JPLException: " + e);
917 }
918 } catch (Exception e) {
919 fail("jpl.Query#getSolution() threw wrong class of exception: " + e);
920 }
921 }
922
923 public void testHasMoreSolutions1() {
924 StringBuffer sb = new StringBuffer();
925 Query q = new Query("atom_chars(prolog, Cs), member(C, Cs)");
926 Map<String, Term> soln;
927 q.open();
928 while (q.hasMoreSolutions()) {
929 soln = q.nextSolution();
930 sb.append(((Atom) soln.get("C")).name());
931 }
932 q.close();
933 assertEquals("Query#hasMoreSolutions() + Query#nextSolution() work as intended", "prolog", sb.toString());
934 }
935
936 @SuppressWarnings("unchecked")
937 public void testHasMoreElements1() {
938 StringBuffer sb = new StringBuffer();
939 Query q = new Query("atom_chars(prolog, Cs), member(C, Cs)");
940 Map<String, Term> soln;
941 q.open();
942 while (q.hasMoreElements()) {
943 soln = (Map<String, Term>) q.nextElement();
944 sb.append(((Atom) soln.get("C")).name());
945 }
946 q.close();
947 assertEquals("Query#hasMoreElements() + Query#nextElement() work as intended", "prolog", sb.toString());
948 }
949
950 public void testStackedQueries1() {
951 StringBuffer sb = new StringBuffer();
952 Query q = new Query("atom_chars(prolog, Cs), member(C, Cs)");
953 Map<String, Term> soln;
954 q.open();
955 while ((soln = q.getSolution()) != null) {
956 Atom a = (Atom) soln.get("C");
957 if (Query.hasSolution("memberchk(?, [l,o,r])", new Term[] { a })) { // this query opens and closes while an earlier query is still open
958 sb.append(((Atom) soln.get("C")).name());
959 }
960 }
961 assertTrue(!q.isOpen()); // q will have been closed by the final getSolution()
962 assertEquals("rolo", sb.toString());
963 }
964
965 }
0 package org.jpl7.test;
1
2 import java.util.Map;
3
4 import org.jpl7.Atom;
5 import org.jpl7.Compound;
6 import org.jpl7.Integer;
7 import org.jpl7.JPL;
8 import org.jpl7.Query;
9 import org.jpl7.Term;
10 import org.jpl7.Util;
11 import org.jpl7.Variable;
12 import org.jpl7.fli.Prolog;
13
14 // This class is nearly obsolete; most of its tests have been migrated to TestJUnit.
15 public class TestOLD {
16 private static void test10() {
17 System.err.println("test10:");
18 System.err.println(" java_lib_version = " + JPL.version_string());
19 System.err.println(" c_lib_version = " + org.jpl7.fli.Prolog.get_c_lib_version());
20 System.err.println(" pl_lib_version = " + new Query(new Compound("jpl_pl_lib_version", new Term[] { new Variable("V") })).oneSolution().get("V"));
21 System.err.println(" java.version = " + System.getProperty("java.version"));
22 System.err.println(" os.name = " + System.getProperty("os.name"));
23 System.err.println(" os.arch = " + System.getProperty("os.arch"));
24 System.err.println(" os.version = " + System.getProperty("os.version"));
25 System.err.println();
26 }
27
28 private static void test10j() {
29 Term l2 = Util.termArrayToList(new Term[] { new Atom("a"), new Atom("b"), new Atom("c"), new Atom("d"), new Atom("e") });
30 Query q9 = new Query(new Compound("append", new Term[] { new Variable("Xs"), new Variable("Ys"), l2 }));
31 Map<String, Term>[] s9s = q9.allSolutions();
32 System.err.println("test10j:");
33 for (int i = 0; i < s9s.length; i++) {
34 System.err.println(" append(Xs,Ys,[a,b,c,d,e]) -> " + Util.toString(s9s[i]));
35 }
36 System.err.println();
37 }
38
39 private static void test10k() {
40 String[] args = org.jpl7.fli.Prolog.get_default_init_args();
41 String which;
42 String s = "";
43 System.err.println("test10k:");
44 if (args == null) {
45 args = org.jpl7.fli.Prolog.get_actual_init_args();
46 which = "actual";
47 } else {
48 which = "default";
49 }
50 for (int i = 0; i < args.length; i++) {
51 s = s + args[i] + " ";
52 }
53 System.err.println(" " + which + "_init_args = " + s + '\n');
54 }
55
56 private static void test10l() {
57 Query q5 = new Query(new Compound("length", new Term[] { new Variable("Zs"), new org.jpl7.Integer(5) }));
58 Map<String, Term> s5 = q5.oneSolution();
59 System.err.println("test10l:");
60 System.err.println(" length(Zs,5)");
61 System.err.println(" " + Util.toString(s5));
62 System.err.println(" Zs = " + (Term) s5.get("Zs"));
63 System.err.println();
64 }
65
66 private static void test10m() {
67 String text = "append(Xs,Ys,[_,_,_,_,_])";
68 Query q = new Query(text);
69 Map<String, Term>[] ss = q.allSolutions();
70 System.err.println("test10m:");
71 System.err.println(" all solutions of " + text);
72 for (int i = 0; i < ss.length; i++) {
73 System.err.println(" " + Util.toString(ss[i]));
74 }
75 System.err.println();
76 }
77
78 private static void test10o() {
79 System.err.println("test10o:");
80 Term l2b = Util.termArrayToList(new Term[] { new Variable("A"), new Variable("B"), new Variable("C"), new Variable("D"), new Variable("E") });
81 Query q9b = new Query(new Compound("append", new Term[] { new Variable("Xs"), new Variable("Ys"), l2b }));
82 Map<String, Term>[] s9bs = q9b.allSolutions();
83 for (int i = 0; i < s9bs.length; i++) {
84 System.err.println(" append(Xs,Ys,[A,B,C,D,E]) -> " + Util.toString(s9bs[i]));
85 }
86 System.err.println();
87 }
88
89 private static void test10q() {
90 System.err.println("test10q:");
91 System.err.println((new Compound("Bad Name", new Term[] { new Atom("3 3") })).toString());
92 System.err.println();
93 }
94
95 @SuppressWarnings("unused")
96 private static void test10s() {
97 final Query q = new Query("jpl_slow_goal"); // 10 successive sleep(1)
98 System.err.println("test10s:");
99 Thread t = new Thread(new Runnable() {
100 public void run() {
101 try {
102 System.err.println("q.hasSolution() ... ");
103 System.err.println(q.hasSolution() ? "finished" : "failed");
104 } catch (Exception e) {
105 System.err.println("q.hasSolution() threw " + e);
106 }
107 }
108 });
109 t.start(); // call the query in a separate thread
110 System.err.println("pausing for 2 secs...");
111 try {
112 Thread.sleep(2000);
113 } catch (InterruptedException e) {
114 ;
115 } // wait a coupla seconds for it to get started
116 // (new Query("set_prolog_flag(abort_with_exception, true)")).hasSolution();
117 System.err.println("calling q.abort()...");
118 // q.abort();
119 System.err.println();
120 }
121
122 public static void main(String argv[]) {
123 Prolog.set_default_init_args(new String[] { "libpl.dll", "-f", "none", "-g", "set_prolog_flag(debug_on_error,false)", "-q" });
124 System.err.println("tag = " + Prolog.object_to_tag(new Query("hello")));
125 test10k();
126 test10();
127 // test10h();
128 // test10i();
129 test10j();
130 test10k();
131 test10l();
132 test10m();
133 // test10n();
134 test10o();
135 // test10p();
136 test10q();
137 // test10r();
138 // test10s();
139 // test10t();
140 // test10u();
141 // test10v();
142 String s = new String("" + '\0' + '\377');
143 System.err.println("s.length = " + s.length());
144 for (int i = 0; i < s.length(); i++) {
145 System.err.print((new Integer(s.charAt(i))).toString() + " ");
146 }
147 System.err.println();
148 System.err.println(new Query("atom_codes(A,[127,128,255,0])").oneSolution().toString());
149 }
150 }
0 package org.jpl7.test;
1
2 import java.net.URL;
3 import java.util.Map;
4
5 import org.jpl7.Atom;
6 import org.jpl7.Query;
7 import org.jpl7.Term;
8 import org.jpl7.Variable;
9
10 public class Versions {
11 public static void main(String argv[]) {
12
13 System.out.println("command line args: (" + argv.length + ")");
14 for (int i = 0; i < argv.length; i++) {
15 System.out.println(" argv[" + i + "]: " + argv[i]);
16 }
17 System.out.println();
18
19 System.out.println("old (built in) default init args:");
20 String[] defaultInitArgsOld = org.jpl7.JPL.getDefaultInitArgs();
21 for (int i = 0; i < defaultInitArgsOld.length; i++) {
22 System.out.println(" arg[" + i + "]: " + defaultInitArgsOld[i]);
23 }
24 System.out.println();
25
26 String[] defaultInitArgsNew1;
27 if (argv.length == 1 && argv[0].equals("traditional")) {
28 defaultInitArgsNew1 = new String[] { "swipl", "-g", "true", "-nosignals", "--traditional" };
29 } else {
30 defaultInitArgsNew1 = new String[] { "swipl", "-g", "true", "-nosignals" };
31 }
32 org.jpl7.JPL.setDefaultInitArgs(defaultInitArgsNew1);
33
34 System.out.println("new (stashed) default init args:");
35 String[] defaultInitArgsNew2 = org.jpl7.JPL.getDefaultInitArgs();
36 for (int i = 0; i < defaultInitArgsNew2.length; i++) {
37 System.out.println(" arg[" + i + "]: " + defaultInitArgsNew2[i]);
38 }
39 System.out.println();
40
41 // if (!Query.hasSolution("consult('Versions.pl')")) {
42 // System.out.println("Warning: failed to consult Versions.pl");
43 // System.out.println();
44 // }
45
46 if (!(new Query("consult", new Atom("jpl/test/Versions.pl"))).hasSolution()) {
47 System.out.println("Warning: failed to consult Versions.pl");
48 System.out.println();
49 }
50
51 // String swiplHome = ((Term) (new Query("current_prolog_flag(home,Home)")).oneSolution().get("Home")).name();
52 // System.out.println(" SWI-Prolog home dir: " + swiplHome );
53
54 System.out.println("home1 = " + (new Atom("c:/swipl-7.1.26")).toString());
55
56 Query q1 = new Query("current_prolog_flag", new Term[] { new Atom("home"), new Variable("Home") });
57 Map<String, Term> h1 = q1.oneSolution();
58 Term home = (Term) h1.get("Home");
59 // System.out.println("Home = " + home.debugString());
60 System.out.println("Home = " + home.toString());
61
62 try {
63 URL jarPathJpl = Class.forName("org.jpl7.JPL").getProtectionDomain().getCodeSource().getLocation();
64 System.out.println("package jpl loaded from: " + jarPathJpl);
65 } catch (ClassNotFoundException e) {
66 System.out.println("org.jpl7.JPL not found");
67 }
68
69 String prologVersion = ((Term) (new Query("jpl_pl_lib_version(V)")).oneSolution().get("V")).name();
70 System.out.println(" prolog library version: " + prologVersion);
71 String javaVersion = org.jpl7.JPL.version_string();
72 System.out.println(" java library version: " + javaVersion);
73 String cVersion = org.jpl7.fli.Prolog.get_c_lib_version();
74 System.out.println(" c library version: " + cVersion);
75
76 System.out.println(" SWI Prolog syntax: " + org.jpl7.fli.Prolog.get_syntax());
77
78 // if ( prologVersion.equals(javaVersion) && javaVersion.equals(cVersion) ) {
79 // System.out.println("BINGO! you appear to have the same version of each library installed");
80 // } else {
81 // System.out.println("WHOOPS! you appear not to have the same version of each library installed");
82 // }
83
84 System.out.println();
85 }
86 }
0 % a simple database for Family.java
1
2 child_of( joe, ralf ).
3 child_of( mary, joe ).
4 child_of( steve, joe ).
5
6 descendent_of( X, Y ) :-
7 child_of( X, Y ).
8 descendent_of( X, Y ) :-
9 child_of( Z, Y ),
10 descendent_of( X, Z ).
11
12 p( A, B) :-
13 ( q( A, B)
14 -> write( 'OK'-q(A,B)), nl
15 ; write( 'FAIL'-q(A,B)), nl
16 ).
17
18 q( 3, 4).
19
20 r( 5, 5).
0 p( N, T) :-
1 ( N > 1
2 -> Nx is N-1,
3 p( Nx, Tx),
4 T = a(Tx,Tx)
5 ; N == 1
6 -> T = a
7 ).
8
0 package org.jpl7.util;
1
2 import java.io.BufferedReader;
3 import java.io.InputStream;
4 import java.io.InputStreamReader;
5
6 public class Getenv {
7
8 public static void main(String args[]) {
9
10 try {
11 getenv();
12 } catch (java.io.IOException e) {
13 }
14 }
15
16 public static void getenv() throws java.io.IOException, java.io.UnsupportedEncodingException {
17 Runtime rt = Runtime.getRuntime();
18
19 String a[] = new String[3];
20 a[0] = "CMD";
21 a[1] = "/C";
22 a[2] = "SET";
23
24 Process p = rt.exec(a);
25
26 InputStream is = p.getInputStream();
27
28 InputStreamReader isr = new InputStreamReader(is, "UTF8");
29
30 BufferedReader br = new BufferedReader(isr);
31
32 getenv1(br);
33 }
34
35 static void getenv1(BufferedReader br) throws java.io.IOException {
36
37 String s = br.readLine();
38
39 if (s != null) {
40 System.out.println(s);
41 getenv1(br);
42 }
43 }
44 }
0 package org.jpl7.util;
1
2 /**
3 * HashedRefs collision list.
4 */
5 class HashedRefsEntry {
6 int hash;
7 Object obj;
8 public int iref;
9 public HashedRefsEntry next;
10 }
11
12 public class HashedRefs {
13 /**
14 * The hash table data.
15 */
16 public transient HashedRefsEntry table[];
17
18 /**
19 * The total number of entries in the hash table.
20 */
21 private transient int count;
22
23 /**
24 * Rehashes the table when count exceeds this threshold.
25 */
26 private int threshold;
27
28 /**
29 * The load factor for the hashtable.
30 */
31 private float loadFactor;
32
33 public HashedRefs(int initialCapacity, float loadFactor) {
34 if ((initialCapacity <= 0) || (loadFactor <= 0.0)) {
35 throw new IllegalArgumentException();
36 }
37 this.loadFactor = loadFactor;
38 table = new HashedRefsEntry[initialCapacity];
39 threshold = (int) (initialCapacity * loadFactor);
40 }
41
42 public HashedRefs(int initialCapacity) {
43 this(initialCapacity, 0.75f);
44 }
45
46 public HashedRefs() {
47 this(101, 0.75f);
48 }
49
50 public int size() {
51 return count;
52 }
53
54 protected void rehash() {
55 int oldCapacity = table.length;
56 HashedRefsEntry oldTable[] = table;
57
58 int newCapacity = oldCapacity * 2 + 1;
59 HashedRefsEntry newTable[] = new HashedRefsEntry[newCapacity];
60
61 threshold = (int) (newCapacity * loadFactor);
62 table = newTable;
63
64 for (int i = oldCapacity; i-- > 0;) {
65 for (HashedRefsEntry old = oldTable[i]; old != null;) {
66 HashedRefsEntry e = old;
67 old = old.next;
68
69 int index = (e.hash & 0x7FFFFFFF) % newCapacity;
70 e.next = newTable[index];
71 newTable[index] = e;
72 }
73 }
74 }
75
76 public synchronized int add(Object obj, int iref) {
77 // Make sure the object reference is not null
78 if (obj == null) {
79 throw new NullPointerException();
80 }
81
82 // check whether object is already in the hashtable...
83 HashedRefsEntry tab[] = table;
84 int hash = java.lang.System.identityHashCode(obj);
85 int index = (hash & 0x7FFFFFFF) % tab.length;
86 for (HashedRefsEntry e = tab[index]; e != null; e = e.next) {
87 if ((e.hash == hash) && (e.obj == obj)) {
88 return e.iref; // existing global reference to this object
89 }
90 }
91
92 if (count >= threshold) {
93 // Rehash the table if the threshold is exceeded
94 rehash();
95 return add(obj, iref);
96 }
97
98 // create a new entry...
99 HashedRefsEntry e = new HashedRefsEntry();
100 e.hash = hash;
101 e.obj = obj;
102 e.iref = iref;
103 e.next = tab[index];
104 tab[index] = e;
105 count++;
106 return 0; // indicates this reference has been added
107 }
108
109 public synchronized boolean del(Object obj) {
110 HashedRefsEntry tab[] = table;
111 int hash = java.lang.System.identityHashCode(obj);
112 int index = (hash & 0x7FFFFFFF) % tab.length;
113 for (HashedRefsEntry e = tab[index], prev = null; e != null; prev = e, e = e.next) {
114 if ((e.hash == hash) && (e.obj == obj)) {
115 if (prev != null) {
116 prev.next = e.next;
117 } else {
118 tab[index] = e.next;
119 }
120 count--;
121 return true;
122 }
123 }
124 return false;
125 }
126
127 public synchronized void clear() {
128 HashedRefsEntry tab[] = table;
129 for (int index = tab.length; --index >= 0;)
130 tab[index] = null;
131 count = 0;
132 }
133
134 }
0 package org.jpl7.util;
1
2 public class Mod {
3 public static void main(String args[]) {
4
5 System.out.println(" 17 % 5 = " + (17 % 5));
6 System.out.println(" 17 % -5 = " + (17 % -5));
7 System.out.println("-17 % 5 = " + (-17 % 5));
8 System.out.println("-17 % -5 = " + (-17 % -5));
9 while (true)
10 ;
11 }
12 }
0 package org.jpl7.util;
1
2 public class Overload {
3 static void m1(int a1, long a2) {
4 }
5
6 static void m1(long a1, int a2) {
7 }
8
9 public static void main(String[] args) {
10 m1((long) 0, 0);
11 }
12 }
0 package org.jpl7.util;
1
2 public class Overload2 {
3 // experiment (why not read the language reference?)
4 public static int fred;
5
6 public static int fred() {
7 return fred;
8 }
9 }
0 package org.jpl7.util;
1
2 import java.awt.Point;
3 import java.awt.event.ActionEvent;
4 import java.awt.event.ActionListener;
5 import javax.swing.JFrame;
6 import javax.swing.JMenu;
7 import javax.swing.JMenuItem;
8 import javax.swing.JPopupMenu;
9
10 /*
11 * Adapted from a Swing Connection demo
12 * see pcm's jpl_demo:jpl_popup_demo/0
13 */
14 public class PopupMenuDemo extends JFrame implements ActionListener {
15 private static final long serialVersionUID = 1L;
16 // JTextArea output;
17 public JPopupMenu popup;
18 JMenuItem source;
19 int mi;
20
21 public PopupMenuDemo() {
22
23 // Add regular components to the window, using the default BorderLayout.
24 // output = new JTextArea(5, 30);
25 // output.setEditable(false);
26 // getContentPane().add(new JScrollPane(output), BorderLayout.CENTER);
27 }
28
29 /*
30 * JPopupMenu +- JMenuItem +- JMenuItem +- JMenu ----- JPopupMenu | +- JMenuItem | +- JMenuItem +- JMenuItem +- JMenuItem
31 */
32 public boolean search(JPopupMenu p) {
33 Object[] mes = p.getSubElements(); // array of JMenuItem or JMenu (see diagram)
34 int i;
35
36 for (i = 0; i < mes.length; i++) {
37 if (mes[i] == source) { // it's the clicked JMenuItem
38 return true;
39 } else if (mes[i] instanceof JMenu) { // it's a submenu
40 if (search((JPopupMenu) (((JMenu) mes[i]).getSubElements())[0])) {
41 return true; // clicked JMenuItem was within this submenu tree
42 }
43 } else { // it's a non-matching leaf element
44 mi++; // next JMenuItemm will be the mi-th
45 }
46 }
47 return false;
48 }
49
50 public void actionPerformed(ActionEvent e) {
51 source = (JMenuItem) (e.getSource());
52 // output.append("action event source: " + source.getText()
53 // + " (an instance of " + getClassName(source) + ")\n");
54 mi = 1;
55 if (search(popup)) {
56 // output.append("clicked " + mi + "\n");
57 if ((new org.jpl7.Query("jpl_popup_demo_callback",
58 new org.jpl7.Term[] { new org.jpl7.Integer(mi) })).hasSolution()) {
59 // output.append("succeeded\n");
60 } else {
61 // output.append("failed\n");
62 }
63 }
64 // output.append("jpl_popup_demo_callback(" + mi + ")\n");
65 }
66
67 // protected String getClassName(Object o) { // Returns just the class name -- no package info.
68 // String classString = o.getClass().getName();
69 // int dotIndex = classString.lastIndexOf(".");
70 // return classString.substring(dotIndex+1);
71 // }
72
73 public JPopupMenu buildPopupMenu(Object[] mis) {
74 int i;
75 JPopupMenu m = new JPopupMenu((String) mis[0]);
76 JMenuItem mi;
77
78 for (i = 1; i < mis.length; i++) {
79 if (mis[i] instanceof String) {
80 mi = new JMenuItem((String) mis[i]);
81 mi.addActionListener(this);
82 m.add(mi);
83 } else if (mis[i] instanceof Object[]) {
84 m.add(buildSubMenu((Object[]) mis[i]));
85 } else {
86 return null; // bad menuitems array
87 }
88 }
89 return m;
90 }
91
92 public JMenu buildSubMenu(Object[] mis) {
93 int i;
94 JMenu m = new JMenu((String) mis[0]);
95 JMenuItem mi;
96
97 for (i = 1; i < mis.length; i++) {
98 if (mis[i] instanceof String) {
99 mi = new JMenuItem((String) mis[i]);
100 mi.addActionListener(this);
101 m.add(mi);
102 } else if (mis[i] instanceof Object[]) {
103 m.add(buildSubMenu((Object[]) mis[i]));
104 } else {
105 return null; // bad menuitems array
106 }
107 }
108 return m;
109 }
110
111 public void showPopup(Object[] mis, int x, int y) {
112 Point p = getLocationOnScreen(); // on-screen location of origin of this Frame
113
114 popup = buildPopupMenu(mis); // discarding any previous one...
115 setVisible(true); // ensure this Frame thingy is visible (else we get an error)
116 popup.show(this, x - p.x, y - p.y); // must show over some Component (e.g. this)
117 }
118
119 }
0 package org.jpl7.util;
1
2 public class Prog {
3 public static int i_am_static_1 = 1;
4
5 public int i_am_not_static_2 = 2;
6
7 public static java.lang.String S = "hello";
8
9 public static class Inside {
10 public int intErnal;
11 }
12
13 public static void main(String[] args) {
14 System.out.println("Hello World");
15 }
16
17 public static float div0() {
18 return (float) (1.234);
19 }
20
21 public static String welcome() {
22 return "Welcome to JSP!";
23 }
24
25 public float div1(int d) {
26 return i_am_static_1 / d;
27 }
28
29 public double div2(int d) {
30 return i_am_not_static_2 / d;
31 }
32
33 public static int add_ints(int i1, int i2, int i3) {
34 return i1 + i2 + i3;
35 }
36
37 public static float floats_to_float(float f1, float f2, float f3) {
38 return f1 + f2 + f3;
39 }
40
41 public static double floats_to_double(float f1, float f2, float f3) {
42 return f1 + f2 + f3;
43 }
44
45 public static String double_to_string(double d) {
46 return "The answer is " + d;
47 }
48
49 }
0 package org.jpl7.util;
1
2 import java.awt.BorderLayout;
3 import java.awt.GridLayout;
4 import java.awt.event.ActionEvent;
5 import java.awt.event.ActionListener;
6 import java.awt.event.WindowAdapter;
7 import java.awt.event.WindowEvent;
8 import javax.swing.BorderFactory;
9 import javax.swing.JButton;
10 import javax.swing.JFrame;
11 import javax.swing.JLabel;
12 import javax.swing.JPanel;
13 import javax.swing.UIManager;
14
15 public class SwingGadget extends JFrame {
16 private static final long serialVersionUID = 1L;
17
18 public int numClicks = 0; // can be changed e.g. from Prolog
19
20 private static String labelPrefix = "Number of button clicks: ";
21 final JLabel label = new JLabel(labelPrefix + "0 ");
22
23 public SwingGadget(String caption) {
24 super(caption); // call the JFrame contructor
25
26 JButton button = new JButton("I'm a Swing button!");
27
28 button.addActionListener(new ActionListener() {
29 public void actionPerformed(ActionEvent e) {
30 inc();
31 }
32 });
33
34 label.setLabelFor(button);
35
36 JPanel pane = new JPanel();
37 pane.setBorder(BorderFactory.createEmptyBorder(30, 30, 10, 30));
38 pane.setLayout(new GridLayout(0, 1));
39 pane.add(button);
40 pane.add(label);
41
42 try {
43 UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
44 } catch (Exception e) {
45 }
46
47 getContentPane().add(pane, BorderLayout.CENTER);
48
49 addWindowListener(new WindowAdapter() {
50 public void windowClosing(WindowEvent e) {
51 // System.exit(0);
52 setVisible(false);
53 }
54 });
55 pack();
56 setVisible(true);
57 }
58
59 public synchronized void inc() {
60 numClicks++;
61 label.setText(labelPrefix + numClicks);
62 notifyAll();
63 }
64
65 public synchronized boolean dec() {
66 try {
67 while (numClicks <= 0) {
68 wait();
69 }
70 numClicks--;
71 label.setText(labelPrefix + numClicks);
72 return true;
73 } catch (InterruptedException e) {
74 return false;
75 }
76 }
77 }
0 package org.jpl7.util;
1
2 import java.awt.BorderLayout;
3 import java.awt.event.ActionEvent;
4 import java.awt.event.ActionListener;
5 import javax.swing.JFrame;
6 import javax.swing.JPanel;
7 import javax.swing.UIManager;
8
9 public class SwingGadget2 extends JFrame {
10 private static final long serialVersionUID = 1L;
11 private Qev head;
12 private Qev tail;
13 public JPanel pane;
14
15 public ActionListener al = new ActionListener() {
16 public void actionPerformed(ActionEvent e) {
17 inc(e);
18 }
19 };
20
21 public SwingGadget2(String caption) {
22 super(caption); // call the JFrame contructor
23 try {
24 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
25 } catch (Exception e) {
26 }
27 pane = new JPanel();
28 getContentPane().add(pane, BorderLayout.CENTER);
29
30 // JButton button1 = new JButton("click me");
31 // JButton button2 = new JButton("...or me");
32
33 // button1.addActionListener( al);
34 // button2.addActionListener( al);
35
36 // pane.add(button1);
37 // pane.add(button2);
38
39 pack();
40 setVisible(true);
41 }
42
43 public synchronized void inc(Object e) {
44 if (head == null) {
45 head = new Qev(e);
46 head.next = null;
47 tail = head;
48 } else {
49 tail.next = new Qev(e);
50 tail = tail.next;
51 }
52 notifyAll();
53 }
54
55 public synchronized Object dec() {
56 Qev t;
57
58 try {
59 while (head == null) {
60 wait();
61 }
62 t = head;
63 head = head.next;
64 return t.ev;
65 } catch (InterruptedException e) {
66 return null;
67 }
68 }
69
70 public class Qev {
71 public Object ev;
72 public Qev next;
73
74 public Qev(Object e) {
75 ev = e;
76 }
77 }
78 }
0 package org.jpl7.util;
1
2 public class Test1 {
3
4 public static String booleans_to_string(boolean p0, boolean p1) {
5 return "{" + p0 + "," + p1 + "}";
6 }
7
8 public static String chars_to_string(char p0, char p1) {
9 return "{" + p0 + "," + p1 + "}";
10 }
11
12 public static String bytes_to_string(byte p0, byte p1) {
13 return "{" + p0 + "," + p1 + "}";
14 }
15
16 public static String shorts_to_string(short p0, short p1) {
17 return "{" + p0 + "," + p1 + "}";
18 }
19
20 public static String ints_to_string(int p0, int p1) {
21 return "{" + p0 + "," + p1 + "}";
22 }
23
24 public static String longs_to_string(long p0, long p1) {
25 return "{" + p0 + "," + p1 + "}";
26 }
27
28 public static String floats_to_string(float p0, float p1) {
29 return "{" + p0 + "," + p1 + "}";
30 }
31
32 public static String doubles_to_string(double p0, double p1) {
33 return "{" + p0 + "," + p1 + "}";
34 }
35
36 public static String boolean_to_string(boolean p) {
37 return "{" + p + "}";
38 }
39
40 public static String char_to_string(char p) {
41 return "{" + p + "}";
42 }
43
44 public static String byte_to_string(byte p) {
45 return "{" + p + "}";
46 }
47
48 public static String short_to_string(short p) {
49 return "{" + p + "}";
50 }
51
52 public static String int_to_string(int p) {
53 return "{" + p + "}";
54 }
55
56 public static String long_to_string(long p) {
57 return "{" + p + "}";
58 }
59
60 public static String float_to_string(float p) {
61 return "{" + p + "}";
62 }
63
64 public static String double_to_string(double p) {
65 return "{" + p + "}";
66 }
67
68 public static boolean boolean_1() {
69 return false;
70 }
71
72 public static boolean boolean_2() {
73 return true;
74 }
75
76 public static char char_1() {
77 return '\uFFFF';
78 }
79
80 public static byte byte_1() {
81 return 127;
82 }
83
84 public static short short_1() {
85 return 32767;
86 }
87
88 public static int int_1() {
89 return 0x01234567; /* 19088743 */
90 }
91
92 public static int int_2() {
93 return 0x89ABCDEF; /* -1985229329 */
94 }
95
96 public static long long_1() {
97 return 0x0123456789ABCDEFL; /* jlong(19088743,-1985229329) */
98 }
99
100 public static long long_2() {
101 return 0xFFFFFFFFFFFFFFFEL; /* jlong(-1,-2) */
102 }
103
104 public static long long_3() {
105 return 0x0000000100000002L; /* jlong(1,2) */
106 }
107
108 public static long long_4() {
109 return 0xFFFFFFFF00000000L; /* jlong(-1,0) */
110 }
111
112 public static long long_5() {
113 return 0x00000000FFFFFFFFL; /* -1 */
114 }
115
116 public static long long_6() {
117 return 0x0000000080000000L; /* -2147483648 */
118 }
119
120 public static long long_7() {
121 return 0x000000007FFFFFFFL; /* 2147483647 */
122 }
123
124 public static float float_1() {
125 return 12345.6789F;
126 }
127
128 public static double double_1() {
129 return 12345.6789D;
130 }
131
132 public static double double_1a() {
133 return 2.3456789e+100D;
134 }
135
136 public static double double_1b() {
137 return 3.456789e-100D;
138 }
139
140 public static double double_1c() {
141 return 0.0D;
142 }
143
144 public static double double_2() {
145 return Double.MIN_VALUE;
146 }
147
148 public static double double_3() {
149 return Double.MAX_VALUE;
150 }
151
152 public static double double_4() {
153 return Double.NEGATIVE_INFINITY;
154 }
155
156 public static double double_5() {
157 return Double.POSITIVE_INFINITY;
158 }
159
160 public static double double_6() {
161 return Double.NaN;
162 }
163
164 }
0 package org.jpl7.util;
1
2 public class Test2 {
3 public static boolean boolean_field;
4 public static char char_field;
5 public static byte byte_field;
6 public static short short_field;
7 public static int int_field;
8 public static long long_field;
9 public static float float_field;
10 public static double double_field;
11
12 public static boolean get_boolean_field() {
13 return boolean_field;
14 }
15
16 public static char get_char_field() {
17 return char_field;
18 }
19
20 public static byte get_byte_field() {
21 return byte_field;
22 }
23
24 public static short get_short_field() {
25 return short_field;
26 }
27
28 public static int get_int_field() {
29 return int_field;
30 }
31
32 public static long get_long_field() {
33 return long_field;
34 }
35
36 public static float get_float_field() {
37 return float_field;
38 }
39
40 public static double get_double_field() {
41 return double_field;
42 }
43
44 /*-------------------------------------------------------------------------------*/
45 public static void set_boolean_field(boolean v) {
46 boolean_field = v;
47 }
48
49 public static void set_char_field(char v) {
50 char_field = v;
51 }
52
53 public static void set_byte_field(byte v) {
54 byte_field = v;
55 }
56
57 public static void set_short_field(short v) {
58 short_field = v;
59 }
60
61 public static void set_int_field(int v) {
62 int_field = v;
63 }
64
65 public static void set_long_field(long v) {
66 long_field = v;
67 }
68
69 public static void set_float_field(float v) {
70 float_field = v;
71 }
72
73 public static void set_double_field(double v) {
74 double_field = v;
75 }
76
77 public static String boolean_field_to_string() {
78 return "{" + boolean_field + "}";
79 }
80
81 public static String char_field_to_string() {
82 return "{" + char_field + "}";
83 }
84
85 public static String byte_field_to_string() {
86 return "{" + byte_field + "}";
87 }
88
89 public static String short_field_to_string() {
90 return "{" + short_field + "}";
91 }
92
93 public static String int_field_to_string() {
94 return "{" + int_field + "}";
95 }
96
97 public static String long_field_to_string() {
98 return "{" + long_field + "}";
99 }
100
101 public static String float_field_to_string() {
102 return "{" + float_field + "}";
103 }
104
105 public static String double_field_to_string() {
106 return "{" + double_field + "}";
107 }
108
109 public static String echo_2_and_3(Object a1, int a2, int a3) {
110 return "a2=" + a2 + ", a3=" + a3;
111 }
112
113 public static String set_bytes_to_7(byte[] a, int offset, int count) {
114 for (int i = 0; i < count; i++)
115 a[offset + i] = 7;
116 return "offset=" + offset + ", count=" + count;
117 }
118
119 public static String lotsa_args(byte[] a, int a1, int a2, int a3, int a4, int a5, int a6) { // this illustrated a bug in the MS JVM's JNI
120 return "a1=" + a1 + ", a2=" + a2 + ", a3=" + a3 + ", a4=" + a4 + ", a5=" + a5 + ", a6="
121 + a6;
122 }
123 }
0 package org.jpl7.util;
1
2 import java.io.File;
3 import java.io.FileInputStream;
4 import java.io.FileNotFoundException;
5 import java.io.FileOutputStream;
6 import java.io.IOException;
7 import java.util.NoSuchElementException;
8 import java.util.Random;
9 import java.util.StringTokenizer;
10
11 public class Util {
12 private static Random r = new Random();
13
14 public static String[] dir_to_members(String dir) {
15 String[] ns = (new File(dir)).list();
16 int len = ns.length;
17 String[] ps = new String[len];
18 for (int i = 0; i < len; i++) {
19 try {
20 ps[i] = (new File(dir, ns[i])).getCanonicalPath().toString();
21 } catch (IOException e) {
22 ps[i] = "";
23 }
24 }
25 return ps;
26 }
27
28 public static String[] dir_to_member_paths(String dir) {
29 String[] ns = (new File(dir)).list();
30 int len = ns.length;
31 String[] ps = new String[len];
32 for (int i = 0; i < len; i++) {
33 try {
34 ps[i] = (new File(dir, ns[i])).getCanonicalPath();
35 } catch (IOException e) {
36 ps[i] = "";
37 }
38 }
39 return ps;
40 }
41
42 public static String[] dir_to_member_names(String dir) {
43 String[] ns = (new File(dir)).list();
44 int len = ns.length;
45 String[] ps = new String[len];
46 for (int i = 0; i < len; i++) {
47 ps[i] = (new File(dir, ns[i])).getName();
48 }
49 return ps;
50 }
51
52 public static int spawn_in_out_err(String command, String infile, String outfile, String errfile) {
53 Process p;
54
55 try {
56 p = Runtime.getRuntime().exec(command);
57 } catch (IOException e) {
58 return -1;
59 }
60
61 try {
62 if (infile != null) {
63 (new Xfer(new FileInputStream(infile), p.getOutputStream())).start();
64 }
65 if (outfile != null) {
66 (new Xfer(p.getInputStream(), new FileOutputStream(outfile))).start();
67 }
68 if (errfile != null) {
69 (new Xfer(p.getErrorStream(), new FileOutputStream(errfile))).start();
70 }
71 return p.waitFor();
72 } catch (FileNotFoundException e) {
73 return -2;
74 } catch (InterruptedException e) {
75 return -4;
76 }
77 }
78
79 public static int spawn_in_out_err_wait(String command, String infile, String outfile,
80 String errfile, boolean wait) {
81 Process p;
82
83 try {
84 p = Runtime.getRuntime().exec(command);
85 } catch (IOException e) {
86 return -1;
87 }
88
89 try {
90 if (infile != null) {
91 (new Xfer(new FileInputStream(infile), p.getOutputStream())).start();
92 }
93 if (outfile != null) {
94 (new Xfer(p.getInputStream(), new FileOutputStream(outfile))).start();
95 }
96 if (errfile != null) {
97 (new Xfer(p.getErrorStream(), new FileOutputStream(errfile))).start();
98 }
99 if (wait)
100 return p.waitFor();
101 else
102 return 0;
103 } catch (FileNotFoundException e) {
104 return -2;
105 } catch (InterruptedException e) {
106 return -4;
107 }
108 }
109
110 public static int spawn(String command) {
111
112 return spawn_wait(command, true);
113 }
114
115 public static int spawn_wait(String command, boolean wait) {
116 Process p;
117
118 try {
119 p = java.lang.Runtime.getRuntime().exec(command);
120 } catch (IOException e) {
121 return -77;
122 }
123 if (wait) {
124 try {
125 return p.waitFor();
126 } catch (InterruptedException e) {
127 return -78;
128 }
129 } else {
130 return 0;
131 }
132 }
133
134 public static String new_scratch_file(String dir) {
135 return new_scratch_file(dir, "nsf");
136 }
137
138 public static String new_scratch_file(String dir, String suffix) {
139 int n = (int) (r.nextFloat() * 900000 + 100000);
140 File f = new File(dir, n + "." + suffix);
141
142 if (f.exists()) {
143 return new_scratch_file(dir, suffix);
144 } else {
145 try {
146 (new FileOutputStream(f)).close();
147 if (f.exists()) {
148 return f.getCanonicalPath().toString();
149 } else {
150 return null;
151 }
152 } catch (IOException e) {
153 return null;
154 }
155 }
156 }
157
158 public static String new_scratch_dir(String dir) {
159 int n = (int) (r.nextFloat() * 900000 + 100000);
160 File d = new File(dir, n + ".nsd");
161
162 if (d.exists()) {
163 return new_scratch_dir(dir);
164 } else {
165 try {
166 if (d.mkdir()) {
167 return d.getCanonicalPath().toString();
168 } else {
169 return null;
170 }
171 } catch (IOException e) {
172 return null;
173 }
174 }
175 }
176
177 public static String new_scratch_suffix_file(String dir, String suffix) {
178 int n = (int) (r.nextFloat() * 900000 + 100000);
179 File f = new File(dir, n + "." + suffix);
180
181 if (f.exists()) {
182 return new_scratch_suffix_file(dir, suffix);
183 } else {
184 try {
185 (new FileOutputStream(f)).close();
186 if (f.exists()) {
187 return f.getCanonicalPath().toString();
188 } else {
189 return null;
190 }
191 } catch (IOException e) {
192 return null;
193 }
194 }
195 }
196
197 public static String new_scratch_suffix_dir(String dir, String suffix) {
198 int n = (int) (r.nextFloat() * 900000 + 100000);
199 File d = new File(dir, n + "." + suffix);
200
201 if (d.exists()) {
202 return new_scratch_suffix_dir(dir, suffix);
203 } else {
204 try {
205 if (d.mkdir()) {
206 return d.getCanonicalPath().toString();
207 } else {
208 return null;
209 }
210 } catch (IOException e) {
211 return null;
212 }
213 }
214 }
215
216 public static boolean create_file(String file) {
217 File f = new File(file);
218
219 try {
220 (new FileOutputStream(f)).close();
221 return f.exists();
222 } catch (IOException e) {
223 return false;
224 }
225 }
226
227 public static boolean create_dir(String dir) {
228 try {
229 return (new File(dir)).mkdir();
230 } catch (SecurityException e) {
231 return false;
232 }
233 }
234
235 public static boolean file_exists(String f) {
236 return (new File(f)).exists();
237 }
238
239 public static boolean file_can_read(String f) {
240 return (new File(f)).canRead();
241 }
242
243 public static boolean file_can_write(String f) {
244 return (new File(f)).canWrite();
245 }
246
247 public static boolean file_is_file(String f) {
248 return (new File(f)).isFile();
249 }
250
251 public static boolean file_is_dir(String f) {
252 return (new File(f)).isDirectory();
253 }
254
255 public static long file_last_modified(String f) {
256 return (new File(f)).lastModified();
257 }
258
259 public static long file_to_length(String f) {
260 return (new File(f)).length();
261 }
262
263 public static boolean delete_file(String f) {
264 try {
265 return (new File(f)).delete();
266 } catch (SecurityException e) {
267 return false;
268 }
269 }
270
271 public static String[] classpath_parts() {
272 String cp = java.lang.System.getProperty("java.class.path");
273 StringTokenizer p = new StringTokenizer(cp, File.pathSeparator);
274 String a[] = new String[p.countTokens()];
275 int i = 0;
276 String s;
277 String[] r;
278
279 try {
280 while (p.hasMoreTokens()) {
281 s = (new File(p.nextToken())).getCanonicalPath().toString();
282 if (!strings_contains_string(a, i, s)) {
283 a[i++] = s;
284 }
285 }
286 } catch (NoSuchElementException e) {
287 return null;
288 } catch (IOException e) {
289 return null;
290 } finally {
291 r = new String[i];
292 java.lang.System.arraycopy(a, 0, r, 0, i);
293 }
294 return r;
295 }
296
297 private static boolean strings_contains_string(String[] ss, int n, String s) {
298 int i;
299
300 for (i = 0; i < n; i++) {
301 if (ss[i].equals(s))
302 return true;
303 }
304 return false;
305 }
306
307 public static byte[] filename_to_byte_array(String f) {
308 try {
309 FileInputStream s = new FileInputStream(f);
310 int length = s.available();
311 byte[] buf = new byte[length];
312 s.read(buf);
313 s.close(); // to release file for e.g. deletion...
314 return buf;
315 } catch (FileNotFoundException e) {
316 return null;
317 } catch (IOException e) {
318 return null;
319 }
320 }
321
322 public static boolean rename_file_to_file(String n1, String n2) {
323 try {
324 File f1 = new File(n1);
325 File f2 = new File(n2);
326 return (f1 != null && f2 != null ? f1.renameTo(f2) : false);
327 } catch (SecurityException e) {
328 return false;
329 }
330 }
331
332 }
0 package org.jpl7.util;
1
2 import java.io.File;
3 import java.io.FileInputStream;
4 import java.io.FileNotFoundException;
5 import java.io.FileOutputStream;
6 import java.io.IOException;
7 import java.util.NoSuchElementException;
8 import java.util.Random;
9 import java.util.StringTokenizer;
10
11 public class Util2 {
12 private static Random r = new Random();
13
14 public static String[] dir_to_members(String dir) {
15 String[] ns = (new File(dir)).list();
16 int len = ns.length;
17 String[] ps = new String[len];
18 for (int i = 0; i < len; i++) {
19 try {
20 ps[i] = (new File(dir, ns[i])).getCanonicalPath().toString();
21 } catch (IOException e) {
22 ps[i] = "";
23 }
24 }
25 return ps;
26 }
27
28 public static int spawn_in_out_err(String command, String infile, String outfile, String errfile) {
29 Process p;
30
31 try {
32 p = Runtime.getRuntime().exec(command);
33 } catch (IOException e) {
34 return -1;
35 }
36
37 try {
38 if (infile != null) {
39 (new Xfer(new FileInputStream(infile), p.getOutputStream())).start();
40 }
41 if (outfile != null) {
42 (new Xfer(p.getInputStream(), new FileOutputStream(outfile))).start();
43 }
44 if (errfile != null) {
45 (new Xfer(p.getErrorStream(), new FileOutputStream(errfile))).start();
46 }
47 return p.waitFor();
48 } catch (FileNotFoundException e) {
49 return -2;
50 } catch (InterruptedException e) {
51 return -4;
52 }
53 }
54
55 public static int spawn(String command) {
56
57 try {
58 return java.lang.Runtime.getRuntime().exec(command).waitFor();
59 } catch (IOException e) {
60 return -77;
61 } catch (InterruptedException e) {
62 return -78;
63 }
64 }
65
66 public static String new_scratch_file(String dir) {
67 int n = (int) (r.nextFloat() * 900000 + 100000);
68 File f = new File(dir, "newscratchfile." + n);
69
70 if (f.exists()) {
71 return new_scratch_file(dir);
72 } else {
73 try {
74 (new FileOutputStream(f)).close();
75 if (f.exists()) {
76 return f.getCanonicalPath().toString();
77 } else {
78 return null;
79 }
80 } catch (IOException e) {
81 return null;
82 }
83 }
84 }
85
86 public static boolean create_dir(String dir) {
87 try {
88 return (new File(dir)).mkdir();
89 } catch (SecurityException e) {
90 return false;
91 }
92 }
93
94 public static boolean file_exists(String f) {
95 return (new File(f)).exists();
96 }
97
98 public static boolean file_can_read(String f) {
99 return (new File(f)).canRead();
100 }
101
102 public static boolean file_can_write(String f) {
103 return (new File(f)).canWrite();
104 }
105
106 public static boolean file_is_file(String f) {
107 return (new File(f)).isFile();
108 }
109
110 public static boolean file_is_dir(String f) {
111 return (new File(f)).isDirectory();
112 }
113
114 public static long file_last_modified(String f) {
115 return (new File(f)).lastModified();
116 }
117
118 public static boolean delete_file(String f) {
119 try {
120 return (new File(f)).delete();
121 } catch (SecurityException e) {
122 return false;
123 }
124 }
125
126 public static String[] classpath_parts() {
127 String cp = java.lang.System.getProperty("java.class.path");
128 StringTokenizer p = new StringTokenizer(cp, File.pathSeparator);
129 String a[] = new String[p.countTokens()];
130 int i = 0;
131 String s;
132
133 try {
134 while (p.hasMoreTokens()) {
135 s = (new File(p.nextToken())).getCanonicalPath().toString();
136 if (!strings_contains_string(a, i, s)) {
137 a[i++] = s;
138 }
139 }
140 } catch (NoSuchElementException e) {
141 return null;
142 } catch (IOException e) {
143 return null;
144 }
145 String r[] = new String[i];
146 java.lang.System.arraycopy(a, 0, r, 0, i);
147 return r;
148 }
149
150 private static boolean strings_contains_string(String[] ss, int n, String s) {
151 int i;
152
153 for (i = 0; i < n; i++) {
154 if (ss[i].equals(s))
155 return true;
156 }
157 return false;
158 }
159
160 public static byte[] filename_to_byte_array(String f) {
161 try {
162 FileInputStream s = new FileInputStream(f);
163 int length = s.available();
164 byte[] buf = new byte[length];
165 s.read(buf);
166 s.close(); // to release file for e.g. deletion...
167 return buf;
168 } catch (FileNotFoundException e) {
169 return null;
170 } catch (IOException e) {
171 return null;
172 }
173 }
174 }
0 package org.jpl7.util;
1
2 import java.io.IOException;
3 import java.io.InputStream;
4 import java.io.OutputStream;
5
6 public class Xfer extends Thread {
7 private InputStream in;
8
9 private OutputStream out;
10
11 public Xfer(InputStream s1, OutputStream s2) {
12 in = s1;
13 out = s2;
14 }
15
16 public void run() {
17 int c;
18
19 try {
20 while ((c = in.read()) != -1) {
21 out.write(c);
22 }
23 in.close();
24 out.close();
25 } catch (IOException e) {
26 }
27 }
28 }
2222
2323 export CLASSPATH=$JUNIT:jpl.jar:jpltest.jar
2424
25 $JAVA junit.textui.TestRunner jpl.test.TestJUnit
25 $JAVA junit.textui.TestRunner org.jpl7.test.TestJUnit
1919 test(
2020 ancestor_types_1,
2121 [ true(
22 Ts == [class([jpl],['Compound']),class([jpl],['Term']),class([java,lang],['Object'])]
23 )
24 ]
25 ) :-
26 jpl:jpl_type_to_ancestor_types( class([jpl],['Atom']), Ts).
22 Ts == [class([org,jpl7],['Term']),class([java,lang],['Object'])]
23 )
24 ]
25 ) :-
26 jpl:jpl_type_to_ancestor_types(class([org,jpl7],['Atom']), Ts).
2727
2828 test(
2929 call_array_equals_1,
3030 [ setup((
31 jpl_new( array(byte), [4,5,6], A1),
32 jpl_new( array(byte), [4,5,6], A2)
33 ))
34 ]
35 ) :-
36 jpl_call( A1, equals, [A2], @(false)).
31 jpl_new(array(byte), [4,5,6], A1),
32 jpl_new(array(byte), [4,5,6], A2)
33 ))
34 ]
35 ) :-
36 jpl_call(A1, equals, [A2], @(false)).
3737
3838 test(
3939 call_array_equals_2,
4040 [ setup((
41 jpl_new( array(byte), [4,5,6], A1)
42 ))
43 ]
44 ) :-
45 jpl_call( A1, equals, [A1], @(true)).
41 jpl_new(array(byte), [4,5,6], A1)
42 ))
43 ]
44 ) :-
45 jpl_call(A1, equals, [A1], @(true)).
4646
4747 test(
4848 call_array_hashcode_1,
4949 [ setup((
50 jpl_new( array(byte), [4,5,6], A)
51 )),
52 true((
53 integer( H)
54 ))
55 ]
56 ) :-
57 jpl_call( A, hashCode, [], H).
50 jpl_new(array(byte), [4,5,6], A)
51 )),
52 true((
53 integer(H)
54 ))
55 ]
56 ) :-
57 jpl_call(A, hashCode, [], H).
5858
5959 test(
6060 call_array_hashcode_2,
6161 [ setup((
62 jpl_new( array(byte), [4,5,6], A1),
63 jpl_new( array(byte), [4,5,6], A2)
62 jpl_new(array(byte), [4,5,6], A1),
63 jpl_new(array(byte), [4,5,6], A2)
6464 )),
6565 true((
6666 H1 \== H2
6767 ))
6868 ]
6969 ) :-
70 jpl_call( A1, hashCode, [], H1),
71 jpl_call( A2, hashCode, [], H2).
70 jpl_call(A1, hashCode, [], H1),
71 jpl_call(A2, hashCode, [], H2).
7272
7373 test(
7474 call_array_to_string_1,
7575 [ setup((
76 jpl_new( array(byte), [4,5,6], A)
77 )),
78 true((
79 atom_codes( S, [0'[, 0'B | _])
80 ))
81 ]
82 ) :-
83 jpl_call( A, toString, [], S).
76 jpl_new(array(byte), [4,5,6], A)
77 )),
78 true((
79 atom_codes(S, [0'[, 0'B | _])
80 ))
81 ]
82 ) :-
83 jpl_call(A, toString, [], S).
8484
8585 test(
8686 call_instance_param_cyclic_term_1,
8787 [ setup((
8888 T = f(T),
89 jpl_new( 'jpl.test.Test', [], Test)
89 jpl_new('org.jpl7.test.Test', [], Test)
9090 )),
9191 throws(
9292 error(type_error(acyclic,T),context(jpl_call/4,_))
9393 )
9494 ]
9595 ) :-
96 jpl_call( Test, methodInstanceTerm, [{T}], @(true)).
96 jpl_call(Test, methodInstanceTerm, [{T}], @(true)).
9797
9898 testX(
9999 call_instance_param_cyclic_term_2,
100100 [ setup((
101101 T = f(T),
102 jpl_new( 'jpl.test.Test', [], Test)
102 jpl_new('org.jpl7.test.Test', [], Test)
103103 )),
104104 throws(
105105 error(type_error(acyclic,_),context(jpl_call/4,_))
106106 )
107107 ]
108108 ) :-
109 jpl_call( Test, methodInstanceTerm, [{T}], @(true)).
109 jpl_call(Test, methodInstanceTerm, [{T}], @(true)).
110110
111111 test(
112112 call_method_static_array_1,
113113 [ setup((
114 jpl_new( array(int), [3,4,5], IntArray)
115 ))
116 ]
117 ) :-
118 jpl_call( 'jpl.test.Test', methodStaticArray, [IntArray], 'int[]').
114 jpl_new(array(int), [3,4,5], IntArray)
115 ))
116 ]
117 ) :-
118 jpl_call('org.jpl7.test.Test', methodStaticArray, [IntArray], 'int[]').
119119
120120 test(
121121 call_method_static_array_2,
122122 [ setup((
123 jpl_new( array(byte), [3,4,5], ByteArray)
123 jpl_new(array(byte), [3,4,5], ByteArray)
124124 )),
125125 throws(
126126 error(
130130 )
131131 ]
132132 ) :-
133 jpl_call( 'jpl.test.Test', methodStaticArray, [ByteArray], _).
133 jpl_call('org.jpl7.test.Test', methodStaticArray, [ByteArray], _).
134134
135135 test(
136136 call_static_param_cyclic_term_1,
142142 )
143143 ]
144144 ) :-
145 jpl_call( 'jpl.test.Test', methodStaticTerm, [{T}], @(true)).
145 jpl_call('org.jpl7.test.Test', methodStaticTerm, [{T}], @(true)).
146146
147147 test(
148148 call_class_get_name_1,
149149 [ setup((
150150 ClassName = 'java.lang.Integer',
151 jpl_classname_to_class( ClassName, ClassObject)
151 jpl_classname_to_class(ClassName, ClassObject)
152152 )),
153153 true((
154154 ClassName == ClassName2
155155 ))
156156 ]
157157 ) :-
158 jpl_call( ClassObject, getName, [], ClassName2).
158 jpl_call(ClassObject, getName, [], ClassName2).
159159
160160 test(
161161 call_get_array_bad_field_name_1,
162162 [ setup((
163 jpl_new( array(byte), 5, A),
163 jpl_new(array(byte), 5, A),
164164 FieldName = colour
165165 )),
166166 throws(
168168 )
169169 ]
170170 ) :-
171 jpl_get( A, FieldName, _).
171 jpl_get(A, FieldName, _).
172172
173173 test(
174174 call_get_array_bad_fspec_1,
175175 [ setup((
176 jpl_new( array(byte), 5, A),
176 jpl_new(array(byte), 5, A),
177177 Fspec = poo(77)
178178 )),
179179 throws(
181181 )
182182 ]
183183 ) :-
184 jpl_get( A, Fspec, _).
184 jpl_get(A, Fspec, _).
185185
186186 test(
187187 call_get_array_bad_index_range_1,
188188 [ setup((
189 jpl_new( array(byte), 5, A)
189 jpl_new(array(byte), 5, A)
190190 )),
191191 throws(
192192 error(domain_error(array_index_range,(-1)-2),context(jpl_get/3,_))
193193 )
194194 ]
195195 ) :-
196 jpl_get( A, (-1)-2, _).
196 jpl_get(A, (-1)-2, _).
197197
198198 test(
199199 call_get_array_bad_index_range_2,
200200 [ setup((
201 jpl_new( array(byte), 5, A)
201 jpl_new(array(byte), 5, A)
202202 )),
203203 throws(
204204 error(domain_error(array_index_range,10-12),context(jpl_get/3,_))
205205 )
206206 ]
207207 ) :-
208 jpl_get( A, 10-12, _).
208 jpl_get(A, 10-12, _).
209209
210210 test(
211211 call_get_array_bad_index_range_3,
212212 [ setup((
213 jpl_new( array(byte), 5, A)
213 jpl_new(array(byte), 5, A)
214214 )),
215215 throws(
216216 error(domain_error(array_index_range,3-33),context(jpl_get/3,_))
217217 )
218218 ]
219219 ) :-
220 jpl_get( A, 3-33, _).
220 jpl_get(A, 3-33, _).
221221
222222 test(
223223 call_get_array_bad_index_range_4,
224224 [ setup((
225 jpl_new( array(byte), 5, A)
225 jpl_new(array(byte), 5, A)
226226 )),
227227 throws(
228228 error(type_error(array_index_range,this-that),context(jpl_get/3,_))
229229 )
230230 ]
231231 ) :-
232 jpl_get( A, this-that, _).
232 jpl_get(A, this-that, _).
233233
234234 test(
235235 get_array_element_1,
236236 [ setup((
237 jpl_new( array(byte), [4,5,6,7,8], A)
237 jpl_new(array(byte), [4,5,6,7,8], A)
238238 )),
239239 true((
240240 7 == V
241241 ))
242242 ]
243243 ) :-
244 jpl_get( A, 3, V). % should bind V = 7 i.e. a[3] i.e. the fourth array element counting from zero
244 jpl_get(A, 3, V). % should bind V = 7 i.e. a[3] i.e. the fourth array element counting from zero
245245
246246 test(
247247 get_array_elements_1,
248248 [ setup((
249 jpl_new( array(byte), [4,5,6,7,8], A)
249 jpl_new(array(byte), [4,5,6,7,8], A)
250250 )),
251251 true((
252252 [5,6] == V
253253 ))
254254 ]
255255 ) :-
256 jpl_get( A, 1-2, V). % should bind V = [5,6] i.e. a[1-2] i.e. the 2nd to 3rd array elements counting from zero
256 jpl_get(A, 1-2, V). % should bind V = [5,6] i.e. a[1-2] i.e. the 2nd to 3rd array elements counting from zero
257257
258258 test(
259259 get_array_length_1,
260260 [ setup((
261261 Len1 is 5,
262 jpl_new( array(byte), Len1, A)
262 jpl_new(array(byte), Len1, A)
263263 )),
264264 true((
265265 Len1 == Len2
266266 ))
267267 ]
268268 ) :-
269 jpl_get( A, length, Len2). % should bind Len2 to the (integer) value of Len1
269 jpl_get(A, length, Len2). % should bind Len2 to the (integer) value of Len1
270270
271271 test(
272272 get_array_negative_index_1,
273273 [ setup((
274274 BadIndex is -1,
275 jpl_new( array(byte), 5, A)
275 jpl_new(array(byte), 5, A)
276276 )),
277277 throws(
278278 error(domain_error(array_index,BadIndex), context(jpl_get/3,_))
279279 )
280280 ]
281281 ) :-
282 jpl_get( A, BadIndex, _).
282 jpl_get(A, BadIndex, _).
283283
284284 test(
285285 get_array_unbound_fspec_1,
286286 [ setup((
287 jpl_new( array(byte), 5, A)
287 jpl_new(array(byte), 5, A)
288288 )),
289289 throws(
290290 error(instantiation_error,context(jpl_get/3,_))
291291 )
292292 ]
293293 ) :-
294 jpl_get( A, _, _).
294 jpl_get(A, _, _).
295295
296296 test(
297297 get_field_static_boolean_1,
300300 ))
301301 ]
302302 ) :-
303 jpl_get( 'jpl.test.Test', fieldStaticBoolean1, V).
303 jpl_get('org.jpl7.test.Test', fieldStaticBoolean1, V).
304304
305305 test(
306306 get_field_static_boolean_2,
309309 ))
310310 ]
311311 ) :-
312 jpl_get( 'jpl.test.Test', fieldStaticBoolean2, V).
312 jpl_get('org.jpl7.test.Test', fieldStaticBoolean2, V).
313313
314314 test(
315315 get_field_static_char_1,
318318 ))
319319 ]
320320 ) :-
321 jpl_get( 'jpl.test.Test', fieldStaticChar1, V).
321 jpl_get('org.jpl7.test.Test', fieldStaticChar1, V).
322322
323323 test(
324324 get_field_static_char_2,
327327 ))
328328 ]
329329 ) :-
330 jpl_get( 'jpl.test.Test', fieldStaticChar2, V).
330 jpl_get('org.jpl7.test.Test', fieldStaticChar2, V).
331331
332332 test(
333333 get_field_instance_byte_2,
334334 [ setup((
335 jpl_new( 'jpl.test.Test', [], Test)
335 jpl_new('org.jpl7.test.Test', [], Test)
336336 )),
337337 true((
338338 V == -1
339339 ))
340340 ]
341341 ) :-
342 jpl_get( Test, fieldInstanceByte2, V).
342 jpl_get(Test, fieldInstanceByte2, V).
343343
344344 test(
345345 list_to_array_1,
348348 ))
349349 ]
350350 ) :-
351 jpl_list_to_array( [1,2,3], A),
352 jpl_object_to_type( A, Type).
351 jpl_list_to_array([1,2,3], A),
352 jpl_object_to_type(A, Type).
353353
354354 test(
355355 method_static_byte_1,
361361 )
362362 ]
363363 ) :-
364 jpl_call( 'jpl.test.Test', methodStaticEchoByte, [-129], _).
364 jpl_call('org.jpl7.test.Test', methodStaticEchoByte, [-129], _).
365365
366366 test(
367367 method_static_echo_boolean_1,
368368 [ setup((
369 jpl_false( V1)
369 jpl_false(V1)
370370 )),
371371 true((
372372 V1 == V2
373373 ))
374374 ]
375375 ) :-
376 jpl_call( 'jpl.test.Test', methodStaticEchoBoolean, [V1], V2).
376 jpl_call('org.jpl7.test.Test', methodStaticEchoBoolean, [V1], V2).
377377
378378 test(
379379 method_static_echo_boolean_2,
380380 [ setup((
381 jpl_true( V1)
381 jpl_true(V1)
382382 )),
383383 true((
384384 V1 == V2
385385 ))
386386 ]
387387 ) :-
388 jpl_call( 'jpl.test.Test', methodStaticEchoBoolean, [V1], V2).
388 jpl_call('org.jpl7.test.Test', methodStaticEchoBoolean, [V1], V2).
389389
390390 test(
391391 method_static_echo_char_1,
397397 ))
398398 ]
399399 ) :-
400 jpl_call( 'jpl.test.Test', methodStaticEchoChar, [V1], V2).
400 jpl_call('org.jpl7.test.Test', methodStaticEchoChar, [V1], V2).
401401
402402 test(
403403 method_static_echo_char_2,
409409 ))
410410 ]
411411 ) :-
412 jpl_call( 'jpl.test.Test', methodStaticEchoChar, [V1], V2).
412 jpl_call('org.jpl7.test.Test', methodStaticEchoChar, [V1], V2).
413413
414414 test(
415415 method_static_char_3,
424424 )
425425 ]
426426 ) :-
427 jpl_call( 'jpl.test.Test', methodStaticEchoChar, [V1], _).
427 jpl_call('org.jpl7.test.Test', methodStaticEchoChar, [V1], _).
428428
429429 test(
430430 method_static_char_4,
439439 )
440440 ]
441441 ) :-
442 jpl_call( 'jpl.test.Test', methodStaticEchoChar, [V1], _).
442 jpl_call('org.jpl7.test.Test', methodStaticEchoChar, [V1], _).
443443
444444 test(
445445 method_static_char_5,
454454 )
455455 ]
456456 ) :-
457 jpl_call( 'jpl.test.Test', methodStaticEchoChar, [V1], _).
457 jpl_call('org.jpl7.test.Test', methodStaticEchoChar, [V1], _).
458458
459459 test(
460460 method_static_echo_double_1,
466466 ))
467467 ]
468468 ) :-
469 jpl_call( 'jpl.test.Test', methodStaticEchoDouble, [V1], V2).
469 jpl_call('org.jpl7.test.Test', methodStaticEchoDouble, [V1], V2).
470470
471471 test(
472472 method_static_echo_double_2,
478478 ))
479479 ]
480480 ) :-
481 jpl_call( 'jpl.test.Test', methodStaticEchoDouble, [V1], V2).
481 jpl_call('org.jpl7.test.Test', methodStaticEchoDouble, [V1], V2).
482482
483483 test(
484484 method_static_echo_double_3,
485485 [ setup((
486 ( current_prolog_flag( bounded, true)
487 -> current_prolog_flag( max_integer, V1)
486 ( current_prolog_flag(bounded, true)
487 -> current_prolog_flag(max_integer, V1)
488488 ; V1 is 2**63-1
489489 ),
490490 V2b is float(V1)
494494 ))
495495 ]
496496 ) :-
497 jpl_call( 'jpl.test.Test', methodStaticEchoDouble, [V1], V2).
497 jpl_call('org.jpl7.test.Test', methodStaticEchoDouble, [V1], V2).
498498
499499 test(
500500 method_static_echo_float_1,
506506 ))
507507 ]
508508 ) :-
509 jpl_call( 'jpl.test.Test', methodStaticEchoFloat, [V1], V2).
509 jpl_call('org.jpl7.test.Test', methodStaticEchoFloat, [V1], V2).
510510
511511 test(
512512 method_static_echo_float_2,
519519 ))
520520 ]
521521 ) :-
522 jpl_call( 'jpl.test.Test', methodStaticEchoFloat, [V1], V2).
522 jpl_call('org.jpl7.test.Test', methodStaticEchoFloat, [V1], V2).
523523
524524 test(
525525 method_static_echo_float_3,
526526 [ setup((
527 ( current_prolog_flag( bounded, true)
528 -> current_prolog_flag( max_integer, V1)
529 ; V1 is 2**63-1 % was 2**99
527 ( current_prolog_flag(bounded, true)
528 -> current_prolog_flag(max_integer, V1)
529 ; V1 is 2**63-1 % was 2**99
530530 ),
531531 V2b is float(V1)
532532 )),
535535 ))
536536 ]
537537 ) :-
538 jpl_call( 'jpl.test.Test', methodStaticEchoFloat, [V1], V2).
538 jpl_call('org.jpl7.test.Test', methodStaticEchoFloat, [V1], V2).
539539
540540 test(
541541 method_static_echo_float_4,
542542 [ blocked('we do not yet widen unbounded integers to floats or doubles'),
543543 setup((
544 ( current_prolog_flag( bounded, true)
545 -> current_prolog_flag( max_integer, V1)
544 ( current_prolog_flag(bounded, true)
545 -> current_prolog_flag(max_integer, V1)
546546 ; V1 is 2**99 % an unbounded integer
547547 ),
548548 V2b is float(V1)
552552 ))
553553 ]
554554 ) :-
555 jpl_call( 'jpl.test.Test', methodStaticEchoFloat, [V1], V2).
555 jpl_call('org.jpl7.test.Test', methodStaticEchoFloat, [V1], V2).
556556
557557 test(
558558 new_abstract_class_1,
567567 )
568568 ]
569569 ) :-
570 jpl_new( Classname, [], _).
570 jpl_new(Classname, [], _).
571571
572572 test(
573573 new_array_boolean_from_val_1,
574574 [ setup((
575 jpl_false( V)
575 jpl_false(V)
576576 )),
577577 true((
578578 V == V2
579579 ))
580580 ]
581581 ) :-
582 jpl_call( 'jpl.test.Test', newArrayBooleanFromValue, [V], A),
583 jpl_get( A, 0, V2).
582 jpl_call('org.jpl7.test.Test', newArrayBooleanFromValue, [V], A),
583 jpl_get(A, 0, V2).
584584
585585 test(
586586 new_array_double_from_val_1,
592592 ))
593593 ]
594594 ) :-
595 jpl_call( 'jpl.test.Test', newArrayDoubleFromValue, [V], A),
596 jpl_get( A, 0, V2).
595 jpl_call('org.jpl7.test.Test', newArrayDoubleFromValue, [V], A),
596 jpl_get(A, 0, V2).
597597
598598 test(
599599 new_array_float_from_val_1,
605605 ))
606606 ]
607607 ) :-
608 jpl_call( 'jpl.test.Test', newArrayFloatFromValue, [V], A),
609 jpl_get( A, 0, V2).
608 jpl_call('org.jpl7.test.Test', newArrayFloatFromValue, [V], A),
609 jpl_get(A, 0, V2).
610610
611611 test(
612612 new_interface_1,
621621 )
622622 ]
623623 ) :-
624 jpl_new( Classname, [], _).
624 jpl_new(Classname, [], _).
625625
626626 test(
627627 new_param_cyclic_term_1,
636636 )
637637 ]
638638 ) :-
639 jpl_new( 'jpl.test.Test', [{T}], _).
639 jpl_new('org.jpl7.test.Test', [{T}], _).
640640
641641 test(
642642 prolog_calls_java_calls_prolog_1,
645645 ))
646646 ]
647647 ) :-
648 jpl_new( 'jpl.Query', ['4 is 2+2'], Q),
649 jpl_call( Q, hasSolution, [], V).
648 jpl_new('org.jpl7.Query', ['4 is 2+2'], Q),
649 jpl_call(Q, hasSolution, [], V).
650650
651651 test(
652652 set_array_element_cyclic_term_1,
653653 [ setup((
654654 T = f(T),
655 jpl_new( array(class([jpl,test],['Test'])), 5, A)
655 jpl_new(array(class([org,jpl7,test],['Test'])), 5, A)
656656 )),
657657 throws(
658658 error(
662662 )
663663 ]
664664 ) :-
665 jpl_set( A, 0, {T}).
665 jpl_set(A, 0, {T}).
666666
667667 test(
668668 set_array_elements_bad_type_1,
669669 [ setup((
670 jpl_new( array(byte), 3, A)
670 jpl_new(array(byte), 3, A)
671671 )),
672672 throws(
673673 error(
677677 )
678678 ]
679679 ) :-
680 jpl_set( A, 0, 128).
680 jpl_set(A, 0, 128).
681681
682682 test(
683683 set_array_length_1,
684684 [ setup((
685 jpl_new( array(byte), 6, A)
685 jpl_new(array(byte), 6, A)
686686 )),
687687 throws(
688688 error(
692692 )
693693 ]
694694 ) :-
695 jpl_set( A, length, 13).
695 jpl_set(A, length, 13).
696696
697697 test(
698698 set_field_bad_field_spec_1,
707707 )
708708 ]
709709 ) :-
710 jpl_set( 'jpl.test.Test', BadFieldName, a).
710 jpl_set('org.jpl7.test.Test', BadFieldName, a).
711711
712712 test(
713713 set_field_instance_cyclic_term_1,
714714 [ setup((
715715 T = f(T),
716 jpl_new( 'jpl.test.Test', [], Test)
716 jpl_new('org.jpl7.test.Test', [], Test)
717717 )),
718718 throws(
719719 error(
723723 )
724724 ]
725725 ) :-
726 jpl_set( Test, instanceTerm, {T}).
726 jpl_set(Test, instanceTerm, {T}).
727727
728728 test(
729729 set_field_long_array_1,
730730 [ setup((
731 jpl_new( array(long), [1,2,3], LongArray)
732 ))
733 ]
734 ) :-
735 jpl_set( 'jpl.test.Test', fieldStaticLongArray, LongArray).
731 jpl_new(array(long), [1,2,3], LongArray)
732 ))
733 ]
734 ) :-
735 jpl_set('org.jpl7.test.Test', fieldStaticLongArray, LongArray).
736736
737737 test(
738738 set_field_long_array_2,
739739 [ setup((
740 jpl_new( array(int), [1,2,3], IntArray)
740 jpl_new(array(int), [1,2,3], IntArray)
741741 )),
742742 throws(
743743 error(
750750 )
751751 ]
752752 ) :-
753 jpl_set( 'jpl.test.Test', fieldStaticLongArray, IntArray).
753 jpl_set('org.jpl7.test.Test', fieldStaticLongArray, IntArray).
754754
755755 test(
756756 set_field_object_array_1,
757757 [ setup((
758 jpl_new( 'java.util.Date', [], Date),
759 jpl_new( array(class([java,lang],['Object'])), [Date,Date], ObjArray)
760 ))
761 ]
762 ) :-
763 jpl_set( 'jpl.test.Test', fieldStaticObjectArray, ObjArray).
758 jpl_new('java.util.Date', [], Date),
759 jpl_new(array(class([java,lang],['Object'])), [Date,Date], ObjArray)
760 ))
761 ]
762 ) :-
763 jpl_set('org.jpl7.test.Test', fieldStaticObjectArray, ObjArray).
764764
765765 test(
766766 set_field_static_bad_type_1,
775775 )
776776 ]
777777 ) :-
778 jpl_set( 'jpl.test.Test', fieldStaticBoolean, BadVal).
778 jpl_set('org.jpl7.test.Test', fieldStaticBoolean, BadVal).
779779
780780 test(
781781 set_field_static_boolean_1,
782782 [ setup((
783 jpl_true( V)
784 ))
785 ]
786 ) :-
787 jpl_set( 'jpl.test.Test', fieldStaticBoolean, V).
783 jpl_true(V)
784 ))
785 ]
786 ) :-
787 jpl_set('org.jpl7.test.Test', fieldStaticBoolean, V).
788788
789789 test(
790790 set_field_static_boolean_2,
791791 [ setup((
792 jpl_false( V)
793 ))
794 ]
795 ) :-
796 jpl_set( 'jpl.test.Test', fieldStaticBoolean, V).
792 jpl_false(V)
793 ))
794 ]
795 ) :-
796 jpl_set('org.jpl7.test.Test', fieldStaticBoolean, V).
797797
798798 test(
799799 set_field_static_boolean_bad_1,
808808 )
809809 ]
810810 ) :-
811 jpl_set( 'jpl.test.Test', fieldStaticBoolean, BadVal).
811 jpl_set('org.jpl7.test.Test', fieldStaticBoolean, BadVal).
812812
813813 test(
814814 set_field_static_cyclic_term_1,
823823 )
824824 ]
825825 ) :-
826 jpl_set( 'jpl.test.Test', staticTerm, {T}).
826 jpl_set('org.jpl7.test.Test', staticTerm, {T}).
827827
828828 test(
829829 set_field_static_final_int_1,
839839 )
840840 ]
841841 ) :-
842 jpl_set( 'jpl.test.Test', FieldName, Value).
842 jpl_set('org.jpl7.test.Test', FieldName, Value).
843843
844844 test(
845845 set_field_static_shadow_1,
846846 [ blocked('we do not yet resolve same-named shadowed fields')
847847 ]
848848 ) :-
849 jpl_set( 'jpl.test.ShadowB', fieldStaticInt, 3).
849 jpl_set('org.jpl7.test.ShadowB', fieldStaticInt, 3).
850850
851851 test(
852852 set_field_static_term_1,
860860 ))
861861 ]
862862 ) :-
863 jpl_set( 'jpl.test.Test', fieldStaticTerm, {T1}),
864 jpl_get( 'jpl.test.Test', fieldStaticTerm, {T1a}),
865 jpl_set( 'jpl.test.Test', fieldStaticTerm, {T2}),
866 jpl_get( 'jpl.test.Test', fieldStaticTerm, {T2a}).
863 jpl_set('org.jpl7.test.Test', fieldStaticTerm, {T1}),
864 jpl_get('org.jpl7.test.Test', fieldStaticTerm, {T1a}),
865 jpl_set('org.jpl7.test.Test', fieldStaticTerm, {T2}),
866 jpl_get('org.jpl7.test.Test', fieldStaticTerm, {T2a}).
867867
868868 test(
869869 set_field_static_term_2,
873873 ))
874874 ]
875875 ) :-
876 jpl_set( 'jpl.test.Test', fieldStaticTerm, {T1}),
877 jpl_get( 'jpl.test.Test', fieldStaticTerm, {T1}),
878 jpl_set( 'jpl.test.Test', fieldStaticTerm, {T2}),
879 jpl_get( 'jpl.test.Test', fieldStaticTerm, {T2}).
876 jpl_set('org.jpl7.test.Test', fieldStaticTerm, {T1}),
877 jpl_get('org.jpl7.test.Test', fieldStaticTerm, {T1}),
878 jpl_set('org.jpl7.test.Test', fieldStaticTerm, {T2}),
879 jpl_get('org.jpl7.test.Test', fieldStaticTerm, {T2}).
880880
881881 test(
882882 set_get_array_element_boolean_1,
883883 [ setup((
884 jpl_new( array(boolean), 3, A),
884 jpl_new(array(boolean), 3, A),
885885 V = @(false)
886886 )),
887887 true((
889889 ))
890890 ]
891891 ) :-
892 jpl_set( A, 2, V),
893 jpl_get( A, 2, Vr).
892 jpl_set(A, 2, V),
893 jpl_get(A, 2, Vr).
894894
895895 test(
896896 set_get_array_element_boolean_2,
897897 [ setup((
898 jpl_new( array(boolean), 3, A),
898 jpl_new(array(boolean), 3, A),
899899 V = @(true)
900900 )),
901901 true((
903903 ))
904904 ]
905905 ) :-
906 jpl_set( A, 2, V),
907 jpl_get( A, 2, Vr).
906 jpl_set(A, 2, V),
907 jpl_get(A, 2, Vr).
908908
909909 test(
910910 set_get_array_element_boolean_3,
911911 [ setup((
912 jpl_new( array(boolean), 3, A),
912 jpl_new(array(boolean), 3, A),
913913 V = bogus
914914 )),
915915 throws(
920920 )
921921 ]
922922 ) :-
923 jpl_set( A, 2, V).
923 jpl_set(A, 2, V).
924924
925925 test(
926926 set_get_array_element_byte_1,
927927 [ setup((
928 jpl_new( array(byte), 3, A),
928 jpl_new(array(byte), 3, A),
929929 V = 33
930930 )),
931931 true((
933933 ))
934934 ]
935935 ) :-
936 jpl_set( A, 2, V),
937 jpl_get( A, 2, Vr).
936 jpl_set(A, 2, V),
937 jpl_get(A, 2, Vr).
938938
939939 test(
940940 set_get_array_element_byte_2,
941941 [ setup((
942 jpl_new( array(byte), 3, A),
942 jpl_new(array(byte), 3, A),
943943 V = 128
944944 )),
945945 throws(
950950 )
951951 ]
952952 ) :-
953 jpl_set( A, 2, V).
953 jpl_set(A, 2, V).
954954
955955 test(
956956 set_get_array_element_char_1,
957957 [ setup((
958 jpl_new( array(char), 3, A),
958 jpl_new(array(char), 3, A),
959959 V = 65535
960960 )),
961961 true((
963963 ))
964964 ]
965965 ) :-
966 jpl_set( A, 2, V),
967 jpl_get( A, 2, Vr).
966 jpl_set(A, 2, V),
967 jpl_get(A, 2, Vr).
968968
969969 test(
970970 set_get_array_element_double_1,
971971 [ setup((
972 jpl_new( array(double), 3, A),
972 jpl_new(array(double), 3, A),
973973 V = 2.5
974974 )),
975975 true((
977977 ))
978978 ]
979979 ) :-
980 jpl_set( A, 2, V),
981 jpl_get( A, 2, Vr).
980 jpl_set(A, 2, V),
981 jpl_get(A, 2, Vr).
982982
983983 test(
984984 set_get_array_element_float_1,
985985 [ setup((
986 jpl_new( array(float), 3, A),
986 jpl_new(array(float), 3, A),
987987 V = 7.5
988988 )),
989989 true((
991991 ))
992992 ]
993993 ) :-
994 jpl_set( A, 2, V),
995 jpl_get( A, 2, Vr).
994 jpl_set(A, 2, V),
995 jpl_get(A, 2, Vr).
996996
997997 test(
998998 set_get_array_element_float_2,
999999 [ setup((
1000 jpl_new( array(float), 3, A),
1000 jpl_new(array(float), 3, A),
10011001 V is 2,
10021002 VrX is float(V)
10031003 )),
10061006 ))
10071007 ]
10081008 ) :-
1009 jpl_set( A, 2, V),
1010 jpl_get( A, 2, Vr).
1009 jpl_set(A, 2, V),
1010 jpl_get(A, 2, Vr).
10111011
10121012 test(
10131013 set_get_array_element_float_3,
10141014 [ setup((
1015 jpl_new( array(float), 3, A),
1016 ( current_prolog_flag( bounded, true)
1017 -> current_prolog_flag( max_integer, Imax)
1015 jpl_new(array(float), 3, A),
1016 ( current_prolog_flag(bounded, true)
1017 -> current_prolog_flag(max_integer, Imax)
10181018 ; Imax is 2**63-1
10191019 ),
10201020 VrX is float(Imax)
10241024 ))
10251025 ]
10261026 ) :-
1027 jpl_set( A, 2, Imax),
1028 jpl_get( A, 2, Vr).
1027 jpl_set(A, 2, Imax),
1028 jpl_get(A, 2, Vr).
10291029
10301030 test(
10311031 set_get_array_element_long_1,
10321032 [ setup((
1033 jpl_new( array(long), 3, A),
1034 ( current_prolog_flag( bounded, true)
1035 -> current_prolog_flag( max_integer, V)
1033 jpl_new(array(long), 3, A),
1034 ( current_prolog_flag(bounded, true)
1035 -> current_prolog_flag(max_integer, V)
10361036 ; V is 2**63-1
10371037 )
10381038 )),
10411041 ))
10421042 ]
10431043 ) :-
1044 jpl_set( A, 2, V),
1045 jpl_get( A, 2, Vr).
1044 jpl_set(A, 2, V),
1045 jpl_get(A, 2, Vr).
10461046
10471047 test(
10481048 set_get_array_element_long_2,
10491049 [ setup((
1050 jpl_new( array(long), 3, A),
1051 ( current_prolog_flag( bounded, true)
1052 -> current_prolog_flag( max_integer, V)
1050 jpl_new(array(long), 3, A),
1051 ( current_prolog_flag(bounded, true)
1052 -> current_prolog_flag(max_integer, V)
10531053 ; V is 2**63
10541054 )
10551055 )),
10611061 )
10621062 ]
10631063 ) :-
1064 jpl_set( A, 2, V).
1064 jpl_set(A, 2, V).
10651065
10661066 test(
10671067 set_get_array_elements_boolean_1,
10681068 [ setup((
1069 jpl_new( array(boolean), 3, A),
1069 jpl_new(array(boolean), 3, A),
10701070 Vf = @(false),
10711071 Vt = @(true)
10721072 )),
10751075 ))
10761076 ]
10771077 ) :-
1078 jpl_set( A, 0, Vf),
1079 jpl_set( A, 1, Vt),
1080 jpl_set( A, 2, Vf),
1081 jpl_get( A, 0, Vr0),
1082 jpl_get( A, 1, Vr1),
1083 jpl_get( A, 2, Vr2).
1078 jpl_set(A, 0, Vf),
1079 jpl_set(A, 1, Vt),
1080 jpl_set(A, 2, Vf),
1081 jpl_get(A, 0, Vr0),
1082 jpl_get(A, 1, Vr1),
1083 jpl_get(A, 2, Vr2).
10841084
10851085 test(
10861086 set_get_field_static_long_1,
10871087 [ setup((
1088 ( current_prolog_flag( bounded, true)
1089 -> current_prolog_flag( max_integer, V)
1088 ( current_prolog_flag(bounded, true)
1089 -> current_prolog_flag(max_integer, V)
10901090 ; V is 2**63-1
10911091 )
10921092 )),
10951095 ))
10961096 ]
10971097 ) :-
1098 jpl_set( 'jpl.test.Test', fieldStaticLong, V),
1099 jpl_get( 'jpl.test.Test', fieldStaticLong, V2).
1098 jpl_set('org.jpl7.test.Test', fieldStaticLong, V),
1099 jpl_get('org.jpl7.test.Test', fieldStaticLong, V2).
11001100
11011101 test(
11021102 set_non_accessible_field_1,
11081108 )
11091109 ]
11101110 ) :-
1111 jpl_set( 'jpl.test.Test', gagaga, 4).
1111 jpl_set('org.jpl7.test.Test', gagaga, 4).
11121112
11131113 test(
11141114 terms_to_array_1,
11151115 []
11161116 ) :-
1117 jpl_terms_to_array( [foo(bar)], A),
1118 jpl_object_to_type( A, array(class([jpl],['Term']))),
1119 jpl_get( A, length, 1),
1120 jpl_get( A, 0, T),
1121 jpl_call( T, toString, [], 'foo(bar)').
1117 jpl_terms_to_array([foo(bar)], A),
1118 jpl_object_to_type(A, array(class([org,jpl7],['Term']))),
1119 jpl_get(A, length, 1),
1120 jpl_get(A, 0, T),
1121 jpl_call(T, toString, [], 'foo(bar)').
11221122
11231123 test(
11241124 throw_java_exception_1,
11311131 )
11321132 ]
11331133 ) :-
1134 jpl_call( 'java.lang.Integer', decode, [q], _).
1134 jpl_call('java.lang.Integer', decode, [q], _).
11351135
11361136 test(
11371137 versions_1,
11431143 ) :-
11441144 jpl_pl_lib_version(Vpl),
11451145 jpl_c_lib_version(Vc),
1146 jpl_call( 'jpl.JPL', version_string, [], Vjava).
1146 jpl_call('org.jpl7.JPL', version_string, [], Vjava).
11471147
11481148 % JW: Mutual recursion check. Moved from jpl.pl to here. As the
11491149 % callback is in module user, we define it there.
11501150
1151 user:jpl_test_fac( N, F) :-
1151 user:jpl_test_fac(N, F) :-
11521152 ( N == 1
11531153 -> F = 1
11541154 ; N > 1
11551155 -> N2 is N-1,
1156 jpl_call( 'jpl.test.Test', fac, [N2], F2), % call its Java counterpart, which does vice versa
1156 jpl_call('org.jpl7.test.Test', fac, [N2], F2), % call its Java counterpart, which does vice versa
11571157 F is N*F2
11581158 ; F = 0
11591159 ).
11601160
11611161 test(fac10,
1162 [ true(N==3628800)
1163 ]) :-
1164 user:jpl_test_fac(10, N).
1162 [ true(N==3628800)
1163 ]
1164 ) :-
1165 user:jpl_test_fac(10, N).
11651166
11661167 test(threads1,
11671168 [ true((
11721173 ) :-
11731174 jpl_call('java.lang.System', currentTimeMillis, [], _).
11741175
1175 test(threads2, true(X==true)) :-
1176 test(threads2,
1177 [ true(X==true)
1178 ]
1179 ) :-
11761180 jpl_call('java.lang.System', currentTimeMillis, [], _),
11771181 thread_create(jpl_call('java.lang.System', currentTimeMillis, [], _), ThreadId, []),
11781182 thread_join(ThreadId, X).
11791183
11801184 test(threads3,
11811185 [ true((
1182 length(Ss, 1000),
1186 length(Ss, N),
11831187 sort(Ss, [true])
11841188 ))
11851189 ]
11861190 ) :-
1191 N is 100, % was 1000 (ok in V6); in V7 traditional, fails with 200
11871192 jpl_call('java.lang.System', currentTimeMillis, [], _),
11881193 findall(
11891194 Status,
1190 ( between(1, 1000, _),
1195 ( between(1, N, _),
11911196 thread_create(jpl_call('java.lang.System', currentTimeMillis, [], _), ThreadId, []),
11921197 thread_join(ThreadId, Status)
11931198 ),
11961201
11971202 test(jref1,
11981203 [ true((
1199 Term1 \== Term2,
1200 Term1 =@= Term2
1204 Term1 \== Term2
12011205 ))
12021206 ]
12031207 ) :-
12051209 jpl:jni_term_to_jref(Term1, JRef),
12061210 jpl:jni_jref_to_term(JRef, Term2).
12071211
1212 test(jref2,
1213 [ true((
1214 Term1 =@= Term2
1215 ))
1216 ]
1217 ) :-
1218 length(Term1, 5),
1219 jpl:jni_term_to_jref(Term1, JRef),
1220 jpl:jni_jref_to_term(JRef, Term2).
1221
12081222 :- end_tests(jpl).
Binary diff not shown
6161 ################################################################
6262
6363 check::
64 $(PL) -f test_odbc.pl -q -g test_odbc,halt -t 'halt(1)'
6465
6566 ################################################################
6667 # Clean
12921292 return NULL;
12931293 memset(c, 0, sizeof(*c));
12941294 c->alias = alias;
1295 c->magic = CON_MAGIC;
12951296 if ( alias )
12961297 PL_register_atom(alias);
12971298 c->dsn = dsn;
13481349 return type_error(tcid, "odbc_connection");
13491350 c = ptr;
13501351
1351 if ( !c->magic == CON_MAGIC )
1352 if ( c->magic != CON_MAGIC )
13521353 return existence_error(tcid, "odbc_connection");
13531354 } else
13541355 { if ( !PL_get_atom(tcid, &alias) )
22952296 case SQL_C_BINARY:
22962297 if ( columnSize > ctxt->max_nogetdata || columnSize == 0 )
22972298 goto use_sql_get_data;
2298 ptr_result->len_value = sizeof(char)*(columnSize+1);
2299 ptr_result->len_value = sizeof(char)*(columnSize+1)*((ctxt->connection->encoding == ENC_UTF8)?4:1);
22992300 break;
23002301 case SQL_C_WCHAR:
23012302 if ( columnSize == 0 )
29832984 parameter *params;
29842985 SWORD npar;
29852986 int pn;
2986 int character_size = sizeof(char);
2987 int character_size = ((ctxt->connection->encoding == ENC_UTF8)?4:1)*sizeof(char);
29872988
29882989 TRY(ctxt,
29892990 SQLNumParams(ctxt->hstmt, &npar),
+0
-636
packages/odbc/odbc_test.pl less more
0 /* $Id$
1
2 Part of SWI-Prolog
3
4 Author: Jan Wielemaker
5 E-mail: J.Wielemaker@uva.nl
6 WWW: http://www.swi-prolog.org
7 Copyright (C): 1985-2008, University of Amsterdam
8
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License
11 as published by the Free Software Foundation; either version 2
12 of the License, or (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public
20 License along with this library; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22
23 As a special exception, if you link this library with other files,
24 compiled with a Free Software compiler, to produce an executable, this
25 library does not by itself cause the resulting executable to be covered
26 by the GNU General Public License. This exception does not however
27 invalidate any other reasons why the executable file might be covered by
28 the GNU General Public License.
29 */
30
31 % use the local copy
32 :- asserta(user:file_search_path(foreign, '.')).
33
34 :- use_module(odbc).
35
36 :- dynamic
37 parms/2,
38 passwd/1.
39
40 parms(test, [ user(jan) | Options ]) :-
41 ( passwd(Pass)
42 -> true
43 ; getpass(Pass), % my private library
44 assert(passwd(Pass))
45 ),
46 ( Pass == ""
47 -> Options = []
48 ; Options = [password(Pass)]
49 ).
50
51
52 set_db(DSN, Options) :-
53 retractall(parms(_,_)),
54 assert(parms(DSN, Options)).
55
56 open_db :-
57 parms(DSN, Options),
58 odbc_connect(DSN, _,
59 [ alias(test),
60 open(once)
61 | Options
62 ]).
63
64 test :-
65 forall(type(Type, _, _, _),
66 test_type(Type)).
67
68
69 /*******************************
70 * TYPE TESTS *
71 *******************************/
72
73 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
74 Test the type-conversion system. For each type we create a small table
75 and read it back. If the type can be accessed with alternative Prolog
76 types we test this too.
77 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
78
79 % type(SqlType, PlType=Values, [AltType=Map, ...], Options)
80 %
81 % Define a test-set. The first argument is the SQL type to test.
82 % PlType is the default Prolog type with a set of values. AltType
83 % is an alternative type that can be used to exchange values and
84 % Map is a maplist/3 argument to convert the value-list into a
85 % list of values of the alternative type.
86
87 type(integer,
88 integer = [-1, 0, 42, '$null$' ],
89 [ atom = integer_to_atom, % exchange as text
90 float = integer_to_float % exchange as float
91 ],
92 []).
93 type(bigint,
94 integer = [-1, 0, 42, 35184372088832, -35184372088832, '$null$' ],
95 [ atom = integer_to_atom, % exchange as text
96 float = integer_to_float % exchange as float
97 ],
98 []).
99 type(float,
100 float = [-1.0, 0.0, 42.0, 3.2747, '$null$' ],
101 [
102 ],
103 []).
104 type(decimal(10,2),
105 atom = ['3.43', '4.50', '5.00', '$null$'],
106 [
107 ],
108 []).
109 type(decimal(6,2), % truncating test
110 atom = ['1000.00'],
111 [
112 ],
113 []).
114 type(decimal(14,2), % truncating test
115 atom = ['17.45'],
116 [
117 ],
118 []).
119 type(numeric(10),
120 integer = [-1, 0, 42, '$null$'],
121 [
122 ],
123 []).
124 type(varchar(20),
125 atom = [ 'foo',
126 '',
127 'this is a long text',
128 '$null$'
129 ],
130 [ codes = sql_atom_codes,
131 string = atom_to_string
132 ],
133 []).
134 type(varchar(10), % can we access as integers?
135 atom = [ '1', '2', '$null$'
136 ],
137 [ integer = atom_to_integer
138 ],
139 []).
140 type(varchar(100),
141 atom = [ foo,
142 '',
143 'This is a nice long string consisting of enough text',
144 '$null$'
145 ],
146 [ codes = sql_atom_codes
147 ],
148 []).
149 type(varchar(2000), % can we access as integers?
150 atom = [ 'This is a nice atom',
151 '',
152 Long,
153 '$null$'
154 ],
155 [
156 ],
157 [ \+ dbms_name('MySQL')
158 ]) :-
159 findall(C, (between(1, 1500, X),
160 C is X mod 64 + "@"), LongCodes),
161 atom_chars(Long, LongCodes).
162 type(varbinary(20),
163 atom = [ foo,
164 '',
165 'With a \0\ character'
166 ],
167 [
168 ],
169 [ \+ dbms_name('MySQL')
170 ]).
171 type(blob, % mySql blob
172 atom = [ foo,
173 '',
174 'With a \0\ character'
175 ],
176 [
177 ],
178 [ odbc_type(longvarbinary),
179 dbms_name('MySQL') % MySQL specific test
180 ]).
181 type(longblob, % mySql blob
182 atom = [ BIG
183 ],
184 [
185 ],
186 [ odbc_type(longvarbinary),
187 dbms_name('MySQL') % MySQL specific test
188 ]) :-
189 read_file_to_codes('odbc.pdf', Codes, [encoding(octet)]),
190 atom_codes(BIG, Codes).
191 type(date - 'Type date',
192 date = [ date(1960,3,19) ],
193 [
194 ],
195 [ \+ dbms_name('Microsoft SQL Server')
196 ]).
197 type(date - 'Type date: NULL',
198 date = [ '$null$' ],
199 [
200 ],
201 [ \+ dbms_name('Microsoft SQL Server'),
202 \+ dbms_name('MySQL')
203 ]).
204 type(time - 'Type time',
205 time = [ time(18,23,19) ],
206 [
207 ],
208 [ \+ dbms_name('Microsoft SQL Server')
209 ]).
210 type(time - 'Type time: NULL',
211 time = [ '$null$' ],
212 [
213 ],
214 [ \+ dbms_name('Microsoft SQL Server'),
215 \+ dbms_name('MySQL')
216 ]).
217 type(timestamp, % MySQL uses POSIX stamps
218 timestamp = [ timestamp(1990,5,18,18,23,19,0) ],
219 [ integer = timestamp_to_integer
220 ],
221 [ dbms_name('MySQL')
222 ]).
223
224 test_type(TypeSpec) :-
225 open_db,
226 type(TypeSpec, PlType=Values, AltAccess, Options),
227 db_type(TypeSpec, Type, Comment),
228 ( applicable(Options, Type)
229 -> progress('~w:', [Comment]),
230 create_test_table(Type),
231 progress(' (w)', []),
232 ( memberchk(odbc_type(ODBCType), Options)
233 -> true
234 ; ODBCType = Type
235 ),
236 insert_values(test, ODBCType, PlType, Values),
237 progress(' (r)', []),
238 read_values(test, PlType, ReadValues),
239 compare_sets(Values, ReadValues),
240 read_test_alt_types(AltAccess, test, Values),
241 write_test_alt_types(AltAccess, Type, test),
242 progress(' (OK!)~n', [])
243 ; true
244 % progress('Skipped ~w: not supported~n', [Comment])
245 ).
246
247 db_type(Type-Comment, Type, Comment).
248 db_type(Type, Type, Comment) :-
249 sformat(Comment, 'Type ~w', [Type]).
250
251 % applicable(+Options, +Type)
252 %
253 % See whether we can run this test on this connection.
254
255 applicable([], _) :- !.
256 applicable([H|T], Type) :- !,
257 applicable(H, Type),
258 applicable(T, Type).
259 applicable(\+ Option, Type) :- !,
260 \+ applicable(Option, Type).
261 applicable(dbms_name(DB), _) :- !,
262 odbc_get_connection(test, dbms_name(DB)).
263 applicable(_, _).
264
265
266 % read_test_alt_types([Type=Map, ...], Table, Values)
267 %
268 % Try to read the table using alternative Prolog types and check
269 % the results.
270
271 read_test_alt_types([], _, _).
272 read_test_alt_types([Type=Map|T], Table, Values) :-
273 read_test_alt_type(Type, Map, Table, Values),
274 read_test_alt_types(T, Table, Values).
275
276 read_test_alt_type(Type, Map, Table, Values) :-
277 progress(' r(~w)', Type),
278 maplist(Map, Values, AltValues),
279 read_values(Table, Type, ReadValues),
280 compare_sets(AltValues, ReadValues).
281
282 % write_test_alt_types([Type=Map, ...], Table, Values)
283 %
284
285 write_test_alt_types([], _, _).
286 write_test_alt_types([Type=Map|T], SqlType, Table) :-
287 write_test_alt_type(Type, Map, SqlType, Table),
288 write_test_alt_types(T, SqlType, Table).
289
290 write_test_alt_type(Type, Map, SqlType, Table) :-
291 progress(' w(~w)', Type),
292 type(SqlType, PlType=NativeValues, _, _),
293 odbc_query(test, 'delete from ~w'-[Table]),
294 maplist(Map, NativeValues, Values),
295 insert_values(test, SqlType, Type, Values),
296 read_values(test, PlType, ReadValues),
297 compare_sets(NativeValues, ReadValues).
298
299 % insert_values(+Table, +OdbcType, +PlType, +Values)
300 %
301 % Insert Prolog values into the table
302
303 insert_values(Table, SqlType, PlType, Values) :-
304 open_db,
305 odbc_prepare(test,
306 'insert into ~w (testval) values (?)'-[Table],
307 [ PlType>SqlType ],
308 Statement),
309 forall(member(V, Values),
310 odbc_execute(Statement, [V])),
311 odbc_free_statement(Statement).
312
313 read_values(Table, PlType, Values) :-
314 open_db,
315 findall(Value,
316 odbc_query(test,
317 'select (testval) from ~w'-[Table],
318 row(Value),
319 [ types([PlType])
320 ]),
321 Values).
322
323 compare_sets(X, X) :- !.
324 compare_sets(X, Y) :-
325 compare_elements(X, Y).
326
327 compare_elements([], []).
328 compare_elements([H|T0], [H|T1]) :- !,
329 compare_elements(T0, T1).
330 compare_elements([H0|T0], [H1|T1]) :-
331 ( float(H0),
332 float(H1)
333 -> Diff is H0-H1,
334 format('~NERROR: ~q != ~q (diff=~f)~n', [H0, H1, Diff])
335 ; print_val(H0, P0),
336 print_val(H1, P1),
337 format('~NERROR: ~q != ~q~n', [P0, P1])
338 ),
339 compare_elements(T0, T1).
340
341
342 print_val(H, P) :-
343 atom(H),
344 atom_length(H, Len),
345 Len > 60, !,
346 sub_atom(H, 0, 40, _, Start),
347 sub_atom(H, _, 20, 0, End),
348 atomic_list_concat([Start, '...', End], P).
349 print_val(H, H).
350
351 /*******************************
352 * MAPS *
353 *******************************/
354
355 integer_to_atom('$null$', '$null$') :- !.
356 integer_to_atom(Int, Atom) :-
357 ( number(Int)
358 -> number_codes(Int, Codes),
359 atom_codes(Atom, Codes)
360 ; atom_codes(Atom, Codes),
361 number_codes(Int, Codes)
362 ).
363
364 integer_to_float('$null$', '$null$') :- !.
365 integer_to_float(Int, Float) :-
366 Float is float(Int).
367
368 atom_to_string('$null$', '$null$') :- !.
369 atom_to_string(Atom, String) :-
370 atom_string(String, Atom).
371
372 atom_to_integer('$null$', '$null$') :- !.
373 atom_to_integer(Atom, Int) :-
374 integer_to_atom(Int, Atom).
375
376 sql_atom_codes('$null$', '$null$') :- !.
377 sql_atom_codes(Atom, Codes) :-
378 atom_codes(Atom, Codes).
379
380 timestamp_to_integer('$null$', '$null$') :- !.
381 timestamp_to_integer(timestamp(Y,M,D,H,Mn,S,0), Sec) :-
382 get(date(S,Mn,H,D,M,Y), slot, date, Sec).
383
384 /*******************************
385 * SHOW SOURCE *
386 *******************************/
387
388 list(Name) :-
389 open_db,
390 ( odbc_query(test, 'select * from ~w'-[Name], Row, [source(true)]),
391 writeln(Row),
392 fail
393 ; true
394 ).
395
396 /*******************************
397 * CURSOR TEST *
398 *******************************/
399
400 :- dynamic
401 statement/2.
402
403 delete_statements :-
404 forall(retract(statement(_, Statement)),
405 odbc_free_statement(Statement)).
406
407
408 mark(john, 6).
409 mark(bob, 7).
410 mark(chris, 5).
411 mark(mary, 7).
412
413 make_mark_table :-
414 open_db,
415 delete_statements,
416 catch(odbc_query(test, 'drop table marks'), _, true),
417 odbc_query(test, 'create table marks (name char(25), mark integer)'),
418 odbc_prepare(test,
419 'insert into marks (name,mark) values (?,?)',
420 [ char(25),
421 integer
422 ],
423 Statement),
424 forall(mark(Name, Mark),
425 odbc_execute(Statement, [Name,Mark])),
426 odbc_free_statement(Statement).
427
428 db_mark(Name, Mark) :-
429 ( statement(select_mark, Stmt)
430 -> true
431 ; odbc_prepare(test, 'select * from marks', [], Stmt),
432 assert(statement(select_mark, Stmt))
433 ),
434 odbc_execute(Stmt, [], row(Name, Mark)).
435
436 same_mark(Name1, Name2) :-
437 db_mark(Name1, Mark1),
438 db_mark(Name2, Mark2),
439 Mark1 == Mark2.
440
441 marks(L) :-
442 open_db,
443 odbc_query(test,
444 'select * from marks', L,
445 [findall(mark(X,Y), row(X,Y))]).
446
447 with_mark(Mark, L) :- % doesn't work yet
448 open_db,
449 odbc_query(test,
450 'select * from marks', L,
451 [ findall(Name, row(Name, Mark))
452 ]).
453
454 tmark :-
455 open_db,
456 odbc_query(test, 'SELECT * from marks', row(X, 6)),
457 write(X),
458 fail.
459
460 prepfoo :-
461 open_db,
462 odbc_prepare(test,
463 'select name from foo where mark=?',
464 [default],
465 S,
466 []),
467 writeln(S).
468
469
470 /*******************************
471 * GENERIC ACTIONS *
472 *******************************/
473
474 create_test_table(Type) :-
475 catch(odbc_query(test, 'drop table test'), _, true),
476 odbc_query(test,
477 'create table ~w (testval ~w)'-[test, Type]).
478
479
480 /*******************************
481 * SPECIAL TESTS *
482 *******************************/
483
484 test(decimal) :-
485 create_test_table(decimal(14,2)),
486 odbc_prepare(test,
487 'insert into test (testval) values (?)',
488 [ decimal(14,2) ],
489 Statement),
490 odbc_execute(Statement, ['17.45'], affected(Affected)),
491 odbc_free_statement(Statement),
492 progress('Affected ~w rows', [Affected]),
493 odbc_query(test, 'select * from test', row('17.45')),
494 progress(' OK!~n', []).
495
496
497 /*******************************
498 * FETCH *
499 *******************************/
500
501 create_fetch_table :-
502 open_db,
503 create_test_table(integer),
504 odbc_prepare(test,
505 'insert into test (testval) values (?)',
506 [ integer ],
507 Statement),
508 forall(between(1, 100, X),
509 odbc_execute(Statement, [X])),
510 odbc_free_statement(Statement).
511
512 fetch(Options) :-
513 open_db,
514 odbc_set_connection(test, cursor_type(static)),
515 odbc_prepare(test,
516 'select (testval) from test',
517 [],
518 Statement,
519 [ fetch(fetch)
520 ]),
521 odbc_execute(Statement, []),
522 fetch(Statement, Options).
523
524 fetch(Statement, Options) :-
525 odbc_fetch(Statement, Row, Options),
526 ( Row == end_of_file
527 -> true
528 ; writeln(Row),
529 fetch(Statement, Options)
530 ).
531
532
533 /*******************************
534 * META *
535 *******************************/
536
537 tcolumns :-
538 open_db,
539 make_mark_table,
540 findall(X, odbc_table_column(test, marks, X), List),
541 List = [name, mark].
542
543
544 /*******************************
545 * FEEDBACK *
546 *******************************/
547
548 progress(Fmt, Args) :-
549 format(Fmt, Args),
550 flush_output.
551
552
553 /*******************************
554 * PORTRAY *
555 *******************************/
556
557 user:portray(Long) :-
558 atom(Long),
559 atom_length(Long, Len),
560 Len > 70,
561 sub_atom(Long, 0, 20, _, Start),
562 sub_atom(Long, _, 10, 0, End),
563 format('\'~w...~w\'', [Start, End]).
564
565 /*******************************
566 * Primary & foreign keys *
567 *******************************/
568
569 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
570 this interface has been developed on purpose to implement
571 W3C 'direct mapping of RDB to RDF'. The database definition is then the same
572 as documented in http://www.w3.org/TR/rdb-direct-mapping/.
573 If tested with MySQL, then tables must use InnoDB as storage engine,
574 that allows for foreign keys definition. Here is the dump required to
575 rebuild the test case. Database is named rdb2rdf_dm
576
577 -- Adminer 3.6.1 MySQL dump
578
579 SET NAMES utf8;
580 SET foreign_key_checks = 0;
581 SET time_zone = 'SYSTEM';
582 SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
583
584 DROP TABLE IF EXISTS `Addresses`;
585 CREATE TABLE `Addresses` (
586 `ID` int(11) NOT NULL DEFAULT '0',
587 `city` char(10) NOT NULL,
588 `state` char(2) NOT NULL,
589 PRIMARY KEY (`ID`)
590 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
591
592 INSERT INTO `Addresses` (`ID`, `city`, `state`) VALUES
593 (18, 'Cambridge', 'MA');
594
595 DROP TABLE IF EXISTS `People`;
596 CREATE TABLE `People` (
597 `ID` int(11) NOT NULL,
598 `fname` char(10) NOT NULL,
599 `addr` int(11) DEFAULT NULL,
600 PRIMARY KEY (`ID`),
601 KEY `addr` (`addr`),
602 CONSTRAINT `People_ibfk_2` FOREIGN KEY (`addr`) REFERENCES `Addresses` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION
603 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
604
605 INSERT INTO `People` (`ID`, `fname`, `addr`) VALUES
606 (7, 'Bob', 18),
607 (8, 'Sue', NULL);
608
609 -- 2013-01-03 09:05:38
610
611 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
612
613 test_keys_connect(Cn) :-
614 ( passwd(Pwd) -> true ; getpass(Pwd), assert(passwd(Pwd)) ),
615 Db = rdb2rdf_dm,
616 Uid = root, % normally this is user name
617 format(atom(S), 'driver=mysql;db=~s;uid=~s;pwd=~s', [Db, Uid, Pwd]),
618 odbc_driver_connect(S, Cn, []).
619
620 test_pk_keys :-
621 test_keys_connect(Cn),
622 forall(odbc_table_primary_key(Cn, T, K),
623 writeln(primary_key(T, K))).
624
625 test_fk_keys :-
626 test_keys_connect(Cn),
627 forall((
628 Tpk = 'Addresses',
629 odbc_table_foreign_key(Cn, Tpk, Cpk, Tfk, Cfk),
630 writeln(foreign_key(Tpk, Cpk, Tfk, Cfk))
631 ;
632 Tfk = 'People',
633 odbc_table_foreign_key(Cn, Tpk, Cpk, Tfk, Cfk),
634 writeln(foreign_key(Tpk, Cpk, Tfk, Cfk))
635 ), true).
0 /* Part of SWI-Prolog
1
2 Author: Jan Wielemaker
3 E-mail: J.Wielemaker@vu.nl
4 WWW: http://www.swi-prolog.org
5 Copyright (C): 2002-2015, University of Amsterdam
6 VU University Amsterdam
7
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
22 As a special exception, if you link this library with other files,
23 compiled with a Free Software compiler, to produce an executable, this
24 library does not by itself cause the resulting executable to be covered
25 by the GNU General Public License. This exception does not however
26 invalidate any other reasons why the executable file might be covered by
27 the GNU General Public License.
28 */
29
30 :- module(test_odbc,
31 [ test_odbc/0,
32 test_odbc/1, % +ConnectionString
33 test_odbc/2 % +DSN, +Options
34 ]).
35 % use the local copy
36 :- asserta(user:file_search_path(foreign, '.')).
37 :- asserta(user:file_search_path(library, '.')).
38 :- asserta(user:file_search_path(library, '../plunit')).
39
40 :- use_module(library(odbc)).
41 :- use_module(library(lists)).
42 :- use_module(library(apply)).
43 :- use_module(library(plunit)).
44
45 /** <module> Test ODBC Interface
46
47 This module tests the ODBC interface. The default test is designed to
48 run with SQLite version 2, installed using the driver =SQLite=. The
49 versions test_odbc/1 and test_odbc/2 allow connecting to alternative
50 databases.
51
52 @tbd The current version of this test file does not return failure.
53 Failure will be enabled when the tests are more mature.
54 */
55
56 %% test_odbc is semidet.
57 %% test_odbc(+ConnectString) is semidet.
58 %% test_odbc(+DSN, +Options) is semidet.
59 %
60 % Run ODBC tests. Without options, this tries to create an
61 % anonymous memory based ODBC connection using SQLite. This
62 % requires the SQLite driver to be configured on the hosting
63 % machine. With options, odbc_connect/3 is called with the DSN and
64 % options. The caller must ensure ODBC is properly installed.
65
66 test_odbc :-
67 test_odbc('DRIVER=SQLite;Database=test.sqlite').
68 test_odbc(ConnectString) :-
69 delete_db_file(ConnectString),
70 catch(open_db(ConnectString), E, print_message(error, E)),
71 ( var(E)
72 -> run_tests([ odbc
73 ])
74 ; true
75 ),
76 delete_db_file(ConnectString).
77 test_odbc(DSN, Options) :-
78 catch(open_db(DSN-Options), E, print_message(error, E)),
79 ( var(E)
80 -> run_tests([ odbc
81 ])
82 ; true
83 ).
84
85 :- dynamic
86 params/1.
87
88 open_db(DSN-Options) :- !,
89 asserta(params(DSN-Options)),
90 odbc_connect(DSN, _,
91 [ alias(test),
92 open(once)
93 | Options
94 ]).
95 open_db(ConnectString) :-
96 asserta(params(ConnectString)),
97 odbc_driver_connect(ConnectString,
98 _Connection,
99 [ open(once),
100 alias(test)
101 ]).
102
103 open_db :-
104 params(Params), !,
105 open_db(Params).
106
107 delete_db_file(ConnectString) :-
108 split_string(ConnectString, ";", " ", Parts),
109 member(Part, Parts),
110 split_string(Part, "=", "", ["Database",File]), !,
111 catch(delete_file(File), _, true).
112 delete_db_file(_).
113
114
115 :- begin_tests(odbc).
116
117 test(integer) :- test_type(integer).
118 test(integer_float) :- test_type(integer - 'Type integer: as float').
119 test(integer_atom) :- test_type(integer - 'Type integer: as atom').
120 test(bigint) :- test_type(bigint).
121 test(float) :- test_type(float).
122 test(decimal_10_2) :- test_type(decimal(10,2)).
123 test(decimal_6_2) :- test_type(decimal(6,2)).
124 test(decimal_14_2) :- test_type(decimal(14,2)).
125 test(numeric_10) :- test_type(numeric(10)).
126 test(varchar_20) :- test_type(varchar(20)).
127 test(varchar_10) :- test_type(varchar(10)).
128 test(varchar_100) :- test_type(varchar(100)).
129 test(varchar_2000) :- test_type(varchar(2000)).
130 test(varbinary_20) :- test_type(varbinary(20)).
131 test(blob) :- test_type(blob).
132 test(longblob) :- test_type(longblob).
133 test(date) :- test_type(date - 'Type date').
134 test(date_null) :- test_type(date - 'Type date: NULL').
135 test(time) :- test_type(time - 'Type time').
136 test(time_null) :- test_type(time - 'Type time: NULL').
137 test(timestamp) :- test_type(timestamp).
138 test(columns) :- tcolumns.
139
140 test(cursor,
141 [ setup(make_mark_table),
142 all(Name1-Name2 == [john-john, bob-bob, bob-mary,
143 chris-chris, mary-bob, mary-mary])
144 ]) :-
145 same_mark(Name1, Name2).
146
147 :- end_tests(odbc).
148
149 /*******************************
150 * TYPE TESTS *
151 *******************************/
152
153 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
154 Test the type-conversion system. For each type we create a small table
155 and read it back. If the type can be accessed with alternative Prolog
156 types we test this too.
157 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
158
159 %% type(SqlType, PlType=Values, [AltType=Map, ...], Options)
160 %
161 % Define a test-set. The first argument is the SQL type to test.
162 % PlType is the default Prolog type with a set of values. AltType
163 % is an alternative type that can be used to exchange values and
164 % Map is a maplist/3 argument to convert the value-list into a
165 % list of values of the alternative type.
166 %
167 % SQLite issues:
168 %
169 % - -1, when read as a float is 4294967295.0
170 % - Writing integers as text does not work.
171
172 type(integer,
173 integer = [-1, 0, 42, '$null$' ],
174 [
175 ],
176 []).
177 type(integer - 'Type integer: as float',
178 integer = [-1, 0, 42, '$null$' ],
179 [ float = integer_to_float % exchange as float
180 ],
181 [ \+ dbms_name('SQLite') ]).
182 type(integer - 'Type integer: as atom',
183 integer = [-1, 0, 42, '$null$' ],
184 [ atom = integer_to_atom % exchange as text
185 ],
186 [ \+ dbms_name('SQLite') ]).
187 type(bigint,
188 integer = [-1, 0, 42, 35184372088832, -35184372088832, '$null$' ],
189 [ atom = integer_to_atom, % exchange as text
190 float = integer_to_float % exchange as float
191 ],
192 [ \+ dbms_name('SQLite') ]).
193 type(float,
194 float = [-1.0, 0.0, 42.0, 3.2747, '$null$' ],
195 [
196 ],
197 []).
198 type(decimal(10,2),
199 atom = ['3.43', '4.50', '5.00', '$null$'],
200 [
201 ],
202 []).
203 type(decimal(6,2), % truncating test
204 atom = ['1000.00'],
205 [
206 ],
207 []).
208 type(decimal(14,2), % truncating test
209 atom = ['17.45'],
210 [
211 ],
212 []).
213 type(numeric(10),
214 integer = [-1, 0, 42, '$null$'],
215 [
216 ],
217 []).
218 type(varchar(20),
219 atom = [ 'foo',
220 '',
221 'this is a long text',
222 '$null$'
223 ],
224 [ codes = sql_atom_codes,
225 string = atom_to_string
226 ],
227 []).
228 type(varchar(10), % can we access as integers?
229 atom = [ '1', '2', '$null$'
230 ],
231 [ integer = atom_to_integer
232 ],
233 []).
234 type(varchar(100),
235 atom = [ foo,
236 '',
237 'This is a nice long string consisting of enough text',
238 '$null$'
239 ],
240 [ codes = sql_atom_codes
241 ],
242 []).
243 type(varchar(2000), % can we access as integers?
244 atom = [ 'This is a nice atom',
245 '',
246 Long,
247 '$null$'
248 ],
249 [
250 ],
251 [ \+ dbms_name('MySQL')
252 ]) :-
253 findall(C, (between(1, 1500, X),
254 C is X mod 64 + "@"), LongCodes),
255 atom_chars(Long, LongCodes).
256 type(varbinary(20),
257 atom = [ foo,
258 '',
259 'With a \0\ character'
260 ],
261 [
262 ],
263 [ \+ dbms_name('MySQL')
264 ]).
265 type(blob, % mySql blob
266 atom = [ foo,
267 '',
268 'With a \0\ character'
269 ],
270 [
271 ],
272 [ odbc_type(longvarbinary),
273 dbms_name('MySQL') % MySQL specific test
274 ]).
275 type(longblob, % mySql blob
276 atom = [ BIG
277 ],
278 [
279 ],
280 [ odbc_type(longvarbinary),
281 dbms_name('MySQL') % MySQL specific test
282 ]) :-
283 read_file_to_codes('odbc.pdf', Codes, [encoding(octet)]),
284 atom_codes(BIG, Codes).
285 type(date - 'Type date',
286 date = [ date(1960,3,19) ],
287 [
288 ],
289 [ \+ dbms_name('Microsoft SQL Server')
290 ]).
291 type(date - 'Type date: NULL',
292 date = [ '$null$' ],
293 [
294 ],
295 [ \+ dbms_name('Microsoft SQL Server'),
296 \+ dbms_name('MySQL')
297 ]).
298 type(time - 'Type time',
299 time = [ time(18,23,19) ],
300 [
301 ],
302 [ \+ dbms_name('Microsoft SQL Server')
303 ]).
304 type(time - 'Type time: NULL',
305 time = [ '$null$' ],
306 [
307 ],
308 [ \+ dbms_name('Microsoft SQL Server'),
309 \+ dbms_name('MySQL')
310 ]).
311 type(timestamp, % MySQL uses POSIX stamps
312 timestamp = [ timestamp(1990,5,18,18,23,19,0) ],
313 [ integer = timestamp_to_integer
314 ],
315 [ dbms_name('MySQL')
316 ]).
317
318 %% test_type(+TypeSpec)
319 %
320 % Test round-trip conversion for TypeSpec.
321
322 test_type(TypeSpec) :-
323 open_db,
324 once(type(TypeSpec, PlType=Values, AltAccess, Options)),
325 db_type(TypeSpec, Type, Comment),
326 ( applicable(Options, Type)
327 -> progress('~w:', [Comment]),
328 create_test_table(Type),
329 progress(' (w)', []),
330 ( memberchk(odbc_type(ODBCType), Options)
331 -> true
332 ; ODBCType = Type
333 ),
334 insert_values(test, ODBCType, PlType, Values),
335 progress(' (r)', []),
336 read_values(test, PlType, ReadValues),
337 compare_sets(Values, ReadValues),
338 read_test_alt_types(AltAccess, test, Values),
339 write_test_alt_types(AltAccess, Type, test),
340 progress(' (OK!)~n', [])
341 ; true
342 % progress('Skipped ~w: not supported~n', [Comment])
343 ).
344
345 db_type(Type-Comment, Type, Comment) :- !.
346 db_type(Type, Type, Comment) :-
347 format(string(Comment), 'Type ~w', [Type]).
348
349 %% applicable(+Options, +Type)
350 %
351 % See whether we can run this test on this connection.
352
353 applicable([], _) :- !.
354 applicable([H|T], Type) :- !,
355 applicable(H, Type),
356 applicable(T, Type).
357 applicable(\+ Option, Type) :- !,
358 \+ applicable(Option, Type).
359 applicable(dbms_name(DB), _) :- !,
360 odbc_get_connection(test, dbms_name(DB)).
361 applicable(_, _).
362
363
364 %% read_test_alt_types([Type=Map, ...], Table, Values)
365 %
366 % Try to read the table using alternative Prolog types and check
367 % the results.
368
369 read_test_alt_types([], _, _).
370 read_test_alt_types([Type=Map|T], Table, Values) :-
371 read_test_alt_type(Type, Map, Table, Values),
372 read_test_alt_types(T, Table, Values).
373
374 read_test_alt_type(Type, Map, Table, Values) :-
375 progress(' r(~w)', Type),
376 maplist(Map, Values, AltValues),
377 read_values(Table, Type, ReadValues),
378 compare_sets(AltValues, ReadValues).
379
380 %% write_test_alt_types([Type=Map, ...], Table, Values)
381
382 write_test_alt_types([], _, _).
383 write_test_alt_types([Type=Map|T], SqlType, Table) :-
384 write_test_alt_type(Type, Map, SqlType, Table),
385 write_test_alt_types(T, SqlType, Table).
386
387 write_test_alt_type(Type, Map, SqlType, Table) :-
388 progress(' w(~w)', Type),
389 once(type(SqlType, PlType=NativeValues, _, _)),
390 odbc_query(test, 'delete from ~w'-[Table]),
391 maplist(Map, NativeValues, Values),
392 insert_values(test, SqlType, Type, Values),
393 read_values(test, PlType, ReadValues),
394 compare_sets(NativeValues, ReadValues).
395
396 %% insert_values(+Table, +OdbcType, +PlType, +Values)
397 %
398 % Insert Prolog values into the table
399
400 insert_values(Table, SqlType, PlType, Values) :-
401 open_db,
402 odbc_prepare(test,
403 'insert into ~w (testval) values (?)'-[Table],
404 [ PlType>SqlType ],
405 Statement),
406 forall(member(V, Values),
407 odbc_execute(Statement, [V])),
408 odbc_free_statement(Statement).
409
410 read_values(Table, PlType, Values) :-
411 open_db,
412 findall(Value,
413 odbc_query(test,
414 'select (testval) from ~w'-[Table],
415 row(Value),
416 [ types([PlType])
417 ]),
418 Values).
419
420 %% compare_sets(+Expected, +Read) is det.
421 %
422 % Compare two sets of values and print the differences.
423
424 compare_sets(X, X) :- !.
425 compare_sets(X, Y) :-
426 compare_elements(X, Y).
427
428 compare_elements([], []).
429 compare_elements([H|T0], [H|T1]) :- !,
430 compare_elements(T0, T1).
431 compare_elements([H0|T0], [H1|T1]) :-
432 ( float(H0),
433 float(H1)
434 -> Diff is H0-H1,
435 format('~NERROR: ~q != ~q (diff=~f)~n', [H0, H1, Diff])
436 ; print_val(H0, P0),
437 print_val(H1, P1),
438 format('~NERROR: ~q != ~q~n', [P0, P1])
439 ),
440 compare_elements(T0, T1).
441
442
443 print_val(H, P) :-
444 atom(H),
445 atom_length(H, Len),
446 Len > 60, !,
447 sub_atom(H, 0, 40, _, Start),
448 sub_atom(H, _, 20, 0, End),
449 atomic_list_concat([Start, '...', End], P).
450 print_val(H, H).
451
452 /*******************************
453 * MAPS *
454 *******************************/
455
456 integer_to_atom('$null$', '$null$') :- !.
457 integer_to_atom(Int, Atom) :-
458 ( number(Int)
459 -> number_codes(Int, Codes),
460 atom_codes(Atom, Codes)
461 ; atom_codes(Atom, Codes),
462 number_codes(Int, Codes)
463 ).
464
465 integer_to_float('$null$', '$null$') :- !.
466 integer_to_float(Int, Float) :-
467 Float is float(Int).
468
469 atom_to_string('$null$', '$null$') :- !.
470 atom_to_string(Atom, String) :-
471 atom_string(Atom, String).
472
473 atom_to_integer('$null$', '$null$') :- !.
474 atom_to_integer(Atom, Int) :-
475 integer_to_atom(Int, Atom).
476
477 sql_atom_codes('$null$', '$null$') :- !.
478 sql_atom_codes(Atom, Codes) :-
479 atom_codes(Atom, Codes).
480
481 timestamp_to_integer('$null$', '$null$') :- !.
482 timestamp_to_integer(timestamp(Y,M,D,H,Mn,S,0), Sec) :-
483 date_time_stamp(date(S,Mn,H,D,M,Y,_UTCOff,_TZ,_DST), Sec).
484
485
486 /*******************************
487 * SHOW SOURCE *
488 *******************************/
489
490 list(Name) :-
491 open_db,
492 ( odbc_query(test, 'select * from ~w'-[Name], Row, [source(true)]),
493 writeln(Row),
494 fail
495 ; true
496 ).
497
498 /*******************************
499 * CURSOR TEST *
500 *******************************/
501
502 :- dynamic
503 statement/2.
504
505 delete_statements :-
506 forall(retract(statement(_, Statement)),
507 odbc_free_statement(Statement)).
508
509
510 mark(john, 6).
511 mark(bob, 7).
512 mark(chris, 5).
513 mark(mary, 7).
514
515 make_mark_table :-
516 open_db,
517 delete_statements,
518 catch(odbc_query(test, 'drop table marks'), _, true),
519 odbc_query(test, 'create table marks (name char(25), mark integer)'),
520 odbc_prepare(test,
521 'insert into marks (name,mark) values (?,?)',
522 [ char(25),
523 integer
524 ],
525 Statement),
526 forall(mark(Name, Mark),
527 odbc_execute(Statement, [Name,Mark])),
528 odbc_free_statement(Statement).
529
530 db_mark(Name, Mark) :-
531 ( statement(select_mark, Stmt)
532 -> true
533 ; odbc_prepare(test, 'select * from marks', [], Stmt),
534 assert(statement(select_mark, Stmt))
535 ),
536 odbc_execute(Stmt, [], row(Name, Mark)).
537
538 same_mark(Name1, Name2) :-
539 db_mark(Name1, Mark1),
540 db_mark(Name2, Mark2),
541 Mark1 == Mark2.
542
543 marks(L) :-
544 open_db,
545 odbc_query(test,
546 'select * from marks', L,
547 [findall(mark(X,Y), row(X,Y))]).
548
549 with_mark(Mark, L) :- % doesn't work yet
550 open_db,
551 odbc_query(test,
552 'select * from marks', L,
553 [ findall(Name, row(Name, Mark))
554 ]).
555
556 tmark :-
557 open_db,
558 odbc_query(test, 'SELECT * from marks', row(X, 6)),
559 write(X),
560 fail.
561
562 prepfoo :-
563 open_db,
564 odbc_prepare(test,
565 'select name from foo where mark=?',
566 [default],
567 S,
568 []),
569 writeln(S).
570
571
572 /*******************************
573 * GENERIC ACTIONS *
574 *******************************/
575
576 create_test_table(Type) :-
577 catch(odbc_query(test, 'drop table test'), _, true),
578 odbc_query(test,
579 'create table ~w (testval ~w)'-[test, Type]).
580
581
582 /*******************************
583 * SPECIAL TESTS *
584 *******************************/
585
586 test(decimal) :-
587 create_test_table(decimal(14,2)),
588 odbc_prepare(test,
589 'insert into test (testval) values (?)',
590 [ decimal(14,2) ],
591 Statement),
592 odbc_execute(Statement, ['17.45'], affected(Affected)),
593 odbc_free_statement(Statement),
594 progress('Affected ~w rows', [Affected]),
595 odbc_query(test, 'select * from test', row('17.45')),
596 progress(' OK!~n', []).
597
598
599 /*******************************
600 * FETCH *
601 *******************************/
602
603 create_fetch_table :-
604 open_db,
605 create_test_table(integer),
606 odbc_prepare(test,
607 'insert into test (testval) values (?)',
608 [ integer ],
609 Statement),
610 forall(between(1, 100, X),
611 odbc_execute(Statement, [X])),
612 odbc_free_statement(Statement).
613
614 fetch(Options) :-
615 open_db,
616 odbc_set_connection(test, cursor_type(static)),
617 odbc_prepare(test,
618 'select (testval) from test',
619 [],
620 Statement,
621 [ fetch(fetch)
622 ]),
623 odbc_execute(Statement, []),
624 fetch(Statement, Options).
625
626 fetch(Statement, Options) :-
627 odbc_fetch(Statement, Row, Options),
628 ( Row == end_of_file
629 -> true
630 ; writeln(Row),
631 fetch(Statement, Options)
632 ).
633
634
635 /*******************************
636 * META *
637 *******************************/
638
639 tcolumns :-
640 open_db,
641 make_mark_table,
642 findall(X, odbc_table_column(test, marks, X), List),
643 List = [name, mark].
644
645
646 /*******************************
647 * FEEDBACK *
648 *******************************/
649
650 progress(_, _) :-
651 current_prolog_flag(verbose, silent), !.
652 progress(Fmt, Args) :-
653 format(Fmt, Args),
654 flush_output.
655
656
657 /*******************************
658 * PORTRAY *
659 *******************************/
660
661 user:portray(Long) :-
662 atom(Long),
663 atom_length(Long, Len),
664 Len > 70,
665 sub_atom(Long, 0, 20, _, Start),
666 sub_atom(Long, _, 10, 0, End),
667 format('\'~w...~w\'', [Start, End]).
668
669 /*******************************
670 * Primary & foreign keys *
671 *******************************/
672
673 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
674 this interface has been developed on purpose to implement
675 W3C 'direct mapping of RDB to RDF'. The database definition is then the same
676 as documented in http://www.w3.org/TR/rdb-direct-mapping/.
677 If tested with MySQL, then tables must use InnoDB as storage engine,
678 that allows for foreign keys definition. Here is the dump required to
679 rebuild the test case. Database is named rdb2rdf_dm
680
681 -- Adminer 3.6.1 MySQL dump
682
683 SET NAMES utf8;
684 SET foreign_key_checks = 0;
685 SET time_zone = 'SYSTEM';
686 SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
687
688 DROP TABLE IF EXISTS `Addresses`;
689 CREATE TABLE `Addresses` (
690 `ID` int(11) NOT NULL DEFAULT '0',
691 `city` char(10) NOT NULL,
692 `state` char(2) NOT NULL,
693 PRIMARY KEY (`ID`)
694 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
695
696 INSERT INTO `Addresses` (`ID`, `city`, `state`) VALUES
697 (18, 'Cambridge', 'MA');
698
699 DROP TABLE IF EXISTS `People`;
700 CREATE TABLE `People` (
701 `ID` int(11) NOT NULL,
702 `fname` char(10) NOT NULL,
703 `addr` int(11) DEFAULT NULL,
704 PRIMARY KEY (`ID`),
705 KEY `addr` (`addr`),
706 CONSTRAINT `People_ibfk_2` FOREIGN KEY (`addr`) REFERENCES `Addresses` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION
707 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
708
709 INSERT INTO `People` (`ID`, `fname`, `addr`) VALUES
710 (7, 'Bob', 18),
711 (8, 'Sue', NULL);
712
713 -- 2013-01-03 09:05:38
714
715 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
716
717 test_keys_connect(Cn) :-
718 ( passwd(Pwd) -> true ; getpass(Pwd), assert(passwd(Pwd)) ),
719 Db = rdb2rdf_dm,
720 Uid = root, % normally this is user name
721 format(atom(S), 'driver=mysql;db=~s;uid=~s;pwd=~s', [Db, Uid, Pwd]),
722 odbc_driver_connect(S, Cn, []).
723
724 test_pk_keys :-
725 test_keys_connect(Cn),
726 forall(odbc_table_primary_key(Cn, T, K),
727 writeln(primary_key(T, K))).
728
729 test_fk_keys :-
730 test_keys_connect(Cn),
731 forall((
732 Tpk = 'Addresses',
733 odbc_table_foreign_key(Cn, Tpk, Cpk, Tfk, Cfk),
734 writeln(foreign_key(Tpk, Cpk, Tfk, Cfk))
735 ;
736 Tfk = 'People',
737 odbc_table_foreign_key(Cn, Tpk, Cpk, Tfk, Cfk),
738 writeln(foreign_key(Tpk, Cpk, Tfk, Cfk))
739 ), true).
5050 install-examples::
5151 mkdir -p $(EXDIR)/web
5252 (cd examples && $(INSTALL_DATA) *.pl $(EXDIR))
53 (cd examples/web && $(INSTALL_DATA) *.html *.js *.png $(EXDIR)/web)
53 (cd examples/web && $(INSTALL_DATA) *.html *.png $(EXDIR)/web)
5454
5555 uninstall:
5656 (cd $(PLLIBDIR) && rm -f $(LIBPL))
00 <html lang="en">
11 <head>
2 <script src="/jquery-2.0.3.min.js"></script>
2 <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
33 <script src="/js/pengines.js"></script>
44 <script type="text/x-prolog">
55
00 <html lang="en">
11 <head>
2 <script src="/jquery-2.0.3.min.js"></script>
2 <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
33 <script src="/js/pengines.js"></script>
44 <script type="text/x-prolog">
55
00 <html lang="en">
11 <head>
2 <script src="/jquery-2.0.3.min.js"></script>
2 <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
33 <script src="/js/pengines.js"></script>
44 <script type="text/x-prolog">
55
00 <html lang="en">
11 <head>
2 <script src="/jquery-2.0.3.min.js"></script>
2 <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
33 <script src="/js/pengines.js"></script>
44 <script type="text/x-prolog">
55
+0
-6
packages/pengines/examples/web/jquery-2.0.3.min.js less more
0 /*! jQuery v2.0.3 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
1 //@ sourceMappingURL=jquery-2.0.3.min.map
2 */
3 (function(e,undefined){var t,n,r=typeof undefined,i=e.location,o=e.document,s=o.documentElement,a=e.jQuery,u=e.$,l={},c=[],p="2.0.3",f=c.concat,h=c.push,d=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,x=function(e,n){return new x.fn.init(e,n,t)},b=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^-ms-/,N=/-([\da-z])/gi,E=function(e,t){return t.toUpperCase()},S=function(){o.removeEventListener("DOMContentLoaded",S,!1),e.removeEventListener("load",S,!1),x.ready()};x.fn=x.prototype={jquery:p,constructor:x,init:function(e,t,n){var r,i;if(!e)return this;if("string"==typeof e){if(r="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:T.exec(e),!r||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof x?t[0]:t,x.merge(this,x.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:o,!0)),C.test(r[1])&&x.isPlainObject(t))for(r in t)x.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return i=o.getElementById(r[2]),i&&i.parentNode&&(this.length=1,this[0]=i),this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?n.ready(e):(e.selector!==undefined&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return d.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,t,n,r,i,o,s=arguments[0]||{},a=1,u=arguments.length,l=!1;for("boolean"==typeof s&&(l=s,s=arguments[1]||{},a=2),"object"==typeof s||x.isFunction(s)||(s={}),u===a&&(s=this,--a);u>a;a++)if(null!=(e=arguments[a]))for(t in e)n=s[t],r=e[t],s!==r&&(l&&r&&(x.isPlainObject(r)||(i=x.isArray(r)))?(i?(i=!1,o=n&&x.isArray(n)?n:[]):o=n&&x.isPlainObject(n)?n:{},s[t]=x.extend(l,o,r)):r!==undefined&&(s[t]=r));return s},x.extend({expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=a),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){(e===!0?--x.readyWait:x.isReady)||(x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(o,[x]),x.fn.trigger&&x(o).trigger("ready").off("ready")))},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray,isWindow:function(e){return null!=e&&e===e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if("object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(t){return!1}return!0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:JSON.parse,parseXML:function(e){var t,n;if(!e||"string"!=typeof e)return null;try{n=new DOMParser,t=n.parseFromString(e,"text/xml")}catch(r){t=undefined}return(!t||t.getElementsByTagName("parsererror").length)&&x.error("Invalid XML: "+e),t},noop:function(){},globalEval:function(e){var t,n=eval;e=x.trim(e),e&&(1===e.indexOf("use strict")?(t=o.createElement("script"),t.text=e,o.head.appendChild(t).parentNode.removeChild(t)):n(e))},camelCase:function(e){return e.replace(k,"ms-").replace(N,E)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,s=j(e);if(n){if(s){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(s){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:function(e){return null==e?"":v.call(e)},makeArray:function(e,t){var n=t||[];return null!=e&&(j(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:g.call(t,e,n)},merge:function(e,t){var n=t.length,r=e.length,i=0;if("number"==typeof n)for(;n>i;i++)e[r++]=t[i];else while(t[i]!==undefined)e[r++]=t[i++];return e.length=r,e},grep:function(e,t,n){var r,i=[],o=0,s=e.length;for(n=!!n;s>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,s=j(e),a=[];if(s)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(a[a.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(a[a.length]=r);return f.apply([],a)},guid:1,proxy:function(e,t){var n,r,i;return"string"==typeof t&&(n=e[t],t=e,e=n),x.isFunction(e)?(r=d.call(arguments,2),i=function(){return e.apply(t||this,r.concat(d.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):undefined},access:function(e,t,n,r,i,o,s){var a=0,u=e.length,l=null==n;if("object"===x.type(n)){i=!0;for(a in n)x.access(e,t,a,n[a],!0,o,s)}else if(r!==undefined&&(i=!0,x.isFunction(r)||(s=!0),l&&(s?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(x(e),n)})),t))for(;u>a;a++)t(e[a],n,s?r:r.call(e[a],a,t(e[a],n)));return i?e:l?t.call(e):u?t(e[0],n):o},now:Date.now,swap:function(e,t,n,r){var i,o,s={};for(o in t)s[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=s[o];return i}}),x.ready.promise=function(t){return n||(n=x.Deferred(),"complete"===o.readyState?setTimeout(x.ready):(o.addEventListener("DOMContentLoaded",S,!1),e.addEventListener("load",S,!1))),n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function j(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}t=x(o),function(e,undefined){var t,n,r,i,o,s,a,u,l,c,p,f,h,d,g,m,y,v="sizzle"+-new Date,b=e.document,w=0,T=0,C=st(),k=st(),N=st(),E=!1,S=function(e,t){return e===t?(E=!0,0):0},j=typeof undefined,D=1<<31,A={}.hasOwnProperty,L=[],q=L.pop,H=L.push,O=L.push,F=L.slice,P=L.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},R="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",W="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",$=W.replace("w","w#"),B="\\["+M+"*("+W+")"+M+"*(?:([*^$|!~]?=)"+M+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+$+")|)|)"+M+"*\\]",I=":("+W+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+B.replace(3,8)+")*)|.*)\\)|)",z=RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),_=RegExp("^"+M+"*,"+M+"*"),X=RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=RegExp(M+"*[+~]"),Y=RegExp("="+M+"*([^\\]'\"]*)"+M+"*\\]","g"),V=RegExp(I),G=RegExp("^"+$+"$"),J={ID:RegExp("^#("+W+")"),CLASS:RegExp("^\\.("+W+")"),TAG:RegExp("^("+W.replace("w","w*")+")"),ATTR:RegExp("^"+B),PSEUDO:RegExp("^"+I),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:RegExp("^(?:"+R+")$","i"),needsContext:RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Q=/^[^{]+\{\s*\[native \w/,K=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,Z=/^(?:input|select|textarea|button)$/i,et=/^h\d$/i,tt=/'|\\/g,nt=RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),rt=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{O.apply(L=F.call(b.childNodes),b.childNodes),L[b.childNodes.length].nodeType}catch(it){O={apply:L.length?function(e,t){H.apply(e,F.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function ot(e,t,r,i){var o,s,a,u,l,f,g,m,x,w;if((t?t.ownerDocument||t:b)!==p&&c(t),t=t||p,r=r||[],!e||"string"!=typeof e)return r;if(1!==(u=t.nodeType)&&9!==u)return[];if(h&&!i){if(o=K.exec(e))if(a=o[1]){if(9===u){if(s=t.getElementById(a),!s||!s.parentNode)return r;if(s.id===a)return r.push(s),r}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(a))&&y(t,s)&&s.id===a)return r.push(s),r}else{if(o[2])return O.apply(r,t.getElementsByTagName(e)),r;if((a=o[3])&&n.getElementsByClassName&&t.getElementsByClassName)return O.apply(r,t.getElementsByClassName(a)),r}if(n.qsa&&(!d||!d.test(e))){if(m=g=v,x=t,w=9===u&&e,1===u&&"object"!==t.nodeName.toLowerCase()){f=gt(e),(g=t.getAttribute("id"))?m=g.replace(tt,"\\$&"):t.setAttribute("id",m),m="[id='"+m+"'] ",l=f.length;while(l--)f[l]=m+mt(f[l]);x=U.test(e)&&t.parentNode||t,w=f.join(",")}if(w)try{return O.apply(r,x.querySelectorAll(w)),r}catch(T){}finally{g||t.removeAttribute("id")}}}return kt(e.replace(z,"$1"),t,r,i)}function st(){var e=[];function t(n,r){return e.push(n+=" ")>i.cacheLength&&delete t[e.shift()],t[n]=r}return t}function at(e){return e[v]=!0,e}function ut(e){var t=p.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function lt(e,t){var n=e.split("|"),r=e.length;while(r--)i.attrHandle[n[r]]=t}function ct(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function pt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function ft(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ht(e){return at(function(t){return t=+t,at(function(n,r){var i,o=e([],n.length,t),s=o.length;while(s--)n[i=o[s]]&&(n[i]=!(r[i]=n[i]))})})}s=ot.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},n=ot.support={},c=ot.setDocument=function(e){var t=e?e.ownerDocument||e:b,r=t.defaultView;return t!==p&&9===t.nodeType&&t.documentElement?(p=t,f=t.documentElement,h=!s(t),r&&r.attachEvent&&r!==r.top&&r.attachEvent("onbeforeunload",function(){c()}),n.attributes=ut(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=ut(function(e){return e.appendChild(t.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=ut(function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),n.getById=ut(function(e){return f.appendChild(e).id=v,!t.getElementsByName||!t.getElementsByName(v).length}),n.getById?(i.find.ID=function(e,t){if(typeof t.getElementById!==j&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},i.filter.ID=function(e){var t=e.replace(nt,rt);return function(e){return e.getAttribute("id")===t}}):(delete i.find.ID,i.filter.ID=function(e){var t=e.replace(nt,rt);return function(e){var n=typeof e.getAttributeNode!==j&&e.getAttributeNode("id");return n&&n.value===t}}),i.find.TAG=n.getElementsByTagName?function(e,t){return typeof t.getElementsByTagName!==j?t.getElementsByTagName(e):undefined}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},i.find.CLASS=n.getElementsByClassName&&function(e,t){return typeof t.getElementsByClassName!==j&&h?t.getElementsByClassName(e):undefined},g=[],d=[],(n.qsa=Q.test(t.querySelectorAll))&&(ut(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||d.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll(":checked").length||d.push(":checked")}),ut(function(e){var n=t.createElement("input");n.setAttribute("type","hidden"),e.appendChild(n).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&d.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||d.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),d.push(",.*:")})),(n.matchesSelector=Q.test(m=f.webkitMatchesSelector||f.mozMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&ut(function(e){n.disconnectedMatch=m.call(e,"div"),m.call(e,"[s!='']:x"),g.push("!=",I)}),d=d.length&&RegExp(d.join("|")),g=g.length&&RegExp(g.join("|")),y=Q.test(f.contains)||f.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},S=f.compareDocumentPosition?function(e,r){if(e===r)return E=!0,0;var i=r.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(r);return i?1&i||!n.sortDetached&&r.compareDocumentPosition(e)===i?e===t||y(b,e)?-1:r===t||y(b,r)?1:l?P.call(l,e)-P.call(l,r):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,n){var r,i=0,o=e.parentNode,s=n.parentNode,a=[e],u=[n];if(e===n)return E=!0,0;if(!o||!s)return e===t?-1:n===t?1:o?-1:s?1:l?P.call(l,e)-P.call(l,n):0;if(o===s)return ct(e,n);r=e;while(r=r.parentNode)a.unshift(r);r=n;while(r=r.parentNode)u.unshift(r);while(a[i]===u[i])i++;return i?ct(a[i],u[i]):a[i]===b?-1:u[i]===b?1:0},t):p},ot.matches=function(e,t){return ot(e,null,null,t)},ot.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&c(e),t=t.replace(Y,"='$1']"),!(!n.matchesSelector||!h||g&&g.test(t)||d&&d.test(t)))try{var r=m.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(i){}return ot(t,p,null,[e]).length>0},ot.contains=function(e,t){return(e.ownerDocument||e)!==p&&c(e),y(e,t)},ot.attr=function(e,t){(e.ownerDocument||e)!==p&&c(e);var r=i.attrHandle[t.toLowerCase()],o=r&&A.call(i.attrHandle,t.toLowerCase())?r(e,t,!h):undefined;return o===undefined?n.attributes||!h?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null:o},ot.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},ot.uniqueSort=function(e){var t,r=[],i=0,o=0;if(E=!n.detectDuplicates,l=!n.sortStable&&e.slice(0),e.sort(S),E){while(t=e[o++])t===e[o]&&(i=r.push(o));while(i--)e.splice(r[i],1)}return e},o=ot.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=o(t);return n},i=ot.selectors={cacheLength:50,createPseudo:at,match:J,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(nt,rt),e[3]=(e[4]||e[5]||"").replace(nt,rt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||ot.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&ot.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return J.CHILD.test(e[0])?null:(e[3]&&e[4]!==undefined?e[2]=e[4]:n&&V.test(n)&&(t=gt(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(nt,rt).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=C[e+" "];return t||(t=RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&C(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=ot.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),s="last"!==e.slice(-4),a="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,p,f,h,d,g=o!==s?"nextSibling":"previousSibling",m=t.parentNode,y=a&&t.nodeName.toLowerCase(),x=!u&&!a;if(m){if(o){while(g){p=t;while(p=p[g])if(a?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;d=g="only"===e&&!d&&"nextSibling"}return!0}if(d=[s?m.firstChild:m.lastChild],s&&x){c=m[v]||(m[v]={}),l=c[e]||[],h=l[0]===w&&l[1],f=l[0]===w&&l[2],p=h&&m.childNodes[h];while(p=++h&&p&&p[g]||(f=h=0)||d.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[w,h,f];break}}else if(x&&(l=(t[v]||(t[v]={}))[e])&&l[0]===w)f=l[1];else while(p=++h&&p&&p[g]||(f=h=0)||d.pop())if((a?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(x&&((p[v]||(p[v]={}))[e]=[w,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||ot.error("unsupported pseudo: "+e);return r[v]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?at(function(e,n){var i,o=r(e,t),s=o.length;while(s--)i=P.call(e,o[s]),e[i]=!(n[i]=o[s])}):function(e){return r(e,0,n)}):r}},pseudos:{not:at(function(e){var t=[],n=[],r=a(e.replace(z,"$1"));return r[v]?at(function(e,t,n,i){var o,s=r(e,null,i,[]),a=e.length;while(a--)(o=s[a])&&(e[a]=!(t[a]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:at(function(e){return function(t){return ot(e,t).length>0}}),contains:at(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),lang:at(function(e){return G.test(e||"")||ot.error("unsupported lang: "+e),e=e.replace(nt,rt).toLowerCase(),function(t){var n;do if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===f},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!i.pseudos.empty(e)},header:function(e){return et.test(e.nodeName)},input:function(e){return Z.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:ht(function(){return[0]}),last:ht(function(e,t){return[t-1]}),eq:ht(function(e,t,n){return[0>n?n+t:n]}),even:ht(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:ht(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:ht(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:ht(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}},i.pseudos.nth=i.pseudos.eq;for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})i.pseudos[t]=pt(t);for(t in{submit:!0,reset:!0})i.pseudos[t]=ft(t);function dt(){}dt.prototype=i.filters=i.pseudos,i.setFilters=new dt;function gt(e,t){var n,r,o,s,a,u,l,c=k[e+" "];if(c)return t?0:c.slice(0);a=e,u=[],l=i.preFilter;while(a){(!n||(r=_.exec(a)))&&(r&&(a=a.slice(r[0].length)||a),u.push(o=[])),n=!1,(r=X.exec(a))&&(n=r.shift(),o.push({value:n,type:r[0].replace(z," ")}),a=a.slice(n.length));for(s in i.filter)!(r=J[s].exec(a))||l[s]&&!(r=l[s](r))||(n=r.shift(),o.push({value:n,type:s,matches:r}),a=a.slice(n.length));if(!n)break}return t?a.length:a?ot.error(e):k(e,u).slice(0)}function mt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function yt(e,t,n){var i=t.dir,o=n&&"parentNode"===i,s=T++;return t.first?function(t,n,r){while(t=t[i])if(1===t.nodeType||o)return e(t,n,r)}:function(t,n,a){var u,l,c,p=w+" "+s;if(a){while(t=t[i])if((1===t.nodeType||o)&&e(t,n,a))return!0}else while(t=t[i])if(1===t.nodeType||o)if(c=t[v]||(t[v]={}),(l=c[i])&&l[0]===p){if((u=l[1])===!0||u===r)return u===!0}else if(l=c[i]=[p],l[1]=e(t,n,a)||r,l[1]===!0)return!0}}function vt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xt(e,t,n,r,i){var o,s=[],a=0,u=e.length,l=null!=t;for(;u>a;a++)(o=e[a])&&(!n||n(o,r,i))&&(s.push(o),l&&t.push(a));return s}function bt(e,t,n,r,i,o){return r&&!r[v]&&(r=bt(r)),i&&!i[v]&&(i=bt(i,o)),at(function(o,s,a,u){var l,c,p,f=[],h=[],d=s.length,g=o||Ct(t||"*",a.nodeType?[a]:a,[]),m=!e||!o&&t?g:xt(g,f,e,a,u),y=n?i||(o?e:d||r)?[]:s:m;if(n&&n(m,y,a,u),r){l=xt(y,h),r(l,[],a,u),c=l.length;while(c--)(p=l[c])&&(y[h[c]]=!(m[h[c]]=p))}if(o){if(i||e){if(i){l=[],c=y.length;while(c--)(p=y[c])&&l.push(m[c]=p);i(null,y=[],l,u)}c=y.length;while(c--)(p=y[c])&&(l=i?P.call(o,p):f[c])>-1&&(o[l]=!(s[l]=p))}}else y=xt(y===s?y.splice(d,y.length):y),i?i(null,s,y,u):O.apply(s,y)})}function wt(e){var t,n,r,o=e.length,s=i.relative[e[0].type],a=s||i.relative[" "],l=s?1:0,c=yt(function(e){return e===t},a,!0),p=yt(function(e){return P.call(t,e)>-1},a,!0),f=[function(e,n,r){return!s&&(r||n!==u)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;o>l;l++)if(n=i.relative[e[l].type])f=[yt(vt(f),n)];else{if(n=i.filter[e[l].type].apply(null,e[l].matches),n[v]){for(r=++l;o>r;r++)if(i.relative[e[r].type])break;return bt(l>1&&vt(f),l>1&&mt(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(z,"$1"),n,r>l&&wt(e.slice(l,r)),o>r&&wt(e=e.slice(r)),o>r&&mt(e))}f.push(n)}return vt(f)}function Tt(e,t){var n=0,o=t.length>0,s=e.length>0,a=function(a,l,c,f,h){var d,g,m,y=[],v=0,x="0",b=a&&[],T=null!=h,C=u,k=a||s&&i.find.TAG("*",h&&l.parentNode||l),N=w+=null==C?1:Math.random()||.1;for(T&&(u=l!==p&&l,r=n);null!=(d=k[x]);x++){if(s&&d){g=0;while(m=e[g++])if(m(d,l,c)){f.push(d);break}T&&(w=N,r=++n)}o&&((d=!m&&d)&&v--,a&&b.push(d))}if(v+=x,o&&x!==v){g=0;while(m=t[g++])m(b,y,l,c);if(a){if(v>0)while(x--)b[x]||y[x]||(y[x]=q.call(f));y=xt(y)}O.apply(f,y),T&&!a&&y.length>0&&v+t.length>1&&ot.uniqueSort(f)}return T&&(w=N,u=C),b};return o?at(a):a}a=ot.compile=function(e,t){var n,r=[],i=[],o=N[e+" "];if(!o){t||(t=gt(e)),n=t.length;while(n--)o=wt(t[n]),o[v]?r.push(o):i.push(o);o=N(e,Tt(i,r))}return o};function Ct(e,t,n){var r=0,i=t.length;for(;i>r;r++)ot(e,t[r],n);return n}function kt(e,t,r,o){var s,u,l,c,p,f=gt(e);if(!o&&1===f.length){if(u=f[0]=f[0].slice(0),u.length>2&&"ID"===(l=u[0]).type&&n.getById&&9===t.nodeType&&h&&i.relative[u[1].type]){if(t=(i.find.ID(l.matches[0].replace(nt,rt),t)||[])[0],!t)return r;e=e.slice(u.shift().value.length)}s=J.needsContext.test(e)?0:u.length;while(s--){if(l=u[s],i.relative[c=l.type])break;if((p=i.find[c])&&(o=p(l.matches[0].replace(nt,rt),U.test(u[0].type)&&t.parentNode||t))){if(u.splice(s,1),e=o.length&&mt(u),!e)return O.apply(r,o),r;break}}}return a(e,f)(o,t,!h,r,U.test(e)),r}n.sortStable=v.split("").sort(S).join("")===v,n.detectDuplicates=E,c(),n.sortDetached=ut(function(e){return 1&e.compareDocumentPosition(p.createElement("div"))}),ut(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||lt("type|href|height|width",function(e,t,n){return n?undefined:e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&ut(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||lt("value",function(e,t,n){return n||"input"!==e.nodeName.toLowerCase()?undefined:e.defaultValue}),ut(function(e){return null==e.getAttribute("disabled")})||lt(R,function(e,t,n){var r;return n?undefined:(r=e.getAttributeNode(t))&&r.specified?r.value:e[t]===!0?t.toLowerCase():null}),x.find=ot,x.expr=ot.selectors,x.expr[":"]=x.expr.pseudos,x.unique=ot.uniqueSort,x.text=ot.getText,x.isXMLDoc=ot.isXML,x.contains=ot.contains}(e);var D={};function A(e){var t=D[e]={};return x.each(e.match(w)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e){e="string"==typeof e?D[e]||A(e):x.extend({},e);var t,n,r,i,o,s,a=[],u=!e.once&&[],l=function(p){for(t=e.memory&&p,n=!0,s=i||0,i=0,o=a.length,r=!0;a&&o>s;s++)if(a[s].apply(p[0],p[1])===!1&&e.stopOnFalse){t=!1;break}r=!1,a&&(u?u.length&&l(u.shift()):t?a=[]:c.disable())},c={add:function(){if(a){var n=a.length;(function s(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&c.has(n)||a.push(n):n&&n.length&&"string"!==r&&s(n)})})(arguments),r?o=a.length:t&&(i=n,l(t))}return this},remove:function(){return a&&x.each(arguments,function(e,t){var n;while((n=x.inArray(t,a,n))>-1)a.splice(n,1),r&&(o>=n&&o--,s>=n&&s--)}),this},has:function(e){return e?x.inArray(e,a)>-1:!(!a||!a.length)},empty:function(){return a=[],o=0,this},disable:function(){return a=u=t=undefined,this},disabled:function(){return!a},lock:function(){return u=undefined,t||c.disable(),this},locked:function(){return!u},fireWith:function(e,t){return!a||n&&!u||(t=t||[],t=[e,t.slice?t.slice():t],r?u.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!n}};return c},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var s=o[0],a=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=a&&a.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===r?n.promise():this,a?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,o){var s=o[2],a=o[3];r[o[1]]=s.add,a&&s.add(function(){n=a},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=s.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=d.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),s=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?d.call(arguments):r,n===a?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},a,u,l;if(r>1)for(a=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(s(t,l,n)).fail(o.reject).progress(s(t,u,a)):--i;return i||o.resolveWith(l,n),o.promise()}}),x.support=function(t){var n=o.createElement("input"),r=o.createDocumentFragment(),i=o.createElement("div"),s=o.createElement("select"),a=s.appendChild(o.createElement("option"));return n.type?(n.type="checkbox",t.checkOn=""!==n.value,t.optSelected=a.selected,t.reliableMarginRight=!0,t.boxSizingReliable=!0,t.pixelPosition=!1,n.checked=!0,t.noCloneChecked=n.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!a.disabled,n=o.createElement("input"),n.value="t",n.type="radio",t.radioValue="t"===n.value,n.setAttribute("checked","t"),n.setAttribute("name","t"),r.appendChild(n),t.checkClone=r.cloneNode(!0).cloneNode(!0).lastChild.checked,t.focusinBubbles="onfocusin"in e,i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===i.style.backgroundClip,x(function(){var n,r,s="padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box",a=o.getElementsByTagName("body")[0];a&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",a.appendChild(n).appendChild(i),i.innerHTML="",i.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%",x.swap(a,null!=a.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===i.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(i,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(i,null)||{width:"4px"}).width,r=i.appendChild(o.createElement("div")),r.style.cssText=i.style.cssText=s,r.style.marginRight=r.style.width="0",i.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),a.removeChild(n))}),t):t}({});var L,q,H=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,O=/([A-Z])/g;function F(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=x.expando+Math.random()}F.uid=1,F.accepts=function(e){return e.nodeType?1===e.nodeType||9===e.nodeType:!0},F.prototype={key:function(e){if(!F.accepts(e))return 0;var t={},n=e[this.expando];if(!n){n=F.uid++;try{t[this.expando]={value:n},Object.defineProperties(e,t)}catch(r){t[this.expando]=n,x.extend(e,t)}}return this.cache[n]||(this.cache[n]={}),n},set:function(e,t,n){var r,i=this.key(e),o=this.cache[i];if("string"==typeof t)o[t]=n;else if(x.isEmptyObject(o))x.extend(this.cache[i],t);else for(r in t)o[r]=t[r];return o},get:function(e,t){var n=this.cache[this.key(e)];return t===undefined?n:n[t]},access:function(e,t,n){var r;return t===undefined||t&&"string"==typeof t&&n===undefined?(r=this.get(e,t),r!==undefined?r:this.get(e,x.camelCase(t))):(this.set(e,t,n),n!==undefined?n:t)},remove:function(e,t){var n,r,i,o=this.key(e),s=this.cache[o];if(t===undefined)this.cache[o]={};else{x.isArray(t)?r=t.concat(t.map(x.camelCase)):(i=x.camelCase(t),t in s?r=[t,i]:(r=i,r=r in s?[r]:r.match(w)||[])),n=r.length;while(n--)delete s[r[n]]}},hasData:function(e){return!x.isEmptyObject(this.cache[e[this.expando]]||{})},discard:function(e){e[this.expando]&&delete this.cache[e[this.expando]]}},L=new F,q=new F,x.extend({acceptData:F.accepts,hasData:function(e){return L.hasData(e)||q.hasData(e)},data:function(e,t,n){return L.access(e,t,n)},removeData:function(e,t){L.remove(e,t)},_data:function(e,t,n){return q.access(e,t,n)},_removeData:function(e,t){q.remove(e,t)}}),x.fn.extend({data:function(e,t){var n,r,i=this[0],o=0,s=null;if(e===undefined){if(this.length&&(s=L.get(i),1===i.nodeType&&!q.get(i,"hasDataAttrs"))){for(n=i.attributes;n.length>o;o++)r=n[o].name,0===r.indexOf("data-")&&(r=x.camelCase(r.slice(5)),P(i,r,s[r]));q.set(i,"hasDataAttrs",!0)}return s}return"object"==typeof e?this.each(function(){L.set(this,e)}):x.access(this,function(t){var n,r=x.camelCase(e);if(i&&t===undefined){if(n=L.get(i,e),n!==undefined)return n;if(n=L.get(i,r),n!==undefined)return n;if(n=P(i,r,undefined),n!==undefined)return n}else this.each(function(){var n=L.get(this,r);L.set(this,r,t),-1!==e.indexOf("-")&&n!==undefined&&L.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){L.remove(this,e)})}});function P(e,t,n){var r;if(n===undefined&&1===e.nodeType)if(r="data-"+t.replace(O,"-$1").toLowerCase(),n=e.getAttribute(r),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:H.test(n)?JSON.parse(n):n}catch(i){}L.set(e,t,n)}else n=undefined;return n}x.extend({queue:function(e,t,n){var r;return e?(t=(t||"fx")+"queue",r=q.get(e,t),n&&(!r||x.isArray(n)?r=q.access(e,t,x.makeArray(n)):r.push(n)),r||[]):undefined},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),o=x._queueHooks(e,t),s=function(){x.dequeue(e,t)
4 };"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,s,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return q.get(e,n)||q.access(e,n,{empty:x.Callbacks("once memory").add(function(){q.remove(e,[t+"queue",n])})})}}),x.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),n>arguments.length?x.queue(this[0],e):t===undefined?this:this.each(function(){var n=x.queue(this,e,t);x._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&x.dequeue(this,e)})},dequeue:function(e){return this.each(function(){x.dequeue(this,e)})},delay:function(e,t){return e=x.fx?x.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=x.Deferred(),o=this,s=this.length,a=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=undefined),e=e||"fx";while(s--)n=q.get(o[s],e+"queueHooks"),n&&n.empty&&(r++,n.empty.add(a));return a(),i.promise(t)}});var R,M,W=/[\t\r\n\f]/g,$=/\r/g,B=/^(?:input|select|textarea|button)$/i;x.fn.extend({attr:function(e,t){return x.access(this,x.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){x.removeAttr(this,e)})},prop:function(e,t){return x.access(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[x.propFix[e]||e]})},addClass:function(e){var t,n,r,i,o,s=0,a=this.length,u="string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];a>s;s++)if(n=this[s],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(W," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=x.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,s=0,a=this.length,u=0===arguments.length||"string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];a>s;s++)if(n=this[s],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(W," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?x.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):x.isFunction(e)?this.each(function(n){x(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var t,i=0,o=x(this),s=e.match(w)||[];while(t=s[i++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else(n===r||"boolean"===n)&&(this.className&&q.set(this,"__className__",this.className),this.className=this.className||e===!1?"":q.get(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(W," ").indexOf(t)>=0)return!0;return!1},val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=x.isFunction(e),this.each(function(n){var i;1===this.nodeType&&(i=r?e.call(this,n,x(this).val()):e,null==i?i="":"number"==typeof i?i+="":x.isArray(i)&&(i=x.map(i,function(e){return null==e?"":e+""})),t=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&t.set(this,i,"value")!==undefined||(this.value=i))});if(i)return t=x.valHooks[i.type]||x.valHooks[i.nodeName.toLowerCase()],t&&"get"in t&&(n=t.get(i,"value"))!==undefined?n:(n=i.value,"string"==typeof n?n.replace($,""):null==n?"":n)}}}),x.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,s=o?null:[],a=o?i+1:r.length,u=0>i?a:o?i:0;for(;a>u;u++)if(n=r[u],!(!n.selected&&u!==i||(x.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&x.nodeName(n.parentNode,"optgroup"))){if(t=x(n).val(),o)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=x.makeArray(t),s=i.length;while(s--)r=i[s],(r.selected=x.inArray(x(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,t,n){var i,o,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return typeof e.getAttribute===r?x.prop(e,t,n):(1===s&&x.isXMLDoc(e)||(t=t.toLowerCase(),i=x.attrHooks[t]||(x.expr.match.bool.test(t)?M:R)),n===undefined?i&&"get"in i&&null!==(o=i.get(e,t))?o:(o=x.find.attr(e,t),null==o?undefined:o):null!==n?i&&"set"in i&&(o=i.set(e,n,t))!==undefined?o:(e.setAttribute(t,n+""),n):(x.removeAttr(e,t),undefined))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(w);if(o&&1===e.nodeType)while(n=o[i++])r=x.propFix[n]||n,x.expr.match.bool.test(n)&&(e[r]=!1),e.removeAttribute(n)},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,t,n){var r,i,o,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return o=1!==s||!x.isXMLDoc(e),o&&(t=x.propFix[t]||t,i=x.propHooks[t]),n!==undefined?i&&"set"in i&&(r=i.set(e,n,t))!==undefined?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){return e.hasAttribute("tabindex")||B.test(e.nodeName)||e.href?e.tabIndex:-1}}}}),M={set:function(e,t,n){return t===!1?x.removeAttr(e,n):e.setAttribute(n,n),n}},x.each(x.expr.match.bool.source.match(/\w+/g),function(e,t){var n=x.expr.attrHandle[t]||x.find.attr;x.expr.attrHandle[t]=function(e,t,r){var i=x.expr.attrHandle[t],o=r?undefined:(x.expr.attrHandle[t]=undefined)!=n(e,t,r)?t.toLowerCase():null;return x.expr.attrHandle[t]=i,o}}),x.support.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,t){return x.isArray(t)?e.checked=x.inArray(x(e).val(),t)>=0:undefined}},x.support.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var I=/^key/,z=/^(?:mouse|contextmenu)|click/,_=/^(?:focusinfocus|focusoutblur)$/,X=/^([^.]*)(?:\.(.+)|)$/;function U(){return!0}function Y(){return!1}function V(){try{return o.activeElement}catch(e){}}x.event={global:{},add:function(e,t,n,i,o){var s,a,u,l,c,p,f,h,d,g,m,y=q.get(e);if(y){n.handler&&(s=n,n=s.handler,o=s.selector),n.guid||(n.guid=x.guid++),(l=y.events)||(l=y.events={}),(a=y.handle)||(a=y.handle=function(e){return typeof x===r||e&&x.event.triggered===e.type?undefined:x.event.dispatch.apply(a.elem,arguments)},a.elem=e),t=(t||"").match(w)||[""],c=t.length;while(c--)u=X.exec(t[c])||[],d=m=u[1],g=(u[2]||"").split(".").sort(),d&&(f=x.event.special[d]||{},d=(o?f.delegateType:f.bindType)||d,f=x.event.special[d]||{},p=x.extend({type:d,origType:m,data:i,handler:n,guid:n.guid,selector:o,needsContext:o&&x.expr.match.needsContext.test(o),namespace:g.join(".")},s),(h=l[d])||(h=l[d]=[],h.delegateCount=0,f.setup&&f.setup.call(e,i,g,a)!==!1||e.addEventListener&&e.addEventListener(d,a,!1)),f.add&&(f.add.call(e,p),p.handler.guid||(p.handler.guid=n.guid)),o?h.splice(h.delegateCount++,0,p):h.push(p),x.event.global[d]=!0);e=null}},remove:function(e,t,n,r,i){var o,s,a,u,l,c,p,f,h,d,g,m=q.hasData(e)&&q.get(e);if(m&&(u=m.events)){t=(t||"").match(w)||[""],l=t.length;while(l--)if(a=X.exec(t[l])||[],h=g=a[1],d=(a[2]||"").split(".").sort(),h){p=x.event.special[h]||{},h=(r?p.delegateType:p.bindType)||h,f=u[h]||[],a=a[2]&&RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"),s=o=f.length;while(o--)c=f[o],!i&&g!==c.origType||n&&n.guid!==c.guid||a&&!a.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(f.splice(o,1),c.selector&&f.delegateCount--,p.remove&&p.remove.call(e,c));s&&!f.length&&(p.teardown&&p.teardown.call(e,d,m.handle)!==!1||x.removeEvent(e,h,m.handle),delete u[h])}else for(h in u)x.event.remove(e,h+t[l],n,r,!0);x.isEmptyObject(u)&&(delete m.handle,q.remove(e,"events"))}},trigger:function(t,n,r,i){var s,a,u,l,c,p,f,h=[r||o],d=y.call(t,"type")?t.type:t,g=y.call(t,"namespace")?t.namespace.split("."):[];if(a=u=r=r||o,3!==r.nodeType&&8!==r.nodeType&&!_.test(d+x.event.triggered)&&(d.indexOf(".")>=0&&(g=d.split("."),d=g.shift(),g.sort()),c=0>d.indexOf(":")&&"on"+d,t=t[x.expando]?t:new x.Event(d,"object"==typeof t&&t),t.isTrigger=i?2:3,t.namespace=g.join("."),t.namespace_re=t.namespace?RegExp("(^|\\.)"+g.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=undefined,t.target||(t.target=r),n=null==n?[t]:x.makeArray(n,[t]),f=x.event.special[d]||{},i||!f.trigger||f.trigger.apply(r,n)!==!1)){if(!i&&!f.noBubble&&!x.isWindow(r)){for(l=f.delegateType||d,_.test(l+d)||(a=a.parentNode);a;a=a.parentNode)h.push(a),u=a;u===(r.ownerDocument||o)&&h.push(u.defaultView||u.parentWindow||e)}s=0;while((a=h[s++])&&!t.isPropagationStopped())t.type=s>1?l:f.bindType||d,p=(q.get(a,"events")||{})[t.type]&&q.get(a,"handle"),p&&p.apply(a,n),p=c&&a[c],p&&x.acceptData(a)&&p.apply&&p.apply(a,n)===!1&&t.preventDefault();return t.type=d,i||t.isDefaultPrevented()||f._default&&f._default.apply(h.pop(),n)!==!1||!x.acceptData(r)||c&&x.isFunction(r[d])&&!x.isWindow(r)&&(u=r[c],u&&(r[c]=null),x.event.triggered=d,r[d](),x.event.triggered=undefined,u&&(r[c]=u)),t.result}},dispatch:function(e){e=x.event.fix(e);var t,n,r,i,o,s=[],a=d.call(arguments),u=(q.get(this,"events")||{})[e.type]||[],l=x.event.special[e.type]||{};if(a[0]=e,e.delegateTarget=this,!l.preDispatch||l.preDispatch.call(this,e)!==!1){s=x.event.handlers.call(this,e,u),t=0;while((i=s[t++])&&!e.isPropagationStopped()){e.currentTarget=i.elem,n=0;while((o=i.handlers[n++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(o.namespace))&&(e.handleObj=o,e.data=o.data,r=((x.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,a),r!==undefined&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return l.postDispatch&&l.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,r,i,o,s=[],a=t.delegateCount,u=e.target;if(a&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!==this;u=u.parentNode||this)if(u.disabled!==!0||"click"!==e.type){for(r=[],n=0;a>n;n++)o=t[n],i=o.selector+" ",r[i]===undefined&&(r[i]=o.needsContext?x(i,this).index(u)>=0:x.find(i,this,null,[u]).length),r[i]&&r.push(o);r.length&&s.push({elem:u,handlers:r})}return t.length>a&&s.push({elem:this,handlers:t.slice(a)}),s},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,t){var n,r,i,s=t.button;return null==e.pageX&&null!=t.clientX&&(n=e.target.ownerDocument||o,r=n.documentElement,i=n.body,e.pageX=t.clientX+(r&&r.scrollLeft||i&&i.scrollLeft||0)-(r&&r.clientLeft||i&&i.clientLeft||0),e.pageY=t.clientY+(r&&r.scrollTop||i&&i.scrollTop||0)-(r&&r.clientTop||i&&i.clientTop||0)),e.which||s===undefined||(e.which=1&s?1:2&s?3:4&s?2:0),e}},fix:function(e){if(e[x.expando])return e;var t,n,r,i=e.type,s=e,a=this.fixHooks[i];a||(this.fixHooks[i]=a=z.test(i)?this.mouseHooks:I.test(i)?this.keyHooks:{}),r=a.props?this.props.concat(a.props):this.props,e=new x.Event(s),t=r.length;while(t--)n=r[t],e[n]=s[n];return e.target||(e.target=o),3===e.target.nodeType&&(e.target=e.target.parentNode),a.filter?a.filter(e,s):e},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==V()&&this.focus?(this.focus(),!1):undefined},delegateType:"focusin"},blur:{trigger:function(){return this===V()&&this.blur?(this.blur(),!1):undefined},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&x.nodeName(this,"input")?(this.click(),!1):undefined},_default:function(e){return x.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==undefined&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?x.event.trigger(i,null,t):x.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},x.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)},x.Event=function(e,t){return this instanceof x.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.getPreventDefault&&e.getPreventDefault()?U:Y):this.type=e,t&&x.extend(this,t),this.timeStamp=e&&e.timeStamp||x.now(),this[x.expando]=!0,undefined):new x.Event(e,t)},x.Event.prototype={isDefaultPrevented:Y,isPropagationStopped:Y,isImmediatePropagationStopped:Y,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=U,e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=U,e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=U,this.stopPropagation()}},x.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){x.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!x.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){x.event.simulate(t,e.target,x.event.fix(e),!0)};x.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),x.fn.extend({on:function(e,t,n,r,i){var o,s;if("object"==typeof e){"string"!=typeof t&&(n=n||t,t=undefined);for(s in e)this.on(s,t,n,e[s],i);return this}if(null==n&&null==r?(r=t,n=t=undefined):null==r&&("string"==typeof t?(r=n,n=undefined):(r=n,n=t,t=undefined)),r===!1)r=Y;else if(!r)return this;return 1===i&&(o=r,r=function(e){return x().off(e),o.apply(this,arguments)},r.guid=o.guid||(o.guid=x.guid++)),this.each(function(){x.event.add(this,e,r,n,t)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,x(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return(t===!1||"function"==typeof t)&&(n=t,t=undefined),n===!1&&(n=Y),this.each(function(){x.event.remove(this,e,n,t)})},trigger:function(e,t){return this.each(function(){x.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];return n?x.event.trigger(e,t,n,!0):undefined}});var G=/^.[^:#\[\.,]*$/,J=/^(?:parents|prev(?:Until|All))/,Q=x.expr.match.needsContext,K={children:!0,contents:!0,next:!0,prev:!0};x.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(x(e).filter(function(){for(t=0;i>t;t++)if(x.contains(r[t],this))return!0}));for(t=0;i>t;t++)x.find(e,r[t],n);return n=this.pushStack(i>1?x.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t=x(e,this),n=t.length;return this.filter(function(){var e=0;for(;n>e;e++)if(x.contains(this,t[e]))return!0})},not:function(e){return this.pushStack(et(this,e||[],!0))},filter:function(e){return this.pushStack(et(this,e||[],!1))},is:function(e){return!!et(this,"string"==typeof e&&Q.test(e)?x(e):e||[],!1).length},closest:function(e,t){var n,r=0,i=this.length,o=[],s=Q.test(e)||"string"!=typeof e?x(e,t||this.context):0;for(;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(11>n.nodeType&&(s?s.index(n)>-1:1===n.nodeType&&x.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?x.unique(o):o)},index:function(e){return e?"string"==typeof e?g.call(x(e),this[0]):g.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?x(e,t):x.makeArray(e&&e.nodeType?[e]:e),r=x.merge(this.get(),n);return this.pushStack(x.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function Z(e,t){while((e=e[t])&&1!==e.nodeType);return e}x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return x.dir(e,"parentNode")},parentsUntil:function(e,t,n){return x.dir(e,"parentNode",n)},next:function(e){return Z(e,"nextSibling")},prev:function(e){return Z(e,"previousSibling")},nextAll:function(e){return x.dir(e,"nextSibling")},prevAll:function(e){return x.dir(e,"previousSibling")},nextUntil:function(e,t,n){return x.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return x.dir(e,"previousSibling",n)},siblings:function(e){return x.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return x.sibling(e.firstChild)},contents:function(e){return e.contentDocument||x.merge([],e.childNodes)}},function(e,t){x.fn[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=x.filter(r,i)),this.length>1&&(K[e]||x.unique(i),J.test(e)&&i.reverse()),this.pushStack(i)}}),x.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,t,n){var r=[],i=n!==undefined;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&x(e).is(n))break;r.push(e)}return r},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function et(e,t,n){if(x.isFunction(t))return x.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return x.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(G.test(t))return x.filter(t,e,n);t=x.filter(t,e)}return x.grep(e,function(e){return g.call(t,e)>=0!==n})}var tt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,nt=/<([\w:]+)/,rt=/<|&#?\w+;/,it=/<(?:script|style|link)/i,ot=/^(?:checkbox|radio)$/i,st=/checked\s*(?:[^=]|=\s*.checked.)/i,at=/^$|\/(?:java|ecma)script/i,ut=/^true\/(.*)/,lt=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ct={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ct.optgroup=ct.option,ct.tbody=ct.tfoot=ct.colgroup=ct.caption=ct.thead,ct.th=ct.td,x.fn.extend({text:function(e){return x.access(this,function(e){return e===undefined?x.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=pt(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=pt(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?x.filter(e,this):this,i=0;for(;null!=(n=r[i]);i++)t||1!==n.nodeType||x.cleanData(mt(n)),n.parentNode&&(t&&x.contains(n.ownerDocument,n)&&dt(mt(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++)1===e.nodeType&&(x.cleanData(mt(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return x.clone(this,e,t)})},html:function(e){return x.access(this,function(e){var t=this[0]||{},n=0,r=this.length;if(e===undefined&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!it.test(e)&&!ct[(nt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(tt,"<$1></$2>");try{for(;r>n;n++)t=this[n]||{},1===t.nodeType&&(x.cleanData(mt(t,!1)),t.innerHTML=e);t=0}catch(i){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=x.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),x(this).remove(),i.insertBefore(n,r))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=f.apply([],e);var r,i,o,s,a,u,l=0,c=this.length,p=this,h=c-1,d=e[0],g=x.isFunction(d);if(g||!(1>=c||"string"!=typeof d||x.support.checkClone)&&st.test(d))return this.each(function(r){var i=p.eq(r);g&&(e[0]=d.call(this,r,i.html())),i.domManip(e,t,n)});if(c&&(r=x.buildFragment(e,this[0].ownerDocument,!1,!n&&this),i=r.firstChild,1===r.childNodes.length&&(r=i),i)){for(o=x.map(mt(r,"script"),ft),s=o.length;c>l;l++)a=r,l!==h&&(a=x.clone(a,!0,!0),s&&x.merge(o,mt(a,"script"))),t.call(this[l],a,l);if(s)for(u=o[o.length-1].ownerDocument,x.map(o,ht),l=0;s>l;l++)a=o[l],at.test(a.type||"")&&!q.access(a,"globalEval")&&x.contains(u,a)&&(a.src?x._evalUrl(a.src):x.globalEval(a.textContent.replace(lt,"")))}return this}}),x.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){x.fn[e]=function(e){var n,r=[],i=x(e),o=i.length-1,s=0;for(;o>=s;s++)n=s===o?this:this.clone(!0),x(i[s])[t](n),h.apply(r,n.get());return this.pushStack(r)}}),x.extend({clone:function(e,t,n){var r,i,o,s,a=e.cloneNode(!0),u=x.contains(e.ownerDocument,e);if(!(x.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||x.isXMLDoc(e)))for(s=mt(a),o=mt(e),r=0,i=o.length;i>r;r++)yt(o[r],s[r]);if(t)if(n)for(o=o||mt(e),s=s||mt(a),r=0,i=o.length;i>r;r++)gt(o[r],s[r]);else gt(e,a);return s=mt(a,"script"),s.length>0&&dt(s,!u&&mt(e,"script")),a},buildFragment:function(e,t,n,r){var i,o,s,a,u,l,c=0,p=e.length,f=t.createDocumentFragment(),h=[];for(;p>c;c++)if(i=e[c],i||0===i)if("object"===x.type(i))x.merge(h,i.nodeType?[i]:i);else if(rt.test(i)){o=o||f.appendChild(t.createElement("div")),s=(nt.exec(i)||["",""])[1].toLowerCase(),a=ct[s]||ct._default,o.innerHTML=a[1]+i.replace(tt,"<$1></$2>")+a[2],l=a[0];while(l--)o=o.lastChild;x.merge(h,o.childNodes),o=f.firstChild,o.textContent=""}else h.push(t.createTextNode(i));f.textContent="",c=0;while(i=h[c++])if((!r||-1===x.inArray(i,r))&&(u=x.contains(i.ownerDocument,i),o=mt(f.appendChild(i),"script"),u&&dt(o),n)){l=0;while(i=o[l++])at.test(i.type||"")&&n.push(i)}return f},cleanData:function(e){var t,n,r,i,o,s,a=x.event.special,u=0;for(;(n=e[u])!==undefined;u++){if(F.accepts(n)&&(o=n[q.expando],o&&(t=q.cache[o]))){if(r=Object.keys(t.events||{}),r.length)for(s=0;(i=r[s])!==undefined;s++)a[i]?x.event.remove(n,i):x.removeEvent(n,i,t.handle);q.cache[o]&&delete q.cache[o]}delete L.cache[n[L.expando]]}},_evalUrl:function(e){return x.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}});function pt(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function ft(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function ht(e){var t=ut.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function dt(e,t){var n=e.length,r=0;for(;n>r;r++)q.set(e[r],"globalEval",!t||q.get(t[r],"globalEval"))}function gt(e,t){var n,r,i,o,s,a,u,l;if(1===t.nodeType){if(q.hasData(e)&&(o=q.access(e),s=q.set(t,o),l=o.events)){delete s.handle,s.events={};for(i in l)for(n=0,r=l[i].length;r>n;n++)x.event.add(t,i,l[i][n])}L.hasData(e)&&(a=L.access(e),u=x.extend({},a),L.set(t,u))}}function mt(e,t){var n=e.getElementsByTagName?e.getElementsByTagName(t||"*"):e.querySelectorAll?e.querySelectorAll(t||"*"):[];return t===undefined||t&&x.nodeName(e,t)?x.merge([e],n):n}function yt(e,t){var n=t.nodeName.toLowerCase();"input"===n&&ot.test(e.type)?t.checked=e.checked:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}x.fn.extend({wrapAll:function(e){var t;return x.isFunction(e)?this.each(function(t){x(this).wrapAll(e.call(this,t))}):(this[0]&&(t=x(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this)},wrapInner:function(e){return x.isFunction(e)?this.each(function(t){x(this).wrapInner(e.call(this,t))}):this.each(function(){var t=x(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=x.isFunction(e);return this.each(function(n){x(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){x.nodeName(this,"body")||x(this).replaceWith(this.childNodes)}).end()}});var vt,xt,bt=/^(none|table(?!-c[ea]).+)/,wt=/^margin/,Tt=RegExp("^("+b+")(.*)$","i"),Ct=RegExp("^("+b+")(?!px)[a-z%]+$","i"),kt=RegExp("^([+-])=("+b+")","i"),Nt={BODY:"block"},Et={position:"absolute",visibility:"hidden",display:"block"},St={letterSpacing:0,fontWeight:400},jt=["Top","Right","Bottom","Left"],Dt=["Webkit","O","Moz","ms"];function At(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=Dt.length;while(i--)if(t=Dt[i]+n,t in e)return t;return r}function Lt(e,t){return e=t||e,"none"===x.css(e,"display")||!x.contains(e.ownerDocument,e)}function qt(t){return e.getComputedStyle(t,null)}function Ht(e,t){var n,r,i,o=[],s=0,a=e.length;for(;a>s;s++)r=e[s],r.style&&(o[s]=q.get(r,"olddisplay"),n=r.style.display,t?(o[s]||"none"!==n||(r.style.display=""),""===r.style.display&&Lt(r)&&(o[s]=q.access(r,"olddisplay",Rt(r.nodeName)))):o[s]||(i=Lt(r),(n&&"none"!==n||!i)&&q.set(r,"olddisplay",i?n:x.css(r,"display"))));for(s=0;a>s;s++)r=e[s],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[s]||"":"none"));return e}x.fn.extend({css:function(e,t){return x.access(this,function(e,t,n){var r,i,o={},s=0;if(x.isArray(t)){for(r=qt(e),i=t.length;i>s;s++)o[t[s]]=x.css(e,t[s],!1,r);return o}return n!==undefined?x.style(e,t,n):x.css(e,t)},e,t,arguments.length>1)},show:function(){return Ht(this,!0)},hide:function(){return Ht(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){Lt(this)?x(this).show():x(this).hide()})}}),x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=vt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,s,a=x.camelCase(t),u=e.style;return t=x.cssProps[a]||(x.cssProps[a]=At(u,a)),s=x.cssHooks[t]||x.cssHooks[a],n===undefined?s&&"get"in s&&(i=s.get(e,!1,r))!==undefined?i:u[t]:(o=typeof n,"string"===o&&(i=kt.exec(n))&&(n=(i[1]+1)*i[2]+parseFloat(x.css(e,t)),o="number"),null==n||"number"===o&&isNaN(n)||("number"!==o||x.cssNumber[a]||(n+="px"),x.support.clearCloneStyle||""!==n||0!==t.indexOf("background")||(u[t]="inherit"),s&&"set"in s&&(n=s.set(e,n,r))===undefined||(u[t]=n)),undefined)}},css:function(e,t,n,r){var i,o,s,a=x.camelCase(t);return t=x.cssProps[a]||(x.cssProps[a]=At(e.style,a)),s=x.cssHooks[t]||x.cssHooks[a],s&&"get"in s&&(i=s.get(e,!0,n)),i===undefined&&(i=vt(e,t,r)),"normal"===i&&t in St&&(i=St[t]),""===n||n?(o=parseFloat(i),n===!0||x.isNumeric(o)?o||0:i):i}}),vt=function(e,t,n){var r,i,o,s=n||qt(e),a=s?s.getPropertyValue(t)||s[t]:undefined,u=e.style;return s&&(""!==a||x.contains(e.ownerDocument,e)||(a=x.style(e,t)),Ct.test(a)&&wt.test(t)&&(r=u.width,i=u.minWidth,o=u.maxWidth,u.minWidth=u.maxWidth=u.width=a,a=s.width,u.width=r,u.minWidth=i,u.maxWidth=o)),a};function Ot(e,t,n){var r=Tt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function Ft(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,s=0;for(;4>o;o+=2)"margin"===n&&(s+=x.css(e,n+jt[o],!0,i)),r?("content"===n&&(s-=x.css(e,"padding"+jt[o],!0,i)),"margin"!==n&&(s-=x.css(e,"border"+jt[o]+"Width",!0,i))):(s+=x.css(e,"padding"+jt[o],!0,i),"padding"!==n&&(s+=x.css(e,"border"+jt[o]+"Width",!0,i)));return s}function Pt(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=qt(e),s=x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=vt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Ct.test(i))return i;r=s&&(x.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+Ft(e,t,n||(s?"border":"content"),r,o)+"px"}function Rt(e){var t=o,n=Nt[e];return n||(n=Mt(e,t),"none"!==n&&n||(xt=(xt||x("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(xt[0].contentWindow||xt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=Mt(e,t),xt.detach()),Nt[e]=n),n}function Mt(e,t){var n=x(t.createElement(e)).appendTo(t.body),r=x.css(n[0],"display");return n.remove(),r}x.each(["height","width"],function(e,t){x.cssHooks[t]={get:function(e,n,r){return n?0===e.offsetWidth&&bt.test(x.css(e,"display"))?x.swap(e,Et,function(){return Pt(e,t,r)}):Pt(e,t,r):undefined},set:function(e,n,r){var i=r&&qt(e);return Ot(e,n,r?Ft(e,t,r,x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,i),i):0)}}}),x(function(){x.support.reliableMarginRight||(x.cssHooks.marginRight={get:function(e,t){return t?x.swap(e,{display:"inline-block"},vt,[e,"marginRight"]):undefined}}),!x.support.pixelPosition&&x.fn.position&&x.each(["top","left"],function(e,t){x.cssHooks[t]={get:function(e,n){return n?(n=vt(e,t),Ct.test(n)?x(e).position()[t]+"px":n):undefined}}})}),x.expr&&x.expr.filters&&(x.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight},x.expr.filters.visible=function(e){return!x.expr.filters.hidden(e)}),x.each({margin:"",padding:"",border:"Width"},function(e,t){x.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+jt[r]+t]=o[r]||o[r-2]||o[0];return i}},wt.test(e)||(x.cssHooks[e+t].set=Ot)});var Wt=/%20/g,$t=/\[\]$/,Bt=/\r?\n/g,It=/^(?:submit|button|image|reset|file)$/i,zt=/^(?:input|select|textarea|keygen)/i;x.fn.extend({serialize:function(){return x.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=x.prop(this,"elements");return e?x.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!x(this).is(":disabled")&&zt.test(this.nodeName)&&!It.test(e)&&(this.checked||!ot.test(e))}).map(function(e,t){var n=x(this).val();return null==n?null:x.isArray(n)?x.map(n,function(e){return{name:t.name,value:e.replace(Bt,"\r\n")}}):{name:t.name,value:n.replace(Bt,"\r\n")}}).get()}}),x.param=function(e,t){var n,r=[],i=function(e,t){t=x.isFunction(t)?t():null==t?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(t===undefined&&(t=x.ajaxSettings&&x.ajaxSettings.traditional),x.isArray(e)||e.jquery&&!x.isPlainObject(e))x.each(e,function(){i(this.name,this.value)});else for(n in e)_t(n,e[n],t,i);return r.join("&").replace(Wt,"+")};function _t(e,t,n,r){var i;if(x.isArray(t))x.each(t,function(t,i){n||$t.test(e)?r(e,i):_t(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==x.type(t))r(e,t);else for(i in t)_t(e+"["+i+"]",t[i],n,r)}x.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){x.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),x.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)
5 },delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var Xt,Ut,Yt=x.now(),Vt=/\?/,Gt=/#.*$/,Jt=/([?&])_=[^&]*/,Qt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Kt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Zt=/^(?:GET|HEAD)$/,en=/^\/\//,tn=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,nn=x.fn.load,rn={},on={},sn="*/".concat("*");try{Ut=i.href}catch(an){Ut=o.createElement("a"),Ut.href="",Ut=Ut.href}Xt=tn.exec(Ut.toLowerCase())||[];function un(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(w)||[];if(x.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function ln(e,t,n,r){var i={},o=e===on;function s(a){var u;return i[a]=!0,x.each(e[a]||[],function(e,a){var l=a(t,n,r);return"string"!=typeof l||o||i[l]?o?!(u=l):undefined:(t.dataTypes.unshift(l),s(l),!1)}),u}return s(t.dataTypes[0])||!i["*"]&&s("*")}function cn(e,t){var n,r,i=x.ajaxSettings.flatOptions||{};for(n in t)t[n]!==undefined&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&x.extend(!0,e,r),e}x.fn.load=function(e,t,n){if("string"!=typeof e&&nn)return nn.apply(this,arguments);var r,i,o,s=this,a=e.indexOf(" ");return a>=0&&(r=e.slice(a),e=e.slice(0,a)),x.isFunction(t)?(n=t,t=undefined):t&&"object"==typeof t&&(i="POST"),s.length>0&&x.ajax({url:e,type:i,dataType:"html",data:t}).done(function(e){o=arguments,s.html(r?x("<div>").append(x.parseHTML(e)).find(r):e)}).complete(n&&function(e,t){s.each(n,o||[e.responseText,t,e])}),this},x.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){x.fn[t]=function(e){return this.on(t,e)}}),x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ut,type:"GET",isLocal:Kt.test(Xt[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":sn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":x.parseJSON,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?cn(cn(e,x.ajaxSettings),t):cn(x.ajaxSettings,e)},ajaxPrefilter:un(rn),ajaxTransport:un(on),ajax:function(e,t){"object"==typeof e&&(t=e,e=undefined),t=t||{};var n,r,i,o,s,a,u,l,c=x.ajaxSetup({},t),p=c.context||c,f=c.context&&(p.nodeType||p.jquery)?x(p):x.event,h=x.Deferred(),d=x.Callbacks("once memory"),g=c.statusCode||{},m={},y={},v=0,b="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(2===v){if(!o){o={};while(t=Qt.exec(i))o[t[1].toLowerCase()]=t[2]}t=o[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===v?i:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return v||(e=y[n]=y[n]||e,m[e]=t),this},overrideMimeType:function(e){return v||(c.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>v)for(t in e)g[t]=[g[t],e[t]];else T.always(e[T.status]);return this},abort:function(e){var t=e||b;return n&&n.abort(t),k(0,t),this}};if(h.promise(T).complete=d.add,T.success=T.done,T.error=T.fail,c.url=((e||c.url||Ut)+"").replace(Gt,"").replace(en,Xt[1]+"//"),c.type=t.method||t.type||c.method||c.type,c.dataTypes=x.trim(c.dataType||"*").toLowerCase().match(w)||[""],null==c.crossDomain&&(a=tn.exec(c.url.toLowerCase()),c.crossDomain=!(!a||a[1]===Xt[1]&&a[2]===Xt[2]&&(a[3]||("http:"===a[1]?"80":"443"))===(Xt[3]||("http:"===Xt[1]?"80":"443")))),c.data&&c.processData&&"string"!=typeof c.data&&(c.data=x.param(c.data,c.traditional)),ln(rn,c,t,T),2===v)return T;u=c.global,u&&0===x.active++&&x.event.trigger("ajaxStart"),c.type=c.type.toUpperCase(),c.hasContent=!Zt.test(c.type),r=c.url,c.hasContent||(c.data&&(r=c.url+=(Vt.test(r)?"&":"?")+c.data,delete c.data),c.cache===!1&&(c.url=Jt.test(r)?r.replace(Jt,"$1_="+Yt++):r+(Vt.test(r)?"&":"?")+"_="+Yt++)),c.ifModified&&(x.lastModified[r]&&T.setRequestHeader("If-Modified-Since",x.lastModified[r]),x.etag[r]&&T.setRequestHeader("If-None-Match",x.etag[r])),(c.data&&c.hasContent&&c.contentType!==!1||t.contentType)&&T.setRequestHeader("Content-Type",c.contentType),T.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+("*"!==c.dataTypes[0]?", "+sn+"; q=0.01":""):c.accepts["*"]);for(l in c.headers)T.setRequestHeader(l,c.headers[l]);if(c.beforeSend&&(c.beforeSend.call(p,T,c)===!1||2===v))return T.abort();b="abort";for(l in{success:1,error:1,complete:1})T[l](c[l]);if(n=ln(on,c,t,T)){T.readyState=1,u&&f.trigger("ajaxSend",[T,c]),c.async&&c.timeout>0&&(s=setTimeout(function(){T.abort("timeout")},c.timeout));try{v=1,n.send(m,k)}catch(C){if(!(2>v))throw C;k(-1,C)}}else k(-1,"No Transport");function k(e,t,o,a){var l,m,y,b,w,C=t;2!==v&&(v=2,s&&clearTimeout(s),n=undefined,i=a||"",T.readyState=e>0?4:0,l=e>=200&&300>e||304===e,o&&(b=pn(c,T,o)),b=fn(c,b,T,l),l?(c.ifModified&&(w=T.getResponseHeader("Last-Modified"),w&&(x.lastModified[r]=w),w=T.getResponseHeader("etag"),w&&(x.etag[r]=w)),204===e||"HEAD"===c.type?C="nocontent":304===e?C="notmodified":(C=b.state,m=b.data,y=b.error,l=!y)):(y=C,(e||!C)&&(C="error",0>e&&(e=0))),T.status=e,T.statusText=(t||C)+"",l?h.resolveWith(p,[m,C,T]):h.rejectWith(p,[T,C,y]),T.statusCode(g),g=undefined,u&&f.trigger(l?"ajaxSuccess":"ajaxError",[T,c,l?m:y]),d.fireWith(p,[T,C]),u&&(f.trigger("ajaxComplete",[T,c]),--x.active||x.event.trigger("ajaxStop")))}return T},getJSON:function(e,t,n){return x.get(e,t,n,"json")},getScript:function(e,t){return x.get(e,undefined,t,"script")}}),x.each(["get","post"],function(e,t){x[t]=function(e,n,r,i){return x.isFunction(n)&&(i=i||r,r=n,n=undefined),x.ajax({url:e,type:t,dataType:i,data:n,success:r})}});function pn(e,t,n){var r,i,o,s,a=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),r===undefined&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in a)if(a[i]&&a[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}s||(s=i)}o=o||s}return o?(o!==u[0]&&u.unshift(o),n[o]):undefined}function fn(e,t,n,r){var i,o,s,a,u,l={},c=e.dataTypes.slice();if(c[1])for(s in e.converters)l[s.toLowerCase()]=e.converters[s];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(s=l[u+" "+o]||l["* "+o],!s)for(i in l)if(a=i.split(" "),a[1]===o&&(s=l[u+" "+a[0]]||l["* "+a[0]])){s===!0?s=l[i]:l[i]!==!0&&(o=a[0],c.unshift(a[1]));break}if(s!==!0)if(s&&e["throws"])t=s(t);else try{t=s(t)}catch(p){return{state:"parsererror",error:s?p:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",function(e){e.cache===undefined&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),x.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(r,i){t=x("<script>").prop({async:!0,charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&i("error"===e.type?404:200,e.type)}),o.head.appendChild(t[0])},abort:function(){n&&n()}}}});var hn=[],dn=/(=)\?(?=&|$)|\?\?/;x.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=hn.pop()||x.expando+"_"+Yt++;return this[e]=!0,e}}),x.ajaxPrefilter("json jsonp",function(t,n,r){var i,o,s,a=t.jsonp!==!1&&(dn.test(t.url)?"url":"string"==typeof t.data&&!(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&dn.test(t.data)&&"data");return a||"jsonp"===t.dataTypes[0]?(i=t.jsonpCallback=x.isFunction(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,a?t[a]=t[a].replace(dn,"$1"+i):t.jsonp!==!1&&(t.url+=(Vt.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){return s||x.error(i+" was not called"),s[0]},t.dataTypes[0]="json",o=e[i],e[i]=function(){s=arguments},r.always(function(){e[i]=o,t[i]&&(t.jsonpCallback=n.jsonpCallback,hn.push(i)),s&&x.isFunction(o)&&o(s[0]),s=o=undefined}),"script"):undefined}),x.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(e){}};var gn=x.ajaxSettings.xhr(),mn={0:200,1223:204},yn=0,vn={};e.ActiveXObject&&x(e).on("unload",function(){for(var e in vn)vn[e]();vn=undefined}),x.support.cors=!!gn&&"withCredentials"in gn,x.support.ajax=gn=!!gn,x.ajaxTransport(function(e){var t;return x.support.cors||gn&&!e.crossDomain?{send:function(n,r){var i,o,s=e.xhr();if(s.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(i in e.xhrFields)s[i]=e.xhrFields[i];e.mimeType&&s.overrideMimeType&&s.overrideMimeType(e.mimeType),e.crossDomain||n["X-Requested-With"]||(n["X-Requested-With"]="XMLHttpRequest");for(i in n)s.setRequestHeader(i,n[i]);t=function(e){return function(){t&&(delete vn[o],t=s.onload=s.onerror=null,"abort"===e?s.abort():"error"===e?r(s.status||404,s.statusText):r(mn[s.status]||s.status,s.statusText,"string"==typeof s.responseText?{text:s.responseText}:undefined,s.getAllResponseHeaders()))}},s.onload=t(),s.onerror=t("error"),t=vn[o=yn++]=t("abort"),s.send(e.hasContent&&e.data||null)},abort:function(){t&&t()}}:undefined});var xn,bn,wn=/^(?:toggle|show|hide)$/,Tn=RegExp("^(?:([+-])=|)("+b+")([a-z%]*)$","i"),Cn=/queueHooks$/,kn=[An],Nn={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Tn.exec(t),o=i&&i[3]||(x.cssNumber[e]?"":"px"),s=(x.cssNumber[e]||"px"!==o&&+r)&&Tn.exec(x.css(n.elem,e)),a=1,u=20;if(s&&s[3]!==o){o=o||s[3],i=i||[],s=+r||1;do a=a||".5",s/=a,x.style(n.elem,e,s+o);while(a!==(a=n.cur()/r)&&1!==a&&--u)}return i&&(s=n.start=+s||+r||0,n.unit=o,n.end=i[1]?s+(i[1]+1)*i[2]:+i[2]),n}]};function En(){return setTimeout(function(){xn=undefined}),xn=x.now()}function Sn(e,t,n){var r,i=(Nn[t]||[]).concat(Nn["*"]),o=0,s=i.length;for(;s>o;o++)if(r=i[o].call(n,t,e))return r}function jn(e,t,n){var r,i,o=0,s=kn.length,a=x.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;var t=xn||En(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,s=0,u=l.tweens.length;for(;u>s;s++)l.tweens[s].run(o);return a.notifyWith(e,[l,o,n]),1>o&&u?n:(a.resolveWith(e,[l]),!1)},l=a.promise({elem:e,props:x.extend({},t),opts:x.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:xn||En(),duration:n.duration,tweens:[],createTween:function(t,n){var r=x.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)l.tweens[n].run(1);return t?a.resolveWith(e,[l,t]):a.rejectWith(e,[l,t]),this}}),c=l.props;for(Dn(c,l.opts.specialEasing);s>o;o++)if(r=kn[o].call(l,e,c,l.opts))return r;return x.map(c,Sn,l),x.isFunction(l.opts.start)&&l.opts.start.call(e,l),x.fx.timer(x.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function Dn(e,t){var n,r,i,o,s;for(n in e)if(r=x.camelCase(n),i=t[r],o=e[n],x.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),s=x.cssHooks[r],s&&"expand"in s){o=s.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}x.Animation=x.extend(jn,{tweener:function(e,t){x.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Nn[n]=Nn[n]||[],Nn[n].unshift(t)},prefilter:function(e,t){t?kn.unshift(e):kn.push(e)}});function An(e,t,n){var r,i,o,s,a,u,l=this,c={},p=e.style,f=e.nodeType&&Lt(e),h=q.get(e,"fxshow");n.queue||(a=x._queueHooks(e,"fx"),null==a.unqueued&&(a.unqueued=0,u=a.empty.fire,a.empty.fire=function(){a.unqueued||u()}),a.unqueued++,l.always(function(){l.always(function(){a.unqueued--,x.queue(e,"fx").length||a.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===x.css(e,"display")&&"none"===x.css(e,"float")&&(p.display="inline-block")),n.overflow&&(p.overflow="hidden",l.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],wn.exec(i)){if(delete t[r],o=o||"toggle"===i,i===(f?"hide":"show")){if("show"!==i||!h||h[r]===undefined)continue;f=!0}c[r]=h&&h[r]||x.style(e,r)}if(!x.isEmptyObject(c)){h?"hidden"in h&&(f=h.hidden):h=q.access(e,"fxshow",{}),o&&(h.hidden=!f),f?x(e).show():l.done(function(){x(e).hide()}),l.done(function(){var t;q.remove(e,"fxshow");for(t in c)x.style(e,t,c[t])});for(r in c)s=Sn(f?h[r]:0,r,l),r in h||(h[r]=s.start,f&&(s.end=s.start,s.start="width"===r||"height"===r?1:0))}}function Ln(e,t,n,r,i){return new Ln.prototype.init(e,t,n,r,i)}x.Tween=Ln,Ln.prototype={constructor:Ln,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(x.cssNumber[n]?"":"px")},cur:function(){var e=Ln.propHooks[this.prop];return e&&e.get?e.get(this):Ln.propHooks._default.get(this)},run:function(e){var t,n=Ln.propHooks[this.prop];return this.pos=t=this.options.duration?x.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Ln.propHooks._default.set(this),this}},Ln.prototype.init.prototype=Ln.prototype,Ln.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=x.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[x.cssProps[e.prop]]||x.cssHooks[e.prop])?x.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Ln.propHooks.scrollTop=Ln.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},x.each(["toggle","show","hide"],function(e,t){var n=x.fn[t];x.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(qn(t,!0),e,r,i)}}),x.fn.extend({fadeTo:function(e,t,n,r){return this.filter(Lt).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=x.isEmptyObject(e),o=x.speed(t,n,r),s=function(){var t=jn(this,x.extend({},e),o);(i||q.get(this,"finish"))&&t.stop(!0)};return s.finish=s,i||o.queue===!1?this.each(s):this.queue(o.queue,s)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=undefined),t&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=null!=e&&e+"queueHooks",o=x.timers,s=q.get(this);if(i)s[i]&&s[i].stop&&r(s[i]);else for(i in s)s[i]&&s[i].stop&&Cn.test(i)&&r(s[i]);for(i=o.length;i--;)o[i].elem!==this||null!=e&&o[i].queue!==e||(o[i].anim.stop(n),t=!1,o.splice(i,1));(t||!n)&&x.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=q.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=x.timers,s=r?r.length:0;for(n.finish=!0,x.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;s>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function qn(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=jt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}x.each({slideDown:qn("show"),slideUp:qn("hide"),slideToggle:qn("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){x.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),x.speed=function(e,t,n){var r=e&&"object"==typeof e?x.extend({},e):{complete:n||!n&&t||x.isFunction(e)&&e,duration:e,easing:n&&t||t&&!x.isFunction(t)&&t};return r.duration=x.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in x.fx.speeds?x.fx.speeds[r.duration]:x.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){x.isFunction(r.old)&&r.old.call(this),r.queue&&x.dequeue(this,r.queue)},r},x.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},x.timers=[],x.fx=Ln.prototype.init,x.fx.tick=function(){var e,t=x.timers,n=0;for(xn=x.now();t.length>n;n++)e=t[n],e()||t[n]!==e||t.splice(n--,1);t.length||x.fx.stop(),xn=undefined},x.fx.timer=function(e){e()&&x.timers.push(e)&&x.fx.start()},x.fx.interval=13,x.fx.start=function(){bn||(bn=setInterval(x.fx.tick,x.fx.interval))},x.fx.stop=function(){clearInterval(bn),bn=null},x.fx.speeds={slow:600,fast:200,_default:400},x.fx.step={},x.expr&&x.expr.filters&&(x.expr.filters.animated=function(e){return x.grep(x.timers,function(t){return e===t.elem}).length}),x.fn.offset=function(e){if(arguments.length)return e===undefined?this:this.each(function(t){x.offset.setOffset(this,e,t)});var t,n,i=this[0],o={top:0,left:0},s=i&&i.ownerDocument;if(s)return t=s.documentElement,x.contains(t,i)?(typeof i.getBoundingClientRect!==r&&(o=i.getBoundingClientRect()),n=Hn(s),{top:o.top+n.pageYOffset-t.clientTop,left:o.left+n.pageXOffset-t.clientLeft}):o},x.offset={setOffset:function(e,t,n){var r,i,o,s,a,u,l,c=x.css(e,"position"),p=x(e),f={};"static"===c&&(e.style.position="relative"),a=p.offset(),o=x.css(e,"top"),u=x.css(e,"left"),l=("absolute"===c||"fixed"===c)&&(o+u).indexOf("auto")>-1,l?(r=p.position(),s=r.top,i=r.left):(s=parseFloat(o)||0,i=parseFloat(u)||0),x.isFunction(t)&&(t=t.call(e,n,a)),null!=t.top&&(f.top=t.top-a.top+s),null!=t.left&&(f.left=t.left-a.left+i),"using"in t?t.using.call(e,f):p.css(f)}},x.fn.extend({position:function(){if(this[0]){var e,t,n=this[0],r={top:0,left:0};return"fixed"===x.css(n,"position")?t=n.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),x.nodeName(e[0],"html")||(r=e.offset()),r.top+=x.css(e[0],"borderTopWidth",!0),r.left+=x.css(e[0],"borderLeftWidth",!0)),{top:t.top-r.top-x.css(n,"marginTop",!0),left:t.left-r.left-x.css(n,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||s;while(e&&!x.nodeName(e,"html")&&"static"===x.css(e,"position"))e=e.offsetParent;return e||s})}}),x.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,n){var r="pageYOffset"===n;x.fn[t]=function(i){return x.access(this,function(t,i,o){var s=Hn(t);return o===undefined?s?s[n]:t[i]:(s?s.scrollTo(r?e.pageXOffset:o,r?o:e.pageYOffset):t[i]=o,undefined)},t,i,arguments.length,null)}});function Hn(e){return x.isWindow(e)?e:9===e.nodeType&&e.defaultView}x.each({Height:"height",Width:"width"},function(e,t){x.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){x.fn[r]=function(r,i){var o=arguments.length&&(n||"boolean"!=typeof r),s=n||(r===!0||i===!0?"margin":"border");return x.access(this,function(t,n,r){var i;return x.isWindow(t)?t.document.documentElement["client"+e]:9===t.nodeType?(i=t.documentElement,Math.max(t.body["scroll"+e],i["scroll"+e],t.body["offset"+e],i["offset"+e],i["client"+e])):r===undefined?x.css(t,n,s):x.style(t,n,r,s)},t,o?r:undefined,o,null)}})}),x.fn.size=function(){return this.length},x.fn.andSelf=x.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=x:"function"==typeof define&&define.amd&&define("jquery",[],function(){return x}),"object"==typeof e&&"object"==typeof e.document&&(e.jQuery=e.$=x)})(window);
00 <html lang="en">
11 <head>
22 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
3 <script src="/jquery-2.0.3.min.js"></script>
3 <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
44 <script src="/js/pengines.js"></script>
55 <script type="text/x-prolog">
66
33 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
44 <title>Eight Queens Demo</title>
55 <meta name="author" content="Torbjörn Lager and Jan Wielmaker">
6 <script type="text/javascript" src="/jquery-2.0.3.min.js"></script>
6 <script type="text/javascript" src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
77 <script type="text/javascript" src="/js/pengines.js"></script>
88 <script type="text/x-prolog">
99
00 <html lang="en">
11 <head>
2 <script src="/jquery-2.0.3.min.js"></script>
2 <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
33 <script src="/js/pengines.js"></script>
44 <script type="text/x-prolog">
55
0 JQUERY=http://code.jquery.com/jquery-1.11.3.min.js
1
2 sed -i -e 's@src="[^"]*jquery[^"]*"@src="'$JQUERY'"@' *.html
126126
127127 main :-
128128 pengine_create([
129 server('http://pengines.org'),
129 server('http://pengines.swi-prolog.org'),
130130 src_text("
131131 q(X) :- p(X).
132132 p(a). p(b). p(c).
136136
137137
138138 handle(create(ID, _)) :-
139 pengine_ask(ID, q(X), []).
140 handle(success(ID, [X], false)) :-
139 pengine_ask(ID, q(_X), []).
140 handle(success(_ID, [X], false)) :-
141141 writeln(X).
142142 handle(success(ID, [X], true)) :-
143143 writeln(X),
350350
351351 main :-
352352 pengine_create([
353 server('http://pengines.org'),
353 server('http://pengines.swi-prolog.org'),
354354 src_text("
355355 q(X) :- p(X).
356356 p(a). p(b). p(c).
360360
361361
362362 handle(create(ID, _)) :-
363 pengine_ask(ID, q(X), []).
364 handle(success(ID, [X], false)) :-
363 pengine_ask(ID, q(_X), []).
364 handle(success(_ID, [X], false)) :-
365365 writeln(X).
366366 handle(success(ID, [X], true)) :-
367367 writeln(X),
805805 succeeds.</dd>
806806 <dt class="pubdef"><span class="pred-tag">[det]</span><a name="pengine_application/1"><strong>pengine_application</strong>(<var>+Application</var>)</a></dt>
807807 <dd class="defbody">
808 Directive that must be used to declarate a pengine application module.
809 The module may not be associated to any file. The default application is <code>pengine_sandbox</code>.
808 Directive that must be used to declare a pengine application module. The
809 module may not be associated to any file. The default application is <code>pengine_sandbox</code>.
810810 The example below creates a new application <code>address_book</code>
811811 and imports the API defined in the module file <code>adress_book_api.pl</code>
812812 into the application.
11591159 treated in a special way. Also, JSON terms are not converted. Mapping:
11601160
11611161 <p>
1162 <ul class="compact">
1162 <ul class="latex">
11631163 <li>Variable: <code>{"type":"var", "name":&lt;string&gt;}</code>
11641164 <li>Atom: <code>{"type":"atom", "value":&lt;string&gt;}</code>
11651165 <li>Integer: <code>{"type":"integer", "value":&lt;integer&gt;}</code>
11661166 <li>Float: <code>{"type":"float", "value":&lt;float&gt;}</code>
11671167 <li>List: JSON array
1168 <li>Dict: a JSON object. Values are processed recursively. (the tag is
1169 ignored)
1170 <li><code>json([Key=Value, ...])</code>: a JSON object Values are
1171 processed recursively.
11681172 <li>compound: <code>{"type":"compound", "functor":&lt;string&gt;, "args":&lt;array&gt;}</code>
11691173 </ul>
11701174 <table class="arglist">
633633
634634 /** pengine_application(+Application) is det.
635635
636 Directive that must be used to declarate a pengine application
636 Directive that must be used to declare a pengine application
637637 module. The module may not be associated to any file. The default
638638 application is =pengine_sandbox=. The example below creates a new
639639 application =address_book= and imports the API defined in the module
6060 :- use_module(library(sandbox)).
6161 :- use_module(library(http/html_write)).
6262 :- use_module(library(http/term_html)).
63 :- if(exists_source(library(prolog_stream))).
64 :- use_module(library(prolog_stream)).
65 :- endif.
6366 :- html_meta send_html(html).
6467
6568 :- meta_predicate
197200 %% pengine_listing(+Spec)
198201 %
199202 % List the content of the current pengine or a specified predicate
200 % in the pengine. Does not allow for listing outside the pengine
201 % module.
203 % in the pengine.
202204
203205 pengine_listing :-
204206 pengine_listing(_).
205207
206208 pengine_listing(Spec) :-
207 ( nonvar(Spec),
208 Spec = M:_
209 -> permission_error(listing, module, M)
210 ; true
211 ),
212209 pengine_self(Module),
213210 with_output_to(string(String), listing(Module:Spec)),
214 send_html(pre(class(listing), String)).
211 split_string(String, "", "\n", [Pre]),
212 send_html(pre(class(listing), Pre)).
215213
216214 pengine_portray_clause(Term) :-
217215 with_output_to(string(String), portray_clause(Term)),
218 send_html(pre(class(listing), String)).
216 split_string(String, "", "\n", [Pre]),
217 send_html(pre(class(listing), Pre)).
219218
220219
221220 /*******************************
549548
550549 pengine_io_goal_expansion(_, _).
551550
551
552 /*******************************
553 * REBIND PENGINE I/O *
554 *******************************/
555
556 :- if(current_predicate(open_prolog_stream/4)).
557 :- public
558 stream_write/2,
559 stream_read/2,
560 stream_close/1.
561
562 stream_write(_Stream, Out) :-
563 send_html(pre(class(console), Out)).
564 stream_read(_Stream, Data) :-
565 prompt(Prompt, Prompt),
566 pengine_input(_{type:console, prompt:Prompt}, Data).
567 stream_close(_Stream).
568
569 %% pengine_bind_user_streams
570 %
571 % Bind the pengine user I/O streams to a Prolog stream that
572 % redirects the input and output to pengine_input/2 and
573 % pengine_output/1. This results in less pretty behaviour then
574 % redefining the I/O predicates to produce nice HTML, but does
575 % provide functioning I/O from included libraries.
576
577 pengine_bind_user_streams :-
578 Err = Out,
579 open_prolog_stream(pengines_io, write, Out, []),
580 set_stream(Out, buffer(line)),
581 open_prolog_stream(pengines_io, read, In, []),
582 set_stream(In, alias(user_input)),
583 set_stream(Out, alias(user_output)),
584 set_stream(Err, alias(user_error)),
585 set_stream(In, alias(current_input)),
586 set_stream(Out, alias(current_output)),
587 thread_at_exit(close_io(In, Out)).
588
589 close_io(In, Out) :-
590 close(In, [force(true)]),
591 close(Out, [force(true)]).
592 :- else.
593
594 pengine_bind_user_streams.
595
596 :- endif.
597
598
552599 %% pengine_bind_io_to_html(+Module)
553600 %
554601 % Redefine the built-in predicates for IO to send HTML messages
556603
557604 pengine_bind_io_to_html(Module) :-
558605 forall(pengine_io_predicate(Head),
559 bind_io(Head, Module)).
606 bind_io(Head, Module)),
607 pengine_bind_user_streams.
560608
561609 bind_io(Head, Module) :-
562610 prompt(_, ''),
11
22 Author: Torbjörn Lager and Jan Wielemaker
33 WWW: http://www.swi-prolog.org
4 Copyright (C): 2014, Torbjörn Lager,
5 VU University Amsterdam
4 Copyright (C): 2014-2015, Torbjörn Lager,
5 VU University Amsterdam
66
77 This program is free software; you can redistribute it and/or
88 modify it under the terms of the GNU General Public License
3131 term_to_json/2 % +Term, -Json
3232 ]).
3333 :- use_module(library(apply)).
34 :- use_module(library(error)).
3435
3536 %% term_to_json(+Term, +Bindings, -JsonTerm) is det.
3637 %% term_to_json(+Term, -JsonTerm) is det.
4445 % * Integer: =|{"type":"integer", "value":<integer>}|=
4546 % * Float: =|{"type":"float", "value":<float>}|=
4647 % * List: JSON array
48 % * Dict: a JSON object. Values are processed recursively.
49 % (the tag is ignored)
50 % * json([Key=Value, ...]): a JSON object Values are processed
51 % recursively.
4752 % * compound: =|{"type":"compound", "functor":<string>, "args":<array>}|=
4853 %
4954 % @param Bindings is a list of Name=Var terms for variables that
7277 json_symbol(Symbol), !.
7378 to_json(Term, Term) :-
7479 atom(Term), !. % interpreted as a string
80 to_json(Term, Term) :-
81 string(Term), !.
7582 to_json(Term, Value) :-
7683 integer(Term), !,
7784 ( Term >= -(2**31), Term < 2**31
8390 to_json(Term, JsonList) :-
8491 is_list(Term), !,
8592 maplist(to_json, Term, JsonList).
93 to_json(json(Pairs0), Term) :-
94 must_be(list, Pairs0),
95 maplist(pair_value_to_json_ex, Pairs0, Pairs),
96 dict_pairs(Term, json, Pairs).
8697 to_json(Term0, Term) :-
8798 is_dict(Term0), !,
8899 dict_pairs(Term0, Tag, Pairs0),
100111
101112 pair_value_to_json(Key-Value0, Key-Value) :-
102113 to_json(Value0, Value).
114
115 pair_value_to_json_ex(Key=Value0, Key-Value) :-
116 (atom(Key) ; integer(Key)), !,
117 to_json(Value0, Value).
118 pair_value_to_json_ex(Elem, _) :-
119 domain_error(json_key_value, Elem).
120
5555 :- use_module(library(http/http_files)).
5656 :- use_module(library(http/http_dispatch)).
5757 :- use_module(library(http/json)).
58 :- use_module(library(http/jquery)).
5859
5960 :- pengine_application(swish).
6061 :- use_module(swish:library(pengines_io)).
+0
-6
packages/pengines/web/jquery-2.0.3.min.js less more
0 /*! jQuery v2.0.3 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
1 //@ sourceMappingURL=jquery-2.0.3.min.map
2 */
3 (function(e,undefined){var t,n,r=typeof undefined,i=e.location,o=e.document,s=o.documentElement,a=e.jQuery,u=e.$,l={},c=[],p="2.0.3",f=c.concat,h=c.push,d=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,x=function(e,n){return new x.fn.init(e,n,t)},b=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^-ms-/,N=/-([\da-z])/gi,E=function(e,t){return t.toUpperCase()},S=function(){o.removeEventListener("DOMContentLoaded",S,!1),e.removeEventListener("load",S,!1),x.ready()};x.fn=x.prototype={jquery:p,constructor:x,init:function(e,t,n){var r,i;if(!e)return this;if("string"==typeof e){if(r="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:T.exec(e),!r||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof x?t[0]:t,x.merge(this,x.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:o,!0)),C.test(r[1])&&x.isPlainObject(t))for(r in t)x.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return i=o.getElementById(r[2]),i&&i.parentNode&&(this.length=1,this[0]=i),this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?n.ready(e):(e.selector!==undefined&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return d.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,t,n,r,i,o,s=arguments[0]||{},a=1,u=arguments.length,l=!1;for("boolean"==typeof s&&(l=s,s=arguments[1]||{},a=2),"object"==typeof s||x.isFunction(s)||(s={}),u===a&&(s=this,--a);u>a;a++)if(null!=(e=arguments[a]))for(t in e)n=s[t],r=e[t],s!==r&&(l&&r&&(x.isPlainObject(r)||(i=x.isArray(r)))?(i?(i=!1,o=n&&x.isArray(n)?n:[]):o=n&&x.isPlainObject(n)?n:{},s[t]=x.extend(l,o,r)):r!==undefined&&(s[t]=r));return s},x.extend({expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=a),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){(e===!0?--x.readyWait:x.isReady)||(x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(o,[x]),x.fn.trigger&&x(o).trigger("ready").off("ready")))},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray,isWindow:function(e){return null!=e&&e===e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if("object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(t){return!1}return!0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:JSON.parse,parseXML:function(e){var t,n;if(!e||"string"!=typeof e)return null;try{n=new DOMParser,t=n.parseFromString(e,"text/xml")}catch(r){t=undefined}return(!t||t.getElementsByTagName("parsererror").length)&&x.error("Invalid XML: "+e),t},noop:function(){},globalEval:function(e){var t,n=eval;e=x.trim(e),e&&(1===e.indexOf("use strict")?(t=o.createElement("script"),t.text=e,o.head.appendChild(t).parentNode.removeChild(t)):n(e))},camelCase:function(e){return e.replace(k,"ms-").replace(N,E)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,s=j(e);if(n){if(s){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(s){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:function(e){return null==e?"":v.call(e)},makeArray:function(e,t){var n=t||[];return null!=e&&(j(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:g.call(t,e,n)},merge:function(e,t){var n=t.length,r=e.length,i=0;if("number"==typeof n)for(;n>i;i++)e[r++]=t[i];else while(t[i]!==undefined)e[r++]=t[i++];return e.length=r,e},grep:function(e,t,n){var r,i=[],o=0,s=e.length;for(n=!!n;s>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,s=j(e),a=[];if(s)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(a[a.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(a[a.length]=r);return f.apply([],a)},guid:1,proxy:function(e,t){var n,r,i;return"string"==typeof t&&(n=e[t],t=e,e=n),x.isFunction(e)?(r=d.call(arguments,2),i=function(){return e.apply(t||this,r.concat(d.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):undefined},access:function(e,t,n,r,i,o,s){var a=0,u=e.length,l=null==n;if("object"===x.type(n)){i=!0;for(a in n)x.access(e,t,a,n[a],!0,o,s)}else if(r!==undefined&&(i=!0,x.isFunction(r)||(s=!0),l&&(s?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(x(e),n)})),t))for(;u>a;a++)t(e[a],n,s?r:r.call(e[a],a,t(e[a],n)));return i?e:l?t.call(e):u?t(e[0],n):o},now:Date.now,swap:function(e,t,n,r){var i,o,s={};for(o in t)s[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=s[o];return i}}),x.ready.promise=function(t){return n||(n=x.Deferred(),"complete"===o.readyState?setTimeout(x.ready):(o.addEventListener("DOMContentLoaded",S,!1),e.addEventListener("load",S,!1))),n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function j(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}t=x(o),function(e,undefined){var t,n,r,i,o,s,a,u,l,c,p,f,h,d,g,m,y,v="sizzle"+-new Date,b=e.document,w=0,T=0,C=st(),k=st(),N=st(),E=!1,S=function(e,t){return e===t?(E=!0,0):0},j=typeof undefined,D=1<<31,A={}.hasOwnProperty,L=[],q=L.pop,H=L.push,O=L.push,F=L.slice,P=L.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},R="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",W="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",$=W.replace("w","w#"),B="\\["+M+"*("+W+")"+M+"*(?:([*^$|!~]?=)"+M+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+$+")|)|)"+M+"*\\]",I=":("+W+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+B.replace(3,8)+")*)|.*)\\)|)",z=RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),_=RegExp("^"+M+"*,"+M+"*"),X=RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=RegExp(M+"*[+~]"),Y=RegExp("="+M+"*([^\\]'\"]*)"+M+"*\\]","g"),V=RegExp(I),G=RegExp("^"+$+"$"),J={ID:RegExp("^#("+W+")"),CLASS:RegExp("^\\.("+W+")"),TAG:RegExp("^("+W.replace("w","w*")+")"),ATTR:RegExp("^"+B),PSEUDO:RegExp("^"+I),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:RegExp("^(?:"+R+")$","i"),needsContext:RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Q=/^[^{]+\{\s*\[native \w/,K=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,Z=/^(?:input|select|textarea|button)$/i,et=/^h\d$/i,tt=/'|\\/g,nt=RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),rt=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{O.apply(L=F.call(b.childNodes),b.childNodes),L[b.childNodes.length].nodeType}catch(it){O={apply:L.length?function(e,t){H.apply(e,F.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function ot(e,t,r,i){var o,s,a,u,l,f,g,m,x,w;if((t?t.ownerDocument||t:b)!==p&&c(t),t=t||p,r=r||[],!e||"string"!=typeof e)return r;if(1!==(u=t.nodeType)&&9!==u)return[];if(h&&!i){if(o=K.exec(e))if(a=o[1]){if(9===u){if(s=t.getElementById(a),!s||!s.parentNode)return r;if(s.id===a)return r.push(s),r}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(a))&&y(t,s)&&s.id===a)return r.push(s),r}else{if(o[2])return O.apply(r,t.getElementsByTagName(e)),r;if((a=o[3])&&n.getElementsByClassName&&t.getElementsByClassName)return O.apply(r,t.getElementsByClassName(a)),r}if(n.qsa&&(!d||!d.test(e))){if(m=g=v,x=t,w=9===u&&e,1===u&&"object"!==t.nodeName.toLowerCase()){f=gt(e),(g=t.getAttribute("id"))?m=g.replace(tt,"\\$&"):t.setAttribute("id",m),m="[id='"+m+"'] ",l=f.length;while(l--)f[l]=m+mt(f[l]);x=U.test(e)&&t.parentNode||t,w=f.join(",")}if(w)try{return O.apply(r,x.querySelectorAll(w)),r}catch(T){}finally{g||t.removeAttribute("id")}}}return kt(e.replace(z,"$1"),t,r,i)}function st(){var e=[];function t(n,r){return e.push(n+=" ")>i.cacheLength&&delete t[e.shift()],t[n]=r}return t}function at(e){return e[v]=!0,e}function ut(e){var t=p.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function lt(e,t){var n=e.split("|"),r=e.length;while(r--)i.attrHandle[n[r]]=t}function ct(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function pt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function ft(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ht(e){return at(function(t){return t=+t,at(function(n,r){var i,o=e([],n.length,t),s=o.length;while(s--)n[i=o[s]]&&(n[i]=!(r[i]=n[i]))})})}s=ot.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},n=ot.support={},c=ot.setDocument=function(e){var t=e?e.ownerDocument||e:b,r=t.defaultView;return t!==p&&9===t.nodeType&&t.documentElement?(p=t,f=t.documentElement,h=!s(t),r&&r.attachEvent&&r!==r.top&&r.attachEvent("onbeforeunload",function(){c()}),n.attributes=ut(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=ut(function(e){return e.appendChild(t.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=ut(function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),n.getById=ut(function(e){return f.appendChild(e).id=v,!t.getElementsByName||!t.getElementsByName(v).length}),n.getById?(i.find.ID=function(e,t){if(typeof t.getElementById!==j&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},i.filter.ID=function(e){var t=e.replace(nt,rt);return function(e){return e.getAttribute("id")===t}}):(delete i.find.ID,i.filter.ID=function(e){var t=e.replace(nt,rt);return function(e){var n=typeof e.getAttributeNode!==j&&e.getAttributeNode("id");return n&&n.value===t}}),i.find.TAG=n.getElementsByTagName?function(e,t){return typeof t.getElementsByTagName!==j?t.getElementsByTagName(e):undefined}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},i.find.CLASS=n.getElementsByClassName&&function(e,t){return typeof t.getElementsByClassName!==j&&h?t.getElementsByClassName(e):undefined},g=[],d=[],(n.qsa=Q.test(t.querySelectorAll))&&(ut(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||d.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll(":checked").length||d.push(":checked")}),ut(function(e){var n=t.createElement("input");n.setAttribute("type","hidden"),e.appendChild(n).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&d.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||d.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),d.push(",.*:")})),(n.matchesSelector=Q.test(m=f.webkitMatchesSelector||f.mozMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&ut(function(e){n.disconnectedMatch=m.call(e,"div"),m.call(e,"[s!='']:x"),g.push("!=",I)}),d=d.length&&RegExp(d.join("|")),g=g.length&&RegExp(g.join("|")),y=Q.test(f.contains)||f.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},S=f.compareDocumentPosition?function(e,r){if(e===r)return E=!0,0;var i=r.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(r);return i?1&i||!n.sortDetached&&r.compareDocumentPosition(e)===i?e===t||y(b,e)?-1:r===t||y(b,r)?1:l?P.call(l,e)-P.call(l,r):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,n){var r,i=0,o=e.parentNode,s=n.parentNode,a=[e],u=[n];if(e===n)return E=!0,0;if(!o||!s)return e===t?-1:n===t?1:o?-1:s?1:l?P.call(l,e)-P.call(l,n):0;if(o===s)return ct(e,n);r=e;while(r=r.parentNode)a.unshift(r);r=n;while(r=r.parentNode)u.unshift(r);while(a[i]===u[i])i++;return i?ct(a[i],u[i]):a[i]===b?-1:u[i]===b?1:0},t):p},ot.matches=function(e,t){return ot(e,null,null,t)},ot.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&c(e),t=t.replace(Y,"='$1']"),!(!n.matchesSelector||!h||g&&g.test(t)||d&&d.test(t)))try{var r=m.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(i){}return ot(t,p,null,[e]).length>0},ot.contains=function(e,t){return(e.ownerDocument||e)!==p&&c(e),y(e,t)},ot.attr=function(e,t){(e.ownerDocument||e)!==p&&c(e);var r=i.attrHandle[t.toLowerCase()],o=r&&A.call(i.attrHandle,t.toLowerCase())?r(e,t,!h):undefined;return o===undefined?n.attributes||!h?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null:o},ot.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},ot.uniqueSort=function(e){var t,r=[],i=0,o=0;if(E=!n.detectDuplicates,l=!n.sortStable&&e.slice(0),e.sort(S),E){while(t=e[o++])t===e[o]&&(i=r.push(o));while(i--)e.splice(r[i],1)}return e},o=ot.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=o(t);return n},i=ot.selectors={cacheLength:50,createPseudo:at,match:J,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(nt,rt),e[3]=(e[4]||e[5]||"").replace(nt,rt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||ot.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&ot.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return J.CHILD.test(e[0])?null:(e[3]&&e[4]!==undefined?e[2]=e[4]:n&&V.test(n)&&(t=gt(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(nt,rt).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=C[e+" "];return t||(t=RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&C(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=ot.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),s="last"!==e.slice(-4),a="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,p,f,h,d,g=o!==s?"nextSibling":"previousSibling",m=t.parentNode,y=a&&t.nodeName.toLowerCase(),x=!u&&!a;if(m){if(o){while(g){p=t;while(p=p[g])if(a?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;d=g="only"===e&&!d&&"nextSibling"}return!0}if(d=[s?m.firstChild:m.lastChild],s&&x){c=m[v]||(m[v]={}),l=c[e]||[],h=l[0]===w&&l[1],f=l[0]===w&&l[2],p=h&&m.childNodes[h];while(p=++h&&p&&p[g]||(f=h=0)||d.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[w,h,f];break}}else if(x&&(l=(t[v]||(t[v]={}))[e])&&l[0]===w)f=l[1];else while(p=++h&&p&&p[g]||(f=h=0)||d.pop())if((a?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(x&&((p[v]||(p[v]={}))[e]=[w,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||ot.error("unsupported pseudo: "+e);return r[v]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?at(function(e,n){var i,o=r(e,t),s=o.length;while(s--)i=P.call(e,o[s]),e[i]=!(n[i]=o[s])}):function(e){return r(e,0,n)}):r}},pseudos:{not:at(function(e){var t=[],n=[],r=a(e.replace(z,"$1"));return r[v]?at(function(e,t,n,i){var o,s=r(e,null,i,[]),a=e.length;while(a--)(o=s[a])&&(e[a]=!(t[a]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:at(function(e){return function(t){return ot(e,t).length>0}}),contains:at(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),lang:at(function(e){return G.test(e||"")||ot.error("unsupported lang: "+e),e=e.replace(nt,rt).toLowerCase(),function(t){var n;do if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===f},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!i.pseudos.empty(e)},header:function(e){return et.test(e.nodeName)},input:function(e){return Z.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:ht(function(){return[0]}),last:ht(function(e,t){return[t-1]}),eq:ht(function(e,t,n){return[0>n?n+t:n]}),even:ht(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:ht(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:ht(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:ht(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}},i.pseudos.nth=i.pseudos.eq;for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})i.pseudos[t]=pt(t);for(t in{submit:!0,reset:!0})i.pseudos[t]=ft(t);function dt(){}dt.prototype=i.filters=i.pseudos,i.setFilters=new dt;function gt(e,t){var n,r,o,s,a,u,l,c=k[e+" "];if(c)return t?0:c.slice(0);a=e,u=[],l=i.preFilter;while(a){(!n||(r=_.exec(a)))&&(r&&(a=a.slice(r[0].length)||a),u.push(o=[])),n=!1,(r=X.exec(a))&&(n=r.shift(),o.push({value:n,type:r[0].replace(z," ")}),a=a.slice(n.length));for(s in i.filter)!(r=J[s].exec(a))||l[s]&&!(r=l[s](r))||(n=r.shift(),o.push({value:n,type:s,matches:r}),a=a.slice(n.length));if(!n)break}return t?a.length:a?ot.error(e):k(e,u).slice(0)}function mt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function yt(e,t,n){var i=t.dir,o=n&&"parentNode"===i,s=T++;return t.first?function(t,n,r){while(t=t[i])if(1===t.nodeType||o)return e(t,n,r)}:function(t,n,a){var u,l,c,p=w+" "+s;if(a){while(t=t[i])if((1===t.nodeType||o)&&e(t,n,a))return!0}else while(t=t[i])if(1===t.nodeType||o)if(c=t[v]||(t[v]={}),(l=c[i])&&l[0]===p){if((u=l[1])===!0||u===r)return u===!0}else if(l=c[i]=[p],l[1]=e(t,n,a)||r,l[1]===!0)return!0}}function vt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xt(e,t,n,r,i){var o,s=[],a=0,u=e.length,l=null!=t;for(;u>a;a++)(o=e[a])&&(!n||n(o,r,i))&&(s.push(o),l&&t.push(a));return s}function bt(e,t,n,r,i,o){return r&&!r[v]&&(r=bt(r)),i&&!i[v]&&(i=bt(i,o)),at(function(o,s,a,u){var l,c,p,f=[],h=[],d=s.length,g=o||Ct(t||"*",a.nodeType?[a]:a,[]),m=!e||!o&&t?g:xt(g,f,e,a,u),y=n?i||(o?e:d||r)?[]:s:m;if(n&&n(m,y,a,u),r){l=xt(y,h),r(l,[],a,u),c=l.length;while(c--)(p=l[c])&&(y[h[c]]=!(m[h[c]]=p))}if(o){if(i||e){if(i){l=[],c=y.length;while(c--)(p=y[c])&&l.push(m[c]=p);i(null,y=[],l,u)}c=y.length;while(c--)(p=y[c])&&(l=i?P.call(o,p):f[c])>-1&&(o[l]=!(s[l]=p))}}else y=xt(y===s?y.splice(d,y.length):y),i?i(null,s,y,u):O.apply(s,y)})}function wt(e){var t,n,r,o=e.length,s=i.relative[e[0].type],a=s||i.relative[" "],l=s?1:0,c=yt(function(e){return e===t},a,!0),p=yt(function(e){return P.call(t,e)>-1},a,!0),f=[function(e,n,r){return!s&&(r||n!==u)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;o>l;l++)if(n=i.relative[e[l].type])f=[yt(vt(f),n)];else{if(n=i.filter[e[l].type].apply(null,e[l].matches),n[v]){for(r=++l;o>r;r++)if(i.relative[e[r].type])break;return bt(l>1&&vt(f),l>1&&mt(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(z,"$1"),n,r>l&&wt(e.slice(l,r)),o>r&&wt(e=e.slice(r)),o>r&&mt(e))}f.push(n)}return vt(f)}function Tt(e,t){var n=0,o=t.length>0,s=e.length>0,a=function(a,l,c,f,h){var d,g,m,y=[],v=0,x="0",b=a&&[],T=null!=h,C=u,k=a||s&&i.find.TAG("*",h&&l.parentNode||l),N=w+=null==C?1:Math.random()||.1;for(T&&(u=l!==p&&l,r=n);null!=(d=k[x]);x++){if(s&&d){g=0;while(m=e[g++])if(m(d,l,c)){f.push(d);break}T&&(w=N,r=++n)}o&&((d=!m&&d)&&v--,a&&b.push(d))}if(v+=x,o&&x!==v){g=0;while(m=t[g++])m(b,y,l,c);if(a){if(v>0)while(x--)b[x]||y[x]||(y[x]=q.call(f));y=xt(y)}O.apply(f,y),T&&!a&&y.length>0&&v+t.length>1&&ot.uniqueSort(f)}return T&&(w=N,u=C),b};return o?at(a):a}a=ot.compile=function(e,t){var n,r=[],i=[],o=N[e+" "];if(!o){t||(t=gt(e)),n=t.length;while(n--)o=wt(t[n]),o[v]?r.push(o):i.push(o);o=N(e,Tt(i,r))}return o};function Ct(e,t,n){var r=0,i=t.length;for(;i>r;r++)ot(e,t[r],n);return n}function kt(e,t,r,o){var s,u,l,c,p,f=gt(e);if(!o&&1===f.length){if(u=f[0]=f[0].slice(0),u.length>2&&"ID"===(l=u[0]).type&&n.getById&&9===t.nodeType&&h&&i.relative[u[1].type]){if(t=(i.find.ID(l.matches[0].replace(nt,rt),t)||[])[0],!t)return r;e=e.slice(u.shift().value.length)}s=J.needsContext.test(e)?0:u.length;while(s--){if(l=u[s],i.relative[c=l.type])break;if((p=i.find[c])&&(o=p(l.matches[0].replace(nt,rt),U.test(u[0].type)&&t.parentNode||t))){if(u.splice(s,1),e=o.length&&mt(u),!e)return O.apply(r,o),r;break}}}return a(e,f)(o,t,!h,r,U.test(e)),r}n.sortStable=v.split("").sort(S).join("")===v,n.detectDuplicates=E,c(),n.sortDetached=ut(function(e){return 1&e.compareDocumentPosition(p.createElement("div"))}),ut(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||lt("type|href|height|width",function(e,t,n){return n?undefined:e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&ut(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||lt("value",function(e,t,n){return n||"input"!==e.nodeName.toLowerCase()?undefined:e.defaultValue}),ut(function(e){return null==e.getAttribute("disabled")})||lt(R,function(e,t,n){var r;return n?undefined:(r=e.getAttributeNode(t))&&r.specified?r.value:e[t]===!0?t.toLowerCase():null}),x.find=ot,x.expr=ot.selectors,x.expr[":"]=x.expr.pseudos,x.unique=ot.uniqueSort,x.text=ot.getText,x.isXMLDoc=ot.isXML,x.contains=ot.contains}(e);var D={};function A(e){var t=D[e]={};return x.each(e.match(w)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e){e="string"==typeof e?D[e]||A(e):x.extend({},e);var t,n,r,i,o,s,a=[],u=!e.once&&[],l=function(p){for(t=e.memory&&p,n=!0,s=i||0,i=0,o=a.length,r=!0;a&&o>s;s++)if(a[s].apply(p[0],p[1])===!1&&e.stopOnFalse){t=!1;break}r=!1,a&&(u?u.length&&l(u.shift()):t?a=[]:c.disable())},c={add:function(){if(a){var n=a.length;(function s(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&c.has(n)||a.push(n):n&&n.length&&"string"!==r&&s(n)})})(arguments),r?o=a.length:t&&(i=n,l(t))}return this},remove:function(){return a&&x.each(arguments,function(e,t){var n;while((n=x.inArray(t,a,n))>-1)a.splice(n,1),r&&(o>=n&&o--,s>=n&&s--)}),this},has:function(e){return e?x.inArray(e,a)>-1:!(!a||!a.length)},empty:function(){return a=[],o=0,this},disable:function(){return a=u=t=undefined,this},disabled:function(){return!a},lock:function(){return u=undefined,t||c.disable(),this},locked:function(){return!u},fireWith:function(e,t){return!a||n&&!u||(t=t||[],t=[e,t.slice?t.slice():t],r?u.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!n}};return c},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var s=o[0],a=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=a&&a.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===r?n.promise():this,a?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,o){var s=o[2],a=o[3];r[o[1]]=s.add,a&&s.add(function(){n=a},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=s.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=d.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),s=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?d.call(arguments):r,n===a?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},a,u,l;if(r>1)for(a=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(s(t,l,n)).fail(o.reject).progress(s(t,u,a)):--i;return i||o.resolveWith(l,n),o.promise()}}),x.support=function(t){var n=o.createElement("input"),r=o.createDocumentFragment(),i=o.createElement("div"),s=o.createElement("select"),a=s.appendChild(o.createElement("option"));return n.type?(n.type="checkbox",t.checkOn=""!==n.value,t.optSelected=a.selected,t.reliableMarginRight=!0,t.boxSizingReliable=!0,t.pixelPosition=!1,n.checked=!0,t.noCloneChecked=n.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!a.disabled,n=o.createElement("input"),n.value="t",n.type="radio",t.radioValue="t"===n.value,n.setAttribute("checked","t"),n.setAttribute("name","t"),r.appendChild(n),t.checkClone=r.cloneNode(!0).cloneNode(!0).lastChild.checked,t.focusinBubbles="onfocusin"in e,i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===i.style.backgroundClip,x(function(){var n,r,s="padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box",a=o.getElementsByTagName("body")[0];a&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",a.appendChild(n).appendChild(i),i.innerHTML="",i.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%",x.swap(a,null!=a.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===i.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(i,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(i,null)||{width:"4px"}).width,r=i.appendChild(o.createElement("div")),r.style.cssText=i.style.cssText=s,r.style.marginRight=r.style.width="0",i.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),a.removeChild(n))}),t):t}({});var L,q,H=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,O=/([A-Z])/g;function F(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=x.expando+Math.random()}F.uid=1,F.accepts=function(e){return e.nodeType?1===e.nodeType||9===e.nodeType:!0},F.prototype={key:function(e){if(!F.accepts(e))return 0;var t={},n=e[this.expando];if(!n){n=F.uid++;try{t[this.expando]={value:n},Object.defineProperties(e,t)}catch(r){t[this.expando]=n,x.extend(e,t)}}return this.cache[n]||(this.cache[n]={}),n},set:function(e,t,n){var r,i=this.key(e),o=this.cache[i];if("string"==typeof t)o[t]=n;else if(x.isEmptyObject(o))x.extend(this.cache[i],t);else for(r in t)o[r]=t[r];return o},get:function(e,t){var n=this.cache[this.key(e)];return t===undefined?n:n[t]},access:function(e,t,n){var r;return t===undefined||t&&"string"==typeof t&&n===undefined?(r=this.get(e,t),r!==undefined?r:this.get(e,x.camelCase(t))):(this.set(e,t,n),n!==undefined?n:t)},remove:function(e,t){var n,r,i,o=this.key(e),s=this.cache[o];if(t===undefined)this.cache[o]={};else{x.isArray(t)?r=t.concat(t.map(x.camelCase)):(i=x.camelCase(t),t in s?r=[t,i]:(r=i,r=r in s?[r]:r.match(w)||[])),n=r.length;while(n--)delete s[r[n]]}},hasData:function(e){return!x.isEmptyObject(this.cache[e[this.expando]]||{})},discard:function(e){e[this.expando]&&delete this.cache[e[this.expando]]}},L=new F,q=new F,x.extend({acceptData:F.accepts,hasData:function(e){return L.hasData(e)||q.hasData(e)},data:function(e,t,n){return L.access(e,t,n)},removeData:function(e,t){L.remove(e,t)},_data:function(e,t,n){return q.access(e,t,n)},_removeData:function(e,t){q.remove(e,t)}}),x.fn.extend({data:function(e,t){var n,r,i=this[0],o=0,s=null;if(e===undefined){if(this.length&&(s=L.get(i),1===i.nodeType&&!q.get(i,"hasDataAttrs"))){for(n=i.attributes;n.length>o;o++)r=n[o].name,0===r.indexOf("data-")&&(r=x.camelCase(r.slice(5)),P(i,r,s[r]));q.set(i,"hasDataAttrs",!0)}return s}return"object"==typeof e?this.each(function(){L.set(this,e)}):x.access(this,function(t){var n,r=x.camelCase(e);if(i&&t===undefined){if(n=L.get(i,e),n!==undefined)return n;if(n=L.get(i,r),n!==undefined)return n;if(n=P(i,r,undefined),n!==undefined)return n}else this.each(function(){var n=L.get(this,r);L.set(this,r,t),-1!==e.indexOf("-")&&n!==undefined&&L.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){L.remove(this,e)})}});function P(e,t,n){var r;if(n===undefined&&1===e.nodeType)if(r="data-"+t.replace(O,"-$1").toLowerCase(),n=e.getAttribute(r),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:H.test(n)?JSON.parse(n):n}catch(i){}L.set(e,t,n)}else n=undefined;return n}x.extend({queue:function(e,t,n){var r;return e?(t=(t||"fx")+"queue",r=q.get(e,t),n&&(!r||x.isArray(n)?r=q.access(e,t,x.makeArray(n)):r.push(n)),r||[]):undefined},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),o=x._queueHooks(e,t),s=function(){x.dequeue(e,t)
4 };"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,s,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return q.get(e,n)||q.access(e,n,{empty:x.Callbacks("once memory").add(function(){q.remove(e,[t+"queue",n])})})}}),x.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),n>arguments.length?x.queue(this[0],e):t===undefined?this:this.each(function(){var n=x.queue(this,e,t);x._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&x.dequeue(this,e)})},dequeue:function(e){return this.each(function(){x.dequeue(this,e)})},delay:function(e,t){return e=x.fx?x.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=x.Deferred(),o=this,s=this.length,a=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=undefined),e=e||"fx";while(s--)n=q.get(o[s],e+"queueHooks"),n&&n.empty&&(r++,n.empty.add(a));return a(),i.promise(t)}});var R,M,W=/[\t\r\n\f]/g,$=/\r/g,B=/^(?:input|select|textarea|button)$/i;x.fn.extend({attr:function(e,t){return x.access(this,x.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){x.removeAttr(this,e)})},prop:function(e,t){return x.access(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[x.propFix[e]||e]})},addClass:function(e){var t,n,r,i,o,s=0,a=this.length,u="string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];a>s;s++)if(n=this[s],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(W," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=x.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,s=0,a=this.length,u=0===arguments.length||"string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];a>s;s++)if(n=this[s],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(W," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?x.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):x.isFunction(e)?this.each(function(n){x(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var t,i=0,o=x(this),s=e.match(w)||[];while(t=s[i++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else(n===r||"boolean"===n)&&(this.className&&q.set(this,"__className__",this.className),this.className=this.className||e===!1?"":q.get(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(W," ").indexOf(t)>=0)return!0;return!1},val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=x.isFunction(e),this.each(function(n){var i;1===this.nodeType&&(i=r?e.call(this,n,x(this).val()):e,null==i?i="":"number"==typeof i?i+="":x.isArray(i)&&(i=x.map(i,function(e){return null==e?"":e+""})),t=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&t.set(this,i,"value")!==undefined||(this.value=i))});if(i)return t=x.valHooks[i.type]||x.valHooks[i.nodeName.toLowerCase()],t&&"get"in t&&(n=t.get(i,"value"))!==undefined?n:(n=i.value,"string"==typeof n?n.replace($,""):null==n?"":n)}}}),x.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,s=o?null:[],a=o?i+1:r.length,u=0>i?a:o?i:0;for(;a>u;u++)if(n=r[u],!(!n.selected&&u!==i||(x.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&x.nodeName(n.parentNode,"optgroup"))){if(t=x(n).val(),o)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=x.makeArray(t),s=i.length;while(s--)r=i[s],(r.selected=x.inArray(x(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,t,n){var i,o,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return typeof e.getAttribute===r?x.prop(e,t,n):(1===s&&x.isXMLDoc(e)||(t=t.toLowerCase(),i=x.attrHooks[t]||(x.expr.match.bool.test(t)?M:R)),n===undefined?i&&"get"in i&&null!==(o=i.get(e,t))?o:(o=x.find.attr(e,t),null==o?undefined:o):null!==n?i&&"set"in i&&(o=i.set(e,n,t))!==undefined?o:(e.setAttribute(t,n+""),n):(x.removeAttr(e,t),undefined))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(w);if(o&&1===e.nodeType)while(n=o[i++])r=x.propFix[n]||n,x.expr.match.bool.test(n)&&(e[r]=!1),e.removeAttribute(n)},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,t,n){var r,i,o,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return o=1!==s||!x.isXMLDoc(e),o&&(t=x.propFix[t]||t,i=x.propHooks[t]),n!==undefined?i&&"set"in i&&(r=i.set(e,n,t))!==undefined?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){return e.hasAttribute("tabindex")||B.test(e.nodeName)||e.href?e.tabIndex:-1}}}}),M={set:function(e,t,n){return t===!1?x.removeAttr(e,n):e.setAttribute(n,n),n}},x.each(x.expr.match.bool.source.match(/\w+/g),function(e,t){var n=x.expr.attrHandle[t]||x.find.attr;x.expr.attrHandle[t]=function(e,t,r){var i=x.expr.attrHandle[t],o=r?undefined:(x.expr.attrHandle[t]=undefined)!=n(e,t,r)?t.toLowerCase():null;return x.expr.attrHandle[t]=i,o}}),x.support.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,t){return x.isArray(t)?e.checked=x.inArray(x(e).val(),t)>=0:undefined}},x.support.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var I=/^key/,z=/^(?:mouse|contextmenu)|click/,_=/^(?:focusinfocus|focusoutblur)$/,X=/^([^.]*)(?:\.(.+)|)$/;function U(){return!0}function Y(){return!1}function V(){try{return o.activeElement}catch(e){}}x.event={global:{},add:function(e,t,n,i,o){var s,a,u,l,c,p,f,h,d,g,m,y=q.get(e);if(y){n.handler&&(s=n,n=s.handler,o=s.selector),n.guid||(n.guid=x.guid++),(l=y.events)||(l=y.events={}),(a=y.handle)||(a=y.handle=function(e){return typeof x===r||e&&x.event.triggered===e.type?undefined:x.event.dispatch.apply(a.elem,arguments)},a.elem=e),t=(t||"").match(w)||[""],c=t.length;while(c--)u=X.exec(t[c])||[],d=m=u[1],g=(u[2]||"").split(".").sort(),d&&(f=x.event.special[d]||{},d=(o?f.delegateType:f.bindType)||d,f=x.event.special[d]||{},p=x.extend({type:d,origType:m,data:i,handler:n,guid:n.guid,selector:o,needsContext:o&&x.expr.match.needsContext.test(o),namespace:g.join(".")},s),(h=l[d])||(h=l[d]=[],h.delegateCount=0,f.setup&&f.setup.call(e,i,g,a)!==!1||e.addEventListener&&e.addEventListener(d,a,!1)),f.add&&(f.add.call(e,p),p.handler.guid||(p.handler.guid=n.guid)),o?h.splice(h.delegateCount++,0,p):h.push(p),x.event.global[d]=!0);e=null}},remove:function(e,t,n,r,i){var o,s,a,u,l,c,p,f,h,d,g,m=q.hasData(e)&&q.get(e);if(m&&(u=m.events)){t=(t||"").match(w)||[""],l=t.length;while(l--)if(a=X.exec(t[l])||[],h=g=a[1],d=(a[2]||"").split(".").sort(),h){p=x.event.special[h]||{},h=(r?p.delegateType:p.bindType)||h,f=u[h]||[],a=a[2]&&RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"),s=o=f.length;while(o--)c=f[o],!i&&g!==c.origType||n&&n.guid!==c.guid||a&&!a.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(f.splice(o,1),c.selector&&f.delegateCount--,p.remove&&p.remove.call(e,c));s&&!f.length&&(p.teardown&&p.teardown.call(e,d,m.handle)!==!1||x.removeEvent(e,h,m.handle),delete u[h])}else for(h in u)x.event.remove(e,h+t[l],n,r,!0);x.isEmptyObject(u)&&(delete m.handle,q.remove(e,"events"))}},trigger:function(t,n,r,i){var s,a,u,l,c,p,f,h=[r||o],d=y.call(t,"type")?t.type:t,g=y.call(t,"namespace")?t.namespace.split("."):[];if(a=u=r=r||o,3!==r.nodeType&&8!==r.nodeType&&!_.test(d+x.event.triggered)&&(d.indexOf(".")>=0&&(g=d.split("."),d=g.shift(),g.sort()),c=0>d.indexOf(":")&&"on"+d,t=t[x.expando]?t:new x.Event(d,"object"==typeof t&&t),t.isTrigger=i?2:3,t.namespace=g.join("."),t.namespace_re=t.namespace?RegExp("(^|\\.)"+g.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=undefined,t.target||(t.target=r),n=null==n?[t]:x.makeArray(n,[t]),f=x.event.special[d]||{},i||!f.trigger||f.trigger.apply(r,n)!==!1)){if(!i&&!f.noBubble&&!x.isWindow(r)){for(l=f.delegateType||d,_.test(l+d)||(a=a.parentNode);a;a=a.parentNode)h.push(a),u=a;u===(r.ownerDocument||o)&&h.push(u.defaultView||u.parentWindow||e)}s=0;while((a=h[s++])&&!t.isPropagationStopped())t.type=s>1?l:f.bindType||d,p=(q.get(a,"events")||{})[t.type]&&q.get(a,"handle"),p&&p.apply(a,n),p=c&&a[c],p&&x.acceptData(a)&&p.apply&&p.apply(a,n)===!1&&t.preventDefault();return t.type=d,i||t.isDefaultPrevented()||f._default&&f._default.apply(h.pop(),n)!==!1||!x.acceptData(r)||c&&x.isFunction(r[d])&&!x.isWindow(r)&&(u=r[c],u&&(r[c]=null),x.event.triggered=d,r[d](),x.event.triggered=undefined,u&&(r[c]=u)),t.result}},dispatch:function(e){e=x.event.fix(e);var t,n,r,i,o,s=[],a=d.call(arguments),u=(q.get(this,"events")||{})[e.type]||[],l=x.event.special[e.type]||{};if(a[0]=e,e.delegateTarget=this,!l.preDispatch||l.preDispatch.call(this,e)!==!1){s=x.event.handlers.call(this,e,u),t=0;while((i=s[t++])&&!e.isPropagationStopped()){e.currentTarget=i.elem,n=0;while((o=i.handlers[n++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(o.namespace))&&(e.handleObj=o,e.data=o.data,r=((x.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,a),r!==undefined&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return l.postDispatch&&l.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,r,i,o,s=[],a=t.delegateCount,u=e.target;if(a&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!==this;u=u.parentNode||this)if(u.disabled!==!0||"click"!==e.type){for(r=[],n=0;a>n;n++)o=t[n],i=o.selector+" ",r[i]===undefined&&(r[i]=o.needsContext?x(i,this).index(u)>=0:x.find(i,this,null,[u]).length),r[i]&&r.push(o);r.length&&s.push({elem:u,handlers:r})}return t.length>a&&s.push({elem:this,handlers:t.slice(a)}),s},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,t){var n,r,i,s=t.button;return null==e.pageX&&null!=t.clientX&&(n=e.target.ownerDocument||o,r=n.documentElement,i=n.body,e.pageX=t.clientX+(r&&r.scrollLeft||i&&i.scrollLeft||0)-(r&&r.clientLeft||i&&i.clientLeft||0),e.pageY=t.clientY+(r&&r.scrollTop||i&&i.scrollTop||0)-(r&&r.clientTop||i&&i.clientTop||0)),e.which||s===undefined||(e.which=1&s?1:2&s?3:4&s?2:0),e}},fix:function(e){if(e[x.expando])return e;var t,n,r,i=e.type,s=e,a=this.fixHooks[i];a||(this.fixHooks[i]=a=z.test(i)?this.mouseHooks:I.test(i)?this.keyHooks:{}),r=a.props?this.props.concat(a.props):this.props,e=new x.Event(s),t=r.length;while(t--)n=r[t],e[n]=s[n];return e.target||(e.target=o),3===e.target.nodeType&&(e.target=e.target.parentNode),a.filter?a.filter(e,s):e},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==V()&&this.focus?(this.focus(),!1):undefined},delegateType:"focusin"},blur:{trigger:function(){return this===V()&&this.blur?(this.blur(),!1):undefined},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&x.nodeName(this,"input")?(this.click(),!1):undefined},_default:function(e){return x.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==undefined&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?x.event.trigger(i,null,t):x.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},x.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)},x.Event=function(e,t){return this instanceof x.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.getPreventDefault&&e.getPreventDefault()?U:Y):this.type=e,t&&x.extend(this,t),this.timeStamp=e&&e.timeStamp||x.now(),this[x.expando]=!0,undefined):new x.Event(e,t)},x.Event.prototype={isDefaultPrevented:Y,isPropagationStopped:Y,isImmediatePropagationStopped:Y,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=U,e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=U,e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=U,this.stopPropagation()}},x.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){x.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!x.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){x.event.simulate(t,e.target,x.event.fix(e),!0)};x.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),x.fn.extend({on:function(e,t,n,r,i){var o,s;if("object"==typeof e){"string"!=typeof t&&(n=n||t,t=undefined);for(s in e)this.on(s,t,n,e[s],i);return this}if(null==n&&null==r?(r=t,n=t=undefined):null==r&&("string"==typeof t?(r=n,n=undefined):(r=n,n=t,t=undefined)),r===!1)r=Y;else if(!r)return this;return 1===i&&(o=r,r=function(e){return x().off(e),o.apply(this,arguments)},r.guid=o.guid||(o.guid=x.guid++)),this.each(function(){x.event.add(this,e,r,n,t)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,x(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return(t===!1||"function"==typeof t)&&(n=t,t=undefined),n===!1&&(n=Y),this.each(function(){x.event.remove(this,e,n,t)})},trigger:function(e,t){return this.each(function(){x.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];return n?x.event.trigger(e,t,n,!0):undefined}});var G=/^.[^:#\[\.,]*$/,J=/^(?:parents|prev(?:Until|All))/,Q=x.expr.match.needsContext,K={children:!0,contents:!0,next:!0,prev:!0};x.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(x(e).filter(function(){for(t=0;i>t;t++)if(x.contains(r[t],this))return!0}));for(t=0;i>t;t++)x.find(e,r[t],n);return n=this.pushStack(i>1?x.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t=x(e,this),n=t.length;return this.filter(function(){var e=0;for(;n>e;e++)if(x.contains(this,t[e]))return!0})},not:function(e){return this.pushStack(et(this,e||[],!0))},filter:function(e){return this.pushStack(et(this,e||[],!1))},is:function(e){return!!et(this,"string"==typeof e&&Q.test(e)?x(e):e||[],!1).length},closest:function(e,t){var n,r=0,i=this.length,o=[],s=Q.test(e)||"string"!=typeof e?x(e,t||this.context):0;for(;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(11>n.nodeType&&(s?s.index(n)>-1:1===n.nodeType&&x.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?x.unique(o):o)},index:function(e){return e?"string"==typeof e?g.call(x(e),this[0]):g.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?x(e,t):x.makeArray(e&&e.nodeType?[e]:e),r=x.merge(this.get(),n);return this.pushStack(x.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function Z(e,t){while((e=e[t])&&1!==e.nodeType);return e}x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return x.dir(e,"parentNode")},parentsUntil:function(e,t,n){return x.dir(e,"parentNode",n)},next:function(e){return Z(e,"nextSibling")},prev:function(e){return Z(e,"previousSibling")},nextAll:function(e){return x.dir(e,"nextSibling")},prevAll:function(e){return x.dir(e,"previousSibling")},nextUntil:function(e,t,n){return x.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return x.dir(e,"previousSibling",n)},siblings:function(e){return x.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return x.sibling(e.firstChild)},contents:function(e){return e.contentDocument||x.merge([],e.childNodes)}},function(e,t){x.fn[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=x.filter(r,i)),this.length>1&&(K[e]||x.unique(i),J.test(e)&&i.reverse()),this.pushStack(i)}}),x.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,t,n){var r=[],i=n!==undefined;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&x(e).is(n))break;r.push(e)}return r},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function et(e,t,n){if(x.isFunction(t))return x.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return x.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(G.test(t))return x.filter(t,e,n);t=x.filter(t,e)}return x.grep(e,function(e){return g.call(t,e)>=0!==n})}var tt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,nt=/<([\w:]+)/,rt=/<|&#?\w+;/,it=/<(?:script|style|link)/i,ot=/^(?:checkbox|radio)$/i,st=/checked\s*(?:[^=]|=\s*.checked.)/i,at=/^$|\/(?:java|ecma)script/i,ut=/^true\/(.*)/,lt=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ct={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ct.optgroup=ct.option,ct.tbody=ct.tfoot=ct.colgroup=ct.caption=ct.thead,ct.th=ct.td,x.fn.extend({text:function(e){return x.access(this,function(e){return e===undefined?x.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=pt(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=pt(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?x.filter(e,this):this,i=0;for(;null!=(n=r[i]);i++)t||1!==n.nodeType||x.cleanData(mt(n)),n.parentNode&&(t&&x.contains(n.ownerDocument,n)&&dt(mt(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++)1===e.nodeType&&(x.cleanData(mt(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return x.clone(this,e,t)})},html:function(e){return x.access(this,function(e){var t=this[0]||{},n=0,r=this.length;if(e===undefined&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!it.test(e)&&!ct[(nt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(tt,"<$1></$2>");try{for(;r>n;n++)t=this[n]||{},1===t.nodeType&&(x.cleanData(mt(t,!1)),t.innerHTML=e);t=0}catch(i){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=x.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),x(this).remove(),i.insertBefore(n,r))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=f.apply([],e);var r,i,o,s,a,u,l=0,c=this.length,p=this,h=c-1,d=e[0],g=x.isFunction(d);if(g||!(1>=c||"string"!=typeof d||x.support.checkClone)&&st.test(d))return this.each(function(r){var i=p.eq(r);g&&(e[0]=d.call(this,r,i.html())),i.domManip(e,t,n)});if(c&&(r=x.buildFragment(e,this[0].ownerDocument,!1,!n&&this),i=r.firstChild,1===r.childNodes.length&&(r=i),i)){for(o=x.map(mt(r,"script"),ft),s=o.length;c>l;l++)a=r,l!==h&&(a=x.clone(a,!0,!0),s&&x.merge(o,mt(a,"script"))),t.call(this[l],a,l);if(s)for(u=o[o.length-1].ownerDocument,x.map(o,ht),l=0;s>l;l++)a=o[l],at.test(a.type||"")&&!q.access(a,"globalEval")&&x.contains(u,a)&&(a.src?x._evalUrl(a.src):x.globalEval(a.textContent.replace(lt,"")))}return this}}),x.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){x.fn[e]=function(e){var n,r=[],i=x(e),o=i.length-1,s=0;for(;o>=s;s++)n=s===o?this:this.clone(!0),x(i[s])[t](n),h.apply(r,n.get());return this.pushStack(r)}}),x.extend({clone:function(e,t,n){var r,i,o,s,a=e.cloneNode(!0),u=x.contains(e.ownerDocument,e);if(!(x.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||x.isXMLDoc(e)))for(s=mt(a),o=mt(e),r=0,i=o.length;i>r;r++)yt(o[r],s[r]);if(t)if(n)for(o=o||mt(e),s=s||mt(a),r=0,i=o.length;i>r;r++)gt(o[r],s[r]);else gt(e,a);return s=mt(a,"script"),s.length>0&&dt(s,!u&&mt(e,"script")),a},buildFragment:function(e,t,n,r){var i,o,s,a,u,l,c=0,p=e.length,f=t.createDocumentFragment(),h=[];for(;p>c;c++)if(i=e[c],i||0===i)if("object"===x.type(i))x.merge(h,i.nodeType?[i]:i);else if(rt.test(i)){o=o||f.appendChild(t.createElement("div")),s=(nt.exec(i)||["",""])[1].toLowerCase(),a=ct[s]||ct._default,o.innerHTML=a[1]+i.replace(tt,"<$1></$2>")+a[2],l=a[0];while(l--)o=o.lastChild;x.merge(h,o.childNodes),o=f.firstChild,o.textContent=""}else h.push(t.createTextNode(i));f.textContent="",c=0;while(i=h[c++])if((!r||-1===x.inArray(i,r))&&(u=x.contains(i.ownerDocument,i),o=mt(f.appendChild(i),"script"),u&&dt(o),n)){l=0;while(i=o[l++])at.test(i.type||"")&&n.push(i)}return f},cleanData:function(e){var t,n,r,i,o,s,a=x.event.special,u=0;for(;(n=e[u])!==undefined;u++){if(F.accepts(n)&&(o=n[q.expando],o&&(t=q.cache[o]))){if(r=Object.keys(t.events||{}),r.length)for(s=0;(i=r[s])!==undefined;s++)a[i]?x.event.remove(n,i):x.removeEvent(n,i,t.handle);q.cache[o]&&delete q.cache[o]}delete L.cache[n[L.expando]]}},_evalUrl:function(e){return x.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}});function pt(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function ft(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function ht(e){var t=ut.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function dt(e,t){var n=e.length,r=0;for(;n>r;r++)q.set(e[r],"globalEval",!t||q.get(t[r],"globalEval"))}function gt(e,t){var n,r,i,o,s,a,u,l;if(1===t.nodeType){if(q.hasData(e)&&(o=q.access(e),s=q.set(t,o),l=o.events)){delete s.handle,s.events={};for(i in l)for(n=0,r=l[i].length;r>n;n++)x.event.add(t,i,l[i][n])}L.hasData(e)&&(a=L.access(e),u=x.extend({},a),L.set(t,u))}}function mt(e,t){var n=e.getElementsByTagName?e.getElementsByTagName(t||"*"):e.querySelectorAll?e.querySelectorAll(t||"*"):[];return t===undefined||t&&x.nodeName(e,t)?x.merge([e],n):n}function yt(e,t){var n=t.nodeName.toLowerCase();"input"===n&&ot.test(e.type)?t.checked=e.checked:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}x.fn.extend({wrapAll:function(e){var t;return x.isFunction(e)?this.each(function(t){x(this).wrapAll(e.call(this,t))}):(this[0]&&(t=x(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this)},wrapInner:function(e){return x.isFunction(e)?this.each(function(t){x(this).wrapInner(e.call(this,t))}):this.each(function(){var t=x(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=x.isFunction(e);return this.each(function(n){x(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){x.nodeName(this,"body")||x(this).replaceWith(this.childNodes)}).end()}});var vt,xt,bt=/^(none|table(?!-c[ea]).+)/,wt=/^margin/,Tt=RegExp("^("+b+")(.*)$","i"),Ct=RegExp("^("+b+")(?!px)[a-z%]+$","i"),kt=RegExp("^([+-])=("+b+")","i"),Nt={BODY:"block"},Et={position:"absolute",visibility:"hidden",display:"block"},St={letterSpacing:0,fontWeight:400},jt=["Top","Right","Bottom","Left"],Dt=["Webkit","O","Moz","ms"];function At(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=Dt.length;while(i--)if(t=Dt[i]+n,t in e)return t;return r}function Lt(e,t){return e=t||e,"none"===x.css(e,"display")||!x.contains(e.ownerDocument,e)}function qt(t){return e.getComputedStyle(t,null)}function Ht(e,t){var n,r,i,o=[],s=0,a=e.length;for(;a>s;s++)r=e[s],r.style&&(o[s]=q.get(r,"olddisplay"),n=r.style.display,t?(o[s]||"none"!==n||(r.style.display=""),""===r.style.display&&Lt(r)&&(o[s]=q.access(r,"olddisplay",Rt(r.nodeName)))):o[s]||(i=Lt(r),(n&&"none"!==n||!i)&&q.set(r,"olddisplay",i?n:x.css(r,"display"))));for(s=0;a>s;s++)r=e[s],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[s]||"":"none"));return e}x.fn.extend({css:function(e,t){return x.access(this,function(e,t,n){var r,i,o={},s=0;if(x.isArray(t)){for(r=qt(e),i=t.length;i>s;s++)o[t[s]]=x.css(e,t[s],!1,r);return o}return n!==undefined?x.style(e,t,n):x.css(e,t)},e,t,arguments.length>1)},show:function(){return Ht(this,!0)},hide:function(){return Ht(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){Lt(this)?x(this).show():x(this).hide()})}}),x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=vt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,s,a=x.camelCase(t),u=e.style;return t=x.cssProps[a]||(x.cssProps[a]=At(u,a)),s=x.cssHooks[t]||x.cssHooks[a],n===undefined?s&&"get"in s&&(i=s.get(e,!1,r))!==undefined?i:u[t]:(o=typeof n,"string"===o&&(i=kt.exec(n))&&(n=(i[1]+1)*i[2]+parseFloat(x.css(e,t)),o="number"),null==n||"number"===o&&isNaN(n)||("number"!==o||x.cssNumber[a]||(n+="px"),x.support.clearCloneStyle||""!==n||0!==t.indexOf("background")||(u[t]="inherit"),s&&"set"in s&&(n=s.set(e,n,r))===undefined||(u[t]=n)),undefined)}},css:function(e,t,n,r){var i,o,s,a=x.camelCase(t);return t=x.cssProps[a]||(x.cssProps[a]=At(e.style,a)),s=x.cssHooks[t]||x.cssHooks[a],s&&"get"in s&&(i=s.get(e,!0,n)),i===undefined&&(i=vt(e,t,r)),"normal"===i&&t in St&&(i=St[t]),""===n||n?(o=parseFloat(i),n===!0||x.isNumeric(o)?o||0:i):i}}),vt=function(e,t,n){var r,i,o,s=n||qt(e),a=s?s.getPropertyValue(t)||s[t]:undefined,u=e.style;return s&&(""!==a||x.contains(e.ownerDocument,e)||(a=x.style(e,t)),Ct.test(a)&&wt.test(t)&&(r=u.width,i=u.minWidth,o=u.maxWidth,u.minWidth=u.maxWidth=u.width=a,a=s.width,u.width=r,u.minWidth=i,u.maxWidth=o)),a};function Ot(e,t,n){var r=Tt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function Ft(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,s=0;for(;4>o;o+=2)"margin"===n&&(s+=x.css(e,n+jt[o],!0,i)),r?("content"===n&&(s-=x.css(e,"padding"+jt[o],!0,i)),"margin"!==n&&(s-=x.css(e,"border"+jt[o]+"Width",!0,i))):(s+=x.css(e,"padding"+jt[o],!0,i),"padding"!==n&&(s+=x.css(e,"border"+jt[o]+"Width",!0,i)));return s}function Pt(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=qt(e),s=x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=vt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Ct.test(i))return i;r=s&&(x.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+Ft(e,t,n||(s?"border":"content"),r,o)+"px"}function Rt(e){var t=o,n=Nt[e];return n||(n=Mt(e,t),"none"!==n&&n||(xt=(xt||x("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(xt[0].contentWindow||xt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=Mt(e,t),xt.detach()),Nt[e]=n),n}function Mt(e,t){var n=x(t.createElement(e)).appendTo(t.body),r=x.css(n[0],"display");return n.remove(),r}x.each(["height","width"],function(e,t){x.cssHooks[t]={get:function(e,n,r){return n?0===e.offsetWidth&&bt.test(x.css(e,"display"))?x.swap(e,Et,function(){return Pt(e,t,r)}):Pt(e,t,r):undefined},set:function(e,n,r){var i=r&&qt(e);return Ot(e,n,r?Ft(e,t,r,x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,i),i):0)}}}),x(function(){x.support.reliableMarginRight||(x.cssHooks.marginRight={get:function(e,t){return t?x.swap(e,{display:"inline-block"},vt,[e,"marginRight"]):undefined}}),!x.support.pixelPosition&&x.fn.position&&x.each(["top","left"],function(e,t){x.cssHooks[t]={get:function(e,n){return n?(n=vt(e,t),Ct.test(n)?x(e).position()[t]+"px":n):undefined}}})}),x.expr&&x.expr.filters&&(x.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight},x.expr.filters.visible=function(e){return!x.expr.filters.hidden(e)}),x.each({margin:"",padding:"",border:"Width"},function(e,t){x.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+jt[r]+t]=o[r]||o[r-2]||o[0];return i}},wt.test(e)||(x.cssHooks[e+t].set=Ot)});var Wt=/%20/g,$t=/\[\]$/,Bt=/\r?\n/g,It=/^(?:submit|button|image|reset|file)$/i,zt=/^(?:input|select|textarea|keygen)/i;x.fn.extend({serialize:function(){return x.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=x.prop(this,"elements");return e?x.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!x(this).is(":disabled")&&zt.test(this.nodeName)&&!It.test(e)&&(this.checked||!ot.test(e))}).map(function(e,t){var n=x(this).val();return null==n?null:x.isArray(n)?x.map(n,function(e){return{name:t.name,value:e.replace(Bt,"\r\n")}}):{name:t.name,value:n.replace(Bt,"\r\n")}}).get()}}),x.param=function(e,t){var n,r=[],i=function(e,t){t=x.isFunction(t)?t():null==t?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(t===undefined&&(t=x.ajaxSettings&&x.ajaxSettings.traditional),x.isArray(e)||e.jquery&&!x.isPlainObject(e))x.each(e,function(){i(this.name,this.value)});else for(n in e)_t(n,e[n],t,i);return r.join("&").replace(Wt,"+")};function _t(e,t,n,r){var i;if(x.isArray(t))x.each(t,function(t,i){n||$t.test(e)?r(e,i):_t(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==x.type(t))r(e,t);else for(i in t)_t(e+"["+i+"]",t[i],n,r)}x.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){x.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),x.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)
5 },delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var Xt,Ut,Yt=x.now(),Vt=/\?/,Gt=/#.*$/,Jt=/([?&])_=[^&]*/,Qt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Kt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Zt=/^(?:GET|HEAD)$/,en=/^\/\//,tn=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,nn=x.fn.load,rn={},on={},sn="*/".concat("*");try{Ut=i.href}catch(an){Ut=o.createElement("a"),Ut.href="",Ut=Ut.href}Xt=tn.exec(Ut.toLowerCase())||[];function un(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(w)||[];if(x.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function ln(e,t,n,r){var i={},o=e===on;function s(a){var u;return i[a]=!0,x.each(e[a]||[],function(e,a){var l=a(t,n,r);return"string"!=typeof l||o||i[l]?o?!(u=l):undefined:(t.dataTypes.unshift(l),s(l),!1)}),u}return s(t.dataTypes[0])||!i["*"]&&s("*")}function cn(e,t){var n,r,i=x.ajaxSettings.flatOptions||{};for(n in t)t[n]!==undefined&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&x.extend(!0,e,r),e}x.fn.load=function(e,t,n){if("string"!=typeof e&&nn)return nn.apply(this,arguments);var r,i,o,s=this,a=e.indexOf(" ");return a>=0&&(r=e.slice(a),e=e.slice(0,a)),x.isFunction(t)?(n=t,t=undefined):t&&"object"==typeof t&&(i="POST"),s.length>0&&x.ajax({url:e,type:i,dataType:"html",data:t}).done(function(e){o=arguments,s.html(r?x("<div>").append(x.parseHTML(e)).find(r):e)}).complete(n&&function(e,t){s.each(n,o||[e.responseText,t,e])}),this},x.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){x.fn[t]=function(e){return this.on(t,e)}}),x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ut,type:"GET",isLocal:Kt.test(Xt[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":sn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":x.parseJSON,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?cn(cn(e,x.ajaxSettings),t):cn(x.ajaxSettings,e)},ajaxPrefilter:un(rn),ajaxTransport:un(on),ajax:function(e,t){"object"==typeof e&&(t=e,e=undefined),t=t||{};var n,r,i,o,s,a,u,l,c=x.ajaxSetup({},t),p=c.context||c,f=c.context&&(p.nodeType||p.jquery)?x(p):x.event,h=x.Deferred(),d=x.Callbacks("once memory"),g=c.statusCode||{},m={},y={},v=0,b="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(2===v){if(!o){o={};while(t=Qt.exec(i))o[t[1].toLowerCase()]=t[2]}t=o[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===v?i:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return v||(e=y[n]=y[n]||e,m[e]=t),this},overrideMimeType:function(e){return v||(c.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>v)for(t in e)g[t]=[g[t],e[t]];else T.always(e[T.status]);return this},abort:function(e){var t=e||b;return n&&n.abort(t),k(0,t),this}};if(h.promise(T).complete=d.add,T.success=T.done,T.error=T.fail,c.url=((e||c.url||Ut)+"").replace(Gt,"").replace(en,Xt[1]+"//"),c.type=t.method||t.type||c.method||c.type,c.dataTypes=x.trim(c.dataType||"*").toLowerCase().match(w)||[""],null==c.crossDomain&&(a=tn.exec(c.url.toLowerCase()),c.crossDomain=!(!a||a[1]===Xt[1]&&a[2]===Xt[2]&&(a[3]||("http:"===a[1]?"80":"443"))===(Xt[3]||("http:"===Xt[1]?"80":"443")))),c.data&&c.processData&&"string"!=typeof c.data&&(c.data=x.param(c.data,c.traditional)),ln(rn,c,t,T),2===v)return T;u=c.global,u&&0===x.active++&&x.event.trigger("ajaxStart"),c.type=c.type.toUpperCase(),c.hasContent=!Zt.test(c.type),r=c.url,c.hasContent||(c.data&&(r=c.url+=(Vt.test(r)?"&":"?")+c.data,delete c.data),c.cache===!1&&(c.url=Jt.test(r)?r.replace(Jt,"$1_="+Yt++):r+(Vt.test(r)?"&":"?")+"_="+Yt++)),c.ifModified&&(x.lastModified[r]&&T.setRequestHeader("If-Modified-Since",x.lastModified[r]),x.etag[r]&&T.setRequestHeader("If-None-Match",x.etag[r])),(c.data&&c.hasContent&&c.contentType!==!1||t.contentType)&&T.setRequestHeader("Content-Type",c.contentType),T.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+("*"!==c.dataTypes[0]?", "+sn+"; q=0.01":""):c.accepts["*"]);for(l in c.headers)T.setRequestHeader(l,c.headers[l]);if(c.beforeSend&&(c.beforeSend.call(p,T,c)===!1||2===v))return T.abort();b="abort";for(l in{success:1,error:1,complete:1})T[l](c[l]);if(n=ln(on,c,t,T)){T.readyState=1,u&&f.trigger("ajaxSend",[T,c]),c.async&&c.timeout>0&&(s=setTimeout(function(){T.abort("timeout")},c.timeout));try{v=1,n.send(m,k)}catch(C){if(!(2>v))throw C;k(-1,C)}}else k(-1,"No Transport");function k(e,t,o,a){var l,m,y,b,w,C=t;2!==v&&(v=2,s&&clearTimeout(s),n=undefined,i=a||"",T.readyState=e>0?4:0,l=e>=200&&300>e||304===e,o&&(b=pn(c,T,o)),b=fn(c,b,T,l),l?(c.ifModified&&(w=T.getResponseHeader("Last-Modified"),w&&(x.lastModified[r]=w),w=T.getResponseHeader("etag"),w&&(x.etag[r]=w)),204===e||"HEAD"===c.type?C="nocontent":304===e?C="notmodified":(C=b.state,m=b.data,y=b.error,l=!y)):(y=C,(e||!C)&&(C="error",0>e&&(e=0))),T.status=e,T.statusText=(t||C)+"",l?h.resolveWith(p,[m,C,T]):h.rejectWith(p,[T,C,y]),T.statusCode(g),g=undefined,u&&f.trigger(l?"ajaxSuccess":"ajaxError",[T,c,l?m:y]),d.fireWith(p,[T,C]),u&&(f.trigger("ajaxComplete",[T,c]),--x.active||x.event.trigger("ajaxStop")))}return T},getJSON:function(e,t,n){return x.get(e,t,n,"json")},getScript:function(e,t){return x.get(e,undefined,t,"script")}}),x.each(["get","post"],function(e,t){x[t]=function(e,n,r,i){return x.isFunction(n)&&(i=i||r,r=n,n=undefined),x.ajax({url:e,type:t,dataType:i,data:n,success:r})}});function pn(e,t,n){var r,i,o,s,a=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),r===undefined&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in a)if(a[i]&&a[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}s||(s=i)}o=o||s}return o?(o!==u[0]&&u.unshift(o),n[o]):undefined}function fn(e,t,n,r){var i,o,s,a,u,l={},c=e.dataTypes.slice();if(c[1])for(s in e.converters)l[s.toLowerCase()]=e.converters[s];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(s=l[u+" "+o]||l["* "+o],!s)for(i in l)if(a=i.split(" "),a[1]===o&&(s=l[u+" "+a[0]]||l["* "+a[0]])){s===!0?s=l[i]:l[i]!==!0&&(o=a[0],c.unshift(a[1]));break}if(s!==!0)if(s&&e["throws"])t=s(t);else try{t=s(t)}catch(p){return{state:"parsererror",error:s?p:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",function(e){e.cache===undefined&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),x.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(r,i){t=x("<script>").prop({async:!0,charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&i("error"===e.type?404:200,e.type)}),o.head.appendChild(t[0])},abort:function(){n&&n()}}}});var hn=[],dn=/(=)\?(?=&|$)|\?\?/;x.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=hn.pop()||x.expando+"_"+Yt++;return this[e]=!0,e}}),x.ajaxPrefilter("json jsonp",function(t,n,r){var i,o,s,a=t.jsonp!==!1&&(dn.test(t.url)?"url":"string"==typeof t.data&&!(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&dn.test(t.data)&&"data");return a||"jsonp"===t.dataTypes[0]?(i=t.jsonpCallback=x.isFunction(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,a?t[a]=t[a].replace(dn,"$1"+i):t.jsonp!==!1&&(t.url+=(Vt.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){return s||x.error(i+" was not called"),s[0]},t.dataTypes[0]="json",o=e[i],e[i]=function(){s=arguments},r.always(function(){e[i]=o,t[i]&&(t.jsonpCallback=n.jsonpCallback,hn.push(i)),s&&x.isFunction(o)&&o(s[0]),s=o=undefined}),"script"):undefined}),x.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(e){}};var gn=x.ajaxSettings.xhr(),mn={0:200,1223:204},yn=0,vn={};e.ActiveXObject&&x(e).on("unload",function(){for(var e in vn)vn[e]();vn=undefined}),x.support.cors=!!gn&&"withCredentials"in gn,x.support.ajax=gn=!!gn,x.ajaxTransport(function(e){var t;return x.support.cors||gn&&!e.crossDomain?{send:function(n,r){var i,o,s=e.xhr();if(s.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(i in e.xhrFields)s[i]=e.xhrFields[i];e.mimeType&&s.overrideMimeType&&s.overrideMimeType(e.mimeType),e.crossDomain||n["X-Requested-With"]||(n["X-Requested-With"]="XMLHttpRequest");for(i in n)s.setRequestHeader(i,n[i]);t=function(e){return function(){t&&(delete vn[o],t=s.onload=s.onerror=null,"abort"===e?s.abort():"error"===e?r(s.status||404,s.statusText):r(mn[s.status]||s.status,s.statusText,"string"==typeof s.responseText?{text:s.responseText}:undefined,s.getAllResponseHeaders()))}},s.onload=t(),s.onerror=t("error"),t=vn[o=yn++]=t("abort"),s.send(e.hasContent&&e.data||null)},abort:function(){t&&t()}}:undefined});var xn,bn,wn=/^(?:toggle|show|hide)$/,Tn=RegExp("^(?:([+-])=|)("+b+")([a-z%]*)$","i"),Cn=/queueHooks$/,kn=[An],Nn={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Tn.exec(t),o=i&&i[3]||(x.cssNumber[e]?"":"px"),s=(x.cssNumber[e]||"px"!==o&&+r)&&Tn.exec(x.css(n.elem,e)),a=1,u=20;if(s&&s[3]!==o){o=o||s[3],i=i||[],s=+r||1;do a=a||".5",s/=a,x.style(n.elem,e,s+o);while(a!==(a=n.cur()/r)&&1!==a&&--u)}return i&&(s=n.start=+s||+r||0,n.unit=o,n.end=i[1]?s+(i[1]+1)*i[2]:+i[2]),n}]};function En(){return setTimeout(function(){xn=undefined}),xn=x.now()}function Sn(e,t,n){var r,i=(Nn[t]||[]).concat(Nn["*"]),o=0,s=i.length;for(;s>o;o++)if(r=i[o].call(n,t,e))return r}function jn(e,t,n){var r,i,o=0,s=kn.length,a=x.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;var t=xn||En(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,s=0,u=l.tweens.length;for(;u>s;s++)l.tweens[s].run(o);return a.notifyWith(e,[l,o,n]),1>o&&u?n:(a.resolveWith(e,[l]),!1)},l=a.promise({elem:e,props:x.extend({},t),opts:x.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:xn||En(),duration:n.duration,tweens:[],createTween:function(t,n){var r=x.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)l.tweens[n].run(1);return t?a.resolveWith(e,[l,t]):a.rejectWith(e,[l,t]),this}}),c=l.props;for(Dn(c,l.opts.specialEasing);s>o;o++)if(r=kn[o].call(l,e,c,l.opts))return r;return x.map(c,Sn,l),x.isFunction(l.opts.start)&&l.opts.start.call(e,l),x.fx.timer(x.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function Dn(e,t){var n,r,i,o,s;for(n in e)if(r=x.camelCase(n),i=t[r],o=e[n],x.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),s=x.cssHooks[r],s&&"expand"in s){o=s.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}x.Animation=x.extend(jn,{tweener:function(e,t){x.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Nn[n]=Nn[n]||[],Nn[n].unshift(t)},prefilter:function(e,t){t?kn.unshift(e):kn.push(e)}});function An(e,t,n){var r,i,o,s,a,u,l=this,c={},p=e.style,f=e.nodeType&&Lt(e),h=q.get(e,"fxshow");n.queue||(a=x._queueHooks(e,"fx"),null==a.unqueued&&(a.unqueued=0,u=a.empty.fire,a.empty.fire=function(){a.unqueued||u()}),a.unqueued++,l.always(function(){l.always(function(){a.unqueued--,x.queue(e,"fx").length||a.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===x.css(e,"display")&&"none"===x.css(e,"float")&&(p.display="inline-block")),n.overflow&&(p.overflow="hidden",l.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],wn.exec(i)){if(delete t[r],o=o||"toggle"===i,i===(f?"hide":"show")){if("show"!==i||!h||h[r]===undefined)continue;f=!0}c[r]=h&&h[r]||x.style(e,r)}if(!x.isEmptyObject(c)){h?"hidden"in h&&(f=h.hidden):h=q.access(e,"fxshow",{}),o&&(h.hidden=!f),f?x(e).show():l.done(function(){x(e).hide()}),l.done(function(){var t;q.remove(e,"fxshow");for(t in c)x.style(e,t,c[t])});for(r in c)s=Sn(f?h[r]:0,r,l),r in h||(h[r]=s.start,f&&(s.end=s.start,s.start="width"===r||"height"===r?1:0))}}function Ln(e,t,n,r,i){return new Ln.prototype.init(e,t,n,r,i)}x.Tween=Ln,Ln.prototype={constructor:Ln,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(x.cssNumber[n]?"":"px")},cur:function(){var e=Ln.propHooks[this.prop];return e&&e.get?e.get(this):Ln.propHooks._default.get(this)},run:function(e){var t,n=Ln.propHooks[this.prop];return this.pos=t=this.options.duration?x.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Ln.propHooks._default.set(this),this}},Ln.prototype.init.prototype=Ln.prototype,Ln.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=x.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[x.cssProps[e.prop]]||x.cssHooks[e.prop])?x.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Ln.propHooks.scrollTop=Ln.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},x.each(["toggle","show","hide"],function(e,t){var n=x.fn[t];x.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(qn(t,!0),e,r,i)}}),x.fn.extend({fadeTo:function(e,t,n,r){return this.filter(Lt).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=x.isEmptyObject(e),o=x.speed(t,n,r),s=function(){var t=jn(this,x.extend({},e),o);(i||q.get(this,"finish"))&&t.stop(!0)};return s.finish=s,i||o.queue===!1?this.each(s):this.queue(o.queue,s)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=undefined),t&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=null!=e&&e+"queueHooks",o=x.timers,s=q.get(this);if(i)s[i]&&s[i].stop&&r(s[i]);else for(i in s)s[i]&&s[i].stop&&Cn.test(i)&&r(s[i]);for(i=o.length;i--;)o[i].elem!==this||null!=e&&o[i].queue!==e||(o[i].anim.stop(n),t=!1,o.splice(i,1));(t||!n)&&x.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=q.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=x.timers,s=r?r.length:0;for(n.finish=!0,x.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;s>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function qn(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=jt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}x.each({slideDown:qn("show"),slideUp:qn("hide"),slideToggle:qn("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){x.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),x.speed=function(e,t,n){var r=e&&"object"==typeof e?x.extend({},e):{complete:n||!n&&t||x.isFunction(e)&&e,duration:e,easing:n&&t||t&&!x.isFunction(t)&&t};return r.duration=x.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in x.fx.speeds?x.fx.speeds[r.duration]:x.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){x.isFunction(r.old)&&r.old.call(this),r.queue&&x.dequeue(this,r.queue)},r},x.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},x.timers=[],x.fx=Ln.prototype.init,x.fx.tick=function(){var e,t=x.timers,n=0;for(xn=x.now();t.length>n;n++)e=t[n],e()||t[n]!==e||t.splice(n--,1);t.length||x.fx.stop(),xn=undefined},x.fx.timer=function(e){e()&&x.timers.push(e)&&x.fx.start()},x.fx.interval=13,x.fx.start=function(){bn||(bn=setInterval(x.fx.tick,x.fx.interval))},x.fx.stop=function(){clearInterval(bn),bn=null},x.fx.speeds={slow:600,fast:200,_default:400},x.fx.step={},x.expr&&x.expr.filters&&(x.expr.filters.animated=function(e){return x.grep(x.timers,function(t){return e===t.elem}).length}),x.fn.offset=function(e){if(arguments.length)return e===undefined?this:this.each(function(t){x.offset.setOffset(this,e,t)});var t,n,i=this[0],o={top:0,left:0},s=i&&i.ownerDocument;if(s)return t=s.documentElement,x.contains(t,i)?(typeof i.getBoundingClientRect!==r&&(o=i.getBoundingClientRect()),n=Hn(s),{top:o.top+n.pageYOffset-t.clientTop,left:o.left+n.pageXOffset-t.clientLeft}):o},x.offset={setOffset:function(e,t,n){var r,i,o,s,a,u,l,c=x.css(e,"position"),p=x(e),f={};"static"===c&&(e.style.position="relative"),a=p.offset(),o=x.css(e,"top"),u=x.css(e,"left"),l=("absolute"===c||"fixed"===c)&&(o+u).indexOf("auto")>-1,l?(r=p.position(),s=r.top,i=r.left):(s=parseFloat(o)||0,i=parseFloat(u)||0),x.isFunction(t)&&(t=t.call(e,n,a)),null!=t.top&&(f.top=t.top-a.top+s),null!=t.left&&(f.left=t.left-a.left+i),"using"in t?t.using.call(e,f):p.css(f)}},x.fn.extend({position:function(){if(this[0]){var e,t,n=this[0],r={top:0,left:0};return"fixed"===x.css(n,"position")?t=n.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),x.nodeName(e[0],"html")||(r=e.offset()),r.top+=x.css(e[0],"borderTopWidth",!0),r.left+=x.css(e[0],"borderLeftWidth",!0)),{top:t.top-r.top-x.css(n,"marginTop",!0),left:t.left-r.left-x.css(n,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||s;while(e&&!x.nodeName(e,"html")&&"static"===x.css(e,"position"))e=e.offsetParent;return e||s})}}),x.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,n){var r="pageYOffset"===n;x.fn[t]=function(i){return x.access(this,function(t,i,o){var s=Hn(t);return o===undefined?s?s[n]:t[i]:(s?s.scrollTo(r?e.pageXOffset:o,r?o:e.pageYOffset):t[i]=o,undefined)},t,i,arguments.length,null)}});function Hn(e){return x.isWindow(e)?e:9===e.nodeType&&e.defaultView}x.each({Height:"height",Width:"width"},function(e,t){x.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){x.fn[r]=function(r,i){var o=arguments.length&&(n||"boolean"!=typeof r),s=n||(r===!0||i===!0?"margin":"border");return x.access(this,function(t,n,r){var i;return x.isWindow(t)?t.document.documentElement["client"+e]:9===t.nodeType?(i=t.documentElement,Math.max(t.body["scroll"+e],i["scroll"+e],t.body["offset"+e],i["offset"+e],i["client"+e])):r===undefined?x.css(t,n,s):x.style(t,n,r,s)},t,o?r:undefined,o,null)}})}),x.fn.size=function(){return this.length},x.fn.andSelf=x.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=x:"function"==typeof define&&define.amd&&define("jquery",[],function(){return x}),"object"==typeof e&&"object"==typeof e.document&&(e.jQuery=e.$=x)})(window);
232232 };
233233
234234 Pengine.prototype.send = function(event) {
235 pengine = this;
235 var pengine = this;
236236
237237 $.get(pengine.options.server + '/send',
238238 { id: this.id,
316316 },
317317
318318 output: function(obj) {
319 if ( !this.id )
320 this.id = obj.id;
319321 this.callback('onoutput', obj);
320322 this.pull_response();
321323 },
387389 * is performed according to the rules below:
388390 *
389391 * - A number is serialized trivially
390 * - A string is serialized into a Prolog string unless
391 * `option.string == "atom"`
392 * - A string is serialized into a Prolog string unless
393 * `option.string == "atom"`
394 * - `true`, `false`, `null` and `undefined` are serialized as
395 * atoms.
392396 * - An array is serialized into a Prolog list
393397 * - An object is serialized into a Prolog dict. Keys that are
394398 * integers are mapped to Prolog integers, other keys are mapped
448452 }
449453
450454 switch ( typeof(data) ) {
455 case "boolean":
456 msg += data ? "true" : "false";
457 break;
458 case "undefined":
459 msg += "undefined";
460 break;
451461 case "number":
452462 msg += data;
453463 break;
455465 msg += stringEscape(data, strq);
456466 break;
457467 case "object":
458 if ( Array.isArray(data) ) {
468 if ( data == null ) {
469 msg += "null";
470 } else if ( Array.isArray(data) ) {
459471 msg += "[";
460472 for(var i=0; i<data.length; i++) {
461473 if ( !serialize(data[i]) )
00 <html lang="en">
11 <head>
2 <script src="/jquery-2.0.3.min.js"></script>
2 <script src="/js/jquery-1.11.3.min.js"></script>
33 <script src="/js/pengines.js"></script>
44 <script type="text/x-prolog">
55
22 keys are the variables that do not start with '_'.
33 -->
44 <head>
5 <script src="/jquery-2.0.3.min.js"></script>
5 <script src="/js/jquery-1.11.3.min.js"></script>
66 <script src="/js/pengines.js"></script>
77 <script type="text/x-prolog">
88
00 <html lang="en">
11 <head>
22 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
3 <script src="/jquery-2.0.3.min.js"></script>
3 <script src="/js/jquery-1.11.3.min.js"></script>
44 <script src="/js/pengines.js"></script>
55
66 <script type="text/x-prolog">
00 <html lang="en">
11 <head>
2 <script src="/jquery-2.0.3.min.js"></script>
2 <script src="/js/jquery-1.11.3.min.js"></script>
33 <script src="/js/pengines.js"></script>
44 <script type="text/x-prolog">
55
11 <!-- Test json-html output
22 -->
33 <head>
4 <script src="/jquery-2.0.3.min.js"></script>
4 <script src="/js/jquery-1.11.3.min.js"></script>
55 <script src="/js/pengines.js"></script>
66 <script type="text/x-prolog">
77
22 keys are the variables that do not start with '_'.
33 -->
44 <head>
5 <script src="/jquery-2.0.3.min.js"></script>
5 <script src="/js/jquery-1.11.3.min.js"></script>
66 <script src="/js/pengines.js"></script>
77 <script src="config.js"></script>
88 <script type="text/x-prolog">
0 JQUERY=/js/jquery-1.11.3.min.js
1
2 sed -i -e 's@src="[^"]*jquery[^"]*"@src="'$JQUERY'"@' *.html
11 doc_process.pl doc_index.pl doc_search.pl doc_man.pl \
22 doc_library.pl hooks.pl doc_htmlsrc.pl doc_colour.pl \
33 doc_util.pl doc_access.pl doc_pack.pl
4 SUPPORT= pldoc.css pldoc.js jquery.js pllisting.css pldoc.sty \
4 SUPPORT= pldoc.css pldoc.js pllisting.css pldoc.sty \
55 edit.png private.png public.png reload.png favicon.ico \
66 up.gif source.png h1-bg.png pub-bg.png multi-bg.png \
77 priv-bg.png h2-bg.png editpred.png
22 Author: Jan Wielemaker
33 E-mail: J.Wielemaker@cs.vu.nl
44 WWW: http://www.swi-prolog.org
5 Copyright (C): 2009-2014, University of Amsterdam
5 Copyright (C): 2009-2015, University of Amsterdam
66 VU University Amsterdam
77
88 This program is free software; you can redistribute it and/or
8383 :- use_module(library(http/http_wrapper)).
8484 :- use_module(library(http/http_path)).
8585 :- use_module(library(http/html_head)).
86 :- use_module(library(http/jquery)).
8687 :- use_module(library(debug)).
8788 :- use_module(library(apply)).
8889 :- use_module(library(pairs)).
192193 requires([ pldoc_resource('pldoc.css')
193194 ])
194195 ]).
195 :- if(\+html_current_resource(jquery)).
196 :- html_resource(jquery,
197 [ virtual(true),
198 requires([ pldoc_resource('jquery.js')
199 ])
200 ]).
201 :- endif.
202196 :- html_resource(pldoc_resource('pldoc.js'),
203197 [ requires([ jquery
204198 ])
13601354 -> { Done = Done0 },
13611355 pred_head(Head)
13621356 ; html([ span(style('float:right'),
1363 \pred_edit_button(Head, Options)),
1357 \pred_edit_or_source_button(Head, Options)),
13641358 a(name=Name, \pred_head(Head))
13651359 ]),
13661360 { Done = [PI|Done0] }
13671361 ).
1362
1363
1364 pred_edit_or_source_button(Head, Options) -->
1365 { option(edit(true), Options) }, !,
1366 pred_edit_button(Head, Options).
1367 pred_edit_or_source_button(Head, Options) -->
1368 { option(source_link(true), Options) }, !,
1369 pred_source_button(Head, Options).
1370 pred_edit_or_source_button(_, _) --> [].
13681371
13691372 %% pred_edit_button(+PredIndicator, +Options)// is det.
13701373 %
19791982 ; Primary = Module
19801983 ),
19811984 module_property(Primary, file(File)).
1982 in_file(_, Head, File) :-
1983 source_file(Head, File).
1985 in_file(Module, Head, File) :-
1986 predicate_property(Module:Head, file(File)).
19841987 in_file(Module, Head, File) :-
19851988 current_module(Module),
19861989 source_file(Module:Head, File).
00 /* Part of SWI-Prolog
11
22 Author: Jan Wielemaker
3 E-mail: J.Wielemaker@uva.nl
3 E-mail: J.Wielemaker@vu.nl
44 WWW: http://www.swi-prolog.org
5 Copyright (C): 1985-2009, University of Amsterdam
5 Copyright (C): 2006-2015, University of Amsterdam
6 VU University Amsterdam
67
78 This program is free software; you can redistribute it and/or
89 modify it under the terms of the GNU General Public License
398399 file('pldoc.css', 'pldoc.css').
399400 file('pllisting.css', 'pllisting.css').
400401 file('pldoc.js', 'pldoc.js').
401 file('jquery.js', 'jquery.js').
402402 file('edit.png', 'edit.png').
403403 file('editpred.png', 'editpred.png').
404404 file('up.gif', 'up.gif').
508508 mime_type(text/plain)
509509 ], Request)
510510 ; doc_for_file(File,
511 [ public_only(Public)
511 [ public_only(Public),
512 source_link(true)
512513 | EditOptions
513514 ])
514515 ).
982982 |}).
983983 man_match(root, root) --> !,
984984 man_overview([]).
985 man_match((Parent+Path)-(Obj+[element(dt,A,C)|DD]), Obj) -->
986 { man_qualified_object(Obj, Parent, QObj, Section) }, !,
985 man_match((Parent+Path)-(Obj+[element(dt,A,C0)|DD]), Obj) -->
986 { man_qualified_object(Obj, Parent, QObj, Section), !,
987 C = [ span(style('float:right;margin-left:5px;'),
988 \object_source_button(QObj, [link_source(true)]))
989 | C0
990 ]
991 },
987992 dom_list([ element(dt,[],[\man_synopsis(QObj, Section)]),
988993 element(dt,A,C)
989994 | DD
990995 ], Path).
991996 man_match((_Parent+Path)-(Obj+DOM), Obj) -->
992997 dom_list(DOM, Path).
998
993999
9941000 :- html_meta
9951001 dom_list(html, +, ?, ?).
22 Author: Jan Wielemaker
33 E-mail: J.Wielemaker@vu.nl
44 WWW: http://www.swi-prolog.org
5 Copyright (C): 2006-2013, University of Amsterdam
5 Copyright (C): 2006-2015, University of Amsterdam
66 VU University Amsterdam
77
88 This program is free software; you can redistribute it and/or
5555 :- op(750, xf, ...). % Repeated argument: Arg...
5656 :- op(650, fx, +). % allow +Arg
5757 :- op(650, fx, -). % allow -Arg
58 :- op(650, fx, ++). % allow ++Arg
59 :- op(650, fx, --). % allow --Arg
5860 :- op(650, fx, ?). % allow ?Arg
5961 :- op(650, fx, :). % allow :Arg
6062 :- op(650, fx, @). % allow @Arg
429431 % Our defined argument-mode indicators
430432
431433 mode_indicator(+). % Instantiated to type
432 mode_indicator(-). % Unbound
434 mode_indicator(-). % Output argument
435 mode_indicator(++). % Ground
436 mode_indicator(--). % Must be unbound
433437 mode_indicator(?). % Partially instantiated to type
434438 mode_indicator(:). % Meta-argument (implies +)
435439 mode_indicator(@). % Not instantiated by pred
437441
438442 mode_ind(+(X), +, X).
439443 mode_ind(-(X), -, X).
444 mode_ind(++(X), ++, X).
445 mode_ind(--(X), --, X).
440446 mode_ind(?(X), ?, X).
441447 mode_ind(:(X), :, X).
442448 mode_ind(@(X), @, X).
6262 :- multifile
6363 prolog:doc_wiki_face//2, % -Out, +VarNames
6464 prolog:doc_url_expansion/3, % +Alias(Rest), -HREF, -Label
65 prolog:url_expansion_hook/3. % +Term, -Ref, -Label
65 prolog:url_expansion_hook/3, % +Term, -Ref, -Label
66 prolog:doc_autolink_extension/2.% +Extension, -Type
6667
6768
6869 /*******************************
13231324 % True if Ext is a filename extensions that create automatic links
13241325 % in the documentation.
13251326
1327 autolink_extension(Ext, Type) :-
1328 prolog:doc_autolink_extension(Ext, Type), !.
13261329 autolink_extension(Ext, prolog) :-
1327 user:prolog_file_type(Ext,prolog).
1330 user:prolog_file_type(Ext,prolog), !.
13281331 autolink_extension(txt, wiki).
13291332 autolink_extension(md, wiki).
13301333 autolink_extension(gif, image).
+0
-6
packages/pldoc/jquery.js less more
0 /*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
1 //@ sourceMappingURL=jquery-1.10.2.min.map
2 */
3 (function(e,t){var n,r,i=typeof t,o=e.location,a=e.document,s=a.documentElement,l=e.jQuery,u=e.$,c={},p=[],f="1.10.2",d=p.concat,h=p.push,g=p.slice,m=p.indexOf,y=c.toString,v=c.hasOwnProperty,b=f.trim,x=function(e,t){return new x.fn.init(e,t,r)},w=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=/\S+/g,C=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,k=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,E=/^[\],:{}\s]*$/,S=/(?:^|:|,)(?:\s*\[)+/g,A=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,j=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,D=/^-ms-/,L=/-([\da-z])/gi,H=function(e,t){return t.toUpperCase()},q=function(e){(a.addEventListener||"load"===e.type||"complete"===a.readyState)&&(_(),x.ready())},_=function(){a.addEventListener?(a.removeEventListener("DOMContentLoaded",q,!1),e.removeEventListener("load",q,!1)):(a.detachEvent("onreadystatechange",q),e.detachEvent("onload",q))};x.fn=x.prototype={jquery:f,constructor:x,init:function(e,n,r){var i,o;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof x?n[0]:n,x.merge(this,x.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:a,!0)),k.test(i[1])&&x.isPlainObject(n))for(i in n)x.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(o=a.getElementById(i[2]),o&&o.parentNode){if(o.id!==i[2])return r.find(e);this.length=1,this[0]=o}return this.context=a,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return g.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(g.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},l=1,u=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},l=2),"object"==typeof s||x.isFunction(s)||(s={}),u===l&&(s=this,--l);u>l;l++)if(null!=(o=arguments[l]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(x.isPlainObject(r)||(n=x.isArray(r)))?(n?(n=!1,a=e&&x.isArray(e)?e:[]):a=e&&x.isPlainObject(e)?e:{},s[i]=x.extend(c,a,r)):r!==t&&(s[i]=r));return s},x.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=l),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){if(e===!0?!--x.readyWait:!x.isReady){if(!a.body)return setTimeout(x.ready);x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(a,[x]),x.fn.trigger&&x(a).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray||function(e){return"array"===x.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?c[y.call(e)]||"object":typeof e},isPlainObject:function(e){var n;if(!e||"object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!v.call(e,"constructor")&&!v.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(r){return!1}if(x.support.ownLast)for(n in e)return v.call(e,n);for(n in e);return n===t||v.call(e,n)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||a;var r=k.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=x.trim(n),n&&E.test(n.replace(A,"@").replace(j,"]").replace(S,"")))?Function("return "+n)():(x.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||x.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&x.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(D,"ms-").replace(L,H)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:b&&!b.call("\ufeff\u00a0")?function(e){return null==e?"":b.call(e)}:function(e){return null==e?"":(e+"").replace(C,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(m)return m.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return d.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),x.isFunction(e)?(r=g.call(arguments,2),i=function(){return e.apply(n||this,r.concat(g.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):t},access:function(e,n,r,i,o,a,s){var l=0,u=e.length,c=null==r;if("object"===x.type(r)){o=!0;for(l in r)x.access(e,n,l,r[l],!0,a,s)}else if(i!==t&&(o=!0,x.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(x(e),n)})),n))for(;u>l;l++)n(e[l],r,s?i:i.call(e[l],l,n(e[l],r)));return o?e:c?n.call(e):u?n(e[0],r):a},now:function(){return(new Date).getTime()},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),x.ready.promise=function(t){if(!n)if(n=x.Deferred(),"complete"===a.readyState)setTimeout(x.ready);else if(a.addEventListener)a.addEventListener("DOMContentLoaded",q,!1),e.addEventListener("load",q,!1);else{a.attachEvent("onreadystatechange",q),e.attachEvent("onload",q);var r=!1;try{r=null==e.frameElement&&a.documentElement}catch(i){}r&&r.doScroll&&function o(){if(!x.isReady){try{r.doScroll("left")}catch(e){return setTimeout(o,50)}_(),x.ready()}}()}return n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){c["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=x(a),function(e,t){var n,r,i,o,a,s,l,u,c,p,f,d,h,g,m,y,v,b="sizzle"+-new Date,w=e.document,T=0,C=0,N=st(),k=st(),E=st(),S=!1,A=function(e,t){return e===t?(S=!0,0):0},j=typeof t,D=1<<31,L={}.hasOwnProperty,H=[],q=H.pop,_=H.push,M=H.push,O=H.slice,F=H.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",P="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",W=R.replace("w","w#"),$="\\["+P+"*("+R+")"+P+"*(?:([*^$|!~]?=)"+P+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+W+")|)|)"+P+"*\\]",I=":("+R+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+$.replace(3,8)+")*)|.*)\\)|)",z=RegExp("^"+P+"+|((?:^|[^\\\\])(?:\\\\.)*)"+P+"+$","g"),X=RegExp("^"+P+"*,"+P+"*"),U=RegExp("^"+P+"*([>+~]|"+P+")"+P+"*"),V=RegExp(P+"*[+~]"),Y=RegExp("="+P+"*([^\\]'\"]*)"+P+"*\\]","g"),J=RegExp(I),G=RegExp("^"+W+"$"),Q={ID:RegExp("^#("+R+")"),CLASS:RegExp("^\\.("+R+")"),TAG:RegExp("^("+R.replace("w","w*")+")"),ATTR:RegExp("^"+$),PSEUDO:RegExp("^"+I),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+P+"*(even|odd|(([+-]|)(\\d*)n|)"+P+"*(?:([+-]|)"+P+"*(\\d+)|))"+P+"*\\)|)","i"),bool:RegExp("^(?:"+B+")$","i"),needsContext:RegExp("^"+P+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+P+"*((?:-\\d)?\\d*)"+P+"*\\)|)(?=[^-]|$)","i")},K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,et=/^(?:input|select|textarea|button)$/i,tt=/^h\d$/i,nt=/'|\\/g,rt=RegExp("\\\\([\\da-f]{1,6}"+P+"?|("+P+")|.)","ig"),it=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{M.apply(H=O.call(w.childNodes),w.childNodes),H[w.childNodes.length].nodeType}catch(ot){M={apply:H.length?function(e,t){_.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function at(e,t,n,i){var o,a,s,l,u,c,d,m,y,x;if((t?t.ownerDocument||t:w)!==f&&p(t),t=t||f,n=n||[],!e||"string"!=typeof e)return n;if(1!==(l=t.nodeType)&&9!==l)return[];if(h&&!i){if(o=Z.exec(e))if(s=o[1]){if(9===l){if(a=t.getElementById(s),!a||!a.parentNode)return n;if(a.id===s)return n.push(a),n}else if(t.ownerDocument&&(a=t.ownerDocument.getElementById(s))&&v(t,a)&&a.id===s)return n.push(a),n}else{if(o[2])return M.apply(n,t.getElementsByTagName(e)),n;if((s=o[3])&&r.getElementsByClassName&&t.getElementsByClassName)return M.apply(n,t.getElementsByClassName(s)),n}if(r.qsa&&(!g||!g.test(e))){if(m=d=b,y=t,x=9===l&&e,1===l&&"object"!==t.nodeName.toLowerCase()){c=mt(e),(d=t.getAttribute("id"))?m=d.replace(nt,"\\$&"):t.setAttribute("id",m),m="[id='"+m+"'] ",u=c.length;while(u--)c[u]=m+yt(c[u]);y=V.test(e)&&t.parentNode||t,x=c.join(",")}if(x)try{return M.apply(n,y.querySelectorAll(x)),n}catch(T){}finally{d||t.removeAttribute("id")}}}return kt(e.replace(z,"$1"),t,n,i)}function st(){var e=[];function t(n,r){return e.push(n+=" ")>o.cacheLength&&delete t[e.shift()],t[n]=r}return t}function lt(e){return e[b]=!0,e}function ut(e){var t=f.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ct(e,t){var n=e.split("|"),r=e.length;while(r--)o.attrHandle[n[r]]=t}function pt(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function ft(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function dt(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ht(e){return lt(function(t){return t=+t,lt(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}s=at.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},r=at.support={},p=at.setDocument=function(e){var n=e?e.ownerDocument||e:w,i=n.defaultView;return n!==f&&9===n.nodeType&&n.documentElement?(f=n,d=n.documentElement,h=!s(n),i&&i.attachEvent&&i!==i.top&&i.attachEvent("onbeforeunload",function(){p()}),r.attributes=ut(function(e){return e.className="i",!e.getAttribute("className")}),r.getElementsByTagName=ut(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),r.getElementsByClassName=ut(function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),r.getById=ut(function(e){return d.appendChild(e).id=b,!n.getElementsByName||!n.getElementsByName(b).length}),r.getById?(o.find.ID=function(e,t){if(typeof t.getElementById!==j&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){return e.getAttribute("id")===t}}):(delete o.find.ID,o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){var n=typeof e.getAttributeNode!==j&&e.getAttributeNode("id");return n&&n.value===t}}),o.find.TAG=r.getElementsByTagName?function(e,n){return typeof n.getElementsByTagName!==j?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},o.find.CLASS=r.getElementsByClassName&&function(e,n){return typeof n.getElementsByClassName!==j&&h?n.getElementsByClassName(e):t},m=[],g=[],(r.qsa=K.test(n.querySelectorAll))&&(ut(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||g.push("\\["+P+"*(?:value|"+B+")"),e.querySelectorAll(":checked").length||g.push(":checked")}),ut(function(e){var t=n.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&g.push("[*^$]="+P+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")})),(r.matchesSelector=K.test(y=d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ut(function(e){r.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),m.push("!=",I)}),g=g.length&&RegExp(g.join("|")),m=m.length&&RegExp(m.join("|")),v=K.test(d.contains)||d.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},A=d.compareDocumentPosition?function(e,t){if(e===t)return S=!0,0;var i=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t);return i?1&i||!r.sortDetached&&t.compareDocumentPosition(e)===i?e===n||v(w,e)?-1:t===n||v(w,t)?1:c?F.call(c,e)-F.call(c,t):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return S=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:c?F.call(c,e)-F.call(c,t):0;if(o===a)return pt(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?pt(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},n):f},at.matches=function(e,t){return at(e,null,null,t)},at.matchesSelector=function(e,t){if((e.ownerDocument||e)!==f&&p(e),t=t.replace(Y,"='$1']"),!(!r.matchesSelector||!h||m&&m.test(t)||g&&g.test(t)))try{var n=y.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(i){}return at(t,f,null,[e]).length>0},at.contains=function(e,t){return(e.ownerDocument||e)!==f&&p(e),v(e,t)},at.attr=function(e,n){(e.ownerDocument||e)!==f&&p(e);var i=o.attrHandle[n.toLowerCase()],a=i&&L.call(o.attrHandle,n.toLowerCase())?i(e,n,!h):t;return a===t?r.attributes||!h?e.getAttribute(n):(a=e.getAttributeNode(n))&&a.specified?a.value:null:a},at.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},at.uniqueSort=function(e){var t,n=[],i=0,o=0;if(S=!r.detectDuplicates,c=!r.sortStable&&e.slice(0),e.sort(A),S){while(t=e[o++])t===e[o]&&(i=n.push(o));while(i--)e.splice(n[i],1)}return e},a=at.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=a(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=a(t);return n},o=at.selectors={cacheLength:50,createPseudo:lt,match:Q,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(rt,it),e[3]=(e[4]||e[5]||"").replace(rt,it),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||at.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&at.error(e[0]),e},PSEUDO:function(e){var n,r=!e[5]&&e[2];return Q.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:r&&J.test(r)&&(n=mt(r,!0))&&(n=r.indexOf(")",r.length-n)-r.length)&&(e[0]=e[0].slice(0,n),e[2]=r.slice(0,n)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(rt,it).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=N[e+" "];return t||(t=RegExp("(^|"+P+")"+e+"("+P+"|$)"))&&N(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=at.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,l){var u,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!l&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[b]||(m[b]={}),u=c[e]||[],d=u[0]===T&&u[1],f=u[0]===T&&u[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[T,d,f];break}}else if(v&&(u=(t[b]||(t[b]={}))[e])&&u[0]===T)f=u[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[b]||(p[b]={}))[e]=[T,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=o.pseudos[e]||o.setFilters[e.toLowerCase()]||at.error("unsupported pseudo: "+e);return r[b]?r(t):r.length>1?(n=[e,e,"",t],o.setFilters.hasOwnProperty(e.toLowerCase())?lt(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=F.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:lt(function(e){var t=[],n=[],r=l(e.replace(z,"$1"));return r[b]?lt(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:lt(function(e){return function(t){return at(e,t).length>0}}),contains:lt(function(e){return function(t){return(t.textContent||t.innerText||a(t)).indexOf(e)>-1}}),lang:lt(function(e){return G.test(e||"")||at.error("unsupported lang: "+e),e=e.replace(rt,it).toLowerCase(),function(t){var n;do if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===f.activeElement&&(!f.hasFocus||f.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!o.pseudos.empty(e)},header:function(e){return tt.test(e.nodeName)},input:function(e){return et.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:ht(function(){return[0]}),last:ht(function(e,t){return[t-1]}),eq:ht(function(e,t,n){return[0>n?n+t:n]}),even:ht(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:ht(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:ht(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:ht(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}},o.pseudos.nth=o.pseudos.eq;for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})o.pseudos[n]=ft(n);for(n in{submit:!0,reset:!0})o.pseudos[n]=dt(n);function gt(){}gt.prototype=o.filters=o.pseudos,o.setFilters=new gt;function mt(e,t){var n,r,i,a,s,l,u,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,l=[],u=o.preFilter;while(s){(!n||(r=X.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),l.push(i=[])),n=!1,(r=U.exec(s))&&(n=r.shift(),i.push({value:n,type:r[0].replace(z," ")}),s=s.slice(n.length));for(a in o.filter)!(r=Q[a].exec(s))||u[a]&&!(r=u[a](r))||(n=r.shift(),i.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?at.error(e):k(e,l).slice(0)}function yt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function vt(e,t,n){var r=t.dir,o=n&&"parentNode"===r,a=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||o)return e(t,n,i)}:function(t,n,s){var l,u,c,p=T+" "+a;if(s){while(t=t[r])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[r])if(1===t.nodeType||o)if(c=t[b]||(t[b]={}),(u=c[r])&&u[0]===p){if((l=u[1])===!0||l===i)return l===!0}else if(u=c[r]=[p],u[1]=e(t,n,s)||i,u[1]===!0)return!0}}function bt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xt(e,t,n,r,i){var o,a=[],s=0,l=e.length,u=null!=t;for(;l>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),u&&t.push(s));return a}function wt(e,t,n,r,i,o){return r&&!r[b]&&(r=wt(r)),i&&!i[b]&&(i=wt(i,o)),lt(function(o,a,s,l){var u,c,p,f=[],d=[],h=a.length,g=o||Nt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:xt(g,f,e,s,l),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,l),r){u=xt(y,d),r(u,[],s,l),c=u.length;while(c--)(p=u[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){u=[],c=y.length;while(c--)(p=y[c])&&u.push(m[c]=p);i(null,y=[],u,l)}c=y.length;while(c--)(p=y[c])&&(u=i?F.call(o,p):f[c])>-1&&(o[u]=!(a[u]=p))}}else y=xt(y===a?y.splice(h,y.length):y),i?i(null,a,y,l):M.apply(a,y)})}function Tt(e){var t,n,r,i=e.length,a=o.relative[e[0].type],s=a||o.relative[" "],l=a?1:0,c=vt(function(e){return e===t},s,!0),p=vt(function(e){return F.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==u)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;i>l;l++)if(n=o.relative[e[l].type])f=[vt(bt(f),n)];else{if(n=o.filter[e[l].type].apply(null,e[l].matches),n[b]){for(r=++l;i>r;r++)if(o.relative[e[r].type])break;return wt(l>1&&bt(f),l>1&&yt(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(z,"$1"),n,r>l&&Tt(e.slice(l,r)),i>r&&Tt(e=e.slice(r)),i>r&&yt(e))}f.push(n)}return bt(f)}function Ct(e,t){var n=0,r=t.length>0,a=e.length>0,s=function(s,l,c,p,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,C=u,N=s||a&&o.find.TAG("*",d&&l.parentNode||l),k=T+=null==C?1:Math.random()||.1;for(w&&(u=l!==f&&l,i=n);null!=(h=N[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,l,c)){p.push(h);break}w&&(T=k,i=++n)}r&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,r&&b!==v){g=0;while(m=t[g++])m(x,y,l,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=q.call(p));y=xt(y)}M.apply(p,y),w&&!s&&y.length>0&&v+t.length>1&&at.uniqueSort(p)}return w&&(T=k,u=C),x};return r?lt(s):s}l=at.compile=function(e,t){var n,r=[],i=[],o=E[e+" "];if(!o){t||(t=mt(e)),n=t.length;while(n--)o=Tt(t[n]),o[b]?r.push(o):i.push(o);o=E(e,Ct(i,r))}return o};function Nt(e,t,n){var r=0,i=t.length;for(;i>r;r++)at(e,t[r],n);return n}function kt(e,t,n,i){var a,s,u,c,p,f=mt(e);if(!i&&1===f.length){if(s=f[0]=f[0].slice(0),s.length>2&&"ID"===(u=s[0]).type&&r.getById&&9===t.nodeType&&h&&o.relative[s[1].type]){if(t=(o.find.ID(u.matches[0].replace(rt,it),t)||[])[0],!t)return n;e=e.slice(s.shift().value.length)}a=Q.needsContext.test(e)?0:s.length;while(a--){if(u=s[a],o.relative[c=u.type])break;if((p=o.find[c])&&(i=p(u.matches[0].replace(rt,it),V.test(s[0].type)&&t.parentNode||t))){if(s.splice(a,1),e=i.length&&yt(s),!e)return M.apply(n,i),n;break}}}return l(e,f)(i,t,!h,n,V.test(e)),n}r.sortStable=b.split("").sort(A).join("")===b,r.detectDuplicates=S,p(),r.sortDetached=ut(function(e){return 1&e.compareDocumentPosition(f.createElement("div"))}),ut(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||ct("type|href|height|width",function(e,n,r){return r?t:e.getAttribute(n,"type"===n.toLowerCase()?1:2)}),r.attributes&&ut(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||ct("value",function(e,n,r){return r||"input"!==e.nodeName.toLowerCase()?t:e.defaultValue}),ut(function(e){return null==e.getAttribute("disabled")})||ct(B,function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&i.specified?i.value:e[n]===!0?n.toLowerCase():null}),x.find=at,x.expr=at.selectors,x.expr[":"]=x.expr.pseudos,x.unique=at.uniqueSort,x.text=at.getText,x.isXMLDoc=at.isXML,x.contains=at.contains}(e);var O={};function F(e){var t=O[e]={};return x.each(e.match(T)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e){e="string"==typeof e?O[e]||F(e):x.extend({},e);var n,r,i,o,a,s,l=[],u=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=l.length,n=!0;l&&o>a;a++)if(l[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,l&&(u?u.length&&c(u.shift()):r?l=[]:p.disable())},p={add:function(){if(l){var t=l.length;(function i(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this},remove:function(){return l&&x.each(arguments,function(e,t){var r;while((r=x.inArray(t,l,r))>-1)l.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?x.inArray(e,l)>-1:!(!l||!l.length)},empty:function(){return l=[],o=0,this},disable:function(){return l=u=r=t,this},disabled:function(){return!l},lock:function(){return u=t,r||p.disable(),this},locked:function(){return!u},fireWith:function(e,t){return!l||i&&!u||(t=t||[],t=[e,t.slice?t.slice():t],n?u.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var a=o[0],s=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=g.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?g.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,l,u;if(r>1)for(s=Array(r),l=Array(r),u=Array(r);r>t;t++)n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(a(t,u,n)).fail(o.reject).progress(a(t,l,s)):--i;return i||o.resolveWith(u,n),o.promise()}}),x.support=function(t){var n,r,o,s,l,u,c,p,f,d=a.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*")||[],r=d.getElementsByTagName("a")[0],!r||!r.style||!n.length)return t;s=a.createElement("select"),u=s.appendChild(a.createElement("option")),o=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==d.className,t.leadingWhitespace=3===d.firstChild.nodeType,t.tbody=!d.getElementsByTagName("tbody").length,t.htmlSerialize=!!d.getElementsByTagName("link").length,t.style=/top/.test(r.getAttribute("style")),t.hrefNormalized="/a"===r.getAttribute("href"),t.opacity=/^0.5/.test(r.style.opacity),t.cssFloat=!!r.style.cssFloat,t.checkOn=!!o.value,t.optSelected=u.selected,t.enctype=!!a.createElement("form").enctype,t.html5Clone="<:nav></:nav>"!==a.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,o.checked=!0,t.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!u.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}o=a.createElement("input"),o.setAttribute("value",""),t.input=""===o.getAttribute("value"),o.value="t",o.setAttribute("type","radio"),t.radioValue="t"===o.value,o.setAttribute("checked","t"),o.setAttribute("name","t"),l=a.createDocumentFragment(),l.appendChild(o),t.appendChecked=o.checked,t.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip;for(f in x(t))break;return t.ownLast="0"!==f,x(function(){var n,r,o,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",l=a.getElementsByTagName("body")[0];l&&(n=a.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",l.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",o=d.getElementsByTagName("td"),o[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===o[0].offsetHeight,o[0].style.display="",o[1].style.display="none",t.reliableHiddenOffsets=p&&0===o[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",x.swap(l,null!=l.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===d.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(a.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(l.style.zoom=1)),l.removeChild(n),n=d=o=r=null)}),n=s=l=u=r=o=null,t
4 }({});var B=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;function R(e,n,r,i){if(x.acceptData(e)){var o,a,s=x.expando,l=e.nodeType,u=l?x.cache:e,c=l?e[s]:e[s]&&s;if(c&&u[c]&&(i||u[c].data)||r!==t||"string"!=typeof n)return c||(c=l?e[s]=p.pop()||x.guid++:s),u[c]||(u[c]=l?{}:{toJSON:x.noop}),("object"==typeof n||"function"==typeof n)&&(i?u[c]=x.extend(u[c],n):u[c].data=x.extend(u[c].data,n)),a=u[c],i||(a.data||(a.data={}),a=a.data),r!==t&&(a[x.camelCase(n)]=r),"string"==typeof n?(o=a[n],null==o&&(o=a[x.camelCase(n)])):o=a,o}}function W(e,t,n){if(x.acceptData(e)){var r,i,o=e.nodeType,a=o?x.cache:e,s=o?e[x.expando]:x.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){x.isArray(t)?t=t.concat(x.map(t,x.camelCase)):t in r?t=[t]:(t=x.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;while(i--)delete r[t[i]];if(n?!I(r):!x.isEmptyObject(r))return}(n||(delete a[s].data,I(a[s])))&&(o?x.cleanData([e],!0):x.support.deleteExpando||a!=a.window?delete a[s]:a[s]=null)}}}x.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?x.cache[e[x.expando]]:e[x.expando],!!e&&!I(e)},data:function(e,t,n){return R(e,t,n)},removeData:function(e,t){return W(e,t)},_data:function(e,t,n){return R(e,t,n,!0)},_removeData:function(e,t){return W(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&x.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),x.fn.extend({data:function(e,n){var r,i,o=null,a=0,s=this[0];if(e===t){if(this.length&&(o=x.data(s),1===s.nodeType&&!x._data(s,"parsedAttrs"))){for(r=s.attributes;r.length>a;a++)i=r[a].name,0===i.indexOf("data-")&&(i=x.camelCase(i.slice(5)),$(s,i,o[i]));x._data(s,"parsedAttrs",!0)}return o}return"object"==typeof e?this.each(function(){x.data(this,e)}):arguments.length>1?this.each(function(){x.data(this,e,n)}):s?$(s,e,x.data(s,e)):null},removeData:function(e){return this.each(function(){x.removeData(this,e)})}});function $(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(P,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:B.test(r)?x.parseJSON(r):r}catch(o){}x.data(e,n,r)}else r=t}return r}function I(e){var t;for(t in e)if(("data"!==t||!x.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}x.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=x._data(e,n),r&&(!i||x.isArray(r)?i=x._data(e,n,x.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),o=x._queueHooks(e,t),a=function(){x.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return x._data(e,n)||x._data(e,n,{empty:x.Callbacks("once memory").add(function(){x._removeData(e,t+"queue"),x._removeData(e,n)})})}}),x.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?x.queue(this[0],e):n===t?this:this.each(function(){var t=x.queue(this,e,n);x._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&x.dequeue(this,e)})},dequeue:function(e){return this.each(function(){x.dequeue(this,e)})},delay:function(e,t){return e=x.fx?x.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=x.Deferred(),a=this,s=this.length,l=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=x._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(l));return l(),o.promise(n)}});var z,X,U=/[\t\r\n\f]/g,V=/\r/g,Y=/^(?:input|select|textarea|button|object)$/i,J=/^(?:a|area)$/i,G=/^(?:checked|selected)$/i,Q=x.support.getSetAttribute,K=x.support.input;x.fn.extend({attr:function(e,t){return x.access(this,x.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){x.removeAttr(this,e)})},prop:function(e,t){return x.access(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return e=x.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,l="string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).addClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=x.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,l=0===arguments.length||"string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?x.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):x.isFunction(e)?this.each(function(n){x(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var t,r=0,o=x(this),a=e.match(T)||[];while(t=a[r++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else(n===i||"boolean"===n)&&(this.className&&x._data(this,"__className__",this.className),this.className=this.className||e===!1?"":x._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(U," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=x.isFunction(e),this.each(function(n){var o;1===this.nodeType&&(o=i?e.call(this,n,x(this).val()):e,null==o?o="":"number"==typeof o?o+="":x.isArray(o)&&(o=x.map(o,function(e){return null==e?"":e+""})),r=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=x.valHooks[o.type]||x.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(V,""):null==n?"":n)}}}),x.extend({valHooks:{option:{get:function(e){var t=x.find.attr(e,"value");return null!=t?t:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,l=0>i?s:o?i:0;for(;s>l;l++)if(n=r[l],!(!n.selected&&l!==i||(x.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&x.nodeName(n.parentNode,"optgroup"))){if(t=x(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n,r,i=e.options,o=x.makeArray(t),a=i.length;while(a--)r=i[a],(r.selected=x.inArray(x(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,n,r){var o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return typeof e.getAttribute===i?x.prop(e,n,r):(1===s&&x.isXMLDoc(e)||(n=n.toLowerCase(),o=x.attrHooks[n]||(x.expr.match.bool.test(n)?X:z)),r===t?o&&"get"in o&&null!==(a=o.get(e,n))?a:(a=x.find.attr(e,n),null==a?t:a):null!==r?o&&"set"in o&&(a=o.set(e,r,n))!==t?a:(e.setAttribute(n,r+""),r):(x.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(T);if(o&&1===e.nodeType)while(n=o[i++])r=x.propFix[n]||n,x.expr.match.bool.test(n)?K&&Q||!G.test(n)?e[r]=!1:e[x.camelCase("default-"+n)]=e[r]=!1:x.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!x.isXMLDoc(e),a&&(n=x.propFix[n]||n,o=x.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var t=x.find.attr(e,"tabindex");return t?parseInt(t,10):Y.test(e.nodeName)||J.test(e.nodeName)&&e.href?0:-1}}}}),X={set:function(e,t,n){return t===!1?x.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&x.propFix[n]||n,n):e[x.camelCase("default-"+n)]=e[n]=!0,n}},x.each(x.expr.match.bool.source.match(/\w+/g),function(e,n){var r=x.expr.attrHandle[n]||x.find.attr;x.expr.attrHandle[n]=K&&Q||!G.test(n)?function(e,n,i){var o=x.expr.attrHandle[n],a=i?t:(x.expr.attrHandle[n]=t)!=r(e,n,i)?n.toLowerCase():null;return x.expr.attrHandle[n]=o,a}:function(e,n,r){return r?t:e[x.camelCase("default-"+n)]?n.toLowerCase():null}}),K&&Q||(x.attrHooks.value={set:function(e,n,r){return x.nodeName(e,"input")?(e.defaultValue=n,t):z&&z.set(e,n,r)}}),Q||(z={set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},x.expr.attrHandle.id=x.expr.attrHandle.name=x.expr.attrHandle.coords=function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&""!==i.value?i.value:null},x.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&r.specified?r.value:t},set:z.set},x.attrHooks.contenteditable={set:function(e,t,n){z.set(e,""===t?!1:t,n)}},x.each(["width","height"],function(e,n){x.attrHooks[n]={set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}}})),x.support.hrefNormalized||x.each(["href","src"],function(e,t){x.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),x.support.style||(x.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),x.support.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.support.enctype||(x.propFix.enctype="encoding"),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,n){return x.isArray(n)?e.checked=x.inArray(x(e).val(),n)>=0:t}},x.support.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}function at(){try{return a.activeElement}catch(e){}}x.event={global:{},add:function(e,n,r,o,a){var s,l,u,c,p,f,d,h,g,m,y,v=x._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=x.guid++),(l=v.events)||(l=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof x===i||e&&x.event.triggered===e.type?t:x.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(T)||[""],u=n.length;while(u--)s=rt.exec(n[u])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),g&&(p=x.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=x.event.special[g]||{},d=x.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&x.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=l[g])||(h=l[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),x.event.global[g]=!0);e=null}},remove:function(e,t,n,r,i){var o,a,s,l,u,c,p,f,d,h,g,m=x.hasData(e)&&x._data(e);if(m&&(c=m.events)){t=(t||"").match(T)||[""],u=t.length;while(u--)if(s=rt.exec(t[u])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=x.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),l=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));l&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||x.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)x.event.remove(e,d+t[u],n,r,!0);x.isEmptyObject(c)&&(delete m.handle,x._removeData(e,"events"))}},trigger:function(n,r,i,o){var s,l,u,c,p,f,d,h=[i||a],g=v.call(n,"type")?n.type:n,m=v.call(n,"namespace")?n.namespace.split("."):[];if(u=f=i=i||a,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+x.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),l=0>g.indexOf(":")&&"on"+g,n=n[x.expando]?n:new x.Event(g,"object"==typeof n&&n),n.isTrigger=o?2:3,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:x.makeArray(r,[n]),p=x.event.special[g]||{},o||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!o&&!p.noBubble&&!x.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(u=u.parentNode);u;u=u.parentNode)h.push(u),f=u;f===(i.ownerDocument||a)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((u=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(x._data(u,"events")||{})[n.type]&&x._data(u,"handle"),s&&s.apply(u,r),s=l&&u[l],s&&x.acceptData(u)&&s.apply&&s.apply(u,r)===!1&&n.preventDefault();if(n.type=g,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(h.pop(),r)===!1)&&x.acceptData(i)&&l&&i[g]&&!x.isWindow(i)){f=i[l],f&&(i[l]=null),x.event.triggered=g;try{i[g]()}catch(y){}x.event.triggered=t,f&&(i[l]=f)}return n.result}},dispatch:function(e){e=x.event.fix(e);var n,r,i,o,a,s=[],l=g.call(arguments),u=(x._data(this,"events")||{})[e.type]||[],c=x.event.special[e.type]||{};if(l[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=x.event.handlers.call(this,e,u),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((x.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,l),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],l=n.delegateCount,u=e.target;if(l&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(u.disabled!==!0||"click"!==e.type)){for(o=[],a=0;l>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?x(r,this).index(u)>=0:x.find(r,this,null,[u]).length),o[r]&&o.push(i);o.length&&s.push({elem:u,handlers:o})}return n.length>l&&s.push({elem:this,handlers:n.slice(l)}),s},fix:function(e){if(e[x.expando])return e;var t,n,r,i=e.type,o=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new x.Event(o),t=r.length;while(t--)n=r[t],e[n]=o[n];return e.target||(e.target=o.srcElement||a),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,o):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,o,s=n.button,l=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||a,o=i.documentElement,r=i.body,e.pageX=n.clientX+(o&&o.scrollLeft||r&&r.scrollLeft||0)-(o&&o.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(o&&o.scrollTop||r&&r.scrollTop||0)-(o&&o.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&l&&(e.relatedTarget=l===e.target?n.toElement:l),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==at()&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===at()&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},click:{trigger:function(){return x.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t},_default:function(e){return x.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?x.event.trigger(i,null,t):x.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},x.removeEvent=a.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},x.Event=function(e,n){return this instanceof x.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&x.extend(this,n),this.timeStamp=e&&e.timeStamp||x.now(),this[x.expando]=!0,t):new x.Event(e,n)},x.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},x.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){x.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!x.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),x.support.submitBubbles||(x.event.special.submit={setup:function(){return x.nodeName(this,"form")?!1:(x.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=x.nodeName(n,"input")||x.nodeName(n,"button")?n.form:t;r&&!x._data(r,"submitBubbles")&&(x.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),x._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&x.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return x.nodeName(this,"form")?!1:(x.event.remove(this,"._submit"),t)}}),x.support.changeBubbles||(x.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(x.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),x.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),x.event.simulate("change",this,e,!0)})),!1):(x.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!x._data(t,"changeBubbles")&&(x.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||x.event.simulate("change",this.parentNode,e,!0)}),x._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return x.event.remove(this,"._change"),!Z.test(this.nodeName)}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){x.event.simulate(t,e.target,x.event.fix(e),!0)};x.event.special[t]={setup:function(){0===n++&&a.addEventListener(e,r,!0)},teardown:function(){0===--n&&a.removeEventListener(e,r,!0)}}}),x.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return x().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=x.guid++)),this.each(function(){x.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,x(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){x.event.remove(this,e,r,n)})},trigger:function(e,t){return this.each(function(){x.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?x.event.trigger(e,n,r,!0):t}});var st=/^.[^:#\[\.,]*$/,lt=/^(?:parents|prev(?:Until|All))/,ut=x.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};x.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(x(e).filter(function(){for(t=0;i>t;t++)if(x.contains(r[t],this))return!0}));for(t=0;i>t;t++)x.find(e,r[t],n);return n=this.pushStack(i>1?x.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t,n=x(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(x.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e||[],!0))},filter:function(e){return this.pushStack(ft(this,e||[],!1))},is:function(e){return!!ft(this,"string"==typeof e&&ut.test(e)?x(e):e||[],!1).length},closest:function(e,t){var n,r=0,i=this.length,o=[],a=ut.test(e)||"string"!=typeof e?x(e,t||this.context):0;for(;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(11>n.nodeType&&(a?a.index(n)>-1:1===n.nodeType&&x.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?x.unique(o):o)},index:function(e){return e?"string"==typeof e?x.inArray(this[0],x(e)):x.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?x(e,t):x.makeArray(e&&e.nodeType?[e]:e),r=x.merge(this.get(),n);return this.pushStack(x.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return x.dir(e,"parentNode")},parentsUntil:function(e,t,n){return x.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return x.dir(e,"nextSibling")},prevAll:function(e){return x.dir(e,"previousSibling")},nextUntil:function(e,t,n){return x.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return x.dir(e,"previousSibling",n)},siblings:function(e){return x.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return x.sibling(e.firstChild)},contents:function(e){return x.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:x.merge([],e.childNodes)}},function(e,t){x.fn[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=x.filter(r,i)),this.length>1&&(ct[e]||(i=x.unique(i)),lt.test(e)&&(i=i.reverse())),this.pushStack(i)}}),x.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!x(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(x.isFunction(t))return x.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return x.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(st.test(t))return x.filter(t,e,n);t=x.filter(t,e)}return x.grep(e,function(e){return x.inArray(e,t)>=0!==n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w+;/,Tt=/<(?:script|style|link)/i,Ct=/^(?:checkbox|radio)$/i,Nt=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:x.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(a),Dt=jt.appendChild(a.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,x.fn.extend({text:function(e){return x.access(this,function(e){return e===t?x.text(this):this.empty().append((this[0]&&this[0].ownerDocument||a).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?x.filter(e,this):this,i=0;for(;null!=(n=r[i]);i++)t||1!==n.nodeType||x.cleanData(Ft(n)),n.parentNode&&(t&&x.contains(n.ownerDocument,n)&&_t(Ft(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&x.cleanData(Ft(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&x.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return x.clone(this,e,t)})},html:function(e){return x.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!x.support.htmlSerialize&&mt.test(e)||!x.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(x.cleanData(Ft(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=x.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),x(this).remove(),i.insertBefore(n,r))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=d.apply([],e);var r,i,o,a,s,l,u=0,c=this.length,p=this,f=c-1,h=e[0],g=x.isFunction(h);if(g||!(1>=c||"string"!=typeof h||x.support.checkClone)&&Nt.test(h))return this.each(function(r){var i=p.eq(r);g&&(e[0]=h.call(this,r,i.html())),i.domManip(e,t,n)});if(c&&(l=x.buildFragment(e,this[0].ownerDocument,!1,!n&&this),r=l.firstChild,1===l.childNodes.length&&(l=r),r)){for(a=x.map(Ft(l,"script"),Ht),o=a.length;c>u;u++)i=l,u!==f&&(i=x.clone(i,!0,!0),o&&x.merge(a,Ft(i,"script"))),t.call(this[u],i,u);if(o)for(s=a[a.length-1].ownerDocument,x.map(a,qt),u=0;o>u;u++)i=a[u],kt.test(i.type||"")&&!x._data(i,"globalEval")&&x.contains(s,i)&&(i.src?x._evalUrl(i.src):x.globalEval((i.text||i.textContent||i.innerHTML||"").replace(St,"")));l=r=null}return this}});function Lt(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function Ht(e){return e.type=(null!==x.find.attr(e,"type"))+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function _t(e,t){var n,r=0;for(;null!=(n=e[r]);r++)x._data(n,"globalEval",!t||x._data(t[r],"globalEval"))}function Mt(e,t){if(1===t.nodeType&&x.hasData(e)){var n,r,i,o=x._data(e),a=x._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)x.event.add(t,n,s[n][r])}a.data&&(a.data=x.extend({},a.data))}}function Ot(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!x.support.noCloneEvent&&t[x.expando]){i=x._data(t);for(r in i.events)x.removeEvent(t,r,i.handle);t.removeAttribute(x.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),x.support.html5Clone&&e.innerHTML&&!x.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Ct.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}x.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){x.fn[e]=function(e){var n,r=0,i=[],o=x(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),x(o[r])[t](n),h.apply(i,n.get());return this.pushStack(i)}});function Ft(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||x.nodeName(o,n)?s.push(o):x.merge(s,Ft(o,n));return n===t||n&&x.nodeName(e,n)?x.merge([e],s):s}function Bt(e){Ct.test(e.type)&&(e.defaultChecked=e.checked)}x.extend({clone:function(e,t,n){var r,i,o,a,s,l=x.contains(e.ownerDocument,e);if(x.support.html5Clone||x.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(x.support.noCloneEvent&&x.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||x.isXMLDoc(e)))for(r=Ft(o),s=Ft(e),a=0;null!=(i=s[a]);++a)r[a]&&Ot(i,r[a]);if(t)if(n)for(s=s||Ft(e),r=r||Ft(o),a=0;null!=(i=s[a]);a++)Mt(i,r[a]);else Mt(e,o);return r=Ft(o,"script"),r.length>0&&_t(r,!l&&Ft(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,l,u,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===x.type(o))x.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),l=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[l]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!x.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!x.support.tbody){o="table"!==l||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)x.nodeName(u=o.childNodes[i],"tbody")&&!u.childNodes.length&&o.removeChild(u)}x.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),x.support.appendChecked||x.grep(Ft(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===x.inArray(o,r))&&(a=x.contains(o.ownerDocument,o),s=Ft(f.appendChild(o),"script"),a&&_t(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,l=x.expando,u=x.cache,c=x.support.deleteExpando,f=x.event.special;for(;null!=(n=e[s]);s++)if((t||x.acceptData(n))&&(o=n[l],a=o&&u[o])){if(a.events)for(r in a.events)f[r]?x.event.remove(n,r):x.removeEvent(n,r,a.handle);
5 u[o]&&(delete u[o],c?delete n[l]:typeof n.removeAttribute!==i?n.removeAttribute(l):n[l]=null,p.push(o))}},_evalUrl:function(e){return x.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}}),x.fn.extend({wrapAll:function(e){if(x.isFunction(e))return this.each(function(t){x(this).wrapAll(e.call(this,t))});if(this[0]){var t=x(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return x.isFunction(e)?this.each(function(t){x(this).wrapInner(e.call(this,t))}):this.each(function(){var t=x(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=x.isFunction(e);return this.each(function(n){x(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){x.nodeName(this,"body")||x(this).replaceWith(this.childNodes)}).end()}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+w+")(.*)$","i"),Yt=RegExp("^("+w+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+w+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===x.css(e,"display")||!x.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=x._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=x._data(r,"olddisplay",ln(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&x._data(r,"olddisplay",i?n:x.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}x.fn.extend({css:function(e,n){return x.access(this,function(e,n,r){var i,o,a={},s=0;if(x.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=x.css(e,n[s],!1,o);return a}return r!==t?x.style(e,n,r):x.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){nn(this)?x(this).show():x(this).hide()})}}),x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":x.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,l=x.camelCase(n),u=e.style;if(n=x.cssProps[l]||(x.cssProps[l]=tn(u,l)),s=x.cssHooks[n]||x.cssHooks[l],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:u[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(x.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||x.cssNumber[l]||(r+="px"),x.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(u[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{u[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,l=x.camelCase(n);return n=x.cssProps[l]||(x.cssProps[l]=tn(e.style,l)),s=x.cssHooks[n]||x.cssHooks[l],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||x.isNumeric(o)?o||0:a):a}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s.getPropertyValue(n)||s[n]:t,u=e.style;return s&&(""!==l||x.contains(e.ownerDocument,e)||(l=x.style(e,n)),Yt.test(l)&&Ut.test(n)&&(i=u.width,o=u.minWidth,a=u.maxWidth,u.minWidth=u.maxWidth=u.width=l,l=s.width,u.width=i,u.minWidth=o,u.maxWidth=a)),l}):a.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s[n]:t,u=e.style;return null==l&&u&&u[n]&&(l=u[n]),Yt.test(l)&&!zt.test(n)&&(i=u.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),u.left="fontSize"===n?"1em":l,l=u.pixelLeft+"px",u.left=i,a&&(o.left=a)),""===l?"auto":l});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=x.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=x.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=x.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=x.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=x.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(x.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function ln(e){var t=a,n=Gt[e];return n||(n=un(e,t),"none"!==n&&n||(Pt=(Pt||x("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=un(e,t),Pt.detach()),Gt[e]=n),n}function un(e,t){var n=x(t.createElement(e)).appendTo(t.body),r=x.css(n[0],"display");return n.remove(),r}x.each(["height","width"],function(e,n){x.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(x.css(e,"display"))?x.swap(e,Qt,function(){return sn(e,n,i)}):sn(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,i),i):0)}}}),x.support.opacity||(x.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=x.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===x.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),x(function(){x.support.reliableMarginRight||(x.cssHooks.marginRight={get:function(e,n){return n?x.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!x.support.pixelPosition&&x.fn.position&&x.each(["top","left"],function(e,n){x.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?x(e).position()[n]+"px":r):t}}})}),x.expr&&x.expr.filters&&(x.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!x.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||x.css(e,"display"))},x.expr.filters.visible=function(e){return!x.expr.filters.hidden(e)}),x.each({margin:"",padding:"",border:"Width"},function(e,t){x.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+Zt[r]+t]=o[r]||o[r-2]||o[0];return i}},Ut.test(e)||(x.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|file)$/i,hn=/^(?:input|select|textarea|keygen)/i;x.fn.extend({serialize:function(){return x.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=x.prop(this,"elements");return e?x.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!x(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Ct.test(e))}).map(function(e,t){var n=x(this).val();return null==n?null:x.isArray(n)?x.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),x.param=function(e,n){var r,i=[],o=function(e,t){t=x.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=x.ajaxSettings&&x.ajaxSettings.traditional),x.isArray(e)||e.jquery&&!x.isPlainObject(e))x.each(e,function(){o(this.name,this.value)});else for(r in e)gn(r,e[r],n,o);return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var i;if(x.isArray(t))x.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==x.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}x.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){x.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),x.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var mn,yn,vn=x.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Cn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Nn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=x.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=o.href}catch(Ln){yn=a.createElement("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(T)||[];if(x.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function qn(e,n,r,i){var o={},a=e===jn;function s(l){var u;return o[l]=!0,x.each(e[l]||[],function(e,l){var c=l(n,r,i);return"string"!=typeof c||a||o[c]?a?!(u=c):t:(n.dataTypes.unshift(c),s(c),!1)}),u}return s(n.dataTypes[0])||!o["*"]&&s("*")}function _n(e,n){var r,i,o=x.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&x.extend(!0,e,r),e}x.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var i,o,a,s=this,l=e.indexOf(" ");return l>=0&&(i=e.slice(l,e.length),e=e.slice(0,l)),x.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&x.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?x("<div>").append(x.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},x.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){x.fn[t]=function(e){return this.on(t,e)}}),x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Cn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":x.parseJSON,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?_n(_n(e,x.ajaxSettings),t):_n(x.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,l,u,c,p=x.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?x(f):x.event,h=x.Deferred(),g=x.Callbacks("once memory"),m=p.statusCode||{},y={},v={},b=0,w="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return b||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>b)for(t in e)m[t]=[m[t],e[t]];else C.always(e[C.status]);return this},abort:function(e){var t=e||w;return u&&u.abort(t),k(0,t),this}};if(h.promise(C).complete=g.add,C.success=C.done,C.error=C.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=x.trim(p.dataType||"*").toLowerCase().match(T)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(mn[3]||("http:"===mn[1]?"80":"443")))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=x.param(p.data,p.traditional)),qn(An,p,n,C),2===b)return C;l=p.global,l&&0===x.active++&&x.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Nn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(x.lastModified[o]&&C.setRequestHeader("If-Modified-Since",x.lastModified[o]),x.etag[o]&&C.setRequestHeader("If-None-Match",x.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&C.setRequestHeader("Content-Type",p.contentType),C.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)C.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,C,p)===!1||2===b))return C.abort();w="abort";for(i in{success:1,error:1,complete:1})C[i](p[i]);if(u=qn(jn,p,n,C)){C.readyState=1,l&&d.trigger("ajaxSend",[C,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){C.abort("timeout")},p.timeout));try{b=1,u.send(y,k)}catch(N){if(!(2>b))throw N;k(-1,N)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,N=n;2!==b&&(b=2,s&&clearTimeout(s),u=t,a=i||"",C.readyState=e>0?4:0,c=e>=200&&300>e||304===e,r&&(w=Mn(p,C,r)),w=On(p,w,C,c),c?(p.ifModified&&(T=C.getResponseHeader("Last-Modified"),T&&(x.lastModified[o]=T),T=C.getResponseHeader("etag"),T&&(x.etag[o]=T)),204===e||"HEAD"===p.type?N="nocontent":304===e?N="notmodified":(N=w.state,y=w.data,v=w.error,c=!v)):(v=N,(e||!N)&&(N="error",0>e&&(e=0))),C.status=e,C.statusText=(n||N)+"",c?h.resolveWith(f,[y,N,C]):h.rejectWith(f,[C,N,v]),C.statusCode(m),m=t,l&&d.trigger(c?"ajaxSuccess":"ajaxError",[C,p,c?y:v]),g.fireWith(f,[C,N]),l&&(d.trigger("ajaxComplete",[C,p]),--x.active||x.event.trigger("ajaxStop")))}return C},getJSON:function(e,t,n){return x.get(e,t,n,"json")},getScript:function(e,n){return x.get(e,t,n,"script")}}),x.each(["get","post"],function(e,n){x[n]=function(e,r,i,o){return x.isFunction(r)&&(o=o||i,i=r,r=t),x.ajax({url:e,type:n,dataType:o,data:r,success:i})}});function Mn(e,n,r){var i,o,a,s,l=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in l)if(l[s]&&l[s].test(o)){u.unshift(s);break}if(u[0]in r)a=u[0];else{for(s in r){if(!u[0]||e.converters[s+" "+u[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==u[0]&&u.unshift(a),r[a]):t}function On(e,t,n,r){var i,o,a,s,l,u={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)u[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!l&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=o,o=c.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(a=u[l+" "+o]||u["* "+o],!a)for(i in u)if(s=i.split(" "),s[1]===o&&(a=u[l+" "+s[0]]||u["* "+s[0]])){a===!0?a=u[i]:u[i]!==!0&&(o=s[0],c.unshift(s[1]));break}if(a!==!0)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(p){return{state:"parsererror",error:a?p:"No conversion from "+l+" to "+o}}}return{state:"success",data:t}}x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),x.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=a.head||x("head")[0]||a.documentElement;return{send:function(t,i){n=a.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var Fn=[],Bn=/(=)\?(?=&|$)|\?\?/;x.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Fn.pop()||x.expando+"_"+vn++;return this[e]=!0,e}}),x.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,l=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return l||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=x.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,l?n[l]=n[l].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||x.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,Fn.push(o)),s&&x.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}x.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=x.ajaxSettings.xhr(),x.support.cors=!!Rn&&"withCredentials"in Rn,Rn=x.support.ajax=!!Rn,Rn&&x.ajaxTransport(function(n){if(!n.crossDomain||x.support.cors){var r;return{send:function(i,o){var a,s,l=n.xhr();if(n.username?l.open(n.type,n.url,n.async,n.username,n.password):l.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)l[s]=n.xhrFields[s];n.mimeType&&l.overrideMimeType&&l.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)l.setRequestHeader(s,i[s])}catch(u){}l.send(n.hasContent&&n.data||null),r=function(e,i){var s,u,c,p;try{if(r&&(i||4===l.readyState))if(r=t,a&&(l.onreadystatechange=x.noop,$n&&delete Pn[a]),i)4!==l.readyState&&l.abort();else{p={},s=l.status,u=l.getAllResponseHeaders(),"string"==typeof l.responseText&&(p.text=l.responseText);try{c=l.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,u)},n.async?4===l.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},x(e).unload($n)),Pn[a]=r),l.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+w+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Yn.exec(t),o=i&&i[3]||(x.cssNumber[e]?"":"px"),a=(x.cssNumber[e]||"px"!==o&&+r)&&Yn.exec(x.css(n.elem,e)),s=1,l=20;if(a&&a[3]!==o){o=o||a[3],i=i||[],a=+r||1;do s=s||".5",a/=s,x.style(n.elem,e,a+o);while(s!==(s=n.cur()/r)&&1!==s&&--l)}return i&&(a=n.start=+a||+r||0,n.unit=o,n.end=i[1]?a+(i[1]+1)*i[2]:+i[2]),n}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=x.now()}function Zn(e,t,n){var r,i=(Qn[t]||[]).concat(Qn["*"]),o=0,a=i.length;for(;a>o;o++)if(r=i[o].call(n,t,e))return r}function er(e,t,n){var r,i,o=0,a=Gn.length,s=x.Deferred().always(function(){delete l.elem}),l=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,u.startTime+u.duration-t),r=n/u.duration||0,o=1-r,a=0,l=u.tweens.length;for(;l>a;a++)u.tweens[a].run(o);return s.notifyWith(e,[u,o,n]),1>o&&l?n:(s.resolveWith(e,[u]),!1)},u=s.promise({elem:e,props:x.extend({},t),opts:x.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=x.Tween(e,u.opts,t,n,u.opts.specialEasing[t]||u.opts.easing);return u.tweens.push(r),r},stop:function(t){var n=0,r=t?u.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)u.tweens[n].run(1);return t?s.resolveWith(e,[u,t]):s.rejectWith(e,[u,t]),this}}),c=u.props;for(tr(c,u.opts.specialEasing);a>o;o++)if(r=Gn[o].call(u,e,c,u.opts))return r;return x.map(c,Zn,u),x.isFunction(u.opts.start)&&u.opts.start.call(e,u),x.fx.timer(x.extend(l,{elem:e,anim:u,queue:u.opts.queue})),u.progress(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always)}function tr(e,t){var n,r,i,o,a;for(n in e)if(r=x.camelCase(n),i=t[r],o=e[n],x.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),a=x.cssHooks[r],a&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}x.Animation=x.extend(er,{tweener:function(e,t){x.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,l,u=this,c={},p=e.style,f=e.nodeType&&nn(e),d=x._data(e,"fxshow");n.queue||(s=x._queueHooks(e,"fx"),null==s.unqueued&&(s.unqueued=0,l=s.empty.fire,s.empty.fire=function(){s.unqueued||l()}),s.unqueued++,u.always(function(){u.always(function(){s.unqueued--,x.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===x.css(e,"display")&&"none"===x.css(e,"float")&&(x.support.inlineBlockNeedsLayout&&"inline"!==ln(e.nodeName)?p.zoom=1:p.display="inline-block")),n.overflow&&(p.overflow="hidden",x.support.shrinkWrapBlocks||u.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],Vn.exec(i)){if(delete t[r],o=o||"toggle"===i,i===(f?"hide":"show"))continue;c[r]=d&&d[r]||x.style(e,r)}if(!x.isEmptyObject(c)){d?"hidden"in d&&(f=d.hidden):d=x._data(e,"fxshow",{}),o&&(d.hidden=!f),f?x(e).show():u.done(function(){x(e).hide()}),u.done(function(){var t;x._removeData(e,"fxshow");for(t in c)x.style(e,t,c[t])});for(r in c)a=Zn(f?d[r]:0,r,u),r in d||(d[r]=a.start,f&&(a.end=a.start,a.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}x.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(x.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?x.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=x.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[x.cssProps[e.prop]]||x.cssHooks[e.prop])?x.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},x.each(["toggle","show","hide"],function(e,t){var n=x.fn[t];x.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),x.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=x.isEmptyObject(e),o=x.speed(t,n,r),a=function(){var t=er(this,x.extend({},e),o);(i||x._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=x.timers,a=x._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&x.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=x._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=x.timers,a=r?r.length:0;for(n.finish=!0,x.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}x.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){x.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),x.speed=function(e,t,n){var r=e&&"object"==typeof e?x.extend({},e):{complete:n||!n&&t||x.isFunction(e)&&e,duration:e,easing:n&&t||t&&!x.isFunction(t)&&t};return r.duration=x.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in x.fx.speeds?x.fx.speeds[r.duration]:x.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){x.isFunction(r.old)&&r.old.call(this),r.queue&&x.dequeue(this,r.queue)},r},x.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},x.timers=[],x.fx=rr.prototype.init,x.fx.tick=function(){var e,n=x.timers,r=0;for(Xn=x.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||x.fx.stop(),Xn=t},x.fx.timer=function(e){e()&&x.timers.push(e)&&x.fx.start()},x.fx.interval=13,x.fx.start=function(){Un||(Un=setInterval(x.fx.tick,x.fx.interval))},x.fx.stop=function(){clearInterval(Un),Un=null},x.fx.speeds={slow:600,fast:200,_default:400},x.fx.step={},x.expr&&x.expr.filters&&(x.expr.filters.animated=function(e){return x.grep(x.timers,function(t){return e===t.elem}).length}),x.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){x.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,x.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},x.offset={setOffset:function(e,t,n){var r=x.css(e,"position");"static"===r&&(e.style.position="relative");var i=x(e),o=i.offset(),a=x.css(e,"top"),s=x.css(e,"left"),l=("absolute"===r||"fixed"===r)&&x.inArray("auto",[a,s])>-1,u={},c={},p,f;l?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),x.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(u.top=t.top-o.top+p),null!=t.left&&(u.left=t.left-o.left+f),"using"in t?t.using.call(e,u):i.css(u)}},x.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===x.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),x.nodeName(e[0],"html")||(n=e.offset()),n.top+=x.css(e[0],"borderTopWidth",!0),n.left+=x.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-x.css(r,"marginTop",!0),left:t.left-n.left-x.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||s;while(e&&!x.nodeName(e,"html")&&"static"===x.css(e,"position"))e=e.offsetParent;return e||s})}}),x.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);x.fn[e]=function(i){return x.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?x(a).scrollLeft():o,r?o:x(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return x.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}x.each({Height:"height",Width:"width"},function(e,n){x.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){x.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return x.access(this,function(n,r,i){var o;return x.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?x.css(n,r,s):x.style(n,r,i,s)},n,a?i:t,a,null)}})}),x.fn.size=function(){return this.length},x.fn.andSelf=x.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=x:(e.jQuery=e.$=x,"function"==typeof define&&define.amd&&define("jquery",[],function(){return x}))})(window);
4141 { margin-bottom: 1em;
4242 }
4343
44 .arglist
44 table.arglist
45 { border-top: 1px solid #888;
46 }
47
48 table.arglist td:nth-child(1)
4549 { font-style: italic;
46 }
47
48 table.arglist,table.paramlist td
50 font-weight: bold;
51 padding-right: 1em;
52 }
53
54 table.arglist td,table.paramlist td
4955 { vertical-align: top;
5056 }
5157
183183
184184
185185 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
186 \section{Type and mode declarations}
186 \section{Type, mode and determinism declaration headers}
187187 \label{sec:modes}
188188
189 The type and mode declaration header consists of one or more Prolog
190 terms. Each term describes a mode of the predicate. The syntax is
191 informally described below:
189 Many predicates can sensibly be called in different ways, e.g. with a
190 specific argument as input or as output. The header of the documentation
191 of a predicate consists of one or more \jargon{templates}, each
192 representing a specific way of calling the predicate.
193
194 A template can contain information about types, argument instantiation
195 patterns, determinism and more. The syntax is informally described below:
192196
193197 \begin{center}
194198 \begin{tabular}{lrl}
195199 \hline
196 <modedef> \isa <head>['//'] 'is' <determinism> \\
200 <template> \isa <head>['//'] 'is' <determinism> \\
197201 \ora <head>['//'] \\
198202 <determinism> \isa 'det' \\
199203 \ora 'semidet' \\
203207 <head> \isa <functor>'('<argspec> {',' <argspec>}')' \\
204208 \ora <functor> \\
205209 <argspec> \isa [<instantiation>]<argname>[':'<type>] \\
206 <instantiation> \isa '+' $\mid$ '-' $\mid$ '?' $\mid$ ':'
207 $\mid$ '@' $\mid$ '!' \\
210 <instantiation> \isa '++' $\mid$ '+' $\mid$ '-' $\mid$ '--' $\mid$ '?'
211 $\mid$ ':' $\mid$ '@' $\mid$ '!' \\
208212 <type> \isa <term> \\
209213 \hline
210214 \end{tabular}
233237 \end{tabular}
234238 \end{center}
235239
236 Instantiation patterns are:
240 The meanings of the \jargon{instantiation patterns} for individual
241 arguments are:
237242
238243 \begin{center}
239244 \begin{tabular}{l|p{0.7\linewidth}}
240245 \hline
241 + & Argument must be fully instantiated to a term that satisfies the
246 ++& Argument is ground at call-time, i.e., the argument does not contain a
247 variable anywhere. \\
248 + & Argument is fully instantiated at call-time, to a term that satisfies
249 the type. This is not necessarily \jargon{ground}, e.g., the term
250 \exam{[_]} is a \jargon{list}, although its only member is
251 unbound. \\
252 - & Argument is an \emph{output} argument. It may be unbound at call-time,
253 or it may be bound to a term. In the latter case, the predicate behaves
254 as if the argument was unbound, and then unified with that term after
255 the goal succeeds.
256 For example, the goal \exam{findall(X, Goal, [T])} is good style and
257 equivalent to \exam{findall(X, Goal, Xs), Xs = [T]}\footnote{The
258 ISO standard dictates that \exam{findall(X, Goal, 1)} raises a
259 \const{type_error} exception, breaking this semantic relation.
260 SWI-Prolog does not follow the standard here.} Determinism
261 declarations assume that the argument is a free variable at call-time.
262 For the case where the argument is bound or involved in constraints,
263 \const{det} effectively becomes \const{semidet}, and \const{multi}
264 effectively becomes \const{nondet}.\\
265 --& Argument is unbound at call-time. Typically used by predicates that
266 create `something' and return a handle to the created object,
267 such as open/3 which creates a \jargon{stream}. \\
268 ? & Argument is bound to a \emph{partial term} of the indicated
269 type at call-time. Note that a variable is a partial term for any
242270 type. \\
243 - & Argument must be unbound. \\
244 ? & Argument must be bound to a \emph{partial term} of the indicated
245 type. Note that a variable is a partial term for any type. \\
246271 : & Argument is a meta-argument. Implies \chr{+}. \\
247 @ & Argument is not further instantiated. \\
272 @ & Argument will not be further instantiated than it is at call-time.
273 Typically used for type tests. \\
248274 ! & Argument contains a mutable structure that may be modified using
249275 setarg/3 or nb_setarg/3. \\
250276 \hline
251277 \end{tabular}
252278 \end{center}
253279
254 In the current version types are represented by an arbitrary term
280 Users should be aware that calling a predicate with arguments instantiated
281 in a way other than specified by one of the templates may result in errors or
282 unexpected behavior.
283
284 Developers should ensure that predicates are \jargon{steadfast} with respect to
285 output arguments (marked - in the template). This means that instantiation of
286 output arguments at call-time does not change the semantics of the goal (it may
287 be used for optimization, though). If this steadfast behavior cannot be
288 guaranteed, -- should be used instead.
289
290 In the current version, argument \jargon{types} are represented by an arbitrary term
255291 without formal semantics. In future versions we may adopt a formal type
256292 system that allows for runtime verification and static type analysis
257293 \cite{DBLP:conf/cl/Hermenegildo00,DBLP:journals/ai/MycroftO84,DBLP:conf/acsc/JefferyHS00}
215215 comments</span></a></div>
216216 <div class="toc-h2"><a class="sec" href="#sec:4"><span class="sec-nr">4</span> <span class="sec-title">File
217217 (module) comments</span></a></div>
218 <div class="toc-h2"><a class="sec" href="#sec:5"><span class="sec-nr">5</span> <span class="sec-title">Type
219 and mode declarations</span></a></div>
218 <div class="toc-h2"><a class="sec" href="#sec:5"><span class="sec-nr">5</span> <span class="sec-title">Type,
219 mode and determinism declaration headers</span></a></div>
220220 <div class="toc-h2"><a class="sec" href="#sec:6"><span class="sec-nr">6</span> <span class="sec-title">Tags: <code>@</code>see,
221221 etc.</span></a></div>
222222 <div class="toc-h2"><a class="sec" href="#sec:7"><span class="sec-nr">7</span> <span class="sec-title">Wiki
394394 */
395395 </pre>
396396
397 <p><h2 id="sec:modes"><a name="sec:5"><span class="sec-nr">5</span> <span class="sec-title">Type
398 and mode declarations</span></a></h2>
397 <p><h2 id="sec:modes"><a name="sec:5"><span class="sec-nr">5</span> <span class="sec-title">Type,
398 mode and determinism declaration headers</span></a></h2>
399399
400400 <a name="sec:modes"></a>
401401
402 <p>The type and mode declaration header consists of one or more Prolog
403 terms. Each term describes a mode of the predicate. The syntax is
404 informally described below:
402 <p>Many predicates can sensibly be called in different ways, e.g. with a
403 specific argument as input or as output. The header of the documentation
404 of a predicate consists of one or more <em>templates</em>, each
405 representing a specific way of calling the predicate.
406
407 <p>A template can contain information about types, argument
408 instantiation patterns, determinism and more. The syntax is informally
409 described below:
405410
406411 <p><table border="2" frame="hsides" rules="groups" style="margin:auto">
407 <tr valign="top"><td>&lt;<var>modedef</var>&gt; </td><td align=right>::=</td><td>&lt;<var>head</var>&gt;['//']
412 <tr valign="top"><td>&lt;<var>template</var>&gt; </td><td align=right>::=</td><td>&lt;<var>head</var>&gt;['//']
408413 'is' &lt;<var>determinism</var>&gt; </td></tr>
409414 <tr valign="top"><td></td><td align=right>|</td><td>&lt;<var>head</var>&gt;['//'] </td></tr>
410415 <tr valign="top"><td>&lt;<var>determinism</var>&gt; </td><td align=right>::=</td><td>'det' </td></tr>
416421 ',' &lt;<var>argspec</var>&gt;')' </td></tr>
417422 <tr valign="top"><td></td><td align=right>|</td><td>&lt;<var>functor</var>&gt; </td></tr>
418423 <tr valign="top"><td>&lt;<var>argspec</var>&gt; </td><td align=right>::=</td><td>[&lt;<var>instantiation</var>&gt;]&lt;<var>argname</var>&gt;[':'&lt;type&gt;] </td></tr>
419 <tr valign="top"><td>&lt;<var>instantiation</var>&gt; </td><td align=right>::=</td><td>'+' <var>|</var>
420 '-' <var>|</var> '?' <var>|</var> ':'
421 <var>|</var> '@' <var>|</var> '!' </td></tr>
424 <tr valign="top"><td>&lt;<var>instantiation</var>&gt; </td><td align=right>::=</td><td>'++' <var>|</var>
425 '+' <var>|</var> '-' <var>|</var> '--' <var>|</var> '?'
426 <var>|</var> ':' <var>|</var> '@' <var>|</var> '!' </td></tr>
422427 <tr valign="top"><td>&lt;<var>type</var>&gt; </td><td align=right>::=</td><td>&lt;<var>term</var>&gt; </td></tr>
423428 </table>
424429
445450 but succeeds at least one time. </td></tr>
446451 </table>
447452
448 <p>Instantiation patterns are:
453 <p>The meanings of the <em>instantiation patterns</em> for individual
454 arguments are:
449455
450456 <p><table border="2" frame="hsides" rules="groups" style="margin:auto">
451 <tr valign="top"><td>+</td><td>Argument must be fully instantiated to a
452 term that satisfies the type. </td></tr>
453 <tr valign="top"><td>-</td><td>Argument must be unbound. </td></tr>
454 <tr valign="top"><td>?</td><td>Argument must be bound to a <em>partial
455 term</em> of the indicated type. Note that a variable is a partial term
456 for any type. </td></tr>
457 <tr valign="top"><td>++</td><td>Argument is ground at call-time, i.e.,
458 the argument does not contain a variable anywhere. </td></tr>
459 <tr valign="top"><td>+</td><td>Argument is fully instantiated at
460 call-time, to a term that satisfies the type. This is not necessarily <em>ground</em>,
461 e.g., the term
462 <code>[_]</code> is a <em>list</em>, although its only member is
463 unbound. </td></tr>
464 <tr valign="top"><td>-</td><td>Argument is an <em>output</em> argument.
465 It may be unbound at call-time, or it may be bound to a term. In the
466 latter case, the predicate behaves as if the argument was unbound, and
467 then unified with that term after the goal succeeds. For example, the
468 goal <code>findall(X, Goal, [T])</code> is good style and equivalent to <code>findall(X,
469 Goal, Xs), Xs = [T]</code><sup class="fn">3<span class="fn-text">The ISO
470 standard dictates that <code>findall(X, Goal, 1)</code> raises a <code>type_error</code>
471 exception, breaking this semantic relation. SWI-Prolog does not follow
472 the standard here.</span></sup> Determinism declarations assume that the
473 argument is a free variable at call-time. For the case where the
474 argument is bound or involved in constraints,
475 <code>det</code> effectively becomes <code>semidet</code>, and <code>multi</code>
476 effectively becomes <code>nondet</code>.</td></tr>
477 <tr valign="top"><td>--</td><td>Argument is unbound at call-time.
478 Typically used by predicates that create `something' and return a handle
479 to the created object, such as <a name="idx:open3:2"></a><span class="pred-ext">open/3</span>
480 which creates a <em>stream</em>. </td></tr>
481 <tr valign="top"><td>?</td><td>Argument is bound to a <em>partial term</em>
482 of the indicated type at call-time. Note that a variable is a partial
483 term for any type. </td></tr>
457484 <tr valign="top"><td>:</td><td>Argument is a meta-argument. Implies <code><code>+</code></code>. </td></tr>
458 <tr valign="top"><td>@</td><td>Argument is not further instantiated. </td></tr>
485 <tr valign="top"><td>@</td><td>Argument will not be further instantiated
486 than it is at call-time. Typically used for type tests. </td></tr>
459487 <tr valign="top"><td>!</td><td>Argument contains a mutable structure
460488 that may be modified using
461 <a name="idx:setarg3:2"></a><span class="pred-ext">setarg/3</span> or <a name="idx:nbsetarg3:3"></a><span class="pred-ext">nb_setarg/3</span>. </td></tr>
489 <a name="idx:setarg3:3"></a><span class="pred-ext">setarg/3</span> or <a name="idx:nbsetarg3:4"></a><span class="pred-ext">nb_setarg/3</span>. </td></tr>
462490 </table>
463491
464 <p>In the current version types are represented by an arbitrary term
465 without formal semantics. In future versions we may adopt a formal type
466 system that allows for runtime verification and static type analysis
492 <p>Users should be aware that calling a predicate with arguments
493 instantiated in a way other than specified by one of the templates may
494 result in errors or unexpected behavior.
495
496 <p>Developers should ensure that predicates are <em>steadfast</em> with
497 respect to output arguments (marked - in the template). This means that
498 instantiation of output arguments at call-time does not change the
499 semantics of the goal (it may be used for optimization, though). If this
500 steadfast behavior cannot be guaranteed, -- should be used instead.
501
502 <p>In the current version, argument <em>types</em> are represented by an
503 arbitrary term without formal semantics. In future versions we may adopt
504 a formal type system that allows for runtime verification and static
505 type analysis
467506 <cite><a class="cite" href="#DBLP:conf/cl/Hermenegildo00">Hermenegildo,
468507 2000</a>, <a class="cite" href="#DBLP:journals/ai/MycroftO84">Mycroft &amp;
469508 O'Keefe, 1984</a>, <a class="cite" href="#DBLP:conf/acsc/JefferyHS00">Jeffery <em>et
658697 <code>#</code> must be followed by blank space. If the header is
659698 underlined, the underline is a line that only contains <code><code>=</code></code>
660699 or
661 <code><code>-</code></code> characters. There must be a minimum of three<sup class="fn">3<span class="fn-text">Markdown
700 <code><code>-</code></code> characters. There must be a minimum of three<sup class="fn">4<span class="fn-text">Markdown
662701 demands two, but this results in ambiguities with the <code><code>==</code></code>
663702 fence for code blocks.</span></sup> of such characters.
664703
828867 <p>In addition, compound terms in canonical notation (i.e.,
829868 <i>functor</i><code>(</code>,<i>...args...</i><code>)</code> that can be
830869 parsed are first verified as a file-specification for
831 <a name="idx:absolutefilename3:4"></a><span class="pred-ext">absolute_file_name/3</span>
870 <a name="idx:absolutefilename3:5"></a><span class="pred-ext">absolute_file_name/3</span>
832871 and otherwise rendered as <em>code</em>.
833872
834873 <p><h4 id="sec:pldoc-links"><a name="sec:7.2.3"><span class="sec-nr">7.2.3</span> <span class="sec-title">Links</span></a></h4>
851890 is one of <code>http</code>, <code>https</code> or <code>ftp</code>,
852891 create a link. </td></tr>
853892 <tr valign="top"><td><code><code><code>&lt;</code></code>url<code><code>&gt;</code></code> </code></td><td>Create
854 a hyperlink to URL. This construct supports the <a name="idx:expandurlpath2:5"></a><span class="pred-ext">expand_url_path/2</span>
893 a hyperlink to URL. This construct supports the <a name="idx:expandurlpath2:6"></a><span class="pred-ext">expand_url_path/2</span>
855894 using the construct
856895 &lt;<var>alias</var>&gt;:&lt;<var>local</var>&gt;. &lt;<var>local</var>&gt;
857896 can be empty. </td></tr>
873912
874913 <p>Images can be included in the documentation by referencing an image
875914 file using one of the extensions <code>.gif</code>, <code>.png</code>,
876 <code>.jpeg</code>, <code>.jpg</code> or <code>.svg</code>.<sup class="fn">4<span class="fn-text">SVG
915 <code>.jpeg</code>, <code>.jpg</code> or <code>.svg</code>.<sup class="fn">5<span class="fn-text">SVG
877916 images are included using the <code>object</code> element. This is
878917 supported by many modern browsers. When using IE, one needs at least
879918 IE9.</span></sup> By default this creates a link to the image file that
9621001 <dt class="pubdef"><a name="doc_collect/1"><strong>doc_collect</strong>(<var>+Bool</var>)</a></dt>
9631002 <dd class="defbody">
9641003 Enable/disable collecting structured comments into the Prolog database.
965 See <a name="idx:docserver1:6"></a><a class="pred" href="#doc_server/1">doc_server/1</a>
966 or <a name="idx:docbrowser0:7"></a><a class="pred" href="#doc_browser/0">doc_browser/0</a>
1004 See <a name="idx:docserver1:7"></a><a class="pred" href="#doc_server/1">doc_server/1</a>
1005 or <a name="idx:docbrowser0:8"></a><a class="pred" href="#doc_browser/0">doc_browser/0</a>
9671006 for the normal way to deploy the server in your application. All these
9681007 predicates must be called
9691008 <em>before</em> loading your program.</dd>
9721011 Start documentation server at <var>Port</var>. Same as
9731012 <code>doc_server(Port, [allow(localhost), workers(1)])</code>. This
9741013 predicate must be called <em>before</em> loading the program for which
975 you consult the documentation. It calls <a name="idx:doccollect1:8"></a><a class="pred" href="#doc_collect/1">doc_collect/1</a>
1014 you consult the documentation. It calls <a name="idx:doccollect1:9"></a><a class="pred" href="#doc_collect/1">doc_collect/1</a>
9761015 to start collecting documentation while (re-)loading your program.</dd>
9771016 <dt class="pubdef"><a name="doc_server/2"><strong>doc_server</strong>(<var>?Port,
9781017 +Options</var>)</a></dt>
10001039 Allow connections from <var>HostOrIP</var>. If <var>Host</var> is an
10011040 atom starting with a '.', suffix matching is preformed. I.e. <code>allow('.uva.nl')</code>
10021041 grants access to all machines in this domain. IP addresses are specified
1003 using the library(socket) <a name="idx:ip4:9"></a><span class="pred-ext">ip/4</span>
1042 using the library(socket) <a name="idx:ip4:10"></a><span class="pred-ext">ip/4</span>
10041043 term. I.e. to allow access from the 10.0.0.X domain, specify
10051044 <code>allow(ip(10,0,0,_))</code>.</dd>
10061045 <dt><strong>deny</strong>(<var>+HostOrIP</var>)</dt>
10261065 <dt class="pubdef"><a name="doc_browser/1"><strong>doc_browser</strong>(<var>+Spec</var>)</a></dt>
10271066 <dd class="defbody">
10281067 Open the user's default browser on the specified page. <var>Spec</var>
1029 is handled similar to <a name="idx:edit1:10"></a><span class="pred-ext">edit/1</span>,
1068 is handled similar to <a name="idx:edit1:11"></a><span class="pred-ext">edit/1</span>,
10301069 resolving anything that relates somehow to the given specification and
10311070 ask the user to select.<sup class="fn">bug<span class="fn-text">This
10321071 flexibility is not yet implemented</span></sup>.
10381077
10391078 <a name="sec:manserver"></a>
10401079
1041 <p>The library <code>library(pldoc/doc_library)</code> defines <a name="idx:docloadlibrary0:11"></a><a class="pred" href="#doc_load_library/0">doc_load_library/0</a>
1080 <p>The library <code>library(pldoc/doc_library)</code> defines <a name="idx:docloadlibrary0:12"></a><a class="pred" href="#doc_load_library/0">doc_load_library/0</a>
10421081 to load the entire library.
10431082
10441083 <dl class="latex">
10661105 <a name="sec:browser"></a>
10671106
10681107 <p>The documentation system is normally accessed from a web-browser
1069 after starting the server using <a name="idx:docserver1:12"></a><a class="pred" href="#doc_server/1">doc_server/1</a>.
1108 after starting the server using <a name="idx:docserver1:13"></a><a class="pred" href="#doc_server/1">doc_server/1</a>.
10701109 This section briefly explains the user-interface provided from the
10711110 browser.
10721111
11191158 the user can select to view both public and documentated private
11201159 predicates. Using the <b>source</b> button, the system shows the source
11211160 with syntax highlighting as in PceEmacs and formatted structured
1122 comments.<sup class="fn">5<span class="fn-text">This mode is still
1161 comments.<sup class="fn">6<span class="fn-text">This mode is still
11231162 incomplete. It would be nice to add line-numbers and links to
11241163 documentation and definitions in the sources.</span></sup>
11251164
11421181
11431182 <p>If the browser is accessed from <code>localhost</code>, each object
11441183 that is related to a known source-location has an edit icon at the right
1145 side. Clicking this calls <a name="idx:edit1:13"></a><span class="pred-ext">edit/1</span>
1184 side. Clicking this calls <a name="idx:edit1:14"></a><span class="pred-ext">edit/1</span>
11461185 on the object, calling the user's default editor in the file. To use the
11471186 built-in PceEmacs editor, either set the Prolog flag <code>editor</code>
11481187 to <code>pce_emacs</code> or run <code>?- emacs.</code> before clicking
15381577 <dt class="index-sep">?</dt>
15391578 <dt>absolute_file_name/3</dt>
15401579 <dd>
1541 <a class="idx" href="#idx:absolutefilename3:4">7.2.2</a></dd>
1580 <a class="idx" href="#idx:absolutefilename3:5">7.2.2</a></dd>
15421581 <dt>catch/3</dt>
15431582 <dd>
15441583 <a class="idx" href="#idx:catch3:1">5</a></dd>
15451584 <dt><a class="idx" href="#doc_browser/0">doc_browser/0</a></dt>
15461585 <dd>
1547 <a class="idx" href="#idx:docbrowser0:7">10.1</a></dd>
1586 <a class="idx" href="#idx:docbrowser0:8">10.1</a></dd>
15481587 <dt><a class="idx" href="#doc_browser/1">doc_browser/1</a></dt>
15491588 <dt><a class="idx" href="#doc_collect/1">doc_collect/1</a></dt>
15501589 <dd>
1551 <a class="idx" href="#idx:doccollect1:8">10.1</a></dd>
1590 <a class="idx" href="#idx:doccollect1:9">10.1</a></dd>
15521591 <dt><a class="idx" href="#doc_latex/3">doc_latex/3</a></dt>
15531592 <dt><a class="idx" href="#doc_load_library/0">doc_load_library/0</a></dt>
15541593 <dd>
1555 <a class="idx" href="#idx:docloadlibrary0:11">10.2</a></dd>
1594 <a class="idx" href="#idx:docloadlibrary0:12">10.2</a></dd>
15561595 <dt><a class="idx" href="#doc_pack/1">doc_pack/1</a></dt>
15571596 <dt><a class="idx" href="#doc_save/2">doc_save/2</a></dt>
15581597 <dt><a class="idx" href="#doc_server/1">doc_server/1</a></dt>
15591598 <dd>
1560 <a class="idx" href="#idx:docserver1:6">10.1</a> <a class="idx" href="#idx:docserver1:12">10.3</a></dd>
1599 <a class="idx" href="#idx:docserver1:7">10.1</a> <a class="idx" href="#idx:docserver1:13">10.3</a></dd>
15611600 <dt><a class="idx" href="#doc_server/2">doc_server/2</a></dt>
15621601 <dt>edit/1</dt>
15631602 <dd>
1564 <a class="idx" href="#idx:edit1:10">10.1</a> <a class="idx" href="#idx:edit1:13">10.3.3</a></dd>
1603 <a class="idx" href="#idx:edit1:11">10.1</a> <a class="idx" href="#idx:edit1:14">10.3.3</a></dd>
15651604 <dt>expand_url_path/2</dt>
15661605 <dd>
1567 <a class="idx" href="#idx:expandurlpath2:5">7.2.3</a></dd>
1606 <a class="idx" href="#idx:expandurlpath2:6">7.2.3</a></dd>
15681607 <dt>ip/4</dt>
15691608 <dd>
1570 <a class="idx" href="#idx:ip4:9">10.1</a></dd>
1609 <a class="idx" href="#idx:ip4:10">10.1</a></dd>
15711610 <dt><a class="idx" href="#latex_for_file/3">latex_for_file/3</a></dt>
15721611 <dt><a class="idx" href="#latex_for_predicates/3">latex_for_predicates/3</a></dt>
15731612 <dt><a class="idx" href="#latex_for_wiki_file/3">latex_for_wiki_file/3</a></dt>
15741613 <dt>nb_setarg/3</dt>
15751614 <dd>
1576 <a class="idx" href="#idx:nbsetarg3:3">5</a></dd>
1615 <a class="idx" href="#idx:nbsetarg3:4">5</a></dd>
1616 <dt>open/3</dt>
1617 <dd>
1618 <a class="idx" href="#idx:open3:2">5</a></dd>
15771619 <dt>setarg/3</dt>
15781620 <dd>
1579 <a class="idx" href="#idx:setarg3:2">5</a></dd>
1621 <a class="idx" href="#idx:setarg3:3">5</a></dd>
15801622 </dl>
15811623
15821624 </body></html>
Binary diff not shown
Binary diff not shown
5656 }
5757
5858
59 inline wint_t
59 static wint_t
6060 fetch(const text *txt, int i)
6161 { return txt->a ? (wint_t)txt->a[i] : (wint_t)txt->w[i];
6262 }
177177 static int check_predicate_cloud(predicate_cloud *c);
178178 static void invalidate_is_leaf(predicate *p, query *q, int add);
179179 static void create_triple_hashes(rdf_db *db, int count, int *ic);
180 static void free_literal_value(rdf_db *db, literal *lit);
181 static void finalize_graph(void *g, void *db);
180182
181183
182184 /*******************************
22872289
22882290 static int
22892291 init_graph_table(rdf_db *db)
2290 { size_t bytes = sizeof(graph**)*INITIAL_PREDICATE_TABLE_SIZE;
2292 { size_t bytes = sizeof(graph**)*INITIAL_GRAPH_TABLE_SIZE;
22912293 graph **p = PL_malloc_uncollectable(bytes);
2292 int i, count = INITIAL_PREDICATE_TABLE_SIZE;
2294 int i, count = INITIAL_GRAPH_TABLE_SIZE;
22932295
22942296 memset(p, 0, bytes);
22952297 for(i=0; i<MSB(count); i++)
22982300 db->graphs.bucket_count = count;
22992301 db->graphs.bucket_count_epoch = count;
23002302 db->graphs.count = 0;
2303 db->graphs.erased = 0;
23012304
23022305 return TRUE;
23032306 }
23802383 { graph *g, **gp;
23812384 int entry;
23822385
2383 if ( (g=existing_graph(db, name)) )
2386 if ( (g=existing_graph(db, name)) && !g->erased )
23842387 return g;
23852388
23862389 LOCK_MISC(db);
24292432 }
24302433 }
24312434
2432 db->graphs.count = 0;
2433 db->last_graph = NULL;
2435 db->graphs.count = 0;
2436 db->graphs.erased = 0;
2437 db->last_graph = NULL;
2438 }
2439
2440
2441 static int
2442 gc_graphs(rdf_db *db, gen_t gen)
2443 { int reclaimed = 0;
2444
2445 if ( db->graphs.erased > 10 + db->graphs.count/2 )
2446 { int i;
2447
2448 LOCK_MISC(db);
2449 for(i=0; i<db->graphs.bucket_count; i++)
2450 { graph *p, *n, *g;
2451
2452 p = NULL;
2453 g = db->graphs.blocks[MSB(i)][i];
2454
2455 for( ; g; g = n )
2456 { n = g->next;
2457
2458 if ( g->erased && g->triple_count == 0 )
2459 { if ( p )
2460 p->next = g->next;
2461 else
2462 db->graphs.blocks[MSB(i)][i] = g->next;
2463
2464 if ( db->last_graph == g )
2465 db->last_graph = NULL;
2466 db->graphs.count--;
2467 db->graphs.erased--;
2468 reclaimed++;
2469 deferred_finalize(&db->defer_all, g,
2470 finalize_graph, db);
2471 } else
2472 p = g;
2473 }
2474 }
2475 UNLOCK_MISC(db);
2476 }
2477
2478 return reclaimed;
24342479 }
24352480
24362481
24692514 if ( db->last_graph && db->last_graph->name == ID_ATOM(t->graph_id) )
24702515 { src = db->last_graph;
24712516 } else
2472 { src = lookup_graph(db, ID_ATOM(t->graph_id));
2473 db->last_graph = src;
2474 }
2475
2476 ATOMIC_SUB(&src->triple_count, 1);
2517 { src = existing_graph(db, ID_ATOM(t->graph_id));
2518 }
2519
2520 if ( src )
2521 { ATOMIC_SUB(&src->triple_count, 1);
24772522 #ifdef WITH_MD5
2478 if ( src->md5 )
2479 { md5_byte_t digest[16];
2480 md5_triple(t, digest);
2481 dec_digest(src->digest, digest);
2482 }
2523 if ( src->md5 )
2524 { md5_byte_t digest[16];
2525 md5_triple(t, digest);
2526 dec_digest(src->digest, digest);
2527 }
24832528 #endif
2529 }
24842530 }
24852531
24862532
26572703 }
26582704
26592705
2706 static void
2707 clean_atom(atom_t *ap)
2708 { atom_t old;
2709
2710 if ( (old=*ap) )
2711 { *ap = 0;
2712 PL_unregister_atom(old);
2713 }
2714 }
2715
2716
2717 static void
2718 finalize_graph(void *mem, void *clientdata)
2719 { graph *g = mem;
2720 (void)clientdata;
2721
2722 clean_atom(&g->name);
2723 }
2724
2725
26602726 static foreign_t
26612727 rdf_destroy_graph(term_t graph_name)
26622728 { atom_t gn;
26672733 return FALSE;
26682734
26692735 if ( (g = existing_graph(db, gn)) )
2670 { atom_t a;
2671
2672 LOCK_MISC(db);
2673 if ( (a=g->source) )
2674 { g->source = 0;
2675 PL_unregister_atom(a);
2676 }
2736 { LOCK_MISC(db);
26772737 memset(g->digest, 0, sizeof(g->digest));
26782738 memset(g->unmodified_digest, 0, sizeof(g->unmodified_digest));
2739 clean_atom(&g->source);
26792740 g->modified = 0.0;
26802741 g->erased = TRUE;
2742 db->graphs.erased++;
26812743 UNLOCK_MISC(db);
26822744 }
26832745
27742836
27752837
27762838 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2777 FIXME: rdf_broadcast(EV_OLD_LITERAL,...) happens with the literal lock
2778 helt. Needs better merging with free_literal() to reduce locking and
2779 avoid this problem.
2839 free_literal_value() gets rid of atoms or term that forms the value of
2840 the literal. We cannot dispose of these immediately as they might be
2841 needed by an ongoing scan of the literal skiplist for comparison.
2842 Therefore, we use deferred_finalize() and dispose of the triple later.
2843
2844 Return TRUE if the triple value could be distroyed and FALSE if the
2845 destruction has been deferred. That will eventually call
2846 finalize_literal_ptr(), which calls free_literal_value() again, but now
2847 as not shared literal so it can do its work unconditionally.
27802848 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
27812849
2782 static int
2783 free_literal_value(rdf_db *db, literal *lit)
2784 { int rc = TRUE;
2785
2786 if ( lit->shared && !db->resetting )
2850 static void
2851 finalize_literal_ptr(void *mem, void *clientdata)
2852 { literal **litp = mem;
2853 rdf_db *db = clientdata;
2854 literal *lit = *litp;
2855
2856 free_literal_value(db, lit);
2857 rdf_free(db, lit, sizeof(*lit));
2858 }
2859
2860
2861 static literal **
2862 unlink_literal(rdf_db *db, literal *lit)
2863 { if ( lit->shared && !db->resetting )
27872864 { literal_ex lex;
27882865 literal **data;
27892866
27902867 lit->shared = FALSE;
2791 rc = rdf_broadcast(EV_OLD_LITERAL, lit, NULL);
27922868 DEBUG(2,
27932869 Sdprintf("Delete %p from literal table: ", lit);
27942870 print_literal(lit);
27982874 prepare_literal_ex(&lex);
27992875
28002876 if ( (data=skiplist_delete(&db->literals, &lex)) )
2801 { unlock_atoms_literal(lit);
2802
2803 deferred_free(&db->defer_literals, data); /* someone else may be reading */
2877 { return data;
28042878 } else
28052879 { Sdprintf("Failed to delete %p (size=%ld): ", lit, db->literals.count);
28062880 print_literal(lit);
28072881 Sdprintf("\n");
28082882 assert(0);
28092883 }
2810 } else
2811 { unlock_atoms_literal(lit);
2812 }
2813
2884 }
2885
2886 return NULL;
2887 }
2888
2889
2890 static void
2891 free_literal_value(rdf_db *db, literal *lit)
2892 { unlock_atoms_literal(lit);
28142893 if ( lit->objtype == OBJ_TERM &&
28152894 lit->value.term.record )
28162895 { if ( lit->term_loaded )
28182897 else
28192898 PL_erase_external(lit->value.term.record);
28202899 }
2821
2822 return rc;
2900 lit->objtype = OBJ_UNTYPED; /* debugging: trap errors early */
28232901 }
28242902
28252903
28382916 if ( lit->shared )
28392917 { simpleMutexLock(&db->locks.literal);
28402918 if ( --lit->references == 0 )
2841 { rc = free_literal_value(db, lit);
2919 { literal **data = unlink_literal(db, lit);
28422920 simpleMutexUnlock(&db->locks.literal);
28432921
2844 rdf_free(db, lit, sizeof(*lit));
2922 if ( data ) /* unlinked */
2923 { rc = rdf_broadcast(EV_OLD_LITERAL, lit, NULL);
2924 deferred_finalize(&db->defer_literals, data,
2925 finalize_literal_ptr, db);
2926 } else
2927 { free_literal_value(db, lit);
2928 rdf_free(db, lit, sizeof(*lit));
2929 }
28452930 } else
28462931 { simpleMutexUnlock(&db->locks.literal);
28472932 }
28482933 } else /* not shared; no locking needed */
28492934 { if ( --lit->references == 0 )
2850 { rc = free_literal_value(db, lit);
2851
2935 { free_literal_value(db, lit);
28522936 rdf_free(db, lit, sizeof(*lit));
28532937 }
28542938 }
30173101 #endif
30183102 { literal_ex *lex = p1;
30193103
3104 assert(l2->objtype != OBJ_UNTYPED);
30203105 return compare_literals(lex, l2);
30213106 }
30223107 }
38973982 DEBUG(10, Sdprintf("RDF GC; gen = %s\n", gen_name(gen, buf)));
38983983 if ( optimize_triple_hashes(db, gen) >= 0 &&
38993984 gc_hashes(db, gen, reindex_gen) >= 0 &&
3900 gc_clouds(db, gen) >= 0 )
3985 gc_clouds(db, gen) >= 0 &&
3986 gc_graphs(db, gen) >= 0 )
39013987 { db->gc.count++;
39023988 db->gc.last_gen = gen;
39033989 db->gc.last_reindex_gen = reindex_gen;
255255 size_t bucket_count; /* Allocated #buckets */
256256 size_t bucket_count_epoch; /* Initial bucket count */
257257 size_t count; /* Total #predicates */
258 size_t erased; /* erased and not reclaimed graphs */
258259 } graph_hash_table;
259260
260261 typedef struct literal
179179 cache(boolean),
180180 concurrent(positive_integer),
181181 db(atom),
182 format(oneof([xml,triples,turtle])),
182 format(oneof([xml,triples,turtle,trig,nquads,ntriples])),
183183 graph(atom),
184184 if(oneof([true,changed,not_loaded])),
185185 modified(-float),
13561356 %% rdf_set_predicate(+Predicate, +Property) is det.
13571357 %
13581358 % Define a property of the predicate. This predicate currently
1359 % supports the properties =symmetric=, =inverse_of= and
1360 % =transitive= as defined with rdf_predicate_property/2. Adding an
1361 % A inverse_of B also adds B inverse_of A. An inverse relation is
1362 % deleted using inverse_of([]).
1359 % supports the following properties:
1360 %
1361 % - symmetric(+Boolean)
1362 % Set/unset the predicate as being symmetric. Using
1363 % symmetric(true) is the same as inverse_of(Predicate),
1364 % i.e., creating a predicate that is the inverse of
1365 % itself.
1366 % - transitive(+Boolean)
1367 % Sets the transitive property.
1368 % - inverse_of(+Predicate2)
1369 % Define Predicate as the inverse of Predicate2. An inverse
1370 % relation is deleted using inverse_of([]).
1371 %
1372 % The `transitive` property is currently not used. The `symmetric`
1373 % and `inverse_of` properties are considered by rdf_has/3,4 and
1374 % rdf_reachable/3.
1375 %
1376 % @tbd Maintain these properties based on OWL triples.
13631377
13641378
13651379 /*******************************
6969 error:has_type(rdf_format, Term):-
7070 error:has_type(oneof([nquads,ntriples,rdfa,trig,turtle,xml]), Term).
7171
72 %% rdf_extra_headers(-List)
72 %% rdf_extra_headers(-RequestHeaders:list(compound), +Options:list) is det.
7373 %
7474 % Send extra headers with the request. Note that, although we also
7575 % process RDF embedded in HTML, we do not explicitely ask for it.
7676 % Doing so causes some (e.g., http://w3.org/2004/02/skos/core to
7777 % reply with the HTML description rather than the RDF).
78 %
79 % When given, option format(+atom) is used in order to prioritize
80 % the corresponding RDF content types.
7881
7982 rdf_extra_headers([ cert_verify_hook(ssl_verify),
8083 request_header('Accept'=AcceptValue)
825825 retractall(map_building(stem, _)))).
826826
827827 stem_literal_tokens(Literal, StemMap) :-
828 rdf_tokenize_literal(Literal, Tokens),
828 rdf_tokenize_literal(Literal, Tokens), !,
829829 sort(Tokens, Tokens1),
830830 text_of(Literal, Lang, _Text),
831831 insert_tokens_stem(Tokens1, Lang, StemMap).
832 stem_literal_tokens(_,_).
832833
833834 insert_tokens_stem([], _, _).
834835 insert_tokens_stem([Token|T], Lang, Map) :-
13721372 +Property</var>)</a></dt>
13731373 <dd class="defbody">
13741374 Define a property of the predicate. This predicate currently supports
1375 the properties <code>symmetric</code>, <code>inverse_of</code> and
1376 <code>transitive</code> as defined with <a class="pred" href="#rdf_predicate_property/2">rdf_predicate_property/2</a>.
1377 Adding an A inverse_of B also adds B inverse_of A. An inverse relation
1378 is deleted using <code>inverse_of([])</code>.</dd>
1375 the following properties:
1376
1377 <dl class="latex">
1378 <dt><strong>symmetric</strong>(<var>+Boolean</var>)</dt>
1379 <dd class="defbody">
1380 Set/unset the predicate as being symmetric. Using
1381 <code>symmetric(true)</code> is the same as <code>inverse_of(Predicate)</code>,
1382 i.e., creating a predicate that is the inverse of itself.
1383 </dd>
1384 <dt><strong>transitive</strong>(<var>+Boolean</var>)</dt>
1385 <dd class="defbody">
1386 Sets the transitive property.
1387 </dd>
1388 <dt><strong>inverse_of</strong>(<var>+Predicate2</var>)</dt>
1389 <dd class="defbody">
1390 Define <var>Predicate</var> as the inverse of <var>Predicate2</var>. An
1391 inverse relation is deleted using <code>inverse_of([])</code>.
1392 </dd>
1393 </dl>
1394
1395 <p>The <code>transitive</code> property is currently not used. The <code>symmetric</code>
1396 and <code>inverse_of</code> properties are considered by <a class="pred" href="#rdf_has/3">rdf_has/3</a>,4
1397 and
1398 <a class="pred" href="#rdf_reachable/3">rdf_reachable/3</a>.
1399
1400 <dl class="tags">
1401 <dt class="tag">To be done</dt>
1402 <dd>
1403 Maintain these properties based on OWL triples.
1404 </dd>
1405 </dl>
1406
1407 </dd>
13791408 <dt class="pubdef"><a name="rdf_predicate_property/2"><strong>rdf_predicate_property</strong>(<var>?Predicate,
13801409 ?Property</var>)</a></dt>
13811410 <dd class="defbody">
Binary diff not shown
3939 :- use_module(library(rdf)).
4040 :- use_module(library(semweb/rdf_turtle)).
4141 :- use_module(library(option)).
42 :- use_module(library(sandbox)).
4342
4443 /** <module> SPARQL client library
4544
495494 * SANDBOX *
496495 *******************************/
497496
497 :- multifile
498 sandbox:safe_primitive/1.
499
498500 sandbox:safe_primitive(sparql_client:sparql_query(_,_,_)).
Binary diff not shown
379379
380380 load_structure(Spec, DOM, Options) :-
381381 Options = M:Plain,
382 ( select_option(encoding(Encoding), Options, NoEnc)
382 ( select_option(encoding(Encoding), Plain, NoEnc)
383383 -> ( sgml_encoding(Encoding)
384384 -> merge_options(Plain, [type(binary)], OpenOptions),
385385 SGMLOptions = Options
4040
4141 /* Define to 1 if you have the <inttypes.h> header file. */
4242 #undef HAVE_INTTYPES_H
43
44 /* Define if Security/Security.h supplies kSecClass */
45 #undef HAVE_KSECCLASS
4346
4447 /* Define to 1 if you have the `crypt32' library (-lcrypt32). */
4548 #undef HAVE_LIBCRYPT32
133136 /* Define to 1 if you have the ANSI C header files. */
134137 #undef STDC_HEADERS
135138
139 /* Location of the system certificate file */
140 #undef SYSTEM_CACERT_FILENAME
141
136142 /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
137143 significant byte first (like Motorola and SPARC, unlike Intel). */
138144 #if defined AC_APPLE_UNIVERSAL_BUILD
45064506
45074507 done
45084508
4509 { $as_echo "$as_me:${as_lineno-$LINENO}: checking kSecClass" >&5
4510 $as_echo_n "checking kSecClass... " >&6; }
4511 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
4512 /* end confdefs.h. */
4513 #include <sys/types.h>
4514 #include <Security/Security.h>
4515
4516 int
4517 main ()
4518 {
4519 const void *key = kSecClass;
4520
4521 ;
4522 return 0;
4523 }
4524 _ACEOF
4525 if ac_fn_c_try_compile "$LINENO"; then :
4526
4527 $as_echo "#define HAVE_KSECCLASS 1" >>confdefs.h
4528
4529 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
4530 $as_echo "yes" >&6; }
4531 else
4532 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
4533 $as_echo "no" >&6; }
4534 fi
4535 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
45094536
45104537 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lcrypto" >&5
45114538 $as_echo_n "checking for main in -lcrypto... " >&6; }
46924719
46934720 fi
46944721
4722
4723 { $as_echo "$as_me:${as_lineno-$LINENO}: checking system certificate file" >&5
4724 $as_echo_n "checking system certificate file... " >&6; }
4725 SYSTEM_CACERT_FILENAME=/etc/ssl/certs/ca-certificates.crt
4726 cert_candidates="/etc/ssl/certs/ca-certificates.crt"
4727 cert_candidates+=" /etc/pki/tls/certs/ca-bundle.crt"
4728 cert_candidates+=" /etc/ssl/ca-bundle.pem"
4729
4730 for f in $cert_candidates; do
4731 if test -f $f; then
4732 SYSTEM_CACERT_FILENAME=$f
4733 break
4734 fi
4735 done
4736
4737 cat >>confdefs.h <<_ACEOF
4738 #define SYSTEM_CACERT_FILENAME "$SYSTEM_CACERT_FILENAME"
4739 _ACEOF
4740
4741 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SYSTEM_CACERT_FILENAME" >&5
4742 $as_echo "$SYSTEM_CACERT_FILENAME" >&6; }
46954743
46964744 PLTARGETS=`echo $TARGETS | sed "s/4pl\.$SO/.pl/g"`
46974745
2020 esac
2121
2222 AC_CHECK_HEADERS(unistd.h fcntl.h Security/Security.h)
23 AC_MSG_CHECKING(kSecClass)
24 AC_TRY_COMPILE(
25 [ #include <sys/types.h>
26 #include <Security/Security.h>
27 ],
28 [ const void *key = kSecClass;
29 ], AC_DEFINE(HAVE_KSECCLASS, 1,
30 [Define if Security/Security.h supplies kSecClass])
31 AC_MSG_RESULT(yes),
32 AC_MSG_RESULT(no))
2333
2434 AC_CHECK_LIB(crypto, main)
2535 AC_CHECK_LIB(ssl, SSL_library_init)
5868
5969 AC_CHECK_TYPES(CRYPTO_THREADID)
6070
71 AC_MSG_CHECKING(system certificate file)
72 SYSTEM_CACERT_FILENAME=/etc/ssl/certs/ca-certificates.crt
73 cert_candidates="/etc/ssl/certs/ca-certificates.crt"
74 cert_candidates+=" /etc/pki/tls/certs/ca-bundle.crt"
75 cert_candidates+=" /etc/ssl/ca-bundle.pem"
76
77 for f in $cert_candidates; do
78 if test -f $f; then
79 SYSTEM_CACERT_FILENAME=$f
80 break
81 fi
82 done
83 AC_DEFINE_UNQUOTED(SYSTEM_CACERT_FILENAME, "$SYSTEM_CACERT_FILENAME",
84 [Location of the system certificate file])
85 AC_MSG_RESULT($SYSTEM_CACERT_FILENAME)
86
6187 PLTARGETS=`echo $TARGETS | sed "s/4pl\.$SO/.pl/g"`
6288
6389 AC_OUTPUT(Makefile)
551551 <i>SystemRootCertificates</i> key chain. The Apple API for this requires
552552 the SSL interface to be compiled with an XCode compiler, i.e., <b>not</b>
553553 with native gcc.
554 <li>Otherwise, certificates are loaded from the file
555 <code>/etc/ssl/certs/ca-certificates.crt</code>. This location is the
556 default on Linux.
554 <li>Otherwise, certificates are loaded from a file defined by the Prolog
555 flag <code>system_cacert_filename</code>. The initial value of this flag
556 is operating system dependent. For security reasons, the flag can only
557 be set prior to using the SSL library. For example:
558
559 <pre class="code">
560 :- use_module(library(ssl)).
561 :- set_prolog_flag(system_cacert_filename,
562 '/home/jan/ssl/ca-bundle.crt').
563 </pre>
564
565 <p>
557566 </ul>
558567 </dd>
559568 <dt class="pubdef"><span class="pred-tag">[det]</span><a name="load_private_key/3"><strong>load_private_key</strong>(<var>+Stream,
Binary diff not shown
315315 % _SystemRootCertificates_ key chain. The Apple API
316316 % for this requires the SSL interface to be compiled
317317 % with an XCode compiler, i.e., *not* with native gcc.
318 % - Otherwise, certificates are loaded from the file
319 % =|/etc/ssl/certs/ca-certificates.crt|=. This
320 % location is the default on Linux.
318 % - Otherwise, certificates are loaded from a file defined
319 % by the Prolog flag `system_cacert_filename`. The initial
320 % value of this flag is operating system dependent. For
321 % security reasons, the flag can only be set prior to using
322 % the SSL library. For example:
323 %
324 % ==
325 % :- use_module(library(ssl)).
326 % :- set_prolog_flag(system_cacert_filename,
327 % '/home/jan/ssl/ca-bundle.crt').
328 % ==
321329
322330 %% load_private_key(+Stream, +Password, -PrivateKey) is det.
323331 %
18091809
18101810
18111811 install_t
1812 install_ssl4pl()
1812 install_ssl4pl(void)
18131813 { ATOM_server = PL_new_atom("server");
18141814 ATOM_client = PL_new_atom("client");
18151815 ATOM_password = PL_new_atom("password");
18941894
18951895 PL_set_prolog_flag("ssl_library_version", PL_ATOM,
18961896 SSLeay_version(SSLEAY_VERSION));
1897 PL_set_prolog_flag("system_cacert_filename", PL_ATOM,
1898 SYSTEM_CACERT_FILENAME);
18971899 }
18981900
18991901 install_t
1900 uninstall_ssl4pl()
1902 uninstall_ssl4pl(void)
19011903 { ssl_lib_exit();
19021904 }
3838 #include <windows.h>
3939 #include <wincrypt.h>
4040 #endif
41 #ifdef HAVE_SECURITY_SECURITY_H /*__APPLE__*/
41 #if defined(HAVE_SECURITY_SECURITY_H) && defined(HAVE_KSECCLASS) /*__APPLE__*/
4242 #include <Security/Security.h>
43 #else
44 #undef HAVE_SECURITY_SECURITY_H
4345 #endif
4446 #define perror(x) Sdprintf("%s: %s\n", x, strerror(errno));
4547
10811083 }
10821084 }
10831085
1086
1087 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1088 Extract the system certificate file from the Prolog flag
1089 system_cacert_filename
1090 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
1091
1092 static const char *
1093 system_cacert_filename(void)
1094 { fid_t fid;
1095 static char *cacert_filename = NULL;
1096
1097 if ( !cacert_filename )
1098 { if ( (fid = PL_open_foreign_frame()) )
1099 { term_t av = PL_new_term_refs(2);
1100 PL_put_atom_chars(av+0, "system_cacert_filename");
1101
1102 if ( PL_call_predicate(NULL, PL_Q_NORMAL,
1103 PL_predicate("current_prolog_flag", 2, "system"),
1104 av) )
1105 { char *s;
1106
1107 if ( PL_get_atom_chars(av+1, &s) )
1108 { char *old = cacert_filename;
1109 cacert_filename = strdup(s);
1110 free(old);
1111 }
1112 }
1113
1114 PL_close_foreign_frame(fid);
1115 }
1116 }
1117
1118 return cacert_filename;
1119 }
1120
1121
1122
10841123 static X509_list *
10851124 ssl_system_verify_locations(void)
10861125 { X509_list *head=NULL, *tail=NULL;
10871126 int ok = TRUE;
1127 const char *cacert_filename;
10881128
10891129 #ifdef __WINDOWS__
10901130 HCERTSTORE hSystemStore;
11531193 CFRelease(keychain);
11541194 }
11551195 #else
1156 #ifdef SYSTEM_CACERT_FILENAME
1157 X509 *cert = NULL;
1158 FILE *cafile = fopen(SYSTEM_CACERT_FILENAME, "rb");
1159 if (cafile != NULL)
1160 { while ((cert = PEM_read_X509(cafile, NULL, NULL, NULL)) != NULL)
1161 { if ( !list_add_X509(cert, &head, &tail) )
1162 { ok = FALSE;
1163 break;
1196 if ( (cacert_filename = system_cacert_filename()) )
1197 { X509 *cert = NULL;
1198 FILE *cafile = fopen(cacert_filename, "rb");
1199
1200 ssl_deb(1, "cacert_filename = %s\n", cacert_filename);
1201
1202 if ( cafile != NULL )
1203 { while ((cert = PEM_read_X509(cafile, NULL, NULL, NULL)) != NULL)
1204 { if ( !list_add_X509(cert, &head, &tail) )
1205 { ok = FALSE;
1206 break;
1207 }
11641208 }
1165 }
1166 fclose(cafile);
1167 }
1168 #endif
1209 fclose(cafile);
1210 }
1211 }
11691212 #endif
11701213
11711214 if ( ok )
2525 #include "../clib/nonblockio.h"
2626
2727 #define SSL_CONFIG_MAGIC 0x539dbe3a
28 #ifndef SYSTEM_CACERT_FILENAME
2829 #define SYSTEM_CACERT_FILENAME "/etc/ssl/certs/ca-certificates.crt"
30 #endif
2931
3032 typedef int BOOL;
3133 #ifndef TRUE
00 #!/bin/bash
11
2 export PATH=$HOME/bin:$HOME/Qt5.1.1/5.1.1/clang_64/bin:$PATH
3 swipl=$HOME/bin/swipl
2 export PATH=$HOME/stable/bin:$HOME/Qt5.1.1/5.1.1/clang_64/bin:$PATH
3 swipl=$HOME/stable/bin/swipl
44 app=swipl-win.app
55
66 copy_files=true
Binary diff not shown
0 /* $Id$
1
2 Part of SWI-Prolog
0 /* Part of SWI-Prolog
31
42 Author: Jan Wielemaker
5 E-mail: jan@swi.psy.uva.nl
3 E-mail: J.Wielemaker@vu.nl
64 WWW: http://www.swi-prolog.org
7 Copyright (C): 1985-2002, University of Amsterdam
5 Copyright (C): 1985-2015, University of Amsterdam
6 VU University Amsterdam
87
98 This program is free software; you can redistribute it and/or
109 modify it under the terms of the GNU General Public License
4342 % anything that can be converted into a pixmap object, notably any
4443 % XPCE graphical object.
4544 %
46 % Currently the only option recognised is content_type(+Type) to
47 % specify the type. image/jpeg and image/gif are the only sensible
48 % values. The default is to generate gif.
45 % Currently the only option recognised is content_type(+Type) to
46 % specify the type. image/jpeg and image/gif are the only sensible
47 % values. The default is to generate gif.
4948 %
5049 % If this module is used as a server on X11-based systems the user
51 % must ensure the presence of an X11 server. The XPCE library
50 % must ensure the presence of an X11 server. The XPCE library
5251 % 'Xserver' provides code to start a `head-less' (i.e. server that
53 % doesn't need a physical display) server and adjust the
52 % doesn't need a physical display) server and adjust the
5453 % environment to make XPCE use this server.
54
55 % (*) Note that this code uses a text_buffer as intermediate for the
56 % data. this is pretty dubious as binary data is not well supported this
57 % way. It still works, but only when using newline(posix) for Windows.
5558
5659 reply_image(Image, Options) :-
5760 ( memberchk(content_type(Type), Options)
6568 send(Pixmap, save, TB, ImgType),
6669 format('Content-type: ~w~n~n', [Type]),
6770 pce_open(TB, read, Data),
71 set_stream(Data, newline(posix)), % (*)
6872 copy_stream_data(Data, current_output),
6973 close(Data),
7074 free(TB),
6969 nextBucketSize(int n)
7070 { int m;
7171
72 for(m=2; m<n; m<<=1);
73 return m;
72 for(m=2; m<n; m<<=1)
73 ;
74 return m;
7475 }
7576 #endif
7677
430431
431432 for(n=size, s=ht->symbols; n-- > 0; s++)
432433 if ( s->name )
433 *q++ = *s;
434 *q++ = *s;
434435
435436 for(n=valInt(ht->size), q=symbols; n-- > 0; q++)
436437 if ( (nonObject(q->name) || !isFreedObj(q->name)) &&
457458
458459 for(n=size, s=ht->symbols; n-- > 0; s++)
459460 if ( s->name )
460 *q++ = *s;
461 *q++ = *s;
461462
462463 for(n=valInt(ht->size), q=symbols; n-- > 0; q++)
463464 if ( (nonObject(q->name) || !isFreedObj(q->name)) &&
112112 int
113113 ar_times(NumericValue n1, NumericValue n2, NumericValue r)
114114 { if ( intNumericValue(n1) && intNumericValue(n2) )
115 { if ( abs(n1->value.i) >= (1 << 15) || abs(n2->value.i) >= (1 << 15) )
115 { if ( labs(n1->value.i) >= (1 << 15) || labs(n2->value.i) >= (1 << 15) )
116116 { r->value.f = (double)n1->value.i * (double)n2->value.i;
117117 r->type = V_DOUBLE;
118118 succeed;
78097809 fi
78107810
78117811
7812 if test "$x_libraries" = ""; then
7812 if test "$x_libraries" = "" -o "$x_libraries" = NONE; then
7813 { $as_echo "$as_me:${as_lineno-$LINENO}: checking \"Checking for XQuartz\"" >&5
7814 $as_echo_n "checking \"Checking for XQuartz\"... " >&6; };
7815 if test -r /opt/X11/lib/libX11.dylib; then
7816 XLIB=/opt/X11/lib
7817 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XLIB" >&5
7818 $as_echo "$XLIB" >&6; };
7819 else
7820 { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"no\"" >&5
7821 $as_echo "\"no\"" >&6; };
78137822 XLIB=/usr/X11/lib
7814 else
7815 XLIB="$x_libraries"
7823 fi
7824 else
7825 XLIB="$x_libraries"
78167826 fi
78177827 XLIBS="-L$XLIB -lXt -lX11"
78187828
7819 if test "$x_includes" = ""; then
7820 XINCLUDES="-I/usr/include"
7821 else
7822 XINCLUDES="-I$x_includes"
7823 fi
7829 if test "$x_includes" = "" -o "$x_includes" = NONE; then
7830 if test -r /opt/X11/include/X11/Xlib.h; then
7831 XINCLUDES="-I/opt/X11/include"
7832 else
7833 XINCLUDES="-I/usr/include"
7834 fi
7835 else
7836 XINCLUDES="-I$x_includes"
7837 fi
7838
78247839
78257840 ac_oldlibs="$LIBS"
78267841 if test ! -z "$x_libraries"; then
78337848 $as_echo_n "(cached) " >&6
78347849 else
78357850 ac_check_lib_save_LIBS=$LIBS
7836 LIBS="-lSM -lX11 -lXt -lICE $LIBS"
7851 LIBS="-lSM $XLIBS -lICE $LIBS"
78377852 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
78387853 /* end confdefs.h. */
78397854
407407
408408 AC_PATH_X
409409
410 if test "$x_libraries" = ""; then
410 if test "$x_libraries" = "" -o "$x_libraries" = NONE; then
411 AC_MSG_CHECKING("Checking for XQuartz");
412 if test -r /opt/X11/lib/libX11.dylib; then
413 XLIB=/opt/X11/lib
414 AC_MSG_RESULT($XLIB);
415 else
416 AC_MSG_RESULT("no");
411417 XLIB=/usr/X11/lib
418 fi
412419 else
413 XLIB="$x_libraries"
420 XLIB="$x_libraries"
414421 fi
415422 XLIBS="-L$XLIB -lXt -lX11"
416423
417 if test "$x_includes" = ""; then
418 XINCLUDES="-I/usr/include"
424 if test "$x_includes" = "" -o "$x_includes" = NONE; then
425 if test -r /opt/X11/include/X11/Xlib.h; then
426 XINCLUDES="-I/opt/X11/include"
427 else
428 XINCLUDES="-I/usr/include"
429 fi
419430 else
420 XINCLUDES="-I$x_includes"
421 fi
431 XINCLUDES="-I$x_includes"
432 fi
433
434 dnl echo XLIBS: $XLIBS, XINCLUDES $XINCLUDES
422435
423436 ac_oldlibs="$LIBS"
424437 if test ! -z "$x_libraries"; then
428441 AC_CHECK_LIB(SM, main,
429442 XSMLIBS="-lSM -lICE",
430443 ,
431 -lX11 -lXt -lICE)
444 $XLIBS -lICE)
432445 XLIBS="$XLIBS $XSMLIBS"
433446
434447 if test ! -z "$x_libraries"; then
258258 new(D, directory(.)),
259259 get(D, parent, PD),
260260 get(PD, path, Parent),
261 working_directory(CWD, CWD),
261 working_directory(CWD0, CWD0),
262 ( sub_atom(CWD0, _, _, 0, /)
263 -> file_directory_name(CWD0, CWD)
264 ; CWD = CWD0
265 ),
262266 file_directory_name(CWD, PlParent),
263267 same_file(Parent, PlParent).
264268 dir(members-1) :-
127127 If \const{true} (default), closing the compressed stream also closes
128128 (and thus invalidates) the wrapped stream. If \const{false}, the wrapped
129129 stream is \emph{not} closed. This can be used to read/write a compressed
130 ndata block as partial input/output on a stream.
130 data block as partial input/output on a stream.
131131 \end{description}
132132
133133 \predicate{gzopen}{3}{+File, +Mode, -Stream}
134 Same as \exam{gzopen}{File, Mode, Stream, []}.
134 Same as \term{gzopen}{File, Mode, Stream, []}.
135135
136136 \predicate{gzopen}{4}{+File, +Mode, -Stream, +Options}
137137 Open \program{gzip} compatible \arg{File} for reading or writing.
304304 If <code>true</code> (default), closing the compressed stream also
305305 closes (and thus invalidates) the wrapped stream. If <code>false</code>,
306306 the wrapped stream is <em>not</em> closed. This can be used to
307 read/write a compressed ndata block as partial input/output on a stream.
307 read/write a compressed data block as partial input/output on a stream.
308308 </dd>
309309 </dl>
310310
312312 <dt class="pubdef"><a name="gzopen/3"><strong>gzopen</strong>(<var>+File,
313313 +Mode, -Stream</var>)</a></dt>
314314 <dd class="defbody">
315 Same as <code>gzopen</code>File, Mode, Stream,[].</dd>
315 Same as <code>gzopen(File, Mode, Stream,[])</code>.</dd>
316316 <dt class="pubdef"><a name="gzopen/4"><strong>gzopen</strong>(<var>+File,
317317 +Mode, -Stream, +Options</var>)</a></dt>
318318 <dd class="defbody">
Binary diff not shown
152152 echo " - Pushing source package to PPA"
153153
154154 ( cd build-ppa-tmp &&
155 dput ppa:swi-prolog/devel swi-prolog_${VERSION}_source.changes
155 dput ppa:swi-prolog/stable swi-prolog_${VERSION}_source.changes
156156 )
157157 fi
290290 A gcd "gcd"
291291 A gctime "gctime"
292292 A gdiv "//"
293 A getbit "getbit"
293294 A getcwd "getcwd"
294295 A global "global"
295296 A global_shifts "global_shifts"
816817 F dgarbage_collect 1
817818 F div 2
818819 F gdiv 2
820 F getbit 2
819821 F divide 2
820822 F dmessage_queue 1
821823 F dmutex 1
122122 SOLIB=@SOLIB@
123123 SHARED=@PLSO@
124124 SHAREDV=$(SHARED).$(PLVERSION)
125 SONAME=@SONAME@
125126 SONAMEOPT=@SONAMEOPT@
126127 LIBRARYDIR=${PLBASE}/library
127128 PLCUSTOM=${PLBASE}/customize
245246
246247 $(RUNTIMEDIR)/$(SHARED): $(RUNTIMEDIR)/$(SHAREDV)
247248 ( cd ../lib/$(PLARCH) && rm -f $(SHARED) && ln -s $(SHAREDV) $(SHARED) )
249 ( cd ../lib/$(PLARCH) && rm -f $(SONAME) && ln -s $(SHAREDV) $(SONAME) )
248250 endif
249251 endif
250252
507509 if [ -f $(RUNTIMEDIR)/$(SHAREDV) ]; then \
508510 $(INSTALL_SHOBJ) $(RUNTIMEDIR)/$(SHAREDV) $(DESTDIR)$(PLBASE)/$(SOLIB)/$(INSTALL_PLARCH) ; \
509511 ( cd $(DESTDIR)$(PLBASE)/lib/$(INSTALL_PLARCH) && rm -f $(SHARED) && ln -s $(SHAREDV) $(SHARED) ) ; \
512 ( cd $(DESTDIR)$(PLBASE)/lib/$(INSTALL_PLARCH) && rm -f $(SONAME) && ln -s $(SHAREDV) $(SONAME) ) ; \
510513 fi
511514 endif
512515 endif
22 Author: Jan Wielemaker
33 E-mail: J.Wielemak@vu.nl
44 WWW: http://www.swi-prolog.org
5 Copyright (C): 1985-2012, University of Amsterdam
5 Copyright (C): 1985-2015, University of Amsterdam
66 VU University Amsterdam
77
88 This library is free software; you can redistribute it and/or
5454 /* PLVERSION: 10000 * <Major> + 100 * <Minor> + <Patch> */
5555
5656 #ifndef PLVERSION
57 #define PLVERSION 70200
57 #define PLVERSION 70203
5858 #endif
5959
6060 /*******************************
273273 PL_EXPORT(int) PL_foreign_control(control_t);
274274 PL_EXPORT(intptr_t) PL_foreign_context(control_t);
275275 PL_EXPORT(void *) PL_foreign_context_address(control_t);
276 PL_EXPORT(predicate_t) PL_foreign_context_predicate(control_t);
276277
277278
278279 /********************************
0 /* $Id$
0 /* Part of SWI-Prolog
11
2 Part of SWI-Prolog
3
4 Author: Jan Wielemaker and Anjo Anjewierden
5 E-mail: jan@swi.psy.uva.nl
2 Author: Jan Wielemaker
3 E-mail: J.Wielemaker@vu.nl
64 WWW: http://www.swi-prolog.org
7 Copyright (C): 1985-2002, University of Amsterdam
5 Copyright (C): 2008-2015, University of Amsterdam
6 VU University Amsterdam
87
98 This library is free software; you can redistribute it and/or
109 modify it under the terms of the GNU Lesser General Public
5958 dif(11) :-
6059 dif(A,B), memberchk(A, [B, C]),
6160 A == C.
61 dif(12) :- % https://github.com/SWI-Prolog/issues/issues/15
62 dif(X-Y,1-2), X=Y, Y = 1.
63 dif(13) :- % https://github.com/SWI-Prolog/issues/issues/15
64 dif(X-Y,1-2), X=Y, Y = 2.
6265
6366 :- dynamic
6467 failed/1.
0 /* $Id$
1
2 Part of SWI-Prolog
0 /* Part of SWI-Prolog
31
42 Author: Jan Wielemaker
5 E-mail: wielemak@science.uva.nl
3 E-mail: J.Wielemaker@vu.nl
64 WWW: http://www.swi-prolog.org
7 Copyright (C): 1985-2007, University of Amsterdam
5 Copyright (C): 2008-2015, University of Amsterdam
6 VU University Amsterdam
87
98 This library is free software; you can redistribute it and/or
109 modify it under the terms of the GNU Lesser General Public
4039 x(X),
4140 freeze(X, true),
4241 call_residue_vars(true, Vars).
43 test(freeze_oi, [true(Vars == [X])]) :-
42 test(freeze_oi, Vars == [X]) :-
4443 x(X),
4544 freeze(X, true),
4645 call_residue_vars(freeze(X, fail), Vars).
47 test(nogc, [true(Vars = [_])]) :-
46 test(nogc, Vars = [_]) :-
4847 call_residue_vars(gc_able, Vars).
49 test(gc, [true(Vars = [_])]) :-
48 test(gc, Vars = [_]) :-
5049 call_residue_vars((gc_able, garbage_collect), Vars).
50 test(gc2, Vars = [_]) :-
51 call_residue_vars(gc_able2_gc, Vars).
52 test(modify, Vars == [X]) :-
53 put_attr(X, a, 1),
54 call_residue_vars(put_attr(X, a, 2), Vars).
5155 test(trail, [all(Vars == [[]])]) :-
5256 G=(freeze(X,X=1),X=1),
5357 call_residue_vars(G,Vars),
5458 (true;Vars=[2]).
59 test(frozen_stacks, Vars == []) :-
60 x(X),
61 call_residue_vars(
62 ( freeze(X, true),
63 nb_setval(x, a(b)),
64 fail
65 ; true
66 ),
67 Vars).
68 test(copy_term) :-
69 T = x(X), put_attr(X, a, 1),
70 copy_term(T, T2),
71 garbage_collect,
72 x(T2).
73 test(copy_term, Vars == [V]) :-
74 T = x(X), put_attr(X, a, 1),
75 call_residue_vars(copy_term(T, T2), Vars),
76 arg(1, T2, V).
77 test(record) :-
78 T = x(X), put_attr(X, a, 1),
79 cp_record(T, T2),
80 garbage_collect,
81 x(T2).
82 test(record, Vars == [V]) :-
83 T = x(X), put_attr(X, a, 1),
84 call_residue_vars(cp_record(T, T2), Vars),
85 arg(1, T2, V).
86
87 cp_record(T,T2) :- % copy using recorded DB
88 findall(T2, T2=T, [T2]).
5589
5690 x(_). % avoid singleton warnings
5791
6296 x(X),
6397 freeze(X, fail).
6498
99 gc_able2_gc :-
100 freeze(X, writeln(X)),
101 garbage_collect.
102
65103 :- end_tests(call_residue_vars).
0 /* Part of SWI-Prolog
1
2 Author: Jan Wielemaker
3 E-mail: J.Wielemaker@vu.nl
4 WWW: http://www.swi-prolog.org
5 Copyright (C): 2015, University of Amsterdam
6 VU University Amsterdam
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23 :- module(test_code_type, [test_code_type/0]).
24 :- use_module(library(plunit)).
25 :- use_module(library(apply)).
26
27 /** <module> Test Prolog text code_typeting primitives
28
29 This module is a Unit test for Prolog code_type/2, etc.
30
31 @author Jan Wielemaker
32 */
33
34 test_code_type :-
35 run_tests([ code_type
36 ]).
37
38 :- begin_tests(code_type).
39
40 test(code_type, true) :-
41 assert_ct,
42 gen.
43
44 :- end_tests(code_type).
45
46 :- thread_local ct/2.
47
48 assert_ct :-
49 retractall(ct(_,_)),
50 forall(( between(0, 255, C),
51 code_type(C, T)
52 ),
53 assertz(ct(C,T))).
54
55 gen_t(T) :-
56 ct(_C,T0),
57 ( atom(T0)
58 -> T = T0
59 ; functor(T0,F,A),
60 functor(T,F,A)
61 ).
62
63 gen :-
64 setof(T, gen_t(T), TL),
65 maplist(gen, TL).
66
67 gen(T) :-
68 (setof(C, code_type(C,T), CL) -> true ; CL = []),
69 (setof(C, ct(C,T), CL2) -> true ; CL2 = []),
70 ( CL == CL2
71 -> true
72 ; format('ERROR: code_type ~p: ~p \\== ~p~n', [T, CL, CL2]),
73 fail
74 ).
0 /* $Id$
1
2 Part of SWI-Prolog
0 /* Part of SWI-Prolog
31
42 Author: Jan Wielemaker
5 E-mail: J.Wielemak@uva.nl
3 E-mail: J.Wielemaker@vu.nl
64 WWW: http://www.swi-prolog.org
7 Copyright (C): 2008, University of Amsterdam
5 Copyright (C): 2008-2015, University of Amsterdam
6 VU University Amsterdam
87
98 This library is free software; you can redistribute it and/or
109 modify it under the terms of the GNU Lesser General Public
4443 test(no_stream, error(existence_error(stream, S))) :-
4544 S = stream_dhfuweiu,
4645 format(S, fmt, []).
46 test(atom, A == 'a\n') :-
47 format(atom(A), 'a\n', []).
4748
4849 :- end_tests(format).
0 /* $Id$
1
2 Part of SWI-Prolog
0 /* Part of SWI-Prolog
31
42 Author: Jan Wielemaker
5 E-mail: wielemak@science.uva.nl
3 E-mail: J.Wielemaker@vu.nl
64 WWW: http://www.swi-prolog.org
7 Copyright (C): 2008, University of Amsterdam
5 Copyright (C): 2008-2015, University of Amsterdam
6 VU University Amsterdam
87
98 This library is free software; you can redistribute it and/or
109 modify it under the terms of the GNU Lesser General Public
3332 run_tests([ gc_leak,
3433 gc_reset,
3534 gc_crash,
35 gc_crash2,
3636 gc_mark,
3737 agc
3838 ]).
180180
181181 :- end_tests(gc_crash).
182182
183 :- begin_tests(gc_crash2).
184
185 test(cleanup) :- % patch 33c661dca59ba3c007348533bd3e4687585c9e7a
186 catch(( go_1(1),
187 go_1(2)
188 ),
189 _,
190 true).
191
192 go_1(N) :-
193 setup_call_cleanup(mysetup,
194 ( ( true ; true ),
195 process_n(N)
196 ),
197 mycleanup).
198
199 mysetup.
200 mycleanup.
201
202 process_n(1) :- !.
203 process_n(2) :- throw(foo).
204
205 :- end_tests(gc_crash2).
183206
184207 :- begin_tests(gc_mark).
185208
22 Author: Jan Wielemaker
33 E-mail: J.Wielemaker.vu.nl
44 WWW: http://www.swi-prolog.org
5 Copyright (C): 1985-2013, University of Amsterdam
5 Copyright (C): 1985-2015, University of Amsterdam
66 VU University Amsterdam
77
88 This library is free software; you can redistribute it and/or
2222
2323 :- module(test_term, [test_term/0]).
2424 :- use_module(library(plunit)).
25 :- use_module(library(debug)).
2526
2627 /** <module> Test Prolog core term manipulation primitives
2728
4445 numbervars(_, 0, End).
4546 test(single_s, End == 0) :-
4647 numbervars(_, 0, End, [singletons(true)]).
48 test(neg, End == -6) :-
49 numbervars(f(X), -7, End),
50 assertion(X == '$VAR'(-7)).
4751 test(shared, End == 1) :-
4852 X = d(_),
4953 Y = t(X,X),
2727 #define PLARCH "i386-win32"
2828 #define SIZEOF_VOIDP 4
2929
30 #include "windows.h"
30 #include "wincfg.h"
2828 #define PLARCH "x64-win64"
2929 #define SIZEOF_VOIDP 8
3030
31 #include "windows.h"
31 #include "wincfg.h"
0 /* $Id$
1
2 Part of SWI-Prolog
3
4 Author: Jan Wielemaker
5 E-mail: J.Wielemaker@cs.vu.nl
6 WWW: http://www.swi-prolog.org
7 Copyright (C): 1985-2011, University of Amsterdam
8 Vu University Amsterdam
9
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Lesser General Public
12 License as published by the Free Software Foundation; either
13 version 2.1 of the License, or (at your option) any later version.
14
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public
21 License along with this library; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 */
24
25 #define __WIN32__ 1
26 #if !defined(VC8) && (_MSC_VER >= 1400) /* Visual studio 8 */
27 #define VC8 1 /* (aka Microsoft 2005 VC++ */
28 #endif
29
30 #define NOTTYCONTROL TRUE /* default -tty */
31 #define O_GMP 1
32 #define _REENTRANT 1
33
34 #define OPEN_MAX 32
35
36 #define HAVE_UXNT_H 1
37
38 #define HAVE_CLOCK 1 /* clock() timing function */
39
40 /* Define for emulating dlopen(), etc. using LoadLibrary */
41 #define EMULATE_DLOPEN 1
42
43 /* Define for the _xos_... functions */
44 #define O_XOS 1
45
46 /* Define O_RLC for the ../readline library */
47 #define O_RLC 1
48
49 /* Define for Windows DDE support */
50 #define O_DDE 1
51
52 /* Define for Windows DLL support */
53 #define O_DLL 1
54
55 /* Define if you disk-drives are special to you (DOS, Windows, OS/2) */
56 #define O_HASDRIVES 1
57
58 /* Define if you have shares using the notation //host/share */
59 #define O_HASSHARES 1
60
61 /* Maximum length of a path-name. Note XOS! */
62 #define MAXPATHLEN 512
63
64 /* Format for int64_t */
65 #ifndef INT64_FORMAT
66 #define INT64_FORMAT "%I64d"
67 #endif
68
69 /* Define if floats are IEEE754 */
70 #define IEEE754 1
71
72 /* setenv comes from uxnt.c */
73 #define HAVE_SETENV 1
74
75
76 #ifdef __MINGW32__
77 #include "config.h"
78 #endif
79
80 /* FIXME: this is overriding what is in config.h. */
81 /* Define to make use of standard (UNIX98) pthread recursive mutexes */
82 #define RECURSIVE_MUTEXES 1
83
84 /* FIXME: this is overriding what is in config.h. */
85 /* Define if pthread has pthread_mutexattr_settype() */
86 #define HAVE_PTHREAD_MUTEXATTR_SETTYPE 1
87
88 #ifndef __MINGW32__
89 typedef unsigned long sigset_t; /* we don't have this */
90 typedef int mode_t;
91
92 /* Define to 1 if you have the <shlobj.h> header file. */
93 #define HAVE_SHLOBJ_H 1
94
95 /* Define to 1 if you have the <dbghelp.h> header file. */
96 #define HAVE_DBGHELP_H 1
97
98 /* Define to 1 if you have the <malloc.h> header file. */
99 #define HAVE_MALLOC_H 1
100
101 #define inline __inline
102
103 #define snprintf ms_snprintf /* defined in pl-nt.c */
104
105 #ifdef O_GMP
106 #define HAVE_GMP_H 1
107 #endif
108
109 #ifdef __LCC__
110 #define NO_MS_EXTENSIONS 1
111 #endif
112
113 /* Define to extension used for shared objects if not "so" */
114 #define SO_EXT "dll"
115
116 /* Define as the return type of signal handlers (int or void). */
117 #define RETSIGTYPE void
118
119 /* Define if SIGPROF and setitimer() are available */
120 #define O_PROFILE 1
121
122 /* "Define if Prolog kernel is in shared object" */
123 #define O_SHARED_KERNEL 1
124
125 /* The number of bytes in a int. */
126 #define SIZEOF_INT 4
127
128 /* The number of bytes in a long. */
129 #define SIZEOF_LONG 4
130
131 /* The number of bytes in a wchar_t. */
132 #define SIZEOF_WCHAR_T 2
133
134 /* Define if you have the access function. */
135 #define HAVE_ACCESS 1
136
137 /* Define if you have the chmod function. */
138 #define HAVE_CHMOD 1
139
140 /* Define if you have the fstat function. */
141 #define HAVE_FSTAT 1
142
143 /* Define if you have the getcwd function. */
144 #define HAVE_GETCWD 1
145
146 /* Define if you have the getpid function. */
147 #define HAVE_GETPID 1
148
149 /* Define if you have the ftime function. */
150 #define HAVE_FTIME 1
151
152 /* Define if you have the memmove function. */
153 #define HAVE_MEMMOVE 1
154
155 /* Define if you have the opendir function. */
156 #define HAVE_OPENDIR 1
157
158 /* Define if you have the popen function. */
159 #define HAVE_POPEN 1
160
161 /* Define if you have the putenv function. */
162 #define HAVE_PUTENV 1
163
164 /* Define if you have the remove function. */
165 #define HAVE_REMOVE 1
166
167 /* Define if you have the rename function. */
168 #define HAVE_RENAME 1
169
170 /* Define if you have the stricmp() function. */
171 #define HAVE_STRICMP 1
172
173 /* Define if you have the mbscasecoll() function. */
174 #define mbscasecoll mbsicoll
175 #define HAVE_MBSCASECOLL 1
176
177 /* Define if you have the strlwr() function */
178 #define HAVE_STRLWR 1
179
180 /* Define if you have the rl_insert_close function. */
181 #define HAVE_RL_INSERT_CLOSE 1
182
183 /* Define if you have the select function. */
184 #define HAVE_SELECT 1
185
186 /* Define if you have the signal function. */
187 #define HAVE_SIGNAL 1
188
189 /* Define if you have the srand function. */
190 #define HAVE_SRAND 1
191
192 /* Define if you have the stat function. */
193 #define HAVE_STAT 1
194
195 /* Define if you have the strerror function. */
196 #define HAVE_STRERROR 1
197
198 /* Define to 1 if you have the `ceil' function. */
199 #define HAVE_CEIL 1
200
201 /* Define to 1 if you have the `floor' function. */
202 #define HAVE_FLOOR 1
203
204 /* Define if you have the <dirent.h> header file. */
205 #define HAVE_DIRENT_H 1
206
207 /* Define if you have the <memory.h> header file. */
208 #define HAVE_MEMORY_H 1
209
210 /* Define if you have the <ndir.h> header file. */
211 /* #undef HAVE_NDIR_H */
212
213 /* Define if you have the <string.h> header file. */
214 #define HAVE_STRING_H 1
215
216 /* Define if you have the <sys/stat.h> header file. */
217 #define HAVE_SYS_STAT_H 1
218
219 /* Define if you have the m library (-lm). */
220 #define HAVE_LIBM 1
221
222 /* Define to 1 if you have the <locale.h> header file. */
223 #define HAVE_LOCALE_H 1
224
225 /* Define to 1 if you have the `setlocale' function. */
226 #define HAVE_SETLOCALE 1
227
228 /* Define to 1 if you have `isnan' function */
229 #define HAVE_ISNAN 1
230
231 /* Define to 1 if you have `_fpclass' function */
232 #define HAVE__FPCLASS 1
233
234 /* Define to 1 if you have `signbit' function */
235 /* #undef HAVE_SIGNBIT 1 */
236
237 /* Define to 1 if you have <float.h> header */
238 #define HAVE_FLOAT_H 1
239
240 /* Define to 1 if you have the 'wcsxfrm' function. */
241 #define HAVE_WCSXFRM 1
242
243 #endif
+0
-245
src/config/windows.h less more
0 /* $Id$
1
2 Part of SWI-Prolog
3
4 Author: Jan Wielemaker
5 E-mail: J.Wielemaker@cs.vu.nl
6 WWW: http://www.swi-prolog.org
7 Copyright (C): 1985-2011, University of Amsterdam
8 Vu University Amsterdam
9
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Lesser General Public
12 License as published by the Free Software Foundation; either
13 version 2.1 of the License, or (at your option) any later version.
14
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public
21 License along with this library; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 */
24
25 #define __WIN32__ 1
26 #if !defined(VC8) && (_MSC_VER >= 1400) /* Visual studio 8 */
27 #define VC8 1 /* (aka Microsoft 2005 VC++ */
28 #endif
29
30 #ifdef __MINGW32__
31 #include <config.h>
32 #endif
33
34 #ifndef __MINGW32__
35 typedef unsigned long sigset_t; /* we don't have this */
36 typedef int mode_t;
37 #define HAVE_SHLOBJ_H 1
38 #endif
39 #define HAVE_SIGSET_T 1 /* For the future */
40
41 #ifndef __MINGW32__
42 #define HAVE_DBGHELP_H 1
43 #endif
44
45 #define NOTTYCONTROL TRUE /* default -tty */
46 #define O_GMP 1
47 #define O_PLMT 1
48 #define _REENTRANT 1
49
50 #define OPEN_MAX 32
51
52 #define HAVE_UXNT_H 1
53 #define HAVE_MALLOC_H 1
54 #define HAVE_VIRTUALALLOC 1
55 #define HAVE_CLOCK 1 /* clock() timing function */
56 #define inline __inline
57
58 #define snprintf ms_snprintf /* defined in pl-nt.c */
59
60 #ifdef O_GMP
61 #define HAVE_GMP_H 1
62 #define HAVE_LIB_GMP 1
63 #endif
64
65 #ifdef __LCC__
66 #define NO_MS_EXTENSIONS 1
67 #endif
68
69 /* Define for emulating dlopen(), etc. using LoadLibrary */
70 #define EMULATE_DLOPEN 1
71
72 /* Define to extension used for shared objects if not "so" */
73 #define SO_EXT "dll"
74
75 /* Define for the _xos_... functions */
76 #define O_XOS 1
77
78 /* Define O_RLC for the ../readline library */
79 #define O_RLC 1
80
81 /* Define for Windows DDE support */
82 #define O_DDE 1
83
84 /* Define for Windows DLL support */
85 #define O_DLL 1
86
87 /* Define if you disk-drives are special to you (DOS, Windows, OS/2) */
88 #define O_HASDRIVES 1
89
90 /* Define if you have shares using the notation //host/share */
91 #define O_HASSHARES 1
92
93 /* Maximum length of a path-name. Note XOS! */
94 #define MAXPATHLEN 512
95
96 /* Define as the return type of signal handlers (int or void). */
97 #define RETSIGTYPE void
98
99 /* Define if you have the ANSI C header files. */
100 #define STDC_HEADERS 1
101
102 /* Define if uchar is not defined in <sys/types.h> */
103 #define NEED_UCHAR 1
104
105 /* Define if SIGPROF and setitimer() are available */
106 #define O_PROFILE 1
107
108 /* "Define if Prolog kernel is in shared object" */
109 #define O_SHARED_KERNEL 1
110
111 /* The number of bytes in a int. */
112 #define SIZEOF_INT 4
113
114 /* The number of bytes in a long. */
115 #define SIZEOF_LONG 4
116
117 /* The number of bytes in a wchar_t. */
118 #define SIZEOF_WCHAR_T 2
119
120 /* Define if you have the access function. */
121 #define HAVE_ACCESS 1
122
123 /* Define if you have the chmod function. */
124 #define HAVE_CHMOD 1
125
126 /* Define if you have the fstat function. */
127 #define HAVE_FSTAT 1
128
129 /* Define if you have the getcwd function. */
130 #define HAVE_GETCWD 1
131
132 /* Define if you have the getpid function. */
133 #define HAVE_GETPID 1
134
135 /* Define if you have the ftime function. */
136 #define HAVE_FTIME 1
137
138 /* Define if you have the memmove function. */
139 #define HAVE_MEMMOVE 1
140
141 /* Define if you have the opendir function. */
142 #define HAVE_OPENDIR 1
143
144 /* Define if you have the popen function. */
145 #define HAVE_POPEN 1
146
147 /* Define if you have the putenv function. */
148 #define HAVE_PUTENV 1
149
150 /* Define if you have the remove function. */
151 #define HAVE_REMOVE 1
152
153 /* Define if you have the rename function. */
154 #define HAVE_RENAME 1
155
156 /* Define if you have the stricmp() function. */
157 #define HAVE_STRICMP 1
158
159 /* Define if you have the mbscasecoll() function. */
160 #define mbcasescoll mbsicoll
161 #define HAVE_MBCASESCOLL 1
162
163 /* Define if you have the strlwr() function */
164 #define HAVE_STRLWR 1
165
166 /* Define if you have the rl_insert_close function. */
167 #define HAVE_RL_INSERT_CLOSE 1
168
169 /* Define if you have the select function. */
170 #define HAVE_SELECT 1
171
172 /* Define if you have the signal function. */
173 #define HAVE_SIGNAL 1
174
175 /* Define if you have the srand function. */
176 #define HAVE_SRAND 1
177
178 /* Define if you have the stat function. */
179 #define HAVE_STAT 1
180
181 /* Define if you have the strerror function. */
182 #define HAVE_STRERROR 1
183
184 #define HAVE_CEIL 1
185 #define HAVE_FLOOR 1
186
187 /* Define if you have the <dirent.h> header file. */
188 #define HAVE_DIRENT_H 1
189
190 /* Define if you have the <malloc.h> header file. */
191 #define HAVE_MALLOC_H 1
192
193 /* Define if you have the <memory.h> header file. */
194 #define HAVE_MEMORY_H 1
195
196 /* Define if you have the <ndir.h> header file. */
197 /* #undef HAVE_NDIR_H */
198
199 /* Define if you have the <string.h> header file. */
200 #define HAVE_STRING_H 1
201
202 /* Define if you have the <sys/stat.h> header file. */
203 #define HAVE_SYS_STAT_H 1
204
205 /* Define if you have the m library (-lm). */
206 #define HAVE_LIBM 1
207
208 /* Define to make use of standard (UNIX98) pthread recursive mutexes */
209 #define RECURSIVE_MUTEXES 1
210
211 /* Define if pthread has pthread_mutexattr_settype() */
212 #define HAVE_PTHREAD_MUTEXATTR_SETTYPE 1
213
214 /* Format for int64_t */
215 #ifndef INT64_FORMAT
216 #define INT64_FORMAT "%I64d"
217 #endif
218
219 /* Define to 1 if you have the <locale.h> header file. */
220 #define HAVE_LOCALE_H 1
221
222 /* Define to 1 if you have the `setlocale' function. */
223 #define HAVE_SETLOCALE 1
224
225 /* Define to 1 if you have `isnan' function */
226 #define HAVE_ISNAN 1
227
228 /* Define to 1 if you have `_fpclass' function */
229 #define HAVE__FPCLASS 1
230
231 /* Define to 1 if you have `signbit' function */
232 /* #undef HAVE_SIGNBIT 1 */
233
234 /* Define if floats are IEEE754 */
235 #define IEEE754 1
236
237 /* Define to 1 if you have <float.h> header */
238 #define HAVE_FLOAT_H 1
239
240 /* setenv comes from uxnt.c */
241 #define HAVE_SETENV 1
242
243 /* Define to 1 if you have the 'wcsxfrm' function. */
244 #define HAVE_WCSXFRM 1
304304
305305 /* Define to 1 if you have the `mmap' function. */
306306 #undef HAVE_MMAP
307
308 /* Define to 1 if the system has the type `mp_bitcnt_t'. */
309 #undef HAVE_MP_BITCNT_T
307310
308311 /* Define to 1 if you have the `mtrace' function. */
309312 #undef HAVE_MTRACE
681681 XLIBS
682682 LNLIBS
683683 USEPLLIB
684 SONAME
684685 SONAMEOPT
685686 PLSO
686687 PLLIB
750751 ac_subst_files=''
751752 ac_user_opts='
752753 enable_option_checking
754 enable_mt
753755 enable_shared
754756 enable_static
755757 enable_readline
13851387 --disable-option-checking ignore unrecognized --enable/--with options
13861388 --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
13871389 --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
1390 --disable-mt Disable multi-threading
13881391 --enable-shared Prolog kernel as shared obj
13891392 --disable-static Do not install static library
13901393 --disable-readline Do NOT include GNU readline
26402643 MKLIBS=""
26412644 PLVERSION=`cat ../VERSION`
26422645 CNFG="" DEFSTARTUP=.swiplrc
2643 MT=yes
2646
2647 # Check whether --enable-mt was given.
2648 if test "${enable_mt+set}" = set; then :
2649 enableval=$enable_mt; case "$enableval" in
2650 yes) MT=yes
2651 ;;
2652 *) ;;
2653 esac
2654 else
2655 MT=yes
2656 fi
2657
2658
26442659
26452660
26462661 true()
66796694 #define PROG_PL "$PL$EXEEXT"
66806695 _ACEOF
66816696
6697 SONAMEV=`$as_echo "$PLVERSION" | sed 's/\([0-9]\+\.[0-9]\+\)\.[0-9]\+/\1/'`
6698 SONAME='$(SHARED).'$SONAMEV
66826699 case "$PLARCH" in
66836700 *-win32|*-win64|*-cygwin*)
66846701 PLSO=libswipl.$SO_EXT
6685 SONAMEOPT='-Wl,-soname=$(SHAREDV) -Wl,--out-implib,$(RUNTIMEDIR)/libswipl.$(SOEXT).a -Wl,--output-def,$(RUNTIMEDIR)/libswipl.def'
6702 SONAMEOPT='-Wl,-soname=$(SONAME) -Wl,--out-implib,$(RUNTIMEDIR)/libswipl.$(SOEXT).a -Wl,--output-def,$(RUNTIMEDIR)/libswipl.def'
66866703 ;;
66876704 *)
66886705 PLSO=libswipl.$SO_EXT
6689 SONAMEOPT='-Wl,-soname=$(SHAREDV)'
6706 SONAMEOPT='-Wl,-soname=$(SONAME)'
66906707 ;;
66916708 esac
66926709
77177734 case "$PLARCH" in
77187735 *darwin*)
77197736 if test -z "$RLPREFIX"; then
7720 RLPREFIX=/opt/local
7737 if test -f /opt/local/lib/libreadline.$SO_EXT; then
7738 RLPREFIX=/opt/local
7739 else
7740 RLPREFIX=/usr/local
7741 fi
77217742 fi
77227743 ;;
77237744 esac
91829203 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
91839204 fi
91849205
9206 if test "$MT" = "yes"; then
91859207 if test "$MINGW" = false; then
91869208
91879209
92629284 $as_echo "#define HAVE_GETTID_SYSCALL 1" >>confdefs.h
92639285
92649286 else
9265
92669287 { $as_echo "$as_me:${as_lineno-$LINENO}: checking \"linux gettid _syscall0 macro\"" >&5
92679288 $as_echo_n "checking \"linux gettid _syscall0 macro\"... " >&6; }
92689289 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
92939314 fi
92949315 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
92959316 fi
9296
92979317 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5
92989318 $as_echo_n "checking for clock_gettime in -lrt... " >&6; }
92999319 if ${ac_cv_lib_rt_clock_gettime+:} false; then :
94929512 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
94939513 $as_echo "no" >&6; }
94949514 fi
9495 fi
9496 fi
9497
9515 fi fi fi
94989516 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysconf support for _SC_NPROCESSORS_CONF" >&5
94999517 $as_echo_n "checking for sysconf support for _SC_NPROCESSORS_CONF... " >&6; }
95009518 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
99079925 fi
99089926 rm -f core conftest.err conftest.$ac_objext \
99099927 conftest$ac_exeext conftest.$ac_ext
9928
9929 ac_fn_c_check_type "$LINENO" "mp_bitcnt_t" "ac_cv_type_mp_bitcnt_t" "#include <gmp.h>
9930 "
9931 if test "x$ac_cv_type_mp_bitcnt_t" = xyes; then :
9932
9933 cat >>confdefs.h <<_ACEOF
9934 #define HAVE_MP_BITCNT_T 1
9935 _ACEOF
9936
9937
9938 fi
9939
99109940 fi
99119941
99129942
1047010500 #define RETSIGTYPE $ac_cv_type_signal
1047110501 _ACEOF
1047210502
10503
10504
10505 if test "$MT" = "yes"; then
1047310506
1047410507 { $as_echo "$as_me:${as_lineno-$LINENO}: checking \"for BSD signal handlers\"" >&5
1047510508 $as_echo_n "checking \"for BSD signal handlers\"... " >&6; }
1060710640 fi
1060810641
1060910642
10643 fi
1061010644 { $as_echo "$as_me:${as_lineno-$LINENO}: checking \"for union wait\"" >&5
1061110645 $as_echo_n "checking \"for union wait\"... " >&6; }
1061210646 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3131 AC_SUBST(PLLIB) dnl libswipl.a
3232 AC_SUBST(PLSO) dnl libswipl.so
3333 AC_SUBST(SONAMEOPT) dnl ld options for linking shared objects
34 AC_SUBST(SONAME) dnl libswipl SONAME
3435 AC_SUBST(USEPLLIB) dnl -lswipl
3536 AC_SUBST(LNLIBS) dnl libs to link with Prolog
3637 AC_SUBST(XLIBS) dnl libs to link with plterm
8586 PLVERSION=`cat ../VERSION`
8687 CNFG="" dnl Package configuration options
8788 DEFSTARTUP=.swiplrc
88 MT=yes
89
90 AC_ARG_ENABLE(mt, [ --disable-mt Disable multi-threading],
91 [case "$enableval" in
92 yes) MT=yes
93 ;;
94 *) ;;
95 esac],
96 MT=yes)
97
8998
9099 dnl ****************************************************************
91100 dnl Some systems don't appear to have true. Hope all like this ...
713722 [Flags for compiling position-independent BIG object])
714723 AC_DEFINE_UNQUOTED(PROG_PL, "$PL$EXEEXT",
715724 [Name of the SWI-Prolog executable (normally swipl[.exe])])
725 SONAMEV=`$as_echo "$PLVERSION" | sed 's/\(@<:@0-9@:>@\+\.@<:@0-9@:>@\+\)\.@<:@0-9@:>@\+/\1/'`
726 SONAME='$(SHARED).'$SONAMEV
716727 case "$PLARCH" in
717728 *-win32|*-win64|*-cygwin*)
718729 PLSO=libswipl.$SO_EXT
719 SONAMEOPT='-Wl,-soname=$(SHAREDV) -Wl,--out-implib,$(RUNTIMEDIR)/libswipl.$(SOEXT).a -Wl,--output-def,$(RUNTIMEDIR)/libswipl.def'
730 SONAMEOPT='-Wl,-soname=$(SONAME) -Wl,--out-implib,$(RUNTIMEDIR)/libswipl.$(SOEXT).a -Wl,--output-def,$(RUNTIMEDIR)/libswipl.def'
720731 ;;
721732 *)
722733 PLSO=libswipl.$SO_EXT
723 SONAMEOPT='-Wl,-soname=$(SHAREDV)'
734 SONAMEOPT='-Wl,-soname=$(SONAME)'
724735 ;;
725736 esac
726737
967978
968979 dnl Hacks for MacOS handling of libreadline. We want to prefer the MacOS X
969980 dnl libraries, but we need to get libreadline from Macports, as the BSD
970 dnl version is severely limited.
981 dnl version is severely limited. Note that Macports installs in
982 dnl /opt/local and Brew in /usr/local, so we try both.
971983
972984 case "$PLARCH" in
973985 *darwin*)
974986 if test -z "$RLPREFIX"; then
975 RLPREFIX=/opt/local
987 if test -f /opt/local/lib/libreadline.$SO_EXT; then
988 RLPREFIX=/opt/local
989 else
990 RLPREFIX=/usr/local
991 fi
976992 fi
977993 ;;
978994 esac
12201236 AC_MSG_RESULT(yes))
12211237 fi
12221238
1239 if test "$MT" = "yes"; then
12231240 if test "$MINGW" = false; then
12241241
12251242 dnl The tests below are Unix only. There is no point doing this for MinGW.
12481265 if test "x$ac_syscall_gettid" = "xyes"; then
12491266 AC_DEFINE(HAVE_GETTID_SYSCALL, 1,
12501267 [Define to 1 if you have syscall support for gettid()])
1251 else
1268 else dnl ! test "x$ac_syscall_gettid" = "xyes"
12521269
12531270 AC_MSG_CHECKING("linux gettid _syscall0 macro")
12541271 AC_TRY_COMPILE(
12621279 [Define to 1 if you have the Linux gettid() _syscall0 macro])
12631280 AC_MSG_RESULT(yes),
12641281 AC_MSG_RESULT(no))
1265 fi
1282 fi dnl ! test "x$ac_syscall_gettid" = "xyes"
12661283
12671284 AC_CHECK_LIB(rt, clock_gettime)
12681285 AC_CHECK_FUNCS(clock_gettime)
13481365 else
13491366 AC_MSG_RESULT(no)
13501367 fi
1351 fi
1352 fi
1368 fi dnl test "x$ac_linux_cpuclocks" = "xyes"
1369 fi dnl test "$MINGW" = false
1370 fi dnl if test "$MT" = "yes"
13531371
13541372 AC_MSG_CHECKING(for sysconf support for _SC_NPROCESSORS_CONF)
13551373 AC_TRY_COMPILE(
14361454 AC_DEFINE(HAVE_GMP_RANDINIT_MT, 1,
14371455 [ Define you you have gmp_randinit_mt (gmp > 4.2.0) ]),
14381456 AC_MSG_RESULT(no))
1457
1458 AC_CHECK_TYPES([mp_bitcnt_t], [], [], [[#include <gmp.h>]])
14391459 fi
14401460
14411461 dnl Setup DMALLOC
16631683 fi
16641684
16651685 AC_TYPE_SIGNAL
1686
1687 dnl Do not enable profiling unless MT is also enabled
1688 if test "$MT" = "yes"; then
1689
16661690 AC_MSG_CHECKING("for BSD signal handlers")
16671691 AC_TRY_RUN(
16681692 [
17641788 AC_MSG_RESULT(no),
17651789 true)
17661790
1791 fi dnl End of conditional disabling profiling unless MT is enabled
1792
17671793 AC_MSG_CHECKING("for union wait")
17681794 AC_TRY_COMPILE(
17691795 [
251251 get_trace_store(void)
252252 { GET_LD
253253
254 if ( LD )
254 if ( HAS_LD )
255255 { if ( !LD->btrace_store )
256256 { btrace *s = malloc(sizeof(*s));
257257 if ( s )
2323 #include "pl-incl.h"
2424 #include <ctype.h>
2525 #include "pl-ctype.h"
26 #include <errno.h>
2627
2728 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2829 This module defines:
397398 goto error;
398399
399400 for(;;)
400 { int rval;
401
402 if ( (rval = (*gen->class->test)((wint_t)gen->current)) )
403 { if ( gen->do_enum & ENUM_CHAR )
401 { int rval = (*gen->class->test)((wint_t)gen->current);
402
403 if ( (gen->class->arity == 0 && rval) ||
404 (gen->class->arity > 0 && rval >= 0) )
405 { if ( (gen->do_enum & ENUM_CHAR) )
404406 { if ( !PL_unify_char(chr, gen->current, how) )
405407 { if ( LD->exception.term )
406408 goto error;
407409 goto next;
408410 }
409411 }
410 if ( gen->class->arity > 0 )
411 { if ( rval < 0 ||
412 !unify_char_type(class, gen->class, rval, how) )
413 { if ( LD->exception.term )
414 goto error;
415 goto next;
416 }
417 } else if ( gen->do_enum & ENUM_CLASS )
412 if ( (gen->do_enum & ENUM_CLASS) || gen->class->arity > 0 )
418413 { if ( !unify_char_type(class, gen->class, rval, how) )
419414 { if ( LD->exception.term )
420415 goto error;
869864 initEncoding(void)
870865 { GET_LD
871866
872 if ( LD )
867 if ( HAS_LD )
873868 { if ( !LD->encoding )
874869 { char *enc;
875870
4040
4141 #define Long int /* 32-bits */
4242
43 #ifdef _REENTRANT
43 #if defined(_REENTRANT) && defined(O_PLMT)
4444 #define MULTIPLE_THREADS
4545
4646 /* TBD: Use the pl-thread.[ch] locks for better speed on Windows
3333
3434 /*#define O_DEBUG 1*/
3535 /*#define O_DEBUG_MT 1*/
36
37 #ifdef __MINGW32__
38 #include <winsock2.h>
39 #include <windows.h>
40 #endif
3641
3742 #define NEEDS_SWINSOCK
3843 #include "pl-incl.h"
11761181 { GET_LD
11771182 IOSTREAM *s;
11781183
1179 if ( LD && Sprotocol && (s = getStream(Sprotocol)) )
1184 if ( HAS_LD && Sprotocol && (s = getStream(Sprotocol)) )
11801185 { while( n-- > 0 )
11811186 Sputcode(*str++&0xff, s);
11821187 Sflush(s);
13661371 ctx->size = sizeof(ctx->buffer);
13671372 ctx->stream = Sopenmem(&ctx->data, &ctx->size, "w");
13681373 ctx->stream->encoding = ENC_WCHAR;
1374 ctx->stream->newline = SIO_NL_POSIX;
13691375 }
13701376
13711377 ctx->magic = REDIR_MAGIC;
2121 License along with this library; if not, write to the Free Software
2222 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2323 */
24
25 #ifdef __MINGW32__
26 #include <windows.h>
27 #endif
2428
2529 #include "pl-incl.h"
2630 #include "pl-utf8.h"
2121
2222 #include "pl-incl.h"
2323 #include "pl-locale.h"
24 #include <errno.h>
2425
2526 #if defined(__sun) || __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070
2627 #undef HAVE_WCSDUP /* No prototype, so better use our own */
881882 { GET_LD
882883 PL_locale *l;
883884
884 if ( LD ) /* a Prolog thread */
885 if ( HAS_LD ) /* a Prolog thread */
885886 l = LD->locale.current;
886887 else
887888 l = GD->locale.default_locale;
148148 static int
149149 dict_option(term_t key, term_t value, int last, void *closure)
150150 { dictopt_ctx *ctx = closure;
151 #if defined(O_PLMT) || defined(O_MULTIPLE_ENGINES)
151152 PL_local_data_t *__PL_ld = ctx->ld;
153 #endif
152154 atom_t name;
153155 int n;
154156 const opt_spec *s;
15741574 { const char *base, *p;
15751575
15761576 for(base = p = f; *p; p++)
1577 { if (*p == '/' && p[1] != EOS )
1577 { if ( *p == '/' )
15781578 base = p;
15791579 }
15801580 if ( base == f )
19311931 { GET_LD
19321932 int fd;
19331933
1934 if ( (!LD || truePrologFlag(PLFLAG_TTY_CONTROL)) &&
1934 if ( (!HAS_LD || truePrologFlag(PLFLAG_TTY_CONTROL)) &&
19351935 (fd = Sfileno(s)) >= 0 )
19361936 rc = SetTtyState(fd, &TTY_STATE(buf));
19371937
3030 #ifdef __WINDOWS__
3131 #include <process.h> /* getpid() */
3232 #endif
33 #include <time.h>
3334
3435 #define LOCK() PL_LOCK(L_PLFLAG)
3536 #define UNLOCK() PL_UNLOCK(L_PLFLAG)
13421343 { Table t = GD->prolog_flag.table;
13431344
13441345 GD->prolog_flag.table = NULL;
1346 #ifdef O_PLMT
13451347 t->free_symbol = freeSymbolPrologFlagTable;
1348 #else
1349 t->free_symbol = NULL;
1350 #endif
13461351 destroyHTable(t);
13471352 }
13481353 }
332332 char *line;
333333
334334 prepare_signals();
335 if ( LD )
335 if ( HAS_LD )
336336 { EXCEPTION_GUARDED({ line = readline(prompt);
337337 },
338338 { DEBUG(3, Sdprintf("Exception in readline()\n"));
405405
406406 if ( rc < 0 && errno == EINTR )
407407 { if ( PL_handle_signals() < 0 )
408 { errno = EPLEXCEPTION;
408 { Sset_exception(s, PL_exception(0));
409 s->flags |= SIO_CLEARERR;
410 errno = EPLEXCEPTION;
409411 return -1;
410412 }
411413
462464 } else if ( n < 0 ) /* error */
463465 { if ( errno == EINTR )
464466 { if ( PL_handle_signals() < 0 )
467 { Sset_exception(s, PL_exception(0));
468 s->flags |= SIO_CLEARERR;
465469 errno = EPLEXCEPTION;
466 else
470 } else
467471 goto retry;
468472 } else if ( errno != EPLEXCEPTION )
469473 S__seterror(s);
174174 { Symbol *newentries, *oldentries;
175175 int newbuckets, oldbuckets;
176176 int i;
177 #ifdef O_PLMT
177178 int safe_copy = (ht->mutex != NULL);
179 #else
180 const int safe_copy = 1;
181 #endif
178182
179183 newbuckets = ht->buckets*2;
180184 newentries = allocHTableEntries(newbuckets);
990990 } else
991991 { char *t, *to = PL_malloc(len+1);
992992
993 text->text.t = to;
994993 for(t=to; s<e;)
995994 { s = utf8_get_char(s, &chr);
996995 *t++ = chr;
22 Author: Jan Wielemaker
33 E-mail: J.Wielemaker@cs.vu.nl
44 WWW: http://www.swi-prolog.org
5 Copyright (C): 1985-2013, University of Amsterdam
5 Copyright (C): 1985-2015, University of Amsterdam
66 VU University Amsterdam
77
88 This library is free software; you can redistribute it and/or
5454 #endif
5555
5656 #ifdef __WINDOWS__
57 #include <windows.h>
5758 #include <wincrypt.h>
5859 #endif
5960
325326 return rc;
326327 }
327328
329 /*******************************
330 * BIGNUM FUNCTIONS *
331 *******************************/
332
333 #ifdef O_GMP
334
335 static int
336 get_mpz(term_t t, Number n ARG_LD)
337 { Word p = valTermRef(t);
338
339 deRef(p);
340 if ( isInteger(*p) )
341 { get_integer(*p, n);
342 promoteToMPZNumber(n);
343
344 return TRUE;
345 }
346
347 return PL_type_error("integer", t);
348 }
349
350
351 /**
352 * divmod(+Dividend, +Divisor, -Quotient, -Remainder)
353 *
354 * Defined as
355 *
356 * - Quotient is div(Dividend, Divisor)
357 * - Remainder is mod(Dividend, Divisor)
358 */
359
360 static
361 PRED_IMPL("divmod", 4, divmod, 0)
362 { PRED_LD
363 number N = {V_INTEGER}, D = {V_INTEGER};
364 int rc = FALSE;
365
366 if ( get_mpz(A1, &N PASS_LD) &&
367 get_mpz(A2, &D PASS_LD) )
368 { if ( mpz_sgn(D.value.mpz) != 0 )
369 { number Q = {V_MPZ}, R = {V_MPZ};
370
371 mpz_init(R.value.mpz);
372 mpz_init(Q.value.mpz);
373 mpz_fdiv_qr(Q.value.mpz, R.value.mpz, N.value.mpz, D.value.mpz);
374 rc = ( PL_unify_number(A3, &Q) &&
375 PL_unify_number(A4, &R)
376 );
377 clearNumber(&R);
378 clearNumber(&Q);
379 } else
380 { rc = PL_error("divmod", 2, NULL, ERR_DIV_BY_ZERO);
381 }
382 }
383
384 clearNumber(&N);
385 clearNumber(&D);
386
387 return rc;
388 }
389
390 /**
391 * nth_integer_root_and_remainder(+N, +I, -Root, -Remainder)
392 */
393
394 static
395 PRED_IMPL("nth_integer_root_and_remainder", 4,
396 nth_integer_root_and_remainder, 0)
397 { PRED_LD
398 number N = {V_INTEGER};
399 long I;
400 int rc = FALSE;
401
402 if ( PL_get_long_ex(A1, &I) &&
403 get_mpz(A2, &N PASS_LD) )
404 { if ( I >= 1 )
405 { number root = {V_MPZ};
406 number rem = {V_MPZ};
407
408 if ( mpz_sgn(N.value.mpz) < 0 &&
409 I % 2 == 0 )
410 { rc = PL_error(NULL, 0, NULL, ERR_AR_UNDEF);
411 goto out;
412 }
413
414 mpz_init(root.value.mpz);
415 mpz_init(rem.value.mpz);
416 mpz_rootrem(root.value.mpz, rem.value.mpz,
417 N.value.mpz, (unsigned long)I);
418 rc = ( PL_unify_number(A3, &root) &&
419 PL_unify_number(A4, &rem)
420 );
421 clearNumber(&root);
422 clearNumber(&rem);
423 } else
424 { rc = PL_domain_error("not_less_than_one", A1);
425 }
426 }
427
428 out:
429 clearNumber(&N);
430
431 return rc;
432 }
433
434 #endif /*O_GMP*/
328435
329436 /********************************
330437 * COMPARISON *
25212628 }
25222629 }
25232630
2631 /* bit(I,K) is the K-th bit of I
2632 */
2633
2634 #ifndef HAVE_MP_BITCNT_T
2635 typedef unsigned long mp_bitcnt_t;
2636 #endif
2637
2638 #define MP_BITCNT_T_MIN 0
2639 #define MP_BITCNT_T_MAX (~(mp_bitcnt_t)0)
2640
2641 static int
2642 ar_getbit(Number I, Number K, Number r)
2643 { mp_bitcnt_t bit;
2644
2645 if ( !toIntegerNumber(I, 0) )
2646 return PL_error("bit", 2, NULL, ERR_AR_TYPE, ATOM_integer, I);
2647 if ( !toIntegerNumber(K, 0) )
2648 return PL_error("bit", 2, NULL, ERR_AR_TYPE, ATOM_integer, K);
2649
2650 switch(K->type)
2651 { case V_INTEGER:
2652 if ( K->value.i < 0 )
2653 return notLessThanZero("bit", 2, K);
2654 if ( sizeof(mp_bitcnt_t) < 8 &&
2655 K->value.i > MP_BITCNT_T_MAX )
2656 { too_large:
2657 r->value.i = 0;
2658 r->type = V_INTEGER;
2659 return TRUE;
2660 }
2661 bit = K->value.i;
2662 break;
2663 #ifdef O_GMP
2664 case V_MPZ:
2665 if ( mpz_sgn(K->value.mpz) < 0 )
2666 return notLessThanZero("bit", 2, K);
2667 if ( mpz_cmp_ui(K->value.mpz, MP_BITCNT_T_MAX) > 0 )
2668 goto too_large;
2669 bit = mpz_get_ui(K->value.mpz);
2670 break;
2671 #endif
2672 default:
2673 assert(0);
2674 }
2675
2676 if ( bit < 0 )
2677 return notLessThanZero("bit", 2, K);
2678
2679 switch(I->type)
2680 { case V_INTEGER:
2681 if ( I->value.i < 0 )
2682 return notLessThanZero("bit", 2, I);
2683
2684 if ( bit >= 8*sizeof(I->value.i) )
2685 goto too_large;
2686 r->value.i = (I->value.i & ((int64_t)1<<bit)) != 0;
2687 r->type = V_INTEGER;
2688 return TRUE;
2689 #ifdef O_GMP
2690 case V_MPZ:
2691 if ( mpz_sgn(I->value.mpz) < 0 )
2692 return notLessThanZero("bit", 2, I);
2693
2694 r->value.i = mpz_tstbit(I->value.mpz, bit);
2695 r->type = V_INTEGER;
2696 return TRUE;
2697 #endif
2698 default:
2699 assert(0);
2700 fail;
2701 }
2702 }
25242703
25252704
25262705 static int
32573436 * PROLOG CONNECTION *
32583437 *********************************/
32593438
3439 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3440 (*) valueExpression() cannot use GC, but can return a number whose value
3441 is a GPM number pointing at the global stack. If this is the case,
3442 PL_unify_number() may not invoke GC, so we must check that we have room
3443 for the required attribute wakeup and trailing before we start.
3444
3445 is/2 is the only victim of this issue, as the other arithmetic
3446 predicates (>/2, etc.) only use their arguments as inputs.
3447 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
3448
32603449 static
32613450 PRED_IMPL("is", 2, is, PL_FA_ISO) /* -Value is +Expr */
32623451 { PRED_LD
32633452 AR_CTX
32643453 number arg;
32653454 int rc;
3455
3456 if ( !hasGlobalSpace(0) ) /* see (*) */
3457 { if ( (rc=ensureGlobalSpace(0, ALLOW_GC)) != TRUE )
3458 return raiseStackOverflow(rc);
3459 }
32663460
32673461 AR_BEGIN();
32683462
34083602 ADD(FUNCTOR_msb1, ar_msb, 0),
34093603 ADD(FUNCTOR_lsb1, ar_lsb, 0),
34103604 ADD(FUNCTOR_popcount1, ar_popcount, 0),
3605 ADD(FUNCTOR_getbit2, ar_getbit, 0),
34113606 ADD(FUNCTOR_powm3, ar_powm, 0),
34123607
34133608 ADD(FUNCTOR_eval1, ar_eval, 0)
36253820 PRED_DEF("succ", 2, succ, 0)
36263821 PRED_DEF("plus", 3, plus, 0)
36273822 PRED_DEF("between", 3, between, PL_FA_NONDETERMINISTIC)
3823 #ifdef O_GMP
3824 PRED_DEF("divmod", 4, divmod, 0)
3825 PRED_DEF("nth_integer_root_and_remainder", 4,
3826 nth_integer_root_and_remainder, 0)
3827 #endif
36283828 PRED_DEF("set_random", 1, set_random, 0)
36293829 #ifdef O_RANDOM_STATE
36303830 PRED_DEF("random_property", 1, random_property, 0)
972972 } else
973973 { GET_LD
974974
975 if ( LD )
975 if ( HAS_LD )
976976 LD->atoms.unregistering = a;
977977 if ( (refs=ATOMIC_DEC(&p->references)) == 0 )
978978 ATOMIC_INC(&GD->atoms.unregistered);
10721072 unsigned int v;
10731073 static char *s = ".";
10741074
1075 Sdprintf("Resetting list constructor to ./2\n");
1075 DEBUG(0, Sdprintf("Resetting list constructor to ./2\n"));
10761076
10771077 for( ; ; ap2 = &(*ap2)->next )
10781078 { assert(*ap2); /* MT: TBD: failed a few times!? */
16141614 #include <pthread.h>
16151615 static pthread_once_t key_created = PTHREAD_ONCE_INIT;
16161616 static pthread_key_t key;
1617 #endif
16181617
16191618 static void
16201619 atom_generator_create_key(void)
16211620 { pthread_key_create(&key, NULL);
16221621 }
1622 #endif
16231623
16241624 static int
16251625 atom_generator(PL_chars_t *prefix, PL_chars_t *hit, int state)
16271627 size_t index;
16281628 int i, last=FALSE;
16291629
1630 #ifdef O_PLMT
16301631 if ( !LD )
16311632 pthread_once(&key_created, atom_generator_create_key);
1633 #endif
16321634
16331635 if ( !state )
16341636 { index = 1;
16351637 } else
1636 { if ( LD )
1638 { if ( HAS_LD )
16371639 index = LD->atoms.generator;
16381640 #ifdef O_PLMT
16391641 else
16531655 for(; index<upto; index++)
16541656 { Atom a = b[index];
16551657
1656 if ( is_signalled(LD) ) /* Notably allow windows version */
1658 if ( is_signalled(PASS_LD1) ) /* Notably allow windows version */
16571659 PL_handle_signals(); /* to break out on ^C */
16581660
16591661 if ( a && completion_candidate(a) &&
16611663 hit->length < ALT_SIZ &&
16621664 PL_cmp_text(prefix, 0, hit, 0, prefix->length) == 0 &&
16631665 is_identifier_text(hit) )
1664 { if ( LD )
1666 { if ( HAS_LD )
16651667 LD->atoms.generator = index+1;
16661668 #ifdef O_PLMT
16671669 else
0 /* $Id$
1
2 Part of SWI-Prolog
0 /* Part of SWI-Prolog
31
42 Author: Jan Wielemaker
5 E-mail: J.Wielemaker@uva.nl
3 E-mail: J.Wielemaker@vu.nl
64 WWW: http://www.swi-prolog.org
7 Copyright (C): 1985-2009, University of Amsterdam
5 Copyright (C): 2004-2015, University of Amsterdam
6 VU University Amsterdam
87
98 This library is free software; you can redistribute it and/or
109 modify it under the terms of the GNU Lesser General Public
3433 "Dynamic attributes, their hProlog implementation, and a first
3534 evaluation" by Bart Demoen, Report CW350, October 2002, Katholieke
3635 Universiteit Leuven.
36
37 An attributed is represented as a cell pointing with an TAG_ATTVAR to
38 the linked list of attributes:
39
40
41 ----------
42 | refptr | <--- newer attvars <--- LD->attvar.attvars
43 ----------
44 | attvar | --\
45 ---------- | TAG_ATTVAR|STG_GLOBAL pointer
46 | att/3 | <-/
47 ----------
48 | name |
49 ----------
50 | value |
51 ----------
52 | <tail> |
53 ----------
54
55 Binding the attvar places the new value in <attvar> using a trailed
56 assignment. The attribute list remains accessible through the trailed
57 assignment until this is GC'ed.
3758 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
3859
3960 #ifdef O_DEBUG
147168 assert(isAttVar(*av));
148169 assert(!isRef(*value));
149170 assert(gTop+7 <= gMax && tTop+6 <= tMax);
171 DEBUG(CHK_SECURE, assert(on_attvar_chain(av)));
150172
151173 DEBUG(1, Sdprintf("assignAttVar(%s)\n", vName(av)));
152174
174196
175197
176198 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
177 SHIFT-SAFE: Requires 2+0
199 Link known attributes variables into a reference list.
200 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
201
202 static Word
203 link_attvar(ARG1_LD)
204 { Word gp = gTop++;
205
206 register_attvar(gp PASS_LD);
207
208 return gp+1;
209 }
210
211
212 Word
213 alloc_attvar(ARG1_LD)
214 { Word gp = allocGlobalNoShift(3);
215
216 if ( gp )
217 { register_attvar(&gp[0] PASS_LD);
218 gp[1] = consPtr(&gp[2], TAG_ATTVAR|STG_GLOBAL);
219 gp[2] = ATOM_nil;
220 return &gp[1];
221 }
222
223 return NULL;
224 }
225
226
227 int
228 on_attvar_chain(Word avp)
229 { GET_LD
230 Word p, next;
231
232 for(p = LD->attvar.attvars; p; p = next)
233 { Word avp0 = p+1;
234 next = isRef(*p) ? unRef(*p) : NULL;
235
236 if ( avp0 == avp )
237 return TRUE;
238 }
239
240 DEBUG(0, char buf[256];
241 Sdprintf("%s: not on attvar chain\n", print_addr(avp, buf)));
242
243 return FALSE;
244 }
245
246
247 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
248 The creation of an attributed variable is trailed if call_residue_vars/2
249 is active. This is needed to avoid that an attributed variable that is
250 destroyed on backtracking (and thus should not be reported) survives due
251 to a frozen stack.
252 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
253
254 static inline void
255 trail_new_attvar(Word p ARG_LD)
256 { if ( LD->attvar.call_residue_vars_count )
257 { tTop->address = p;
258 tTop++;
259 }
260 }
261
262
263 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
264 SHIFT-SAFE: Requires 3 global + 2 trail
178265 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
179266
180267 static void
181268 make_new_attvar(Word p ARG_LD)
182269 { Word gp;
183270
184 assert(gTop+2 <= gMax && tTop+1 <= tMax);
185
186 if ( p >= (Word)lBase )
187 { gp = gTop;
188 gp[1] = ATOM_nil;
189 gp[0] = consPtr(&gp[1], TAG_ATTVAR|STG_GLOBAL);
190 *p = makeRefG(gp);
191 gTop += 2;
192 LTrail(p);
193 } else
194 { gp = gTop;
195 gp[0] = ATOM_nil;
196 *p = consPtr(&gp[0], TAG_ATTVAR|STG_GLOBAL);
197 gTop += 1;
198 GTrail(p);
199 }
271 assert(gTop+3 <= gMax && tTop+1 <= tMax);
272
273 gp = link_attvar(PASS_LD1);
274 gp[1] = ATOM_nil;
275 gp[0] = consPtr(&gp[1], TAG_ATTVAR|STG_GLOBAL);
276 gTop += 2;
277
278 trail_new_attvar(gp PASS_LD);
279 Trail(p, makeRefG(gp));
200280 }
201281
202282
203283 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
204 SHIFT-SAFE: Requires 6 global + 1 trail
284 SHIFT-SAFE: Requires 7 global + 2 trail
205285 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
206286
207287 static void
208288 put_new_attvar(Word p, atom_t name, Word value ARG_LD)
209289 { Word gp, at;
210290
211 assert(gTop+6 <= gMax && tTop+1 <= tMax);
212
213 gp = gTop;
214 if ( p >= (Word)lBase )
215 { gTop += 6;
216 at = &gp[1];
217 setVar(*at);
218 gp[0] = consPtr(&gp[1], TAG_ATTVAR|STG_GLOBAL);
219 *p = makeRefG(&gp[0]);
220 LTrail(p);
221 } else
222 { gTop += 5;
223 at = &gp[0];
224 setVar(*at);
225 *p = consPtr(&gp[0], TAG_ATTVAR|STG_GLOBAL);
226 GTrail(p);
227 }
291 assert(gTop+7 <= gMax && tTop+1 <= tMax);
292
293 gp = link_attvar(PASS_LD1);
294 gTop += 6;
295 at = &gp[1];
296 setVar(*at);
297 gp[0] = consPtr(&gp[1], TAG_ATTVAR|STG_GLOBAL);
228298
229299 at[1] = FUNCTOR_att3;
230300 at[2] = name;
231301 at[3] = linkVal(value);
232302 at[4] = ATOM_nil;
233303 at[0] = consPtr(&at[1], TAG_COMPOUND|STG_GLOBAL);
304
305 trail_new_attvar(gp PASS_LD);
306 Trail(p, makeRefG(gp));
234307 }
235308
236309
427500 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
428501
429502 int
430 saveWakeup(wakeup_state *state, int forceframe, ARG1_LD)
503 saveWakeup(wakeup_state *state, int forceframe ARG_LD)
431504 { Word h;
432505
433506 state->flags = 0;
628701 deRef(av);
629702
630703 if ( isVar(*av) )
631 { make_new_attvar(av PASS_LD); /* SHIFT: 2+0 */
704 { make_new_attvar(av PASS_LD); /* SHIFT: 3+0 */
632705 deRef(av);
633706 } else if ( !isAttVar(*av) )
634707 { return PL_error("put_attrs", 2, NULL, ERR_UNINSTANTIATION, 1, A1);
737810 deRef(goal);
738811
739812 if ( isVar(*v) )
740 { put_new_attvar(v, ATOM_freeze, goal PASS_LD); /* SHIFT: 6+1 */
813 { put_new_attvar(v, ATOM_freeze, goal PASS_LD); /* SHIFT: 6+2 */
741814 } else
742815 { Word vp;
743816
10761149 *******************************/
10771150
10781151 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1079 $new_choice_point(-Chp) is det.
1080
1081 Unify Chp with a reference to a new choicepoint.
1152 has_attributes_after(Word av, Choice ch) is true if the attributed
1153 variable av has attributes created or modified after the choicepoint ch.
1154
1155 We compute this by marking all trailed assignments and scanning the
1156 attribute list for terms that are newer than the choicepoint or having a
1157 value that is changed due to a trailed assignment.
10821158 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
10831159
1084 static
1085 PRED_IMPL("$get_choice_point", 1, get_choice_point, 0)
1086 { PRED_LD
1087 Choice ch;
1088
1089 for(ch=LD->choicepoints; ch; ch=ch->parent)
1090 { if ( ch->type == CHP_CLAUSE )
1091 { intptr_t off = (Word)ch - (Word)lBase;
1092
1093 if ( PL_unify_integer(A1, off) )
1094 succeed;
1160 static inline word
1161 get_value(Word p)
1162 { return (*p) & ~MARK_MASK;
1163 }
1164
1165 static Word
1166 deRefM(Word p, Word pv ARG_LD)
1167 { for(;;)
1168 { word w = get_value(p);
1169
1170 if ( isRef(w) )
1171 { p = unRef(w);
1172 } else
1173 { *pv = w;
1174 return p;
10951175 }
10961176 }
1097
1098 fail;
1099 }
1100
1101
1102 static inline size_t
1103 offset_cell(Word p)
1104 { word m = *p; /* was get_value(p) */
1105 size_t offset;
1106
1107 if ( storage(m) == STG_LOCAL )
1108 offset = wsizeofInd(m) + 1;
1109 else
1110 offset = 0;
1111
1112 return offset;
1113 }
1114
1115
1116 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1117 has_attributes_after(Word av, Choice ch) is true if the attributed
1118 variable av has attributes created after the choicepoint ch. Note that
1119 the current implementation only deals with attributes created after the
1120 ch or an attribute value set to a compound term created after the
1121 choicepoint ch. Notably atomic value-changes are *not* tracked.
1122
1123 1 ?- put_attr(X, a, 1), call_residue_vars(put_attr(X, a, 2), V).
1124
1125 V = []
1126 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
1177 }
1178
11271179
11281180 static int
11291181 has_attributes_after(Word av, Choice ch ARG_LD)
11301182 { Word l;
1131
1132 DEBUG(1, Sdprintf("has_attributes_after(%s, %p)\n",
1133 vName(av), ch->mark.globaltop));
1134
1135 deRef(av);
1136 assert(isAttVar(*av));
1137 l = valPAttVar(*av);
1183 word w;
1184
1185 DEBUG(MSG_CALL_RESIDUE_VARS,
1186 { char buf[64];
1187 Sdprintf("has_attributes_after(%s, %s)\n",
1188 vName(av), print_addr(ch->mark.globaltop, buf));
1189 });
1190
1191 av = deRefM(av, &w PASS_LD);
1192 assert(isAttVar(w));
1193 l = valPAttVar(w);
11381194
11391195 for(;;)
1140 { deRef(l);
1141
1142 if ( isNil(*l) )
1196 { l = deRefM(l, &w PASS_LD);
1197
1198 if ( isNil(w) )
11431199 { fail;
1144 } else if ( isTerm(*l) )
1145 { Functor f = valueTerm(*l);
1146
1147 DEBUG(1, Sdprintf("\tterm at %p\n", f));
1200 } else if ( isTerm(w) )
1201 { Functor f = valueTerm(w);
1202
1203 DEBUG(MSG_CALL_RESIDUE_VARS,
1204 { char buf[64];
1205 Sdprintf(" att/3 at %s\n", print_addr((Word)f, buf));
1206 });
11481207
11491208 if ( (Word)f >= ch->mark.globaltop )
1150 succeed;
1209 return TRUE; /* created after choice */
11511210
11521211 if ( f->definition == FUNCTOR_att3 )
1153 { if ( isTerm(f->arguments[1]) &&
1154 (Word)valueTerm(f->arguments[1]) >= ch->mark.globaltop )
1155 succeed;
1156
1157 l = &f->arguments[2];
1212 { Word pv = &f->arguments[1]; /* pointer to value */
1213
1214 DEBUG(MSG_CALL_RESIDUE_VARS,
1215 { char buf1[64]; char buf2[64];
1216 Sdprintf(" value at %s: %s\n",
1217 print_addr(pv, buf1), print_val(*pv, buf2));
1218 });
1219
1220 if ( is_marked(pv) )
1221 return TRUE; /* modified after choice point */
1222 (void)deRefM(pv, &w PASS_LD);
1223 if ( isTerm(w) &&
1224 (Word)valueTerm(w) >= ch->mark.globaltop )
1225 return TRUE; /* argument term after choice point */
1226
1227 l = pv+1;
11581228 } else
11591229 { DEBUG(0, Sdprintf("Illegal attvar\n"));
1160 fail;
1230 return FALSE;
11611231 }
11621232 } else
11631233 { DEBUG(0, Sdprintf("Illegal attvar\n"));
1164 fail;
1234 return FALSE;
11651235 }
11661236 }
11671237 }
11681238
11691239
11701240 static void
1171 scan_trail(int set)
1172 { GET_LD
1173 TrailEntry te;
1174
1175 for(te=tTop-1; te>=tBase; te--)
1241 scan_trail(Choice ch, int set ARG_LD)
1242 { TrailEntry te, base;
1243
1244 base = ch->mark.trailtop;
1245
1246 for(te=tTop-1; te>=base; te--)
11761247 { if ( isTrailVal(te->address) )
1177 { Word p = trailValP(te->address);
1178
1179 te--;
1180 if ( isAttVar(*p) )
1181 { DEBUG(1, Sdprintf("Trailed attvar assignment at %p\n", p));
1182 if ( set )
1183 *p |= MARK_MASK;
1184 else
1185 *p &= ~MARK_MASK;
1248 { te--;
1249 if ( set )
1250 { DEBUG(MSG_CALL_RESIDUE_VARS,
1251 { char buf1[64]; char buf2[64];
1252 word old = trailVal(te[1].address);
1253 Sdprintf("Mark %s (%s)\n",
1254 print_addr(te->address, buf1), print_val(old, buf2));
1255 });
1256 *te->address |= MARK_MASK;
1257 } else
1258 { *te->address &= ~MARK_MASK;
11861259 }
11871260 }
11881261 }
12021275 { PRED_LD
12031276 intptr_t off;
12041277 Choice ch;
1205 Word gp, gend, list, tailp;
1278 Word p, next, gend, list, tailp;
1279
1280 if ( !PL_get_intptr_ex(A1, &off) )
1281 return FALSE;
12061282
12071283 retry:
1208 if ( !PL_get_intptr_ex(A1, &off) )
1209 fail;
1210
12111284 ch = (Choice)((Word)lBase+off);
1285 if ( !existingChoice(ch PASS_LD) )
1286 return PL_error(NULL, 0, NULL, ERR_EXISTENCE, ATOM_choice, A1);
1287
1288 if ( !LD->attvar.attvars )
1289 return PL_unify_nil(A2);
1290
12121291 list = tailp = allocGlobalNoShift(1);
12131292 if ( !list )
12141293 goto grow;
12151294 setVar(*list);
12161295
1217 startCritical;
1218 scan_trail(TRUE);
1219
1220 for(gp=gBase, gend = gTop; gp<gend; gp += offset_cell(gp)+1)
1221 { if ( isAttVar(*gp) &&
1222 !is_marked(gp) &&
1223 has_attributes_after(gp, ch PASS_LD) )
1296 scan_trail(ch, TRUE PASS_LD);
1297
1298 gend = gTop;
1299 for(p=LD->attvar.attvars; p; p=next)
1300 { Word pav = p+1;
1301 next = isRef(*p) ? unRef(*p) : NULL;
1302
1303 if ( isAttVar(*pav) &&
1304 has_attributes_after(pav, ch PASS_LD) )
12241305 { Word p = allocGlobalNoShift(3);
12251306
12261307 if ( p )
12271308 { p[0] = FUNCTOR_dot2;
1228 p[1] = makeRefG(gp);
1309 p[1] = makeRefG(pav);
12291310 setVar(p[2]);
12301311 *tailp = consPtr(p, TAG_COMPOUND|STG_GLOBAL);
12311312 tailp = &p[2];
12321313 } else
12331314 { gTop = gend;
1234 scan_trail(FALSE);
1235 if ( !endCritical )
1236 return FALSE;
1315 scan_trail(ch, FALSE PASS_LD);
12371316 goto grow;
12381317 }
12391318 }
12401319 }
12411320
1242 scan_trail(FALSE);
1243 if ( !endCritical )
1244 return FALSE;
1321 scan_trail(ch, FALSE PASS_LD);
12451322
12461323 if ( list == tailp )
12471324 { gTop = gend;
12601337 if ( !makeMoreStackSpace(GLOBAL_OVERFLOW, ALLOW_SHIFT|ALLOW_GC) )
12611338 return FALSE;
12621339 goto retry;
1340 }
1341
1342 static
1343 PRED_IMPL("$call_residue_vars_start", 0, call_residue_vars_start, 0)
1344 { PRED_LD
1345
1346 LD->attvar.call_residue_vars_count++;
1347 return TRUE;
1348 }
1349
1350 static
1351 PRED_IMPL("$call_residue_vars_end", 0, call_residue_vars_end, 0)
1352 { PRED_LD
1353
1354 assert(LD->attvar.call_residue_vars_count>0);
1355 LD->attvar.call_residue_vars_count--;
1356
1357 return TRUE;
12631358 }
12641359
12651360 #endif /*O_CALL_RESIDUE*/
12811376 PRED_DEF("$eval_when_condition", 2, eval_when_condition, 0)
12821377 PRED_DEF("$suspend", 3, suspend, PL_FA_TRANSPARENT)
12831378 #ifdef O_CALL_RESIDUE
1284 PRED_DEF("$get_choice_point", 1, get_choice_point, 0)
12851379 PRED_DEF("$attvars_after_choicepoint", 2, attvars_after_choicepoint, 0)
1380 PRED_DEF("$call_residue_vars_start", 0, call_residue_vars_start, 0)
1381 PRED_DEF("$call_residue_vars_end", 0, call_residue_vars_end, 0)
12861382 #endif
12871383 EndPredDefs
12881384
127127 if ( !LD->bags.bags ) /* outer one */
128128 { if ( !LD->bags.default_bag )
129129 {
130 #ifdef O_ATOMGC
130 #if defined(O_ATOMGC) && defined(O_PLMT)
131131 simpleMutexInit(&LD->bags.mutex);
132132 #endif
133133 LD->bags.default_bag = PL_malloc(sizeof(*bag));
157157 #define ARG_LD , ARG1_LD
158158 #define PASS_LD1 LD
159159 #define PASS_LD , LD
160 #define PASS_LDARG1(x) x
161 #define PASS_LDARG(x) , x
160162 #define LOCAL_LD __PL_ld
161163 #define IGNORE_LD (void)__PL_ld;
164 #define HAS_LD (LD != 0)
162165
163166 #else
164167
165168 #define GET_LD
169 #define PRED_LD
166170 #define ARG_LD
167171 #define ARG1_LD void
168172 #define PASS_LD
169173 #define PASS_LD1
174 #define PASS_LDARG1(x)
175 #define PASS_LDARG(x)
170176 #define LOCAL_LD (&PL_local_data)
171177 #define GLOBAL_LD (&PL_local_data)
172178 #define LD GLOBAL_LD
173179 #define IGNORE_LD
180 #define HAS_LD (1)
174181
175182 #endif
176183
221228 { uintptr_t context; /* context value */
222229 frg_code control; /* FRG_* action */
223230 struct PL_local_data *engine; /* invoking engine */
231 struct definition *predicate; /* called Prolog predicate */
224232 } *control_t;
225233
226234 #define FRG_REDO_MASK 0x03
22 Author: Jan Wielemaker
33 E-mail: J.Wielemaker@cs.vu.nl
44 WWW: http://www.swi-prolog.org
5 Copyright (C): 1985-2013, University of Amsterdam
5 Copyright (C): 1985-2015, University of Amsterdam
66 VU University Amsterdam
77
88 This library is free software; you can redistribute it and/or
38823882 continue;
38833883 #ifdef O_DEBUGGER
38843884 case D_BREAK:
3885 c = decode(replacedBreak(PC-1));
3885 c = decode(replacedBreak(PC));
38863886 goto again;
38873887 #endif
38883888 default:
66966696 code dop = decode(op);
66976697
66986698 if ( !breakTable )
6699 breakTable = newHTable(16);
6699 breakTable = newHTable(16|TABLE_UNLOCKED);
67006700
67016701 if ( (codeTable[dop].flags & VIF_BREAK) || dop == B_UNIFY_EXIT )
67026702 { BreakPoint bp = allocHeapOrHalt(sizeof(break_point));
67876787 BreakPoint bp;
67886788 code c;
67896789
6790 if ( !breakTable || !(s=lookupHTable(breakTable, PC)) )
6791 return (code) sysError("No saved instruction for break");
6792 bp = (BreakPoint)s->value;
6793 c = bp->saved_instruction;
6790 PL_LOCK(L_BREAK);
6791 c = decode(*PC);
6792 if ( c == D_BREAK )
6793 { if ( (s=lookupHTable(breakTable, PC)) )
6794 { bp = (BreakPoint)s->value;
6795 c = bp->saved_instruction;
6796 } else
6797 { PL_UNLOCK(L_BREAK);
6798 sysError("No saved instruction for break at %p", PC);
6799 }
6800 }
6801 PL_UNLOCK(L_BREAK);
67946802
67956803 return c;
67966804 }
421421 } else
422422 { Word attr;
423423
424 if ( !(attr = allocGlobalNoShift(1)) )
424 if ( !(attr = alloc_attvar(PASS_LD1)) )
425425 { rc = GLOBAL_OVERFLOW;
426426 goto out;
427427 }
428428 TrailCyclic(p PASS_LD);
429429 TrailCyclic(from PASS_LD);
430 *from = consPtr(to, STG_GLOBAL|TAG_ATTVAR);
431 *to = consPtr(attr, STG_GLOBAL|TAG_ATTVAR);
430 *from = consPtr(attr, STG_GLOBAL|TAG_ATTVAR);
431 *to = makeRefG(attr);
432432
433433 from = p;
434 to = attr;
434 to = &attr[1];
435435 goto again;
436436 }
437437 } else
2727
2828 #define INCLUDE_DDEML_H
2929 #include "pl-incl.h"
30
31 #include <windows.h>
3032
3133 #if O_DDE
3234 #include <string.h>
111111 DEBUG_TOPIC(MSG_SHIFT_FRAME),
112112 DEBUG_TOPIC(MSG_STACK_OVERFLOW),
113113
114 DEBUG_TOPIC(MSG_ATTVAR_LINK),
115 DEBUG_TOPIC(MSG_CALL_RESIDUE_VARS),
116
114117 DEBUG_TOPIC(CHK_SECURE),
115118 DEBUG_TOPIC(CHK_HIGH_ARITY),
116119 DEBUG_TOPIC(CHK_HIGHER_ADDRESS),
110110 #define MSG_SHIFT_FRAME 125
111111 #define MSG_STACK_OVERFLOW 126
112112
113 #define MSG_ATTVAR_LINK 150
114 #define MSG_CALL_RESIDUE_VARS 151
115
113116 #define CHK_SECURE 1000
114117 #define CHK_HIGH_ARITY 1001
115118 #define CHK_HIGHER_ADDRESS 1002
289289 }
290290
291291
292 #if defined(O_PLMT) || defined(O_MULTIPLE_ENGINES)
293 #define GET_LDARG(x) PL_local_data_t *__PL_ld = (x)
294 #else
295 #define GET_LDARG(x)
296 #endif
297
292298 static int
293299 compare_dict_entry(const void *a, const void *b, void *arg)
294 { PL_local_data_t *__PL_ld = arg;
300 { GET_LDARG(arg);
295301 Word p = (Word)a;
296302 Word q = (Word)b;
297303
331337 { const int *ip1 = a;
332338 const int *ip2 = b;
333339 order_term_refs *ctx = arg;
334 PL_local_data_t *__PL_ld = ctx->ld;
340 GET_LDARG(ctx->ld);
335341 Word p = valTermRef(ctx->av[*ip1*2]);
336342 Word q = valTermRef(ctx->av[*ip2*2]);
337343
810816 { int *ip1 = (int*)a1;
811817 int *ip2 = (int*)a2;
812818 cmp_dict_index_data *ctx = arg;
813 PL_local_data_t *__PL_ld = ctx->ld;
819 GET_LDARG(ctx->ld);
814820 Word p = &ctx->data[*ip1*2];
815821 Word q = &ctx->data[*ip2*2];
816822 int rc;
978984 }
979985
980986 int
981 resortDictsInClause(Clause clause)
982 { Code PC, end;
983
984 PC = clause->codes;
985 end = &PC[clause->code_size];
986
987 resortDictsInCodes(Code PC, Code end)
988 {
987989 for( ; PC < end; PC = stepPC(PC) )
988990 { code op = fetchop(PC);
989991
10151017 fields_start = PC;
10161018
10171019 for(f = 0; f < fields; f++)
1018 { code op = fetchop(PC);
1020 { Code PCv;
1021 code op = fetchop(PC);
10191022
10201023 kv_pos[f].start = PC-fields_start;
10211024
10311034 return TRUE; /* not a dict */
10321035 }
10331036 PC = stepPC(PC); /* skip key */
1037 PCv = PC;
10341038 PC = skipArgs(PC, 1); /* skip value */
1039
1040 if ( !resortDictsInCodes(PCv, PC) )
1041 { return FALSE;
1042 }
10351043
10361044 kv_pos[f].len = PC-fields_start-kv_pos[f].start;
10371045
10741082 }
10751083
10761084 return TRUE;
1085 }
1086
1087 int
1088 resortDictsInClause(Clause clause)
1089 { Code PC, end;
1090
1091 PC = clause->codes;
1092 end = &PC[clause->code_size];
1093
1094 return resortDictsInCodes(PC, end);
10771095 }
10781096
10791097
13441362 static int
13451363 put_pair(term_t key, term_t value, int last, void *closure)
13461364 { dict_pairs_ctx *ctx = closure;
1347 PL_local_data_t *__PL_ld = ctx->ld;
1365 GET_LDARG(ctx->ld);
13481366
13491367 if ( PL_cons_functor(ctx->tmp, FUNCTOR_minus2, key, value) &&
13501368 PL_unify_list_ex(ctx->tail, ctx->head, ctx->tail) &&
13531371
13541372 return -1;
13551373 }
1374
1375 #undef GET_LDARG
13561376
13571377
13581378 static
5050
5151 Flags almost always is TRACE_ME. Additional common flags:
5252
53 P_TRANSPARENT Predicate is module transparent
53 P_TRANSPARENT Predicate is module transparent
5454 P_NONDET Predicate can be resatisfied
55
56 Deprecated: the modern interface uses PRED_IMPL()
5557 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
5658
5759 #define NOTRACE PL_FA_NOTRACE
7981 FRG("sub_atom", 5, pl_sub_atom, NDET|ISO),
8082 FRG("sleep", 1, pl_sleep, 0),
8183 FRG("break", 0, pl_break, 0),
82 FRG("notrace", 1, pl_notrace1, META),
8384
8485 FRG("write_canonical", 1, pl_write_canonical, ISO),
8586 FRG("write_term", 2, pl_write_term, META|ISO),
461462 #ifdef O_ATTVAR
462463 LOOKUPPROC(dwakeup1);
463464 #endif
464 #ifdef O_CALL_RESIDUE
465 PROCEDURE_call_residue_vars2 =
466 PL_predicate("call_residue_vars", 2, "$attvar");
467 #endif
468465 #if O_DEBUGGER
469466 PROCEDURE_event_hook1 =
470467 PL_predicate("prolog_event_hook", 1, "user");
36563656 { return ForeignControl(h);
36573657 }
36583658
3659 predicate_t /* = Procedure */
3660 PL_foreign_context_predicate(control_t h)
3661 { Definition def = h->predicate;
3662
3663 return isCurrentProcedure(def->functor->functor, def->module);
3664 }
36593665
36603666 static int
36613667 copy_exception(term_t ex, term_t bin ARG_LD)
37543760 PL_clear_exception(void)
37553761 { GET_LD
37563762
3757 resumeAfterException(TRUE, LD->outofstack);
3758 LD->outofstack = NULL;
3763 if ( exception_term )
3764 { resumeAfterException(TRUE, LD->outofstack);
3765 LD->outofstack = NULL;
3766 }
37593767 }
37603768
37613769
38563864 return PL_new_module(PL_new_atom(module));
38573865 else
38583866 { GET_LD
3859 return (LD && environment_frame ? contextModule(environment_frame)
3860 : MODULE_user);
3867 return (HAS_LD && environment_frame ? contextModule(environment_frame)
3868 : MODULE_user);
38613869 }
38623870 }
38633871
40324040
40334041 int
40344042 PL_pending__LD(int sig ARG_LD)
4035 { if ( sig > 0 && sig <= MAXSIGNAL && LD )
4043 { if ( sig > 0 && sig <= MAXSIGNAL && HAS_LD )
40364044 { int off = (sig-1)/32;
40374045 int mask = 1 << ((sig-1)%32);
40384046
40454053
40464054 int
40474055 PL_clearsig__LD(int sig ARG_LD)
4048 { if ( sig > 0 && sig <= MAXSIGNAL && LD )
4056 { if ( sig > 0 && sig <= MAXSIGNAL && HAS_LD )
40494057 { int off = (sig-1)/32;
40504058 int mask = 1 << ((sig-1)%32);
40514059
45414549 case PL_QUERY_ENCODING:
45424550 { GET_LD
45434551
4544 if ( LD )
4552 if ( HAS_LD )
45454553 return LD->encoding;
45464554 return PL_local_data.encoding; /* Default: of main thread? */
45474555 }
3434 COMMON(int) saveWakeup(wakeup_state *state, int forceframe ARG_LD);
3535 COMMON(void) restoreWakeup(wakeup_state *state ARG_LD);
3636 COMMON(int) PL_get_attr__LD(term_t t, term_t a ARG_LD);
37 COMMON(int) on_attvar_chain(Word avp);
38 COMMON(Word) alloc_attvar(ARG1_LD);
3739
3840 /* pl-gvar.c */
3941
5759 COMMON(int) raiseSignal(PL_local_data_t *ld, int sig);
5860 COMMON(Module) contextModule(LocalFrame fr);
5961 COMMON(void) setContextModule(LocalFrame fr, Module context);
62 COMMON(int) existingChoice(Choice ch ARG_LD);
6063
6164 /* pl-stream.c */
6265
382385 COMMON(intptr_t) skip_list(Word l, Word *tailp ARG_LD);
383386 COMMON(intptr_t) lengthList(term_t list, int errors);
384387 COMMON(int) is_acyclic(Word p ARG_LD);
385 COMMON(int) numberVars(term_t t, nv_options *opts, int n ARG_LD);
388 COMMON(intptr_t) numberVars(term_t t, nv_options *opts, intptr_t n ARG_LD);
386389 COMMON(int) duplicate_term(term_t in, term_t copy ARG_LD);
387390 COMMON(word) stringToList(char *s);
388391 COMMON(foreign_t) pl_sub_atom(term_t atom,
418421
419422 /* pl-pro.c */
420423 COMMON(word) pl_break(void);
421 COMMON(word) pl_notrace1(term_t goal);
422424 COMMON(int) currentBreakLevel(void);
423425 COMMON(int) callProlog(Module module, term_t goal, int flags, term_t *ex);
424426 COMMON(int) abortProlog(void);
22 Author: Jan Wielemaker
33 E-mail: J.Wielemake@cs.vu.nl
44 WWW: http://www.swi-prolog.org
5 Copyright (C): 1985-2012, University of Amsterdam
5 Copyright (C): 1985-2015, University of Amsterdam
66 VU University Amsterdam
77
88 This library is free software; you can redistribute it and/or
9595 If the CHK_SECURE prolog_debug flag is set some additional expensive
9696 consistency checks that need considerable amounts of memory and cpu time
9797 are added. Garbage collection gets about 3-4 times as slow.
98 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
99
100 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
101 call_residue_vars(:Goal, -Vars) should avoid that the attvars are
102 reclaimed by GC. Unfortunately, mark_attvars() is broken because:
103
104 - Seems there is something wrong calling mark_variable() directly on
105 the pointer. This can be fixed, worst case by using a temporary
106 term reference.
107 - We also need to sweep. There is no good place to do that.
108
109 A solution would be to reference the attvars from term references, just
110 like global variables. The problem is that we do not know how many there
111 are and computing that upfront is rather expensive.
112
113 For now, we disable trying to rescue attvars from GC.
98114 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
99115
100116 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
802818 }
803819
804820
821 static void
822 save_grefs(ARG1_LD)
823 {
824 #ifdef O_ATTVAR
825 if ( LD->attvar.attvars )
826 { *valTermRef(LD->attvar.gc_attvars) = makeRefG(LD->attvar.attvars);
827 }
828 #endif
829 }
830
831 static void
832 restore_grefs(ARG1_LD)
833 {
834 #ifdef O_ATTVAR
835 if ( LD->attvar.attvars )
836 { LD->attvar.attvars = unRef(*valTermRef(LD->attvar.gc_attvars));
837 setVar(*valTermRef(LD->attvar.gc_attvars));
838 }
839 #endif
840 }
841
842
805843 #ifdef O_GVAR
806844
807845 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9891027
9901028
9911029 #ifdef O_CALL_RESIDUE
992 static void
993 mark_attvars()
994 { GET_LD
995 Word gp;
996
997 for( gp = gBase; gp < gTop; gp += (offset_cell(gp)+1) )
998 { if ( isAttVar(*gp) && !is_marked(gp) )
999 { DEBUG(MSG_GC_MARK_ATTVAR, Sdprintf("mark_attvars(): marking %p\n", gp));
1000 mark_variable(gp PASS_LD);
1001 }
1002 }
1003 }
1030 static size_t
1031 count_need_protection_attvars(ARG1_LD)
1032 { Word p, next;
1033 size_t attvars = 0;
1034
1035 for(p=LD->attvar.attvars; p; p = next)
1036 { Word avp = p+1;
1037
1038 next = isRef(*p) ? unRef(*p) : NULL;
1039 if ( isAttVar(*avp) )
1040 attvars++;
1041 }
1042
1043 return attvars;
1044 }
1045
1046 static fid_t
1047 link_attvars(ARG1_LD)
1048 { if ( LD->attvar.call_residue_vars_count &&
1049 LD->attvar.attvars )
1050 { fid_t fid = PL_open_foreign_frame();
1051 Word p, next;
1052
1053 for(p=LD->attvar.attvars; p; p = next)
1054 { Word avp = p+1;
1055
1056 next = isRef(*p) ? unRef(*p) : NULL;
1057 if ( isAttVar(*avp) )
1058 { term_t t = PL_new_term_ref_noshift();
1059
1060 assert(t);
1061 *valTermRef(t) = makeRefG(avp);
1062 }
1063 }
1064
1065 return fid;
1066 } else
1067 return 0;
1068 }
1069
1070 static void
1071 restore_attvars(fid_t attvars ARG_LD)
1072 { if ( attvars )
1073 PL_close_foreign_frame(attvars);
1074 }
1075
1076
10041077 #endif /*O_CALL_RESIDUE*/
10051078
10061079
10921165 return def->functor->arity;
10931166
10941167 return fr->clause->value.clause->prolog_vars;
1095 }
1096
1097
1098 static inline void
1099 check_call_residue(LocalFrame fr ARG_LD)
1100 {
1101 #ifdef O_CALL_RESIDUE
1102 if ( fr->predicate == PROCEDURE_call_residue_vars2->definition )
1103 { if ( !LD->gc.marked_attvars )
1104 { mark_attvars();
1105 LD->gc.marked_attvars = TRUE;
1106 }
1107 }
1108 #endif
11091168 }
11101169
11111170
18431902 if ( false(fr, FR_MARKED) )
18441903 { set(fr, FR_MARKED);
18451904 COUNT(marked_envs);
1846 check_call_residue(fr PASS_LD);
18471905 mark_environments(state, fr->parent, fr->programPointer PASS_LD);
18481906 }
18491907 break;
19021960 state.flags = GCM_CLEAR;
19031961
19041962 COUNT(marked_envs);
1905 check_call_residue(fr PASS_LD);
19061963 } else
19071964 { state.flags = 0;
19081965 }
22132270 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
22142271
22152272 static void
2216 tag_trail()
2217 { GET_LD
2218 TrailEntry te;
2273 tag_trail(ARG1_LD)
2274 { TrailEntry te;
22192275
22202276 for( te = tTop; --te >= tBase; )
22212277 { Word p = te->address;
22422298
22432299
22442300 static void
2245 untag_trail()
2246 { GET_LD
2247 TrailEntry te;
2301 untag_trail(ARG1_LD)
2302 { TrailEntry te;
22482303
22492304 for(te = tBase; te < tTop; te++)
22502305 { if ( te->address )
22512306 { word mask = ttag(te->address);
22522307
22532308 te->address = (Word)((word)valPtr((word)te->address)|mask);
2254 }
2255 }
2256 }
2257
2309 #ifdef O_ATTVAR
2310 if ( isTrailVal(te->address) )
2311 { word w = trailVal(te->address);
2312
2313 if ( isAttVar(w) )
2314 { Word avp = te[-1].address;
2315
2316 DEBUG(CHK_SECURE, assert(on_attvar_chain(avp)));
2317 if ( !isAttVar(*avp) )
2318 *(avp) |= MARK_MASK;
2319 }
2320 }
2321 #endif
2322 }
2323 }
2324 }
2325
2326 #ifdef O_ATTVAR
2327
2328 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2329 Remove dead cells from the attvar administration. This is a chain of
2330 variable references located just below each attvar. An attvar is dead if
2331 the value is no longer a TAG_ATTVAR reference and there is no trailed
2332 assignment for it.
2333 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
2334
2335 static int
2336 is_dead_attvar(Word p ARG_LD)
2337 { word w = *p;
2338
2339 if ( (w & MARK_MASK) )
2340 { *p = (w & ~MARK_MASK);
2341 return FALSE;
2342 }
2343 if ( isAttVar(w) )
2344 return FALSE;
2345
2346 return TRUE;
2347 }
2348
2349
2350 static void
2351 clean_attvar_chain(ARG1_LD)
2352 { Word p, last = NULL, next;
2353 #ifdef O_DEBUG
2354 size_t cleaned = 0;
2355 #endif
2356
2357 for(p = LD->attvar.attvars; p; p = next)
2358 { Word avp = p+1;
2359
2360 next = isRef(*p) ? unRef(*p) : NULL;
2361
2362 if ( is_dead_attvar(avp PASS_LD) )
2363 { if ( last )
2364 *last = *p;
2365 else
2366 LD->attvar.attvars = next;
2367 #ifdef O_DEBUG
2368 cleaned++;
2369 #endif
2370 } else
2371 last = p;
2372 }
2373
2374 DEBUG(MSG_ATTVAR_LINK,
2375 if ( cleaned )
2376 Sdprintf("Cleaned %ld attvars\n", cleaned));
2377 }
2378
2379 #endif /*ATTVAR*/
22582380
22592381 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
22602382 Make a hole. This is used by functions doing a scan on the global data
35383660 }
35393661
35403662 assert(scan_global(FALSE));
3663 if ( LD->attvar.attvars )
3664 checkData(LD->attvar.attvars);
35413665
35423666 local_frames = 0;
35433667 choice_count = 0;
36623786 lneeded += sizeof(Word);
36633787 if ( state->save_argp )
36643788 lneeded += sizeof(struct fliFrame) + (aTop+1-aBase)*sizeof(word);
3789 if ( LD->attvar.call_residue_vars_count && LD->attvar.attvars )
3790 { size_t protect = count_need_protection_attvars(PASS_LD1);
3791 lneeded += sizeof(struct fliFrame) + protect*sizeof(word);
3792 }
36653793
36663794 if ( (char*)lTop + lneeded > (char*)lMax )
36673795 { if ( (char*)lTop + lneeded > (char*)lMax + LD->stacks.local.spare )
37073835 garbageCollect(void)
37083836 { GET_LD
37093837 vm_state state;
3710 LocalFrame safeLTop; /* include ARGP in body mode */
3711 term_t preShiftLTop; /* safe over trimStacks() (shift) */
3838 LocalFrame safeLTop; /* include ARGP in body mode */
3839 term_t preShiftLTop; /* safe over trimStacks() (shift) */
37123840 intptr_t tgar, ggar;
37133841 double t = ThreadCPUTime(LD, CPU_USER);
37143842 int verbose = truePrologFlag(PLFLAG_TRACE_GC);
37153843 int no_mark_bar;
37163844 int rc;
3717 fid_t gvars, astack;
3845 fid_t gvars, astack, attvars;
37183846 Word *saved_bar_at;
37193847 #ifdef O_PROFILE
37203848 struct call_node *prof_node = NULL;
37943922 setVar(*gTop); /* always one space; see initPrologStacks() */
37953923 tTop->address = 0; /* gMax-- and tMax-- */
37963924
3925 attvars = link_attvars(PASS_LD1);
37973926 astack = argument_stack_to_term_refs(&state);
37983927 gvars = gvars_to_term_refs(&saved_bar_at);
3928 save_grefs(PASS_LD1);
37993929 DEBUG(CHK_SECURE, check_foreign());
3800 tag_trail();
3930 tag_trail(PASS_LD1);
38013931 mark_phase(&state);
38023932 tgar = trailcells_deleted * sizeof(struct trail_entry);
38033933 ggar = (gTop - gBase - total_marked) * sizeof(word);
38073937
38083938 DEBUG(MSG_GC_PROGRESS, Sdprintf("Compacting trail\n"));
38093939 compact_trail();
3810
38113940 collect_phase(&state, saved_bar_at);
3812 untag_trail();
3941 restore_grefs(PASS_LD1);
3942 untag_trail(PASS_LD1);
3943 clean_attvar_chain(PASS_LD1);
3944
38133945 term_refs_to_gvars(gvars, saved_bar_at);
38143946 term_refs_to_argument_stack(&state, astack);
3947 restore_attvars(attvars PASS_LD);
38153948
38163949 assert(LD->mark_bar <= gTop);
38173950
43284461
43294462 if ( LD->frozen_bar )
43304463 { update_pointer(&LD->frozen_bar, gs);
4464 }
4465 if ( LD->attvar.attvars )
4466 { update_pointer(&LD->attvar.attvars, gs);
43314467 }
43324468 }
43334469
49435079 markAtomsOnGlobalStack(ld);
49445080 markAtomsOnLocalStack(ld);
49455081 markAtomsFindall(ld);
5082 #ifdef O_PLMT
49465083 markAtomsThreadMessageQueue(ld);
5084 #endif
49475085 }
49485086
49495087 #endif /*O_ATOMGC*/
22 Author: Jan Wielemaker
33 E-mail: J.Wielemaker@cs.vu.nl
44 WWW: http://www.swi-prolog.org
5 Copyright (C): 1985-2013, University of Amsterdam
5 Copyright (C): 1985-2015, University of Amsterdam
66 VU University Amsterdam
77
88 This library is free software; you can redistribute it and/or
271271 Procedure dwakeup1; /* system:$wakeup/1 */
272272 Procedure portray_attvar1; /* $attvar:portray_attvar/1 */
273273 #endif
274 #ifdef O_CALL_RESIDUE
275 Procedure call_residue_vars2; /* $attvar:call_residue_vars/2 */
276 #endif
277274 Procedure comment_hook3; /* prolog:comment_hook/3 */
278275
279276 SourceFile reloading; /* source file we are re-loading */
401398 struct
402399 { term_t head; /* Head of wakeup list */
403400 term_t tail; /* Tail of this list */
401 term_t gc_attvars; /* place for attvars during GC */
402 Word attvars; /* linked list of all attvars */
403 int call_residue_vars_count; /* # call_residue_vars/2 active */
404404 } attvar;
405405 #endif
406406
526526 struct
527527 { struct findall_bag *bags; /* Known bags */
528528 struct findall_bag *default_bag; /* Bag we keep around */
529 #ifdef O_ATOMGC
529 #if defined(O_ATOMGC) && defined(O_PLMT)
530530 simpleMutex mutex; /* Atom GC scanning synchronization */
531531 #endif
532532 } bags;
220220
221221 static int
222222 globalMPZ(Word at, mpz_t mpz, int flags ARG_LD)
223 { if ( mpz->_mp_alloc )
223 { DEBUG(CHK_SECURE, assert(!onStackArea(global, at) && !onStackArea(local, at)));
224
225 if ( mpz->_mp_alloc )
224226 { Word p;
225227 size_t size;
226228 size_t wsz = mpz_wsize(mpz, &size);
467467 #define PLMAXTAGGEDINT (-PLMINTAGGEDINT - 1)
468468 #define PLMINTAGGEDINT32 (-(intptr_t)((word)1<<(32-LMASK_BITS-1)))
469469 #define PLMAXTAGGEDINT32 (-PLMINTAGGEDINT32 - 1)
470 #define inTaggedNumRange(n) (((n)&~PLMAXTAGGEDINT) == 0 || \
471 ((n)&~PLMAXTAGGEDINT) == ~PLMAXTAGGEDINT)
470 #define inTaggedNumRange(n) (valInt(consInt(n)) == (n))
472471 #define PLMININT (((int64_t)-1<<(INT64BITSIZE-1)))
473472 #define PLMAXINT (-(PLMININT+1))
474473 #if SIZEOF_WCHAR_T == 2
13341333 DBG_ALL /* switch on globally */
13351334 } debug_type;
13361335
1336 #define SKIP_VERY_DEEP ((size_t)-1) /* deep skiplevel */
1337 #define SKIP_REDO_IN_SKIP (SKIP_VERY_DEEP-1)
1338
13371339 struct clause_choice
13381340 { ClauseRef cref; /* Next clause reference */
13391341 word key; /* Search key */
18611863 AV_ERROR
18621864 } av_action;
18631865
1866 #define NV_ERROR (PLMINTAGGEDINT-1)
1867
18641868 typedef struct
18651869 { functor_t functor; /* Functor to use ($VAR/1) */
1870 intptr_t offset; /* offset */
18661871 av_action on_attvar; /* How to handle attvars */
18671872 int singletons; /* Write singletons as $VAR('_') */
18681873 int numbered_check; /* Check for already numbered */
19891994 #define PROCEDURE_setup_call_catcher_cleanup4 \
19901995 (GD->procedures.setup_call_catcher_cleanup4)
19911996 #define PROCEDURE_dwakeup1 (GD->procedures.dwakeup1)
1992 #define PROCEDURE_call_residue_vars2 (GD->procedures.call_residue_vars2)
19931997 #define PROCEDURE_dthread_init0 (GD->procedures.dthread_init0)
19941998 #define PROCEDURE_exception_hook4 (GD->procedures.exception_hook4)
19951999 #define PROCEDURE_dc_call_prolog (GD->procedures.dc_call_prolog0)
11351135 { int n = ci->buckets;
11361136
11371137 for(; n; n--, ch++)
1138 ci->size -= deleteClauseBucket(ch, cl, key, ci->is_list);
1138 deleteClauseBucket(ch, cl, key, ci->is_list);
11391139 } else
11401140 { int hi = hashIndex(key, ci->buckets);
11411141
11671167 return FALSE;
11681168 }
11691169
1170 #ifdef O_PLMT
11701171 if ( !LD )
11711172 { PL_thread_attach_engine(NULL);
11721173 LD = GLOBAL_LD;
11731174 if ( !LD )
11741175 goto emergency;
11751176 }
1177 #endif
11761178
11771179 GD->cleaning = CLN_PROLOG;
11781180 debugmode(FALSE, NULL); /* avoid recursive tracing */
12111213 #endif
12121214 #ifdef O_PLMT
12131215 exitPrologThreads();
1214 #endif
12151216
12161217 emergency:
1218 #endif
12171219 Scurout = Soutput; /* reset output stream to user */
12181220
12191221 qlfCleanup(); /* remove errornous .qlf files */
12471249
12481250 if ( reclaim_memory )
12491251 { freeStacks(PASS_LD1);
1252 #ifdef O_PLMT
12501253 cleanupLocalDefinitions(LD);
1254 #endif
12511255 freePrologLocalData(LD);
12521256 cleanupSourceFiles();
12531257 cleanupModules();
14431447
14441448 if ( !GD->bootsession && GD->initialised &&
14451449 !LD->outofstack && /* cannot call Prolog */
1446 !fm[0] == '$') /* explicit: don't call Prolog */
1450 fm[0] != '$') /* explicit: don't call Prolog */
14471451 { char message[LINESIZ];
14481452 char *s = message;
14491453 fid_t cid;
311311
312312 static inline int
313313 is_signalled(ARG1_LD)
314 { return LD && unlikely((LD->signal.pending[0]|LD->signal.pending[1]) != 0);
314 { return HAS_LD && unlikely((LD->signal.pending[0]|LD->signal.pending[1]) != 0);
315 }
316
317 static inline void
318 register_attvar(Word gp ARG_LD)
319 { if ( LD->attvar.attvars )
320 { *gp = makeRefG(LD->attvar.attvars);
321 DEBUG(MSG_ATTVAR_LINK,
322 Sdprintf("Linking %p -> %p\n", gp, LD->attvar.attvars));
323 } else
324 { DEBUG(MSG_ATTVAR_LINK,
325 Sdprintf("Attvar chain head at %p\n", gp));
326 setVar(*gp);
327 }
328
329 LD->attvar.attvars = gp;
315330 }
316331
317332 #endif /*PL_INLINE_H_INCLUDED*/
6767 consoleHandlerRoutine(DWORD id)
6868 { switch(id)
6969 { case CTRL_C_EVENT:
70 #ifdef O_PLMT
7071 PL_w32thread_raise(main_thread_id, SIGINT);
72 #else
73 PL_raise(SIGINT);
74 #endif
7175 return TRUE;
7276 }
7377
187187 if ( m->public ) destroyHTable(m->public);
188188 if ( m->operators ) destroyHTable(m->operators);
189189 if ( m->supers ) unallocList(m->supers);
190 #ifdef O_PLMT
190191 if ( m->mutex ) freeSimpleMutex(m->mutex);
192 #endif
191193 if ( m->lingering ) freeLingeringDefinitions(m->lingering);
192194
193195 freeHeap(m, sizeof(*m));
2323 #define _UNICODE 1
2424 #define UNICODE 1
2525
26 #ifdef __MINGW32__
27 #include <windows.h>
28 #endif
29
2630 #ifdef WIN64
2731 #include "config/win64.h"
2832 #else
2933 #include "config/win32.h"
3034 #endif
3135
32 #include <windows.h>
3336 #include <tchar.h>
3437 #include <malloc.h>
3538 #include <stdio.h>
3639 #include "os/SWI-Stream.h"
3740 #include "SWI-Prolog.h"
41 #include <windows.h>
3842 #include <ctype.h>
3943 #include "win32/console/console.h"
4044 #include <signal.h>
891895 { uintptr_t val;
892896
893897 if ( rlc_get(c, RLC_APPLICATION_THREAD_ID, &val) )
894 { DWORD tid = (DWORD)val;
895
898 {
899 #ifdef O_PLMT
900 DWORD tid = (DWORD)val;
896901 PL_w32thread_raise(tid, sig);
902 #else
903 PL_raise(sig);
904 #endif
905
897906 if ( rlc_get(c, RLC_PROLOG_WINDOW, &val) )
898907 { HWND hwnd = (HWND)val;
899908
00 /* Part of SWI-Prolog
11
22 Author: Jan Wielemaker
3 E-mail: J.Wielemaker@cs.vu.nl
3 E-mail: J.Wielemaker@vu.nl
44 WWW: http://www.swi-prolog.org
5 Copyright (C): 1985-2013, University of Amsterdam
5 Copyright (C): 1985-2015, University of Amsterdam
66 VU University Amsterdam
77
88 This library is free software; you can redistribute it and/or
24822482 - both-marked: done
24832483 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
24842484
2485 #define ALREADY_NUMBERED (-10)
2486 #define CONTAINS_ATTVAR (-11)
2487
2488 static int
2489 do_number_vars(Word p, nv_options *options, int n, mark *m ARG_LD)
2485 #define ALREADY_NUMBERED (-10)
2486 #define CONTAINS_ATTVAR (-11)
2487 #define REPRESENTATION_ERROR (-12)
2488
2489 static intptr_t
2490 do_number_vars(Word p, nv_options *options, intptr_t n, mark *m ARG_LD)
24902491 { term_agenda agenda;
2491 int start = n;
2492 intptr_t start = n;
24922493
24932494 initTermAgenda(&agenda, 1, p);
24942495 while((p=nextTermAgenda(&agenda)))
25182519 if ( options->singletons )
25192520 { a[1] = ATOM_anonvar;
25202521 } else
2521 { a[1] = consInt(n);
2522 assert(valInt(a[1]) == n);
2522 { intptr_t v = n+options->offset;
2523 a[1] = consInt(v);
2524 if ( valInt(a[1]) != v )
2525 { n = REPRESENTATION_ERROR;
2526 goto out;
2527 }
25232528 n++;
25242529 }
25252530 gTop += 2;
25802585 -1: Error. Exception is left in the environment
25812586 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
25822587
2583 int
2584 numberVars(term_t t, nv_options *options, int n ARG_LD)
2585 { for(;;)
2588 intptr_t
2589 numberVars(term_t t, nv_options *options, intptr_t n ARG_LD)
2590 { if ( !inTaggedNumRange(n) )
2591 { PL_representation_error("tagged_integer");
2592 return NV_ERROR;
2593 }
2594
2595 options->offset = n;
2596 n = 0;
2597
2598 for(;;)
25862599 { mark m;
2587 int rc;
2600 intptr_t rc;
25882601
25892602 Mark(m);
25902603 initvisited(PASS_LD1);
25922605 unvisit(PASS_LD1);
25932606 if ( rc >= 0 ) /* all ok */
25942607 { DiscardMark(m);
2595 return rc;
2596 } else if ( rc == CONTAINS_ATTVAR )
2597 { DiscardMark(m);
2598
2599 PL_error(NULL, 0, NULL,
2600 ERR_TYPE, ATOM_free_of_attvar, t);
2601 return -1;
2602 } else if ( rc == ALREADY_NUMBERED )
2603 { DiscardMark(m);
2604
2605 PL_error(NULL, 0, "already numbered",
2606 ERR_PERMISSION, ATOM_numbervars, ATOM_term, t);
2607 return -1;
2608 } else /* stack overflow */
2609 { Undo(m);
2610 DiscardMark(m);
2611 if ( !makeMoreStackSpace(rc, ALLOW_GC|ALLOW_SHIFT) )
2612 return -1;
2608 return rc + options->offset;
2609 } else
2610 { switch( rc )
2611 { case CONTAINS_ATTVAR:
2612 DiscardMark(m);
2613 PL_error(NULL, 0, NULL,
2614 ERR_TYPE, ATOM_free_of_attvar, t);
2615 return NV_ERROR;
2616 case ALREADY_NUMBERED:
2617 DiscardMark(m);
2618 PL_error(NULL, 0, "already numbered",
2619 ERR_PERMISSION, ATOM_numbervars, ATOM_term, t);
2620 return NV_ERROR;
2621 case REPRESENTATION_ERROR:
2622 DiscardMark(m);
2623 PL_representation_error("tagged_integer");
2624 return NV_ERROR;
2625 default:
2626 Undo(m);
2627 DiscardMark(m);
2628 if ( !makeMoreStackSpace(rc, ALLOW_GC|ALLOW_SHIFT) )
2629 return NV_ERROR;
2630 }
26132631 }
26142632 }
26152633 }
26312649 static
26322650 PRED_IMPL("numbervars", 4, numbervars, 0)
26332651 { GET_LD
2634 int n;
2652 intptr_t n;
26352653 atom_t name = ATOM_isovar; /* '$VAR' */
26362654 atom_t av = ATOM_error;
26372655 term_t t, end, options;
26422660
26432661 t = PL_copy_term_ref(A1);
26442662
2645 if ( !PL_get_integer(A2, &n) )
2646 { if ( PL_get_atom(A2, &name) &&
2647 PL_get_integer(A3, &n) ) /* old calling conventions */
2648 { end = A4;
2649 options = 0;
2650 } else
2651 { return PL_get_integer_ex(A2, &n);
2652 }
2653 } else
2663 if ( PL_get_intptr_ex(A2, &n) )
26542664 { end = A3;
26552665 options = A4;
2656 }
2666 } else
2667 return FALSE;
26572668
26582669 if ( options &&
26592670 !scan_options(options, 0, ATOM_numbervar_option, numbervar_options,
26762687
26772688 opts.functor = PL_new_functor(name, 1);
26782689 n = numberVars(t, &opts, n PASS_LD);
2679 if ( n >= 0 )
2680 return PL_unify_integer(end, n);
2690 if ( n != NV_ERROR )
2691 return PL_unify_int64(end, n);
26812692
26822693 return FALSE;
26832694 }
0 /* $Id$
1
2 Part of SWI-Prolog
0 /* Part of SWI-Prolog
31
42 Author: Jan Wielemaker
5 E-mail: J.Wielemaker@cs.vu.nl
3 E-mail: J.Wielemaker@vu.nl
64 WWW: http://www.swi-prolog.org
7 Copyright (C): 1985-2009, University of Amsterdam
5 Copyright (C): 1985-2015, University of Amsterdam
6 VU University Amsterdam
87
98 This library is free software; you can redistribute it and/or
109 modify it under the terms of the GNU Lesser General Public
214213 }
215214
216215
217 word
218 pl_notrace1(term_t goal)
219 { GET_LD
220 bool rval;
216 static
217 PRED_IMPL("notrace", 1, notrace, PL_FA_TRANSPARENT|PL_FA_NOTRACE)
218 { PRED_LD
219 int rval;
220 term_t ex;
221221
222222 uintptr_t skipSave = debugstatus.skiplevel;
223223 bool traceSave = debugstatus.tracing;
224224
225 rval = callProlog(NULL, goal, PL_Q_NODEBUG, NULL);
225 rval = callProlog(NULL, A1, PL_Q_CATCH_EXCEPTION|PL_Q_NODEBUG, &ex);
226226
227227 debugstatus.skiplevel = skipSave;
228228 debugstatus.tracing = traceSave;
229
230 if ( !rval && ex )
231 return PL_raise_exception(ex);
229232
230233 return rval;
231234 }
760763
761764 BeginPredDefs(pro)
762765 PRED_DEF("abort", 0, abort, 0)
766 PRED_DEF("notrace", 1, notrace, PL_FA_TRANSPARENT|PL_FA_NOTRACE)
763767 PRED_DEF("$sig_atomic", 1, sig_atomic, PL_FA_TRANSPARENT)
764768 PRED_DEF("$trap_gdb", 0, trap_gdb, 0)
765769 EndPredDefs
3838 static void resetProcedure(Procedure proc, bool isnew);
3939 static atom_t autoLoader(Definition def);
4040 static Procedure visibleProcedure(functor_t f, Module m);
41 #ifdef O_PLMT
4142 static void detachMutexAndUnlock(Definition def);
43 #endif
4244
4345 /* Enforcing this limit demands we propagate NULL from lookupProcedure()
4446 through the whole system. This is not done
133135 unallocDefinition(Definition def)
134136 { if ( false(def, P_FOREIGN|P_THREAD_LOCAL) )
135137 unallocClauseList(def->impl.clauses.first_clause);
138 #ifdef O_PLMT
136139 else if ( true(def, P_THREAD_LOCAL) )
137140 free_ldef_vector(def->impl.local);
138141
139142 if ( def->mutex )
140143 freeSimpleMutex(def->mutex);
144 #endif
141145
142146 unallocClauseIndexes(def);
143147 freeCodesDefinition(def, FALSE);
11971201 clause->generation.erased = ++GD->generation;
11981202 PL_UNLOCK(L_MISC);
11991203 #endif
1204
1205 DEBUG(CHK_SECURE, checkDefinition(def));
12001206 UNLOCKDYNDEF(def);
12011207
1202 DEBUG(CHK_SECURE, checkDefinition(def));
1203
12041208 succeed;
12051209 }
12061210
12071211 rc = unlinkClause(def, clause);
1212 DEBUG(CHK_SECURE, checkDefinition(def));
12081213 UNLOCKDYNDEF(def);
1209 DEBUG(CHK_SECURE, checkDefinition(def));
12101214
12111215 /* as we do a call-back, we cannot */
12121216 /* hold the L_PREDICATE mutex */
13261330 int hooked;
13271331 int savely_hooked;
13281332
1329 if ( LD && LD->query &&
1333 if ( HAS_LD && LD->query &&
13301334 PROCEDURE_event_hook1 &&
13311335 hasClausesDefinition(PROCEDURE_event_hook1->definition) )
13321336 { hooked = TRUE;
13891393 if ( cref )
13901394 freeClauseList(cref);
13911395
1392 DEBUG(CHK_SECURE, checkDefinition(def));
1396 DEBUG(CHK_SECURE,
1397 LOCKDEF(def);
1398 checkDefinition(def);
1399 UNLOCKDEF(def));
13931400 }
13941401
13951402
31173124 if ( true(def, P_FOREIGN) )
31183125 fail;
31193126
3127 LOCKDEF(def);
31203128 checkDefinition(def);
3129 UNLOCKDEF(def);
31213130
31223131 succeed;
31233132 }
6767
6868 int
6969 activateProfiler(prof_status active ARG_LD)
70 { int i;
70 {
71 int i;
7172 PL_local_data_t *profiling;
7273
7374 PL_LOCK(L_THREAD);
285286 ld->profile.time += tend - ld->profile.time_at_start;
286287
287288 stopItimer();
288 activateProfiler(PROF_INACTIVE, ld);
289 activateProfiler(PROF_INACTIVE PASS_LDARG(ld));
289290 #ifndef __WINDOWS__
290291 set_sighandler(timer_signal, SIG_IGN);
291292 timer_signal = 0;
850851 profile(intptr_t count, PL_local_data_t *__PL_ld)
851852 { call_node *node;
852853
853 if ( !LD )
854 if ( !HAS_LD )
854855 return;
855856
856857 LD->profile.samples++;
2828 #include "os/pl-dtoa.h"
2929 #include "pl-umap.c" /* Unicode map */
3030 #include "pl-dict.h"
31 #include <errno.h>
3132
3233 typedef const unsigned char * cucharp;
3334 typedef unsigned char * ucharp;
366367 term_t qq_tail; /* Tail of the quoted stuff */
367368 #endif
368369 bool cycles; /* Re-establish cycles */
369 bool dot_lists; /* read .(a,b) as a list */
370 bool dotlists; /* read .(a,b) as a list */
370371 int strictness; /* Strictness level */
371372
372373 atom_t locked; /* atom that must be unlocked */
38823883 #undef P_HEAD
38833884 #undef P_ARG
38843885
3885 if ( _PL_rd->dot_lists )
3886 if ( _PL_rd->dotlists )
38863887 { static atom_t dot = 0;
38873888 if ( !dot )
38883889 dot = PL_new_atom(".");
38973898 PL_unregister_atom(functor);
38983899
38993900 succeed;
3901 }
3902
3903
3904 static int
3905 is_key_token(Token token, ReadData _PL_rd)
3906 { switch(token->type)
3907 { case T_NAME:
3908 case T_QNAME:
3909 case T_FUNCTOR:
3910 case T_DICT:
3911 return TRUE;
3912 case T_PUNCTUATION:
3913 { switch(token->value.character)
3914 { case '[':
3915 case '{':
3916 case '(':
3917 case ')':
3918 case '}':
3919 case ']':
3920 case '|':
3921 case ',':
3922 return FALSE;
3923 default:
3924 return TRUE;
3925 }
3926 }
3927 default:
3928 return FALSE;
3929 }
39003930 }
39013931
39023932
39633993 if ( !(key = get_token(FALSE, _PL_rd)) )
39643994 return FALSE;
39653995
3966 if ( is_name_token(key, TRUE, _PL_rd) )
3996 if ( is_key_token(key, _PL_rd) )
39673997 { key_term = alloc_term(_PL_rd PASS_LD);
39683998 PL_put_atom(key_term, key->value.atom);
39693999 Unlock(key->value.atom);
39834013 if ( !(sep = get_token(FALSE, _PL_rd)) )
39844014 return FALSE;
39854015
3986 if ( !is_name_token(sep, TRUE, _PL_rd) ||
4016 if ( !is_key_token(sep, _PL_rd) ||
39874017 key->value.atom != ATOM_colon )
39884018 syntaxError("colon_expected", _PL_rd);
39894019
46254655 &rd.quasi_quotations,
46264656 #endif
46274657 &rd.cycles,
4628 &rd.dot_lists) )
4658 &rd.dotlists) )
46294659 return FALSE;
46304660
46314661 if ( mname )
22 Author: Jan Wielemaker
33 E-mail: J.Wielemaker@vu.nl
44 WWW: http://www.swi-prolog.org
5 Copyright (C): 1985-2012, University of Amsterdam
5 Copyright (C): 1985-2015, University of Amsterdam
66 VU University Amsterdam
77
88 This library is free software; you can redistribute it and/or
439439 addBuffer(&info->vars, mkAttVarP(p), Word);
440440 addOpCode(info, PL_TYPE_ATTVAR);
441441 addSizeInt(info, n);
442 info->size++;
442 info->size += 3;
443443 DEBUG(9, Sdprintf("Added attvar %d\n", n));
444444
445445 p = ap;
961961 case PL_TYPE_ATTVAR:
962962 { intptr_t n = fetchSizeInt(b);
963963
964 *p = consPtr(b->gstore, TAG_ATTVAR|STG_GLOBAL);
965 b->vars[n] = p;
966 p = b->gstore++;
964 register_attvar(b->gstore PASS_LD);
965 b->gstore[1] = consPtr(&b->gstore[2], TAG_ATTVAR|STG_GLOBAL);
966 *p = makeRefG(&b->gstore[1]);
967 b->vars[n] = &b->gstore[1];
968 p = &b->gstore[2];
969 b->gstore += 3;
967970 goto right_recursion;
968971 }
969972 #endif
622622 { GET_LD
623623 (void)sig;
624624
625 if ( LD && LD->signal.exception )
625 if ( HAS_LD && LD->signal.exception )
626626 { record_t ex = LD->signal.exception;
627627
628628 LD->signal.exception = 0;
916916 PL_handle_signals(void)
917917 { GET_LD
918918
919 if ( !LD || LD->critical || !is_signalled(LD) )
919 if ( !HAS_LD || LD->critical || !is_signalled(PASS_LD1) )
920920 return 0;
921921 if ( exception_term )
922922 return -1;
930930 { int done = 0;
931931 int i;
932932
933 if ( !LD || LD->critical )
933 if ( !HAS_LD || LD->critical )
934934 return 0;
935935
936936 for(i=0; i<2; i++)
953953 }
954954
955955 if ( done )
956 updateAlerted(PASS_LD1);
956 updateAlerted(LD);
957957
958958 return done;
959959 }
12061206 LD->exception.pending = PL_new_term_ref();
12071207 LD->trim.dummy = PL_new_term_ref();
12081208 #ifdef O_ATTVAR
1209 LD->attvar.head = PL_new_term_ref();
1209 LD->attvar.head = PL_new_term_ref();
12101210 LD->attvar.tail = PL_new_term_ref();
1211 LD->attvar.gc_attvars = PL_new_term_ref();
12111212 DEBUG(3, Sdprintf("attvar.tail at %p\n", valTermRef(LD->attvar.tail)));
12121213 #endif
12131214 #ifdef O_GVAR
15141515
15151516 if ( ld->bags.default_bag )
15161517 { PL_free(ld->bags.default_bag);
1517 #ifdef O_ATOMGC
1518 #if defined(O_ATOMGC) && defined(O_PLMT)
15181519 simpleMutexDelete(&ld->bags.mutex);
15191520 #endif
15201521 }
137137 { sf->magic = 0;
138138 freeList(&sf->procedures);
139139 freeList(&sf->modules);
140 #ifdef O_PLMT
140141 if ( sf->mutex )
141142 freeSimpleMutex(sf->mutex);
143 #endif
142144 freeHeap(sf, sizeof(*sf));
143145 }
144146 }
758760 }
759761
760762
761 /** '$clause_from_source'(+File, +Line, -Clause) is semidet.
762
763 True when Clause is the clause that contains Line in File.
764 */
765
766763 static
767 PRED_IMPL("$clause_from_source", 3, clause_from_source, 0)
764 PRED_IMPL("$end_consult", 1, end_consult, 0)
768765 { PRED_LD
769766 atom_t name;
770 SourceFile sf;
767
768 if ( PL_get_atom_ex(A1, &name) )
769 { SourceFile f;
770
771 if ( (f=lookupSourceFile(name, FALSE)) )
772 f->current_procedure = NULL;
773
774 return TRUE;
775 }
776
777 return FALSE;
778 }
779
780
781
782 /** '$clause_from_source'(+Owner, +File, +Line, -Clause) is semidet.
783
784 True when Clause is the clause that contains Line in File. Owner is the
785 source file owning Clause. For normal files, Owner and File are the
786 same. This predicate can find a clause in an included file by specifying
787 the main file as Owner and the included file as File.
788 */
789
790 static
791 PRED_IMPL("$clause_from_source", 4, clause_from_source, 0)
792 { PRED_LD
793 atom_t owner_name;
794 atom_t file_name;
795 SourceFile of, sf; /* owner file, source file */
796 unsigned short source_no;
771797 int ln;
772798 ListCell cell;
773799 Clause c = NULL;
774800
775 term_t file = A1;
776 term_t line = A2;
777 term_t clause = A3;
778
779 if ( !PL_get_atom_ex(file, &name) ||
780 !(sf = lookupSourceFile(name, FALSE)) ||
801 term_t owner = A1;
802 term_t file = A2;
803 term_t line = A3;
804 term_t clause = A4;
805
806 if ( !PL_get_atom_ex(owner, &owner_name) ||
807 !PL_get_atom_ex(file, &file_name) ||
808 !(of = lookupSourceFile(owner_name, FALSE)) ||
781809 !PL_get_integer_ex(line, &ln) )
782 fail;
783
784 LOCKSRCFILE(sf);
785 for(cell = sf->procedures; cell; cell = cell->next)
810 return FALSE;
811
812 if ( file_name == owner_name ) {
813 source_no = of->index;
814 } else {
815 if ( !(sf=lookupSourceFile(file_name, FALSE)) )
816 return FALSE;
817 source_no = sf->index;
818 }
819
820 LOCKSRCFILE(of);
821 for(cell = of->procedures; cell; cell = cell->next)
786822 { Procedure proc = cell->value;
787823 Definition def = proc->definition;
788824
792828 for( ; cref; cref = cref->next )
793829 { Clause cl = cref->value.clause;
794830
795 if ( cl->source_no == sf->index )
831 if ( cl->source_no == source_no )
796832 { if ( ln >= (int)cl->line_no )
797833 { if ( !c || c->line_no < cl->line_no )
798834 c = cl;
801837 }
802838 }
803839 }
804 UNLOCKSRCFILE(sf);
840 UNLOCKSRCFILE(of);
805841
806842 if ( c )
807843 return PL_unify_clref(clause, c);
818854 PRED_DEF("$source_file", 2, source_file, 0)
819855 PRED_DEF("$source_file_predicates", 2, source_file_predicates, 0)
820856 PRED_DEF("$time_source_file", 3, time_source_file, PL_FA_NONDETERMINISTIC)
821 PRED_DEF("$clause_from_source", 3, clause_from_source, 0)
857 PRED_DEF("$clause_from_source", 4, clause_from_source, 0)
822858 PRED_DEF("$unload_file", 1, unload_file, 0)
823859 PRED_DEF("$start_consult", 2, start_consult, 0)
860 PRED_DEF("$end_consult", 1, end_consult, 0)
824861 PRED_DEF("$make_system_source_files", 0, make_system_source_files, 0)
825862 EndPredDefs
177177 { if ( !PL_is_variable(A3) )
178178 { if ( !PL_get_char_ex(A3, &tchar, FALSE) )
179179 return FALSE;
180 } else if ( t.length > 0 )
181 { tchar = -1;
180182 } else
181 tchar = -1;
183 return FALSE;
182184
183185 idx = 0;
184186 goto gen;
340340
341341 #ifdef __WINDOWS__
342342
343 #include <windows.h>
344
343345 static void *
344346 getModuleFunction(const char *module, const char *name)
345347 { HMODULE hconsole;
15151515 ldnew->_debugstatus = ldold->_debugstatus;
15161516 ldnew->_debugstatus.retryFrame = NULL;
15171517 ldnew->_debugstatus.suspendTrace= 0;
1518 if ( ldold->_debugstatus.skiplevel != SKIP_VERY_DEEP )
1519 { ldnew->_debugstatus.debugging = DBG_OFF;
1520 ldnew->_debugstatus.tracing = FALSE;
1521 ldnew->_debugstatus.skiplevel = SKIP_VERY_DEEP;
1522 }
1523
15181524 ldnew->statistics.start_time = WallTime();
15191525 ldnew->prolog_flag.mask = ldold->prolog_flag.mask;
15201526 ldnew->prolog_flag.occurs_check = ldold->prolog_flag.occurs_check;
22262232
22272233 if ( LD == ld ) /* if FALSE, we are called from another thread (create) */
22282234 { at_exit_goal *eg;
2235 fid_t fid = PL_open_foreign_frame();
22292236
22302237 while( (eg = ld->thread.exit_goals) )
22312238 { ld->thread.exit_goals = NULL; /* empty these */
22342241 }
22352242
22362243 run_exit_hooks(GD->thread.exit_goals, FALSE);
2244 PL_close_foreign_frame(fid);
22372245 }
22382246 }
22392247
60076015 }
60086016
60096017 #ifdef __WINDOWS__
6018 #include <windows.h>
6019
60106020 int
60116021 PL_w32thread_raise(DWORD id, int sig)
60126022 { return PL_raise(sig);
60456055 { fail;
60466056 }
60476057
6058 void
6059 PL_cleanup_fork(void)
6060 {
6061 }
6062
6063 double
6064 ThreadCPUTime(PL_local_data_t *ld, int which) {
6065 return CpuTime(which);
6066 }
60486067
60496068 void
60506069 initPrologThreads()
389389 #define UNLOCKDYNDEF(def)
390390 #define LOCKMODULE(module)
391391 #define UNLOCKMODULE(module)
392 #define LOCKSRCFILE(sf)
393 #define UNLOCKSRCFILE(sf)
394 COMMON(double) ThreadCPUTime(PL_local_data_t *ld, int which);
392395
393396 #endif /*O_PLMT*/
394397
2525 #include "os/pl-cstack.h"
2626 #include "pl-inline.h"
2727 #include "pl-dbref.h"
28
29 #define SKIP_VERY_DEEP 1000000000L /* deep skiplevel */
30 #define SKIP_REDO_IN_SKIP (SKIP_VERY_DEEP-1)
3128
3229 #define WFG_TRACE 0x01000
3330 #define WFG_TRACING 0x02000
13181315 { GET_LD
13191316 (void)thread_id;
13201317
1321 if ( !LD )
1318 if ( !HAS_LD )
13221319 return FALSE;
13231320
13241321 c->ld = LD;
24322429
24332430 int
24342431 PL_call_event_hook(pl_event_type ev, ...)
2435 { if ( PROCEDURE_event_hook1->definition->impl.any )
2432 { if ( PROCEDURE_event_hook1->definition->impl.any &&
2433 GD->cleaning != CLN_DATA )
24362434 { GET_LD
24372435 wakeup_state wstate;
24382436 int rc;
22 Author: Jan Wielemaker
33 E-mail: J.Wielemaker@cs.vu.nl
44 WWW: http://www.swi-prolog.org
5 Copyright (C): 1985-2013, University of Amsterdam
5 Copyright (C): 1985-2015, University of Amsterdam
66 VU University Amsterdam
77
88 This library is free software; you can redistribute it and/or
17851785 }
17861786
17871787 if ( true(FR, FR_WATCHED) )
1788 { LocalFrame lSave = lTop;
1788 { LD->query->next_environment = lTop;
17891789 lTop = (LocalFrame)ARGP; /* just pushed arguments, so top */
17901790 SAVE_REGISTERS(qid);
17911791 frameFinished(FR, FINISH_EXIT PASS_LD);
17921792 LOAD_REGISTERS(qid);
1793 lTop = lSave;
1793 lTop = LD->query->next_environment;
1794 LD->query->next_environment = NULL;
17941795 }
17951796
17961797 FR->clause = NULL; /* for save atom-gc */
29022903
29032904 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
29042905 A_ENTER: Ensure the alignment of ARGP allows for efficient pushing of
2905 the number structure.
2906 the number structure. We must check for availaible space to support
2907 bindConst() (wakeup and trail) because the resulting value may possibly
2908 not be shifted. See is/2 in pl-arith.c for details.
29062909 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
29072910
29082911 VMI(A_ENTER, 0, 0, ())
2909 { AR_BEGIN();
2912 { if ( !hasGlobalSpace(0) )
2913 { int rc;
2914
2915 SAVE_REGISTERS(qid);
2916 rc = ensureGlobalSpace(0, ALLOW_GC);
2917 LOAD_REGISTERS(qid);
2918 if ( rc != TRUE )
2919 { raiseStackOverflow(rc);
2920 THROW_EXCEPTION;
2921 }
2922 }
2923
2924 AR_BEGIN();
29102925 NEXT_INSTRUCTION;
29112926 }
29122927
35053520 { ffr = (FliFrame)argFrameP(FR, DEF->functor->arity);
35063521 }
35073522
3523 assert(DEF->functor->arity < 100);
3524
35083525 lTop = (LocalFrame)(ffr+1);
35093526 ffr->size = 0;
35103527 NoMark(ffr->mark);
35283545 struct foreign_context context;
35293546 term_t h0 = argFrameP(FR, 0) - (Word)lBase;
35303547
3531 context.context = 0L;
3532 context.engine = LD;
3533 context.control = FRG_FIRST_CALL;
3548 context.context = 0L;
3549 context.engine = LD;
3550 context.control = FRG_FIRST_CALL;
3551 context.predicate = DEF;
35343552
35353553 PROF_FOREIGN;
35363554 rc = (*f)(h0, DEF->functor->arity, &context);
37063724 { Choice ch;
37073725 FliFrame ffr;
37083726
3709 context.context = 0L;
3710 context.engine = LD;
3711 context.control = FRG_FIRST_CALL;
3727 context.context = 0L;
3728 context.engine = LD;
3729 context.control = FRG_FIRST_CALL;
3730 context.predicate = DEF;
37123731
37133732 foreign_redo:
37143733 lTop = (LocalFrame)argFrameP(FR, DEF->functor->arity);
40754094 assert(exception_term);
40764095 outofstack = LD->outofstack;
40774096 LD->outofstack = NULL;
4097 PC = NULL;
40784098
40794099 if ( lTop < (LocalFrame)argFrameP(FR, FR->predicate->functor->arity) )
40804100 lTop = (LocalFrame)argFrameP(FR, FR->predicate->functor->arity);
22 Author: Jan Wielemaker
33 E-mail: J.Wielemaker@vu.nl
44 WWW: http://www.swi-prolog.org
5 Copyright (C): 1985-2012, University of Amsterdam
5 Copyright (C): 1985-2015, University of Amsterdam
66 VU University Amsterdam
77
88 This library is free software; you can redistribute it and/or
235235 updateAlerted(PL_local_data_t *ld)
236236 { int mask = 0;
237237
238 if ( is_signalled(ld) ) mask |= ALERT_SIGNAL;
238 if ( is_signalled(PASS_LDARG1(ld)) ) mask |= ALERT_SIGNAL;
239239 #ifdef O_PROFILE
240240 if ( ld->profile.active ) mask |= ALERT_PROFILE;
241241 #endif
12071207 }
12081208
12091209
1210 #ifdef O_ATTVAR
1211 static void
1212 reclaim_attvars(Word after ARG_LD)
1213 { while ( LD->attvar.attvars >= after )
1214 { word w = *LD->attvar.attvars;
1215
1216 if ( isVar(w) )
1217 LD->attvar.attvars = NULL;
1218 else
1219 LD->attvar.attvars = unRef(w);
1220 }
1221 }
1222 #endif
1223
1224
12101225 static inline void
12111226 __do_undo(mark *m ARG_LD)
12121227 { TrailEntry tt = tTop;
12191234 { DEBUG(2, Sdprintf("Undoing a trailed assignment\n"));
12201235 tt--;
12211236 *tt->address = trailVal(p);
1237 DEBUG(CHK_SECURE,
1238 if ( isAttVar(*tt->address) )
1239 assert(on_attvar_chain(tt->address)));
12221240 assert(!(*tt->address & (MARK_MASK|FIRST_MASK)));
12231241 } else
12241242 setVar(*p);
12271245 tTop = mt;
12281246 if ( LD->frozen_bar > m->globaltop )
12291247 { DEBUG(CHK_SECURE, assert(gTop >= LD->frozen_bar));
1248 reclaim_attvars(LD->frozen_bar PASS_LD);
12301249 gTop = LD->frozen_bar;
12311250 } else
1232 { gTop = m->globaltop;
1251 { reclaim_attvars(m->globaltop PASS_LD);
1252 gTop = m->globaltop;
12331253 }
12341254 }
12351255
12531273 our block is not the real memory pointer.
12541274 */
12551275
1276 #ifdef O_PLMT
12561277 static Definition
12571278 localDefinition(Definition def ARG_LD)
12581279 { unsigned int tid = LD->thread.info->pl_tid;
12811302 return v->blocks[idx][tid];
12821303 }
12831304
1284
12851305 void
12861306 destroyLocalDefinition(Definition def, unsigned int tid)
12871307 { size_t idx = MSB(tid);
12921312 v->blocks[idx][tid] = NULL;
12931313 destroyDefinition(local);
12941314 }
1295
1315 #endif
12961316
12971317 Definition
12981318 getProcDefinition__LD(Definition def ARG_LD)
19872007 #endif
19882008
19892009
1990 static int
2010 int
19912011 existingChoice(Choice ch ARG_LD)
19922012 { if ( onStack(local, ch) && onStack(local, ch->frame) &&
19932013 (int)ch->type >= 0 && (int)ch->type <= CHP_DEBUG )
22 Author: Jan Wielemaker
33 E-mail: J.Wielemaker@cs.vu.nl
44 WWW: http://www.swi-prolog.org
5 Copyright (C): 1985-2012, University of Amsterdam
5 Copyright (C): 1985-2015, University of Amsterdam
66 VU University Amsterdam
77
88 This library is free software; you can redistribute it and/or
19871987 static int
19881988 saveQlfTerm(wic_state *state, term_t t ARG_LD)
19891989 { IOSTREAM *fd = state->wicFd;
1990 int nvars, rc=TRUE;
1990 intptr_t nvars, rc=TRUE;
19911991 fid_t cid;
19921992 nv_options options;
19931993
20032003 options.singletons = FALSE; /* TBD: TRUE may be better! */
20042004 options.numbered_check = TRUE; /* otherwise may be wrong */
20052005
2006 if ( (nvars = numberVars(t, &options, 0 PASS_LD)) >= 0 )
2006 if ( (nvars = numberVars(t, &options, 0 PASS_LD)) != NV_ERROR )
20072007 { putNum(nvars, fd);
20082008 do_save_qlf_term(state, valTermRef(t) PASS_LD); /* TBD */
20092009 DEBUG(MSG_QLF_TERM, Sdprintf("to %d\n", Stell(fd)));
19061906 options.singletons = PL_is_acyclic(term);
19071907 options.numbered_check = FALSE;
19081908
1909 rc = ( numberVars(term, &options, 0 PASS_LD) >= 0 &&
1909 rc = ( numberVars(term, &options, 0 PASS_LD) != NV_ERROR &&
19101910 do_write2(stream, term,
19111911 PL_WRT_QUOTED|PL_WRT_IGNOREOPS|PL_WRT_NUMBERVARS|
19121912 PL_WRT_NODOTINATOM, TRUE)
621621
622622 for( ; d->extension; d++ )
623623 { if ( strfeq(d->extension, ext) )
624 { if ( d->list == &plfiles )
624 { if ( d->list == &plfiles || d->list == &qlfiles )
625625 nostate = FALSE;
626626 appendArgList(d->list, name);
627627 return TRUE;
628628 }
629629 }
630630 if ( soext && strfeq(soext, ext) )
631 { if ( d->list == &plfiles )
631 { if ( d->list == &plfiles || d->list == &qlfiles )
632632 nostate = FALSE;
633633 appendArgList(&libs, name);
634634 return TRUE;
14381438 quoted_name(plfiles.list[n], e);
14391439 e += strlen(e);
14401440 }
1441 for(n=0; n<qlfiles.size; n++)
1442 { if ( n > 0 )
1443 *e++ = ',';
1444 quoted_name(qlfiles.list[n], e);
1445 e += strlen(e);
1446 }
14411447 strcpy(e, "]),qsave_program(");
14421448 e += strlen(e);
14431449 quoted_name(pltmp, e);
610610 File ${SWIPL}\bin\readutil.dll
611611 File ${SWIPL}\bin\process.dll
612612 File ${SWIPL}\bin\streaminfo.dll
613 File ${SWIPL}\bin\prolog_stream.dll
613614 SetOutPath $INSTDIR\library
614615 File ${SWIPL}\library\cgi.pl
615616 File ${SWIPL}\library\crypt.pl
626627 File ${SWIPL}\library\process.pl
627628 File ${SWIPL}\library\udp_broadcast.pl
628629 File ${SWIPL}\library\streaminfo.pl
630 File ${SWIPL}\library\prolog_stream.pl
629631 SetOutPath $INSTDIR\doc\packages
630632 File ${SWIPL}\doc\packages\clib.html
631633 SectionEnd