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