This file is indexed.

/usr/share/doc/swi-prolog-doc/Manual/termrw.html is in swi-prolog-doc 5.6.59-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<HTML>
<HEAD>
<TITLE>SWI-Prolog 5.6.59 Reference Manual: Section 4.19</TITLE><LINK REL=home HREF="index.html">
<LINK REL=contents HREF="Contents.html">
<LINK REL=index HREF="DocIndex.html">
<LINK REL=previous HREF="chario.html">
<LINK REL=next HREF="manipterm.html">
<STYLE type="text/css">
/* Style sheet for SWI-Prolog latex2html
*/

dd.defbody
{ margin-bottom: 1em;
}

dt.pubdef
{ background-color: #c5e1ff;
}

pre.code
{ margin-left: 1.5em;
margin-right: 1.5em;
border: 1px dotted;
padding-top: 5px;
padding-left: 5px;
padding-bottom: 5px;
background-color: #f8f8f8;
}

div.navigate
{ text-align: center;
background-color: #f0f0f0;
border: 1px dotted;
padding: 5px;
}

div.title
{ text-align: center;
padding-bottom: 1em;
font-size: 200%;
font-weight: bold;
}

div.author
{ text-align: center;
font-style: italic;
}

div.abstract
{ margin-top: 2em;
background-color: #f0f0f0;
border: 1px dotted;
padding: 5px;
margin-left: 10%; margin-right:10%;
}

div.abstract-title
{ text-align: center;
padding: 5px;
font-size: 120%;
font-weight: bold;
}

div.toc-h1
{ font-size: 200%;
font-weight: bold;
}

div.toc-h2
{ font-size: 120%;
font-weight: bold;
margin-left: 2em;
}

div.toc-h3
{ font-size: 100%;
font-weight: bold;
margin-left: 4em;
}

div.toc-h4
{ font-size: 100%;
margin-left: 6em;
}

span.sec-nr
{ 
}

span.sec-title
{ 
}

span.pred-ext
{ font-weight: bold;
}

span.pred-tag
{ float: right;
font-size: 80%;
font-style: italic;
color: #202020;
}

/* Footnotes */

sup.fn { color: blue; text-decoration: underline; }
span.fn-text { display: none; }
sup.fn span {display: none;}
sup:hover span 
{ display: block !important;
position: absolute; top: auto; left: auto; width: 80%;
color: #000; background: white;
border: 2px solid;
padding: 5px; margin: 10px; z-index: 100;
font-size: smaller;
}
</STYLE>
</HEAD>
<BODY BGCOLOR="white">
<DIV class="navigate"><A class="nav" href="index.html"><IMG SRC="home.gif" BORDER=0 ALT="Home"></A>
<A class="nav" href="Contents.html"><IMG SRC="index.gif" BORDER=0 ALT="Contents"></A>
<A class="nav" href="DocIndex.html"><IMG SRC="yellow_pages.gif" BORDER=0 ALT="Index"></A>
<A class="nav" href="chario.html"><IMG SRC="prev.gif" BORDER=0 ALT="Previous"></A>
<A class="nav" href="manipterm.html"><IMG SRC="next.gif" BORDER=0 ALT="Next"></A>
</DIV>

<H2><A NAME="sec:4.19"><SPAN class="sec-nr">4.19</SPAN> <SPAN class="sec-title">Term 
reading and writing</SPAN></A></H2>

<A NAME="sec:termrw"></A>

<P>This section describes the basic term reading and writing predicates. 
The predicates <A NAME="idx:format12:805"></A><A class="pred" href="format.html#format/1">format/[1,2]</A> 
and <A NAME="idx:writef2:806"></A><A class="pred" href="format.html#writef/2">writef/2</A> 
provide formatted output. Writing to Prolog datastructures such as atoms 
or code-lists is supported by <A NAME="idx:withoutputto2:807"></A><A class="pred" href="IO.html#with_output_to/2">with_output_to/2</A> 
and <A NAME="idx:format3:808"></A><A class="pred" href="format.html#format/3">format/3</A>.

<P>There are two ways to manipulate the output format. The predicate
<A NAME="idx:print12:809"></A><A class="pred" href="termrw.html#print/1">print/[1,2]</A> 
may be programmed using <A NAME="idx:portray1:810"></A><A class="pred" href="termrw.html#portray/1">portray/1</A>. 
The format of floating point numbers may be manipulated using the Prolog 
flag
<A class="flag" href="flags.html#flag:float_format">float_format</A>.

<P>Reading is sensitive to the Prolog flag <A class="flag" href="flags.html#flag:character_escapes">character_escapes</A>, 
which controls the interpretation of the <CODE><CODE>\</CODE></CODE> 
character in quoted atoms and strings.

<DL>
<DT class="pubdef"><span class="pred-tag">[ISO]</span><A NAME="write_term/2"><STRONG>write_term</STRONG>(<VAR>+Term, 
+Options</VAR>)</A></DT>
<DD class="defbody">
The predicate <A NAME="idx:writeterm2:811"></A><A class="pred" href="termrw.html#write_term/2">write_term/2</A> 
is the generic form of all Prolog term-write predicates. Valid options 
are:

<DL>
<DT><STRONG>attributes</STRONG>(<VAR>Atom</VAR>)</DT>
<DD class="defbody">
Define how attributed variables (see <A class="sec" href="attvar.html">section 
6.1</A>) are written. The default is determined by the Prolog flag <A class="flag" href="flags.html#flag:write_attributes">write_attributes</A>. 
Defined values are <CODE>ignore</CODE> (ignore the attribute), <CODE>dots</CODE> 
(write the attributes as <CODE>{...}</CODE>), <CODE>write</CODE> (simply 
hand the attributes recursively to <A NAME="idx:writeterm2:812"></A><A class="pred" href="termrw.html#write_term/2">write_term/2</A>) 
and <CODE>portray</CODE> (hand the attributes to <A NAME="idx:attrportrayhook2:813"></A><A class="pred" href="attvar.html#attr_portray_hook/2">attr_portray_hook/2</A>).</DD>
<DT><STRONG>backquoted_string</STRONG>(<VAR>Bool</VAR>)</DT>
<DD class="defbody">
If <CODE>true</CODE>, write a string object (see <A class="sec" href="strings.html">section 
4.23</A>) as
<CODE>`</CODE>...<CODE>`</CODE>. The default depends on the Prolog flag
<A class="flag" href="flags.html#flag:backquoted_string">backquoted_string</A>.</DD>
<DT><STRONG>character_escapes</STRONG>(<VAR>Bool</VAR>)</DT>
<DD class="defbody">
If <CODE>true</CODE>, and <CODE>quoted(true)</CODE> is active, special 
characters in quoted atoms and strings are emitted as ISO 
escape-sequences. Default is taken from the reference module (see 
below).</DD>
<DT><STRONG>ignore_ops</STRONG>(<VAR>Bool</VAR>)</DT>
<DD class="defbody">
If <CODE>true</CODE>, the generic term-representation (&lt;<VAR>functor</VAR>&gt;(&lt;<VAR>args</VAR>&gt; 
... )) will be used for all terms, Otherwise (default), operators, 
list-notation and <CODE>{}</CODE>/1 will be written using their special 
syntax.</DD>
<DT><STRONG>max_depth</STRONG>(<VAR>Integer</VAR>)</DT>
<DD class="defbody">
If the term is nested deeper than <VAR>Integer</VAR>, print the 
remainder as eclipse ( ... ). A 0 (zero) value (default) imposes no 
depth limit. This option also delimits the number of printed for a list. 
Example:

<PRE class="code">
?- write_term(a(s(s(s(s(0)))), [a,b,c,d,e,f]), [max_depth(3)]).
a(s(s(...)), [a, b|...])

Yes
</PRE>

<P>Used by the top-level and debugger to limit screen output. See also 
the Prolog flags <A class="flag" href="flags.html#flag:toplevel_print_options">toplevel_print_options</A> 
and
<A class="flag" href="flags.html#flag:debugger_print_options">debugger_print_options</A>.</DD>
<DT><STRONG>module</STRONG>(<VAR>Module</VAR>)</DT>
<DD class="defbody">
Define the reference module (default <CODE>user</CODE>). This defines 
the default value for the <A class="flag" href="flags.html#flag:character_escapes">character_escapes</A> 
option as well as the operator definitions to use. See also <A NAME="idx:op3:814"></A><A class="pred" href="operators.html#op/3">op/3</A>.</DD>
<DT><STRONG>numbervars</STRONG>(<VAR>Bool</VAR>)</DT>
<DD class="defbody">
If <CODE>true</CODE>, terms of the format <CODE>$VAR(N)</CODE>, where &lt;<VAR>N</VAR>&gt; 
is a positive integer, will be written as a variable name. If <VAR>N</VAR> 
is an atom it is written without quotes. This extension allows for 
writing variables with user-provided names. The default is
<CODE>false</CODE>. See also <A NAME="idx:numbervars3:815"></A><A class="pred" href="manipterm.html#numbervars/3">numbervars/3</A>.</DD>
<DT><STRONG>portray</STRONG>(<VAR>Bool</VAR>)</DT>
<DD class="defbody">
If <CODE>true</CODE>, the hook <A NAME="idx:portray1:816"></A><A class="pred" href="termrw.html#portray/1">portray/1</A> 
is called before printing a term that is not a variable. If <A NAME="idx:portray1:817"></A><A class="pred" href="termrw.html#portray/1">portray/1</A> 
succeeds, the term is considered printed. See also <A NAME="idx:print1:818"></A><A class="pred" href="termrw.html#print/1">print/1</A>. 
The default is <CODE>false</CODE>. This option is an extension to the 
ISO write_term options.</DD>
<DT><STRONG>priority</STRONG>(<VAR>Integer</VAR>)</DT>
<DD class="defbody">
An integer between 0 and 1200 representing the `context priority'. 
Default is 1200. Can be used to write partial terms appearing as the 
argument to an operator. For example:

<PRE class="code">
        format('~w = ', [VarName]),
        write_term(Value, [quoted(true), priority(699)])
</PRE>

</DD>
<DT><STRONG>quoted</STRONG>(<VAR>Bool</VAR>)</DT>
<DD class="defbody">
If <CODE>true</CODE>, atoms and functors that needs quotes will be 
quoted. The default is <CODE>false</CODE>.
</DD>
</DL>

</DD>
<DT class="pubdef"><span class="pred-tag">[ISO]</span><A NAME="write_term/3"><STRONG>write_term</STRONG>(<VAR>+Stream, 
+Term, +Options</VAR>)</A></DT>
<DD class="defbody">
As <A NAME="idx:writeterm2:819"></A><A class="pred" href="termrw.html#write_term/2">write_term/2</A>, 
but output is sent to <VAR>Stream</VAR> rather than the current output.</DD>
<DT class="pubdef"><span class="pred-tag">[ISO]</span><A NAME="write_canonical/1"><STRONG>write_canonical</STRONG>(<VAR>+Term</VAR>)</A></DT>
<DD class="defbody">
Write <VAR>Term</VAR> on the current output stream using standard 
parenthesised prefix notation (i.e., ignoring operator declarations). 
Atoms that need quotes are quoted. Terms written with this predicate can 
always be read back, regardless of current operator declarations. 
Equivalent to <A NAME="idx:writeterm2:820"></A><A class="pred" href="termrw.html#write_term/2">write_term/2</A> 
using the options <CODE>ignore_ops</CODE>,
<CODE>quoted</CODE> and <CODE>numbervars</CODE> after <A NAME="idx:numbervars4:821"></A><A class="pred" href="manipterm.html#numbervars/4">numbervars/4</A> 
using the
<CODE>singletons</CODE> option.

<P>Note that due to the use of <A NAME="idx:numbervars4:822"></A><A class="pred" href="manipterm.html#numbervars/4">numbervars/4</A>, 
non-ground terms must be written using a <EM>single</EM> <A NAME="idx:writecanonical1:823"></A><A class="pred" href="termrw.html#write_canonical/1">write_canonical/1</A> 
call. This used to be the case anyhow, as garbage collection between 
multiple calls to one of the write predicates can change the <CODE>_G</CODE>&lt;<VAR>NNN</VAR>&gt; 
identity of the variables.</DD>
<DT class="pubdef"><span class="pred-tag">[ISO]</span><A NAME="write_canonical/2"><STRONG>write_canonical</STRONG>(<VAR>+Stream, 
+Term</VAR>)</A></DT>
<DD class="defbody">
Write <VAR>Term</VAR> in canonical form on <VAR>Stream</VAR>.</DD>
<DT class="pubdef"><span class="pred-tag">[ISO]</span><A NAME="write/1"><STRONG>write</STRONG>(<VAR>+Term</VAR>)</A></DT>
<DD class="defbody">
Write <VAR>Term</VAR> to the current output, using brackets and 
operators where appropriate. The Prolog flag <A class="flag" href="flags.html#flag:float_format">float_format</A> 
controls floating point output format.</DD>
<DT class="pubdef"><span class="pred-tag">[ISO]</span><A NAME="write/2"><STRONG>write</STRONG>(<VAR>+Stream, 
+Term</VAR>)</A></DT>
<DD class="defbody">
Write <VAR>Term</VAR> to <VAR>Stream</VAR>.</DD>
<DT class="pubdef"><span class="pred-tag">[ISO]</span><A NAME="writeq/1"><STRONG>writeq</STRONG>(<VAR>+Term</VAR>)</A></DT>
<DD class="defbody">
Write <VAR>Term</VAR> to the current output, using brackets and 
operators where appropriate. Atoms that need quotes are quoted. Terms 
written with this predicate can be read back with <A NAME="idx:read1:824"></A><A class="pred" href="termrw.html#read/1">read/1</A> 
provided the currently active operator declarations are identical.</DD>
<DT class="pubdef"><span class="pred-tag">[ISO]</span><A NAME="writeq/2"><STRONG>writeq</STRONG>(<VAR>+Stream, 
+Term</VAR>)</A></DT>
<DD class="defbody">
Write <VAR>Term</VAR> to <VAR>Stream</VAR>, inserting quotes.</DD>
<DT class="pubdef"><A NAME="print/1"><STRONG>print</STRONG>(<VAR>+Term</VAR>)</A></DT>
<DD class="defbody">
Prints <VAR>Term</VAR> on the current output stream similar to <A NAME="idx:write1:825"></A><A class="pred" href="termrw.html#write/1">write/1</A>, 
but for each (sub)term of <VAR>Term</VAR> first the dynamic predicate
<A NAME="idx:portray1:826"></A><A class="pred" href="termrw.html#portray/1">portray/1</A> 
is called. If this predicate succeeds <VAR>print</VAR> assumes the 
(sub)term has been written. This allows for user defined term writing.</DD>
<DT class="pubdef"><A NAME="print/2"><STRONG>print</STRONG>(<VAR>+Stream, 
+Term</VAR>)</A></DT>
<DD class="defbody">
Print <VAR>Term</VAR> to <VAR>Stream</VAR>.</DD>
<DT class="pubdef"><A NAME="portray/1"><STRONG>portray</STRONG>(<VAR>+Term</VAR>)</A></DT>
<DD class="defbody">
A dynamic predicate, which can be defined by the user to change the 
behaviour of <A NAME="idx:print1:827"></A><A class="pred" href="termrw.html#print/1">print/1</A> 
on (sub)terms. For each subterm encountered that is not a variable <A NAME="idx:print1:828"></A><A class="pred" href="termrw.html#print/1">print/1</A> 
first calls <A NAME="idx:portray1:829"></A><A class="pred" href="termrw.html#portray/1">portray/1</A> 
using the term as argument. For lists only the list as a whole is given 
to <A NAME="idx:portray1:830"></A><A class="pred" href="termrw.html#portray/1">portray/1</A>. 
If portray succeeds <A NAME="idx:print1:831"></A><A class="pred" href="termrw.html#print/1">print/1</A> 
assumes the term has been written.</DD>
<DT class="pubdef"><span class="pred-tag">[ISO]</span><A NAME="read/1"><STRONG>read</STRONG>(<VAR>-Term</VAR>)</A></DT>
<DD class="defbody">
Read the next Prolog term from the current input stream and unify it 
with <VAR>Term</VAR>. On a syntax error <A NAME="idx:read1:832"></A><A class="pred" href="termrw.html#read/1">read/1</A> 
displays an error message, attempts to skip the erroneous term and 
fails. On reaching end-of-file
<VAR>Term</VAR> is unified with the atom <CODE>end_of_file</CODE>.</DD>
<DT class="pubdef"><span class="pred-tag">[ISO]</span><A NAME="read/2"><STRONG>read</STRONG>(<VAR>+Stream, 
-Term</VAR>)</A></DT>
<DD class="defbody">
Read <VAR>Term</VAR> from <VAR>Stream</VAR>.</DD>
<DT class="pubdef"><A NAME="read_clause/1"><STRONG>read_clause</STRONG>(<VAR>-Term</VAR>)</A></DT>
<DD class="defbody">
Equivalent to <A NAME="idx:read1:833"></A><A class="pred" href="termrw.html#read/1">read/1</A>, 
but warns the user for variables only occurring once in a term 
(singleton variables, see <A class="sec" href="syntax.html">section 
2.15.1.5</A>) which do not start with an underscore if <CODE>style_check(singleton)</CODE> 
is active (default). Used to read Prolog source files (see <A NAME="idx:consult1:834"></A><A class="pred" href="consulting.html#consult/1">consult/1</A>). 
New code should use <A NAME="idx:readterm2:835"></A><A class="pred" href="termrw.html#read_term/2">read_term/2</A> 
with the option <CODE>singletons(warning)</CODE>.</DD>
<DT class="pubdef"><A NAME="read_clause/2"><STRONG>read_clause</STRONG>(<VAR>+Stream, 
-Term</VAR>)</A></DT>
<DD class="defbody">
Read a clause from <VAR>Stream</VAR>. See <A NAME="idx:readclause1:836"></A><A class="pred" href="termrw.html#read_clause/1">read_clause/1</A>.</DD>
<DT class="pubdef"><span class="pred-tag">[ISO]</span><A NAME="read_term/2"><STRONG>read_term</STRONG>(<VAR>-Term, 
+Options</VAR>)</A></DT>
<DD class="defbody">
Read a term from the current input stream and unify the term with
<VAR>Term</VAR>. The reading is controlled by options from the list of
<VAR>Options</VAR>. If this list is empty, the behaviour is the same as 
for
<A NAME="idx:read1:837"></A><A class="pred" href="termrw.html#read/1">read/1</A>. 
The options are upward compatible to Quintus Prolog. The argument order 
is according to the ISO standard. Syntax-errors are always reported 
using exception-handling (see <A NAME="idx:catch3:838"></A><A class="pred" href="exception.html#catch/3">catch/3</A>). 
Options:

<DL>
<DT><STRONG>backquoted_string</STRONG>(<VAR>Bool</VAR>)</DT>
<DD class="defbody">
If <CODE>true</CODE>, read <CODE>`</CODE>...<CODE>`</CODE> to a string 
object (see
<A class="sec" href="strings.html">section 4.23</A>). The default 
depends on the Prolog flag
<A class="flag" href="flags.html#flag:backquoted_string">backquoted_string</A>.</DD>
<DT><STRONG>character_escapes</STRONG>(<VAR>Bool</VAR>)</DT>
<DD class="defbody">
Defines how to read <CODE>\</CODE> escape-sequences in quoted atoms. See 
the Prolog flags <A class="flag" href="flags.html#flag:character_escapes">character_escapes</A>, <A NAME="idx:currentprologflag2:839"></A><A class="pred" href="flags.html#current_prolog_flag/2">current_prolog_flag/2</A>. 
(SWI-Prolog).</DD>
<DT><STRONG>comments</STRONG>(<VAR>-Comments</VAR>)</DT>
<DD class="defbody">
Unify <VAR>Comments</VAR> with a list of <VAR>Position</VAR>-<VAR>Comment</VAR>, 
where
<VAR>Position</VAR> is a stream-position object (see <A NAME="idx:streampositiondata3:840"></A><A class="pred" href="IO.html#stream_position_data/3">stream_position_data/3</A>) 
indicating the start of a comment and <VAR>Comment</VAR> is a 
string-object containing the text including delimiters of a comment. It 
returns all comments from where the <A NAME="idx:readterm2:841"></A><A class="pred" href="termrw.html#read_term/2">read_term/2</A> 
call started upto the end of the term read.</DD>
<DT><STRONG>double_quotes</STRONG>(<VAR>Bool</VAR>)</DT>
<DD class="defbody">
Defines how to read " ... " strings. See the Prolog flag
<A class="flag" href="flags.html#flag:double_quotes">double_quotes</A>. 
(SWI-Prolog).</DD>
<DT><STRONG>module</STRONG>(<VAR>Module</VAR>)</DT>
<DD class="defbody">
Specify <VAR>Module</VAR> for operators, <A class="flag" href="flags.html#flag:character_escapes">character_escapes</A> 
flag and <A class="flag" href="flags.html#flag:double_quotes">double_quotes</A> 
flag. The value of the latter two is overruled if the corresponding <A NAME="idx:readterm3:842"></A><A class="pred" href="termrw.html#read_term/3">read_term/3</A> 
option is provided. If no module is specified, the current 
`source-module' is used. (SWI-Prolog).</DD>
<DT><STRONG>singletons</STRONG>(<VAR>Vars</VAR>)</DT>
<DD class="defbody">
As <CODE>variable_names</CODE>, but only reports the variables occurring 
only once in the <VAR>Term</VAR> read. Variables starting with an 
underscore (`<CODE>_</CODE>') are not included in this list. (ISO). If <VAR>Vars</VAR> 
is the constant <CODE>warning</CODE>, singleton variables are reported 
using
<A NAME="idx:printmessage2:843"></A><A class="pred" href="exception.html#print_message/2">print_message/2</A>.</DD>
<DT><STRONG>syntax_errors</STRONG>(<VAR>Atom</VAR>)</DT>
<DD class="defbody">
If <CODE>error</CODE> (default), throw and exception on a syntax error. 
Other values are <CODE>fail</CODE>, which causes a message to be printed 
using
<A NAME="idx:printmessage2:844"></A><A class="pred" href="exception.html#print_message/2">print_message/2</A>, 
after which the predicate fails, <CODE>quiet</CODE> which causes the 
predicate to fail silently and <CODE>dec10</CODE> which causes syntax 
errors to be printed, after which <A NAME="idx:readterm23:845"></A><A class="pred" href="termrw.html#read_term/2">read_term/[2,3]</A> 
continues reading the next term. Using <CODE>dec10</CODE>, <A NAME="idx:readterm23:846"></A><A class="pred" href="termrw.html#read_term/2">read_term/[2,3]</A> 
never fails. (Quintus, SICStus).</DD>
<DT><STRONG>subterm_positions</STRONG>(<VAR>TermPos</VAR>)</DT>
<DD class="defbody">
Describes the detailed layout of the term. The formats for the various 
types of terms if given below. All positions are character positions. If 
the input is related to a normal stream, these positions are relative to 
the start of the input, when reading from the terminal, they are 
relative to the start of the term.

<DL>
<DT><B><VAR>From</VAR>-<VAR>To</VAR></B></DT>
<DD class="defbody">
Used for primitive types (atoms, numbers, variables).
</DD>
<DT><STRONG>string_position</STRONG>(<VAR><VAR>From</VAR>, <VAR>To</VAR></VAR>)</DT>
<DD class="defbody">
Used to indicate the position of a string enclosed in double quotes (<CODE>"</CODE>).
</DD>
<DT><STRONG>brace_term_position</STRONG>(<VAR><VAR>From</VAR>, <VAR>To</VAR>, <VAR>Arg</VAR></VAR>)</DT>
<DD class="defbody">
Term of the form <CODE>{...}</CODE>, as used in DCG rules. <VAR>Arg</VAR> 
describes the argument.
</DD>
<DT><STRONG>list_position</STRONG>(<VAR><VAR>From</VAR>, <VAR>To</VAR>, <VAR>Elms</VAR>, <VAR>Tail</VAR></VAR>)</DT>
<DD class="defbody">
A list. <VAR>Elms</VAR> describes the positions of the elements. If the 
list specifies the tail as <CODE><CODE>|</CODE></CODE>&lt;<VAR>TailTerm</VAR>&gt;, <VAR>Tail</VAR> 
is unified with the term-position of the tail, otherwise with the atom <CODE>none</CODE>.
</DD>
<DT><STRONG>term_position</STRONG>(<VAR><VAR>From</VAR>, <VAR>To</VAR>, <VAR>FFrom</VAR>, <VAR>FTo</VAR>, <VAR>SubPos</VAR></VAR>)</DT>
<DD class="defbody">
Used for a compound term not matching one of the above. <VAR>FFrom</VAR> 
and <VAR>FTo</VAR> describe the position of the functor. <VAR>SubPos</VAR> 
is a list, each element of which describes the term-position of the 
corresponding subterm.
</DD>
</DL>

</DD>
<DT><STRONG>term_position</STRONG>(<VAR>Pos</VAR>)</DT>
<DD class="defbody">
Unifies <VAR>Pos</VAR> with the starting position of the term read. <VAR>Pos</VAR> 
if of the same format as use by <A NAME="idx:streamproperty2:847"></A><A class="pred" href="IO.html#stream_property/2">stream_property/2</A>.</DD>
<DT><STRONG>variables</STRONG>(<VAR>Vars</VAR>)</DT>
<DD class="defbody">
Unify <VAR>Vars</VAR> with a list of variables in the term. The 
variables appear in the order they have been read. See also <A NAME="idx:termvariables2:848"></A><A class="pred" href="manipterm.html#term_variables/2">term_variables/2</A>. 
(ISO).</DD>
<DT><STRONG>variable_names</STRONG>(<VAR>Vars</VAR>)</DT>
<DD class="defbody">
Unify <VAR>Vars</VAR> with a list of `<VAR>Name</VAR> = <VAR>Var</VAR>', 
where <VAR>Name</VAR> is an atom describing the variable name and <VAR>Var</VAR> 
is a variable that shares with the corresponding variable in <VAR>Term</VAR>. 
(ISO).
</DD>
</DL>

</DD>
<DT class="pubdef"><span class="pred-tag">[ISO]</span><A NAME="read_term/3"><STRONG>read_term</STRONG>(<VAR>+Stream, 
-Term, +Options</VAR>)</A></DT>
<DD class="defbody">
Read term with options from <VAR>Stream</VAR>. See <A NAME="idx:readterm2:849"></A><A class="pred" href="termrw.html#read_term/2">read_term/2</A>.</DD>
<DT class="pubdef"><A NAME="read_history/6"><STRONG>read_history</STRONG>(<VAR>+Show, 
+Help, +Special, +Prompt, -Term, -Bindings</VAR>)</A></DT>
<DD class="defbody">
Similar to <A NAME="idx:readterm2:850"></A><A class="pred" href="termrw.html#read_term/2">read_term/2</A> 
using the option <CODE>variable_names</CODE>, but allows for history 
substitutions. <A NAME="idx:readhistory6:851"></A><A class="pred" href="termrw.html#read_history/6">read_history/6</A> 
is used by the top level to read the user's actions. <VAR>Show</VAR> is 
the command the user should type to show the saved events. <VAR>Help</VAR> 
is the command to get an overview of the capabilities. <VAR>Special</VAR> 
is a list of commands that are not saved in the history. <VAR>Prompt</VAR> 
is the first prompt given. Continuation prompts for more lines are 
determined by <A NAME="idx:prompt2:852"></A><A class="pred" href="termrw.html#prompt/2">prompt/2</A>. 
A
<CODE>%w</CODE> in the prompt is substituted by the event number. See
<A class="sec" href="history.html">section 2.7</A> for available 
substitutions.

<P>SWI-Prolog calls <A NAME="idx:readhistory6:853"></A><A class="pred" href="termrw.html#read_history/6">read_history/6</A> 
as follows:

<PRE class="code">
read_history(h, '!h', [trace], '%w ?- ', Goal, Bindings)
</PRE>

</DD>
<DT class="pubdef"><A NAME="prompt/2"><STRONG>prompt</STRONG>(<VAR>-Old, 
+New</VAR>)</A></DT>
<DD class="defbody">
Set prompt associated with <A NAME="idx:read1:854"></A><A class="pred" href="termrw.html#read/1">read/1</A> 
and its derivatives. <VAR>Old</VAR> is first unified with the current 
prompt. On success the prompt will be set to <VAR>New</VAR> if this is 
an atom. Otherwise an error message is displayed. A prompt is printed if 
one of the read predicates is called and the cursor is at the left 
margin. It is also printed whenever a newline is given and the term has 
not been terminated. Prompts are only printed when the current input 
stream is <VAR>user</VAR>.</DD>
<DT class="pubdef"><A NAME="prompt1/1"><STRONG>prompt1</STRONG>(<VAR>+Prompt</VAR>)</A></DT>
<DD class="defbody">
Sets the prompt for the next line to be read. Continuation lines will be 
read using the prompt defined by <A NAME="idx:prompt2:855"></A><A class="pred" href="termrw.html#prompt/2">prompt/2</A>.
</DD>
</DL>

<P></BODY></HTML>