summaryrefslogtreecommitdiffstats
path: root/slib_2.html
blob: ef8c0590d69058f5ee33b27fecc47531760715b0 (plain)
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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                      "http://www.w3.org/TR/html40/loose.dtd">
<HTML>
<!-- Created on January, 10 2005 by texi2html 1.66 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
            Karl Berry  <karl@freefriends.org>
            Olaf Bachmann <obachman@mathematik.uni-kl.de>
            and many others.
Maintained by: Many creative people <dev@texi2html.cvshome.org>
Send bugs and suggestions to <users@texi2html.cvshome.org>

-->
<HEAD>
<TITLE>SLIB: Universal SLIB Procedures</TITLE>

<META NAME="description" CONTENT="SLIB: Universal SLIB Procedures">
<META NAME="keywords" CONTENT="SLIB: Universal SLIB Procedures">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META NAME="Generator" CONTENT="texi2html 1.66">

</HEAD>

<BODY LANG="en" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">

<A NAME="SEC13"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_1.html#SEC12"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC14"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_1.html#SEC1"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_3.html#SEC21"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1> 2. Universal SLIB Procedures </H1>
<!--docid::SEC13::-->
<P>

The procedures described in these sections are supported by all
implementations as part of the `<SAMP>*.init</SAMP>' files or by
`<TT>require.scm</TT>'.
</P>
<P>

<TABLE BORDER="0" CELLSPACING="0">
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="slib_2.html#SEC14">2.1 Vicinity</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Pathname Management</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="slib_2.html#SEC15">2.2 Configuration</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Characteristics of Scheme Implementation</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="slib_2.html#SEC16">2.3 Input/Output</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Things not provided by the Scheme specs.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="slib_2.html#SEC17">2.4 System</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">LOADing, EVALing, ERRORing, and EXITing</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="slib_2.html#SEC18">2.5 Miscellany</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
</TABLE>
<P>

<A NAME="Vicinity"></A>
<HR SIZE="6">
<A NAME="SEC14"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC15"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_3.html#SEC21"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 2.1 Vicinity </H2>
<!--docid::SEC14::-->
<P>

A vicinity is a descriptor for a place in the file system.  Vicinities
hide from the programmer the concepts of host, volume, directory, and
version.  Vicinities express only the concept of a file environment
where a file name can be resolved to a file in a system independent
manner.  Vicinities can even be used on <EM>flat</EM> file systems (which
have no directory structure) by having the vicinity express constraints
on the file name.  On most systems a vicinity would be a string.  All of
these procedures are file system dependent.
</P>
<P>

These procedures are provided by all implementations.
</P>
<P>

<A NAME="IDX56"></A>
</P>
<DL>
<DT><U>Function:</U> <B>make-vicinity</B> <I>dirpath</I>
<DD>Returns <VAR>dirpath</VAR> as a vicinity for use as first argument to
<CODE>in-vicinity</CODE>.
</DL>
<P>

<A NAME="IDX57"></A>
</P>
<DL>
<DT><U>Function:</U> <B>pathname-&gt;vicinity</B> <I>path</I>
<DD>Returns the vicinity containing <VAR>path</VAR>.
<TABLE><tr><td>&nbsp;</td><td class=example><pre>(pathname-&gt;vicinity &quot;/usr/local/lib/scm/Link.scm&quot;)
                    => &quot;/usr/local/lib/scm/&quot;
</pre></td></tr></table></DL>
<P>

<A NAME="IDX58"></A>
</P>
<DL>
<DT><U>Function:</U> <B>program-vicinity</B>
<DD>Returns the vicinity of the currently loading Scheme code.  For an
interpreter this would be the directory containing source code.  For a
compiled system (with multiple files) this would be the directory where
the object or executable files are.  If no file is currently loading it
the result is undefined.  <STRONG>Warning:</STRONG> <CODE>program-vicinity</CODE> can
return incorrect values if your program escapes back into a
<CODE>load</CODE>.
</DL>
<P>

<A NAME="IDX59"></A>
</P>
<DL>
<DT><U>Function:</U> <B>library-vicinity</B>
<DD>Returns the vicinity of the shared Scheme library.
</DL>
<P>

<A NAME="IDX60"></A>
</P>
<DL>
<DT><U>Function:</U> <B>implementation-vicinity</B>
<DD>Returns the vicinity of the underlying Scheme implementation.  This
vicinity will likely contain startup code and messages and a compiler.
</DL>
<P>

<A NAME="IDX61"></A>
</P>
<DL>
<DT><U>Function:</U> <B>user-vicinity</B>
<DD>Returns the vicinity of the current directory of the user.  On most
systems this is `<TT>&quot;&quot;</TT>' (the empty string).
</DL>
<P>

<A NAME="IDX62"></A>
</P>
<DL>
<DT><U>Function:</U> <B>home-vicinity</B>
<DD>Returns the vicinity of the user's <EM>HOME</EM> directory, the directory
<A NAME="IDX63"></A>
which typically contains files which customize a computer environment
for a user.  If scheme is running without a user (eg. a daemon) or if
this concept is meaningless for the platform, then <CODE>home-vicinity</CODE>
returns <CODE>#f</CODE>.
</DL>
<P>

<A NAME="IDX64"></A>
</P>
<DL>
<DT><U>Function:</U> <B>vicinity:suffix?</B> <I>chr</I>
<DD>Returns the `<SAMP>#t</SAMP>' if <VAR>chr</VAR> is a vicinity suffix character; and
<CODE>#f</CODE> otherwise.  Typical vicinity suffixes are `<SAMP>/</SAMP>',
`<SAMP>:</SAMP>', and `<SAMP>\</SAMP>',
</DL>
<P>

<A NAME="IDX65"></A>
</P>
<DL>
<DT><U>Function:</U> <B>in-vicinity</B> <I>vicinity filename</I>
<DD>Returns a filename suitable for use by <CODE>slib:load</CODE>,
<CODE>slib:load-source</CODE>, <CODE>slib:load-compiled</CODE>,
<CODE>open-input-file</CODE>, <CODE>open-output-file</CODE>, etc.  The returned
filename is <VAR>filename</VAR> in <VAR>vicinity</VAR>.  <CODE>in-vicinity</CODE> should
allow <VAR>filename</VAR> to override <VAR>vicinity</VAR> when <VAR>filename</VAR> is
an absolute pathname and <VAR>vicinity</VAR> is equal to the value of
<CODE>(user-vicinity)</CODE>.  The behavior of <CODE>in-vicinity</CODE> when
<VAR>filename</VAR> is absolute and <VAR>vicinity</VAR> is not equal to the value
of <CODE>(user-vicinity)</CODE> is unspecified.  For most systems
<CODE>in-vicinity</CODE> can be <CODE>string-append</CODE>.
</DL>
<P>

<A NAME="IDX66"></A>
</P>
<DL>
<DT><U>Function:</U> <B>sub-vicinity</B> <I>vicinity name</I>
<DD>Returns the vicinity of <VAR>vicinity</VAR> restricted to <VAR>name</VAR>.  This
is used for large systems where names of files in subsystems could
conflict.  On systems with directory structure <CODE>sub-vicinity</CODE> will
return a pathname of the subdirectory <VAR>name</VAR> of
<VAR>vicinity</VAR>.
</DL>
<P>

<A NAME="Configuration"></A>
<HR SIZE="6">
<A NAME="SEC15"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC14"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC16"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_3.html#SEC21"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 2.2 Configuration </H2>
<!--docid::SEC15::-->
<P>

These constants and procedures describe characteristics of the Scheme
and underlying operating system.  They are provided by all
implementations.
</P>
<P>

<A NAME="IDX67"></A>
</P>
<DL>
<DT><U>Constant:</U> <B>char-code-limit</B>
<DD>An integer 1 larger that the largest value which can be returned by
<CODE>char-&gt;integer</CODE>.
</DL>
<P>

<A NAME="IDX68"></A>
</P>
<DL>
<DT><U>Constant:</U> <B>most-positive-fixnum</B>
<DD>In implementations which support integers of practically unlimited size,
<VAR>most-positive-fixnum</VAR> is a large exact integer within the range of
exact integers that may result from computing the length of a list,
vector, or string.
<P>

In implementations which do not support integers of practically
unlimited size, <VAR>most-positive-fixnum</VAR> is the largest exact integer
that may result from computing the length of a list, vector, or string.
</P>
</DL>
<P>

<A NAME="IDX69"></A>
</P>
<DL>
<DT><U>Constant:</U> <B>slib:tab</B>
<DD>The tab character.
</DL>
<P>

<A NAME="IDX70"></A>
</P>
<DL>
<DT><U>Constant:</U> <B>slib:form-feed</B>
<DD>The form-feed character.
</DL>
<P>

<A NAME="IDX71"></A>
</P>
<DL>
<DT><U>Function:</U> <B>software-type</B>
<DD>Returns a symbol denoting the generic operating system type.  For
instance, <CODE>unix</CODE>, <CODE>vms</CODE>, <CODE>macos</CODE>, <CODE>amiga</CODE>, or
<CODE>ms-dos</CODE>.
</DL>
<P>

<A NAME="IDX72"></A>
</P>
<DL>
<DT><U>Function:</U> <B>slib:report-version</B>
<DD>Displays the versions of SLIB and the underlying Scheme implementation
and the name of the operating system.  An unspecified value is returned.
<P>

<TABLE><tr><td>&nbsp;</td><td class=example><pre>(slib:report-version) => slib &quot;3a1&quot; on scm &quot;5b1&quot; on unix
</pre></td></tr></table></DL>
<P>

<A NAME="IDX73"></A>
</P>
<DL>
<DT><U>Function:</U> <B>slib:report</B>
<DD>Displays the information of <CODE>(slib:report-version)</CODE> followed by
almost all the information neccessary for submitting a problem report.
An unspecified value is returned.
<P>

<A NAME="IDX74"></A>
<DT><U>Function:</U> <B>slib:report</B> <I>#t</I>
<DD>provides a more verbose listing.
</P>
<P>

<A NAME="IDX75"></A>
<DT><U>Function:</U> <B>slib:report</B> <I>filename</I>
<DD>Writes the report to file `<TT>filename</TT>'.
</P>
<P>

<TABLE><tr><td>&nbsp;</td><td class=example><pre>(slib:report)
=>
slib &quot;3a1&quot; on scm &quot;5b1&quot; on unix
(implementation-vicinity) is &quot;/usr/local/lib/scm/&quot;
(library-vicinity) is &quot;/usr/local/lib/slib/&quot;
(scheme-file-suffix) is &quot;.scm&quot;
loaded *features* :
        trace alist qp sort
        common-list-functions macro values getopt
        compiled
implementation *features* :
        bignum complex real rational
        inexact vicinity ed getenv
        tmpnam abort transcript with-file
        ieee-p1178 r4rs rev4-optional-procedures hash
        object-hash delay eval dynamic-wind
        multiarg-apply multiarg/and- logical defmacro
        string-port source current-time record
        rev3-procedures rev2-procedures sun-dl string-case
        array dump char-ready? full-continuation
        system
implementation *catalog* :
        (i/o-extensions compiled &quot;/usr/local/lib/scm/ioext.so&quot;)
        ...
</pre></td></tr></table></DL>
<P>

<A NAME="Input/Output"></A>
<HR SIZE="6">
<A NAME="SEC16"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC15"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC17"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_3.html#SEC21"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 2.3 Input/Output </H2>
<!--docid::SEC16::-->
<P>

These procedures are provided by all implementations.
</P>
<P>

<A NAME="IDX76"></A>
</P>
<DL>
<DT><U>Function:</U> <B>file-exists?</B> <I>filename</I>
<DD>Returns <CODE>#t</CODE> if the specified file exists.  Otherwise, returns
<CODE>#f</CODE>.  If the underlying implementation does not support this
feature then <CODE>#f</CODE> is always returned.
</DL>
<P>

<A NAME="IDX77"></A>
</P>
<DL>
<DT><U>Function:</U> <B>delete-file</B> <I>filename</I>
<DD>Deletes the file specified by <VAR>filename</VAR>.  If <VAR>filename</VAR> can not
be deleted, <CODE>#f</CODE> is returned.  Otherwise, <CODE>#t</CODE> is
returned.
</DL>
<P>

<A NAME="IDX78"></A>
</P>
<DL>
<DT><U>Function:</U> <B>open-file</B> <I>filename modes</I>
<DD><VAR>filename</VAR> should be a string naming a file.  <CODE>open-file</CODE>
returns a port depending on the symbol <VAR>modes</VAR>:
<P>

</P>
<DL COMPACT>
<DT>r
<DD>an input port capable of delivering characters from the file.
<DT>rb
<DD>a <EM>binary</EM> input port capable of delivering characters from the file.
<DT>w
<DD>an output port capable of writing characters to a new file by that name.
<DT>wb
<DD>a <EM>binary</EM> output port capable of writing characters to a new file
by that name.
</DL>
<P>

If an implementation does not distinguish between binary and non-binary
files, then it must treat rb as r and wb as w.
</P>
<P>

If the file cannot be opened, either #f is returned or an error is
signalled.  For output, if a file with the given name already exists,
the effect is unspecified.
</P>
</DL>
<P>

<A NAME="IDX79"></A>
</P>
<DL>
<DT><U>Function:</U> <B>port?</B> <I>obj</I>
<DD>Returns <TT>#t</TT> if <VAR>obj</VAR> is an input or output port, otherwise
returns <TT>#f</TT>.
</DL>
<P>

<A NAME="IDX80"></A>
</P>
<DL>
<DT><U>Procedure:</U> <B>close-port</B> <I>port</I>
<DD>Closes the file associated with <VAR>port</VAR>, rendering the <VAR>port</VAR>
incapable of delivering or accepting characters.
<P>

<CODE>close-file</CODE> has no effect if the file has already been closed.
The value returned is unspecified.
</P>
</DL>
<P>

<A NAME="IDX81"></A>
</P>
<DL>
<DT><U>Function:</U> <B>call-with-open-ports</B> <I>proc ports <small>...</small></I>
<DD><A NAME="IDX82"></A>
<DT><U>Function:</U> <B>call-with-open-ports</B> <I>ports <small>...</small> proc</I>
<DD><VAR>Proc</VAR> should be a procedure that accepts as many arguments as there
are <VAR>ports</VAR> passed to <CODE>call-with-open-ports</CODE>.
<CODE>call-with-open-ports</CODE> calls <VAR>proc</VAR> with <VAR>ports</VAR> <small>...</small>.
If <VAR>proc</VAR> returns, then the ports are closed automatically and the
value yielded by the <VAR>proc</VAR> is returned.  If <VAR>proc</VAR> does not
return, then the ports will not be closed automatically unless it is
possible to prove that the ports will never again be used for a read or
write operation.
</DL>
<P>

<A NAME="IDX83"></A>
</P>
<DL>
<DT><U>Function:</U> <B>tmpnam</B>
<DD>Returns a pathname for a file which will likely not be used by any other
process.  Successive calls to <CODE>(tmpnam)</CODE> will return different
pathnames.
</DL>
<P>

<A NAME="IDX84"></A>
</P>
<DL>
<DT><U>Function:</U> <B>current-error-port</B>
<DD>Returns the current port to which diagnostic and error output is
directed.
</DL>
<P>

<A NAME="IDX85"></A>
</P>
<DL>
<DT><U>Procedure:</U> <B>force-output</B>
<DD><A NAME="IDX86"></A>
<DT><U>Procedure:</U> <B>force-output</B> <I>port</I>
<DD>Forces any pending output on <VAR>port</VAR> to be delivered to the output
device and returns an unspecified value.  The <VAR>port</VAR> argument may be
omitted, in which case it defaults to the value returned by
<CODE>(current-output-port)</CODE>.
</DL>
<P>

<A NAME="IDX87"></A>
</P>
<DL>
<DT><U>Function:</U> <B>output-port-width</B>
<DD><A NAME="IDX88"></A>
<DT><U>Function:</U> <B>output-port-width</B> <I>port</I>
<DD><P>

Returns the width of <VAR>port</VAR>, which defaults to
<CODE>(current-output-port)</CODE> if absent.  If the width cannot be
determined 79 is returned.
</P>
</DL>
<P>

<A NAME="IDX89"></A>
</P>
<DL>
<DT><U>Function:</U> <B>output-port-height</B>
<DD><A NAME="IDX90"></A>
<DT><U>Function:</U> <B>output-port-height</B> <I>port</I>
<DD><P>

Returns the height of <VAR>port</VAR>, which defaults to
<CODE>(current-output-port)</CODE> if absent.  If the height cannot be
determined 24 is returned.
</P>
</DL>
<P>

<A NAME="System"></A>
<HR SIZE="6">
<A NAME="SEC17"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC16"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC18"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_3.html#SEC21"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 2.4 System </H2>
<!--docid::SEC17::-->
<P>

These procedures are provided by all implementations.
</P>
<P>

<A NAME="IDX91"></A>
</P>
<DL>
<DT><U>Procedure:</U> <B>slib:load-source</B> <I>name</I>
<DD>Loads a file of Scheme source code from <VAR>name</VAR> with the default
filename extension used in SLIB.  For instance if the filename extension
used in SLIB is `<TT>.scm</TT>' then <CODE>(slib:load-source &quot;foo&quot;)</CODE> will
load from file `<TT>foo.scm</TT>'.
</DL>
<P>

<A NAME="IDX92"></A>
</P>
<DL>
<DT><U>Procedure:</U> <B>slib:load-compiled</B> <I>name</I>
<DD>On implementations which support separtely loadable compiled modules,
loads a file of compiled code from <VAR>name</VAR> with the implementation's
filename extension for compiled code appended.
</DL>
<P>

<A NAME="IDX93"></A>
</P>
<DL>
<DT><U>Procedure:</U> <B>slib:load</B> <I>name</I>
<DD>Loads a file of Scheme source or compiled code from <VAR>name</VAR> with the
appropriate suffixes appended.  If both source and compiled code are
present with the appropriate names then the implementation will load
just one.  It is up to the implementation to choose which one will be
loaded.
<P>

If an implementation does not support compiled code then
<CODE>slib:load</CODE> will be identical to <CODE>slib:load-source</CODE>.
</P>
</DL>
<P>

<A NAME="IDX94"></A>
</P>
<DL>
<DT><U>Procedure:</U> <B>slib:eval</B> <I>obj</I>
<DD><CODE>eval</CODE> returns the value of <VAR>obj</VAR> evaluated in the current top
level environment.  <A HREF="slib_7.html#SEC246">7.4.11 Eval</A> provides a more general evaluation
facility.
</DL>
<P>

<A NAME="IDX95"></A>
</P>
<DL>
<DT><U>Procedure:</U> <B>slib:eval-load</B> <I>filename eval</I>
<DD><VAR>filename</VAR> should be a string.  If filename names an existing file,
the Scheme source code expressions and definitions are read from the
file and <VAR>eval</VAR> called with them sequentially.  The
<CODE>slib:eval-load</CODE> procedure does not affect the values returned by
<CODE>current-input-port</CODE> and <CODE>current-output-port</CODE>.
</DL>
<P>

<A NAME="IDX96"></A>
</P>
<DL>
<DT><U>Procedure:</U> <B>slib:warn</B> <I>arg1 arg2 <small>...</small></I>
<DD>Outputs a warning message containing the arguments.
</DL>
<P>

<A NAME="IDX97"></A>
</P>
<DL>
<DT><U>Procedure:</U> <B>slib:error</B> <I>arg1 arg2 <small>...</small></I>
<DD>Outputs an error message containing the arguments, aborts evaluation of
the current form and responds in a system dependent way to the error.
Typical responses are to abort the program or to enter a read-eval-print
loop.
</DL>
<P>

<A NAME="IDX98"></A>
</P>
<DL>
<DT><U>Procedure:</U> <B>slib:exit</B> <I>n</I>
<DD><A NAME="IDX99"></A>
<DT><U>Procedure:</U> <B>slib:exit</B>
<DD>Exits from the Scheme session returning status <VAR>n</VAR> to the system.
If <VAR>n</VAR> is omitted or <CODE>#t</CODE>, a success status is returned to the
system (if possible).  If <VAR>n</VAR> is <CODE>#f</CODE> a failure is returned to
the system (if possible).  If <VAR>n</VAR> is an integer, then <VAR>n</VAR> is
returned to the system (if possible).  If the Scheme session cannot exit
an unspecified value is returned from <CODE>slib:exit</CODE>.
</DL>
<P>

<A NAME="IDX100"></A>
</P>
<DL>
<DT><U>Function:</U> <B>browse-url</B> <I>url</I>
<DD>Web browsers have become so ubiquitous that programming languagues
should support a uniform interface to them.
<P>

If a `<SAMP>netscape</SAMP>' browser is running, <CODE>browse-url</CODE> causes the
browser to display the page specified by string <VAR>url</VAR> and returns
#t.
</P>
<P>

If the browser is not running, <CODE>browse-url</CODE> starts a browser
displaying the argument <VAR>url</VAR>.  If the browser starts as a
background job, <CODE>browse-url</CODE> returns #t immediately; if the
browser starts as a foreground job, then <CODE>browse-url</CODE> returns #t
when the browser exits; otherwise it returns #f.
</P>
</DL>
<P>

<A NAME="Miscellany"></A>
<HR SIZE="6">
<A NAME="SEC18"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC17"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC19"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_3.html#SEC21"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 2.5 Miscellany </H2>
<!--docid::SEC18::-->
<P>

These procedures are provided by all implementations.
</P>
<P>

<A NAME="IDX101"></A>
</P>
<DL>
<DT><U>Function:</U> <B>identity</B> <I>x</I>
<DD><VAR>identity</VAR> returns its argument.
<P>

Example:
<TABLE><tr><td>&nbsp;</td><td class=example><pre>(identity 3)
   => 3
(identity '(foo bar))
   => (foo bar)
(map identity <VAR>lst</VAR>)
   == (copy-list <VAR>lst</VAR>)
</pre></td></tr></table></DL>
<P>

<HR SIZE="6">
<A NAME="SEC19"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC18"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC20"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_3.html#SEC21"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 2.5.1 Mutual Exclusion </H3>
<!--docid::SEC19::-->
<P>

An <EM>exchanger</EM> is a procedure of one argument regulating mutually
<A NAME="IDX102"></A>
exclusive access to a resource.  When a exchanger is called, its current
content is returned, while being replaced by its argument in an atomic
operation.
</P>
<P>

<A NAME="IDX103"></A>
</P>
<DL>
<DT><U>Function:</U> <B>make-exchanger</B> <I>obj</I>
<DD><P>

Returns a new exchanger with the argument <VAR>obj</VAR> as its initial
content.
</P>
<P>

<TABLE><tr><td>&nbsp;</td><td class=example><pre>(define queue (make-exchanger (list a)))
</pre></td></tr></table><P>

A queue implemented as an exchanger holding a list can be protected from
reentrant execution thus:
</P>
<P>

<TABLE><tr><td>&nbsp;</td><td class=example><pre>(define (pop queue)
  (let ((lst #f))
    (dynamic-wind
        (lambda () (set! lst (queue #f)))
        (lambda () (and lst (not (null? lst))
                        (let ((ret (car lst)))
                          (set! lst (cdr lst))
                          ret)))
        (lambda () (and lst (queue lst))))))

(pop queue)         => a

(pop queue)         => #f
</pre></td></tr></table></DL>
<P>

<HR SIZE="6">
<A NAME="SEC20"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC19"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_3.html#SEC21"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_3.html#SEC21"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 2.5.2 Legacy </H3>
<!--docid::SEC20::-->
<P>

The following procedures were present in Scheme until R4RS
(see section `Language changes' in <CITE>Revised(4) Scheme</CITE>).
They are provided by all SLIB implementations.
</P>
<P>

<A NAME="IDX104"></A>
</P>
<DL>
<DT><U>Constant:</U> <B>t</B>
<DD>Derfined as <CODE>#t</CODE>.
</DL>
<P>

<A NAME="IDX105"></A>
</P>
<DL>
<DT><U>Constant:</U> <B>nil</B>
<DD>Defined as <CODE>#f</CODE>.
</DL>
<P>

<A NAME="IDX106"></A>
</P>
<DL>
<DT><U>Function:</U> <B>last-pair</B> <I>l</I>
<DD>Returns the last pair in the list <VAR>l</VAR>.  Example:
<TABLE><tr><td>&nbsp;</td><td class=example><pre>(last-pair (cons 1 2))
   => (1 . 2)
(last-pair '(1 2))
   => (2)
    == (cons 2 '())
</pre></td></tr></table></DL>
<P>

<A NAME="Scheme Syntax Extension Packages"></A>
<HR SIZE="6">
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_3.html#SEC21"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<BR>
<FONT SIZE="-1">
This document was generated
by <I>Steve Langasek</I> on <I>January, 10 2005</I>
using <A HREF="http://texi2html.cvshome.org"><I>texi2html</I></A>
</FONT>

</BODY>
</HTML>