Commit | Line | Data |
---|---|---|
f7b47737 | 1 | Guile NEWS --- history of user-visible changes. -*- text -*- |
d23bbf3e | 2 | Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. |
5c54da76 JB |
3 | See the end for copying conditions. |
4 | ||
e1b6c710 | 5 | Please send Guile bug reports to bug-guile@gnu.org. |
5c54da76 | 6 | \f |
f3227c7a JB |
7 | Changes since Guile 1.3: |
8 | ||
d77fb593 JB |
9 | * Changes to the distribution |
10 | ||
1d335863 JB |
11 | ** Readline support is no longer included with Guile by default. |
12 | ||
13 | Based on the different license terms of Guile and Readline, we | |
14 | concluded that Guile should not *by default* cause the linking of | |
15 | Readline into an application program. Readline support is now offered | |
16 | as a separate module, which is linked into an application only when | |
17 | you explicitly specify it. | |
18 | ||
19 | Although Guile is GNU software, its distribution terms add a special | |
20 | exception to the usual GNU General Public License (GPL). Guile's | |
21 | license includes a clause that allows you to link Guile with non-free | |
22 | programs. We add this exception so as not to put Guile at a | |
23 | disadvantage vis-a-vis other extensibility packages that support other | |
24 | languages. | |
25 | ||
26 | In contrast, the GNU Readline library is distributed under the GNU | |
27 | General Public License pure and simple. This means that you may not | |
28 | link Readline, even dynamically, into an application unless it is | |
29 | distributed under a free software license that is compatible the GPL. | |
30 | ||
31 | Because of this difference in distribution terms, an application that | |
32 | can use Guile may not be able to use Readline. Now users will be | |
33 | explicitly offered two independent decisions about the use of these | |
34 | two packages. | |
d77fb593 | 35 | |
e4eae9b1 MD |
36 | * Changes to the stand-alone interpreter |
37 | ||
67ad463a MD |
38 | ** All builtins now print as primitives. |
39 | Previously builtin procedures not belonging to the fundamental subr | |
40 | types printed as #<compiled closure #<primitive-procedure gsubr-apply>>. | |
41 | Now, they print as #<primitive-procedure NAME>. | |
42 | ||
43 | ** Backtraces slightly more intelligible. | |
44 | gsubr-apply and macro transformer application frames no longer appear | |
45 | in backtraces. | |
46 | ||
69c6acbb JB |
47 | * Changes to Scheme functions and syntax |
48 | ||
deaceb4e JB |
49 | ** New module (ice-9 getopt-long), with the function `getopt-long'. |
50 | ||
51 | getopt-long is a function for parsing command-line arguments in a | |
52 | manner consistent with other GNU programs. | |
53 | ||
54 | (getopt-long ARGS GRAMMAR) | |
55 | Parse the arguments ARGS according to the argument list grammar GRAMMAR. | |
56 | ||
57 | ARGS should be a list of strings. Its first element should be the | |
58 | name of the program; subsequent elements should be the arguments | |
59 | that were passed to the program on the command line. The | |
60 | `program-arguments' procedure returns a list of this form. | |
61 | ||
62 | GRAMMAR is a list of the form: | |
63 | ((OPTION (PROPERTY VALUE) ...) ...) | |
64 | ||
65 | Each OPTION should be a symbol. `getopt-long' will accept a | |
66 | command-line option named `--OPTION'. | |
67 | Each option can have the following (PROPERTY VALUE) pairs: | |
68 | ||
69 | (single-char CHAR) --- Accept `-CHAR' as a single-character | |
70 | equivalent to `--OPTION'. This is how to specify traditional | |
71 | Unix-style flags. | |
72 | (required? BOOL) --- If BOOL is true, the option is required. | |
73 | getopt-long will raise an error if it is not found in ARGS. | |
74 | (value BOOL) --- If BOOL is #t, the option accepts a value; if | |
75 | it is #f, it does not; and if it is the symbol | |
76 | `optional', the option may appear in ARGS with or | |
77 | without a value. | |
78 | (predicate FUNC) --- If the option accepts a value (i.e. you | |
79 | specified `(value #t)' for this option), then getopt | |
80 | will apply FUNC to the value, and throw an exception | |
81 | if it returns #f. FUNC should be a procedure which | |
82 | accepts a string and returns a boolean value; you may | |
83 | need to use quasiquotes to get it into GRAMMAR. | |
84 | ||
85 | The (PROPERTY VALUE) pairs may occur in any order, but each | |
86 | property may occur only once. By default, options do not have | |
87 | single-character equivalents, are not required, and do not take | |
88 | values. | |
89 | ||
90 | In ARGS, single-character options may be combined, in the usual | |
91 | Unix fashion: ("-x" "-y") is equivalent to ("-xy"). If an option | |
92 | accepts values, then it must be the last option in the | |
93 | combination; the value is the next argument. So, for example, using | |
94 | the following grammar: | |
95 | ((apples (single-char #\a)) | |
96 | (blimps (single-char #\b) (value #t)) | |
97 | (catalexis (single-char #\c) (value #t))) | |
98 | the following argument lists would be acceptable: | |
99 | ("-a" "-b" "bang" "-c" "couth") ("bang" and "couth" are the values | |
100 | for "blimps" and "catalexis") | |
101 | ("-ab" "bang" "-c" "couth") (same) | |
102 | ("-ac" "couth" "-b" "bang") (same) | |
103 | ("-abc" "couth" "bang") (an error, since `-b' is not the | |
104 | last option in its combination) | |
105 | ||
106 | If an option's value is optional, then `getopt-long' decides | |
107 | whether it has a value by looking at what follows it in ARGS. If | |
108 | the next element is a string, and it does not appear to be an | |
109 | option itself, then that string is the option's value. | |
110 | ||
111 | The value of a long option can appear as the next element in ARGS, | |
112 | or it can follow the option name, separated by an `=' character. | |
113 | Thus, using the same grammar as above, the following argument lists | |
114 | are equivalent: | |
115 | ("--apples" "Braeburn" "--blimps" "Goodyear") | |
116 | ("--apples=Braeburn" "--blimps" "Goodyear") | |
117 | ("--blimps" "Goodyear" "--apples=Braeburn") | |
118 | ||
119 | If the option "--" appears in ARGS, argument parsing stops there; | |
120 | subsequent arguments are returned as ordinary arguments, even if | |
121 | they resemble options. So, in the argument list: | |
122 | ("--apples" "Granny Smith" "--" "--blimp" "Goodyear") | |
123 | `getopt-long' will recognize the `apples' option as having the | |
124 | value "Granny Smith", but it will not recognize the `blimp' | |
125 | option; it will return the strings "--blimp" and "Goodyear" as | |
126 | ordinary argument strings. | |
127 | ||
128 | The `getopt-long' function returns the parsed argument list as an | |
129 | assocation list, mapping option names --- the symbols from GRAMMAR | |
130 | --- onto their values, or #t if the option does not accept a value. | |
131 | Unused options do not appear in the alist. | |
132 | ||
133 | All arguments that are not the value of any option are returned | |
134 | as a list, associated with the empty list. | |
135 | ||
136 | `getopt-long' throws an exception if: | |
137 | - it finds an unrecognized option in ARGS | |
138 | - a required option is omitted | |
139 | - an option that requires an argument doesn't get one | |
140 | - an option that doesn't accept an argument does get one (this can | |
141 | only happen using the long option `--opt=value' syntax) | |
142 | - an option predicate fails | |
143 | ||
144 | So, for example: | |
145 | ||
146 | (define grammar | |
147 | `((lockfile-dir (required? #t) | |
148 | (value #t) | |
149 | (single-char #\k) | |
150 | (predicate ,file-is-directory?)) | |
151 | (verbose (required? #f) | |
152 | (single-char #\v) | |
153 | (value #f)) | |
154 | (x-includes (single-char #\x)) | |
155 | (rnet-server (single-char #\y) | |
156 | (predicate ,string?)))) | |
157 | ||
158 | (getopt-long '("my-prog" "-vk" "/tmp" "foo1" "--x-includes=/usr/include" | |
159 | "--rnet-server=lamprod" "--" "-fred" "foo2" "foo3") | |
160 | grammar) | |
161 | => ((() "foo1" "-fred" "foo2" "foo3") | |
162 | (rnet-server . "lamprod") | |
163 | (x-includes . "/usr/include") | |
164 | (lockfile-dir . "/tmp") | |
165 | (verbose . #t)) | |
166 | ||
167 | ** The (ice-9 getopt-gnu-style) module is obsolete; use (ice-9 getopt-long). | |
168 | ||
169 | It will be removed in a few releases. | |
170 | ||
08394899 MS |
171 | ** New syntax: lambda* |
172 | ** New syntax: define* | |
173 | ** New syntax: define*-public | |
174 | ** New syntax: defmacro* | |
175 | ** New syntax: defmacro*-public | |
176 | Guile now supports optional arguments. | |
177 | ||
178 | `lambda*', `define*', `define*-public', `defmacro*' and | |
179 | `defmacro*-public' are identical to the non-* versions except that | |
180 | they use an extended type of parameter list that has the following BNF | |
181 | syntax (parentheses are literal, square brackets indicate grouping, | |
182 | and `*', `+' and `?' have the usual meaning): | |
183 | ||
184 | ext-param-list ::= ( [identifier]* [#&optional [ext-var-decl]+]? | |
185 | [#&key [ext-var-decl]+ [#&allow-other-keys]?]? | |
186 | [[#&rest identifier]|[. identifier]]? ) | [identifier] | |
187 | ||
188 | ext-var-decl ::= identifier | ( identifier expression ) | |
189 | ||
190 | The semantics are best illustrated with the following documentation | |
191 | and examples for `lambda*': | |
192 | ||
193 | lambda* args . body | |
194 | lambda extended for optional and keyword arguments | |
195 | ||
196 | lambda* creates a procedure that takes optional arguments. These | |
197 | are specified by putting them inside brackets at the end of the | |
198 | paramater list, but before any dotted rest argument. For example, | |
199 | (lambda* (a b #&optional c d . e) '()) | |
200 | creates a procedure with fixed arguments a and b, optional arguments c | |
201 | and d, and rest argument e. If the optional arguments are omitted | |
202 | in a call, the variables for them are unbound in the procedure. This | |
203 | can be checked with the bound? macro. | |
204 | ||
205 | lambda* can also take keyword arguments. For example, a procedure | |
206 | defined like this: | |
207 | (lambda* (#&key xyzzy larch) '()) | |
208 | can be called with any of the argument lists (#:xyzzy 11) | |
209 | (#:larch 13) (#:larch 42 #:xyzzy 19) (). Whichever arguments | |
210 | are given as keywords are bound to values. | |
211 | ||
212 | Optional and keyword arguments can also be given default values | |
213 | which they take on when they are not present in a call, by giving a | |
214 | two-item list in place of an optional argument, for example in: | |
215 | (lambda* (foo #&optional (bar 42) #&key (baz 73)) (list foo bar baz)) | |
216 | foo is a fixed argument, bar is an optional argument with default | |
217 | value 42, and baz is a keyword argument with default value 73. | |
218 | Default value expressions are not evaluated unless they are needed | |
219 | and until the procedure is called. | |
220 | ||
221 | lambda* now supports two more special parameter list keywords. | |
222 | ||
223 | lambda*-defined procedures now throw an error by default if a | |
224 | keyword other than one of those specified is found in the actual | |
225 | passed arguments. However, specifying #&allow-other-keys | |
226 | immediately after the kyword argument declarations restores the | |
227 | previous behavior of ignoring unknown keywords. lambda* also now | |
228 | guarantees that if the same keyword is passed more than once, the | |
229 | last one passed is the one that takes effect. For example, | |
230 | ((lambda* (#&key (heads 0) (tails 0)) (display (list heads tails))) | |
231 | #:heads 37 #:tails 42 #:heads 99) | |
232 | would result in (99 47) being displayed. | |
233 | ||
234 | #&rest is also now provided as a synonym for the dotted syntax rest | |
235 | argument. The argument lists (a . b) and (a #&rest b) are equivalent in | |
236 | all respects to lambda*. This is provided for more similarity to DSSSL, | |
237 | MIT-Scheme and Kawa among others, as well as for refugees from other | |
238 | Lisp dialects. | |
239 | ||
240 | Further documentation may be found in the optargs.scm file itself. | |
241 | ||
242 | The optional argument module also exports the macros `let-optional', | |
243 | `let-optional*', `let-keywords', `let-keywords*' and `bound?'. These | |
244 | are not documented here because they may be removed in the future, but | |
245 | full documentation is still available in optargs.scm. | |
246 | ||
2e132553 JB |
247 | ** New syntax: and-let* |
248 | Guile now supports the `and-let*' form, described in the draft SRFI-2. | |
249 | ||
250 | Syntax: (land* (<clause> ...) <body> ...) | |
251 | Each <clause> should have one of the following forms: | |
252 | (<variable> <expression>) | |
253 | (<expression>) | |
254 | <bound-variable> | |
255 | Each <variable> or <bound-variable> should be an identifier. Each | |
256 | <expression> should be a valid expression. The <body> should be a | |
257 | possibly empty sequence of expressions, like the <body> of a | |
258 | lambda form. | |
259 | ||
260 | Semantics: A LAND* expression is evaluated by evaluating the | |
261 | <expression> or <bound-variable> of each of the <clause>s from | |
262 | left to right. The value of the first <expression> or | |
263 | <bound-variable> that evaluates to a false value is returned; the | |
264 | remaining <expression>s and <bound-variable>s are not evaluated. | |
265 | The <body> forms are evaluated iff all the <expression>s and | |
266 | <bound-variable>s evaluate to true values. | |
267 | ||
268 | The <expression>s and the <body> are evaluated in an environment | |
269 | binding each <variable> of the preceding (<variable> <expression>) | |
270 | clauses to the value of the <expression>. Later bindings | |
271 | shadow earlier bindings. | |
272 | ||
273 | Guile's and-let* macro was contributed by Michael Livshin. | |
274 | ||
ed8c8636 MD |
275 | ** New function: sorted? SEQUENCE LESS? |
276 | Returns `#t' when the sequence argument is in non-decreasing order | |
277 | according to LESS? (that is, there is no adjacent pair `... x y | |
278 | ...' for which `(less? y x)'). | |
279 | ||
280 | Returns `#f' when the sequence contains at least one out-of-order | |
281 | pair. It is an error if the sequence is neither a list nor a | |
282 | vector. | |
283 | ||
284 | ** New function: merge LIST1 LIST2 LESS? | |
285 | LIST1 and LIST2 are sorted lists. | |
286 | Returns the sorted list of all elements in LIST1 and LIST2. | |
287 | ||
288 | Assume that the elements a and b1 in LIST1 and b2 in LIST2 are "equal" | |
289 | in the sense that (LESS? x y) --> #f for x, y in {a, b1, b2}, | |
290 | and that a < b1 in LIST1. Then a < b1 < b2 in the result. | |
291 | (Here "<" should read "comes before".) | |
292 | ||
293 | ** New procedure: merge! LIST1 LIST2 LESS? | |
294 | Merges two lists, re-using the pairs of LIST1 and LIST2 to build | |
295 | the result. If the code is compiled, and LESS? constructs no new | |
296 | pairs, no pairs at all will be allocated. The first pair of the | |
297 | result will be either the first pair of LIST1 or the first pair of | |
298 | LIST2. | |
299 | ||
300 | ** New function: sort SEQUENCE LESS? | |
301 | Accepts either a list or a vector, and returns a new sequence | |
302 | which is sorted. The new sequence is the same type as the input. | |
303 | Always `(sorted? (sort sequence less?) less?)'. The original | |
304 | sequence is not altered in any way. The new sequence shares its | |
305 | elements with the old one; no elements are copied. | |
306 | ||
307 | ** New procedure: sort! SEQUENCE LESS | |
308 | Returns its sorted result in the original boxes. No new storage is | |
309 | allocated at all. Proper usage: (set! slist (sort! slist <)) | |
310 | ||
311 | ** New function: stable-sort SEQUENCE LESS? | |
312 | Similar to `sort' but stable. That is, if "equal" elements are | |
313 | ordered a < b in the original sequence, they will have the same order | |
314 | in the result. | |
315 | ||
316 | ** New function: stable-sort! SEQUENCE LESS? | |
317 | Similar to `sort!' but stable. | |
318 | Uses temporary storage when sorting vectors. | |
319 | ||
320 | ** New functions: sort-list, sort-list! | |
321 | Added for compatibility with scsh. | |
322 | ||
3e8370c3 MD |
323 | ** New function: random N [STATE] |
324 | Accepts a positive integer or real N and returns a number of the | |
325 | same type between zero (inclusive) and N (exclusive). The values | |
326 | returned have a uniform distribution. | |
327 | ||
328 | The optional argument STATE must be of the type produced by | |
416075f1 MD |
329 | `copy-random-state' or `seed->random-state'. It defaults to the value |
330 | of the variable `*random-state*'. This object is used to maintain the | |
331 | state of the pseudo-random-number generator and is altered as a side | |
332 | effect of the `random' operation. | |
3e8370c3 MD |
333 | |
334 | ** New variable: *random-state* | |
335 | Holds a data structure that encodes the internal state of the | |
336 | random-number generator that `random' uses by default. The nature | |
337 | of this data structure is implementation-dependent. It may be | |
338 | printed out and successfully read back in, but may or may not | |
339 | function correctly as a random-number state object in another | |
340 | implementation. | |
341 | ||
416075f1 | 342 | ** New function: copy-random-state [STATE] |
3e8370c3 MD |
343 | Returns a new object of type suitable for use as the value of the |
344 | variable `*random-state*' and as a second argument to `random'. | |
345 | If argument STATE is given, a copy of it is returned. Otherwise a | |
346 | copy of `*random-state*' is returned. | |
416075f1 MD |
347 | |
348 | ** New function: seed->random-state SEED | |
349 | Returns a new object of type suitable for use as the value of the | |
350 | variable `*random-state*' and as a second argument to `random'. | |
351 | SEED is a string or a number. A new state is generated and | |
352 | initialized using SEED. | |
3e8370c3 MD |
353 | |
354 | ** New function: random:uniform [STATE] | |
355 | Returns an uniformly distributed inexact real random number in the | |
356 | range between 0 and 1. | |
357 | ||
358 | ** New procedure: random:solid-sphere! VECT [STATE] | |
359 | Fills VECT with inexact real random numbers the sum of whose | |
360 | squares is less than 1.0. Thinking of VECT as coordinates in | |
361 | space of dimension N = `(vector-length VECT)', the coordinates are | |
362 | uniformly distributed within the unit N-shere. The sum of the | |
363 | squares of the numbers is returned. VECT can be either a vector | |
364 | or a uniform vector of doubles. | |
365 | ||
366 | ** New procedure: random:hollow-sphere! VECT [STATE] | |
367 | Fills VECT with inexact real random numbers the sum of whose squares | |
368 | is equal to 1.0. Thinking of VECT as coordinates in space of | |
369 | dimension n = `(vector-length VECT)', the coordinates are uniformly | |
370 | distributed over the surface of the unit n-shere. VECT can be either | |
371 | a vector or a uniform vector of doubles. | |
372 | ||
373 | ** New function: random:normal [STATE] | |
374 | Returns an inexact real in a normal distribution with mean 0 and | |
375 | standard deviation 1. For a normal distribution with mean M and | |
376 | standard deviation D use `(+ M (* D (random:normal)))'. | |
377 | ||
378 | ** New procedure: random:normal-vector! VECT [STATE] | |
379 | Fills VECT with inexact real random numbers which are independent and | |
380 | standard normally distributed (i.e., with mean 0 and variance 1). | |
381 | VECT can be either a vector or a uniform vector of doubles. | |
382 | ||
383 | ** New function: random:exp STATE | |
384 | Returns an inexact real in an exponential distribution with mean 1. | |
385 | For an exponential distribution with mean U use (* U (random:exp)). | |
386 | ||
69c6acbb JB |
387 | ** The range of logand, logior, logxor, logtest, and logbit? have changed. |
388 | ||
389 | These functions now operate on numbers in the range of a C unsigned | |
390 | long. | |
391 | ||
392 | These functions used to operate on numbers in the range of a C signed | |
393 | long; however, this seems inappropriate, because Guile integers don't | |
394 | overflow. | |
395 | ||
ba4ee0d6 MD |
396 | ** New function: make-guardian |
397 | This is an implementation of guardians as described in | |
398 | R. Kent Dybvig, Carl Bruggeman, and David Eby (1993) "Guardians in a | |
399 | Generation-Based Garbage Collector" ACM SIGPLAN Conference on | |
400 | Programming Language Design and Implementation, June 1993 | |
401 | ftp://ftp.cs.indiana.edu/pub/scheme-repository/doc/pubs/guardians.ps.gz | |
402 | ||
88ceea5c MD |
403 | ** New functions: delq1!, delv1!, delete1! |
404 | These procedures behave similar to delq! and friends but delete only | |
405 | one object if at all. | |
406 | ||
55254a6a MD |
407 | ** New function: unread-string STRING PORT |
408 | Unread STRING to PORT, that is, push it back onto the port so that | |
409 | next read operation will work on the pushed back characters. | |
410 | ||
411 | ** unread-char can now be called multiple times | |
412 | If unread-char is called multiple times, the unread characters will be | |
413 | read again in last-in first-out order. | |
414 | ||
67ad463a | 415 | ** New function: map-in-order PROC LIST1 LIST2 ... |
d41b3904 MD |
416 | Version of `map' which guarantees that the procedure is applied to the |
417 | lists in serial order. | |
418 | ||
67ad463a MD |
419 | ** Renamed `serial-array-copy!' and `serial-array-map!' to |
420 | `array-copy-in-order!' and `array-map-in-order!'. The old names are | |
421 | now obsolete and will go away in release 1.5. | |
422 | ||
cf7132b3 | 423 | ** New syntax: collect BODY1 ... |
d41b3904 MD |
424 | Version of `begin' which returns a list of the results of the body |
425 | forms instead of the result of the last body form. In contrast to | |
cf7132b3 | 426 | `begin', `collect' allows an empty body. |
d41b3904 | 427 | |
e4eae9b1 MD |
428 | ** New functions: read-history FILENAME, write-history FILENAME |
429 | Read/write command line history from/to file. Returns #t on success | |
430 | and #f if an error occured. | |
431 | ||
3ffc7a36 MD |
432 | * Changes to the gh_ interface |
433 | ||
434 | ** gh_scm2doubles | |
435 | ||
436 | Now takes a second argument which is the result array. If this | |
437 | pointer is NULL, a new array is malloced (the old behaviour). | |
438 | ||
439 | ** gh_chars2byvect, gh_shorts2svect, gh_floats2fvect, gh_scm2chars, | |
440 | gh_scm2shorts, gh_scm2longs, gh_scm2floats | |
441 | ||
442 | New functions. | |
443 | ||
3e8370c3 MD |
444 | * Changes to the scm_ interface |
445 | ||
446 | ** Plug in interface for random number generators | |
447 | The variable `scm_the_rng' in random.c contains a value and three | |
448 | function pointers which together define the current random number | |
449 | generator being used by the Scheme level interface and the random | |
450 | number library functions. | |
451 | ||
452 | The user is free to replace the default generator with the generator | |
453 | of his own choice. | |
454 | ||
455 | *** Variable: size_t scm_the_rng.rstate_size | |
456 | The size of the random state type used by the current RNG | |
457 | measured in chars. | |
458 | ||
459 | *** Function: unsigned long scm_the_rng.random_bits (scm_rstate *STATE) | |
460 | Given the random STATE, return 32 random bits. | |
461 | ||
462 | *** Function: void scm_the_rng.init_rstate (scm_rstate *STATE, chars *S, int N) | |
463 | Seed random state STATE using string S of length N. | |
464 | ||
465 | *** Function: scm_rstate *scm_the_rng.copy_rstate (scm_rstate *STATE) | |
466 | Given random state STATE, return a malloced copy. | |
467 | ||
468 | ** Default RNG | |
469 | The default RNG is the MWC (Multiply With Carry) random number | |
470 | generator described by George Marsaglia at the Department of | |
471 | Statistics and Supercomputer Computations Research Institute, The | |
472 | Florida State University (http://stat.fsu.edu/~geo). | |
473 | ||
474 | It uses 64 bits, has a period of 4578426017172946943 (4.6e18), and | |
475 | passes all tests in the DIEHARD test suite | |
476 | (http://stat.fsu.edu/~geo/diehard.html). The generation of 32 bits | |
477 | costs one multiply and one add on platforms which either supports long | |
478 | longs (gcc does this on most systems) or have 64 bit longs. The cost | |
479 | is four multiply on other systems but this can be optimized by writing | |
480 | scm_i_uniform32 in assembler. | |
481 | ||
482 | These functions are provided through the scm_the_rng interface for use | |
483 | by libguile and the application. | |
484 | ||
485 | *** Function: unsigned long scm_i_uniform32 (scm_i_rstate *STATE) | |
486 | Given the random STATE, return 32 random bits. | |
487 | Don't use this function directly. Instead go through the plugin | |
488 | interface (see "Plug in interface" above). | |
489 | ||
490 | *** Function: void scm_i_init_rstate (scm_i_rstate *STATE, char *SEED, int N) | |
491 | Initialize STATE using SEED of length N. | |
492 | ||
493 | *** Function: scm_i_rstate *scm_i_copy_rstate (scm_i_rstate *STATE) | |
494 | Return a malloc:ed copy of STATE. This function can easily be re-used | |
495 | in the interfaces to other RNGs. | |
496 | ||
497 | ** Random number library functions | |
498 | These functions use the current RNG through the scm_the_rng interface. | |
499 | It might be a good idea to use these functions from your C code so | |
500 | that only one random generator is used by all code in your program. | |
501 | ||
502 | You can get the default random state using: | |
503 | ||
504 | *** Variable: SCM scm_var_random_state | |
505 | Contains the vcell of the Scheme variable "*random-state*" which is | |
506 | used as default state by all random number functions in the Scheme | |
507 | level interface. | |
508 | ||
509 | Example: | |
510 | ||
511 | double x = scm_i_uniform01 (SCM_RSTATE (SCM_CDR (scm_var_random_state))); | |
512 | ||
513 | *** Function: double scm_i_uniform01 (scm_rstate *STATE) | |
514 | Return a sample from the uniform(0,1) distribution. | |
515 | ||
516 | *** Function: double scm_i_normal01 (scm_rstate *STATE) | |
517 | Return a sample from the normal(0,1) distribution. | |
518 | ||
519 | *** Function: double scm_i_exp1 (scm_rstate *STATE) | |
520 | Return a sample from the exp(1) distribution. | |
521 | ||
522 | *** Function: unsigned long scm_i_random (unsigned long M, scm_rstate *STATE) | |
523 | Return a sample from the discrete uniform(0,M) distribution. | |
524 | ||
f3227c7a | 525 | \f |
d23bbf3e | 526 | Changes in Guile 1.3 (released Monday, October 19, 1998): |
c484bf7f JB |
527 | |
528 | * Changes to the distribution | |
529 | ||
e2d6569c JB |
530 | ** We renamed the SCHEME_LOAD_PATH environment variable to GUILE_LOAD_PATH. |
531 | To avoid conflicts, programs should name environment variables after | |
532 | themselves, except when there's a common practice establishing some | |
533 | other convention. | |
534 | ||
535 | For now, Guile supports both GUILE_LOAD_PATH and SCHEME_LOAD_PATH, | |
536 | giving the former precedence, and printing a warning message if the | |
537 | latter is set. Guile 1.4 will not recognize SCHEME_LOAD_PATH at all. | |
538 | ||
539 | ** The header files related to multi-byte characters have been removed. | |
540 | They were: libguile/extchrs.h and libguile/mbstrings.h. Any C code | |
541 | which referred to these explicitly will probably need to be rewritten, | |
542 | since the support for the variant string types has been removed; see | |
543 | below. | |
544 | ||
545 | ** The header files append.h and sequences.h have been removed. These | |
546 | files implemented non-R4RS operations which would encourage | |
547 | non-portable programming style and less easy-to-read code. | |
3a97e020 | 548 | |
c484bf7f JB |
549 | * Changes to the stand-alone interpreter |
550 | ||
2e368582 | 551 | ** New procedures have been added to implement a "batch mode": |
ec4ab4fd | 552 | |
2e368582 | 553 | *** Function: batch-mode? |
ec4ab4fd GH |
554 | |
555 | Returns a boolean indicating whether the interpreter is in batch | |
556 | mode. | |
557 | ||
2e368582 | 558 | *** Function: set-batch-mode?! ARG |
ec4ab4fd GH |
559 | |
560 | If ARG is true, switches the interpreter to batch mode. The `#f' | |
561 | case has not been implemented. | |
562 | ||
2e368582 JB |
563 | ** Guile now provides full command-line editing, when run interactively. |
564 | To use this feature, you must have the readline library installed. | |
565 | The Guile build process will notice it, and automatically include | |
566 | support for it. | |
567 | ||
568 | The readline library is available via anonymous FTP from any GNU | |
569 | mirror site; the canonical location is "ftp://prep.ai.mit.edu/pub/gnu". | |
570 | ||
a5d6d578 MD |
571 | ** the-last-stack is now a fluid. |
572 | ||
c484bf7f JB |
573 | * Changes to the procedure for linking libguile with your programs |
574 | ||
71f20534 | 575 | ** You can now use the `guile-config' utility to build programs that use Guile. |
2e368582 | 576 | |
2adfe1c0 | 577 | Guile now includes a command-line utility called `guile-config', which |
71f20534 JB |
578 | can provide information about how to compile and link programs that |
579 | use Guile. | |
580 | ||
581 | *** `guile-config compile' prints any C compiler flags needed to use Guile. | |
582 | You should include this command's output on the command line you use | |
583 | to compile C or C++ code that #includes the Guile header files. It's | |
584 | usually just a `-I' flag to help the compiler find the Guile headers. | |
585 | ||
586 | ||
587 | *** `guile-config link' prints any linker flags necessary to link with Guile. | |
8aa5c148 | 588 | |
71f20534 | 589 | This command writes to its standard output a list of flags which you |
8aa5c148 JB |
590 | must pass to the linker to link your code against the Guile library. |
591 | The flags include '-lguile' itself, any other libraries the Guile | |
592 | library depends upon, and any `-L' flags needed to help the linker | |
593 | find those libraries. | |
2e368582 JB |
594 | |
595 | For example, here is a Makefile rule that builds a program named 'foo' | |
596 | from the object files ${FOO_OBJECTS}, and links them against Guile: | |
597 | ||
598 | foo: ${FOO_OBJECTS} | |
2adfe1c0 | 599 | ${CC} ${CFLAGS} ${FOO_OBJECTS} `guile-config link` -o foo |
2e368582 | 600 | |
e2d6569c JB |
601 | Previous Guile releases recommended that you use autoconf to detect |
602 | which of a predefined set of libraries were present on your system. | |
2adfe1c0 | 603 | It is more robust to use `guile-config', since it records exactly which |
e2d6569c JB |
604 | libraries the installed Guile library requires. |
605 | ||
2adfe1c0 JB |
606 | This was originally called `build-guile', but was renamed to |
607 | `guile-config' before Guile 1.3 was released, to be consistent with | |
608 | the analogous script for the GTK+ GUI toolkit, which is called | |
609 | `gtk-config'. | |
610 | ||
2e368582 | 611 | |
8aa5c148 JB |
612 | ** Use the GUILE_FLAGS macro in your configure.in file to find Guile. |
613 | ||
614 | If you are using the GNU autoconf package to configure your program, | |
615 | you can use the GUILE_FLAGS autoconf macro to call `guile-config' | |
616 | (described above) and gather the necessary values for use in your | |
617 | Makefiles. | |
618 | ||
619 | The GUILE_FLAGS macro expands to configure script code which runs the | |
620 | `guile-config' script, to find out where Guile's header files and | |
621 | libraries are installed. It sets two variables, marked for | |
622 | substitution, as by AC_SUBST. | |
623 | ||
624 | GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build | |
625 | code that uses Guile header files. This is almost always just a | |
626 | -I flag. | |
627 | ||
628 | GUILE_LDFLAGS --- flags to pass to the linker to link a | |
629 | program against Guile. This includes `-lguile' for the Guile | |
630 | library itself, any libraries that Guile itself requires (like | |
631 | -lqthreads), and so on. It may also include a -L flag to tell the | |
632 | compiler where to find the libraries. | |
633 | ||
634 | GUILE_FLAGS is defined in the file guile.m4, in the top-level | |
635 | directory of the Guile distribution. You can copy it into your | |
636 | package's aclocal.m4 file, and then use it in your configure.in file. | |
637 | ||
638 | If you are using the `aclocal' program, distributed with GNU automake, | |
639 | to maintain your aclocal.m4 file, the Guile installation process | |
640 | installs guile.m4 where aclocal will find it. All you need to do is | |
641 | use GUILE_FLAGS in your configure.in file, and then run `aclocal'; | |
642 | this will copy the definition of GUILE_FLAGS into your aclocal.m4 | |
643 | file. | |
644 | ||
645 | ||
c484bf7f | 646 | * Changes to Scheme functions and syntax |
7ad3c1e7 | 647 | |
02755d59 | 648 | ** Multi-byte strings have been removed, as have multi-byte and wide |
e2d6569c JB |
649 | ports. We felt that these were the wrong approach to |
650 | internationalization support. | |
02755d59 | 651 | |
2e368582 JB |
652 | ** New function: readline [PROMPT] |
653 | Read a line from the terminal, and allow the user to edit it, | |
654 | prompting with PROMPT. READLINE provides a large set of Emacs-like | |
655 | editing commands, lets the user recall previously typed lines, and | |
656 | works on almost every kind of terminal, including dumb terminals. | |
657 | ||
658 | READLINE assumes that the cursor is at the beginning of the line when | |
659 | it is invoked. Thus, you can't print a prompt yourself, and then call | |
660 | READLINE; you need to package up your prompt as a string, pass it to | |
661 | the function, and let READLINE print the prompt itself. This is | |
662 | because READLINE needs to know the prompt's screen width. | |
663 | ||
8cd57bd0 JB |
664 | For Guile to provide this function, you must have the readline |
665 | library, version 2.1 or later, installed on your system. Readline is | |
666 | available via anonymous FTP from prep.ai.mit.edu in pub/gnu, or from | |
667 | any GNU mirror site. | |
2e368582 JB |
668 | |
669 | See also ADD-HISTORY function. | |
670 | ||
671 | ** New function: add-history STRING | |
672 | Add STRING as the most recent line in the history used by the READLINE | |
673 | command. READLINE does not add lines to the history itself; you must | |
674 | call ADD-HISTORY to make previous input available to the user. | |
675 | ||
8cd57bd0 JB |
676 | ** The behavior of the read-line function has changed. |
677 | ||
678 | This function now uses standard C library functions to read the line, | |
679 | for speed. This means that it doesn not respect the value of | |
680 | scm-line-incrementors; it assumes that lines are delimited with | |
681 | #\newline. | |
682 | ||
683 | (Note that this is read-line, the function that reads a line of text | |
684 | from a port, not readline, the function that reads a line from a | |
685 | terminal, providing full editing capabilities.) | |
686 | ||
1a0106ef JB |
687 | ** New module (ice-9 getopt-gnu-style): Parse command-line arguments. |
688 | ||
689 | This module provides some simple argument parsing. It exports one | |
690 | function: | |
691 | ||
692 | Function: getopt-gnu-style ARG-LS | |
693 | Parse a list of program arguments into an alist of option | |
694 | descriptions. | |
695 | ||
696 | Each item in the list of program arguments is examined to see if | |
697 | it meets the syntax of a GNU long-named option. An argument like | |
698 | `--MUMBLE' produces an element of the form (MUMBLE . #t) in the | |
699 | returned alist, where MUMBLE is a keyword object with the same | |
700 | name as the argument. An argument like `--MUMBLE=FROB' produces | |
701 | an element of the form (MUMBLE . FROB), where FROB is a string. | |
702 | ||
703 | As a special case, the returned alist also contains a pair whose | |
704 | car is the symbol `rest'. The cdr of this pair is a list | |
705 | containing all the items in the argument list that are not options | |
706 | of the form mentioned above. | |
707 | ||
708 | The argument `--' is treated specially: all items in the argument | |
709 | list appearing after such an argument are not examined, and are | |
710 | returned in the special `rest' list. | |
711 | ||
712 | This function does not parse normal single-character switches. | |
713 | You will need to parse them out of the `rest' list yourself. | |
714 | ||
8cd57bd0 JB |
715 | ** The read syntax for byte vectors and short vectors has changed. |
716 | ||
717 | Instead of #bytes(...), write #y(...). | |
718 | ||
719 | Instead of #short(...), write #h(...). | |
720 | ||
721 | This may seem nutty, but, like the other uniform vectors, byte vectors | |
722 | and short vectors want to have the same print and read syntax (and, | |
723 | more basic, want to have read syntax!). Changing the read syntax to | |
724 | use multiple characters after the hash sign breaks with the | |
725 | conventions used in R5RS and the conventions used for the other | |
726 | uniform vectors. It also introduces complexity in the current reader, | |
727 | both on the C and Scheme levels. (The Right solution is probably to | |
728 | change the syntax and prototypes for uniform vectors entirely.) | |
729 | ||
730 | ||
731 | ** The new module (ice-9 session) provides useful interactive functions. | |
732 | ||
733 | *** New procedure: (apropos REGEXP OPTION ...) | |
734 | ||
735 | Display a list of top-level variables whose names match REGEXP, and | |
736 | the modules they are imported from. Each OPTION should be one of the | |
737 | following symbols: | |
738 | ||
739 | value --- Show the value of each matching variable. | |
740 | shadow --- Show bindings shadowed by subsequently imported modules. | |
741 | full --- Same as both `shadow' and `value'. | |
742 | ||
743 | For example: | |
744 | ||
745 | guile> (apropos "trace" 'full) | |
746 | debug: trace #<procedure trace args> | |
747 | debug: untrace #<procedure untrace args> | |
748 | the-scm-module: display-backtrace #<compiled-closure #<primitive-procedure gsubr-apply>> | |
749 | the-scm-module: before-backtrace-hook () | |
750 | the-scm-module: backtrace #<primitive-procedure backtrace> | |
751 | the-scm-module: after-backtrace-hook () | |
752 | the-scm-module: has-shown-backtrace-hint? #f | |
753 | guile> | |
754 | ||
755 | ** There are new functions and syntax for working with macros. | |
756 | ||
757 | Guile implements macros as a special object type. Any variable whose | |
758 | top-level binding is a macro object acts as a macro. The macro object | |
759 | specifies how the expression should be transformed before evaluation. | |
760 | ||
761 | *** Macro objects now print in a reasonable way, resembling procedures. | |
762 | ||
763 | *** New function: (macro? OBJ) | |
764 | True iff OBJ is a macro object. | |
765 | ||
766 | *** New function: (primitive-macro? OBJ) | |
767 | Like (macro? OBJ), but true only if OBJ is one of the Guile primitive | |
768 | macro transformers, implemented in eval.c rather than Scheme code. | |
769 | ||
dbdd0c16 JB |
770 | Why do we have this function? |
771 | - For symmetry with procedure? and primitive-procedure?, | |
772 | - to allow custom print procedures to tell whether a macro is | |
773 | primitive, and display it differently, and | |
774 | - to allow compilers and user-written evaluators to distinguish | |
775 | builtin special forms from user-defined ones, which could be | |
776 | compiled. | |
777 | ||
8cd57bd0 JB |
778 | *** New function: (macro-type OBJ) |
779 | Return a value indicating what kind of macro OBJ is. Possible return | |
780 | values are: | |
781 | ||
782 | The symbol `syntax' --- a macro created by procedure->syntax. | |
783 | The symbol `macro' --- a macro created by procedure->macro. | |
784 | The symbol `macro!' --- a macro created by procedure->memoizing-macro. | |
785 | The boolean #f --- if OBJ is not a macro object. | |
786 | ||
787 | *** New function: (macro-name MACRO) | |
788 | Return the name of the macro object MACRO's procedure, as returned by | |
789 | procedure-name. | |
790 | ||
791 | *** New function: (macro-transformer MACRO) | |
792 | Return the transformer procedure for MACRO. | |
793 | ||
794 | *** New syntax: (use-syntax MODULE ... TRANSFORMER) | |
795 | ||
796 | Specify a new macro expander to use in the current module. Each | |
797 | MODULE is a module name, with the same meaning as in the `use-modules' | |
798 | form; each named module's exported bindings are added to the current | |
799 | top-level environment. TRANSFORMER is an expression evaluated in the | |
800 | resulting environment which must yield a procedure to use as the | |
801 | module's eval transformer: every expression evaluated in this module | |
802 | is passed to this function, and the result passed to the Guile | |
803 | interpreter. | |
804 | ||
805 | *** macro-eval! is removed. Use local-eval instead. | |
29521173 | 806 | |
8d9dcb3c MV |
807 | ** Some magic has been added to the printer to better handle user |
808 | written printing routines (like record printers, closure printers). | |
809 | ||
810 | The problem is that these user written routines must have access to | |
7fbd77df | 811 | the current `print-state' to be able to handle fancy things like |
8d9dcb3c MV |
812 | detection of circular references. These print-states have to be |
813 | passed to the builtin printing routines (display, write, etc) to | |
814 | properly continue the print chain. | |
815 | ||
816 | We didn't want to change all existing print code so that it | |
8cd57bd0 | 817 | explicitly passes thru a print state in addition to a port. Instead, |
8d9dcb3c MV |
818 | we extented the possible values that the builtin printing routines |
819 | accept as a `port'. In addition to a normal port, they now also take | |
820 | a pair of a normal port and a print-state. Printing will go to the | |
821 | port and the print-state will be used to control the detection of | |
822 | circular references, etc. If the builtin function does not care for a | |
823 | print-state, it is simply ignored. | |
824 | ||
825 | User written callbacks are now called with such a pair as their | |
826 | `port', but because every function now accepts this pair as a PORT | |
827 | argument, you don't have to worry about that. In fact, it is probably | |
828 | safest to not check for these pairs. | |
829 | ||
830 | However, it is sometimes necessary to continue a print chain on a | |
831 | different port, for example to get a intermediate string | |
832 | representation of the printed value, mangle that string somehow, and | |
833 | then to finally print the mangled string. Use the new function | |
834 | ||
835 | inherit-print-state OLD-PORT NEW-PORT | |
836 | ||
837 | for this. It constructs a new `port' that prints to NEW-PORT but | |
838 | inherits the print-state of OLD-PORT. | |
839 | ||
ef1ea498 MD |
840 | ** struct-vtable-offset renamed to vtable-offset-user |
841 | ||
842 | ** New constants: vtable-index-layout, vtable-index-vtable, vtable-index-printer | |
843 | ||
844 | ** There is now a fourth (optional) argument to make-vtable-vtable and | |
845 | make-struct when constructing new types (vtables). This argument | |
846 | initializes field vtable-index-printer of the vtable. | |
847 | ||
4851dc57 MV |
848 | ** The detection of circular references has been extended to structs. |
849 | That is, a structure that -- in the process of being printed -- prints | |
850 | itself does not lead to infinite recursion. | |
851 | ||
852 | ** There is now some basic support for fluids. Please read | |
853 | "libguile/fluid.h" to find out more. It is accessible from Scheme with | |
854 | the following functions and macros: | |
855 | ||
9c3fb66f MV |
856 | Function: make-fluid |
857 | ||
858 | Create a new fluid object. Fluids are not special variables or | |
859 | some other extension to the semantics of Scheme, but rather | |
860 | ordinary Scheme objects. You can store them into variables (that | |
861 | are still lexically scoped, of course) or into any other place you | |
862 | like. Every fluid has a initial value of `#f'. | |
04c76b58 | 863 | |
9c3fb66f | 864 | Function: fluid? OBJ |
04c76b58 | 865 | |
9c3fb66f | 866 | Test whether OBJ is a fluid. |
04c76b58 | 867 | |
9c3fb66f MV |
868 | Function: fluid-ref FLUID |
869 | Function: fluid-set! FLUID VAL | |
04c76b58 MV |
870 | |
871 | Access/modify the fluid FLUID. Modifications are only visible | |
872 | within the current dynamic root (that includes threads). | |
873 | ||
9c3fb66f MV |
874 | Function: with-fluids* FLUIDS VALUES THUNK |
875 | ||
876 | FLUIDS is a list of fluids and VALUES a corresponding list of | |
877 | values for these fluids. Before THUNK gets called the values are | |
878 | installed in the fluids and the old values of the fluids are | |
879 | saved in the VALUES list. When the flow of control leaves THUNK | |
880 | or reenters it, the values get swapped again. You might think of | |
881 | this as a `safe-fluid-excursion'. Note that the VALUES list is | |
882 | modified by `with-fluids*'. | |
883 | ||
884 | Macro: with-fluids ((FLUID VALUE) ...) FORM ... | |
885 | ||
886 | The same as `with-fluids*' but with a different syntax. It looks | |
887 | just like `let', but both FLUID and VALUE are evaluated. Remember, | |
888 | fluids are not special variables but ordinary objects. FLUID | |
889 | should evaluate to a fluid. | |
04c76b58 | 890 | |
e2d6569c | 891 | ** Changes to system call interfaces: |
64d01d13 | 892 | |
e2d6569c | 893 | *** close-port, close-input-port and close-output-port now return a |
64d01d13 GH |
894 | boolean instead of an `unspecified' object. #t means that the port |
895 | was successfully closed, while #f means it was already closed. It is | |
896 | also now possible for these procedures to raise an exception if an | |
897 | error occurs (some errors from write can be delayed until close.) | |
898 | ||
e2d6569c | 899 | *** the first argument to chmod, fcntl, ftell and fseek can now be a |
6afcd3b2 GH |
900 | file descriptor. |
901 | ||
e2d6569c | 902 | *** the third argument to fcntl is now optional. |
6afcd3b2 | 903 | |
e2d6569c | 904 | *** the first argument to chown can now be a file descriptor or a port. |
6afcd3b2 | 905 | |
e2d6569c | 906 | *** the argument to stat can now be a port. |
6afcd3b2 | 907 | |
e2d6569c | 908 | *** The following new procedures have been added (most use scsh |
64d01d13 GH |
909 | interfaces): |
910 | ||
e2d6569c | 911 | *** procedure: close PORT/FD |
ec4ab4fd GH |
912 | Similar to close-port (*note close-port: Closing Ports.), but also |
913 | works on file descriptors. A side effect of closing a file | |
914 | descriptor is that any ports using that file descriptor are moved | |
915 | to a different file descriptor and have their revealed counts set | |
916 | to zero. | |
917 | ||
e2d6569c | 918 | *** procedure: port->fdes PORT |
ec4ab4fd GH |
919 | Returns the integer file descriptor underlying PORT. As a side |
920 | effect the revealed count of PORT is incremented. | |
921 | ||
e2d6569c | 922 | *** procedure: fdes->ports FDES |
ec4ab4fd GH |
923 | Returns a list of existing ports which have FDES as an underlying |
924 | file descriptor, without changing their revealed counts. | |
925 | ||
e2d6569c | 926 | *** procedure: fdes->inport FDES |
ec4ab4fd GH |
927 | Returns an existing input port which has FDES as its underlying |
928 | file descriptor, if one exists, and increments its revealed count. | |
929 | Otherwise, returns a new input port with a revealed count of 1. | |
930 | ||
e2d6569c | 931 | *** procedure: fdes->outport FDES |
ec4ab4fd GH |
932 | Returns an existing output port which has FDES as its underlying |
933 | file descriptor, if one exists, and increments its revealed count. | |
934 | Otherwise, returns a new output port with a revealed count of 1. | |
935 | ||
936 | The next group of procedures perform a `dup2' system call, if NEWFD | |
937 | (an integer) is supplied, otherwise a `dup'. The file descriptor to be | |
938 | duplicated can be supplied as an integer or contained in a port. The | |
64d01d13 GH |
939 | type of value returned varies depending on which procedure is used. |
940 | ||
ec4ab4fd GH |
941 | All procedures also have the side effect when performing `dup2' that |
942 | any ports using NEWFD are moved to a different file descriptor and have | |
64d01d13 GH |
943 | their revealed counts set to zero. |
944 | ||
e2d6569c | 945 | *** procedure: dup->fdes PORT/FD [NEWFD] |
ec4ab4fd | 946 | Returns an integer file descriptor. |
64d01d13 | 947 | |
e2d6569c | 948 | *** procedure: dup->inport PORT/FD [NEWFD] |
ec4ab4fd | 949 | Returns a new input port using the new file descriptor. |
64d01d13 | 950 | |
e2d6569c | 951 | *** procedure: dup->outport PORT/FD [NEWFD] |
ec4ab4fd | 952 | Returns a new output port using the new file descriptor. |
64d01d13 | 953 | |
e2d6569c | 954 | *** procedure: dup PORT/FD [NEWFD] |
ec4ab4fd GH |
955 | Returns a new port if PORT/FD is a port, with the same mode as the |
956 | supplied port, otherwise returns an integer file descriptor. | |
64d01d13 | 957 | |
e2d6569c | 958 | *** procedure: dup->port PORT/FD MODE [NEWFD] |
ec4ab4fd GH |
959 | Returns a new port using the new file descriptor. MODE supplies a |
960 | mode string for the port (*note open-file: File Ports.). | |
64d01d13 | 961 | |
e2d6569c | 962 | *** procedure: setenv NAME VALUE |
ec4ab4fd GH |
963 | Modifies the environment of the current process, which is also the |
964 | default environment inherited by child processes. | |
64d01d13 | 965 | |
ec4ab4fd GH |
966 | If VALUE is `#f', then NAME is removed from the environment. |
967 | Otherwise, the string NAME=VALUE is added to the environment, | |
968 | replacing any existing string with name matching NAME. | |
64d01d13 | 969 | |
ec4ab4fd | 970 | The return value is unspecified. |
956055a9 | 971 | |
e2d6569c | 972 | *** procedure: truncate-file OBJ SIZE |
6afcd3b2 GH |
973 | Truncates the file referred to by OBJ to at most SIZE bytes. OBJ |
974 | can be a string containing a file name or an integer file | |
975 | descriptor or port open for output on the file. The underlying | |
976 | system calls are `truncate' and `ftruncate'. | |
977 | ||
978 | The return value is unspecified. | |
979 | ||
e2d6569c | 980 | *** procedure: setvbuf PORT MODE [SIZE] |
7a6f1ffa GH |
981 | Set the buffering mode for PORT. MODE can be: |
982 | `_IONBF' | |
983 | non-buffered | |
984 | ||
985 | `_IOLBF' | |
986 | line buffered | |
987 | ||
988 | `_IOFBF' | |
989 | block buffered, using a newly allocated buffer of SIZE bytes. | |
990 | However if SIZE is zero or unspecified, the port will be made | |
991 | non-buffered. | |
992 | ||
993 | This procedure should not be used after I/O has been performed with | |
994 | the port. | |
995 | ||
996 | Ports are usually block buffered by default, with a default buffer | |
997 | size. Procedures e.g., *Note open-file: File Ports, which accept a | |
998 | mode string allow `0' to be added to request an unbuffered port. | |
999 | ||
e2d6569c | 1000 | *** procedure: fsync PORT/FD |
6afcd3b2 GH |
1001 | Copies any unwritten data for the specified output file descriptor |
1002 | to disk. If PORT/FD is a port, its buffer is flushed before the | |
1003 | underlying file descriptor is fsync'd. The return value is | |
1004 | unspecified. | |
1005 | ||
e2d6569c | 1006 | *** procedure: open-fdes PATH FLAGS [MODES] |
6afcd3b2 GH |
1007 | Similar to `open' but returns a file descriptor instead of a port. |
1008 | ||
e2d6569c | 1009 | *** procedure: execle PATH ENV [ARG] ... |
6afcd3b2 GH |
1010 | Similar to `execl', but the environment of the new process is |
1011 | specified by ENV, which must be a list of strings as returned by | |
1012 | the `environ' procedure. | |
1013 | ||
1014 | This procedure is currently implemented using the `execve' system | |
1015 | call, but we call it `execle' because of its Scheme calling | |
1016 | interface. | |
1017 | ||
e2d6569c | 1018 | *** procedure: strerror ERRNO |
ec4ab4fd GH |
1019 | Returns the Unix error message corresponding to ERRNO, an integer. |
1020 | ||
e2d6569c | 1021 | *** procedure: primitive-exit [STATUS] |
6afcd3b2 GH |
1022 | Terminate the current process without unwinding the Scheme stack. |
1023 | This is would typically be useful after a fork. The exit status | |
1024 | is STATUS if supplied, otherwise zero. | |
1025 | ||
e2d6569c | 1026 | *** procedure: times |
6afcd3b2 GH |
1027 | Returns an object with information about real and processor time. |
1028 | The following procedures accept such an object as an argument and | |
1029 | return a selected component: | |
1030 | ||
1031 | `tms:clock' | |
1032 | The current real time, expressed as time units relative to an | |
1033 | arbitrary base. | |
1034 | ||
1035 | `tms:utime' | |
1036 | The CPU time units used by the calling process. | |
1037 | ||
1038 | `tms:stime' | |
1039 | The CPU time units used by the system on behalf of the | |
1040 | calling process. | |
1041 | ||
1042 | `tms:cutime' | |
1043 | The CPU time units used by terminated child processes of the | |
1044 | calling process, whose status has been collected (e.g., using | |
1045 | `waitpid'). | |
1046 | ||
1047 | `tms:cstime' | |
1048 | Similarly, the CPU times units used by the system on behalf of | |
1049 | terminated child processes. | |
7ad3c1e7 | 1050 | |
e2d6569c JB |
1051 | ** Removed: list-length |
1052 | ** Removed: list-append, list-append! | |
1053 | ** Removed: list-reverse, list-reverse! | |
1054 | ||
1055 | ** array-map renamed to array-map! | |
1056 | ||
1057 | ** serial-array-map renamed to serial-array-map! | |
1058 | ||
660f41fa MD |
1059 | ** catch doesn't take #f as first argument any longer |
1060 | ||
1061 | Previously, it was possible to pass #f instead of a key to `catch'. | |
1062 | That would cause `catch' to pass a jump buffer object to the procedure | |
1063 | passed as second argument. The procedure could then use this jump | |
1064 | buffer objekt as an argument to throw. | |
1065 | ||
1066 | This mechanism has been removed since its utility doesn't motivate the | |
1067 | extra complexity it introduces. | |
1068 | ||
332d00f6 JB |
1069 | ** The `#/' notation for lists now provokes a warning message from Guile. |
1070 | This syntax will be removed from Guile in the near future. | |
1071 | ||
1072 | To disable the warning message, set the GUILE_HUSH environment | |
1073 | variable to any non-empty value. | |
1074 | ||
8cd57bd0 JB |
1075 | ** The newline character now prints as `#\newline', following the |
1076 | normal Scheme notation, not `#\nl'. | |
1077 | ||
c484bf7f JB |
1078 | * Changes to the gh_ interface |
1079 | ||
8986901b JB |
1080 | ** The gh_enter function now takes care of loading the Guile startup files. |
1081 | gh_enter works by calling scm_boot_guile; see the remarks below. | |
1082 | ||
5424b4f7 MD |
1083 | ** Function: void gh_write (SCM x) |
1084 | ||
1085 | Write the printed representation of the scheme object x to the current | |
1086 | output port. Corresponds to the scheme level `write'. | |
1087 | ||
3a97e020 MD |
1088 | ** gh_list_length renamed to gh_length. |
1089 | ||
8d6787b6 MG |
1090 | ** vector handling routines |
1091 | ||
1092 | Several major changes. In particular, gh_vector() now resembles | |
1093 | (vector ...) (with a caveat -- see manual), and gh_make_vector() now | |
956328d2 MG |
1094 | exists and behaves like (make-vector ...). gh_vset() and gh_vref() |
1095 | have been renamed gh_vector_set_x() and gh_vector_ref(). Some missing | |
8d6787b6 MG |
1096 | vector-related gh_ functions have been implemented. |
1097 | ||
7fee59bd MG |
1098 | ** pair and list routines |
1099 | ||
1100 | Implemented several of the R4RS pair and list functions that were | |
1101 | missing. | |
1102 | ||
171422a9 MD |
1103 | ** gh_scm2doubles, gh_doubles2scm, gh_doubles2dvect |
1104 | ||
1105 | New function. Converts double arrays back and forth between Scheme | |
1106 | and C. | |
1107 | ||
c484bf7f JB |
1108 | * Changes to the scm_ interface |
1109 | ||
8986901b JB |
1110 | ** The function scm_boot_guile now takes care of loading the startup files. |
1111 | ||
1112 | Guile's primary initialization function, scm_boot_guile, now takes | |
1113 | care of loading `boot-9.scm', in the `ice-9' module, to initialize | |
1114 | Guile, define the module system, and put together some standard | |
1115 | bindings. It also loads `init.scm', which is intended to hold | |
1116 | site-specific initialization code. | |
1117 | ||
1118 | Since Guile cannot operate properly until boot-9.scm is loaded, there | |
1119 | is no reason to separate loading boot-9.scm from Guile's other | |
1120 | initialization processes. | |
1121 | ||
1122 | This job used to be done by scm_compile_shell_switches, which didn't | |
1123 | make much sense; in particular, it meant that people using Guile for | |
1124 | non-shell-like applications had to jump through hoops to get Guile | |
1125 | initialized properly. | |
1126 | ||
1127 | ** The function scm_compile_shell_switches no longer loads the startup files. | |
1128 | Now, Guile always loads the startup files, whenever it is initialized; | |
1129 | see the notes above for scm_boot_guile and scm_load_startup_files. | |
1130 | ||
1131 | ** Function: scm_load_startup_files | |
1132 | This new function takes care of loading Guile's initialization file | |
1133 | (`boot-9.scm'), and the site initialization file, `init.scm'. Since | |
1134 | this is always called by the Guile initialization process, it's | |
1135 | probably not too useful to call this yourself, but it's there anyway. | |
1136 | ||
87148d9e JB |
1137 | ** The semantics of smob marking have changed slightly. |
1138 | ||
1139 | The smob marking function (the `mark' member of the scm_smobfuns | |
1140 | structure) is no longer responsible for setting the mark bit on the | |
1141 | smob. The generic smob handling code in the garbage collector will | |
1142 | set this bit. The mark function need only ensure that any other | |
1143 | objects the smob refers to get marked. | |
1144 | ||
1145 | Note that this change means that the smob's GC8MARK bit is typically | |
1146 | already set upon entry to the mark function. Thus, marking functions | |
1147 | which look like this: | |
1148 | ||
1149 | { | |
1150 | if (SCM_GC8MARKP (ptr)) | |
1151 | return SCM_BOOL_F; | |
1152 | SCM_SETGC8MARK (ptr); | |
1153 | ... mark objects to which the smob refers ... | |
1154 | } | |
1155 | ||
1156 | are now incorrect, since they will return early, and fail to mark any | |
1157 | other objects the smob refers to. Some code in the Guile library used | |
1158 | to work this way. | |
1159 | ||
1cf84ea5 JB |
1160 | ** The semantics of the I/O port functions in scm_ptobfuns have changed. |
1161 | ||
1162 | If you have implemented your own I/O port type, by writing the | |
1163 | functions required by the scm_ptobfuns and then calling scm_newptob, | |
1164 | you will need to change your functions slightly. | |
1165 | ||
1166 | The functions in a scm_ptobfuns structure now expect the port itself | |
1167 | as their argument; they used to expect the `stream' member of the | |
1168 | port's scm_port_table structure. This allows functions in an | |
1169 | scm_ptobfuns structure to easily access the port's cell (and any flags | |
1170 | it its CAR), and the port's scm_port_table structure. | |
1171 | ||
1172 | Guile now passes the I/O port itself as the `port' argument in the | |
1173 | following scm_ptobfuns functions: | |
1174 | ||
1175 | int (*free) (SCM port); | |
1176 | int (*fputc) (int, SCM port); | |
1177 | int (*fputs) (char *, SCM port); | |
1178 | scm_sizet (*fwrite) SCM_P ((char *ptr, | |
1179 | scm_sizet size, | |
1180 | scm_sizet nitems, | |
1181 | SCM port)); | |
1182 | int (*fflush) (SCM port); | |
1183 | int (*fgetc) (SCM port); | |
1184 | int (*fclose) (SCM port); | |
1185 | ||
1186 | The interfaces to the `mark', `print', `equalp', and `fgets' methods | |
1187 | are unchanged. | |
1188 | ||
1189 | If you have existing code which defines its own port types, it is easy | |
1190 | to convert your code to the new interface; simply apply SCM_STREAM to | |
1191 | the port argument to yield the value you code used to expect. | |
1192 | ||
1193 | Note that since both the port and the stream have the same type in the | |
1194 | C code --- they are both SCM values --- the C compiler will not remind | |
1195 | you if you forget to update your scm_ptobfuns functions. | |
1196 | ||
1197 | ||
933a7411 MD |
1198 | ** Function: int scm_internal_select (int fds, |
1199 | SELECT_TYPE *rfds, | |
1200 | SELECT_TYPE *wfds, | |
1201 | SELECT_TYPE *efds, | |
1202 | struct timeval *timeout); | |
1203 | ||
1204 | This is a replacement for the `select' function provided by the OS. | |
1205 | It enables I/O blocking and sleeping to happen for one cooperative | |
1206 | thread without blocking other threads. It also avoids busy-loops in | |
1207 | these situations. It is intended that all I/O blocking and sleeping | |
1208 | will finally go through this function. Currently, this function is | |
1209 | only available on systems providing `gettimeofday' and `select'. | |
1210 | ||
5424b4f7 MD |
1211 | ** Function: SCM scm_internal_stack_catch (SCM tag, |
1212 | scm_catch_body_t body, | |
1213 | void *body_data, | |
1214 | scm_catch_handler_t handler, | |
1215 | void *handler_data) | |
1216 | ||
1217 | A new sibling to the other two C level `catch' functions | |
1218 | scm_internal_catch and scm_internal_lazy_catch. Use it if you want | |
1219 | the stack to be saved automatically into the variable `the-last-stack' | |
1220 | (scm_the_last_stack_var) on error. This is necessary if you want to | |
1221 | use advanced error reporting, such as calling scm_display_error and | |
1222 | scm_display_backtrace. (They both take a stack object as argument.) | |
1223 | ||
df366c26 MD |
1224 | ** Function: SCM scm_spawn_thread (scm_catch_body_t body, |
1225 | void *body_data, | |
1226 | scm_catch_handler_t handler, | |
1227 | void *handler_data) | |
1228 | ||
1229 | Spawns a new thread. It does a job similar to | |
1230 | scm_call_with_new_thread but takes arguments more suitable when | |
1231 | spawning threads from application C code. | |
1232 | ||
88482b31 MD |
1233 | ** The hook scm_error_callback has been removed. It was originally |
1234 | intended as a way for the user to install his own error handler. But | |
1235 | that method works badly since it intervenes between throw and catch, | |
1236 | thereby changing the semantics of expressions like (catch #t ...). | |
1237 | The correct way to do it is to use one of the C level catch functions | |
1238 | in throw.c: scm_internal_catch/lazy_catch/stack_catch. | |
1239 | ||
3a97e020 MD |
1240 | ** Removed functions: |
1241 | ||
1242 | scm_obj_length, scm_list_length, scm_list_append, scm_list_append_x, | |
1243 | scm_list_reverse, scm_list_reverse_x | |
1244 | ||
1245 | ** New macros: SCM_LISTn where n is one of the integers 0-9. | |
1246 | ||
1247 | These can be used for pretty list creation from C. The idea is taken | |
1248 | from Erick Gallesio's STk. | |
1249 | ||
298aa6e3 MD |
1250 | ** scm_array_map renamed to scm_array_map_x |
1251 | ||
527da704 MD |
1252 | ** mbstrings are now removed |
1253 | ||
1254 | This means that the type codes scm_tc7_mb_string and | |
1255 | scm_tc7_mb_substring has been removed. | |
1256 | ||
8cd57bd0 JB |
1257 | ** scm_gen_putc, scm_gen_puts, scm_gen_write, and scm_gen_getc have changed. |
1258 | ||
1259 | Since we no longer support multi-byte strings, these I/O functions | |
1260 | have been simplified, and renamed. Here are their old names, and | |
1261 | their new names and arguments: | |
1262 | ||
1263 | scm_gen_putc -> void scm_putc (int c, SCM port); | |
1264 | scm_gen_puts -> void scm_puts (char *s, SCM port); | |
1265 | scm_gen_write -> void scm_lfwrite (char *ptr, scm_sizet size, SCM port); | |
1266 | scm_gen_getc -> void scm_getc (SCM port); | |
1267 | ||
1268 | ||
527da704 MD |
1269 | ** The macros SCM_TYP7D and SCM_TYP7SD has been removed. |
1270 | ||
1271 | ** The macro SCM_TYP7S has taken the role of the old SCM_TYP7D | |
1272 | ||
1273 | SCM_TYP7S now masks away the bit which distinguishes substrings from | |
1274 | strings. | |
1275 | ||
660f41fa MD |
1276 | ** scm_catch_body_t: Backward incompatible change! |
1277 | ||
1278 | Body functions to scm_internal_catch and friends do not any longer | |
1279 | take a second argument. This is because it is no longer possible to | |
1280 | pass a #f arg to catch. | |
1281 | ||
a8e05009 JB |
1282 | ** Calls to scm_protect_object and scm_unprotect now nest properly. |
1283 | ||
1284 | The function scm_protect_object protects its argument from being freed | |
1285 | by the garbage collector. scm_unprotect_object removes that | |
1286 | protection. | |
1287 | ||
1288 | These functions now nest properly. That is, for every object O, there | |
1289 | is a counter which scm_protect_object(O) increments and | |
1290 | scm_unprotect_object(O) decrements, if the counter is greater than | |
1291 | zero. Every object's counter is zero when it is first created. If an | |
1292 | object's counter is greater than zero, the garbage collector will not | |
1293 | reclaim its storage. | |
1294 | ||
1295 | This allows you to use scm_protect_object in your code without | |
1296 | worrying that some other function you call will call | |
1297 | scm_unprotect_object, and allow it to be freed. Assuming that the | |
1298 | functions you call are well-behaved, and unprotect only those objects | |
1299 | they protect, you can follow the same rule and have confidence that | |
1300 | objects will be freed only at appropriate times. | |
1301 | ||
c484bf7f JB |
1302 | \f |
1303 | Changes in Guile 1.2 (released Tuesday, June 24 1997): | |
cf78e9e8 | 1304 | |
737c9113 JB |
1305 | * Changes to the distribution |
1306 | ||
832b09ed JB |
1307 | ** Nightly snapshots are now available from ftp.red-bean.com. |
1308 | The old server, ftp.cyclic.com, has been relinquished to its rightful | |
1309 | owner. | |
1310 | ||
1311 | Nightly snapshots of the Guile development sources are now available via | |
1312 | anonymous FTP from ftp.red-bean.com, as /pub/guile/guile-snap.tar.gz. | |
1313 | ||
1314 | Via the web, that's: ftp://ftp.red-bean.com/pub/guile/guile-snap.tar.gz | |
1315 | For getit, that's: ftp.red-bean.com:/pub/guile/guile-snap.tar.gz | |
1316 | ||
0fcab5ed JB |
1317 | ** To run Guile without installing it, the procedure has changed a bit. |
1318 | ||
1319 | If you used a separate build directory to compile Guile, you'll need | |
1320 | to include the build directory in SCHEME_LOAD_PATH, as well as the | |
1321 | source directory. See the `INSTALL' file for examples. | |
1322 | ||
737c9113 JB |
1323 | * Changes to the procedure for linking libguile with your programs |
1324 | ||
94982a4e JB |
1325 | ** The standard Guile load path for Scheme code now includes |
1326 | $(datadir)/guile (usually /usr/local/share/guile). This means that | |
1327 | you can install your own Scheme files there, and Guile will find them. | |
1328 | (Previous versions of Guile only checked a directory whose name | |
1329 | contained the Guile version number, so you had to re-install or move | |
1330 | your Scheme sources each time you installed a fresh version of Guile.) | |
1331 | ||
1332 | The load path also includes $(datadir)/guile/site; we recommend | |
1333 | putting individual Scheme files there. If you want to install a | |
1334 | package with multiple source files, create a directory for them under | |
1335 | $(datadir)/guile. | |
1336 | ||
1337 | ** Guile 1.2 will now use the Rx regular expression library, if it is | |
1338 | installed on your system. When you are linking libguile into your own | |
1339 | programs, this means you will have to link against -lguile, -lqt (if | |
1340 | you configured Guile with thread support), and -lrx. | |
27590f82 JB |
1341 | |
1342 | If you are using autoconf to generate configuration scripts for your | |
1343 | application, the following lines should suffice to add the appropriate | |
1344 | libraries to your link command: | |
1345 | ||
1346 | ### Find Rx, quickthreads and libguile. | |
1347 | AC_CHECK_LIB(rx, main) | |
1348 | AC_CHECK_LIB(qt, main) | |
1349 | AC_CHECK_LIB(guile, scm_shell) | |
1350 | ||
94982a4e JB |
1351 | The Guile 1.2 distribution does not contain sources for the Rx |
1352 | library, as Guile 1.0 did. If you want to use Rx, you'll need to | |
1353 | retrieve it from a GNU FTP site and install it separately. | |
1354 | ||
b83b8bee JB |
1355 | * Changes to Scheme functions and syntax |
1356 | ||
e035e7e6 MV |
1357 | ** The dynamic linking features of Guile are now enabled by default. |
1358 | You can disable them by giving the `--disable-dynamic-linking' option | |
1359 | to configure. | |
1360 | ||
e035e7e6 MV |
1361 | (dynamic-link FILENAME) |
1362 | ||
1363 | Find the object file denoted by FILENAME (a string) and link it | |
1364 | into the running Guile application. When everything works out, | |
1365 | return a Scheme object suitable for representing the linked object | |
1366 | file. Otherwise an error is thrown. How object files are | |
1367 | searched is system dependent. | |
1368 | ||
1369 | (dynamic-object? VAL) | |
1370 | ||
1371 | Determine whether VAL represents a dynamically linked object file. | |
1372 | ||
1373 | (dynamic-unlink DYNOBJ) | |
1374 | ||
1375 | Unlink the indicated object file from the application. DYNOBJ | |
1376 | should be one of the values returned by `dynamic-link'. | |
1377 | ||
1378 | (dynamic-func FUNCTION DYNOBJ) | |
1379 | ||
1380 | Search the C function indicated by FUNCTION (a string or symbol) | |
1381 | in DYNOBJ and return some Scheme object that can later be used | |
1382 | with `dynamic-call' to actually call this function. Right now, | |
1383 | these Scheme objects are formed by casting the address of the | |
1384 | function to `long' and converting this number to its Scheme | |
1385 | representation. | |
1386 | ||
1387 | (dynamic-call FUNCTION DYNOBJ) | |
1388 | ||
1389 | Call the C function indicated by FUNCTION and DYNOBJ. The | |
1390 | function is passed no arguments and its return value is ignored. | |
1391 | When FUNCTION is something returned by `dynamic-func', call that | |
1392 | function and ignore DYNOBJ. When FUNCTION is a string (or symbol, | |
1393 | etc.), look it up in DYNOBJ; this is equivalent to | |
1394 | ||
1395 | (dynamic-call (dynamic-func FUNCTION DYNOBJ) #f) | |
1396 | ||
1397 | Interrupts are deferred while the C function is executing (with | |
1398 | SCM_DEFER_INTS/SCM_ALLOW_INTS). | |
1399 | ||
1400 | (dynamic-args-call FUNCTION DYNOBJ ARGS) | |
1401 | ||
1402 | Call the C function indicated by FUNCTION and DYNOBJ, but pass it | |
1403 | some arguments and return its return value. The C function is | |
1404 | expected to take two arguments and return an `int', just like | |
1405 | `main': | |
1406 | ||
1407 | int c_func (int argc, char **argv); | |
1408 | ||
1409 | ARGS must be a list of strings and is converted into an array of | |
1410 | `char *'. The array is passed in ARGV and its size in ARGC. The | |
1411 | return value is converted to a Scheme number and returned from the | |
1412 | call to `dynamic-args-call'. | |
1413 | ||
0fcab5ed JB |
1414 | When dynamic linking is disabled or not supported on your system, |
1415 | the above functions throw errors, but they are still available. | |
1416 | ||
e035e7e6 MV |
1417 | Here is a small example that works on GNU/Linux: |
1418 | ||
1419 | (define libc-obj (dynamic-link "libc.so")) | |
1420 | (dynamic-args-call 'rand libc-obj '()) | |
1421 | ||
1422 | See the file `libguile/DYNAMIC-LINKING' for additional comments. | |
1423 | ||
27590f82 JB |
1424 | ** The #/ syntax for module names is depreciated, and will be removed |
1425 | in a future version of Guile. Instead of | |
1426 | ||
1427 | #/foo/bar/baz | |
1428 | ||
1429 | instead write | |
1430 | ||
1431 | (foo bar baz) | |
1432 | ||
1433 | The latter syntax is more consistent with existing Lisp practice. | |
1434 | ||
5dade857 MV |
1435 | ** Guile now does fancier printing of structures. Structures are the |
1436 | underlying implementation for records, which in turn are used to | |
1437 | implement modules, so all of these object now print differently and in | |
1438 | a more informative way. | |
1439 | ||
161029df JB |
1440 | The Scheme printer will examine the builtin variable *struct-printer* |
1441 | whenever it needs to print a structure object. When this variable is | |
1442 | not `#f' it is deemed to be a procedure and will be applied to the | |
1443 | structure object and the output port. When *struct-printer* is `#f' | |
1444 | or the procedure return `#f' the structure object will be printed in | |
1445 | the boring #<struct 80458270> form. | |
5dade857 MV |
1446 | |
1447 | This hook is used by some routines in ice-9/boot-9.scm to implement | |
1448 | type specific printing routines. Please read the comments there about | |
1449 | "printing structs". | |
1450 | ||
1451 | One of the more specific uses of structs are records. The printing | |
1452 | procedure that could be passed to MAKE-RECORD-TYPE is now actually | |
1453 | called. It should behave like a *struct-printer* procedure (described | |
1454 | above). | |
1455 | ||
b83b8bee JB |
1456 | ** Guile now supports a new R4RS-compliant syntax for keywords. A |
1457 | token of the form #:NAME, where NAME has the same syntax as a Scheme | |
1458 | symbol, is the external representation of the keyword named NAME. | |
1459 | Keyword objects print using this syntax as well, so values containing | |
1e5afba0 JB |
1460 | keyword objects can be read back into Guile. When used in an |
1461 | expression, keywords are self-quoting objects. | |
b83b8bee JB |
1462 | |
1463 | Guile suports this read syntax, and uses this print syntax, regardless | |
1464 | of the current setting of the `keyword' read option. The `keyword' | |
1465 | read option only controls whether Guile recognizes the `:NAME' syntax, | |
1466 | which is incompatible with R4RS. (R4RS says such token represent | |
1467 | symbols.) | |
737c9113 JB |
1468 | |
1469 | ** Guile has regular expression support again. Guile 1.0 included | |
1470 | functions for matching regular expressions, based on the Rx library. | |
1471 | In Guile 1.1, the Guile/Rx interface was removed to simplify the | |
1472 | distribution, and thus Guile had no regular expression support. Guile | |
94982a4e JB |
1473 | 1.2 again supports the most commonly used functions, and supports all |
1474 | of SCSH's regular expression functions. | |
2409cdfa | 1475 | |
94982a4e JB |
1476 | If your system does not include a POSIX regular expression library, |
1477 | and you have not linked Guile with a third-party regexp library such as | |
1478 | Rx, these functions will not be available. You can tell whether your | |
1479 | Guile installation includes regular expression support by checking | |
1480 | whether the `*features*' list includes the `regex' symbol. | |
737c9113 | 1481 | |
94982a4e | 1482 | *** regexp functions |
161029df | 1483 | |
94982a4e JB |
1484 | By default, Guile supports POSIX extended regular expressions. That |
1485 | means that the characters `(', `)', `+' and `?' are special, and must | |
1486 | be escaped if you wish to match the literal characters. | |
e1a191a8 | 1487 | |
94982a4e JB |
1488 | This regular expression interface was modeled after that implemented |
1489 | by SCSH, the Scheme Shell. It is intended to be upwardly compatible | |
1490 | with SCSH regular expressions. | |
1491 | ||
1492 | **** Function: string-match PATTERN STR [START] | |
1493 | Compile the string PATTERN into a regular expression and compare | |
1494 | it with STR. The optional numeric argument START specifies the | |
1495 | position of STR at which to begin matching. | |
1496 | ||
1497 | `string-match' returns a "match structure" which describes what, | |
1498 | if anything, was matched by the regular expression. *Note Match | |
1499 | Structures::. If STR does not match PATTERN at all, | |
1500 | `string-match' returns `#f'. | |
1501 | ||
1502 | Each time `string-match' is called, it must compile its PATTERN | |
1503 | argument into a regular expression structure. This operation is | |
1504 | expensive, which makes `string-match' inefficient if the same regular | |
1505 | expression is used several times (for example, in a loop). For better | |
1506 | performance, you can compile a regular expression in advance and then | |
1507 | match strings against the compiled regexp. | |
1508 | ||
1509 | **** Function: make-regexp STR [FLAGS] | |
1510 | Compile the regular expression described by STR, and return the | |
1511 | compiled regexp structure. If STR does not describe a legal | |
1512 | regular expression, `make-regexp' throws a | |
1513 | `regular-expression-syntax' error. | |
1514 | ||
1515 | FLAGS may be the bitwise-or of one or more of the following: | |
1516 | ||
1517 | **** Constant: regexp/extended | |
1518 | Use POSIX Extended Regular Expression syntax when interpreting | |
1519 | STR. If not set, POSIX Basic Regular Expression syntax is used. | |
1520 | If the FLAGS argument is omitted, we assume regexp/extended. | |
1521 | ||
1522 | **** Constant: regexp/icase | |
1523 | Do not differentiate case. Subsequent searches using the | |
1524 | returned regular expression will be case insensitive. | |
1525 | ||
1526 | **** Constant: regexp/newline | |
1527 | Match-any-character operators don't match a newline. | |
1528 | ||
1529 | A non-matching list ([^...]) not containing a newline matches a | |
1530 | newline. | |
1531 | ||
1532 | Match-beginning-of-line operator (^) matches the empty string | |
1533 | immediately after a newline, regardless of whether the FLAGS | |
1534 | passed to regexp-exec contain regexp/notbol. | |
1535 | ||
1536 | Match-end-of-line operator ($) matches the empty string | |
1537 | immediately before a newline, regardless of whether the FLAGS | |
1538 | passed to regexp-exec contain regexp/noteol. | |
1539 | ||
1540 | **** Function: regexp-exec REGEXP STR [START [FLAGS]] | |
1541 | Match the compiled regular expression REGEXP against `str'. If | |
1542 | the optional integer START argument is provided, begin matching | |
1543 | from that position in the string. Return a match structure | |
1544 | describing the results of the match, or `#f' if no match could be | |
1545 | found. | |
1546 | ||
1547 | FLAGS may be the bitwise-or of one or more of the following: | |
1548 | ||
1549 | **** Constant: regexp/notbol | |
1550 | The match-beginning-of-line operator always fails to match (but | |
1551 | see the compilation flag regexp/newline above) This flag may be | |
1552 | used when different portions of a string are passed to | |
1553 | regexp-exec and the beginning of the string should not be | |
1554 | interpreted as the beginning of the line. | |
1555 | ||
1556 | **** Constant: regexp/noteol | |
1557 | The match-end-of-line operator always fails to match (but see the | |
1558 | compilation flag regexp/newline above) | |
1559 | ||
1560 | **** Function: regexp? OBJ | |
1561 | Return `#t' if OBJ is a compiled regular expression, or `#f' | |
1562 | otherwise. | |
1563 | ||
1564 | Regular expressions are commonly used to find patterns in one string | |
1565 | and replace them with the contents of another string. | |
1566 | ||
1567 | **** Function: regexp-substitute PORT MATCH [ITEM...] | |
1568 | Write to the output port PORT selected contents of the match | |
1569 | structure MATCH. Each ITEM specifies what should be written, and | |
1570 | may be one of the following arguments: | |
1571 | ||
1572 | * A string. String arguments are written out verbatim. | |
1573 | ||
1574 | * An integer. The submatch with that number is written. | |
1575 | ||
1576 | * The symbol `pre'. The portion of the matched string preceding | |
1577 | the regexp match is written. | |
1578 | ||
1579 | * The symbol `post'. The portion of the matched string | |
1580 | following the regexp match is written. | |
1581 | ||
1582 | PORT may be `#f', in which case nothing is written; instead, | |
1583 | `regexp-substitute' constructs a string from the specified ITEMs | |
1584 | and returns that. | |
1585 | ||
1586 | **** Function: regexp-substitute/global PORT REGEXP TARGET [ITEM...] | |
1587 | Similar to `regexp-substitute', but can be used to perform global | |
1588 | substitutions on STR. Instead of taking a match structure as an | |
1589 | argument, `regexp-substitute/global' takes two string arguments: a | |
1590 | REGEXP string describing a regular expression, and a TARGET string | |
1591 | which should be matched against this regular expression. | |
1592 | ||
1593 | Each ITEM behaves as in REGEXP-SUBSTITUTE, with the following | |
1594 | exceptions: | |
1595 | ||
1596 | * A function may be supplied. When this function is called, it | |
1597 | will be passed one argument: a match structure for a given | |
1598 | regular expression match. It should return a string to be | |
1599 | written out to PORT. | |
1600 | ||
1601 | * The `post' symbol causes `regexp-substitute/global' to recurse | |
1602 | on the unmatched portion of STR. This *must* be supplied in | |
1603 | order to perform global search-and-replace on STR; if it is | |
1604 | not present among the ITEMs, then `regexp-substitute/global' | |
1605 | will return after processing a single match. | |
1606 | ||
1607 | *** Match Structures | |
1608 | ||
1609 | A "match structure" is the object returned by `string-match' and | |
1610 | `regexp-exec'. It describes which portion of a string, if any, matched | |
1611 | the given regular expression. Match structures include: a reference to | |
1612 | the string that was checked for matches; the starting and ending | |
1613 | positions of the regexp match; and, if the regexp included any | |
1614 | parenthesized subexpressions, the starting and ending positions of each | |
1615 | submatch. | |
1616 | ||
1617 | In each of the regexp match functions described below, the `match' | |
1618 | argument must be a match structure returned by a previous call to | |
1619 | `string-match' or `regexp-exec'. Most of these functions return some | |
1620 | information about the original target string that was matched against a | |
1621 | regular expression; we will call that string TARGET for easy reference. | |
1622 | ||
1623 | **** Function: regexp-match? OBJ | |
1624 | Return `#t' if OBJ is a match structure returned by a previous | |
1625 | call to `regexp-exec', or `#f' otherwise. | |
1626 | ||
1627 | **** Function: match:substring MATCH [N] | |
1628 | Return the portion of TARGET matched by subexpression number N. | |
1629 | Submatch 0 (the default) represents the entire regexp match. If | |
1630 | the regular expression as a whole matched, but the subexpression | |
1631 | number N did not match, return `#f'. | |
1632 | ||
1633 | **** Function: match:start MATCH [N] | |
1634 | Return the starting position of submatch number N. | |
1635 | ||
1636 | **** Function: match:end MATCH [N] | |
1637 | Return the ending position of submatch number N. | |
1638 | ||
1639 | **** Function: match:prefix MATCH | |
1640 | Return the unmatched portion of TARGET preceding the regexp match. | |
1641 | ||
1642 | **** Function: match:suffix MATCH | |
1643 | Return the unmatched portion of TARGET following the regexp match. | |
1644 | ||
1645 | **** Function: match:count MATCH | |
1646 | Return the number of parenthesized subexpressions from MATCH. | |
1647 | Note that the entire regular expression match itself counts as a | |
1648 | subexpression, and failed submatches are included in the count. | |
1649 | ||
1650 | **** Function: match:string MATCH | |
1651 | Return the original TARGET string. | |
1652 | ||
1653 | *** Backslash Escapes | |
1654 | ||
1655 | Sometimes you will want a regexp to match characters like `*' or `$' | |
1656 | exactly. For example, to check whether a particular string represents | |
1657 | a menu entry from an Info node, it would be useful to match it against | |
1658 | a regexp like `^* [^:]*::'. However, this won't work; because the | |
1659 | asterisk is a metacharacter, it won't match the `*' at the beginning of | |
1660 | the string. In this case, we want to make the first asterisk un-magic. | |
1661 | ||
1662 | You can do this by preceding the metacharacter with a backslash | |
1663 | character `\'. (This is also called "quoting" the metacharacter, and | |
1664 | is known as a "backslash escape".) When Guile sees a backslash in a | |
1665 | regular expression, it considers the following glyph to be an ordinary | |
1666 | character, no matter what special meaning it would ordinarily have. | |
1667 | Therefore, we can make the above example work by changing the regexp to | |
1668 | `^\* [^:]*::'. The `\*' sequence tells the regular expression engine | |
1669 | to match only a single asterisk in the target string. | |
1670 | ||
1671 | Since the backslash is itself a metacharacter, you may force a | |
1672 | regexp to match a backslash in the target string by preceding the | |
1673 | backslash with itself. For example, to find variable references in a | |
1674 | TeX program, you might want to find occurrences of the string `\let\' | |
1675 | followed by any number of alphabetic characters. The regular expression | |
1676 | `\\let\\[A-Za-z]*' would do this: the double backslashes in the regexp | |
1677 | each match a single backslash in the target string. | |
1678 | ||
1679 | **** Function: regexp-quote STR | |
1680 | Quote each special character found in STR with a backslash, and | |
1681 | return the resulting string. | |
1682 | ||
1683 | *Very important:* Using backslash escapes in Guile source code (as | |
1684 | in Emacs Lisp or C) can be tricky, because the backslash character has | |
1685 | special meaning for the Guile reader. For example, if Guile encounters | |
1686 | the character sequence `\n' in the middle of a string while processing | |
1687 | Scheme code, it replaces those characters with a newline character. | |
1688 | Similarly, the character sequence `\t' is replaced by a horizontal tab. | |
1689 | Several of these "escape sequences" are processed by the Guile reader | |
1690 | before your code is executed. Unrecognized escape sequences are | |
1691 | ignored: if the characters `\*' appear in a string, they will be | |
1692 | translated to the single character `*'. | |
1693 | ||
1694 | This translation is obviously undesirable for regular expressions, | |
1695 | since we want to be able to include backslashes in a string in order to | |
1696 | escape regexp metacharacters. Therefore, to make sure that a backslash | |
1697 | is preserved in a string in your Guile program, you must use *two* | |
1698 | consecutive backslashes: | |
1699 | ||
1700 | (define Info-menu-entry-pattern (make-regexp "^\\* [^:]*")) | |
1701 | ||
1702 | The string in this example is preprocessed by the Guile reader before | |
1703 | any code is executed. The resulting argument to `make-regexp' is the | |
1704 | string `^\* [^:]*', which is what we really want. | |
1705 | ||
1706 | This also means that in order to write a regular expression that | |
1707 | matches a single backslash character, the regular expression string in | |
1708 | the source code must include *four* backslashes. Each consecutive pair | |
1709 | of backslashes gets translated by the Guile reader to a single | |
1710 | backslash, and the resulting double-backslash is interpreted by the | |
1711 | regexp engine as matching a single backslash character. Hence: | |
1712 | ||
1713 | (define tex-variable-pattern (make-regexp "\\\\let\\\\=[A-Za-z]*")) | |
1714 | ||
1715 | The reason for the unwieldiness of this syntax is historical. Both | |
1716 | regular expression pattern matchers and Unix string processing systems | |
1717 | have traditionally used backslashes with the special meanings described | |
1718 | above. The POSIX regular expression specification and ANSI C standard | |
1719 | both require these semantics. Attempting to abandon either convention | |
1720 | would cause other kinds of compatibility problems, possibly more severe | |
1721 | ones. Therefore, without extending the Scheme reader to support | |
1722 | strings with different quoting conventions (an ungainly and confusing | |
1723 | extension when implemented in other languages), we must adhere to this | |
1724 | cumbersome escape syntax. | |
1725 | ||
7ad3c1e7 GH |
1726 | * Changes to the gh_ interface |
1727 | ||
1728 | * Changes to the scm_ interface | |
1729 | ||
1730 | * Changes to system call interfaces: | |
94982a4e | 1731 | |
7ad3c1e7 | 1732 | ** The value returned by `raise' is now unspecified. It throws an exception |
e1a191a8 GH |
1733 | if an error occurs. |
1734 | ||
94982a4e | 1735 | *** A new procedure `sigaction' can be used to install signal handlers |
115b09a5 GH |
1736 | |
1737 | (sigaction signum [action] [flags]) | |
1738 | ||
1739 | signum is the signal number, which can be specified using the value | |
1740 | of SIGINT etc. | |
1741 | ||
1742 | If action is omitted, sigaction returns a pair: the CAR is the current | |
1743 | signal hander, which will be either an integer with the value SIG_DFL | |
1744 | (default action) or SIG_IGN (ignore), or the Scheme procedure which | |
1745 | handles the signal, or #f if a non-Scheme procedure handles the | |
1746 | signal. The CDR contains the current sigaction flags for the handler. | |
1747 | ||
1748 | If action is provided, it is installed as the new handler for signum. | |
1749 | action can be a Scheme procedure taking one argument, or the value of | |
1750 | SIG_DFL (default action) or SIG_IGN (ignore), or #f to restore | |
1751 | whatever signal handler was installed before sigaction was first used. | |
1752 | Flags can optionally be specified for the new handler (SA_RESTART is | |
1753 | always used if the system provides it, so need not be specified.) The | |
1754 | return value is a pair with information about the old handler as | |
1755 | described above. | |
1756 | ||
1757 | This interface does not provide access to the "signal blocking" | |
1758 | facility. Maybe this is not needed, since the thread support may | |
1759 | provide solutions to the problem of consistent access to data | |
1760 | structures. | |
e1a191a8 | 1761 | |
94982a4e | 1762 | *** A new procedure `flush-all-ports' is equivalent to running |
89ea5b7c GH |
1763 | `force-output' on every port open for output. |
1764 | ||
94982a4e JB |
1765 | ** Guile now provides information on how it was built, via the new |
1766 | global variable, %guile-build-info. This variable records the values | |
1767 | of the standard GNU makefile directory variables as an assocation | |
1768 | list, mapping variable names (symbols) onto directory paths (strings). | |
1769 | For example, to find out where the Guile link libraries were | |
1770 | installed, you can say: | |
1771 | ||
1772 | guile -c "(display (assq-ref %guile-build-info 'libdir)) (newline)" | |
1773 | ||
1774 | ||
1775 | * Changes to the scm_ interface | |
1776 | ||
1777 | ** The new function scm_handle_by_message_noexit is just like the | |
1778 | existing scm_handle_by_message function, except that it doesn't call | |
1779 | exit to terminate the process. Instead, it prints a message and just | |
1780 | returns #f. This might be a more appropriate catch-all handler for | |
1781 | new dynamic roots and threads. | |
1782 | ||
cf78e9e8 | 1783 | \f |
c484bf7f | 1784 | Changes in Guile 1.1 (released Friday, May 16 1997): |
f3b1485f JB |
1785 | |
1786 | * Changes to the distribution. | |
1787 | ||
1788 | The Guile 1.0 distribution has been split up into several smaller | |
1789 | pieces: | |
1790 | guile-core --- the Guile interpreter itself. | |
1791 | guile-tcltk --- the interface between the Guile interpreter and | |
1792 | Tcl/Tk; Tcl is an interpreter for a stringy language, and Tk | |
1793 | is a toolkit for building graphical user interfaces. | |
1794 | guile-rgx-ctax --- the interface between Guile and the Rx regular | |
1795 | expression matcher, and the translator for the Ctax | |
1796 | programming language. These are packaged together because the | |
1797 | Ctax translator uses Rx to parse Ctax source code. | |
1798 | ||
095936d2 JB |
1799 | This NEWS file describes the changes made to guile-core since the 1.0 |
1800 | release. | |
1801 | ||
48d224d7 JB |
1802 | We no longer distribute the documentation, since it was either out of |
1803 | date, or incomplete. As soon as we have current documentation, we | |
1804 | will distribute it. | |
1805 | ||
0fcab5ed JB |
1806 | |
1807 | ||
f3b1485f JB |
1808 | * Changes to the stand-alone interpreter |
1809 | ||
48d224d7 JB |
1810 | ** guile now accepts command-line arguments compatible with SCSH, Olin |
1811 | Shivers' Scheme Shell. | |
1812 | ||
1813 | In general, arguments are evaluated from left to right, but there are | |
1814 | exceptions. The following switches stop argument processing, and | |
1815 | stash all remaining command-line arguments as the value returned by | |
1816 | the (command-line) function. | |
1817 | -s SCRIPT load Scheme source code from FILE, and exit | |
1818 | -c EXPR evalute Scheme expression EXPR, and exit | |
1819 | -- stop scanning arguments; run interactively | |
1820 | ||
1821 | The switches below are processed as they are encountered. | |
1822 | -l FILE load Scheme source code from FILE | |
1823 | -e FUNCTION after reading script, apply FUNCTION to | |
1824 | command line arguments | |
1825 | -ds do -s script at this point | |
1826 | --emacs enable Emacs protocol (experimental) | |
1827 | -h, --help display this help and exit | |
1828 | -v, --version display version information and exit | |
1829 | \ read arguments from following script lines | |
1830 | ||
1831 | So, for example, here is a Guile script named `ekko' (thanks, Olin) | |
1832 | which re-implements the traditional "echo" command: | |
1833 | ||
1834 | #!/usr/local/bin/guile -s | |
1835 | !# | |
1836 | (define (main args) | |
1837 | (map (lambda (arg) (display arg) (display " ")) | |
1838 | (cdr args)) | |
1839 | (newline)) | |
1840 | ||
1841 | (main (command-line)) | |
1842 | ||
1843 | Suppose we invoke this script as follows: | |
1844 | ||
1845 | ekko a speckled gecko | |
1846 | ||
1847 | Through the magic of Unix script processing (triggered by the `#!' | |
1848 | token at the top of the file), /usr/local/bin/guile receives the | |
1849 | following list of command-line arguments: | |
1850 | ||
1851 | ("-s" "./ekko" "a" "speckled" "gecko") | |
1852 | ||
1853 | Unix inserts the name of the script after the argument specified on | |
1854 | the first line of the file (in this case, "-s"), and then follows that | |
1855 | with the arguments given to the script. Guile loads the script, which | |
1856 | defines the `main' function, and then applies it to the list of | |
1857 | remaining command-line arguments, ("a" "speckled" "gecko"). | |
1858 | ||
095936d2 JB |
1859 | In Unix, the first line of a script file must take the following form: |
1860 | ||
1861 | #!INTERPRETER ARGUMENT | |
1862 | ||
1863 | where INTERPRETER is the absolute filename of the interpreter | |
1864 | executable, and ARGUMENT is a single command-line argument to pass to | |
1865 | the interpreter. | |
1866 | ||
1867 | You may only pass one argument to the interpreter, and its length is | |
1868 | limited. These restrictions can be annoying to work around, so Guile | |
1869 | provides a general mechanism (borrowed from, and compatible with, | |
1870 | SCSH) for circumventing them. | |
1871 | ||
1872 | If the ARGUMENT in a Guile script is a single backslash character, | |
1873 | `\', Guile will open the script file, parse arguments from its second | |
1874 | and subsequent lines, and replace the `\' with them. So, for example, | |
1875 | here is another implementation of the `ekko' script: | |
1876 | ||
1877 | #!/usr/local/bin/guile \ | |
1878 | -e main -s | |
1879 | !# | |
1880 | (define (main args) | |
1881 | (for-each (lambda (arg) (display arg) (display " ")) | |
1882 | (cdr args)) | |
1883 | (newline)) | |
1884 | ||
1885 | If the user invokes this script as follows: | |
1886 | ||
1887 | ekko a speckled gecko | |
1888 | ||
1889 | Unix expands this into | |
1890 | ||
1891 | /usr/local/bin/guile \ ekko a speckled gecko | |
1892 | ||
1893 | When Guile sees the `\' argument, it replaces it with the arguments | |
1894 | read from the second line of the script, producing: | |
1895 | ||
1896 | /usr/local/bin/guile -e main -s ekko a speckled gecko | |
1897 | ||
1898 | This tells Guile to load the `ekko' script, and apply the function | |
1899 | `main' to the argument list ("a" "speckled" "gecko"). | |
1900 | ||
1901 | Here is how Guile parses the command-line arguments: | |
1902 | - Each space character terminates an argument. This means that two | |
1903 | spaces in a row introduce an empty-string argument. | |
1904 | - The tab character is not permitted (unless you quote it with the | |
1905 | backslash character, as described below), to avoid confusion. | |
1906 | - The newline character terminates the sequence of arguments, and will | |
1907 | also terminate a final non-empty argument. (However, a newline | |
1908 | following a space will not introduce a final empty-string argument; | |
1909 | it only terminates the argument list.) | |
1910 | - The backslash character is the escape character. It escapes | |
1911 | backslash, space, tab, and newline. The ANSI C escape sequences | |
1912 | like \n and \t are also supported. These produce argument | |
1913 | constituents; the two-character combination \n doesn't act like a | |
1914 | terminating newline. The escape sequence \NNN for exactly three | |
1915 | octal digits reads as the character whose ASCII code is NNN. As | |
1916 | above, characters produced this way are argument constituents. | |
1917 | Backslash followed by other characters is not allowed. | |
1918 | ||
48d224d7 JB |
1919 | * Changes to the procedure for linking libguile with your programs |
1920 | ||
1921 | ** Guile now builds and installs a shared guile library, if your | |
1922 | system support shared libraries. (It still builds a static library on | |
1923 | all systems.) Guile automatically detects whether your system | |
1924 | supports shared libraries. To prevent Guile from buildisg shared | |
1925 | libraries, pass the `--disable-shared' flag to the configure script. | |
1926 | ||
1927 | Guile takes longer to compile when it builds shared libraries, because | |
1928 | it must compile every file twice --- once to produce position- | |
1929 | independent object code, and once to produce normal object code. | |
1930 | ||
1931 | ** The libthreads library has been merged into libguile. | |
1932 | ||
1933 | To link a program against Guile, you now need only link against | |
1934 | -lguile and -lqt; -lthreads is no longer needed. If you are using | |
1935 | autoconf to generate configuration scripts for your application, the | |
1936 | following lines should suffice to add the appropriate libraries to | |
1937 | your link command: | |
1938 | ||
1939 | ### Find quickthreads and libguile. | |
1940 | AC_CHECK_LIB(qt, main) | |
1941 | AC_CHECK_LIB(guile, scm_shell) | |
f3b1485f JB |
1942 | |
1943 | * Changes to Scheme functions | |
1944 | ||
095936d2 JB |
1945 | ** Guile Scheme's special syntax for keyword objects is now optional, |
1946 | and disabled by default. | |
1947 | ||
1948 | The syntax variation from R4RS made it difficult to port some | |
1949 | interesting packages to Guile. The routines which accepted keyword | |
1950 | arguments (mostly in the module system) have been modified to also | |
1951 | accept symbols whose names begin with `:'. | |
1952 | ||
1953 | To change the keyword syntax, you must first import the (ice-9 debug) | |
1954 | module: | |
1955 | (use-modules (ice-9 debug)) | |
1956 | ||
1957 | Then you can enable the keyword syntax as follows: | |
1958 | (read-set! keywords 'prefix) | |
1959 | ||
1960 | To disable keyword syntax, do this: | |
1961 | (read-set! keywords #f) | |
1962 | ||
1963 | ** Many more primitive functions accept shared substrings as | |
1964 | arguments. In the past, these functions required normal, mutable | |
1965 | strings as arguments, although they never made use of this | |
1966 | restriction. | |
1967 | ||
1968 | ** The uniform array functions now operate on byte vectors. These | |
1969 | functions are `array-fill!', `serial-array-copy!', `array-copy!', | |
1970 | `serial-array-map', `array-map', `array-for-each', and | |
1971 | `array-index-map!'. | |
1972 | ||
1973 | ** The new functions `trace' and `untrace' implement simple debugging | |
1974 | support for Scheme functions. | |
1975 | ||
1976 | The `trace' function accepts any number of procedures as arguments, | |
1977 | and tells the Guile interpreter to display each procedure's name and | |
1978 | arguments each time the procedure is invoked. When invoked with no | |
1979 | arguments, `trace' returns the list of procedures currently being | |
1980 | traced. | |
1981 | ||
1982 | The `untrace' function accepts any number of procedures as arguments, | |
1983 | and tells the Guile interpreter not to trace them any more. When | |
1984 | invoked with no arguments, `untrace' untraces all curretly traced | |
1985 | procedures. | |
1986 | ||
1987 | The tracing in Guile has an advantage over most other systems: we | |
1988 | don't create new procedure objects, but mark the procedure objects | |
1989 | themselves. This means that anonymous and internal procedures can be | |
1990 | traced. | |
1991 | ||
1992 | ** The function `assert-repl-prompt' has been renamed to | |
1993 | `set-repl-prompt!'. It takes one argument, PROMPT. | |
1994 | - If PROMPT is #f, the Guile read-eval-print loop will not prompt. | |
1995 | - If PROMPT is a string, we use it as a prompt. | |
1996 | - If PROMPT is a procedure accepting no arguments, we call it, and | |
1997 | display the result as a prompt. | |
1998 | - Otherwise, we display "> ". | |
1999 | ||
2000 | ** The new function `eval-string' reads Scheme expressions from a | |
2001 | string and evaluates them, returning the value of the last expression | |
2002 | in the string. If the string contains no expressions, it returns an | |
2003 | unspecified value. | |
2004 | ||
2005 | ** The new function `thunk?' returns true iff its argument is a | |
2006 | procedure of zero arguments. | |
2007 | ||
2008 | ** `defined?' is now a builtin function, instead of syntax. This | |
2009 | means that its argument should be quoted. It returns #t iff its | |
2010 | argument is bound in the current module. | |
2011 | ||
2012 | ** The new syntax `use-modules' allows you to add new modules to your | |
2013 | environment without re-typing a complete `define-module' form. It | |
2014 | accepts any number of module names as arguments, and imports their | |
2015 | public bindings into the current module. | |
2016 | ||
2017 | ** The new function (module-defined? NAME MODULE) returns true iff | |
2018 | NAME, a symbol, is defined in MODULE, a module object. | |
2019 | ||
2020 | ** The new function `builtin-bindings' creates and returns a hash | |
2021 | table containing copies of all the root module's bindings. | |
2022 | ||
2023 | ** The new function `builtin-weak-bindings' does the same as | |
2024 | `builtin-bindings', but creates a doubly-weak hash table. | |
2025 | ||
2026 | ** The `equal?' function now considers variable objects to be | |
2027 | equivalent if they have the same name and the same value. | |
2028 | ||
2029 | ** The new function `command-line' returns the command-line arguments | |
2030 | given to Guile, as a list of strings. | |
2031 | ||
2032 | When using guile as a script interpreter, `command-line' returns the | |
2033 | script's arguments; those processed by the interpreter (like `-s' or | |
2034 | `-c') are omitted. (In other words, you get the normal, expected | |
2035 | behavior.) Any application that uses scm_shell to process its | |
2036 | command-line arguments gets this behavior as well. | |
2037 | ||
2038 | ** The new function `load-user-init' looks for a file called `.guile' | |
2039 | in the user's home directory, and loads it if it exists. This is | |
2040 | mostly for use by the code generated by scm_compile_shell_switches, | |
2041 | but we thought it might also be useful in other circumstances. | |
2042 | ||
2043 | ** The new function `log10' returns the base-10 logarithm of its | |
2044 | argument. | |
2045 | ||
2046 | ** Changes to I/O functions | |
2047 | ||
2048 | *** The functions `read', `primitive-load', `read-and-eval!', and | |
2049 | `primitive-load-path' no longer take optional arguments controlling | |
2050 | case insensitivity and a `#' parser. | |
2051 | ||
2052 | Case sensitivity is now controlled by a read option called | |
2053 | `case-insensitive'. The user can add new `#' syntaxes with the | |
2054 | `read-hash-extend' function (see below). | |
2055 | ||
2056 | *** The new function `read-hash-extend' allows the user to change the | |
2057 | syntax of Guile Scheme in a somewhat controlled way. | |
2058 | ||
2059 | (read-hash-extend CHAR PROC) | |
2060 | When parsing S-expressions, if we read a `#' character followed by | |
2061 | the character CHAR, use PROC to parse an object from the stream. | |
2062 | If PROC is #f, remove any parsing procedure registered for CHAR. | |
2063 | ||
2064 | The reader applies PROC to two arguments: CHAR and an input port. | |
2065 | ||
2066 | *** The new functions read-delimited and read-delimited! provide a | |
2067 | general mechanism for doing delimited input on streams. | |
2068 | ||
2069 | (read-delimited DELIMS [PORT HANDLE-DELIM]) | |
2070 | Read until we encounter one of the characters in DELIMS (a string), | |
2071 | or end-of-file. PORT is the input port to read from; it defaults to | |
2072 | the current input port. The HANDLE-DELIM parameter determines how | |
2073 | the terminating character is handled; it should be one of the | |
2074 | following symbols: | |
2075 | ||
2076 | 'trim omit delimiter from result | |
2077 | 'peek leave delimiter character in input stream | |
2078 | 'concat append delimiter character to returned value | |
2079 | 'split return a pair: (RESULT . TERMINATOR) | |
2080 | ||
2081 | HANDLE-DELIM defaults to 'peek. | |
2082 | ||
2083 | (read-delimited! DELIMS BUF [PORT HANDLE-DELIM START END]) | |
2084 | A side-effecting variant of `read-delimited'. | |
2085 | ||
2086 | The data is written into the string BUF at the indices in the | |
2087 | half-open interval [START, END); the default interval is the whole | |
2088 | string: START = 0 and END = (string-length BUF). The values of | |
2089 | START and END must specify a well-defined interval in BUF, i.e. | |
2090 | 0 <= START <= END <= (string-length BUF). | |
2091 | ||
2092 | It returns NBYTES, the number of bytes read. If the buffer filled | |
2093 | up without a delimiter character being found, it returns #f. If the | |
2094 | port is at EOF when the read starts, it returns the EOF object. | |
2095 | ||
2096 | If an integer is returned (i.e., the read is successfully terminated | |
2097 | by reading a delimiter character), then the HANDLE-DELIM parameter | |
2098 | determines how to handle the terminating character. It is described | |
2099 | above, and defaults to 'peek. | |
2100 | ||
2101 | (The descriptions of these functions were borrowed from the SCSH | |
2102 | manual, by Olin Shivers and Brian Carlstrom.) | |
2103 | ||
2104 | *** The `%read-delimited!' function is the primitive used to implement | |
2105 | `read-delimited' and `read-delimited!'. | |
2106 | ||
2107 | (%read-delimited! DELIMS BUF GOBBLE? [PORT START END]) | |
2108 | ||
2109 | This returns a pair of values: (TERMINATOR . NUM-READ). | |
2110 | - TERMINATOR describes why the read was terminated. If it is a | |
2111 | character or the eof object, then that is the value that terminated | |
2112 | the read. If it is #f, the function filled the buffer without finding | |
2113 | a delimiting character. | |
2114 | - NUM-READ is the number of characters read into BUF. | |
2115 | ||
2116 | If the read is successfully terminated by reading a delimiter | |
2117 | character, then the gobble? parameter determines what to do with the | |
2118 | terminating character. If true, the character is removed from the | |
2119 | input stream; if false, the character is left in the input stream | |
2120 | where a subsequent read operation will retrieve it. In either case, | |
2121 | the character is also the first value returned by the procedure call. | |
2122 | ||
2123 | (The descriptions of this function was borrowed from the SCSH manual, | |
2124 | by Olin Shivers and Brian Carlstrom.) | |
2125 | ||
2126 | *** The `read-line' and `read-line!' functions have changed; they now | |
2127 | trim the terminator by default; previously they appended it to the | |
2128 | returned string. For the old behavior, use (read-line PORT 'concat). | |
2129 | ||
2130 | *** The functions `uniform-array-read!' and `uniform-array-write!' now | |
2131 | take new optional START and END arguments, specifying the region of | |
2132 | the array to read and write. | |
2133 | ||
f348c807 JB |
2134 | *** The `ungetc-char-ready?' function has been removed. We feel it's |
2135 | inappropriate for an interface to expose implementation details this | |
2136 | way. | |
095936d2 JB |
2137 | |
2138 | ** Changes to the Unix library and system call interface | |
2139 | ||
2140 | *** The new fcntl function provides access to the Unix `fcntl' system | |
2141 | call. | |
2142 | ||
2143 | (fcntl PORT COMMAND VALUE) | |
2144 | Apply COMMAND to PORT's file descriptor, with VALUE as an argument. | |
2145 | Values for COMMAND are: | |
2146 | ||
2147 | F_DUPFD duplicate a file descriptor | |
2148 | F_GETFD read the descriptor's close-on-exec flag | |
2149 | F_SETFD set the descriptor's close-on-exec flag to VALUE | |
2150 | F_GETFL read the descriptor's flags, as set on open | |
2151 | F_SETFL set the descriptor's flags, as set on open to VALUE | |
2152 | F_GETOWN return the process ID of a socket's owner, for SIGIO | |
2153 | F_SETOWN set the process that owns a socket to VALUE, for SIGIO | |
2154 | FD_CLOEXEC not sure what this is | |
2155 | ||
2156 | For details, see the documentation for the fcntl system call. | |
2157 | ||
2158 | *** The arguments to `select' have changed, for compatibility with | |
2159 | SCSH. The TIMEOUT parameter may now be non-integral, yielding the | |
2160 | expected behavior. The MILLISECONDS parameter has been changed to | |
2161 | MICROSECONDS, to more closely resemble the underlying system call. | |
2162 | The RVEC, WVEC, and EVEC arguments can now be vectors; the type of the | |
2163 | corresponding return set will be the same. | |
2164 | ||
2165 | *** The arguments to the `mknod' system call have changed. They are | |
2166 | now: | |
2167 | ||
2168 | (mknod PATH TYPE PERMS DEV) | |
2169 | Create a new file (`node') in the file system. PATH is the name of | |
2170 | the file to create. TYPE is the kind of file to create; it should | |
2171 | be 'fifo, 'block-special, or 'char-special. PERMS specifies the | |
2172 | permission bits to give the newly created file. If TYPE is | |
2173 | 'block-special or 'char-special, DEV specifies which device the | |
2174 | special file refers to; its interpretation depends on the kind of | |
2175 | special file being created. | |
2176 | ||
2177 | *** The `fork' function has been renamed to `primitive-fork', to avoid | |
2178 | clashing with various SCSH forks. | |
2179 | ||
2180 | *** The `recv' and `recvfrom' functions have been renamed to `recv!' | |
2181 | and `recvfrom!'. They no longer accept a size for a second argument; | |
2182 | you must pass a string to hold the received value. They no longer | |
2183 | return the buffer. Instead, `recv' returns the length of the message | |
2184 | received, and `recvfrom' returns a pair containing the packet's length | |
2185 | and originating address. | |
2186 | ||
2187 | *** The file descriptor datatype has been removed, as have the | |
2188 | `read-fd', `write-fd', `close', `lseek', and `dup' functions. | |
2189 | We plan to replace these functions with a SCSH-compatible interface. | |
2190 | ||
2191 | *** The `create' function has been removed; it's just a special case | |
2192 | of `open'. | |
2193 | ||
2194 | *** There are new functions to break down process termination status | |
2195 | values. In the descriptions below, STATUS is a value returned by | |
2196 | `waitpid'. | |
2197 | ||
2198 | (status:exit-val STATUS) | |
2199 | If the child process exited normally, this function returns the exit | |
2200 | code for the child process (i.e., the value passed to exit, or | |
2201 | returned from main). If the child process did not exit normally, | |
2202 | this function returns #f. | |
2203 | ||
2204 | (status:stop-sig STATUS) | |
2205 | If the child process was suspended by a signal, this function | |
2206 | returns the signal that suspended the child. Otherwise, it returns | |
2207 | #f. | |
2208 | ||
2209 | (status:term-sig STATUS) | |
2210 | If the child process terminated abnormally, this function returns | |
2211 | the signal that terminated the child. Otherwise, this function | |
2212 | returns false. | |
2213 | ||
2214 | POSIX promises that exactly one of these functions will return true on | |
2215 | a valid STATUS value. | |
2216 | ||
2217 | These functions are compatible with SCSH. | |
2218 | ||
2219 | *** There are new accessors and setters for the broken-out time vectors | |
48d224d7 JB |
2220 | returned by `localtime', `gmtime', and that ilk. They are: |
2221 | ||
2222 | Component Accessor Setter | |
2223 | ========================= ============ ============ | |
2224 | seconds tm:sec set-tm:sec | |
2225 | minutes tm:min set-tm:min | |
2226 | hours tm:hour set-tm:hour | |
2227 | day of the month tm:mday set-tm:mday | |
2228 | month tm:mon set-tm:mon | |
2229 | year tm:year set-tm:year | |
2230 | day of the week tm:wday set-tm:wday | |
2231 | day in the year tm:yday set-tm:yday | |
2232 | daylight saving time tm:isdst set-tm:isdst | |
2233 | GMT offset, seconds tm:gmtoff set-tm:gmtoff | |
2234 | name of time zone tm:zone set-tm:zone | |
2235 | ||
095936d2 JB |
2236 | *** There are new accessors for the vectors returned by `uname', |
2237 | describing the host system: | |
48d224d7 JB |
2238 | |
2239 | Component Accessor | |
2240 | ============================================== ================ | |
2241 | name of the operating system implementation utsname:sysname | |
2242 | network name of this machine utsname:nodename | |
2243 | release level of the operating system utsname:release | |
2244 | version level of the operating system utsname:version | |
2245 | machine hardware platform utsname:machine | |
2246 | ||
095936d2 JB |
2247 | *** There are new accessors for the vectors returned by `getpw', |
2248 | `getpwnam', `getpwuid', and `getpwent', describing entries from the | |
2249 | system's user database: | |
2250 | ||
2251 | Component Accessor | |
2252 | ====================== ================= | |
2253 | user name passwd:name | |
2254 | user password passwd:passwd | |
2255 | user id passwd:uid | |
2256 | group id passwd:gid | |
2257 | real name passwd:gecos | |
2258 | home directory passwd:dir | |
2259 | shell program passwd:shell | |
2260 | ||
2261 | *** There are new accessors for the vectors returned by `getgr', | |
2262 | `getgrnam', `getgrgid', and `getgrent', describing entries from the | |
2263 | system's group database: | |
2264 | ||
2265 | Component Accessor | |
2266 | ======================= ============ | |
2267 | group name group:name | |
2268 | group password group:passwd | |
2269 | group id group:gid | |
2270 | group members group:mem | |
2271 | ||
2272 | *** There are new accessors for the vectors returned by `gethost', | |
2273 | `gethostbyaddr', `gethostbyname', and `gethostent', describing | |
2274 | internet hosts: | |
2275 | ||
2276 | Component Accessor | |
2277 | ========================= =============== | |
2278 | official name of host hostent:name | |
2279 | alias list hostent:aliases | |
2280 | host address type hostent:addrtype | |
2281 | length of address hostent:length | |
2282 | list of addresses hostent:addr-list | |
2283 | ||
2284 | *** There are new accessors for the vectors returned by `getnet', | |
2285 | `getnetbyaddr', `getnetbyname', and `getnetent', describing internet | |
2286 | networks: | |
2287 | ||
2288 | Component Accessor | |
2289 | ========================= =============== | |
2290 | official name of net netent:name | |
2291 | alias list netent:aliases | |
2292 | net number type netent:addrtype | |
2293 | net number netent:net | |
2294 | ||
2295 | *** There are new accessors for the vectors returned by `getproto', | |
2296 | `getprotobyname', `getprotobynumber', and `getprotoent', describing | |
2297 | internet protocols: | |
2298 | ||
2299 | Component Accessor | |
2300 | ========================= =============== | |
2301 | official protocol name protoent:name | |
2302 | alias list protoent:aliases | |
2303 | protocol number protoent:proto | |
2304 | ||
2305 | *** There are new accessors for the vectors returned by `getserv', | |
2306 | `getservbyname', `getservbyport', and `getservent', describing | |
2307 | internet protocols: | |
2308 | ||
2309 | Component Accessor | |
2310 | ========================= =============== | |
2311 | official service name servent:name | |
2312 | alias list servent:aliases | |
2313 | port number servent:port | |
2314 | protocol to use servent:proto | |
2315 | ||
2316 | *** There are new accessors for the sockaddr structures returned by | |
2317 | `accept', `getsockname', `getpeername', `recvfrom!': | |
2318 | ||
2319 | Component Accessor | |
2320 | ======================================== =============== | |
2321 | address format (`family') sockaddr:fam | |
2322 | path, for file domain addresses sockaddr:path | |
2323 | address, for internet domain addresses sockaddr:addr | |
2324 | TCP or UDP port, for internet sockaddr:port | |
2325 | ||
2326 | *** The `getpwent', `getgrent', `gethostent', `getnetent', | |
2327 | `getprotoent', and `getservent' functions now return #f at the end of | |
2328 | the user database. (They used to throw an exception.) | |
2329 | ||
2330 | Note that calling MUMBLEent function is equivalent to calling the | |
2331 | corresponding MUMBLE function with no arguments. | |
2332 | ||
2333 | *** The `setpwent', `setgrent', `sethostent', `setnetent', | |
2334 | `setprotoent', and `setservent' routines now take no arguments. | |
2335 | ||
2336 | *** The `gethost', `getproto', `getnet', and `getserv' functions now | |
2337 | provide more useful information when they throw an exception. | |
2338 | ||
2339 | *** The `lnaof' function has been renamed to `inet-lnaof'. | |
2340 | ||
2341 | *** Guile now claims to have the `current-time' feature. | |
2342 | ||
2343 | *** The `mktime' function now takes an optional second argument ZONE, | |
2344 | giving the time zone to use for the conversion. ZONE should be a | |
2345 | string, in the same format as expected for the "TZ" environment variable. | |
2346 | ||
2347 | *** The `strptime' function now returns a pair (TIME . COUNT), where | |
2348 | TIME is the parsed time as a vector, and COUNT is the number of | |
2349 | characters from the string left unparsed. This function used to | |
2350 | return the remaining characters as a string. | |
2351 | ||
2352 | *** The `gettimeofday' function has replaced the old `time+ticks' function. | |
2353 | The return value is now (SECONDS . MICROSECONDS); the fractional | |
2354 | component is no longer expressed in "ticks". | |
2355 | ||
2356 | *** The `ticks/sec' constant has been removed, in light of the above change. | |
6685dc83 | 2357 | |
ea00ecba MG |
2358 | * Changes to the gh_ interface |
2359 | ||
2360 | ** gh_eval_str() now returns an SCM object which is the result of the | |
2361 | evaluation | |
2362 | ||
aaef0d2a MG |
2363 | ** gh_scm2str() now copies the Scheme data to a caller-provided C |
2364 | array | |
2365 | ||
2366 | ** gh_scm2newstr() now makes a C array, copies the Scheme data to it, | |
2367 | and returns the array | |
2368 | ||
2369 | ** gh_scm2str0() is gone: there is no need to distinguish | |
2370 | null-terminated from non-null-terminated, since gh_scm2newstr() allows | |
2371 | the user to interpret the data both ways. | |
2372 | ||
f3b1485f JB |
2373 | * Changes to the scm_ interface |
2374 | ||
095936d2 JB |
2375 | ** The new function scm_symbol_value0 provides an easy way to get a |
2376 | symbol's value from C code: | |
2377 | ||
2378 | SCM scm_symbol_value0 (char *NAME) | |
2379 | Return the value of the symbol named by the null-terminated string | |
2380 | NAME in the current module. If the symbol named NAME is unbound in | |
2381 | the current module, return SCM_UNDEFINED. | |
2382 | ||
2383 | ** The new function scm_sysintern0 creates new top-level variables, | |
2384 | without assigning them a value. | |
2385 | ||
2386 | SCM scm_sysintern0 (char *NAME) | |
2387 | Create a new Scheme top-level variable named NAME. NAME is a | |
2388 | null-terminated string. Return the variable's value cell. | |
2389 | ||
2390 | ** The function scm_internal_catch is the guts of catch. It handles | |
2391 | all the mechanics of setting up a catch target, invoking the catch | |
2392 | body, and perhaps invoking the handler if the body does a throw. | |
2393 | ||
2394 | The function is designed to be usable from C code, but is general | |
2395 | enough to implement all the semantics Guile Scheme expects from throw. | |
2396 | ||
2397 | TAG is the catch tag. Typically, this is a symbol, but this function | |
2398 | doesn't actually care about that. | |
2399 | ||
2400 | BODY is a pointer to a C function which runs the body of the catch; | |
2401 | this is the code you can throw from. We call it like this: | |
2402 | BODY (BODY_DATA, JMPBUF) | |
2403 | where: | |
2404 | BODY_DATA is just the BODY_DATA argument we received; we pass it | |
2405 | through to BODY as its first argument. The caller can make | |
2406 | BODY_DATA point to anything useful that BODY might need. | |
2407 | JMPBUF is the Scheme jmpbuf object corresponding to this catch, | |
2408 | which we have just created and initialized. | |
2409 | ||
2410 | HANDLER is a pointer to a C function to deal with a throw to TAG, | |
2411 | should one occur. We call it like this: | |
2412 | HANDLER (HANDLER_DATA, THROWN_TAG, THROW_ARGS) | |
2413 | where | |
2414 | HANDLER_DATA is the HANDLER_DATA argument we recevied; it's the | |
2415 | same idea as BODY_DATA above. | |
2416 | THROWN_TAG is the tag that the user threw to; usually this is | |
2417 | TAG, but it could be something else if TAG was #t (i.e., a | |
2418 | catch-all), or the user threw to a jmpbuf. | |
2419 | THROW_ARGS is the list of arguments the user passed to the THROW | |
2420 | function. | |
2421 | ||
2422 | BODY_DATA is just a pointer we pass through to BODY. HANDLER_DATA | |
2423 | is just a pointer we pass through to HANDLER. We don't actually | |
2424 | use either of those pointers otherwise ourselves. The idea is | |
2425 | that, if our caller wants to communicate something to BODY or | |
2426 | HANDLER, it can pass a pointer to it as MUMBLE_DATA, which BODY and | |
2427 | HANDLER can then use. Think of it as a way to make BODY and | |
2428 | HANDLER closures, not just functions; MUMBLE_DATA points to the | |
2429 | enclosed variables. | |
2430 | ||
2431 | Of course, it's up to the caller to make sure that any data a | |
2432 | MUMBLE_DATA needs is protected from GC. A common way to do this is | |
2433 | to make MUMBLE_DATA a pointer to data stored in an automatic | |
2434 | structure variable; since the collector must scan the stack for | |
2435 | references anyway, this assures that any references in MUMBLE_DATA | |
2436 | will be found. | |
2437 | ||
2438 | ** The new function scm_internal_lazy_catch is exactly like | |
2439 | scm_internal_catch, except: | |
2440 | ||
2441 | - It does not unwind the stack (this is the major difference). | |
2442 | - If handler returns, its value is returned from the throw. | |
2443 | - BODY always receives #f as its JMPBUF argument (since there's no | |
2444 | jmpbuf associated with a lazy catch, because we don't unwind the | |
2445 | stack.) | |
2446 | ||
2447 | ** scm_body_thunk is a new body function you can pass to | |
2448 | scm_internal_catch if you want the body to be like Scheme's `catch' | |
2449 | --- a thunk, or a function of one argument if the tag is #f. | |
2450 | ||
2451 | BODY_DATA is a pointer to a scm_body_thunk_data structure, which | |
2452 | contains the Scheme procedure to invoke as the body, and the tag | |
2453 | we're catching. If the tag is #f, then we pass JMPBUF (created by | |
2454 | scm_internal_catch) to the body procedure; otherwise, the body gets | |
2455 | no arguments. | |
2456 | ||
2457 | ** scm_handle_by_proc is a new handler function you can pass to | |
2458 | scm_internal_catch if you want the handler to act like Scheme's catch | |
2459 | --- call a procedure with the tag and the throw arguments. | |
2460 | ||
2461 | If the user does a throw to this catch, this function runs a handler | |
2462 | procedure written in Scheme. HANDLER_DATA is a pointer to an SCM | |
2463 | variable holding the Scheme procedure object to invoke. It ought to | |
2464 | be a pointer to an automatic variable (i.e., one living on the stack), | |
2465 | or the procedure object should be otherwise protected from GC. | |
2466 | ||
2467 | ** scm_handle_by_message is a new handler function to use with | |
2468 | `scm_internal_catch' if you want Guile to print a message and die. | |
2469 | It's useful for dealing with throws to uncaught keys at the top level. | |
2470 | ||
2471 | HANDLER_DATA, if non-zero, is assumed to be a char * pointing to a | |
2472 | message header to print; if zero, we use "guile" instead. That | |
2473 | text is followed by a colon, then the message described by ARGS. | |
2474 | ||
2475 | ** The return type of scm_boot_guile is now void; the function does | |
2476 | not return a value, and indeed, never returns at all. | |
2477 | ||
f3b1485f JB |
2478 | ** The new function scm_shell makes it easy for user applications to |
2479 | process command-line arguments in a way that is compatible with the | |
2480 | stand-alone guile interpreter (which is in turn compatible with SCSH, | |
2481 | the Scheme shell). | |
2482 | ||
2483 | To use the scm_shell function, first initialize any guile modules | |
2484 | linked into your application, and then call scm_shell with the values | |
7ed46dc8 | 2485 | of ARGC and ARGV your `main' function received. scm_shell will add |
f3b1485f JB |
2486 | any SCSH-style meta-arguments from the top of the script file to the |
2487 | argument vector, and then process the command-line arguments. This | |
2488 | generally means loading a script file or starting up an interactive | |
2489 | command interpreter. For details, see "Changes to the stand-alone | |
2490 | interpreter" above. | |
2491 | ||
095936d2 JB |
2492 | ** The new functions scm_get_meta_args and scm_count_argv help you |
2493 | implement the SCSH-style meta-argument, `\'. | |
2494 | ||
2495 | char **scm_get_meta_args (int ARGC, char **ARGV) | |
2496 | If the second element of ARGV is a string consisting of a single | |
2497 | backslash character (i.e. "\\" in Scheme notation), open the file | |
2498 | named by the following argument, parse arguments from it, and return | |
2499 | the spliced command line. The returned array is terminated by a | |
2500 | null pointer. | |
2501 | ||
2502 | For details of argument parsing, see above, under "guile now accepts | |
2503 | command-line arguments compatible with SCSH..." | |
2504 | ||
2505 | int scm_count_argv (char **ARGV) | |
2506 | Count the arguments in ARGV, assuming it is terminated by a null | |
2507 | pointer. | |
2508 | ||
2509 | For an example of how these functions might be used, see the source | |
2510 | code for the function scm_shell in libguile/script.c. | |
2511 | ||
2512 | You will usually want to use scm_shell instead of calling this | |
2513 | function yourself. | |
2514 | ||
2515 | ** The new function scm_compile_shell_switches turns an array of | |
2516 | command-line arguments into Scheme code to carry out the actions they | |
2517 | describe. Given ARGC and ARGV, it returns a Scheme expression to | |
2518 | evaluate, and calls scm_set_program_arguments to make any remaining | |
2519 | command-line arguments available to the Scheme code. For example, | |
2520 | given the following arguments: | |
2521 | ||
2522 | -e main -s ekko a speckled gecko | |
2523 | ||
2524 | scm_set_program_arguments will return the following expression: | |
2525 | ||
2526 | (begin (load "ekko") (main (command-line)) (quit)) | |
2527 | ||
2528 | You will usually want to use scm_shell instead of calling this | |
2529 | function yourself. | |
2530 | ||
2531 | ** The function scm_shell_usage prints a usage message appropriate for | |
2532 | an interpreter that uses scm_compile_shell_switches to handle its | |
2533 | command-line arguments. | |
2534 | ||
2535 | void scm_shell_usage (int FATAL, char *MESSAGE) | |
2536 | Print a usage message to the standard error output. If MESSAGE is | |
2537 | non-zero, write it before the usage message, followed by a newline. | |
2538 | If FATAL is non-zero, exit the process, using FATAL as the | |
2539 | termination status. (If you want to be compatible with Guile, | |
2540 | always use 1 as the exit status when terminating due to command-line | |
2541 | usage problems.) | |
2542 | ||
2543 | You will usually want to use scm_shell instead of calling this | |
2544 | function yourself. | |
48d224d7 JB |
2545 | |
2546 | ** scm_eval_0str now returns SCM_UNSPECIFIED if the string contains no | |
095936d2 JB |
2547 | expressions. It used to return SCM_EOL. Earth-shattering. |
2548 | ||
2549 | ** The macros for declaring scheme objects in C code have been | |
2550 | rearranged slightly. They are now: | |
2551 | ||
2552 | SCM_SYMBOL (C_NAME, SCHEME_NAME) | |
2553 | Declare a static SCM variable named C_NAME, and initialize it to | |
2554 | point to the Scheme symbol whose name is SCHEME_NAME. C_NAME should | |
2555 | be a C identifier, and SCHEME_NAME should be a C string. | |
2556 | ||
2557 | SCM_GLOBAL_SYMBOL (C_NAME, SCHEME_NAME) | |
2558 | Just like SCM_SYMBOL, but make C_NAME globally visible. | |
2559 | ||
2560 | SCM_VCELL (C_NAME, SCHEME_NAME) | |
2561 | Create a global variable at the Scheme level named SCHEME_NAME. | |
2562 | Declare a static SCM variable named C_NAME, and initialize it to | |
2563 | point to the Scheme variable's value cell. | |
2564 | ||
2565 | SCM_GLOBAL_VCELL (C_NAME, SCHEME_NAME) | |
2566 | Just like SCM_VCELL, but make C_NAME globally visible. | |
2567 | ||
2568 | The `guile-snarf' script writes initialization code for these macros | |
2569 | to its standard output, given C source code as input. | |
2570 | ||
2571 | The SCM_GLOBAL macro is gone. | |
2572 | ||
2573 | ** The scm_read_line and scm_read_line_x functions have been replaced | |
2574 | by Scheme code based on the %read-delimited! procedure (known to C | |
2575 | code as scm_read_delimited_x). See its description above for more | |
2576 | information. | |
48d224d7 | 2577 | |
095936d2 JB |
2578 | ** The function scm_sys_open has been renamed to scm_open. It now |
2579 | returns a port instead of an FD object. | |
ea00ecba | 2580 | |
095936d2 JB |
2581 | * The dynamic linking support has changed. For more information, see |
2582 | libguile/DYNAMIC-LINKING. | |
ea00ecba | 2583 | |
f7b47737 JB |
2584 | \f |
2585 | Guile 1.0b3 | |
3065a62a | 2586 | |
f3b1485f JB |
2587 | User-visible changes from Thursday, September 5, 1996 until Guile 1.0 |
2588 | (Sun 5 Jan 1997): | |
3065a62a | 2589 | |
4b521edb | 2590 | * Changes to the 'guile' program: |
3065a62a | 2591 | |
4b521edb JB |
2592 | ** Guile now loads some new files when it starts up. Guile first |
2593 | searches the load path for init.scm, and loads it if found. Then, if | |
2594 | Guile is not being used to execute a script, and the user's home | |
2595 | directory contains a file named `.guile', Guile loads that. | |
c6486f8a | 2596 | |
4b521edb | 2597 | ** You can now use Guile as a shell script interpreter. |
3065a62a JB |
2598 | |
2599 | To paraphrase the SCSH manual: | |
2600 | ||
2601 | When Unix tries to execute an executable file whose first two | |
2602 | characters are the `#!', it treats the file not as machine code to | |
2603 | be directly executed by the native processor, but as source code | |
2604 | to be executed by some interpreter. The interpreter to use is | |
2605 | specified immediately after the #! sequence on the first line of | |
2606 | the source file. The kernel reads in the name of the interpreter, | |
2607 | and executes that instead. It passes the interpreter the source | |
2608 | filename as its first argument, with the original arguments | |
2609 | following. Consult the Unix man page for the `exec' system call | |
2610 | for more information. | |
2611 | ||
1a1945be JB |
2612 | Now you can use Guile as an interpreter, using a mechanism which is a |
2613 | compatible subset of that provided by SCSH. | |
2614 | ||
3065a62a JB |
2615 | Guile now recognizes a '-s' command line switch, whose argument is the |
2616 | name of a file of Scheme code to load. It also treats the two | |
2617 | characters `#!' as the start of a comment, terminated by `!#'. Thus, | |
2618 | to make a file of Scheme code directly executable by Unix, insert the | |
2619 | following two lines at the top of the file: | |
2620 | ||
2621 | #!/usr/local/bin/guile -s | |
2622 | !# | |
2623 | ||
2624 | Guile treats the argument of the `-s' command-line switch as the name | |
2625 | of a file of Scheme code to load, and treats the sequence `#!' as the | |
2626 | start of a block comment, terminated by `!#'. | |
2627 | ||
2628 | For example, here's a version of 'echo' written in Scheme: | |
2629 | ||
2630 | #!/usr/local/bin/guile -s | |
2631 | !# | |
2632 | (let loop ((args (cdr (program-arguments)))) | |
2633 | (if (pair? args) | |
2634 | (begin | |
2635 | (display (car args)) | |
2636 | (if (pair? (cdr args)) | |
2637 | (display " ")) | |
2638 | (loop (cdr args))))) | |
2639 | (newline) | |
2640 | ||
2641 | Why does `#!' start a block comment terminated by `!#', instead of the | |
2642 | end of the line? That is the notation SCSH uses, and although we | |
2643 | don't yet support the other SCSH features that motivate that choice, | |
2644 | we would like to be backward-compatible with any existing Guile | |
3763761c JB |
2645 | scripts once we do. Furthermore, if the path to Guile on your system |
2646 | is too long for your kernel, you can start the script with this | |
2647 | horrible hack: | |
2648 | ||
2649 | #!/bin/sh | |
2650 | exec /really/long/path/to/guile -s "$0" ${1+"$@"} | |
2651 | !# | |
3065a62a JB |
2652 | |
2653 | Note that some very old Unix systems don't support the `#!' syntax. | |
2654 | ||
c6486f8a | 2655 | |
4b521edb | 2656 | ** You can now run Guile without installing it. |
6685dc83 JB |
2657 | |
2658 | Previous versions of the interactive Guile interpreter (`guile') | |
2659 | couldn't start up unless Guile's Scheme library had been installed; | |
2660 | they used the value of the environment variable `SCHEME_LOAD_PATH' | |
2661 | later on in the startup process, but not to find the startup code | |
2662 | itself. Now Guile uses `SCHEME_LOAD_PATH' in all searches for Scheme | |
2663 | code. | |
2664 | ||
2665 | To run Guile without installing it, build it in the normal way, and | |
2666 | then set the environment variable `SCHEME_LOAD_PATH' to a | |
2667 | colon-separated list of directories, including the top-level directory | |
2668 | of the Guile sources. For example, if you unpacked Guile so that the | |
2669 | full filename of this NEWS file is /home/jimb/guile-1.0b3/NEWS, then | |
2670 | you might say | |
2671 | ||
2672 | export SCHEME_LOAD_PATH=/home/jimb/my-scheme:/home/jimb/guile-1.0b3 | |
2673 | ||
c6486f8a | 2674 | |
4b521edb JB |
2675 | ** Guile's read-eval-print loop no longer prints #<unspecified> |
2676 | results. If the user wants to see this, she can evaluate the | |
2677 | expression (assert-repl-print-unspecified #t), perhaps in her startup | |
48d224d7 | 2678 | file. |
6685dc83 | 2679 | |
4b521edb JB |
2680 | ** Guile no longer shows backtraces by default when an error occurs; |
2681 | however, it does display a message saying how to get one, and how to | |
2682 | request that they be displayed by default. After an error, evaluate | |
2683 | (backtrace) | |
2684 | to see a backtrace, and | |
2685 | (debug-enable 'backtrace) | |
2686 | to see them by default. | |
6685dc83 | 2687 | |
6685dc83 | 2688 | |
d9fb83d9 | 2689 | |
4b521edb JB |
2690 | * Changes to Guile Scheme: |
2691 | ||
2692 | ** Guile now distinguishes between #f and the empty list. | |
2693 | ||
2694 | This is for compatibility with the IEEE standard, the (possibly) | |
2695 | upcoming Revised^5 Report on Scheme, and many extant Scheme | |
2696 | implementations. | |
2697 | ||
2698 | Guile used to have #f and '() denote the same object, to make Scheme's | |
2699 | type system more compatible with Emacs Lisp's. However, the change | |
2700 | caused too much trouble for Scheme programmers, and we found another | |
2701 | way to reconcile Emacs Lisp with Scheme that didn't require this. | |
2702 | ||
2703 | ||
2704 | ** Guile's delq, delv, delete functions, and their destructive | |
c6486f8a JB |
2705 | counterparts, delq!, delv!, and delete!, now remove all matching |
2706 | elements from the list, not just the first. This matches the behavior | |
2707 | of the corresponding Emacs Lisp functions, and (I believe) the Maclisp | |
2708 | functions which inspired them. | |
2709 | ||
2710 | I recognize that this change may break code in subtle ways, but it | |
2711 | seems best to make the change before the FSF's first Guile release, | |
2712 | rather than after. | |
2713 | ||
2714 | ||
4b521edb | 2715 | ** The compiled-library-path function has been deleted from libguile. |
6685dc83 | 2716 | |
4b521edb | 2717 | ** The facilities for loading Scheme source files have changed. |
c6486f8a | 2718 | |
4b521edb | 2719 | *** The variable %load-path now tells Guile which directories to search |
6685dc83 JB |
2720 | for Scheme code. Its value is a list of strings, each of which names |
2721 | a directory. | |
2722 | ||
4b521edb JB |
2723 | *** The variable %load-extensions now tells Guile which extensions to |
2724 | try appending to a filename when searching the load path. Its value | |
2725 | is a list of strings. Its default value is ("" ".scm"). | |
2726 | ||
2727 | *** (%search-load-path FILENAME) searches the directories listed in the | |
2728 | value of the %load-path variable for a Scheme file named FILENAME, | |
2729 | with all the extensions listed in %load-extensions. If it finds a | |
2730 | match, then it returns its full filename. If FILENAME is absolute, it | |
2731 | returns it unchanged. Otherwise, it returns #f. | |
6685dc83 | 2732 | |
4b521edb JB |
2733 | %search-load-path will not return matches that refer to directories. |
2734 | ||
2735 | *** (primitive-load FILENAME :optional CASE-INSENSITIVE-P SHARP) | |
2736 | uses %seach-load-path to find a file named FILENAME, and loads it if | |
2737 | it finds it. If it can't read FILENAME for any reason, it throws an | |
2738 | error. | |
6685dc83 JB |
2739 | |
2740 | The arguments CASE-INSENSITIVE-P and SHARP are interpreted as by the | |
4b521edb JB |
2741 | `read' function. |
2742 | ||
2743 | *** load uses the same searching semantics as primitive-load. | |
2744 | ||
2745 | *** The functions %try-load, try-load-with-path, %load, load-with-path, | |
2746 | basic-try-load-with-path, basic-load-with-path, try-load-module-with- | |
2747 | path, and load-module-with-path have been deleted. The functions | |
2748 | above should serve their purposes. | |
2749 | ||
2750 | *** If the value of the variable %load-hook is a procedure, | |
2751 | `primitive-load' applies its value to the name of the file being | |
2752 | loaded (without the load path directory name prepended). If its value | |
2753 | is #f, it is ignored. Otherwise, an error occurs. | |
2754 | ||
2755 | This is mostly useful for printing load notification messages. | |
2756 | ||
2757 | ||
2758 | ** The function `eval!' is no longer accessible from the scheme level. | |
2759 | We can't allow operations which introduce glocs into the scheme level, | |
2760 | because Guile's type system can't handle these as data. Use `eval' or | |
2761 | `read-and-eval!' (see below) as replacement. | |
2762 | ||
2763 | ** The new function read-and-eval! reads an expression from PORT, | |
2764 | evaluates it, and returns the result. This is more efficient than | |
2765 | simply calling `read' and `eval', since it is not necessary to make a | |
2766 | copy of the expression for the evaluator to munge. | |
2767 | ||
2768 | Its optional arguments CASE_INSENSITIVE_P and SHARP are interpreted as | |
2769 | for the `read' function. | |
2770 | ||
2771 | ||
2772 | ** The function `int?' has been removed; its definition was identical | |
2773 | to that of `integer?'. | |
2774 | ||
2775 | ** The functions `<?', `<?', `<=?', `=?', `>?', and `>=?'. Code should | |
2776 | use the R4RS names for these functions. | |
2777 | ||
2778 | ** The function object-properties no longer returns the hash handle; | |
2779 | it simply returns the object's property list. | |
2780 | ||
2781 | ** Many functions have been changed to throw errors, instead of | |
2782 | returning #f on failure. The point of providing exception handling in | |
2783 | the language is to simplify the logic of user code, but this is less | |
2784 | useful if Guile's primitives don't throw exceptions. | |
2785 | ||
2786 | ** The function `fileno' has been renamed from `%fileno'. | |
2787 | ||
2788 | ** The function primitive-mode->fdes returns #t or #f now, not 1 or 0. | |
2789 | ||
2790 | ||
2791 | * Changes to Guile's C interface: | |
2792 | ||
2793 | ** The library's initialization procedure has been simplified. | |
2794 | scm_boot_guile now has the prototype: | |
2795 | ||
2796 | void scm_boot_guile (int ARGC, | |
2797 | char **ARGV, | |
2798 | void (*main_func) (), | |
2799 | void *closure); | |
2800 | ||
2801 | scm_boot_guile calls MAIN_FUNC, passing it CLOSURE, ARGC, and ARGV. | |
2802 | MAIN_FUNC should do all the work of the program (initializing other | |
2803 | packages, reading user input, etc.) before returning. When MAIN_FUNC | |
2804 | returns, call exit (0); this function never returns. If you want some | |
2805 | other exit value, MAIN_FUNC may call exit itself. | |
2806 | ||
2807 | scm_boot_guile arranges for program-arguments to return the strings | |
2808 | given by ARGC and ARGV. If MAIN_FUNC modifies ARGC/ARGV, should call | |
2809 | scm_set_program_arguments with the final list, so Scheme code will | |
2810 | know which arguments have been processed. | |
2811 | ||
2812 | scm_boot_guile establishes a catch-all catch handler which prints an | |
2813 | error message and exits the process. This means that Guile exits in a | |
2814 | coherent way when system errors occur and the user isn't prepared to | |
2815 | handle it. If the user doesn't like this behavior, they can establish | |
2816 | their own universal catcher in MAIN_FUNC to shadow this one. | |
2817 | ||
2818 | Why must the caller do all the real work from MAIN_FUNC? The garbage | |
2819 | collector assumes that all local variables of type SCM will be above | |
2820 | scm_boot_guile's stack frame on the stack. If you try to manipulate | |
2821 | SCM values after this function returns, it's the luck of the draw | |
2822 | whether the GC will be able to find the objects you allocate. So, | |
2823 | scm_boot_guile function exits, rather than returning, to discourage | |
2824 | people from making that mistake. | |
2825 | ||
2826 | The IN, OUT, and ERR arguments were removed; there are other | |
2827 | convenient ways to override these when desired. | |
2828 | ||
2829 | The RESULT argument was deleted; this function should never return. | |
2830 | ||
2831 | The BOOT_CMD argument was deleted; the MAIN_FUNC argument is more | |
2832 | general. | |
2833 | ||
2834 | ||
2835 | ** Guile's header files should no longer conflict with your system's | |
2836 | header files. | |
2837 | ||
2838 | In order to compile code which #included <libguile.h>, previous | |
2839 | versions of Guile required you to add a directory containing all the | |
2840 | Guile header files to your #include path. This was a problem, since | |
2841 | Guile's header files have names which conflict with many systems' | |
2842 | header files. | |
2843 | ||
2844 | Now only <libguile.h> need appear in your #include path; you must | |
2845 | refer to all Guile's other header files as <libguile/mumble.h>. | |
2846 | Guile's installation procedure puts libguile.h in $(includedir), and | |
2847 | the rest in $(includedir)/libguile. | |
2848 | ||
2849 | ||
2850 | ** Two new C functions, scm_protect_object and scm_unprotect_object, | |
2851 | have been added to the Guile library. | |
2852 | ||
2853 | scm_protect_object (OBJ) protects OBJ from the garbage collector. | |
2854 | OBJ will not be freed, even if all other references are dropped, | |
2855 | until someone does scm_unprotect_object (OBJ). Both functions | |
2856 | return OBJ. | |
2857 | ||
2858 | Note that calls to scm_protect_object do not nest. You can call | |
2859 | scm_protect_object any number of times on a given object, and the | |
2860 | next call to scm_unprotect_object will unprotect it completely. | |
2861 | ||
2862 | Basically, scm_protect_object and scm_unprotect_object just | |
2863 | maintain a list of references to things. Since the GC knows about | |
2864 | this list, all objects it mentions stay alive. scm_protect_object | |
2865 | adds its argument to the list; scm_unprotect_object remove its | |
2866 | argument from the list. | |
2867 | ||
2868 | ||
2869 | ** scm_eval_0str now returns the value of the last expression | |
2870 | evaluated. | |
2871 | ||
2872 | ** The new function scm_read_0str reads an s-expression from a | |
2873 | null-terminated string, and returns it. | |
2874 | ||
2875 | ** The new function `scm_stdio_to_port' converts a STDIO file pointer | |
2876 | to a Scheme port object. | |
2877 | ||
2878 | ** The new function `scm_set_program_arguments' allows C code to set | |
e80c8fea | 2879 | the value returned by the Scheme `program-arguments' function. |
6685dc83 | 2880 | |
6685dc83 | 2881 | \f |
1a1945be JB |
2882 | Older changes: |
2883 | ||
2884 | * Guile no longer includes sophisticated Tcl/Tk support. | |
2885 | ||
2886 | The old Tcl/Tk support was unsatisfying to us, because it required the | |
2887 | user to link against the Tcl library, as well as Tk and Guile. The | |
2888 | interface was also un-lispy, in that it preserved Tcl/Tk's practice of | |
2889 | referring to widgets by names, rather than exporting widgets to Scheme | |
2890 | code as a special datatype. | |
2891 | ||
2892 | In the Usenix Tk Developer's Workshop held in July 1996, the Tcl/Tk | |
2893 | maintainers described some very interesting changes in progress to the | |
2894 | Tcl/Tk internals, which would facilitate clean interfaces between lone | |
2895 | Tk and other interpreters --- even for garbage-collected languages | |
2896 | like Scheme. They expected the new Tk to be publicly available in the | |
2897 | fall of 1996. | |
2898 | ||
2899 | Since it seems that Guile might soon have a new, cleaner interface to | |
2900 | lone Tk, and that the old Guile/Tk glue code would probably need to be | |
2901 | completely rewritten, we (Jim Blandy and Richard Stallman) have | |
2902 | decided not to support the old code. We'll spend the time instead on | |
2903 | a good interface to the newer Tk, as soon as it is available. | |
5c54da76 | 2904 | |
8512dea6 | 2905 | Until then, gtcltk-lib provides trivial, low-maintenance functionality. |
deb95d71 | 2906 | |
5c54da76 JB |
2907 | \f |
2908 | Copyright information: | |
2909 | ||
ea00ecba | 2910 | Copyright (C) 1996,1997 Free Software Foundation, Inc. |
5c54da76 JB |
2911 | |
2912 | Permission is granted to anyone to make or distribute verbatim copies | |
2913 | of this document as received, in any medium, provided that the | |
2914 | copyright notice and this permission notice are preserved, | |
2915 | thus giving the recipient permission to redistribute in turn. | |
2916 | ||
2917 | Permission is granted to distribute modified versions | |
2918 | of this document, or of portions of it, | |
2919 | under the above conditions, provided also that they | |
2920 | carry prominent notices stating who last changed them. | |
2921 | ||
48d224d7 JB |
2922 | \f |
2923 | Local variables: | |
2924 | mode: outline | |
2925 | paragraph-separate: "[ \f]*$" | |
2926 | end: | |
2927 |