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