Commit | Line | Data |
---|---|---|
f7b47737 JB |
1 | Guile NEWS --- history of user-visible changes. -*- text -*- |
2 | Copyright (C) 1996, 1997 Free Software Foundation, Inc. | |
5c54da76 JB |
3 | See the end for copying conditions. |
4 | ||
16f2ebea | 5 | Please send Guile bug reports to bug-guile@prep.ai.mit.edu. |
5c54da76 | 6 | \f |
c484bf7f JB |
7 | Changes since Guile 1.2: |
8 | ||
9 | * Changes to the distribution | |
10 | ||
11 | * Changes to the stand-alone interpreter | |
12 | ||
13 | * Changes to the procedure for linking libguile with your programs | |
14 | ||
15 | * Changes to Scheme functions and syntax | |
7ad3c1e7 | 16 | |
04c76b58 MV |
17 | ** There is now some basic support for fluids. Please read |
18 | "libguile/fluid.h" to find out more. It is accessible from Scheme with | |
19 | the following builtin procedures: | |
20 | ||
21 | (make-fluid) | |
22 | ||
23 | Create a new fluid object. | |
24 | ||
25 | (fluid-ref FLUID) | |
26 | (fluid-set! FLUID VAL) | |
27 | ||
28 | Access/modify the fluid FLUID. Modifications are only visible | |
29 | within the current dynamic root (that includes threads). | |
30 | ||
31 | There is no `fluid-let' yet. | |
32 | ||
7ad3c1e7 GH |
33 | ** A new procedure primitive-exit can be used to terminate the current |
34 | process without unwinding the Scheme stack. This would usually be used | |
35 | after a fork. | |
36 | ||
c484bf7f JB |
37 | * Changes to the gh_ interface |
38 | ||
39 | * Changes to the scm_ interface | |
40 | ||
41 | \f | |
42 | Changes in Guile 1.2 (released Tuesday, June 24 1997): | |
cf78e9e8 | 43 | |
737c9113 JB |
44 | * Changes to the distribution |
45 | ||
832b09ed JB |
46 | ** Nightly snapshots are now available from ftp.red-bean.com. |
47 | The old server, ftp.cyclic.com, has been relinquished to its rightful | |
48 | owner. | |
49 | ||
50 | Nightly snapshots of the Guile development sources are now available via | |
51 | anonymous FTP from ftp.red-bean.com, as /pub/guile/guile-snap.tar.gz. | |
52 | ||
53 | Via the web, that's: ftp://ftp.red-bean.com/pub/guile/guile-snap.tar.gz | |
54 | For getit, that's: ftp.red-bean.com:/pub/guile/guile-snap.tar.gz | |
55 | ||
0fcab5ed JB |
56 | ** To run Guile without installing it, the procedure has changed a bit. |
57 | ||
58 | If you used a separate build directory to compile Guile, you'll need | |
59 | to include the build directory in SCHEME_LOAD_PATH, as well as the | |
60 | source directory. See the `INSTALL' file for examples. | |
61 | ||
737c9113 JB |
62 | * Changes to the procedure for linking libguile with your programs |
63 | ||
94982a4e JB |
64 | ** The standard Guile load path for Scheme code now includes |
65 | $(datadir)/guile (usually /usr/local/share/guile). This means that | |
66 | you can install your own Scheme files there, and Guile will find them. | |
67 | (Previous versions of Guile only checked a directory whose name | |
68 | contained the Guile version number, so you had to re-install or move | |
69 | your Scheme sources each time you installed a fresh version of Guile.) | |
70 | ||
71 | The load path also includes $(datadir)/guile/site; we recommend | |
72 | putting individual Scheme files there. If you want to install a | |
73 | package with multiple source files, create a directory for them under | |
74 | $(datadir)/guile. | |
75 | ||
76 | ** Guile 1.2 will now use the Rx regular expression library, if it is | |
77 | installed on your system. When you are linking libguile into your own | |
78 | programs, this means you will have to link against -lguile, -lqt (if | |
79 | you configured Guile with thread support), and -lrx. | |
27590f82 JB |
80 | |
81 | If you are using autoconf to generate configuration scripts for your | |
82 | application, the following lines should suffice to add the appropriate | |
83 | libraries to your link command: | |
84 | ||
85 | ### Find Rx, quickthreads and libguile. | |
86 | AC_CHECK_LIB(rx, main) | |
87 | AC_CHECK_LIB(qt, main) | |
88 | AC_CHECK_LIB(guile, scm_shell) | |
89 | ||
94982a4e JB |
90 | The Guile 1.2 distribution does not contain sources for the Rx |
91 | library, as Guile 1.0 did. If you want to use Rx, you'll need to | |
92 | retrieve it from a GNU FTP site and install it separately. | |
93 | ||
b83b8bee JB |
94 | * Changes to Scheme functions and syntax |
95 | ||
e035e7e6 MV |
96 | ** The dynamic linking features of Guile are now enabled by default. |
97 | You can disable them by giving the `--disable-dynamic-linking' option | |
98 | to configure. | |
99 | ||
e035e7e6 MV |
100 | (dynamic-link FILENAME) |
101 | ||
102 | Find the object file denoted by FILENAME (a string) and link it | |
103 | into the running Guile application. When everything works out, | |
104 | return a Scheme object suitable for representing the linked object | |
105 | file. Otherwise an error is thrown. How object files are | |
106 | searched is system dependent. | |
107 | ||
108 | (dynamic-object? VAL) | |
109 | ||
110 | Determine whether VAL represents a dynamically linked object file. | |
111 | ||
112 | (dynamic-unlink DYNOBJ) | |
113 | ||
114 | Unlink the indicated object file from the application. DYNOBJ | |
115 | should be one of the values returned by `dynamic-link'. | |
116 | ||
117 | (dynamic-func FUNCTION DYNOBJ) | |
118 | ||
119 | Search the C function indicated by FUNCTION (a string or symbol) | |
120 | in DYNOBJ and return some Scheme object that can later be used | |
121 | with `dynamic-call' to actually call this function. Right now, | |
122 | these Scheme objects are formed by casting the address of the | |
123 | function to `long' and converting this number to its Scheme | |
124 | representation. | |
125 | ||
126 | (dynamic-call FUNCTION DYNOBJ) | |
127 | ||
128 | Call the C function indicated by FUNCTION and DYNOBJ. The | |
129 | function is passed no arguments and its return value is ignored. | |
130 | When FUNCTION is something returned by `dynamic-func', call that | |
131 | function and ignore DYNOBJ. When FUNCTION is a string (or symbol, | |
132 | etc.), look it up in DYNOBJ; this is equivalent to | |
133 | ||
134 | (dynamic-call (dynamic-func FUNCTION DYNOBJ) #f) | |
135 | ||
136 | Interrupts are deferred while the C function is executing (with | |
137 | SCM_DEFER_INTS/SCM_ALLOW_INTS). | |
138 | ||
139 | (dynamic-args-call FUNCTION DYNOBJ ARGS) | |
140 | ||
141 | Call the C function indicated by FUNCTION and DYNOBJ, but pass it | |
142 | some arguments and return its return value. The C function is | |
143 | expected to take two arguments and return an `int', just like | |
144 | `main': | |
145 | ||
146 | int c_func (int argc, char **argv); | |
147 | ||
148 | ARGS must be a list of strings and is converted into an array of | |
149 | `char *'. The array is passed in ARGV and its size in ARGC. The | |
150 | return value is converted to a Scheme number and returned from the | |
151 | call to `dynamic-args-call'. | |
152 | ||
0fcab5ed JB |
153 | When dynamic linking is disabled or not supported on your system, |
154 | the above functions throw errors, but they are still available. | |
155 | ||
e035e7e6 MV |
156 | Here is a small example that works on GNU/Linux: |
157 | ||
158 | (define libc-obj (dynamic-link "libc.so")) | |
159 | (dynamic-args-call 'rand libc-obj '()) | |
160 | ||
161 | See the file `libguile/DYNAMIC-LINKING' for additional comments. | |
162 | ||
27590f82 JB |
163 | ** The #/ syntax for module names is depreciated, and will be removed |
164 | in a future version of Guile. Instead of | |
165 | ||
166 | #/foo/bar/baz | |
167 | ||
168 | instead write | |
169 | ||
170 | (foo bar baz) | |
171 | ||
172 | The latter syntax is more consistent with existing Lisp practice. | |
173 | ||
5dade857 MV |
174 | ** Guile now does fancier printing of structures. Structures are the |
175 | underlying implementation for records, which in turn are used to | |
176 | implement modules, so all of these object now print differently and in | |
177 | a more informative way. | |
178 | ||
161029df JB |
179 | The Scheme printer will examine the builtin variable *struct-printer* |
180 | whenever it needs to print a structure object. When this variable is | |
181 | not `#f' it is deemed to be a procedure and will be applied to the | |
182 | structure object and the output port. When *struct-printer* is `#f' | |
183 | or the procedure return `#f' the structure object will be printed in | |
184 | the boring #<struct 80458270> form. | |
5dade857 MV |
185 | |
186 | This hook is used by some routines in ice-9/boot-9.scm to implement | |
187 | type specific printing routines. Please read the comments there about | |
188 | "printing structs". | |
189 | ||
190 | One of the more specific uses of structs are records. The printing | |
191 | procedure that could be passed to MAKE-RECORD-TYPE is now actually | |
192 | called. It should behave like a *struct-printer* procedure (described | |
193 | above). | |
194 | ||
b83b8bee JB |
195 | ** Guile now supports a new R4RS-compliant syntax for keywords. A |
196 | token of the form #:NAME, where NAME has the same syntax as a Scheme | |
197 | symbol, is the external representation of the keyword named NAME. | |
198 | Keyword objects print using this syntax as well, so values containing | |
1e5afba0 JB |
199 | keyword objects can be read back into Guile. When used in an |
200 | expression, keywords are self-quoting objects. | |
b83b8bee JB |
201 | |
202 | Guile suports this read syntax, and uses this print syntax, regardless | |
203 | of the current setting of the `keyword' read option. The `keyword' | |
204 | read option only controls whether Guile recognizes the `:NAME' syntax, | |
205 | which is incompatible with R4RS. (R4RS says such token represent | |
206 | symbols.) | |
737c9113 JB |
207 | |
208 | ** Guile has regular expression support again. Guile 1.0 included | |
209 | functions for matching regular expressions, based on the Rx library. | |
210 | In Guile 1.1, the Guile/Rx interface was removed to simplify the | |
211 | distribution, and thus Guile had no regular expression support. Guile | |
94982a4e JB |
212 | 1.2 again supports the most commonly used functions, and supports all |
213 | of SCSH's regular expression functions. | |
2409cdfa | 214 | |
94982a4e JB |
215 | If your system does not include a POSIX regular expression library, |
216 | and you have not linked Guile with a third-party regexp library such as | |
217 | Rx, these functions will not be available. You can tell whether your | |
218 | Guile installation includes regular expression support by checking | |
219 | whether the `*features*' list includes the `regex' symbol. | |
737c9113 | 220 | |
94982a4e | 221 | *** regexp functions |
161029df | 222 | |
94982a4e JB |
223 | By default, Guile supports POSIX extended regular expressions. That |
224 | means that the characters `(', `)', `+' and `?' are special, and must | |
225 | be escaped if you wish to match the literal characters. | |
e1a191a8 | 226 | |
94982a4e JB |
227 | This regular expression interface was modeled after that implemented |
228 | by SCSH, the Scheme Shell. It is intended to be upwardly compatible | |
229 | with SCSH regular expressions. | |
230 | ||
231 | **** Function: string-match PATTERN STR [START] | |
232 | Compile the string PATTERN into a regular expression and compare | |
233 | it with STR. The optional numeric argument START specifies the | |
234 | position of STR at which to begin matching. | |
235 | ||
236 | `string-match' returns a "match structure" which describes what, | |
237 | if anything, was matched by the regular expression. *Note Match | |
238 | Structures::. If STR does not match PATTERN at all, | |
239 | `string-match' returns `#f'. | |
240 | ||
241 | Each time `string-match' is called, it must compile its PATTERN | |
242 | argument into a regular expression structure. This operation is | |
243 | expensive, which makes `string-match' inefficient if the same regular | |
244 | expression is used several times (for example, in a loop). For better | |
245 | performance, you can compile a regular expression in advance and then | |
246 | match strings against the compiled regexp. | |
247 | ||
248 | **** Function: make-regexp STR [FLAGS] | |
249 | Compile the regular expression described by STR, and return the | |
250 | compiled regexp structure. If STR does not describe a legal | |
251 | regular expression, `make-regexp' throws a | |
252 | `regular-expression-syntax' error. | |
253 | ||
254 | FLAGS may be the bitwise-or of one or more of the following: | |
255 | ||
256 | **** Constant: regexp/extended | |
257 | Use POSIX Extended Regular Expression syntax when interpreting | |
258 | STR. If not set, POSIX Basic Regular Expression syntax is used. | |
259 | If the FLAGS argument is omitted, we assume regexp/extended. | |
260 | ||
261 | **** Constant: regexp/icase | |
262 | Do not differentiate case. Subsequent searches using the | |
263 | returned regular expression will be case insensitive. | |
264 | ||
265 | **** Constant: regexp/newline | |
266 | Match-any-character operators don't match a newline. | |
267 | ||
268 | A non-matching list ([^...]) not containing a newline matches a | |
269 | newline. | |
270 | ||
271 | Match-beginning-of-line operator (^) matches the empty string | |
272 | immediately after a newline, regardless of whether the FLAGS | |
273 | passed to regexp-exec contain regexp/notbol. | |
274 | ||
275 | Match-end-of-line operator ($) matches the empty string | |
276 | immediately before a newline, regardless of whether the FLAGS | |
277 | passed to regexp-exec contain regexp/noteol. | |
278 | ||
279 | **** Function: regexp-exec REGEXP STR [START [FLAGS]] | |
280 | Match the compiled regular expression REGEXP against `str'. If | |
281 | the optional integer START argument is provided, begin matching | |
282 | from that position in the string. Return a match structure | |
283 | describing the results of the match, or `#f' if no match could be | |
284 | found. | |
285 | ||
286 | FLAGS may be the bitwise-or of one or more of the following: | |
287 | ||
288 | **** Constant: regexp/notbol | |
289 | The match-beginning-of-line operator always fails to match (but | |
290 | see the compilation flag regexp/newline above) This flag may be | |
291 | used when different portions of a string are passed to | |
292 | regexp-exec and the beginning of the string should not be | |
293 | interpreted as the beginning of the line. | |
294 | ||
295 | **** Constant: regexp/noteol | |
296 | The match-end-of-line operator always fails to match (but see the | |
297 | compilation flag regexp/newline above) | |
298 | ||
299 | **** Function: regexp? OBJ | |
300 | Return `#t' if OBJ is a compiled regular expression, or `#f' | |
301 | otherwise. | |
302 | ||
303 | Regular expressions are commonly used to find patterns in one string | |
304 | and replace them with the contents of another string. | |
305 | ||
306 | **** Function: regexp-substitute PORT MATCH [ITEM...] | |
307 | Write to the output port PORT selected contents of the match | |
308 | structure MATCH. Each ITEM specifies what should be written, and | |
309 | may be one of the following arguments: | |
310 | ||
311 | * A string. String arguments are written out verbatim. | |
312 | ||
313 | * An integer. The submatch with that number is written. | |
314 | ||
315 | * The symbol `pre'. The portion of the matched string preceding | |
316 | the regexp match is written. | |
317 | ||
318 | * The symbol `post'. The portion of the matched string | |
319 | following the regexp match is written. | |
320 | ||
321 | PORT may be `#f', in which case nothing is written; instead, | |
322 | `regexp-substitute' constructs a string from the specified ITEMs | |
323 | and returns that. | |
324 | ||
325 | **** Function: regexp-substitute/global PORT REGEXP TARGET [ITEM...] | |
326 | Similar to `regexp-substitute', but can be used to perform global | |
327 | substitutions on STR. Instead of taking a match structure as an | |
328 | argument, `regexp-substitute/global' takes two string arguments: a | |
329 | REGEXP string describing a regular expression, and a TARGET string | |
330 | which should be matched against this regular expression. | |
331 | ||
332 | Each ITEM behaves as in REGEXP-SUBSTITUTE, with the following | |
333 | exceptions: | |
334 | ||
335 | * A function may be supplied. When this function is called, it | |
336 | will be passed one argument: a match structure for a given | |
337 | regular expression match. It should return a string to be | |
338 | written out to PORT. | |
339 | ||
340 | * The `post' symbol causes `regexp-substitute/global' to recurse | |
341 | on the unmatched portion of STR. This *must* be supplied in | |
342 | order to perform global search-and-replace on STR; if it is | |
343 | not present among the ITEMs, then `regexp-substitute/global' | |
344 | will return after processing a single match. | |
345 | ||
346 | *** Match Structures | |
347 | ||
348 | A "match structure" is the object returned by `string-match' and | |
349 | `regexp-exec'. It describes which portion of a string, if any, matched | |
350 | the given regular expression. Match structures include: a reference to | |
351 | the string that was checked for matches; the starting and ending | |
352 | positions of the regexp match; and, if the regexp included any | |
353 | parenthesized subexpressions, the starting and ending positions of each | |
354 | submatch. | |
355 | ||
356 | In each of the regexp match functions described below, the `match' | |
357 | argument must be a match structure returned by a previous call to | |
358 | `string-match' or `regexp-exec'. Most of these functions return some | |
359 | information about the original target string that was matched against a | |
360 | regular expression; we will call that string TARGET for easy reference. | |
361 | ||
362 | **** Function: regexp-match? OBJ | |
363 | Return `#t' if OBJ is a match structure returned by a previous | |
364 | call to `regexp-exec', or `#f' otherwise. | |
365 | ||
366 | **** Function: match:substring MATCH [N] | |
367 | Return the portion of TARGET matched by subexpression number N. | |
368 | Submatch 0 (the default) represents the entire regexp match. If | |
369 | the regular expression as a whole matched, but the subexpression | |
370 | number N did not match, return `#f'. | |
371 | ||
372 | **** Function: match:start MATCH [N] | |
373 | Return the starting position of submatch number N. | |
374 | ||
375 | **** Function: match:end MATCH [N] | |
376 | Return the ending position of submatch number N. | |
377 | ||
378 | **** Function: match:prefix MATCH | |
379 | Return the unmatched portion of TARGET preceding the regexp match. | |
380 | ||
381 | **** Function: match:suffix MATCH | |
382 | Return the unmatched portion of TARGET following the regexp match. | |
383 | ||
384 | **** Function: match:count MATCH | |
385 | Return the number of parenthesized subexpressions from MATCH. | |
386 | Note that the entire regular expression match itself counts as a | |
387 | subexpression, and failed submatches are included in the count. | |
388 | ||
389 | **** Function: match:string MATCH | |
390 | Return the original TARGET string. | |
391 | ||
392 | *** Backslash Escapes | |
393 | ||
394 | Sometimes you will want a regexp to match characters like `*' or `$' | |
395 | exactly. For example, to check whether a particular string represents | |
396 | a menu entry from an Info node, it would be useful to match it against | |
397 | a regexp like `^* [^:]*::'. However, this won't work; because the | |
398 | asterisk is a metacharacter, it won't match the `*' at the beginning of | |
399 | the string. In this case, we want to make the first asterisk un-magic. | |
400 | ||
401 | You can do this by preceding the metacharacter with a backslash | |
402 | character `\'. (This is also called "quoting" the metacharacter, and | |
403 | is known as a "backslash escape".) When Guile sees a backslash in a | |
404 | regular expression, it considers the following glyph to be an ordinary | |
405 | character, no matter what special meaning it would ordinarily have. | |
406 | Therefore, we can make the above example work by changing the regexp to | |
407 | `^\* [^:]*::'. The `\*' sequence tells the regular expression engine | |
408 | to match only a single asterisk in the target string. | |
409 | ||
410 | Since the backslash is itself a metacharacter, you may force a | |
411 | regexp to match a backslash in the target string by preceding the | |
412 | backslash with itself. For example, to find variable references in a | |
413 | TeX program, you might want to find occurrences of the string `\let\' | |
414 | followed by any number of alphabetic characters. The regular expression | |
415 | `\\let\\[A-Za-z]*' would do this: the double backslashes in the regexp | |
416 | each match a single backslash in the target string. | |
417 | ||
418 | **** Function: regexp-quote STR | |
419 | Quote each special character found in STR with a backslash, and | |
420 | return the resulting string. | |
421 | ||
422 | *Very important:* Using backslash escapes in Guile source code (as | |
423 | in Emacs Lisp or C) can be tricky, because the backslash character has | |
424 | special meaning for the Guile reader. For example, if Guile encounters | |
425 | the character sequence `\n' in the middle of a string while processing | |
426 | Scheme code, it replaces those characters with a newline character. | |
427 | Similarly, the character sequence `\t' is replaced by a horizontal tab. | |
428 | Several of these "escape sequences" are processed by the Guile reader | |
429 | before your code is executed. Unrecognized escape sequences are | |
430 | ignored: if the characters `\*' appear in a string, they will be | |
431 | translated to the single character `*'. | |
432 | ||
433 | This translation is obviously undesirable for regular expressions, | |
434 | since we want to be able to include backslashes in a string in order to | |
435 | escape regexp metacharacters. Therefore, to make sure that a backslash | |
436 | is preserved in a string in your Guile program, you must use *two* | |
437 | consecutive backslashes: | |
438 | ||
439 | (define Info-menu-entry-pattern (make-regexp "^\\* [^:]*")) | |
440 | ||
441 | The string in this example is preprocessed by the Guile reader before | |
442 | any code is executed. The resulting argument to `make-regexp' is the | |
443 | string `^\* [^:]*', which is what we really want. | |
444 | ||
445 | This also means that in order to write a regular expression that | |
446 | matches a single backslash character, the regular expression string in | |
447 | the source code must include *four* backslashes. Each consecutive pair | |
448 | of backslashes gets translated by the Guile reader to a single | |
449 | backslash, and the resulting double-backslash is interpreted by the | |
450 | regexp engine as matching a single backslash character. Hence: | |
451 | ||
452 | (define tex-variable-pattern (make-regexp "\\\\let\\\\=[A-Za-z]*")) | |
453 | ||
454 | The reason for the unwieldiness of this syntax is historical. Both | |
455 | regular expression pattern matchers and Unix string processing systems | |
456 | have traditionally used backslashes with the special meanings described | |
457 | above. The POSIX regular expression specification and ANSI C standard | |
458 | both require these semantics. Attempting to abandon either convention | |
459 | would cause other kinds of compatibility problems, possibly more severe | |
460 | ones. Therefore, without extending the Scheme reader to support | |
461 | strings with different quoting conventions (an ungainly and confusing | |
462 | extension when implemented in other languages), we must adhere to this | |
463 | cumbersome escape syntax. | |
464 | ||
7ad3c1e7 GH |
465 | * Changes to the gh_ interface |
466 | ||
467 | * Changes to the scm_ interface | |
468 | ||
469 | * Changes to system call interfaces: | |
94982a4e | 470 | |
7ad3c1e7 | 471 | ** The value returned by `raise' is now unspecified. It throws an exception |
e1a191a8 GH |
472 | if an error occurs. |
473 | ||
94982a4e | 474 | *** A new procedure `sigaction' can be used to install signal handlers |
115b09a5 GH |
475 | |
476 | (sigaction signum [action] [flags]) | |
477 | ||
478 | signum is the signal number, which can be specified using the value | |
479 | of SIGINT etc. | |
480 | ||
481 | If action is omitted, sigaction returns a pair: the CAR is the current | |
482 | signal hander, which will be either an integer with the value SIG_DFL | |
483 | (default action) or SIG_IGN (ignore), or the Scheme procedure which | |
484 | handles the signal, or #f if a non-Scheme procedure handles the | |
485 | signal. The CDR contains the current sigaction flags for the handler. | |
486 | ||
487 | If action is provided, it is installed as the new handler for signum. | |
488 | action can be a Scheme procedure taking one argument, or the value of | |
489 | SIG_DFL (default action) or SIG_IGN (ignore), or #f to restore | |
490 | whatever signal handler was installed before sigaction was first used. | |
491 | Flags can optionally be specified for the new handler (SA_RESTART is | |
492 | always used if the system provides it, so need not be specified.) The | |
493 | return value is a pair with information about the old handler as | |
494 | described above. | |
495 | ||
496 | This interface does not provide access to the "signal blocking" | |
497 | facility. Maybe this is not needed, since the thread support may | |
498 | provide solutions to the problem of consistent access to data | |
499 | structures. | |
e1a191a8 | 500 | |
94982a4e | 501 | *** A new procedure `flush-all-ports' is equivalent to running |
89ea5b7c GH |
502 | `force-output' on every port open for output. |
503 | ||
94982a4e JB |
504 | ** Guile now provides information on how it was built, via the new |
505 | global variable, %guile-build-info. This variable records the values | |
506 | of the standard GNU makefile directory variables as an assocation | |
507 | list, mapping variable names (symbols) onto directory paths (strings). | |
508 | For example, to find out where the Guile link libraries were | |
509 | installed, you can say: | |
510 | ||
511 | guile -c "(display (assq-ref %guile-build-info 'libdir)) (newline)" | |
512 | ||
513 | ||
514 | * Changes to the scm_ interface | |
515 | ||
516 | ** The new function scm_handle_by_message_noexit is just like the | |
517 | existing scm_handle_by_message function, except that it doesn't call | |
518 | exit to terminate the process. Instead, it prints a message and just | |
519 | returns #f. This might be a more appropriate catch-all handler for | |
520 | new dynamic roots and threads. | |
521 | ||
cf78e9e8 | 522 | \f |
c484bf7f | 523 | Changes in Guile 1.1 (released Friday, May 16 1997): |
f3b1485f JB |
524 | |
525 | * Changes to the distribution. | |
526 | ||
527 | The Guile 1.0 distribution has been split up into several smaller | |
528 | pieces: | |
529 | guile-core --- the Guile interpreter itself. | |
530 | guile-tcltk --- the interface between the Guile interpreter and | |
531 | Tcl/Tk; Tcl is an interpreter for a stringy language, and Tk | |
532 | is a toolkit for building graphical user interfaces. | |
533 | guile-rgx-ctax --- the interface between Guile and the Rx regular | |
534 | expression matcher, and the translator for the Ctax | |
535 | programming language. These are packaged together because the | |
536 | Ctax translator uses Rx to parse Ctax source code. | |
537 | ||
095936d2 JB |
538 | This NEWS file describes the changes made to guile-core since the 1.0 |
539 | release. | |
540 | ||
48d224d7 JB |
541 | We no longer distribute the documentation, since it was either out of |
542 | date, or incomplete. As soon as we have current documentation, we | |
543 | will distribute it. | |
544 | ||
0fcab5ed JB |
545 | |
546 | ||
f3b1485f JB |
547 | * Changes to the stand-alone interpreter |
548 | ||
48d224d7 JB |
549 | ** guile now accepts command-line arguments compatible with SCSH, Olin |
550 | Shivers' Scheme Shell. | |
551 | ||
552 | In general, arguments are evaluated from left to right, but there are | |
553 | exceptions. The following switches stop argument processing, and | |
554 | stash all remaining command-line arguments as the value returned by | |
555 | the (command-line) function. | |
556 | -s SCRIPT load Scheme source code from FILE, and exit | |
557 | -c EXPR evalute Scheme expression EXPR, and exit | |
558 | -- stop scanning arguments; run interactively | |
559 | ||
560 | The switches below are processed as they are encountered. | |
561 | -l FILE load Scheme source code from FILE | |
562 | -e FUNCTION after reading script, apply FUNCTION to | |
563 | command line arguments | |
564 | -ds do -s script at this point | |
565 | --emacs enable Emacs protocol (experimental) | |
566 | -h, --help display this help and exit | |
567 | -v, --version display version information and exit | |
568 | \ read arguments from following script lines | |
569 | ||
570 | So, for example, here is a Guile script named `ekko' (thanks, Olin) | |
571 | which re-implements the traditional "echo" command: | |
572 | ||
573 | #!/usr/local/bin/guile -s | |
574 | !# | |
575 | (define (main args) | |
576 | (map (lambda (arg) (display arg) (display " ")) | |
577 | (cdr args)) | |
578 | (newline)) | |
579 | ||
580 | (main (command-line)) | |
581 | ||
582 | Suppose we invoke this script as follows: | |
583 | ||
584 | ekko a speckled gecko | |
585 | ||
586 | Through the magic of Unix script processing (triggered by the `#!' | |
587 | token at the top of the file), /usr/local/bin/guile receives the | |
588 | following list of command-line arguments: | |
589 | ||
590 | ("-s" "./ekko" "a" "speckled" "gecko") | |
591 | ||
592 | Unix inserts the name of the script after the argument specified on | |
593 | the first line of the file (in this case, "-s"), and then follows that | |
594 | with the arguments given to the script. Guile loads the script, which | |
595 | defines the `main' function, and then applies it to the list of | |
596 | remaining command-line arguments, ("a" "speckled" "gecko"). | |
597 | ||
095936d2 JB |
598 | In Unix, the first line of a script file must take the following form: |
599 | ||
600 | #!INTERPRETER ARGUMENT | |
601 | ||
602 | where INTERPRETER is the absolute filename of the interpreter | |
603 | executable, and ARGUMENT is a single command-line argument to pass to | |
604 | the interpreter. | |
605 | ||
606 | You may only pass one argument to the interpreter, and its length is | |
607 | limited. These restrictions can be annoying to work around, so Guile | |
608 | provides a general mechanism (borrowed from, and compatible with, | |
609 | SCSH) for circumventing them. | |
610 | ||
611 | If the ARGUMENT in a Guile script is a single backslash character, | |
612 | `\', Guile will open the script file, parse arguments from its second | |
613 | and subsequent lines, and replace the `\' with them. So, for example, | |
614 | here is another implementation of the `ekko' script: | |
615 | ||
616 | #!/usr/local/bin/guile \ | |
617 | -e main -s | |
618 | !# | |
619 | (define (main args) | |
620 | (for-each (lambda (arg) (display arg) (display " ")) | |
621 | (cdr args)) | |
622 | (newline)) | |
623 | ||
624 | If the user invokes this script as follows: | |
625 | ||
626 | ekko a speckled gecko | |
627 | ||
628 | Unix expands this into | |
629 | ||
630 | /usr/local/bin/guile \ ekko a speckled gecko | |
631 | ||
632 | When Guile sees the `\' argument, it replaces it with the arguments | |
633 | read from the second line of the script, producing: | |
634 | ||
635 | /usr/local/bin/guile -e main -s ekko a speckled gecko | |
636 | ||
637 | This tells Guile to load the `ekko' script, and apply the function | |
638 | `main' to the argument list ("a" "speckled" "gecko"). | |
639 | ||
640 | Here is how Guile parses the command-line arguments: | |
641 | - Each space character terminates an argument. This means that two | |
642 | spaces in a row introduce an empty-string argument. | |
643 | - The tab character is not permitted (unless you quote it with the | |
644 | backslash character, as described below), to avoid confusion. | |
645 | - The newline character terminates the sequence of arguments, and will | |
646 | also terminate a final non-empty argument. (However, a newline | |
647 | following a space will not introduce a final empty-string argument; | |
648 | it only terminates the argument list.) | |
649 | - The backslash character is the escape character. It escapes | |
650 | backslash, space, tab, and newline. The ANSI C escape sequences | |
651 | like \n and \t are also supported. These produce argument | |
652 | constituents; the two-character combination \n doesn't act like a | |
653 | terminating newline. The escape sequence \NNN for exactly three | |
654 | octal digits reads as the character whose ASCII code is NNN. As | |
655 | above, characters produced this way are argument constituents. | |
656 | Backslash followed by other characters is not allowed. | |
657 | ||
48d224d7 JB |
658 | * Changes to the procedure for linking libguile with your programs |
659 | ||
660 | ** Guile now builds and installs a shared guile library, if your | |
661 | system support shared libraries. (It still builds a static library on | |
662 | all systems.) Guile automatically detects whether your system | |
663 | supports shared libraries. To prevent Guile from buildisg shared | |
664 | libraries, pass the `--disable-shared' flag to the configure script. | |
665 | ||
666 | Guile takes longer to compile when it builds shared libraries, because | |
667 | it must compile every file twice --- once to produce position- | |
668 | independent object code, and once to produce normal object code. | |
669 | ||
670 | ** The libthreads library has been merged into libguile. | |
671 | ||
672 | To link a program against Guile, you now need only link against | |
673 | -lguile and -lqt; -lthreads is no longer needed. If you are using | |
674 | autoconf to generate configuration scripts for your application, the | |
675 | following lines should suffice to add the appropriate libraries to | |
676 | your link command: | |
677 | ||
678 | ### Find quickthreads and libguile. | |
679 | AC_CHECK_LIB(qt, main) | |
680 | AC_CHECK_LIB(guile, scm_shell) | |
f3b1485f JB |
681 | |
682 | * Changes to Scheme functions | |
683 | ||
095936d2 JB |
684 | ** Guile Scheme's special syntax for keyword objects is now optional, |
685 | and disabled by default. | |
686 | ||
687 | The syntax variation from R4RS made it difficult to port some | |
688 | interesting packages to Guile. The routines which accepted keyword | |
689 | arguments (mostly in the module system) have been modified to also | |
690 | accept symbols whose names begin with `:'. | |
691 | ||
692 | To change the keyword syntax, you must first import the (ice-9 debug) | |
693 | module: | |
694 | (use-modules (ice-9 debug)) | |
695 | ||
696 | Then you can enable the keyword syntax as follows: | |
697 | (read-set! keywords 'prefix) | |
698 | ||
699 | To disable keyword syntax, do this: | |
700 | (read-set! keywords #f) | |
701 | ||
702 | ** Many more primitive functions accept shared substrings as | |
703 | arguments. In the past, these functions required normal, mutable | |
704 | strings as arguments, although they never made use of this | |
705 | restriction. | |
706 | ||
707 | ** The uniform array functions now operate on byte vectors. These | |
708 | functions are `array-fill!', `serial-array-copy!', `array-copy!', | |
709 | `serial-array-map', `array-map', `array-for-each', and | |
710 | `array-index-map!'. | |
711 | ||
712 | ** The new functions `trace' and `untrace' implement simple debugging | |
713 | support for Scheme functions. | |
714 | ||
715 | The `trace' function accepts any number of procedures as arguments, | |
716 | and tells the Guile interpreter to display each procedure's name and | |
717 | arguments each time the procedure is invoked. When invoked with no | |
718 | arguments, `trace' returns the list of procedures currently being | |
719 | traced. | |
720 | ||
721 | The `untrace' function accepts any number of procedures as arguments, | |
722 | and tells the Guile interpreter not to trace them any more. When | |
723 | invoked with no arguments, `untrace' untraces all curretly traced | |
724 | procedures. | |
725 | ||
726 | The tracing in Guile has an advantage over most other systems: we | |
727 | don't create new procedure objects, but mark the procedure objects | |
728 | themselves. This means that anonymous and internal procedures can be | |
729 | traced. | |
730 | ||
731 | ** The function `assert-repl-prompt' has been renamed to | |
732 | `set-repl-prompt!'. It takes one argument, PROMPT. | |
733 | - If PROMPT is #f, the Guile read-eval-print loop will not prompt. | |
734 | - If PROMPT is a string, we use it as a prompt. | |
735 | - If PROMPT is a procedure accepting no arguments, we call it, and | |
736 | display the result as a prompt. | |
737 | - Otherwise, we display "> ". | |
738 | ||
739 | ** The new function `eval-string' reads Scheme expressions from a | |
740 | string and evaluates them, returning the value of the last expression | |
741 | in the string. If the string contains no expressions, it returns an | |
742 | unspecified value. | |
743 | ||
744 | ** The new function `thunk?' returns true iff its argument is a | |
745 | procedure of zero arguments. | |
746 | ||
747 | ** `defined?' is now a builtin function, instead of syntax. This | |
748 | means that its argument should be quoted. It returns #t iff its | |
749 | argument is bound in the current module. | |
750 | ||
751 | ** The new syntax `use-modules' allows you to add new modules to your | |
752 | environment without re-typing a complete `define-module' form. It | |
753 | accepts any number of module names as arguments, and imports their | |
754 | public bindings into the current module. | |
755 | ||
756 | ** The new function (module-defined? NAME MODULE) returns true iff | |
757 | NAME, a symbol, is defined in MODULE, a module object. | |
758 | ||
759 | ** The new function `builtin-bindings' creates and returns a hash | |
760 | table containing copies of all the root module's bindings. | |
761 | ||
762 | ** The new function `builtin-weak-bindings' does the same as | |
763 | `builtin-bindings', but creates a doubly-weak hash table. | |
764 | ||
765 | ** The `equal?' function now considers variable objects to be | |
766 | equivalent if they have the same name and the same value. | |
767 | ||
768 | ** The new function `command-line' returns the command-line arguments | |
769 | given to Guile, as a list of strings. | |
770 | ||
771 | When using guile as a script interpreter, `command-line' returns the | |
772 | script's arguments; those processed by the interpreter (like `-s' or | |
773 | `-c') are omitted. (In other words, you get the normal, expected | |
774 | behavior.) Any application that uses scm_shell to process its | |
775 | command-line arguments gets this behavior as well. | |
776 | ||
777 | ** The new function `load-user-init' looks for a file called `.guile' | |
778 | in the user's home directory, and loads it if it exists. This is | |
779 | mostly for use by the code generated by scm_compile_shell_switches, | |
780 | but we thought it might also be useful in other circumstances. | |
781 | ||
782 | ** The new function `log10' returns the base-10 logarithm of its | |
783 | argument. | |
784 | ||
785 | ** Changes to I/O functions | |
786 | ||
787 | *** The functions `read', `primitive-load', `read-and-eval!', and | |
788 | `primitive-load-path' no longer take optional arguments controlling | |
789 | case insensitivity and a `#' parser. | |
790 | ||
791 | Case sensitivity is now controlled by a read option called | |
792 | `case-insensitive'. The user can add new `#' syntaxes with the | |
793 | `read-hash-extend' function (see below). | |
794 | ||
795 | *** The new function `read-hash-extend' allows the user to change the | |
796 | syntax of Guile Scheme in a somewhat controlled way. | |
797 | ||
798 | (read-hash-extend CHAR PROC) | |
799 | When parsing S-expressions, if we read a `#' character followed by | |
800 | the character CHAR, use PROC to parse an object from the stream. | |
801 | If PROC is #f, remove any parsing procedure registered for CHAR. | |
802 | ||
803 | The reader applies PROC to two arguments: CHAR and an input port. | |
804 | ||
805 | *** The new functions read-delimited and read-delimited! provide a | |
806 | general mechanism for doing delimited input on streams. | |
807 | ||
808 | (read-delimited DELIMS [PORT HANDLE-DELIM]) | |
809 | Read until we encounter one of the characters in DELIMS (a string), | |
810 | or end-of-file. PORT is the input port to read from; it defaults to | |
811 | the current input port. The HANDLE-DELIM parameter determines how | |
812 | the terminating character is handled; it should be one of the | |
813 | following symbols: | |
814 | ||
815 | 'trim omit delimiter from result | |
816 | 'peek leave delimiter character in input stream | |
817 | 'concat append delimiter character to returned value | |
818 | 'split return a pair: (RESULT . TERMINATOR) | |
819 | ||
820 | HANDLE-DELIM defaults to 'peek. | |
821 | ||
822 | (read-delimited! DELIMS BUF [PORT HANDLE-DELIM START END]) | |
823 | A side-effecting variant of `read-delimited'. | |
824 | ||
825 | The data is written into the string BUF at the indices in the | |
826 | half-open interval [START, END); the default interval is the whole | |
827 | string: START = 0 and END = (string-length BUF). The values of | |
828 | START and END must specify a well-defined interval in BUF, i.e. | |
829 | 0 <= START <= END <= (string-length BUF). | |
830 | ||
831 | It returns NBYTES, the number of bytes read. If the buffer filled | |
832 | up without a delimiter character being found, it returns #f. If the | |
833 | port is at EOF when the read starts, it returns the EOF object. | |
834 | ||
835 | If an integer is returned (i.e., the read is successfully terminated | |
836 | by reading a delimiter character), then the HANDLE-DELIM parameter | |
837 | determines how to handle the terminating character. It is described | |
838 | above, and defaults to 'peek. | |
839 | ||
840 | (The descriptions of these functions were borrowed from the SCSH | |
841 | manual, by Olin Shivers and Brian Carlstrom.) | |
842 | ||
843 | *** The `%read-delimited!' function is the primitive used to implement | |
844 | `read-delimited' and `read-delimited!'. | |
845 | ||
846 | (%read-delimited! DELIMS BUF GOBBLE? [PORT START END]) | |
847 | ||
848 | This returns a pair of values: (TERMINATOR . NUM-READ). | |
849 | - TERMINATOR describes why the read was terminated. If it is a | |
850 | character or the eof object, then that is the value that terminated | |
851 | the read. If it is #f, the function filled the buffer without finding | |
852 | a delimiting character. | |
853 | - NUM-READ is the number of characters read into BUF. | |
854 | ||
855 | If the read is successfully terminated by reading a delimiter | |
856 | character, then the gobble? parameter determines what to do with the | |
857 | terminating character. If true, the character is removed from the | |
858 | input stream; if false, the character is left in the input stream | |
859 | where a subsequent read operation will retrieve it. In either case, | |
860 | the character is also the first value returned by the procedure call. | |
861 | ||
862 | (The descriptions of this function was borrowed from the SCSH manual, | |
863 | by Olin Shivers and Brian Carlstrom.) | |
864 | ||
865 | *** The `read-line' and `read-line!' functions have changed; they now | |
866 | trim the terminator by default; previously they appended it to the | |
867 | returned string. For the old behavior, use (read-line PORT 'concat). | |
868 | ||
869 | *** The functions `uniform-array-read!' and `uniform-array-write!' now | |
870 | take new optional START and END arguments, specifying the region of | |
871 | the array to read and write. | |
872 | ||
f348c807 JB |
873 | *** The `ungetc-char-ready?' function has been removed. We feel it's |
874 | inappropriate for an interface to expose implementation details this | |
875 | way. | |
095936d2 JB |
876 | |
877 | ** Changes to the Unix library and system call interface | |
878 | ||
879 | *** The new fcntl function provides access to the Unix `fcntl' system | |
880 | call. | |
881 | ||
882 | (fcntl PORT COMMAND VALUE) | |
883 | Apply COMMAND to PORT's file descriptor, with VALUE as an argument. | |
884 | Values for COMMAND are: | |
885 | ||
886 | F_DUPFD duplicate a file descriptor | |
887 | F_GETFD read the descriptor's close-on-exec flag | |
888 | F_SETFD set the descriptor's close-on-exec flag to VALUE | |
889 | F_GETFL read the descriptor's flags, as set on open | |
890 | F_SETFL set the descriptor's flags, as set on open to VALUE | |
891 | F_GETOWN return the process ID of a socket's owner, for SIGIO | |
892 | F_SETOWN set the process that owns a socket to VALUE, for SIGIO | |
893 | FD_CLOEXEC not sure what this is | |
894 | ||
895 | For details, see the documentation for the fcntl system call. | |
896 | ||
897 | *** The arguments to `select' have changed, for compatibility with | |
898 | SCSH. The TIMEOUT parameter may now be non-integral, yielding the | |
899 | expected behavior. The MILLISECONDS parameter has been changed to | |
900 | MICROSECONDS, to more closely resemble the underlying system call. | |
901 | The RVEC, WVEC, and EVEC arguments can now be vectors; the type of the | |
902 | corresponding return set will be the same. | |
903 | ||
904 | *** The arguments to the `mknod' system call have changed. They are | |
905 | now: | |
906 | ||
907 | (mknod PATH TYPE PERMS DEV) | |
908 | Create a new file (`node') in the file system. PATH is the name of | |
909 | the file to create. TYPE is the kind of file to create; it should | |
910 | be 'fifo, 'block-special, or 'char-special. PERMS specifies the | |
911 | permission bits to give the newly created file. If TYPE is | |
912 | 'block-special or 'char-special, DEV specifies which device the | |
913 | special file refers to; its interpretation depends on the kind of | |
914 | special file being created. | |
915 | ||
916 | *** The `fork' function has been renamed to `primitive-fork', to avoid | |
917 | clashing with various SCSH forks. | |
918 | ||
919 | *** The `recv' and `recvfrom' functions have been renamed to `recv!' | |
920 | and `recvfrom!'. They no longer accept a size for a second argument; | |
921 | you must pass a string to hold the received value. They no longer | |
922 | return the buffer. Instead, `recv' returns the length of the message | |
923 | received, and `recvfrom' returns a pair containing the packet's length | |
924 | and originating address. | |
925 | ||
926 | *** The file descriptor datatype has been removed, as have the | |
927 | `read-fd', `write-fd', `close', `lseek', and `dup' functions. | |
928 | We plan to replace these functions with a SCSH-compatible interface. | |
929 | ||
930 | *** The `create' function has been removed; it's just a special case | |
931 | of `open'. | |
932 | ||
933 | *** There are new functions to break down process termination status | |
934 | values. In the descriptions below, STATUS is a value returned by | |
935 | `waitpid'. | |
936 | ||
937 | (status:exit-val STATUS) | |
938 | If the child process exited normally, this function returns the exit | |
939 | code for the child process (i.e., the value passed to exit, or | |
940 | returned from main). If the child process did not exit normally, | |
941 | this function returns #f. | |
942 | ||
943 | (status:stop-sig STATUS) | |
944 | If the child process was suspended by a signal, this function | |
945 | returns the signal that suspended the child. Otherwise, it returns | |
946 | #f. | |
947 | ||
948 | (status:term-sig STATUS) | |
949 | If the child process terminated abnormally, this function returns | |
950 | the signal that terminated the child. Otherwise, this function | |
951 | returns false. | |
952 | ||
953 | POSIX promises that exactly one of these functions will return true on | |
954 | a valid STATUS value. | |
955 | ||
956 | These functions are compatible with SCSH. | |
957 | ||
958 | *** There are new accessors and setters for the broken-out time vectors | |
48d224d7 JB |
959 | returned by `localtime', `gmtime', and that ilk. They are: |
960 | ||
961 | Component Accessor Setter | |
962 | ========================= ============ ============ | |
963 | seconds tm:sec set-tm:sec | |
964 | minutes tm:min set-tm:min | |
965 | hours tm:hour set-tm:hour | |
966 | day of the month tm:mday set-tm:mday | |
967 | month tm:mon set-tm:mon | |
968 | year tm:year set-tm:year | |
969 | day of the week tm:wday set-tm:wday | |
970 | day in the year tm:yday set-tm:yday | |
971 | daylight saving time tm:isdst set-tm:isdst | |
972 | GMT offset, seconds tm:gmtoff set-tm:gmtoff | |
973 | name of time zone tm:zone set-tm:zone | |
974 | ||
095936d2 JB |
975 | *** There are new accessors for the vectors returned by `uname', |
976 | describing the host system: | |
48d224d7 JB |
977 | |
978 | Component Accessor | |
979 | ============================================== ================ | |
980 | name of the operating system implementation utsname:sysname | |
981 | network name of this machine utsname:nodename | |
982 | release level of the operating system utsname:release | |
983 | version level of the operating system utsname:version | |
984 | machine hardware platform utsname:machine | |
985 | ||
095936d2 JB |
986 | *** There are new accessors for the vectors returned by `getpw', |
987 | `getpwnam', `getpwuid', and `getpwent', describing entries from the | |
988 | system's user database: | |
989 | ||
990 | Component Accessor | |
991 | ====================== ================= | |
992 | user name passwd:name | |
993 | user password passwd:passwd | |
994 | user id passwd:uid | |
995 | group id passwd:gid | |
996 | real name passwd:gecos | |
997 | home directory passwd:dir | |
998 | shell program passwd:shell | |
999 | ||
1000 | *** There are new accessors for the vectors returned by `getgr', | |
1001 | `getgrnam', `getgrgid', and `getgrent', describing entries from the | |
1002 | system's group database: | |
1003 | ||
1004 | Component Accessor | |
1005 | ======================= ============ | |
1006 | group name group:name | |
1007 | group password group:passwd | |
1008 | group id group:gid | |
1009 | group members group:mem | |
1010 | ||
1011 | *** There are new accessors for the vectors returned by `gethost', | |
1012 | `gethostbyaddr', `gethostbyname', and `gethostent', describing | |
1013 | internet hosts: | |
1014 | ||
1015 | Component Accessor | |
1016 | ========================= =============== | |
1017 | official name of host hostent:name | |
1018 | alias list hostent:aliases | |
1019 | host address type hostent:addrtype | |
1020 | length of address hostent:length | |
1021 | list of addresses hostent:addr-list | |
1022 | ||
1023 | *** There are new accessors for the vectors returned by `getnet', | |
1024 | `getnetbyaddr', `getnetbyname', and `getnetent', describing internet | |
1025 | networks: | |
1026 | ||
1027 | Component Accessor | |
1028 | ========================= =============== | |
1029 | official name of net netent:name | |
1030 | alias list netent:aliases | |
1031 | net number type netent:addrtype | |
1032 | net number netent:net | |
1033 | ||
1034 | *** There are new accessors for the vectors returned by `getproto', | |
1035 | `getprotobyname', `getprotobynumber', and `getprotoent', describing | |
1036 | internet protocols: | |
1037 | ||
1038 | Component Accessor | |
1039 | ========================= =============== | |
1040 | official protocol name protoent:name | |
1041 | alias list protoent:aliases | |
1042 | protocol number protoent:proto | |
1043 | ||
1044 | *** There are new accessors for the vectors returned by `getserv', | |
1045 | `getservbyname', `getservbyport', and `getservent', describing | |
1046 | internet protocols: | |
1047 | ||
1048 | Component Accessor | |
1049 | ========================= =============== | |
1050 | official service name servent:name | |
1051 | alias list servent:aliases | |
1052 | port number servent:port | |
1053 | protocol to use servent:proto | |
1054 | ||
1055 | *** There are new accessors for the sockaddr structures returned by | |
1056 | `accept', `getsockname', `getpeername', `recvfrom!': | |
1057 | ||
1058 | Component Accessor | |
1059 | ======================================== =============== | |
1060 | address format (`family') sockaddr:fam | |
1061 | path, for file domain addresses sockaddr:path | |
1062 | address, for internet domain addresses sockaddr:addr | |
1063 | TCP or UDP port, for internet sockaddr:port | |
1064 | ||
1065 | *** The `getpwent', `getgrent', `gethostent', `getnetent', | |
1066 | `getprotoent', and `getservent' functions now return #f at the end of | |
1067 | the user database. (They used to throw an exception.) | |
1068 | ||
1069 | Note that calling MUMBLEent function is equivalent to calling the | |
1070 | corresponding MUMBLE function with no arguments. | |
1071 | ||
1072 | *** The `setpwent', `setgrent', `sethostent', `setnetent', | |
1073 | `setprotoent', and `setservent' routines now take no arguments. | |
1074 | ||
1075 | *** The `gethost', `getproto', `getnet', and `getserv' functions now | |
1076 | provide more useful information when they throw an exception. | |
1077 | ||
1078 | *** The `lnaof' function has been renamed to `inet-lnaof'. | |
1079 | ||
1080 | *** Guile now claims to have the `current-time' feature. | |
1081 | ||
1082 | *** The `mktime' function now takes an optional second argument ZONE, | |
1083 | giving the time zone to use for the conversion. ZONE should be a | |
1084 | string, in the same format as expected for the "TZ" environment variable. | |
1085 | ||
1086 | *** The `strptime' function now returns a pair (TIME . COUNT), where | |
1087 | TIME is the parsed time as a vector, and COUNT is the number of | |
1088 | characters from the string left unparsed. This function used to | |
1089 | return the remaining characters as a string. | |
1090 | ||
1091 | *** The `gettimeofday' function has replaced the old `time+ticks' function. | |
1092 | The return value is now (SECONDS . MICROSECONDS); the fractional | |
1093 | component is no longer expressed in "ticks". | |
1094 | ||
1095 | *** The `ticks/sec' constant has been removed, in light of the above change. | |
6685dc83 | 1096 | |
ea00ecba MG |
1097 | * Changes to the gh_ interface |
1098 | ||
1099 | ** gh_eval_str() now returns an SCM object which is the result of the | |
1100 | evaluation | |
1101 | ||
aaef0d2a MG |
1102 | ** gh_scm2str() now copies the Scheme data to a caller-provided C |
1103 | array | |
1104 | ||
1105 | ** gh_scm2newstr() now makes a C array, copies the Scheme data to it, | |
1106 | and returns the array | |
1107 | ||
1108 | ** gh_scm2str0() is gone: there is no need to distinguish | |
1109 | null-terminated from non-null-terminated, since gh_scm2newstr() allows | |
1110 | the user to interpret the data both ways. | |
1111 | ||
f3b1485f JB |
1112 | * Changes to the scm_ interface |
1113 | ||
095936d2 JB |
1114 | ** The new function scm_symbol_value0 provides an easy way to get a |
1115 | symbol's value from C code: | |
1116 | ||
1117 | SCM scm_symbol_value0 (char *NAME) | |
1118 | Return the value of the symbol named by the null-terminated string | |
1119 | NAME in the current module. If the symbol named NAME is unbound in | |
1120 | the current module, return SCM_UNDEFINED. | |
1121 | ||
1122 | ** The new function scm_sysintern0 creates new top-level variables, | |
1123 | without assigning them a value. | |
1124 | ||
1125 | SCM scm_sysintern0 (char *NAME) | |
1126 | Create a new Scheme top-level variable named NAME. NAME is a | |
1127 | null-terminated string. Return the variable's value cell. | |
1128 | ||
1129 | ** The function scm_internal_catch is the guts of catch. It handles | |
1130 | all the mechanics of setting up a catch target, invoking the catch | |
1131 | body, and perhaps invoking the handler if the body does a throw. | |
1132 | ||
1133 | The function is designed to be usable from C code, but is general | |
1134 | enough to implement all the semantics Guile Scheme expects from throw. | |
1135 | ||
1136 | TAG is the catch tag. Typically, this is a symbol, but this function | |
1137 | doesn't actually care about that. | |
1138 | ||
1139 | BODY is a pointer to a C function which runs the body of the catch; | |
1140 | this is the code you can throw from. We call it like this: | |
1141 | BODY (BODY_DATA, JMPBUF) | |
1142 | where: | |
1143 | BODY_DATA is just the BODY_DATA argument we received; we pass it | |
1144 | through to BODY as its first argument. The caller can make | |
1145 | BODY_DATA point to anything useful that BODY might need. | |
1146 | JMPBUF is the Scheme jmpbuf object corresponding to this catch, | |
1147 | which we have just created and initialized. | |
1148 | ||
1149 | HANDLER is a pointer to a C function to deal with a throw to TAG, | |
1150 | should one occur. We call it like this: | |
1151 | HANDLER (HANDLER_DATA, THROWN_TAG, THROW_ARGS) | |
1152 | where | |
1153 | HANDLER_DATA is the HANDLER_DATA argument we recevied; it's the | |
1154 | same idea as BODY_DATA above. | |
1155 | THROWN_TAG is the tag that the user threw to; usually this is | |
1156 | TAG, but it could be something else if TAG was #t (i.e., a | |
1157 | catch-all), or the user threw to a jmpbuf. | |
1158 | THROW_ARGS is the list of arguments the user passed to the THROW | |
1159 | function. | |
1160 | ||
1161 | BODY_DATA is just a pointer we pass through to BODY. HANDLER_DATA | |
1162 | is just a pointer we pass through to HANDLER. We don't actually | |
1163 | use either of those pointers otherwise ourselves. The idea is | |
1164 | that, if our caller wants to communicate something to BODY or | |
1165 | HANDLER, it can pass a pointer to it as MUMBLE_DATA, which BODY and | |
1166 | HANDLER can then use. Think of it as a way to make BODY and | |
1167 | HANDLER closures, not just functions; MUMBLE_DATA points to the | |
1168 | enclosed variables. | |
1169 | ||
1170 | Of course, it's up to the caller to make sure that any data a | |
1171 | MUMBLE_DATA needs is protected from GC. A common way to do this is | |
1172 | to make MUMBLE_DATA a pointer to data stored in an automatic | |
1173 | structure variable; since the collector must scan the stack for | |
1174 | references anyway, this assures that any references in MUMBLE_DATA | |
1175 | will be found. | |
1176 | ||
1177 | ** The new function scm_internal_lazy_catch is exactly like | |
1178 | scm_internal_catch, except: | |
1179 | ||
1180 | - It does not unwind the stack (this is the major difference). | |
1181 | - If handler returns, its value is returned from the throw. | |
1182 | - BODY always receives #f as its JMPBUF argument (since there's no | |
1183 | jmpbuf associated with a lazy catch, because we don't unwind the | |
1184 | stack.) | |
1185 | ||
1186 | ** scm_body_thunk is a new body function you can pass to | |
1187 | scm_internal_catch if you want the body to be like Scheme's `catch' | |
1188 | --- a thunk, or a function of one argument if the tag is #f. | |
1189 | ||
1190 | BODY_DATA is a pointer to a scm_body_thunk_data structure, which | |
1191 | contains the Scheme procedure to invoke as the body, and the tag | |
1192 | we're catching. If the tag is #f, then we pass JMPBUF (created by | |
1193 | scm_internal_catch) to the body procedure; otherwise, the body gets | |
1194 | no arguments. | |
1195 | ||
1196 | ** scm_handle_by_proc is a new handler function you can pass to | |
1197 | scm_internal_catch if you want the handler to act like Scheme's catch | |
1198 | --- call a procedure with the tag and the throw arguments. | |
1199 | ||
1200 | If the user does a throw to this catch, this function runs a handler | |
1201 | procedure written in Scheme. HANDLER_DATA is a pointer to an SCM | |
1202 | variable holding the Scheme procedure object to invoke. It ought to | |
1203 | be a pointer to an automatic variable (i.e., one living on the stack), | |
1204 | or the procedure object should be otherwise protected from GC. | |
1205 | ||
1206 | ** scm_handle_by_message is a new handler function to use with | |
1207 | `scm_internal_catch' if you want Guile to print a message and die. | |
1208 | It's useful for dealing with throws to uncaught keys at the top level. | |
1209 | ||
1210 | HANDLER_DATA, if non-zero, is assumed to be a char * pointing to a | |
1211 | message header to print; if zero, we use "guile" instead. That | |
1212 | text is followed by a colon, then the message described by ARGS. | |
1213 | ||
1214 | ** The return type of scm_boot_guile is now void; the function does | |
1215 | not return a value, and indeed, never returns at all. | |
1216 | ||
f3b1485f JB |
1217 | ** The new function scm_shell makes it easy for user applications to |
1218 | process command-line arguments in a way that is compatible with the | |
1219 | stand-alone guile interpreter (which is in turn compatible with SCSH, | |
1220 | the Scheme shell). | |
1221 | ||
1222 | To use the scm_shell function, first initialize any guile modules | |
1223 | linked into your application, and then call scm_shell with the values | |
1224 | of ARGC and ARGV your `main' function received. scm_shell will adding | |
1225 | any SCSH-style meta-arguments from the top of the script file to the | |
1226 | argument vector, and then process the command-line arguments. This | |
1227 | generally means loading a script file or starting up an interactive | |
1228 | command interpreter. For details, see "Changes to the stand-alone | |
1229 | interpreter" above. | |
1230 | ||
095936d2 JB |
1231 | ** The new functions scm_get_meta_args and scm_count_argv help you |
1232 | implement the SCSH-style meta-argument, `\'. | |
1233 | ||
1234 | char **scm_get_meta_args (int ARGC, char **ARGV) | |
1235 | If the second element of ARGV is a string consisting of a single | |
1236 | backslash character (i.e. "\\" in Scheme notation), open the file | |
1237 | named by the following argument, parse arguments from it, and return | |
1238 | the spliced command line. The returned array is terminated by a | |
1239 | null pointer. | |
1240 | ||
1241 | For details of argument parsing, see above, under "guile now accepts | |
1242 | command-line arguments compatible with SCSH..." | |
1243 | ||
1244 | int scm_count_argv (char **ARGV) | |
1245 | Count the arguments in ARGV, assuming it is terminated by a null | |
1246 | pointer. | |
1247 | ||
1248 | For an example of how these functions might be used, see the source | |
1249 | code for the function scm_shell in libguile/script.c. | |
1250 | ||
1251 | You will usually want to use scm_shell instead of calling this | |
1252 | function yourself. | |
1253 | ||
1254 | ** The new function scm_compile_shell_switches turns an array of | |
1255 | command-line arguments into Scheme code to carry out the actions they | |
1256 | describe. Given ARGC and ARGV, it returns a Scheme expression to | |
1257 | evaluate, and calls scm_set_program_arguments to make any remaining | |
1258 | command-line arguments available to the Scheme code. For example, | |
1259 | given the following arguments: | |
1260 | ||
1261 | -e main -s ekko a speckled gecko | |
1262 | ||
1263 | scm_set_program_arguments will return the following expression: | |
1264 | ||
1265 | (begin (load "ekko") (main (command-line)) (quit)) | |
1266 | ||
1267 | You will usually want to use scm_shell instead of calling this | |
1268 | function yourself. | |
1269 | ||
1270 | ** The function scm_shell_usage prints a usage message appropriate for | |
1271 | an interpreter that uses scm_compile_shell_switches to handle its | |
1272 | command-line arguments. | |
1273 | ||
1274 | void scm_shell_usage (int FATAL, char *MESSAGE) | |
1275 | Print a usage message to the standard error output. If MESSAGE is | |
1276 | non-zero, write it before the usage message, followed by a newline. | |
1277 | If FATAL is non-zero, exit the process, using FATAL as the | |
1278 | termination status. (If you want to be compatible with Guile, | |
1279 | always use 1 as the exit status when terminating due to command-line | |
1280 | usage problems.) | |
1281 | ||
1282 | You will usually want to use scm_shell instead of calling this | |
1283 | function yourself. | |
48d224d7 JB |
1284 | |
1285 | ** scm_eval_0str now returns SCM_UNSPECIFIED if the string contains no | |
095936d2 JB |
1286 | expressions. It used to return SCM_EOL. Earth-shattering. |
1287 | ||
1288 | ** The macros for declaring scheme objects in C code have been | |
1289 | rearranged slightly. They are now: | |
1290 | ||
1291 | SCM_SYMBOL (C_NAME, SCHEME_NAME) | |
1292 | Declare a static SCM variable named C_NAME, and initialize it to | |
1293 | point to the Scheme symbol whose name is SCHEME_NAME. C_NAME should | |
1294 | be a C identifier, and SCHEME_NAME should be a C string. | |
1295 | ||
1296 | SCM_GLOBAL_SYMBOL (C_NAME, SCHEME_NAME) | |
1297 | Just like SCM_SYMBOL, but make C_NAME globally visible. | |
1298 | ||
1299 | SCM_VCELL (C_NAME, SCHEME_NAME) | |
1300 | Create a global variable at the Scheme level named SCHEME_NAME. | |
1301 | Declare a static SCM variable named C_NAME, and initialize it to | |
1302 | point to the Scheme variable's value cell. | |
1303 | ||
1304 | SCM_GLOBAL_VCELL (C_NAME, SCHEME_NAME) | |
1305 | Just like SCM_VCELL, but make C_NAME globally visible. | |
1306 | ||
1307 | The `guile-snarf' script writes initialization code for these macros | |
1308 | to its standard output, given C source code as input. | |
1309 | ||
1310 | The SCM_GLOBAL macro is gone. | |
1311 | ||
1312 | ** The scm_read_line and scm_read_line_x functions have been replaced | |
1313 | by Scheme code based on the %read-delimited! procedure (known to C | |
1314 | code as scm_read_delimited_x). See its description above for more | |
1315 | information. | |
48d224d7 | 1316 | |
095936d2 JB |
1317 | ** The function scm_sys_open has been renamed to scm_open. It now |
1318 | returns a port instead of an FD object. | |
ea00ecba | 1319 | |
095936d2 JB |
1320 | * The dynamic linking support has changed. For more information, see |
1321 | libguile/DYNAMIC-LINKING. | |
ea00ecba | 1322 | |
f7b47737 JB |
1323 | \f |
1324 | Guile 1.0b3 | |
3065a62a | 1325 | |
f3b1485f JB |
1326 | User-visible changes from Thursday, September 5, 1996 until Guile 1.0 |
1327 | (Sun 5 Jan 1997): | |
3065a62a | 1328 | |
4b521edb | 1329 | * Changes to the 'guile' program: |
3065a62a | 1330 | |
4b521edb JB |
1331 | ** Guile now loads some new files when it starts up. Guile first |
1332 | searches the load path for init.scm, and loads it if found. Then, if | |
1333 | Guile is not being used to execute a script, and the user's home | |
1334 | directory contains a file named `.guile', Guile loads that. | |
c6486f8a | 1335 | |
4b521edb | 1336 | ** You can now use Guile as a shell script interpreter. |
3065a62a JB |
1337 | |
1338 | To paraphrase the SCSH manual: | |
1339 | ||
1340 | When Unix tries to execute an executable file whose first two | |
1341 | characters are the `#!', it treats the file not as machine code to | |
1342 | be directly executed by the native processor, but as source code | |
1343 | to be executed by some interpreter. The interpreter to use is | |
1344 | specified immediately after the #! sequence on the first line of | |
1345 | the source file. The kernel reads in the name of the interpreter, | |
1346 | and executes that instead. It passes the interpreter the source | |
1347 | filename as its first argument, with the original arguments | |
1348 | following. Consult the Unix man page for the `exec' system call | |
1349 | for more information. | |
1350 | ||
1a1945be JB |
1351 | Now you can use Guile as an interpreter, using a mechanism which is a |
1352 | compatible subset of that provided by SCSH. | |
1353 | ||
3065a62a JB |
1354 | Guile now recognizes a '-s' command line switch, whose argument is the |
1355 | name of a file of Scheme code to load. It also treats the two | |
1356 | characters `#!' as the start of a comment, terminated by `!#'. Thus, | |
1357 | to make a file of Scheme code directly executable by Unix, insert the | |
1358 | following two lines at the top of the file: | |
1359 | ||
1360 | #!/usr/local/bin/guile -s | |
1361 | !# | |
1362 | ||
1363 | Guile treats the argument of the `-s' command-line switch as the name | |
1364 | of a file of Scheme code to load, and treats the sequence `#!' as the | |
1365 | start of a block comment, terminated by `!#'. | |
1366 | ||
1367 | For example, here's a version of 'echo' written in Scheme: | |
1368 | ||
1369 | #!/usr/local/bin/guile -s | |
1370 | !# | |
1371 | (let loop ((args (cdr (program-arguments)))) | |
1372 | (if (pair? args) | |
1373 | (begin | |
1374 | (display (car args)) | |
1375 | (if (pair? (cdr args)) | |
1376 | (display " ")) | |
1377 | (loop (cdr args))))) | |
1378 | (newline) | |
1379 | ||
1380 | Why does `#!' start a block comment terminated by `!#', instead of the | |
1381 | end of the line? That is the notation SCSH uses, and although we | |
1382 | don't yet support the other SCSH features that motivate that choice, | |
1383 | we would like to be backward-compatible with any existing Guile | |
3763761c JB |
1384 | scripts once we do. Furthermore, if the path to Guile on your system |
1385 | is too long for your kernel, you can start the script with this | |
1386 | horrible hack: | |
1387 | ||
1388 | #!/bin/sh | |
1389 | exec /really/long/path/to/guile -s "$0" ${1+"$@"} | |
1390 | !# | |
3065a62a JB |
1391 | |
1392 | Note that some very old Unix systems don't support the `#!' syntax. | |
1393 | ||
c6486f8a | 1394 | |
4b521edb | 1395 | ** You can now run Guile without installing it. |
6685dc83 JB |
1396 | |
1397 | Previous versions of the interactive Guile interpreter (`guile') | |
1398 | couldn't start up unless Guile's Scheme library had been installed; | |
1399 | they used the value of the environment variable `SCHEME_LOAD_PATH' | |
1400 | later on in the startup process, but not to find the startup code | |
1401 | itself. Now Guile uses `SCHEME_LOAD_PATH' in all searches for Scheme | |
1402 | code. | |
1403 | ||
1404 | To run Guile without installing it, build it in the normal way, and | |
1405 | then set the environment variable `SCHEME_LOAD_PATH' to a | |
1406 | colon-separated list of directories, including the top-level directory | |
1407 | of the Guile sources. For example, if you unpacked Guile so that the | |
1408 | full filename of this NEWS file is /home/jimb/guile-1.0b3/NEWS, then | |
1409 | you might say | |
1410 | ||
1411 | export SCHEME_LOAD_PATH=/home/jimb/my-scheme:/home/jimb/guile-1.0b3 | |
1412 | ||
c6486f8a | 1413 | |
4b521edb JB |
1414 | ** Guile's read-eval-print loop no longer prints #<unspecified> |
1415 | results. If the user wants to see this, she can evaluate the | |
1416 | expression (assert-repl-print-unspecified #t), perhaps in her startup | |
48d224d7 | 1417 | file. |
6685dc83 | 1418 | |
4b521edb JB |
1419 | ** Guile no longer shows backtraces by default when an error occurs; |
1420 | however, it does display a message saying how to get one, and how to | |
1421 | request that they be displayed by default. After an error, evaluate | |
1422 | (backtrace) | |
1423 | to see a backtrace, and | |
1424 | (debug-enable 'backtrace) | |
1425 | to see them by default. | |
6685dc83 | 1426 | |
6685dc83 | 1427 | |
d9fb83d9 | 1428 | |
4b521edb JB |
1429 | * Changes to Guile Scheme: |
1430 | ||
1431 | ** Guile now distinguishes between #f and the empty list. | |
1432 | ||
1433 | This is for compatibility with the IEEE standard, the (possibly) | |
1434 | upcoming Revised^5 Report on Scheme, and many extant Scheme | |
1435 | implementations. | |
1436 | ||
1437 | Guile used to have #f and '() denote the same object, to make Scheme's | |
1438 | type system more compatible with Emacs Lisp's. However, the change | |
1439 | caused too much trouble for Scheme programmers, and we found another | |
1440 | way to reconcile Emacs Lisp with Scheme that didn't require this. | |
1441 | ||
1442 | ||
1443 | ** Guile's delq, delv, delete functions, and their destructive | |
c6486f8a JB |
1444 | counterparts, delq!, delv!, and delete!, now remove all matching |
1445 | elements from the list, not just the first. This matches the behavior | |
1446 | of the corresponding Emacs Lisp functions, and (I believe) the Maclisp | |
1447 | functions which inspired them. | |
1448 | ||
1449 | I recognize that this change may break code in subtle ways, but it | |
1450 | seems best to make the change before the FSF's first Guile release, | |
1451 | rather than after. | |
1452 | ||
1453 | ||
4b521edb | 1454 | ** The compiled-library-path function has been deleted from libguile. |
6685dc83 | 1455 | |
4b521edb | 1456 | ** The facilities for loading Scheme source files have changed. |
c6486f8a | 1457 | |
4b521edb | 1458 | *** The variable %load-path now tells Guile which directories to search |
6685dc83 JB |
1459 | for Scheme code. Its value is a list of strings, each of which names |
1460 | a directory. | |
1461 | ||
4b521edb JB |
1462 | *** The variable %load-extensions now tells Guile which extensions to |
1463 | try appending to a filename when searching the load path. Its value | |
1464 | is a list of strings. Its default value is ("" ".scm"). | |
1465 | ||
1466 | *** (%search-load-path FILENAME) searches the directories listed in the | |
1467 | value of the %load-path variable for a Scheme file named FILENAME, | |
1468 | with all the extensions listed in %load-extensions. If it finds a | |
1469 | match, then it returns its full filename. If FILENAME is absolute, it | |
1470 | returns it unchanged. Otherwise, it returns #f. | |
6685dc83 | 1471 | |
4b521edb JB |
1472 | %search-load-path will not return matches that refer to directories. |
1473 | ||
1474 | *** (primitive-load FILENAME :optional CASE-INSENSITIVE-P SHARP) | |
1475 | uses %seach-load-path to find a file named FILENAME, and loads it if | |
1476 | it finds it. If it can't read FILENAME for any reason, it throws an | |
1477 | error. | |
6685dc83 JB |
1478 | |
1479 | The arguments CASE-INSENSITIVE-P and SHARP are interpreted as by the | |
4b521edb JB |
1480 | `read' function. |
1481 | ||
1482 | *** load uses the same searching semantics as primitive-load. | |
1483 | ||
1484 | *** The functions %try-load, try-load-with-path, %load, load-with-path, | |
1485 | basic-try-load-with-path, basic-load-with-path, try-load-module-with- | |
1486 | path, and load-module-with-path have been deleted. The functions | |
1487 | above should serve their purposes. | |
1488 | ||
1489 | *** If the value of the variable %load-hook is a procedure, | |
1490 | `primitive-load' applies its value to the name of the file being | |
1491 | loaded (without the load path directory name prepended). If its value | |
1492 | is #f, it is ignored. Otherwise, an error occurs. | |
1493 | ||
1494 | This is mostly useful for printing load notification messages. | |
1495 | ||
1496 | ||
1497 | ** The function `eval!' is no longer accessible from the scheme level. | |
1498 | We can't allow operations which introduce glocs into the scheme level, | |
1499 | because Guile's type system can't handle these as data. Use `eval' or | |
1500 | `read-and-eval!' (see below) as replacement. | |
1501 | ||
1502 | ** The new function read-and-eval! reads an expression from PORT, | |
1503 | evaluates it, and returns the result. This is more efficient than | |
1504 | simply calling `read' and `eval', since it is not necessary to make a | |
1505 | copy of the expression for the evaluator to munge. | |
1506 | ||
1507 | Its optional arguments CASE_INSENSITIVE_P and SHARP are interpreted as | |
1508 | for the `read' function. | |
1509 | ||
1510 | ||
1511 | ** The function `int?' has been removed; its definition was identical | |
1512 | to that of `integer?'. | |
1513 | ||
1514 | ** The functions `<?', `<?', `<=?', `=?', `>?', and `>=?'. Code should | |
1515 | use the R4RS names for these functions. | |
1516 | ||
1517 | ** The function object-properties no longer returns the hash handle; | |
1518 | it simply returns the object's property list. | |
1519 | ||
1520 | ** Many functions have been changed to throw errors, instead of | |
1521 | returning #f on failure. The point of providing exception handling in | |
1522 | the language is to simplify the logic of user code, but this is less | |
1523 | useful if Guile's primitives don't throw exceptions. | |
1524 | ||
1525 | ** The function `fileno' has been renamed from `%fileno'. | |
1526 | ||
1527 | ** The function primitive-mode->fdes returns #t or #f now, not 1 or 0. | |
1528 | ||
1529 | ||
1530 | * Changes to Guile's C interface: | |
1531 | ||
1532 | ** The library's initialization procedure has been simplified. | |
1533 | scm_boot_guile now has the prototype: | |
1534 | ||
1535 | void scm_boot_guile (int ARGC, | |
1536 | char **ARGV, | |
1537 | void (*main_func) (), | |
1538 | void *closure); | |
1539 | ||
1540 | scm_boot_guile calls MAIN_FUNC, passing it CLOSURE, ARGC, and ARGV. | |
1541 | MAIN_FUNC should do all the work of the program (initializing other | |
1542 | packages, reading user input, etc.) before returning. When MAIN_FUNC | |
1543 | returns, call exit (0); this function never returns. If you want some | |
1544 | other exit value, MAIN_FUNC may call exit itself. | |
1545 | ||
1546 | scm_boot_guile arranges for program-arguments to return the strings | |
1547 | given by ARGC and ARGV. If MAIN_FUNC modifies ARGC/ARGV, should call | |
1548 | scm_set_program_arguments with the final list, so Scheme code will | |
1549 | know which arguments have been processed. | |
1550 | ||
1551 | scm_boot_guile establishes a catch-all catch handler which prints an | |
1552 | error message and exits the process. This means that Guile exits in a | |
1553 | coherent way when system errors occur and the user isn't prepared to | |
1554 | handle it. If the user doesn't like this behavior, they can establish | |
1555 | their own universal catcher in MAIN_FUNC to shadow this one. | |
1556 | ||
1557 | Why must the caller do all the real work from MAIN_FUNC? The garbage | |
1558 | collector assumes that all local variables of type SCM will be above | |
1559 | scm_boot_guile's stack frame on the stack. If you try to manipulate | |
1560 | SCM values after this function returns, it's the luck of the draw | |
1561 | whether the GC will be able to find the objects you allocate. So, | |
1562 | scm_boot_guile function exits, rather than returning, to discourage | |
1563 | people from making that mistake. | |
1564 | ||
1565 | The IN, OUT, and ERR arguments were removed; there are other | |
1566 | convenient ways to override these when desired. | |
1567 | ||
1568 | The RESULT argument was deleted; this function should never return. | |
1569 | ||
1570 | The BOOT_CMD argument was deleted; the MAIN_FUNC argument is more | |
1571 | general. | |
1572 | ||
1573 | ||
1574 | ** Guile's header files should no longer conflict with your system's | |
1575 | header files. | |
1576 | ||
1577 | In order to compile code which #included <libguile.h>, previous | |
1578 | versions of Guile required you to add a directory containing all the | |
1579 | Guile header files to your #include path. This was a problem, since | |
1580 | Guile's header files have names which conflict with many systems' | |
1581 | header files. | |
1582 | ||
1583 | Now only <libguile.h> need appear in your #include path; you must | |
1584 | refer to all Guile's other header files as <libguile/mumble.h>. | |
1585 | Guile's installation procedure puts libguile.h in $(includedir), and | |
1586 | the rest in $(includedir)/libguile. | |
1587 | ||
1588 | ||
1589 | ** Two new C functions, scm_protect_object and scm_unprotect_object, | |
1590 | have been added to the Guile library. | |
1591 | ||
1592 | scm_protect_object (OBJ) protects OBJ from the garbage collector. | |
1593 | OBJ will not be freed, even if all other references are dropped, | |
1594 | until someone does scm_unprotect_object (OBJ). Both functions | |
1595 | return OBJ. | |
1596 | ||
1597 | Note that calls to scm_protect_object do not nest. You can call | |
1598 | scm_protect_object any number of times on a given object, and the | |
1599 | next call to scm_unprotect_object will unprotect it completely. | |
1600 | ||
1601 | Basically, scm_protect_object and scm_unprotect_object just | |
1602 | maintain a list of references to things. Since the GC knows about | |
1603 | this list, all objects it mentions stay alive. scm_protect_object | |
1604 | adds its argument to the list; scm_unprotect_object remove its | |
1605 | argument from the list. | |
1606 | ||
1607 | ||
1608 | ** scm_eval_0str now returns the value of the last expression | |
1609 | evaluated. | |
1610 | ||
1611 | ** The new function scm_read_0str reads an s-expression from a | |
1612 | null-terminated string, and returns it. | |
1613 | ||
1614 | ** The new function `scm_stdio_to_port' converts a STDIO file pointer | |
1615 | to a Scheme port object. | |
1616 | ||
1617 | ** The new function `scm_set_program_arguments' allows C code to set | |
1618 | the value teruturned by the Scheme `program-arguments' function. | |
6685dc83 | 1619 | |
6685dc83 | 1620 | \f |
1a1945be JB |
1621 | Older changes: |
1622 | ||
1623 | * Guile no longer includes sophisticated Tcl/Tk support. | |
1624 | ||
1625 | The old Tcl/Tk support was unsatisfying to us, because it required the | |
1626 | user to link against the Tcl library, as well as Tk and Guile. The | |
1627 | interface was also un-lispy, in that it preserved Tcl/Tk's practice of | |
1628 | referring to widgets by names, rather than exporting widgets to Scheme | |
1629 | code as a special datatype. | |
1630 | ||
1631 | In the Usenix Tk Developer's Workshop held in July 1996, the Tcl/Tk | |
1632 | maintainers described some very interesting changes in progress to the | |
1633 | Tcl/Tk internals, which would facilitate clean interfaces between lone | |
1634 | Tk and other interpreters --- even for garbage-collected languages | |
1635 | like Scheme. They expected the new Tk to be publicly available in the | |
1636 | fall of 1996. | |
1637 | ||
1638 | Since it seems that Guile might soon have a new, cleaner interface to | |
1639 | lone Tk, and that the old Guile/Tk glue code would probably need to be | |
1640 | completely rewritten, we (Jim Blandy and Richard Stallman) have | |
1641 | decided not to support the old code. We'll spend the time instead on | |
1642 | a good interface to the newer Tk, as soon as it is available. | |
5c54da76 | 1643 | |
8512dea6 | 1644 | Until then, gtcltk-lib provides trivial, low-maintenance functionality. |
deb95d71 | 1645 | |
5c54da76 JB |
1646 | \f |
1647 | Copyright information: | |
1648 | ||
ea00ecba | 1649 | Copyright (C) 1996,1997 Free Software Foundation, Inc. |
5c54da76 JB |
1650 | |
1651 | Permission is granted to anyone to make or distribute verbatim copies | |
1652 | of this document as received, in any medium, provided that the | |
1653 | copyright notice and this permission notice are preserved, | |
1654 | thus giving the recipient permission to redistribute in turn. | |
1655 | ||
1656 | Permission is granted to distribute modified versions | |
1657 | of this document, or of portions of it, | |
1658 | under the above conditions, provided also that they | |
1659 | carry prominent notices stating who last changed them. | |
1660 | ||
48d224d7 JB |
1661 | \f |
1662 | Local variables: | |
1663 | mode: outline | |
1664 | paragraph-separate: "[ \f]*$" | |
1665 | end: | |
1666 |