File: gprolog033.html

package info (click to toggle)
gprolog 1.3.0-6.1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, squeeze, wheezy
  • size: 13,512 kB
  • ctags: 8,954
  • sloc: ansic: 57,431; perl: 16,620; sh: 5,900; makefile: 1,284
file content (1709 lines) | stat: -rw-r--r-- 86,367 bytes parent folder | download | duplicates (2)
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
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>



<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="hevea 1.08">
<LINK rel="stylesheet" type="text/css" href="gprolog.css">
<TITLE>
Streams
</TITLE>
</HEAD>
<BODY TEXT=black BGCOLOR=white>
<A HREF="gprolog032.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="gprolog023.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="gprolog034.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>

<H3 CLASS="subsection"><A NAME="htoc105">7.10</A>&nbsp;&nbsp;Streams</H3><UL>
<LI><A HREF="gprolog033.html#toc74">Introduction</A>
<LI><A HREF="gprolog033.html#toc75"><TT>current_input/1</TT></A>
<LI><A HREF="gprolog033.html#toc76"><TT>current_output/1</TT></A>
<LI><A HREF="gprolog033.html#toc77"><TT>set_input/1</TT></A>
<LI><A HREF="gprolog033.html#toc78"><TT>set_output/1</TT></A>
<LI><A HREF="gprolog033.html#toc79"><TT>open/4</TT>,
 <TT>open/3</TT></A>
<LI><A HREF="gprolog033.html#toc80"><TT>close/2</TT>,
 <TT>close/1</TT></A>
<LI><A HREF="gprolog033.html#toc81"><TT>flush_output/1</TT>,
 <TT>flush_output/0</TT></A>
<LI><A HREF="gprolog033.html#toc82"><TT>current_stream/1</TT></A>
<LI><A HREF="gprolog033.html#toc83"><TT>stream_property/2</TT></A>
<LI><A HREF="gprolog033.html#toc84"><TT>at_end_of_stream/1</TT>,
 <TT>at_end_of_stream/0</TT></A>
<LI><A HREF="gprolog033.html#toc85"><TT>stream_position/2</TT></A>
<LI><A HREF="gprolog033.html#toc86"><TT>set_stream_position/2</TT></A>
<LI><A HREF="gprolog033.html#toc87"><TT>seek/4</TT></A>
<LI><A HREF="gprolog033.html#toc88"><TT>character_count/2</TT></A>
<LI><A HREF="gprolog033.html#toc89"><TT>line_count/2</TT></A>
<LI><A HREF="gprolog033.html#toc90"><TT>line_position/2</TT></A>
<LI><A HREF="gprolog033.html#toc91"><TT>stream_line_column/3</TT></A>
<LI><A HREF="gprolog033.html#toc92"><TT>set_stream_line_column/3</TT></A>
<LI><A HREF="gprolog033.html#toc93"><TT>add_stream_alias/2</TT></A>
<LI><A HREF="gprolog033.html#toc94"><TT>current_alias/2</TT></A>
<LI><A HREF="gprolog033.html#toc95"><TT>add_stream_mirror/2</TT></A>
<LI><A HREF="gprolog033.html#toc96"><TT>remove_stream_mirror/2</TT></A>
<LI><A HREF="gprolog033.html#toc97"><TT>current_mirror/2</TT></A>
<LI><A HREF="gprolog033.html#toc98"><TT>set_stream_type/2</TT></A>
<LI><A HREF="gprolog033.html#toc99"><TT>set_stream_eof_action/2</TT></A>
<LI><A HREF="gprolog033.html#toc100"><TT>set_stream_buffering/2</TT></A>
</UL>

<A NAME="Streams"></A>
<A NAME="toc74"></A>
<H4 CLASS="subsubsection"><A NAME="htoc106">7.10.1</A>&nbsp;&nbsp;Introduction</H4>
<A NAME="Introduction:(Streams)"></A>
A stream provides a logical view of a source/sink.<BR>
<BR>
<B>Sources and sinks</B>: a program can output results to a sink or input
data from a source. A source/sink may be a file (regular file, terminal,
device,...), a constant term, a pipe, a socket,...<BR>
<BR>
<B>Associating a stream to a source/sink</B>: to manipulate a source/sink
it must be associated with a stream. This provides a logical and uniform view
of the source/sink whatever its type. Once this association has been
established, i.e. a stream has been created, all subsequent references to
the source/sink are made by referring the stream. A stream is
unidirectional: it is either an input stream or an output stream. For a
classical file, the association is done by opening the file (whose name is
specified as an atom) with the <TT>open/4</TT> (section&nbsp;<A HREF="#open/4">7.10.6</A>). GNU Prolog
makes it possible to treat a Prolog constant term as a source/sink and
provides built-in predicates to associate a stream to such a term
(section&nbsp;<A HREF="gprolog034.html#Constant-term-streams">7.11</A>). GNU Prolog provides operating system interface
predicates defining pipes between GNU Prolog and child processes with streams
associated with these pipes, e.g. <TT>popen/3</TT> (section&nbsp;<A HREF="gprolog050.html#popen/3">7.27.21</A>).
Similarly, socket interface predicates associate streams to a socket to
allow the communication, e.g. <TT>socket_connect/4</TT>
(section&nbsp;<A HREF="gprolog051.html#socket-connect/4">7.28.5</A>).<BR>
<BR>
<B>Stream-term</B>: a stream-term identifies a stream during a call of an
input/output built-in predicate. It is created as a result of associating a
stream to a source/sink (section above). A stream-term is a compound term of
the form <TT>'$stream'(I)</TT> where <TT>I</TT> is an integer.<BR>
<BR>
<B>Stream aliases</B>: any stream may be associated with a stream alias
which is an atom which may be used to refer to that stream. The association
can be done at open time or using <TT>add_stream_alias/2</TT>
(section&nbsp;<A HREF="#add-stream-alias/2">7.10.20</A>). Such an association automatically ends when the
stream is closed. A particular alias only refers to at most one stream at any
one time. However, more than one alias can be associated with a stream. Most
built-in predicates which have a stream-term as an input argument also accept
a stream alias as that argument. However, built-in predicates which return a
stream-term do not accept a stream alias.<BR>
<BR>
<B>Standard streams</B>: two streams are predefined and open during the
execution of every goal: the standard input stream which has the alias
<TT>user_input</TT> and the standard output stream which has the alias
<TT>user_output</TT>. A goal which attempts to close either standard stream
succeeds, but does not close the stream.<BR>
<BR>
<B>Current streams</B>: during execution there is a current input stream
and a current output stream. By default, the current input and output
streams are the standard input and output streams, but the built-in
predicates <TT>set_input/1</TT> (section&nbsp;<A HREF="#set-input/1">7.10.4</A>) and
<TT>set_output/1</TT> (section&nbsp;<A HREF="#set-output/1">7.10.5</A>) can be used to change them.
When the current input stream is closed, the standard input stream becomes
the current input stream. When the current output stream is closed, the
standard output stream becomes the current output stream. <BR>
<BR>
<B>Text streams and binary streams</B>: a text stream is a sequence of
characters. A text stream is also regarded as a sequence of lines where each
line is a possibly empty sequence of characters followed by a new line
character. GNU Prolog may add or remove space characters at the ends of lines
in order to conform to the conventions for representing text streams in the
operating system. A binary stream is a sequence of bytes. Only a few
built-in predicates can deal with binary streams, e.g.
<TT>get_byte/2</TT> (section&nbsp;<A HREF="gprolog036.html#Byte-input/output">7.13</A>).<BR>
<BR>
<B>Stream positions</B>: the stream position of a stream identifies an
absolute position of the source/sink to which the stream is connected and
defines where in the source/sink the next input or output will take place. A
stream position is a ground term of the form
<TT>'$stream_position'(I1, I2, I3, I4)</TT> where <TT>I1</TT>,
<TT>I2</TT>, <TT>I3</TT> and <TT>I4</TT> are integers. Stream positions are
used to reposition a stream (when possible) using for instance
<TT>set_stream_position/2</TT> (section&nbsp;<A HREF="#set-stream-position/2">7.10.13</A>).<BR>
<BR>
<B>The position end of stream</B>: when all data of a stream
<I><TT>S</TT></I> has been input <I><TT>S</TT></I> has a stream position
end-of-stream. At this stream position a goal to input more data will return
a specific value to indicate that end of stream has been reached (e.g.
<TT>-1</TT> for <TT>get_code/2</TT> or <TT>end_of_file</TT> for
<TT>get_char/2</TT>,...). When this terminating value has been input, the
stream has a stream position past-end-of-stream.<BR>
<BR>
<B>Buffering mode</B>: input/output on a stream can be buffered
(line-buffered or block-buffered) or not buffered at all. The buffering mode
can be specified at open time or using <TT>set_stream_buffering/2</TT>
(section&nbsp;<A HREF="#set-stream-buffering/2">7.10.27</A>). Line buffering is used on output streams,
output data are only written to the sink when a new-line character is output
(or at the close time). Block buffering is used on input or output. On input
streams, when an input is requested on the source, if the buffer is empty,
all available characters are read (within the limits of the size of the
buffer), subsequent reads will first use the characters in the buffer. On
output streams, output data are stored in the buffer and only when the
buffer is full is it physically written on the sink. Thus, an output to a
buffered stream may not be sent immediately to the sink connected to that
stream. When it is necessary to be certain that output has been delivered,
the built-in predicate <TT>flush_output/1</TT> (section&nbsp;<A HREF="#flush-output/1">7.10.8</A>)
should be used. Finally, it is also possible to use non-buffered streams, in
that case input/output are directly done on the connected source/sink. This
can be useful for communication purposes (e.g. sockets) or when a precise
control is needed, e.g. <TT>select/5</TT> (section&nbsp;<A HREF="gprolog050.html#wait/2">7.27.25</A>).<BR>
<BR>
<B>Stream mirrors</B>: any stream may be associated with mirror streams
specified at open time or using <TT>add_stream_mirror/2</TT>
(section&nbsp;<A HREF="#add-stream-mirror/2">7.10.22</A>). Then, all characters/bytes read from/written to
the stream are also written on each mirror stream. The association
automatically ends when either the stream or the mirror stream is closed. It
is also possible to explicitely remove a mirror stream using
<TT>remove_stream_mirror/2</TT>
(section&nbsp;<A HREF="#remove-stream-mirror/2">7.10.23</A>).<BR>
<BR>
<A NAME="toc75"></A>
<H4 CLASS="subsubsection"><A NAME="htoc107">7.10.2</A>&nbsp;&nbsp;<TT>current_input/1</TT></H4>
 
<B>Templates</B>
<DL CLASS="list" COMPACT="compact"><DT CLASS="dt-list"><DD CLASS="dd-list"><TT>
current_input(?stream)</TT></DL>
<B>Description</B><BR>
<BR>
<TT>current_input(Stream)</TT> unifies <TT>Stream</TT> with the stream-term
identifying the current input stream.<BR>
<BR>
<B>Errors</B><BR>
<TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Stream</TT> is neither a variable nor a stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream, Stream)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR></TABLE><BR>
<B>Portability</B><BR>
<BR>
ISO predicate.<BR>
<BR>
<A NAME="toc76"></A>
<H4 CLASS="subsubsection"><A NAME="htoc108">7.10.3</A>&nbsp;&nbsp;<TT>current_output/1</TT></H4>
 
<B>Templates</B>
<DL CLASS="list" COMPACT="compact"><DT CLASS="dt-list"><DD CLASS="dd-list"><TT>
current_output(?stream)</TT></DL>
<B>Description</B><BR>
<BR>
<TT>current_output(Stream)</TT> unifies <TT>Stream</TT> with the
stream-term identifying the current output stream.<BR>
<BR>
<B>Errors</B><BR>
<TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Stream</TT> is neither a variable nor a stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream, Stream)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR></TABLE><BR>
<B>Portability</B><BR>
<BR>
ISO predicate.<BR>
<BR>
<A NAME="toc77"></A>
<H4 CLASS="subsubsection"><A NAME="htoc109">7.10.4</A>&nbsp;&nbsp;<TT>set_input/1</TT></H4>
<A NAME="set-input/1"></A>
 
<B>Templates</B>
<DL CLASS="list" COMPACT="compact"><DT CLASS="dt-list"><DD CLASS="dd-list"><TT>
set_input(+stream_or_alias)</TT></DL>
<B>Description</B><BR>
<BR>
<TT>set_input(SorA)</TT> sets the current input stream to be the stream
associated with the stream-term or alias <TT>SorA</TT>.<BR>
<BR>
<B>Errors</B><BR>
<TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is neither a variable nor a stream-term or alias</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream_or_alias, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is not associated with an open stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>existence_error(stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is an output stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>permission_error(input, stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR></TABLE><BR>
<B>Portability</B><BR>
<BR>
ISO predicate.<BR>
<BR>
<A NAME="toc78"></A>
<H4 CLASS="subsubsection"><A NAME="htoc110">7.10.5</A>&nbsp;&nbsp;<TT>set_output/1</TT></H4>
<A NAME="set-output/1"></A>
 
<B>Templates</B>
<DL CLASS="list" COMPACT="compact"><DT CLASS="dt-list"><DD CLASS="dd-list"><TT>
set_output(+stream_or_alias)</TT></DL>
<B>Description</B><BR>
<BR>
<TT>set_output(SorA)</TT> sets the current output stream to be the stream
associated with the stream-term or alias <TT>SorA</TT>.<BR>
<BR>
<B>Errors</B><BR>
<TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is neither a variable nor a stream-term or alias</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream_or_alias, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is not associated with an open stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>existence_error(stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is an input stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>permission_error(output, stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR></TABLE><BR>
<B>Portability</B><BR>
<BR>
ISO predicate.<BR>
<BR>
<A NAME="toc79"></A>
<H4 CLASS="subsubsection"><A NAME="htoc111">7.10.6</A>&nbsp;&nbsp;<TT>open/4</TT>,
 <TT>open/3</TT></H4>
<A NAME="open/4"></A>
 
 
<B>Templates</B>
<DL CLASS="list" COMPACT="compact"><DT CLASS="dt-list"><DD CLASS="dd-list"><TT>
open(+source_sink, +io_mode, -stream, +stream_option_list)<BR>
open(+source_sink, +io_mode, -stream)</TT></DL>
<B>Description</B><BR>
<BR>
<TT>open(SourceSink, Mode, Stream, Options)</TT> opens the source/sink
<TT>SourceSink</TT> for input or output as indicated by <TT>Mode</TT> and
the list of stream-options <TT>Options</TT> and unifies <TT>Stream</TT> with
the stream-term which is associated with this stream. See
<TT>absolute_file_name/2</TT> for information about the syntax of
<TT>SourceSink</TT> (section&nbsp;<A HREF="gprolog049.html#absolute-file-name/2">7.26.1</A>).<BR>
<BR>
<B>Input/output modes</B>: <TT>Mode</TT> is an atom which defines the
input/output operations that may be performed the stream. Possible modes
are:
<UL CLASS="itemize"><LI CLASS="li-itemize"><TT>read</TT>: the source/sink is a source and must already exist.
Input starts at the beginning of the source. <BR>
<BR>
<LI CLASS="li-itemize"><TT>write</TT>: the source/sink is a sink. If the sink already exists
then it is emptied else an empty sink is created. Output starts at the
beginning of that sink.<BR>
<BR>
<LI CLASS="li-itemize"><TT>append</TT>: the source/sink is a sink. If the sink does not exist
it is created. Output starts at the end of that sink.</UL>
<B>Stream options</B>: <TT>Options</TT> is a list of stream options. If
this list contains contradictory options, the rightmost option is the one
which applies. Possible options are:
<UL CLASS="itemize"><LI CLASS="li-itemize"><TT>type(text</TT>/<TT>binary)</TT>: specifies whether the
stream is a text stream or a binary stream. The default value is
<TT>text</TT>.<BR>
<BR>
<LI CLASS="li-itemize"><TT>reposition(true</TT>/<TT>false)</TT>: specifies
whether it is possible to reposition the stream. The default value is
<TT>true</TT> except if the stream cannot be repositioned (e.g. a terminal).<BR>
<BR>
<LI CLASS="li-itemize"><TT>eof_action(error</TT>/<TT>eof_code</TT>/<TT>reset)</TT>:
specifies the effect of attempting to input from a stream whose stream
position is past-end-of-stream:
<UL CLASS="itemize"><LI CLASS="li-itemize"><TT>error</TT>: a <TT>permission_error</TT> is raised signifying that
no more input exists in this stream.<BR>
<BR>
<LI CLASS="li-itemize"><TT>eof_code</TT>: the result of input is as if the stream position
is end-of-stream.<BR>
<BR>
<LI CLASS="li-itemize"><TT>reset</TT>: the stream position is reset so that it is not
past-end-of-stream, and another attempt is made to input from it (this is
useful when inputting from a terminal).</UL><BR>
The default value is <TT>eof_code</TT>.<BR>
<BR>
<LI CLASS="li-itemize"><TT>alias(Alias)</TT>: specifies that the atom <TT>Alias</TT>
is to be an alias for the stream. By default no alias is attached to the
stream. Several aliases can be defined for a same stream.<BR>
<BR>
<LI CLASS="li-itemize"><TT>mirror(Mirror)</TT>: specifies the stream associated with
the stream-term or alias <TT>Mirror</TT> is a mirror for the stream. By
default no mirro is attached to the stream. Several mirrors can be defined
for a same stream.<BR>
<BR>
<LI CLASS="li-itemize"><TT>buffering(none</TT>/<TT>line</TT>/<TT>block)</TT>:
specifies which type of buffering is used by input/output operations on
this stream:
<UL CLASS="itemize"><LI CLASS="li-itemize"><TT>none</TT>: no buffering.<BR>
<BR>
<LI CLASS="li-itemize"><TT>line</TT>: output operations buffer data emitted until a new-line
occurs<BR>
<BR>
<LI CLASS="li-itemize"><TT>block</TT>: input/output operations buffer data until a given
number (implementation dependant) of characters/bytes have been treated.</UL><BR>
The default value is <TT>line</TT> for a terminal (TTY), <TT>block</TT>
otherwise.</UL>
<TT>open(SourceSink, Mode, Stream, Options)</TT> is equivalent to
<TT>open(SourceSink, Mode, Stream, [])</TT>.<BR>
<BR>
<B>Errors</B><BR>
<TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SourceSink</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Mode</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Options</TT> is a partial list or a list with an element
<TT>E</TT> which is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Mode</TT> is neither a variable nor an atom</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>type_error(atom, Mode)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Options</TT> is neither a partial list nor a list</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>type_error(list, Options)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Stream</TT> is not a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>type_error(variable, Stream)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SourceSink</TT> is neither a variable nor a source/sink</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(source_sink, SourceSink)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Mode</TT> is an atom but not an input/output mode</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(io_mode, Mode)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left>an element <TT>E</TT> of the <TT>Options</TT> list is neither a
variable nor a stream-option</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream_option, E)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left>the source/sink specified by <TT>SourceSink</TT> does not exist</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>existence_error(source_sink, SourceSink)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left>the source/sink specified by <TT>SourceSink</TT> cannot be opened</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>permission_error(open, source_sink, SourceSink)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left>an element <TT>E</TT> of the <TT>Options</TT> list is
<TT>alias(A)</TT> and <TT>A</TT> is already associated with an open stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>permission_error(open, source_sink, alias(A))</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left>an element <TT>E</TT> of the <TT>Options</TT> list is
<TT>mirror(M)</TT> and <TT>M</TT> is not associated with an open stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>existence_error(stream, M)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left>an element <TT>E</TT> of the <TT>Options</TT> list is
<TT>mirror(M)</TT> and <TT>M</TT> iis an input stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>permission_error(output, stream, M)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left>an element <TT>E</TT> of the <TT>Options</TT> list is
<TT>reposition(true)</TT> and it is not possible to reposition this stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>permission_error(open, source_sink, reposition(true))</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR></TABLE><BR>
<B>Portability</B><BR>
<BR>
ISO predicates. The <TT>mirror/1</TT> and <TT>buffering/1</TT> stream options
are GNU Prolog extensions.<BR>
<BR>
<A NAME="toc80"></A>
<H4 CLASS="subsubsection"><A NAME="htoc112">7.10.7</A>&nbsp;&nbsp;<TT>close/2</TT>,
 <TT>close/1</TT></H4>
<A NAME="close/2"></A>
 
 
<B>Templates</B>
<DL CLASS="list" COMPACT="compact"><DT CLASS="dt-list"><DD CLASS="dd-list"><TT>
close(+stream_or_alias, +close_option_list)<BR>
close(+stream_or_alias)</TT></DL>
<B>Description</B><BR>
<BR>
<TT>close(SorA, Options)</TT> closes the stream associated with the stream-term
or alias <TT>SorA</TT>. If <TT>SorA</TT> is the standard input stream or the
standard output stream <TT>close/2</TT> simply succeeds else the associated
source/sink is physically closed. If <TT>SorA</TT> is the current input
stream the current input stream becomes the standard input stream
<TT>user_input</TT>. If <TT>SorA</TT> is the current output stream the
current output stream becomes the standard output stream
<TT>user_output</TT>.<BR>
<BR>
<B>Close options</B>: <TT>Options</TT> is a list of close options. For the
moment only one option is available:
<UL CLASS="itemize"><LI CLASS="li-itemize"><TT>force(true</TT>/<TT>false)</TT>: with <TT>false</TT>, if
an error occurs when trying to close the source/sink, the stream is not
closed and an error (<TT>system_error</TT> or <TT>resource_error</TT>) is
raised (but <TT>close/2</TT> succeeds). With <TT>true</TT>, if an error
occurs it is ignored and the stream is closed. The purpose of
<TT>force/1</TT> option is to allow an error handling routine to do its best
to reclaim resources. The default value is <TT>false</TT>.</UL>
<TT>close(SorA)</TT> is equivalent to <TT>close(SorA, [])</TT>.<BR>
<BR>
<B>Errors</B><BR>
<TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Options</TT> is a partial list or a list with an element
<TT>E</TT> which is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Options</TT> is neither a partial list nor a list</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>type_error(list, Options)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is neither a variable nor a stream-term or alias</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream_or_alias, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left>an element <TT>E</TT> of the <TT>Options</TT> list is neither a
variable nor a close-option</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(close_option, E)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is not associated with an open stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>existence_error(stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> needs a special close (section&nbsp;<A HREF="gprolog034.html#Constant-term-streams">7.11</A>)</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>system_error(needs_special_close)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR></TABLE><BR>
<B>Portability</B><BR>
<BR>
ISO predicates. The <TT>system_error(needs_special_close)</TT> is a
GNU Prolog extension.<BR>
<BR>
<A NAME="toc81"></A>
<H4 CLASS="subsubsection"><A NAME="htoc113">7.10.8</A>&nbsp;&nbsp;<TT>flush_output/1</TT>,
 <TT>flush_output/0</TT></H4>
<A NAME="flush-output/1"></A>
 
 
<B>Templates</B>
<DL CLASS="list" COMPACT="compact"><DT CLASS="dt-list"><DD CLASS="dd-list"><TT>
flush_output(+stream_or_alias)<BR>
flush_output</TT></DL>
<B>Description</B><BR>
<BR>
<TT>flush_output(SorA)</TT> sends any buffered output characters/bytes to
the stream.<BR>
<BR>
<TT>flush_output/0</TT> applies to the current output stream.<BR>
<BR>
<B>Errors</B><BR>
<TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is neither a variable nor a stream-term or alias</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream_or_alias, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is not associated with an open stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>existence_error(stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is an input stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>permission_error(output, stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR></TABLE><BR>
<B>Portability</B><BR>
<BR>
ISO predicates.<BR>
<BR>
<A NAME="toc82"></A>
<H4 CLASS="subsubsection"><A NAME="htoc114">7.10.9</A>&nbsp;&nbsp;<TT>current_stream/1</TT></H4>
<A NAME="current-stream/1"></A>
 
<B>Templates</B>
<DL CLASS="list" COMPACT="compact"><DT CLASS="dt-list"><DD CLASS="dd-list"><TT>
current_stream(?stream)</TT></DL>
<B>Description</B><BR>
<BR>
<TT>current_stream(Stream)</TT> succeeds if there exists
a stream-term that unifies with <TT>Stream</TT>. This predicate is
re-executable on backtracking.<BR>
<BR>
<B>Errors</B><BR>
<TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Stream</TT> is neither a variable nor a stream-term</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream, Stream)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR></TABLE><BR>
<B>Portability</B><BR>
<BR>
GNU Prolog predicate.<BR>
<BR>
<A NAME="toc83"></A>
<H4 CLASS="subsubsection"><A NAME="htoc115">7.10.10</A>&nbsp;&nbsp;<TT>stream_property/2</TT></H4>
<A NAME="stream-property/2"></A>
 
<B>Templates</B>
<DL CLASS="list" COMPACT="compact"><DT CLASS="dt-list"><DD CLASS="dd-list"><TT>
stream_property(?stream, ?stream_property)</TT></DL>
<B>Description</B><BR>
<BR>
<TT>stream_property(Stream, Property)</TT> succeeds if
<TT>current_stream(Stream)</TT> succeeds (section&nbsp;<A HREF="#current-stream/1">7.10.9</A>) and if
<TT>Property</TT> unifies with one of the properties of the stream. This
predicate is re-executable on backtracking.<BR>
<BR>
<B>Stream properties</B>:
<UL CLASS="itemize"><LI CLASS="li-itemize"><TT>file_name(F)</TT>: the name of the connected 
source/sink.<BR>
<BR>
<LI CLASS="li-itemize"><TT>mode(M)</TT>: <TT>M</TT> is the open mode (<TT>read</TT>,
<TT>write</TT>, <TT>append</TT>).<BR>
<BR>
<LI CLASS="li-itemize"><TT>input</TT>: if it is an input stream.<BR>
<BR>
<LI CLASS="li-itemize"><TT>output</TT>: if it is an output stream.<BR>
<BR>
<LI CLASS="li-itemize"><TT>alias(A)</TT>: <TT>A</TT> is an alias of the stream.<BR>
<BR>
<LI CLASS="li-itemize"><TT>mirror(M)</TT>: <TT>M</TT> is a mirror stream of the 
stream.<BR>
<BR>
<LI CLASS="li-itemize"><TT>type(T)</TT>: <TT>T</TT> is the type of the stream
(<TT>text</TT>, <TT>binary</TT>).<BR>
<BR>
<LI CLASS="li-itemize"><TT>reposition(R)</TT>: <TT>R</TT> is the reposition
boolean (<TT>true</TT>, <TT>false</TT>).<BR>
<BR>
<LI CLASS="li-itemize"><TT>eof_action(A)</TT>: <TT>A</TT> is the end-of-file
action (<TT>error</TT>, <TT>eof_code</TT>, <TT>reset</TT>).<BR>
<BR>
<LI CLASS="li-itemize"><TT>buffering(B)</TT>: <TT>B</TT> is the buffering mode
(<TT>none</TT>, <TT>line</TT>, <TT>block</TT>).<BR>
<BR>
<LI CLASS="li-itemize"><TT>end_of_stream(E)</TT>: <TT>E</TT> is the
current end-of-stream status (<TT>not</TT>, <TT>at</TT>, <TT>past</TT>). If
the stream position is end-of-stream then <TT>E</TT> is unified with
<TT>at</TT> else if the stream position is past-end-of-stream then <TT>E</TT>
is unified with <TT>past</TT> else <TT>E</TT> is unified with <TT>not</TT>.<BR>
<BR>
<LI CLASS="li-itemize"><TT>position(P)</TT>: <TT>P</TT> is the stream-position
term associated with the current position.</UL>
<B>Errors</B><BR>
<TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Stream</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Stream</TT> is neither a variable nor a stream-term</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream, Stream)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Property</TT> is neither a variable nor a stream property</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream_property, Property)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Property</TT> = <TT>file_name(E)</TT>,<TT> mode(E)</TT>,
<TT>alias(E)</TT>, <TT>end_of_stream(E)</TT>, <TT>eof_action(E)</TT>,
<TT>reposition(E)</TT>, <TT>type(E)</TT> or <TT>buffering(E)</TT> and
<TT>E</TT> is neither a variable nor an atom</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>type_error(atom, E)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR></TABLE><BR>
<B>Portability</B><BR>
<BR>
ISO predicate. The <TT>buffering/1</TT> property is a GNU Prolog extension.<BR>
<BR>
<A NAME="toc84"></A>
<H4 CLASS="subsubsection"><A NAME="htoc116">7.10.11</A>&nbsp;&nbsp;<TT>at_end_of_stream/1</TT>,
 <TT>at_end_of_stream/0</TT></H4>
 
 
<B>Templates</B>
<DL CLASS="list" COMPACT="compact"><DT CLASS="dt-list"><DD CLASS="dd-list"><TT>
at_end_of_stream(+stream_or_alias)<BR>
at_end_of_stream</TT></DL>
<B>Description</B><BR>
<BR>
<TT>at_end_of_stream(SorA)</TT> succeeds if the stream associated with
stream-term or alias <TT>SorA</TT> has a stream position end-of-stream or
past-end-of-stream. This predicate can be defined using
<TT>stream_property/2</TT> (section&nbsp;<A HREF="#stream-property/2">7.10.10</A>).<BR>
<BR>
<TT>at_end_of_stream/0</TT> applies to the current input stream.<BR>
<BR>
<B>Errors</B><BR>
<TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is neither a variable nor a stream-term or alias</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream_or_alias, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is not associated with an open stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>existence_error(stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is an output stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>permission_error(input, stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR></TABLE><BR>
<B>Portability</B><BR>
<BR>
ISO predicates. The <TT>permission_error(input, stream, SorA)</TT> is a
GNU Prolog extension.<BR>
<BR>
<A NAME="toc85"></A>
<H4 CLASS="subsubsection"><A NAME="htoc117">7.10.12</A>&nbsp;&nbsp;<TT>stream_position/2</TT></H4>
<A NAME="stream-position/2"></A>
 
<B>Templates</B>
<DL CLASS="list" COMPACT="compact"><DT CLASS="dt-list"><DD CLASS="dd-list"><TT>
stream_position(+stream_or_alias, ?stream_position)</TT></DL>
<B>Description</B><BR>
<BR>
<TT>stream_position(SorA, Position)</TT> succeeds unifying
<TT>Position</TT> with the stream-position term associated with the current
position of the stream-term or alias <TT>SorA</TT>. This predicate can be
defined using <TT>stream_property/2</TT> (section&nbsp;<A HREF="#stream-property/2">7.10.10</A>).<BR>
<BR>
<B>Errors</B><BR>
<TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is neither a variable nor a stream-term or alias</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream_or_alias, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Position</TT> is neither a variable nor a stream-position term</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream_position, Position)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is not associated with an open stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>existence_error(stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR></TABLE><BR>
<B>Portability</B><BR>
<BR>
GNU Prolog predicate.<BR>
<BR>
<A NAME="toc86"></A>
<H4 CLASS="subsubsection"><A NAME="htoc118">7.10.13</A>&nbsp;&nbsp;<TT>set_stream_position/2</TT></H4>
<A NAME="set-stream-position/2"></A>
 
<B>Templates</B>
<DL CLASS="list" COMPACT="compact"><DT CLASS="dt-list"><DD CLASS="dd-list"><TT>
set_stream_position(+stream_or_alias, +stream_position)</TT></DL>
<B>Description</B><BR>
<BR>
<TT>set_stream_position(SorA, Position)</TT> sets the position of
the stream associated with the stream-term or alias <TT>SorA</TT> to
<TT>Position</TT>. <TT>Position</TT> should have previously been returned by
<TT>stream_property/2</TT> (section&nbsp;<A HREF="#stream-property/2">7.10.10</A>) or by
<TT>stream_position/2</TT> (section&nbsp;<A HREF="#stream-position/2">7.10.12</A>).<BR>
<BR>
<B>Errors</B><BR>
<TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Position</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is neither a variable nor a stream-term or alias</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream_or_alias, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Position</TT> is neither a variable nor a stream-position term</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream_position, Position)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is not associated with an open stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>existence_error(stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> has stream property <TT>reposition(false)</TT></TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>permission_error(reposition, stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR></TABLE><BR>
<B>Portability</B><BR>
<BR>
ISO predicate.<BR>
<BR>
<A NAME="toc87"></A>
<H4 CLASS="subsubsection"><A NAME="htoc119">7.10.14</A>&nbsp;&nbsp;<TT>seek/4</TT></H4>
 
<B>Templates</B>
<DL CLASS="list" COMPACT="compact"><DT CLASS="dt-list"><DD CLASS="dd-list"><TT>
seek(+stream_or_alias, +stream_seek_method, +integer, ?integer)</TT></DL>
<B>Description</B><BR>
<BR>
<TT>seek(SorA, Whence, Offset, NewOffset)</TT> sets the position of
the stream associated with the stream-term or alias <TT>SorA</TT> to
<TT>Offset</TT> according to <TT>Whence</TT> and unifies <TT>NewOffset</TT>
with the new offset from the beginning of the file. <TT>seek/4</TT> can only
be used on binary streams. <TT>Whence</TT> is an atom from:
<UL CLASS="itemize"><LI CLASS="li-itemize"><TT>bof</TT>: the position is set relatively to the begin of the file
(<TT>Offset</TT> should be &#8805; 0).<BR>
<BR>
<LI CLASS="li-itemize"><TT>current</TT>: the position is set relatively to the current
position (<TT>Offset</TT> can be &#8805; 0 or &#8804; 0).<BR>
<BR>
<LI CLASS="li-itemize"><TT>eof</TT>: the position is set relatively to the end of the file
(<TT>Offset</TT> should be &#8804; 0).</UL>
This predicate is an interface to the C Unix function <TT>lseek(2)</TT>.<BR>
<BR>
<B>Errors</B><BR>
<TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Whence</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Offset</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is neither a variable nor a stream-term or alias</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream_or_alias, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Whence</TT> is neither a variable nor an atom</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>type_error(atom, Whence)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Whence</TT> is an atom but not a valid stream seek method</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream_seek_method, Whence)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Offset</TT> is neither a variable nor an integer</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>type_error(integer, Offset)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>NewOffset</TT> is neither a variable nor an integer</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>type_error(integer, NewOffset)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is not associated with an open stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>existence_error(stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> has stream property <TT>reposition(false)</TT></TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>permission_error(reposition, stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is associated with a text stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>permission_error(reposition, text_stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR></TABLE><BR>
<B>Portability</B><BR>
<BR>
GNU Prolog predicate.<BR>
<BR>
<A NAME="toc88"></A>
<H4 CLASS="subsubsection"><A NAME="htoc120">7.10.15</A>&nbsp;&nbsp;<TT>character_count/2</TT></H4>
 
<B>Templates</B>
<DL CLASS="list" COMPACT="compact"><DT CLASS="dt-list"><DD CLASS="dd-list"><TT>
character_count(+stream_or_alias, ?integer)</TT></DL>
<B>Description</B><BR>
<BR>
<TT>character_count(SorA, Count)</TT> unifies <TT>Count</TT> with the
number of characters/bytes read/written on the stream associated with
stream-term or alias <TT>SorA</TT>.<BR>
<BR>
<B>Errors</B><BR>
<TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Count</TT> is neither a variable nor an integer</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>type_error(integer, Count)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is neither a variable nor a stream-term or alias</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream_or_alias, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is not associated with an open stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>existence_error(stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR></TABLE><BR>
<B>Portability</B><BR>
<BR>
GNU Prolog predicate.<BR>
<BR>
<A NAME="toc89"></A>
<H4 CLASS="subsubsection"><A NAME="htoc121">7.10.16</A>&nbsp;&nbsp;<TT>line_count/2</TT></H4>
<A NAME="line-count/2"></A>
 
<B>Templates</B>
<DL CLASS="list" COMPACT="compact"><DT CLASS="dt-list"><DD CLASS="dd-list"><TT>
line_count(+stream_or_alias, ?integer)</TT></DL>
<B>Description</B><BR>
<BR>
<TT>line_count(SorA, Count)</TT> unifies <TT>Count</TT> with the number of
lines read/written on the stream associated with the stream-term or alias
<TT>SorA</TT>. This predicate can only be used on text streams.<BR>
<BR>
<B>Errors</B><BR>
<TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Count</TT> is neither a variable nor an integer</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>type_error(integer, Count)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is neither a variable nor a stream-term or alias</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream_or_alias, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is not associated with an open stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>existence_error(stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is associated with a binary stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>permission_error(access, binary_stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR></TABLE><BR>
<B>Portability</B><BR>
<BR>
GNU Prolog predicate.<BR>
<BR>
<A NAME="toc90"></A>
<H4 CLASS="subsubsection"><A NAME="htoc122">7.10.17</A>&nbsp;&nbsp;<TT>line_position/2</TT></H4>
<A NAME="line-position/2"></A>
 
<B>Templates</B>
<DL CLASS="list" COMPACT="compact"><DT CLASS="dt-list"><DD CLASS="dd-list"><TT>
line_position(+stream_or_alias, ?integer)</TT></DL>
<B>Description</B><BR>
<BR>
<TT>line_position(SorA, Count)</TT> unifies
<TT>Count</TT> with the number of characters read/written on the current
line of the stream associated with the stream-term or alias
<TT>SorA</TT>. This predicate can only be used on text streams.<BR>
<BR>
<B>Errors</B><BR>
<TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Count</TT> is neither a variable nor an integer</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>type_error(integer, Count)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is neither a variable nor a stream-term or alias</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream_or_alias, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is not associated with an open stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>existence_error(stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is associated with a binary stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>permission_error(access, binary_stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR></TABLE><BR>
<B>Portability</B><BR>
<BR>
GNU Prolog predicate.<BR>
<BR>
<A NAME="toc91"></A>
<H4 CLASS="subsubsection"><A NAME="htoc123">7.10.18</A>&nbsp;&nbsp;<TT>stream_line_column/3</TT></H4>
 
<B>Templates</B>
<DL CLASS="list" COMPACT="compact"><DT CLASS="dt-list"><DD CLASS="dd-list"><TT>
stream_line_column(+stream_or_alias, ?integer, ?integer)</TT></DL>
<B>Description</B><BR>
<BR>
<TT>stream_line_column(SorA, Line, Column)</TT> unifies <TT>Line</TT>
(resp. <TT>Column</TT>) with the current line number (resp. column number)
of the stream associated with the stream-term or alias <TT>SorA</TT>. This
predicate can only be used on text streams. Note that <TT>Line</TT>
corresponds to the value returned by <TT>line_count/2</TT> + 1
(section&nbsp;<A HREF="#line-count/2">7.10.16</A>) and <TT>Column</TT> to the value returned
by <TT>line_position/2</TT> + 1 (section&nbsp;<A HREF="#line-position/2">7.10.17</A>).<BR>
<BR>
<B>Errors</B><BR>
<TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Line</TT> is neither a variable nor an integer</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>type_error(integer, Line)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Column</TT> is neither a variable nor an integer</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>type_error(integer, Column)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is neither a variable nor a stream-term or alias</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream_or_alias, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is not associated with an open stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>existence_error(stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is associated with a binary stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>permission_error(access, binary_stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR></TABLE><BR>
<B>Portability</B><BR>
<BR>
GNU Prolog predicate.<BR>
<BR>
<A NAME="toc92"></A>
<H4 CLASS="subsubsection"><A NAME="htoc124">7.10.19</A>&nbsp;&nbsp;<TT>set_stream_line_column/3</TT></H4>
 
<B>Templates</B>
<DL CLASS="list" COMPACT="compact"><DT CLASS="dt-list"><DD CLASS="dd-list"><TT>
set_stream_line_column(+stream_or_alias, +integer, +integer)</TT></DL>
<B>Description</B><BR>
<BR>
<TT>set_stream_line_column(SorA, Line, Column)</TT> sets the stream
position of the stream associated with the stream-term or alias <TT>SorA</TT>
according to the line number <TT>Line</TT> and the column number
<TT>Column</TT>. This predicate can only be used on text streams. It first
repositions the stream to the beginning of the file and then reads character
by character until the required position is reached.<BR>
<BR>
<B>Errors</B><BR>
<TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Line</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Column</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Line</TT> is neither a variable nor an integer</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>type_error(integer, Line)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Column</TT> is neither a variable nor an integer</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>type_error(integer, Column)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is neither a variable nor a stream-term or alias</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream_or_alias, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is not associated with an open stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>existence_error(stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is associated with a binary stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>permission_error(reposition, binary_stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> has stream property <TT>reposition(false)</TT></TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>permission_error(reposition, stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR></TABLE><BR>
<B>Portability</B><BR>
<BR>
GNU Prolog predicate.<BR>
<BR>
<A NAME="toc93"></A>
<H4 CLASS="subsubsection"><A NAME="htoc125">7.10.20</A>&nbsp;&nbsp;<TT>add_stream_alias/2</TT></H4>
<A NAME="add-stream-alias/2"></A>
 
<B>Templates</B>
<DL CLASS="list" COMPACT="compact"><DT CLASS="dt-list"><DD CLASS="dd-list"><TT>
add_stream_alias(+stream_or_alias, +atom)</TT></DL>
<B>Description</B><BR>
<BR>
<TT>add_stream_alias(SorA, Alias)</TT> adds <TT>Alias</TT> as a new alias
to the stream associated with the stream-term or alias <TT>SorA</TT>.<BR>
<BR>
<B>Errors</B><BR>
<TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Alias</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Alias</TT> is neither a variable nor an atom</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>type_error(atom, Alias)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is neither a variable nor a stream-term or alias</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream_or_alias, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is not associated with an open stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>existence_error(stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Alias</TT> is already associated with an open stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>permission_error(add_alias, source_sink, alias(Alias))</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR></TABLE><BR>
<B>Portability</B><BR>
<BR>
GNU Prolog predicate.<BR>
<BR>
<A NAME="toc94"></A>
<H4 CLASS="subsubsection"><A NAME="htoc126">7.10.21</A>&nbsp;&nbsp;<TT>current_alias/2</TT></H4>
 
<B>Templates</B>
<DL CLASS="list" COMPACT="compact"><DT CLASS="dt-list"><DD CLASS="dd-list"><TT>
current_alias(?stream, ?atom)</TT></DL>
<B>Description</B><BR>
<BR>
<TT>current_alias(Stream, Alias)</TT> succeeds if
<TT>current_stream(Stream)</TT> succeeds (section&nbsp;<A HREF="#current-stream/1">7.10.9</A>) and if
<TT>Alias</TT> unifies with one of the aliases of the stream. It can be
defined using <TT>stream_property/2</TT> (section&nbsp;<A HREF="#stream-property/2">7.10.10</A>). This
predicate is re-executable on backtracking.<BR>
<BR>
<B>Errors</B><BR>
<TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Stream</TT> is neither a variable nor a stream-term</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream, Stream)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Alias</TT> is neither a variable nor an atom</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>type_error(atom, Alias)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR></TABLE><BR>
<B>Portability</B><BR>
<BR>
GNU Prolog predicate.<BR>
<BR>
<A NAME="toc95"></A>
<H4 CLASS="subsubsection"><A NAME="htoc127">7.10.22</A>&nbsp;&nbsp;<TT>add_stream_mirror/2</TT></H4>
<A NAME="add-stream-mirror/2"></A>
 
<B>Templates</B>
<DL CLASS="list" COMPACT="compact"><DT CLASS="dt-list"><DD CLASS="dd-list"><TT>
add_stream_mirror(+stream_or_alias, +stream_or_alias)</TT></DL>
<B>Description</B><BR>
<BR>
<TT>add_stream_mirror(SorA, Mirror)</TT> adds the stream associated with
the stream-term or alias <TT>Mirror</TT> as a new mirror to the stream
associated with the stream-term or alias <TT>SorA</TT>. After this, all
characters (or bytes) read from (or written to) <TT>SorA</TT> are also
written to <TT>Mirror</TT>. This mirroring occurs until <TT>Mirror</TT> is
explicitely removed using <TT>remove_stream_mirror/2</TT>
(section&nbsp;<A HREF="#remove-stream-mirror/2">7.10.23</A>) or implicitely when <TT>Mirror</TT> is closed.
Several mirror streams can be associated with a same stream. If <TT>Mirror</TT>
represents the same stream as <TT>SorA</TT> or if <TT>Mirror</TT> is already
a mirror for <TT>SorA</TT>, no mirror is added.<BR>
<BR>
<B>Errors</B><BR>
<TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Mirror</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is neither a variable nor a stream-term or alias</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream_or_alias, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Mirror</TT> is neither a variable nor a stream-term or alias</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream_or_alias, Mirror)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is not associated with an open stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>existence_error(stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Mirror</TT> is not associated with an open stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>existence_error(stream, Mirror)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Mirror</TT> is an input stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>permission_error(output, stream, Mirror)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR></TABLE><BR>
<B>Portability</B><BR>
<BR>
GNU Prolog predicate.<BR>
<BR>
<A NAME="toc96"></A>
<H4 CLASS="subsubsection"><A NAME="htoc128">7.10.23</A>&nbsp;&nbsp;<TT>remove_stream_mirror/2</TT></H4>
<A NAME="remove-stream-mirror/2"></A>
 
<B>Templates</B>
<DL CLASS="list" COMPACT="compact"><DT CLASS="dt-list"><DD CLASS="dd-list"><TT>
remove_stream_mirror(+stream_or_alias, +stream_or_alias)</TT></DL>
<B>Description</B><BR>
<BR>
<TT>remove_stream_mirror(SorA, Mirror)</TT> removes the stream associated
with the stream-term or alias <TT>Mirror</TT> from the list of mirrors of the
stream associated with the stream-term or alias <TT>SorA</TT>. This predicate
fails if <TT>Mirror</TT> is not a mirror stream for <TT>SorA</TT>.<BR>
<BR>
<B>Errors</B><BR>
<TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Mirror</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is neither a variable nor a stream-term or alias</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream_or_alias, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Mirror</TT> is neither a variable nor a stream-term or alias</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream_or_alias, Mirror)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is not associated with an open stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>existence_error(stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Mirror</TT> is not associated with an open stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>existence_error(stream, Mirror)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR></TABLE><BR>
<B>Portability</B><BR>
<BR>
GNU Prolog predicate.<BR>
<BR>
<A NAME="toc97"></A>
<H4 CLASS="subsubsection"><A NAME="htoc129">7.10.24</A>&nbsp;&nbsp;<TT>current_mirror/2</TT></H4>
 
<B>Templates</B>
<DL CLASS="list" COMPACT="compact"><DT CLASS="dt-list"><DD CLASS="dd-list"><TT>
current_mirror(?stream, ?stream)</TT></DL>
<B>Description</B><BR>
<BR>
<TT>current_mirror(Stream, M)</TT> succeeds if
<TT>current_stream(Stream)</TT> succeeds (section&nbsp;<A HREF="#current-stream/1">7.10.9</A>) and if
<TT>M</TT> unifies with one of the mirrors of the stream. It can be
defined using <TT>stream_property/2</TT> (section&nbsp;<A HREF="#stream-property/2">7.10.10</A>). This
predicate is re-executable on backtracking.<BR>
<BR>
<B>Errors</B><BR>
<TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Stream</TT> is neither a variable nor a stream-term</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream, Stream)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>M</TT> is neither a variable nor a stream-term</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream, M)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR></TABLE><BR>
<B>Portability</B><BR>
<BR>
GNU Prolog predicate.<BR>
<BR>
<A NAME="toc98"></A>
<H4 CLASS="subsubsection"><A NAME="htoc130">7.10.25</A>&nbsp;&nbsp;<TT>set_stream_type/2</TT></H4>
<A NAME="set-stream-type/2"></A>
 
<B>Templates</B>
<DL CLASS="list" COMPACT="compact"><DT CLASS="dt-list"><DD CLASS="dd-list"><TT>
set_stream_type(+stream_or_alias, +atom)</TT></DL>
<B>Description</B><BR>
<BR>
<TT>set_stream_type(SorA, Type)</TT> updates the type associated with
stream-term or alias <TT>SorA</TT>. The value of <TT>Type</TT> is an atom in
<TT>text</TT> or <TT>binary</TT> as for <TT>open/4</TT> (section&nbsp;<A HREF="#open/4">7.10.6</A>).
The type of a stream can only be changed before any input/output operation
is executed.<BR>
<BR>
<B>Errors</B><BR>
<TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Type</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Type</TT> is neither a variable nor a valid type</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream_type, Type)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is neither a variable nor a stream-term or alias</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream_or_alias, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is not associated with an open stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>existence_error(stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left>An I/O operation has already been executed on <TT>SorA</TT></TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>permission_error(modify, stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR></TABLE><BR>
<B>Portability</B><BR>
<BR>
GNU Prolog predicate.<BR>
<BR>
<A NAME="toc99"></A>
<H4 CLASS="subsubsection"><A NAME="htoc131">7.10.26</A>&nbsp;&nbsp;<TT>set_stream_eof_action/2</TT></H4>
 
<B>Templates</B>
<DL CLASS="list" COMPACT="compact"><DT CLASS="dt-list"><DD CLASS="dd-list"><TT>
set_stream_eof_action(+stream_or_alias, +atom)</TT></DL>
<B>Description</B><BR>
<BR>
<TT>set_stream_eof_action(SorA, Action)</TT>
updates the <TT>eof_action</TT> option associated with the stream-term or
alias <TT>SorA</TT>. The value of <TT>Action</TT> is one of the atoms
<TT>error</TT>, <TT>eof_code</TT>, <TT>reset</TT> as for <TT>open/4</TT> (section&nbsp;<A HREF="#open/4">7.10.6</A>).<BR>
<BR>
<B>Errors</B><BR>
<TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Action</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Action</TT> is neither a variable nor a valid eof action</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(eof_action, Action)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is neither a variable nor a stream-term or alias</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream_or_alias, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is not associated with an open stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>existence_error(stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is an output stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>permission_error(modify, stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR></TABLE><BR>
<B>Portability</B><BR>
<BR>
GNU Prolog predicate.<BR>
<BR>
<A NAME="toc100"></A>
<H4 CLASS="subsubsection"><A NAME="htoc132">7.10.27</A>&nbsp;&nbsp;<TT>set_stream_buffering/2</TT></H4>
<A NAME="set-stream-buffering/2"></A>
 
<B>Templates</B>
<DL CLASS="list" COMPACT="compact"><DT CLASS="dt-list"><DD CLASS="dd-list"><TT>
set_stream_buffering(+stream_or_alias, +atom)</TT></DL>
<B>Description</B><BR>
<BR>
<TT>set_stream_buffering(SorA, Buffering)</TT>
updates the buffering mode associated with the stream-term or alias
<TT>SorA</TT>. The value of <TT>Buffering</TT> is one of the atoms
<TT>none</TT>, <TT>line</TT> or <TT>block</TT> as for <TT>open/4</TT>
(section&nbsp;<A HREF="#open/4">7.10.6</A>). This predicate may only be used after opening a stream
and before any other operations have been performed on it.<BR>
<BR>
<B>Errors</B><BR>
<TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Buffering</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Buffering</TT> is neither a variable nor a valid buffering
mode</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(buffering_mode, Buffering)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is neither a variable nor a stream-term or alias</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>domain_error(stream_or_alias, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>SorA</TT> is not associated with an open stream</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>existence_error(stream, SorA)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR></TABLE><BR>
<B>Portability</B><BR>
<BR>
GNU Prolog predicate.<BR>
<BR>

<HR SIZE=2>
Copyright (C) 1999-2007 Daniel Diaz
<BR>
<BR>
Verbatim copying and distribution of this entire article is permitted in any
medium, provided this notice is preserved. <BR>
<BR>
<A HREF="index.html#copyright">More about the copyright</A>
<HR>
<A HREF="gprolog032.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="gprolog023.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="gprolog034.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>