* Fix typos.
[bpt/guile.git] / doc / maint / guile.texi
CommitLineData
780ee65e
NJ
1@paragraphindent 0
2
3\facons
4@c snarfed from alist.c:60
5@deffn primitive acons key value alist
6Adds a new key-value pair to @var{alist}. A new pair is
7created whose car is @var{key} and whose cdr is @var{value}, and the
8pair is consed onto @var{alist}, and the new list is returned. This
9function is @emph{not} destructive; @var{alist} is not modified.
10@end deffn
11
12\fsloppy-assq
13@c snarfed from alist.c:83
14@deffn primitive sloppy-assq key alist
15Behaves like @code{assq} but does not do any error checking.
16Recommended only for use in Guile internals.
17@end deffn
18
19\fsloppy-assv
20@c snarfed from alist.c:101
21@deffn primitive sloppy-assv key alist
22Behaves like @code{assv} but does not do any error checking.
23Recommended only for use in Guile internals.
24@end deffn
25
26\fsloppy-assoc
27@c snarfed from alist.c:119
28@deffn primitive sloppy-assoc key alist
29Behaves like @code{assoc} but does not do any error checking.
30Recommended only for use in Guile internals.
31@end deffn
32
33\fassq
34@c snarfed from alist.c:146
35@deffn primitive assq key alist
36@deffnx primitive assv key alist
37@deffnx primitive assoc key alist
38Fetches the entry in @var{alist} that is associated with @var{key}. To
39decide whether the argument @var{key} matches a particular entry in
40@var{alist}, @code{assq} compares keys with @code{eq?}, @code{assv}
41uses @code{eqv?} and @code{assoc} uses @code{equal?}. If @var{key}
42cannot be found in @var{alist} (according to whichever equality
43predicate is in use), then @code{#f} is returned. These functions
44return the entire alist entry found (i.e. both the key and the value).
45@end deffn
46
47\fassv
48@c snarfed from alist.c:167
49@deffn primitive assv key alist
50Behaves like @code{assq} but uses @code{eqv?} for key comparison.
51@end deffn
52
53\fassoc
54@c snarfed from alist.c:188
55@deffn primitive assoc key alist
56Behaves like @code{assq} but uses @code{equal?} for key comparison.
57@end deffn
58
59\fassq-ref
60@c snarfed from alist.c:232
61@deffn primitive assq-ref alist key
62@deffnx primitive assv-ref alist key
63@deffnx primitive assoc-ref alist key
64Like @code{assq}, @code{assv} and @code{assoc}, except that only the
65value associated with @var{key} in @var{alist} is returned. These
66functions are equivalent to
67
68@lisp
69(let ((ent (@var{associator} @var{key} @var{alist})))
70 (and ent (cdr ent)))
71@end lisp
72
73where @var{associator} is one of @code{assq}, @code{assv} or @code{assoc}.
74@end deffn
75
76\fassv-ref
77@c snarfed from alist.c:249
78@deffn primitive assv-ref alist key
79Behaves like @code{assq-ref} but uses @code{eqv?} for key comparison.
80@end deffn
81
82\fassoc-ref
83@c snarfed from alist.c:266
84@deffn primitive assoc-ref alist key
85Behaves like @code{assq-ref} but uses @code{equal?} for key comparison.
86@end deffn
87
88\fassq-set!
89@c snarfed from alist.c:295
90@deffn primitive assq-set! alist key val
91@deffnx primitive assv-set! alist key value
92@deffnx primitive assoc-set! alist key value
93Reassociate @var{key} in @var{alist} with @var{value}: find any existing
94@var{alist} entry for @var{key} and associate it with the new
95@var{value}. If @var{alist} does not contain an entry for @var{key},
96add a new one. Return the (possibly new) alist.
97
98These functions do not attempt to verify the structure of @var{alist},
99and so may cause unusual results if passed an object that is not an
100association list.
101@end deffn
102
103\fassv-set!
104@c snarfed from alist.c:313
105@deffn primitive assv-set! alist key val
106Behaves like @code{assq-set!} but uses @code{eqv?} for key comparison.
107@end deffn
108
109\fassoc-set!
110@c snarfed from alist.c:331
111@deffn primitive assoc-set! alist key val
112Behaves like @code{assq-set!} but uses @code{equal?} for key comparison.
113@end deffn
114
115\fassq-remove!
116@c snarfed from alist.c:355
117@deffn primitive assq-remove! alist key
118@deffnx primitive assv-remove! alist key
119@deffnx primitive assoc-remove! alist key
120Delete the first entry in @var{alist} associated with @var{key}, and return
121the resulting alist.
122@end deffn
123
124\fassv-remove!
125@c snarfed from alist.c:371
126@deffn primitive assv-remove! alist key
127Behaves like @code{assq-remove!} but uses @code{eqv?} for key comparison.
128@end deffn
129
130\fassoc-remove!
131@c snarfed from alist.c:387
132@deffn primitive assoc-remove! alist key
133Behaves like @code{assq-remove!} but uses @code{equal?} for key comparison.
134@end deffn
135
136\fmake-arbiter
137@c snarfed from arbiters.c:84
138@deffn primitive make-arbiter name
139Return an object of type arbiter and name @var{name}. Its
140state is initially unlocked. Arbiters are a way to achieve
141process synchronization.
142@end deffn
143
144\ftry-arbiter
145@c snarfed from arbiters.c:94
146@deffn primitive try-arbiter arb
147Return @code{#t} and lock the arbiter @var{arb} if the arbiter
148was unlocked. Otherwise, return @code{#f}.
149@end deffn
150
151\frelease-arbiter
152@c snarfed from arbiters.c:115
153@deffn primitive release-arbiter arb
154Return @code{#t} and unlock the arbiter @var{arb} if the
155arbiter was locked. Otherwise, return @code{#f}.
156@end deffn
157
158\fasync
159@c snarfed from async.c:290
160@deffn primitive async thunk
161Create a new async for the procedure @var{thunk}.
162@end deffn
163
164\fsystem-async
165@c snarfed from async.c:300
166@deffn primitive system-async thunk
167Create a new async for the procedure @var{thunk}. Also
168add it to the system's list of active async objects.
169@end deffn
170
171\fasync-mark
172@c snarfed from async.c:317
173@deffn primitive async-mark a
174Mark the async @var{a} for future execution.
175@end deffn
176
177\fsystem-async-mark
178@c snarfed from async.c:333
179@deffn primitive system-async-mark a
180Mark the async @var{a} for future execution.
181@end deffn
182
183\frun-asyncs
184@c snarfed from async.c:353
185@deffn primitive run-asyncs list_of_a
186Execute all thunks from the asyncs of the list @var{list_of_a}.
187@end deffn
188
189\fnoop
190@c snarfed from async.c:387
191@deffn primitive noop . args
192Do nothing. When called without arguments, return @code{#f},
193otherwise return the first argument.
194@end deffn
195
196\funmask-signals
197@c snarfed from async.c:439
198@deffn primitive unmask-signals
199Unmask signals. The returned value is not specified.
200@end deffn
201
202\fmask-signals
203@c snarfed from async.c:450
204@deffn primitive mask-signals
205Mask signals. The returned value is not specified.
206@end deffn
207
208\fdisplay-error
209@c snarfed from backtrace.c:262
210@deffn primitive display-error stack port subr message args rest
211Display an error message to the output port @var{port}.
212@var{stack} is the saved stack for the error, @var{subr} is
213the name of the procedure in which the error occured and
214@var{message} is the actual error message, which may contain
215formatting instructions. These will format the arguments in
216the list @var{args} accordingly. @var{rest} is currently
217ignored.
218@end deffn
219
220\fdisplay-application
221@c snarfed from backtrace.c:399
222@deffn primitive display-application frame [port [indent]]
223Display a procedure application @var{frame} to the output port
224@var{port}. @var{indent} specifies the indentation of the
225output.
226@end deffn
227
228\fdisplay-backtrace
229@c snarfed from backtrace.c:617
230@deffn primitive display-backtrace stack port [first [depth]]
231Display a backtrace to the output port @var{port}. @var{stack}
232is the stack to take the backtrace from, @var{first} specifies
233where in the stack to start and @var{depth} how much frames
234to display. Both @var{first} and @var{depth} can be @code{#f},
235which means that default values will be used.
236@end deffn
237
238\fbacktrace
239@c snarfed from backtrace.c:640
240@deffn primitive backtrace
241Display a backtrace of the stack saved by the last error
242to the current output port.
243@end deffn
244
245\fnot
246@c snarfed from boolean.c:56
247@deffn primitive not x
248Return @code{#t} iff @var{x} is @code{#f}, else return @code{#f}.
249@end deffn
250
251\fboolean?
252@c snarfed from boolean.c:66
253@deffn primitive boolean? obj
254Return @code{#t} iff @var{obj} is either @code{#t} or @code{#f}.
255@end deffn
256
257\fchar?
258@c snarfed from chars.c:56
259@deffn primitive char? x
260Return @code{#t} iff @var{x} is a character, else @code{#f}.
261@end deffn
262
263\fchar=?
264@c snarfed from chars.c:65
265@deffn primitive char=? x y
266Return @code{#t} iff @var{x} is the same character as @var{y}, else @code{#f}.
267@end deffn
268
269\fchar<?
270@c snarfed from chars.c:78
271@deffn primitive char<? x y
272Return @code{#t} iff @var{x} is less than @var{y} in the ASCII sequence,
273else @code{#f}.
274@end deffn
275
276\fchar<=?
277@c snarfed from chars.c:90
278@deffn primitive char<=? x y
279Return @code{#t} iff @var{x} is less than or equal to @var{y} in the
280ASCII sequence, else @code{#f}.
281@end deffn
282
283\fchar>?
284@c snarfed from chars.c:102
285@deffn primitive char>? x y
286Return @code{#t} iff @var{x} is greater than @var{y} in the ASCII
287sequence, else @code{#f}.
288@end deffn
289
290\fchar>=?
291@c snarfed from chars.c:114
292@deffn primitive char>=? x y
293Return @code{#t} iff @var{x} is greater than or equal to @var{y} in the
294ASCII sequence, else @code{#f}.
295@end deffn
296
297\fchar-ci=?
298@c snarfed from chars.c:126
299@deffn primitive char-ci=? x y
300Return @code{#t} iff @var{x} is the same character as @var{y} ignoring
301case, else @code{#f}.
302@end deffn
303
304\fchar-ci<?
305@c snarfed from chars.c:138
306@deffn primitive char-ci<? x y
307Return @code{#t} iff @var{x} is less than @var{y} in the ASCII sequence
308ignoring case, else @code{#f}.
309@end deffn
310
311\fchar-ci<=?
312@c snarfed from chars.c:150
313@deffn primitive char-ci<=? x y
314Return @code{#t} iff @var{x} is less than or equal to @var{y} in the
315ASCII sequence ignoring case, else @code{#f}.
316@end deffn
317
318\fchar-ci>?
319@c snarfed from chars.c:162
320@deffn primitive char-ci>? x y
321Return @code{#t} iff @var{x} is greater than @var{y} in the ASCII
322sequence ignoring case, else @code{#f}.
323@end deffn
324
325\fchar-ci>=?
326@c snarfed from chars.c:174
327@deffn primitive char-ci>=? x y
328Return @code{#t} iff @var{x} is greater than or equal to @var{y} in the
329ASCII sequence ignoring case, else @code{#f}.
330@end deffn
331
332\fchar-alphabetic?
333@c snarfed from chars.c:187
334@deffn primitive char-alphabetic? chr
335Return @code{#t} iff @var{chr} is alphabetic, else @code{#f}.
336Alphabetic means the same thing as the isalpha C library function.
337@end deffn
338
339\fchar-numeric?
340@c snarfed from chars.c:198
341@deffn primitive char-numeric? chr
342Return @code{#t} iff @var{chr} is numeric, else @code{#f}.
343Numeric means the same thing as the isdigit C library function.
344@end deffn
345
346\fchar-whitespace?
347@c snarfed from chars.c:209
348@deffn primitive char-whitespace? chr
349Return @code{#t} iff @var{chr} is whitespace, else @code{#f}.
350Whitespace means the same thing as the isspace C library function.
351@end deffn
352
353\fchar-upper-case?
354@c snarfed from chars.c:222
355@deffn primitive char-upper-case? chr
356Return @code{#t} iff @var{chr} is uppercase, else @code{#f}.
357Uppercase means the same thing as the isupper C library function.
358@end deffn
359
360\fchar-lower-case?
361@c snarfed from chars.c:234
362@deffn primitive char-lower-case? chr
363Return @code{#t} iff @var{chr} is lowercase, else @code{#f}.
364Lowercase means the same thing as the islower C library function.
365@end deffn
366
367\fchar-is-both?
368@c snarfed from chars.c:248
369@deffn primitive char-is-both? chr
370Return @code{#t} iff @var{chr} is either uppercase or lowercase, else @code{#f}.
371Uppercase and lowercase are as defined by the isupper and islower
372C library functions.
373@end deffn
374
375\fchar->integer
376@c snarfed from chars.c:262
377@deffn primitive char->integer chr
378Return the number corresponding to ordinal position of @var{chr} in the
379ASCII sequence.
380@end deffn
381
382\finteger->char
383@c snarfed from chars.c:274
384@deffn primitive integer->char n
385Return the character at position @var{n} in the ASCII sequence.
386@end deffn
387
388\fchar-upcase
389@c snarfed from chars.c:285
390@deffn primitive char-upcase chr
391Return the uppercase character version of @var{chr}.
392@end deffn
393
394\fchar-downcase
395@c snarfed from chars.c:296
396@deffn primitive char-downcase chr
397Return the lowercase character version of @var{chr}.
398@end deffn
399
400\fdebug-options-interface
401@c snarfed from debug.c:80
402@deffn primitive debug-options-interface [setting]
403Option interface for the debug options. Instead of using
404this procedure directly, use the procedures @code{debug-enable},
405@code{debug-disable}, @code{debug-set!} and @var{debug-options}.
406@end deffn
407
408\fwith-traps
409@c snarfed from debug.c:128
410@deffn primitive with-traps thunk
411Call @var{thunk} with traps enabled.
412@end deffn
413
414\fmemoized?
415@c snarfed from debug.c:170
416@deffn primitive memoized? obj
417Return @code{#t} if @var{obj} is memoized.
418@end deffn
419
420\funmemoize
421@c snarfed from debug.c:376
422@deffn primitive unmemoize m
423Unmemoize the memoized expression @var{m},
424@end deffn
425
426\fmemoized-environment
427@c snarfed from debug.c:386
428@deffn primitive memoized-environment m
429Return the environment of the memoized expression @var{m}.
430@end deffn
431
432\fprocedure-name
433@c snarfed from debug.c:396
434@deffn primitive procedure-name proc
435Return the name of the procedure @var{proc}
436@end deffn
437
438\fprocedure-source
439@c snarfed from debug.c:422
440@deffn primitive procedure-source proc
441Return the source of the procedure @var{proc}.
442@end deffn
443
444\fprocedure-environment
445@c snarfed from debug.c:456
446@deffn primitive procedure-environment proc
447Return the environment of the procedure @var{proc}.
448@end deffn
449
450\flocal-eval
451@c snarfed from debug.c:488
452@deffn primitive local-eval exp [env]
453Evaluate @var{exp} in its environment. If @var{env} is supplied,
454it is the environment in which to evaluate @var{exp}. Otherwise,
455@var{exp} must be a memoized code object (in which case, its environment
456is implicit).
457@end deffn
458
459\fdebug-object?
460@c snarfed from debug.c:576
461@deffn primitive debug-object? obj
462Return @code{#t} if @var{obj} is a debug object.
463@end deffn
464
465\fc-registered-modules
466@c snarfed from dynl.c:183
467@deffn primitive c-registered-modules
468Return a list of the object code modules that have been imported into
469the current Guile process. Each element of the list is a pair whose
470car is the name of the module, and whose cdr is the function handle
471for that module's initializer function. The name is the string that
472has been passed to scm_register_module_xxx.
473@end deffn
474
475\fc-clear-registered-modules
476@c snarfed from dynl.c:204
477@deffn primitive c-clear-registered-modules
478Destroy the list of modules registered with the current Guile process.
479The return value is unspecified. @strong{Warning:} this function does
480not actually unlink or deallocate these modules, but only destroys the
481records of which modules have been loaded. It should therefore be used
482only by module bookkeeping operations.
483@end deffn
484
485\fdynamic-link
486@c snarfed from dynl.c:356
487@deffn primitive dynamic-link fname
488Open the dynamic library @var{library-file}. A library handle
489representing the opened library is returned; this handle should be used
490as the @var{lib} argument to the following functions.
491@end deffn
492
493\fdynamic-object?
494@c snarfed from dynl.c:372
495@deffn primitive dynamic-object? obj
496Return @code{#t} if @var{obj} is a dynamic library handle, or @code{#f}
497otherwise.
498@end deffn
499
500\fdynamic-unlink
501@c snarfed from dynl.c:388
502@deffn primitive dynamic-unlink dobj
503Unlink the library represented by @var{library-handle},
504and remove any imported symbols from the address space.
505GJB:FIXME:DOC: 2nd version below:
506Unlink the indicated object file from the application. The
507argument @var{dynobj} must have been obtained by a call to
508@code{dynamic-link}. After @code{dynamic-unlink} has been
509called on @var{dynobj}, its content is no longer accessible.
510@end deffn
511
512\fdynamic-func
513@c snarfed from dynl.c:415
514@deffn primitive dynamic-func name dobj
515Search the dynamic object @var{dobj} for the C function
516indicated by the string @var{name} and return some Scheme
517handle that can later be used with @code{dynamic-call} to
518actually call the function.
519
520Regardless whether your C compiler prepends an underscore @samp{_} to
521the global names in a program, you should @strong{not} include this
522underscore in @var{function}. Guile knows whether the underscore is
523needed or not and will add it when necessary.
524@end deffn
525
526\fdynamic-call
527@c snarfed from dynl.c:460
528@deffn primitive dynamic-call func dobj
529Call @var{lib-thunk}, a procedure of no arguments. If @var{lib-thunk}
530is a string, it is assumed to be a symbol found in the dynamic library
531@var{lib} and is fetched with @code{dynamic-func}. Otherwise, it should
532be a function handle returned by a previous call to @code{dynamic-func}.
533The return value is unspecified.
534GJB:FIXME:DOC 2nd version below
535Call the C function indicated by @var{function} and @var{dynobj}. The
536function is passed no arguments and its return value is ignored. When
537@var{function} is something returned by @code{dynamic-func}, call that
538function and ignore @var{dynobj}. When @var{function} is a string (or
539symbol, etc.), look it up in @var{dynobj}; this is equivalent to
540
541@smallexample
542(dynamic-call (dynamic-func @var{function} @var{dynobj} #f))
543@end smallexample
544
545Interrupts are deferred while the C function is executing (with
546@code{SCM_DEFER_INTS}/@code{SCM_ALLOW_INTS}).
547@end deffn
548
549\fdynamic-args-call
550@c snarfed from dynl.c:494
551@deffn primitive dynamic-args-call func dobj args
552Call @var{proc}, a dynamically loaded function, passing it the argument
553list @var{args} (a list of strings). As with @code{dynamic-call},
554@var{proc} should be either a function handle or a string, in which case
555it is first fetched from @var{lib} with @code{dynamic-func}.
556
557@var{proc} is assumed to return an integer, which is used as the return
558value from @code{dynamic-args-call}.
559
560GJB:FIXME:DOC 2nd version below
561Call the C function indicated by @var{function} and @var{dynobj}, just
562like @code{dynamic-call}, but pass it some arguments and return its
563return value. The C function is expected to take two arguments and
564return an @code{int}, just like @code{main}:
565
566@smallexample
567int c_func (int argc, char **argv);
568@end smallexample
569
570The parameter @var{args} must be a list of strings and is converted into
571an array of @code{char *}. The array is passed in @var{argv} and its
572size in @var{argc}. The return value is converted to a Scheme number
573and returned from the call to @code{dynamic-args-call}.
574@end deffn
575
576\fdynamic-wind
577@c snarfed from dynwind.c:115
578@deffn primitive dynamic-wind thunk1 thunk2 thunk3
579All three arguments must be 0-argument procedures.
580
581@var{in-guard} is called, then @var{thunk}, then @var{out-guard}.
582
583If, any time during the execution of @var{thunk}, the continuation
584of the @code{dynamic-wind} expression is escaped non-locally, @var{out-guard}
585is called. If the continuation of the dynamic-wind is re-entered,
586@var{in-guard} is called. Thus @var{in-guard} and @var{out-guard} may
587be called any number of times.
588
589@example
590(define x 'normal-binding)
591@result{} x
592
593(define a-cont (call-with-current-continuation
594 (lambda (escape)
595 (let ((old-x x))
596 (dynamic-wind
597 ;; in-guard:
598 ;;
599 (lambda () (set! x 'special-binding))
600
601 ;; thunk
602 ;;
603 (lambda () (display x) (newline)
604 (call-with-current-continuation escape)
605 (display x) (newline)
606 x)
607
608 ;; out-guard:
609 ;;
610 (lambda () (set! x old-x)))))))
611
612;; Prints:
613special-binding
614;; Evaluates to:
615@result{} a-cont
616
617x
618@result{} normal-binding
619
620(a-cont #f)
621;; Prints:
622special-binding
623;; Evaluates to:
624@result{} a-cont ;; the value of the (define a-cont...)
625
626x
627@result{} normal-binding
628
629a-cont
630@result{} special-binding
631@end example
632@end deffn
633
634\fenvironment?
635@c snarfed from environments.c:135
636@deffn primitive environment? obj
637Return @code{#t} if @var{obj} is an environment, or @code{#f}
638otherwise.
639@end deffn
640
641\fenvironment-bound?
642@c snarfed from environments.c:146
643@deffn primitive environment-bound? env sym
644Return @code{#t} if @var{sym} is bound in @var{env}, or
645@code{#f} otherwise.
646@end deffn
647
648\fenvironment-ref
649@c snarfed from environments.c:161
650@deffn primitive environment-ref env sym
651Return the value of the location bound to @var{sym} in
652@var{env}. If @var{sym} is unbound in @var{env}, signal an
653@code{environment:unbound} error.
654@end deffn
655
656\fenvironment-fold
657@c snarfed from environments.c:231
658@deffn primitive environment-fold env proc init
659Iterate over all the bindings in @var{env}, accumulating some
660value.
661For each binding in @var{env}, apply @var{proc} to the symbol
662bound, its value, and the result from the previous application
663of @var{proc}.
664Use @var{init} as @var{proc}'s third argument the first time
665@var{proc} is applied.
666If @var{env} contains no bindings, this function simply returns
667@var{init}.
668If @var{env} binds the symbol sym1 to the value val1, sym2 to
669val2, and so on, then this procedure computes:
670@example
671 (proc sym1 val1
672 (proc sym2 val2
673 ...
674 (proc symn valn
675 init)))
676@end example
677Each binding in @var{env} will be processed exactly once.
678@code{environment-fold} makes no guarantees about the order in
679which the bindings are processed.
680Here is a function which, given an environment, constructs an
681association list representing that environment's bindings,
682using environment-fold:
683@example
684 (define (environment->alist env)
685 (environment-fold env
686 (lambda (sym val tail)
687 (cons (cons sym val) tail))
688 '()))
689@end example
690@end deffn
691
692\fenvironment-define
693@c snarfed from environments.c:266
694@deffn primitive environment-define env sym val
695Bind @var{sym} to a new location containing @var{val} in
696@var{env}. If @var{sym} is already bound to another location
697in @var{env} and the binding is mutable, that binding is
698replaced. The new binding and location are both mutable. The
699return value is unspecified.
700If @var{sym} is already bound in @var{env}, and the binding is
701immutable, signal an @code{environment:immutable-binding} error.
702@end deffn
703
704\fenvironment-undefine
705@c snarfed from environments.c:292
706@deffn primitive environment-undefine env sym
707Remove any binding for @var{sym} from @var{env}. If @var{sym}
708is unbound in @var{env}, do nothing. The return value is
709unspecified.
710If @var{sym} is already bound in @var{env}, and the binding is
711immutable, signal an @code{environment:immutable-binding} error.
712@end deffn
713
714\fenvironment-set!
715@c snarfed from environments.c:320
716@deffn primitive environment-set! env sym val
717If @var{env} binds @var{sym} to some location, change that
718location's value to @var{val}. The return value is
719unspecified.
720If @var{sym} is not bound in @var{env}, signal an
721@code{environment:unbound} error. If @var{env} binds @var{sym}
722to an immutable location, signal an
723@code{environment:immutable-location} error.
724@end deffn
725
726\fenvironment-cell
727@c snarfed from environments.c:355
728@deffn primitive environment-cell env sym for_write
729Return the value cell which @var{env} binds to @var{sym}, or
730@code{#f} if the binding does not live in a value cell.
731The argument @var{for-write} indicates whether the caller
732intends to modify the variable's value by mutating the value
733cell. If the variable is immutable, then
734@code{environment-cell} signals an
735@code{environment:immutable-location} error.
736If @var{sym} is unbound in @var{env}, signal an
737@code{environment:unbound} error.
738If you use this function, you should consider using
739@code{environment-observe}, to be notified when @var{sym} gets
740re-bound to a new value cell, or becomes undefined.
741@end deffn
742
743\fenvironment-observe
744@c snarfed from environments.c:407
745@deffn primitive environment-observe env proc
746Whenever @var{env}'s bindings change, apply @var{proc} to
747@var{env}.
748This function returns an object, token, which you can pass to
749@code{environment-unobserve} to remove @var{proc} from the set
750of procedures observing @var{env}. The type and value of
751token is unspecified.
752@end deffn
753
754\fenvironment-observe-weak
755@c snarfed from environments.c:424
756@deffn primitive environment-observe-weak env proc
757This function is the same as environment-observe, except that
758the reference @var{env} retains to @var{proc} is a weak
759reference. This means that, if there are no other live,
760non-weak references to @var{proc}, it will be
761garbage-collected, and dropped from @var{env}'s
762list of observing procedures.
763@end deffn
764
765\fenvironment-unobserve
766@c snarfed from environments.c:460
767@deffn primitive environment-unobserve token
768Cancel the observation request which returned the value
769@var{token}. The return value is unspecified.
770If a call @code{(environment-observe env proc)} returns
771@var{token}, then the call @code{(environment-unobserve token)}
772will cause @var{proc} to no longer be called when @var{env}'s
773bindings change.
774@end deffn
775
776\fmake-leaf-environment
777@c snarfed from environments.c:1040
778@deffn primitive make-leaf-environment
779Create a new leaf environment, containing no bindings.
780All bindings and locations created in the new environment
781will be mutable.
782@end deffn
783
784\fleaf-environment?
785@c snarfed from environments.c:1063
786@deffn primitive leaf-environment? object
787Return @code{#t} if object is a leaf environment, or @code{#f}
788otherwise.
789@end deffn
790
791\fmake-eval-environment
792@c snarfed from environments.c:1429
793@deffn primitive make-eval-environment local imported
794Return a new environment object eval whose bindings are the
795union of the bindings in the environments @var{local} and
796@var{imported}, with bindings from @var{local} taking
797precedence. Definitions made in eval are placed in @var{local}.
798Applying @code{environment-define} or
799@code{environment-undefine} to eval has the same effect as
800applying the procedure to @var{local}.
801Note that eval incorporates @var{local} and @var{imported} by
802reference:
803If, after creating eval, the program changes the bindings of
804@var{local} or @var{imported}, those changes will be visible
805in eval.
806Since most Scheme evaluation takes place in eval environments,
807they transparently cache the bindings received from @var{local}
808and @var{imported}. Thus, the first time the program looks up
809a symbol in eval, eval may make calls to @var{local} or
810@var{imported} to find their bindings, but subsequent
811references to that symbol will be as fast as references to
812bindings in finite environments.
813In typical use, @var{local} will be a finite environment, and
814@var{imported} will be an import environment
815@end deffn
816
817\feval-environment?
818@c snarfed from environments.c:1466
819@deffn primitive eval-environment? object
820Return @code{#t} if object is an eval environment, or @code{#f}
821otherwise.
822@end deffn
823
824\feval-environment-local
825@c snarfed from environments.c:1476
826@deffn primitive eval-environment-local env
827Return the local environment of eval environment @var{env}.
828@end deffn
829
830\feval-environment-set-local!
831@c snarfed from environments.c:1488
832@deffn primitive eval-environment-set-local! env local
833Change @var{env}'s local environment to @var{local}.
834@end deffn
835
836\feval-environment-imported
837@c snarfed from environments.c:1514
838@deffn primitive eval-environment-imported env
839Return the imported environment of eval environment @var{env}.
840@end deffn
841
842\feval-environment-set-imported!
843@c snarfed from environments.c:1526
844@deffn primitive eval-environment-set-imported! env imported
845Change @var{env}'s imported environment to @var{imported}.
846@end deffn
847
848\fmake-import-environment
849@c snarfed from environments.c:1846
850@deffn primitive make-import-environment imports conflict_proc
851Return a new environment @var{imp} whose bindings are the union
852of the bindings from the environments in @var{imports};
853@var{imports} must be a list of environments. That is,
854@var{imp} binds a symbol to a location when some element of
855@var{imports} does.
856If two different elements of @var{imports} have a binding for
857the same symbol, the @var{conflict-proc} is called with the
858following parameters: the import environment, the symbol and
859the list of the imported environments that bind the symbol.
860If the @var{conflict-proc} returns an environment @var{env},
861the conflict is considered as resolved and the binding from
862@var{env} is used. If the @var{conflict-proc} returns some
863non-environment object, the conflict is considered unresolved
864and the symbol is treated as unspecified in the import
865environment.
866The checking for conflicts may be performed lazily, i. e. at
867the moment when a value or binding for a certain symbol is
868requested instead of the moment when the environment is
869created or the bindings of the imports change.
870All bindings in @var{imp} are immutable. If you apply
871@code{environment-define} or @code{environment-undefine} to
872@var{imp}, Guile will signal an
873 @code{environment:immutable-binding} error. However,
874notice that the set of bindings in @var{imp} may still change,
875if one of its imported environments changes.
876@end deffn
877
878\fimport-environment?
879@c snarfed from environments.c:1875
880@deffn primitive import-environment? object
881Return @code{#t} if object is an import environment, or
882@code{#f} otherwise.
883@end deffn
884
885\fimport-environment-imports
886@c snarfed from environments.c:1886
887@deffn primitive import-environment-imports env
888Return the list of environments imported by the import
889environment @var{env}.
890@end deffn
891
892\fimport-environment-set-imports!
893@c snarfed from environments.c:1899
894@deffn primitive import-environment-set-imports! env imports
895Change @var{env}'s list of imported environments to
896@var{imports}, and check for conflicts.
897@end deffn
898
899\fmake-export-environment
900@c snarfed from environments.c:2164
901@deffn primitive make-export-environment private signature
902Return a new environment @var{exp} containing only those
903bindings in private whose symbols are present in
904@var{signature}. The @var{private} argument must be an
905environment.
906
907The environment @var{exp} binds symbol to location when
908@var{env} does, and symbol is exported by @var{signature}.
909
910@var{signature} is a list specifying which of the bindings in
911@var{private} should be visible in @var{exp}. Each element of
912@var{signature} should be a list of the form:
913 (symbol attribute ...)
914where each attribute is one of the following:
915@table @asis
916@item the symbol @code{mutable-location}
917 @var{exp} should treat the
918 location bound to symbol as mutable. That is, @var{exp}
919 will pass calls to @code{environment-set!} or
920 @code{environment-cell} directly through to private.
921@item the symbol @code{immutable-location}
922 @var{exp} should treat
923 the location bound to symbol as immutable. If the program
924 applies @code{environment-set!} to @var{exp} and symbol, or
925 calls @code{environment-cell} to obtain a writable value
926 cell, @code{environment-set!} will signal an
927 @code{environment:immutable-location} error. Note that, even
928 if an export environment treats a location as immutable, the
929 underlying environment may treat it as mutable, so its
930 value may change.
931@end table
932It is an error for an element of signature to specify both
933@code{mutable-location} and @code{immutable-location}. If
934neither is specified, @code{immutable-location} is assumed.
935
936As a special case, if an element of signature is a lone
937symbol @var{sym}, it is equivalent to an element of the form
938@code{(sym)}.
939
940All bindings in @var{exp} are immutable. If you apply
941@code{environment-define} or @code{environment-undefine} to
942@var{exp}, Guile will signal an
943@code{environment:immutable-binding} error. However,
944notice that the set of bindings in @var{exp} may still change,
945if the bindings in private change.
946@end deffn
947
948\fexport-environment?
949@c snarfed from environments.c:2199
950@deffn primitive export-environment? object
951Return @code{#t} if object is an export environment, or
952@code{#f} otherwise.
953@end deffn
954
955\fexport-environment-private
956@c snarfed from environments.c:2209
957@deffn primitive export-environment-private env
958Return the private environment of export environment @var{env}.
959@end deffn
960
961\fexport-environment-set-private!
962@c snarfed from environments.c:2221
963@deffn primitive export-environment-set-private! env private
964Change the private environment of export environment @var{env}.
965@end deffn
966
967\fexport-environment-signature
968@c snarfed from environments.c:2243
969@deffn primitive export-environment-signature env
970Return the signature of export environment @var{env}.
971@end deffn
972
973\fexport-environment-set-signature!
974@c snarfed from environments.c:2317
975@deffn primitive export-environment-set-signature! env signature
976Change the signature of export environment @var{env}.
977@end deffn
978
979\feq?
980@c snarfed from eq.c:64
981@deffn primitive eq? x y
982Return @code{#t} iff @var{x} references the same object as @var{y}.
983@code{eq?} is similar to @code{eqv?} except that in some cases it is
984capable of discerning distinctions finer than those detectable by
985@code{eqv?}.
986@end deffn
987
988\feqv?
989@c snarfed from eq.c:78
990@deffn primitive eqv? x y
991The @code{eqv?} procedure defines a useful equivalence relation on objects.
992Briefly, it returns @code{#t} if @var{x} and @var{y} should normally be
993regarded as the same object. This relation is left slightly open to
994interpretation, but works for comparing immediate integers, characters,
995and inexact numbers.
996@end deffn
997
998\fequal?
999@c snarfed from eq.c:127
1000@deffn primitive equal? x y
1001Return @code{#t} iff @var{x} and @var{y} are recursively @code{eqv?} equivalent.
1002@code{equal?} recursively compares the contents of pairs,
1003vectors, and strings, applying @code{eqv?} on other objects such as
1004numbers and symbols. A rule of thumb is that objects are generally
1005@code{equal?} if they print the same. @code{equal?} may fail to
1006terminate if its arguments are circular data structures.
1007@end deffn
1008
1009\fscm-error
1010@c snarfed from error.c:112
1011@deffn primitive scm-error key subr message args rest
1012Raise an error with key @var{key}. @var{subr} can be a string naming
1013the procedure associated with the error, or @code{#f}. @var{message}
1014is the error message string, possibly containing @code{~S} and @code{~A}
1015escapes. When an error is reported, these are replaced by formating the
1016corresponding members of @var{args}: @code{~A} (was @code{%s}) formats using @code{display}
1017and @code{~S} (was @code{%S}) formats using @code{write}. @var{data} is a
1018list or @code{#f} depending on @var{key}: if @var{key} is
1019@code{system-error} then it should be a list
1020containing the Unix @code{errno} value; If @var{key} is @code{signal} then
1021it should be a list containing the Unix signal number; otherwise it
1022will usually be @code{#f}.
1023@end deffn
1024
1025\fstrerror
1026@c snarfed from error.c:153
1027@deffn primitive strerror err
1028Returns the Unix error message corresponding to @var{err}, an integer.
1029@end deffn
1030
1031\fapply:nconc2last
1032@c snarfed from eval.c:3221
1033@deffn primitive apply:nconc2last lst
1034Given a list (@var{arg1} @dots{} @var{args}), this function
1035conses the @var{arg1} @dots{} arguments onto the front of
1036@var{args}, and returns the resulting list. Note that
1037@var{args} is a list; thus, the argument to this function is
1038a list whose last element is a list.
1039Note: Rather than do new consing, @code{apply:nconc2last}
1040destroys its argument, so use with care.
1041@end deffn
1042
1043\fforce
1044@c snarfed from eval.c:3754
1045@deffn primitive force x
1046If the promise @var{x} has not been computed yet, compute and
1047return @var{x}, otherwise just return the previously computed
1048value.
1049@end deffn
1050
1051\fpromise?
1052@c snarfed from eval.c:3777
1053@deffn primitive promise? obj
1054Return true if @var{obj} is a promise, i.e. a delayed computation
1055(@pxref{Delayed evaluation,,,r4rs.info,The Revised^4 Report on Scheme}).
1056@end deffn
1057
1058\fcons-source
1059@c snarfed from eval.c:3789
1060@deffn primitive cons-source xorig x y
1061Create and return a new pair whose car and cdr are @var{x} and @var{y}.
1062Any source properties associated with @var{xorig} are also associated
1063with the new pair.
1064@end deffn
1065
1066\fcopy-tree
1067@c snarfed from eval.c:3811
1068@deffn primitive copy-tree obj
1069Recursively copy the data tree that is bound to @var{obj}, and return a
1070pointer to the new data structure. @code{copy-tree} recurses down the
1071contents of both pairs and vectors (since both cons cells and vector
1072cells may point to arbitrary objects), and stops recursing when it hits
1073any other object.
1074@end deffn
1075
1076\fprimitive-eval
1077@c snarfed from eval.c:3912
1078@deffn primitive primitive-eval exp
1079Evaluate @var{exp} in the top-level environment specified by
1080the current module.
1081@end deffn
1082
1083\feval
1084@c snarfed from eval.c:3977
1085@deffn primitive eval exp module
1086Evaluate @var{exp}, a list representing a Scheme expression,
1087in the top-level environment specified by @var{module}.
1088While @var{exp} is evaluated (using @var{primitive-eval}),
1089@var{module} is made the current module. The current module
1090is reset to its previous value when @var{eval} returns.
1091@end deffn
1092
1093\feval2
1094@c snarfed from eval.c:4020
1095@deffn primitive eval2 obj env_thunk
1096Evaluate @var{exp}, a Scheme expression, in the environment
1097designated by @var{lookup}, a symbol-lookup function."
1098Do not use this version of eval, it does not play well
1099with the module system. Use @code{eval} or
1100@code{primitive-eval} instead.
1101@end deffn
1102
1103\feval-options-interface
1104@c snarfed from eval.c:1685
1105@deffn primitive eval-options-interface [setting]
1106Option interface for the evaluation options. Instead of using
1107this procedure directly, use the procedures @code{eval-enable},
1108@code{eval-disable}, @code{eval-set!} and @var{eval-options}.
1109@end deffn
1110
1111\fevaluator-traps-interface
1112@c snarfed from eval.c:1702
1113@deffn primitive evaluator-traps-interface [setting]
1114Option interface for the evaluator trap options.
1115@end deffn
1116
1117\fdefined?
1118@c snarfed from evalext.c:74
1119@deffn primitive defined? sym [env]
1120Return @code{#t} if @var{sym} is defined in the top-level environment.
1121@end deffn
1122
1123\fmap-in-order
1124@c snarfed from evalext.c:146
1125@deffn primitive map-in-order
1126scm_map
1127@end deffn
1128
1129\fprogram-arguments
1130@c snarfed from feature.c:79
1131@deffn primitive program-arguments
1132@deffnx procedure command-line
1133Return the list of command line arguments passed to Guile, as a list of
1134strings. The list includes the invoked program name, which is usually
1135@code{"guile"}, but excludes switches and parameters for command line
1136options like @code{-e} and @code{-l}.
1137@end deffn
1138
1139\fchown
1140@c snarfed from filesys.c:140
1141@deffn primitive chown object owner group
1142Change the ownership and group of the file referred to by @var{object} to
1143the integer values @var{owner} and @var{group}. @var{object} can be
1144a string containing a file name or, if the platform
1145supports fchown, a port or integer file descriptor
1146which is open on the file. The return value
1147is unspecified.
1148
1149If @var{object} is a symbolic link, either the
1150ownership of the link or the ownership of the referenced file will be
1151changed depending on the operating system (lchown is
1152unsupported at present). If @var{owner} or @var{group} is specified
1153as @code{-1}, then that ID is not changed.
1154@end deffn
1155
1156\fchmod
1157@c snarfed from filesys.c:180
1158@deffn primitive chmod object mode
1159Changes the permissions of the file referred to by @var{obj}.
1160@var{obj} can be a string containing a file name or a port or integer file
1161descriptor which is open on a file (in which case @code{fchmod} is used
1162as the underlying system call).
1163@var{mode} specifies
1164the new permissions as a decimal number, e.g., @code{(chmod "foo" #o755)}.
1165The return value is unspecified.
1166@end deffn
1167
1168\fumask
1169@c snarfed from filesys.c:214
1170@deffn primitive umask [mode]
1171If @var{mode} is omitted, retuns a decimal number representing the current
1172file creation mask. Otherwise the file creation mask is set to
1173@var{mode} and the previous value is returned.
1174
1175E.g., @code{(umask #o022)} sets the mask to octal 22, decimal 18.
1176@end deffn
1177
1178\fopen-fdes
1179@c snarfed from filesys.c:237
1180@deffn primitive open-fdes path flags [mode]
1181Similar to @code{open} but returns a file descriptor instead of a
1182port.
1183@end deffn
1184
1185\fopen
1186@c snarfed from filesys.c:280
1187@deffn primitive open path flags [mode]
1188Open the file named by @var{path} for reading and/or writing.
1189@var{flags} is an integer specifying how the file should be opened.
1190@var{mode} is an integer specifying the permission bits of the file, if
1191it needs to be created, before the umask is applied. The default is 666
1192(Unix itself has no default).
1193
1194@var{flags} can be constructed by combining variables using @code{logior}.
1195Basic flags are:
1196
1197@defvar O_RDONLY
1198Open the file read-only.
1199@end defvar
1200@defvar O_WRONLY
1201Open the file write-only.
1202@end defvar
1203@defvar O_RDWR
1204Open the file read/write.
1205@end defvar
1206@defvar O_APPEND
1207Append to the file instead of truncating.
1208@end defvar
1209@defvar O_CREAT
1210Create the file if it does not already exist.
1211@end defvar
1212
1213See the Unix documentation of the @code{open} system call
1214for additional flags.
1215@end deffn
1216
1217\fclose
1218@c snarfed from filesys.c:318
1219@deffn primitive close fd_or_port
1220Similar to close-port (@pxref{Generic Port Operations, close-port}),
1221but also works on file descriptors. A side
1222effect of closing a file descriptor is that any ports using that file
1223descriptor are moved to a different file descriptor and have
1224their revealed counts set to zero.
1225@end deffn
1226
1227\fclose-fdes
1228@c snarfed from filesys.c:346
1229@deffn primitive close-fdes fd
1230A simple wrapper for the @code{close} system call.
1231Close file descriptor @var{fd}, which must be an integer.
1232Unlike close (@pxref{Ports and File Descriptors, close}),
1233the file descriptor will be closed even if a port is using it.
1234The return value is unspecified.
1235@end deffn
1236
1237\fstat
1238@c snarfed from filesys.c:518
1239@deffn primitive stat object
1240Returns an object containing various information
1241about the file determined by @var{obj}.
1242@var{obj} can be a string containing a file name or a port or integer file
1243descriptor which is open on a file (in which case @code{fstat} is used
1244as the underlying system call).
1245
1246The object returned by @code{stat} can be passed as a single parameter
1247to the following procedures, all of which return integers:
1248
1249@table @code
1250@item stat:dev
1251The device containing the file.
1252@item stat:ino
1253The file serial number, which distinguishes this file from all other
1254files on the same device.
1255@item stat:mode
1256The mode of the file. This includes file type information
1257and the file permission bits. See @code{stat:type} and @code{stat:perms}
1258below.
1259@item stat:nlink
1260The number of hard links to the file.
1261@item stat:uid
1262The user ID of the file's owner.
1263@item stat:gid
1264The group ID of the file.
1265@item stat:rdev
1266Device ID; this entry is defined only for character or block
1267special files.
1268@item stat:size
1269The size of a regular file in bytes.
1270@item stat:atime
1271The last access time for the file.
1272@item stat:mtime
1273The last modification time for the file.
1274@item stat:ctime
1275The last modification time for the attributes of the file.
1276@item stat:blksize
1277The optimal block size for reading or writing the file, in bytes.
1278@item stat:blocks
1279The amount of disk space that the file occupies measured in units of
1280512 byte blocks.
1281@end table
1282
1283In addition, the following procedures return the information
1284from stat:mode in a more convenient form:
1285
1286@table @code
1287@item stat:type
1288A symbol representing the type of file. Possible values are
1289regular, directory, symlink, block-special, char-special,
1290fifo, socket and unknown
1291@item stat:perms
1292An integer representing the access permission bits.
1293@end table
1294@end deffn
1295
1296\flink
1297@c snarfed from filesys.c:564
1298@deffn primitive link oldpath newpath
1299Creates a new name @var{newpath} in the file system for the
1300file named by @var{oldpath}. If @var{oldpath} is a symbolic
1301link, the link may or may not be followed depending on the
1302system.
1303@end deffn
1304
1305\frename-file
1306@c snarfed from filesys.c:586
1307@deffn primitive rename-file oldname newname
1308Renames the file specified by @var{oldname} to @var{newname}.
1309The return value is unspecified.
1310@end deffn
1311
1312\fdelete-file
1313@c snarfed from filesys.c:615
1314@deffn primitive delete-file str
1315Deletes (or "unlinks") the file specified by @var{path}.
1316@end deffn
1317
1318\fmkdir
1319@c snarfed from filesys.c:634
1320@deffn primitive mkdir path [mode]
1321Create a new directory named by @var{path}. If @var{mode} is omitted
1322then the permissions of the directory file are set using the current
1323umask. Otherwise they are set to the decimal value specified with
1324@var{mode}. The return value is unspecified.
1325@end deffn
1326
1327\frmdir
1328@c snarfed from filesys.c:663
1329@deffn primitive rmdir path
1330Remove the existing directory named by @var{path}. The directory must
1331be empty for this to succeed. The return value is unspecified.
1332@end deffn
1333
1334\fdirectory-stream?
1335@c snarfed from filesys.c:689
1336@deffn primitive directory-stream? obj
1337Returns a boolean indicating whether @var{object} is a directory stream
1338as returned by @code{opendir}.
1339@end deffn
1340
1341\fopendir
1342@c snarfed from filesys.c:700
1343@deffn primitive opendir dirname
1344Open the directory specified by @var{path} and return a directory
1345stream.
1346@end deffn
1347
1348\freaddir
1349@c snarfed from filesys.c:718
1350@deffn primitive readdir port
1351Return (as a string) the next directory entry from the directory stream
1352@var{stream}. If there is no remaining entry to be read then the
1353end of file object is returned.
1354@end deffn
1355
1356\frewinddir
1357@c snarfed from filesys.c:741
1358@deffn primitive rewinddir port
1359Reset the directory port @var{stream} so that the next call to
1360@code{readdir} will return the first directory entry.
1361@end deffn
1362
1363\fclosedir
1364@c snarfed from filesys.c:758
1365@deffn primitive closedir port
1366Close the directory stream @var{stream}.
1367The return value is unspecified.
1368@end deffn
1369
1370\fchdir
1371@c snarfed from filesys.c:808
1372@deffn primitive chdir str
1373Change the current working directory to @var{path}.
1374The return value is unspecified.
1375@end deffn
1376
1377\fgetcwd
1378@c snarfed from filesys.c:825
1379@deffn primitive getcwd
1380Returns the name of the current working directory.
1381@end deffn
1382
1383\fselect
1384@c snarfed from filesys.c:1022
1385@deffn primitive select reads writes excepts [secs [usecs]]
1386This procedure has a variety of uses: waiting for the ability
1387to provide input, accept output, or the existance of
1388exceptional conditions on a collection of ports or file
1389descriptors, or waiting for a timeout to occur.
1390It also returns if interrupted by a signal.
1391
1392@var{reads}, @var{writes} and @var{excepts} can be lists or
1393vectors, with each member a port or a file descriptor.
1394The value returned is a list of three corresponding
1395lists or vectors containing only the members which meet the
1396specified requirement. The ability of port buffers to
1397provide input or accept output is taken into account.
1398Ordering of the input lists or vectors is not preserved.
1399
1400The optional arguments @var{secs} and @var{usecs} specify the
1401timeout. Either @var{secs} can be specified alone, as
1402either an integer or a real number, or both @var{secs} and
1403@var{usecs} can be specified as integers, in which case
1404@var{usecs} is an additional timeout expressed in
1405microseconds. If @var{secs} is omitted or is @code{#f} then
1406select will wait for as long as it takes for one of the other
1407conditions to be satisfied.
1408
1409The scsh version of @code{select} differs as follows:
1410Only vectors are accepted for the first three arguments.
1411The @var{usecs} argument is not supported.
1412Multiple values are returned instead of a list.
1413Duplicates in the input vectors appear only once in output.
1414An additional @code{select!} interface is provided.
1415@end deffn
1416
1417\ffcntl
1418@c snarfed from filesys.c:1167
1419@deffn primitive fcntl object cmd [value]
1420Apply @var{command} to the specified file descriptor or the underlying
1421file descriptor of the specified port. @var{value} is an optional
1422integer argument.
1423
1424Values for @var{command} are:
1425
1426@table @code
1427@item F_DUPFD
1428Duplicate a file descriptor
1429@item F_GETFD
1430Get flags associated with the file descriptor.
1431@item F_SETFD
1432Set flags associated with the file descriptor to @var{value}.
1433@item F_GETFL
1434Get flags associated with the open file.
1435@item F_SETFL
1436Set flags associated with the open file to @var{value}
1437@item F_GETOWN
1438Get the process ID of a socket's owner, for @code{SIGIO} signals.
1439@item F_SETOWN
1440Set the process that owns a socket to @var{value}, for @code{SIGIO} signals.
1441@item FD_CLOEXEC
1442The value used to indicate the "close on exec" flag with @code{F_GETFL} or
1443@code{F_SETFL}.
1444@end table
1445@end deffn
1446
1447\ffsync
1448@c snarfed from filesys.c:1203
1449@deffn primitive fsync object
1450Copies any unwritten data for the specified output file descriptor to disk.
1451If @var{port/fd} is a port, its buffer is flushed before the underlying
1452file descriptor is fsync'd.
1453The return value is unspecified.
1454@end deffn
1455
1456\fsymlink
1457@c snarfed from filesys.c:1230
1458@deffn primitive symlink oldpath newpath
1459Create a symbolic link named @var{path-to} with the value (i.e., pointing to)
1460@var{path-from}. The return value is unspecified.
1461@end deffn
1462
1463\freadlink
1464@c snarfed from filesys.c:1252
1465@deffn primitive readlink path
1466Returns the value of the symbolic link named by
1467@var{path} (a string), i.e., the
1468file that the link points to.
1469@end deffn
1470
1471\flstat
1472@c snarfed from filesys.c:1282
1473@deffn primitive lstat str
1474Similar to @code{stat}, but does not follow symbolic links, i.e.,
1475it will return information about a symbolic link itself, not the
1476file it points to. @var{path} must be a string.
1477@end deffn
1478
1479\fcopy-file
1480@c snarfed from filesys.c:1307
1481@deffn primitive copy-file oldfile newfile
1482Copy the file specified by @var{path-from} to @var{path-to}.
1483The return value is unspecified.
1484@end deffn
1485
1486\fdirname
1487@c snarfed from filesys.c:1354
1488@deffn primitive dirname filename
1489Return the directory name component of the file name
1490@var{filename}. If @var{filename} does not contain a directory
1491component, @code{.} is returned.
1492@end deffn
1493
1494\fbasename
1495@c snarfed from filesys.c:1387
1496@deffn primitive basename filename [suffix]
1497Return the base name of the file name @var{filename}. The
1498base name is the file name without any directory components.
1499If @var{suffix} is privided, and is equal to the end of
1500@var{basename}, it is removed also.
1501@end deffn
1502
1503\fmake-fluid
1504@c snarfed from fluids.c:128
1505@deffn primitive make-fluid
1506Return a newly created fluid.
1507Fluids are objects of a certain type (a smob) that can hold one SCM
1508value per dynamic root. That is, modifications to this value are
1509only visible to code that executes within the same dynamic root as
1510the modifying code. When a new dynamic root is constructed, it
1511inherits the values from its parent. Because each thread executes
1512in its own dynamic root, you can use fluids for thread local storage.
1513@end deffn
1514
1515\ffluid?
1516@c snarfed from fluids.c:141
1517@deffn primitive fluid? obj
1518Return #t iff @var{obj} is a fluid; otherwise, return #f.
1519@end deffn
1520
1521\ffluid-ref
1522@c snarfed from fluids.c:151
1523@deffn primitive fluid-ref fluid
1524Return the value associated with @var{fluid} in the current dynamic root.
1525If @var{fluid} has not been set, then this returns #f.
1526@end deffn
1527
1528\ffluid-set!
1529@c snarfed from fluids.c:168
1530@deffn primitive fluid-set! fluid value
1531Set the value associated with @var{fluid} in the current dynamic root.
1532@end deffn
1533
1534\fwith-fluids*
1535@c snarfed from fluids.c:227
1536@deffn primitive with-fluids* fluids values thunk
1537Set @var{fluids} to @var{values} temporary, and call @var{thunk}.
1538@var{fluids} must be a list of fluids and @var{values} must be the same
1539number of their values to be applied. Each substitution is done
1540one after another. @var{thunk} must be a procedure with no argument.
1541@end deffn
1542
1543\fsetvbuf
1544@c snarfed from fports.c:148
1545@deffn primitive setvbuf port mode [size]
1546Set the buffering mode for @var{port}. @var{mode} can be:
1547@table @code
1548@item _IONBF
1549non-buffered
1550@item _IOLBF
1551line buffered
1552@item _IOFBF
1553block buffered, using a newly allocated buffer of @var{size} bytes.
1554If @var{size} is omitted, a default size will be used.
1555@end table
1556@end deffn
1557
1558\ffile-port?
1559@c snarfed from fports.c:229
1560@deffn primitive file-port? obj
1561Determine whether @var{obj} is a port that is related to a file.
1562@end deffn
1563
1564\fopen-file
1565@c snarfed from fports.c:282
1566@deffn primitive open-file filename modes
1567Open the file whose name is @var{string}, and return a port
1568representing that file. The attributes of the port are
1569determined by the @var{mode} string. The way in
1570which this is interpreted is similar to C stdio:
1571
1572The first character must be one of the following:
1573
1574@table @samp
1575@item r
1576Open an existing file for input.
1577@item w
1578Open a file for output, creating it if it doesn't already exist
1579or removing its contents if it does.
1580@item a
1581Open a file for output, creating it if it doesn't already exist.
1582All writes to the port will go to the end of the file.
1583The "append mode" can be turned off while the port is in use
1584@pxref{Ports and File Descriptors, fcntl}
1585@end table
1586
1587The following additional characters can be appended:
1588
1589@table @samp
1590@item +
1591Open the port for both input and output. E.g., @code{r+}: open
1592an existing file for both input and output.
1593@item 0
1594Create an "unbuffered" port. In this case input and output operations
1595are passed directly to the underlying port implementation without
1596additional buffering. This is likely to slow down I/O operations.
1597The buffering mode can be changed while a port is in use
1598@pxref{Ports and File Descriptors, setvbuf}
1599@item l
1600Add line-buffering to the port. The port output buffer will be
1601automatically flushed whenever a newline character is written.
1602@end table
1603
1604In theory we could create read/write ports which were buffered in one
1605direction only. However this isn't included in the current interfaces.
1606
1607If a file cannot be opened with the access requested,
1608@code{open-file} throws an exception.
1609@end deffn
1610
1611\fgc-stats
1612@c snarfed from gc.c:742
1613@deffn primitive gc-stats
1614Returns an association list of statistics about Guile's current use of storage.
1615@end deffn
1616
1617\fobject-address
1618@c snarfed from gc.c:839
1619@deffn primitive object-address obj
1620Return an integer that for the lifetime of @var{obj} is uniquely
1621returned by this function for @var{obj}
1622@end deffn
1623
1624\fgc
1625@c snarfed from gc.c:850
1626@deffn primitive gc
1627Scans all of SCM objects and reclaims for further use those that are
1628no longer accessible.
1629@end deffn
1630
1631\funhash-name
1632@c snarfed from gc.c:2291
1633@deffn primitive unhash-name name
1634Flushes the glocs for @var{name}, or all glocs if @var{name}
1635is @code{#t}.
1636@end deffn
1637
1638\f%compute-slots
1639@c snarfed from goops.c:290
1640@deffn primitive %compute-slots class
1641Return a list consisting of the names of all slots belonging to
1642class @var{class}, i. e. the slots of @var{class} and of all of
1643its superclasses.
1644@end deffn
1645
1646\fget-keyword
1647@c snarfed from goops.c:375
1648@deffn primitive get-keyword key l default_value
1649Determine an associated value for the keyword @var{key} from
1650the list @var{l}. The list @var{l} has to consist of an even
1651number of elements, where, starting with the first, every
1652second element is a keyword, followed by its associated value.
1653If @var{l} does not hold a value for @var{key}, the value
1654@var{default_value} is returned.
1655@end deffn
1656
1657\f%initialize-object
1658@c snarfed from goops.c:398
1659@deffn primitive %initialize-object obj initargs
1660Initialize the object @var{obj} with the given arguments
1661@var{initargs}.
1662@end deffn
1663
1664\f%prep-layout!
1665@c snarfed from goops.c:479
1666@deffn primitive %prep-layout! class
1667@end deffn
1668
1669\f%inherit-magic!
1670@c snarfed from goops.c:542
1671@deffn primitive %inherit-magic! class dsupers
1672@end deffn
1673
1674\finstance?
1675@c snarfed from goops.c:783
1676@deffn primitive instance? obj
1677Return @code{#t} if @var{obj} is an instance.
1678@end deffn
1679
1680\fclass-name
1681@c snarfed from goops.c:798
1682@deffn primitive class-name obj
1683Return the class name of @var{obj}.
1684@end deffn
1685
1686\fclass-direct-supers
1687@c snarfed from goops.c:808
1688@deffn primitive class-direct-supers obj
1689Return the direct superclasses of the class @var{obj}.
1690@end deffn
1691
1692\fclass-direct-slots
1693@c snarfed from goops.c:818
1694@deffn primitive class-direct-slots obj
1695Return the direct slots of the class @var{obj}.
1696@end deffn
1697
1698\fclass-direct-subclasses
1699@c snarfed from goops.c:828
1700@deffn primitive class-direct-subclasses obj
1701Return the direct subclasses of the class @var{obj}.
1702@end deffn
1703
1704\fclass-direct-methods
1705@c snarfed from goops.c:838
1706@deffn primitive class-direct-methods obj
1707Return the direct methods of the class @var{obj}
1708@end deffn
1709
1710\fclass-precedence-list
1711@c snarfed from goops.c:848
1712@deffn primitive class-precedence-list obj
1713Return the class precedence list of the class @var{obj}.
1714@end deffn
1715
1716\fclass-slots
1717@c snarfed from goops.c:858
1718@deffn primitive class-slots obj
1719Return the slot list of the class @var{obj}.
1720@end deffn
1721
1722\fclass-environment
1723@c snarfed from goops.c:868
1724@deffn primitive class-environment obj
1725Return the environment of the class @var{obj}.
1726@end deffn
1727
1728\fgeneric-function-name
1729@c snarfed from goops.c:879
1730@deffn primitive generic-function-name obj
1731Return the name of the generic function @var{obj}.
1732@end deffn
1733
1734\fgeneric-function-methods
1735@c snarfed from goops.c:889
1736@deffn primitive generic-function-methods obj
1737Return the methods of the generic function @var{obj}.
1738@end deffn
1739
1740\fmethod-generic-function
1741@c snarfed from goops.c:900
1742@deffn primitive method-generic-function obj
1743Return the generic function fot the method @var{obj}.
1744@end deffn
1745
1746\fmethod-specializers
1747@c snarfed from goops.c:910
1748@deffn primitive method-specializers obj
1749Return specializers of the method @var{obj}.
1750@end deffn
1751
1752\fmethod-procedure
1753@c snarfed from goops.c:920
1754@deffn primitive method-procedure obj
1755Return the procedure of the method @var{obj}.
1756@end deffn
1757
1758\faccessor-method-slot-definition
1759@c snarfed from goops.c:930
1760@deffn primitive accessor-method-slot-definition obj
1761Return the slot definition of the accessor @var{obj}.
1762@end deffn
1763
1764\f%tag-body
1765@c snarfed from goops.c:940
1766@deffn primitive %tag-body body
1767Internal GOOPS magic---don't use this function!
1768@end deffn
1769
1770\fmake-unbound
1771@c snarfed from goops.c:955
1772@deffn primitive make-unbound
1773Return the unbound value.
1774@end deffn
1775
1776\funbound?
1777@c snarfed from goops.c:964
1778@deffn primitive unbound? obj
1779Return @code{#t} if @var{obj} is unbound.
1780@end deffn
1781
1782\fassert-bound
1783@c snarfed from goops.c:974
1784@deffn primitive assert-bound value obj
1785Return @var{value} if it is bound, and invoke the
1786@var{slot-unbound} method of @var{obj} if it is not.
1787@end deffn
1788
1789\f@@assert-bound-ref
1790@c snarfed from goops.c:986
1791@deffn primitive @@assert-bound-ref obj index
1792Like @code{assert-bound}, but use @var{index} for accessing
1793the value from @var{obj}.
1794@end deffn
1795
1796\f%fast-slot-ref
1797@c snarfed from goops.c:998
1798@deffn primitive %fast-slot-ref obj index
1799Return the slot value with index @var{index} from @var{obj}.
1800@end deffn
1801
1802\f%fast-slot-set!
1803@c snarfed from goops.c:1015
1804@deffn primitive %fast-slot-set! obj index value
1805Set the slot with index @var{index} in @var{obj} to
1806@var{value}.
1807@end deffn
1808
1809\fslot-ref-using-class
1810@c snarfed from goops.c:1143
1811@deffn primitive slot-ref-using-class class obj slot_name
1812@end deffn
1813
1814\fslot-set-using-class!
1815@c snarfed from goops.c:1162
1816@deffn primitive slot-set-using-class! class obj slot_name value
1817@end deffn
1818
1819\fslot-bound-using-class?
1820@c snarfed from goops.c:1176
1821@deffn primitive slot-bound-using-class? class obj slot_name
1822@end deffn
1823
1824\fslot-exists-using-class?
1825@c snarfed from goops.c:1191
1826@deffn primitive slot-exists-using-class? class obj slot_name
1827@end deffn
1828
1829\fslot-ref
1830@c snarfed from goops.c:1207
1831@deffn primitive slot-ref obj slot_name
1832Return the value from @var{obj}'s slot with the name
1833@var{slot_name}.
1834@end deffn
1835
1836\fslot-set!
1837@c snarfed from goops.c:1224
1838@deffn primitive slot-set! obj slot_name value
1839Set the slot named @var{slot_name} of @var{obj} to @var{value}.
1840@end deffn
1841
1842\fslot-bound?
1843@c snarfed from goops.c:1241
1844@deffn primitive slot-bound? obj slot_name
1845Return @code{#t} if the slot named @var{slot_name} of @var{obj}
1846is bound.
1847@end deffn
1848
1849\fslot-exists?
1850@c snarfed from goops.c:1259
1851@deffn primitive slot-exists? obj slot_name
1852Return @code{#t} if @var{obj} has a slot named @var{slot_name}.
1853@end deffn
1854
1855\f%allocate-instance
1856@c snarfed from goops.c:1302
1857@deffn primitive %allocate-instance class initargs
1858Create a new instance of class @var{class} and initialize it
1859from the arguments @var{initargs}.
1860@end deffn
1861
1862\f%set-object-setter!
1863@c snarfed from goops.c:1375
1864@deffn primitive %set-object-setter! obj setter
1865@end deffn
1866
1867\f%modify-instance
1868@c snarfed from goops.c:1400
1869@deffn primitive %modify-instance old new
1870@end deffn
1871
1872\f%modify-class
1873@c snarfed from goops.c:1426
1874@deffn primitive %modify-class old new
1875@end deffn
1876
1877\f%invalidate-class
1878@c snarfed from goops.c:1450
1879@deffn primitive %invalidate-class class
1880@end deffn
1881
1882\f%invalidate-method-cache!
1883@c snarfed from goops.c:1571
1884@deffn primitive %invalidate-method-cache! gf
1885@end deffn
1886
1887\fgeneric-capability?
1888@c snarfed from goops.c:1597
1889@deffn primitive generic-capability? proc
1890@end deffn
1891
1892\fenable-primitive-generic!
1893@c snarfed from goops.c:1610
1894@deffn primitive enable-primitive-generic! . subrs
1895@end deffn
1896
1897\fprimitive-generic-generic
1898@c snarfed from goops.c:1630
1899@deffn primitive primitive-generic-generic subr
1900@end deffn
1901
1902\fmake
1903@c snarfed from goops.c:1989
1904@deffn primitive make . args
1905Make a new object. @var{args} must contain the class and
1906all necessary initialization information.
1907@end deffn
1908
1909\ffind-method
1910@c snarfed from goops.c:2082
1911@deffn primitive find-method . l
1912@end deffn
1913
1914\f%method-more-specific?
1915@c snarfed from goops.c:2102
1916@deffn primitive %method-more-specific? m1 m2 targs
1917@end deffn
1918
1919\f%goops-loaded
1920@c snarfed from goops.c:2634
1921@deffn primitive %goops-loaded
1922Announce that GOOPS is loaded and perform initialization
1923on the C level which depends on the loaded GOOPS modules.
1924@end deffn
1925
1926\fmake-guardian
1927@c snarfed from guardians.c:336
1928@deffn primitive make-guardian [greedy_p]
1929Create a new guardian.
1930A guardian protects a set of objects from garbage collection,
1931allowing a program to apply cleanup or other actions.
1932
1933@code{make-guardian} returns a procedure representing the guardian.
1934Calling the guardian procedure with an argument adds the
1935argument to the guardian's set of protected objects.
1936Calling the guardian procedure without an argument returns
1937one of the protected objects which are ready for garbage
1938collection, or @code{#f} if no such object is available.
1939Objects which are returned in this way are removed from
1940the guardian.
1941
1942@code{make-guardian} takes one optional argument that says whether the
1943new guardian should be greedy or sharing. If there is any chance
1944that any object protected by the guardian may be resurrected,
1945then you should make the guardian greedy (this is the default).
1946
1947See R. Kent Dybvig, Carl Bruggeman, and David Eby (1993)
1948"Guardians in a Generation-Based Garbage Collector".
1949ACM SIGPLAN Conference on Programming Language Design
1950and Implementation, June 1993.
1951
1952(the semantics are slightly different at this point, but the
1953paper still (mostly) accurately describes the interface).
1954@end deffn
1955
1956\fguardian-destroyed?
1957@c snarfed from guardians.c:364
1958@deffn primitive guardian-destroyed? guardian
1959Return @code{#t} if @var{guardian} has been destroyed, otherwise @code{#f}.
1960@end deffn
1961
1962\fguardian-greedy?
1963@c snarfed from guardians.c:382
1964@deffn primitive guardian-greedy? guardian
1965Return @code{#t} if @var{guardian} is a greedy guardian, otherwise @code{#f}.
1966@end deffn
1967
1968\fdestroy-guardian!
1969@c snarfed from guardians.c:393
1970@deffn primitive destroy-guardian! guardian
1971Destroys @var{guardian}, by making it impossible to put any more
1972objects in it or get any objects from it. It also unguards any
1973objects guarded by @var{guardian}.
1974@end deffn
1975
1976\fhashq
1977@c snarfed from hash.c:202
1978@deffn primitive hashq key size
1979Determine a hash value for @var{key} that is suitable for
1980lookups in a hashtable of size @var{size}, where @code{eq?} is
1981used as the equality predicate. The function returns an
1982integer in the range 0 to @var{size} - 1. Note that
1983@code{hashq} may use internal addresses. Thus two calls to
1984hashq where the keys are @code{eq?} are not guaranteed to
1985deliver the same value if the key object gets garbage collected
1986in between. This can happen, for example with symbols:
1987@code{(hashq 'foo n) (gc) (hashq 'foo n)} may produce two
1988different values, since @code{foo} will be garbage collected.
1989@end deffn
1990
1991\fhashv
1992@c snarfed from hash.c:238
1993@deffn primitive hashv key size
1994Determine a hash value for @var{key} that is suitable for
1995lookups in a hashtable of size @var{size}, where @code{eqv?} is
1996used as the equality predicate. The function returns an
1997integer in the range 0 to @var{size} - 1. Note that
1998@code{(hashv key)} may use internal addresses. Thus two calls
1999to hashv where the keys are @code{eqv?} are not guaranteed to
2000deliver the same value if the key object gets garbage collected
2001in between. This can happen, for example with symbols:
2002@code{(hashv 'foo n) (gc) (hashv 'foo n)} may produce two
2003different values, since @code{foo} will be garbage collected.
2004@end deffn
2005
2006\fhash
2007@c snarfed from hash.c:261
2008@deffn primitive hash key size
2009Determine a hash value for @var{key} that is suitable for
2010lookups in a hashtable of size @var{size}, where @code{equal?}
2011is used as the equality predicate. The function returns an
2012integer in the range 0 to @var{size} - 1.
2013@end deffn
2014
2015\fhashq-get-handle
2016@c snarfed from hashtab.c:174
2017@deffn primitive hashq-get-handle table obj
2018This procedure is similar to its @code{-ref} cousin, but returns a
2019@dfn{handle} from the hash table rather than the value associated with
2020@var{key}. By convention, a handle in a hash table is the pair which
2021associates a key with a value. Where @code{hashq-ref table key} returns
2022only a @code{value}, @code{hashq-get-handle table key} returns the pair
2023@code{(key . value)}.
2024@end deffn
2025
2026\fhashq-create-handle!
2027@c snarfed from hashtab.c:186
2028@deffn primitive hashq-create-handle! table key init
2029This function looks up @var{key} in @var{table} and returns its handle.
2030If @var{key} is not already present, a new handle is created which
2031associates @var{key} with @var{init}.
2032@end deffn
2033
2034\fhashq-ref
2035@c snarfed from hashtab.c:199
2036@deffn primitive hashq-ref table obj [dflt]
2037Look up @var{key} in the hash table @var{table}, and return the
2038value (if any) associated with it. If @var{key} is not found,
2039return @var{default} (or @code{#f} if no @var{default} argument
2040is supplied). Uses @code{eq?} for equality testing.
2041@end deffn
2042
2043\fhashq-set!
2044@c snarfed from hashtab.c:213
2045@deffn primitive hashq-set! table obj val
2046Find the entry in @var{table} associated with @var{key}, and
2047store @var{value} there. Uses @code{eq?} for equality testing.
2048@end deffn
2049
2050\fhashq-remove!
2051@c snarfed from hashtab.c:225
2052@deffn primitive hashq-remove! table obj
2053Remove @var{key} (and any value associated with it) from
2054@var{table}. Uses @code{eq?} for equality tests.
2055@end deffn
2056
2057\fhashv-get-handle
2058@c snarfed from hashtab.c:242
2059@deffn primitive hashv-get-handle table obj
2060This procedure is similar to its @code{-ref} cousin, but returns a
2061@dfn{handle} from the hash table rather than the value associated with
2062@var{key}. By convention, a handle in a hash table is the pair which
2063associates a key with a value. Where @code{hashv-ref table key} returns
2064only a @code{value}, @code{hashv-get-handle table key} returns the pair
2065@code{(key . value)}.
2066@end deffn
2067
2068\fhashv-create-handle!
2069@c snarfed from hashtab.c:254
2070@deffn primitive hashv-create-handle! table key init
2071This function looks up @var{key} in @var{table} and returns its handle.
2072If @var{key} is not already present, a new handle is created which
2073associates @var{key} with @var{init}.
2074@end deffn
2075
2076\fhashv-ref
2077@c snarfed from hashtab.c:267
2078@deffn primitive hashv-ref table obj [dflt]
2079Look up @var{key} in the hash table @var{table}, and return the
2080value (if any) associated with it. If @var{key} is not found,
2081return @var{default} (or @code{#f} if no @var{default} argument
2082is supplied). Uses @code{eqv?} for equality testing.
2083@end deffn
2084
2085\fhashv-set!
2086@c snarfed from hashtab.c:281
2087@deffn primitive hashv-set! table obj val
2088Find the entry in @var{table} associated with @var{key}, and
2089store @var{value} there. Uses @code{eqv?} for equality testing.
2090@end deffn
2091
2092\fhashv-remove!
2093@c snarfed from hashtab.c:292
2094@deffn primitive hashv-remove! table obj
2095Remove @var{key} (and any value associated with it) from
2096@var{table}. Uses @code{eqv?} for equality tests.
2097@end deffn
2098
2099\fhash-get-handle
2100@c snarfed from hashtab.c:308
2101@deffn primitive hash-get-handle table obj
2102This procedure is similar to its @code{-ref} cousin, but returns a
2103@dfn{handle} from the hash table rather than the value associated with
2104@var{key}. By convention, a handle in a hash table is the pair which
2105associates a key with a value. Where @code{hash-ref table key} returns
2106only a @code{value}, @code{hash-get-handle table key} returns the pair
2107@code{(key . value)}.
2108@end deffn
2109
2110\fhash-create-handle!
2111@c snarfed from hashtab.c:320
2112@deffn primitive hash-create-handle! table key init
2113This function looks up @var{key} in @var{table} and returns its handle.
2114If @var{key} is not already present, a new handle is created which
2115associates @var{key} with @var{init}.
2116@end deffn
2117
2118\fhash-ref
2119@c snarfed from hashtab.c:333
2120@deffn primitive hash-ref table obj [dflt]
2121Look up @var{key} in the hash table @var{table}, and return the
2122value (if any) associated with it. If @var{key} is not found,
2123return @var{default} (or @code{#f} if no @var{default} argument
2124is supplied). Uses @code{equal?} for equality testing.
2125@end deffn
2126
2127\fhash-set!
2128@c snarfed from hashtab.c:348
2129@deffn primitive hash-set! table obj val
2130Find the entry in @var{table} associated with @var{key}, and
2131store @var{value} there. Uses @code{equal?} for equality
2132testing.
2133@end deffn
2134
2135\fhash-remove!
2136@c snarfed from hashtab.c:360
2137@deffn primitive hash-remove! table obj
2138Remove @var{key} (and any value associated with it) from
2139@var{table}. Uses @code{equal?} for equality tests.
2140@end deffn
2141
2142\fhashx-get-handle
2143@c snarfed from hashtab.c:429
2144@deffn primitive hashx-get-handle hash assoc table obj
2145This behaves the same way as the corresponding @code{-get-handle}
2146function, but uses @var{hasher} as a
2147hash function and @var{assoc} to compare keys. @code{hasher} must
2148be a function that takes two arguments, a key to be hashed and a
2149table size. @code{assoc} must be an associator function, like
2150@code{assoc}, @code{assq} or @code{assv}.
2151@end deffn
2152
2153\fhashx-create-handle!
2154@c snarfed from hashtab.c:447
2155@deffn primitive hashx-create-handle! hash assoc table obj init
2156This behaves the same way as the corresponding @code{-create-handle}
2157function, but uses @var{hasher} as a
2158hash function and @var{assoc} to compare keys. @code{hasher} must
2159be a function that takes two arguments, a key to be hashed and a
2160table size. @code{assoc} must be an associator function, like
2161@code{assoc}, @code{assq} or @code{assv}.
2162@end deffn
2163
2164\fhashx-ref
2165@c snarfed from hashtab.c:468
2166@deffn primitive hashx-ref hash assoc table obj [dflt]
2167This behaves the same way as the corresponding @code{ref}
2168function, but uses @var{hasher} as a
2169hash function and @var{assoc} to compare keys. @code{hasher} must
2170be a function that takes two arguments, a key to be hashed and a
2171table size. @code{assoc} must be an associator function, like
2172@code{assoc}, @code{assq} or @code{assv}.
2173
2174By way of illustration, @code{hashq-ref table key} is equivalent
2175to @code{hashx-ref hashq assq table key}.
2176@end deffn
2177
2178\fhashx-set!
2179@c snarfed from hashtab.c:492
2180@deffn primitive hashx-set! hash assoc table obj val
2181This behaves the same way as the corresponding @code{set!}
2182function, but uses @var{hasher} as a
2183hash function and @var{assoc} to compare keys. @code{hasher} must
2184be a function that takes two arguments, a key to be hashed and a
2185table size. @code{assoc} must be an associator function, like
2186@code{assoc}, @code{assq} or @code{assv}.
2187
2188By way of illustration, @code{hashq-set! table key} is equivalent
2189to @code{hashx-set! hashq assq table key}.
2190@end deffn
2191
2192\fhash-fold
2193@c snarfed from hashtab.c:529
2194@deffn primitive hash-fold proc init table
2195An iterator over hash-table elements.
2196Accumulates and returns a result by applying PROC successively.
2197The arguments to PROC are "(key value prior-result)" where key
2198and value are successive pairs from the hash table TABLE, and
2199prior-result is either INIT (for the first application of PROC)
2200or the return value of the previous application of PROC.
2201For example, @code{(hash-fold acons () tab)} will convert a hash
2202table into an a-list of key-value pairs.
2203@end deffn
2204
2205\fmake-hook-with-name
2206@c snarfed from hooks.c:216
2207@deffn primitive make-hook-with-name name [n_args]
2208Create a named hook with the name @var{name} for storing
2209procedures of arity @var{n_args}.
2210@end deffn
2211
2212\fmake-hook
2213@c snarfed from hooks.c:230
2214@deffn primitive make-hook [n_args]
2215Create a hook for storing procedure of arity @var{n_args}.
2216@end deffn
2217
2218\fhook?
2219@c snarfed from hooks.c:240
2220@deffn primitive hook? x
2221Return @code{#t} if @var{x} is a hook.
2222@end deffn
2223
2224\fhook-empty?
2225@c snarfed from hooks.c:250
2226@deffn primitive hook-empty? hook
2227Return @code{#t} if @var{hook} is an empty hook.
2228@end deffn
2229
2230\fadd-hook!
2231@c snarfed from hooks.c:263
2232@deffn primitive add-hook! hook proc [append_p]
2233Add the procedure @var{proc} to the hook @var{hook}. The
2234procedure is added to the end if @var{append_p} is true,
2235otherwise it is added to the front.
2236@end deffn
2237
2238\fremove-hook!
2239@c snarfed from hooks.c:289
2240@deffn primitive remove-hook! hook proc
2241Remove the procedure @var{proc} from the hook @var{hook}.
2242@end deffn
2243
2244\freset-hook!
2245@c snarfed from hooks.c:302
2246@deffn primitive reset-hook! hook
2247Remove all procedures from the hook @var{hook}.
2248@end deffn
2249
2250\frun-hook
2251@c snarfed from hooks.c:315
2252@deffn primitive run-hook hook . args
2253Apply all procedures from the hook @var{hook} to the arguments
2254@var{args}.
2255@end deffn
2256
2257\fhook->list
2258@c snarfed from hooks.c:342
2259@deffn primitive hook->list hook
2260Convert the procedure list of @var{hook} to a list.
2261@end deffn
2262
2263\fread-string!/partial
2264@c snarfed from ioext.c:114
2265@deffn primitive read-string!/partial str [port_or_fdes [start [end]]]
2266Read characters from an fport or file descriptor into a
2267string @var{str}. This procedure is scsh-compatible
2268and can efficiently read large strings. It will:
2269
2270@itemize
2271@item
2272attempt to fill the entire string, unless the @var{start}
2273and/or @var{end} arguments are supplied. i.e., @var{start}
2274defaults to 0 and @var{end} defaults to
2275@code{(string-length str)}
2276@item
2277use the current input port if @var{port_or_fdes} is not
2278supplied.
2279@item
2280read any characters that are currently available,
2281without waiting for the rest (short reads are possible).
2282
2283@item
2284wait for as long as it needs to for the first character to
2285become available, unless the port is in non-blocking mode
2286@item
2287return @code{#f} if end-of-file is encountered before reading
2288any characters, otherwise return the number of characters
2289read.
2290@item
2291return 0 if the port is in non-blocking mode and no characters
2292are immediately available.
2293@item
2294return 0 if the request is for 0 bytes, with no
2295end-of-file check
2296@end itemize
2297@end deffn
2298
2299\fftell
2300@c snarfed from ioext.c:173
2301@deffn primitive ftell object
2302Returns an integer representing the current position of @var{fd/port},
2303measured from the beginning. Equivalent to:
2304@smalllisp
2305(seek port 0 SEEK_CUR)
2306@end smalllisp
2307@end deffn
2308
2309\ffseek
2310@c snarfed from ioext.c:186
2311@deffn primitive fseek object offset whence
2312Obsolete. Almost the same as seek, above, but the return value is
2313unspecified.
2314@end deffn
2315
2316\fredirect-port
2317@c snarfed from ioext.c:208
2318@deffn primitive redirect-port old new
2319This procedure takes two ports and duplicates the underlying file
2320descriptor from @var{old-port} into @var{new-port}. The
2321current file descriptor in @var{new-port} will be closed.
2322After the redirection the two ports will share a file position
2323and file status flags.
2324
2325The return value is unspecified.
2326
2327Unexpected behaviour can result if both ports are subsequently used
2328and the original and/or duplicate ports are buffered.
2329
2330This procedure does not have any side effects on other ports or
2331revealed counts.
2332@end deffn
2333
2334\fdup->fdes
2335@c snarfed from ioext.c:245
2336@deffn primitive dup->fdes fd_or_port [fd]
2337Returns an integer file descriptor.
2338@end deffn
2339
2340\fdup2
2341@c snarfed from ioext.c:292
2342@deffn primitive dup2 oldfd newfd
2343A simple wrapper for the @code{dup2} system call.
2344Copies the file descriptor @var{oldfd} to descriptor
2345number @var{newfd}, replacing the previous meaning
2346of @var{newfd}. Both @var{oldfd} and @var{newfd} must
2347be integers.
2348Unlike for dup->fdes or primitive-move->fdes, no attempt
2349is made to move away ports which are using @var{newfd}.
2350The return value is unspecified.
2351@end deffn
2352
2353\ffileno
2354@c snarfed from ioext.c:311
2355@deffn primitive fileno port
2356Returns the integer file descriptor underlying @var{port}.
2357Does not change its revealed count.
2358@end deffn
2359
2360\fisatty?
2361@c snarfed from ioext.c:327
2362@deffn primitive isatty? port
2363Returns @code{#t} if @var{port} is using a serial
2364non-file device, otherwise @code{#f}.
2365@end deffn
2366
2367\ffdopen
2368@c snarfed from ioext.c:349
2369@deffn primitive fdopen fdes modes
2370Returns a new port based on the file descriptor @var{fdes}.
2371Modes are given by the string @var{modes}. The revealed count of the port
2372is initialized to zero. The modes string is the same as that accepted
2373by @ref{File Ports, open-file}.
2374@end deffn
2375
2376\fprimitive-move->fdes
2377@c snarfed from ioext.c:374
2378@deffn primitive primitive-move->fdes port fd
2379Moves the underlying file descriptor for @var{port} to the integer
2380value @var{fdes} without changing the revealed count of @var{port}.
2381Any other ports already using this descriptor will be automatically
2382shifted to new descriptors and their revealed counts reset to zero.
2383The return value is @code{#f} if the file descriptor already had the
2384required value or @code{#t} if it was moved.
2385@end deffn
2386
2387\ffdes->ports
2388@c snarfed from ioext.c:407
2389@deffn primitive fdes->ports fd
2390Returns a list of existing ports which have @var{fdes} as an
2391underlying file descriptor, without changing their revealed counts.
2392@end deffn
2393
2394\fmake-keyword-from-dash-symbol
2395@c snarfed from keywords.c:71
2396@deffn primitive make-keyword-from-dash-symbol symbol
2397Make a keyword object from a @var{symbol} that starts with a dash.
2398@end deffn
2399
2400\fkeyword?
2401@c snarfed from keywords.c:112
2402@deffn primitive keyword? obj
2403Returns @code{#t} if the argument @var{obj} is a keyword, else @code{#f}.
2404@end deffn
2405
2406\fkeyword-dash-symbol
2407@c snarfed from keywords.c:123
2408@deffn primitive keyword-dash-symbol keyword
2409Return the dash symbol for @var{keyword}.
2410This is the inverse of @code{make-keyword-from-dash-symbol}.
2411@end deffn
2412
2413\fnil-cons
2414@c snarfed from lang.c:71
2415@deffn primitive nil-cons x y
2416Create a new cons cell with @var{x} as the car and @var{y} as
2417the cdr, but convert @var{y} to Scheme's end-of-list if it is
2418a LISP nil.
2419@end deffn
2420
2421\fnil-car
2422@c snarfed from lang.c:86
2423@deffn primitive nil-car x
2424Return the car of @var{x}, but convert it to LISP nil if it
2425is Scheme's end-of-list.
2426@end deffn
2427
2428\fnil-cdr
2429@c snarfed from lang.c:99
2430@deffn primitive nil-cdr x
2431Return the cdr of @var{x}, but convert it to LISP nil if it
2432is Scheme's end-of-list.
2433@end deffn
2434
2435\fnull
2436@c snarfed from lang.c:114
2437@deffn primitive null x
2438Return LISP's @code{t} if @var{x} is nil in the LISP sense,
2439return LISP's nil otherwise.
2440@end deffn
2441
2442\fnil-eq
2443@c snarfed from lang.c:143
2444@deffn primitive nil-eq x y
2445Compare @var{x} and @var{y} and return LISP's t if they are
2446@code{eq?}, return LISP's nil otherwise.
2447@end deffn
2448
2449\flist
2450@c snarfed from list.c:84
2451@deffn primitive list . objs
2452Return a list containing @var{objs}, the arguments to
2453@code{list}.
2454@end deffn
2455
2456\flist*
2457@c snarfed from list.c:94
2458@deffn primitive list*
2459scm_cons_star
2460@end deffn
2461
2462\fcons*
2463@c snarfed from list.c:105
2464@deffn primitive cons* arg . rest
2465Like @code{list}, but the last arg provides the tail of the
2466constructed list, returning @code{(cons @var{arg1} (cons
2467@var{arg2} (cons @dots{} @var{argn}))). Requires at least one
2468argument. If given one argument, that argument is returned as
2469result. This function is called @code{list*} in some other
2470Schemes and in Common LISP.
2471@end deffn
2472
2473\fnull?
2474@c snarfed from list.c:129
2475@deffn primitive null? x
2476Return @code{#t} iff @var{x} is the empty list, else @code{#f}.
2477@end deffn
2478
2479\flist?
2480@c snarfed from list.c:139
2481@deffn primitive list? x
2482Return @code{#t} iff @var{x} is a proper list, else @code{#f}.
2483@end deffn
2484
2485\flength
2486@c snarfed from list.c:180
2487@deffn primitive length lst
2488Return the number of elements in list @var{lst}.
2489@end deffn
2490
2491\fappend
2492@c snarfed from list.c:209
2493@deffn primitive append . args
2494Return a list consisting of the elements the lists passed as
2495arguments.
2496@example
2497(append '(x) '(y)) @result{} (x y)
2498(append '(a) '(b c d)) @result{} (a b c d)
2499(append '(a (b)) '((c))) @result{} (a (b) (c))
2500@end example
2501The resulting list is always newly allocated, except that it
2502shares structure with the last list argument. The last
2503argument may actually be any object; an improper list results
2504if the last argument is not a proper list.
2505@example
2506(append '(a b) '(c . d)) @result{} (a b c . d)
2507(append '() 'a) @result{} a
2508@end example
2509@end deffn
2510
2511\fappend!
2512@c snarfed from list.c:242
2513@deffn primitive append! . args
2514A destructive version of @code{append} (@pxref{Pairs and Lists,,,r4rs,
2515The Revised^4 Report on Scheme}). The cdr field of each list's final
2516pair is changed to point to the head of the next list, so no consing is
2517performed. Return a pointer to the mutated list.
2518@end deffn
2519
2520\flast-pair
2521@c snarfed from list.c:268
2522@deffn primitive last-pair lst
2523Return a pointer to the last pair in @var{lst}, signalling an error if
2524@var{lst} is circular.
2525@end deffn
2526
2527\freverse
2528@c snarfed from list.c:298
2529@deffn primitive reverse lst
2530Return a new list that contains the elements of @var{lst} but
2531in reverse order.
2532@end deffn
2533
2534\freverse!
2535@c snarfed from list.c:332
2536@deffn primitive reverse! lst [new_tail]
2537A destructive version of @code{reverse} (@pxref{Pairs and Lists,,,r4rs,
2538The Revised^4 Report on Scheme}). The cdr of each cell in @var{lst} is
2539modified to point to the previous list element. Return a pointer to the
2540head of the reversed list.
2541
2542Caveat: because the list is modified in place, the tail of the original
2543list now becomes its head, and the head of the original list now becomes
2544the tail. Therefore, the @var{lst} symbol to which the head of the
2545original list was bound now points to the tail. To ensure that the head
2546of the modified list is not lost, it is wise to save the return value of
2547@code{reverse!}
2548@end deffn
2549
2550\flist-ref
2551@c snarfed from list.c:358
2552@deffn primitive list-ref list k
2553Return the @var{k}th element from @var{list}.
2554@end deffn
2555
2556\flist-set!
2557@c snarfed from list.c:382
2558@deffn primitive list-set! list k val
2559Set the @var{k}th element of @var{list} to @var{val}.
2560@end deffn
2561
2562\flist-cdr-ref
2563@c snarfed from list.c:405
2564@deffn primitive list-cdr-ref
2565scm_list_tail
2566@end deffn
2567
2568\flist-tail
2569@c snarfed from list.c:414
2570@deffn primitive list-tail lst k
2571@deffnx primitive list-cdr-ref lst k
2572Return the "tail" of @var{lst} beginning with its @var{k}th element.
2573The first element of the list is considered to be element 0.
2574
2575@code{list-tail} and @code{list-cdr-ref} are identical. It may help to
2576think of @code{list-cdr-ref} as accessing the @var{k}th cdr of the list,
2577or returning the results of cdring @var{k} times down @var{lst}.
2578@end deffn
2579
2580\flist-cdr-set!
2581@c snarfed from list.c:430
2582@deffn primitive list-cdr-set! list k val
2583Set the @var{k}th cdr of @var{list} to @var{val}.
2584@end deffn
2585
2586\flist-head
2587@c snarfed from list.c:459
2588@deffn primitive list-head lst k
2589Copy the first @var{k} elements from @var{lst} into a new list, and
2590return it.
2591@end deffn
2592
2593\flist-copy
2594@c snarfed from list.c:483
2595@deffn primitive list-copy lst
2596Return a (newly-created) copy of @var{lst}.
2597@end deffn
2598
2599\fsloppy-memq
2600@c snarfed from list.c:517
2601@deffn primitive sloppy-memq x lst
2602This procedure behaves like @code{memq}, but does no type or error checking.
2603Its use is recommended only in writing Guile internals,
2604not for high-level Scheme programs.
2605@end deffn
2606
2607\fsloppy-memv
2608@c snarfed from list.c:534
2609@deffn primitive sloppy-memv x lst
2610This procedure behaves like @code{memv}, but does no type or error checking.
2611Its use is recommended only in writing Guile internals,
2612not for high-level Scheme programs.
2613@end deffn
2614
2615\fsloppy-member
2616@c snarfed from list.c:551
2617@deffn primitive sloppy-member x lst
2618This procedure behaves like @code{member}, but does no type or error checking.
2619Its use is recommended only in writing Guile internals,
2620not for high-level Scheme programs.
2621@end deffn
2622
2623\fmemq
2624@c snarfed from list.c:591
2625@deffn primitive memq x lst
2626Return the first sublist of @var{lst} whose car is @code{eq?}
2627to @var{x} where the sublists of @var{lst} are the non-empty
2628lists returned by @code{(list-tail @var{lst} @var{k})} for
2629@var{k} less than the length of @var{lst}. If @var{x} does not
2630occur in @var{lst}, then @code{#f} (not the empty list) is
2631returned.
2632@end deffn
2633
2634\fmemv
2635@c snarfed from list.c:608
2636@deffn primitive memv x lst
2637Return the first sublist of @var{lst} whose car is @code{eqv?}
2638to @var{x} where the sublists of @var{lst} are the non-empty
2639lists returned by @code{(list-tail @var{lst} @var{k})} for
2640@var{k} less than the length of @var{lst}. If @var{x} does not
2641occur in @var{lst}, then @code{#f} (not the empty list) is
2642returned.
2643@end deffn
2644
2645\fmember
2646@c snarfed from list.c:629
2647@deffn primitive member x lst
2648Return the first sublist of @var{lst} whose car is
2649@code{equal?} to @var{x} where the sublists of @var{lst} are
2650the non-empty lists returned by @code{(list-tail @var{lst}
2651@var{k})} for @var{k} less than the length of @var{lst}. If
2652@var{x} does not occur in @var{lst}, then @code{#f} (not the
2653empty list) is returned.
2654@end deffn
2655
2656\fdelq!
2657@c snarfed from list.c:655
2658@deffn primitive delq! item lst
2659@deffnx primitive delv! item lst
2660@deffnx primitive delete! item lst
2661These procedures are destructive versions of @code{delq}, @code{delv}
2662and @code{delete}: they modify the pointers in the existing @var{lst}
2663rather than creating a new list. Caveat evaluator: Like other
2664destructive list functions, these functions cannot modify the binding of
2665@var{lst}, and so cannot be used to delete the first element of
2666@var{lst} destructively.
2667@end deffn
2668
2669\fdelv!
2670@c snarfed from list.c:679
2671@deffn primitive delv! item lst
2672Destructively remove all elements from @var{lst} that are
2673@code{eqv?} to @var{item}.
2674@end deffn
2675
2676\fdelete!
2677@c snarfed from list.c:704
2678@deffn primitive delete! item lst
2679Destructively remove all elements from @var{lst} that are
2680@code{equal?} to @var{item}.
2681@end deffn
2682
2683\fdelq
2684@c snarfed from list.c:733
2685@deffn primitive delq item lst
2686Return a newly-created copy of @var{lst} with elements
2687@code{eq?} to @var{item} removed. This procedure mirrors
2688@code{memq}: @code{delq} compares elements of @var{lst} against
2689@var{item} with @code{eq?}.
2690@end deffn
2691
2692\fdelv
2693@c snarfed from list.c:746
2694@deffn primitive delv item lst
2695Return a newly-created copy of @var{lst} with elements
2696@code{eqv?} to @var{item} removed. This procedure mirrors
2697@code{memv}: @code{delv} compares elements of @var{lst} against
2698@var{item} with @code{eqv?}.
2699@end deffn
2700
2701\fdelete
2702@c snarfed from list.c:759
2703@deffn primitive delete item lst
2704Return a newly-created copy of @var{lst} with elements
2705@code{equal?} to @var{item} removed. This procedure mirrors
2706@code{member}: @code{delete} compares elements of @var{lst}
2707against @var{item} with @code{equal?}.
2708@end deffn
2709
2710\fdelq1!
2711@c snarfed from list.c:772
2712@deffn primitive delq1! item lst
2713Like @code{delq!}, but only deletes the first occurrence of
2714@var{item} from @var{lst}. Tests for equality using
2715@code{eq?}. See also @code{delv1!} and @code{delete1!}.
2716@end deffn
2717
2718\fdelv1!
2719@c snarfed from list.c:800
2720@deffn primitive delv1! item lst
2721Like @code{delv!}, but only deletes the first occurrence of
2722@var{item} from @var{lst}. Tests for equality using
2723@code{eqv?}. See also @code{delq1!} and @code{delete1!}.
2724@end deffn
2725
2726\fdelete1!
2727@c snarfed from list.c:828
2728@deffn primitive delete1! item lst
2729Like @code{delete!}, but only deletes the first occurrence of
2730@var{item} from @var{lst}. Tests for equality using
2731@code{equal?}. See also @code{delq1!} and @code{delv1!}.
2732@end deffn
2733
2734\fprimitive-load
2735@c snarfed from load.c:112
2736@deffn primitive primitive-load filename
2737Load the file named @var{filename} and evaluate its contents in
2738the top-level environment. The load paths are not searched;
2739@var{filename} must either be a full pathname or be a pathname
2740relative to the current directory. If the variable
2741@code{%load-hook} is defined, it should be bound to a procedure
2742that will be called before any code is loaded. See the
2743documentation for @code{%load-hook} later in this section.
2744@end deffn
2745
2746\f%package-data-dir
2747@c snarfed from load.c:147
2748@deffn primitive %package-data-dir
2749Return the name of the directory where Scheme packages, modules and
2750libraries are kept. On most Unix systems, this will be
2751@samp{/usr/local/share/guile}.
2752@end deffn
2753
2754\f%library-dir
2755@c snarfed from load.c:159
2756@deffn primitive %library-dir
2757Return the directory where the Guile Scheme library files are installed.
2758E.g., may return "/usr/share/guile/1.3.5".
2759@end deffn
2760
2761\f%site-dir
2762@c snarfed from load.c:171
2763@deffn primitive %site-dir
2764Return the directory where the Guile site files are installed.
2765E.g., may return "/usr/share/guile/site".
2766@end deffn
2767
2768\fparse-path
2769@c snarfed from load.c:223
2770@deffn primitive parse-path path [tail]
2771Parse @var{path}, which is expected to be a colon-separated
2772string, into a list and return the resulting list with
2773@var{tail} appended. If @var{path} is @code{#f}, @var{tail}
2774is returned.
2775@end deffn
2776
2777\fsearch-path
2778@c snarfed from load.c:273
2779@deffn primitive search-path path filename [extensions]
2780Search @var{path} for a directory containing a file named
2781@var{filename}. The file must be readable, and not a directory.
2782If we find one, return its full filename; otherwise, return
2783@code{#f}. If @var{filename} is absolute, return it unchanged.
2784If given, @var{extensions} is a list of strings; for each
2785directory in @var{path}, we search for @var{filename}
2786concatenated with each @var{extension}.
2787@end deffn
2788
2789\f%search-load-path
2790@c snarfed from load.c:420
2791@deffn primitive %search-load-path filename
2792Search @var{%load-path} for the file named @var{filename},
2793which must be readable by the current user. If @var{filename}
2794is found in the list of paths to search or is an absolute
2795pathname, return its full pathname. Otherwise, return
2796@code{#f}. Filenames may have any of the optional extensions
2797in the @code{%load-extensions} list; @code{%search-load-path}
2798will try each extension automatically.
2799@end deffn
2800
2801\fprimitive-load-path
2802@c snarfed from load.c:441
2803@deffn primitive primitive-load-path filename
2804Search @var{%load-path} for the file named @var{filename} and
2805load it into the top-level environment. If @var{filename} is a
2806relative pathname and is not found in the list of search paths,
2807an error is signalled.
2808@end deffn
2809
2810\fread-and-eval!
2811@c snarfed from load.c:476
2812@deffn primitive read-and-eval! [port]
2813Read a form from @var{port} (standard input by default), and evaluate it
2814(memoizing it in the process) in the top-level environment. If no data
2815is left to be read from @var{port}, an @code{end-of-file} error is
2816signalled.
2817@end deffn
2818
2819\fprocedure->syntax
2820@c snarfed from macros.c:60
2821@deffn primitive procedure->syntax code
2822Returns a @dfn{macro} which, when a symbol defined to this value
2823appears as the first symbol in an expression, returns the result
2824of applying @var{code} to the expression and the environment.
2825@end deffn
2826
2827\fprocedure->macro
2828@c snarfed from macros.c:82
2829@deffn primitive procedure->macro code
2830Returns a @dfn{macro} which, when a symbol defined to this value
2831appears as the first symbol in an expression, evaluates the result
2832of applying @var{code} to the expression and the environment.
2833The value returned from @var{code} which has been passed to
2834@code{procedure->memoizing-macro} replaces the form passed to
2835@var{code}. For example:
2836
2837@example
2838(define trace
2839 (procedure->macro
2840 (lambda (x env) `(set! ,(cadr x) (tracef ,(cadr x) ',(cadr x))))))
2841
2842(trace @i{foo}) @equiv{} (set! @i{foo} (tracef @i{foo} '@i{foo})).
2843@end example
2844@end deffn
2845
2846\fprocedure->memoizing-macro
2847@c snarfed from macros.c:104
2848@deffn primitive procedure->memoizing-macro code
2849Returns a @dfn{macro} which, when a symbol defined to this value
2850appears as the first symbol in an expression, evaluates the result
2851of applying @var{proc} to the expression and the environment.
2852The value returned from @var{proc} which has been passed to
2853@code{procedure->memoizing-macro} replaces the form passed to
2854@var{proc}. For example:
2855
2856@example
2857(define trace
2858 (procedure->macro
2859 (lambda (x env) `(set! ,(cadr x) (tracef ,(cadr x) ',(cadr x))))))
2860
2861(trace @i{foo}) @equiv{} (set! @i{foo} (tracef @i{foo} '@i{foo})).
2862@end example
2863@end deffn
2864
2865\fmacro?
2866@c snarfed from macros.c:116
2867@deffn primitive macro? obj
2868Return @code{#t} if @var{obj} is a regular macro, a memoizing macro or a
2869syntax transformer.
2870@end deffn
2871
2872\fmacro-type
2873@c snarfed from macros.c:133
2874@deffn primitive macro-type m
2875Return one of the symbols @code{syntax}, @code{macro} or @code{macro!},
2876depending on whether @var{obj} is a syntax tranformer, a regular macro,
2877or a memoizing macro, respectively. If @var{obj} is not a macro,
2878@code{#f} is returned.
2879@end deffn
2880
2881\fmacro-name
2882@c snarfed from macros.c:151
2883@deffn primitive macro-name m
2884Return the name of the macro @var{m}.
2885@end deffn
2886
2887\fmacro-transformer
2888@c snarfed from macros.c:162
2889@deffn primitive macro-transformer m
2890Return the transformer of the macro @var{m}.
2891@end deffn
2892
2893\finteraction-environment
2894@c snarfed from modules.c:102
2895@deffn primitive interaction-environment
2896This procedure returns a specifier for the environment that contains
2897implementation-defined bindings, typically a superset of those listed in
2898the report. The intent is that this procedure will return the
2899environment in which the implementation would evaluate expressions
2900dynamically typed by the user.
2901@end deffn
2902
2903\fstandard-eval-closure
2904@c snarfed from modules.c:271
2905@deffn primitive standard-eval-closure module
2906Return an eval closure for the module @var{module}.
2907@end deffn
2908
2909\finet-aton
2910@c snarfed from net_db.c:96
2911@deffn primitive inet-aton address
2912Converts a string containing an Internet host address in the traditional
2913dotted decimal notation into an integer.
2914
2915@smalllisp
2916(inet-aton "127.0.0.1") @result{} 2130706433
2917
2918@end smalllisp
2919@end deffn
2920
2921\finet-ntoa
2922@c snarfed from net_db.c:116
2923@deffn primitive inet-ntoa inetid
2924Converts an integer Internet host address into a string with the
2925traditional dotted decimal representation.
2926
2927@smalllisp
2928(inet-ntoa 2130706433) @result{} "127.0.0.1"
2929@end smalllisp
2930@end deffn
2931
2932\finet-netof
2933@c snarfed from net_db.c:135
2934@deffn primitive inet-netof address
2935Returns the network number part of the given integer Internet address.
2936
2937@smalllisp
2938(inet-netof 2130706433) @result{} 127
2939@end smalllisp
2940@end deffn
2941
2942\finet-lnaof
2943@c snarfed from net_db.c:152
2944@deffn primitive inet-lnaof address
2945Returns the local-address-with-network part of the given Internet
2946address.
2947
2948@smalllisp
2949(inet-lnaof 2130706433) @result{} 1
2950@end smalllisp
2951@end deffn
2952
2953\finet-makeaddr
2954@c snarfed from net_db.c:169
2955@deffn primitive inet-makeaddr net lna
2956Makes an Internet host address by combining the network number @var{net}
2957with the local-address-within-network number @var{lna}.
2958
2959@smalllisp
2960(inet-makeaddr 127 1) @result{} 2130706433
2961@end smalllisp
2962@end deffn
2963
2964\fgethost
2965@c snarfed from net_db.c:254
2966@deffn primitive gethost [host]
2967@deffnx procedure gethostbyname hostname
2968@deffnx procedure gethostbyaddr address
2969Look up a host by name or address, returning a host object. The
2970@code{gethost} procedure will accept either a string name or an integer
2971address; if given no arguments, it behaves like @code{gethostent} (see
2972below). If a name or address is supplied but the address can not be
2973found, an error will be thrown to one of the keys:
2974@code{host-not-found}, @code{try-again}, @code{no-recovery} or
2975@code{no-data}, corresponding to the equivalent @code{h_error} values.
2976Unusual conditions may result in errors thrown to the
2977@code{system-error} or @code{misc_error} keys.
2978@end deffn
2979
2980\fgetnet
2981@c snarfed from net_db.c:335
2982@deffn primitive getnet [net]
2983@deffnx procedure getnetbyname net-name
2984@deffnx procedure getnetbyaddr net-number
2985Look up a network by name or net number in the network database. The
2986@var{net-name} argument must be a string, and the @var{net-number}
2987argument must be an integer. @code{getnet} will accept either type of
2988argument, behaving like @code{getnetent} (see below) if no arguments are
2989given.
2990@end deffn
2991
2992\fgetproto
2993@c snarfed from net_db.c:385
2994@deffn primitive getproto [protocol]
2995@deffnx procedure getprotobyname name
2996@deffnx procedure getprotobynumber number
2997Look up a network protocol by name or by number. @code{getprotobyname}
2998takes a string argument, and @code{getprotobynumber} takes an integer
2999argument. @code{getproto} will accept either type, behaving like
3000@code{getprotoent} (see below) if no arguments are supplied.
3001@end deffn
3002
3003\fgetserv
3004@c snarfed from net_db.c:452
3005@deffn primitive getserv [name [protocol]]
3006@deffnx procedure getservbyname name protocol
3007@deffnx procedure getservbyport port protocol
3008Look up a network service by name or by service number, and return a
3009network service object. The @var{protocol} argument specifies the name
3010of the desired protocol; if the protocol found in the network service
3011database does not match this name, a system error is signalled.
3012
3013The @code{getserv} procedure will take either a service name or number
3014as its first argument; if given no arguments, it behaves like
3015@code{getservent} (see below).
3016@end deffn
3017
3018\fsethost
3019@c snarfed from net_db.c:491
3020@deffn primitive sethost [stayopen]
3021If @var{stayopen} is omitted, this is equivalent to @code{endhostent}.
3022Otherwise it is equivalent to @code{sethostent stayopen}.
3023@end deffn
3024
3025\fsetnet
3026@c snarfed from net_db.c:507
3027@deffn primitive setnet [stayopen]
3028If @var{stayopen} is omitted, this is equivalent to @code{endnetent}.
3029Otherwise it is equivalent to @code{setnetent stayopen}.
3030@end deffn
3031
3032\fsetproto
3033@c snarfed from net_db.c:523
3034@deffn primitive setproto [stayopen]
3035If @var{stayopen} is omitted, this is equivalent to @code{endprotoent}.
3036Otherwise it is equivalent to @code{setprotoent stayopen}.
3037@end deffn
3038
3039\fsetserv
3040@c snarfed from net_db.c:539
3041@deffn primitive setserv [stayopen]
3042If @var{stayopen} is omitted, this is equivalent to @code{endservent}.
3043Otherwise it is equivalent to @code{setservent stayopen}.
3044@end deffn
3045
3046\fexact?
3047@c snarfed from numbers.c:106
3048@deffn primitive exact? x
3049Return @code{#t} if @var{x} is an exact number, @code{#f}
3050otherwise.
3051@end deffn
3052
3053\fodd?
3054@c snarfed from numbers.c:123
3055@deffn primitive odd? n
3056Return @code{#t} if @var{n} is an odd number, @code{#f}
3057otherwise.
3058@end deffn
3059
3060\feven?
3061@c snarfed from numbers.c:140
3062@deffn primitive even? n
3063Return @code{#t} if @var{n} is an even number, @code{#f}
3064otherwise.
3065@end deffn
3066
3067\flogand
3068@c snarfed from numbers.c:755
3069@deffn primitive logand n1 n2
3070Returns the integer which is the bit-wise AND of the two integer
3071arguments.
3072
3073Example:
3074@lisp
3075(number->string (logand #b1100 #b1010) 2)
3076 @result{} "1000"
3077@end lisp
3078@end deffn
3079
3080\flogior
3081@c snarfed from numbers.c:842
3082@deffn primitive logior n1 n2
3083Returns the integer which is the bit-wise OR of the two integer
3084arguments.
3085
3086Example:
3087@lisp
3088(number->string (logior #b1100 #b1010) 2)
3089 @result{} "1110"
3090@end lisp
3091@end deffn
3092
3093\flogxor
3094@c snarfed from numbers.c:928
3095@deffn primitive logxor n1 n2
3096Returns the integer which is the bit-wise XOR of the two integer
3097arguments.
3098
3099Example:
3100@lisp
3101(number->string (logxor #b1100 #b1010) 2)
3102 @result{} "110"
3103@end lisp
3104@end deffn
3105
3106\flogtest
3107@c snarfed from numbers.c:997
3108@deffn primitive logtest n1 n2
3109@example
3110(logtest j k) @equiv{} (not (zero? (logand j k)))
3111
3112(logtest #b0100 #b1011) @result{} #f
3113(logtest #b0100 #b0111) @result{} #t
3114@end example
3115@end deffn
3116
3117\flogbit?
3118@c snarfed from numbers.c:1054
3119@deffn primitive logbit? index j
3120@example
3121(logbit? index j) @equiv{} (logtest (integer-expt 2 index) j)
3122
3123(logbit? 0 #b1101) @result{} #t
3124(logbit? 1 #b1101) @result{} #f
3125(logbit? 2 #b1101) @result{} #t
3126(logbit? 3 #b1101) @result{} #t
3127(logbit? 4 #b1101) @result{} #f
3128@end example
3129@end deffn
3130
3131\flognot
3132@c snarfed from numbers.c:1102
3133@deffn primitive lognot n
3134Returns the integer which is the 2s-complement of the integer argument.
3135
3136Example:
3137@lisp
3138(number->string (lognot #b10000000) 2)
3139 @result{} "-10000001"
3140(number->string (lognot #b0) 2)
3141 @result{} "-1"
3142@end lisp
3143@end deffn
3144
3145\finteger-expt
3146@c snarfed from numbers.c:1118
3147@deffn primitive integer-expt n k
3148Returns @var{n} raised to the non-negative integer exponent @var{k}.
3149
3150Example:
3151@lisp
3152(integer-expt 2 5)
3153 @result{} 32
3154(integer-expt -3 3)
3155 @result{} -27
3156@end lisp
3157@end deffn
3158
3159\fash
3160@c snarfed from numbers.c:1166
3161@deffn primitive ash n cnt
3162The function ash performs an arithmetic shift left by @var{CNT}
3163bits (or shift right, if @var{cnt} is negative).
3164'Arithmetic' means, that the function does not guarantee to
3165keep the bit structure of @var{n}, but rather guarantees that
3166the result will always be rounded towards minus infinity.
3167Therefore, the results of ash and a corresponding bitwise
3168shift will differ if N is negative.
3169
3170Formally, the function returns an integer equivalent to
3171@code{(inexact->exact (floor (* @var{n} (expt 2 @var{cnt}))))}.
3172
3173Example:
3174@lisp
3175(number->string (ash #b1 3) 2)
3176 @result{} "1000"
3177(number->string (ash #b1010 -1) 2)
3178 @result{} "101"
3179@end lisp
3180@end deffn
3181
3182\fbit-extract
3183@c snarfed from numbers.c:1219
3184@deffn primitive bit-extract n start end
3185Returns the integer composed of the @var{start} (inclusive) through
3186@var{end} (exclusive) bits of @var{n}. The @var{start}th bit becomes
3187the 0-th bit in the result.@refill
3188
3189Example:
3190@lisp
3191(number->string (bit-extract #b1101101010 0 4) 2)
3192 @result{} "1010"
3193(number->string (bit-extract #b1101101010 4 9) 2)
3194 @result{} "10110"
3195@end lisp
3196@end deffn
3197
3198\flogcount
3199@c snarfed from numbers.c:1291
3200@deffn primitive logcount n
3201Returns the number of bits in integer @var{n}. If integer is positive,
3202the 1-bits in its binary representation are counted. If negative, the
32030-bits in its two's-complement binary representation are counted. If 0,
32040 is returned.
3205
3206Example:
3207@lisp
3208(logcount #b10101010)
3209 @result{} 4
3210(logcount 0)
3211 @result{} 0
3212(logcount -2)
3213 @result{} 1
3214@end lisp
3215@end deffn
3216
3217\finteger-length
3218@c snarfed from numbers.c:1342
3219@deffn primitive integer-length n
3220Returns the number of bits neccessary to represent @var{n}.
3221
3222Example:
3223@lisp
3224(integer-length #b10101010)
3225 @result{} 8
3226(integer-length 0)
3227 @result{} 0
3228(integer-length #b1111)
3229 @result{} 4
3230@end lisp
3231@end deffn
3232
3233\fnumber->string
3234@c snarfed from numbers.c:2288
3235@deffn primitive number->string n [radix]
3236Return a string holding the external representation of the
3237number @var{n} in the given @var{radix}. If @var{n} is
3238inexact, a radix of 10 will be used.
3239@end deffn
3240
3241\fstring->number
3242@c snarfed from numbers.c:2873
3243@deffn primitive string->number string [radix]
3244Returns a number of the maximally precise representation
3245expressed by the given @var{string}. @var{radix} must be an
3246exact integer, either 2, 8, 10, or 16. If supplied, @var{radix}
3247is a default radix that may be overridden by an explicit radix
3248prefix in @var{string} (e.g. "#o177"). If @var{radix} is not
3249supplied, then the default radix is 10. If string is not a
3250syntactically valid notation for a number, then
3251@code{string->number} returns @code{#f}.
3252@end deffn
3253
3254\fnumber?
3255@c snarfed from numbers.c:2940
3256@deffn primitive number?
3257scm_number_p
3258@end deffn
3259
3260\fcomplex?
3261@c snarfed from numbers.c:2952
3262@deffn primitive complex? x
3263Return @code{#t} if @var{x} is a complex number, @code{#f}
3264else. Note that the sets of real, rational and integer
3265values form subsets of the set of complex numbers, i. e. the
3266predicate will also be fulfilled if @var{x} is a real,
3267rational or integer number.
3268@end deffn
3269
3270\freal?
3271@c snarfed from numbers.c:2960
3272@deffn primitive real?
3273scm_real_p
3274@end deffn
3275
3276\frational?
3277@c snarfed from numbers.c:2973
3278@deffn primitive rational? x
3279Return @code{#t} if @var{x} is a rational number, @code{#f}
3280else. Note that the set of integer values forms a subset of
3281the set of rational numbers, i. e. the predicate will also be
3282fulfilled if @var{x} is an integer number. Real numbers
3283will also satisfy this predicate, because of their limited
3284precision.
3285@end deffn
3286
3287\finteger?
3288@c snarfed from numbers.c:2994
3289@deffn primitive integer? x
3290Return @code{#t} if @var{x} is an integer number, @code{#f}
3291else.
3292@end deffn
3293
3294\finexact?
3295@c snarfed from numbers.c:3019
3296@deffn primitive inexact? x
3297Return @code{#t} if @var{x} is an inexact number, @code{#f}
3298else.
3299@end deffn
3300
3301\f$expt
3302@c snarfed from numbers.c:4071
3303@deffn primitive $expt x y
3304Return @var{x} raised to the power of @var{y}. This
3305procedure does not accept complex arguments.
3306@end deffn
3307
3308\f$atan2
3309@c snarfed from numbers.c:4087
3310@deffn primitive $atan2 x y
3311Return the arc tangent of the two arguments @var{x} and
3312@var{y}. This is similar to calculating the arc tangent of
3313@var{x} / @var{y}, except that the signs of both arguments
3314are used to determine the quadrant of the result. This
3315procedure does not accept complex arguments.
3316@end deffn
3317
3318\fmake-rectangular
3319@c snarfed from numbers.c:4100
3320@deffn primitive make-rectangular real imaginary
3321Return a complex number constructed of the given @var{real} and
3322@var{imaginary} parts.
3323@end deffn
3324
3325\fmake-polar
3326@c snarfed from numbers.c:4113
3327@deffn primitive make-polar x y
3328Return the complex number @var{x} * e^(i * @var{y}).
3329@end deffn
3330
3331\finexact->exact
3332@c snarfed from numbers.c:4231
3333@deffn primitive inexact->exact z
3334Returns an exact number that is numerically closest to @var{z}.
3335@end deffn
3336
3337\fclass-of
3338@c snarfed from objects.c:88
3339@deffn primitive class-of x
3340Return the class of @var{x}.
3341@end deffn
3342
3343\fentity?
3344@c snarfed from objects.c:359
3345@deffn primitive entity? obj
3346Return @code{#t} if @var{obj} is an entity.
3347@end deffn
3348
3349\foperator?
3350@c snarfed from objects.c:368
3351@deffn primitive operator? obj
3352Return @code{#t} if @var{obj} is an operator.
3353@end deffn
3354
3355\fset-object-procedure!
3356@c snarfed from objects.c:380
3357@deffn primitive set-object-procedure! obj proc
3358Return the object procedure of @var{obj} to @var{proc}.
3359@var{obj} must be either an entity or an operator.
3360@end deffn
3361
3362\fmake-class-object
3363@c snarfed from objects.c:440
3364@deffn primitive make-class-object metaclass layout
3365Create a new class object of class @var{metaclass}, with the
3366slot layout specified by @var{layout}.
3367@end deffn
3368
3369\fmake-subclass-object
3370@c snarfed from objects.c:455
3371@deffn primitive make-subclass-object class layout
3372Create a subclass object of @var{class}, with the slot layout
3373specified by @var{layout}.
3374@end deffn
3375
3376\fobject-properties
3377@c snarfed from objprop.c:62
3378@deffn primitive object-properties obj
3379@deffnx primitive procedure-properties obj
3380Return @var{obj}'s property list.
3381@end deffn
3382
3383\fset-object-properties!
3384@c snarfed from objprop.c:73
3385@deffn primitive set-object-properties! obj plist
3386@deffnx primitive set-procedure-properties! obj alist
3387Set @var{obj}'s property list to @var{alist}.
3388@end deffn
3389
3390\fobject-property
3391@c snarfed from objprop.c:85
3392@deffn primitive object-property obj key
3393@deffnx primitive procedure-property obj key
3394Return the property of @var{obj} with name @var{key}.
3395@end deffn
3396
3397\fset-object-property!
3398@c snarfed from objprop.c:98
3399@deffn primitive set-object-property! obj key val
3400@deffnx primitive set-procedure-property! obj key value
3401In @var{obj}'s property list, set the property named @var{key} to
3402@var{value}.
3403@end deffn
3404
3405\fcons
3406@c snarfed from pairs.c:61
3407@deffn primitive cons x y
3408Returns a newly allocated pair whose car is @var{x} and whose cdr is
3409@var{y}. The pair is guaranteed to be different (in the sense of
3410@code{eqv?}) from every previously existing object.
3411@end deffn
3412
3413\fpair?
3414@c snarfed from pairs.c:93
3415@deffn primitive pair? x
3416Returns @code{#t} if @var{x} is a pair; otherwise returns @code{#f}.
3417@end deffn
3418
3419\fset-car!
3420@c snarfed from pairs.c:104
3421@deffn primitive set-car! pair value
3422Stores @var{value} in the car field of @var{pair}. The value returned
3423by @code{set-car!} is unspecified.
3424@end deffn
3425
3426\fset-cdr!
3427@c snarfed from pairs.c:117
3428@deffn primitive set-cdr! pair value
3429Stores @var{value} in the cdr field of @var{pair}. The value returned
3430by @code{set-cdr!} is unspecified.
3431@end deffn
3432
3433\fchar-ready?
3434@c snarfed from ports.c:246
3435@deffn primitive char-ready? [port]
3436Returns @code{#t} if a character is ready on input @var{port} and
3437returns @code{#f} otherwise. If @code{char-ready?} returns @code{#t}
3438then the next @code{read-char} operation on @var{port} is
3439guaranteed not to hang. If @var{port} is a file port at end of
3440file then @code{char-ready?} returns @code{#t}.
3441@footnote{@code{char-ready?} exists to make it possible for a
3442program to accept characters from interactive ports without getting
3443stuck waiting for input. Any input editors associated with such ports
3444must make sure that characters whose existence has been asserted by
3445@code{char-ready?} cannot be rubbed out. If @code{char-ready?} were to
3446return @code{#f} at end of file, a port at end of file would be
3447indistinguishable from an interactive port that has no ready
3448characters.}
3449@end deffn
3450
3451\fdrain-input
3452@c snarfed from ports.c:312
3453@deffn primitive drain-input port
3454Drain @var{port}'s read buffers (including any pushed-back
3455characters) and returns the content as a single string.
3456@end deffn
3457
3458\fcurrent-input-port
3459@c snarfed from ports.c:339
3460@deffn primitive current-input-port
3461Return the current input port. This is the default port used
3462by many input procedures. Initially, @code{current-input-port}
3463returns the @dfn{standard input} in Unix and C terminology.
3464@end deffn
3465
3466\fcurrent-output-port
3467@c snarfed from ports.c:351
3468@deffn primitive current-output-port
3469Return the current output port. This is the default port used
3470by many output procedures. Initially,
3471@code{current-output-port} returns the @dfn{standard output} in
3472Unix and C terminology.
3473@end deffn
3474
3475\fcurrent-error-port
3476@c snarfed from ports.c:361
3477@deffn primitive current-error-port
3478Return the port to which errors and warnings should be sent (the
3479@dfn{standard error} in Unix and C terminology).
3480@end deffn
3481
3482\fcurrent-load-port
3483@c snarfed from ports.c:371
3484@deffn primitive current-load-port
3485Return the current-load-port.
3486The load port is used internally by @code{primitive-load}.
3487@end deffn
3488
3489\fset-current-input-port
3490@c snarfed from ports.c:384
3491@deffn primitive set-current-input-port port
3492@deffnx primitive set-current-output-port port
3493@deffnx primitive set-current-error-port port
3494Change the ports returned by @code{current-input-port},
3495@code{current-output-port} and @code{current-error-port}, respectively,
3496so that they use the supplied @var{port} for input or output.
3497@end deffn
3498
3499\fset-current-output-port
3500@c snarfed from ports.c:397
3501@deffn primitive set-current-output-port port
3502Set the current default output port to @var{port}.
3503@end deffn
3504
3505\fset-current-error-port
3506@c snarfed from ports.c:411
3507@deffn primitive set-current-error-port port
3508Set the current default error port to @var{port}.
3509@end deffn
3510
3511\fport-revealed
3512@c snarfed from ports.c:556
3513@deffn primitive port-revealed port
3514Returns the revealed count for @var{port}.
3515@end deffn
3516
3517\fset-port-revealed!
3518@c snarfed from ports.c:569
3519@deffn primitive set-port-revealed! port rcount
3520Sets the revealed count for a port to a given value.
3521The return value is unspecified.
3522@end deffn
3523
3524\fport-mode
3525@c snarfed from ports.c:612
3526@deffn primitive port-mode port
3527Returns the port modes associated with the open port @var{port}. These
3528will not necessarily be identical to the modes used when the port was
3529opened, since modes such as "append" which are used only during
3530port creation are not retained.
3531@end deffn
3532
3533\fclose-port
3534@c snarfed from ports.c:649
3535@deffn primitive close-port port
3536Close the specified port object. Returns @code{#t} if it successfully
3537closes a port or @code{#f} if it was already
3538closed. An exception may be raised if an error occurs, for example
3539when flushing buffered output.
3540See also @ref{Ports and File Descriptors, close}, for a procedure
3541which can close file descriptors.
3542@end deffn
3543
3544\fclose-input-port
3545@c snarfed from ports.c:677
3546@deffn primitive close-input-port port
3547Close the specified input port object. The routine has no effect if
3548the file has already been closed. An exception may be raised if an
3549error occurs. The value returned is unspecified.
3550
3551See also @ref{Ports and File Descriptors, close}, for a procedure
3552which can close file descriptors.
3553@end deffn
3554
3555\fclose-output-port
3556@c snarfed from ports.c:692
3557@deffn primitive close-output-port port
3558Close the specified output port object. The routine has no effect if
3559the file has already been closed. An exception may be raised if an
3560error occurs. The value returned is unspecified.
3561
3562See also @ref{Ports and File Descriptors, close}, for a procedure
3563which can close file descriptors.
3564@end deffn
3565
3566\fport-for-each
3567@c snarfed from ports.c:709
3568@deffn primitive port-for-each proc
3569Apply @var{proc} to each port in the Guile port table
3570in turn. The return value is unspecified. More specifically,
3571@var{proc} is applied exactly once to every port that exists
3572in the system at the time @var{port-for-each} is invoked.
3573Changes to the port table while @var{port-for-each} is running
3574have no effect as far as @var{port-for-each} is concerned.
3575@end deffn
3576
3577\fclose-all-ports-except
3578@c snarfed from ports.c:752
3579@deffn primitive close-all-ports-except . ports
3580[DEPRECATED] Close all open file ports used by the interpreter
3581except for those supplied as arguments. This procedure
3582was intended to be used before an exec call to close file descriptors
3583which are not needed in the new process. However it has the
3584undesirable side-effect of flushing buffes, so it's deprecated.
3585Use port-for-each instead.
3586@end deffn
3587
3588\finput-port?
3589@c snarfed from ports.c:791
3590@deffn primitive input-port? x
3591Returns @code{#t} if @var{x} is an input port, otherwise returns
3592@code{#f}. Any object satisfying this predicate also satisfies
3593@code{port?}.
3594@end deffn
3595
3596\foutput-port?
3597@c snarfed from ports.c:804
3598@deffn primitive output-port? x
3599Returns @code{#t} if @var{x} is an output port, otherwise returns
3600@code{#f}. Any object satisfying this predicate also satisfies
3601@code{port?}.
3602@end deffn
3603
3604\fport?
3605@c snarfed from ports.c:819
3606@deffn primitive port? x
3607Returns a boolean indicating whether @var{x} is a port.
3608Equivalent to @code{(or (input-port? @var{x}) (output-port?
3609@var{x}))}.
3610@end deffn
3611
3612\fport-closed?
3613@c snarfed from ports.c:828
3614@deffn primitive port-closed? port
3615Returns @code{#t} if @var{port} is closed or @code{#f} if it is open.
3616@end deffn
3617
3618\feof-object?
3619@c snarfed from ports.c:839
3620@deffn primitive eof-object? x
3621Returns @code{#t} if @var{x} is an end-of-file object; otherwise
3622returns @code{#f}.
3623@end deffn
3624
3625\fforce-output
3626@c snarfed from ports.c:853
3627@deffn primitive force-output [port]
3628Flush the specified output port, or the current output port if @var{port}
3629is omitted. The current output buffer contents are passed to the
3630underlying port implementation (e.g., in the case of fports, the
3631data will be written to the file and the output buffer will be cleared.)
3632It has no effect on an unbuffered port.
3633
3634The return value is unspecified.
3635@end deffn
3636
3637\fflush-all-ports
3638@c snarfed from ports.c:871
3639@deffn primitive flush-all-ports
3640Equivalent to calling @code{force-output} on
3641all open output ports. The return value is unspecified.
3642@end deffn
3643
3644\fread-char
3645@c snarfed from ports.c:889
3646@deffn primitive read-char [port]
3647Returns the next character available from @var{port}, updating
3648@var{port} to point to the following character. If no more
3649characters are available, an end-of-file object is returned.
3650@end deffn
3651
3652\fpeek-char
3653@c snarfed from ports.c:1205
3654@deffn primitive peek-char [port]
3655Returns the next character available from @var{port},
3656@emph{without} updating @var{port} to point to the following
3657character. If no more characters are available, an end-of-file object
3658is returned.@footnote{The value returned by a call to @code{peek-char}
3659is the same as the value that would have been returned by a call to
3660@code{read-char} on the same port. The only difference is that the very
3661next call to @code{read-char} or @code{peek-char} on that
3662@var{port} will return the value returned by the preceding call to
3663@code{peek-char}. In particular, a call to @code{peek-char} on an
3664interactive port will hang waiting for input whenever a call to
3665@code{read-char} would have hung.}
3666@end deffn
3667
3668\funread-char
3669@c snarfed from ports.c:1226
3670@deffn primitive unread-char cobj [port]
3671Place @var{char} in @var{port} so that it will be read by the
3672next read operation. If called multiple times, the unread characters
3673will be read again in last-in first-out order. If @var{port} is
3674not supplied, the current input port is used.
3675@end deffn
3676
3677\funread-string
3678@c snarfed from ports.c:1249
3679@deffn primitive unread-string str port
3680Place the string @var{str} in @var{port} so that its characters will be
3681read in subsequent read operations. If called multiple times, the
3682unread characters will be read again in last-in first-out order. If
3683@var{port} is not supplied, the current-input-port is used.
3684@end deffn
3685
3686\fseek
3687@c snarfed from ports.c:1285
3688@deffn primitive seek object offset whence
3689Sets the current position of @var{fd/port} to the integer @var{offset},
3690which is interpreted according to the value of @var{whence}.
3691
3692One of the following variables should be supplied
3693for @var{whence}:
3694@defvar SEEK_SET
3695Seek from the beginning of the file.
3696@end defvar
3697@defvar SEEK_CUR
3698Seek from the current position.
3699@end defvar
3700@defvar SEEK_END
3701Seek from the end of the file.
3702@end defvar
3703
3704If @var{fd/port} is a file descriptor, the underlying system call is
3705@code{lseek}. @var{port} may be a string port.
3706
3707The value returned is the new position in the file. This means that
3708the current position of a port can be obtained using:
3709@smalllisp
3710(seek port 0 SEEK_CUR)
3711@end smalllisp
3712@end deffn
3713
3714\ftruncate-file
3715@c snarfed from ports.c:1326
3716@deffn primitive truncate-file object [length]
3717Truncates the object referred to by @var{obj} to at most @var{size} bytes.
3718@var{obj} can be a string containing a file name or an integer file
3719descriptor or a port. @var{size} may be omitted if @var{obj} is not
3720a file name, in which case the truncation occurs at the current port.
3721position.
3722
3723The return value is unspecified.
3724@end deffn
3725
3726\fport-line
3727@c snarfed from ports.c:1380
3728@deffn primitive port-line port
3729Return the current line number for @var{port}.
3730@end deffn
3731
3732\fset-port-line!
3733@c snarfed from ports.c:1391
3734@deffn primitive set-port-line! port line
3735Set the current line number for @var{port} to @var{line}.
3736@end deffn
3737
3738\fport-column
3739@c snarfed from ports.c:1412
3740@deffn primitive port-column port
3741@deffnx primitive port-line port
3742Return the current column number or line number of @var{port},
3743using the current input port if none is specified. If the number is
3744unknown, the result is #f. Otherwise, the result is a 0-origin integer
3745- i.e. the first character of the first line is line 0, column 0.
3746(However, when you display a file position, for example in an error
3747message, we recommend you add 1 to get 1-origin integers. This is
3748because lines and column numbers traditionally start with 1, and that is
3749what non-programmers will find most natural.)
3750@end deffn
3751
3752\fset-port-column!
3753@c snarfed from ports.c:1425
3754@deffn primitive set-port-column! port column
3755@deffnx primitive set-port-line! port line
3756Set the current column or line number of @var{port}, using the
3757current input port if none is specified.
3758@end deffn
3759
3760\fport-filename
3761@c snarfed from ports.c:1440
3762@deffn primitive port-filename port
3763Return the filename associated with @var{port}. This function returns
3764the strings "standard input", "standard output" and "standard error"
3765when called on the current input, output and error ports respectively.
3766@end deffn
3767
3768\fset-port-filename!
3769@c snarfed from ports.c:1454
3770@deffn primitive set-port-filename! port filename
3771Change the filename associated with @var{port}, using the current input
3772port if none is specified. Note that this does not change the port's
3773source of data, but only the value that is returned by
3774@code{port-filename} and reported in diagnostic output.
3775@end deffn
3776
3777\f%make-void-port
3778@c snarfed from ports.c:1546
3779@deffn primitive %make-void-port mode
3780Create and return a new void port. A void port acts like
3781/dev/null. The @var{mode} argument
3782specifies the input/output modes for this port: see the
3783documentation for @code{open-file} in @ref{File Ports}.
3784@end deffn
3785
3786\fpipe
3787@c snarfed from posix.c:201
3788@deffn primitive pipe
3789Returns a newly created pipe: a pair of ports which are linked
3790together on the local machine. The CAR is the input port and
3791the CDR is the output port. Data written (and flushed) to the
3792output port can be read from the input port.
3793Pipes are commonly used for communication with a newly
3794forked child process. The need to flush the output port
3795can be avoided by making it unbuffered using @code{setvbuf}.
3796
3797Writes occur atomically provided the size of the data in
3798bytes is not greater than the value of @code{PIPE_BUF}
3799Note that the output port is likely to block if too much data
3800(typically equal to @code{PIPE_BUF}) has been written but not
3801yet read from the input port
3802@end deffn
3803
3804\fgetgroups
3805@c snarfed from posix.c:221
3806@deffn primitive getgroups
3807Returns a vector of integers representing the current supplimentary group IDs.
3808@end deffn
3809
3810\fgetpw
3811@c snarfed from posix.c:254
3812@deffn primitive getpw [user]
3813Look up an entry in the user database. @var{obj} can be an integer,
3814a string, or omitted, giving the behaviour of getpwuid, getpwnam
3815or getpwent respectively.
3816@end deffn
3817
3818\fsetpw
3819@c snarfed from posix.c:307
3820@deffn primitive setpw [arg]
3821If called with a true argument, initialize or reset the password data
3822stream. Otherwise, close the stream. The @code{setpwent} and
3823@code{endpwent} procedures are implemented on top of this.
3824@end deffn
3825
3826\fgetgr
3827@c snarfed from posix.c:326
3828@deffn primitive getgr [name]
3829Look up an entry in the group database. @var{obj} can be an integer,
3830a string, or omitted, giving the behaviour of getgrgid, getgrnam
3831or getgrent respectively.
3832@end deffn
3833
3834\fsetgr
3835@c snarfed from posix.c:367
3836@deffn primitive setgr [arg]
3837If called with a true argument, initialize or reset the group data
3838stream. Otherwise, close the stream. The @code{setgrent} and
3839@code{endgrent} procedures are implemented on top of this.
3840@end deffn
3841
3842\fkill
3843@c snarfed from posix.c:403
3844@deffn primitive kill pid sig
3845Sends a signal to the specified process or group of processes.
3846
3847@var{pid} specifies the processes to which the signal is sent:
3848
3849@table @r
3850@item @var{pid} greater than 0
3851The process whose identifier is @var{pid}.
3852@item @var{pid} equal to 0
3853All processes in the current process group.
3854@item @var{pid} less than -1
3855The process group whose identifier is -@var{pid}
3856@item @var{pid} equal to -1
3857If the process is privileged, all processes except for some special
3858system processes. Otherwise, all processes with the current effective
3859user ID.
3860@end table
3861
3862@var{sig} should be specified using a variable corresponding to
3863the Unix symbolic name, e.g.,
3864
3865@defvar SIGHUP
3866Hang-up signal.
3867@end defvar
3868
3869@defvar SIGINT
3870Interrupt signal.
3871@end defvar
3872@end deffn
3873
3874\fwaitpid
3875@c snarfed from posix.c:451
3876@deffn primitive waitpid pid [options]
3877This procedure collects status information from a child process which
3878has terminated or (optionally) stopped. Normally it will
3879suspend the calling process until this can be done. If more than one
3880child process is eligible then one will be chosen by the operating system.
3881
3882The value of @var{pid} determines the behaviour:
3883
3884@table @r
3885@item @var{pid} greater than 0
3886Request status information from the specified child process.
3887@item @var{pid} equal to -1 or WAIT_ANY
3888Request status information for any child process.
3889@item @var{pid} equal to 0 or WAIT_MYPGRP
3890Request status information for any child process in the current process
3891group.
3892@item @var{pid} less than -1
3893Request status information for any child process whose process group ID
3894is -@var{PID}.
3895@end table
3896
3897The @var{options} argument, if supplied, should be the bitwise OR of the
3898values of zero or more of the following variables:
3899
3900@defvar WNOHANG
3901Return immediately even if there are no child processes to be collected.
3902@end defvar
3903
3904@defvar WUNTRACED
3905Report status information for stopped processes as well as terminated
3906processes.
3907@end defvar
3908
3909The return value is a pair containing:
3910
3911@enumerate
3912@item
3913The process ID of the child process, or 0 if @code{WNOHANG} was
3914specified and no process was collected.
3915@item
3916The integer status value.
3917@end enumerate
3918@end deffn
3919
3920\fstatus:exit-val
3921@c snarfed from posix.c:478
3922@deffn primitive status:exit-val status
3923Returns the exit status value, as would be
3924set if a process ended normally through a
3925call to @code{exit} or @code{_exit}, if any, otherwise @code{#f}.
3926@end deffn
3927
3928\fstatus:term-sig
3929@c snarfed from posix.c:498
3930@deffn primitive status:term-sig status
3931Returns the signal number which terminated the
3932process, if any, otherwise @code{#f}.
3933@end deffn
3934
3935\fstatus:stop-sig
3936@c snarfed from posix.c:516
3937@deffn primitive status:stop-sig status
3938Returns the signal number which stopped the
3939process, if any, otherwise @code{#f}.
3940@end deffn
3941
3942\fgetppid
3943@c snarfed from posix.c:533
3944@deffn primitive getppid
3945Returns an integer representing the process ID of the parent process.
3946@end deffn
3947
3948\fgetuid
3949@c snarfed from posix.c:544
3950@deffn primitive getuid
3951Returns an integer representing the current real user ID.
3952@end deffn
3953
3954\fgetgid
3955@c snarfed from posix.c:555
3956@deffn primitive getgid
3957Returns an integer representing the current real group ID.
3958@end deffn
3959
3960\fgeteuid
3961@c snarfed from posix.c:569
3962@deffn primitive geteuid
3963Returns an integer representing the current effective user ID.
3964If the system does not support effective IDs, then the real ID
3965is returned. @code{(feature? 'EIDs)} reports whether the system
3966supports effective IDs.
3967@end deffn
3968
3969\fgetegid
3970@c snarfed from posix.c:587
3971@deffn primitive getegid
3972Returns an integer representing the current effective group ID.
3973If the system does not support effective IDs, then the real ID
3974is returned. @code{(feature? 'EIDs)} reports whether the system
3975supports effective IDs.
3976@end deffn
3977
3978\fsetuid
3979@c snarfed from posix.c:603
3980@deffn primitive setuid id
3981Sets both the real and effective user IDs to the integer @var{id}, provided
3982the process has appropriate privileges.
3983The return value is unspecified.
3984@end deffn
3985
3986\fsetgid
3987@c snarfed from posix.c:617
3988@deffn primitive setgid id
3989Sets both the real and effective group IDs to the integer @var{id}, provided
3990the process has appropriate privileges.
3991The return value is unspecified.
3992@end deffn
3993
3994\fseteuid
3995@c snarfed from posix.c:633
3996@deffn primitive seteuid id
3997Sets the effective user ID to the integer @var{id}, provided the process
3998has appropriate privileges. If effective IDs are not supported, the
3999real ID is set instead -- @code{(feature? 'EIDs)} reports whether the
4000system supports effective IDs.
4001The return value is unspecified.
4002@end deffn
4003
4004\fsetegid
4005@c snarfed from posix.c:657
4006@deffn primitive setegid id
4007Sets the effective group ID to the integer @var{id}, provided the process
4008has appropriate privileges. If effective IDs are not supported, the
4009real ID is set instead -- @code{(feature? 'EIDs)} reports whether the
4010system supports effective IDs.
4011The return value is unspecified.
4012@end deffn
4013
4014\fgetpgrp
4015@c snarfed from posix.c:679
4016@deffn primitive getpgrp
4017Returns an integer representing the current process group ID.
4018This is the POSIX definition, not BSD.
4019@end deffn
4020
4021\fsetpgid
4022@c snarfed from posix.c:695
4023@deffn primitive setpgid pid pgid
4024Move the process @var{pid} into the process group @var{pgid}. @var{pid} or
4025@var{pgid} must be integers: they can be zero to indicate the ID of the
4026current process.
4027Fails on systems that do not support job control.
4028The return value is unspecified.
4029@end deffn
4030
4031\fsetsid
4032@c snarfed from posix.c:714
4033@deffn primitive setsid
4034Creates a new session. The current process becomes the session leader
4035and is put in a new process group. The process will be detached
4036from its controlling terminal if it has one.
4037The return value is an integer representing the new process group ID.
4038@end deffn
4039
4040\fttyname
4041@c snarfed from posix.c:728
4042@deffn primitive ttyname port
4043Returns a string with the name of the serial terminal device underlying
4044@var{port}.
4045@end deffn
4046
4047\fctermid
4048@c snarfed from posix.c:751
4049@deffn primitive ctermid
4050Returns a string containing the file name of the controlling terminal
4051for the current process.
4052@end deffn
4053
4054\ftcgetpgrp
4055@c snarfed from posix.c:773
4056@deffn primitive tcgetpgrp port
4057Returns the process group ID of the foreground
4058process group associated with the terminal open on the file descriptor
4059underlying @var{port}.
4060
4061If there is no foreground process group, the return value is a
4062number greater than 1 that does not match the process group ID
4063of any existing process group. This can happen if all of the
4064processes in the job that was formerly the foreground job have
4065terminated, and no other job has yet been moved into the
4066foreground.
4067@end deffn
4068
4069\ftcsetpgrp
4070@c snarfed from posix.c:797
4071@deffn primitive tcsetpgrp port pgid
4072Set the foreground process group ID for the terminal used by the file
4073descriptor underlying @var{port} to the integer @var{pgid}.
4074The calling process
4075must be a member of the same session as @var{pgid} and must have the same
4076controlling terminal. The return value is unspecified.
4077@end deffn
4078
4079\fexecl
4080@c snarfed from posix.c:857
4081@deffn primitive execl filename . args
4082Executes the file named by @var{path} as a new process image.
4083The remaining arguments are supplied to the process; from a C program
4084they are accessable as the @code{argv} argument to @code{main}.
4085Conventionally the first @var{arg} is the same as @var{path}.
4086All arguments must be strings.
4087
4088If @var{arg} is missing, @var{path} is executed with a null
4089argument list, which may have system-dependent side-effects.
4090
4091This procedure is currently implemented using the @code{execv} system
4092call, but we call it @code{execl} because of its Scheme calling interface.
4093@end deffn
4094
4095\fexeclp
4096@c snarfed from posix.c:878
4097@deffn primitive execlp filename . args
4098Similar to @code{execl}, however if
4099@var{filename} does not contain a slash
4100then the file to execute will be located by searching the
4101directories listed in the @code{PATH} environment variable.
4102
4103This procedure is currently implemented using the @code{execvp} system
4104call, but we call it @code{execlp} because of its Scheme calling interface.
4105@end deffn
4106
4107\fexecle
4108@c snarfed from posix.c:929
4109@deffn primitive execle filename env . args
4110Similar to @code{execl}, but the environment of the new process is
4111specified by @var{env}, which must be a list of strings as returned by the
4112@code{environ} procedure.
4113
4114This procedure is currently implemented using the @code{execve} system
4115call, but we call it @code{execle} because of its Scheme calling interface.
4116@end deffn
4117
4118\fprimitive-fork
4119@c snarfed from posix.c:953
4120@deffn primitive primitive-fork
4121Creates a new "child" process by duplicating the current "parent" process.
4122In the child the return value is 0. In the parent the return value is
4123the integer process ID of the child.
4124
4125This procedure has been renamed from @code{fork} to avoid a naming conflict
4126with the scsh fork.
4127@end deffn
4128
4129\funame
4130@c snarfed from posix.c:968
4131@deffn primitive uname
4132Returns an object with some information about the computer system the
4133program is running on.
4134@end deffn
4135
4136\fenviron
4137@c snarfed from posix.c:997
4138@deffn primitive environ [env]
4139If @var{env} is omitted, returns the current environment as a list of strings.
4140Otherwise it sets the current environment, which is also the
4141default environment for child processes, to the supplied list of strings.
4142Each member of @var{env} should be of the form
4143@code{NAME=VALUE} and values of @code{NAME} should not be duplicated.
4144If @var{env} is supplied then the return value is unspecified.
4145@end deffn
4146
4147\ftmpnam
4148@c snarfed from posix.c:1035
4149@deffn primitive tmpnam
4150tmpnam returns a name in the file system that does not match
4151any existing file. However there is no guarantee that
4152another process will not create the file after tmpnam
4153is called. Care should be taken if opening the file,
4154e.g., use the O_EXCL open flag or use @code{mkstemp!} instead.
4155@end deffn
4156
4157\fmkstemp!
4158@c snarfed from posix.c:1058
4159@deffn primitive mkstemp! tmpl
4160mkstemp creates a new unique file in the file system and
4161returns a new buffered port open for reading and writing to
4162the file. @var{tmpl} is a string specifying where the
4163file should be created: it must end with @code{XXXXXX}
4164and will be changed in place to return the name of the
4165temporary file.
4166@end deffn
4167
4168\futime
4169@c snarfed from posix.c:1086
4170@deffn primitive utime pathname [actime [modtime]]
4171@code{utime} sets the access and modification times for
4172the file named by @var{path}. If @var{actime} or @var{modtime}
4173is not supplied, then the current time is used.
4174@var{actime} and @var{modtime}
4175must be integer time values as returned by the @code{current-time}
4176procedure.
4177
4178E.g.,
4179
4180@smalllisp
4181(utime "foo" (- (current-time) 3600))
4182@end smalllisp
4183
4184will set the access time to one hour in the past and the modification
4185time to the current time.
4186@end deffn
4187
4188\faccess?
4189@c snarfed from posix.c:1135
4190@deffn primitive access? path how
4191Returns @code{#t} if @var{path} corresponds to an existing
4192file and the current process
4193has the type of access specified by @var{how}, otherwise
4194@code{#f}.
4195@var{how} should be specified
4196using the values of the variables listed below. Multiple values can
4197be combined using a bitwise or, in which case @code{#t} will only
4198be returned if all accesses are granted.
4199
4200Permissions are checked using the real id of the current process,
4201not the effective id, although it's the effective id which determines
4202whether the access would actually be granted.
4203
4204@defvar R_OK
4205test for read permission.
4206@end defvar
4207@defvar W_OK
4208test for write permission.
4209@end defvar
4210@defvar X_OK
4211test for execute permission.
4212@end defvar
4213@defvar F_OK
4214test for existence of the file.
4215@end defvar
4216@end deffn
4217
4218\fgetpid
4219@c snarfed from posix.c:1150
4220@deffn primitive getpid
4221Returns an integer representing the current process ID.
4222@end deffn
4223
4224\fputenv
4225@c snarfed from posix.c:1167
4226@deffn primitive putenv str
4227Modifies the environment of the current process, which is
4228also the default environment inherited by child processes.
4229
4230If @var{string} is of the form @code{NAME=VALUE} then it will be written
4231directly into the environment, replacing any existing environment string
4232with
4233name matching @code{NAME}. If @var{string} does not contain an equal
4234sign, then any existing string with name matching @var{string} will
4235be removed.
4236
4237The return value is unspecified.
4238@end deffn
4239
4240\fsetlocale
4241@c snarfed from posix.c:1198
4242@deffn primitive setlocale category [locale]
4243If @var{locale} is omitted, returns the current value of the specified
4244locale category
4245as a system-dependent string.
4246@var{category} should be specified using the values @code{LC_COLLATE},
4247@code{LC_ALL} etc.
4248
4249Otherwise the specified locale category is set to
4250the string @var{locale}
4251and the new value is returned as a system-dependent string. If @var{locale}
4252is an empty string, the locale will be set using envirionment variables.
4253@end deffn
4254
4255\fmknod
4256@c snarfed from posix.c:1239
4257@deffn primitive mknod path type perms dev
4258Creates a new special file, such as a file corresponding to a device.
4259@var{path} specifies the name of the file. @var{type} should
4260be one of the following symbols:
4261regular, directory, symlink, block-special, char-special,
4262fifo, or socket. @var{perms} (an integer) specifies the file permissions.
4263@var{dev} (an integer) specifies which device the special file refers
4264to. Its exact interpretation depends on the kind of special file
4265being created.
4266
4267E.g.,
4268@example
4269(mknod "/dev/fd0" 'block-special #o660 (+ (* 2 256) 2))
4270@end example
4271
4272The return value is unspecified.
4273@end deffn
4274
4275\fnice
4276@c snarfed from posix.c:1286
4277@deffn primitive nice incr
4278Increment the priority of the current process by @var{incr}. A higher
4279priority value means that the process runs less often.
4280The return value is unspecified.
4281@end deffn
4282
4283\fsync
4284@c snarfed from posix.c:1301
4285@deffn primitive sync
4286Flush the operating system disk buffers.
4287The return value is unspecified.
4288@end deffn
4289
4290\fcrypt
4291@c snarfed from posix.c:1314
4292@deffn primitive crypt key salt
4293Encrypt @var{key} using @var{salt} as the salt value to the
4294crypt(3) library call
4295@end deffn
4296
4297\fchroot
4298@c snarfed from posix.c:1337
4299@deffn primitive chroot path
4300Change the root directory to that specified in @var{path}.
4301This directory will be used for path names beginning with
4302@file{/}. The root directory is inherited by all children
4303of the current process. Only the superuser may change the
4304root directory.
4305@end deffn
4306
4307\fgetlogin
4308@c snarfed from posix.c:1355
4309@deffn primitive getlogin
4310Return a string containing the name of the user logged in on
4311the controlling terminal of the process, or @code{#f} if this
4312information cannot be obtained.
4313@end deffn
4314
4315\fcuserid
4316@c snarfed from posix.c:1373
4317@deffn primitive cuserid
4318Return a string containing a user name associated with the
4319effective user id of the process. Return @code{#f} if this
4320information cannot be obtained.
4321@end deffn
4322
4323\fgetpriority
4324@c snarfed from posix.c:1398
4325@deffn primitive getpriority which who
4326Return the scheduling priority of the process, process group
4327or user, as indicated by @var{which} and @var{who}. @var{which}
4328is one of the variables @code{PRIO_PROCESS}, @code{PRIO_PGRP}
4329or @code{PRIO_USER}, and @var{who} is interpreted relative to
4330@var{which} (a process identifier for @code{PRIO_PROCESS},
4331process group identifier for @code{PRIO_PGRP}, and a user
4332identifier for @code{PRIO_USER}. A zero value of @var{who}
4333denotes the current process, process group, or user. Return
4334the highest priority (lowest numerical value) of any of the
4335specified processes.
4336@end deffn
4337
4338\fsetpriority
4339@c snarfed from posix.c:1432
4340@deffn primitive setpriority which who prio
4341Set the scheduling priority of the process, process group
4342or user, as indicated by @var{which} and @var{who}. @var{which}
4343is one of the variables @code{PRIO_PROCESS}, @code{PRIO_PGRP}
4344or @code{PRIO_USER}, and @var{who} is interpreted relative to
4345@var{which} (a process identifier for @code{PRIO_PROCESS},
4346process group identifier for @code{PRIO_PGRP}, and a user
4347identifier for @code{PRIO_USER}. A zero value of @var{who}
4348denotes the current process, process group, or user.
4349@var{prio} is a value in the range -20 and 20, the default
4350priority is 0; lower priorities cause more favorable
4351scheduling. Sets the priority of all of the specified
4352processes. Only the super-user may lower priorities.
4353The return value is not specified.
4354@end deffn
4355
4356\fgetpass
4357@c snarfed from posix.c:1457
4358@deffn primitive getpass prompt
4359Display @var{prompt} to the standard error output and read
4360a password from @file{/dev/tty}. If this file is not
4361accessible, it reads from standard input. The password may be
4362up to 127 characters in length. Additional characters and the
4363terminating newline character are discarded. While reading
4364the password, echoing and the generation of signals by special
4365characters is disabled.
4366@end deffn
4367
4368\fflock
4369@c snarfed from posix.c:1496
4370@deffn primitive flock file operation
4371Apply or remove an advisory lock on an open file.
4372@var{operation} specifies the action to be done:
4373@table @code
4374@item LOCK_SH
4375Shared lock. More than one process may hold a shared lock
4376for a given file at a given time.
4377@item LOCK_EX
4378Exclusive lock. Only one process may hold an exclusive lock
4379for a given file at a given time.
4380@item LOCK_UN
4381Unlock the file.
4382@item LOCK_NB
4383Don't block when locking. May be specified by bitwise OR'ing
4384it to one of the other operations.
4385@end table
4386The return value is not specified. @var{file} may be an open
4387file descriptor or an open file descriptior port.
4388@end deffn
4389
4390\fsethostname
4391@c snarfed from posix.c:1522
4392@deffn primitive sethostname name
4393Set the host name of the current processor to @var{name}. May
4394only be used by the superuser. The return value is not
4395specified.
4396@end deffn
4397
4398\fgethostname
4399@c snarfed from posix.c:1538
4400@deffn primitive gethostname
4401Return the host name of the current processor.
4402@end deffn
4403
4404\fprint-options-interface
4405@c snarfed from print.c:142
4406@deffn primitive print-options-interface [setting]
4407Option interface for the print options. Instead of using
4408this procedure directly, use the procedures
4409@code{print-enable}, @code{print-disable}, @code{print-set!}
4410and @code{print-options}.
4411@end deffn
4412
4413\fsimple-format
4414@c snarfed from print.c:980
4415@deffn primitive simple-format destination message . args
4416Write @var{message} to @var{destination}, defaulting to
4417the current output port.
4418@var{message} can contain @code{~A} (was @code{%s}) and
4419@code{~S} (was @code{%S}) escapes. When printed,
4420the escapes are replaced with corresponding members of
4421@var{ARGS}:
4422@code{~A} formats using @code{display} and @code{~S} formats
4423using @code{write}.
4424If @var{destination} is @code{#t}, then use the current output
4425port, if @var{destination} is @code{#f}, then return a string
4426containing the formatted text. Does not add a trailing newline.
4427@end deffn
4428
4429\fnewline
4430@c snarfed from print.c:1045
4431@deffn primitive newline [port]
4432Send a newline to @var{port}.
4433@end deffn
4434
4435\fwrite-char
4436@c snarfed from print.c:1060
4437@deffn primitive write-char chr [port]
4438Send character @var{chr} to @var{port}.
4439@end deffn
4440
4441\fport-with-print-state
4442@c snarfed from print.c:1114
4443@deffn primitive port-with-print-state port pstate
4444Create a new port which behaves like @var{port}, but with an
4445included print state @var{pstate}.
4446@end deffn
4447
4448\fget-print-state
4449@c snarfed from print.c:1129
4450@deffn primitive get-print-state port
4451Return the print state of the port @var{port}. If @var{port}
4452has no associated print state, @code{#f} is returned.
4453@end deffn
4454
4455\fprocedure-properties
4456@c snarfed from procprop.c:180
4457@deffn primitive procedure-properties proc
4458Return @var{obj}'s property list.
4459@end deffn
4460
4461\fset-procedure-properties!
4462@c snarfed from procprop.c:193
4463@deffn primitive set-procedure-properties! proc new_val
4464Set @var{obj}'s property list to @var{alist}.
4465@end deffn
4466
4467\fprocedure-property
4468@c snarfed from procprop.c:206
4469@deffn primitive procedure-property p k
4470Return the property of @var{obj} with name @var{key}.
4471@end deffn
4472
4473\fset-procedure-property!
4474@c snarfed from procprop.c:229
4475@deffn primitive set-procedure-property! p k v
4476In @var{obj}'s property list, set the property named @var{key} to
4477@var{value}.
4478@end deffn
4479
4480\fprocedure?
4481@c snarfed from procs.c:196
4482@deffn primitive procedure? obj
4483Return @code{#t} if @var{obj} is a procedure.
4484@end deffn
4485
4486\fclosure?
4487@c snarfed from procs.c:223
4488@deffn primitive closure? obj
4489Return @code{#t} if @var{obj} is a closure.
4490@end deffn
4491
4492\fthunk?
4493@c snarfed from procs.c:232
4494@deffn primitive thunk? obj
4495Return @code{#t} if @var{obj} is a thunk.
4496@end deffn
4497
4498\fprocedure-documentation
4499@c snarfed from procs.c:283
4500@deffn primitive procedure-documentation proc
4501Return the documentation string associated with @code{proc}. By
4502convention, if a procedure contains more than one expression and the
4503first expression is a string constant, that string is assumed to contain
4504documentation for that procedure.
4505@end deffn
4506
4507\fprocedure-with-setter?
4508@c snarfed from procs.c:319
4509@deffn primitive procedure-with-setter? obj
4510Return @code{#t} if @var{obj} is a procedure with an
4511associated setter procedure.
4512@end deffn
4513
4514\fmake-procedure-with-setter
4515@c snarfed from procs.c:329
4516@deffn primitive make-procedure-with-setter procedure setter
4517Create a new procedure which behaves like @var{procedure}, but
4518with the associated setter @var{setter}.
4519@end deffn
4520
4521\fprocedure
4522@c snarfed from procs.c:348
4523@deffn primitive procedure proc
4524Return the procedure of @var{proc}, which must be either a
4525procedure with setter, or an operator struct.
4526@end deffn
4527
4528\fprimitive-make-property
4529@c snarfed from properties.c:66
4530@deffn primitive primitive-make-property not_found_proc
4531Create a @dfn{property token} that can be used with
4532@code{primitive-property-ref} and @code{primitive-property-set!}.
4533See @code{primitive-property-ref} for the significance of
4534@var{not_found_proc}.
4535@end deffn
4536
4537\fprimitive-property-ref
4538@c snarfed from properties.c:83
4539@deffn primitive primitive-property-ref prop obj
4540Return the property @var{prop} of @var{obj}. When no value
4541has yet been associated with @var{prop} and @var{obj}, call
4542@var{not-found-proc} instead (see @code{primitive-make-property})
4543and use its return value. That value is also associated with
4544@var{obj} via @code{primitive-property-set!}. When
4545@var{not-found-proc} is @code{#f}, use @code{#f} as the
4546default value of @var{prop}.
4547@end deffn
4548
4549\fprimitive-property-set!
4550@c snarfed from properties.c:111
4551@deffn primitive primitive-property-set! prop obj val
4552Associate @var{code} with @var{prop} and @var{obj}.
4553@end deffn
4554
4555\fprimitive-property-del!
4556@c snarfed from properties.c:131
4557@deffn primitive primitive-property-del! prop obj
4558Remove any value associated with @var{prop} and @var{obj}.
4559@end deffn
4560
4561\farray-fill!
4562@c snarfed from ramap.c:467
4563@deffn primitive array-fill! ra fill
4564Stores @var{fill} in every element of @var{array}. The value returned
4565is unspecified.
4566@end deffn
4567
4568\farray-copy-in-order!
4569@c snarfed from ramap.c:832
4570@deffn primitive array-copy-in-order!
4571scm_array_copy_x
4572@end deffn
4573
4574\farray-copy!
4575@c snarfed from ramap.c:841
4576@deffn primitive array-copy! src dst
4577@deffnx primitive array-copy-in-order! src dst
4578Copies every element from vector or array @var{source} to the
4579corresponding element of @var{destination}. @var{destination} must have
4580the same rank as @var{source}, and be at least as large in each
4581dimension. The order is unspecified.
4582@end deffn
4583
4584\farray-map-in-order!
4585@c snarfed from ramap.c:1515
4586@deffn primitive array-map-in-order!
4587scm_array_map_x
4588@end deffn
4589
4590\farray-map!
4591@c snarfed from ramap.c:1526
4592@deffn primitive array-map! ra0 proc . lra
4593@deffnx primitive array-map-in-order! ra0 proc . lra
4594@var{array1}, @dots{} must have the same number of dimensions as
4595@var{array0} and have a range for each index which includes the range
4596for the corresponding index in @var{array0}. @var{proc} is applied to
4597each tuple of elements of @var{array1} @dots{} and the result is stored
4598as the corresponding element in @var{array0}. The value returned is
4599unspecified. The order of application is unspecified.
4600@end deffn
4601
4602\farray-for-each
4603@c snarfed from ramap.c:1673
4604@deffn primitive array-for-each proc ra0 . lra
4605@var{proc} is applied to each tuple of elements of @var{array0} @dots{}
4606in row-major order. The value returned is unspecified.
4607@end deffn
4608
4609\farray-index-map!
4610@c snarfed from ramap.c:1701
4611@deffn primitive array-index-map! ra proc
4612applies @var{proc} to the indices of each element of @var{array} in
4613turn, storing the result in the corresponding element. The value
4614returned and the order of application are unspecified.
4615
4616One can implement @var{array-indexes} as
4617@example
4618(define (array-indexes array)
4619 (let ((ra (apply make-array #f (array-shape array))))
4620 (array-index-map! ra (lambda x x))
4621 ra))
4622@end example
4623Another example:
4624@example
4625(define (apl:index-generator n)
4626 (let ((v (make-uniform-vector n 1)))
4627 (array-index-map! v (lambda (i) i))
4628 v))
4629@end example
4630@end deffn
4631
4632\frandom
4633@c snarfed from random.c:370
4634@deffn primitive random n [state]
4635Return a number in [0,N).
4636Accepts a positive integer or real n and returns a
4637number of the same type between zero (inclusive) and
4638N (exclusive). The values returned have a uniform
4639distribution.
4640The optional argument @var{state} must be of the type produced
4641by @code{seed->random-state}. It defaults to the value of the
4642variable @var{*random-state*}. This object is used to maintain
4643the state of the pseudo-random-number generator and is altered
4644as a side effect of the random operation.
4645@end deffn
4646
4647\fcopy-random-state
4648@c snarfed from random.c:393
4649@deffn primitive copy-random-state [state]
4650Return a copy of the random state @var{state}.
4651@end deffn
4652
4653\fseed->random-state
4654@c snarfed from random.c:405
4655@deffn primitive seed->random-state seed
4656Return a new random state using @var{seed}.
4657@end deffn
4658
4659\frandom:uniform
4660@c snarfed from random.c:418
4661@deffn primitive random:uniform [state]
4662Returns a uniformly distributed inexact real random number in [0,1).
4663@end deffn
4664
4665\frandom:normal
4666@c snarfed from random.c:433
4667@deffn primitive random:normal [state]
4668Returns an inexact real in a normal distribution.
4669The distribution used has mean 0 and standard deviation 1.
4670For a normal distribution with mean m and standard deviation
4671d use @code{(+ m (* d (random:normal)))}.
4672@end deffn
4673
4674\frandom:solid-sphere!
4675@c snarfed from random.c:489
4676@deffn primitive random:solid-sphere! v [state]
4677Fills vect with inexact real random numbers
4678the sum of whose squares is less than 1.0.
4679Thinking of vect as coordinates in space of
4680dimension n = (vector-length vect), the coordinates
4681are uniformly distributed within the unit n-shere.
4682The sum of the squares of the numbers is returned.
4683@end deffn
4684
4685\frandom:hollow-sphere!
4686@c snarfed from random.c:512
4687@deffn primitive random:hollow-sphere! v [state]
4688Fills vect with inexact real random numbers
4689the sum of whose squares is equal to 1.0.
4690Thinking of vect as coordinates in space of
4691dimension n = (vector-length vect), the coordinates
4692are uniformly distributed over the surface of the
4693unit n-shere.
4694@end deffn
4695
4696\frandom:normal-vector!
4697@c snarfed from random.c:530
4698@deffn primitive random:normal-vector! v [state]
4699Fills vect with inexact real random numbers that are
4700independent and standard normally distributed
4701(i.e., with mean 0 and variance 1).
4702@end deffn
4703
4704\frandom:exp
4705@c snarfed from random.c:554
4706@deffn primitive random:exp [state]
4707Returns an inexact real in an exponential distribution with mean 1.
4708For an exponential distribution with mean u use (* u (random:exp)).
4709@end deffn
4710
4711\f%read-delimited!
4712@c snarfed from rdelim.c:78
4713@deffn primitive %read-delimited! delims str gobble [port [start [end]]]
4714Read characters from @var{port} into @var{str} until one of the
4715characters in the @var{delims} string is encountered. If
4716@var{gobble} is true, discard the delimiter character;
4717otherwise, leave it in the input stream for the next read. If
4718@var{port} is not specified, use the value of
4719@code{(current-input-port)}. If @var{start} or @var{end} are
4720specified, store data only into the substring of @var{str}
4721bounded by @var{start} and @var{end} (which default to the
4722beginning and end of the string, respectively).
4723 Return a pair consisting of the delimiter that terminated the
4724string and the number of characters read. If reading stopped
4725at the end of file, the delimiter returned is the
4726@var{eof-object}; if the string was filled without encountering
4727a delimiter, this value is @code{#f}.
4728@end deffn
4729
4730\f%read-line
4731@c snarfed from rdelim.c:223
4732@deffn primitive %read-line [port]
4733Read a newline-terminated line from @var{port}, allocating storage as
4734necessary. The newline terminator (if any) is removed from the string,
4735and a pair consisting of the line and its delimiter is returned. The
4736delimiter may be either a newline or the @var{eof-object}; if
4737@code{%read-line} is called at the end of file, it returns the pair
4738@code{(#<eof> . #<eof>)}.
4739@end deffn
4740
4741\fwrite-line
4742@c snarfed from rdelim.c:277
4743@deffn primitive write-line obj [port]
4744Display @var{obj} and a newline character to @var{port}. If @var{port}
4745is not specified, @code{(current-output-port)} is used. This function
4746is equivalent to:
4747
4748@smalllisp
4749(display obj [port])
4750(newline [port])
4751@end smalllisp
4752@end deffn
4753
4754\fread-options-interface
4755@c snarfed from read.c:84
4756@deffn primitive read-options-interface [setting]
4757Option interface for the read options. Instead of using
4758this procedure directly, use the procedures @code{read-enable},
4759@code{read-disable}, @code{read-set!} and @var{read-options}.
4760@end deffn
4761
4762\fread
4763@c snarfed from read.c:104
4764@deffn primitive read [port]
4765Read an s-expression from the input port @var{port}, or from
4766the current input port if @var{port} is not specified.
4767Any whitespace before the next token is discarded.
4768@end deffn
4769
4770\fread-hash-extend
4771@c snarfed from read.c:746
4772@deffn primitive read-hash-extend chr proc
4773Install the procedure @var{proc} for reading expressions
4774starting with the character sequence @code{#} and @var{chr}.
4775@var{proc} will be called with two arguments: the character
4776@var{chr} and the port to read further data from. The object
4777returned will be the return value of @code{read}.
4778@end deffn
4779
4780\fregexp?
4781@c snarfed from regex-posix.c:139
4782@deffn primitive regexp? x
4783Return @code{#t} if @var{obj} is a compiled regular expression, or
4784@code{#f} otherwise.
4785@end deffn
4786
4787\fmake-regexp
4788@c snarfed from regex-posix.c:179
4789@deffn primitive make-regexp pat . flags
4790Compile the regular expression described by @var{str}, and return the
4791compiled regexp structure. If @var{str} does not describe a legal
4792regular expression, @code{make-regexp} throws a
4793@code{regular-expression-syntax} error.
4794
4795The @var{flag} arguments change the behavior of the compiled regexp.
4796The following flags may be supplied:
4797
4798@table @code
4799@item regexp/icase
4800Consider uppercase and lowercase letters to be the same when matching.
4801
4802@item regexp/newline
4803If a newline appears in the target string, then permit the @samp{^} and
4804@samp{$} operators to match immediately after or immediately before the
4805newline, respectively. Also, the @samp{.} and @samp{[^...]} operators
4806will never match a newline character. The intent of this flag is to
4807treat the target string as a buffer containing many lines of text, and
4808the regular expression as a pattern that may match a single one of those
4809lines.
4810
4811@item regexp/basic
4812Compile a basic (``obsolete'') regexp instead of the extended
4813(``modern'') regexps that are the default. Basic regexps do not
4814consider @samp{|}, @samp{+} or @samp{?} to be special characters, and
4815require the @samp{@{...@}} and @samp{(...)} metacharacters to be
4816backslash-escaped (@pxref{Backslash Escapes}). There are several other
4817differences between basic and extended regular expressions, but these
4818are the most significant.
4819
4820@item regexp/extended
4821Compile an extended regular expression rather than a basic regexp. This
4822is the default behavior; this flag will not usually be needed. If a
4823call to @code{make-regexp} includes both @code{regexp/basic} and
4824@code{regexp/extended} flags, the one which comes last will override
4825the earlier one.
4826@end table
4827@end deffn
4828
4829\fregexp-exec
4830@c snarfed from regex-posix.c:226
4831@deffn primitive regexp-exec rx str [start [flags]]
4832Match the compiled regular expression @var{regexp} against @code{str}.
4833If the optional integer @var{start} argument is provided, begin matching
4834from that position in the string. Return a match structure describing
4835the results of the match, or @code{#f} if no match could be found.
4836@end deffn
4837
4838\fcall-with-dynamic-root
4839@c snarfed from root.c:358
4840@deffn primitive call-with-dynamic-root thunk handler
4841Evaluate @code{(thunk)} in a new dynamic context, returning its value.
4842
4843If an error occurs during evaluation, apply @var{handler} to the
4844arguments to the throw, just as @code{throw} would. If this happens,
4845@var{handler} is called outside the scope of the new root -- it is
4846called in the same dynamic context in which
4847@code{call-with-dynamic-root} was evaluated.
4848
4849If @var{thunk} captures a continuation, the continuation is rooted at
4850the call to @var{thunk}. In particular, the call to
4851@code{call-with-dynamic-root} is not captured. Therefore,
4852@code{call-with-dynamic-root} always returns at most one time.
4853
4854Before calling @var{thunk}, the dynamic-wind chain is un-wound back to
4855the root and a new chain started for @var{thunk}. Therefore, this call
4856may not do what you expect:
4857
4858@example
4859;; Almost certainly a bug:
4860(with-output-to-port
4861 some-port
4862
4863 (lambda ()
4864 (call-with-dynamic-root
4865 (lambda ()
4866 (display 'fnord)
4867 (newline))
4868 (lambda (errcode) errcode))))
4869@end example
4870
4871The problem is, on what port will @samp{fnord} be displayed? You
4872might expect that because of the @code{with-output-to-port} that
4873it will be displayed on the port bound to @code{some-port}. But it
4874probably won't -- before evaluating the thunk, dynamic winds are
4875unwound, including those created by @code{with-output-to-port}.
4876So, the standard output port will have been re-set to its default value
4877before @code{display} is evaluated.
4878
4879(This function was added to Guile mostly to help calls to functions in C
4880libraries that can not tolerate non-local exits or calls that return
4881multiple times. If such functions call back to the interpreter, it should
4882be under a new dynamic root.)
4883@end deffn
4884
4885\fdynamic-root
4886@c snarfed from root.c:371
4887@deffn primitive dynamic-root
4888Return an object representing the current dynamic root.
4889
4890These objects are only useful for comparison using @code{eq?}.
4891They are currently represented as numbers, but your code should
4892in no way depend on this.
4893@end deffn
4894
4895\fsigaction
4896@c snarfed from scmsigs.c:201
4897@deffn primitive sigaction signum [handler [flags]]
4898Install or report the signal handler for a specified signal.
4899
4900@var{signum} is the signal number, which can be specified using the value
4901of variables such as @code{SIGINT}.
4902
4903If @var{action} is omitted, @code{sigaction} returns a pair: the
4904CAR is the current
4905signal hander, which will be either an integer with the value @code{SIG_DFL}
4906(default action) or @code{SIG_IGN} (ignore), or the Scheme procedure which
4907handles the signal, or @code{#f} if a non-Scheme procedure handles the
4908signal. The CDR contains the current @code{sigaction} flags for the handler.
4909
4910If @var{action} is provided, it is installed as the new handler for
4911@var{signum}. @var{action} can be a Scheme procedure taking one
4912argument, or the value of @code{SIG_DFL} (default action) or
4913@code{SIG_IGN} (ignore), or @code{#f} to restore whatever signal handler
4914was installed before @code{sigaction} was first used. Flags can
4915optionally be specified for the new handler (@code{SA_RESTART} will
4916always be added if it's available and the system is using restartable
4917system calls.) The return value is a pair with information about the
4918old handler as described above.
4919
4920This interface does not provide access to the "signal blocking"
4921facility. Maybe this is not needed, since the thread support may
4922provide solutions to the problem of consistent access to data
4923structures.
4924@end deffn
4925
4926\frestore-signals
4927@c snarfed from scmsigs.c:360
4928@deffn primitive restore-signals
4929Return all signal handlers to the values they had before any call to
4930@code{sigaction} was made. The return value is unspecified.
4931@end deffn
4932
4933\falarm
4934@c snarfed from scmsigs.c:399
4935@deffn primitive alarm i
4936Set a timer to raise a @code{SIGALRM} signal after the specified
4937number of seconds (an integer). It's advisable to install a signal
4938handler for
4939@code{SIGALRM} beforehand, since the default action is to terminate
4940the process.
4941
4942The return value indicates the time remaining for the previous alarm,
4943if any. The new value replaces the previous alarm. If there was
4944no previous alarm, the return value is zero.
4945@end deffn
4946
4947\fpause
4948@c snarfed from scmsigs.c:414
4949@deffn primitive pause
4950Pause the current process (thread?) until a signal arrives whose
4951action is to either terminate the current process or invoke a
4952handler procedure. The return value is unspecified.
4953@end deffn
4954
4955\fsleep
4956@c snarfed from scmsigs.c:427
4957@deffn primitive sleep i
4958Wait for the given number of seconds (an integer) or until a signal
4959arrives. The return value is zero if the time elapses or the number
4960of seconds remaining otherwise.
4961@end deffn
4962
4963\fusleep
4964@c snarfed from scmsigs.c:445
4965@deffn primitive usleep i
4966Sleep for I microseconds. @code{usleep} is not available on
4967all platforms.
4968@end deffn
4969
4970\fraise
4971@c snarfed from scmsigs.c:475
4972@deffn primitive raise sig
4973Sends a specified signal @var{sig} to the current process, where
4974@var{sig} is as described for the kill procedure.
4975@end deffn
4976
4977\fsystem
4978@c snarfed from simpos.c:76
4979@deffn primitive system [cmd]
4980Executes @var{cmd} using the operating system's "command processor".
4981Under Unix this is usually the default shell @code{sh}. The value
4982returned is @var{cmd}'s exit status as returned by @code{waitpid}, which
4983can be interpreted using the functions above.
4984
4985If @code{system} is called without arguments, it returns a boolean
4986indicating whether the command processor is available.
4987@end deffn
4988
4989\fgetenv
4990@c snarfed from simpos.c:104
4991@deffn primitive getenv nam
4992Looks up the string @var{name} in the current environment. The return
4993value is @code{#f} unless a string of the form @code{NAME=VALUE} is
4994found, in which case the string @code{VALUE} is returned.
4995@end deffn
4996
4997\fprimitive-exit
4998@c snarfed from simpos.c:120
4999@deffn primitive primitive-exit [status]
5000Terminate the current process without unwinding the Scheme stack.
5001This is would typically be useful after a fork. The exit status
5002is @var{status} if supplied, otherwise zero.
5003@end deffn
5004
5005\fhtons
5006@c snarfed from socket.c:89
5007@deffn primitive htons in
5008Returns a new integer from @var{value} by converting from host to
5009network order. @var{value} must be within the range of a C unsigned
5010short integer.
5011@end deffn
5012
5013\fntohs
5014@c snarfed from socket.c:106
5015@deffn primitive ntohs in
5016Returns a new integer from @var{value} by converting from network to
5017host order. @var{value} must be within the range of a C unsigned short
5018integer.
5019@end deffn
5020
5021\fhtonl
5022@c snarfed from socket.c:123
5023@deffn primitive htonl in
5024Returns a new integer from @var{value} by converting from host to
5025network order. @var{value} must be within the range of a C unsigned
5026long integer.
5027@end deffn
5028
5029\fntohl
5030@c snarfed from socket.c:135
5031@deffn primitive ntohl in
5032Returns a new integer from @var{value} by converting from network to
5033host order. @var{value} must be within the range of a C unsigned
5034long integer.
5035@end deffn
5036
5037\fsocket
5038@c snarfed from socket.c:158
5039@deffn primitive socket family style proto
5040Returns a new socket port of the type specified by @var{family}, @var{style}
5041and @var{protocol}. All three parameters are integers. Typical values
5042for @var{family} are the values of @code{AF_UNIX}
5043and @code{AF_INET}. Typical values for @var{style} are
5044the values of @code{SOCK_STREAM}, @code{SOCK_DGRAM} and @code{SOCK_RAW}.
5045
5046@var{protocol} can be obtained from a protocol name using
5047@code{getprotobyname}. A value of
5048zero specifies the default protocol, which is usually right.
5049
5050A single socket port cannot by used for communication until
5051it has been connected to another socket.
5052@end deffn
5053
5054\fsocketpair
5055@c snarfed from socket.c:180
5056@deffn primitive socketpair family style proto
5057Returns a pair of connected (but unnamed) socket ports of the type specified
5058by @var{family}, @var{style} and @var{protocol}.
5059Many systems support only
5060socket pairs of the @code{AF_UNIX} family. Zero is likely to be
5061the only meaningful value for @var{protocol}.
5062@end deffn
5063
5064\fgetsockopt
5065@c snarfed from socket.c:209
5066@deffn primitive getsockopt sock level optname
5067Returns the value of a particular socket option for the socket
5068port @var{socket}. @var{level} is an integer code for type of option
5069being requested, e.g., @code{SOL_SOCKET} for socket-level options.
5070@var{optname} is an
5071integer code for the option required and should be specified using one of
5072the symbols @code{SO_DEBUG}, @code{SO_REUSEADDR} etc.
5073
5074The returned value is typically an integer but @code{SO_LINGER} returns a
5075pair of integers.
5076@end deffn
5077
5078\fsetsockopt
5079@c snarfed from socket.c:277
5080@deffn primitive setsockopt sock level optname value
5081Sets the value of a particular socket option for the socket
5082port @var{socket}. @var{level} is an integer code for type of option
5083being set, e.g., @code{SOL_SOCKET} for socket-level options.
5084@var{optname} is an
5085integer code for the option to set and should be specified using one of
5086the symbols @code{SO_DEBUG}, @code{SO_REUSEADDR} etc.
5087@var{value} is the value to which the option should be set. For
5088most options this must be an integer, but for @code{SO_LINGER} it must
5089be a pair.
5090
5091The return value is unspecified.
5092@end deffn
5093
5094\fshutdown
5095@c snarfed from socket.c:381
5096@deffn primitive shutdown sock how
5097Sockets can be closed simply by using @code{close-port}. The
5098@code{shutdown} procedure allows reception or tranmission on a
5099connection to be shut down individually, according to the parameter
5100@var{how}:
5101
5102@table @asis
5103@item 0
5104Stop receiving data for this socket. If further data arrives, reject it.
5105@item 1
5106Stop trying to transmit data from this socket. Discard any
5107data waiting to be sent. Stop looking for acknowledgement of
5108data already sent; don't retransmit it if it is lost.
5109@item 2
5110Stop both reception and transmission.
5111@end table
5112
5113The return value is unspecified.
5114@end deffn
5115
5116\fconnect
5117@c snarfed from socket.c:474
5118@deffn primitive connect sock fam address . args
5119Initiates a connection from @var{socket} to the address
5120specified by @var{address} and possibly @var{arg @dots{}}. The format
5121required for @var{address}
5122and @var{arg} @dots{} depends on the family of the socket.
5123
5124For a socket of family @code{AF_UNIX},
5125only @code{address} is specified and must be a string with the
5126filename where the socket is to be created.
5127
5128For a socket of family @code{AF_INET},
5129@code{address} must be an integer Internet host address and @var{arg} @dots{}
5130must be a single integer port number.
5131
5132The return value is unspecified.
5133@end deffn
5134
5135\fbind
5136@c snarfed from socket.c:528
5137@deffn primitive bind sock fam address . args
5138Assigns an address to the socket port @var{socket}.
5139Generally this only needs to be done for server sockets,
5140so they know where to look for incoming connections. A socket
5141without an address will be assigned one automatically when it
5142starts communicating.
5143
5144The format of @var{address} and @var{ARG} @dots{} depends on the family
5145of the socket.
5146
5147For a socket of family @code{AF_UNIX}, only @var{address}
5148is specified and must
5149be a string with the filename where the socket is to be created.
5150
5151For a socket of family @code{AF_INET}, @var{address} must be an integer
5152Internet host address and @var{arg} @dots{} must be a single integer
5153port number.
5154
5155The values of the following variables can also be used for @var{address}:
5156
5157@defvar INADDR_ANY
5158Allow connections from any address.
5159@end defvar
5160
5161@defvar INADDR_LOOPBACK
5162The address of the local host using the loopback device.
5163@end defvar
5164
5165@defvar INADDR_BROADCAST
5166The broadcast address on the local network.
5167@end defvar
5168
5169@defvar INADDR_NONE
5170No address.
5171@end defvar
5172
5173The return value is unspecified.
5174@end deffn
5175
5176\flisten
5177@c snarfed from socket.c:561
5178@deffn primitive listen sock backlog
5179This procedure enables @var{socket} to accept connection
5180requests. @var{backlog} is an integer specifying
5181the maximum length of the queue for pending connections.
5182If the queue fills, new clients will fail to connect until the
5183server calls @code{accept} to accept a connection from the queue.
5184
5185The return value is unspecified.
5186@end deffn
5187
5188\faccept
5189@c snarfed from socket.c:637
5190@deffn primitive accept sock
5191Accepts a connection on a bound, listening socket @var{socket}. If there
5192are no pending connections in the queue, it waits until
5193one is available unless the non-blocking option has been set on the
5194socket.
5195
5196The return value is a
5197pair in which the CAR is a new socket port for the connection and
5198the CDR is an object with address information about the client which
5199initiated the connection.
5200
5201If the address is not available then the CDR will be an empty vector.
5202
5203@var{socket} does not become part of the
5204connection and will continue to accept new requests.
5205@end deffn
5206
5207\fgetsockname
5208@c snarfed from socket.c:668
5209@deffn primitive getsockname sock
5210Returns the address of @var{socket}, in the same form as the object
5211returned by @code{accept}. On many systems the address of a socket
5212in the @code{AF_FILE} namespace cannot be read.
5213@end deffn
5214
5215\fgetpeername
5216@c snarfed from socket.c:695
5217@deffn primitive getpeername sock
5218Returns the address of the socket that the socket @var{socket} is connected to,
5219in the same form as the object
5220returned by @code{accept}. On many systems the address of a socket
5221in the @code{AF_FILE} namespace cannot be read.
5222@end deffn
5223
5224\frecv!
5225@c snarfed from socket.c:730
5226@deffn primitive recv! sock buf [flags]
5227Receives data from the socket port @var{socket}. @var{socket} must already
5228be bound to the address from which data is to be received.
5229@var{buf} is a string into which
5230the data will be written. The size of @var{buf} limits the amount of
5231data which can be received: in the case of packet
5232protocols, if a packet larger than this limit is encountered then some data
5233will be irrevocably lost.
5234
5235The optional @var{flags} argument is a value or
5236bitwise OR of MSG_OOB, MSG_PEEK, MSG_DONTROUTE etc.
5237
5238The value returned is the number of bytes read from the socket.
5239
5240Note that the data is read directly from the socket file descriptor:
5241any unread buffered port data is ignored.
5242@end deffn
5243
5244\fsend
5245@c snarfed from socket.c:759
5246@deffn primitive send sock message [flags]
5247Transmits the string @var{message} on the socket port @var{socket}.
5248@var{socket} must already be bound to a destination address. The
5249value returned is the number of bytes transmitted -- it's possible for
5250this to be less than the length of @var{message} if the socket is
5251set to be non-blocking. The optional @var{flags} argument is a value or
5252bitwise OR of MSG_OOB, MSG_PEEK, MSG_DONTROUTE etc.
5253
5254Note that the data is written directly to the socket file descriptor:
5255any unflushed buffered port data is ignored.
5256@end deffn
5257
5258\frecvfrom!
5259@c snarfed from socket.c:797
5260@deffn primitive recvfrom! sock str [flags [start [end]]]
5261Returns data from the socket port @var{socket} and also information about
5262where the data was received from. @var{socket} must already
5263be bound to the address from which data is to be received.
5264@code{str}, is a string into which
5265the data will be written. The size of @var{str} limits the amount of
5266data which can be received: in the case of packet
5267protocols, if a packet larger than this limit is encountered then some data
5268will be irrevocably lost.
5269
5270The optional @var{flags} argument is a value or
5271bitwise OR of MSG_OOB, MSG_PEEK, MSG_DONTROUTE etc.
5272
5273The value returned is a pair: the CAR is the number of bytes read from
5274the socket and the CDR an address object in the same form as returned by
5275@code{accept}.
5276
5277The @var{start} and @var{end} arguments specify a substring of @var{str}
5278to which the data should be written.
5279
5280Note that the data is read directly from the socket file descriptor:
5281any unread buffered port data is ignored.
5282@end deffn
5283
5284\fsendto
5285@c snarfed from socket.c:848
5286@deffn primitive sendto sock message fam address . args_and_flags
5287Transmits the string @var{message} on the socket port @var{socket}. The
5288destination address is specified using the @var{family}, @var{address} and
5289@var{arg} arguments, in a similar way to the @code{connect}
5290procedure. The
5291value returned is the number of bytes transmitted -- it's possible for
5292this to be less than the length of @var{message} if the socket is
5293set to be non-blocking. The optional @var{flags} argument is a value or
5294bitwise OR of MSG_OOB, MSG_PEEK, MSG_DONTROUTE etc.
5295
5296Note that the data is written directly to the socket file descriptor:
5297any unflushed buffered port data is ignored.
5298@end deffn
5299
5300\frestricted-vector-sort!
5301@c snarfed from sort.c:425
5302@deffn primitive restricted-vector-sort! vec less startpos endpos
5303Sort the vector @var{vec}, using @var{less} for comparing
5304the vector elements. @var{startpos} and @var{endpos} delimit
5305the range of the vector which gets sorted. The return value
5306is not specified.
5307@end deffn
5308
5309\fsorted?
5310@c snarfed from sort.c:456
5311@deffn primitive sorted? items less
5312Return @code{#t} iff @var{items} is a list or a vector such that
5313for all 1 <= i <= m, the predicate @var{less} returns true when
5314applied to all elements i - 1 and i
5315@end deffn
5316
5317\fmerge
5318@c snarfed from sort.c:528
5319@deffn primitive merge alist blist less
5320Takes two lists @var{alist} and @var{blist} such that
5321@code{(sorted? alist less?)} and @code{(sorted? blist less?)} and
5322returns a new list in which the elements of @var{alist} and
5323@var{blist} have been stably interleaved so that
5324@code{(sorted? (merge alist blist less?) less?)}.
5325Note: this does _not_ accept vectors.
5326@end deffn
5327
5328\fmerge!
5329@c snarfed from sort.c:641
5330@deffn primitive merge! alist blist less
5331Takes two lists @var{alist} and @var{blist} such that
5332@code{(sorted? alist less?)} and @code{(sorted? blist less?)} and
5333returns a new list in which the elements of @var{alist} and
5334@var{blist} have been stably interleaved so that
5335 @code{(sorted? (merge alist blist less?) less?)}.
5336This is the destructive variant of @code{merge}
5337Note: this does _not_ accept vectors.
5338@end deffn
5339
5340\fsort!
5341@c snarfed from sort.c:717
5342@deffn primitive sort! items less
5343Sort the sequence @var{items}, which may be a list or a
5344vector. @var{less} is used for comparing the sequence
5345elements. The sorting is destructive, that means that the
5346input sequence is modified to produce the sorted result.
5347This is not a stable sort.
5348@end deffn
5349
5350\fsort
5351@c snarfed from sort.c:751
5352@deffn primitive sort items less
5353Sort the sequence @var{items}, which may be a list or a
5354vector. @var{less} is used for comparing the sequence
5355elements. This is not a stable sort.
5356@end deffn
5357
5358\fstable-sort!
5359@c snarfed from sort.c:847
5360@deffn primitive stable-sort! items less
5361Sort the sequence @var{items}, which may be a list or a
5362vector. @var{less} is used for comparing the sequence elements.
5363The sorting is destructive, that means that the input sequence
5364is modified to produce the sorted result.
5365This is a stable sort.
5366@end deffn
5367
5368\fstable-sort
5369@c snarfed from sort.c:887
5370@deffn primitive stable-sort items less
5371Sort the sequence @var{items}, which may be a list or a
5372vector. @var{less} is used for comparing the sequence elements.
5373This is a stable sort.
5374@end deffn
5375
5376\fsort-list!
5377@c snarfed from sort.c:933
5378@deffn primitive sort-list! items less
5379Sort the list @var{items}, using @var{less} for comparing the
5380list elements. The sorting is destructive, that means that the
5381input list is modified to produce the sorted result.
5382This is a stable sort.
5383@end deffn
5384
5385\fsort-list
5386@c snarfed from sort.c:947
5387@deffn primitive sort-list items less
5388Sort the list @var{items}, using @var{less} for comparing the
5389list elements. This is a stable sort.
5390@end deffn
5391
5392\fsource-properties
5393@c snarfed from srcprop.c:171
5394@deffn primitive source-properties obj
5395Return the source property association list of @var{obj}.
5396@end deffn
5397
5398\fset-source-properties!
5399@c snarfed from srcprop.c:194
5400@deffn primitive set-source-properties! obj plist
5401Install the association list @var{plist} as the source property
5402list for @var{obj}.
5403@end deffn
5404
5405\fsource-property
5406@c snarfed from srcprop.c:214
5407@deffn primitive source-property obj key
5408Return the source property specified by @var{key} from
5409@var{obj}'s source property list.
5410@end deffn
5411
5412\fset-source-property!
5413@c snarfed from srcprop.c:247
5414@deffn primitive set-source-property! obj key datum
5415Set the source property of object @var{obj}, which is specified by
5416@var{key} to @var{datum}. Normally, the key will be a symbol.
5417@end deffn
5418
5419\fstack?
5420@c snarfed from stacks.c:407
5421@deffn primitive stack? obj
5422Return @code{#t} if @var{obj} is a calling stack.
5423@end deffn
5424
5425\fmake-stack
5426@c snarfed from stacks.c:421
5427@deffn primitive make-stack obj . args
5428Create a new stack. If @var{obj} is @code{#t}, the current
5429evaluation stack is used for creating the stack frames,
5430otherwise the frames are taken from @var{obj} (which must be
5431either a debug object or a continuation).
5432@var{args} must be a list if integers and specifies how the
5433resulting stack will be narrowed.
5434@end deffn
5435
5436\fstack-id
5437@c snarfed from stacks.c:512
5438@deffn primitive stack-id stack
5439Return the identifier given to @var{stack} by @code{start-stack}.
5440@end deffn
5441
5442\fstack-ref
5443@c snarfed from stacks.c:548
5444@deffn primitive stack-ref stack i
5445Return the @var{i}'th frame from @var{stack}.
5446@end deffn
5447
5448\fstack-length
5449@c snarfed from stacks.c:562
5450@deffn primitive stack-length stack
5451Return the length of @var{stack}.
5452@end deffn
5453
5454\fframe?
5455@c snarfed from stacks.c:575
5456@deffn primitive frame? obj
5457Return @code{#t} if @var{obj} is a stack frame.
5458@end deffn
5459
5460\flast-stack-frame
5461@c snarfed from stacks.c:586
5462@deffn primitive last-stack-frame obj
5463Return a stack which consists of a single frame, which is the
5464last stack frame for @var{obj}. @var{obj} must be either a
5465debug object or a continuation.
5466@end deffn
5467
5468\fframe-number
5469@c snarfed from stacks.c:627
5470@deffn primitive frame-number frame
5471Return the frame number of @var{frame}.
5472@end deffn
5473
5474\fframe-source
5475@c snarfed from stacks.c:637
5476@deffn primitive frame-source frame
5477Return the source of @var{frame}.
5478@end deffn
5479
5480\fframe-procedure
5481@c snarfed from stacks.c:648
5482@deffn primitive frame-procedure frame
5483Return the procedure for @var{frame}, or @code{#f} if no
5484procedure is associated with @var{frame}.
5485@end deffn
5486
5487\fframe-arguments
5488@c snarfed from stacks.c:660
5489@deffn primitive frame-arguments frame
5490Return the arguments of @var{frame}.
5491@end deffn
5492
5493\fframe-previous
5494@c snarfed from stacks.c:671
5495@deffn primitive frame-previous frame
5496Return the previous frame of @var{frame}, or @code{#f} if
5497@var{frame} is the first frame in its stack.
5498@end deffn
5499
5500\fframe-next
5501@c snarfed from stacks.c:687
5502@deffn primitive frame-next frame
5503Return the next frame of @var{frame}, or @code{#f} if
5504@var{frame} is the last frame in its stack.
5505@end deffn
5506
5507\fframe-real?
5508@c snarfed from stacks.c:702
5509@deffn primitive frame-real? frame
5510Return @code{#t} if @var{frame} is a real frame.
5511@end deffn
5512
5513\fframe-procedure?
5514@c snarfed from stacks.c:712
5515@deffn primitive frame-procedure? frame
5516Return @code{#t} if a procedure is associated with @var{frame}.
5517@end deffn
5518
5519\fframe-evaluating-args?
5520@c snarfed from stacks.c:722
5521@deffn primitive frame-evaluating-args? frame
5522Return @code{#t} if @var{frame} contains evaluated arguments.
5523@end deffn
5524
5525\fframe-overflow?
5526@c snarfed from stacks.c:732
5527@deffn primitive frame-overflow? frame
5528Return @code{#t} if @var{frame} is an overflow frame.
5529@end deffn
5530
5531\fget-internal-real-time
5532@c snarfed from stime.c:141
5533@deffn primitive get-internal-real-time
5534Returns the number of time units since the interpreter was started.
5535@end deffn
5536
5537\ftimes
5538@c snarfed from stime.c:183
5539@deffn primitive times
5540Returns an object with information about real and processor time.
5541The following procedures accept such an object as an argument and
5542return a selected component:
5543
5544@table @code
5545@item tms:clock
5546The current real time, expressed as time units relative to an
5547arbitrary base.
5548@item tms:utime
5549The CPU time units used by the calling process.
5550@item tms:stime
5551The CPU time units used by the system on behalf of the calling process.
5552@item tms:cutime
5553The CPU time units used by terminated child processes of the calling
5554process, whose status has been collected (e.g., using @code{waitpid}).
5555@item tms:cstime
5556Similarly, the CPU times units used by the system on behalf of
5557terminated child processes.
5558@end table
5559@end deffn
5560
5561\fget-internal-run-time
5562@c snarfed from stime.c:214
5563@deffn primitive get-internal-run-time
5564Returns the number of time units of processor time used by the interpreter.
5565Both "system" and "user" time are included but subprocesses are not.
5566@end deffn
5567
5568\fcurrent-time
5569@c snarfed from stime.c:224
5570@deffn primitive current-time
5571Returns the number of seconds since 1970-01-01 00:00:00 UTC, excluding
5572leap seconds.
5573@end deffn
5574
5575\fgettimeofday
5576@c snarfed from stime.c:241
5577@deffn primitive gettimeofday
5578Returns a pair containing the number of seconds and microseconds since
55791970-01-01 00:00:00 UTC, excluding leap seconds. Note: whether true
5580microsecond resolution is available depends on the operating system.
5581@end deffn
5582
5583\flocaltime
5584@c snarfed from stime.c:341
5585@deffn primitive localtime time [zone]
5586Returns an object representing the broken down components of @var{time},
5587an integer like the one returned by @code{current-time}. The time zone
5588for the calculation is optionally specified by @var{zone} (a string),
5589otherwise the @code{TZ} environment variable or the system default is
5590used.
5591@end deffn
5592
5593\fgmtime
5594@c snarfed from stime.c:413
5595@deffn primitive gmtime time
5596Returns an object representing the broken down components of @var{time},
5597an integer like the one returned by @code{current-time}. The values
5598are calculated for UTC.
5599@end deffn
5600
5601\fmktime
5602@c snarfed from stime.c:475
5603@deffn primitive mktime sbd_time [zone]
5604@var{bd-time} is an object representing broken down time and @code{zone}
5605is an optional time zone specifier (otherwise the TZ environment variable
5606or the system default is used).
5607
5608Returns a pair: the car is a corresponding
5609integer time value like that returned
5610by @code{current-time}; the cdr is a broken down time object, similar to
5611as @var{bd-time} but with normalized values.
5612@end deffn
5613
5614\ftzset
5615@c snarfed from stime.c:548
5616@deffn primitive tzset
5617Initialize the timezone from the TZ environment variable
5618or the system default. It's not usually necessary to call this procedure
5619since it's done automatically by other procedures that depend on the
5620timezone.
5621@end deffn
5622
5623\fstrftime
5624@c snarfed from stime.c:565
5625@deffn primitive strftime format stime
5626Formats a time specification @var{time} using @var{template}. @var{time}
5627is an object with time components in the form returned by @code{localtime}
5628or @code{gmtime}. @var{template} is a string which can include formatting
5629specifications introduced by a @code{%} character. The formatting of
5630month and day names is dependent on the current locale. The value returned
5631is the formatted string.
5632@xref{Formatting Date and Time, , , libc, The GNU C Library Reference Manual}.)
5633@end deffn
5634
5635\fstrptime
5636@c snarfed from stime.c:663
5637@deffn primitive strptime format string
5638Performs the reverse action to @code{strftime}, parsing
5639@var{string} according to the specification supplied in
5640@var{template}. The interpretation of month and day names is
5641dependent on the current locale. The value returned is a pair.
5642The car has an object with time components
5643in the form returned by @code{localtime} or @code{gmtime},
5644but the time zone components
5645are not usefully set.
5646The cdr reports the number of characters from @var{string}
5647which were used for the conversion.
5648@end deffn
5649
5650\fstring?
5651@c snarfed from strings.c:62
5652@deffn primitive string? obj
5653Returns @code{#t} iff @var{obj} is a string, else returns
5654@code{#f}.
5655@end deffn
5656
5657\fread-only-string?
5658@c snarfed from strings.c:85
5659@deffn primitive read-only-string? obj
5660Return true if @var{obj} can be read as a string,
5661
5662This illustrates the difference between @code{string?} and
5663@code{read-only-string?}:
5664
5665@example
5666(string? "a string") @result{} #t
5667(string? 'a-symbol) @result{} #f
5668
5669(read-only-string? "a string") @result{} #t
5670(read-only-string? 'a-symbol) @result{} #t
5671@end example
5672@end deffn
5673
5674\flist->string
5675@c snarfed from strings.c:94
5676@deffn primitive list->string
5677scm_string
5678@end deffn
5679
5680\fstring
5681@c snarfed from strings.c:100
5682@deffn primitive string . chrs
5683@deffnx primitive list->string chrs
5684Returns a newly allocated string composed of the arguments,
5685@var{chrs}.
5686@end deffn
5687
5688\fmake-string
5689@c snarfed from strings.c:253
5690@deffn primitive make-string k [chr]
5691Return a newly allocated string of
5692length @var{k}. If @var{chr} is given, then all elements of
5693the string are initialized to @var{chr}, otherwise the contents
5694of the @var{string} are unspecified.
5695@end deffn
5696
5697\fstring-length
5698@c snarfed from strings.c:286
5699@deffn primitive string-length string
5700Return the number of characters in @var{string}.
5701@end deffn
5702
5703\fstring-ref
5704@c snarfed from strings.c:297
5705@deffn primitive string-ref str k
5706Return character @var{k} of @var{str} using zero-origin
5707indexing. @var{k} must be a valid index of @var{str}.
5708@end deffn
5709
5710\fstring-set!
5711@c snarfed from strings.c:314
5712@deffn primitive string-set! str k chr
5713Store @var{chr} in element @var{k} of @var{str} and return
5714an unspecified value. @var{k} must be a valid index of
5715@var{str}.
5716@end deffn
5717
5718\fsubstring
5719@c snarfed from strings.c:337
5720@deffn primitive substring str start [end]
5721Return a newly allocated string formed from the characters
5722of @var{str} beginning with index @var{start} (inclusive) and
5723ending with index @var{end} (exclusive).
5724@var{str} must be a string, @var{start} and @var{end} must be
5725exact integers satisfying:
5726
57270 <= @var{start} <= @var{end} <= (string-length @var{str}).
5728@end deffn
5729
5730\fstring-append
5731@c snarfed from strings.c:360
5732@deffn primitive string-append . args
5733Return a newly allocated string whose characters form the
5734concatenation of the given strings, @var{args}.
5735@end deffn
5736
5737\fmake-shared-substring
5738@c snarfed from strings.c:400
5739@deffn primitive make-shared-substring str [frm [to]]
5740Return a shared substring of @var{str}. The semantics are the same as
5741for the @code{substring} function: the shared substring returned
5742includes all of the text from @var{str} between indexes @var{start}
5743(inclusive) and @var{end} (exclusive). If @var{end} is omitted, it
5744defaults to the end of @var{str}. The shared substring returned by
5745@code{make-shared-substring} occupies the same storage space as
5746@var{str}.
5747@end deffn
5748
5749\fstring-index
5750@c snarfed from strop.c:120
5751@deffn primitive string-index str chr [frm [to]]
5752Return the index of the first occurrence of @var{chr} in
5753@var{str}. The optional integer arguments @var{frm} and
5754@var{to} limit the search to a portion of the string. This
5755procedure essentially implements the @code{index} or
5756@code{strchr} functions from the C library.\n (qdocs:) Returns
5757the index of @var{char} in @var{str}, or @code{#f} if the
5758@var{char} isn't in @var{str}. If @var{frm} is given and not
5759@code{#f}, it is used as the starting index; if @var{to} is
5760given and not @code{#f}, it is used as the ending index
5761(exclusive).
5762
5763@example
5764(string-index "weiner" #\\e)
5765@result{} 1
5766
5767(string-index "weiner" #\\e 2)
5768@result{} 4
5769
5770(string-index "weiner" #\\e 2 4)
5771@result{} #f
5772@end example
5773@end deffn
5774
5775\fstring-rindex
5776@c snarfed from strop.c:151
5777@deffn primitive string-rindex str chr [frm [to]]
5778Like @code{string-index}, but search from the right of the string rather
5779than from the left. This procedure essentially implements the
5780@code{rindex} or @code{strrchr} functions from the C library.
5781
5782(qdocs:) The same as @code{string-index}, except it gives the rightmost occurance
5783of @var{char} in the range [@var{frm}, @var{to}-1], which defaults to
5784the entire string.
5785
5786@example
5787(string-rindex "weiner" #\\e)
5788@result{} 4
5789
5790(string-rindex "weiner" #\\e 2 4)
5791@result{} #f
5792
5793(string-rindex "weiner" #\\e 2 5)
5794@result{} 4
5795@end example
5796@end deffn
5797
5798\fsubstring-move-left!
5799@c snarfed from strop.c:168
5800@deffn primitive substring-move-left!
5801scm_substring_move_x
5802@end deffn
5803
5804\fsubstring-move-right!
5805@c snarfed from strop.c:169
5806@deffn primitive substring-move-right!
5807scm_substring_move_x
5808@end deffn
5809
5810\fsubstring-move!
5811@c snarfed from strop.c:243
5812@deffn primitive substring-move! str1 start1 end1 str2 start2
5813@deffnx primitive substring-move-left! str1 start1 end1 str2 start2
5814@deffnx primitive substring-move-right! str1 start1 end1 str2 start2
5815Copy the substring of @var{str1} bounded by @var{start1} and @var{end1}
5816into @var{str2} beginning at position @var{end2}.
5817@code{substring-move-right!} begins copying from the rightmost character
5818and moves left, and @code{substring-move-left!} copies from the leftmost
5819character moving right.
5820
5821It is useful to have two functions that copy in different directions so
5822that substrings can be copied back and forth within a single string. If
5823you wish to copy text from the left-hand side of a string to the
5824right-hand side of the same string, and the source and destination
5825overlap, you must be careful to copy the rightmost characters of the
5826text first, to avoid clobbering your data. Hence, when @var{str1} and
5827@var{str2} are the same string, you should use
5828@code{substring-move-right!} when moving text from left to right, and
5829@code{substring-move-left!} otherwise. If @code{str1} and @samp{str2}
5830are different strings, it does not matter which function you use.
5831@end deffn
5832
5833\fsubstring-fill!
5834@c snarfed from strop.c:279
5835@deffn primitive substring-fill! str start end fill
5836Change every character in @var{str} between @var{start} and @var{end} to
5837@var{fill-char}.
5838
5839(qdocs:) Destructively fills @var{str}, from @var{start} to @var{end}, with @var{fill}.
5840
5841@example
5842(define y "abcdefg")
5843(substring-fill! y 1 3 #\\r)
5844y
5845@result{} "arrdefg"
5846@end example
5847@end deffn
5848
5849\fstring-null?
5850@c snarfed from strop.c:306
5851@deffn primitive string-null? str
5852Return @code{#t} if @var{str}'s length is nonzero, and @code{#f}
5853otherwise.
5854
5855(qdocs:) Returns @code{#t} if @var{str} is empty, else returns @code{#f}.
5856
5857@example
5858(string-null? "")
5859@result{} #t
5860
5861(string-null? y)
5862@result{} #f
5863@end example
5864@end deffn
5865
5866\fstring->list
5867@c snarfed from strop.c:322
5868@deffn primitive string->list str
5869@samp{String->list} returns a newly allocated list of the
5870characters that make up the given string. @samp{List->string}
5871returns a newly allocated string formed from the characters in the list
5872@var{list}, which must be a list of characters. @samp{String->list}
5873and @samp{list->string} are
5874inverses so far as @samp{equal?} is concerned. (r5rs)
5875@end deffn
5876
5877\fstring-copy
5878@c snarfed from strop.c:347
5879@deffn primitive string-copy str
5880Returns a newly allocated copy of the given @var{string}. (r5rs)
5881@end deffn
5882
5883\fstring-fill!
5884@c snarfed from strop.c:360
5885@deffn primitive string-fill! str chr
5886Stores @var{char} in every element of the given @var{string} and returns an
5887unspecified value. (r5rs)
5888@end deffn
5889
5890\fstring-upcase!
5891@c snarfed from strop.c:396
5892@deffn primitive string-upcase! str
5893Destructively upcase every character in @code{str}.
5894
5895(qdocs:) Converts each element in @var{str} to upper case.
5896
5897@example
5898(string-upcase! y)
5899@result{} "ARRDEFG"
5900
5901y
5902@result{} "ARRDEFG"
5903@end example
5904@end deffn
5905
5906\fstring-upcase
5907@c snarfed from strop.c:408
5908@deffn primitive string-upcase str
5909Upcase every character in @code{str}.
5910@end deffn
5911
5912\fstring-downcase!
5913@c snarfed from strop.c:443
5914@deffn primitive string-downcase! str
5915Destructively downcase every character in @code{str}.
5916
5917(qdocs:) Converts each element in @var{str} to lower case.
5918
5919@example
5920y
5921@result{} "ARRDEFG"
5922
5923(string-downcase! y)
5924@result{} "arrdefg"
5925
5926y
5927@result{} "arrdefg"
5928@end example
5929@end deffn
5930
5931\fstring-downcase
5932@c snarfed from strop.c:455
5933@deffn primitive string-downcase str
5934Downcase every character in @code{str}.
5935@end deffn
5936
5937\fstring-capitalize!
5938@c snarfed from strop.c:492
5939@deffn primitive string-capitalize! str
5940Destructively capitalize every character in @code{str}.
5941@end deffn
5942
5943\fstring-capitalize
5944@c snarfed from strop.c:504
5945@deffn primitive string-capitalize str
5946Capitalize every character in @code{str}.
5947@end deffn
5948
5949\fstring-ci->symbol
5950@c snarfed from strop.c:516
5951@deffn primitive string-ci->symbol str
5952Return the symbol whose name is @var{str}, downcased in necessary(???).
5953@end deffn
5954
5955\fstring=?
5956@c snarfed from strorder.c:64
5957@deffn primitive string=? s1 s2
5958Lexicographic equality predicate;
5959Returns @code{#t} if the two strings are the same length and
5960contain the same characters in the same positions, otherwise
5961returns @code{#f}. (r5rs)
5962
5963The procedure @code{string-ci=?} treats upper and lower case
5964letters as though they were the same character, but
5965@code{string=?} treats upper and lower case as distinct
5966characters.
5967@end deffn
5968
5969\fstring-ci=?
5970@c snarfed from strorder.c:99
5971@deffn primitive string-ci=? s1 s2
5972Case-insensitive string equality predicate; returns @code{#t}
5973if the two strings are the same length and their component
5974characters match (ignoring case) at each position; otherwise
5975returns @code{#f}. (r5rs)
5976@end deffn
5977
5978\fstring<?
5979@c snarfed from strorder.c:156
5980@deffn primitive string<? s1 s2
5981Lexicographic ordering predicate; returns @code{#t} if
5982@var{s1} is lexicographically less than @var{s2}. (r5rs)
5983@end deffn
5984
5985\fstring<=?
5986@c snarfed from strorder.c:171
5987@deffn primitive string<=? s1 s2
5988Lexicographic ordering predicate; returns @code{#t} if
5989@var{s1} is lexicographically less than or equal to @var{s2}.
5990(r5rs)
5991@end deffn
5992
5993\fstring>?
5994@c snarfed from strorder.c:185
5995@deffn primitive string>? s1 s2
5996Lexicographic ordering predicate; returns @code{#t} if
5997@var{s1} is lexicographically greater than @var{s2}. (r5rs)
5998@end deffn
5999
6000\fstring>=?
6001@c snarfed from strorder.c:200
6002@deffn primitive string>=? s1 s2
6003Lexicographic ordering predicate; returns @code{#t} if
6004@var{s1} is lexicographically greater than or equal to
6005@var{s2}. (r5rs)
6006@end deffn
6007
6008\fstring-ci<?
6009@c snarfed from strorder.c:239
6010@deffn primitive string-ci<? s1 s2
6011Case insensitive lexicographic ordering predicate;
6012returns @code{#t} if @var{s1} is lexicographically less than
6013@var{s2} regardless of case. (r5rs)
6014@end deffn
6015
6016\fstring-ci<=?
6017@c snarfed from strorder.c:254
6018@deffn primitive string-ci<=? s1 s2
6019Case insensitive lexicographic ordering predicate;
6020returns @code{#t} if @var{s1} is lexicographically less than
6021or equal to @var{s2} regardless of case. (r5rs)
6022@end deffn
6023
6024\fstring-ci>?
6025@c snarfed from strorder.c:269
6026@deffn primitive string-ci>? s1 s2
6027Case insensitive lexicographic ordering predicate;
6028returns @code{#t} if @var{s1} is lexicographically greater
6029than @var{s2} regardless of case. (r5rs)
6030@end deffn
6031
6032\fstring-ci>=?
6033@c snarfed from strorder.c:284
6034@deffn primitive string-ci>=? s1 s2
6035Case insensitive lexicographic ordering predicate;
6036returns @code{#t} if @var{s1} is lexicographically greater
6037than or equal to @var{s2} regardless of case. (r5rs)
6038@end deffn
6039
6040\fobject->string
6041@c snarfed from strports.c:318
6042@deffn primitive object->string obj [printer]
6043Return a Scheme string obtained by printing @var{obj}.
6044Printing function can be specified by the optional second
6045argument @var{printer} (default: @code{write}).
6046@end deffn
6047
6048\fcall-with-output-string
6049@c snarfed from strports.c:352
6050@deffn primitive call-with-output-string proc
6051Calls the one-argument procedure @var{proc} with a newly created output
6052port. When the function returns, the string composed of the characters
6053written into the port is returned.
6054@end deffn
6055
6056\fcall-with-input-string
6057@c snarfed from strports.c:371
6058@deffn primitive call-with-input-string str proc
6059Calls the one-argument procedure @var{proc} with a newly created input
6060port from which @var{string}'s contents may be read. The value yielded
6061by the @var{proc} is returned.
6062@end deffn
6063
6064\fopen-input-string
6065@c snarfed from strports.c:384
6066@deffn primitive open-input-string str
6067Takes a string and returns an input port that delivers
6068characters from the string. The port can be closed by
6069@code{close-input-port}, though its storage will be reclaimed
6070by the garbage collector if it becomes inaccessible.
6071@end deffn
6072
6073\fopen-output-string
6074@c snarfed from strports.c:398
6075@deffn primitive open-output-string
6076Returns an output port that will accumulate characters for
6077retrieval by @code{get-output-string}. The port can be closed
6078by the procedure @code{close-output-port}, though its storage
6079will be reclaimed by the garbage collector if it becomes
6080inaccessible.
6081@end deffn
6082
6083\fget-output-string
6084@c snarfed from strports.c:415
6085@deffn primitive get-output-string port
6086Given an output port created by @code{open-output-string},
6087returns a string consisting of the characters that have been
6088output to the port so far.
6089@end deffn
6090
6091\feval-string
6092@c snarfed from strports.c:456
6093@deffn primitive eval-string string
6094Evaluate @var{string} as the text representation of a Scheme
6095form or forms, and return whatever value they produce.
6096Evaluation takes place in the environment returned by the
6097procedure @code{interaction-environment}.
6098@end deffn
6099
6100\fmake-struct-layout
6101@c snarfed from struct.c:79
6102@deffn primitive make-struct-layout fields
6103Return a new structure layout object.
6104
6105@var{fields} must be a string made up of pairs of characters
6106strung together. The first character of each pair describes a field
6107type, the second a field protection. Allowed types are 'p' for
6108GC-protected Scheme data, 'u' for unprotected binary data, and 's' for
6109a field that points to the structure itself. Allowed protections
6110are 'w' for mutable fields, 'r' for read-only fields, and 'o' for opaque
6111fields. The last field protection specification may be capitalized to
6112indicate that the field is a tail-array.
6113@end deffn
6114
6115\fstruct?
6116@c snarfed from struct.c:246
6117@deffn primitive struct? x
6118Return @code{#t} iff @var{obj} is a structure object, else
6119@code{#f}.
6120@end deffn
6121
6122\fstruct-vtable?
6123@c snarfed from struct.c:255
6124@deffn primitive struct-vtable? x
6125Return @code{#t} iff obj is a vtable structure.
6126@end deffn
6127
6128\fmake-struct
6129@c snarfed from struct.c:437
6130@deffn primitive make-struct vtable tail_array_size . init
6131Create a new structure.
6132
6133@var{type} must be a vtable structure (@pxref{Vtables}).
6134
6135@var{tail-elts} must be a non-negative integer. If the layout
6136specification indicated by @var{type} includes a tail-array,
6137this is the number of elements allocated to that array.
6138
6139The @var{init1}, @dots{} are optional arguments describing how
6140successive fields of the structure should be initialized. Only fields
6141with protection 'r' or 'w' can be initialized, except for fields of
6142type 's', which are automatically initialized to point to the new
6143structure itself; fields with protection 'o' can not be initialized by
6144Scheme programs.
6145
6146If fewer optional arguments than initializable fields are supplied,
6147fields of type 'p' get default value #f while fields of type 'u' are
6148initialized to 0.
6149
6150Structs are currently the basic representation for record-like data
6151structures in Guile. The plan is to eventually replace them with a
6152new representation which will at the same time be easier to use and
6153more powerful.
6154
6155For more information, see the documentation for @code{make-vtable-vtable}.
6156@end deffn
6157
6158\fmake-vtable-vtable
6159@c snarfed from struct.c:523
6160@deffn primitive make-vtable-vtable user_fields tail_array_size . init
6161Return a new, self-describing vtable structure.
6162
6163@var{user-fields} is a string describing user defined fields of the
6164vtable beginning at index @code{vtable-offset-user}
6165(see @code{make-struct-layout}).
6166
6167@var{tail-size} specifies the size of the tail-array (if any) of
6168this vtable.
6169
6170@var{init1}, @dots{} are the optional initializers for the fields of
6171the vtable.
6172
6173Vtables have one initializable system field---the struct printer.
6174This field comes before the user fields in the initializers passed
6175to @code{make-vtable-vtable} and @code{make-struct}, and thus works as
6176a third optional argument to @code{make-vtable-vtable} and a fourth to
6177@code{make-struct} when creating vtables:
6178
6179If the value is a procedure, it will be called instead of the standard
6180printer whenever a struct described by this vtable is printed.
6181The procedure will be called with arguments STRUCT and PORT.
6182
6183The structure of a struct is described by a vtable, so the vtable is
6184in essence the type of the struct. The vtable is itself a struct with
6185a vtable. This could go on forever if it weren't for the
6186vtable-vtables which are self-describing vtables, and thus terminate
6187the chain.
6188
6189There are several potential ways of using structs, but the standard
6190one is to use three kinds of structs, together building up a type
6191sub-system: one vtable-vtable working as the root and one or several
6192"types", each with a set of "instances". (The vtable-vtable should be
6193compared to the class <class> which is the class of itself.)
6194
6195@example
6196(define ball-root (make-vtable-vtable "pr" 0))
6197
6198(define (make-ball-type ball-color)
6199 (make-struct ball-root 0
6200 (make-struct-layout "pw")
6201 (lambda (ball port)
6202 (format port "#<a ~A ball owned by ~A>"
6203 (color ball)
6204 (owner ball)))
6205 ball-color))
6206(define (color ball) (struct-ref (struct-vtable ball) vtable-offset-user))
6207(define (owner ball) (struct-ref ball 0))
6208
6209(define red (make-ball-type 'red))
6210(define green (make-ball-type 'green))
6211
6212(define (make-ball type owner) (make-struct type 0 owner))
6213
6214(define ball (make-ball green 'Nisse))
6215ball @result{} #<a green ball owned by Nisse>
6216@end example
6217@end deffn
6218
6219\fstruct-ref
6220@c snarfed from struct.c:565
6221@deffn primitive struct-ref handle pos
6222@deffnx primitive struct-set! struct n value
6223Access (or modify) the @var{n}th field of @var{struct}.
6224
6225If the field is of type 'p', then it can be set to an arbitrary value.
6226
6227If the field is of type 'u', then it can only be set to a non-negative
6228integer value small enough to fit in one machine word.
6229@end deffn
6230
6231\fstruct-set!
6232@c snarfed from struct.c:643
6233@deffn primitive struct-set! handle pos val
6234Set the slot of the structure @var{handle} with index @var{pos}
6235to @var{val}. Signal an error if the slot can not be written
6236to.
6237@end deffn
6238
6239\fstruct-vtable
6240@c snarfed from struct.c:713
6241@deffn primitive struct-vtable handle
6242Return the vtable structure that describes the type of @var{struct}.
6243@end deffn
6244
6245\fstruct-vtable-tag
6246@c snarfed from struct.c:724
6247@deffn primitive struct-vtable-tag handle
6248Return the vtable tag of the structure @var{handle}.
6249@end deffn
6250
6251\fstruct-vtable-name
6252@c snarfed from struct.c:763
6253@deffn primitive struct-vtable-name vtable
6254Return the name of the vtable @var{vtable}.
6255@end deffn
6256
6257\fset-struct-vtable-name!
6258@c snarfed from struct.c:773
6259@deffn primitive set-struct-vtable-name! vtable name
6260Set the name of the vtable @var{vtable} to @var{name}.
6261@end deffn
6262
6263\fsymbol?
6264@c snarfed from symbols.c:422
6265@deffn primitive symbol? obj
6266Returns @code{#t} if @var{obj} is a symbol, otherwise returns
6267@code{#f}. (r5rs)
6268@end deffn
6269
6270\fsymbol->string
6271@c snarfed from symbols.c:451
6272@deffn primitive symbol->string s
6273Returns the name of @var{symbol} as a string. If the symbol
6274was part of an object returned as the value of a literal
6275expression (section @pxref{Literal expressions,,,r4rs, The
6276Revised^4 Report on Scheme}) or by a call to the @code{read}
6277procedure, and its name contains alphabetic characters, then
6278the string returned will contain characters in the
6279implementation's preferred standard case---some implementations
6280will prefer upper case, others lower case. If the symbol was
6281returned by @code{string->symbol}, the case of characters in
6282the string returned will be the same as the case in the string
6283that was passed to @code{string->symbol}. It is an error to
6284apply mutation procedures like @code{string-set!} to strings
6285returned by this procedure. (r5rs)
6286
6287The following examples assume that the implementation's
6288standard case is lower case:
6289
6290@lisp
6291(symbol->string 'flying-fish) @result{} "flying-fish"
6292(symbol->string 'Martin) @result{} "martin"
6293(symbol->string
6294 (string->symbol "Malvina")) @result{} "Malvina"
6295@end lisp
6296@end deffn
6297
6298\fstring->symbol
6299@c snarfed from symbols.c:478
6300@deffn primitive string->symbol s
6301Returns the symbol whose name is @var{string}. This procedure
6302can create symbols with names containing special characters or
6303letters in the non-standard case, but it is usually a bad idea
6304to create such because in some implementations of Scheme they
6305cannot be read as themselves. See @code{symbol->string}.
6306
6307The following examples assume that the implementation's
6308standard case is lower case:
6309
6310@lisp
6311(eq? 'mISSISSIppi 'mississippi) @result{} #t
6312(string->symbol "mISSISSIppi") @result{} @r{the symbol with name "mISSISSIppi"}
6313(eq? 'bitBlt (string->symbol "bitBlt")) @result{} #f
6314(eq? 'JollyWog
6315 (string->symbol (symbol->string 'JollyWog))) @result{} #t
6316(string=? "K. Harper, M.D."
6317 (symbol->string
6318 (string->symbol "K. Harper, M.D."))) @result{}#t
6319@end lisp
6320@end deffn
6321
6322\fstring->obarray-symbol
6323@c snarfed from symbols.c:499
6324@deffn primitive string->obarray-symbol o s [softp]
6325Intern a new symbol in @var{obarray}, a symbol table, with name
6326@var{string}.
6327
6328If @var{obarray} is @code{#f}, use the default system symbol table. If
6329@var{obarray} is @code{#t}, the symbol should not be interned in any
6330symbol table; merely return the pair (@var{symbol}
6331. @var{#<undefined>}).
6332
6333The @var{soft?} argument determines whether new symbol table entries
6334should be created when the specified symbol is not already present in
6335@var{obarray}. If @var{soft?} is specified and is a true value, then
6336new entries should not be added for symbols not already present in the
6337table; instead, simply return @code{#f}.
6338@end deffn
6339
6340\fintern-symbol
6341@c snarfed from symbols.c:531
6342@deffn primitive intern-symbol o s
6343Add a new symbol to @var{obarray} with name @var{string}, bound to an
6344unspecified initial value. The symbol table is not modified if a symbol
6345with this name is already present.
6346@end deffn
6347
6348\funintern-symbol
6349@c snarfed from symbols.c:568
6350@deffn primitive unintern-symbol o s
6351Remove the symbol with name @var{string} from @var{obarray}. This
6352function returns @code{#t} if the symbol was present and @code{#f}
6353otherwise.
6354@end deffn
6355
6356\fsymbol-binding
6357@c snarfed from symbols.c:609
6358@deffn primitive symbol-binding o s
6359Look up in @var{obarray} the symbol whose name is @var{string}, and
6360return the value to which it is bound. If @var{obarray} is @code{#f},
6361use the global symbol table. If @var{string} is not interned in
6362@var{obarray}, an error is signalled.
6363@end deffn
6364
6365\fsymbol-interned?
6366@c snarfed from symbols.c:626
6367@deffn primitive symbol-interned? o s
6368Return @code{#t} if @var{obarray} contains a symbol with name
6369@var{string}, and @code{#f} otherwise.
6370@end deffn
6371
6372\fsymbol-bound?
6373@c snarfed from symbols.c:649
6374@deffn primitive symbol-bound? o s
6375Return @code{#t} if @var{obarray} contains a symbol with name
6376@var{string} bound to a defined value. This differs from
6377@var{symbol-interned?} in that the mere mention of a symbol
6378usually causes it to be interned; @code{symbol-bound?}
6379determines whether a symbol has been given any meaningful
6380value.
6381@end deffn
6382
6383\fsymbol-set!
6384@c snarfed from symbols.c:667
6385@deffn primitive symbol-set! o s v
6386Find the symbol in @var{obarray} whose name is @var{string}, and rebind
6387it to @var{value}. An error is signalled if @var{string} is not present
6388in @var{obarray}.
6389@end deffn
6390
6391\fsymbol-fref
6392@c snarfed from symbols.c:684
6393@deffn primitive symbol-fref s
6394Return the contents of @var{symbol}'s @dfn{function slot}.
6395@end deffn
6396
6397\fsymbol-pref
6398@c snarfed from symbols.c:695
6399@deffn primitive symbol-pref s
6400Return the @dfn{property list} currently associated with @var{symbol}.
6401@end deffn
6402
6403\fsymbol-fset!
6404@c snarfed from symbols.c:706
6405@deffn primitive symbol-fset! s val
6406Change the binding of @var{symbol}'s function slot.
6407@end deffn
6408
6409\fsymbol-pset!
6410@c snarfed from symbols.c:718
6411@deffn primitive symbol-pset! s val
6412Change the binding of @var{symbol}'s property slot.
6413@end deffn
6414
6415\fsymbol-hash
6416@c snarfed from symbols.c:732
6417@deffn primitive symbol-hash symbol
6418Return a hash value for @var{symbol}.
6419@end deffn
6420
6421\fbuiltin-bindings
6422@c snarfed from symbols.c:769
6423@deffn primitive builtin-bindings
6424Create and return a copy of the global symbol table, removing all
6425unbound symbols.
6426@end deffn
6427
6428\fgensym
6429@c snarfed from symbols.c:790
6430@deffn primitive gensym [prefix]
6431Create a new symbol with a name constructed from a prefix and
6432a counter value. The string @var{prefix} can be specified as
6433an optional argument. Default prefix is @code{g}. The counter
6434is increased by 1 at each call. There is no provision for
6435resetting the counter.
6436@end deffn
6437
6438\fgentemp
6439@c snarfed from symbols.c:829
6440@deffn primitive gentemp [prefix [obarray]]
6441Create a new symbol with a name unique in an obarray.
6442The name is constructed from an optional string @var{prefix}
6443and a counter value. The default prefix is @code{t}. The
6444@var{obarray} is specified as a second optional argument.
6445Default is the system obarray where all normal symbols are
6446interned. The counter is increased by 1 at each
6447call. There is no provision for resetting the counter.
6448@end deffn
6449
6450\ftag
6451@c snarfed from tag.c:98
6452@deffn primitive tag x
6453Return an integer corresponding to the type of X. Deprecated.
6454@end deffn
6455
6456\fcatch
6457@c snarfed from throw.c:529
6458@deffn primitive catch tag thunk handler
6459Invoke @var{thunk} in the dynamic context of @var{handler} for
6460exceptions matching @var{key}. If thunk throws to the symbol @var{key},
6461then @var{handler} is invoked this way:
6462
6463@example
6464(handler key args ...)
6465@end example
6466
6467@var{key} is a symbol or #t.
6468
6469@var{thunk} takes no arguments. If @var{thunk} returns normally, that
6470is the return value of @code{catch}.
6471
6472Handler is invoked outside the scope of its own @code{catch}. If
6473@var{handler} again throws to the same key, a new handler from further
6474up the call chain is invoked.
6475
6476If the key is @code{#t}, then a throw to @emph{any} symbol will match
6477this call to @code{catch}.
6478@end deffn
6479
6480\flazy-catch
6481@c snarfed from throw.c:556
6482@deffn primitive lazy-catch tag thunk handler
6483This behaves exactly like @code{catch}, except that it does
6484not unwind the stack (this is the major difference), and if
6485handler returns, its value is returned from the throw.
6486@end deffn
6487
6488\fthrow
6489@c snarfed from throw.c:589
6490@deffn primitive throw key . args
6491Invoke the catch form matching @var{key}, passing @var{args} to the
6492@var{handler}.
6493
6494@var{key} is a symbol. It will match catches of the same symbol or of
6495#t.
6496
6497If there is no handler at all, an error is signaled.
6498@end deffn
6499
6500\funiform-vector-length
6501@c snarfed from unif.c:255
6502@deffn primitive uniform-vector-length v
6503Returns the number of elements in @var{uve}.
6504@end deffn
6505
6506\farray?
6507@c snarfed from unif.c:289
6508@deffn primitive array? v [prot]
6509Returns @code{#t} if the @var{obj} is an array, and @code{#f} if not.
6510
6511The @var{prototype} argument is used with uniform arrays and is described
6512elsewhere.
6513@end deffn
6514
6515\farray-rank
6516@c snarfed from unif.c:360
6517@deffn primitive array-rank ra
6518Returns the number of dimensions of @var{obj}. If @var{obj} is not an
6519array, @code{0} is returned.
6520@end deffn
6521
6522\farray-dimensions
6523@c snarfed from unif.c:398
6524@deffn primitive array-dimensions ra
6525@code{Array-dimensions} is similar to @code{array-shape} but replaces
6526elements with a @code{0} minimum with one greater than the maximum. So:
6527@example
6528(array-dimensions (make-array 'foo '(-1 3) 5)) @result{} ((-1 3) 5)
6529@end example
6530@end deffn
6531
6532\fshared-array-root
6533@c snarfed from unif.c:445
6534@deffn primitive shared-array-root ra
6535Return the root vector of a shared array.
6536@end deffn
6537
6538\fshared-array-offset
6539@c snarfed from unif.c:456
6540@deffn primitive shared-array-offset ra
6541Return the root vector index of the first element in the array.
6542@end deffn
6543
6544\fshared-array-increments
6545@c snarfed from unif.c:467
6546@deffn primitive shared-array-increments ra
6547For each dimension, return the distance between elements in the root vector.
6548@end deffn
6549
6550\fdimensions->uniform-array
6551@c snarfed from unif.c:586
6552@deffn primitive dimensions->uniform-array dims prot [fill]
6553@deffnx primitive make-uniform-vector length prototype [fill]
6554Creates and returns a uniform array or vector of type corresponding to
6555@var{prototype} with dimensions @var{dims} or length @var{length}. If
6556@var{fill} is supplied, it's used to fill the array, otherwise
6557@var{prototype} is used.
6558@end deffn
6559
6560\fmake-shared-array
6561@c snarfed from unif.c:672
6562@deffn primitive make-shared-array oldra mapfunc . dims
6563@code{make-shared-array} can be used to create shared subarrays of other
6564arrays. The @var{mapper} is a function that translates coordinates in
6565the new array into coordinates in the old array. A @var{mapper} must be
6566linear, and its range must stay within the bounds of the old array, but
6567it can be otherwise arbitrary. A simple example:
6568@example
6569(define fred (make-array #f 8 8))
6570(define freds-diagonal
6571 (make-shared-array fred (lambda (i) (list i i)) 8))
6572(array-set! freds-diagonal 'foo 3)
6573(array-ref fred 3 3) @result{} foo
6574(define freds-center
6575 (make-shared-array fred (lambda (i j) (list (+ 3 i) (+ 3 j))) 2 2))
6576(array-ref freds-center 0 0) @result{} foo
6577@end example
6578@end deffn
6579
6580\ftranspose-array
6581@c snarfed from unif.c:802
6582@deffn primitive transpose-array ra . args
6583Returns an array sharing contents with @var{array}, but with dimensions
6584arranged in a different order. There must be one @var{dim} argument for
6585each dimension of @var{array}. @var{dim0}, @var{dim1}, @dots{} should
6586be integers between 0 and the rank of the array to be returned. Each
6587integer in that range must appear at least once in the argument list.
6588
6589The values of @var{dim0}, @var{dim1}, @dots{} correspond to dimensions
6590in the array to be returned, their positions in the argument list to
6591dimensions of @var{array}. Several @var{dim}s may have the same value,
6592in which case the returned array will have smaller rank than
6593@var{array}.
6594
6595examples:
6596@example
6597(transpose-array '#2((a b) (c d)) 1 0) @result{} #2((a c) (b d))
6598(transpose-array '#2((a b) (c d)) 0 0) @result{} #1(a d)
6599(transpose-array '#3(((a b c) (d e f)) ((1 2 3) (4 5 6))) 1 1 0) @result{}
6600 #2((a 4) (b 5) (c 6))
6601@end example
6602@end deffn
6603
6604\fenclose-array
6605@c snarfed from unif.c:911
6606@deffn primitive enclose-array ra . axes
6607@var{dim0}, @var{dim1} @dots{} should be nonnegative integers less than
6608the rank of @var{array}. @var{enclose-array} returns an array
6609resembling an array of shared arrays. The dimensions of each shared
6610array are the same as the @var{dim}th dimensions of the original array,
6611the dimensions of the outer array are the same as those of the original
6612array that did not match a @var{dim}.
6613
6614An enclosed array is not a general Scheme array. Its elements may not
6615be set using @code{array-set!}. Two references to the same element of
6616an enclosed array will be @code{equal?} but will not in general be
6617@code{eq?}. The value returned by @var{array-prototype} when given an
6618enclosed array is unspecified.
6619
6620examples:
6621@example
6622(enclose-array '#3(((a b c) (d e f)) ((1 2 3) (4 5 6))) 1) @result{}
6623 #<enclosed-array (#1(a d) #1(b e) #1(c f)) (#1(1 4) #1(2 5) #1(3 6))>
6624
6625(enclose-array '#3(((a b c) (d e f)) ((1 2 3) (4 5 6))) 1 0) @result{}
6626 #<enclosed-array #2((a 1) (d 4)) #2((b 2) (e 5)) #2((c 3) (f 6))>
6627@end example
6628@end deffn
6629
6630\farray-in-bounds?
6631@c snarfed from unif.c:994
6632@deffn primitive array-in-bounds? v . args
6633Returns @code{#t} if its arguments would be acceptable to array-ref.
6634@end deffn
6635
6636\farray-ref
6637@c snarfed from unif.c:1073
6638@deffn primitive array-ref
6639scm_uniform_vector_ref
6640@end deffn
6641
6642\funiform-vector-ref
6643@c snarfed from unif.c:1079
6644@deffn primitive uniform-vector-ref v args
6645@deffnx primitive array-ref v . args
6646Returns the element at the @code{(index1, index2)} element in @var{array}.
6647@end deffn
6648
6649\funiform-array-set1!
6650@c snarfed from unif.c:1248
6651@deffn primitive uniform-array-set1!
6652scm_array_set_x
6653@end deffn
6654
6655\farray-set!
6656@c snarfed from unif.c:1257
6657@deffn primitive array-set! v obj . args
6658@deffnx primitive uniform-array-set1! v obj args
6659Sets the element at the @code{(index1, index2)} element in @var{array} to
6660@var{new-value}. The value returned by array-set! is unspecified.
6661@end deffn
6662
6663\farray-contents
6664@c snarfed from unif.c:1372
6665@deffn primitive array-contents ra [strict]
6666@deffnx primitive array-contents array strict
6667If @var{array} may be @dfn{unrolled} into a one dimensional shared array
6668without changing their order (last subscript changing fastest), then
6669@code{array-contents} returns that shared array, otherwise it returns
6670@code{#f}. All arrays made by @var{make-array} and
6671@var{make-uniform-array} may be unrolled, some arrays made by
6672@var{make-shared-array} may not be.
6673
6674If the optional argument @var{strict} is provided, a shared array will
6675be returned only if its elements are stored internally contiguous in
6676memory.
6677@end deffn
6678
6679\funiform-array-read!
6680@c snarfed from unif.c:1486
6681@deffn primitive uniform-array-read! ra [port_or_fd [start [end]]]
6682@deffnx primitive uniform-vector-read! uve [port-or-fdes] [start] [end]
6683Attempts to read all elements of @var{ura}, in lexicographic order, as
6684binary objects from @var{port-or-fdes}.
6685If an end of file is encountered during
6686uniform-array-read! the objects up to that point only are put into @var{ura}
6687(starting at the beginning) and the remainder of the array is
6688unchanged.
6689
6690The optional arguments @var{start} and @var{end} allow
6691a specified region of a vector (or linearized array) to be read,
6692leaving the remainder of the vector unchanged.
6693
6694@code{uniform-array-read!} returns the number of objects read.
6695@var{port-or-fdes} may be omitted, in which case it defaults to the value
6696returned by @code{(current-input-port)}.
6697@end deffn
6698
6699\funiform-array-write
6700@c snarfed from unif.c:1649
6701@deffn primitive uniform-array-write v [port_or_fd [start [end]]]
6702@deffnx primitive uniform-vector-write uve [port-or-fdes] [start] [end]
6703Writes all elements of @var{ura} as binary objects to
6704@var{port-or-fdes}.
6705
6706The optional arguments @var{start}
6707and @var{end} allow
6708a specified region of a vector (or linearized array) to be written.
6709
6710The number of objects actually written is returned.
6711@var{port-or-fdes} may be
6712omitted, in which case it defaults to the value returned by
6713@code{(current-output-port)}.
6714@end deffn
6715
6716\fbit-count
6717@c snarfed from unif.c:1774
6718@deffn primitive bit-count b bitvector
6719Returns the number of occurrences of the boolean @var{b} in
6720@var{bitvector}.
6721@end deffn
6722
6723\fbit-position
6724@c snarfed from unif.c:1813
6725@deffn primitive bit-position item v k
6726Returns the minimum index of an occurrence of @var{bool} in @var{bv}
6727which is at least @var{k}. If no @var{bool} occurs within the specified
6728range @code{#f} is returned.
6729@end deffn
6730
6731\fbit-set*!
6732@c snarfed from unif.c:1881
6733@deffn primitive bit-set*! v kv obj
6734If uve is a bit-vector @var{bv} and uve must be of the same
6735length. If @var{bool} is @code{#t}, uve is OR'ed into
6736@var{bv}; If @var{bool} is @code{#f}, the inversion of uve is
6737AND'ed into @var{bv}.
6738
6739If uve is a unsigned integer vector all the elements of uve
6740must be between 0 and the @code{length} of @var{bv}. The bits
6741of @var{bv} corresponding to the indexes in uve are set to
6742@var{bool}. The return value is unspecified.
6743@end deffn
6744
6745\fbit-count*
6746@c snarfed from unif.c:1935
6747@deffn primitive bit-count* v kv obj
6748Returns
6749@example
6750(bit-count (bit-set*! (if bool bv (bit-invert! bv)) uve #t) #t).
6751@end example
6752@var{bv} is not modified.
6753@end deffn
6754
6755\fbit-invert!
6756@c snarfed from unif.c:1999
6757@deffn primitive bit-invert! v
6758Modifies @var{bv} by replacing each element with its negation.
6759@end deffn
6760
6761\farray->list
6762@c snarfed from unif.c:2077
6763@deffn primitive array->list v
6764Returns a list consisting of all the elements, in order, of @var{array}.
6765@end deffn
6766
6767\flist->uniform-array
6768@c snarfed from unif.c:2169
6769@deffn primitive list->uniform-array ndim prot lst
6770@deffnx procedure list->uniform-vector prot lst
6771Returns a uniform array of the type indicated by prototype @var{prot}
6772with elements the same as those of @var{lst}. Elements must be of the
6773appropriate type, no coercions are done.
6774@end deffn
6775
6776\farray-prototype
6777@c snarfed from unif.c:2520
6778@deffn primitive array-prototype ra
6779Returns an object that would produce an array of the same type as
6780@var{array}, if used as the @var{prototype} for
6781@code{make-uniform-array}.
6782@end deffn
6783
6784\fvalues
6785@c snarfed from values.c:83
6786@deffn primitive values . args
6787Delivers all of its arguments to its continuation. Except for
6788continuations created by the @code{call-with-values} procedure,
6789all continuations take exactly one value. The effect of
6790passing no value or more than one value to continuations that
6791were not created by @code{call-with-values} is unspecified.
6792@end deffn
6793
6794\fcall-with-values
6795@c snarfed from values.c:116
6796@deffn primitive call-with-values producer consumer
6797Calls its @var{producer} argument with no values and a
6798continuation that, when passed some values, calls the
6799@var{consumer} procedure with those values as arguments. The
6800continuation for the call to @var{consumer} is the continuation
6801of the call to @code{call-with-values}.
6802
6803@example
6804(call-with-values (lambda () (values 4 5))
6805 (lambda (a b) b))
6806 ==> 5
6807
6808@end example
6809@example
6810(call-with-values * -) ==> -1
6811@end example
6812@end deffn
6813
6814\fmake-variable
6815@c snarfed from variable.c:100
6816@deffn primitive make-variable init [name_hint]
6817Return a variable object initialized to value @var{init}.
6818If given, uses @var{name-hint} as its internal (debugging)
6819name, otherwise just treat it as an anonymous variable.
6820Remember, of course, that multiple bindings to the same
6821variable may exist, so @var{name-hint} is just that---a hint.
6822@end deffn
6823
6824\fmake-undefined-variable
6825@c snarfed from variable.c:124
6826@deffn primitive make-undefined-variable [name_hint]
6827Return a variable object initialized to an undefined value.
6828If given, uses @var{name-hint} as its internal (debugging)
6829name, otherwise just treat it as an anonymous variable.
6830Remember, of course, that multiple bindings to the same
6831variable may exist, so @var{name-hint} is just that---a hint.
6832@end deffn
6833
6834\fvariable?
6835@c snarfed from variable.c:145
6836@deffn primitive variable? obj
6837Return @code{#t} iff @var{obj} is a variable object, else
6838return @code{#f}
6839@end deffn
6840
6841\fvariable-ref
6842@c snarfed from variable.c:157
6843@deffn primitive variable-ref var
6844Dereference @var{var} and return its value.
6845@var{var} must be a variable object; see @code{make-variable}
6846and @code{make-undefined-variable}.
6847@end deffn
6848
6849\fvariable-set!
6850@c snarfed from variable.c:171
6851@deffn primitive variable-set! var val
6852Set the value of the variable @var{var} to @var{val}.
6853@var{var} must be a variable object, @var{val} can be any
6854value. Return an unspecified value.
6855@end deffn
6856
6857\fbuiltin-variable
6858@c snarfed from variable.c:185
6859@deffn primitive builtin-variable name
6860Return the built-in variable with the name @var{name}.
6861@var{name} must be a symbol (not a string).
6862Then use @code{variable-ref} to access its value.
6863@end deffn
6864
6865\fvariable-bound?
6866@c snarfed from variable.c:213
6867@deffn primitive variable-bound? var
6868Return @code{#t} iff @var{var} is bound to a value.
6869Throws an error if @var{var} is not a variable object.
6870@end deffn
6871
6872\fvector?
6873@c snarfed from vectors.c:142
6874@deffn primitive vector? obj
6875Returns @code{#t} if @var{obj} is a vector, otherwise returns
6876@code{#f}. (r5rs)
6877@end deffn
6878
6879\flist->vector
6880@c snarfed from vectors.c:161
6881@deffn primitive list->vector
6882scm_vector
6883@end deffn
6884
6885\fvector
6886@c snarfed from vectors.c:177
6887@deffn primitive vector . l
6888@deffnx primitive list->vector l
6889Returns a newly allocated vector whose elements contain the
6890given arguments. Analogous to @code{list}. (r5rs)
6891
6892@lisp
6893(vector 'a 'b 'c) @result{} #(a b c)
6894@end lisp
6895@end deffn
6896
6897\fmake-vector
6898@c snarfed from vectors.c:255
6899@deffn primitive make-vector k [fill]
6900Returns a newly allocated vector of @var{k} elements. If a second
6901argument is given, then each element is initialized to @var{fill}.
6902Otherwise the initial contents of each element is unspecified. (r5rs)
6903@end deffn
6904
6905\fvector->list
6906@c snarfed from vectors.c:311
6907@deffn primitive vector->list v
6908@samp{Vector->list} returns a newly allocated list of the
6909objects contained in the elements of @var{vector}. (r5rs)
6910
6911@lisp
6912(vector->list '#(dah dah didah)) @result{} (dah dah didah)
6913(list->vector '(dididit dah)) @result{} #(dididit dah)
6914@end lisp
6915@end deffn
6916
6917\fvector-fill!
6918@c snarfed from vectors.c:328
6919@deffn primitive vector-fill! v fill_x
6920Stores @var{fill} in every element of @var{vector}.
6921The value returned by @code{vector-fill!} is unspecified. (r5rs)
6922@end deffn
6923
6924\fvector-move-left!
6925@c snarfed from vectors.c:355
6926@deffn primitive vector-move-left! vec1 start1 end1 vec2 start2
6927Vector version of @code{substring-move-left!}.
6928@end deffn
6929
6930\fvector-move-right!
6931@c snarfed from vectors.c:378
6932@deffn primitive vector-move-right! vec1 start1 end1 vec2 start2
6933Vector version of @code{substring-move-right!}.
6934@end deffn
6935
6936\fmajor-version
6937@c snarfed from version.c:59
6938@deffn primitive major-version
6939Return a string containing Guile's major version number.
6940E.g., "1".
6941@end deffn
6942
6943\fminor-version
6944@c snarfed from version.c:71
6945@deffn primitive minor-version
6946Return a string containing Guile's minor version number.
6947E.g., "3.5".
6948@end deffn
6949
6950\fversion
6951@c snarfed from version.c:90
6952@deffn primitive version
6953@deffnx primitive major-version
6954@deffnx primitive minor-version
6955Return a string describing Guile's version number, or its major or minor
6956version numbers, respectively.
6957
6958@example
6959(version) @result{} "1.3a"
6960(major-version) @result{} "1"
6961(minor-version) @result{} "3a"
6962@end example
6963@end deffn
6964
6965\fmake-soft-port
6966@c snarfed from vports.c:184
6967@deffn primitive make-soft-port pv modes
6968Returns a port capable of receiving or delivering characters as
6969specified by the @var{modes} string (@pxref{File Ports,
6970open-file}). @var{vector} must be a vector of length 6. Its components
6971are as follows:
6972
6973@enumerate 0
6974@item
6975procedure accepting one character for output
6976@item
6977procedure accepting a string for output
6978@item
6979thunk for flushing output
6980@item
6981thunk for getting one character
6982@item
6983thunk for closing port (not by garbage collection)
6984@end enumerate
6985
6986For an output-only port only elements 0, 1, 2, and 4 need be
6987procedures. For an input-only port only elements 3 and 4 need be
6988procedures. Thunks 2 and 4 can instead be @code{#f} if there is no useful
6989operation for them to perform.
6990
6991If thunk 3 returns @code{#f} or an @code{eof-object} (@pxref{Input,
6992eof-object?, ,r4rs, The Revised^4 Report on Scheme}) it indicates that
6993the port has reached end-of-file. For example:
6994
6995@example
6996(define stdout (current-output-port))
6997(define p (make-soft-port
6998 (vector
6999 (lambda (c) (write c stdout))
7000 (lambda (s) (display s stdout))
7001 (lambda () (display "." stdout))
7002 (lambda () (char-upcase (read-char)))
7003 (lambda () (display "@@" stdout)))
7004 "rw"))
7005
7006(write p p) @result{} #<input-output: soft 8081e20>
7007@end example
7008@end deffn
7009
7010\fmake-weak-vector
7011@c snarfed from weaks.c:62
7012@deffn primitive make-weak-vector k [fill]
7013Return a weak vector with @var{size} elements. If the optional
7014argument @var{fill} is given, all entries in the vector will be set to
7015@var{fill}. The default value for @var{fill} is the empty list.
7016@end deffn
7017
7018\flist->weak-vector
7019@c snarfed from weaks.c:79
7020@deffn primitive list->weak-vector
7021scm_weak_vector
7022@end deffn
7023
7024\fweak-vector
7025@c snarfed from weaks.c:87
7026@deffn primitive weak-vector . l
7027@deffnx primitive list->weak-vector l
7028Construct a weak vector from a list: @code{weak-vector} uses the list of
7029its arguments while @code{list->weak-vector} uses its only argument
7030@var{l} (a list) to construct a weak vector the same way
7031@code{vector->list} would.
7032@end deffn
7033
7034\fweak-vector?
7035@c snarfed from weaks.c:110
7036@deffn primitive weak-vector? x
7037Return @code{#t} if @var{obj} is a weak vector. Note that all
7038weak hashes are also weak vectors.
7039@end deffn
7040
7041\fmake-weak-key-hash-table
7042@c snarfed from weaks.c:130
7043@deffn primitive make-weak-key-hash-table k
7044@deffnx primitive make-weak-value-hash-table size
7045@deffnx primitive make-doubly-weak-hash-table size
7046Return a weak hash table with @var{size} buckets. As with any hash
7047table, choosing a good size for the table requires some caution.
7048
7049You can modify weak hash tables in exactly the same way you would modify
7050regular hash tables. (@pxref{Hash Tables})
7051@end deffn
7052
7053\fmake-weak-value-hash-table
7054@c snarfed from weaks.c:147
7055@deffn primitive make-weak-value-hash-table k
7056Return a hash table with weak values with @var{size} buckets.
7057(@pxref{Hash Tables})
7058@end deffn
7059
7060\fmake-doubly-weak-hash-table
7061@c snarfed from weaks.c:165
7062@deffn primitive make-doubly-weak-hash-table k
7063Return a hash table with weak keys and values with @var{size}
7064buckets. (@pxref{Hash Tables})
7065@end deffn
7066
7067\fweak-key-hash-table?
7068@c snarfed from weaks.c:184
7069@deffn primitive weak-key-hash-table? x
7070@deffnx primitive weak-value-hash-table? obj
7071@deffnx primitive doubly-weak-hash-table? obj
7072Return @code{#t} if @var{obj} is the specified weak hash
7073table. Note that a doubly weak hash table is neither a weak key
7074nor a weak value hash table.
7075@end deffn
7076
7077\fweak-value-hash-table?
7078@c snarfed from weaks.c:194
7079@deffn primitive weak-value-hash-table? x
7080Return @code{#t} if @var{x} is a weak value hash table.
7081@end deffn
7082
7083\fdoubly-weak-hash-table?
7084@c snarfed from weaks.c:204
7085@deffn primitive doubly-weak-hash-table? x
7086Return @code{#t} if @var{x} is a doubly weak hash table.
7087@end deffn