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