1% BEGIN LICENSE BLOCK
2% Version: CMPL 1.1
3%
4% The contents of this file are subject to the Cisco-style Mozilla Public
5% License Version 1.1 (the "License"); you may not use this file except
6% in compliance with the License.  You may obtain a copy of the License
7% at www.eclipse-clp.org/license.
8% 
9% Software distributed under the License is distributed on an "AS IS"
10% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See
11% the License for the specific language governing rights and limitations
12% under the License. 
13% 
14% The Original Code is  The ECLiPSe Constraint Logic Programming System. 
15% The Initial Developer of the Original Code is  Cisco Systems, Inc. 
16% Portions created by the Initial Developer are
17% Copyright (C) 2006 Cisco Systems, Inc.  All Rights Reserved.
18% 
19% Contributor(s): 
20% 
21% END LICENSE BLOCK
22
23:- comment(alias, "Predicate Database and Compiler").
24:- comment(summary, "Built-ins for creation of handling of executable code").
25:- comment(categories, ["Built-In Predicates","Development Tools"]).
26
27:- tool('.' / 2).
28:- tool(als / 1).
29:- tool((abolish) / 1).
30:- tool((demon) / 1).
31:- tool((meta_predicate) / 1).
32:- tool((mode) / 1).
33:- tool((parallel) / 1).
34:- tool(lib / 1).
35:- tool(expand_clause / 2).
36:- tool(expand_goal / 2).
37:- tool(ensure_loaded / 1).
38:- tool(current_module_predicate / 2).
39:- tool(current_pragma / 1).
40:- tool(current_predicate / 1).
41:- tool(current_built_in / 1).
42:- tool(is_predicate / 1).
43:- tool(deprecated / 2).
44:- tool(discontiguous / 1).
45:- tool(compile_stream / 1).
46:- tool(inline / 2).
47:- tool(get_flag / 3).
48:- tool(set_flag / 3).
49
50:- comment(current_compiled_file / 3, [
51	summary:"Succeeds if File is a file that has been compiled into the system.
52
53",
54	amode:(current_compiled_file(-,-,-) is nondet),
55	amode:(current_compiled_file(+,-,-) is semidet),
56	desc:html("   This predicate enumerates all files that have been compiled during this
57   ECLiPSe session.  Time is the modification time of the file at the time
58   it was compiled, and Module is the module from where it was compiled
59   (the latter is irrelevant if the file contains a module itself).  The
60   information can be used to determine if a file needs to be recompiled.
61
62<P>
63"),
64	args:["File" : "Atom or variable.", "Time" : "Integer or variable.", "Module" : "Atom or variable."],
65	exceptions:[5 : "File instantiated, but not to an atom.", 5 : "Time instantiated, but not to an integer.", 5 : "Module instantiated, but not to an atom."],
66	eg:"
67make :- current_compiled_file(File, Time, Module),
68        get_file_info(File, mtime) =\\= Time,
69        compile(File, Module),
70        fail.
71make.
72
73
74
75",
76	see_also:[compile / 1, compile / 2, ensure_loaded / 1, make / 0]]).
77
78:- comment('.' / 2, [
79	summary:"Compile source file or load precompiled file, or list of files",
80	template:"[+File_1, ...., +File_N]",
81	amode:([+] is det),
82	desc:html("
83   The behaviour of this construct is different according to where it is used:
84   As a directive in a source file, e.g.
85<PRE>
86	:- [auxiliaries,tools].
87</PRE>
88   it behaves like an include/1 directive, i.e. it instructs the compiler (or
89   any other source-processing tool) to process the given files as if they were
90   part of the file containing the directive.
91<P>
92   When called as a query (e.g. at the interactive toplevel) or goal, it will
93   compile source files or load precompiled files.  If a precompiled file
94   exists (usually characterized by a .eco file suffix), then this file is
95   loaded, otherwise a source file is expected and compiled using compile/1.
96   See the specification of compile/1 for details.
97<P>
98   A particular common use at the toplevel is the special form:
99<PRE>
100	?- [user].
101</PRE>
102   which is used for interactively compiling code from the standard input.
103"),
104	args:["File_i" : "Atom or string."],
105	exceptions:[4 : "File_n is not instantiated.", 5 : "File_n is instantiated, but not to an atom or string.", 171 : "File_n does not exist."],
106	eg:"
107Success:
108     [hanoi].         % compiles the file hanoi.pl
109
110     [eclipse]: sh('cat file1').
111     p:-writeln(hello).
112     yes.
113     [eclipse]: sh('cat file2').
114     q(X) :- write(X).
115     yes.
116     [eclipse]: [user], p.
117      p :- writeln(hi).
118      user compiled 92 bytes in 0.00 seconds
119     hi
120     yes.
121     [eclipse]: [file1, file2], p.
122     /home/lp/user/file1 compiled 32 bytes in 0.02 seconds
123     /home/lp/user/file2 compiled 92 bytes in 0.00 seconds
124     hello
125     yes.
126Error:
127     [F].            (Error 4).
128     [file1/1].      (Error 5).
129     [noexist].      (Error 171).
130
131
132
133",
134	see_also:[compile/1, compile/2, fcompile:fcompile/1 ]]).
135
136:- comment(is_predicate / 1, [
137	summary:"Succeeds if PredSpec is a defined predicate.
138
139",
140	amode:(is_predicate(++) is semidet),
141	desc:html("   Used to test whether PredSpec is defined as a user or a built-in
142   predicate.
143
144<P>
145"),
146	args:["PredSpec" : "Predicate of the form Atom/Integer."],
147	fail_if:"Fails if PredSpec is not a valid predicate",
148	exceptions:[4 : "PredSpec is not fully instantiated.", 5 : "PredSpec is not in the format Atom/Integer."],
149	eg:"
150Success:
151[eclipse]: [user].
152    a(1).
153    a(1,2).
154    a(1,2,3).
155    user compiled 144 bytes in 0.00 seconds
156   yes.
157   [eclipse]: is_predicate(a/1).
158   yes.
159   [eclipse]: is_predicate(a/2).
160   yes.
161   [eclipse]: is_predicate(nl/0).
162   yes.
163   [eclipse]: is_predicate(a/2).
164   yes.
165Fail:
166   is_predicate(a/0).         % Fails if a/0 is not a predicate
167Error:
168   is_predicate(X).          (Error 4).
169   is_predicate(a/X).        (Error 4).
170   is_predicate(a).          (Error 5).
171   is_predicate(1).          (Error 5).
172
173
174
175",
176	see_also:[get_flag / 3, pred / 1, current_predicate / 1, current_built_in / 1]]).
177
178
179:- comment(lib / 1, [
180	summary:"Makes the library LibraryName available in the current module if not loaded
181already.
182
183",
184	amode:(lib(+) is det),
185	desc:html("
186   This is a shorthand: lib(Lib) is identical to use_module(library(Lib)).
187<P>
188   Used to load the library LibraryName into the system if it has not
189   already been loaded.  The currently used Prolog suffix(es) is appended
190   to LibraryName and the resulting library is loaded if it exists.
191<P>
192   The search path used when loading libraries is specified by the global
193   flag library_path using the get_flag/2 and set_flag/2 predicates.  This
194   flag contains a list of strings containing the pathnames of the
195   directories to be searched when loading a library file.  User libraries
196   may be added to the system simply by copying the desired file into the
197   ECLiPSe library directory.  Alternatively the library_path flag may be
198   updated to point at a number of user specific directories.
199<P>
200"),
201	args:["LibraryName" : "String or atom."],
202	exceptions:[4 : "LibraryName is not instantiated.",
203	    5 : "LibraryName is neither a string nor an atom.",
204	    80 : "Library file does not contain a matching module.",
205	    173 : "Library file LibraryName not found."],
206	eg:"
207Success:
208   [eclipse]: lib(sorts).
209   loading the library /usr/local/ECLIPSE/lib/sorts.pl
210   yes.
211   [eclipse]: lib(sorts).
212   yes.              % library already loaded - succeeds
213Error:
214   lib(X).            (Error 4).
215   lib(1).            (Error 5).
216   lib(no_lib).       (Error 173).
217
218
219",
220	see_also:[ensure_loaded / 1, existing_file/4, get_flag / 2, set_flag / 2, use_module / 1]]).
221
222
223:- comment(als / 1, [
224	summary:"Outputs the abstract code for the compiled predicate PredSpec.
225
226",
227	amode:(als(++) is semidet),
228	desc:html("   If PredSpec is a predicate compiled into a sequence of abstract
229   instructions, this predicate will list on the current output stream this
230   abstract code.  The ECLiPSe abstract machine is a modification of the
231   Warren Abstract Machine.
232
233<P>
234"),
235	args:["PredSpec" : "Atom/Integer or just Atom."],
236	fail_if:"Fails if PredSpec is not a predicate compiled into the WAM",
237	exceptions:[4 : "PredSpec is not instantiated.", 5 : "PredSpec is not of the form Atom/Integer or Atom.", 60 : "PredSpec does not exist."],
238	eg:"
239Success:
240    [eclipse 1]: als(true).
241
242    true/0 :
243            Debug_exit
244            Retd
245
246
247    yes.
248
249Error:
250    als(X).                  (Error 4).
251    als(a/a).                (Error 5).
252    als(undef/3).            (Error 60).
253
254
255
256",
257	see_also:[asm:disasm/2,asm:wam/1]]).
258
259:- comment(compiled_stream / 1, [
260	summary:"Succeeds if the I/O stream currently being compiled is Stream.
261
262",
263	amode:(compiled_stream(-) is semidet),
264	desc:html("   Used to find the stream that is currently being compiled.
265   The stream handle can be used to get other information about the source
266   being compiled, e.g. file name and position.  If nothing is currently being
267   compiled, or if a non-textual source is being compiled (compile_term/1,2),
268   this predicate fails.
269<P>
270   compiled_stream/1 is meaningful mainly in queries inside a compiled
271   file, or in event handlers for compilation events.
272<P>
273"),
274	args:["Stream" : "Atom, stream handle or variable."],
275	fail_if:"Fails if no compilation from a stream is currently active",
276	exceptions:[5 : "Stream is instantiated, but not to an atom or stream handle."],
277	eg:"
278    [eclipse]: [user].
279     a.
280     :- compiled_stream(S), get_stream_info(S, name, File),
281        printf(\"Compiling stream %d, file %s\\n\", [S, File]).
282    Compiling stream 0, file user
283    ^D
284     user       compiled traceable 28 bytes in 0.00 seconds
285
286    yes.
287    [eclipse]: exec('cat a.pl', []).
288    a.
289    :- compiled_stream(S), get_stream_info(S, name, File),
290       printf(\"Compiling stream %d, file %s\\n\", [S, File]).
291
292    yes.
293    [eclipse]: [a].
294    Compiling stream 5, file /home/joe/a.pl
295    a.pl       compiled traceable 28 bytes in 0.00 seconds
296
297    yes.
298
299
300
301",
302	see_also:[compile / 1, compile / 2, compile_stream / 1]]).
303
304:- comment((demon) / 1, [
305	summary:"Declares the procedure(s) specified by SpecList to be demons.
306
307",
308	template:"demon +SpecList",
309	amode:(demon(++) is det),
310	desc:html("   The demon annotation specifies that the listed predicates are to
311   be treated as demons. The only difference between a normal predicate
312   and a demon is the behaviour on waking: When a normal predicate is
313   delayed and gets woken, the delayed goal disappears. When a delayed
314   demon gets woken, the delayed goal stays around.
315   The only way to remove a demon is to explicitly kill it.
316
317<P>
318"),
319	args:["SpecList" : "Comma-separated sequence of expressions of the form Atom/Integer."],
320	exceptions:[4 : "SpecList is not instantiated.", 5 : "SpecList is
321	instantiated, but not to a sequence of    expressions of the form Atom/Integer.",
322                    62: "Predicate in SpecList already defined and is not a demon" 
323],
324	eg:"
325     % A demon that wakes whenever X becomes more constrained
326     report(X) :-
327\t     suspend(report(X, Susp), 1, X->constrained, Susp).
328
329     :- demon report/2.
330     report(X, _Susp) :-
331\t     var(X),
332\t     writeln(constrained(X)).  % implicitly re-suspend
333     report(X, Susp) :-
334\t     nonvar(X),
335\t     writeln(instantiated(X)),
336             kill_suspension(Susp).    % remove from the resolvent
337
338
339
340     [eclipse 1]:  report(X),
341             notify_constrained(X), wake,
342             notify_constrained(X), wake.
343     constrained(X)
344     constrained(X)
345
346     X = X
347
348     Delayed goals:
349                 report(X)
350     yes.
351
352     [eclipse 2]:  report(X),
353             notify_constrained(X), wake,
354             X=123.
355     constrained(X)
356     instantiated(123)
357
358     X = 123
359     yes.
360
361
362
363
364",
365	see_also:[kill_suspension / 1, make_suspension / 3, notify_constrained / 1, schedule_suspensions / 2, set_suspension_data / 3, get_suspension_data / 3]]).
366
367:- comment(ensure_loaded / 1, [
368	summary:"Compile or load the specified Files if necessary.
369
370",
371	amode:(ensure_loaded(++) is det),
372	desc:html("
373	Compiles the specified files or libraries if they haven't been compiled
374	yet or if they have been modified since the last compilation.
375	The file name expansion rules are the same as for compile/1,
376	except that it tries to load a precompiled file (with the
377	eclipse_object_suffix) before looking for source files.
378"),
379	args:["Files" : "Atom, string, library(Atom) or a list thereof."],
380	exceptions:[4 : "Files is not instantiated.", 5 : "File is instantiated but not to a (list of) files."],
381	eg:"
382    ensure_loaded(prog).
383    ensure_loaded('dir/file').
384    ensure_loaded([file1, 'file2.pl']).
385    ensure_loaded(library(lists)).
386",
387	see_also:['.' / 2, compile / 1, compile / 2, current_compiled_file / 3, fcompile:fcompile/1, get_flag/2]]).
388
389:- comment((parallel) / 1, [
390	summary:"Declares the procedure(s) specified by SpecList as parallel.
391
392",
393	template:"parallel +SpecList",
394	amode:(parallel(++) is det),
395	desc:html("   The parallel annotation specifies that the system is allowed to execute
396   the clauses of the annotated predicate in parallel (Or-parallelism),
397   instead of sequentially by backtracking.  This has the following
398   consequences:
399
400<P>
401  * the predicate is a source of or-parallelism which will hopefully speed
402    up execution of the program on a parallel machine
403
404<P>
405  * calls to this predicate may return alternative solutions in
406    unpredictable order
407
408<P>
409  * side effects within the parallel execution may happen in unpredictable
410    order
411
412<P>
413   The parallel annotation has simply no effect when the predicate (or a
414   particular call to it) is deterministic or when it is used with a
415   sequential ECLiPSe system.
416
417<P>
418   A procedure can be declared parallel before it is actually defined.
419
420<P>
421"),
422	args:["SpecList" : "Comma-separated sequence of expressions of the form Atom/Integer."],
423	exceptions:[4 : "SpecList is not instantiated.", 5 : "SpecList is instantiated, but not to a sequence of    expressions of the form Atom/Integer."],
424	eg:"
425  [eclipse 1]: [user].
426   :- parallel p/1.
427   p(a).  p(b).  p(c).
428  user       compiled traceable 220 bytes in 0.02 seconds
429  yes.
430  [eclipse 2]: get_flag(p/1, parallel, Flag).
431  Flag = on
432  yes.
433  [eclipse 3]: p(X), use(X).
434  % The three clauses of p/1 as well as the resulting goals
435  % use(a), use(b) and use(c) may be executed in parallel!
436
437
438
439
440",
441	see_also:[compile / 1, get_flag / 3, set_flag / 3]]).
442
443:- comment((abolish) / 1, [
444	summary:"Remove the definition of the predicates specified in SpecList.
445
446",
447	template:"abolish +SpecList",
448	amode:(abolish(++) is det),
449	desc:html("\
450   Removes the definition of the predicates specified in SpecList. These
451   predicates must have their definition (clauses) in the caller module.
452<P>
453   Predicates that are defined elsewhere (i.e. imported or reexported
454   predicates) cannot be abolished. They can only be abolished from their
455   definition module.
456<P>
457   After a predicate has been abolished, any attempt to invoke it will
458   give rise to an error 68 (calling an undefined procedure).
459<P>
460   Certain declarations about properties of a predicate will remain in
461   effect even after abolishing the predicate. These include declarations
462   that affect the predicate's calling convention (modes, demon, parallel,
463   tool).  Moreover, the predicate's visibility (local, exported) is not
464   affected, i.e. if the predicate was exported, it will remain exported.
465<P>
466   Predicates can be abolished, no matter whether they are static or
467   dynamic. For dynamic predicates, the difference between retractall/1
468   and abolish/1 is that retractall/1 leaves the predicates with no
469   clauses (call of the predicate will fail) and the predicate retains
470   its dynamic-property.  In contrast, abolish/1 makes the predicates
471   undefined (calls will raise and error) and the predicate loses its
472   dynamic-property.
473<P>
474   Error 60 (``referring to an undefined procedure'') is raised when no
475   predicate of name SpecList is visible.  Error 100 (``accessing a
476   procedure defined in another module'') is raised if the visible
477   predicate is defined or declared in a different module than the
478   caller module.
479<P>
480   abolish/1 satisfies the logical update semantics.  Abolishing a
481   predicate will not, in any way, affect previous calls to it (when
482   backtracking).
483<P>
484"),
485	args:["SpecList" : "Sequence of expressions of the form Atom/Integer."],
486	exceptions:[4 : "SpecList is not instantiated",
487	    5 : "SpecList is instantiated, but not to a sequence of expressions of the form Atom/Integer",
488	    60 : "SpecList is undefined in the caller module",
489	    100 : "SpecList is not defined in the caller module"],
490	eg:"
491[eclipse 1]: [user].
492 p :- writeln(hello).
493Yes (0.00s cpu)
494
495[eclipse 2]: p.
496hello
497Yes (0.00s cpu)
498
499[eclipse 3]: abolish p/0.
500Yes (0.00s cpu)
501
502[eclipse 4]: p.
503calling an undefined procedure p in module eclipse
504Abort
505
506[eclipse 5]: abolish writeln/1.
507accessing a procedure defined in another module in abolish writeln / 1
508Abort
509
510[eclipse 6]: abolish foo/33.
511referring to an undefined procedure in abolish foo / 33 in module eclipse
512Abort
513
514
515
516Logical semantics :
517
518If the following clauses are in the database :
519    p(1) :- abolish(p/1).
520    p(2).
521
522The call p(X). will produce all the solutions visible when it started
523executing :
524
525    [eclipse]: p(X).
526    X = 1     More? (;)
527    X = 2
528    yes.
529",
530	see_also:[retractall / 1]]).
531
532:- comment(current_built_in / 1, [
533	summary:"Succeeds if the predicate defined by PredSpec is a visible built-in
534predicate.
535
536",
537	amode:(current_built_in(++) is semidet),
538	amode:(current_built_in(-) is nondet),
539	desc:html("   Used to check that PredSpec is a built-in predicate visible from the
540   caller module, or else to return on backtracking all the visible
541   built-in predicates.
542
543<P>
544"),
545	args:["PredSpec" : "Expression of the form Atom/Integer or variable."],
546	fail_if:"Fails if the predicate defined by PredSpec is not a visible built-in\n   predicate",
547	exceptions:[5 : "PredSpec is instantiated, but not to the form Atom/Integer."],
548	eg:"
549Success:
550     [eclipse]: current_built_in(X/Y),!.
551     X = findall
552     Y = 3
553     yes.
554
555     [eclipse]: current_built_in(X).
556     X = findall / 3     More? (;)
557     X = ! / 0     More? (;)
558     X = delayed_goals / 1     More? (;)
559     X = delayed_goals / 2     More? (;)   % type <cr>
560     yes.
561Fail:
562     current_built_in(assertz/1).
563     current_built_in(reverse/2).
564
565     [eclipse]: [user].
566      p.
567      user compiled 28 bytes in 0.00 seconds
568     yes.
569     [eclipse]: get_flag(p/0, type, T).
570     T = user
571     yes.
572     [eclipse]: current_built_in(p/0).
573     no.
574Error:
575     current_built_in(a/a).         (Error 5).
576
577
578
579",
580	see_also:[current_predicate / 1, current_module_predicate/2, is_predicate / 1]]).
581
582:- comment(current_predicate / 1, [
583	summary:"Succeeds if PredSpec is a visible predicate defined by the user, or a
584visible library predicate.
585
586",
587	amode:(current_predicate(++) is semidet),
588	amode:(current_predicate(-) is multi),
589	desc:html("   Used to check that PredSpec is a user or library predicate visible from
590   the caller module, or else to return on backtracking all the current
591   visible predicates.
592
593<P>
594"),
595	args:["PredSpec" : "Expression of the form Atom/Integer or variable."],
596	fail_if:"Fails if PredSpec is not a visible (user or library) predicate",
597	exceptions:[5 : "PredSpec is instantiated, but not to the form Atom/Integer."],
598	eg:"
599Success:
600     [eclipse]: current_predicate(X/Y).
601     X = intersection
602     Y = 3     More? (;)
603     yes.
604     [eclipse]: current_predicate(X).
605     X = (^) / 2     More? (;)
606     X = intersection / 3     More? (;)
607     X = subtract / 3     More? (;)
608     X = append / 3     More? (;)
609     yes.
610
611     [eclipse]: [user].
612      p.
613      user compiled 28 bytes in 0.00 seconds
614     yes.
615     [eclipse]: current_predicate(p/0).
616     yes.
617Fail:
618     current_predicate(assert/1).
619Error:
620     current_predicate(a/a).         (Error 5).
621
622
623
624",
625	see_also:[current_module_predicate/2, current_built_in / 1, is_predicate / 1, get_flag / 3]]).
626
627
628:- comment(current_module_predicate / 2, [
629	summary:"Used to enumerate all predicates with given property in the caller module",
630	amode:(current_module_predicate(+, -) is nondet),
631	amode:(current_module_predicate(+, ++) is semidet),
632	desc:html("\
633    This predicate is mainly used to enumerate all predicates in the caller
634    module with one of the following properties (for testing, use get_flag/3):
635<DL>
636<DT><STRONG>undeclared</STRONG><DD>
637    predicates that have been referenced but are neither
638    declared nor defined in this module.
639<DT><STRONG>no_module</STRONG><DD>
640    predicates whose module of origin is known (through import or qualified
641    reference), but that module does not exist.
642<DT><STRONG>no_export</STRONG><DD>
643    predicates whose module of origin exists, but the predicate is not
644    exported from there.
645<DT><STRONG>local</STRONG><DD>
646    defined predicates that are local
647<DT><STRONG>exported</STRONG><DD>
648    defined predicates that are exported
649<DT><STRONG>reexported</STRONG><DD>
650    defined predicates that are reexported
651<DT><STRONG>exported_reexported</STRONG><DD>
652    defined predicates that are exported or reexported
653<DT><STRONG>defined</STRONG><DD>
654    predicates defined in this module (local or exported)
655<DT><STRONG>undefined</STRONG><DD>
656    local or exported predicates that have not been defined (no clauses)
657<DT><STRONG>deprecated</STRONG><DD>
658    predicates that are imported or referenced via qualification, but have
659    their deprecated-flag set.
660</DL>
661    This predicate is more efficient than current_predicate/1 and
662    current_built_in/1 when one is not interested in imported predicates.
663    In particular, it does not complain about ambiguous imports.
664"),
665	args:[
666	    "Property" : "An atom.",
667	    "PredSpec" : "A variable or an expression of the form Atom/Integer."],
668	fail_if:"Fails if there is no predicate with the given property",
669	exceptions:[
670	    4 : "Property is not instantiated",
671	    5 : "Property is not an atom",
672	    5 : "PredSpec is instantiated, but not to the form Atom/Integer."],
673	eg:"
674    [eclipse 1]: [user].
675     :- local r/0.
676     p :- q, r.
677    yes.
678
679    [eclipse 2]: current_module_predicate(defined,P).
680    P = p / 0
681    yes.
682
683    [eclipse 3]: current_module_predicate(undefined,P).
684    P = r / 0
685    yes.
686
687    [eclipse 4]: current_module_predicate(undeclared,P).
688    P = q / 0
689    yes.
690",
691	see_also:[current_built_in / 1, current_predicate / 1, get_flag / 3]]).
692
693
694:- comment(get_flag / 3, [
695	summary:"Succeeds if the flag Flag of the procedure specified by PredSpec has the
696value Value.
697
698",
699	amode:(get_flag(++,-,-) is nondet),
700	amode:(get_flag(++,+,-) is semidet),
701	desc:html("   Used to get the value Value of the flag Flag of the procedure specified
702   by PredSpec.  The values of certain flags may be set using set_flag/3.
703   It can also be used to test if a procedure with a given functor exists
704   or has certain properties.
705
706<P>
707   The possible flags, their values and their meanings are:
708
709<P>
710<PRE>
711    Flags              Values           Description
712   ----------------------------------------------------------------------
713    auxiliary          on,off           predicate is a compiler auxiliary
714
715    break_lines        list of          list of predicate source File:Line
716                       atom:integer     that currently have breakpoints set
717
718    call_type          prolog,          predicate calling external convention
719
720    code_size          an integer       size of abstract machine
721                                        code in words (32/64 bits)
722
723    debugged           on, off          compiled in debugging mode
724
725    declared           on, off          predicate was declared
726
727    defined            on, off          predicate code exists
728
729    definition_module  an atom          where the procedure is defined
730
731    demon              on, off          predicate is a demon
732
733    deprecated         on, off          predicate is deprecated,
734                                        warning on use
735
736    leash              stop,print,      see below
737                       notrace
738
739    meta_predicate     pred(Prop1,...)  the meta-arguments of the predicate
740                                        (from a meta_predicate/1 declaration)
741
742    mode               pred(Mode1,...)  the mode of the predicate (from a
743                                        mode/1 or meta_predicate/1 declaration)
744
745    parallel           on, off          clauses may be executed in parallel
746
747    port_calls         list of          list of DefModule:Name/Arity for
748                       atom:atom/int    the predicate's body goals where 
749                                        breakpoints can be added. The 
750                                        port_lines option returns the source
751                                        information for these ports, in the 
752                                        same order
753
754    port_lines         list of          list of predicate source File:Line
755                       atom:integer     where breakpoints can be added. The
756                                        port_calls option returns the goal
757                                        information for these ports, in the 
758                                        same order 
759
760    priority           1..12            waking priority
761
762    run_priority       1..12            execution priority when woken
763
764    skip               on, off          procedure will be traced,
765                                        but its children will not
766
767    spy                on, off          procedure has a spypoint
768
769    stability          static,dynamic   is the procedure dynamic?
770
771    tool               on, off          tool property
772
773    type               built-in,user    type of predicate
774
775    visibility         local,exported   module scope
776                       reexported,
777                       imported
778
779    source_file        an atom          the file where defined
780
781    source_line        an integer       starting line number in the file
782
783    source_offset      an integer       byte offset at which the procedure
784                                        definition starts in its source file
785</PRE>
786   The possible values of leash and their meanings are:
787
788<P>
789<PRE>
790   -----------------------------------------------------
791   | Values   Description                               |
792   |--------------------------------------------------  |
793   | stop     procedure ports are printed and the       |
794   |          debugger stops on them                    |
795   | print    procedure ports are printed and the       |
796   |          debugger does not stop on them            |
797   | notrace  procedure ports will not be shown, but    |
798   |          its childrens's ports will                |
799   -----------------------------------------------------|
800</PRE>
801"),
802	args:["PredSpec" : "Expression of the form Atom/Integer.", "Flag" : "Atom or variable.", "Value" : "Atom, integer, compound_term or variable."],
803	fail_if:"Fails if the flag Flag of the procedure specified by PredSpec does not\n   have the value Value, if its value is unknown or if the procedure does\n   not exist",
804	exceptions:[4 : "PredSpec is not instantiated", 5 : "PredSpec is not an expression of the form Atom/Integer.", 5 : "Flag is instantiated but not to an atom.", 5 : "Value is not an atom."],
805	eg:"
806Success:
807    [eclipse]: get_flag(member/2, F, V),
808            printf(\"%-20s%w\\n\", [F, V]), fail.
809
810    mode                member(?, ?)
811    visibility          imported
812    definition_module   sepia_kernel
813    declared            on
814    defined             on
815    autoload            off
816    auxiliary           off
817    call_type           prolog
818    demon               off
819    deprecated          off
820    parallel            off
821    priority            2
822    run_priority        2
823    stability           static
824    tool                off
825    type                built_in
826    debugged            off
827    leash               stop
828    skip                off
829    spy                 off
830    start_tracing       off
831    source_file         Kernel/lib/kernel.pl
832    code_size           14
833
834Fail:
835    get_flag(true/0, defined, off).
836    get_flag(undef/0, F, V).
837Error:
838    get_flag(X, spy, on).           (Error 4).
839    get_flag(\"a\", spy, on).         (Error 5).
840
841
842
843",
844	see_also:[pred / 1, set_flag / 3, current_module_predicate/2]]).
845
846:- comment((mode) / 1, [
847	summary:"Specifies the mode (calling pattern) for the given predicates",
848	template:"mode +PredModes",
849	amode:(mode(++) is det),
850	desc:html("\
851   This declaration is normally used as a directive in compiled code,
852   and informs the compiler that the arguments of the specified predicate
853   will always have the corresponding form when the predicate is called.
854   The compiler takes this information into account when the predicate
855   is compiled, and generates more compact and/or faster code.
856   Specifying the mode of a predicate that has been already compiled
857   has no effect, unless it is recompiled.  If the specified predicate
858   does not exist, a local undefined predicate is created.
859<P>
860   The possible argument modes are:
861<P>
862<DL>
863<DT>
864    <PRE>+</PRE><DD>
865	The argument is instantiated, i.e. it is not a variable.
866<DT>
867    <PRE>++</PRE><DD>
868	The argument is ground, i.e. contains no variables.
869<DT>
870    <PRE>-</PRE><DD>
871	The argument is not instantiated, it must be a free variable without
872	any constraints, especially it must not occur in any other argument
873	and it cannot be a suspending variable.
874<DT>
875    <PRE>?</PRE><DD>
876	The mode is not known or it is neither of the above.
877</DL>
878</PRE>
879   mode/1 is a prefix operator and accepts also comma-separated list of
880   mode specifications in the form
881<P>
882<PRE>
883   :- mode p(+), q(-), r(++, ?).
884</PRE>
885   As the operator binds less than comma, the argument of mode/1 might
886   have to be parenthesised when it is followed by other goals.  Modes must
887   be declared in a predicate's definition module.  Modes are significant
888   only for the first 15 arguments, for higher arguments the mode is always
889   taken as ?.
890<P>
891   NOTE: If the instantiation of a runtime predicate call violates its mode
892   declaration, no exception is raised and its behaviour is undefined.
893<P>
894   The declared mode information can be accessed by retrieving the
895   predicate's 'mode' property with get_flag/3.
896<P>
897"),
898	args:["PredModes" : "Callable term with mode-indicator arguments, or a comma-separated list of such"],
899	exceptions:[4 : "PredModes is not ground",
900		5 : "PredModes is not a callable term, or a comma list, or its arguments are not atoms.",
901		6 : "The callable term arguments are not mode indicators"
902		],
903	eg:"
904Success:
905    % code size:
906    % no mode declarations
907    [eclipse]: [append].
908    /home/eclipse/src/append.pl compiled 212 bytes in 0.03 seconds
909
910    % mode for one argument decreases the code size
911    [eclipse]: mode(append(++, ?, ?)), [append].
912    /home/eclipse/src/append.pl compiled 120 bytes in 0.00 seconds
913
914    % modes for other arguments further decreases the size
915    [eclipse]: mode(append(++, ++, -)), [append].
916    /home/eclipse/src/append.pl compiled 92 bytes in 0.00 seconds
917
918    % size of the trail stack
919    cygnus% cat p.pl
920    p(f(1), [output]) :- !.
921    p(f(2), [another_one]).
922
923    test :-
924        p(f(1), X),
925        statistics(trail_stack_used, T1),
926        writeln(T1).
927    :- test.
928    cygnus% eclipse
929    [eclipse]: [p].
930    16
931    /home/eclipse/p.pl    compiled 540 bytes in 0.02 seconds
932
933    % With modes the code is shorter and does less trailing
934    [eclipse]: mode(p(++, -)), [p].
935    12
936    /home/eclipse/p.pl    compiled 408 bytes in 0.02 seconds
937
938    % bad mode declaration:
939    [eclipse]: mode(p(+)), [user].
940     p(a).
941     user   compiled 40 bytes in 0.00 seconds
942
943    yes.
944    [eclipse]: p(X).    % call violates the mode declaration
945
946    no (more) solution.
947Error:
948    mode p(X).                         (Error 4).
949    mode p(+), get_flag(p/1, mode, X). (Error 5).
950    % equivalent to mode((p(+), get_flag(p/1, mode, X)))
951",
952	see_also:[compile / 1, get_flag / 3, set_flag / 3, (meta_predicate)/1]]).
953
954
955:- comment((meta_predicate) / 1, [
956	summary:"Specifies the meta-arguments for the given predicates",
957%	template:"meta_predicate +MetaSpecs",
958	amode:(meta_predicate(++) is det),
959	desc:html("\
960   This declaration is normally used as a directive in compiled code,
961   to specify if and how the arguments of a predicate refer to other
962   predicates (meta-arguments).  In ECLiPSe 6.1, this declaration does
963   not affect the semantics of the program, and is only used by
964   development tools like the cross-referencer or coverage analyser. 
965   In future releases, the compiler may make use of the information.
966<P>
967   The meta-argument indicators describes the control flow through the
968   arguments of a meta-predicate.  The functor and arity of MetaSpec
969   correspond to the functor and arity of the meta-predicate. The arguments
970   are each populated with one of the following atomic descriptors:
971<DL>
972    <PRE>0</PRE><DD>
973	A goal that is called as a subgoal of the declared predicate.
974<DT>
975    <P>A positive integer</P><DD>
976	A subgoal is constructed by appending the number of specified
977	arguments, and then called.
978<DT>
979    <PRE>:-</PRE><DD>
980	A clause (a fact or a rule).
981<DT>
982    <PRE>/</PRE><DD>
983	A PredSpec of the form Name/Arity.
984<DT>
985    <PRE>:</PRE><DD>
986	A module-sensitive argument, but none of the above.
987<DT>
988    <PRE>*</PRE><DD>
989	An argument that is not one of the above.
990</DL>
991    Instead of the '*', which marks a non-meta argument, a mode indicator
992    can be given.  The effect is the same as specifying '*', and giving
993    the mode in a separate mode/1 declaration:
994<DL>
995<DT>
996    <PRE>+</PRE><DD>
997	The argument is instantiated, i.e. it is not a variable.
998<DT>
999    <PRE>++</PRE><DD>
1000	The argument is ground, i.e. contains no variables.
1001<DT>
1002    <PRE>-</PRE><DD>
1003	The argument is not instantiated, it must be a free variable without
1004	any constraints or aliases.
1005<DT>
1006    <PRE>?</PRE><DD>
1007	The mode is not known or it is neither of the above.
1008</DL>
1009<P>
1010   If one of the declared predicates does not exist, a local undefined
1011   predicate is created.
1012<P>
1013   The declared meta-predicate information can be accessed by retrieving
1014   the predicate's 'meta_predicate' and 'mode' properties with get_flag/3.
1015<P>
1016"),
1017	args:["MetaSpecs" : "Callable term with meta-argument indicators, or a comma-separated list of such."],
1018	exceptions:[4 : "MetaSpecs is not ground",
1019		5 : "MetaSpecs is not a callable term, or a comma list of such",
1020		6 : "The callable term arguments are not meta-argument indicators"
1021		],
1022	eg:"
1023:- meta_predicate p(:,*,*).
1024
1025:- meta_predicate q(0,+,-).
1026
1027:- meta_predicate
1028	maplist(2,*,*),
1029	checklist(1,*).
1030",
1031	see_also:[compile/1, get_flag/3, (mode)/1, library(instrument),
1032			library(xref), library(coverage), library(lint)]
1033]).
1034
1035
1036:- comment(set_flag / 3, [
1037	summary:"Sets the flag Flag of the procedure specified by PredSpec to the value
1038Value.
1039
1040",
1041	index:[deprecated,priority,run_priority,leash,skip,start_tracing,spy],
1042	amode:(set_flag(++,+,+) is det),
1043	desc:html("   Used to set the value Value of the flag Flag of the procedure(s)
1044   specified by PredSpec.  The value of a flag may be returned using
1045   get_flag/3.
1046
1047<P>
1048   The settable flags, their values and their meanings are:
1049
1050<P>
1051<PRE>
1052   ---------------------------------------------------------------------
1053   | Flags          Values     Description                             |
1054   |-------------------------------------------------------------------|
1055   | deprecated     on, off    predicate is deprecated, warn on use    |
1056   |                                                                   |
1057   | leash                     debugger behaviour for this procedure:  |
1058   |                stop,        trace procedure's ports and stop      |
1059   |                print,       trace procedure's ports and continue  |
1060   |                notrace      hide procedure's ports                |
1061   |                                                                   |
1062   | skip           on, off    procedure will be traced,               |
1063   |                           but its children will not               |
1064   |                                                                   |
1065   | spy            on, off    procedure has a spypoint                |
1066   |                                                                   |
1067   | start_tracing  on, off    procedure starts the tracer             |
1068   |                                                                   |
1069   | priority       1..12      default waking priority                 |
1070   |                                                                   |
1071   | run_priority   1..12      execution priority when woken           |
1072   ---------------------------------------------------------------------
1073</PRE>
1074"),
1075	args:["PredSpec" : "Expression of the form Atom/Integer or a list of those.", "Flag" : "Atom.", "Value" : "Atom."],
1076	exceptions:[4 : "At least one of PredSpec, Flag or Value are not instantiated", 5 : "PredSpec is not an expression of the form Atom/Integer.", 5 : "Flag is not an atom.", 5 : "Value is not an atom.", 6 : "Flag is no flag.", 6 : "Value is no value of the flag Flag.", 30 : "Flag is a read only flag.", 60 : "PredSpec is not defined."],
1077	eg:"
1078Success:
1079    [eclipse]: [user].
1080     pr([]).  % prints the elements of a list
1081     pr([ S | T ]) :-
1082            writeln(S),
1083            pr(T).
1084     user compiled 484 bytes in 0.00 seconds
1085    yes.
1086    [eclipse]: pr([tom, dick]).
1087    tom
1088    dick
1089    yes.
1090    [eclipse]: set_flag(pr/1, spy, on).
1091    yes.
1092    [eclipse]: trace.
1093    Debugger switched on - creep mode
1094    yes.
1095    [eclipse]: pr([tom, dick]).
1096     +(1) 0  CALL   pr([tom, dick]) (dbg)?- leap
1097    tom
1098     +(3) 1  CALL   pr([dick]) (dbg)?- leap
1099    dick
1100     +(5) 2  CALL   pr([]) (dbg)?- leap
1101     +(5) 2  EXIT   pr([]) (dbg)?- leap
1102     +(3) 1  EXIT   pr([dick]) (dbg)?- leap
1103     +(1) 0  EXIT   pr([tom, dick]) (dbg)?- leap
1104    yes.
1105
1106Error:
1107    set_flag(X, skip, on).                 (Error 4).
1108    set_flag(\"a\", spy, on).                (Error 5).
1109    set_flag(is/2, spy, yes).              (Error 6).
1110    set_flag(p/2, leash, on).              (Error 60).
1111
1112
1113
1114",
1115	see_also:[debug / 0, get_flag / 3, deprecated/2, (nospy) / 1, pred / 1, (skipped) / 1, (spy) / 1, trace / 0, (traceable) / 1, (unskipped) / 1, (untraceable) / 1]]).
1116
1117:- comment(inline / 2, [
1118	summary:"Declares TransPred as the predicate to be used to do compile-time
1119transformation (e.g. inlining) of calls to Pred.
1120
1121",
1122	amode:(inline(++,++) is det),
1123	desc:html("\
1124   To improve efficiency, calls to user-defined predicates can be
1125   preprocessed and transformed at compile time.  The directive
1126<PRE>
1127    :- inline(mypred/1, mytranspred/2).
1128</PRE>
1129   arranges for mytranspred/2 to be invoked at compile time for each 
1130   call to the predicate mypred/1 before it is being compiled.
1131<P>
1132   The transformation predicate receives the original call to mypred/1
1133   as its first argument, and is expected to return a replacement goal
1134   in its second argument. This replacement goal replaces the original
1135   call in the compiled code. Usually, the replacement goal would be
1136   semantically equivalent, but more efficient than the original goal.
1137   When the transformation predicate fails, the original goal is not
1138   replaced.
1139<P>
1140   A transformation predicate can have an optional third argument which
1141   supplies the module in which the substitution takes place:
1142<PRE>
1143      trans_pred(OldGoal, NewGoal [, Module]) :- ...
1144</PRE>
1145<P>
1146   Moreover, a transformation predicate can be source annotation aware;
1147   it is then of arity 4 or 5, and should look as follows:
1148<PRE>
1149      trans_pred(OldGoal, NewGoal, OldAnnGoal, NewAnnGoal [, Module]) :- ...
1150</PRE>
1151   In this setting, the annotated version of the original goal term
1152   (see read_annotated/2,3) is passed in the third argument, and the
1153   transformation should bind the fourth argument to the annotated
1154   transformed goal term.  If no source annotation information was
1155   available for the original goal, the third argument is passed in as
1156   a free variable, and the transformation should not bind the fourth
1157   argument.  The optional last argument is again the module in which
1158   the substitution takes place, i.e. where the goal was called.
1159<P>
1160   If inlining is applied to an exported predicate, one must be aware that
1161   the replacement goal will be textually substituted for the original
1162   goal in an unknown module context.  That means that the replacement goal
1163   should only contain calls to builtins or explicitly qualified calls to
1164   other exported predicates, since the visibility of predicates generally
1165   cannot be guaranteed in the module where the substitution takes place.
1166<P>
1167   The inline/2 directive must be issued from the definition module
1168   of Pred, and TransPred must be visible from (and is usually defined
1169   in) this same module.
1170<P>
1171   The transformation predicate for a predicate can be queried by
1172   calling get_flag(Pred, inline, TransPred).
1173<P>
1174   Setting TransPred to =/2 will erase any previously attached
1175   transformation predicate.
1176<P>
1177   Transformation can be disabled for debugging purposes by adding
1178<PRE>
1179      :- pragma(noexpand).
1180</PRE>
1181   to the compiled file, or by setting the global flag
1182<PRE>
1183      :- set_flag(goal_expansion, off).
1184</PRE>
1185    The global flag also controls whether transformations are applied
1186    to goals entered at the interactive toplevel prompt.
1187<P>
1188"),
1189	args:["Pred" : "Expression of the form Atom/Integer.", "TransPred" : "Expression of the form Atom/Integer, Integer is 2 to 5."],
1190	exceptions:[4 : "Pred or TransPred are not fully instantiated.",
1191	    5 : "Pred or TransPred are not of the form Atom/Integer.",
1192	    6 : "The arity of TransPred is not between 2 and 5.",
1193	    100 : "Pred is not defined is this module."],
1194	eg:"
1195    :- inline(double/2, trans_double/2).
1196
1197    double(X, Y) :-
1198        Y is 2*X.
1199
1200    trans_double(double(X, Y), Y=Result) :-
1201        ground(X),           % if X already known at compile time:
1202        Result is 2*X.       % do calculation at compile time!
1203
1204
1205    % If we now compile the following predicate involving double/2:
1206
1207    sample :-
1208        double(12,Y),        % will be transformed into: Y=24
1209        ...
1210        double(Y,Z).         % will be compiled as is
1211
1212
1213
1214
1215",
1216	see_also:[inline/1, expand_goal/2, macro / 3, get_flag / 2, set_flag / 2, pragma / 1, compile / 1, read_annotated/3]]).
1217
1218
1219:- comment(inline / 1, [
1220	summary:"Declares Pred as a candidate for inlining (unfolding).",
1221	amode:(inline(++) is det),
1222	desc:html("\
1223   If a predicate is declared inline, the compiler will attempt to
1224   textually insert the predicate's definition everywhere the
1225   predicate is called.  This is also known as unfolding.  
1226   Inlining will usually improve efficiency, in particular when the
1227   inlined predicate is short or has many arguments.
1228<P>
1229   If the inlined predicate has multiple clauses, they will be inlined
1230   in the form of a disjunction (note that indexing will be preserved).
1231<P>
1232   If inlining is applied to an exported predicate, one must be aware that
1233   the definition will be textually substituted for the original goal in
1234   an unknown module context.  Although the expansion mechanism will add
1235   module qualifications to the expanded source, it means that all
1236   predicates called by the expanded source must be exported from their
1237   definition module in order to be accessible from elsewhere.
1238<P>
1239   The inline/1 directive must be issued from the definition module
1240   of Pred, and should occur before Pred's definition.  Only calls that
1241   textually follow the definition will be inlined.
1242<P>
1243   Note that inline/1 is a special system-defined case of inline/2,
1244   using a transformation predicate called unfold/6.  Therefore
1245   get_flag(Pred, inline, unfold/6) can be used to test whether a
1246   predicate has been declared with inline/1.
1247<P>
1248   Inlining can be disabled for debugging purposes by adding
1249<PRE>
1250    :- pragma(noexpand).
1251</PRE>
1252   to the code containing calls, or by setting the global flag
1253<PRE>
1254    :- set_flag(goal_expansion, off).
1255</PRE>
1256    The global flag also controls whether transformations are applied
1257    to goals entered at the interactive toplevel prompt.
1258<P>
1259"),
1260	args:["Pred" : "Expression of the form Atom/Integer."],
1261	exceptions:[4 : "Pred is not fully instantiated.", 5 : "Pred is not of the form Atom/Integer.", 100 : "Pred is not defined is this module."],
1262	eg:"
1263    :- inline(double/2).
1264    double(X, Y) :- Y is 2*X.
1265
1266    % The predicate
1267    sample :- ..., double(A, B), ...
1268    % will be compiled as
1269    sample :- ..., B is 2*A, ...
1270
1271    :- inline(yesno/1).
1272    yesno(yes).
1273    yesno(no).
1274
1275    % The predicate
1276    sample :- ..., yesno(X), ...
1277    % will be compiled as
1278    sample :- ..., (X=yes;X=no), ...
1279
1280",
1281	see_also:[inline / 2, expand_goal/2, get_flag / 2, pragma / 1, compile / 1]]).
1282
1283
1284:- comment(expand_goal / 2, [
1285	summary:"Apply goal inline expansion to Term",
1286	amode:(expand_goal(+,-) is det),
1287	desc:html("\
1288    Applies a goal inline expansion to Term, if any is visible in the
1289    caller module. If no inline/1 or inline/2 declaration is visible,
1290    TransTerm is identical to Term.
1291    <P>
1292    Normally, goal inline expansion is performed implicitly by the compiler.
1293    For certain meta-programming applications (e.g. for writing other
1294    compilers) it can be performed explicitly using expand_goal/2.
1295    Goal inline expansion is the third transformation which is applied during
1296    the compilation process: macro expansion, then clause expansion, then
1297    goal inline expansion.
1298"),
1299	args:["Term" : "A callable term.",
1300		"TransTerm" : "A variable or callable term."],
1301	eg:"
1302    [eclipse 1]: lib(fd).
1303    yes.
1304
1305    [eclipse 5]: expand_goal(X#>Y, G).
1306    X = X
1307    Y = Y
1308    G = fd_arith : fd_gec(X, -1, Y, -1, 0)
1309    yes.
1310",
1311	see_also:[inline/1, inline/2, portray/3, expand_clause/2]]).
1312
1313:- comment(expand_clause / 2, [
1314	summary:"Apply clause transformation to Term",
1315	amode:(expand_clause(+,-) is det),
1316	desc:html("\
1317    Applies a clause-transformation (clause macro) to Term, if any is
1318    visible in the caller module (see macro/3). If no transformation
1319    is visible, TransTerm is identical to Term.
1320    <P>
1321    Normally, clause expansion is performed implicitly by the compiler.
1322    For certain meta-programming applications (e.g. for writing other
1323    compilers) it can be performed explicitly using expand_clause/2.
1324    Clause expansion is the second transformation which is applied during
1325    the compilation process: macro expansion, then clause expansion, then
1326    goal inlining expansion.
1327    <P>
1328    Note that the result of clause transformation can be either a single
1329    clause or a list of clauses. Transformed clauses should all be standard
1330    clauses, i.e. either facts or rules with toplevel functor :-/2.
1331"),
1332	args:["Term" : "A clause term.",
1333		"TransTerm" : "A variable or term."],
1334	eg:"
1335    % A grammar rule is an example of a predefined clause transformation:
1336    ?- expand_clause((p --> q, [tok]), C).
1337
1338    C = p(_263, _258) :- q(_263, _278), 'C'(_278, tok, _258)
1339    yes.
1340",
1341	see_also:[macro/3, expand_goal/2, library(source_processor)]]).
1342
1343
1344
1345:- comment((discontiguous) / 1, [
1346	summary:"Declares the procedure(s) specified by SpecList as discontiguous",
1347	amode:(discontiguous(++) is det),
1348	desc:html("\
1349   The discontiguous declaration specifies that clauses for the declared
1350   predicate need not be together (contiguous) in the source file which contains
1351   them, but can be interleaved with clauses for other predicates. All clauses
1352   must be in a single file, though.
1353<P>
1354   A discontiguous declaration must textually occur in the same file and before
1355   any clauses for the predicate. Multiple discontiguous declarations for the
1356   same predicate are silently accepted.
1357"),
1358	args:["SpecList" : "term of the form Atom/Integer, or a comma-separated sequence of such terms, or a list of such terms"],
1359	exceptions:[4 : "SpecList or a component of it is not instantiated.",
1360		5 : "SpecList is instantiated, but not to a sequence or list of expressions of the form Atom/Integer.",
1361		65 : "SpecList specifies a predicate which is already defined"],
1362	eg:"
1363  [eclipse 1]: [user].
1364   :- discontiguous(p/1).
1365   p(a).
1366   q(1).
1367   p(b).
1368  user       compiled traceable 220 bytes in 0.02 seconds
1369  yes.
1370",
1371	see_also:[compile / 1]]).
1372
1373
1374:- comment(deprecated / 2, [
1375    summary:"Declares the specified procedure as deprecated",
1376    amode:(deprecated(++,+) is det),
1377    desc:html("\
1378   This declaration marks a predicate as deprecated. This means that a
1379   compile-time warning will be raised when a call to this predicate is
1380   compiled or when the predicate is explicitly imported. The warning
1381   will include the Advice-string, which is supposed to tell the user
1382   how to replace the deprecated predicate with a better equivalent.
1383   <P>
1384   Deprecation warnings can be suppressed using the pragma
1385   <PRE>
1386   :- pragma(deprecated_warnings(off)).
1387   </PRE>
1388"),
1389    args:["PredSpec" : "A term of the form Atom/Integer",
1390	"Advice":"A string"],
1391    exceptions:[4 : "PredSpec or a component of it is not instantiated.",
1392	4 : "Advice is not instantiated.",
1393	5 : "PredSpec is instantiated, but not to a term of the form Atom/Integer.",
1394	5 : "Advice is instantiated, but not to a string."],
1395    eg:"
1396    :- deprecated(foo/1, \"Please use bar/2 instead\").
1397    foo(99).
1398",
1399    see_also:[compile / 1, pragma/1, get_flag/3]]).
1400
1401
1402:- comment(current_pragma / 1, [
1403    summary:"Retrieves pragmas that are currently in effect for the context module",
1404    amode:(current_pragma(+) is semidet),
1405    amode:(current_pragma(-) is nondet),
1406    desc:html("<P>\
1407    Used to test or enumerate currently set pragmas in the context module.
1408    This is typically only meaningful during the compilation process or
1409    during some other kind of source processing.
1410    </P><P>
1411    Source processing tools (or code invoked from source-processing tools,
1412    e.g. inline-transformations) can exploit the pragma facility to make
1413    their behaviour user-configurable. All they need to do is document the
1414    pragma names/structures and check for them using current_pragma/1.
1415    </P><P>
1416    Pragma recording works as follows: if the argument of the pragma directive
1417    is a structure, the new structure overwrites any previously recorded
1418    structure with the same functor.  If the argument is an atom, e.g.
1419    'xxx', then a previously recorded atom 'noxxx' is erased and 'xxx'
1420    recorded instead, and vice versa.
1421    </P>"),
1422    args:["Pragma" : "A variable, atom or compound term"],
1423    exceptions:[5 : "Pragma is not a variable, atom or compound term."],
1424    eg:"
1425    :- pragma(blah).
1426
1427    ?- findall(P, current_pragma(P), L), writeln(L).
1428    [blah]
1429
1430    :- pragma(myoption(on)).
1431
1432    ?- findall(P, current_pragma(P), L), writeln(L).
1433    [blah, myoption(on)]
1434
1435    :- pragma(myoption(off)).
1436
1437    ?- findall(P, current_pragma(P), L), writeln(L).
1438    [blah, myoption(off)]
1439
1440    :- pragma(noblah).
1441
1442     ?- findall(P, current_pragma(P), L), writeln(L).
1443    [noblah, myoption(off)]
1444
1445     ?- current_pragma(myoption(off)).
1446     Yes.
1447",
1448    see_also:[compile / 1, inline/1, inline/2, pragma/1, library(source_processor)]]).
1449
1450
1451%----------------------------------------------------------------------
1452% Compiler - these actually belong to the code in libray(ecl_compiler)
1453%----------------------------------------------------------------------
1454
1455:- tool(compile/1).
1456:- tool(compile/2).
1457:- tool(compile_stream/1).
1458:- tool(compile_term/1).
1459:- tool(compile_term/2).
1460:- tool(compile_term_annotated/3).
1461
1462
1463:- comment(compile / 1, [
1464	summary:"Compile specified file, or list of files, with default options",
1465	amode:(compile(++) is det),
1466	desc:html("
1467    Compiles the specified ECLiPSE source file or list of source files.
1468    The default options are used, and the resulting code is directly
1469    loaded into memory and ready for execution.  See compile/2 for details.
1470"),
1471	args:["File" : "Atom, structure or string, or a list of them."],
1472	exceptions:[4 : "File is not instantiated.",
1473	    5 : "File is instantiated, but not to an atom or string, or a list of atoms or strings.",
1474	    61 : "A predicate that was already defined is later declared to be a tool.",
1475	    62 : "Illegal attempt to change a predicate's properties like: tool, dynamic, demon, parallel, calling convention.",
1476	    82 : "The module in which the clauses should be compiled is locked.",
1477	    94 : "There is already am imported predicate of the same name.",
1478	    130 : "The head of a clause is not an atom or a compound term.",
1479	    131 : "A subgoal in the body of a clause is not an atom, a compound term or a variable.",
1480	    134 : "The clauses of a procedure are not consecutive.",
1481	    137 : "A procedure which was previously referenced as built-in or external is now defined as a regular one, or vice versa.",
1482	    139 : "This event is invoked at the end of each compiled file, by default it prints the compilation time and size of compiled code.",
1483	    143 : "A query in the compiled file has failed. This is by default ignored and the compilation continues.",
1484	    145 : "A procedure is being redefined in another file than the original one.",
1485	    147 : "This event is raised just before a compilation is aborted because of an error.",
1486	    148 : "An unrecognised pragma was used in the code.",
1487	    171 : "File does not exist."
1488	    ],
1489
1490	eg:"
1491Success:
1492   [hanoi].         % compiles the file hanoi.pl
1493
1494   [eclipse]: sh('cat file1').
1495   p:-q(hello).
1496   yes.
1497   [eclipse]: sh('cat file2').
1498   q(X) :- writeln(X).
1499   yes.
1500   [eclipse]: compile(user), p.
1501    p :- writeln(hi).
1502    user compiled 92 bytes in 0.00 seconds
1503   hi
1504   yes.
1505   [eclipse]: compile([file1, file2]), p.
1506   /home/lp/user/file1 compiled 32 bytes in 0.02 seconds
1507   /home/lp/user/file2 compiled 92 bytes in 0.00 seconds
1508   hello
1509   yes.
1510
1511
1512   % example showing use of relative pathnames.
1513   [eclipse]: sh('ls -FR /home/lp/user/pl').
1514   a.pl        util/
1515
1516   /home/lp/user/pl/util:
1517   b.pl        c.pl
1518
1519   yes.
1520   [eclipse]: sh('cat /home/lp/user/pl/a.pl').
1521   :- compile('util/b').
1522   p.
1523
1524   yes.
1525   [eclipse]: compile('/home/lp/user/pl/a').
1526   /home/lp/user/pl/util/b.pl compiled 92 bytes in 0.00 seconds
1527   /home/lp/user/pl/a.pl compiled 28 bytes in 0.00 seconds
1528   yes.
1529
1530Error:
1531   compile(F).            (Error 4).
1532   compile(file1/1).      (Error 5).
1533   compile(file).         (Error 171).
1534",
1535    see_also:[compile/2,compile_stream/1,compile_term/1,compile_term/2,
1536    	ensure_loaded/1,lib/1,use_module/1,pragma/1,
1537	fcompile:fcompile / 1]]).
1538
1539
1540:- comment(compile/2, [
1541    summary:"Compile specified file, or list of files, with given options",
1542    index: [debug,expand_goals,opt_level,warnings],
1543    args:["Source":"Source file name (atom or string) or structure stream(Stream)",
1544    	"Options":"List of compiler options (name:value pairs)"],
1545    amode:compile(++,++),
1546    desc:html("
1547   Compiles the specified ECLiPSE source file or list of source files,
1548   with the given options.  See below for a detailed description of the
1549   options.
1550<P>
1551<h3>Source Location</h3>
1552   The atom or string File must be instantiated to a legitimate
1553   specification for an existing file except for the suffix.
1554   The predicate tries to add to it the source suffixes from the list
1555   specified in the global flag prolog_suffix, and look for an existing and
1556   readable file.  As soon as a file is found which exists, it is taken as
1557   the input file name.  The default source suffixes are empty suffix,
1558   .ecl and .pl.
1559<P>
1560   If File is of the form library(Name), the predicates looks for the file
1561   in the directories from the library_path flag.
1562<P>
1563   If File is the special atom 'user', the source will be taken from
1564   the current 'input' stream, i.e. will usually generate a prompt
1565   at which clauses can be typed in.  In this case, input must be
1566   terminated either by typing CTRL-D (on Unix), CTRL-Z + RETURN
1567   (on Windows), or with the single atom end_of_file, followed by
1568   a fullstop/period.
1569<P>
1570   If File is the special form stream(Stream), then the source is taken
1571   from the given stream (which must be already opened).  The stream
1572   content is compiled until the end of stream, but the stream is not
1573   closed.
1574<P>
1575   When File is not in the current directory, ECLiPSe first changes the
1576   current directory to that of the file.  Consequently, recursive
1577   compile/1 calls inside compiled files can use relative pathnames.  This
1578   makes it possible to compile the top program files from any directory
1579   and still use only local file names inside.  At the end of the compilation,
1580   the current directory is changed back to the initial one.  This has the
1581   side effect that all calls to cd/1 in queries in the compiled file are
1582   ignored.
1583<P>
1584
1585<h3>Option Syntax</h3>
1586    Options is a possibly empty list of OptionName:OptionValue pairs.
1587
1588<h3>Code Generation Options</h3>
1589<DL>
1590<DT>debug:</DT><DD>
1591    This option (off/on) determines whether the resulting code contains
1592    debugging information.  If off, subgoals of the compiled predicates will
1593    not be visible to the debugger, the code will be significantly smaller,
1594    and slightly faster.
1595    The default value is taken from the global flag debug_compile.
1596    The setting can be changed via a pragma (debug/nodebug) in the code.
1597</DD>
1598<DT>expand_goals:</DT><DD>
1599    This option (off/on, default taken from global flag goal_expansion)
1600    determines whether inlining (a.k.a. goals macros) is performed.
1601    The default value is taken from the global flag goal_expansion.
1602    The setting can be changed via a pragma (expand/noexpand) in the code.
1603    Should only be switched off if a problem with inlining is suspected,
1604    or to get a debugger trace that is closer to the source code.
1605</DD>
1606<DT>opt_level:</DT><DD>
1607    Currently the integer 0 or 1, with 1 the default. Setting this to 0
1608    will disable certain compiler optimizations and usually reduce performance.
1609</DD>
1610</DL>
1611<h3>Output Options</h3>
1612<DL>
1613<DT>load:</DT><DD>
1614    When loading is requested, the abstract machine code produced by the
1615    compiler gets assembled and loaded into memory as executable code.
1616    Values for the 'load' option are:
1617    <DL>
1618    <DT>all (default)</DT><DD>
1619        Load and replace code in memory, create/re-create all modules,
1620        interpret pragmas, and execute all directives and queries.
1621    </DD><DT>none</DT><DD>
1622        Do not load any code into memory, do not execute queries,
1623        but interpret pragmas and execute directives.
1624        Do not re-create modules, but create new ones and erase them
1625        again after compilation.
1626    </DD><DT>new</DT><DD>
1627        Do not overwrite any code in memory, but load new predicates.
1628        Do not execute queries, but interpret pragmas and execute directives.
1629        Do not re-create modules, but create new ones and erase them
1630        again after compilation. For existing modules, erase pragmas.
1631    </DD></DL>
1632</DD>
1633<DT>output:</DT><DD>
1634    The abstract machine code which is the result of the compilation can
1635    be output in various forms.  Values for 'output' option (default: none):
1636    <DL>
1637    <DT>none</DT><DD>
1638        no output (but code may be loaded, see load option),
1639    </DD><DT>asm</DT><DD>
1640        output compiled code in asm format to input file with .asm suffix.
1641        This format represents the code as WAM code that can be loaded back
1642        into ECLiPSe using the assembler (lib(asm)).  
1643    </DD><DT>asm(File)</DT><DD>
1644        output compiled code in asm format to File.
1645    </DD><DT>eco</DT><DD>
1646        output compiled code in eco format to input file with .eco suffix
1647        This format can be loaded using ensure_loaded/1 or the compiler
1648        itself.
1649    </DD><DT>eco(File)</DT><DD>
1650        output compiled code in eco format,
1651    </DD><DT>print</DT><DD>
1652        print resulting WAM code to the output stream,
1653    </DD><DT>print(Stream)</DT><DD>
1654        print WAM code to Stream,
1655    </DD><DT>listing</DT><DD>
1656        print WAM code to input file with .lst suffix,
1657    </DD><DT>listing(File)</DT><DD>
1658        print WAM code to File,
1659    </DD></DL>
1660</DD>
1661<DT>outdir:</DT><DD>
1662    Value is the destination directory for all output files.
1663    The default is the empty string \"\", meaning that all output files
1664    go into the same directory as the corresponding input file.
1665</DD>
1666</DL>
1667<h3>Information Options</h3>
1668<DL>
1669<DT>verbose:</DT><DD>
1670    This option controls whether the compiler produces any log messages to
1671    the log_output stream. The value is a positive integer. Level 0 is the
1672    most silent, 1 is quiet, 2 is verbose.  Level 1 produces a log of all
1673    compiled predicates. Default: 0.
1674</DD>
1675<DT>warnings:</DT><DD>
1676    Controls (on/off) whether warnings are printed during compilation.
1677    Default: on.
1678    The setting can be changed via a pragma (warnings/nowarnings) in the code.
1679</DD>
1680</DL>
1681<h3>Expert Options</h3>
1682<DL>
1683<DT>expand_clauses:</DT><DD>
1684    This option (off/on, default:on) determines whether clause macros, such
1685    as DCGs and delay clauses are being expanded.  Should not be switched off.
1686</DD>
1687<DT>print_normalised:</DT><DD>
1688    Print result of the normalisation pass (on/off, default:off).
1689</DD>
1690<DT>print_indexes:</DT><DD>
1691    Print result of indexing  analysis (on/off, default:off).
1692</DD>
1693<DT>print_lifetimes:</DT><DD>
1694    Print result of the variable lifetime analysis (on/off, default:off).
1695</DD>
1696<DT>print_raw_code:</DT><DD>
1697    Print annotated WAM code before register allocation (on/off, default:off).
1698</DD>
1699<DT>print_final_code:</DT><DD>
1700    Print annotated WAM code after register allocation (on/off, default:off).
1701</DD>
1702<DT>skip:</DT><DD>
1703    This option (off/on, default:off) determines whether all compiled
1704    predicates have their 'skip' flag set by default.  This means that
1705    subgoals of these predicates will be hidden in the debugger trace,
1706    unless the flag is reset at runtime.
1707    The setting can be changed via a pragma (skip/noskip) in the code.
1708</DD>
1709<DT>srcroot:</DT><DD>
1710    This is used to make the compilation result (e.g. .eco files) independent
1711    of absolute source file names: when the option is set to a non-empty string,
1712    wich is a parent directory of a source file, the source file property of the
1713    compiled predicates will be set as a pathname relative to the given
1714    root directory.
1715</DD>
1716<DT>system:</DT><DD>
1717    This option (off/on, default:off) causes all compiled predicates to
1718    have their type-flag set to 'built_in'.  This is used for compiling
1719    system files.  Same effect as a system-pragma in the code.
1720</DD>
1721</DL>
1722
1723<h3>Compiling Modules</h3>
1724   In the absence of module-directives (module/1,3) within the file, the
1725   file content is compiled into the module from which compile/2 itself
1726   was called.  This context module may be modified using the @/2 notation,
1727   i.e. compile(File,Options)@Module.  Existing static predicates will
1728   be redefined, and clauses for dynamic predicates appended to the
1729   existing ones (unless the 'load' option requests otherwise).
1730<P>
1731   If the compiled file contains module directives (module/1,3), these
1732   specify to which module(s) the compiled code belongs.  Module directives
1733   are effective from the point where they occur until the next module
1734   directive, or until the end of file.  If a module directive refers
1735   to a module that exists already, this module is erased and redefined
1736   (unless the 'load' option requests otherwise).
1737<P>
1738   For backward compatibility with older ECLiPSe versions, we allow a
1739   module name in place of the Options-list.  If this module does not exist,
1740   compile/2 will create such a module and compile the content of file
1741   into this module, as with compile(File)@Module.
1742<P>
1743   In addition to the exceptions listed below, any exception can occur during
1744   compilation, because general code may be executed in directives (:-/2), file
1745   queries (?-/2), macro transformations and inline expansion code.
1746    "),
1747	exceptions:[4 : "Either File or Options is not instantiated.",
1748	    5 : "File is instantiated, but not to a valid source specification.",
1749	    5 : "Options is not a valid options list, nor a module name.",
1750	    61 : "A predicate that was already defined is later declared to be a tool.",
1751	    62 : "Illegal attempt to change a predicate's properties like: tool, dynamic, demon, parallel, calling convention.",
1752	    82 : "The module in which the clauses should be compiled is locked.",
1753	    94 : "There is already am imported predicate of the same name.",
1754	    130 : "The head of a clause is not an atom or a compound term.",
1755	    131 : "A subgoal in the body of a clause is not an atom, a compound term or a variable.",
1756	    134 : "The clauses of a procedure are not consecutive.",
1757	    136 : "Attempt to redefine a built-in predicate without declaring it first.",
1758	    137 : "A procedure which was previously referenced as built-in or external is now defined as a regular one, or vice versa.",
1759	    139 : "This event is invoked at the end of each compiled file, by default it prints the compilation time and size of compiled code.",
1760	    143 : "A query in the compiled file has failed. This is by default ignored and the compilation continues.",
1761	    145 : "A procedure is being redefined in another file than the original one.",
1762	    147 : "This event is raised just before a compilation is aborted because of an error.",
1763	    148 : "An unrecognised pragma was used in the code.",
1764	    171 : "File does not exist."
1765	    ],
1766
1767	eg:"
1768    ?- compile(myfile, [debug:off]).
1769
1770    ?- compile(\"MyFile.ecl\", [output:eco]).
1771
1772    ?- compile(\"MyFile\", [verbose:1,opt_level:0]).
1773",
1774    see_also:[compile/1,compile_stream/1,compile_term/1,compile_term/2,
1775    	ensure_loaded/1,lib/1,use_module/1,pragma/1,
1776	fcompile:fcompile / 1]]).
1777
1778
1779:- comment(compile_stream / 1, [
1780	summary:"Compile the given stream Stream with default options",
1781	amode:(compile_stream(+) is det),
1782	desc:html("
1783    Compile from an (already opened) input stream with default options.
1784    The resulting code is directly loaded into memory and ready for execution.
1785    Equivalent to
1786    <PRE>
1787	compile(stream(Stream), [])
1788    </PRE>
1789   Stream may be a stream handle or a reserved or user-defined
1790   symbolic stream name.  The stream can be of any type, e.g. file, tty,
1791   socket, queue, string, etc.
1792<P>
1793   If Stream is an opened input stream, its content is read and compiled as
1794   in compile/1.  The compilation stops at the stream end, but the stream
1795   remains open.
1796<P>
1797"),
1798	args:["Stream" : "Stream handle or alias (atom)"],
1799	exceptions:[4 : "Stream is not instantiated.",
1800		5 : "Stream is instantiated, but not to an atom or stream handle.",
1801		192 : "Stream is in an illegal stream mode.",
1802		193 : "Stream is an illegal stream specification."],
1803	eg:"
1804compile_string(String) :-
1805	open(string(String), read, S),
1806	compile_stream(S),
1807	close(S).
1808
1809
1810Error:
1811     compile_stream(X).      (Error 4).
1812     compile_stream(1.0).    (Error 5).
1813     compile_stream(1).      (Error 192).
1814     compile_stream(2).      (Error 192).
1815     compile_stream(20).     (Error 192).
1816     compile_stream(a).      (Error 193).
1817",
1818	see_also:[compile / 1, compile / 2, compile_term / 1, pragma/1]]).
1819
1820
1821:- comment(compile_term / 2, [
1822	summary:"Compile specified clause or list of clauses, with the given options",
1823	amode:(compile_term(+,++) is det),
1824    args:["Clauses":"List of clauses and/or directives",
1825    	"Options":"List of compiler options"],
1826	desc:html("\
1827   Compiles the specified clause, or list of clauses, similar to
1828   compilation from a file.  If the clauses are for a predicate that
1829   was undefined so far, a new static predicate will be created.  If
1830   the clauses are for an existing static predicate, the new clauses
1831   will replace the old definition of the predicate.  If the clauses
1832   are for an existing dynamic predicate, the new clauses will be
1833   added to the exiting ones for the dynamic predicate.
1834<P>
1835   If Clause is a list, the list elements are interpreted as consecutive
1836   clauses.  Otherwise, Clause will be taken as a single clause.
1837   Each clause may be a fact or a rule.
1838<P>
1839   As with source files, the list may also contain directives (:- xxx)
1840   but their handling is slightly different: include/1, if/1, elif/1,
1841   else/0, endif/0 and module directives are not allowed.  Pragmas are
1842   interpreted.  All others, as well as file queries (?- xxx) are
1843   called as goals.
1844<P>
1845   This predicate works almost as if all the clauses in the list
1846   were written into a file and this file was then compiled using
1847   compile/1.  Unlike in earlier releases, clause and goal expansion
1848   is performed, according to the default compiler options.
1849   General macro-expansion is not performed, since this is normally
1850   the responsibility of the parser.  If required, it must be done
1851   explicitly via expand_macros/2.
1852<P>
1853   The difference between compile_term/1 and assert/1 is that
1854   the predicates for which clauses are compiled are not necessarily
1855   dynamic with compile_term/1, unless explicitly declared as such.
1856   Therefore clauses compiled with compile_term/1 usually replace the
1857   existing ones for the same predicate, moreover their source form is not
1858   available.  Therefore, it can be used instead of assert/1 if the
1859   properties of dynamic procedures are not required.
1860<P>
1861   Unlike compiling a file, when an event occurs which is not just a
1862   warning, the following clauses are not compiled, the compilation is
1863   aborted.
1864<P>
1865   See compile/2 for a description of compiler options and a exceptions.
1866"),
1867	exceptions:[4 : "Clause is a partial list.",
1868	    5 : "Clause is a list whose tail is neither nil nor a variable.",
1869	    82 : "The module in which the clauses should be compiled is locked.",
1870	    94 : "There is already am imported predicate of the same name.",
1871	    130 : "The head of a clause is not an atom or a compound term.",
1872	    131 : "A subgoal in the body of a clause is not an atom, a compound term or a variable.",
1873	    134 : "The clauses of a procedure are not consecutive.",
1874	    136 : "Trying to redefine a built-in predicate without having declared it.",
1875	    137 : "A procedure which was previously referenced as built-in or external is now defined as a regular one, or vice versa.",
1876	    143 : "One of the clauses was a query and it failed."],
1877
1878	eg:"
1879Success:
1880   % several facts for different predicates
1881   ?- compile_term([p(a), p(b), q(1), r(\"abc\")]).
1882
1883   % a single clause
1884   ?- compile_term(p(X) :- q(X)).
1885
1886   % two clauses for the same predicate
1887   ?- compile_term([p([]), (p([X|Xs]) :- writeln(X), p(Xs))]).
1888
1889   % a declaration and two clauses
1890   ?- compile_term([(:- export p/1), p(a), p(b)]).
1891
1892
1893Error:
1894
1895   compile_term([p|X]).          (Error 4).
1896   compile_term([a|b]).          (Error 5).
1897   compile_term([[a]]).          (Error 94).
1898   compile_term([(p :- write(a)), write(b)]).      (Error 94).
1899   compile_term(\"a\").          (Error 130).
1900   compile_term([\"a\" :- b]).   (Error 130).
1901   compile_term([p(X) :- 1]).    (Error 131).
1902   compile_term([a, b, a]).      (Error 134).
1903   compile_term(!).              (Error 135).
1904   compile_term(:- var(a)).      (Error 143).
1905",
1906	see_also:[compile / 1, compile / 2, '.' / 2, compile_stream / 1,
1907	compile_term/2, compile_term_annotated/3,
1908	assert / 1, expand_macros/2, set_flag / 2, pragma/1]]).
1909
1910
1911:- comment(compile_term/1, [
1912    summary:"Compile a list of clauses using the default options",
1913    args:["Clauses":"List of clauses and/or directives"],
1914    amode:compile_term(+),
1915    see_also:[compile/1,compile/2,compile_stream/1,compile_term/2,
1916	    compile_term_annotated/3],
1917    desc:html("
1918    Compile a list of clauses and directives/queries using the default compiler
1919    options. See compile_term/2 for details.
1920    ")
1921]).
1922
1923:- comment(compile_term_annotated/3, [
1924    summary:"Compile a list of terms, possibly annotated with source information",
1925    args:["Clauses":"List of clauses and/or directives",
1926        "Annotated":"Annotated form of Clauses, or variable",
1927    	"Options":"List of compiler options"],
1928    amode:compile_term_annotated(+,?,++),
1929    see_also:[compile/1,compile_term/2,compile/2,compile_term/1,read_annotated/2,read_annotated/3],
1930    desc:html("
1931    Compile a list of clauses and queries, when source location information
1932    is available.  Such annotated source clauses occur inside inlining
1933    transformations (inline/2) or macro transformations (macro/3), when
1934    using library(source_processor), or when using read_annotated/3.
1935    Code compiled with source location annotations can be traced more
1936    easily in the debugger.
1937<P>
1938    If Annotated is a variable, then no source information is available,
1939    and the predicate behaves exactly like compile_term/2. If Annotated
1940    is instantiated, it must corresponded to the annotated form of Clauses,
1941    i.e. as if returned by read_annotated/2,3.
1942<P>
1943    See compile_term/2 for details.
1944    ")
1945]).
1946