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 |
737c9113 | 7 | Changes in Guile 1.2: |
cf78e9e8 | 8 | |
737c9113 JB |
9 | [[trim out any sections we don't need]] |
10 | ||
11 | * Changes to the distribution | |
12 | ||
13 | * Changes to the procedure for linking libguile with your programs | |
14 | ||
27590f82 JB |
15 | ** Like Guile 1.1, Guile 1.2 will now use the Rx regular expression |
16 | library, if it is installed on your system. When you are linking | |
17 | libguile into your own programs, this means you will have to link | |
18 | against -lguile, -lqt (if you configured Guile with thread support), | |
19 | and -lrx. | |
20 | ||
21 | If you are using autoconf to generate configuration scripts for your | |
22 | application, the following lines should suffice to add the appropriate | |
23 | libraries to your link command: | |
24 | ||
25 | ### Find Rx, quickthreads and libguile. | |
26 | AC_CHECK_LIB(rx, main) | |
27 | AC_CHECK_LIB(qt, main) | |
28 | AC_CHECK_LIB(guile, scm_shell) | |
29 | ||
b83b8bee JB |
30 | * Changes to Scheme functions and syntax |
31 | ||
27590f82 JB |
32 | ** The #/ syntax for module names is depreciated, and will be removed |
33 | in a future version of Guile. Instead of | |
34 | ||
35 | #/foo/bar/baz | |
36 | ||
37 | instead write | |
38 | ||
39 | (foo bar baz) | |
40 | ||
41 | The latter syntax is more consistent with existing Lisp practice. | |
42 | ||
5dade857 MV |
43 | ** Guile now does fancier printing of structures. Structures are the |
44 | underlying implementation for records, which in turn are used to | |
45 | implement modules, so all of these object now print differently and in | |
46 | a more informative way. | |
47 | ||
48 | The Scheme printer will examine the builtin variable | |
49 | *struct-printer* whenever it needs to print a structure object. When | |
50 | this variable is not `#f' it is deemed to be a procedure and will be | |
51 | applied to the structure object and the output port. When | |
52 | *struct-printer* is `#f' or the procedure return `#f' the structure | |
53 | object will be printed in the boring #<struct 80458270> form. | |
54 | ||
55 | This hook is used by some routines in ice-9/boot-9.scm to implement | |
56 | type specific printing routines. Please read the comments there about | |
57 | "printing structs". | |
58 | ||
59 | One of the more specific uses of structs are records. The printing | |
60 | procedure that could be passed to MAKE-RECORD-TYPE is now actually | |
61 | called. It should behave like a *struct-printer* procedure (described | |
62 | above). | |
63 | ||
b83b8bee JB |
64 | ** Guile now supports a new R4RS-compliant syntax for keywords. A |
65 | token of the form #:NAME, where NAME has the same syntax as a Scheme | |
66 | symbol, is the external representation of the keyword named NAME. | |
67 | Keyword objects print using this syntax as well, so values containing | |
1e5afba0 JB |
68 | keyword objects can be read back into Guile. When used in an |
69 | expression, keywords are self-quoting objects. | |
b83b8bee JB |
70 | |
71 | Guile suports this read syntax, and uses this print syntax, regardless | |
72 | of the current setting of the `keyword' read option. The `keyword' | |
73 | read option only controls whether Guile recognizes the `:NAME' syntax, | |
74 | which is incompatible with R4RS. (R4RS says such token represent | |
75 | symbols.) | |
737c9113 JB |
76 | |
77 | ** Guile has regular expression support again. Guile 1.0 included | |
78 | functions for matching regular expressions, based on the Rx library. | |
79 | In Guile 1.1, the Guile/Rx interface was removed to simplify the | |
80 | distribution, and thus Guile had no regular expression support. Guile | |
81 | 1.2 now adds back the most commonly used functions, and supports all | |
82 | of SCSH's regular expression functions. They are: | |
83 | ||
84 | *** [[get docs from Tim?]] | |
85 | ||
86 | * Changes to the gh_ interface | |
87 | ||
88 | * Changes to the scm_ interface | |
cf78e9e8 | 89 | |
e1a191a8 GH |
90 | * Changes to system call interfaces: |
91 | ||
92 | ** The value returned by `raise' is now unspecified. It throws an exception | |
93 | if an error occurs. | |
94 | ||
95 | ** A new procedure `sigaction' can be used to install signal handlers | |
115b09a5 GH |
96 | |
97 | (sigaction signum [action] [flags]) | |
98 | ||
99 | signum is the signal number, which can be specified using the value | |
100 | of SIGINT etc. | |
101 | ||
102 | If action is omitted, sigaction returns a pair: the CAR is the current | |
103 | signal hander, which will be either an integer with the value SIG_DFL | |
104 | (default action) or SIG_IGN (ignore), or the Scheme procedure which | |
105 | handles the signal, or #f if a non-Scheme procedure handles the | |
106 | signal. The CDR contains the current sigaction flags for the handler. | |
107 | ||
108 | If action is provided, it is installed as the new handler for signum. | |
109 | action can be a Scheme procedure taking one argument, or the value of | |
110 | SIG_DFL (default action) or SIG_IGN (ignore), or #f to restore | |
111 | whatever signal handler was installed before sigaction was first used. | |
112 | Flags can optionally be specified for the new handler (SA_RESTART is | |
113 | always used if the system provides it, so need not be specified.) The | |
114 | return value is a pair with information about the old handler as | |
115 | described above. | |
116 | ||
117 | This interface does not provide access to the "signal blocking" | |
118 | facility. Maybe this is not needed, since the thread support may | |
119 | provide solutions to the problem of consistent access to data | |
120 | structures. | |
e1a191a8 | 121 | |
cf78e9e8 JB |
122 | \f |
123 | Changes in Guile 1.1 (Fri May 16 1997): | |
f3b1485f JB |
124 | |
125 | * Changes to the distribution. | |
126 | ||
127 | The Guile 1.0 distribution has been split up into several smaller | |
128 | pieces: | |
129 | guile-core --- the Guile interpreter itself. | |
130 | guile-tcltk --- the interface between the Guile interpreter and | |
131 | Tcl/Tk; Tcl is an interpreter for a stringy language, and Tk | |
132 | is a toolkit for building graphical user interfaces. | |
133 | guile-rgx-ctax --- the interface between Guile and the Rx regular | |
134 | expression matcher, and the translator for the Ctax | |
135 | programming language. These are packaged together because the | |
136 | Ctax translator uses Rx to parse Ctax source code. | |
137 | ||
095936d2 JB |
138 | This NEWS file describes the changes made to guile-core since the 1.0 |
139 | release. | |
140 | ||
48d224d7 JB |
141 | We no longer distribute the documentation, since it was either out of |
142 | date, or incomplete. As soon as we have current documentation, we | |
143 | will distribute it. | |
144 | ||
f3b1485f JB |
145 | * Changes to the stand-alone interpreter |
146 | ||
48d224d7 JB |
147 | ** guile now accepts command-line arguments compatible with SCSH, Olin |
148 | Shivers' Scheme Shell. | |
149 | ||
150 | In general, arguments are evaluated from left to right, but there are | |
151 | exceptions. The following switches stop argument processing, and | |
152 | stash all remaining command-line arguments as the value returned by | |
153 | the (command-line) function. | |
154 | -s SCRIPT load Scheme source code from FILE, and exit | |
155 | -c EXPR evalute Scheme expression EXPR, and exit | |
156 | -- stop scanning arguments; run interactively | |
157 | ||
158 | The switches below are processed as they are encountered. | |
159 | -l FILE load Scheme source code from FILE | |
160 | -e FUNCTION after reading script, apply FUNCTION to | |
161 | command line arguments | |
162 | -ds do -s script at this point | |
163 | --emacs enable Emacs protocol (experimental) | |
164 | -h, --help display this help and exit | |
165 | -v, --version display version information and exit | |
166 | \ read arguments from following script lines | |
167 | ||
168 | So, for example, here is a Guile script named `ekko' (thanks, Olin) | |
169 | which re-implements the traditional "echo" command: | |
170 | ||
171 | #!/usr/local/bin/guile -s | |
172 | !# | |
173 | (define (main args) | |
174 | (map (lambda (arg) (display arg) (display " ")) | |
175 | (cdr args)) | |
176 | (newline)) | |
177 | ||
178 | (main (command-line)) | |
179 | ||
180 | Suppose we invoke this script as follows: | |
181 | ||
182 | ekko a speckled gecko | |
183 | ||
184 | Through the magic of Unix script processing (triggered by the `#!' | |
185 | token at the top of the file), /usr/local/bin/guile receives the | |
186 | following list of command-line arguments: | |
187 | ||
188 | ("-s" "./ekko" "a" "speckled" "gecko") | |
189 | ||
190 | Unix inserts the name of the script after the argument specified on | |
191 | the first line of the file (in this case, "-s"), and then follows that | |
192 | with the arguments given to the script. Guile loads the script, which | |
193 | defines the `main' function, and then applies it to the list of | |
194 | remaining command-line arguments, ("a" "speckled" "gecko"). | |
195 | ||
095936d2 JB |
196 | In Unix, the first line of a script file must take the following form: |
197 | ||
198 | #!INTERPRETER ARGUMENT | |
199 | ||
200 | where INTERPRETER is the absolute filename of the interpreter | |
201 | executable, and ARGUMENT is a single command-line argument to pass to | |
202 | the interpreter. | |
203 | ||
204 | You may only pass one argument to the interpreter, and its length is | |
205 | limited. These restrictions can be annoying to work around, so Guile | |
206 | provides a general mechanism (borrowed from, and compatible with, | |
207 | SCSH) for circumventing them. | |
208 | ||
209 | If the ARGUMENT in a Guile script is a single backslash character, | |
210 | `\', Guile will open the script file, parse arguments from its second | |
211 | and subsequent lines, and replace the `\' with them. So, for example, | |
212 | here is another implementation of the `ekko' script: | |
213 | ||
214 | #!/usr/local/bin/guile \ | |
215 | -e main -s | |
216 | !# | |
217 | (define (main args) | |
218 | (for-each (lambda (arg) (display arg) (display " ")) | |
219 | (cdr args)) | |
220 | (newline)) | |
221 | ||
222 | If the user invokes this script as follows: | |
223 | ||
224 | ekko a speckled gecko | |
225 | ||
226 | Unix expands this into | |
227 | ||
228 | /usr/local/bin/guile \ ekko a speckled gecko | |
229 | ||
230 | When Guile sees the `\' argument, it replaces it with the arguments | |
231 | read from the second line of the script, producing: | |
232 | ||
233 | /usr/local/bin/guile -e main -s ekko a speckled gecko | |
234 | ||
235 | This tells Guile to load the `ekko' script, and apply the function | |
236 | `main' to the argument list ("a" "speckled" "gecko"). | |
237 | ||
238 | Here is how Guile parses the command-line arguments: | |
239 | - Each space character terminates an argument. This means that two | |
240 | spaces in a row introduce an empty-string argument. | |
241 | - The tab character is not permitted (unless you quote it with the | |
242 | backslash character, as described below), to avoid confusion. | |
243 | - The newline character terminates the sequence of arguments, and will | |
244 | also terminate a final non-empty argument. (However, a newline | |
245 | following a space will not introduce a final empty-string argument; | |
246 | it only terminates the argument list.) | |
247 | - The backslash character is the escape character. It escapes | |
248 | backslash, space, tab, and newline. The ANSI C escape sequences | |
249 | like \n and \t are also supported. These produce argument | |
250 | constituents; the two-character combination \n doesn't act like a | |
251 | terminating newline. The escape sequence \NNN for exactly three | |
252 | octal digits reads as the character whose ASCII code is NNN. As | |
253 | above, characters produced this way are argument constituents. | |
254 | Backslash followed by other characters is not allowed. | |
255 | ||
48d224d7 JB |
256 | * Changes to the procedure for linking libguile with your programs |
257 | ||
258 | ** Guile now builds and installs a shared guile library, if your | |
259 | system support shared libraries. (It still builds a static library on | |
260 | all systems.) Guile automatically detects whether your system | |
261 | supports shared libraries. To prevent Guile from buildisg shared | |
262 | libraries, pass the `--disable-shared' flag to the configure script. | |
263 | ||
264 | Guile takes longer to compile when it builds shared libraries, because | |
265 | it must compile every file twice --- once to produce position- | |
266 | independent object code, and once to produce normal object code. | |
267 | ||
268 | ** The libthreads library has been merged into libguile. | |
269 | ||
270 | To link a program against Guile, you now need only link against | |
271 | -lguile and -lqt; -lthreads is no longer needed. If you are using | |
272 | autoconf to generate configuration scripts for your application, the | |
273 | following lines should suffice to add the appropriate libraries to | |
274 | your link command: | |
275 | ||
276 | ### Find quickthreads and libguile. | |
277 | AC_CHECK_LIB(qt, main) | |
278 | AC_CHECK_LIB(guile, scm_shell) | |
f3b1485f JB |
279 | |
280 | * Changes to Scheme functions | |
281 | ||
095936d2 JB |
282 | ** Guile Scheme's special syntax for keyword objects is now optional, |
283 | and disabled by default. | |
284 | ||
285 | The syntax variation from R4RS made it difficult to port some | |
286 | interesting packages to Guile. The routines which accepted keyword | |
287 | arguments (mostly in the module system) have been modified to also | |
288 | accept symbols whose names begin with `:'. | |
289 | ||
290 | To change the keyword syntax, you must first import the (ice-9 debug) | |
291 | module: | |
292 | (use-modules (ice-9 debug)) | |
293 | ||
294 | Then you can enable the keyword syntax as follows: | |
295 | (read-set! keywords 'prefix) | |
296 | ||
297 | To disable keyword syntax, do this: | |
298 | (read-set! keywords #f) | |
299 | ||
300 | ** Many more primitive functions accept shared substrings as | |
301 | arguments. In the past, these functions required normal, mutable | |
302 | strings as arguments, although they never made use of this | |
303 | restriction. | |
304 | ||
305 | ** The uniform array functions now operate on byte vectors. These | |
306 | functions are `array-fill!', `serial-array-copy!', `array-copy!', | |
307 | `serial-array-map', `array-map', `array-for-each', and | |
308 | `array-index-map!'. | |
309 | ||
310 | ** The new functions `trace' and `untrace' implement simple debugging | |
311 | support for Scheme functions. | |
312 | ||
313 | The `trace' function accepts any number of procedures as arguments, | |
314 | and tells the Guile interpreter to display each procedure's name and | |
315 | arguments each time the procedure is invoked. When invoked with no | |
316 | arguments, `trace' returns the list of procedures currently being | |
317 | traced. | |
318 | ||
319 | The `untrace' function accepts any number of procedures as arguments, | |
320 | and tells the Guile interpreter not to trace them any more. When | |
321 | invoked with no arguments, `untrace' untraces all curretly traced | |
322 | procedures. | |
323 | ||
324 | The tracing in Guile has an advantage over most other systems: we | |
325 | don't create new procedure objects, but mark the procedure objects | |
326 | themselves. This means that anonymous and internal procedures can be | |
327 | traced. | |
328 | ||
329 | ** The function `assert-repl-prompt' has been renamed to | |
330 | `set-repl-prompt!'. It takes one argument, PROMPT. | |
331 | - If PROMPT is #f, the Guile read-eval-print loop will not prompt. | |
332 | - If PROMPT is a string, we use it as a prompt. | |
333 | - If PROMPT is a procedure accepting no arguments, we call it, and | |
334 | display the result as a prompt. | |
335 | - Otherwise, we display "> ". | |
336 | ||
337 | ** The new function `eval-string' reads Scheme expressions from a | |
338 | string and evaluates them, returning the value of the last expression | |
339 | in the string. If the string contains no expressions, it returns an | |
340 | unspecified value. | |
341 | ||
342 | ** The new function `thunk?' returns true iff its argument is a | |
343 | procedure of zero arguments. | |
344 | ||
345 | ** `defined?' is now a builtin function, instead of syntax. This | |
346 | means that its argument should be quoted. It returns #t iff its | |
347 | argument is bound in the current module. | |
348 | ||
349 | ** The new syntax `use-modules' allows you to add new modules to your | |
350 | environment without re-typing a complete `define-module' form. It | |
351 | accepts any number of module names as arguments, and imports their | |
352 | public bindings into the current module. | |
353 | ||
354 | ** The new function (module-defined? NAME MODULE) returns true iff | |
355 | NAME, a symbol, is defined in MODULE, a module object. | |
356 | ||
357 | ** The new function `builtin-bindings' creates and returns a hash | |
358 | table containing copies of all the root module's bindings. | |
359 | ||
360 | ** The new function `builtin-weak-bindings' does the same as | |
361 | `builtin-bindings', but creates a doubly-weak hash table. | |
362 | ||
363 | ** The `equal?' function now considers variable objects to be | |
364 | equivalent if they have the same name and the same value. | |
365 | ||
366 | ** The new function `command-line' returns the command-line arguments | |
367 | given to Guile, as a list of strings. | |
368 | ||
369 | When using guile as a script interpreter, `command-line' returns the | |
370 | script's arguments; those processed by the interpreter (like `-s' or | |
371 | `-c') are omitted. (In other words, you get the normal, expected | |
372 | behavior.) Any application that uses scm_shell to process its | |
373 | command-line arguments gets this behavior as well. | |
374 | ||
375 | ** The new function `load-user-init' looks for a file called `.guile' | |
376 | in the user's home directory, and loads it if it exists. This is | |
377 | mostly for use by the code generated by scm_compile_shell_switches, | |
378 | but we thought it might also be useful in other circumstances. | |
379 | ||
380 | ** The new function `log10' returns the base-10 logarithm of its | |
381 | argument. | |
382 | ||
383 | ** Changes to I/O functions | |
384 | ||
385 | *** The functions `read', `primitive-load', `read-and-eval!', and | |
386 | `primitive-load-path' no longer take optional arguments controlling | |
387 | case insensitivity and a `#' parser. | |
388 | ||
389 | Case sensitivity is now controlled by a read option called | |
390 | `case-insensitive'. The user can add new `#' syntaxes with the | |
391 | `read-hash-extend' function (see below). | |
392 | ||
393 | *** The new function `read-hash-extend' allows the user to change the | |
394 | syntax of Guile Scheme in a somewhat controlled way. | |
395 | ||
396 | (read-hash-extend CHAR PROC) | |
397 | When parsing S-expressions, if we read a `#' character followed by | |
398 | the character CHAR, use PROC to parse an object from the stream. | |
399 | If PROC is #f, remove any parsing procedure registered for CHAR. | |
400 | ||
401 | The reader applies PROC to two arguments: CHAR and an input port. | |
402 | ||
403 | *** The new functions read-delimited and read-delimited! provide a | |
404 | general mechanism for doing delimited input on streams. | |
405 | ||
406 | (read-delimited DELIMS [PORT HANDLE-DELIM]) | |
407 | Read until we encounter one of the characters in DELIMS (a string), | |
408 | or end-of-file. PORT is the input port to read from; it defaults to | |
409 | the current input port. The HANDLE-DELIM parameter determines how | |
410 | the terminating character is handled; it should be one of the | |
411 | following symbols: | |
412 | ||
413 | 'trim omit delimiter from result | |
414 | 'peek leave delimiter character in input stream | |
415 | 'concat append delimiter character to returned value | |
416 | 'split return a pair: (RESULT . TERMINATOR) | |
417 | ||
418 | HANDLE-DELIM defaults to 'peek. | |
419 | ||
420 | (read-delimited! DELIMS BUF [PORT HANDLE-DELIM START END]) | |
421 | A side-effecting variant of `read-delimited'. | |
422 | ||
423 | The data is written into the string BUF at the indices in the | |
424 | half-open interval [START, END); the default interval is the whole | |
425 | string: START = 0 and END = (string-length BUF). The values of | |
426 | START and END must specify a well-defined interval in BUF, i.e. | |
427 | 0 <= START <= END <= (string-length BUF). | |
428 | ||
429 | It returns NBYTES, the number of bytes read. If the buffer filled | |
430 | up without a delimiter character being found, it returns #f. If the | |
431 | port is at EOF when the read starts, it returns the EOF object. | |
432 | ||
433 | If an integer is returned (i.e., the read is successfully terminated | |
434 | by reading a delimiter character), then the HANDLE-DELIM parameter | |
435 | determines how to handle the terminating character. It is described | |
436 | above, and defaults to 'peek. | |
437 | ||
438 | (The descriptions of these functions were borrowed from the SCSH | |
439 | manual, by Olin Shivers and Brian Carlstrom.) | |
440 | ||
441 | *** The `%read-delimited!' function is the primitive used to implement | |
442 | `read-delimited' and `read-delimited!'. | |
443 | ||
444 | (%read-delimited! DELIMS BUF GOBBLE? [PORT START END]) | |
445 | ||
446 | This returns a pair of values: (TERMINATOR . NUM-READ). | |
447 | - TERMINATOR describes why the read was terminated. If it is a | |
448 | character or the eof object, then that is the value that terminated | |
449 | the read. If it is #f, the function filled the buffer without finding | |
450 | a delimiting character. | |
451 | - NUM-READ is the number of characters read into BUF. | |
452 | ||
453 | If the read is successfully terminated by reading a delimiter | |
454 | character, then the gobble? parameter determines what to do with the | |
455 | terminating character. If true, the character is removed from the | |
456 | input stream; if false, the character is left in the input stream | |
457 | where a subsequent read operation will retrieve it. In either case, | |
458 | the character is also the first value returned by the procedure call. | |
459 | ||
460 | (The descriptions of this function was borrowed from the SCSH manual, | |
461 | by Olin Shivers and Brian Carlstrom.) | |
462 | ||
463 | *** The `read-line' and `read-line!' functions have changed; they now | |
464 | trim the terminator by default; previously they appended it to the | |
465 | returned string. For the old behavior, use (read-line PORT 'concat). | |
466 | ||
467 | *** The functions `uniform-array-read!' and `uniform-array-write!' now | |
468 | take new optional START and END arguments, specifying the region of | |
469 | the array to read and write. | |
470 | ||
f348c807 JB |
471 | *** The `ungetc-char-ready?' function has been removed. We feel it's |
472 | inappropriate for an interface to expose implementation details this | |
473 | way. | |
095936d2 JB |
474 | |
475 | ** Changes to the Unix library and system call interface | |
476 | ||
477 | *** The new fcntl function provides access to the Unix `fcntl' system | |
478 | call. | |
479 | ||
480 | (fcntl PORT COMMAND VALUE) | |
481 | Apply COMMAND to PORT's file descriptor, with VALUE as an argument. | |
482 | Values for COMMAND are: | |
483 | ||
484 | F_DUPFD duplicate a file descriptor | |
485 | F_GETFD read the descriptor's close-on-exec flag | |
486 | F_SETFD set the descriptor's close-on-exec flag to VALUE | |
487 | F_GETFL read the descriptor's flags, as set on open | |
488 | F_SETFL set the descriptor's flags, as set on open to VALUE | |
489 | F_GETOWN return the process ID of a socket's owner, for SIGIO | |
490 | F_SETOWN set the process that owns a socket to VALUE, for SIGIO | |
491 | FD_CLOEXEC not sure what this is | |
492 | ||
493 | For details, see the documentation for the fcntl system call. | |
494 | ||
495 | *** The arguments to `select' have changed, for compatibility with | |
496 | SCSH. The TIMEOUT parameter may now be non-integral, yielding the | |
497 | expected behavior. The MILLISECONDS parameter has been changed to | |
498 | MICROSECONDS, to more closely resemble the underlying system call. | |
499 | The RVEC, WVEC, and EVEC arguments can now be vectors; the type of the | |
500 | corresponding return set will be the same. | |
501 | ||
502 | *** The arguments to the `mknod' system call have changed. They are | |
503 | now: | |
504 | ||
505 | (mknod PATH TYPE PERMS DEV) | |
506 | Create a new file (`node') in the file system. PATH is the name of | |
507 | the file to create. TYPE is the kind of file to create; it should | |
508 | be 'fifo, 'block-special, or 'char-special. PERMS specifies the | |
509 | permission bits to give the newly created file. If TYPE is | |
510 | 'block-special or 'char-special, DEV specifies which device the | |
511 | special file refers to; its interpretation depends on the kind of | |
512 | special file being created. | |
513 | ||
514 | *** The `fork' function has been renamed to `primitive-fork', to avoid | |
515 | clashing with various SCSH forks. | |
516 | ||
517 | *** The `recv' and `recvfrom' functions have been renamed to `recv!' | |
518 | and `recvfrom!'. They no longer accept a size for a second argument; | |
519 | you must pass a string to hold the received value. They no longer | |
520 | return the buffer. Instead, `recv' returns the length of the message | |
521 | received, and `recvfrom' returns a pair containing the packet's length | |
522 | and originating address. | |
523 | ||
524 | *** The file descriptor datatype has been removed, as have the | |
525 | `read-fd', `write-fd', `close', `lseek', and `dup' functions. | |
526 | We plan to replace these functions with a SCSH-compatible interface. | |
527 | ||
528 | *** The `create' function has been removed; it's just a special case | |
529 | of `open'. | |
530 | ||
531 | *** There are new functions to break down process termination status | |
532 | values. In the descriptions below, STATUS is a value returned by | |
533 | `waitpid'. | |
534 | ||
535 | (status:exit-val STATUS) | |
536 | If the child process exited normally, this function returns the exit | |
537 | code for the child process (i.e., the value passed to exit, or | |
538 | returned from main). If the child process did not exit normally, | |
539 | this function returns #f. | |
540 | ||
541 | (status:stop-sig STATUS) | |
542 | If the child process was suspended by a signal, this function | |
543 | returns the signal that suspended the child. Otherwise, it returns | |
544 | #f. | |
545 | ||
546 | (status:term-sig STATUS) | |
547 | If the child process terminated abnormally, this function returns | |
548 | the signal that terminated the child. Otherwise, this function | |
549 | returns false. | |
550 | ||
551 | POSIX promises that exactly one of these functions will return true on | |
552 | a valid STATUS value. | |
553 | ||
554 | These functions are compatible with SCSH. | |
555 | ||
556 | *** There are new accessors and setters for the broken-out time vectors | |
48d224d7 JB |
557 | returned by `localtime', `gmtime', and that ilk. They are: |
558 | ||
559 | Component Accessor Setter | |
560 | ========================= ============ ============ | |
561 | seconds tm:sec set-tm:sec | |
562 | minutes tm:min set-tm:min | |
563 | hours tm:hour set-tm:hour | |
564 | day of the month tm:mday set-tm:mday | |
565 | month tm:mon set-tm:mon | |
566 | year tm:year set-tm:year | |
567 | day of the week tm:wday set-tm:wday | |
568 | day in the year tm:yday set-tm:yday | |
569 | daylight saving time tm:isdst set-tm:isdst | |
570 | GMT offset, seconds tm:gmtoff set-tm:gmtoff | |
571 | name of time zone tm:zone set-tm:zone | |
572 | ||
095936d2 JB |
573 | *** There are new accessors for the vectors returned by `uname', |
574 | describing the host system: | |
48d224d7 JB |
575 | |
576 | Component Accessor | |
577 | ============================================== ================ | |
578 | name of the operating system implementation utsname:sysname | |
579 | network name of this machine utsname:nodename | |
580 | release level of the operating system utsname:release | |
581 | version level of the operating system utsname:version | |
582 | machine hardware platform utsname:machine | |
583 | ||
095936d2 JB |
584 | *** There are new accessors for the vectors returned by `getpw', |
585 | `getpwnam', `getpwuid', and `getpwent', describing entries from the | |
586 | system's user database: | |
587 | ||
588 | Component Accessor | |
589 | ====================== ================= | |
590 | user name passwd:name | |
591 | user password passwd:passwd | |
592 | user id passwd:uid | |
593 | group id passwd:gid | |
594 | real name passwd:gecos | |
595 | home directory passwd:dir | |
596 | shell program passwd:shell | |
597 | ||
598 | *** There are new accessors for the vectors returned by `getgr', | |
599 | `getgrnam', `getgrgid', and `getgrent', describing entries from the | |
600 | system's group database: | |
601 | ||
602 | Component Accessor | |
603 | ======================= ============ | |
604 | group name group:name | |
605 | group password group:passwd | |
606 | group id group:gid | |
607 | group members group:mem | |
608 | ||
609 | *** There are new accessors for the vectors returned by `gethost', | |
610 | `gethostbyaddr', `gethostbyname', and `gethostent', describing | |
611 | internet hosts: | |
612 | ||
613 | Component Accessor | |
614 | ========================= =============== | |
615 | official name of host hostent:name | |
616 | alias list hostent:aliases | |
617 | host address type hostent:addrtype | |
618 | length of address hostent:length | |
619 | list of addresses hostent:addr-list | |
620 | ||
621 | *** There are new accessors for the vectors returned by `getnet', | |
622 | `getnetbyaddr', `getnetbyname', and `getnetent', describing internet | |
623 | networks: | |
624 | ||
625 | Component Accessor | |
626 | ========================= =============== | |
627 | official name of net netent:name | |
628 | alias list netent:aliases | |
629 | net number type netent:addrtype | |
630 | net number netent:net | |
631 | ||
632 | *** There are new accessors for the vectors returned by `getproto', | |
633 | `getprotobyname', `getprotobynumber', and `getprotoent', describing | |
634 | internet protocols: | |
635 | ||
636 | Component Accessor | |
637 | ========================= =============== | |
638 | official protocol name protoent:name | |
639 | alias list protoent:aliases | |
640 | protocol number protoent:proto | |
641 | ||
642 | *** There are new accessors for the vectors returned by `getserv', | |
643 | `getservbyname', `getservbyport', and `getservent', describing | |
644 | internet protocols: | |
645 | ||
646 | Component Accessor | |
647 | ========================= =============== | |
648 | official service name servent:name | |
649 | alias list servent:aliases | |
650 | port number servent:port | |
651 | protocol to use servent:proto | |
652 | ||
653 | *** There are new accessors for the sockaddr structures returned by | |
654 | `accept', `getsockname', `getpeername', `recvfrom!': | |
655 | ||
656 | Component Accessor | |
657 | ======================================== =============== | |
658 | address format (`family') sockaddr:fam | |
659 | path, for file domain addresses sockaddr:path | |
660 | address, for internet domain addresses sockaddr:addr | |
661 | TCP or UDP port, for internet sockaddr:port | |
662 | ||
663 | *** The `getpwent', `getgrent', `gethostent', `getnetent', | |
664 | `getprotoent', and `getservent' functions now return #f at the end of | |
665 | the user database. (They used to throw an exception.) | |
666 | ||
667 | Note that calling MUMBLEent function is equivalent to calling the | |
668 | corresponding MUMBLE function with no arguments. | |
669 | ||
670 | *** The `setpwent', `setgrent', `sethostent', `setnetent', | |
671 | `setprotoent', and `setservent' routines now take no arguments. | |
672 | ||
673 | *** The `gethost', `getproto', `getnet', and `getserv' functions now | |
674 | provide more useful information when they throw an exception. | |
675 | ||
676 | *** The `lnaof' function has been renamed to `inet-lnaof'. | |
677 | ||
678 | *** Guile now claims to have the `current-time' feature. | |
679 | ||
680 | *** The `mktime' function now takes an optional second argument ZONE, | |
681 | giving the time zone to use for the conversion. ZONE should be a | |
682 | string, in the same format as expected for the "TZ" environment variable. | |
683 | ||
684 | *** The `strptime' function now returns a pair (TIME . COUNT), where | |
685 | TIME is the parsed time as a vector, and COUNT is the number of | |
686 | characters from the string left unparsed. This function used to | |
687 | return the remaining characters as a string. | |
688 | ||
689 | *** The `gettimeofday' function has replaced the old `time+ticks' function. | |
690 | The return value is now (SECONDS . MICROSECONDS); the fractional | |
691 | component is no longer expressed in "ticks". | |
692 | ||
693 | *** The `ticks/sec' constant has been removed, in light of the above change. | |
6685dc83 | 694 | |
ea00ecba MG |
695 | * Changes to the gh_ interface |
696 | ||
697 | ** gh_eval_str() now returns an SCM object which is the result of the | |
698 | evaluation | |
699 | ||
aaef0d2a MG |
700 | ** gh_scm2str() now copies the Scheme data to a caller-provided C |
701 | array | |
702 | ||
703 | ** gh_scm2newstr() now makes a C array, copies the Scheme data to it, | |
704 | and returns the array | |
705 | ||
706 | ** gh_scm2str0() is gone: there is no need to distinguish | |
707 | null-terminated from non-null-terminated, since gh_scm2newstr() allows | |
708 | the user to interpret the data both ways. | |
709 | ||
f3b1485f JB |
710 | * Changes to the scm_ interface |
711 | ||
095936d2 JB |
712 | ** The new function scm_symbol_value0 provides an easy way to get a |
713 | symbol's value from C code: | |
714 | ||
715 | SCM scm_symbol_value0 (char *NAME) | |
716 | Return the value of the symbol named by the null-terminated string | |
717 | NAME in the current module. If the symbol named NAME is unbound in | |
718 | the current module, return SCM_UNDEFINED. | |
719 | ||
720 | ** The new function scm_sysintern0 creates new top-level variables, | |
721 | without assigning them a value. | |
722 | ||
723 | SCM scm_sysintern0 (char *NAME) | |
724 | Create a new Scheme top-level variable named NAME. NAME is a | |
725 | null-terminated string. Return the variable's value cell. | |
726 | ||
727 | ** The function scm_internal_catch is the guts of catch. It handles | |
728 | all the mechanics of setting up a catch target, invoking the catch | |
729 | body, and perhaps invoking the handler if the body does a throw. | |
730 | ||
731 | The function is designed to be usable from C code, but is general | |
732 | enough to implement all the semantics Guile Scheme expects from throw. | |
733 | ||
734 | TAG is the catch tag. Typically, this is a symbol, but this function | |
735 | doesn't actually care about that. | |
736 | ||
737 | BODY is a pointer to a C function which runs the body of the catch; | |
738 | this is the code you can throw from. We call it like this: | |
739 | BODY (BODY_DATA, JMPBUF) | |
740 | where: | |
741 | BODY_DATA is just the BODY_DATA argument we received; we pass it | |
742 | through to BODY as its first argument. The caller can make | |
743 | BODY_DATA point to anything useful that BODY might need. | |
744 | JMPBUF is the Scheme jmpbuf object corresponding to this catch, | |
745 | which we have just created and initialized. | |
746 | ||
747 | HANDLER is a pointer to a C function to deal with a throw to TAG, | |
748 | should one occur. We call it like this: | |
749 | HANDLER (HANDLER_DATA, THROWN_TAG, THROW_ARGS) | |
750 | where | |
751 | HANDLER_DATA is the HANDLER_DATA argument we recevied; it's the | |
752 | same idea as BODY_DATA above. | |
753 | THROWN_TAG is the tag that the user threw to; usually this is | |
754 | TAG, but it could be something else if TAG was #t (i.e., a | |
755 | catch-all), or the user threw to a jmpbuf. | |
756 | THROW_ARGS is the list of arguments the user passed to the THROW | |
757 | function. | |
758 | ||
759 | BODY_DATA is just a pointer we pass through to BODY. HANDLER_DATA | |
760 | is just a pointer we pass through to HANDLER. We don't actually | |
761 | use either of those pointers otherwise ourselves. The idea is | |
762 | that, if our caller wants to communicate something to BODY or | |
763 | HANDLER, it can pass a pointer to it as MUMBLE_DATA, which BODY and | |
764 | HANDLER can then use. Think of it as a way to make BODY and | |
765 | HANDLER closures, not just functions; MUMBLE_DATA points to the | |
766 | enclosed variables. | |
767 | ||
768 | Of course, it's up to the caller to make sure that any data a | |
769 | MUMBLE_DATA needs is protected from GC. A common way to do this is | |
770 | to make MUMBLE_DATA a pointer to data stored in an automatic | |
771 | structure variable; since the collector must scan the stack for | |
772 | references anyway, this assures that any references in MUMBLE_DATA | |
773 | will be found. | |
774 | ||
775 | ** The new function scm_internal_lazy_catch is exactly like | |
776 | scm_internal_catch, except: | |
777 | ||
778 | - It does not unwind the stack (this is the major difference). | |
779 | - If handler returns, its value is returned from the throw. | |
780 | - BODY always receives #f as its JMPBUF argument (since there's no | |
781 | jmpbuf associated with a lazy catch, because we don't unwind the | |
782 | stack.) | |
783 | ||
784 | ** scm_body_thunk is a new body function you can pass to | |
785 | scm_internal_catch if you want the body to be like Scheme's `catch' | |
786 | --- a thunk, or a function of one argument if the tag is #f. | |
787 | ||
788 | BODY_DATA is a pointer to a scm_body_thunk_data structure, which | |
789 | contains the Scheme procedure to invoke as the body, and the tag | |
790 | we're catching. If the tag is #f, then we pass JMPBUF (created by | |
791 | scm_internal_catch) to the body procedure; otherwise, the body gets | |
792 | no arguments. | |
793 | ||
794 | ** scm_handle_by_proc is a new handler function you can pass to | |
795 | scm_internal_catch if you want the handler to act like Scheme's catch | |
796 | --- call a procedure with the tag and the throw arguments. | |
797 | ||
798 | If the user does a throw to this catch, this function runs a handler | |
799 | procedure written in Scheme. HANDLER_DATA is a pointer to an SCM | |
800 | variable holding the Scheme procedure object to invoke. It ought to | |
801 | be a pointer to an automatic variable (i.e., one living on the stack), | |
802 | or the procedure object should be otherwise protected from GC. | |
803 | ||
804 | ** scm_handle_by_message is a new handler function to use with | |
805 | `scm_internal_catch' if you want Guile to print a message and die. | |
806 | It's useful for dealing with throws to uncaught keys at the top level. | |
807 | ||
808 | HANDLER_DATA, if non-zero, is assumed to be a char * pointing to a | |
809 | message header to print; if zero, we use "guile" instead. That | |
810 | text is followed by a colon, then the message described by ARGS. | |
811 | ||
812 | ** The return type of scm_boot_guile is now void; the function does | |
813 | not return a value, and indeed, never returns at all. | |
814 | ||
f3b1485f JB |
815 | ** The new function scm_shell makes it easy for user applications to |
816 | process command-line arguments in a way that is compatible with the | |
817 | stand-alone guile interpreter (which is in turn compatible with SCSH, | |
818 | the Scheme shell). | |
819 | ||
820 | To use the scm_shell function, first initialize any guile modules | |
821 | linked into your application, and then call scm_shell with the values | |
822 | of ARGC and ARGV your `main' function received. scm_shell will adding | |
823 | any SCSH-style meta-arguments from the top of the script file to the | |
824 | argument vector, and then process the command-line arguments. This | |
825 | generally means loading a script file or starting up an interactive | |
826 | command interpreter. For details, see "Changes to the stand-alone | |
827 | interpreter" above. | |
828 | ||
095936d2 JB |
829 | ** The new functions scm_get_meta_args and scm_count_argv help you |
830 | implement the SCSH-style meta-argument, `\'. | |
831 | ||
832 | char **scm_get_meta_args (int ARGC, char **ARGV) | |
833 | If the second element of ARGV is a string consisting of a single | |
834 | backslash character (i.e. "\\" in Scheme notation), open the file | |
835 | named by the following argument, parse arguments from it, and return | |
836 | the spliced command line. The returned array is terminated by a | |
837 | null pointer. | |
838 | ||
839 | For details of argument parsing, see above, under "guile now accepts | |
840 | command-line arguments compatible with SCSH..." | |
841 | ||
842 | int scm_count_argv (char **ARGV) | |
843 | Count the arguments in ARGV, assuming it is terminated by a null | |
844 | pointer. | |
845 | ||
846 | For an example of how these functions might be used, see the source | |
847 | code for the function scm_shell in libguile/script.c. | |
848 | ||
849 | You will usually want to use scm_shell instead of calling this | |
850 | function yourself. | |
851 | ||
852 | ** The new function scm_compile_shell_switches turns an array of | |
853 | command-line arguments into Scheme code to carry out the actions they | |
854 | describe. Given ARGC and ARGV, it returns a Scheme expression to | |
855 | evaluate, and calls scm_set_program_arguments to make any remaining | |
856 | command-line arguments available to the Scheme code. For example, | |
857 | given the following arguments: | |
858 | ||
859 | -e main -s ekko a speckled gecko | |
860 | ||
861 | scm_set_program_arguments will return the following expression: | |
862 | ||
863 | (begin (load "ekko") (main (command-line)) (quit)) | |
864 | ||
865 | You will usually want to use scm_shell instead of calling this | |
866 | function yourself. | |
867 | ||
868 | ** The function scm_shell_usage prints a usage message appropriate for | |
869 | an interpreter that uses scm_compile_shell_switches to handle its | |
870 | command-line arguments. | |
871 | ||
872 | void scm_shell_usage (int FATAL, char *MESSAGE) | |
873 | Print a usage message to the standard error output. If MESSAGE is | |
874 | non-zero, write it before the usage message, followed by a newline. | |
875 | If FATAL is non-zero, exit the process, using FATAL as the | |
876 | termination status. (If you want to be compatible with Guile, | |
877 | always use 1 as the exit status when terminating due to command-line | |
878 | usage problems.) | |
879 | ||
880 | You will usually want to use scm_shell instead of calling this | |
881 | function yourself. | |
48d224d7 JB |
882 | |
883 | ** scm_eval_0str now returns SCM_UNSPECIFIED if the string contains no | |
095936d2 JB |
884 | expressions. It used to return SCM_EOL. Earth-shattering. |
885 | ||
886 | ** The macros for declaring scheme objects in C code have been | |
887 | rearranged slightly. They are now: | |
888 | ||
889 | SCM_SYMBOL (C_NAME, SCHEME_NAME) | |
890 | Declare a static SCM variable named C_NAME, and initialize it to | |
891 | point to the Scheme symbol whose name is SCHEME_NAME. C_NAME should | |
892 | be a C identifier, and SCHEME_NAME should be a C string. | |
893 | ||
894 | SCM_GLOBAL_SYMBOL (C_NAME, SCHEME_NAME) | |
895 | Just like SCM_SYMBOL, but make C_NAME globally visible. | |
896 | ||
897 | SCM_VCELL (C_NAME, SCHEME_NAME) | |
898 | Create a global variable at the Scheme level named SCHEME_NAME. | |
899 | Declare a static SCM variable named C_NAME, and initialize it to | |
900 | point to the Scheme variable's value cell. | |
901 | ||
902 | SCM_GLOBAL_VCELL (C_NAME, SCHEME_NAME) | |
903 | Just like SCM_VCELL, but make C_NAME globally visible. | |
904 | ||
905 | The `guile-snarf' script writes initialization code for these macros | |
906 | to its standard output, given C source code as input. | |
907 | ||
908 | The SCM_GLOBAL macro is gone. | |
909 | ||
910 | ** The scm_read_line and scm_read_line_x functions have been replaced | |
911 | by Scheme code based on the %read-delimited! procedure (known to C | |
912 | code as scm_read_delimited_x). See its description above for more | |
913 | information. | |
48d224d7 | 914 | |
095936d2 JB |
915 | ** The function scm_sys_open has been renamed to scm_open. It now |
916 | returns a port instead of an FD object. | |
ea00ecba | 917 | |
095936d2 JB |
918 | * The dynamic linking support has changed. For more information, see |
919 | libguile/DYNAMIC-LINKING. | |
ea00ecba | 920 | |
f7b47737 JB |
921 | \f |
922 | Guile 1.0b3 | |
3065a62a | 923 | |
f3b1485f JB |
924 | User-visible changes from Thursday, September 5, 1996 until Guile 1.0 |
925 | (Sun 5 Jan 1997): | |
3065a62a | 926 | |
4b521edb | 927 | * Changes to the 'guile' program: |
3065a62a | 928 | |
4b521edb JB |
929 | ** Guile now loads some new files when it starts up. Guile first |
930 | searches the load path for init.scm, and loads it if found. Then, if | |
931 | Guile is not being used to execute a script, and the user's home | |
932 | directory contains a file named `.guile', Guile loads that. | |
c6486f8a | 933 | |
4b521edb | 934 | ** You can now use Guile as a shell script interpreter. |
3065a62a JB |
935 | |
936 | To paraphrase the SCSH manual: | |
937 | ||
938 | When Unix tries to execute an executable file whose first two | |
939 | characters are the `#!', it treats the file not as machine code to | |
940 | be directly executed by the native processor, but as source code | |
941 | to be executed by some interpreter. The interpreter to use is | |
942 | specified immediately after the #! sequence on the first line of | |
943 | the source file. The kernel reads in the name of the interpreter, | |
944 | and executes that instead. It passes the interpreter the source | |
945 | filename as its first argument, with the original arguments | |
946 | following. Consult the Unix man page for the `exec' system call | |
947 | for more information. | |
948 | ||
1a1945be JB |
949 | Now you can use Guile as an interpreter, using a mechanism which is a |
950 | compatible subset of that provided by SCSH. | |
951 | ||
3065a62a JB |
952 | Guile now recognizes a '-s' command line switch, whose argument is the |
953 | name of a file of Scheme code to load. It also treats the two | |
954 | characters `#!' as the start of a comment, terminated by `!#'. Thus, | |
955 | to make a file of Scheme code directly executable by Unix, insert the | |
956 | following two lines at the top of the file: | |
957 | ||
958 | #!/usr/local/bin/guile -s | |
959 | !# | |
960 | ||
961 | Guile treats the argument of the `-s' command-line switch as the name | |
962 | of a file of Scheme code to load, and treats the sequence `#!' as the | |
963 | start of a block comment, terminated by `!#'. | |
964 | ||
965 | For example, here's a version of 'echo' written in Scheme: | |
966 | ||
967 | #!/usr/local/bin/guile -s | |
968 | !# | |
969 | (let loop ((args (cdr (program-arguments)))) | |
970 | (if (pair? args) | |
971 | (begin | |
972 | (display (car args)) | |
973 | (if (pair? (cdr args)) | |
974 | (display " ")) | |
975 | (loop (cdr args))))) | |
976 | (newline) | |
977 | ||
978 | Why does `#!' start a block comment terminated by `!#', instead of the | |
979 | end of the line? That is the notation SCSH uses, and although we | |
980 | don't yet support the other SCSH features that motivate that choice, | |
981 | we would like to be backward-compatible with any existing Guile | |
3763761c JB |
982 | scripts once we do. Furthermore, if the path to Guile on your system |
983 | is too long for your kernel, you can start the script with this | |
984 | horrible hack: | |
985 | ||
986 | #!/bin/sh | |
987 | exec /really/long/path/to/guile -s "$0" ${1+"$@"} | |
988 | !# | |
3065a62a JB |
989 | |
990 | Note that some very old Unix systems don't support the `#!' syntax. | |
991 | ||
c6486f8a | 992 | |
4b521edb | 993 | ** You can now run Guile without installing it. |
6685dc83 JB |
994 | |
995 | Previous versions of the interactive Guile interpreter (`guile') | |
996 | couldn't start up unless Guile's Scheme library had been installed; | |
997 | they used the value of the environment variable `SCHEME_LOAD_PATH' | |
998 | later on in the startup process, but not to find the startup code | |
999 | itself. Now Guile uses `SCHEME_LOAD_PATH' in all searches for Scheme | |
1000 | code. | |
1001 | ||
1002 | To run Guile without installing it, build it in the normal way, and | |
1003 | then set the environment variable `SCHEME_LOAD_PATH' to a | |
1004 | colon-separated list of directories, including the top-level directory | |
1005 | of the Guile sources. For example, if you unpacked Guile so that the | |
1006 | full filename of this NEWS file is /home/jimb/guile-1.0b3/NEWS, then | |
1007 | you might say | |
1008 | ||
1009 | export SCHEME_LOAD_PATH=/home/jimb/my-scheme:/home/jimb/guile-1.0b3 | |
1010 | ||
c6486f8a | 1011 | |
4b521edb JB |
1012 | ** Guile's read-eval-print loop no longer prints #<unspecified> |
1013 | results. If the user wants to see this, she can evaluate the | |
1014 | expression (assert-repl-print-unspecified #t), perhaps in her startup | |
48d224d7 | 1015 | file. |
6685dc83 | 1016 | |
4b521edb JB |
1017 | ** Guile no longer shows backtraces by default when an error occurs; |
1018 | however, it does display a message saying how to get one, and how to | |
1019 | request that they be displayed by default. After an error, evaluate | |
1020 | (backtrace) | |
1021 | to see a backtrace, and | |
1022 | (debug-enable 'backtrace) | |
1023 | to see them by default. | |
6685dc83 | 1024 | |
6685dc83 | 1025 | |
d9fb83d9 | 1026 | |
4b521edb JB |
1027 | * Changes to Guile Scheme: |
1028 | ||
1029 | ** Guile now distinguishes between #f and the empty list. | |
1030 | ||
1031 | This is for compatibility with the IEEE standard, the (possibly) | |
1032 | upcoming Revised^5 Report on Scheme, and many extant Scheme | |
1033 | implementations. | |
1034 | ||
1035 | Guile used to have #f and '() denote the same object, to make Scheme's | |
1036 | type system more compatible with Emacs Lisp's. However, the change | |
1037 | caused too much trouble for Scheme programmers, and we found another | |
1038 | way to reconcile Emacs Lisp with Scheme that didn't require this. | |
1039 | ||
1040 | ||
1041 | ** Guile's delq, delv, delete functions, and their destructive | |
c6486f8a JB |
1042 | counterparts, delq!, delv!, and delete!, now remove all matching |
1043 | elements from the list, not just the first. This matches the behavior | |
1044 | of the corresponding Emacs Lisp functions, and (I believe) the Maclisp | |
1045 | functions which inspired them. | |
1046 | ||
1047 | I recognize that this change may break code in subtle ways, but it | |
1048 | seems best to make the change before the FSF's first Guile release, | |
1049 | rather than after. | |
1050 | ||
1051 | ||
4b521edb | 1052 | ** The compiled-library-path function has been deleted from libguile. |
6685dc83 | 1053 | |
4b521edb | 1054 | ** The facilities for loading Scheme source files have changed. |
c6486f8a | 1055 | |
4b521edb | 1056 | *** The variable %load-path now tells Guile which directories to search |
6685dc83 JB |
1057 | for Scheme code. Its value is a list of strings, each of which names |
1058 | a directory. | |
1059 | ||
4b521edb JB |
1060 | *** The variable %load-extensions now tells Guile which extensions to |
1061 | try appending to a filename when searching the load path. Its value | |
1062 | is a list of strings. Its default value is ("" ".scm"). | |
1063 | ||
1064 | *** (%search-load-path FILENAME) searches the directories listed in the | |
1065 | value of the %load-path variable for a Scheme file named FILENAME, | |
1066 | with all the extensions listed in %load-extensions. If it finds a | |
1067 | match, then it returns its full filename. If FILENAME is absolute, it | |
1068 | returns it unchanged. Otherwise, it returns #f. | |
6685dc83 | 1069 | |
4b521edb JB |
1070 | %search-load-path will not return matches that refer to directories. |
1071 | ||
1072 | *** (primitive-load FILENAME :optional CASE-INSENSITIVE-P SHARP) | |
1073 | uses %seach-load-path to find a file named FILENAME, and loads it if | |
1074 | it finds it. If it can't read FILENAME for any reason, it throws an | |
1075 | error. | |
6685dc83 JB |
1076 | |
1077 | The arguments CASE-INSENSITIVE-P and SHARP are interpreted as by the | |
4b521edb JB |
1078 | `read' function. |
1079 | ||
1080 | *** load uses the same searching semantics as primitive-load. | |
1081 | ||
1082 | *** The functions %try-load, try-load-with-path, %load, load-with-path, | |
1083 | basic-try-load-with-path, basic-load-with-path, try-load-module-with- | |
1084 | path, and load-module-with-path have been deleted. The functions | |
1085 | above should serve their purposes. | |
1086 | ||
1087 | *** If the value of the variable %load-hook is a procedure, | |
1088 | `primitive-load' applies its value to the name of the file being | |
1089 | loaded (without the load path directory name prepended). If its value | |
1090 | is #f, it is ignored. Otherwise, an error occurs. | |
1091 | ||
1092 | This is mostly useful for printing load notification messages. | |
1093 | ||
1094 | ||
1095 | ** The function `eval!' is no longer accessible from the scheme level. | |
1096 | We can't allow operations which introduce glocs into the scheme level, | |
1097 | because Guile's type system can't handle these as data. Use `eval' or | |
1098 | `read-and-eval!' (see below) as replacement. | |
1099 | ||
1100 | ** The new function read-and-eval! reads an expression from PORT, | |
1101 | evaluates it, and returns the result. This is more efficient than | |
1102 | simply calling `read' and `eval', since it is not necessary to make a | |
1103 | copy of the expression for the evaluator to munge. | |
1104 | ||
1105 | Its optional arguments CASE_INSENSITIVE_P and SHARP are interpreted as | |
1106 | for the `read' function. | |
1107 | ||
1108 | ||
1109 | ** The function `int?' has been removed; its definition was identical | |
1110 | to that of `integer?'. | |
1111 | ||
1112 | ** The functions `<?', `<?', `<=?', `=?', `>?', and `>=?'. Code should | |
1113 | use the R4RS names for these functions. | |
1114 | ||
1115 | ** The function object-properties no longer returns the hash handle; | |
1116 | it simply returns the object's property list. | |
1117 | ||
1118 | ** Many functions have been changed to throw errors, instead of | |
1119 | returning #f on failure. The point of providing exception handling in | |
1120 | the language is to simplify the logic of user code, but this is less | |
1121 | useful if Guile's primitives don't throw exceptions. | |
1122 | ||
1123 | ** The function `fileno' has been renamed from `%fileno'. | |
1124 | ||
1125 | ** The function primitive-mode->fdes returns #t or #f now, not 1 or 0. | |
1126 | ||
1127 | ||
1128 | * Changes to Guile's C interface: | |
1129 | ||
1130 | ** The library's initialization procedure has been simplified. | |
1131 | scm_boot_guile now has the prototype: | |
1132 | ||
1133 | void scm_boot_guile (int ARGC, | |
1134 | char **ARGV, | |
1135 | void (*main_func) (), | |
1136 | void *closure); | |
1137 | ||
1138 | scm_boot_guile calls MAIN_FUNC, passing it CLOSURE, ARGC, and ARGV. | |
1139 | MAIN_FUNC should do all the work of the program (initializing other | |
1140 | packages, reading user input, etc.) before returning. When MAIN_FUNC | |
1141 | returns, call exit (0); this function never returns. If you want some | |
1142 | other exit value, MAIN_FUNC may call exit itself. | |
1143 | ||
1144 | scm_boot_guile arranges for program-arguments to return the strings | |
1145 | given by ARGC and ARGV. If MAIN_FUNC modifies ARGC/ARGV, should call | |
1146 | scm_set_program_arguments with the final list, so Scheme code will | |
1147 | know which arguments have been processed. | |
1148 | ||
1149 | scm_boot_guile establishes a catch-all catch handler which prints an | |
1150 | error message and exits the process. This means that Guile exits in a | |
1151 | coherent way when system errors occur and the user isn't prepared to | |
1152 | handle it. If the user doesn't like this behavior, they can establish | |
1153 | their own universal catcher in MAIN_FUNC to shadow this one. | |
1154 | ||
1155 | Why must the caller do all the real work from MAIN_FUNC? The garbage | |
1156 | collector assumes that all local variables of type SCM will be above | |
1157 | scm_boot_guile's stack frame on the stack. If you try to manipulate | |
1158 | SCM values after this function returns, it's the luck of the draw | |
1159 | whether the GC will be able to find the objects you allocate. So, | |
1160 | scm_boot_guile function exits, rather than returning, to discourage | |
1161 | people from making that mistake. | |
1162 | ||
1163 | The IN, OUT, and ERR arguments were removed; there are other | |
1164 | convenient ways to override these when desired. | |
1165 | ||
1166 | The RESULT argument was deleted; this function should never return. | |
1167 | ||
1168 | The BOOT_CMD argument was deleted; the MAIN_FUNC argument is more | |
1169 | general. | |
1170 | ||
1171 | ||
1172 | ** Guile's header files should no longer conflict with your system's | |
1173 | header files. | |
1174 | ||
1175 | In order to compile code which #included <libguile.h>, previous | |
1176 | versions of Guile required you to add a directory containing all the | |
1177 | Guile header files to your #include path. This was a problem, since | |
1178 | Guile's header files have names which conflict with many systems' | |
1179 | header files. | |
1180 | ||
1181 | Now only <libguile.h> need appear in your #include path; you must | |
1182 | refer to all Guile's other header files as <libguile/mumble.h>. | |
1183 | Guile's installation procedure puts libguile.h in $(includedir), and | |
1184 | the rest in $(includedir)/libguile. | |
1185 | ||
1186 | ||
1187 | ** Two new C functions, scm_protect_object and scm_unprotect_object, | |
1188 | have been added to the Guile library. | |
1189 | ||
1190 | scm_protect_object (OBJ) protects OBJ from the garbage collector. | |
1191 | OBJ will not be freed, even if all other references are dropped, | |
1192 | until someone does scm_unprotect_object (OBJ). Both functions | |
1193 | return OBJ. | |
1194 | ||
1195 | Note that calls to scm_protect_object do not nest. You can call | |
1196 | scm_protect_object any number of times on a given object, and the | |
1197 | next call to scm_unprotect_object will unprotect it completely. | |
1198 | ||
1199 | Basically, scm_protect_object and scm_unprotect_object just | |
1200 | maintain a list of references to things. Since the GC knows about | |
1201 | this list, all objects it mentions stay alive. scm_protect_object | |
1202 | adds its argument to the list; scm_unprotect_object remove its | |
1203 | argument from the list. | |
1204 | ||
1205 | ||
1206 | ** scm_eval_0str now returns the value of the last expression | |
1207 | evaluated. | |
1208 | ||
1209 | ** The new function scm_read_0str reads an s-expression from a | |
1210 | null-terminated string, and returns it. | |
1211 | ||
1212 | ** The new function `scm_stdio_to_port' converts a STDIO file pointer | |
1213 | to a Scheme port object. | |
1214 | ||
1215 | ** The new function `scm_set_program_arguments' allows C code to set | |
1216 | the value teruturned by the Scheme `program-arguments' function. | |
6685dc83 | 1217 | |
6685dc83 | 1218 | \f |
1a1945be JB |
1219 | Older changes: |
1220 | ||
1221 | * Guile no longer includes sophisticated Tcl/Tk support. | |
1222 | ||
1223 | The old Tcl/Tk support was unsatisfying to us, because it required the | |
1224 | user to link against the Tcl library, as well as Tk and Guile. The | |
1225 | interface was also un-lispy, in that it preserved Tcl/Tk's practice of | |
1226 | referring to widgets by names, rather than exporting widgets to Scheme | |
1227 | code as a special datatype. | |
1228 | ||
1229 | In the Usenix Tk Developer's Workshop held in July 1996, the Tcl/Tk | |
1230 | maintainers described some very interesting changes in progress to the | |
1231 | Tcl/Tk internals, which would facilitate clean interfaces between lone | |
1232 | Tk and other interpreters --- even for garbage-collected languages | |
1233 | like Scheme. They expected the new Tk to be publicly available in the | |
1234 | fall of 1996. | |
1235 | ||
1236 | Since it seems that Guile might soon have a new, cleaner interface to | |
1237 | lone Tk, and that the old Guile/Tk glue code would probably need to be | |
1238 | completely rewritten, we (Jim Blandy and Richard Stallman) have | |
1239 | decided not to support the old code. We'll spend the time instead on | |
1240 | a good interface to the newer Tk, as soon as it is available. | |
5c54da76 | 1241 | |
8512dea6 | 1242 | Until then, gtcltk-lib provides trivial, low-maintenance functionality. |
deb95d71 | 1243 | |
5c54da76 JB |
1244 | \f |
1245 | Copyright information: | |
1246 | ||
ea00ecba | 1247 | Copyright (C) 1996,1997 Free Software Foundation, Inc. |
5c54da76 JB |
1248 | |
1249 | Permission is granted to anyone to make or distribute verbatim copies | |
1250 | of this document as received, in any medium, provided that the | |
1251 | copyright notice and this permission notice are preserved, | |
1252 | thus giving the recipient permission to redistribute in turn. | |
1253 | ||
1254 | Permission is granted to distribute modified versions | |
1255 | of this document, or of portions of it, | |
1256 | under the above conditions, provided also that they | |
1257 | carry prominent notices stating who last changed them. | |
1258 | ||
48d224d7 JB |
1259 | \f |
1260 | Local variables: | |
1261 | mode: outline | |
1262 | paragraph-separate: "[ \f]*$" | |
1263 | end: | |
1264 |