1 Guile NEWS --- history of user-visible changes. -*- text -*-
2 Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
3 See the end for copying conditions.
5 Please send Guile bug reports to bug-guile@gnu.org.
7 Changes since Guile 1.3.4:
9 * New primitive: `simple-format', affects `scm-error', scm_display_error, & scm_error message strings
11 (ice-9 boot) makes `format' an alias for `simple-format' until possibly
12 extended by the more sophisticated version in (ice-9 format)
14 (simple-format port message . args)
15 Write MESSAGE to DESTINATION, defaulting to `current-output-port'.
16 MESSAGE can contain ~A (was %s) and ~S (was %S) escapes. When printed,
17 the escapes are replaced with corresponding members of ARGS:
18 ~A formats using `display' and ~S formats using `write'.
19 If DESTINATION is #t, then use the `current-output-port',
20 if DESTINATION is #f, then return a string containing the formatted text.
21 Does not add a trailing newline."
23 The two C procedures: scm_display_error and scm_error, as well as the
24 primitive `scm-error', now use scm_format to do their work. This means
25 that the message strings of all code must be updated to use ~A where %s
26 was used before, and ~S where %S was used before.
28 During the period when there still are a lot of old Guiles out there,
29 you might want to support both old and new versions of Guile.
31 There are basically two methods to achieve this. Both methods use
34 AC_CHECK_FUNCS(scm_simple_format)
38 Method 1: Use the string concatenation features of ANSI C's
43 #ifdef HAVE_SCM_SIMPLE_FORMAT
49 Then represent each of your error messages using a preprocessor macro:
51 #define E_SPIDER_ERROR "There's a spider in your " ## FMT_S ## "!!!"
55 (define fmt-s (if (defined? 'simple-format) "~S" "%S"))
56 (define make-message string-append)
58 (define e-spider-error (make-message "There's a spider in your " fmt-s "!!!"))
60 Method 2: Use the oldfmt function found in doc/oldfmt.c.
64 scm_misc_error ("picnic", scm_c_oldfmt0 ("There's a spider in your ~S!!!"),
69 (scm-error 'misc-error "picnic" (oldfmt "There's a spider in your ~S!!!")
72 * Massive software engineering face-lift by Greg J. Badros <gjb@cs.washington.edu>
74 Now Guile primitives are defined using the GUILE_PROC/GUILE_PROC1 macros
75 and must contain a docstring that is extracted into foo.doc using a new
76 guile-doc-snarf script (that uses guile-doc-snarf.awk).
78 Also, many SCM_VALIDATE_* macros are defined to ease the redundancy and
79 improve the readability of argument checking.
81 All (nearly?) K&R prototypes for functions replaced with ANSI C equivalents.
83 * Dynamic linking now uses libltdl from the libtool package.
85 The old system dependent code for doing dynamic linking has been
86 replaced with calls to the libltdl functions which do all the hairy
89 The major improvement is that you can now directly pass libtool
90 library names like "libfoo.la" to `dynamic-link' and `dynamic-link'
91 will be able to do the best shared library job you can get, via
94 The way dynamic libraries are found has changed and is not really
95 portable across platforms, probably. It is therefore recommended to
96 use absolute filenames when possible.
98 If you pass a filename without an extension to `dynamic-link', it will
99 try a few appropriate ones. Thus, the most platform ignorant way is
100 to specify a name like "libfoo", without any directories and
103 * Changes to the distribution
105 ** Trees from nightly snapshots and CVS now require you to run autogen.sh.
107 We've changed the way we handle generated files in the Guile source
108 repository. As a result, the procedure for building trees obtained
109 from the nightly FTP snapshots or via CVS has changed:
110 - You must have appropriate versions of autoconf, automake, and
111 libtool installed on your system. See README for info on how to
112 obtain these programs.
113 - Before configuring the tree, you must first run the script
114 `autogen.sh' at the top of the source tree.
116 The Guile repository used to contain not only source files, written by
117 humans, but also some generated files, like configure scripts and
118 Makefile.in files. Even though the contents of these files could be
119 derived mechanically from other files present, we thought it would
120 make the tree easier to build if we checked them into CVS.
122 However, this approach means that minor differences between
123 developer's installed tools and habits affected the whole team.
124 So we have removed the generated files from the repository, and
125 added the autogen.sh script, which will reconstruct them
129 ** configure now has experimental options to remove support for certain
132 --disable-arrays omit array and uniform array support
133 --disable-posix omit posix interfaces
134 --disable-networking omit networking interfaces
135 --disable-regex omit regular expression interfaces
137 These are likely to become separate modules some day.
139 ** Added new configure option --enable-debug-freelist
141 This enables a debugging version of SCM_NEWCELL(), and also registers
142 an extra primitive, the setter `gc-set-debug-check-freelist!'.
144 Configure with the --enable-debug-freelist option to enable
145 the gc-set-debug-check-freelist! primitive, and then use:
147 (gc-set-debug-check-freelist! #t) # turn on checking of the freelist
148 (gc-set-debug-check-freelist! #f) # turn off checking
150 Checking of the freelist forces a traversal of the freelist and
151 a garbage collection before each allocation of a cell. This can
152 slow down the interpreter dramatically, so the setter should be used to
153 turn on this extra processing only when necessary.
155 * Changes to the stand-alone interpreter
157 ** New primitives: `pkgdata-dir', `site-dir', `library-dir'
159 ** Positions of erring expression in scripts
161 With version 1.3.4, the location of the erring expression in Guile
162 scipts is no longer automatically reported. (This should have been
163 documented before the 1.3.4 release.)
165 You can get this information by enabling recording of positions of
166 source expressions and running the debugging evaluator. Put this at
167 the top of your script (or in your "site" file):
169 (read-enable 'positions)
170 (debug-enable 'debug)
172 ** Backtraces in scripts
174 It is now possible to get backtraces in scripts.
178 (debug-enable 'debug 'backtrace)
180 at the top of the script.
182 (The first options enables the debugging evaluator.
183 The second enables backtraces.)
185 ** New procedure: port-closed? PORT
186 Returns #t if PORT is closed or #f if it is open.
188 ** Attempting to get the value of an unbound variable now produces
189 an exception with a key of 'unbound-variable instead of 'misc-error.
191 * Changes to the scm_ interface
193 ** Port internals: the rw_random variable in the scm_port structure
194 must be set to non-zero in any random access port. In recent Guile
195 releases it was only set for bidirectional random-access ports.
197 ** Port internals: the seek ptob procedure is now responsible for
198 resetting the buffers if required. The change was made so that in the
199 special case of reading the current position (i.e., seek p 0 SEEK_CUR)
200 the fport and strport ptobs can avoid resetting the buffers,
201 in particular to avoid discarding unread chars. An existing port
202 type can be fixed by adding something like the following to the
203 beginning of the ptob seek procedure:
205 if (pt->rw_active == SCM_PORT_READ)
206 scm_end_input (object);
207 else if (pt->rw_active == SCM_PORT_WRITE)
208 ptob->flush (object);
210 although to actually avoid resetting the buffers and discard unread
211 chars requires further hacking that depends on the characteristics
214 ** The scm_sysmissing procedure is no longer used in libguile.
215 Unless it turns out to be unexpectedly useful to somebody, it will be
216 removed in a future version.
218 * Changes to system call interfaces:
220 ** If a facility is not available on the system when Guile is
221 compiled, the corresponding primitive procedure will not be defined.
222 Previously it would have been defined but would throw a system-error
223 exception if called. Exception handlers which catch this case may
224 need minor modification: an error will be thrown with key
225 'unbound-variable instead of 'system-error. Alternatively it's
226 now possible to use `defined?' to check whether the facility is
229 ** Procedures which depend on the timezone should now give the correct
230 result on systems which cache the TZ environment variable, even if TZ
231 is changed without calling tzset.
233 * Changes to the networking interfaces:
235 ** New functions: htons, ntohs, htonl, ntohl: for converting short and
236 long integers between network and host format. For now, it's not
237 particularly convenient to do this kind of thing, but consider:
239 (define write-network-long
241 (let ((v (make-uniform-vector 1 1 0)))
242 (uniform-vector-set! v 0 (htonl value))
243 (uniform-vector-write v port))))
245 (define read-network-long
247 (let ((v (make-uniform-vector 1 1 0)))
248 (uniform-vector-read! v port)
249 (ntohl (uniform-vector-ref v 0)))))
251 ** If inet-aton fails, it now throws an error with key 'misc-error
252 instead of 'system-error, since errno is not relevant.
254 ** Certain gethostbyname/gethostbyaddr failures now throw errors with
255 specific keys instead of 'system-error. The latter is inappropriate
256 since errno will not have been set. The keys are:
257 'host-not-found, 'try-again, 'no-recovery and 'no-data.
259 ** sethostent, setnetent, setprotoent, setservent: now take an
260 optional argument STAYOPEN, which specifies whether the database
261 remains open after a database entry is accessed randomly (e.g., using
262 gethostbyname for the hosts database.) The default is #f. Previously
266 Changes since Guile 1.3.2:
268 * Changes to the stand-alone interpreter
272 An initial version of the Guile debugger written by Chris Hanson has
273 been added. The debugger is still under development but is included
274 in the distribution anyway since it is already quite useful.
280 after an error to enter the debugger. Type `help' inside the debugger
281 for a description of available commands.
283 If you prefer to have stack frames numbered and printed in
284 anti-chronological order and prefer up in the stack to be down on the
285 screen as is the case in gdb, you can put
287 (debug-enable 'backwards)
289 in your .guile startup file. (However, this means that Guile can't
290 use indentation to indicate stack level.)
292 The debugger is autoloaded into Guile at the first use.
294 ** Further enhancements to backtraces
296 There is a new debug option `width' which controls the maximum width
297 on the screen of printed stack frames. Fancy printing parameters
298 ("level" and "length" as in Common LISP) are adaptively adjusted for
299 each stack frame to give maximum information while still fitting
300 within the bounds. If the stack frame can't be made to fit by
301 adjusting parameters, it is simply cut off at the end. This is marked
304 ** Some modules are now only loaded when the repl is started
306 The modules (ice-9 debug), (ice-9 session), (ice-9 threads) and (ice-9
307 regex) are now loaded into (guile-user) only if the repl has been
308 started. The effect is that the startup time for scripts has been
309 reduced to 30% of what it was previously.
311 Correctly written scripts load the modules they require at the top of
312 the file and should not be affected by this change.
314 ** Hooks are now represented as smobs
316 * Changes to Scheme functions and syntax
318 ** Readline support has changed again.
320 The old (readline-activator) module is gone. Use (ice-9 readline)
321 instead, which now contains all readline functionality. So the code
322 to activate readline is now
324 (use-modules (ice-9 readline))
327 This should work at any time, including from the guile prompt.
329 To avoid confusion about the terms of Guile's license, please only
330 enable readline for your personal use; please don't make it the
331 default for others. Here is why we make this rather odd-sounding
334 Guile is normally licensed under a weakened form of the GNU General
335 Public License, which allows you to link code with Guile without
336 placing that code under the GPL. This exception is important to some
339 However, since readline is distributed under the GNU General Public
340 License, when you link Guile with readline, either statically or
341 dynamically, you effectively change Guile's license to the strict GPL.
342 Whenever you link any strictly GPL'd code into Guile, uses of Guile
343 which are normally permitted become forbidden. This is a rather
344 non-obvious consequence of the licensing terms.
346 So, to make sure things remain clear, please let people choose for
347 themselves whether to link GPL'd libraries like readline with Guile.
349 ** regexp-substitute/global has changed slightly, but incompatibly.
351 If you include a function in the item list, the string of the match
352 object it receives is the same string passed to
353 regexp-substitute/global, not some suffix of that string.
354 Correspondingly, the match's positions are relative to the entire
355 string, not the suffix.
357 If the regexp can match the empty string, the way matches are chosen
358 from the string has changed. regexp-substitute/global recognizes the
359 same set of matches that list-matches does; see below.
361 ** New function: list-matches REGEXP STRING [FLAGS]
363 Return a list of match objects, one for every non-overlapping, maximal
364 match of REGEXP in STRING. The matches appear in left-to-right order.
365 list-matches only reports matches of the empty string if there are no
366 other matches which begin on, end at, or include the empty match's
369 If present, FLAGS is passed as the FLAGS argument to regexp-exec.
371 ** New function: fold-matches REGEXP STRING INIT PROC [FLAGS]
373 For each match of REGEXP in STRING, apply PROC to the match object,
374 and the last value PROC returned, or INIT for the first call. Return
375 the last value returned by PROC. We apply PROC to the matches as they
376 appear from left to right.
378 This function recognizes matches according to the same criteria as
381 Thus, you could define list-matches like this:
383 (define (list-matches regexp string . flags)
384 (reverse! (apply fold-matches regexp string '() cons flags)))
386 If present, FLAGS is passed as the FLAGS argument to regexp-exec.
390 *** New function: hook? OBJ
392 Return #t if OBJ is a hook, otherwise #f.
394 *** New function: make-hook-with-name NAME [ARITY]
396 Return a hook with name NAME and arity ARITY. The default value for
397 ARITY is 0. The only effect of NAME is that it will appear when the
398 hook object is printed to ease debugging.
400 *** New function: hook-empty? HOOK
402 Return #t if HOOK doesn't contain any procedures, otherwise #f.
404 *** New function: hook->list HOOK
406 Return a list of the procedures that are called when run-hook is
409 ** `map' signals an error if its argument lists are not all the same length.
411 This is the behavior required by R5RS, so this change is really a bug
412 fix. But it seems to affect a lot of people's code, so we're
413 mentioning it here anyway.
415 ** Print-state handling has been made more transparent
417 Under certain circumstances, ports are represented as a port with an
418 associated print state. Earlier, this pair was represented as a pair
419 (see "Some magic has been added to the printer" below). It is now
420 indistinguishable (almost; see `get-print-state') from a port on the
423 *** New function: port-with-print-state OUTPUT-PORT PRINT-STATE
425 Return a new port with the associated print state PRINT-STATE.
427 *** New function: get-print-state OUTPUT-PORT
429 Return the print state associated with this port if it exists,
432 *** New function: directory-stream? OBJECT
434 Returns true iff OBJECT is a directory stream --- the sort of object
435 returned by `opendir'.
437 ** New function: using-readline?
439 Return #t if readline is in use in the current repl.
441 ** structs will be removed in 1.4
443 Structs will be replaced in Guile 1.4. We will merge GOOPS into Guile
444 and use GOOPS objects as the fundamental record type.
446 * Changes to the scm_ interface
448 ** structs will be removed in 1.4
450 The entire current struct interface (struct.c, struct.h) will be
451 replaced in Guile 1.4. We will merge GOOPS into libguile and use
452 GOOPS objects as the fundamental record type.
454 ** The internal representation of subr's has changed
456 Instead of giving a hint to the subr name, the CAR field of the subr
457 now contains an index to a subr entry in scm_subr_table.
459 *** New variable: scm_subr_table
461 An array of subr entries. A subr entry contains the name, properties
462 and documentation associated with the subr. The properties and
463 documentation slots are not yet used.
465 ** A new scheme for "forwarding" calls to a builtin to a generic function
467 It is now possible to extend the functionality of some Guile
468 primitives by letting them defer a call to a GOOPS generic function on
469 argument mismatch. This means that there is no loss of efficiency in
474 (use-modules (oop goops)) ; Must be GOOPS version 0.2.
475 (define-method + ((x <string>) (y <string>))
478 + will still be as efficient as usual in numerical calculations, but
479 can also be used for concatenating strings.
481 Who will be the first one to extend Guile's numerical tower to
482 rationals? :) [OK, there a few other things to fix before this can
483 be made in a clean way.]
485 *** New snarf macros for defining primitives: SCM_GPROC, SCM_GPROC1
487 New macro: SCM_GPROC (CNAME, SNAME, REQ, OPT, VAR, CFUNC, GENERIC)
489 New macro: SCM_GPROC1 (CNAME, SNAME, TYPE, CFUNC, GENERIC)
491 These do the same job as SCM_PROC and SCM_PROC1, but they also define
492 a variable GENERIC which can be used by the dispatch macros below.
494 [This is experimental code which may change soon.]
496 *** New macros for forwarding control to a generic on arg type error
498 New macro: SCM_WTA_DISPATCH_1 (GENERIC, ARG1, POS, SUBR)
500 New macro: SCM_WTA_DISPATCH_2 (GENERIC, ARG1, ARG2, POS, SUBR)
502 These correspond to the scm_wta function call, and have the same
503 behaviour until the user has called the GOOPS primitive
504 `enable-primitive-generic!'. After that, these macros will apply the
505 generic function GENERIC to the argument(s) instead of calling
508 [This is experimental code which may change soon.]
510 *** New macros for argument testing with generic dispatch
512 New macro: SCM_GASSERT1 (COND, GENERIC, ARG1, POS, SUBR)
514 New macro: SCM_GASSERT2 (COND, GENERIC, ARG1, ARG2, POS, SUBR)
516 These correspond to the SCM_ASSERT macro, but will defer control to
517 GENERIC on error after `enable-primitive-generic!' has been called.
519 [This is experimental code which may change soon.]
521 ** New function: SCM scm_eval_body (SCM body, SCM env)
523 Evaluates the body of a special form.
525 ** The internal representation of struct's has changed
527 Previously, four slots were allocated for the procedure(s) of entities
528 and operators. The motivation for this representation had to do with
529 the structure of the evaluator, the wish to support tail-recursive
530 generic functions, and efficiency. Since the generic function
531 dispatch mechanism has changed, there is no longer a need for such an
532 expensive representation, and the representation has been simplified.
534 This should not make any difference for most users.
536 ** GOOPS support has been cleaned up.
538 Some code has been moved from eval.c to objects.c and code in both of
539 these compilation units has been cleaned up and better structured.
541 *** New functions for applying generic functions
543 New function: SCM scm_apply_generic (GENERIC, ARGS)
544 New function: SCM scm_call_generic_0 (GENERIC)
545 New function: SCM scm_call_generic_1 (GENERIC, ARG1)
546 New function: SCM scm_call_generic_2 (GENERIC, ARG1, ARG2)
547 New function: SCM scm_call_generic_3 (GENERIC, ARG1, ARG2, ARG3)
549 ** Deprecated function: scm_make_named_hook
551 It is now replaced by:
553 ** New function: SCM scm_create_hook (const char *name, int arity)
555 Creates a hook in the same way as make-hook above but also
556 binds a variable named NAME to it.
558 This is the typical way of creating a hook from C code.
560 Currently, the variable is created in the "current" module.
561 This might change when we get the new module system.
563 [The behaviour is identical to scm_make_named_hook.]
567 Changes since Guile 1.3:
569 * Changes to mailing lists
571 ** Some of the Guile mailing lists have moved to sourceware.cygnus.com.
573 See the README file to find current addresses for all the Guile
576 * Changes to the distribution
578 ** Readline support is no longer included with Guile by default.
580 Based on the different license terms of Guile and Readline, we
581 concluded that Guile should not *by default* cause the linking of
582 Readline into an application program. Readline support is now offered
583 as a separate module, which is linked into an application only when
584 you explicitly specify it.
586 Although Guile is GNU software, its distribution terms add a special
587 exception to the usual GNU General Public License (GPL). Guile's
588 license includes a clause that allows you to link Guile with non-free
589 programs. We add this exception so as not to put Guile at a
590 disadvantage vis-a-vis other extensibility packages that support other
593 In contrast, the GNU Readline library is distributed under the GNU
594 General Public License pure and simple. This means that you may not
595 link Readline, even dynamically, into an application unless it is
596 distributed under a free software license that is compatible the GPL.
598 Because of this difference in distribution terms, an application that
599 can use Guile may not be able to use Readline. Now users will be
600 explicitly offered two independent decisions about the use of these
603 You can activate the readline support by issuing
605 (use-modules (readline-activator))
608 from your ".guile" file, for example.
610 * Changes to the stand-alone interpreter
612 ** All builtins now print as primitives.
613 Previously builtin procedures not belonging to the fundamental subr
614 types printed as #<compiled closure #<primitive-procedure gsubr-apply>>.
615 Now, they print as #<primitive-procedure NAME>.
617 ** Backtraces slightly more intelligible.
618 gsubr-apply and macro transformer application frames no longer appear
621 * Changes to Scheme functions and syntax
623 ** Guile now correctly handles internal defines by rewriting them into
624 their equivalent letrec. Previously, internal defines would
625 incrementally add to the innermost environment, without checking
626 whether the restrictions specified in RnRS were met. This lead to the
627 correct behaviour when these restriction actually were met, but didn't
628 catch all illegal uses. Such an illegal use could lead to crashes of
629 the Guile interpreter or or other unwanted results. An example of
630 incorrect internal defines that made Guile behave erratically:
642 The problem with this example is that the definition of `c' uses the
643 value of `b' directly. This confuses the meoization machine of Guile
644 so that the second call of `b' (this time in a larger environment that
645 also contains bindings for `c' and `d') refers to the binding of `c'
646 instead of `a'. You could also make Guile crash with a variation on
651 (define (b flag) (if flag a 1))
652 (define c (1+ (b flag)))
660 From now on, Guile will issue an `Unbound variable: b' error message
665 A hook contains a list of functions which should be called on
666 particular occasions in an existing program. Hooks are used for
669 A window manager might have a hook before-window-map-hook. The window
670 manager uses the function run-hooks to call all functions stored in
671 before-window-map-hook each time a window is mapped. The user can
672 store functions in the hook using add-hook!.
674 In Guile, hooks are first class objects.
676 *** New function: make-hook [N_ARGS]
678 Return a hook for hook functions which can take N_ARGS arguments.
679 The default value for N_ARGS is 0.
681 (See also scm_make_named_hook below.)
683 *** New function: add-hook! HOOK PROC [APPEND_P]
685 Put PROC at the beginning of the list of functions stored in HOOK.
686 If APPEND_P is supplied, and non-false, put PROC at the end instead.
688 PROC must be able to take the number of arguments specified when the
691 If PROC already exists in HOOK, then remove it first.
693 *** New function: remove-hook! HOOK PROC
695 Remove PROC from the list of functions in HOOK.
697 *** New function: reset-hook! HOOK
699 Clear the list of hook functions stored in HOOK.
701 *** New function: run-hook HOOK ARG1 ...
703 Run all hook functions stored in HOOK with arguments ARG1 ... .
704 The number of arguments supplied must correspond to the number given
705 when the hook was created.
707 ** The function `dynamic-link' now takes optional keyword arguments.
708 The only keyword argument that is currently defined is `:global
709 BOOL'. With it, you can control whether the shared library will be
710 linked in global mode or not. In global mode, the symbols from the
711 linked library can be used to resolve references from other
712 dynamically linked libraries. In non-global mode, the linked
713 library is essentially invisible and can only be accessed via
714 `dynamic-func', etc. The default is now to link in global mode.
715 Previously, the default has been non-global mode.
717 The `#:global' keyword is only effective on platforms that support
718 the dlopen family of functions.
720 ** New function `provided?'
722 - Function: provided? FEATURE
723 Return true iff FEATURE is supported by this installation of
724 Guile. FEATURE must be a symbol naming a feature; the global
725 variable `*features*' is a list of available features.
727 ** Changes to the module (ice-9 expect):
729 *** The expect-strings macro now matches `$' in a regular expression
730 only at a line-break or end-of-file by default. Previously it would
731 match the end of the string accumulated so far. The old behaviour
732 can be obtained by setting the variable `expect-strings-exec-flags'
735 *** The expect-strings macro now uses a variable `expect-strings-exec-flags'
736 for the regexp-exec flags. If `regexp/noteol' is included, then `$'
737 in a regular expression will still match before a line-break or
738 end-of-file. The default is `regexp/noteol'.
740 *** The expect-strings macro now uses a variable
741 `expect-strings-compile-flags' for the flags to be supplied to
742 `make-regexp'. The default is `regexp/newline', which was previously
745 *** The expect macro now supplies two arguments to a match procedure:
746 the current accumulated string and a flag to indicate whether
747 end-of-file has been reached. Previously only the string was supplied.
748 If end-of-file is reached, the match procedure will be called an
749 additional time with the same accumulated string as the previous call
750 but with the flag set.
752 ** New module (ice-9 format), implementing the Common Lisp `format' function.
754 This code, and the documentation for it that appears here, was
755 borrowed from SLIB, with minor adaptations for Guile.
757 - Function: format DESTINATION FORMAT-STRING . ARGUMENTS
758 An almost complete implementation of Common LISP format description
759 according to the CL reference book `Common LISP' from Guy L.
760 Steele, Digital Press. Backward compatible to most of the
761 available Scheme format implementations.
763 Returns `#t', `#f' or a string; has side effect of printing
764 according to FORMAT-STRING. If DESTINATION is `#t', the output is
765 to the current output port and `#t' is returned. If DESTINATION
766 is `#f', a formatted string is returned as the result of the call.
767 NEW: If DESTINATION is a string, DESTINATION is regarded as the
768 format string; FORMAT-STRING is then the first argument and the
769 output is returned as a string. If DESTINATION is a number, the
770 output is to the current error port if available by the
771 implementation. Otherwise DESTINATION must be an output port and
774 FORMAT-STRING must be a string. In case of a formatting error
775 format returns `#f' and prints a message on the current output or
776 error port. Characters are output as if the string were output by
777 the `display' function with the exception of those prefixed by a
778 tilde (~). For a detailed description of the FORMAT-STRING syntax
779 please consult a Common LISP format reference manual. For a test
780 suite to verify this format implementation load `formatst.scm'.
781 Please send bug reports to `lutzeb@cs.tu-berlin.de'.
783 Note: `format' is not reentrant, i.e. only one `format'-call may
784 be executed at a time.
787 *** Format Specification (Format version 3.0)
789 Please consult a Common LISP format reference manual for a detailed
790 description of the format string syntax. For a demonstration of the
791 implemented directives see `formatst.scm'.
793 This implementation supports directive parameters and modifiers (`:'
794 and `@' characters). Multiple parameters must be separated by a comma
795 (`,'). Parameters can be numerical parameters (positive or negative),
796 character parameters (prefixed by a quote character (`''), variable
797 parameters (`v'), number of rest arguments parameter (`#'), empty and
798 default parameters. Directive characters are case independent. The
799 general form of a directive is:
801 DIRECTIVE ::= ~{DIRECTIVE-PARAMETER,}[:][@]DIRECTIVE-CHARACTER
803 DIRECTIVE-PARAMETER ::= [ [-|+]{0-9}+ | 'CHARACTER | v | # ]
805 *** Implemented CL Format Control Directives
807 Documentation syntax: Uppercase characters represent the
808 corresponding control directive characters. Lowercase characters
809 represent control directive parameter descriptions.
812 Any (print as `display' does).
816 `~MINCOL,COLINC,MINPAD,PADCHARA'
820 S-expression (print as `write' does).
824 `~MINCOL,COLINC,MINPAD,PADCHARS'
830 print number sign always.
833 print comma separated.
835 `~MINCOL,PADCHAR,COMMACHARD'
841 print number sign always.
844 print comma separated.
846 `~MINCOL,PADCHAR,COMMACHARX'
852 print number sign always.
855 print comma separated.
857 `~MINCOL,PADCHAR,COMMACHARO'
863 print number sign always.
866 print comma separated.
868 `~MINCOL,PADCHAR,COMMACHARB'
873 `~N,MINCOL,PADCHAR,COMMACHARR'
877 print a number as a Roman numeral.
880 print a number as an "old fashioned" Roman numeral.
883 print a number as an ordinal English number.
886 print a number as a cardinal English number.
891 prints `y' and `ies'.
894 as `~P but jumps 1 argument backward.'
897 as `~@P but jumps 1 argument backward.'
902 prints a character as the reader can understand it (i.e. `#\'
906 prints a character as emacs does (eg. `^C' for ASCII 03).
909 Fixed-format floating-point (prints a flonum like MMM.NNN).
910 `~WIDTH,DIGITS,SCALE,OVERFLOWCHAR,PADCHARF'
912 If the number is positive a plus sign is printed.
915 Exponential floating-point (prints a flonum like MMM.NNN`E'EE).
916 `~WIDTH,DIGITS,EXPONENTDIGITS,SCALE,OVERFLOWCHAR,PADCHAR,EXPONENTCHARE'
918 If the number is positive a plus sign is printed.
921 General floating-point (prints a flonum either fixed or
923 `~WIDTH,DIGITS,EXPONENTDIGITS,SCALE,OVERFLOWCHAR,PADCHAR,EXPONENTCHARG'
925 If the number is positive a plus sign is printed.
928 Dollars floating-point (prints a flonum in fixed with signs
930 `~DIGITS,SCALE,WIDTH,PADCHAR$'
932 If the number is positive a plus sign is printed.
935 A sign is always printed and appears before the padding.
938 The sign appears before the padding.
946 print newline if not at the beginning of the output line.
948 prints `~&' and then N-1 newlines.
953 print N page separators.
963 newline is ignored, white space left.
966 newline is left, white space ignored.
977 Indirection (expects indirect arguments as a list).
979 extracts indirect arguments from format arguments.
982 Case conversion (converts by `string-downcase').
984 converts by `string-capitalize'.
987 converts by `string-capitalize-first'.
990 converts by `string-upcase'.
993 Argument Jumping (jumps 1 argument forward).
995 jumps N arguments forward.
998 jumps 1 argument backward.
1001 jumps N arguments backward.
1004 jumps to the 0th argument.
1007 jumps to the Nth argument (beginning from 0)
1009 `~[STR0~;STR1~;...~;STRN~]'
1010 Conditional Expression (numerical clause conditional).
1012 take argument from N.
1015 true test conditional.
1018 if-else-then conditional.
1024 default clause follows.
1027 Iteration (args come from the next argument (a list)).
1029 at most N iterations.
1032 args from next arg (a list of lists).
1035 args from the rest of arguments.
1038 args from the rest args (lists).
1049 aborts if N <= M <= K
1051 *** Not Implemented CL Format Control Directives
1054 print `#f' as an empty list (see below).
1057 print `#f' as an empty list (see below).
1063 (sorry I don't understand its semantics completely)
1065 *** Extended, Replaced and Additional Control Directives
1067 `~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHD'
1068 `~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHX'
1069 `~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHO'
1070 `~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHB'
1071 `~N,MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHR'
1072 COMMAWIDTH is the number of characters between two comma
1076 print a R4RS complex number as `~F~@Fi' with passed parameters for
1080 Pretty print formatting of an argument for scheme code lists.
1086 Flushes the output if format DESTINATION is a port.
1089 Print a `#\space' character
1091 print N `#\space' characters.
1094 Print a `#\tab' character
1096 print N `#\tab' characters.
1099 Takes N as an integer representation for a character. No arguments
1100 are consumed. N is converted to a character by `integer->char'. N
1101 must be a positive decimal number.
1104 Print out readproof. Prints out internal objects represented as
1105 `#<...>' as strings `"#<...>"' so that the format output can always
1106 be processed by `read'.
1109 Print out readproof. Prints out internal objects represented as
1110 `#<...>' as strings `"#<...>"' so that the format output can always
1111 be processed by `read'.
1114 Prints information and a copyright notice on the format
1117 prints format version.
1120 may also print number strings, i.e. passing a number as a string
1121 and format it accordingly.
1123 *** Configuration Variables
1125 The format module exports some configuration variables to suit the
1126 systems and users needs. There should be no modification necessary for
1127 the configuration that comes with Guile. Format detects automatically
1128 if the running scheme system implements floating point numbers and
1131 format:symbol-case-conv
1132 Symbols are converted by `symbol->string' so the case type of the
1133 printed symbols is implementation dependent.
1134 `format:symbol-case-conv' is a one arg closure which is either
1135 `#f' (no conversion), `string-upcase', `string-downcase' or
1136 `string-capitalize'. (default `#f')
1138 format:iobj-case-conv
1139 As FORMAT:SYMBOL-CASE-CONV but applies for the representation of
1140 implementation internal objects. (default `#f')
1143 The character prefixing the exponent value in `~E' printing.
1146 *** Compatibility With Other Format Implementations
1152 Downward compatible except for padding support and `~A', `~S',
1153 `~P', `~X' uppercase printing. SLIB format 1.4 uses C-style
1154 `printf' padding support which is completely replaced by the CL
1155 `format' padding style.
1158 Downward compatible except for `~', which is not documented
1159 (ignores all characters inside the format string up to a newline
1160 character). (7.1 implements `~a', `~s', ~NEWLINE, `~~', `~%',
1161 numerical and variable parameters and `:/@' modifiers in the CL
1165 Downward compatible except for `~A' and `~S' which print in
1166 uppercase. (Elk implements `~a', `~s', `~~', and `~%' (no
1167 directive parameters or modifiers)).
1170 Downward compatible except for an optional destination parameter:
1171 S2C accepts a format call without a destination which returns a
1172 formatted string. This is equivalent to a #f destination in S2C.
1173 (S2C implements `~a', `~s', `~c', `~%', and `~~' (no directive
1174 parameters or modifiers)).
1177 ** Changes to string-handling functions.
1179 These functions were added to support the (ice-9 format) module, above.
1181 *** New function: string-upcase STRING
1182 *** New function: string-downcase STRING
1184 These are non-destructive versions of the existing string-upcase! and
1185 string-downcase! functions.
1187 *** New function: string-capitalize! STRING
1188 *** New function: string-capitalize STRING
1190 These functions convert the first letter of each word in the string to
1193 (string-capitalize "howdy there")
1196 As with the other functions, string-capitalize! modifies the string in
1197 place, while string-capitalize returns a modified copy of its argument.
1199 *** New function: string-ci->symbol STRING
1201 Return a symbol whose name is STRING, but having the same case as if
1202 the symbol had be read by `read'.
1204 Guile can be configured to be sensitive or insensitive to case
1205 differences in Scheme identifiers. If Guile is case-insensitive, all
1206 symbols are converted to lower case on input. The `string-ci->symbol'
1207 function returns a symbol whose name in STRING, transformed as Guile
1208 would if STRING were input.
1210 *** New function: substring-move! STRING1 START END STRING2 START
1212 Copy the substring of STRING1 from START (inclusive) to END
1213 (exclusive) to STRING2 at START. STRING1 and STRING2 may be the same
1214 string, and the source and destination areas may overlap; in all
1215 cases, the function behaves as if all the characters were copied
1218 *** Extended functions: substring-move-left! substring-move-right!
1220 These functions now correctly copy arbitrarily overlapping substrings;
1221 they are both synonyms for substring-move!.
1224 ** New module (ice-9 getopt-long), with the function `getopt-long'.
1226 getopt-long is a function for parsing command-line arguments in a
1227 manner consistent with other GNU programs.
1229 (getopt-long ARGS GRAMMAR)
1230 Parse the arguments ARGS according to the argument list grammar GRAMMAR.
1232 ARGS should be a list of strings. Its first element should be the
1233 name of the program; subsequent elements should be the arguments
1234 that were passed to the program on the command line. The
1235 `program-arguments' procedure returns a list of this form.
1237 GRAMMAR is a list of the form:
1238 ((OPTION (PROPERTY VALUE) ...) ...)
1240 Each OPTION should be a symbol. `getopt-long' will accept a
1241 command-line option named `--OPTION'.
1242 Each option can have the following (PROPERTY VALUE) pairs:
1244 (single-char CHAR) --- Accept `-CHAR' as a single-character
1245 equivalent to `--OPTION'. This is how to specify traditional
1247 (required? BOOL) --- If BOOL is true, the option is required.
1248 getopt-long will raise an error if it is not found in ARGS.
1249 (value BOOL) --- If BOOL is #t, the option accepts a value; if
1250 it is #f, it does not; and if it is the symbol
1251 `optional', the option may appear in ARGS with or
1253 (predicate FUNC) --- If the option accepts a value (i.e. you
1254 specified `(value #t)' for this option), then getopt
1255 will apply FUNC to the value, and throw an exception
1256 if it returns #f. FUNC should be a procedure which
1257 accepts a string and returns a boolean value; you may
1258 need to use quasiquotes to get it into GRAMMAR.
1260 The (PROPERTY VALUE) pairs may occur in any order, but each
1261 property may occur only once. By default, options do not have
1262 single-character equivalents, are not required, and do not take
1265 In ARGS, single-character options may be combined, in the usual
1266 Unix fashion: ("-x" "-y") is equivalent to ("-xy"). If an option
1267 accepts values, then it must be the last option in the
1268 combination; the value is the next argument. So, for example, using
1269 the following grammar:
1270 ((apples (single-char #\a))
1271 (blimps (single-char #\b) (value #t))
1272 (catalexis (single-char #\c) (value #t)))
1273 the following argument lists would be acceptable:
1274 ("-a" "-b" "bang" "-c" "couth") ("bang" and "couth" are the values
1275 for "blimps" and "catalexis")
1276 ("-ab" "bang" "-c" "couth") (same)
1277 ("-ac" "couth" "-b" "bang") (same)
1278 ("-abc" "couth" "bang") (an error, since `-b' is not the
1279 last option in its combination)
1281 If an option's value is optional, then `getopt-long' decides
1282 whether it has a value by looking at what follows it in ARGS. If
1283 the next element is a string, and it does not appear to be an
1284 option itself, then that string is the option's value.
1286 The value of a long option can appear as the next element in ARGS,
1287 or it can follow the option name, separated by an `=' character.
1288 Thus, using the same grammar as above, the following argument lists
1290 ("--apples" "Braeburn" "--blimps" "Goodyear")
1291 ("--apples=Braeburn" "--blimps" "Goodyear")
1292 ("--blimps" "Goodyear" "--apples=Braeburn")
1294 If the option "--" appears in ARGS, argument parsing stops there;
1295 subsequent arguments are returned as ordinary arguments, even if
1296 they resemble options. So, in the argument list:
1297 ("--apples" "Granny Smith" "--" "--blimp" "Goodyear")
1298 `getopt-long' will recognize the `apples' option as having the
1299 value "Granny Smith", but it will not recognize the `blimp'
1300 option; it will return the strings "--blimp" and "Goodyear" as
1301 ordinary argument strings.
1303 The `getopt-long' function returns the parsed argument list as an
1304 assocation list, mapping option names --- the symbols from GRAMMAR
1305 --- onto their values, or #t if the option does not accept a value.
1306 Unused options do not appear in the alist.
1308 All arguments that are not the value of any option are returned
1309 as a list, associated with the empty list.
1311 `getopt-long' throws an exception if:
1312 - it finds an unrecognized option in ARGS
1313 - a required option is omitted
1314 - an option that requires an argument doesn't get one
1315 - an option that doesn't accept an argument does get one (this can
1316 only happen using the long option `--opt=value' syntax)
1317 - an option predicate fails
1322 `((lockfile-dir (required? #t)
1325 (predicate ,file-is-directory?))
1326 (verbose (required? #f)
1329 (x-includes (single-char #\x))
1330 (rnet-server (single-char #\y)
1331 (predicate ,string?))))
1333 (getopt-long '("my-prog" "-vk" "/tmp" "foo1" "--x-includes=/usr/include"
1334 "--rnet-server=lamprod" "--" "-fred" "foo2" "foo3")
1336 => ((() "foo1" "-fred" "foo2" "foo3")
1337 (rnet-server . "lamprod")
1338 (x-includes . "/usr/include")
1339 (lockfile-dir . "/tmp")
1342 ** The (ice-9 getopt-gnu-style) module is obsolete; use (ice-9 getopt-long).
1344 It will be removed in a few releases.
1346 ** New syntax: lambda*
1347 ** New syntax: define*
1348 ** New syntax: define*-public
1349 ** New syntax: defmacro*
1350 ** New syntax: defmacro*-public
1351 Guile now supports optional arguments.
1353 `lambda*', `define*', `define*-public', `defmacro*' and
1354 `defmacro*-public' are identical to the non-* versions except that
1355 they use an extended type of parameter list that has the following BNF
1356 syntax (parentheses are literal, square brackets indicate grouping,
1357 and `*', `+' and `?' have the usual meaning):
1359 ext-param-list ::= ( [identifier]* [#&optional [ext-var-decl]+]?
1360 [#&key [ext-var-decl]+ [#&allow-other-keys]?]?
1361 [[#&rest identifier]|[. identifier]]? ) | [identifier]
1363 ext-var-decl ::= identifier | ( identifier expression )
1365 The semantics are best illustrated with the following documentation
1366 and examples for `lambda*':
1369 lambda extended for optional and keyword arguments
1371 lambda* creates a procedure that takes optional arguments. These
1372 are specified by putting them inside brackets at the end of the
1373 paramater list, but before any dotted rest argument. For example,
1374 (lambda* (a b #&optional c d . e) '())
1375 creates a procedure with fixed arguments a and b, optional arguments c
1376 and d, and rest argument e. If the optional arguments are omitted
1377 in a call, the variables for them are unbound in the procedure. This
1378 can be checked with the bound? macro.
1380 lambda* can also take keyword arguments. For example, a procedure
1382 (lambda* (#&key xyzzy larch) '())
1383 can be called with any of the argument lists (#:xyzzy 11)
1384 (#:larch 13) (#:larch 42 #:xyzzy 19) (). Whichever arguments
1385 are given as keywords are bound to values.
1387 Optional and keyword arguments can also be given default values
1388 which they take on when they are not present in a call, by giving a
1389 two-item list in place of an optional argument, for example in:
1390 (lambda* (foo #&optional (bar 42) #&key (baz 73)) (list foo bar baz))
1391 foo is a fixed argument, bar is an optional argument with default
1392 value 42, and baz is a keyword argument with default value 73.
1393 Default value expressions are not evaluated unless they are needed
1394 and until the procedure is called.
1396 lambda* now supports two more special parameter list keywords.
1398 lambda*-defined procedures now throw an error by default if a
1399 keyword other than one of those specified is found in the actual
1400 passed arguments. However, specifying #&allow-other-keys
1401 immediately after the kyword argument declarations restores the
1402 previous behavior of ignoring unknown keywords. lambda* also now
1403 guarantees that if the same keyword is passed more than once, the
1404 last one passed is the one that takes effect. For example,
1405 ((lambda* (#&key (heads 0) (tails 0)) (display (list heads tails)))
1406 #:heads 37 #:tails 42 #:heads 99)
1407 would result in (99 47) being displayed.
1409 #&rest is also now provided as a synonym for the dotted syntax rest
1410 argument. The argument lists (a . b) and (a #&rest b) are equivalent in
1411 all respects to lambda*. This is provided for more similarity to DSSSL,
1412 MIT-Scheme and Kawa among others, as well as for refugees from other
1415 Further documentation may be found in the optargs.scm file itself.
1417 The optional argument module also exports the macros `let-optional',
1418 `let-optional*', `let-keywords', `let-keywords*' and `bound?'. These
1419 are not documented here because they may be removed in the future, but
1420 full documentation is still available in optargs.scm.
1422 ** New syntax: and-let*
1423 Guile now supports the `and-let*' form, described in the draft SRFI-2.
1425 Syntax: (land* (<clause> ...) <body> ...)
1426 Each <clause> should have one of the following forms:
1427 (<variable> <expression>)
1430 Each <variable> or <bound-variable> should be an identifier. Each
1431 <expression> should be a valid expression. The <body> should be a
1432 possibly empty sequence of expressions, like the <body> of a
1435 Semantics: A LAND* expression is evaluated by evaluating the
1436 <expression> or <bound-variable> of each of the <clause>s from
1437 left to right. The value of the first <expression> or
1438 <bound-variable> that evaluates to a false value is returned; the
1439 remaining <expression>s and <bound-variable>s are not evaluated.
1440 The <body> forms are evaluated iff all the <expression>s and
1441 <bound-variable>s evaluate to true values.
1443 The <expression>s and the <body> are evaluated in an environment
1444 binding each <variable> of the preceding (<variable> <expression>)
1445 clauses to the value of the <expression>. Later bindings
1446 shadow earlier bindings.
1448 Guile's and-let* macro was contributed by Michael Livshin.
1450 ** New sorting functions
1452 *** New function: sorted? SEQUENCE LESS?
1453 Returns `#t' when the sequence argument is in non-decreasing order
1454 according to LESS? (that is, there is no adjacent pair `... x y
1455 ...' for which `(less? y x)').
1457 Returns `#f' when the sequence contains at least one out-of-order
1458 pair. It is an error if the sequence is neither a list nor a
1461 *** New function: merge LIST1 LIST2 LESS?
1462 LIST1 and LIST2 are sorted lists.
1463 Returns the sorted list of all elements in LIST1 and LIST2.
1465 Assume that the elements a and b1 in LIST1 and b2 in LIST2 are "equal"
1466 in the sense that (LESS? x y) --> #f for x, y in {a, b1, b2},
1467 and that a < b1 in LIST1. Then a < b1 < b2 in the result.
1468 (Here "<" should read "comes before".)
1470 *** New procedure: merge! LIST1 LIST2 LESS?
1471 Merges two lists, re-using the pairs of LIST1 and LIST2 to build
1472 the result. If the code is compiled, and LESS? constructs no new
1473 pairs, no pairs at all will be allocated. The first pair of the
1474 result will be either the first pair of LIST1 or the first pair of
1477 *** New function: sort SEQUENCE LESS?
1478 Accepts either a list or a vector, and returns a new sequence
1479 which is sorted. The new sequence is the same type as the input.
1480 Always `(sorted? (sort sequence less?) less?)'. The original
1481 sequence is not altered in any way. The new sequence shares its
1482 elements with the old one; no elements are copied.
1484 *** New procedure: sort! SEQUENCE LESS
1485 Returns its sorted result in the original boxes. No new storage is
1486 allocated at all. Proper usage: (set! slist (sort! slist <))
1488 *** New function: stable-sort SEQUENCE LESS?
1489 Similar to `sort' but stable. That is, if "equal" elements are
1490 ordered a < b in the original sequence, they will have the same order
1493 *** New function: stable-sort! SEQUENCE LESS?
1494 Similar to `sort!' but stable.
1495 Uses temporary storage when sorting vectors.
1497 *** New functions: sort-list, sort-list!
1498 Added for compatibility with scsh.
1500 ** New built-in random number support
1502 *** New function: random N [STATE]
1503 Accepts a positive integer or real N and returns a number of the
1504 same type between zero (inclusive) and N (exclusive). The values
1505 returned have a uniform distribution.
1507 The optional argument STATE must be of the type produced by
1508 `copy-random-state' or `seed->random-state'. It defaults to the value
1509 of the variable `*random-state*'. This object is used to maintain the
1510 state of the pseudo-random-number generator and is altered as a side
1511 effect of the `random' operation.
1513 *** New variable: *random-state*
1514 Holds a data structure that encodes the internal state of the
1515 random-number generator that `random' uses by default. The nature
1516 of this data structure is implementation-dependent. It may be
1517 printed out and successfully read back in, but may or may not
1518 function correctly as a random-number state object in another
1521 *** New function: copy-random-state [STATE]
1522 Returns a new object of type suitable for use as the value of the
1523 variable `*random-state*' and as a second argument to `random'.
1524 If argument STATE is given, a copy of it is returned. Otherwise a
1525 copy of `*random-state*' is returned.
1527 *** New function: seed->random-state SEED
1528 Returns a new object of type suitable for use as the value of the
1529 variable `*random-state*' and as a second argument to `random'.
1530 SEED is a string or a number. A new state is generated and
1531 initialized using SEED.
1533 *** New function: random:uniform [STATE]
1534 Returns an uniformly distributed inexact real random number in the
1535 range between 0 and 1.
1537 *** New procedure: random:solid-sphere! VECT [STATE]
1538 Fills VECT with inexact real random numbers the sum of whose
1539 squares is less than 1.0. Thinking of VECT as coordinates in
1540 space of dimension N = `(vector-length VECT)', the coordinates are
1541 uniformly distributed within the unit N-shere. The sum of the
1542 squares of the numbers is returned. VECT can be either a vector
1543 or a uniform vector of doubles.
1545 *** New procedure: random:hollow-sphere! VECT [STATE]
1546 Fills VECT with inexact real random numbers the sum of whose squares
1547 is equal to 1.0. Thinking of VECT as coordinates in space of
1548 dimension n = `(vector-length VECT)', the coordinates are uniformly
1549 distributed over the surface of the unit n-shere. VECT can be either
1550 a vector or a uniform vector of doubles.
1552 *** New function: random:normal [STATE]
1553 Returns an inexact real in a normal distribution with mean 0 and
1554 standard deviation 1. For a normal distribution with mean M and
1555 standard deviation D use `(+ M (* D (random:normal)))'.
1557 *** New procedure: random:normal-vector! VECT [STATE]
1558 Fills VECT with inexact real random numbers which are independent and
1559 standard normally distributed (i.e., with mean 0 and variance 1).
1560 VECT can be either a vector or a uniform vector of doubles.
1562 *** New function: random:exp STATE
1563 Returns an inexact real in an exponential distribution with mean 1.
1564 For an exponential distribution with mean U use (* U (random:exp)).
1566 ** The range of logand, logior, logxor, logtest, and logbit? have changed.
1568 These functions now operate on numbers in the range of a C unsigned
1571 These functions used to operate on numbers in the range of a C signed
1572 long; however, this seems inappropriate, because Guile integers don't
1575 ** New function: make-guardian
1576 This is an implementation of guardians as described in
1577 R. Kent Dybvig, Carl Bruggeman, and David Eby (1993) "Guardians in a
1578 Generation-Based Garbage Collector" ACM SIGPLAN Conference on
1579 Programming Language Design and Implementation, June 1993
1580 ftp://ftp.cs.indiana.edu/pub/scheme-repository/doc/pubs/guardians.ps.gz
1582 ** New functions: delq1!, delv1!, delete1!
1583 These procedures behave similar to delq! and friends but delete only
1584 one object if at all.
1586 ** New function: unread-string STRING PORT
1587 Unread STRING to PORT, that is, push it back onto the port so that
1588 next read operation will work on the pushed back characters.
1590 ** unread-char can now be called multiple times
1591 If unread-char is called multiple times, the unread characters will be
1592 read again in last-in first-out order.
1594 ** the procedures uniform-array-read! and uniform-array-write! now
1595 work on any kind of port, not just ports which are open on a file.
1597 ** Now 'l' in a port mode requests line buffering.
1599 ** The procedure truncate-file now works on string ports as well
1600 as file ports. If the size argument is omitted, the current
1601 file position is used.
1603 ** new procedure: seek PORT/FDES OFFSET WHENCE
1604 The arguments are the same as for the old fseek procedure, but it
1605 works on string ports as well as random-access file ports.
1607 ** the fseek procedure now works on string ports, since it has been
1608 redefined using seek.
1610 ** the setvbuf procedure now uses a default size if mode is _IOFBF and
1611 size is not supplied.
1613 ** the newline procedure no longer flushes the port if it's not
1614 line-buffered: previously it did if it was the current output port.
1616 ** open-pipe and close-pipe are no longer primitive procedures, but
1617 an emulation can be obtained using `(use-modules (ice-9 popen))'.
1619 ** the freopen procedure has been removed.
1621 ** new procedure: drain-input PORT
1622 Drains PORT's read buffers (including any pushed-back characters)
1623 and returns the contents as a single string.
1625 ** New function: map-in-order PROC LIST1 LIST2 ...
1626 Version of `map' which guarantees that the procedure is applied to the
1627 lists in serial order.
1629 ** Renamed `serial-array-copy!' and `serial-array-map!' to
1630 `array-copy-in-order!' and `array-map-in-order!'. The old names are
1631 now obsolete and will go away in release 1.5.
1633 ** New syntax: collect BODY1 ...
1634 Version of `begin' which returns a list of the results of the body
1635 forms instead of the result of the last body form. In contrast to
1636 `begin', `collect' allows an empty body.
1638 ** New functions: read-history FILENAME, write-history FILENAME
1639 Read/write command line history from/to file. Returns #t on success
1640 and #f if an error occured.
1642 ** `ls' and `lls' in module (ice-9 ls) now handle no arguments.
1644 These procedures return a list of definitions available in the specified
1645 argument, a relative module reference. In the case of no argument,
1646 `(current-module)' is now consulted for definitions to return, instead
1647 of simply returning #f, the former behavior.
1649 ** The #/ syntax for lists is no longer supported.
1651 Earlier versions of Scheme accepted this syntax, but printed a
1654 ** Guile no longer consults the SCHEME_LOAD_PATH environment variable.
1656 Instead, you should set GUILE_LOAD_PATH to tell Guile where to find
1659 * Changes to the gh_ interface
1663 Now takes a second argument which is the result array. If this
1664 pointer is NULL, a new array is malloced (the old behaviour).
1666 ** gh_chars2byvect, gh_shorts2svect, gh_floats2fvect, gh_scm2chars,
1667 gh_scm2shorts, gh_scm2longs, gh_scm2floats
1671 * Changes to the scm_ interface
1673 ** Function: scm_make_named_hook (char* name, int n_args)
1675 Creates a hook in the same way as make-hook above but also
1676 binds a variable named NAME to it.
1678 This is the typical way of creating a hook from C code.
1680 Currently, the variable is created in the "current" module. This
1681 might change when we get the new module system.
1683 ** The smob interface
1685 The interface for creating smobs has changed. For documentation, see
1686 data-rep.info (made from guile-core/doc/data-rep.texi).
1688 *** Deprecated function: SCM scm_newsmob (scm_smobfuns *)
1690 >>> This function will be removed in 1.3.4. <<<
1694 *** Function: SCM scm_make_smob_type (const char *name, scm_sizet size)
1695 This function adds a new smob type, named NAME, with instance size
1696 SIZE to the system. The return value is a tag that is used in
1697 creating instances of the type. If SIZE is 0, then no memory will
1698 be allocated when instances of the smob are created, and nothing
1699 will be freed by the default free function.
1701 *** Function: void scm_set_smob_mark (long tc, SCM (*mark) (SCM))
1702 This function sets the smob marking procedure for the smob type
1703 specified by the tag TC. TC is the tag returned by
1704 `scm_make_smob_type'.
1706 *** Function: void scm_set_smob_free (long tc, SCM (*mark) (SCM))
1707 This function sets the smob freeing procedure for the smob type
1708 specified by the tag TC. TC is the tag returned by
1709 `scm_make_smob_type'.
1711 *** Function: void scm_set_smob_print (tc, print)
1713 - Function: void scm_set_smob_print (long tc,
1714 scm_sizet (*print) (SCM,
1718 This function sets the smob printing procedure for the smob type
1719 specified by the tag TC. TC is the tag returned by
1720 `scm_make_smob_type'.
1722 *** Function: void scm_set_smob_equalp (long tc, SCM (*equalp) (SCM, SCM))
1723 This function sets the smob equality-testing predicate for the
1724 smob type specified by the tag TC. TC is the tag returned by
1725 `scm_make_smob_type'.
1727 *** Macro: void SCM_NEWSMOB (SCM var, long tc, void *data)
1728 Make VALUE contain a smob instance of the type with type code TC and
1729 smob data DATA. VALUE must be previously declared as C type `SCM'.
1731 *** Macro: fn_returns SCM_RETURN_NEWSMOB (long tc, void *data)
1732 This macro expands to a block of code that creates a smob instance
1733 of the type with type code TC and smob data DATA, and returns that
1734 `SCM' value. It should be the last piece of code in a block.
1736 ** The interfaces for using I/O ports and implementing port types
1737 (ptobs) have changed significantly. The new interface is based on
1738 shared access to buffers and a new set of ptob procedures.
1740 *** scm_newptob has been removed
1744 *** Function: SCM scm_make_port_type (type_name, fill_buffer, write_flush)
1746 - Function: SCM scm_make_port_type (char *type_name,
1747 int (*fill_buffer) (SCM port),
1748 void (*write_flush) (SCM port));
1750 Similarly to the new smob interface, there is a set of function
1751 setters by which the user can customize the behaviour of his port
1752 type. See ports.h (scm_set_port_XXX).
1754 ** scm_strport_to_string: New function: creates a new string from
1755 a string port's buffer.
1757 ** Plug in interface for random number generators
1758 The variable `scm_the_rng' in random.c contains a value and three
1759 function pointers which together define the current random number
1760 generator being used by the Scheme level interface and the random
1761 number library functions.
1763 The user is free to replace the default generator with the generator
1766 *** Variable: size_t scm_the_rng.rstate_size
1767 The size of the random state type used by the current RNG
1770 *** Function: unsigned long scm_the_rng.random_bits (scm_rstate *STATE)
1771 Given the random STATE, return 32 random bits.
1773 *** Function: void scm_the_rng.init_rstate (scm_rstate *STATE, chars *S, int N)
1774 Seed random state STATE using string S of length N.
1776 *** Function: scm_rstate *scm_the_rng.copy_rstate (scm_rstate *STATE)
1777 Given random state STATE, return a malloced copy.
1780 The default RNG is the MWC (Multiply With Carry) random number
1781 generator described by George Marsaglia at the Department of
1782 Statistics and Supercomputer Computations Research Institute, The
1783 Florida State University (http://stat.fsu.edu/~geo).
1785 It uses 64 bits, has a period of 4578426017172946943 (4.6e18), and
1786 passes all tests in the DIEHARD test suite
1787 (http://stat.fsu.edu/~geo/diehard.html). The generation of 32 bits
1788 costs one multiply and one add on platforms which either supports long
1789 longs (gcc does this on most systems) or have 64 bit longs. The cost
1790 is four multiply on other systems but this can be optimized by writing
1791 scm_i_uniform32 in assembler.
1793 These functions are provided through the scm_the_rng interface for use
1794 by libguile and the application.
1796 *** Function: unsigned long scm_i_uniform32 (scm_i_rstate *STATE)
1797 Given the random STATE, return 32 random bits.
1798 Don't use this function directly. Instead go through the plugin
1799 interface (see "Plug in interface" above).
1801 *** Function: void scm_i_init_rstate (scm_i_rstate *STATE, char *SEED, int N)
1802 Initialize STATE using SEED of length N.
1804 *** Function: scm_i_rstate *scm_i_copy_rstate (scm_i_rstate *STATE)
1805 Return a malloc:ed copy of STATE. This function can easily be re-used
1806 in the interfaces to other RNGs.
1808 ** Random number library functions
1809 These functions use the current RNG through the scm_the_rng interface.
1810 It might be a good idea to use these functions from your C code so
1811 that only one random generator is used by all code in your program.
1813 The default random state is stored in:
1815 *** Variable: SCM scm_var_random_state
1816 Contains the vcell of the Scheme variable "*random-state*" which is
1817 used as default state by all random number functions in the Scheme
1822 double x = scm_c_uniform01 (SCM_RSTATE (SCM_CDR (scm_var_random_state)));
1824 *** Function: scm_rstate *scm_c_default_rstate (void)
1825 This is a convenience function which returns the value of
1826 scm_var_random_state. An error message is generated if this value
1827 isn't a random state.
1829 *** Function: scm_rstate *scm_c_make_rstate (char *SEED, int LENGTH)
1830 Make a new random state from the string SEED of length LENGTH.
1832 It is generally not a good idea to use multiple random states in a
1833 program. While subsequent random numbers generated from one random
1834 state are guaranteed to be reasonably independent, there is no such
1835 guarantee for numbers generated from different random states.
1837 *** Macro: unsigned long scm_c_uniform32 (scm_rstate *STATE)
1838 Return 32 random bits.
1840 *** Function: double scm_c_uniform01 (scm_rstate *STATE)
1841 Return a sample from the uniform(0,1) distribution.
1843 *** Function: double scm_c_normal01 (scm_rstate *STATE)
1844 Return a sample from the normal(0,1) distribution.
1846 *** Function: double scm_c_exp1 (scm_rstate *STATE)
1847 Return a sample from the exp(1) distribution.
1849 *** Function: unsigned long scm_c_random (scm_rstate *STATE, unsigned long M)
1850 Return a sample from the discrete uniform(0,M) distribution.
1852 *** Function: SCM scm_c_random_bignum (scm_rstate *STATE, SCM M)
1853 Return a sample from the discrete uniform(0,M) distribution.
1854 M must be a bignum object. The returned value may be an INUM.
1858 Changes in Guile 1.3 (released Monday, October 19, 1998):
1860 * Changes to the distribution
1862 ** We renamed the SCHEME_LOAD_PATH environment variable to GUILE_LOAD_PATH.
1863 To avoid conflicts, programs should name environment variables after
1864 themselves, except when there's a common practice establishing some
1867 For now, Guile supports both GUILE_LOAD_PATH and SCHEME_LOAD_PATH,
1868 giving the former precedence, and printing a warning message if the
1869 latter is set. Guile 1.4 will not recognize SCHEME_LOAD_PATH at all.
1871 ** The header files related to multi-byte characters have been removed.
1872 They were: libguile/extchrs.h and libguile/mbstrings.h. Any C code
1873 which referred to these explicitly will probably need to be rewritten,
1874 since the support for the variant string types has been removed; see
1877 ** The header files append.h and sequences.h have been removed. These
1878 files implemented non-R4RS operations which would encourage
1879 non-portable programming style and less easy-to-read code.
1881 * Changes to the stand-alone interpreter
1883 ** New procedures have been added to implement a "batch mode":
1885 *** Function: batch-mode?
1887 Returns a boolean indicating whether the interpreter is in batch
1890 *** Function: set-batch-mode?! ARG
1892 If ARG is true, switches the interpreter to batch mode. The `#f'
1893 case has not been implemented.
1895 ** Guile now provides full command-line editing, when run interactively.
1896 To use this feature, you must have the readline library installed.
1897 The Guile build process will notice it, and automatically include
1900 The readline library is available via anonymous FTP from any GNU
1901 mirror site; the canonical location is "ftp://prep.ai.mit.edu/pub/gnu".
1903 ** the-last-stack is now a fluid.
1905 * Changes to the procedure for linking libguile with your programs
1907 ** You can now use the `guile-config' utility to build programs that use Guile.
1909 Guile now includes a command-line utility called `guile-config', which
1910 can provide information about how to compile and link programs that
1913 *** `guile-config compile' prints any C compiler flags needed to use Guile.
1914 You should include this command's output on the command line you use
1915 to compile C or C++ code that #includes the Guile header files. It's
1916 usually just a `-I' flag to help the compiler find the Guile headers.
1919 *** `guile-config link' prints any linker flags necessary to link with Guile.
1921 This command writes to its standard output a list of flags which you
1922 must pass to the linker to link your code against the Guile library.
1923 The flags include '-lguile' itself, any other libraries the Guile
1924 library depends upon, and any `-L' flags needed to help the linker
1925 find those libraries.
1927 For example, here is a Makefile rule that builds a program named 'foo'
1928 from the object files ${FOO_OBJECTS}, and links them against Guile:
1931 ${CC} ${CFLAGS} ${FOO_OBJECTS} `guile-config link` -o foo
1933 Previous Guile releases recommended that you use autoconf to detect
1934 which of a predefined set of libraries were present on your system.
1935 It is more robust to use `guile-config', since it records exactly which
1936 libraries the installed Guile library requires.
1938 This was originally called `build-guile', but was renamed to
1939 `guile-config' before Guile 1.3 was released, to be consistent with
1940 the analogous script for the GTK+ GUI toolkit, which is called
1944 ** Use the GUILE_FLAGS macro in your configure.in file to find Guile.
1946 If you are using the GNU autoconf package to configure your program,
1947 you can use the GUILE_FLAGS autoconf macro to call `guile-config'
1948 (described above) and gather the necessary values for use in your
1951 The GUILE_FLAGS macro expands to configure script code which runs the
1952 `guile-config' script, to find out where Guile's header files and
1953 libraries are installed. It sets two variables, marked for
1954 substitution, as by AC_SUBST.
1956 GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
1957 code that uses Guile header files. This is almost always just a
1960 GUILE_LDFLAGS --- flags to pass to the linker to link a
1961 program against Guile. This includes `-lguile' for the Guile
1962 library itself, any libraries that Guile itself requires (like
1963 -lqthreads), and so on. It may also include a -L flag to tell the
1964 compiler where to find the libraries.
1966 GUILE_FLAGS is defined in the file guile.m4, in the top-level
1967 directory of the Guile distribution. You can copy it into your
1968 package's aclocal.m4 file, and then use it in your configure.in file.
1970 If you are using the `aclocal' program, distributed with GNU automake,
1971 to maintain your aclocal.m4 file, the Guile installation process
1972 installs guile.m4 where aclocal will find it. All you need to do is
1973 use GUILE_FLAGS in your configure.in file, and then run `aclocal';
1974 this will copy the definition of GUILE_FLAGS into your aclocal.m4
1978 * Changes to Scheme functions and syntax
1980 ** Multi-byte strings have been removed, as have multi-byte and wide
1981 ports. We felt that these were the wrong approach to
1982 internationalization support.
1984 ** New function: readline [PROMPT]
1985 Read a line from the terminal, and allow the user to edit it,
1986 prompting with PROMPT. READLINE provides a large set of Emacs-like
1987 editing commands, lets the user recall previously typed lines, and
1988 works on almost every kind of terminal, including dumb terminals.
1990 READLINE assumes that the cursor is at the beginning of the line when
1991 it is invoked. Thus, you can't print a prompt yourself, and then call
1992 READLINE; you need to package up your prompt as a string, pass it to
1993 the function, and let READLINE print the prompt itself. This is
1994 because READLINE needs to know the prompt's screen width.
1996 For Guile to provide this function, you must have the readline
1997 library, version 2.1 or later, installed on your system. Readline is
1998 available via anonymous FTP from prep.ai.mit.edu in pub/gnu, or from
1999 any GNU mirror site.
2001 See also ADD-HISTORY function.
2003 ** New function: add-history STRING
2004 Add STRING as the most recent line in the history used by the READLINE
2005 command. READLINE does not add lines to the history itself; you must
2006 call ADD-HISTORY to make previous input available to the user.
2008 ** The behavior of the read-line function has changed.
2010 This function now uses standard C library functions to read the line,
2011 for speed. This means that it doesn not respect the value of
2012 scm-line-incrementors; it assumes that lines are delimited with
2015 (Note that this is read-line, the function that reads a line of text
2016 from a port, not readline, the function that reads a line from a
2017 terminal, providing full editing capabilities.)
2019 ** New module (ice-9 getopt-gnu-style): Parse command-line arguments.
2021 This module provides some simple argument parsing. It exports one
2024 Function: getopt-gnu-style ARG-LS
2025 Parse a list of program arguments into an alist of option
2028 Each item in the list of program arguments is examined to see if
2029 it meets the syntax of a GNU long-named option. An argument like
2030 `--MUMBLE' produces an element of the form (MUMBLE . #t) in the
2031 returned alist, where MUMBLE is a keyword object with the same
2032 name as the argument. An argument like `--MUMBLE=FROB' produces
2033 an element of the form (MUMBLE . FROB), where FROB is a string.
2035 As a special case, the returned alist also contains a pair whose
2036 car is the symbol `rest'. The cdr of this pair is a list
2037 containing all the items in the argument list that are not options
2038 of the form mentioned above.
2040 The argument `--' is treated specially: all items in the argument
2041 list appearing after such an argument are not examined, and are
2042 returned in the special `rest' list.
2044 This function does not parse normal single-character switches.
2045 You will need to parse them out of the `rest' list yourself.
2047 ** The read syntax for byte vectors and short vectors has changed.
2049 Instead of #bytes(...), write #y(...).
2051 Instead of #short(...), write #h(...).
2053 This may seem nutty, but, like the other uniform vectors, byte vectors
2054 and short vectors want to have the same print and read syntax (and,
2055 more basic, want to have read syntax!). Changing the read syntax to
2056 use multiple characters after the hash sign breaks with the
2057 conventions used in R5RS and the conventions used for the other
2058 uniform vectors. It also introduces complexity in the current reader,
2059 both on the C and Scheme levels. (The Right solution is probably to
2060 change the syntax and prototypes for uniform vectors entirely.)
2063 ** The new module (ice-9 session) provides useful interactive functions.
2065 *** New procedure: (apropos REGEXP OPTION ...)
2067 Display a list of top-level variables whose names match REGEXP, and
2068 the modules they are imported from. Each OPTION should be one of the
2071 value --- Show the value of each matching variable.
2072 shadow --- Show bindings shadowed by subsequently imported modules.
2073 full --- Same as both `shadow' and `value'.
2077 guile> (apropos "trace" 'full)
2078 debug: trace #<procedure trace args>
2079 debug: untrace #<procedure untrace args>
2080 the-scm-module: display-backtrace #<compiled-closure #<primitive-procedure gsubr-apply>>
2081 the-scm-module: before-backtrace-hook ()
2082 the-scm-module: backtrace #<primitive-procedure backtrace>
2083 the-scm-module: after-backtrace-hook ()
2084 the-scm-module: has-shown-backtrace-hint? #f
2087 ** There are new functions and syntax for working with macros.
2089 Guile implements macros as a special object type. Any variable whose
2090 top-level binding is a macro object acts as a macro. The macro object
2091 specifies how the expression should be transformed before evaluation.
2093 *** Macro objects now print in a reasonable way, resembling procedures.
2095 *** New function: (macro? OBJ)
2096 True iff OBJ is a macro object.
2098 *** New function: (primitive-macro? OBJ)
2099 Like (macro? OBJ), but true only if OBJ is one of the Guile primitive
2100 macro transformers, implemented in eval.c rather than Scheme code.
2102 Why do we have this function?
2103 - For symmetry with procedure? and primitive-procedure?,
2104 - to allow custom print procedures to tell whether a macro is
2105 primitive, and display it differently, and
2106 - to allow compilers and user-written evaluators to distinguish
2107 builtin special forms from user-defined ones, which could be
2110 *** New function: (macro-type OBJ)
2111 Return a value indicating what kind of macro OBJ is. Possible return
2114 The symbol `syntax' --- a macro created by procedure->syntax.
2115 The symbol `macro' --- a macro created by procedure->macro.
2116 The symbol `macro!' --- a macro created by procedure->memoizing-macro.
2117 The boolean #f --- if OBJ is not a macro object.
2119 *** New function: (macro-name MACRO)
2120 Return the name of the macro object MACRO's procedure, as returned by
2123 *** New function: (macro-transformer MACRO)
2124 Return the transformer procedure for MACRO.
2126 *** New syntax: (use-syntax MODULE ... TRANSFORMER)
2128 Specify a new macro expander to use in the current module. Each
2129 MODULE is a module name, with the same meaning as in the `use-modules'
2130 form; each named module's exported bindings are added to the current
2131 top-level environment. TRANSFORMER is an expression evaluated in the
2132 resulting environment which must yield a procedure to use as the
2133 module's eval transformer: every expression evaluated in this module
2134 is passed to this function, and the result passed to the Guile
2137 *** macro-eval! is removed. Use local-eval instead.
2139 ** Some magic has been added to the printer to better handle user
2140 written printing routines (like record printers, closure printers).
2142 The problem is that these user written routines must have access to
2143 the current `print-state' to be able to handle fancy things like
2144 detection of circular references. These print-states have to be
2145 passed to the builtin printing routines (display, write, etc) to
2146 properly continue the print chain.
2148 We didn't want to change all existing print code so that it
2149 explicitly passes thru a print state in addition to a port. Instead,
2150 we extented the possible values that the builtin printing routines
2151 accept as a `port'. In addition to a normal port, they now also take
2152 a pair of a normal port and a print-state. Printing will go to the
2153 port and the print-state will be used to control the detection of
2154 circular references, etc. If the builtin function does not care for a
2155 print-state, it is simply ignored.
2157 User written callbacks are now called with such a pair as their
2158 `port', but because every function now accepts this pair as a PORT
2159 argument, you don't have to worry about that. In fact, it is probably
2160 safest to not check for these pairs.
2162 However, it is sometimes necessary to continue a print chain on a
2163 different port, for example to get a intermediate string
2164 representation of the printed value, mangle that string somehow, and
2165 then to finally print the mangled string. Use the new function
2167 inherit-print-state OLD-PORT NEW-PORT
2169 for this. It constructs a new `port' that prints to NEW-PORT but
2170 inherits the print-state of OLD-PORT.
2172 ** struct-vtable-offset renamed to vtable-offset-user
2174 ** New constants: vtable-index-layout, vtable-index-vtable, vtable-index-printer
2176 ** There is now a fourth (optional) argument to make-vtable-vtable and
2177 make-struct when constructing new types (vtables). This argument
2178 initializes field vtable-index-printer of the vtable.
2180 ** The detection of circular references has been extended to structs.
2181 That is, a structure that -- in the process of being printed -- prints
2182 itself does not lead to infinite recursion.
2184 ** There is now some basic support for fluids. Please read
2185 "libguile/fluid.h" to find out more. It is accessible from Scheme with
2186 the following functions and macros:
2188 Function: make-fluid
2190 Create a new fluid object. Fluids are not special variables or
2191 some other extension to the semantics of Scheme, but rather
2192 ordinary Scheme objects. You can store them into variables (that
2193 are still lexically scoped, of course) or into any other place you
2194 like. Every fluid has a initial value of `#f'.
2196 Function: fluid? OBJ
2198 Test whether OBJ is a fluid.
2200 Function: fluid-ref FLUID
2201 Function: fluid-set! FLUID VAL
2203 Access/modify the fluid FLUID. Modifications are only visible
2204 within the current dynamic root (that includes threads).
2206 Function: with-fluids* FLUIDS VALUES THUNK
2208 FLUIDS is a list of fluids and VALUES a corresponding list of
2209 values for these fluids. Before THUNK gets called the values are
2210 installed in the fluids and the old values of the fluids are
2211 saved in the VALUES list. When the flow of control leaves THUNK
2212 or reenters it, the values get swapped again. You might think of
2213 this as a `safe-fluid-excursion'. Note that the VALUES list is
2214 modified by `with-fluids*'.
2216 Macro: with-fluids ((FLUID VALUE) ...) FORM ...
2218 The same as `with-fluids*' but with a different syntax. It looks
2219 just like `let', but both FLUID and VALUE are evaluated. Remember,
2220 fluids are not special variables but ordinary objects. FLUID
2221 should evaluate to a fluid.
2223 ** Changes to system call interfaces:
2225 *** close-port, close-input-port and close-output-port now return a
2226 boolean instead of an `unspecified' object. #t means that the port
2227 was successfully closed, while #f means it was already closed. It is
2228 also now possible for these procedures to raise an exception if an
2229 error occurs (some errors from write can be delayed until close.)
2231 *** the first argument to chmod, fcntl, ftell and fseek can now be a
2234 *** the third argument to fcntl is now optional.
2236 *** the first argument to chown can now be a file descriptor or a port.
2238 *** the argument to stat can now be a port.
2240 *** The following new procedures have been added (most use scsh
2243 *** procedure: close PORT/FD
2244 Similar to close-port (*note close-port: Closing Ports.), but also
2245 works on file descriptors. A side effect of closing a file
2246 descriptor is that any ports using that file descriptor are moved
2247 to a different file descriptor and have their revealed counts set
2250 *** procedure: port->fdes PORT
2251 Returns the integer file descriptor underlying PORT. As a side
2252 effect the revealed count of PORT is incremented.
2254 *** procedure: fdes->ports FDES
2255 Returns a list of existing ports which have FDES as an underlying
2256 file descriptor, without changing their revealed counts.
2258 *** procedure: fdes->inport FDES
2259 Returns an existing input port which has FDES as its underlying
2260 file descriptor, if one exists, and increments its revealed count.
2261 Otherwise, returns a new input port with a revealed count of 1.
2263 *** procedure: fdes->outport FDES
2264 Returns an existing output port which has FDES as its underlying
2265 file descriptor, if one exists, and increments its revealed count.
2266 Otherwise, returns a new output port with a revealed count of 1.
2268 The next group of procedures perform a `dup2' system call, if NEWFD
2269 (an integer) is supplied, otherwise a `dup'. The file descriptor to be
2270 duplicated can be supplied as an integer or contained in a port. The
2271 type of value returned varies depending on which procedure is used.
2273 All procedures also have the side effect when performing `dup2' that
2274 any ports using NEWFD are moved to a different file descriptor and have
2275 their revealed counts set to zero.
2277 *** procedure: dup->fdes PORT/FD [NEWFD]
2278 Returns an integer file descriptor.
2280 *** procedure: dup->inport PORT/FD [NEWFD]
2281 Returns a new input port using the new file descriptor.
2283 *** procedure: dup->outport PORT/FD [NEWFD]
2284 Returns a new output port using the new file descriptor.
2286 *** procedure: dup PORT/FD [NEWFD]
2287 Returns a new port if PORT/FD is a port, with the same mode as the
2288 supplied port, otherwise returns an integer file descriptor.
2290 *** procedure: dup->port PORT/FD MODE [NEWFD]
2291 Returns a new port using the new file descriptor. MODE supplies a
2292 mode string for the port (*note open-file: File Ports.).
2294 *** procedure: setenv NAME VALUE
2295 Modifies the environment of the current process, which is also the
2296 default environment inherited by child processes.
2298 If VALUE is `#f', then NAME is removed from the environment.
2299 Otherwise, the string NAME=VALUE is added to the environment,
2300 replacing any existing string with name matching NAME.
2302 The return value is unspecified.
2304 *** procedure: truncate-file OBJ SIZE
2305 Truncates the file referred to by OBJ to at most SIZE bytes. OBJ
2306 can be a string containing a file name or an integer file
2307 descriptor or port open for output on the file. The underlying
2308 system calls are `truncate' and `ftruncate'.
2310 The return value is unspecified.
2312 *** procedure: setvbuf PORT MODE [SIZE]
2313 Set the buffering mode for PORT. MODE can be:
2321 block buffered, using a newly allocated buffer of SIZE bytes.
2322 However if SIZE is zero or unspecified, the port will be made
2325 This procedure should not be used after I/O has been performed with
2328 Ports are usually block buffered by default, with a default buffer
2329 size. Procedures e.g., *Note open-file: File Ports, which accept a
2330 mode string allow `0' to be added to request an unbuffered port.
2332 *** procedure: fsync PORT/FD
2333 Copies any unwritten data for the specified output file descriptor
2334 to disk. If PORT/FD is a port, its buffer is flushed before the
2335 underlying file descriptor is fsync'd. The return value is
2338 *** procedure: open-fdes PATH FLAGS [MODES]
2339 Similar to `open' but returns a file descriptor instead of a port.
2341 *** procedure: execle PATH ENV [ARG] ...
2342 Similar to `execl', but the environment of the new process is
2343 specified by ENV, which must be a list of strings as returned by
2344 the `environ' procedure.
2346 This procedure is currently implemented using the `execve' system
2347 call, but we call it `execle' because of its Scheme calling
2350 *** procedure: strerror ERRNO
2351 Returns the Unix error message corresponding to ERRNO, an integer.
2353 *** procedure: primitive-exit [STATUS]
2354 Terminate the current process without unwinding the Scheme stack.
2355 This is would typically be useful after a fork. The exit status
2356 is STATUS if supplied, otherwise zero.
2358 *** procedure: times
2359 Returns an object with information about real and processor time.
2360 The following procedures accept such an object as an argument and
2361 return a selected component:
2364 The current real time, expressed as time units relative to an
2368 The CPU time units used by the calling process.
2371 The CPU time units used by the system on behalf of the
2375 The CPU time units used by terminated child processes of the
2376 calling process, whose status has been collected (e.g., using
2380 Similarly, the CPU times units used by the system on behalf of
2381 terminated child processes.
2383 ** Removed: list-length
2384 ** Removed: list-append, list-append!
2385 ** Removed: list-reverse, list-reverse!
2387 ** array-map renamed to array-map!
2389 ** serial-array-map renamed to serial-array-map!
2391 ** catch doesn't take #f as first argument any longer
2393 Previously, it was possible to pass #f instead of a key to `catch'.
2394 That would cause `catch' to pass a jump buffer object to the procedure
2395 passed as second argument. The procedure could then use this jump
2396 buffer objekt as an argument to throw.
2398 This mechanism has been removed since its utility doesn't motivate the
2399 extra complexity it introduces.
2401 ** The `#/' notation for lists now provokes a warning message from Guile.
2402 This syntax will be removed from Guile in the near future.
2404 To disable the warning message, set the GUILE_HUSH environment
2405 variable to any non-empty value.
2407 ** The newline character now prints as `#\newline', following the
2408 normal Scheme notation, not `#\nl'.
2410 * Changes to the gh_ interface
2412 ** The gh_enter function now takes care of loading the Guile startup files.
2413 gh_enter works by calling scm_boot_guile; see the remarks below.
2415 ** Function: void gh_write (SCM x)
2417 Write the printed representation of the scheme object x to the current
2418 output port. Corresponds to the scheme level `write'.
2420 ** gh_list_length renamed to gh_length.
2422 ** vector handling routines
2424 Several major changes. In particular, gh_vector() now resembles
2425 (vector ...) (with a caveat -- see manual), and gh_make_vector() now
2426 exists and behaves like (make-vector ...). gh_vset() and gh_vref()
2427 have been renamed gh_vector_set_x() and gh_vector_ref(). Some missing
2428 vector-related gh_ functions have been implemented.
2430 ** pair and list routines
2432 Implemented several of the R4RS pair and list functions that were
2435 ** gh_scm2doubles, gh_doubles2scm, gh_doubles2dvect
2437 New function. Converts double arrays back and forth between Scheme
2440 * Changes to the scm_ interface
2442 ** The function scm_boot_guile now takes care of loading the startup files.
2444 Guile's primary initialization function, scm_boot_guile, now takes
2445 care of loading `boot-9.scm', in the `ice-9' module, to initialize
2446 Guile, define the module system, and put together some standard
2447 bindings. It also loads `init.scm', which is intended to hold
2448 site-specific initialization code.
2450 Since Guile cannot operate properly until boot-9.scm is loaded, there
2451 is no reason to separate loading boot-9.scm from Guile's other
2452 initialization processes.
2454 This job used to be done by scm_compile_shell_switches, which didn't
2455 make much sense; in particular, it meant that people using Guile for
2456 non-shell-like applications had to jump through hoops to get Guile
2457 initialized properly.
2459 ** The function scm_compile_shell_switches no longer loads the startup files.
2460 Now, Guile always loads the startup files, whenever it is initialized;
2461 see the notes above for scm_boot_guile and scm_load_startup_files.
2463 ** Function: scm_load_startup_files
2464 This new function takes care of loading Guile's initialization file
2465 (`boot-9.scm'), and the site initialization file, `init.scm'. Since
2466 this is always called by the Guile initialization process, it's
2467 probably not too useful to call this yourself, but it's there anyway.
2469 ** The semantics of smob marking have changed slightly.
2471 The smob marking function (the `mark' member of the scm_smobfuns
2472 structure) is no longer responsible for setting the mark bit on the
2473 smob. The generic smob handling code in the garbage collector will
2474 set this bit. The mark function need only ensure that any other
2475 objects the smob refers to get marked.
2477 Note that this change means that the smob's GC8MARK bit is typically
2478 already set upon entry to the mark function. Thus, marking functions
2479 which look like this:
2482 if (SCM_GC8MARKP (ptr))
2484 SCM_SETGC8MARK (ptr);
2485 ... mark objects to which the smob refers ...
2488 are now incorrect, since they will return early, and fail to mark any
2489 other objects the smob refers to. Some code in the Guile library used
2492 ** The semantics of the I/O port functions in scm_ptobfuns have changed.
2494 If you have implemented your own I/O port type, by writing the
2495 functions required by the scm_ptobfuns and then calling scm_newptob,
2496 you will need to change your functions slightly.
2498 The functions in a scm_ptobfuns structure now expect the port itself
2499 as their argument; they used to expect the `stream' member of the
2500 port's scm_port_table structure. This allows functions in an
2501 scm_ptobfuns structure to easily access the port's cell (and any flags
2502 it its CAR), and the port's scm_port_table structure.
2504 Guile now passes the I/O port itself as the `port' argument in the
2505 following scm_ptobfuns functions:
2507 int (*free) (SCM port);
2508 int (*fputc) (int, SCM port);
2509 int (*fputs) (char *, SCM port);
2510 scm_sizet (*fwrite) SCM_P ((char *ptr,
2514 int (*fflush) (SCM port);
2515 int (*fgetc) (SCM port);
2516 int (*fclose) (SCM port);
2518 The interfaces to the `mark', `print', `equalp', and `fgets' methods
2521 If you have existing code which defines its own port types, it is easy
2522 to convert your code to the new interface; simply apply SCM_STREAM to
2523 the port argument to yield the value you code used to expect.
2525 Note that since both the port and the stream have the same type in the
2526 C code --- they are both SCM values --- the C compiler will not remind
2527 you if you forget to update your scm_ptobfuns functions.
2530 ** Function: int scm_internal_select (int fds,
2534 struct timeval *timeout);
2536 This is a replacement for the `select' function provided by the OS.
2537 It enables I/O blocking and sleeping to happen for one cooperative
2538 thread without blocking other threads. It also avoids busy-loops in
2539 these situations. It is intended that all I/O blocking and sleeping
2540 will finally go through this function. Currently, this function is
2541 only available on systems providing `gettimeofday' and `select'.
2543 ** Function: SCM scm_internal_stack_catch (SCM tag,
2544 scm_catch_body_t body,
2546 scm_catch_handler_t handler,
2549 A new sibling to the other two C level `catch' functions
2550 scm_internal_catch and scm_internal_lazy_catch. Use it if you want
2551 the stack to be saved automatically into the variable `the-last-stack'
2552 (scm_the_last_stack_var) on error. This is necessary if you want to
2553 use advanced error reporting, such as calling scm_display_error and
2554 scm_display_backtrace. (They both take a stack object as argument.)
2556 ** Function: SCM scm_spawn_thread (scm_catch_body_t body,
2558 scm_catch_handler_t handler,
2561 Spawns a new thread. It does a job similar to
2562 scm_call_with_new_thread but takes arguments more suitable when
2563 spawning threads from application C code.
2565 ** The hook scm_error_callback has been removed. It was originally
2566 intended as a way for the user to install his own error handler. But
2567 that method works badly since it intervenes between throw and catch,
2568 thereby changing the semantics of expressions like (catch #t ...).
2569 The correct way to do it is to use one of the C level catch functions
2570 in throw.c: scm_internal_catch/lazy_catch/stack_catch.
2572 ** Removed functions:
2574 scm_obj_length, scm_list_length, scm_list_append, scm_list_append_x,
2575 scm_list_reverse, scm_list_reverse_x
2577 ** New macros: SCM_LISTn where n is one of the integers 0-9.
2579 These can be used for pretty list creation from C. The idea is taken
2580 from Erick Gallesio's STk.
2582 ** scm_array_map renamed to scm_array_map_x
2584 ** mbstrings are now removed
2586 This means that the type codes scm_tc7_mb_string and
2587 scm_tc7_mb_substring has been removed.
2589 ** scm_gen_putc, scm_gen_puts, scm_gen_write, and scm_gen_getc have changed.
2591 Since we no longer support multi-byte strings, these I/O functions
2592 have been simplified, and renamed. Here are their old names, and
2593 their new names and arguments:
2595 scm_gen_putc -> void scm_putc (int c, SCM port);
2596 scm_gen_puts -> void scm_puts (char *s, SCM port);
2597 scm_gen_write -> void scm_lfwrite (char *ptr, scm_sizet size, SCM port);
2598 scm_gen_getc -> void scm_getc (SCM port);
2601 ** The macros SCM_TYP7D and SCM_TYP7SD has been removed.
2603 ** The macro SCM_TYP7S has taken the role of the old SCM_TYP7D
2605 SCM_TYP7S now masks away the bit which distinguishes substrings from
2608 ** scm_catch_body_t: Backward incompatible change!
2610 Body functions to scm_internal_catch and friends do not any longer
2611 take a second argument. This is because it is no longer possible to
2612 pass a #f arg to catch.
2614 ** Calls to scm_protect_object and scm_unprotect now nest properly.
2616 The function scm_protect_object protects its argument from being freed
2617 by the garbage collector. scm_unprotect_object removes that
2620 These functions now nest properly. That is, for every object O, there
2621 is a counter which scm_protect_object(O) increments and
2622 scm_unprotect_object(O) decrements, if the counter is greater than
2623 zero. Every object's counter is zero when it is first created. If an
2624 object's counter is greater than zero, the garbage collector will not
2625 reclaim its storage.
2627 This allows you to use scm_protect_object in your code without
2628 worrying that some other function you call will call
2629 scm_unprotect_object, and allow it to be freed. Assuming that the
2630 functions you call are well-behaved, and unprotect only those objects
2631 they protect, you can follow the same rule and have confidence that
2632 objects will be freed only at appropriate times.
2635 Changes in Guile 1.2 (released Tuesday, June 24 1997):
2637 * Changes to the distribution
2639 ** Nightly snapshots are now available from ftp.red-bean.com.
2640 The old server, ftp.cyclic.com, has been relinquished to its rightful
2643 Nightly snapshots of the Guile development sources are now available via
2644 anonymous FTP from ftp.red-bean.com, as /pub/guile/guile-snap.tar.gz.
2646 Via the web, that's: ftp://ftp.red-bean.com/pub/guile/guile-snap.tar.gz
2647 For getit, that's: ftp.red-bean.com:/pub/guile/guile-snap.tar.gz
2649 ** To run Guile without installing it, the procedure has changed a bit.
2651 If you used a separate build directory to compile Guile, you'll need
2652 to include the build directory in SCHEME_LOAD_PATH, as well as the
2653 source directory. See the `INSTALL' file for examples.
2655 * Changes to the procedure for linking libguile with your programs
2657 ** The standard Guile load path for Scheme code now includes
2658 $(datadir)/guile (usually /usr/local/share/guile). This means that
2659 you can install your own Scheme files there, and Guile will find them.
2660 (Previous versions of Guile only checked a directory whose name
2661 contained the Guile version number, so you had to re-install or move
2662 your Scheme sources each time you installed a fresh version of Guile.)
2664 The load path also includes $(datadir)/guile/site; we recommend
2665 putting individual Scheme files there. If you want to install a
2666 package with multiple source files, create a directory for them under
2669 ** Guile 1.2 will now use the Rx regular expression library, if it is
2670 installed on your system. When you are linking libguile into your own
2671 programs, this means you will have to link against -lguile, -lqt (if
2672 you configured Guile with thread support), and -lrx.
2674 If you are using autoconf to generate configuration scripts for your
2675 application, the following lines should suffice to add the appropriate
2676 libraries to your link command:
2678 ### Find Rx, quickthreads and libguile.
2679 AC_CHECK_LIB(rx, main)
2680 AC_CHECK_LIB(qt, main)
2681 AC_CHECK_LIB(guile, scm_shell)
2683 The Guile 1.2 distribution does not contain sources for the Rx
2684 library, as Guile 1.0 did. If you want to use Rx, you'll need to
2685 retrieve it from a GNU FTP site and install it separately.
2687 * Changes to Scheme functions and syntax
2689 ** The dynamic linking features of Guile are now enabled by default.
2690 You can disable them by giving the `--disable-dynamic-linking' option
2693 (dynamic-link FILENAME)
2695 Find the object file denoted by FILENAME (a string) and link it
2696 into the running Guile application. When everything works out,
2697 return a Scheme object suitable for representing the linked object
2698 file. Otherwise an error is thrown. How object files are
2699 searched is system dependent.
2701 (dynamic-object? VAL)
2703 Determine whether VAL represents a dynamically linked object file.
2705 (dynamic-unlink DYNOBJ)
2707 Unlink the indicated object file from the application. DYNOBJ
2708 should be one of the values returned by `dynamic-link'.
2710 (dynamic-func FUNCTION DYNOBJ)
2712 Search the C function indicated by FUNCTION (a string or symbol)
2713 in DYNOBJ and return some Scheme object that can later be used
2714 with `dynamic-call' to actually call this function. Right now,
2715 these Scheme objects are formed by casting the address of the
2716 function to `long' and converting this number to its Scheme
2719 (dynamic-call FUNCTION DYNOBJ)
2721 Call the C function indicated by FUNCTION and DYNOBJ. The
2722 function is passed no arguments and its return value is ignored.
2723 When FUNCTION is something returned by `dynamic-func', call that
2724 function and ignore DYNOBJ. When FUNCTION is a string (or symbol,
2725 etc.), look it up in DYNOBJ; this is equivalent to
2727 (dynamic-call (dynamic-func FUNCTION DYNOBJ) #f)
2729 Interrupts are deferred while the C function is executing (with
2730 SCM_DEFER_INTS/SCM_ALLOW_INTS).
2732 (dynamic-args-call FUNCTION DYNOBJ ARGS)
2734 Call the C function indicated by FUNCTION and DYNOBJ, but pass it
2735 some arguments and return its return value. The C function is
2736 expected to take two arguments and return an `int', just like
2739 int c_func (int argc, char **argv);
2741 ARGS must be a list of strings and is converted into an array of
2742 `char *'. The array is passed in ARGV and its size in ARGC. The
2743 return value is converted to a Scheme number and returned from the
2744 call to `dynamic-args-call'.
2746 When dynamic linking is disabled or not supported on your system,
2747 the above functions throw errors, but they are still available.
2749 Here is a small example that works on GNU/Linux:
2751 (define libc-obj (dynamic-link "libc.so"))
2752 (dynamic-args-call 'rand libc-obj '())
2754 See the file `libguile/DYNAMIC-LINKING' for additional comments.
2756 ** The #/ syntax for module names is depreciated, and will be removed
2757 in a future version of Guile. Instead of
2765 The latter syntax is more consistent with existing Lisp practice.
2767 ** Guile now does fancier printing of structures. Structures are the
2768 underlying implementation for records, which in turn are used to
2769 implement modules, so all of these object now print differently and in
2770 a more informative way.
2772 The Scheme printer will examine the builtin variable *struct-printer*
2773 whenever it needs to print a structure object. When this variable is
2774 not `#f' it is deemed to be a procedure and will be applied to the
2775 structure object and the output port. When *struct-printer* is `#f'
2776 or the procedure return `#f' the structure object will be printed in
2777 the boring #<struct 80458270> form.
2779 This hook is used by some routines in ice-9/boot-9.scm to implement
2780 type specific printing routines. Please read the comments there about
2783 One of the more specific uses of structs are records. The printing
2784 procedure that could be passed to MAKE-RECORD-TYPE is now actually
2785 called. It should behave like a *struct-printer* procedure (described
2788 ** Guile now supports a new R4RS-compliant syntax for keywords. A
2789 token of the form #:NAME, where NAME has the same syntax as a Scheme
2790 symbol, is the external representation of the keyword named NAME.
2791 Keyword objects print using this syntax as well, so values containing
2792 keyword objects can be read back into Guile. When used in an
2793 expression, keywords are self-quoting objects.
2795 Guile suports this read syntax, and uses this print syntax, regardless
2796 of the current setting of the `keyword' read option. The `keyword'
2797 read option only controls whether Guile recognizes the `:NAME' syntax,
2798 which is incompatible with R4RS. (R4RS says such token represent
2801 ** Guile has regular expression support again. Guile 1.0 included
2802 functions for matching regular expressions, based on the Rx library.
2803 In Guile 1.1, the Guile/Rx interface was removed to simplify the
2804 distribution, and thus Guile had no regular expression support. Guile
2805 1.2 again supports the most commonly used functions, and supports all
2806 of SCSH's regular expression functions.
2808 If your system does not include a POSIX regular expression library,
2809 and you have not linked Guile with a third-party regexp library such as
2810 Rx, these functions will not be available. You can tell whether your
2811 Guile installation includes regular expression support by checking
2812 whether the `*features*' list includes the `regex' symbol.
2814 *** regexp functions
2816 By default, Guile supports POSIX extended regular expressions. That
2817 means that the characters `(', `)', `+' and `?' are special, and must
2818 be escaped if you wish to match the literal characters.
2820 This regular expression interface was modeled after that implemented
2821 by SCSH, the Scheme Shell. It is intended to be upwardly compatible
2822 with SCSH regular expressions.
2824 **** Function: string-match PATTERN STR [START]
2825 Compile the string PATTERN into a regular expression and compare
2826 it with STR. The optional numeric argument START specifies the
2827 position of STR at which to begin matching.
2829 `string-match' returns a "match structure" which describes what,
2830 if anything, was matched by the regular expression. *Note Match
2831 Structures::. If STR does not match PATTERN at all,
2832 `string-match' returns `#f'.
2834 Each time `string-match' is called, it must compile its PATTERN
2835 argument into a regular expression structure. This operation is
2836 expensive, which makes `string-match' inefficient if the same regular
2837 expression is used several times (for example, in a loop). For better
2838 performance, you can compile a regular expression in advance and then
2839 match strings against the compiled regexp.
2841 **** Function: make-regexp STR [FLAGS]
2842 Compile the regular expression described by STR, and return the
2843 compiled regexp structure. If STR does not describe a legal
2844 regular expression, `make-regexp' throws a
2845 `regular-expression-syntax' error.
2847 FLAGS may be the bitwise-or of one or more of the following:
2849 **** Constant: regexp/extended
2850 Use POSIX Extended Regular Expression syntax when interpreting
2851 STR. If not set, POSIX Basic Regular Expression syntax is used.
2852 If the FLAGS argument is omitted, we assume regexp/extended.
2854 **** Constant: regexp/icase
2855 Do not differentiate case. Subsequent searches using the
2856 returned regular expression will be case insensitive.
2858 **** Constant: regexp/newline
2859 Match-any-character operators don't match a newline.
2861 A non-matching list ([^...]) not containing a newline matches a
2864 Match-beginning-of-line operator (^) matches the empty string
2865 immediately after a newline, regardless of whether the FLAGS
2866 passed to regexp-exec contain regexp/notbol.
2868 Match-end-of-line operator ($) matches the empty string
2869 immediately before a newline, regardless of whether the FLAGS
2870 passed to regexp-exec contain regexp/noteol.
2872 **** Function: regexp-exec REGEXP STR [START [FLAGS]]
2873 Match the compiled regular expression REGEXP against `str'. If
2874 the optional integer START argument is provided, begin matching
2875 from that position in the string. Return a match structure
2876 describing the results of the match, or `#f' if no match could be
2879 FLAGS may be the bitwise-or of one or more of the following:
2881 **** Constant: regexp/notbol
2882 The match-beginning-of-line operator always fails to match (but
2883 see the compilation flag regexp/newline above) This flag may be
2884 used when different portions of a string are passed to
2885 regexp-exec and the beginning of the string should not be
2886 interpreted as the beginning of the line.
2888 **** Constant: regexp/noteol
2889 The match-end-of-line operator always fails to match (but see the
2890 compilation flag regexp/newline above)
2892 **** Function: regexp? OBJ
2893 Return `#t' if OBJ is a compiled regular expression, or `#f'
2896 Regular expressions are commonly used to find patterns in one string
2897 and replace them with the contents of another string.
2899 **** Function: regexp-substitute PORT MATCH [ITEM...]
2900 Write to the output port PORT selected contents of the match
2901 structure MATCH. Each ITEM specifies what should be written, and
2902 may be one of the following arguments:
2904 * A string. String arguments are written out verbatim.
2906 * An integer. The submatch with that number is written.
2908 * The symbol `pre'. The portion of the matched string preceding
2909 the regexp match is written.
2911 * The symbol `post'. The portion of the matched string
2912 following the regexp match is written.
2914 PORT may be `#f', in which case nothing is written; instead,
2915 `regexp-substitute' constructs a string from the specified ITEMs
2918 **** Function: regexp-substitute/global PORT REGEXP TARGET [ITEM...]
2919 Similar to `regexp-substitute', but can be used to perform global
2920 substitutions on STR. Instead of taking a match structure as an
2921 argument, `regexp-substitute/global' takes two string arguments: a
2922 REGEXP string describing a regular expression, and a TARGET string
2923 which should be matched against this regular expression.
2925 Each ITEM behaves as in REGEXP-SUBSTITUTE, with the following
2928 * A function may be supplied. When this function is called, it
2929 will be passed one argument: a match structure for a given
2930 regular expression match. It should return a string to be
2931 written out to PORT.
2933 * The `post' symbol causes `regexp-substitute/global' to recurse
2934 on the unmatched portion of STR. This *must* be supplied in
2935 order to perform global search-and-replace on STR; if it is
2936 not present among the ITEMs, then `regexp-substitute/global'
2937 will return after processing a single match.
2939 *** Match Structures
2941 A "match structure" is the object returned by `string-match' and
2942 `regexp-exec'. It describes which portion of a string, if any, matched
2943 the given regular expression. Match structures include: a reference to
2944 the string that was checked for matches; the starting and ending
2945 positions of the regexp match; and, if the regexp included any
2946 parenthesized subexpressions, the starting and ending positions of each
2949 In each of the regexp match functions described below, the `match'
2950 argument must be a match structure returned by a previous call to
2951 `string-match' or `regexp-exec'. Most of these functions return some
2952 information about the original target string that was matched against a
2953 regular expression; we will call that string TARGET for easy reference.
2955 **** Function: regexp-match? OBJ
2956 Return `#t' if OBJ is a match structure returned by a previous
2957 call to `regexp-exec', or `#f' otherwise.
2959 **** Function: match:substring MATCH [N]
2960 Return the portion of TARGET matched by subexpression number N.
2961 Submatch 0 (the default) represents the entire regexp match. If
2962 the regular expression as a whole matched, but the subexpression
2963 number N did not match, return `#f'.
2965 **** Function: match:start MATCH [N]
2966 Return the starting position of submatch number N.
2968 **** Function: match:end MATCH [N]
2969 Return the ending position of submatch number N.
2971 **** Function: match:prefix MATCH
2972 Return the unmatched portion of TARGET preceding the regexp match.
2974 **** Function: match:suffix MATCH
2975 Return the unmatched portion of TARGET following the regexp match.
2977 **** Function: match:count MATCH
2978 Return the number of parenthesized subexpressions from MATCH.
2979 Note that the entire regular expression match itself counts as a
2980 subexpression, and failed submatches are included in the count.
2982 **** Function: match:string MATCH
2983 Return the original TARGET string.
2985 *** Backslash Escapes
2987 Sometimes you will want a regexp to match characters like `*' or `$'
2988 exactly. For example, to check whether a particular string represents
2989 a menu entry from an Info node, it would be useful to match it against
2990 a regexp like `^* [^:]*::'. However, this won't work; because the
2991 asterisk is a metacharacter, it won't match the `*' at the beginning of
2992 the string. In this case, we want to make the first asterisk un-magic.
2994 You can do this by preceding the metacharacter with a backslash
2995 character `\'. (This is also called "quoting" the metacharacter, and
2996 is known as a "backslash escape".) When Guile sees a backslash in a
2997 regular expression, it considers the following glyph to be an ordinary
2998 character, no matter what special meaning it would ordinarily have.
2999 Therefore, we can make the above example work by changing the regexp to
3000 `^\* [^:]*::'. The `\*' sequence tells the regular expression engine
3001 to match only a single asterisk in the target string.
3003 Since the backslash is itself a metacharacter, you may force a
3004 regexp to match a backslash in the target string by preceding the
3005 backslash with itself. For example, to find variable references in a
3006 TeX program, you might want to find occurrences of the string `\let\'
3007 followed by any number of alphabetic characters. The regular expression
3008 `\\let\\[A-Za-z]*' would do this: the double backslashes in the regexp
3009 each match a single backslash in the target string.
3011 **** Function: regexp-quote STR
3012 Quote each special character found in STR with a backslash, and
3013 return the resulting string.
3015 *Very important:* Using backslash escapes in Guile source code (as
3016 in Emacs Lisp or C) can be tricky, because the backslash character has
3017 special meaning for the Guile reader. For example, if Guile encounters
3018 the character sequence `\n' in the middle of a string while processing
3019 Scheme code, it replaces those characters with a newline character.
3020 Similarly, the character sequence `\t' is replaced by a horizontal tab.
3021 Several of these "escape sequences" are processed by the Guile reader
3022 before your code is executed. Unrecognized escape sequences are
3023 ignored: if the characters `\*' appear in a string, they will be
3024 translated to the single character `*'.
3026 This translation is obviously undesirable for regular expressions,
3027 since we want to be able to include backslashes in a string in order to
3028 escape regexp metacharacters. Therefore, to make sure that a backslash
3029 is preserved in a string in your Guile program, you must use *two*
3030 consecutive backslashes:
3032 (define Info-menu-entry-pattern (make-regexp "^\\* [^:]*"))
3034 The string in this example is preprocessed by the Guile reader before
3035 any code is executed. The resulting argument to `make-regexp' is the
3036 string `^\* [^:]*', which is what we really want.
3038 This also means that in order to write a regular expression that
3039 matches a single backslash character, the regular expression string in
3040 the source code must include *four* backslashes. Each consecutive pair
3041 of backslashes gets translated by the Guile reader to a single
3042 backslash, and the resulting double-backslash is interpreted by the
3043 regexp engine as matching a single backslash character. Hence:
3045 (define tex-variable-pattern (make-regexp "\\\\let\\\\=[A-Za-z]*"))
3047 The reason for the unwieldiness of this syntax is historical. Both
3048 regular expression pattern matchers and Unix string processing systems
3049 have traditionally used backslashes with the special meanings described
3050 above. The POSIX regular expression specification and ANSI C standard
3051 both require these semantics. Attempting to abandon either convention
3052 would cause other kinds of compatibility problems, possibly more severe
3053 ones. Therefore, without extending the Scheme reader to support
3054 strings with different quoting conventions (an ungainly and confusing
3055 extension when implemented in other languages), we must adhere to this
3056 cumbersome escape syntax.
3058 * Changes to the gh_ interface
3060 * Changes to the scm_ interface
3062 * Changes to system call interfaces:
3064 ** The value returned by `raise' is now unspecified. It throws an exception
3067 *** A new procedure `sigaction' can be used to install signal handlers
3069 (sigaction signum [action] [flags])
3071 signum is the signal number, which can be specified using the value
3074 If action is omitted, sigaction returns a pair: the CAR is the current
3075 signal hander, which will be either an integer with the value SIG_DFL
3076 (default action) or SIG_IGN (ignore), or the Scheme procedure which
3077 handles the signal, or #f if a non-Scheme procedure handles the
3078 signal. The CDR contains the current sigaction flags for the handler.
3080 If action is provided, it is installed as the new handler for signum.
3081 action can be a Scheme procedure taking one argument, or the value of
3082 SIG_DFL (default action) or SIG_IGN (ignore), or #f to restore
3083 whatever signal handler was installed before sigaction was first used.
3084 Flags can optionally be specified for the new handler (SA_RESTART is
3085 always used if the system provides it, so need not be specified.) The
3086 return value is a pair with information about the old handler as
3089 This interface does not provide access to the "signal blocking"
3090 facility. Maybe this is not needed, since the thread support may
3091 provide solutions to the problem of consistent access to data
3094 *** A new procedure `flush-all-ports' is equivalent to running
3095 `force-output' on every port open for output.
3097 ** Guile now provides information on how it was built, via the new
3098 global variable, %guile-build-info. This variable records the values
3099 of the standard GNU makefile directory variables as an assocation
3100 list, mapping variable names (symbols) onto directory paths (strings).
3101 For example, to find out where the Guile link libraries were
3102 installed, you can say:
3104 guile -c "(display (assq-ref %guile-build-info 'libdir)) (newline)"
3107 * Changes to the scm_ interface
3109 ** The new function scm_handle_by_message_noexit is just like the
3110 existing scm_handle_by_message function, except that it doesn't call
3111 exit to terminate the process. Instead, it prints a message and just
3112 returns #f. This might be a more appropriate catch-all handler for
3113 new dynamic roots and threads.
3116 Changes in Guile 1.1 (released Friday, May 16 1997):
3118 * Changes to the distribution.
3120 The Guile 1.0 distribution has been split up into several smaller
3122 guile-core --- the Guile interpreter itself.
3123 guile-tcltk --- the interface between the Guile interpreter and
3124 Tcl/Tk; Tcl is an interpreter for a stringy language, and Tk
3125 is a toolkit for building graphical user interfaces.
3126 guile-rgx-ctax --- the interface between Guile and the Rx regular
3127 expression matcher, and the translator for the Ctax
3128 programming language. These are packaged together because the
3129 Ctax translator uses Rx to parse Ctax source code.
3131 This NEWS file describes the changes made to guile-core since the 1.0
3134 We no longer distribute the documentation, since it was either out of
3135 date, or incomplete. As soon as we have current documentation, we
3140 * Changes to the stand-alone interpreter
3142 ** guile now accepts command-line arguments compatible with SCSH, Olin
3143 Shivers' Scheme Shell.
3145 In general, arguments are evaluated from left to right, but there are
3146 exceptions. The following switches stop argument processing, and
3147 stash all remaining command-line arguments as the value returned by
3148 the (command-line) function.
3149 -s SCRIPT load Scheme source code from FILE, and exit
3150 -c EXPR evalute Scheme expression EXPR, and exit
3151 -- stop scanning arguments; run interactively
3153 The switches below are processed as they are encountered.
3154 -l FILE load Scheme source code from FILE
3155 -e FUNCTION after reading script, apply FUNCTION to
3156 command line arguments
3157 -ds do -s script at this point
3158 --emacs enable Emacs protocol (experimental)
3159 -h, --help display this help and exit
3160 -v, --version display version information and exit
3161 \ read arguments from following script lines
3163 So, for example, here is a Guile script named `ekko' (thanks, Olin)
3164 which re-implements the traditional "echo" command:
3166 #!/usr/local/bin/guile -s
3169 (map (lambda (arg) (display arg) (display " "))
3173 (main (command-line))
3175 Suppose we invoke this script as follows:
3177 ekko a speckled gecko
3179 Through the magic of Unix script processing (triggered by the `#!'
3180 token at the top of the file), /usr/local/bin/guile receives the
3181 following list of command-line arguments:
3183 ("-s" "./ekko" "a" "speckled" "gecko")
3185 Unix inserts the name of the script after the argument specified on
3186 the first line of the file (in this case, "-s"), and then follows that
3187 with the arguments given to the script. Guile loads the script, which
3188 defines the `main' function, and then applies it to the list of
3189 remaining command-line arguments, ("a" "speckled" "gecko").
3191 In Unix, the first line of a script file must take the following form:
3193 #!INTERPRETER ARGUMENT
3195 where INTERPRETER is the absolute filename of the interpreter
3196 executable, and ARGUMENT is a single command-line argument to pass to
3199 You may only pass one argument to the interpreter, and its length is
3200 limited. These restrictions can be annoying to work around, so Guile
3201 provides a general mechanism (borrowed from, and compatible with,
3202 SCSH) for circumventing them.
3204 If the ARGUMENT in a Guile script is a single backslash character,
3205 `\', Guile will open the script file, parse arguments from its second
3206 and subsequent lines, and replace the `\' with them. So, for example,
3207 here is another implementation of the `ekko' script:
3209 #!/usr/local/bin/guile \
3213 (for-each (lambda (arg) (display arg) (display " "))
3217 If the user invokes this script as follows:
3219 ekko a speckled gecko
3221 Unix expands this into
3223 /usr/local/bin/guile \ ekko a speckled gecko
3225 When Guile sees the `\' argument, it replaces it with the arguments
3226 read from the second line of the script, producing:
3228 /usr/local/bin/guile -e main -s ekko a speckled gecko
3230 This tells Guile to load the `ekko' script, and apply the function
3231 `main' to the argument list ("a" "speckled" "gecko").
3233 Here is how Guile parses the command-line arguments:
3234 - Each space character terminates an argument. This means that two
3235 spaces in a row introduce an empty-string argument.
3236 - The tab character is not permitted (unless you quote it with the
3237 backslash character, as described below), to avoid confusion.
3238 - The newline character terminates the sequence of arguments, and will
3239 also terminate a final non-empty argument. (However, a newline
3240 following a space will not introduce a final empty-string argument;
3241 it only terminates the argument list.)
3242 - The backslash character is the escape character. It escapes
3243 backslash, space, tab, and newline. The ANSI C escape sequences
3244 like \n and \t are also supported. These produce argument
3245 constituents; the two-character combination \n doesn't act like a
3246 terminating newline. The escape sequence \NNN for exactly three
3247 octal digits reads as the character whose ASCII code is NNN. As
3248 above, characters produced this way are argument constituents.
3249 Backslash followed by other characters is not allowed.
3251 * Changes to the procedure for linking libguile with your programs
3253 ** Guile now builds and installs a shared guile library, if your
3254 system support shared libraries. (It still builds a static library on
3255 all systems.) Guile automatically detects whether your system
3256 supports shared libraries. To prevent Guile from buildisg shared
3257 libraries, pass the `--disable-shared' flag to the configure script.
3259 Guile takes longer to compile when it builds shared libraries, because
3260 it must compile every file twice --- once to produce position-
3261 independent object code, and once to produce normal object code.
3263 ** The libthreads library has been merged into libguile.
3265 To link a program against Guile, you now need only link against
3266 -lguile and -lqt; -lthreads is no longer needed. If you are using
3267 autoconf to generate configuration scripts for your application, the
3268 following lines should suffice to add the appropriate libraries to
3271 ### Find quickthreads and libguile.
3272 AC_CHECK_LIB(qt, main)
3273 AC_CHECK_LIB(guile, scm_shell)
3275 * Changes to Scheme functions
3277 ** Guile Scheme's special syntax for keyword objects is now optional,
3278 and disabled by default.
3280 The syntax variation from R4RS made it difficult to port some
3281 interesting packages to Guile. The routines which accepted keyword
3282 arguments (mostly in the module system) have been modified to also
3283 accept symbols whose names begin with `:'.
3285 To change the keyword syntax, you must first import the (ice-9 debug)
3287 (use-modules (ice-9 debug))
3289 Then you can enable the keyword syntax as follows:
3290 (read-set! keywords 'prefix)
3292 To disable keyword syntax, do this:
3293 (read-set! keywords #f)
3295 ** Many more primitive functions accept shared substrings as
3296 arguments. In the past, these functions required normal, mutable
3297 strings as arguments, although they never made use of this
3300 ** The uniform array functions now operate on byte vectors. These
3301 functions are `array-fill!', `serial-array-copy!', `array-copy!',
3302 `serial-array-map', `array-map', `array-for-each', and
3305 ** The new functions `trace' and `untrace' implement simple debugging
3306 support for Scheme functions.
3308 The `trace' function accepts any number of procedures as arguments,
3309 and tells the Guile interpreter to display each procedure's name and
3310 arguments each time the procedure is invoked. When invoked with no
3311 arguments, `trace' returns the list of procedures currently being
3314 The `untrace' function accepts any number of procedures as arguments,
3315 and tells the Guile interpreter not to trace them any more. When
3316 invoked with no arguments, `untrace' untraces all curretly traced
3319 The tracing in Guile has an advantage over most other systems: we
3320 don't create new procedure objects, but mark the procedure objects
3321 themselves. This means that anonymous and internal procedures can be
3324 ** The function `assert-repl-prompt' has been renamed to
3325 `set-repl-prompt!'. It takes one argument, PROMPT.
3326 - If PROMPT is #f, the Guile read-eval-print loop will not prompt.
3327 - If PROMPT is a string, we use it as a prompt.
3328 - If PROMPT is a procedure accepting no arguments, we call it, and
3329 display the result as a prompt.
3330 - Otherwise, we display "> ".
3332 ** The new function `eval-string' reads Scheme expressions from a
3333 string and evaluates them, returning the value of the last expression
3334 in the string. If the string contains no expressions, it returns an
3337 ** The new function `thunk?' returns true iff its argument is a
3338 procedure of zero arguments.
3340 ** `defined?' is now a builtin function, instead of syntax. This
3341 means that its argument should be quoted. It returns #t iff its
3342 argument is bound in the current module.
3344 ** The new syntax `use-modules' allows you to add new modules to your
3345 environment without re-typing a complete `define-module' form. It
3346 accepts any number of module names as arguments, and imports their
3347 public bindings into the current module.
3349 ** The new function (module-defined? NAME MODULE) returns true iff
3350 NAME, a symbol, is defined in MODULE, a module object.
3352 ** The new function `builtin-bindings' creates and returns a hash
3353 table containing copies of all the root module's bindings.
3355 ** The new function `builtin-weak-bindings' does the same as
3356 `builtin-bindings', but creates a doubly-weak hash table.
3358 ** The `equal?' function now considers variable objects to be
3359 equivalent if they have the same name and the same value.
3361 ** The new function `command-line' returns the command-line arguments
3362 given to Guile, as a list of strings.
3364 When using guile as a script interpreter, `command-line' returns the
3365 script's arguments; those processed by the interpreter (like `-s' or
3366 `-c') are omitted. (In other words, you get the normal, expected
3367 behavior.) Any application that uses scm_shell to process its
3368 command-line arguments gets this behavior as well.
3370 ** The new function `load-user-init' looks for a file called `.guile'
3371 in the user's home directory, and loads it if it exists. This is
3372 mostly for use by the code generated by scm_compile_shell_switches,
3373 but we thought it might also be useful in other circumstances.
3375 ** The new function `log10' returns the base-10 logarithm of its
3378 ** Changes to I/O functions
3380 *** The functions `read', `primitive-load', `read-and-eval!', and
3381 `primitive-load-path' no longer take optional arguments controlling
3382 case insensitivity and a `#' parser.
3384 Case sensitivity is now controlled by a read option called
3385 `case-insensitive'. The user can add new `#' syntaxes with the
3386 `read-hash-extend' function (see below).
3388 *** The new function `read-hash-extend' allows the user to change the
3389 syntax of Guile Scheme in a somewhat controlled way.
3391 (read-hash-extend CHAR PROC)
3392 When parsing S-expressions, if we read a `#' character followed by
3393 the character CHAR, use PROC to parse an object from the stream.
3394 If PROC is #f, remove any parsing procedure registered for CHAR.
3396 The reader applies PROC to two arguments: CHAR and an input port.
3398 *** The new functions read-delimited and read-delimited! provide a
3399 general mechanism for doing delimited input on streams.
3401 (read-delimited DELIMS [PORT HANDLE-DELIM])
3402 Read until we encounter one of the characters in DELIMS (a string),
3403 or end-of-file. PORT is the input port to read from; it defaults to
3404 the current input port. The HANDLE-DELIM parameter determines how
3405 the terminating character is handled; it should be one of the
3408 'trim omit delimiter from result
3409 'peek leave delimiter character in input stream
3410 'concat append delimiter character to returned value
3411 'split return a pair: (RESULT . TERMINATOR)
3413 HANDLE-DELIM defaults to 'peek.
3415 (read-delimited! DELIMS BUF [PORT HANDLE-DELIM START END])
3416 A side-effecting variant of `read-delimited'.
3418 The data is written into the string BUF at the indices in the
3419 half-open interval [START, END); the default interval is the whole
3420 string: START = 0 and END = (string-length BUF). The values of
3421 START and END must specify a well-defined interval in BUF, i.e.
3422 0 <= START <= END <= (string-length BUF).
3424 It returns NBYTES, the number of bytes read. If the buffer filled
3425 up without a delimiter character being found, it returns #f. If the
3426 port is at EOF when the read starts, it returns the EOF object.
3428 If an integer is returned (i.e., the read is successfully terminated
3429 by reading a delimiter character), then the HANDLE-DELIM parameter
3430 determines how to handle the terminating character. It is described
3431 above, and defaults to 'peek.
3433 (The descriptions of these functions were borrowed from the SCSH
3434 manual, by Olin Shivers and Brian Carlstrom.)
3436 *** The `%read-delimited!' function is the primitive used to implement
3437 `read-delimited' and `read-delimited!'.
3439 (%read-delimited! DELIMS BUF GOBBLE? [PORT START END])
3441 This returns a pair of values: (TERMINATOR . NUM-READ).
3442 - TERMINATOR describes why the read was terminated. If it is a
3443 character or the eof object, then that is the value that terminated
3444 the read. If it is #f, the function filled the buffer without finding
3445 a delimiting character.
3446 - NUM-READ is the number of characters read into BUF.
3448 If the read is successfully terminated by reading a delimiter
3449 character, then the gobble? parameter determines what to do with the
3450 terminating character. If true, the character is removed from the
3451 input stream; if false, the character is left in the input stream
3452 where a subsequent read operation will retrieve it. In either case,
3453 the character is also the first value returned by the procedure call.
3455 (The descriptions of this function was borrowed from the SCSH manual,
3456 by Olin Shivers and Brian Carlstrom.)
3458 *** The `read-line' and `read-line!' functions have changed; they now
3459 trim the terminator by default; previously they appended it to the
3460 returned string. For the old behavior, use (read-line PORT 'concat).
3462 *** The functions `uniform-array-read!' and `uniform-array-write!' now
3463 take new optional START and END arguments, specifying the region of
3464 the array to read and write.
3466 *** The `ungetc-char-ready?' function has been removed. We feel it's
3467 inappropriate for an interface to expose implementation details this
3470 ** Changes to the Unix library and system call interface
3472 *** The new fcntl function provides access to the Unix `fcntl' system
3475 (fcntl PORT COMMAND VALUE)
3476 Apply COMMAND to PORT's file descriptor, with VALUE as an argument.
3477 Values for COMMAND are:
3479 F_DUPFD duplicate a file descriptor
3480 F_GETFD read the descriptor's close-on-exec flag
3481 F_SETFD set the descriptor's close-on-exec flag to VALUE
3482 F_GETFL read the descriptor's flags, as set on open
3483 F_SETFL set the descriptor's flags, as set on open to VALUE
3484 F_GETOWN return the process ID of a socket's owner, for SIGIO
3485 F_SETOWN set the process that owns a socket to VALUE, for SIGIO
3486 FD_CLOEXEC not sure what this is
3488 For details, see the documentation for the fcntl system call.
3490 *** The arguments to `select' have changed, for compatibility with
3491 SCSH. The TIMEOUT parameter may now be non-integral, yielding the
3492 expected behavior. The MILLISECONDS parameter has been changed to
3493 MICROSECONDS, to more closely resemble the underlying system call.
3494 The RVEC, WVEC, and EVEC arguments can now be vectors; the type of the
3495 corresponding return set will be the same.
3497 *** The arguments to the `mknod' system call have changed. They are
3500 (mknod PATH TYPE PERMS DEV)
3501 Create a new file (`node') in the file system. PATH is the name of
3502 the file to create. TYPE is the kind of file to create; it should
3503 be 'fifo, 'block-special, or 'char-special. PERMS specifies the
3504 permission bits to give the newly created file. If TYPE is
3505 'block-special or 'char-special, DEV specifies which device the
3506 special file refers to; its interpretation depends on the kind of
3507 special file being created.
3509 *** The `fork' function has been renamed to `primitive-fork', to avoid
3510 clashing with various SCSH forks.
3512 *** The `recv' and `recvfrom' functions have been renamed to `recv!'
3513 and `recvfrom!'. They no longer accept a size for a second argument;
3514 you must pass a string to hold the received value. They no longer
3515 return the buffer. Instead, `recv' returns the length of the message
3516 received, and `recvfrom' returns a pair containing the packet's length
3517 and originating address.
3519 *** The file descriptor datatype has been removed, as have the
3520 `read-fd', `write-fd', `close', `lseek', and `dup' functions.
3521 We plan to replace these functions with a SCSH-compatible interface.
3523 *** The `create' function has been removed; it's just a special case
3526 *** There are new functions to break down process termination status
3527 values. In the descriptions below, STATUS is a value returned by
3530 (status:exit-val STATUS)
3531 If the child process exited normally, this function returns the exit
3532 code for the child process (i.e., the value passed to exit, or
3533 returned from main). If the child process did not exit normally,
3534 this function returns #f.
3536 (status:stop-sig STATUS)
3537 If the child process was suspended by a signal, this function
3538 returns the signal that suspended the child. Otherwise, it returns
3541 (status:term-sig STATUS)
3542 If the child process terminated abnormally, this function returns
3543 the signal that terminated the child. Otherwise, this function
3546 POSIX promises that exactly one of these functions will return true on
3547 a valid STATUS value.
3549 These functions are compatible with SCSH.
3551 *** There are new accessors and setters for the broken-out time vectors
3552 returned by `localtime', `gmtime', and that ilk. They are:
3554 Component Accessor Setter
3555 ========================= ============ ============
3556 seconds tm:sec set-tm:sec
3557 minutes tm:min set-tm:min
3558 hours tm:hour set-tm:hour
3559 day of the month tm:mday set-tm:mday
3560 month tm:mon set-tm:mon
3561 year tm:year set-tm:year
3562 day of the week tm:wday set-tm:wday
3563 day in the year tm:yday set-tm:yday
3564 daylight saving time tm:isdst set-tm:isdst
3565 GMT offset, seconds tm:gmtoff set-tm:gmtoff
3566 name of time zone tm:zone set-tm:zone
3568 *** There are new accessors for the vectors returned by `uname',
3569 describing the host system:
3572 ============================================== ================
3573 name of the operating system implementation utsname:sysname
3574 network name of this machine utsname:nodename
3575 release level of the operating system utsname:release
3576 version level of the operating system utsname:version
3577 machine hardware platform utsname:machine
3579 *** There are new accessors for the vectors returned by `getpw',
3580 `getpwnam', `getpwuid', and `getpwent', describing entries from the
3581 system's user database:
3584 ====================== =================
3585 user name passwd:name
3586 user password passwd:passwd
3589 real name passwd:gecos
3590 home directory passwd:dir
3591 shell program passwd:shell
3593 *** There are new accessors for the vectors returned by `getgr',
3594 `getgrnam', `getgrgid', and `getgrent', describing entries from the
3595 system's group database:
3598 ======================= ============
3599 group name group:name
3600 group password group:passwd
3602 group members group:mem
3604 *** There are new accessors for the vectors returned by `gethost',
3605 `gethostbyaddr', `gethostbyname', and `gethostent', describing
3609 ========================= ===============
3610 official name of host hostent:name
3611 alias list hostent:aliases
3612 host address type hostent:addrtype
3613 length of address hostent:length
3614 list of addresses hostent:addr-list
3616 *** There are new accessors for the vectors returned by `getnet',
3617 `getnetbyaddr', `getnetbyname', and `getnetent', describing internet
3621 ========================= ===============
3622 official name of net netent:name
3623 alias list netent:aliases
3624 net number type netent:addrtype
3625 net number netent:net
3627 *** There are new accessors for the vectors returned by `getproto',
3628 `getprotobyname', `getprotobynumber', and `getprotoent', describing
3632 ========================= ===============
3633 official protocol name protoent:name
3634 alias list protoent:aliases
3635 protocol number protoent:proto
3637 *** There are new accessors for the vectors returned by `getserv',
3638 `getservbyname', `getservbyport', and `getservent', describing
3642 ========================= ===============
3643 official service name servent:name
3644 alias list servent:aliases
3645 port number servent:port
3646 protocol to use servent:proto
3648 *** There are new accessors for the sockaddr structures returned by
3649 `accept', `getsockname', `getpeername', `recvfrom!':
3652 ======================================== ===============
3653 address format (`family') sockaddr:fam
3654 path, for file domain addresses sockaddr:path
3655 address, for internet domain addresses sockaddr:addr
3656 TCP or UDP port, for internet sockaddr:port
3658 *** The `getpwent', `getgrent', `gethostent', `getnetent',
3659 `getprotoent', and `getservent' functions now return #f at the end of
3660 the user database. (They used to throw an exception.)
3662 Note that calling MUMBLEent function is equivalent to calling the
3663 corresponding MUMBLE function with no arguments.
3665 *** The `setpwent', `setgrent', `sethostent', `setnetent',
3666 `setprotoent', and `setservent' routines now take no arguments.
3668 *** The `gethost', `getproto', `getnet', and `getserv' functions now
3669 provide more useful information when they throw an exception.
3671 *** The `lnaof' function has been renamed to `inet-lnaof'.
3673 *** Guile now claims to have the `current-time' feature.
3675 *** The `mktime' function now takes an optional second argument ZONE,
3676 giving the time zone to use for the conversion. ZONE should be a
3677 string, in the same format as expected for the "TZ" environment variable.
3679 *** The `strptime' function now returns a pair (TIME . COUNT), where
3680 TIME is the parsed time as a vector, and COUNT is the number of
3681 characters from the string left unparsed. This function used to
3682 return the remaining characters as a string.
3684 *** The `gettimeofday' function has replaced the old `time+ticks' function.
3685 The return value is now (SECONDS . MICROSECONDS); the fractional
3686 component is no longer expressed in "ticks".
3688 *** The `ticks/sec' constant has been removed, in light of the above change.
3690 * Changes to the gh_ interface
3692 ** gh_eval_str() now returns an SCM object which is the result of the
3695 ** gh_scm2str() now copies the Scheme data to a caller-provided C
3698 ** gh_scm2newstr() now makes a C array, copies the Scheme data to it,
3699 and returns the array
3701 ** gh_scm2str0() is gone: there is no need to distinguish
3702 null-terminated from non-null-terminated, since gh_scm2newstr() allows
3703 the user to interpret the data both ways.
3705 * Changes to the scm_ interface
3707 ** The new function scm_symbol_value0 provides an easy way to get a
3708 symbol's value from C code:
3710 SCM scm_symbol_value0 (char *NAME)
3711 Return the value of the symbol named by the null-terminated string
3712 NAME in the current module. If the symbol named NAME is unbound in
3713 the current module, return SCM_UNDEFINED.
3715 ** The new function scm_sysintern0 creates new top-level variables,
3716 without assigning them a value.
3718 SCM scm_sysintern0 (char *NAME)
3719 Create a new Scheme top-level variable named NAME. NAME is a
3720 null-terminated string. Return the variable's value cell.
3722 ** The function scm_internal_catch is the guts of catch. It handles
3723 all the mechanics of setting up a catch target, invoking the catch
3724 body, and perhaps invoking the handler if the body does a throw.
3726 The function is designed to be usable from C code, but is general
3727 enough to implement all the semantics Guile Scheme expects from throw.
3729 TAG is the catch tag. Typically, this is a symbol, but this function
3730 doesn't actually care about that.
3732 BODY is a pointer to a C function which runs the body of the catch;
3733 this is the code you can throw from. We call it like this:
3734 BODY (BODY_DATA, JMPBUF)
3736 BODY_DATA is just the BODY_DATA argument we received; we pass it
3737 through to BODY as its first argument. The caller can make
3738 BODY_DATA point to anything useful that BODY might need.
3739 JMPBUF is the Scheme jmpbuf object corresponding to this catch,
3740 which we have just created and initialized.
3742 HANDLER is a pointer to a C function to deal with a throw to TAG,
3743 should one occur. We call it like this:
3744 HANDLER (HANDLER_DATA, THROWN_TAG, THROW_ARGS)
3746 HANDLER_DATA is the HANDLER_DATA argument we recevied; it's the
3747 same idea as BODY_DATA above.
3748 THROWN_TAG is the tag that the user threw to; usually this is
3749 TAG, but it could be something else if TAG was #t (i.e., a
3750 catch-all), or the user threw to a jmpbuf.
3751 THROW_ARGS is the list of arguments the user passed to the THROW
3754 BODY_DATA is just a pointer we pass through to BODY. HANDLER_DATA
3755 is just a pointer we pass through to HANDLER. We don't actually
3756 use either of those pointers otherwise ourselves. The idea is
3757 that, if our caller wants to communicate something to BODY or
3758 HANDLER, it can pass a pointer to it as MUMBLE_DATA, which BODY and
3759 HANDLER can then use. Think of it as a way to make BODY and
3760 HANDLER closures, not just functions; MUMBLE_DATA points to the
3763 Of course, it's up to the caller to make sure that any data a
3764 MUMBLE_DATA needs is protected from GC. A common way to do this is
3765 to make MUMBLE_DATA a pointer to data stored in an automatic
3766 structure variable; since the collector must scan the stack for
3767 references anyway, this assures that any references in MUMBLE_DATA
3770 ** The new function scm_internal_lazy_catch is exactly like
3771 scm_internal_catch, except:
3773 - It does not unwind the stack (this is the major difference).
3774 - If handler returns, its value is returned from the throw.
3775 - BODY always receives #f as its JMPBUF argument (since there's no
3776 jmpbuf associated with a lazy catch, because we don't unwind the
3779 ** scm_body_thunk is a new body function you can pass to
3780 scm_internal_catch if you want the body to be like Scheme's `catch'
3781 --- a thunk, or a function of one argument if the tag is #f.
3783 BODY_DATA is a pointer to a scm_body_thunk_data structure, which
3784 contains the Scheme procedure to invoke as the body, and the tag
3785 we're catching. If the tag is #f, then we pass JMPBUF (created by
3786 scm_internal_catch) to the body procedure; otherwise, the body gets
3789 ** scm_handle_by_proc is a new handler function you can pass to
3790 scm_internal_catch if you want the handler to act like Scheme's catch
3791 --- call a procedure with the tag and the throw arguments.
3793 If the user does a throw to this catch, this function runs a handler
3794 procedure written in Scheme. HANDLER_DATA is a pointer to an SCM
3795 variable holding the Scheme procedure object to invoke. It ought to
3796 be a pointer to an automatic variable (i.e., one living on the stack),
3797 or the procedure object should be otherwise protected from GC.
3799 ** scm_handle_by_message is a new handler function to use with
3800 `scm_internal_catch' if you want Guile to print a message and die.
3801 It's useful for dealing with throws to uncaught keys at the top level.
3803 HANDLER_DATA, if non-zero, is assumed to be a char * pointing to a
3804 message header to print; if zero, we use "guile" instead. That
3805 text is followed by a colon, then the message described by ARGS.
3807 ** The return type of scm_boot_guile is now void; the function does
3808 not return a value, and indeed, never returns at all.
3810 ** The new function scm_shell makes it easy for user applications to
3811 process command-line arguments in a way that is compatible with the
3812 stand-alone guile interpreter (which is in turn compatible with SCSH,
3815 To use the scm_shell function, first initialize any guile modules
3816 linked into your application, and then call scm_shell with the values
3817 of ARGC and ARGV your `main' function received. scm_shell will add
3818 any SCSH-style meta-arguments from the top of the script file to the
3819 argument vector, and then process the command-line arguments. This
3820 generally means loading a script file or starting up an interactive
3821 command interpreter. For details, see "Changes to the stand-alone
3824 ** The new functions scm_get_meta_args and scm_count_argv help you
3825 implement the SCSH-style meta-argument, `\'.
3827 char **scm_get_meta_args (int ARGC, char **ARGV)
3828 If the second element of ARGV is a string consisting of a single
3829 backslash character (i.e. "\\" in Scheme notation), open the file
3830 named by the following argument, parse arguments from it, and return
3831 the spliced command line. The returned array is terminated by a
3834 For details of argument parsing, see above, under "guile now accepts
3835 command-line arguments compatible with SCSH..."
3837 int scm_count_argv (char **ARGV)
3838 Count the arguments in ARGV, assuming it is terminated by a null
3841 For an example of how these functions might be used, see the source
3842 code for the function scm_shell in libguile/script.c.
3844 You will usually want to use scm_shell instead of calling this
3847 ** The new function scm_compile_shell_switches turns an array of
3848 command-line arguments into Scheme code to carry out the actions they
3849 describe. Given ARGC and ARGV, it returns a Scheme expression to
3850 evaluate, and calls scm_set_program_arguments to make any remaining
3851 command-line arguments available to the Scheme code. For example,
3852 given the following arguments:
3854 -e main -s ekko a speckled gecko
3856 scm_set_program_arguments will return the following expression:
3858 (begin (load "ekko") (main (command-line)) (quit))
3860 You will usually want to use scm_shell instead of calling this
3863 ** The function scm_shell_usage prints a usage message appropriate for
3864 an interpreter that uses scm_compile_shell_switches to handle its
3865 command-line arguments.
3867 void scm_shell_usage (int FATAL, char *MESSAGE)
3868 Print a usage message to the standard error output. If MESSAGE is
3869 non-zero, write it before the usage message, followed by a newline.
3870 If FATAL is non-zero, exit the process, using FATAL as the
3871 termination status. (If you want to be compatible with Guile,
3872 always use 1 as the exit status when terminating due to command-line
3875 You will usually want to use scm_shell instead of calling this
3878 ** scm_eval_0str now returns SCM_UNSPECIFIED if the string contains no
3879 expressions. It used to return SCM_EOL. Earth-shattering.
3881 ** The macros for declaring scheme objects in C code have been
3882 rearranged slightly. They are now:
3884 SCM_SYMBOL (C_NAME, SCHEME_NAME)
3885 Declare a static SCM variable named C_NAME, and initialize it to
3886 point to the Scheme symbol whose name is SCHEME_NAME. C_NAME should
3887 be a C identifier, and SCHEME_NAME should be a C string.
3889 SCM_GLOBAL_SYMBOL (C_NAME, SCHEME_NAME)
3890 Just like SCM_SYMBOL, but make C_NAME globally visible.
3892 SCM_VCELL (C_NAME, SCHEME_NAME)
3893 Create a global variable at the Scheme level named SCHEME_NAME.
3894 Declare a static SCM variable named C_NAME, and initialize it to
3895 point to the Scheme variable's value cell.
3897 SCM_GLOBAL_VCELL (C_NAME, SCHEME_NAME)
3898 Just like SCM_VCELL, but make C_NAME globally visible.
3900 The `guile-snarf' script writes initialization code for these macros
3901 to its standard output, given C source code as input.
3903 The SCM_GLOBAL macro is gone.
3905 ** The scm_read_line and scm_read_line_x functions have been replaced
3906 by Scheme code based on the %read-delimited! procedure (known to C
3907 code as scm_read_delimited_x). See its description above for more
3910 ** The function scm_sys_open has been renamed to scm_open. It now
3911 returns a port instead of an FD object.
3913 * The dynamic linking support has changed. For more information, see
3914 libguile/DYNAMIC-LINKING.
3919 User-visible changes from Thursday, September 5, 1996 until Guile 1.0
3922 * Changes to the 'guile' program:
3924 ** Guile now loads some new files when it starts up. Guile first
3925 searches the load path for init.scm, and loads it if found. Then, if
3926 Guile is not being used to execute a script, and the user's home
3927 directory contains a file named `.guile', Guile loads that.
3929 ** You can now use Guile as a shell script interpreter.
3931 To paraphrase the SCSH manual:
3933 When Unix tries to execute an executable file whose first two
3934 characters are the `#!', it treats the file not as machine code to
3935 be directly executed by the native processor, but as source code
3936 to be executed by some interpreter. The interpreter to use is
3937 specified immediately after the #! sequence on the first line of
3938 the source file. The kernel reads in the name of the interpreter,
3939 and executes that instead. It passes the interpreter the source
3940 filename as its first argument, with the original arguments
3941 following. Consult the Unix man page for the `exec' system call
3942 for more information.
3944 Now you can use Guile as an interpreter, using a mechanism which is a
3945 compatible subset of that provided by SCSH.
3947 Guile now recognizes a '-s' command line switch, whose argument is the
3948 name of a file of Scheme code to load. It also treats the two
3949 characters `#!' as the start of a comment, terminated by `!#'. Thus,
3950 to make a file of Scheme code directly executable by Unix, insert the
3951 following two lines at the top of the file:
3953 #!/usr/local/bin/guile -s
3956 Guile treats the argument of the `-s' command-line switch as the name
3957 of a file of Scheme code to load, and treats the sequence `#!' as the
3958 start of a block comment, terminated by `!#'.
3960 For example, here's a version of 'echo' written in Scheme:
3962 #!/usr/local/bin/guile -s
3964 (let loop ((args (cdr (program-arguments))))
3967 (display (car args))
3968 (if (pair? (cdr args))
3970 (loop (cdr args)))))
3973 Why does `#!' start a block comment terminated by `!#', instead of the
3974 end of the line? That is the notation SCSH uses, and although we
3975 don't yet support the other SCSH features that motivate that choice,
3976 we would like to be backward-compatible with any existing Guile
3977 scripts once we do. Furthermore, if the path to Guile on your system
3978 is too long for your kernel, you can start the script with this
3982 exec /really/long/path/to/guile -s "$0" ${1+"$@"}
3985 Note that some very old Unix systems don't support the `#!' syntax.
3988 ** You can now run Guile without installing it.
3990 Previous versions of the interactive Guile interpreter (`guile')
3991 couldn't start up unless Guile's Scheme library had been installed;
3992 they used the value of the environment variable `SCHEME_LOAD_PATH'
3993 later on in the startup process, but not to find the startup code
3994 itself. Now Guile uses `SCHEME_LOAD_PATH' in all searches for Scheme
3997 To run Guile without installing it, build it in the normal way, and
3998 then set the environment variable `SCHEME_LOAD_PATH' to a
3999 colon-separated list of directories, including the top-level directory
4000 of the Guile sources. For example, if you unpacked Guile so that the
4001 full filename of this NEWS file is /home/jimb/guile-1.0b3/NEWS, then
4004 export SCHEME_LOAD_PATH=/home/jimb/my-scheme:/home/jimb/guile-1.0b3
4007 ** Guile's read-eval-print loop no longer prints #<unspecified>
4008 results. If the user wants to see this, she can evaluate the
4009 expression (assert-repl-print-unspecified #t), perhaps in her startup
4012 ** Guile no longer shows backtraces by default when an error occurs;
4013 however, it does display a message saying how to get one, and how to
4014 request that they be displayed by default. After an error, evaluate
4016 to see a backtrace, and
4017 (debug-enable 'backtrace)
4018 to see them by default.
4022 * Changes to Guile Scheme:
4024 ** Guile now distinguishes between #f and the empty list.
4026 This is for compatibility with the IEEE standard, the (possibly)
4027 upcoming Revised^5 Report on Scheme, and many extant Scheme
4030 Guile used to have #f and '() denote the same object, to make Scheme's
4031 type system more compatible with Emacs Lisp's. However, the change
4032 caused too much trouble for Scheme programmers, and we found another
4033 way to reconcile Emacs Lisp with Scheme that didn't require this.
4036 ** Guile's delq, delv, delete functions, and their destructive
4037 counterparts, delq!, delv!, and delete!, now remove all matching
4038 elements from the list, not just the first. This matches the behavior
4039 of the corresponding Emacs Lisp functions, and (I believe) the Maclisp
4040 functions which inspired them.
4042 I recognize that this change may break code in subtle ways, but it
4043 seems best to make the change before the FSF's first Guile release,
4047 ** The compiled-library-path function has been deleted from libguile.
4049 ** The facilities for loading Scheme source files have changed.
4051 *** The variable %load-path now tells Guile which directories to search
4052 for Scheme code. Its value is a list of strings, each of which names
4055 *** The variable %load-extensions now tells Guile which extensions to
4056 try appending to a filename when searching the load path. Its value
4057 is a list of strings. Its default value is ("" ".scm").
4059 *** (%search-load-path FILENAME) searches the directories listed in the
4060 value of the %load-path variable for a Scheme file named FILENAME,
4061 with all the extensions listed in %load-extensions. If it finds a
4062 match, then it returns its full filename. If FILENAME is absolute, it
4063 returns it unchanged. Otherwise, it returns #f.
4065 %search-load-path will not return matches that refer to directories.
4067 *** (primitive-load FILENAME :optional CASE-INSENSITIVE-P SHARP)
4068 uses %seach-load-path to find a file named FILENAME, and loads it if
4069 it finds it. If it can't read FILENAME for any reason, it throws an
4072 The arguments CASE-INSENSITIVE-P and SHARP are interpreted as by the
4075 *** load uses the same searching semantics as primitive-load.
4077 *** The functions %try-load, try-load-with-path, %load, load-with-path,
4078 basic-try-load-with-path, basic-load-with-path, try-load-module-with-
4079 path, and load-module-with-path have been deleted. The functions
4080 above should serve their purposes.
4082 *** If the value of the variable %load-hook is a procedure,
4083 `primitive-load' applies its value to the name of the file being
4084 loaded (without the load path directory name prepended). If its value
4085 is #f, it is ignored. Otherwise, an error occurs.
4087 This is mostly useful for printing load notification messages.
4090 ** The function `eval!' is no longer accessible from the scheme level.
4091 We can't allow operations which introduce glocs into the scheme level,
4092 because Guile's type system can't handle these as data. Use `eval' or
4093 `read-and-eval!' (see below) as replacement.
4095 ** The new function read-and-eval! reads an expression from PORT,
4096 evaluates it, and returns the result. This is more efficient than
4097 simply calling `read' and `eval', since it is not necessary to make a
4098 copy of the expression for the evaluator to munge.
4100 Its optional arguments CASE_INSENSITIVE_P and SHARP are interpreted as
4101 for the `read' function.
4104 ** The function `int?' has been removed; its definition was identical
4105 to that of `integer?'.
4107 ** The functions `<?', `<?', `<=?', `=?', `>?', and `>=?'. Code should
4108 use the R4RS names for these functions.
4110 ** The function object-properties no longer returns the hash handle;
4111 it simply returns the object's property list.
4113 ** Many functions have been changed to throw errors, instead of
4114 returning #f on failure. The point of providing exception handling in
4115 the language is to simplify the logic of user code, but this is less
4116 useful if Guile's primitives don't throw exceptions.
4118 ** The function `fileno' has been renamed from `%fileno'.
4120 ** The function primitive-mode->fdes returns #t or #f now, not 1 or 0.
4123 * Changes to Guile's C interface:
4125 ** The library's initialization procedure has been simplified.
4126 scm_boot_guile now has the prototype:
4128 void scm_boot_guile (int ARGC,
4130 void (*main_func) (),
4133 scm_boot_guile calls MAIN_FUNC, passing it CLOSURE, ARGC, and ARGV.
4134 MAIN_FUNC should do all the work of the program (initializing other
4135 packages, reading user input, etc.) before returning. When MAIN_FUNC
4136 returns, call exit (0); this function never returns. If you want some
4137 other exit value, MAIN_FUNC may call exit itself.
4139 scm_boot_guile arranges for program-arguments to return the strings
4140 given by ARGC and ARGV. If MAIN_FUNC modifies ARGC/ARGV, should call
4141 scm_set_program_arguments with the final list, so Scheme code will
4142 know which arguments have been processed.
4144 scm_boot_guile establishes a catch-all catch handler which prints an
4145 error message and exits the process. This means that Guile exits in a
4146 coherent way when system errors occur and the user isn't prepared to
4147 handle it. If the user doesn't like this behavior, they can establish
4148 their own universal catcher in MAIN_FUNC to shadow this one.
4150 Why must the caller do all the real work from MAIN_FUNC? The garbage
4151 collector assumes that all local variables of type SCM will be above
4152 scm_boot_guile's stack frame on the stack. If you try to manipulate
4153 SCM values after this function returns, it's the luck of the draw
4154 whether the GC will be able to find the objects you allocate. So,
4155 scm_boot_guile function exits, rather than returning, to discourage
4156 people from making that mistake.
4158 The IN, OUT, and ERR arguments were removed; there are other
4159 convenient ways to override these when desired.
4161 The RESULT argument was deleted; this function should never return.
4163 The BOOT_CMD argument was deleted; the MAIN_FUNC argument is more
4167 ** Guile's header files should no longer conflict with your system's
4170 In order to compile code which #included <libguile.h>, previous
4171 versions of Guile required you to add a directory containing all the
4172 Guile header files to your #include path. This was a problem, since
4173 Guile's header files have names which conflict with many systems'
4176 Now only <libguile.h> need appear in your #include path; you must
4177 refer to all Guile's other header files as <libguile/mumble.h>.
4178 Guile's installation procedure puts libguile.h in $(includedir), and
4179 the rest in $(includedir)/libguile.
4182 ** Two new C functions, scm_protect_object and scm_unprotect_object,
4183 have been added to the Guile library.
4185 scm_protect_object (OBJ) protects OBJ from the garbage collector.
4186 OBJ will not be freed, even if all other references are dropped,
4187 until someone does scm_unprotect_object (OBJ). Both functions
4190 Note that calls to scm_protect_object do not nest. You can call
4191 scm_protect_object any number of times on a given object, and the
4192 next call to scm_unprotect_object will unprotect it completely.
4194 Basically, scm_protect_object and scm_unprotect_object just
4195 maintain a list of references to things. Since the GC knows about
4196 this list, all objects it mentions stay alive. scm_protect_object
4197 adds its argument to the list; scm_unprotect_object remove its
4198 argument from the list.
4201 ** scm_eval_0str now returns the value of the last expression
4204 ** The new function scm_read_0str reads an s-expression from a
4205 null-terminated string, and returns it.
4207 ** The new function `scm_stdio_to_port' converts a STDIO file pointer
4208 to a Scheme port object.
4210 ** The new function `scm_set_program_arguments' allows C code to set
4211 the value returned by the Scheme `program-arguments' function.
4216 * Guile no longer includes sophisticated Tcl/Tk support.
4218 The old Tcl/Tk support was unsatisfying to us, because it required the
4219 user to link against the Tcl library, as well as Tk and Guile. The
4220 interface was also un-lispy, in that it preserved Tcl/Tk's practice of
4221 referring to widgets by names, rather than exporting widgets to Scheme
4222 code as a special datatype.
4224 In the Usenix Tk Developer's Workshop held in July 1996, the Tcl/Tk
4225 maintainers described some very interesting changes in progress to the
4226 Tcl/Tk internals, which would facilitate clean interfaces between lone
4227 Tk and other interpreters --- even for garbage-collected languages
4228 like Scheme. They expected the new Tk to be publicly available in the
4231 Since it seems that Guile might soon have a new, cleaner interface to
4232 lone Tk, and that the old Guile/Tk glue code would probably need to be
4233 completely rewritten, we (Jim Blandy and Richard Stallman) have
4234 decided not to support the old code. We'll spend the time instead on
4235 a good interface to the newer Tk, as soon as it is available.
4237 Until then, gtcltk-lib provides trivial, low-maintenance functionality.
4240 Copyright information:
4242 Copyright (C) 1996,1997 Free Software Foundation, Inc.
4244 Permission is granted to anyone to make or distribute verbatim copies
4245 of this document as received, in any medium, provided that the
4246 copyright notice and this permission notice are preserved,
4247 thus giving the recipient permission to redistribute in turn.
4249 Permission is granted to distribute modified versions
4250 of this document, or of portions of it,
4251 under the above conditions, provided also that they
4252 carry prominent notices stating who last changed them.
4257 paragraph-separate: "[
\f]*$"