Commit | Line | Data |
---|---|---|
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) | |
6 | Add a new key-value pair to @var{alist}. A new pair is | |
780ee65e NJ |
7 | created whose car is @var{key} and whose cdr is @var{value}, and the |
8 | pair is consed onto @var{alist}, and the new list is returned. This | |
9 | function 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 |
16 | Behaves like @code{assq} but does not do any error checking. |
17 | Recommended 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 |
24 | Behaves like @code{assv} but does not do any error checking. |
25 | Recommended 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 |
32 | Behaves like @code{assoc} but does not do any error checking. |
33 | Recommended 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) | |
42 | Fetch the entry in @var{alist} that is associated with @var{key}. To | |
780ee65e NJ |
43 | decide whether the argument @var{key} matches a particular entry in |
44 | @var{alist}, @code{assq} compares keys with @code{eq?}, @code{assv} | |
45 | uses @code{eqv?} and @code{assoc} uses @code{equal?}. If @var{key} | |
46 | cannot be found in @var{alist} (according to whichever equality | |
8f85c0c6 | 47 | predicate is in use), then return @code{#f}. These functions |
780ee65e NJ |
48 | return 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 |
55 | Behaves 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 |
62 | Behaves 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 |
71 | Like @code{assq}, @code{assv} and @code{assoc}, except that only the |
72 | value associated with @var{key} in @var{alist} is returned. These | |
73 | functions are equivalent to | |
74 | ||
75 | @lisp | |
76 | (let ((ent (@var{associator} @var{key} @var{alist}))) | |
77 | (and ent (cdr ent))) | |
78 | @end lisp | |
79 | ||
80 | where @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 |
87 | Behaves 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 |
94 | Behaves 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 |
103 | Reassociate @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}, | |
106 | add a new one. Return the (possibly new) alist. | |
107 | ||
108 | These functions do not attempt to verify the structure of @var{alist}, | |
109 | and so may cause unusual results if passed an object that is not an | |
110 | association 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 |
117 | Behaves 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 |
124 | Behaves 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 |
133 | Delete the first entry in @var{alist} associated with @var{key}, and return |
134 | the 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 |
141 | Behaves 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 |
148 | Behaves 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 |
155 | Return an object of type arbiter and name @var{name}. Its |
156 | state is initially unlocked. Arbiters are a way to achieve | |
157 | process 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 |
164 | Return @code{#t} and lock the arbiter @var{arb} if the arbiter |
165 | was 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 |
172 | Return @code{#t} and unlock the arbiter @var{arb} if the |
173 | arbiter 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 |
180 | Create 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 |
187 | Create a new async for the procedure @var{thunk}. Also |
188 | add 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 |
195 | Mark 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 |
202 | Mark 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 |
209 | Execute 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 |
216 | Do nothing. When called without arguments, return @code{#f}, |
217 | otherwise 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 |
224 | Unmask 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 |
231 | Mask 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 |
238 | Display an error message to the output port @var{port}. |
239 | @var{stack} is the saved stack for the error, @var{subr} is | |
198586ed | 240 | the name of the procedure in which the error occurred and |
780ee65e NJ |
241 | @var{message} is the actual error message, which may contain |
242 | formatting instructions. These will format the arguments in | |
243 | the list @var{args} accordingly. @var{rest} is currently | |
244 | ignored. | |
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 |
251 | Display a procedure application @var{frame} to the output port |
252 | @var{port}. @var{indent} specifies the indentation of the | |
253 | output. | |
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 |
260 | Display a backtrace to the output port @var{port}. @var{stack} |
261 | is the stack to take the backtrace from, @var{first} specifies | |
262 | where in the stack to start and @var{depth} how much frames | |
263 | to display. Both @var{first} and @var{depth} can be @code{#f}, | |
264 | which 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 |
271 | Display a backtrace of the stack saved by the last error |
272 | to 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 |
279 | Return @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 |
286 | Return @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 |
293 | Return @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 |
299 | Return @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 |
305 | Return @code{#t} iff @var{x} is less than @var{y} in the ASCII sequence, |
306 | else @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 |
312 | Return @code{#t} iff @var{x} is less than or equal to @var{y} in the |
313 | ASCII 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 |
319 | Return @code{#t} iff @var{x} is greater than @var{y} in the ASCII |
320 | sequence, 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 |
326 | Return @code{#t} iff @var{x} is greater than or equal to @var{y} in the |
327 | ASCII 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 |
333 | Return @code{#t} iff @var{x} is the same character as @var{y} ignoring |
334 | case, 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 |
340 | Return @code{#t} iff @var{x} is less than @var{y} in the ASCII sequence |
341 | ignoring 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 |
347 | Return @code{#t} iff @var{x} is less than or equal to @var{y} in the |
348 | ASCII 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 |
354 | Return @code{#t} iff @var{x} is greater than @var{y} in the ASCII |
355 | sequence 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 |
361 | Return @code{#t} iff @var{x} is greater than or equal to @var{y} in the |
362 | ASCII 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 |
369 | Return @code{#t} iff @var{chr} is alphabetic, else @code{#f}. |
370 | Alphabetic 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 |
377 | Return @code{#t} iff @var{chr} is numeric, else @code{#f}. |
378 | Numeric 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 |
385 | Return @code{#t} iff @var{chr} is whitespace, else @code{#f}. |
386 | Whitespace 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 |
393 | Return @code{#t} iff @var{chr} is uppercase, else @code{#f}. |
394 | Uppercase 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 |
401 | Return @code{#t} iff @var{chr} is lowercase, else @code{#f}. |
402 | Lowercase 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 |
409 | Return @code{#t} iff @var{chr} is either uppercase or lowercase, else @code{#f}. |
410 | Uppercase and lowercase are as defined by the isupper and islower | |
411 | C 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 |
418 | Return the number corresponding to ordinal position of @var{chr} in the |
419 | ASCII 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 |
426 | Return 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 |
433 | Return 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 |
440 | Return 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 |
447 | Option interface for the debug options. Instead of using |
448 | this 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 |
456 | Call @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 |
463 | Return @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 |
470 | Unmemoize 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 |
477 | Return 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 |
484 | Return 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 |
491 | Return 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 |
498 | Return 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 |
505 | Evaluate @var{exp} in its environment. If @var{env} is supplied, |
506 | it is the environment in which to evaluate @var{exp}. Otherwise, | |
507 | @var{exp} must be a memoized code object (in which case, its environment | |
508 | is 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 |
515 | Return @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 |
522 | Find the shared object (shared library) denoted by |
523 | @var{filename} and link it into the running Guile | |
524 | application. The returned | |
525 | scheme object is a ``handle'' for the library which can | |
526 | be passed to @code{dynamic-func}, @code{dynamic-call} etc. | |
527 | ||
528 | Searching for object files is system dependent. Normally, | |
529 | if @var{filename} does have an explicit directory it will | |
530 | be searched for in locations | |
531 | such 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 |
538 | Return @code{#t} if @var{obj} is a dynamic object handle, |
539 | or @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 |
546 | Unlink a dynamic object from the application, if possible. The |
547 | object must have been linked by @code{dynamic-link}, with | |
548 | @var{dobj} the corresponding handle. After this procedure | |
549 | is called, the handle can no longer be used to access the | |
550 | object. | |
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 |
557 | Return a ``handle'' for the function @var{name} in the |
558 | shared object referred to by @var{dobj}. The handle | |
559 | can be passed to @code{dynamic-call} to actually | |
560 | call the function. | |
780ee65e | 561 | |
dd235de4 GH |
562 | Regardless 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} | |
565 | since 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 |
572 | Call a C function in a dynamic object. Two styles of |
573 | invocation 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 | |
578 | ignored | |
579 | @item @var{func} can be a string with the name of the | |
580 | function to call, with @var{dobj} the handle of the | |
581 | dynamic object in which to find the function. | |
582 | This 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 |
589 | In either case, the function is passed no arguments |
590 | and 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 |
597 | Call the C function indicated by @var{func} and @var{dobj}, |
598 | just like @code{dynamic-call}, but pass it some arguments and | |
599 | return its return value. The C function is expected to take | |
600 | two arguments and return an @code{int}, just like @code{main}: | |
780ee65e NJ |
601 | @smallexample |
602 | int c_func (int argc, char **argv); | |
603 | @end smallexample | |
604 | ||
ae9f3a15 MG |
605 | The parameter @var{args} must be a list of strings and is |
606 | converted into an array of @code{char *}. The array is passed | |
607 | in @var{argv} and its size in @var{argc}. The return value is | |
608 | converted 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 | 616 | All 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 |
620 | If, any time during the execution of @var{thunk}, the |
621 | continuation of the @code{dynamic_wind} expression is escaped | |
622 | non-locally, @var{out_guard} is called. If the continuation of | |
623 | the 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 | |
625 | times. | |
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: |
649 | special-binding | |
650 | ;; Evaluates to: | |
651 | @result{} a-cont | |
780ee65e NJ |
652 | x |
653 | @result{} normal-binding | |
780ee65e NJ |
654 | (a-cont #f) |
655 | ;; Prints: | |
656 | special-binding | |
657 | ;; Evaluates to: | |
658 | @result{} a-cont ;; the value of the (define a-cont...) | |
780ee65e NJ |
659 | x |
660 | @result{} normal-binding | |
780ee65e NJ |
661 | a-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 |
670 | Return @code{#t} if @var{obj} is an environment, or @code{#f} |
671 | otherwise. | |
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 |
678 | Return @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 |
686 | Return 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 |
695 | Iterate over all the bindings in @var{env}, accumulating some |
696 | value. | |
697 | For each binding in @var{env}, apply @var{proc} to the symbol | |
698 | bound, its value, and the result from the previous application | |
699 | of @var{proc}. | |
700 | Use @var{init} as @var{proc}'s third argument the first time | |
701 | @var{proc} is applied. | |
702 | If @var{env} contains no bindings, this function simply returns | |
703 | @var{init}. | |
704 | If @var{env} binds the symbol sym1 to the value val1, sym2 to | |
705 | val2, 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 |
713 | Each binding in @var{env} will be processed exactly once. |
714 | @code{environment-fold} makes no guarantees about the order in | |
715 | which the bindings are processed. | |
716 | Here is a function which, given an environment, constructs an | |
717 | association list representing that environment's bindings, | |
718 | using 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 |
732 | Bind @var{sym} to a new location containing @var{val} in |
733 | @var{env}. If @var{sym} is already bound to another location | |
734 | in @var{env} and the binding is mutable, that binding is | |
735 | replaced. The new binding and location are both mutable. The | |
736 | return value is unspecified. | |
737 | If @var{sym} is already bound in @var{env}, and the binding is | |
738 | immutable, 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 |
745 | Remove any binding for @var{sym} from @var{env}. If @var{sym} |
746 | is unbound in @var{env}, do nothing. The return value is | |
747 | unspecified. | |
748 | If @var{sym} is already bound in @var{env}, and the binding is | |
749 | immutable, 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 |
756 | If @var{env} binds @var{sym} to some location, change that |
757 | location's value to @var{val}. The return value is | |
758 | unspecified. | |
759 | If @var{sym} is not bound in @var{env}, signal an | |
760 | @code{environment:unbound} error. If @var{env} binds @var{sym} | |
761 | to 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 |
769 | Return the value cell which @var{env} binds to @var{sym}, or |
770 | @code{#f} if the binding does not live in a value cell. | |
771 | The argument @var{for-write} indicates whether the caller | |
772 | intends to modify the variable's value by mutating the value | |
773 | cell. If the variable is immutable, then | |
774 | @code{environment-cell} signals an | |
775 | @code{environment:immutable-location} error. | |
776 | If @var{sym} is unbound in @var{env}, signal an | |
777 | @code{environment:unbound} error. | |
778 | If you use this function, you should consider using | |
779 | @code{environment-observe}, to be notified when @var{sym} gets | |
780 | re-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 |
787 | Whenever @var{env}'s bindings change, apply @var{proc} to |
788 | @var{env}. | |
789 | This function returns an object, token, which you can pass to | |
790 | @code{environment-unobserve} to remove @var{proc} from the set | |
791 | of procedures observing @var{env}. The type and value of | |
792 | token 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 |
799 | This function is the same as environment-observe, except that |
800 | the reference @var{env} retains to @var{proc} is a weak | |
801 | reference. This means that, if there are no other live, | |
802 | non-weak references to @var{proc}, it will be | |
803 | garbage-collected, and dropped from @var{env}'s | |
804 | list 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 |
811 | Cancel the observation request which returned the value |
812 | @var{token}. The return value is unspecified. | |
813 | If a call @code{(environment-observe env proc)} returns | |
814 | @var{token}, then the call @code{(environment-unobserve token)} | |
815 | will cause @var{proc} to no longer be called when @var{env}'s | |
816 | bindings 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 |
823 | Create a new leaf environment, containing no bindings. |
824 | All bindings and locations created in the new environment | |
825 | will 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 |
832 | Return @code{#t} if object is a leaf environment, or @code{#f} |
833 | otherwise. | |
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 |
840 | Return a new environment object eval whose bindings are the |
841 | union of the bindings in the environments @var{local} and | |
842 | @var{imported}, with bindings from @var{local} taking | |
843 | precedence. Definitions made in eval are placed in @var{local}. | |
844 | Applying @code{environment-define} or | |
845 | @code{environment-undefine} to eval has the same effect as | |
846 | applying the procedure to @var{local}. | |
847 | Note that eval incorporates @var{local} and @var{imported} by | |
848 | reference: | |
849 | If, after creating eval, the program changes the bindings of | |
850 | @var{local} or @var{imported}, those changes will be visible | |
851 | in eval. | |
852 | Since most Scheme evaluation takes place in eval environments, | |
853 | they transparently cache the bindings received from @var{local} | |
854 | and @var{imported}. Thus, the first time the program looks up | |
855 | a symbol in eval, eval may make calls to @var{local} or | |
856 | @var{imported} to find their bindings, but subsequent | |
857 | references to that symbol will be as fast as references to | |
858 | bindings in finite environments. | |
859 | In 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 |
867 | Return @code{#t} if object is an eval environment, or @code{#f} |
868 | otherwise. | |
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 |
875 | Return 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 |
882 | Change @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 |
889 | Return 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 |
896 | Change @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 |
903 | Return a new environment @var{imp} whose bindings are the union |
904 | of 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. | |
908 | If two different elements of @var{imports} have a binding for | |
909 | the same symbol, the @var{conflict-proc} is called with the | |
910 | following parameters: the import environment, the symbol and | |
911 | the list of the imported environments that bind the symbol. | |
912 | If the @var{conflict-proc} returns an environment @var{env}, | |
913 | the conflict is considered as resolved and the binding from | |
914 | @var{env} is used. If the @var{conflict-proc} returns some | |
915 | non-environment object, the conflict is considered unresolved | |
916 | and the symbol is treated as unspecified in the import | |
917 | environment. | |
918 | The checking for conflicts may be performed lazily, i. e. at | |
919 | the moment when a value or binding for a certain symbol is | |
920 | requested instead of the moment when the environment is | |
921 | created or the bindings of the imports change. | |
922 | All 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, | |
926 | notice that the set of bindings in @var{imp} may still change, | |
927 | if 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 |
934 | Return @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 |
942 | Return the list of environments imported by the import |
943 | environment @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 |
950 | Change @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 |
958 | Return a new environment @var{exp} containing only those |
959 | bindings in private whose symbols are present in | |
960 | @var{signature}. The @var{private} argument must be an | |
961 | environment. | |
962 | ||
963 | The 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 ...) | |
970 | where 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 | |
988 | It is an error for an element of signature to specify both | |
989 | @code{mutable-location} and @code{immutable-location}. If | |
990 | neither is specified, @code{immutable-location} is assumed. | |
991 | ||
992 | As a special case, if an element of signature is a lone | |
993 | symbol @var{sym}, it is equivalent to an element of the form | |
994 | @code{(sym)}. | |
995 | ||
996 | All 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, | |
1000 | notice that the set of bindings in @var{exp} may still change, | |
1001 | if 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 |
1008 | Return @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 |
1016 | Return 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 |
1023 | Change 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 |
1030 | Return 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 |
1037 | Change 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 |
1043 | Return @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 | |
1045 | capable 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 |
1052 | The @code{eqv?} procedure defines a useful equivalence relation on objects. |
1053 | Briefly, it returns @code{#t} if @var{x} and @var{y} should normally be | |
1054 | regarded as the same object. This relation is left slightly open to | |
1055 | interpretation, but works for comparing immediate integers, characters, | |
1056 | and 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 |
1062 | Return @code{#t} iff @var{x} and @var{y} are recursively @code{eqv?} equivalent. |
1063 | @code{equal?} recursively compares the contents of pairs, | |
1064 | vectors, and strings, applying @code{eqv?} on other objects such as | |
1065 | numbers and symbols. A rule of thumb is that objects are generally | |
1066 | @code{equal?} if they print the same. @code{equal?} may fail to | |
1067 | terminate 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 |
1074 | Raise an error with key @var{key}. @var{subr} can be a string |
1075 | naming 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, | |
1078 | these are replaced by formatting the corresponding members of | |
1079 | @var{args}: @code{~A} (was @code{%s} in older versions of | |
1080 | Guile) 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 | |
1084 | Unix @code{errno} value; If @var{key} is @code{signal} then it | |
1085 | should be a list containing the Unix signal number; otherwise | |
1086 | it 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 |
1093 | Return the Unix error message corresponding to @var{err}, which |
1094 | must 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 |
1101 | Given a list (@var{arg1} @dots{} @var{args}), this function |
1102 | conses 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 | |
1105 | a list whose last element is a list. | |
1106 | Note: Rather than do new consing, @code{apply:nconc2last} | |
1107 | destroys 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 |
1114 | If the promise @var{x} has not been computed yet, compute and |
1115 | return @var{x}, otherwise just return the previously computed | |
1116 | value. | |
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 | 1123 | Return 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 |
1131 | Create and return a new pair whose car and cdr are @var{x} and @var{y}. |
1132 | Any source properties associated with @var{xorig} are also associated | |
1133 | with 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 |
1140 | Recursively copy the data tree that is bound to @var{obj}, and return a |
1141 | pointer to the new data structure. @code{copy-tree} recurses down the | |
1142 | contents of both pairs and vectors (since both cons cells and vector | |
1143 | cells may point to arbitrary objects), and stops recursing when it hits | |
1144 | any 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 |
1151 | Evaluate @var{exp} in the top-level environment specified by |
1152 | the 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 |
1159 | Evaluate @var{exp}, a list representing a Scheme expression, |
1160 | in the top-level environment specified by @var{module}. | |
8f85c0c6 | 1161 | While @var{exp} is evaluated (using @code{primitive-eval}), |
780ee65e NJ |
1162 | @var{module} is made the current module. The current module |
1163 | is 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 |
1170 | Option interface for the evaluation options. Instead of using |
1171 | this 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 |
1179 | Option 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 | 1186 | Return @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 |
1192 | implemented 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 | 1199 | Load and initialize the extension designated by LIB and INIT. |
9401323e NJ |
1200 | When there is no pre-registered function for LIB/INIT, this is |
1201 | equivalent to | |
1202 | ||
1203 | @lisp | |
1204 | (dynamic-call INIT (dynamic-link LIB)) | |
1205 | @end lisp | |
1206 | ||
1207 | When there is a pre-registered function, that function is called | |
1208 | instead. | |
1209 | ||
1210 | Normally, there is no pre-registered function. This option exists | |
1211 | only for situations where dynamic linking is unavailable or unwanted. | |
1212 | In that case, you would statically link your program with the desired | |
1213 | library, and register its init function right after Guile has been | |
1214 | initialized. | |
1215 | ||
1216 | LIB should be a string denoting a shared library without any file type | |
1217 | suffix such as ".so". The suffix is provided automatically. It | |
1218 | should also not contain any directory components. Libraries that | |
1219 | implement Guile Extensions should be put into the normal locations for | |
1220 | shared libraries. We recommend to use the naming convention | |
1221 | libguile-bla-blum for a extension related to a module `(bla blum)'. | |
1222 | ||
1223 | The normal way for a extension to be used is to write a small Scheme | |
1224 | file that defines a module, and to load the extension into this | |
1225 | module. When the module is auto-loaded, the extension is loaded as | |
1226 | well. 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 |
1240 | Return the list of command line arguments passed to Guile, as a list of |
1241 | strings. The list includes the invoked program name, which is usually | |
1242 | @code{"guile"}, but excludes switches and parameters for command line | |
1243 | options 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 |
1250 | Return a newly created fluid. |
1251 | Fluids are objects of a certain type (a smob) that can hold one SCM | |
1252 | value per dynamic root. That is, modifications to this value are | |
1253 | only visible to code that executes within the same dynamic root as | |
1254 | the modifying code. When a new dynamic root is constructed, it | |
1255 | inherits the values from its parent. Because each thread executes | |
1256 | in 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 |
1263 | Return @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 |
1271 | Return the value associated with @var{fluid} in the current |
1272 | dynamic 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 | 1280 | Set 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 |
1287 | Set @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 | |
1289 | number of their values to be applied. Each substitution is done | |
1290 | one 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 |
1297 | Set the buffering mode for @var{port}. @var{mode} can be: |
1298 | @table @code | |
1299 | @item _IONBF | |
1300 | non-buffered | |
1301 | @item _IOLBF | |
1302 | line buffered | |
1303 | @item _IOFBF | |
1304 | block buffered, using a newly allocated buffer of @var{size} bytes. | |
1305 | If @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 | 1313 | Determine 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 |
1320 | Open the file whose name is @var{filename}, and return a port |
1321 | representing that file. The attributes of the port are | |
1322 | determined by the @var{mode} string. The way in which this is | |
1323 | interpreted is similar to C stdio. The first character must be | |
1324 | one of the following: | |
1325 | @table @samp | |
1326 | @item r | |
1327 | Open an existing file for input. | |
1328 | @item w | |
1329 | Open a file for output, creating it if it doesn't already exist | |
1330 | or removing its contents if it does. | |
1331 | @item a | |
1332 | Open a file for output, creating it if it doesn't already | |
1333 | exist. All writes to the port will go to the end of the file. | |
1334 | The "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 |
1337 | The following additional characters can be appended: |
1338 | @table @samp | |
1339 | @item + | |
1340 | Open the port for both input and output. E.g., @code{r+}: open | |
1341 | an existing file for both input and output. | |
1342 | @item 0 | |
1343 | Create an "unbuffered" port. In this case input and output | |
1344 | operations are passed directly to the underlying port | |
1345 | implementation without additional buffering. This is likely to | |
1346 | slow down I/O operations. The buffering mode can be changed | |
1347 | while a port is in use @pxref{Ports and File Descriptors, | |
1348 | setvbuf} | |
1349 | @item l | |
1350 | Add line-buffering to the port. The port output buffer will be | |
1351 | automatically flushed whenever a newline character is written. | |
780ee65e | 1352 | @end table |
9401323e NJ |
1353 | In theory we could create read/write ports which were buffered |
1354 | in one direction only. However this isn't included in the | |
1355 | current interfaces. If a file cannot be opened with the access | |
1356 | requested, @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 |
1363 | Return an association list of statistics about Guile's current |
1364 | use 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 |
1371 | Return an integer that for the lifetime of @var{obj} is uniquely |
1372 | returned 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 |
1379 | Scans all of SCM objects and reclaims for further use those that are |
1380 | no 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 |
1387 | Return a list consisting of the names of all slots belonging to |
1388 | class @var{class}, i. e. the slots of @var{class} and of all of | |
1389 | its 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 |
1396 | Determine an associated value for the keyword @var{key} from |
1397 | the list @var{l}. The list @var{l} has to consist of an even | |
1398 | number of elements, where, starting with the first, every | |
1399 | second element is a keyword, followed by its associated value. | |
1400 | If @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 |
1408 | Initialize 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 | 1430 | Return @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 | 1437 | Return 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 |
1444 | Return 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 |
1451 | Return 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 |
1458 | Return 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 | 1465 | Return 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 |
1472 | Return 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 |
1479 | Return 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 | 1486 | Return 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 | 1493 | Return 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 | 1500 | Return 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 | 1507 | Return 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 | 1514 | Return 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 | 1521 | Return 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 | 1528 | Return 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 | 1535 | Internal 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 | 1542 | Return 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 | 1549 | Return @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 |
1556 | Return @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 |
1564 | Like @code{assert-bound}, but use @var{index} for accessing |
1565 | the 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 | 1572 | Return 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 |
1579 | Set 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 |
1615 | Return 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 |
1623 | Set 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 |
1630 | Return @code{#t} if the slot named @var{slot_name} of @var{obj} |
1631 | is 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 |
1638 | Return @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 |
1645 | Create a new instance of class @var{class} and initialize it |
1646 | from 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 |
1709 | Make a new object. @var{args} must contain the class and |
1710 | all 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 |
1731 | Announce that GOOPS is loaded and perform initialization |
1732 | on 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 |
1739 | Create a new guardian. |
1740 | A guardian protects a set of objects from garbage collection, | |
1741 | allowing a program to apply cleanup or other actions. | |
1742 | ||
1743 | @code{make-guardian} returns a procedure representing the guardian. | |
1744 | Calling the guardian procedure with an argument adds the | |
1745 | argument to the guardian's set of protected objects. | |
1746 | Calling the guardian procedure without an argument returns | |
1747 | one of the protected objects which are ready for garbage | |
1748 | collection, or @code{#f} if no such object is available. | |
1749 | Objects which are returned in this way are removed from | |
1750 | the guardian. | |
1751 | ||
1752 | @code{make-guardian} takes one optional argument that says whether the | |
1753 | new guardian should be greedy or sharing. If there is any chance | |
1754 | that any object protected by the guardian may be resurrected, | |
1755 | then you should make the guardian greedy (this is the default). | |
1756 | ||
1757 | See R. Kent Dybvig, Carl Bruggeman, and David Eby (1993) | |
1758 | "Guardians in a Generation-Based Garbage Collector". | |
1759 | ACM SIGPLAN Conference on Programming Language Design | |
1760 | and Implementation, June 1993. | |
1761 | ||
1762 | (the semantics are slightly different at this point, but the | |
1763 | paper 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 |
1770 | Return @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 |
1777 | Return @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 |
1784 | Destroys @var{guardian}, by making it impossible to put any more |
1785 | objects in it or get any objects from it. It also unguards any | |
1786 | objects 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 |
1793 | Determine a hash value for @var{key} that is suitable for |
1794 | lookups in a hashtable of size @var{size}, where @code{eq?} is | |
1795 | used as the equality predicate. The function returns an | |
1796 | integer in the range 0 to @var{size} - 1. Note that | |
1797 | @code{hashq} may use internal addresses. Thus two calls to | |
1798 | hashq where the keys are @code{eq?} are not guaranteed to | |
1799 | deliver the same value if the key object gets garbage collected | |
1800 | in between. This can happen, for example with symbols: | |
1801 | @code{(hashq 'foo n) (gc) (hashq 'foo n)} may produce two | |
1802 | different 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 |
1809 | Determine a hash value for @var{key} that is suitable for |
1810 | lookups in a hashtable of size @var{size}, where @code{eqv?} is | |
1811 | used as the equality predicate. The function returns an | |
1812 | integer in the range 0 to @var{size} - 1. Note that | |
1813 | @code{(hashv key)} may use internal addresses. Thus two calls | |
1814 | to hashv where the keys are @code{eqv?} are not guaranteed to | |
1815 | deliver the same value if the key object gets garbage collected | |
1816 | in between. This can happen, for example with symbols: | |
1817 | @code{(hashv 'foo n) (gc) (hashv 'foo n)} may produce two | |
1818 | different 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 |
1825 | Determine a hash value for @var{key} that is suitable for |
1826 | lookups in a hashtable of size @var{size}, where @code{equal?} | |
1827 | is used as the equality predicate. The function returns an | |
1828 | integer 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 |
1835 | This procedure returns the @code{(key . value)} pair from the |
1836 | hash table @var{table}. If @var{table} does not hold an | |
1837 | associated value for @var{key}, @code{#f} is returned. | |
1838 | Uses @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 |
1845 | This function looks up @var{key} in @var{table} and returns its handle. |
1846 | If @var{key} is not already present, a new handle is created which | |
1847 | associates @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 |
1854 | Look up @var{key} in the hash table @var{table}, and return the |
1855 | value (if any) associated with it. If @var{key} is not found, | |
1856 | return @var{default} (or @code{#f} if no @var{default} argument | |
1857 | is 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 |
1864 | Find the entry in @var{table} associated with @var{key}, and |
1865 | store @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 |
1872 | Remove @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 |
1880 | This procedure returns the @code{(key . value)} pair from the |
1881 | hash table @var{table}. If @var{table} does not hold an | |
1882 | associated value for @var{key}, @code{#f} is returned. | |
1883 | Uses @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 |
1890 | This function looks up @var{key} in @var{table} and returns its handle. |
1891 | If @var{key} is not already present, a new handle is created which | |
1892 | associates @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 |
1899 | Look up @var{key} in the hash table @var{table}, and return the |
1900 | value (if any) associated with it. If @var{key} is not found, | |
1901 | return @var{default} (or @code{#f} if no @var{default} argument | |
1902 | is 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 |
1909 | Find the entry in @var{table} associated with @var{key}, and |
1910 | store @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 |
1917 | Remove @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 |
1925 | This procedure returns the @code{(key . value)} pair from the |
1926 | hash table @var{table}. If @var{table} does not hold an | |
1927 | associated value for @var{key}, @code{#f} is returned. | |
1928 | Uses @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 |
1935 | This function looks up @var{key} in @var{table} and returns its handle. |
1936 | If @var{key} is not already present, a new handle is created which | |
1937 | associates @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 |
1944 | Look up @var{key} in the hash table @var{table}, and return the |
1945 | value (if any) associated with it. If @var{key} is not found, | |
1946 | return @var{default} (or @code{#f} if no @var{default} argument | |
1947 | is 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 |
1954 | Find the entry in @var{table} associated with @var{key}, and |
1955 | store @var{value} there. Uses @code{equal?} for equality | |
1956 | testing. | |
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 |
1963 | Remove @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 |
1971 | This behaves the same way as the corresponding |
1972 | @code{-get-handle} function, but uses @var{hash} as a hash | |
1973 | function and @var{assoc} to compare keys. @code{hash} must be | |
1974 | a function that takes two arguments, a key to be hashed and a | |
780ee65e NJ |
1975 | table 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 |
1983 | This behaves the same way as the corresponding |
1984 | @code{-create-handle} function, but uses @var{hash} as a hash | |
1985 | function and @var{assoc} to compare keys. @code{hash} must be | |
1986 | a function that takes two arguments, a key to be hashed and a | |
780ee65e NJ |
1987 | table 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 | 1995 | This behaves the same way as the corresponding @code{ref} |
ae9f3a15 MG |
1996 | function, but uses @var{hash} as a hash function and |
1997 | @var{assoc} to compare keys. @code{hash} must be a function | |
1998 | that 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 |
2002 | By way of illustration, @code{hashq-ref table key} is |
2003 | equivalent 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 | 2010 | This behaves the same way as the corresponding @code{set!} |
ae9f3a15 MG |
2011 | function, but uses @var{hash} as a hash function and |
2012 | @var{assoc} to compare keys. @code{hash} must be a function | |
2013 | that 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 |
2018 | equivalent 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 |
2025 | An iterator over hash-table elements. |
2026 | Accumulates and returns a result by applying PROC successively. | |
2027 | The arguments to PROC are "(key value prior-result)" where key | |
2028 | and value are successive pairs from the hash table TABLE, and | |
2029 | prior-result is either INIT (for the first application of PROC) | |
2030 | or the return value of the previous application of PROC. | |
72dd0a03 | 2031 | For example, @code{(hash-fold acons '() tab)} will convert a hash |
780ee65e NJ |
2032 | table 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 |
2039 | Create a hook for storing procedure of arity @var{n_args}. |
2040 | @var{n_args} defaults to zero. The returned value is a hook | |
2041 | object 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 | 2048 | Return @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 |
2055 | Return @code{#t} if @var{hook} is an empty hook, @code{#f} |
2056 | otherwise. | |
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 |
2063 | Add the procedure @var{proc} to the hook @var{hook}. The |
2064 | procedure is added to the end if @var{append_p} is true, | |
9401323e NJ |
2065 | otherwise it is added to the front. The return value of this |
2066 | procedure 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 |
2073 | Remove the procedure @var{proc} from the hook @var{hook}. The |
2074 | return 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 |
2081 | Remove all procedures from the hook @var{hook}. The return |
2082 | value 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 | 2089 | Apply all procedures from the hook @var{hook} to the arguments |
5c4b24e1 | 2090 | @var{args}. The order of the procedure application is first to |
9401323e | 2091 | last. 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 |
2098 | Convert 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 |
2105 | Return 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 |
2117 | This procedure takes two ports and duplicates the underlying file |
2118 | descriptor from @var{old-port} into @var{new-port}. The | |
2119 | current file descriptor in @var{new-port} will be closed. | |
2120 | After the redirection the two ports will share a file position | |
2121 | and file status flags. | |
2122 | ||
2123 | The return value is unspecified. | |
2124 | ||
2125 | Unexpected behaviour can result if both ports are subsequently used | |
2126 | and the original and/or duplicate ports are buffered. | |
2127 | ||
2128 | This procedure does not have any side effects on other ports or | |
2129 | revealed 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 |
2136 | Return a new integer file descriptor referring to the open file |
2137 | designated by @var{fd_or_port}, which must be either an open | |
2138 | file 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 |
2145 | A simple wrapper for the @code{dup2} system call. |
2146 | Copies the file descriptor @var{oldfd} to descriptor | |
2147 | number @var{newfd}, replacing the previous meaning | |
2148 | of @var{newfd}. Both @var{oldfd} and @var{newfd} must | |
2149 | be integers. | |
2150 | Unlike for dup->fdes or primitive-move->fdes, no attempt | |
2151 | is made to move away ports which are using @var{newfd}. | |
2152 | The 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 |
2159 | Return the integer file descriptor underlying @var{port}. Does |
2160 | not 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 |
2167 | Return @code{#t} if @var{port} is using a serial non--file |
2168 | device, 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 |
2175 | Return a new port based on the file descriptor @var{fdes}. |
2176 | Modes are given by the string @var{modes}. The revealed count | |
2177 | of the port is initialized to zero. The modes string is the | |
2178 | same 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 |
2185 | Moves the underlying file descriptor for @var{port} to the integer |
2186 | value @var{fdes} without changing the revealed count of @var{port}. | |
2187 | Any other ports already using this descriptor will be automatically | |
2188 | shifted to new descriptors and their revealed counts reset to zero. | |
2189 | The return value is @code{#f} if the file descriptor already had the | |
2190 | required 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 |
2197 | Return a list of existing ports which have @var{fdes} as an |
2198 | underlying file descriptor, without changing their revealed | |
2199 | counts. | |
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 |
2206 | Make 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 |
2213 | Return @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 |
2221 | Return the dash symbol for @var{keyword}. |
2222 | This 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 |
2229 | Return 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 |
2237 | Like @code{list}, but the last arg provides the tail of the |
2238 | constructed list, returning @code{(cons @var{arg1} (cons | |
a6be01a4 | 2239 | @var{arg2} (cons @dots{} @var{argn})))}. Requires at least one |
780ee65e NJ |
2240 | argument. If given one argument, that argument is returned as |
2241 | result. This function is called @code{list*} in some other | |
2242 | Schemes 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 |
2249 | Return @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 |
2256 | Return @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 |
2263 | Return 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 |
2270 | Return a list consisting of the elements the lists passed as |
2271 | arguments. | |
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 |
2277 | The resulting list is always newly allocated, except that it |
2278 | shares structure with the last list argument. The last | |
2279 | argument may actually be any object; an improper list results | |
2280 | if 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 | 2291 | A destructive version of @code{append} (@pxref{Pairs and |
9401323e | 2292 | Lists,,,r5rs, The Revised^5 Report on Scheme}). The cdr field |
ae9f3a15 MG |
2293 | of each list's final pair is changed to point to the head of |
2294 | the next list, so no consing is performed. Return a pointer to | |
2295 | the 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 |
2302 | Return 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 |
2310 | Return a new list that contains the elements of @var{lst} but |
2311 | in 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 |
2318 | A destructive version of @code{reverse} (@pxref{Pairs and Lists,,,r5rs, |
2319 | The Revised^5 Report on Scheme}). The cdr of each cell in @var{lst} is | |
780ee65e NJ |
2320 | modified to point to the previous list element. Return a pointer to the |
2321 | head of the reversed list. | |
2322 | ||
2323 | Caveat: because the list is modified in place, the tail of the original | |
2324 | list now becomes its head, and the head of the original list now becomes | |
2325 | the tail. Therefore, the @var{lst} symbol to which the head of the | |
2326 | original list was bound now points to the tail. To ensure that the head | |
2327 | of 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 |
2335 | Return 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 |
2342 | Set 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 | 2348 | implemented 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 |
2356 | Return the "tail" of @var{lst} beginning with its @var{k}th element. |
2357 | The 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 | |
2360 | think of @code{list-cdr-ref} as accessing the @var{k}th cdr of the list, | |
2361 | or 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 |
2368 | Set 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 |
2375 | Copy the first @var{k} elements from @var{lst} into a new list, and |
2376 | return 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 |
2383 | Return 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 |
2390 | Return the first sublist of @var{lst} whose car is @code{eq?} |
2391 | to @var{x} where the sublists of @var{lst} are the non-empty | |
2392 | lists 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 | |
2394 | occur in @var{lst}, then @code{#f} (not the empty list) is | |
2395 | returned. | |
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 |
2402 | Return the first sublist of @var{lst} whose car is @code{eqv?} |
2403 | to @var{x} where the sublists of @var{lst} are the non-empty | |
2404 | lists 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 | |
2406 | occur in @var{lst}, then @code{#f} (not the empty list) is | |
2407 | returned. | |
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 |
2414 | Return the first sublist of @var{lst} whose car is |
2415 | @code{equal?} to @var{x} where the sublists of @var{lst} are | |
2416 | the 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 | |
2419 | empty 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 |
2428 | These procedures are destructive versions of @code{delq}, @code{delv} |
2429 | and @code{delete}: they modify the pointers in the existing @var{lst} | |
2430 | rather than creating a new list. Caveat evaluator: Like other | |
2431 | destructive 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 |
2440 | Destructively 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 |
2448 | Destructively 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 |
2456 | Return 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 |
2466 | Return 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 |
2476 | Return 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} | |
2479 | against @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 |
2486 | Like @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 |
2495 | Like @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 |
2504 | Like @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 |
2513 | Load the file named @var{filename} and evaluate its contents in |
2514 | the top-level environment. The load paths are not searched; | |
2515 | @var{filename} must either be a full pathname or be a pathname | |
2516 | relative to the current directory. If the variable | |
2517 | @code{%load-hook} is defined, it should be bound to a procedure | |
2518 | that will be called before any code is loaded. See the | |
2519 | documentation 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 |
2526 | Return the name of the directory where Scheme packages, modules and |
2527 | libraries 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 |
2535 | Return the directory where the Guile Scheme library files are installed. |
2536 | E.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 |
2543 | Return the directory where the Guile site files are installed. |
2544 | E.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 |
2551 | Parse @var{path}, which is expected to be a colon-separated |
2552 | string, into a list and return the resulting list with | |
2553 | @var{tail} appended. If @var{path} is @code{#f}, @var{tail} | |
2554 | is 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 |
2561 | Search @var{path} for a directory containing a file named |
2562 | @var{filename}. The file must be readable, and not a directory. | |
2563 | If we find one, return its full filename; otherwise, return | |
2564 | @code{#f}. If @var{filename} is absolute, return it unchanged. | |
2565 | If given, @var{extensions} is a list of strings; for each | |
2566 | directory in @var{path}, we search for @var{filename} | |
2567 | concatenated 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 |
2574 | Search @var{%load-path} for the file named @var{filename}, |
2575 | which must be readable by the current user. If @var{filename} | |
2576 | is found in the list of paths to search or is an absolute | |
2577 | pathname, return its full pathname. Otherwise, return | |
2578 | @code{#f}. Filenames may have any of the optional extensions | |
2579 | in the @code{%load-extensions} list; @code{%search-load-path} | |
2580 | will 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 |
2587 | Search @var{%load-path} for the file named @var{filename} and |
2588 | load it into the top-level environment. If @var{filename} is a | |
2589 | relative pathname and is not found in the list of search paths, | |
2590 | an 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 |
2597 | Return a @dfn{macro} which, when a symbol defined to this value |
2598 | appears as the first symbol in an expression, returns the | |
2599 | result of applying @var{code} to the expression and the | |
2600 | environment. | |
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 |
2607 | Return a @dfn{macro} which, when a symbol defined to this value |
2608 | appears as the first symbol in an expression, evaluates the | |
2609 | result of applying @var{code} to the expression and the | |
198586ed | 2610 | environment. 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 |
2625 | Return a @dfn{macro} which, when a symbol defined to this value |
2626 | appears as the first symbol in an expression, evaluates the | |
198586ed NJ |
2627 | result of applying @var{code} to the expression and the |
2628 | environment. | |
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 | |
2633 | form 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 |
2640 | Return @code{#t} if @var{obj} is a regular macro, a memoizing macro or a |
2641 | syntax 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 |
2648 | Return one of the symbols @code{syntax}, @code{macro} or |
2649 | @code{macro!}, depending on whether @var{m} is a syntax | |
8f85c0c6 | 2650 | transformer, a regular macro, or a memoizing macro, |
ae9f3a15 MG |
2651 | respectively. If @var{m} is not a macro, @code{#f} is |
2652 | returned. | |
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 |
2659 | Return 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 |
2666 | Return 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 |
2673 | Return 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 |
2680 | Set the current module to @var{module} and return |
2681 | the 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 |
2688 | Return a specifier for the environment that contains |
2689 | implementation--defined bindings, typically a superset of those | |
2690 | listed in the report. The intent is that this procedure will | |
2691 | return the environment in which the implementation would | |
2692 | evaluate 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 |
2699 | Return 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 |
2706 | Return 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 | 2713 | Return 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 | 2720 | Return 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 |
2727 | Return @code{#t} if @var{x} is an exact number, @code{#f} |
2728 | otherwise. | |
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 |
2735 | Return @code{#t} if @var{n} is an odd number, @code{#f} |
2736 | otherwise. | |
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 |
2743 | Return @code{#t} if @var{n} is an even number, @code{#f} |
2744 | otherwise. | |
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) | |
2751 | Return @code{#t} if @var{n} is infinite, @code{#f} | |
2752 | otherwise. | |
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) | |
2759 | Return @code{#t} if @var{n} is a NaN, @code{#f} | |
2760 | otherwise. | |
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 () | |
2767 | Return 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 () | |
2774 | Return 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 | 2780 | Return 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 | 2792 | Return 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 |
2804 | Return the bitwise XOR of the integer arguments. A bit is |
2805 | set 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 |
2845 | Return the integer which is the 2s-complement of the integer |
2846 | argument. | |
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 |
2860 | Return @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 |
2875 | The function ash performs an arithmetic shift left by @var{cnt} |
2876 | bits (or shift right, if @var{cnt} is negative). 'Arithmetic' | |
2877 | means, that the function does not guarantee to keep the bit | |
2878 | structure of @var{n}, but rather guarantees that the result | |
2879 | will always be rounded towards minus infinity. Therefore, the | |
2880 | results of ash and a corresponding bitwise shift will differ if | |
2881 | @var{n} is negative. | |
7a095584 | 2882 | |
780ee65e NJ |
2883 | Formally, 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 |
2896 | Return the integer composed of the @var{start} (inclusive) |
2897 | through @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 |
2912 | Return the number of bits in integer @var{n}. If integer is |
2913 | positive, the 1-bits in its binary representation are counted. | |
2914 | If negative, the 0-bits in its two's-complement binary | |
2915 | representation 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 | 2931 | Return 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 |
2947 | Return a string holding the external representation of the |
2948 | number @var{n} in the given @var{radix}. If @var{n} is | |
2949 | inexact, 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 | 2956 | Return a number of the maximally precise representation |
780ee65e NJ |
2957 | expressed by the given @var{string}. @var{radix} must be an |
2958 | exact integer, either 2, 8, 10, or 16. If supplied, @var{radix} | |
2959 | is a default radix that may be overridden by an explicit radix | |
2960 | prefix in @var{string} (e.g. "#o177"). If @var{radix} is not | |
2961 | supplied, then the default radix is 10. If string is not a | |
2962 | syntactically 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 | 2969 | implemented 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 | 2976 | Return @code{#t} if @var{x} is a complex number, @code{#f} |
198586ed | 2977 | otherwise. Note that the sets of real, rational and integer |
780ee65e NJ |
2978 | values form subsets of the set of complex numbers, i. e. the |
2979 | predicate will also be fulfilled if @var{x} is a real, | |
2980 | rational 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 | 2986 | implemented 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 | 2993 | Return @code{#t} if @var{x} is a rational number, @code{#f} |
198586ed | 2994 | otherwise. Note that the set of integer values forms a subset of |
780ee65e NJ |
2995 | the set of rational numbers, i. e. the predicate will also be |
2996 | fulfilled if @var{x} is an integer number. Real numbers | |
2997 | will also satisfy this predicate, because of their limited | |
2998 | precision. | |
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 |
3005 | Return @code{#t} if @var{x} is an integer number, @code{#f} |
3006 | else. | |
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 |
3013 | Return @code{#t} if @var{x} is an inexact number, @code{#f} |
3014 | else. | |
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 |
3021 | Return @var{x} raised to the power of @var{y}. This |
3022 | procedure 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 |
3029 | Return 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 | |
3032 | are used to determine the quadrant of the result. This | |
3033 | procedure 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 |
3040 | Return 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 |
3048 | Return 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 | 3055 | Return 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 |
3062 | Return 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 |
3069 | Return @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 |
3076 | Return @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 |
3083 | Return @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 | 3090 | Set 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 |
3098 | Create a new class object of class @var{metaclass}, with the |
3099 | slot 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 |
3106 | Create a subclass object of @var{class}, with the slot layout |
3107 | specified 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 |
3114 | Return @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 |
3121 | Set @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 |
3128 | Return 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 |
3135 | In @var{obj}'s property list, set the property named @var{key} |
3136 | to @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 |
3143 | Return a newly allocated pair whose car is @var{x} and whose |
3144 | cdr is @var{y}. The pair is guaranteed to be different (in the | |
3145 | sense 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 |
3152 | Return @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 |
3160 | Stores @var{value} in the car field of @var{pair}. The value returned |
3161 | by @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 |
3168 | Stores @var{value} in the cdr field of @var{pair}. The value returned |
3169 | by @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 |
3176 | Return @code{#t} if a character is ready on input @var{port} |
3177 | and 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 | |
3180 | port 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 |
3182 | program to accept characters from interactive ports without |
3183 | getting stuck waiting for input. Any input editors associated | |
3184 | with such ports must make sure that characters whose existence | |
3185 | has been asserted by @code{char-ready?} cannot be rubbed out. | |
3186 | If @code{char-ready?} were to return @code{#f} at end of file, | |
3187 | a port at end of file would be indistinguishable from an | |
3188 | interactive 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 |
3195 | This procedure clears a port's input buffers, similar |
3196 | to the way that force-output clears the output buffer. The | |
3197 | contents 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 | ||
3206 | Draining the buffers may be useful for cleanly finishing | |
3207 | buffered I/O so that the file descriptor can be used directly | |
3208 | for 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 |
3215 | Return the current input port. This is the default port used |
3216 | by many input procedures. Initially, @code{current-input-port} | |
3217 | returns 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 |
3224 | Return the current output port. This is the default port used |
3225 | by many output procedures. Initially, | |
3226 | @code{current-output-port} returns the @dfn{standard output} in | |
3227 | Unix 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 |
3234 | Return 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 |
3242 | Return the current-load-port. |
3243 | The 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 |
3252 | Change the ports returned by @code{current-input-port}, |
3253 | @code{current-output-port} and @code{current-error-port}, respectively, | |
3254 | so 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 |
3261 | Set 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 |
3268 | Set 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 | 3275 | Return 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 |
3282 | Sets the revealed count for a port to a given value. |
3283 | The 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 |
3290 | Return the port modes associated with the open port @var{port}. |
3291 | These will not necessarily be identical to the modes used when | |
3292 | the port was opened, since modes such as "append" which are | |
3293 | used 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 |
3300 | Close the specified port object. Return @code{#t} if it |
3301 | successfully closes a port or @code{#f} if it was already | |
3302 | closed. An exception may be raised if an error occurs, for | |
3303 | example when flushing buffered output. See also @ref{Ports and | |
3304 | File Descriptors, close}, for a procedure which can close file | |
3305 | descriptors. | |
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 |
3312 | Close the specified input port object. The routine has no effect if |
3313 | the file has already been closed. An exception may be raised if an | |
3314 | error occurs. The value returned is unspecified. | |
3315 | ||
3316 | See also @ref{Ports and File Descriptors, close}, for a procedure | |
3317 | which 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 |
3324 | Close the specified output port object. The routine has no effect if |
3325 | the file has already been closed. An exception may be raised if an | |
3326 | error occurs. The value returned is unspecified. | |
3327 | ||
3328 | See also @ref{Ports and File Descriptors, close}, for a procedure | |
3329 | which 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 |
3336 | Apply @var{proc} to each port in the Guile port table |
3337 | in turn. The return value is unspecified. More specifically, | |
3338 | @var{proc} is applied exactly once to every port that exists | |
3339 | in the system at the time @var{port-for-each} is invoked. | |
3340 | Changes to the port table while @var{port-for-each} is running | |
3341 | have 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 | 3348 | Return @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 | 3357 | Return @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 | 3366 | Return a boolean indicating whether @var{x} is a port. |
780ee65e NJ |
3367 | Equivalent 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 |
3375 | Return @code{#t} if @var{port} is closed or @code{#f} if it is |
3376 | open. | |
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 |
3383 | Return @code{#t} if @var{x} is an end-of-file object; otherwise |
3384 | return @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 |
3391 | Flush the specified output port, or the current output port if @var{port} |
3392 | is omitted. The current output buffer contents are passed to the | |
3393 | underlying port implementation (e.g., in the case of fports, the | |
3394 | data will be written to the file and the output buffer will be cleared.) | |
3395 | It has no effect on an unbuffered port. | |
3396 | ||
3397 | The 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 |
3404 | Equivalent to calling @code{force-output} on |
3405 | all 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 | 3412 | Return the next character available from @var{port}, updating |
780ee65e | 3413 | @var{port} to point to the following character. If no more |
ae9f3a15 | 3414 | characters 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 | 3421 | Return the next character available from @var{port}, |
780ee65e | 3422 | @emph{without} updating @var{port} to point to the following |
ae9f3a15 MG |
3423 | character. If no more characters are available, the |
3424 | end-of-file object is returned.@footnote{The value returned by | |
3425 | a call to @code{peek-char} is the same as the value that would | |
3426 | have been returned by a call to @code{read-char} on the same | |
3427 | port. The only difference is that the very next call to | |
3428 | @code{read-char} or @code{peek-char} on that @var{port} will | |
3429 | return the value returned by the preceding call to | |
3430 | @code{peek-char}. In particular, a call to @code{peek-char} on | |
3431 | an interactive port will hang waiting for input whenever a call | |
3432 | to @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 |
3439 | Place @var{char} in @var{port} so that it will be read by the |
3440 | next read operation. If called multiple times, the unread characters | |
3441 | will be read again in last-in first-out order. If @var{port} is | |
3442 | not 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 |
3449 | Place the string @var{str} in @var{port} so that its characters will be |
3450 | read in subsequent read operations. If called multiple times, the | |
3451 | unread 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 |
3459 | Sets 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 |
3463 | One of the following variables should be supplied for |
3464 | @var{whence}: | |
780ee65e NJ |
3465 | @defvar SEEK_SET |
3466 | Seek from the beginning of the file. | |
3467 | @end defvar | |
3468 | @defvar SEEK_CUR | |
3469 | Seek from the current position. | |
3470 | @end defvar | |
3471 | @defvar SEEK_END | |
3472 | Seek from the end of the file. | |
3473 | @end defvar | |
ae9f3a15 MG |
3474 | If @var{fd/port} is a file descriptor, the underlying system |
3475 | call is @code{lseek}. @var{port} may be a string port. | |
7a095584 | 3476 | |
ae9f3a15 MG |
3477 | The value returned is the new position in the file. This means |
3478 | that 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 |
3488 | Truncates the object referred to by @var{object} to at most |
3489 | @var{length} bytes. @var{object} can be a string containing a | |
3490 | file name or an integer file descriptor or a port. | |
3491 | @var{length} may be omitted if @var{object} is not a file name, | |
3492 | in which case the truncation occurs at the current port. | |
3493 | position. 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 |
3500 | Return 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 |
3507 | Set 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 |
3515 | Return the current column number or line number of @var{port}, |
3516 | using the current input port if none is specified. If the number is | |
3517 | unknown, 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 | |
3520 | message, we recommend you add 1 to get 1-origin integers. This is | |
3521 | because lines and column numbers traditionally start with 1, and that is | |
3522 | what 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 |
3530 | Set the current column or line number of @var{port}, using the |
3531 | current 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 |
3538 | Return the filename associated with @var{port}. This function returns |
3539 | the strings "standard input", "standard output" and "standard error" | |
3540 | when 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 |
3547 | Change the filename associated with @var{port}, using the current input |
3548 | port if none is specified. Note that this does not change the port's | |
3549 | source 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 | 3557 | Create and return a new void port. A void port acts like |
198586ed | 3558 | @file{/dev/null}. The @var{mode} argument |
780ee65e NJ |
3559 | specifies the input/output modes for this port: see the |
3560 | documentation 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 |
3567 | Option interface for the print options. Instead of using |
3568 | this procedure directly, use the procedures | |
3569 | @code{print-enable}, @code{print-disable}, @code{print-set!} | |
3570 | and @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 |
3577 | Write @var{message} to @var{destination}, defaulting to |
3578 | the current output port. | |
3579 | @var{message} can contain @code{~A} (was @code{%s}) and | |
3580 | @code{~S} (was @code{%S}) escapes. When printed, | |
3581 | the escapes are replaced with corresponding members of | |
3582 | @var{ARGS}: | |
3583 | @code{~A} formats using @code{display} and @code{~S} formats | |
3584 | using @code{write}. | |
3585 | If @var{destination} is @code{#t}, then use the current output | |
3586 | port, if @var{destination} is @code{#f}, then return a string | |
3587 | containing 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 | 3594 | Send a newline to @var{port}. |
8f85c0c6 | 3595 | If @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 | 3602 | Send 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 |
3609 | Create a new port which behaves like @var{port}, but with an |
3610 | included 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 |
3617 | Return the print state of the port @var{port}. If @var{port} |
3618 | has 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 | 3625 | Return @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 |
3632 | Set @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 |
3639 | Return 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 |
3646 | In @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 |
3654 | Return @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 |
3661 | Return @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 | 3668 | Return @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 |
3675 | Return the documentation string associated with @code{proc}. By |
3676 | convention, if a procedure contains more than one expression and the | |
3677 | first expression is a string constant, that string is assumed to contain | |
3678 | documentation 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 |
3685 | Return @code{#t} if @var{obj} is a procedure with an |
3686 | associated 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 |
3693 | Create a new procedure which behaves like @var{procedure}, but |
3694 | with 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 |
3701 | Return the procedure of @var{proc}, which must be either a |
3702 | procedure 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 |
3709 | Create a @dfn{property token} that can be used with |
3710 | @code{primitive-property-ref} and @code{primitive-property-set!}. | |
3711 | See @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 |
3719 | Return the property @var{prop} of @var{obj}. When no value |
3720 | has yet been associated with @var{prop} and @var{obj}, call | |
3721 | @var{not-found-proc} instead (see @code{primitive-make-property}) | |
3722 | and 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 | |
3725 | default 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 | 3732 | Associate @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 | 3739 | Remove 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 | 3746 | Return a number in [0,N). |
780ee65e | 3747 | |
9401323e NJ |
3748 | Accepts a positive integer or real n and returns a |
3749 | number of the same type between zero (inclusive) and | |
3750 | N (exclusive). The values returned have a uniform | |
3751 | distribution. | |
780ee65e | 3752 | |
9401323e NJ |
3753 | The optional argument @var{state} must be of the type produced |
3754 | by @code{seed->random-state}. It defaults to the value of the | |
3755 | variable @var{*random-state*}. This object is used to maintain | |
3756 | the state of the pseudo-random-number generator and is altered | |
3757 | as 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 | 3764 | Return 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 | 3771 | Return 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 |
3778 | Return 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 |
3786 | Return an inexact real in a normal distribution. The |
3787 | distribution used has mean 0 and standard deviation 1. For a | |
3788 | normal 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 |
3796 | Fills vect with inexact real random numbers |
3797 | the sum of whose squares is less than 1.0. | |
3798 | Thinking of vect as coordinates in space of | |
3799 | dimension n = (vector-length vect), the coordinates | |
72dd0a03 | 3800 | are uniformly distributed within the unit n-sphere. |
9401323e | 3801 | The 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 |
3808 | Fills vect with inexact real random numbers |
3809 | the sum of whose squares is equal to 1.0. | |
3810 | Thinking of vect as coordinates in space of | |
3811 | dimension n = (vector-length vect), the coordinates | |
3812 | are uniformly distributed over the surface of the | |
72dd0a03 | 3813 | unit 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 |
3820 | Fills vect with inexact real random numbers that are |
3821 | independent 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 |
3829 | Return an inexact real in an exponential distribution with mean |
3830 | 1. 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 |
3838 | Read characters from @var{port} into @var{str} until one of the |
3839 | characters in the @var{delims} string is encountered. If | |
3840 | @var{gobble} is true, discard the delimiter character; | |
3841 | otherwise, 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 | |
3844 | specified, store data only into the substring of @var{str} | |
3845 | bounded by @var{start} and @var{end} (which default to the | |
3846 | beginning and end of the string, respectively). | |
780ee65e | 3847 | |
9401323e NJ |
3848 | Return a pair consisting of the delimiter that terminated the |
3849 | string and the number of characters read. If reading stopped | |
3850 | at the end of file, the delimiter returned is the | |
3851 | @var{eof-object}; if the string was filled without encountering | |
3852 | a 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 |
3859 | Read a newline-terminated line from @var{port}, allocating storage as |
3860 | necessary. The newline terminator (if any) is removed from the string, | |
3861 | and a pair consisting of the line and its delimiter is returned. The | |
3862 | delimiter 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 |
3871 | Display @var{obj} and a newline character to @var{port}. If |
3872 | @var{port} is not specified, @code{(current-output-port)} is | |
3873 | used. 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 |
3884 | Option interface for the read options. Instead of using |
3885 | this 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 |
3893 | Read an s-expression from the input port @var{port}, or from |
3894 | the current input port if @var{port} is not specified. | |
3895 | Any 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 |
3902 | Install the procedure @var{proc} for reading expressions |
3903 | starting 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 | |
3906 | returned 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 | 3913 | Evaluate @code{(thunk)} in a new dynamic context, returning its value. |
780ee65e | 3914 | |
9401323e NJ |
3915 | If an error occurs during evaluation, apply @var{handler} to the |
3916 | arguments 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 | |
3918 | called in the same dynamic context in which | |
3919 | @code{call-with-dynamic-root} was evaluated. | |
780ee65e | 3920 | |
9401323e NJ |
3921 | If @var{thunk} captures a continuation, the continuation is rooted at |
3922 | the 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 |
3926 | Before calling @var{thunk}, the dynamic-wind chain is un-wound back to |
3927 | the root and a new chain started for @var{thunk}. Therefore, this call | |
3928 | may 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 |
3943 | The problem is, on what port will @samp{fnord} be displayed? You |
3944 | might expect that because of the @code{with-output-to-port} that | |
3945 | it will be displayed on the port bound to @code{some-port}. But it | |
3946 | probably won't -- before evaluating the thunk, dynamic winds are | |
3947 | unwound, including those created by @code{with-output-to-port}. | |
3948 | So, the standard output port will have been re-set to its default value | |
3949 | before @code{display} is evaluated. | |
780ee65e | 3950 | |
9401323e NJ |
3951 | (This function was added to Guile mostly to help calls to functions in C |
3952 | libraries that can not tolerate non-local exits or calls that return | |
3953 | multiple times. If such functions call back to the interpreter, it should | |
3954 | be 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 |
3961 | Return an object representing the current dynamic root. |
3962 | ||
3963 | These objects are only useful for comparison using @code{eq?}. | |
3964 | They are currently represented as numbers, but your code should | |
3965 | in 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 |
3972 | Read characters from a port or file descriptor into a |
3973 | string @var{str}. A port must have an underlying file | |
3974 | descriptor --- a so-called fport. This procedure is | |
3975 | scsh-compatible and can efficiently read large strings. | |
3976 | It will: | |
3977 | ||
3978 | @itemize | |
3979 | @item | |
3980 | attempt to fill the entire string, unless the @var{start} | |
3981 | and/or @var{end} arguments are supplied. i.e., @var{start} | |
3982 | defaults to 0 and @var{end} defaults to | |
3983 | @code{(string-length str)} | |
3984 | @item | |
3985 | use the current input port if @var{port_or_fdes} is not | |
3986 | supplied. | |
3987 | @item | |
3988 | return fewer than the requested number of characters in some | |
3989 | cases, e.g., on end of file, if interrupted by a signal, or if | |
3990 | not all the characters are immediately available. | |
3991 | @item | |
3992 | wait indefinitely for some input if no characters are | |
3993 | currently available, | |
3994 | unless the port is in non-blocking mode. | |
3995 | @item | |
3996 | read characters from the port's input buffers if available, | |
3997 | instead from the underlying file descriptor. | |
3998 | @item | |
3999 | return @code{#f} if end-of-file is encountered before reading | |
4000 | any characters, otherwise return the number of characters | |
4001 | read. | |
4002 | @item | |
4003 | return 0 if the port is in non-blocking mode and no characters | |
4004 | are immediately available. | |
4005 | @item | |
4006 | return 0 if the request is for 0 bytes, with no | |
4007 | end-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 |
4015 | Write characters from a string @var{str} to a port or file |
4016 | descriptor. A port must have an underlying file descriptor | |
4017 | --- a so-called fport. This procedure is | |
4018 | scsh-compatible and can efficiently write large strings. | |
4019 | It will: | |
4020 | ||
4021 | @itemize | |
4022 | @item | |
4023 | attempt to write the entire string, unless the @var{start} | |
4024 | and/or @var{end} arguments are supplied. i.e., @var{start} | |
4025 | defaults to 0 and @var{end} defaults to | |
4026 | @code{(string-length str)} | |
4027 | @item | |
4028 | use the current output port if @var{port_of_fdes} is not | |
4029 | supplied. | |
4030 | @item | |
4031 | in the case of a buffered port, store the characters in the | |
4032 | port's output buffer, if all will fit. If they will not fit | |
4033 | then any existing buffered characters will be flushed | |
4034 | before attempting | |
4035 | to write the new characters directly to the underlying file | |
4036 | descriptor. If the port is in non-blocking mode and | |
4037 | buffered characters can not be flushed immediately, then an | |
4038 | @code{EAGAIN} system-error exception will be raised (Note: | |
4039 | scsh does not support the use of non-blocking buffered ports.) | |
4040 | @item | |
4041 | write fewer than the requested number of | |
4042 | characters in some cases, e.g., if interrupted by a signal or | |
4043 | if not all of the output can be accepted immediately. | |
4044 | @item | |
4045 | wait indefinitely for at least one character | |
4046 | from @var{str} to be accepted by the port, unless the port is | |
4047 | in non-blocking mode. | |
4048 | @item | |
4049 | return the number of characters accepted by the port. | |
4050 | @item | |
4051 | return 0 if the port is in non-blocking mode and can not accept | |
4052 | at least one character from @var{str} immediately | |
4053 | @item | |
4054 | return 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 | 4062 | Install 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 |
4065 | of variables such as @code{SIGINT}. | |
7a095584 | 4066 | |
9401323e NJ |
4067 | If @var{action} is omitted, @code{sigaction} returns a pair: the |
4068 | CAR is the current | |
4069 | signal 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 | |
4071 | handles the signal, or @code{#f} if a non-Scheme procedure handles the | |
4072 | signal. The CDR contains the current @code{sigaction} flags for the handler. | |
780ee65e | 4073 | |
9401323e NJ |
4074 | If @var{action} is provided, it is installed as the new handler for |
4075 | @var{signum}. @var{action} can be a Scheme procedure taking one | |
4076 | argument, or the value of @code{SIG_DFL} (default action) or | |
4077 | @code{SIG_IGN} (ignore), or @code{#f} to restore whatever signal handler | |
4078 | was installed before @code{sigaction} was first used. Flags can | |
4079 | optionally be specified for the new handler (@code{SA_RESTART} will | |
4080 | always be added if it's available and the system is using restartable | |
4081 | system calls.) The return value is a pair with information about the | |
4082 | old handler as described above. | |
4083 | ||
4084 | This interface does not provide access to the "signal blocking" | |
4085 | facility. Maybe this is not needed, since the thread support may | |
4086 | provide solutions to the problem of consistent access to data | |
4087 | structures. | |
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 |
4094 | Return 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 |
4102 | Set a timer to raise a @code{SIGALRM} signal after the specified |
4103 | number of seconds (an integer). It's advisable to install a signal | |
4104 | handler for | |
4105 | @code{SIGALRM} beforehand, since the default action is to terminate | |
4106 | the process. | |
780ee65e | 4107 | |
9401323e NJ |
4108 | The return value indicates the time remaining for the previous alarm, |
4109 | if any. The new value replaces the previous alarm. If there was | |
4110 | no 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 |
4117 | Set 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 |
4121 | Return information about the timer's previous setting. |
4122 | Errors are handled as described in the guile info pages under ``POSIX | |
4123 | Interface Conventions''. | |
4124 | ||
4125 | The timers available are: @code{ITIMER_REAL}, @code{ITIMER_VIRTUAL}, | |
4126 | and @code{ITIMER_PROF}. | |
4127 | ||
4128 | The return value will be a list of two cons pairs representing the | |
4129 | current state of the given timer. The first pair is the seconds and | |
4130 | microseconds of the timer @code{it_interval}, and the second pair is | |
4131 | the 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 |
4138 | Return information about the timer specified by @var{which_timer} |
4139 | Errors are handled as described in the guile info pages under ``POSIX | |
4140 | Interface Conventions''. | |
780ee65e | 4141 | |
9401323e NJ |
4142 | The timers available are: @code{ITIMER_REAL}, @code{ITIMER_VIRTUAL}, |
4143 | and @code{ITIMER_PROF}. | |
780ee65e | 4144 | |
9401323e NJ |
4145 | The return value will be a list of two cons pairs representing the |
4146 | current state of the given timer. The first pair is the seconds and | |
4147 | microseconds of the timer @code{it_interval}, and the second pair is | |
4148 | the 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 |
4155 | Pause the current process (thread?) until a signal arrives whose |
4156 | action is to either terminate the current process or invoke a | |
4157 | handler 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 |
4164 | Wait for the given number of seconds (an integer) or until a signal |
4165 | arrives. The return value is zero if the time elapses or the number | |
4166 | of 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 |
4173 | Sleep for I microseconds. @code{usleep} is not available on |
4174 | all 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 |
4181 | Sends 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 |
4189 | Execute @var{cmd} using the operating system's "command |
4190 | processor". Under Unix this is usually the default shell | |
4191 | @code{sh}. The value returned is @var{cmd}'s exit status as | |
4192 | returned by @code{waitpid}, which can be interpreted using the | |
4193 | functions above. | |
780ee65e | 4194 | |
9401323e NJ |
4195 | If @code{system} is called without arguments, return a boolean |
4196 | indicating 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 |
4203 | Looks up the string @var{name} in the current environment. The return |
4204 | value is @code{#f} unless a string of the form @code{NAME=VALUE} is | |
4205 | found, 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 |
4212 | Terminate the current process without unwinding the Scheme stack. |
4213 | This is would typically be useful after a fork. The exit status | |
4214 | is @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 |
4221 | Sort the vector @var{vec}, using @var{less} for comparing |
4222 | the vector elements. @var{startpos} and @var{endpos} delimit | |
4223 | the range of the vector which gets sorted. The return value | |
4224 | is 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 |
4231 | Return @code{#t} iff @var{items} is a list or a vector such that |
4232 | for all 1 <= i <= m, the predicate @var{less} returns true when | |
4233 | applied 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) | |
4240 | Merge two already sorted lists into one. | |
4241 | Given two lists @var{alist} and @var{blist}, such that | |
4242 | @code{(sorted? alist less?)} and @code{(sorted? blist less?)}, | |
4243 | return 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?)}. | |
4246 | Note: 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 |
4253 | Takes two lists @var{alist} and @var{blist} such that |
4254 | @code{(sorted? alist less?)} and @code{(sorted? blist less?)} and | |
4255 | returns 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?)}. | |
4258 | This is the destructive variant of @code{merge} | |
4259 | Note: 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 |
4266 | Sort the sequence @var{items}, which may be a list or a |
4267 | vector. @var{less} is used for comparing the sequence | |
4268 | elements. The sorting is destructive, that means that the | |
4269 | input sequence is modified to produce the sorted result. | |
4270 | This 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 |
4277 | Sort the sequence @var{items}, which may be a list or a |
4278 | vector. @var{less} is used for comparing the sequence | |
4279 | elements. 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 |
4286 | Sort the sequence @var{items}, which may be a list or a |
4287 | vector. @var{less} is used for comparing the sequence elements. | |
4288 | The sorting is destructive, that means that the input sequence | |
4289 | is modified to produce the sorted result. | |
4290 | This 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 |
4297 | Sort the sequence @var{items}, which may be a list or a |
4298 | vector. @var{less} is used for comparing the sequence elements. | |
4299 | This 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 |
4306 | Sort the list @var{items}, using @var{less} for comparing the |
4307 | list elements. The sorting is destructive, that means that the | |
4308 | input list is modified to produce the sorted result. | |
4309 | This 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 |
4316 | Sort the list @var{items}, using @var{less} for comparing the |
4317 | list 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 | 4324 | Return 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 |
4331 | Install the association list @var{plist} as the source property |
4332 | list 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 |
4339 | Return 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 |
4347 | Set 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 | 4355 | Return @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 |
4362 | Create a new stack. If @var{obj} is @code{#t}, the current |
4363 | evaluation stack is used for creating the stack frames, | |
4364 | otherwise the frames are taken from @var{obj} (which must be | |
4365 | either a debug object or a continuation). | |
780ee65e | 4366 | |
9401323e NJ |
4367 | @var{args} should be a list containing any combination of |
4368 | integer, procedure and @code{#t} values. | |
4369 | ||
4370 | These values specify various ways of cutting away uninteresting | |
4371 | stack 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 | ||
4376 | Each @var{inner_cut_N} can be @code{#t}, an integer, or a | |
4377 | procedure. @code{#t} means to cut away all frames up to but | |
4378 | excluding the first user module frame. An integer means to cut | |
4379 | away exactly that number of frames. A procedure means to cut | |
4380 | away all frames up to but excluding the application frame whose | |
4381 | procedure matches the specified one. | |
4382 | ||
4383 | Each @var{outer_cut_N} can be an integer or a procedure. An | |
4384 | integer means to cut away that number of frames. A procedure | |
4385 | means to cut away frames down to but excluding the application | |
4386 | frame whose procedure matches the specified one. | |
4387 | ||
4388 | If the @var{outer_cut_N} of the last pair is missing, it is | |
4389 | taken 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 | 4396 | Return 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 | 4403 | Return 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 | 4410 | Return 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 | 4417 | Return @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 |
4424 | Return a stack which consists of a single frame, which is the |
4425 | last stack frame for @var{obj}. @var{obj} must be either a | |
4426 | debug 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 | 4433 | Return 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 | 4440 | Return 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 |
4447 | Return the procedure for @var{frame}, or @code{#f} if no |
4448 | procedure 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 | 4455 | Return 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 |
4462 | Return 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 |
4470 | Return 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 | 4478 | Return @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 | 4485 | Return @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 | 4492 | Return @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 |
4499 | Return @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 |
4506 | Return the number of time units since the interpreter was |
4507 | started. | |
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 |
4514 | Return an object with information about real and processor |
4515 | time. The following procedures accept such an object as an | |
4516 | argument and return a selected component: | |
7a095584 | 4517 | |
9401323e NJ |
4518 | @table @code |
4519 | @item tms:clock | |
4520 | The current real time, expressed as time units relative to an | |
4521 | arbitrary base. | |
4522 | @item tms:utime | |
4523 | The CPU time units used by the calling process. | |
4524 | @item tms:stime | |
4525 | The CPU time units used by the system on behalf of the calling | |
4526 | process. | |
4527 | @item tms:cutime | |
4528 | The CPU time units used by terminated child processes of the | |
4529 | calling process, whose status has been collected (e.g., using | |
4530 | @code{waitpid}). | |
4531 | @item tms:cstime | |
4532 | Similarly, the CPU times units used by the system on behalf of | |
4533 | terminated 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 |
4541 | Return the number of time units of processor time used by the |
4542 | interpreter. Both @emph{system} and @emph{user} time are | |
4543 | included 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 |
4550 | Return the number of seconds since 1970-01-01 00:00:00 UTC, |
4551 | excluding 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 |
4558 | Return a pair containing the number of seconds and microseconds |
4559 | since 1970-01-01 00:00:00 UTC, excluding leap seconds. Note: | |
4560 | whether true microsecond resolution is available depends on the | |
4561 | operating 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 |
4568 | Return 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 | |
4571 | optionally 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 |
4579 | Return 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} |
4589 | is an optional time zone specifier (otherwise the TZ environment variable | |
4590 | or the system default is used). | |
4591 | ||
4592 | Returns a pair: the car is a corresponding | |
4593 | integer time value like that returned | |
4594 | by @code{current-time}; the cdr is a broken down time object, similar to | |
4595 | as @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 |
4602 | Initialize the timezone from the TZ environment variable |
4603 | or the system default. It's not usually necessary to call this procedure | |
4604 | since it's done automatically by other procedures that depend on the | |
4605 | timezone. | |
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 |
4612 | Formats a time specification @var{time} using @var{template}. @var{time} |
4613 | is an object with time components in the form returned by @code{localtime} | |
4614 | or @code{gmtime}. @var{template} is a string which can include formatting | |
4615 | specifications introduced by a @code{%} character. The formatting of | |
4616 | month and day names is dependent on the current locale. The value returned | |
4617 | is 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 |
4625 | Performs 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 | |
4628 | dependent on the current locale. The value returned is a pair. | |
4629 | The car has an object with time components | |
4630 | in the form returned by @code{localtime} or @code{gmtime}, | |
4631 | but the time zone components | |
4632 | are not usefully set. | |
4633 | The cdr reports the number of characters from @var{string} | |
4634 | which 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 | 4641 | Return @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 | 4647 | implemented 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 |
4655 | Return 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 |
4663 | Return a newly allocated string of |
4664 | length @var{k}. If @var{chr} is given, then all elements of | |
4665 | the string are initialized to @var{chr}, otherwise the contents | |
4666 | of 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 | 4673 | Return 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 |
4680 | Return character @var{k} of @var{str} using zero-origin |
4681 | indexing. @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 |
4688 | Store @var{chr} in element @var{k} of @var{str} and return |
4689 | an 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 |
4697 | Return a newly allocated string formed from the characters |
4698 | of @var{str} beginning with index @var{start} (inclusive) and | |
4699 | ending with index @var{end} (exclusive). | |
4700 | @var{str} must be a string, @var{start} and @var{end} must be | |
4701 | exact integers satisfying: | |
7a095584 | 4702 | |
9401323e | 4703 | 0 <= @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 |
4710 | Return a newly allocated string whose characters form the |
4711 | concatenation 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 |
4718 | Return 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 | |
4721 | procedure 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 |
4740 | Like @code{string-index}, but search from the right of the |
4741 | string rather than from the left. This procedure essentially | |
4742 | implements the @code{rindex} or @code{strrchr} functions from | |
4743 | the 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 |
4761 | Copy the substring of @var{str1} bounded by @var{start1} and @var{end1} |
4762 | into @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 |
4770 | Change 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) | |
4776 | y | |
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 | 4785 | Return @code{#t} if @var{str}'s length is zero, and |
9401323e NJ |
4786 | @code{#f} otherwise. |
4787 | @lisp | |
4788 | (string-null? "") @result{} #t | |
4789 | y @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 |
4798 | Return a newly allocated list of the characters that make up |
4799 | the given string @var{str}. @code{string->list} and | |
4800 | @code{list->string} are inverses as far as @samp{equal?} is | |
4801 | concerned. | |
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 | 4808 | Return 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 |
4815 | Store @var{char} in every element of the given @var{string} and |
4816 | return 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 |
4823 | Destructively upcase every character in @var{str} and return |
4824 | @var{str}. | |
4825 | @lisp | |
4826 | y @result{} "arrdefg" | |
4827 | (string-upcase! y) @result{} "ARRDEFG" | |
4828 | y @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 |
4836 | Return 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 |
4844 | Destructively downcase every character in @var{str} and return |
4845 | @var{str}. | |
4846 | @lisp | |
4847 | y @result{} "ARRDEFG" | |
4848 | (string-downcase! y) @result{} "arrdefg" | |
4849 | y @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 |
4857 | Return 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 |
4865 | Upcase the first character of every word in @var{str} |
4866 | destructively and return @var{str}. | |
780ee65e | 4867 | |
9401323e NJ |
4868 | @lisp |
4869 | y @result{} "hello world" | |
4870 | (string-capitalize! y) @result{} "Hello World" | |
4871 | y @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 |
4879 | Return a freshly allocated string with the characters in |
4880 | @var{str}, where the first character of every word is | |
4881 | capitalized. | |
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 |
4888 | Split the string @var{str} into the a list of the substrings delimited |
4889 | by appearances of the character @var{chr}. Note that an empty substring | |
4890 | between separator characters will result in an empty string in the | |
4891 | result 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 |
4912 | Return the symbol whose name is @var{str}. @var{str} is |
4913 | converted to lowercase before the conversion is done, if Guile | |
8f85c0c6 | 4914 | is 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 |
4920 | Lexicographic equality predicate; return @code{#t} if the two |
4921 | strings are the same length and contain the same characters in | |
4922 | the same positions, otherwise return @code{#f}. | |
4923 | ||
4924 | The procedure @code{string-ci=?} treats upper and lower case | |
4925 | letters as though they were the same character, but | |
4926 | @code{string=?} treats upper and lower case as distinct | |
4927 | characters. | |
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 |
4933 | Case-insensitive string equality predicate; return @code{#t} if |
4934 | the two strings are the same length and their component | |
4935 | characters match (ignoring case) at each position; otherwise | |
4936 | return @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 |
4942 | Lexicographic ordering predicate; return @code{#t} if @var{s1} |
4943 | is 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 |
4949 | Lexicographic ordering predicate; return @code{#t} if @var{s1} |
4950 | is 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 |
4956 | Lexicographic ordering predicate; return @code{#t} if @var{s1} |
4957 | is 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 |
4963 | Lexicographic ordering predicate; return @code{#t} if @var{s1} |
4964 | is 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 |
4970 | Case insensitive lexicographic ordering predicate; return |
4971 | @code{#t} if @var{s1} is lexicographically less than @var{s2} | |
4972 | regardless 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 |
4978 | Case insensitive lexicographic ordering predicate; return |
4979 | @code{#t} if @var{s1} is lexicographically less than or equal | |
4980 | to @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 |
4986 | Case 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 |
4994 | Case insensitive lexicographic ordering predicate; return |
4995 | @code{#t} if @var{s1} is lexicographically greater than or | |
4996 | equal 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 |
5003 | Return a Scheme string obtained by printing @var{obj}. |
5004 | Printing function can be specified by the optional second | |
5005 | argument @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 |
5012 | Calls the one-argument procedure @var{proc} with a newly created output |
5013 | port. When the function returns, the string composed of the characters | |
5014 | written 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 |
5021 | Calls the one-argument procedure @var{proc} with a newly |
5022 | created input port from which @var{string}'s contents may be | |
5023 | read. 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 |
5030 | Take a string and return an input port that delivers characters |
5031 | from the string. The port can be closed by | |
5032 | @code{close-input-port}, though its storage will be reclaimed | |
5033 | by 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 |
5040 | Return an output port that will accumulate characters for |
5041 | retrieval by @code{get-output-string}. The port can be closed | |
5042 | by the procedure @code{close-output-port}, though its storage | |
5043 | will be reclaimed by the garbage collector if it becomes | |
5044 | inaccessible. | |
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 |
5051 | Given an output port created by @code{open-output-string}, |
5052 | return a string consisting of the characters that have been | |
5053 | output 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 |
5060 | Evaluate @var{string} as the text representation of a Scheme |
5061 | form or forms, and return whatever value they produce. | |
5062 | Evaluation takes place in the environment returned by the | |
5063 | procedure @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 | 5070 | Return a new structure layout object. |
780ee65e | 5071 | |
9401323e NJ |
5072 | @var{fields} must be a string made up of pairs of characters |
5073 | strung together. The first character of each pair describes a field | |
5074 | type, the second a field protection. Allowed types are 'p' for | |
5075 | GC-protected Scheme data, 'u' for unprotected binary data, and 's' for | |
5076 | a field that points to the structure itself. Allowed protections | |
5077 | are 'w' for mutable fields, 'r' for read-only fields, and 'o' for opaque | |
5078 | fields. The last field protection specification may be capitalized to | |
5079 | indicate 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 | 5086 | Return @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 | 5094 | Return @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 | 5101 | Create 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 |
5106 | specification indicated by @var{type} includes a tail-array, | |
5107 | this is the number of elements allocated to that array. | |
780ee65e | 5108 | |
9401323e NJ |
5109 | The @var{init1}, @dots{} are optional arguments describing how |
5110 | successive fields of the structure should be initialized. Only fields | |
5111 | with protection 'r' or 'w' can be initialized, except for fields of | |
5112 | type 's', which are automatically initialized to point to the new | |
5113 | structure itself; fields with protection 'o' can not be initialized by | |
5114 | Scheme programs. | |
780ee65e | 5115 | |
9401323e NJ |
5116 | If fewer optional arguments than initializable fields are supplied, |
5117 | fields of type 'p' get default value #f while fields of type 'u' are | |
5118 | initialized to 0. | |
780ee65e | 5119 | |
9401323e NJ |
5120 | Structs are currently the basic representation for record-like data |
5121 | structures in Guile. The plan is to eventually replace them with a | |
5122 | new representation which will at the same time be easier to use and | |
5123 | more powerful. | |
780ee65e | 5124 | |
9401323e NJ |
5125 | For 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 | 5132 | Return a new, self-describing vtable structure. |
780ee65e | 5133 | |
9401323e NJ |
5134 | @var{user-fields} is a string describing user defined fields of the |
5135 | vtable 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 |
5139 | this vtable. | |
780ee65e | 5140 | |
9401323e NJ |
5141 | @var{init1}, @dots{} are the optional initializers for the fields of |
5142 | the vtable. | |
780ee65e | 5143 | |
9401323e NJ |
5144 | Vtables have one initializable system field---the struct printer. |
5145 | This field comes before the user fields in the initializers passed | |
5146 | to @code{make-vtable-vtable} and @code{make-struct}, and thus works as | |
5147 | a third optional argument to @code{make-vtable-vtable} and a fourth to | |
5148 | @code{make-struct} when creating vtables: | |
780ee65e | 5149 | |
9401323e NJ |
5150 | If the value is a procedure, it will be called instead of the standard |
5151 | printer whenever a struct described by this vtable is printed. | |
5152 | The procedure will be called with arguments STRUCT and PORT. | |
780ee65e | 5153 | |
9401323e NJ |
5154 | The structure of a struct is described by a vtable, so the vtable is |
5155 | in essence the type of the struct. The vtable is itself a struct with | |
5156 | a vtable. This could go on forever if it weren't for the | |
5157 | vtable-vtables which are self-describing vtables, and thus terminate | |
5158 | the chain. | |
7a095584 | 5159 | |
9401323e NJ |
5160 | There are several potential ways of using structs, but the standard |
5161 | one is to use three kinds of structs, together building up a type | |
5162 | sub-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 | |
5164 | compared 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)) |
5186 | ball @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 | 5195 | Access (or modify) the @var{n}th field of @var{struct}. |
780ee65e | 5196 | |
9401323e NJ |
5197 | If the field is of type 'p', then it can be set to an arbitrary value. |
5198 | ||
5199 | If the field is of type 'u', then it can only be set to a non-negative | |
5200 | integer 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 |
5207 | Set the slot of the structure @var{handle} with index @var{pos} |
5208 | to @var{val}. Signal an error if the slot can not be written | |
5209 | to. | |
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 |
5216 | Return 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 |
5223 | Return 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 | 5230 | Return 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 |
5237 | Set 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 |
5244 | Return @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) | |
5252 | Return @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) | |
5260 | Return 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 |
5267 | Return the name of @var{symbol} as a string. If the symbol was |
5268 | part of an object returned as the value of a literal expression | |
5269 | (section @pxref{Literal expressions,,,r5rs, The Revised^5 | |
5270 | Report on Scheme}) or by a call to the @code{read} procedure, | |
5271 | and its name contains alphabetic characters, then the string | |
5272 | returned will contain characters in the implementation's | |
5273 | preferred standard case---some implementations will prefer | |
5274 | upper case, others lower case. If the symbol was returned by | |
5275 | @code{string->symbol}, the case of characters in the string | |
5276 | returned will be the same as the case in the string that was | |
5277 | passed to @code{string->symbol}. It is an error to apply | |
5278 | mutation procedures like @code{string-set!} to strings returned | |
5279 | by this procedure. | |
7a095584 | 5280 | |
9401323e NJ |
5281 | The following examples assume that the implementation's |
5282 | standard 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 |
5296 | Return the symbol whose name is @var{string}. This procedure |
5297 | can create symbols with names containing special characters or | |
5298 | letters in the non-standard case, but it is usually a bad idea | |
5299 | to create such symbols because in some implementations of | |
5300 | Scheme they cannot be read as themselves. See | |
5301 | @code{symbol->string}. | |
7a095584 | 5302 | |
9401323e NJ |
5303 | The following examples assume that the implementation's |
5304 | standard 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 |
5322 | Create a new symbol with a name constructed from a prefix and |
5323 | a counter value. The string @var{prefix} can be specified as | |
21b83aab | 5324 | an optional argument. Default prefix is @code{ g}. The counter |
9401323e NJ |
5325 | is increased by 1 at each call. There is no provision for |
5326 | resetting 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 | 5333 | Return 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 | 5340 | Return 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 | 5347 | Return 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 | 5354 | Change 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 | 5361 | Change 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 |
5368 | Invoke @var{thunk} in the dynamic context of @var{handler} for |
5369 | exceptions 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 |
5378 | normally, that is the return value of @code{catch}. | |
5379 | ||
5380 | Handler is invoked outside the scope of its own @code{catch}. | |
5381 | If @var{handler} again throws to the same key, a new handler | |
5382 | from further up the call chain is invoked. | |
5383 | ||
5384 | If the key is @code{#t}, then a throw to @emph{any} symbol will | |
5385 | match 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 |
5392 | This behaves exactly like @code{catch}, except that it does |
5393 | not unwind the stack before invoking @var{handler}. | |
5394 | The @var{handler} procedure is not allowed to return: | |
5395 | it 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 |
5402 | Invoke 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 | ||
5408 | If 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 |
5415 | Delivers all of its arguments to its continuation. Except for |
5416 | continuations created by the @code{call-with-values} procedure, | |
5417 | all continuations take exactly one value. The effect of | |
5418 | passing no value or more than one value to continuations that | |
5419 | were 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 | 5426 | Return 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 | 5433 | Return 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 |
5440 | Return @code{#t} iff @var{obj} is a variable object, else |
5441 | return @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 |
5448 | Dereference @var{var} and return its value. |
5449 | @var{var} must be a variable object; see @code{make-variable} | |
5450 | and @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 |
5457 | Set the value of the variable @var{var} to @var{val}. |
5458 | @var{var} must be a variable object, @var{val} can be any | |
5459 | value. 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 |
5466 | Return @code{#t} iff @var{var} is bound to a value. |
5467 | Throws 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 |
5474 | Return @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 | 5481 | implemented 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) | |
5489 | Return a newly allocated vector composed of the | |
9401323e NJ |
5490 | given 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 | 5501 | Return a newly allocated vector of @var{k} elements. If a |
8f85c0c6 NJ |
5502 | second argument is given, then each position is initialized to |
5503 | @var{fill}. Otherwise the initial contents of each position is | |
9401323e | 5504 | unspecified. |
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) | |
5511 | Return 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) | |
5523 | Store @var{fill} in every position of @var{vector}. The value | |
9401323e | 5524 | returned 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 |
5531 | Copy elements from @var{vec1}, positions @var{start1} to @var{end1}, |
5532 | to @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. | |
5536 | Therefore, in the case where @var{vec1} and @var{vec2} refer to the | |
5537 | same 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 |
5545 | Copy elements from @var{vec1}, positions @var{start1} to @var{end1}, |
5546 | to @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. | |
5550 | Therefore, in the case where @var{vec1} and @var{vec2} refer to the | |
5551 | same 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 |
5559 | Return a string containing Guile's major version number. |
5560 | E.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 |
5567 | Return a string containing Guile's minor version number. |
5568 | E.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 |
5575 | Return a string containing Guile's micro version number. |
5576 | E.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 |
5586 | Return a string describing Guile's version number, or its major, minor |
5587 | or 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 |
5601 | Return a port capable of receiving or delivering characters as |
5602 | specified by the @var{modes} string (@pxref{File Ports, | |
5603 | open-file}). @var{pv} must be a vector of length 5. Its | |
5604 | components are as follows: | |
780ee65e | 5605 | |
9401323e NJ |
5606 | @enumerate 0 |
5607 | @item | |
5608 | procedure accepting one character for output | |
5609 | @item | |
5610 | procedure accepting a string for output | |
5611 | @item | |
5612 | thunk for flushing output | |
5613 | @item | |
5614 | thunk for getting one character | |
5615 | @item | |
5616 | thunk for closing port (not by garbage collection) | |
5617 | @end enumerate | |
780ee65e | 5618 | |
9401323e NJ |
5619 | For an output-only port only elements 0, 1, 2, and 4 need be |
5620 | procedures. For an input-only port only elements 3 and 4 need | |
5621 | be procedures. Thunks 2 and 4 can instead be @code{#f} if | |
5622 | there is no useful operation for them to perform. | |
7a095584 | 5623 | |
9401323e NJ |
5624 | If thunk 3 returns @code{#f} or an @code{eof-object} |
5625 | (@pxref{Input, eof-object?, ,r5rs, The Revised^5 Report on | |
5626 | Scheme}) it indicates that the port has reached end-of-file. | |
5627 | For 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 |
5648 | Return a weak vector with @var{size} elements. If the optional |
5649 | argument @var{fill} is given, all entries in the vector will be | |
5650 | set to @var{fill}. The default value for @var{fill} is the | |
5651 | empty 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 | 5657 | implemented 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 |
5665 | Construct a weak vector from a list: @code{weak-vector} uses |
5666 | the list of its arguments while @code{list->weak-vector} uses | |
5667 | its only argument @var{l} (a list) to construct a weak vector | |
5668 | the 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 |
5675 | Return @code{#t} if @var{obj} is a weak vector. Note that all |
5676 | weak 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 |
5685 | Return a weak hash table with @var{size} buckets. As with any |
5686 | hash table, choosing a good size for the table requires some | |
5687 | caution. | |
780ee65e | 5688 | |
9401323e NJ |
5689 | You can modify weak hash tables in exactly the same way you |
5690 | would 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 |
5697 | Return 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 |
5705 | Return a hash table with weak keys and values with @var{size} |
5706 | buckets. (@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 |
5715 | Return @code{#t} if @var{obj} is the specified weak hash |
5716 | table. Note that a doubly weak hash table is neither a weak key | |
5717 | nor 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 | 5724 | Return @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 | 5731 | Return @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) | |
5738 | Store @var{fill} in every element of @var{array}. The value returned | |
9401323e | 5739 | is 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 | 5745 | implemented 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) | |
5753 | Copy every element from vector or array @var{source} to the | |
9401323e NJ |
5754 | corresponding element of @var{destination}. @var{destination} must have |
5755 | the same rank as @var{source}, and be at least as large in each | |
5756 | dimension. 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 |
5762 | implemented 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 | |
5772 | for the corresponding index in @var{array0}. @var{proc} is applied to | |
5773 | each tuple of elements of @var{array1} @dots{} and the result is stored | |
5774 | as the corresponding element in @var{array0}. The value returned is | |
5775 | unspecified. 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) | |
5782 | Apply @var{proc} to each tuple of elements of @var{array0} @dots{} | |
9401323e | 5783 | in 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) | |
5790 | Apply @var{proc} to the indices of each element of @var{array} in | |
9401323e NJ |
5791 | turn, storing the result in the corresponding element. The value |
5792 | returned and the order of application are unspecified. | |
7a095584 | 5793 | |
9401323e | 5794 | One 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 | |
5801 | Another 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 | 5814 | Return 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 |
5821 | Return @code{#t} if the @var{obj} is an array, and @code{#f} if |
5822 | not. The @var{prototype} argument is used with uniform arrays | |
5823 | and 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 |
5830 | Return the number of dimensions of @var{obj}. If @var{obj} is |
5831 | not 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 |
5839 | elements 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 | 5849 | Return 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 | 5856 | Return 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 | 5863 | For 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 |
5871 | Create and return a uniform array or vector of type |
5872 | corresponding to @var{prototype} with dimensions @var{dims} or | |
5873 | length @var{length}. If @var{fill} is supplied, it's used to | |
5874 | fill 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 |
5882 | arrays. The @var{mapper} is a function that translates coordinates in | |
5883 | the new array into coordinates in the old array. A @var{mapper} must be | |
5884 | linear, and its range must stay within the bounds of the old array, but | |
5885 | it 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 |
5902 | Return an array sharing contents with @var{array}, but with |
5903 | dimensions 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 | |
5906 | and the rank of the array to be returned. Each integer in that | |
5907 | range must appear at least once in the argument list. | |
5908 | ||
5909 | The values of @var{dim0}, @var{dim1}, @dots{} correspond to | |
5910 | dimensions in the array to be returned, their positions in the | |
5911 | argument list to dimensions of @var{array}. Several @var{dim}s | |
5912 | may have the same value, in which case the returned array will | |
5913 | have 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 |
5928 | the rank of @var{array}. @var{enclose-array} returns an array | |
5929 | resembling an array of shared arrays. The dimensions of each shared | |
5930 | array are the same as the @var{dim}th dimensions of the original array, | |
5931 | the dimensions of the outer array are the same as those of the original | |
5932 | array that did not match a @var{dim}. | |
780ee65e | 5933 | |
9401323e NJ |
5934 | An enclosed array is not a general Scheme array. Its elements may not |
5935 | be set using @code{array-set!}. Two references to the same element of | |
5936 | an 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 | |
5938 | enclosed array is unspecified. | |
7a095584 | 5939 | |
9401323e | 5940 | examples: |
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 |
5954 | Return @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 | 5961 | implemented 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 |
5969 | Return 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 | 5976 | implemented 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) | |
5984 | Set 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 |
5992 | If @var{array} may be @dfn{unrolled} into a one dimensional shared array |
5993 | without 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 |
5999 | If the optional argument @var{strict} is provided, a shared array will |
6000 | be returned only if its elements are stored internally contiguous in | |
6001 | memory. | |
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) | |
6009 | Attempt to read all elements of @var{ura}, in lexicographic order, as | |
9401323e | 6010 | binary objects from @var{port-or-fdes}. |
8f85c0c6 NJ |
6011 | If an end of file is encountered, |
6012 | the objects up to that point are put into @var{ura} | |
9401323e NJ |
6013 | (starting at the beginning) and the remainder of the array is |
6014 | unchanged. | |
780ee65e | 6015 | |
9401323e NJ |
6016 | The optional arguments @var{start} and @var{end} allow |
6017 | a specified region of a vector (or linearized array) to be read, | |
6018 | leaving 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 | |
6022 | returned 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 |
6030 | Writes all elements of @var{ura} as binary objects to |
6031 | @var{port-or-fdes}. | |
780ee65e | 6032 | |
9401323e NJ |
6033 | The optional arguments @var{start} |
6034 | and @var{end} allow | |
6035 | a specified region of a vector (or linearized array) to be written. | |
780ee65e | 6036 | |
9401323e NJ |
6037 | The number of objects actually written is returned. |
6038 | @var{port-or-fdes} may be | |
6039 | omitted, 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 |
6047 | Return 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 |
6055 | Return the minimum index of an occurrence of @var{bool} in |
6056 | @var{bv} which is at least @var{k}. If no @var{bool} occurs | |
6057 | within 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 |
6064 | If uve is a bit-vector @var{bv} and uve must be of the same |
6065 | length. 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 | |
6067 | AND'ed into @var{bv}. | |
6068 | ||
8f85c0c6 | 6069 | If uve is a unsigned long integer vector all the elements of uve |
9401323e NJ |
6070 | must be between 0 and the @code{length} of @var{bv}. The bits |
6071 | of @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 |
6079 | Return |
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) | |
6090 | Modify @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 |
6097 | Return 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 |
6106 | Return a uniform array of the type indicated by prototype |
6107 | @var{prot} with elements the same as those of @var{lst}. | |
6108 | Elements must be of the appropriate type, no coercions are | |
6109 | done. | |
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 |
6116 | Return an object that would produce an array of the same type |
6117 | as @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 |
6125 | Change the ownership and group of the file referred to by @var{object} to |
6126 | the integer values @var{owner} and @var{group}. @var{object} can be | |
6127 | a string containing a file name or, if the platform | |
6128 | supports fchown, a port or integer file descriptor | |
6129 | which is open on the file. The return value | |
6130 | is unspecified. | |
6131 | ||
6132 | If @var{object} is a symbolic link, either the | |
6133 | ownership of the link or the ownership of the referenced file will be | |
6134 | changed depending on the operating system (lchown is | |
6135 | unsupported at present). If @var{owner} or @var{group} is specified | |
6136 | as @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 |
6143 | Changes 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 | |
6145 | descriptor which is open on a file (in which case @code{fchmod} is used | |
6146 | as the underlying system call). | |
6147 | @var{mode} specifies | |
6148 | the new permissions as a decimal number, e.g., @code{(chmod "foo" #o755)}. | |
6149 | The 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 | 6156 | If @var{mode} is omitted, returns a decimal number representing the current |
9401323e NJ |
6157 | file creation mask. Otherwise the file creation mask is set to |
6158 | @var{mode} and the previous value is returned. | |
780ee65e | 6159 | |
9401323e NJ |
6160 | E.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 |
6167 | Similar to @code{open} but return a file descriptor instead of |
6168 | a 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 |
6175 | Open 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 | |
6178 | it 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}. |
6182 | Basic flags are: | |
780ee65e | 6183 | |
9401323e NJ |
6184 | @defvar O_RDONLY |
6185 | Open the file read-only. | |
6186 | @end defvar | |
6187 | @defvar O_WRONLY | |
6188 | Open the file write-only. | |
6189 | @end defvar | |
6190 | @defvar O_RDWR | |
6191 | Open the file read/write. | |
6192 | @end defvar | |
6193 | @defvar O_APPEND | |
6194 | Append to the file instead of truncating. | |
6195 | @end defvar | |
6196 | @defvar O_CREAT | |
6197 | Create the file if it does not already exist. | |
6198 | @end defvar | |
780ee65e | 6199 | |
9401323e NJ |
6200 | See the Unix documentation of the @code{open} system call |
6201 | for 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) | |
6208 | Similar to close-port (@pxref{Closing, close-port}), | |
9401323e NJ |
6209 | but also works on file descriptors. A side |
6210 | effect of closing a file descriptor is that any ports using that file | |
6211 | descriptor are moved to a different file descriptor and have | |
6212 | their 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 |
6219 | A simple wrapper for the @code{close} system call. |
6220 | Close file descriptor @var{fd}, which must be an integer. | |
6221 | Unlike close (@pxref{Ports and File Descriptors, close}), | |
6222 | the file descriptor will be closed even if a port is using it. | |
6223 | The 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 |
6230 | Return an object containing various information about the file |
6231 | determined by @var{obj}. @var{obj} can be a string containing | |
6232 | a file name or a port or integer file descriptor which is open | |
6233 | on a file (in which case @code{fstat} is used as the underlying | |
6234 | system call). | |
6235 | ||
6236 | The object returned by @code{stat} can be passed as a single | |
6237 | parameter to the following procedures, all of which return | |
6238 | integers: | |
6239 | ||
6240 | @table @code | |
6241 | @item stat:dev | |
6242 | The device containing the file. | |
6243 | @item stat:ino | |
6244 | The file serial number, which distinguishes this file from all | |
6245 | other files on the same device. | |
6246 | @item stat:mode | |
6247 | The mode of the file. This includes file type information and | |
6248 | the file permission bits. See @code{stat:type} and | |
6249 | @code{stat:perms} below. | |
6250 | @item stat:nlink | |
6251 | The number of hard links to the file. | |
6252 | @item stat:uid | |
6253 | The user ID of the file's owner. | |
6254 | @item stat:gid | |
6255 | The group ID of the file. | |
6256 | @item stat:rdev | |
6257 | Device ID; this entry is defined only for character or block | |
6258 | special files. | |
6259 | @item stat:size | |
6260 | The size of a regular file in bytes. | |
6261 | @item stat:atime | |
6262 | The last access time for the file. | |
6263 | @item stat:mtime | |
6264 | The last modification time for the file. | |
6265 | @item stat:ctime | |
6266 | The last modification time for the attributes of the file. | |
6267 | @item stat:blksize | |
6268 | The optimal block size for reading or writing the file, in | |
6269 | bytes. | |
6270 | @item stat:blocks | |
6271 | The amount of disk space that the file occupies measured in | |
6272 | units of 512 byte blocks. | |
6273 | @end table | |
6274 | ||
6275 | In addition, the following procedures return the information | |
6276 | from stat:mode in a more convenient form: | |
6277 | ||
6278 | @table @code | |
6279 | @item stat:type | |
6280 | A symbol representing the type of file. Possible values are | |
6281 | regular, directory, symlink, block-special, char-special, fifo, | |
6282 | socket and unknown | |
6283 | @item stat:perms | |
6284 | An 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 |
6292 | Creates a new name @var{newpath} in the file system for the |
6293 | file named by @var{oldpath}. If @var{oldpath} is a symbolic | |
6294 | link, the link may or may not be followed depending on the | |
6295 | system. | |
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 |
6302 | Renames the file specified by @var{oldname} to @var{newname}. |
6303 | The 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 |
6310 | Deletes (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 |
6317 | Create a new directory named by @var{path}. If @var{mode} is omitted |
6318 | then the permissions of the directory file are set using the current | |
6319 | umask. 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 |
6327 | Remove the existing directory named by @var{path}. The directory must |
6328 | be 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 |
6335 | Return a boolean indicating whether @var{object} is a directory |
6336 | stream 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 |
6343 | Open the directory specified by @var{path} and return a directory |
6344 | stream. | |
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 |
6351 | Return (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 | |
6353 | end 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 |
6360 | Reset 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 |
6368 | Close the directory stream @var{stream}. |
6369 | The 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 |
6376 | Change the current working directory to @var{path}. |
6377 | The 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 |
6384 | Return 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 | 6391 | This procedure has a variety of uses: waiting for the ability |
198586ed | 6392 | to provide input, accept output, or the existence of |
9401323e NJ |
6393 | exceptional conditions on a collection of ports or file |
6394 | descriptors, or waiting for a timeout to occur. | |
6395 | It also returns if interrupted by a signal. | |
6396 | ||
6397 | @var{reads}, @var{writes} and @var{excepts} can be lists or | |
6398 | vectors, with each member a port or a file descriptor. | |
6399 | The value returned is a list of three corresponding | |
6400 | lists or vectors containing only the members which meet the | |
6401 | specified requirement. The ability of port buffers to | |
6402 | provide input or accept output is taken into account. | |
6403 | Ordering of the input lists or vectors is not preserved. | |
6404 | ||
6405 | The optional arguments @var{secs} and @var{usecs} specify the | |
6406 | timeout. Either @var{secs} can be specified alone, as | |
6407 | either 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 | |
6410 | microseconds. If @var{secs} is omitted or is @code{#f} then | |
6411 | select will wait for as long as it takes for one of the other | |
6412 | conditions to be satisfied. | |
6413 | ||
6414 | The scsh version of @code{select} differs as follows: | |
6415 | Only vectors are accepted for the first three arguments. | |
6416 | The @var{usecs} argument is not supported. | |
6417 | Multiple values are returned instead of a list. | |
6418 | Duplicates in the input vectors appear only once in output. | |
6419 | An 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 |
6426 | Apply @var{command} to the specified file descriptor or the underlying |
6427 | file descriptor of the specified port. @var{value} is an optional | |
6428 | integer argument. | |
6429 | ||
6430 | Values for @var{command} are: | |
6431 | ||
6432 | @table @code | |
6433 | @item F_DUPFD | |
6434 | Duplicate a file descriptor | |
6435 | @item F_GETFD | |
6436 | Get flags associated with the file descriptor. | |
6437 | @item F_SETFD | |
6438 | Set flags associated with the file descriptor to @var{value}. | |
6439 | @item F_GETFL | |
6440 | Get flags associated with the open file. | |
6441 | @item F_SETFL | |
6442 | Set flags associated with the open file to @var{value} | |
6443 | @item F_GETOWN | |
6444 | Get the process ID of a socket's owner, for @code{SIGIO} signals. | |
6445 | @item F_SETOWN | |
6446 | Set the process that owns a socket to @var{value}, for @code{SIGIO} signals. | |
6447 | @item FD_CLOEXEC | |
6448 | The 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 |
6457 | Copies any unwritten data for the specified output file descriptor to disk. |
6458 | If @var{port/fd} is a port, its buffer is flushed before the underlying | |
6459 | file descriptor is fsync'd. | |
6460 | The 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 |
6467 | Create 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 |
6475 | Return the value of the symbolic link named by @var{path} (a |
6476 | string), 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 |
6483 | Similar to @code{stat}, but does not follow symbolic links, i.e., |
6484 | it will return information about a symbolic link itself, not the | |
6485 | file 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 |
6492 | Copy the file specified by @var{path-from} to @var{path-to}. |
6493 | The 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 |
6500 | Return the directory name component of the file name |
6501 | @var{filename}. If @var{filename} does not contain a directory | |
6502 | component, @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 |
6509 | Return the base name of the file name @var{filename}. The |
6510 | base name is the file name without any directory components. | |
198586ed | 6511 | If @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 |
6519 | Return a newly created pipe: a pair of ports which are linked |
6520 | together on the local machine. The @emph{car} is the input | |
6521 | port and the @emph{cdr} is the output port. Data written (and | |
6522 | flushed) to the output port can be read from the input port. | |
6523 | Pipes are commonly used for communication with a newly forked | |
6524 | child process. The need to flush the output port can be | |
6525 | avoided by making it unbuffered using @code{setvbuf}. | |
6526 | ||
6527 | Writes occur atomically provided the size of the data in bytes | |
6528 | is not greater than the value of @code{PIPE_BUF}. Note that | |
6529 | the output port is likely to block if too much data (typically | |
6530 | equal to @code{PIPE_BUF}) has been written but not yet read | |
6531 | from 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 | 6538 | Return a vector of integers representing the current |
198586ed | 6539 | supplementary 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 |
6546 | Look up an entry in the user database. @var{obj} can be an integer, |
6547 | a string, or omitted, giving the behaviour of getpwuid, getpwnam | |
6548 | or 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 |
6555 | If called with a true argument, initialize or reset the password data |
6556 | stream. 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 |
6564 | Look up an entry in the group database. @var{obj} can be an integer, |
6565 | a string, or omitted, giving the behaviour of getgrgid, getgrnam | |
6566 | or 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 |
6573 | If called with a true argument, initialize or reset the group data |
6574 | stream. 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 |
6582 | Sends 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 | |
6588 | The process whose identifier is @var{pid}. | |
6589 | @item @var{pid} equal to 0 | |
6590 | All processes in the current process group. | |
6591 | @item @var{pid} less than -1 | |
6592 | The process group whose identifier is -@var{pid} | |
6593 | @item @var{pid} equal to -1 | |
6594 | If the process is privileged, all processes except for some special | |
6595 | system processes. Otherwise, all processes with the current effective | |
6596 | user ID. | |
6597 | @end table | |
6598 | ||
6599 | @var{sig} should be specified using a variable corresponding to | |
6600 | the Unix symbolic name, e.g., | |
6601 | ||
6602 | @defvar SIGHUP | |
6603 | Hang-up signal. | |
6604 | @end defvar | |
6605 | ||
6606 | @defvar SIGINT | |
6607 | Interrupt 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 |
6615 | This procedure collects status information from a child process which |
6616 | has terminated or (optionally) stopped. Normally it will | |
6617 | suspend the calling process until this can be done. If more than one | |
6618 | child process is eligible then one will be chosen by the operating system. | |
6619 | ||
6620 | The value of @var{pid} determines the behaviour: | |
6621 | ||
6622 | @table @r | |
6623 | @item @var{pid} greater than 0 | |
6624 | Request status information from the specified child process. | |
6625 | @item @var{pid} equal to -1 or WAIT_ANY | |
6626 | Request status information for any child process. | |
6627 | @item @var{pid} equal to 0 or WAIT_MYPGRP | |
6628 | Request status information for any child process in the current process | |
6629 | group. | |
6630 | @item @var{pid} less than -1 | |
6631 | Request status information for any child process whose process group ID | |
6632 | is -@var{PID}. | |
6633 | @end table | |
6634 | ||
6635 | The @var{options} argument, if supplied, should be the bitwise OR of the | |
6636 | values of zero or more of the following variables: | |
780ee65e | 6637 | |
9401323e NJ |
6638 | @defvar WNOHANG |
6639 | Return immediately even if there are no child processes to be collected. | |
6640 | @end defvar | |
780ee65e | 6641 | |
9401323e NJ |
6642 | @defvar WUNTRACED |
6643 | Report status information for stopped processes as well as terminated | |
6644 | processes. | |
6645 | @end defvar | |
780ee65e | 6646 | |
9401323e | 6647 | The return value is a pair containing: |
780ee65e | 6648 | |
9401323e NJ |
6649 | @enumerate |
6650 | @item | |
6651 | The process ID of the child process, or 0 if @code{WNOHANG} was | |
6652 | specified and no process was collected. | |
6653 | @item | |
6654 | The 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 |
6662 | Return the exit status value, as would be set if a process |
6663 | ended normally through a call to @code{exit} or @code{_exit}, | |
6664 | if 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 |
6671 | Return the signal number which terminated the process, if any, |
6672 | otherwise @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 |
6679 | Return the signal number which stopped the process, if any, |
6680 | otherwise @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 |
6687 | Return an integer representing the process ID of the parent |
6688 | process. | |
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 |
6695 | Return 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 |
6702 | Return 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 |
6709 | Return an integer representing the current effective user ID. |
6710 | If the system does not support effective IDs, then the real ID | |
6711 | is returned. @code{(feature? 'EIDs)} reports whether the | |
6712 | system 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 |
6719 | Return an integer representing the current effective group ID. |
6720 | If the system does not support effective IDs, then the real ID | |
6721 | is returned. @code{(feature? 'EIDs)} reports whether the | |
6722 | system 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 |
6729 | Sets both the real and effective user IDs to the integer @var{id}, provided |
6730 | the process has appropriate privileges. | |
6731 | The 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 |
6738 | Sets both the real and effective group IDs to the integer @var{id}, provided |
6739 | the process has appropriate privileges. | |
6740 | The 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 |
6747 | Sets the effective user ID to the integer @var{id}, provided the process |
6748 | has appropriate privileges. If effective IDs are not supported, the | |
6749 | real ID is set instead -- @code{(feature? 'EIDs)} reports whether the | |
6750 | system supports effective IDs. | |
6751 | The 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 |
6758 | Sets the effective group ID to the integer @var{id}, provided the process |
6759 | has appropriate privileges. If effective IDs are not supported, the | |
6760 | real ID is set instead -- @code{(feature? 'EIDs)} reports whether the | |
6761 | system supports effective IDs. | |
6762 | The 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 |
6769 | Return an integer representing the current process group ID. |
6770 | This 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 |
6777 | Move 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 | |
6779 | current process. | |
6780 | Fails on systems that do not support job control. | |
6781 | The 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 |
6788 | Creates a new session. The current process becomes the session leader |
6789 | and is put in a new process group. The process will be detached | |
6790 | from its controlling terminal if it has one. | |
6791 | The 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 |
6798 | Return a string with the name of the serial terminal device |
6799 | underlying @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 |
6806 | Return a string containing the file name of the controlling |
6807 | terminal 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 |
6814 | Return the process group ID of the foreground process group |
6815 | associated with the terminal open on the file descriptor | |
6816 | underlying @var{port}. | |
7a095584 | 6817 | |
9401323e NJ |
6818 | If there is no foreground process group, the return value is a |
6819 | number greater than 1 that does not match the process group ID | |
6820 | of any existing process group. This can happen if all of the | |
6821 | processes in the job that was formerly the foreground job have | |
6822 | terminated, and no other job has yet been moved into the | |
6823 | foreground. | |
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 |
6830 | Set the foreground process group ID for the terminal used by the file |
6831 | descriptor underlying @var{port} to the integer @var{pgid}. | |
6832 | The calling process | |
6833 | must be a member of the same session as @var{pgid} and must have the same | |
6834 | controlling 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 |
6841 | Executes the file named by @var{path} as a new process image. |
6842 | The remaining arguments are supplied to the process; from a C program | |
198586ed | 6843 | they are accessible as the @code{argv} argument to @code{main}. |
9401323e | 6844 | Conventionally the first @var{arg} is the same as @var{path}. |
8f85c0c6 | 6845 | All arguments must be strings. |
7a095584 | 6846 | |
9401323e NJ |
6847 | If @var{arg} is missing, @var{path} is executed with a null |
6848 | argument list, which may have system-dependent side-effects. | |
7a095584 | 6849 | |
9401323e NJ |
6850 | This procedure is currently implemented using the @code{execv} system |
6851 | call, 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 |
6858 | Similar to @code{execl}, however if |
6859 | @var{filename} does not contain a slash | |
6860 | then the file to execute will be located by searching the | |
6861 | directories listed in the @code{PATH} environment variable. | |
6862 | ||
6863 | This procedure is currently implemented using the @code{execvp} system | |
6864 | call, 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 |
6871 | Similar to @code{execl}, but the environment of the new process is |
6872 | specified by @var{env}, which must be a list of strings as returned by the | |
6873 | @code{environ} procedure. | |
780ee65e | 6874 | |
9401323e NJ |
6875 | This procedure is currently implemented using the @code{execve} system |
6876 | call, 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 |
6883 | Creates a new "child" process by duplicating the current "parent" process. |
6884 | In the child the return value is 0. In the parent the return value is | |
6885 | the integer process ID of the child. | |
780ee65e | 6886 | |
9401323e NJ |
6887 | This procedure has been renamed from @code{fork} to avoid a naming conflict |
6888 | with 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 |
6895 | Return an object with some information about the computer |
6896 | system 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 |
6903 | If @var{env} is omitted, return the current environment (in the |
6904 | Unix sense) as a list of strings. Otherwise set the current | |
6905 | environment, which is also the default environment for child | |
6906 | processes, 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 | |
6909 | then 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 |
6916 | Return a name in the file system that does not match any |
6917 | existing file. However there is no guarantee that another | |
6918 | process will not create the file after @code{tmpnam} is called. | |
6919 | Care 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 |
6927 | Create a new unique file in the file system and returns a new |
6928 | buffered port open for reading and writing to the file. | |
6929 | @var{tmpl} is a string specifying where the file should be | |
6930 | created: it must end with @code{XXXXXX} and will be changed in | |
6931 | place 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 |
6939 | file named by @var{path}. If @var{actime} or @var{modtime} is | |
6940 | not 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 | |
6946 | will set the access time to one hour in the past and the | |
6947 | modification 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 |
6954 | Return @code{#t} if @var{path} corresponds to an existing file |
6955 | and the current process has the type of access specified by | |
6956 | @var{how}, otherwise @code{#f}. @var{how} should be specified | |
6957 | using the values of the variables listed below. Multiple | |
6958 | values 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 |
6961 | Permissions are checked using the real id of the current |
6962 | process, not the effective id, although it's the effective id | |
6963 | which determines whether the access would actually be granted. | |
780ee65e | 6964 | |
9401323e NJ |
6965 | @defvar R_OK |
6966 | test for read permission. | |
6967 | @end defvar | |
6968 | @defvar W_OK | |
6969 | test for write permission. | |
6970 | @end defvar | |
6971 | @defvar X_OK | |
6972 | test for execute permission. | |
6973 | @end defvar | |
6974 | @defvar F_OK | |
6975 | test 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 | 6983 | Return 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 |
6990 | Modifies the environment of the current process, which is |
6991 | also the default environment inherited by child processes. | |
780ee65e | 6992 | |
9401323e NJ |
6993 | If @var{string} is of the form @code{NAME=VALUE} then it will be written |
6994 | directly into the environment, replacing any existing environment string | |
6995 | with | |
6996 | name matching @code{NAME}. If @var{string} does not contain an equal | |
6997 | sign, then any existing string with name matching @var{string} will | |
6998 | be removed. | |
6999 | ||
7000 | The 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 |
7007 | If @var{locale} is omitted, return the current value of the |
7008 | specified 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 | ||
7012 | Otherwise the specified locale category is set to the string | |
7013 | @var{locale} and the new value is returned as a | |
7014 | system-dependent string. If @var{locale} is an empty string, | |
198586ed | 7015 | the 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 |
7022 | Creates a new special file, such as a file corresponding to a device. |
7023 | @var{path} specifies the name of the file. @var{type} should | |
7024 | be one of the following symbols: | |
7025 | regular, directory, symlink, block-special, char-special, | |
7026 | fifo, or socket. @var{perms} (an integer) specifies the file permissions. | |
7027 | @var{dev} (an integer) specifies which device the special file refers | |
7028 | to. Its exact interpretation depends on the kind of special file | |
7029 | being created. | |
7030 | ||
7031 | E.g., | |
ae9f3a15 | 7032 | @lisp |
9401323e | 7033 | (mknod "/dev/fd0" 'block-special #o660 (+ (* 2 256) 2)) |
ae9f3a15 | 7034 | @end lisp |
7a095584 | 7035 | |
9401323e NJ |
7036 | The 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 |
7043 | Increment the priority of the current process by @var{incr}. A higher |
7044 | priority value means that the process runs less often. | |
7045 | The 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 |
7052 | Flush the operating system disk buffers. |
7053 | The 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 |
7060 | Encrypt @var{key} using @var{salt} as the salt value to the |
7061 | crypt(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 |
7068 | Change the root directory to that specified in @var{path}. |
7069 | This directory will be used for path names beginning with | |
7070 | @file{/}. The root directory is inherited by all children | |
7071 | of the current process. Only the superuser may change the | |
7072 | root 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 |
7079 | Return a string containing the name of the user logged in on |
7080 | the controlling terminal of the process, or @code{#f} if this | |
7081 | information 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 |
7088 | Return a string containing a user name associated with the |
7089 | effective user id of the process. Return @code{#f} if this | |
7090 | information 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 |
7097 | Return the scheduling priority of the process, process group |
7098 | or user, as indicated by @var{which} and @var{who}. @var{which} | |
7099 | is one of the variables @code{PRIO_PROCESS}, @code{PRIO_PGRP} | |
7100 | or @code{PRIO_USER}, and @var{who} is interpreted relative to | |
7101 | @var{which} (a process identifier for @code{PRIO_PROCESS}, | |
7102 | process group identifier for @code{PRIO_PGRP}, and a user | |
7103 | identifier for @code{PRIO_USER}. A zero value of @var{who} | |
7104 | denotes the current process, process group, or user. Return | |
7105 | the highest priority (lowest numerical value) of any of the | |
7106 | specified 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 |
7113 | Set the scheduling priority of the process, process group |
7114 | or user, as indicated by @var{which} and @var{who}. @var{which} | |
7115 | is one of the variables @code{PRIO_PROCESS}, @code{PRIO_PGRP} | |
7116 | or @code{PRIO_USER}, and @var{who} is interpreted relative to | |
7117 | @var{which} (a process identifier for @code{PRIO_PROCESS}, | |
7118 | process group identifier for @code{PRIO_PGRP}, and a user | |
7119 | identifier for @code{PRIO_USER}. A zero value of @var{who} | |
7120 | denotes the current process, process group, or user. | |
7121 | @var{prio} is a value in the range -20 and 20, the default | |
7122 | priority is 0; lower priorities cause more favorable | |
7123 | scheduling. Sets the priority of all of the specified | |
7124 | processes. Only the super-user may lower priorities. | |
7125 | The 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 |
7132 | Display @var{prompt} to the standard error output and read |
7133 | a password from @file{/dev/tty}. If this file is not | |
7134 | accessible, it reads from standard input. The password may be | |
7135 | up to 127 characters in length. Additional characters and the | |
7136 | terminating newline character are discarded. While reading | |
7137 | the password, echoing and the generation of signals by special | |
7138 | characters 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 |
7145 | Apply 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 | |
7149 | Shared lock. More than one process may hold a shared lock | |
7150 | for a given file at a given time. | |
7151 | @item LOCK_EX | |
7152 | Exclusive lock. Only one process may hold an exclusive lock | |
7153 | for a given file at a given time. | |
7154 | @item LOCK_UN | |
7155 | Unlock the file. | |
7156 | @item LOCK_NB | |
7157 | Don't block when locking. May be specified by bitwise OR'ing | |
7158 | it to one of the other operations. | |
7159 | @end table | |
7160 | The return value is not specified. @var{file} may be an open | |
198586ed | 7161 | file 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 |
7168 | Set the host name of the current processor to @var{name}. May |
7169 | only be used by the superuser. The return value is not | |
7170 | specified. | |
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 | 7177 | Return 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 |
7186 | Look 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 | |
7188 | address; if given no arguments, it behaves like @code{gethostent} (see | |
7189 | below). If a name or address is supplied but the address can not be | |
7190 | found, 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. | |
7193 | Unusual 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 |
7203 | Look 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} | |
7205 | argument must be an integer. @code{getnet} will accept either type of | |
7206 | argument, behaving like @code{getnetent} (see below) if no arguments are | |
7207 | given. | |
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 |
7216 | Look up a network protocol by name or by number. @code{getprotobyname} |
7217 | takes a string argument, and @code{getprotobynumber} takes an integer | |
7218 | argument. @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 |
7228 | Look up a network service by name or by service number, and return a |
7229 | network service object. The @var{protocol} argument specifies the name | |
7230 | of the desired protocol; if the protocol found in the network service | |
7231 | database does not match this name, a system error is signalled. | |
7a095584 | 7232 | |
9401323e NJ |
7233 | The @code{getserv} procedure will take either a service name or number |
7234 | as 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 |
7242 | If @var{stayopen} is omitted, this is equivalent to @code{endhostent}. |
7243 | Otherwise 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 |
7250 | If @var{stayopen} is omitted, this is equivalent to @code{endnetent}. |
7251 | Otherwise 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 |
7258 | If @var{stayopen} is omitted, this is equivalent to @code{endprotoent}. |
7259 | Otherwise 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 |
7266 | If @var{stayopen} is omitted, this is equivalent to @code{endservent}. |
7267 | Otherwise 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 |
7274 | Convert a 16 bit quantity from host to network byte ordering. |
7275 | @var{value} is packed into 2 bytes, which are then converted | |
7276 | and 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 |
7283 | Convert a 16 bit quantity from network to host byte ordering. |
7284 | @var{value} is packed into 2 bytes, which are then converted | |
7285 | and 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 |
7292 | Convert a 32 bit quantity from host to network byte ordering. |
7293 | @var{value} is packed into 4 bytes, which are then converted | |
7294 | and 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 |
7301 | Convert a 32 bit quantity from network to host byte ordering. |
7302 | @var{value} is packed into 4 bytes, which are then converted | |
7303 | and 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 |
7310 | Convert 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 |
7322 | Convert 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 |
7334 | Return the network number part of the given IPv4 |
7335 | Internet 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 |
7346 | Return the local-address-with-network part of the given |
7347 | IPv4 Internet address, using the obsolete class A/B/C system. | |
7348 | E.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 |
7359 | Make 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 |
7372 | Convert a string containing a printable network address to |
7373 | an integer address. Note that unlike the C version of this | |
7374 | function, | |
7375 | the 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 |
7388 | Convert a network address into a printable string. |
7389 | Note that unlike the C version of this function, | |
7390 | the 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{} | |
7396 | ffff: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 |
7404 | Return a new socket port of the type specified by @var{family}, |
7405 | @var{style} and @var{proto}. All three parameters are | |
7406 | integers. Supported values for @var{family} are | |
7407 | @code{AF_UNIX}, @code{AF_INET} and @code{AF_INET6}. | |
7408 | Typical 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 | |
7413 | protocol, which is usually right. | |
780ee65e | 7414 | |
9401323e NJ |
7415 | A single socket port cannot by used for communication until it |
7416 | has 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 |
7423 | Return a pair of connected (but unnamed) socket ports of the |
7424 | type specified by @var{family}, @var{style} and @var{proto}. | |
7425 | Many systems support only socket pairs of the @code{AF_UNIX} | |
7426 | family. 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 |
7434 | Return the value of a particular socket option for the socket |
7435 | port @var{sock}. @var{level} is an integer code for type of | |
7436 | option being requested, e.g., @code{SOL_SOCKET} for | |
7437 | socket-level options. @var{optname} is an integer code for the | |
7438 | option required and should be specified using one of the | |
7439 | symbols @code{SO_DEBUG}, @code{SO_REUSEADDR} etc. | |
780ee65e | 7440 | |
9401323e NJ |
7441 | The returned value is typically an integer but @code{SO_LINGER} |
7442 | returns 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 |
7449 | Set the value of a particular socket option for the socket |
7450 | port @var{sock}. @var{level} is an integer code for type of option | |
7451 | being set, e.g., @code{SOL_SOCKET} for socket-level options. | |
7452 | @var{optname} is an | |
7453 | integer code for the option to set and should be specified using one of | |
7454 | the symbols @code{SO_DEBUG}, @code{SO_REUSEADDR} etc. | |
7455 | @var{value} is the value to which the option should be set. For | |
7456 | most options this must be an integer, but for @code{SO_LINGER} it must | |
7457 | be a pair. | |
780ee65e | 7458 | |
9401323e | 7459 | The 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 | 7466 | Sockets can be closed simply by using @code{close-port}. The |
198586ed | 7467 | @code{shutdown} procedure allows reception or transmission on a |
9401323e NJ |
7468 | connection to be shut down individually, according to the parameter |
7469 | @var{how}: | |
780ee65e | 7470 | |
9401323e NJ |
7471 | @table @asis |
7472 | @item 0 | |
7473 | Stop receiving data for this socket. If further data arrives, reject it. | |
7474 | @item 1 | |
7475 | Stop trying to transmit data from this socket. Discard any | |
7476 | data waiting to be sent. Stop looking for acknowledgement of | |
7477 | data already sent; don't retransmit it if it is lost. | |
7478 | @item 2 | |
7479 | Stop both reception and transmission. | |
7480 | @end table | |
780ee65e | 7481 | |
9401323e | 7482 | The 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 |
7489 | Initiate a connection from a socket using a specified address |
7490 | family to the address | |
7491 | specified by @var{address} and possibly @var{args}. | |
7492 | The format required for @var{address} | |
7493 | and @var{args} depends on the family of the socket. | |
780ee65e | 7494 | |
9401323e NJ |
7495 | For a socket of family @code{AF_UNIX}, |
7496 | only @var{address} is specified and must be a string with the | |
7497 | filename where the socket is to be created. | |
7a095584 | 7498 | |
9401323e NJ |
7499 | For 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 |
7503 | For 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: | |
7506 | port [flowinfo] [scope_id], | |
7507 | where flowinfo and scope_id default to zero. | |
7508 | ||
7509 | The 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 |
7516 | Assign an address to the socket port @var{sock}. |
7517 | Generally this only needs to be done for server sockets, | |
7518 | so they know where to look for incoming connections. A socket | |
7519 | without an address will be assigned one automatically when it | |
7520 | starts communicating. | |
7a095584 | 7521 | |
9401323e NJ |
7522 | The format of @var{address} and @var{args} depends |
7523 | on the family of the socket. | |
7524 | ||
7525 | For a socket of family @code{AF_UNIX}, only @var{address} | |
7526 | is specified and must be a string with the filename where | |
7527 | the socket is to be created. | |
7528 | ||
7529 | For a socket of family @code{AF_INET}, @var{address} | |
7530 | must be an integer IPv4 address and @var{args} | |
7531 | must be a single integer port number. | |
780ee65e | 7532 | |
9401323e NJ |
7533 | The values of the following variables can also be used for |
7534 | @var{address}: | |
780ee65e | 7535 | |
9401323e NJ |
7536 | @defvar INADDR_ANY |
7537 | Allow connections from any address. | |
7538 | @end defvar | |
780ee65e | 7539 | |
9401323e NJ |
7540 | @defvar INADDR_LOOPBACK |
7541 | The address of the local host using the loopback device. | |
7542 | @end defvar | |
780ee65e | 7543 | |
9401323e NJ |
7544 | @defvar INADDR_BROADCAST |
7545 | The broadcast address on the local network. | |
7546 | @end defvar | |
780ee65e | 7547 | |
9401323e NJ |
7548 | @defvar INADDR_NONE |
7549 | No address. | |
7550 | @end defvar | |
780ee65e | 7551 | |
9401323e NJ |
7552 | For a socket of family @code{AF_INET6}, @var{address} |
7553 | must be an integer IPv6 address and @var{args} | |
7554 | may be up to three integers: | |
7555 | port [flowinfo] [scope_id], | |
7556 | where flowinfo and scope_id default to zero. | |
780ee65e | 7557 | |
9401323e | 7558 | The 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 |
7565 | Enable @var{sock} to accept connection |
7566 | requests. @var{backlog} is an integer specifying | |
7567 | the maximum length of the queue for pending connections. | |
7568 | If the queue fills, new clients will fail to connect until | |
7569 | the server calls @code{accept} to accept a connection from | |
7570 | the queue. | |
7a095584 | 7571 | |
9401323e NJ |
7572 | The 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 |
7579 | Accept a connection on a bound, listening socket. |
7580 | If there | |
7581 | are no pending connections in the queue, wait until | |
7582 | one is available unless the non-blocking option has been | |
7583 | set on the socket. | |
7a095584 | 7584 | |
9401323e NJ |
7585 | The return value is a |
7586 | pair in which the @emph{car} is a new socket port for the | |
7587 | connection and | |
7588 | the @emph{cdr} is an object with address information about the | |
7589 | client which initiated the connection. | |
7a095584 | 7590 | |
9401323e NJ |
7591 | @var{sock} does not become part of the |
7592 | connection 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 |
7599 | Return the address of @var{sock}, in the same form as the |
7600 | object returned by @code{accept}. On many systems the address | |
7601 | of 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 |
7608 | Return the address that @var{sock} |
7609 | is 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 |
7618 | Receive data from a socket port. |
7619 | @var{sock} must already | |
7620 | be bound to the address from which data is to be received. | |
7621 | @var{buf} is a string into which | |
7622 | the data will be written. The size of @var{buf} limits | |
7623 | the amount of | |
7624 | data which can be received: in the case of packet | |
7625 | protocols, if a packet larger than this limit is encountered | |
7626 | then some data | |
7627 | will be irrevocably lost. | |
780ee65e | 7628 | |
9401323e NJ |
7629 | The optional @var{flags} argument is a value or |
7630 | bitwise OR of MSG_OOB, MSG_PEEK, MSG_DONTROUTE etc. | |
780ee65e | 7631 | |
9401323e NJ |
7632 | The value returned is the number of bytes read from the |
7633 | socket. | |
7a095584 | 7634 | |
9401323e NJ |
7635 | Note that the data is read directly from the socket file |
7636 | descriptor: | |
7637 | any 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 |
7644 | Transmit the string @var{message} on a socket port @var{sock}. |
7645 | @var{sock} must already be bound to a destination address. The | |
7646 | value returned is the number of bytes transmitted -- | |
7647 | it's possible for | |
7648 | this to be less than the length of @var{message} | |
7649 | if the socket is | |
7650 | set to be non-blocking. The optional @var{flags} argument | |
7651 | is a value or | |
7652 | bitwise OR of MSG_OOB, MSG_PEEK, MSG_DONTROUTE etc. | |
780ee65e | 7653 | |
9401323e NJ |
7654 | Note that the data is written directly to the socket |
7655 | file descriptor: | |
7656 | any 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 |
7663 | Return data from the socket port @var{sock} and also |
7664 | information about where the data was received from. | |
7665 | @var{sock} must already be bound to the address from which | |
7666 | data is to be received. @code{str}, is a string into which the | |
7667 | data will be written. The size of @var{str} limits the amount | |
7668 | of data which can be received: in the case of packet protocols, | |
7669 | if a packet larger than this limit is encountered then some | |
7670 | data will be irrevocably lost. | |
780ee65e | 7671 | |
9401323e NJ |
7672 | The optional @var{flags} argument is a value or bitwise OR of |
7673 | @code{MSG_OOB}, @code{MSG_PEEK}, @code{MSG_DONTROUTE} etc. | |
7674 | ||
7675 | The value returned is a pair: the @emph{car} is the number of | |
7676 | bytes read from the socket and the @emph{cdr} an address object | |
7677 | in the same form as returned by @code{accept}. The address | |
7678 | will given as @code{#f} if not available, as is usually the | |
7679 | case for stream sockets. | |
7680 | ||
7681 | The @var{start} and @var{end} arguments specify a substring of | |
7682 | @var{str} to which the data should be written. | |
7683 | ||
7684 | Note that the data is read directly from the socket file | |
7685 | descriptor: 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 |
7692 | Transmit the string @var{message} on the socket port |
7693 | @var{sock}. The | |
7694 | destination 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 | |
7698 | the usual connection arguments optionally followed by | |
7699 | a flags argument, which is a value or | |
7700 | bitwise OR of MSG_OOB, MSG_PEEK, MSG_DONTROUTE etc. | |
7701 | ||
7702 | The value returned is the number of bytes transmitted -- | |
7703 | it's possible for | |
7704 | this to be less than the length of @var{message} if the | |
7705 | socket is | |
7706 | set to be non-blocking. | |
7707 | Note that the data is written directly to the socket | |
7708 | file descriptor: | |
7709 | any 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) | |
7716 | Return @code{#t} if @var{obj} is a compiled regular expression, | |
7717 | or @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) | |
7724 | Compile the regular expression described by @var{pat}, and | |
7725 | return the compiled regexp structure. If @var{pat} does not | |
7726 | describe a legal regular expression, @code{make-regexp} throws | |
7727 | a @code{regular-expression-syntax} error. | |
7728 | ||
7729 | The @var{flags} arguments change the behavior of the compiled | |
7730 | regular expression. The following flags may be supplied: | |
7731 | ||
7732 | @table @code | |
7733 | @item regexp/icase | |
7734 | Consider uppercase and lowercase letters to be the same when | |
7735 | matching. | |
7736 | @item regexp/newline | |
7737 | If a newline appears in the target string, then permit the | |
7738 | @samp{^} and @samp{$} operators to match immediately after or | |
7739 | immediately before the newline, respectively. Also, the | |
7740 | @samp{.} and @samp{[^...]} operators will never match a newline | |
7741 | character. The intent of this flag is to treat the target | |
7742 | string as a buffer containing many lines of text, and the | |
7743 | regular expression as a pattern that may match a single one of | |
7744 | those lines. | |
7745 | @item regexp/basic | |
7746 | Compile a basic (``obsolete'') regexp instead of the extended | |
7747 | (``modern'') regexps that are the default. Basic regexps do | |
7748 | not consider @samp{|}, @samp{+} or @samp{?} to be special | |
7749 | characters, and require the @samp{@{...@}} and @samp{(...)} | |
7750 | metacharacters to be backslash-escaped (@pxref{Backslash | |
7751 | Escapes}). There are several other differences between basic | |
7752 | and extended regular expressions, but these are the most | |
7753 | significant. | |
7754 | @item regexp/extended | |
7755 | Compile an extended regular expression rather than a basic | |
7756 | regexp. This is the default behavior; this flag will not | |
7757 | usually be needed. If a call to @code{make-regexp} includes | |
7758 | both @code{regexp/basic} and @code{regexp/extended} flags, the | |
7759 | one 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) | |
7767 | Match the compiled regular expression @var{rx} against | |
7768 | @code{str}. If the optional integer @var{start} argument is | |
7769 | provided, begin matching from that position in the string. | |
7770 | Return a match structure describing the results of the match, | |
7771 | or @code{#f} if no match could be found. | |
7772 | ||
7773 | The @var{flags} arguments change the matching behavior. | |
7774 | The following flags may be supplied: | |
7775 | ||
7776 | @table @code | |
7777 | @item regexp/notbol | |
7778 | Operator @samp{^} always fails (unless @code{regexp/newline} | |
7779 | is used). Use this when the beginning of the string should | |
7780 | not be considered the beginning of a line. | |
7781 | @item regexp/noteol | |
7782 | Operator @samp{$} always fails (unless @code{regexp/newline} | |
7783 | is used). Use this when the end of the string should not be | |
7784 | considered 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? |
7791 | implemented 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 |
7797 | implemented 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 |
7803 | implemented 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 |
7809 | implemented 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 |
7815 | implemented 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 |
7821 | implemented 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 |
7827 | implemented 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 |
7833 | implemented 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 |
7839 | implemented 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 |
7845 | implemented by the C function "scm_signal_condition_variable" | |
7846 | @end deffn |