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 * Massive software engineering face-lift by Greg J. Badros <gjb@cs.washington.edu>
11 Now Guile primitives are defined using the GUILE_PROC/GUILE_PROC1 macros
12 and must contain a docstring that is extracted into foo.doc using a new
13 guile-doc-snarf script (that uses guile-doc-snarf.awk).
15 Also, many SCM_VALIDATE_* macros are defined to ease the redundancy and
16 improve the readability of argument checking.
18 All (nearly?) K&R prototypes for functions replaced with ANSI C equivalents.
20 * Dynamic linking now uses libltdl from the libtool package.
22 The old system dependent code for doing dynamic linking has been
23 replaced with calls to the libltdl functions which do all the hairy
26 The major improvement is that you can now directly pass libtool
27 library names like "libfoo.la" to `dynamic-link' and `dynamic-link'
28 will be able to do the best shared library job you can get, via
31 The way dynamic libraries are found has changed and is not really
32 portable across platforms, probably. It is therefore recommended to
33 use absolute filenames when possible.
35 If you pass a filename without an extension to `dynamic-link', it will
36 try a few appropriate ones. Thus, the most platform ignorant way is
37 specify a name like "libfoo", without any directories and extensions.
39 * Changes to the distribution
41 ** Trees from nightly snapshots and CVS now require you to run autogen.sh.
43 We've changed the way we handle generated files in the Guile source
44 repository. As a result, the procedure for building trees obtained
45 from the nightly FTP snapshots or via CVS has changed:
46 - You must have appropriate versions of autoconf, automake, and
47 libtool installed on your system. See README for info on how to
48 obtain these programs.
49 - Before configuring the tree, you must first run the script
50 `autogen.sh' at the top of the source tree.
52 The Guile repository used to contain not only source files, written by
53 humans, but also some generated files, like configure scripts and
54 Makefile.in files. Even though the contents of these files could be
55 derived mechanically from other files present, we thought it would
56 make the tree easier to build if we checked them into CVS.
58 However, this approach means that minor differences between
59 developer's installed tools and habits affected the whole team.
60 So we have removed the generated files from the repository, and
61 added the autogen.sh script, which will reconstruct them
65 ** configure has new options to remove support for certain features:
67 --disable-arrays omit array and uniform array support
68 --disable-posix omit posix interfaces
69 --disable-net omit networking interfaces
70 --disable-regex omit regular expression interfaces
72 These are likely to become separate modules some day.
74 ** Added new configure option --enable-debug-freelist
76 This enables a debugging version of SCM_NEWCELL(), and also registers
77 an extra primitive, the setter `gc-set-debug-check-freelist!'.
79 Configure with the --enable-debug-freelist option to enable
80 the gc-set-debug-check-freelist! primitive, and then use:
82 (gc-set-debug-check-freelist! #t) # turn on checking of the freelist
83 (gc-set-debug-check-freelist! #f) # turn off checking
85 Checking of the freelist forces a traversal of the freelist and
86 a garbage collection before each allocation of a cell. This can
87 slow down the interpreter dramatically, so the setter should be used to
88 turn on this extra processing only when necessary.
90 * Changes to the stand-alone interpreter
92 ** New primitives: `pkgdata-dir', `site-dir', `library-dir'
94 ** Positions of erring expression in scripts
96 With version 1.3.4, the location of the erring expression in Guile
97 scipts is no longer automatically reported. (This should have been
98 documented before the 1.3.4 release.)
100 You can get this information by enabling recording of positions of
101 source expressions and running the debugging evaluator. Put this at
102 the top of your script (or in your "site" file):
104 (read-enable 'positions)
105 (debug-enable 'debug)
107 ** Backtraces in scripts
109 It is now possible to get backtraces in scripts.
113 (debug-enable 'debug 'backtrace)
115 at the top of the script.
117 (The first options enables the debugging evaluator.
118 The second enables backtraces.)
120 ** New procedure: port-closed? PORT
121 Returns #t if PORT is closed or #f if it is open.
123 ** Attempting to get the value of an unbound variable now produces
124 an exception with a key of 'unbound-variable instead of 'misc-error.
126 * Changes to the scm_ interface
128 ** Port internals: the rw_random variable in the scm_port structure
129 must be set to non-zero in any random access port. In recent Guile
130 releases it was only set for bidirectional random-access ports.
132 ** Port internals: the seek ptob procedure is now responsible for
133 resetting the buffers if required. The change was made so that in the
134 special case of reading the current position (i.e., seek p 0 SEEK_CUR)
135 the fport and strport ptobs can avoid resetting the buffers,
136 in particular to avoid discarding unread chars. An existing port
137 type can be fixed by adding something like the following to the
138 beginning of the ptob seek procedure:
140 if (pt->rw_active == SCM_PORT_READ)
141 scm_end_input (object);
142 else if (pt->rw_active == SCM_PORT_WRITE)
143 ptob->flush (object);
145 although to actually avoid resetting the buffers and discard unread
146 chars requires further hacking that depends on the characteristics
149 ** The scm_sysmissing procedure is no longer used in libguile.
150 Unless it turns out to be unexpectedly useful to somebody, it will be
151 removed in a future version.
153 * Changes to system call interfaces:
155 ** If a facility is not available on the system when Guile is
156 compiled, the corresponding primitive procedure will not be defined.
157 Previously it would have been defined but would throw a system-error
158 exception if called. Exception handlers which catch this case may
159 need minor modification: an error will be thrown with key
160 'unbound-variable instead of 'system-error. Alternatively it's
161 now possible to use `defined?' to check whether the facility is
164 ** Procedures which depend on the timezone should now give the correct
165 result on systems which cache the TZ environment variable, even if TZ
166 is changed without calling tzset.
168 * Changes to the networking interfaces:
170 ** New functions: htons, ntohs, htonl, ntohl: for converting short and
171 long integers between network and host format. For now, it's not
172 particularly convenient to do this kind of thing, but consider:
174 (define write-network-long
176 (let ((v (make-uniform-vector 1 1 0)))
177 (uniform-vector-set! v 0 (htonl value))
178 (uniform-vector-write v port))))
180 (define read-network-long
182 (let ((v (make-uniform-vector 1 1 0)))
183 (uniform-vector-read! v port)
184 (ntohl (uniform-vector-ref v 0)))))
186 ** If inet-aton fails, it now throws an error with key 'misc-error
187 instead of 'system-error, since errno is not relevant.
189 ** Certain gethostbyname/gethostbyaddr failures now throw errors with
190 specific keys instead of 'system-error. The latter is inappropriate
191 since errno will not have been set. The keys are:
192 'host-not-found, 'try-again, 'no-recovery and 'no-data.
194 ** sethostent, setnetent, setprotoent, setservent: now take an
195 optional argument STAYOPEN, which specifies whether the database
196 remains open after a database entry is accessed randomly (e.g., using
197 gethostbyname for the hosts database.) The default is #f. Previously
201 Changes since Guile 1.3.2:
203 * Changes to the stand-alone interpreter
207 An initial version of the Guile debugger written by Chris Hanson has
208 been added. The debugger is still under development but is included
209 in the distribution anyway since it is already quite useful.
215 after an error to enter the debugger. Type `help' inside the debugger
216 for a description of available commands.
218 If you prefer to have stack frames numbered and printed in
219 anti-chronological order and prefer up in the stack to be down on the
220 screen as is the case in gdb, you can put
222 (debug-enable 'backwards)
224 in your .guile startup file. (However, this means that Guile can't
225 use indentation to indicate stack level.)
227 The debugger is autoloaded into Guile at the first use.
229 ** Further enhancements to backtraces
231 There is a new debug option `width' which controls the maximum width
232 on the screen of printed stack frames. Fancy printing parameters
233 ("level" and "length" as in Common LISP) are adaptively adjusted for
234 each stack frame to give maximum information while still fitting
235 within the bounds. If the stack frame can't be made to fit by
236 adjusting parameters, it is simply cut off at the end. This is marked
239 ** Some modules are now only loaded when the repl is started
241 The modules (ice-9 debug), (ice-9 session), (ice-9 threads) and (ice-9
242 regex) are now loaded into (guile-user) only if the repl has been
243 started. The effect is that the startup time for scripts has been
244 reduced to 30% of what it was previously.
246 Correctly written scripts load the modules they require at the top of
247 the file and should not be affected by this change.
249 ** Hooks are now represented as smobs
251 * Changes to Scheme functions and syntax
253 ** Readline support has changed again.
255 The old (readline-activator) module is gone. Use (ice-9 readline)
256 instead, which now contains all readline functionality. So the code
257 to activate readline is now
259 (use-modules (ice-9 readline))
262 This should work at any time, including from the guile prompt.
264 To avoid confusion about the terms of Guile's license, please only
265 enable readline for your personal use; please don't make it the
266 default for others. Here is why we make this rather odd-sounding
269 Guile is normally licensed under a weakened form of the GNU General
270 Public License, which allows you to link code with Guile without
271 placing that code under the GPL. This exception is important to some
274 However, since readline is distributed under the GNU General Public
275 License, when you link Guile with readline, either statically or
276 dynamically, you effectively change Guile's license to the strict GPL.
277 Whenever you link any strictly GPL'd code into Guile, uses of Guile
278 which are normally permitted become forbidden. This is a rather
279 non-obvious consequence of the licensing terms.
281 So, to make sure things remain clear, please let people choose for
282 themselves whether to link GPL'd libraries like readline with Guile.
284 ** regexp-substitute/global has changed slightly, but incompatibly.
286 If you include a function in the item list, the string of the match
287 object it receives is the same string passed to
288 regexp-substitute/global, not some suffix of that string.
289 Correspondingly, the match's positions are relative to the entire
290 string, not the suffix.
292 If the regexp can match the empty string, the way matches are chosen
293 from the string has changed. regexp-substitute/global recognizes the
294 same set of matches that list-matches does; see below.
296 ** New function: list-matches REGEXP STRING [FLAGS]
298 Return a list of match objects, one for every non-overlapping, maximal
299 match of REGEXP in STRING. The matches appear in left-to-right order.
300 list-matches only reports matches of the empty string if there are no
301 other matches which begin on, end at, or include the empty match's
304 If present, FLAGS is passed as the FLAGS argument to regexp-exec.
306 ** New function: fold-matches REGEXP STRING INIT PROC [FLAGS]
308 For each match of REGEXP in STRING, apply PROC to the match object,
309 and the last value PROC returned, or INIT for the first call. Return
310 the last value returned by PROC. We apply PROC to the matches as they
311 appear from left to right.
313 This function recognizes matches according to the same criteria as
316 Thus, you could define list-matches like this:
318 (define (list-matches regexp string . flags)
319 (reverse! (apply fold-matches regexp string '() cons flags)))
321 If present, FLAGS is passed as the FLAGS argument to regexp-exec.
325 *** New function: hook? OBJ
327 Return #t if OBJ is a hook, otherwise #f.
329 *** New function: make-hook-with-name NAME [ARITY]
331 Return a hook with name NAME and arity ARITY. The default value for
332 ARITY is 0. The only effect of NAME is that it will appear when the
333 hook object is printed to ease debugging.
335 *** New function: hook-empty? HOOK
337 Return #t if HOOK doesn't contain any procedures, otherwise #f.
339 *** New function: hook->list HOOK
341 Return a list of the procedures that are called when run-hook is
344 ** `map' signals an error if its argument lists are not all the same length.
346 This is the behavior required by R5RS, so this change is really a bug
347 fix. But it seems to affect a lot of people's code, so we're
348 mentioning it here anyway.
350 ** Print-state handling has been made more transparent
352 Under certain circumstances, ports are represented as a port with an
353 associated print state. Earlier, this pair was represented as a pair
354 (see "Some magic has been added to the printer" below). It is now
355 indistinguishable (almost; see `get-print-state') from a port on the
358 *** New function: port-with-print-state OUTPUT-PORT PRINT-STATE
360 Return a new port with the associated print state PRINT-STATE.
362 *** New function: get-print-state OUTPUT-PORT
364 Return the print state associated with this port if it exists,
367 *** New function: directory-stream? OBJECT
369 Returns true iff OBJECT is a directory stream --- the sort of object
370 returned by `opendir'.
372 ** New function: using-readline?
374 Return #t if readline is in use in the current repl.
376 ** structs will be removed in 1.4
378 Structs will be replaced in Guile 1.4. We will merge GOOPS into Guile
379 and use GOOPS objects as the fundamental record type.
381 * Changes to the scm_ interface
383 ** structs will be removed in 1.4
385 The entire current struct interface (struct.c, struct.h) will be
386 replaced in Guile 1.4. We will merge GOOPS into libguile and use
387 GOOPS objects as the fundamental record type.
389 ** The internal representation of subr's has changed
391 Instead of giving a hint to the subr name, the CAR field of the subr
392 now contains an index to a subr entry in scm_subr_table.
394 *** New variable: scm_subr_table
396 An array of subr entries. A subr entry contains the name, properties
397 and documentation associated with the subr. The properties and
398 documentation slots are not yet used.
400 ** A new scheme for "forwarding" calls to a builtin to a generic function
402 It is now possible to extend the functionality of some Guile
403 primitives by letting them defer a call to a GOOPS generic function on
404 argument mismatch. This means that there is no loss of efficiency in
409 (use-modules (oop goops)) ; Must be GOOPS version 0.2.
410 (define-method + ((x <string>) (y <string>))
413 + will still be as efficient as usual in numerical calculations, but
414 can also be used for concatenating strings.
416 Who will be the first one to extend Guile's numerical tower to
417 rationals? :) [OK, there a few other things to fix before this can
418 be made in a clean way.]
420 *** New snarf macros for defining primitives: SCM_GPROC, SCM_GPROC1
422 New macro: SCM_GPROC (CNAME, SNAME, REQ, OPT, VAR, CFUNC, GENERIC)
424 New macro: SCM_GPROC1 (CNAME, SNAME, TYPE, CFUNC, GENERIC)
426 These do the same job as SCM_PROC and SCM_PROC1, but they also define
427 a variable GENERIC which can be used by the dispatch macros below.
429 [This is experimental code which may change soon.]
431 *** New macros for forwarding control to a generic on arg type error
433 New macro: SCM_WTA_DISPATCH_1 (GENERIC, ARG1, POS, SUBR)
435 New macro: SCM_WTA_DISPATCH_2 (GENERIC, ARG1, ARG2, POS, SUBR)
437 These correspond to the scm_wta function call, and have the same
438 behaviour until the user has called the GOOPS primitive
439 `enable-primitive-generic!'. After that, these macros will apply the
440 generic function GENERIC to the argument(s) instead of calling
443 [This is experimental code which may change soon.]
445 *** New macros for argument testing with generic dispatch
447 New macro: SCM_GASSERT1 (COND, GENERIC, ARG1, POS, SUBR)
449 New macro: SCM_GASSERT2 (COND, GENERIC, ARG1, ARG2, POS, SUBR)
451 These correspond to the SCM_ASSERT macro, but will defer control to
452 GENERIC on error after `enable-primitive-generic!' has been called.
454 [This is experimental code which may change soon.]
456 ** New function: SCM scm_eval_body (SCM body, SCM env)
458 Evaluates the body of a special form.
460 ** The internal representation of struct's has changed
462 Previously, four slots were allocated for the procedure(s) of entities
463 and operators. The motivation for this representation had to do with
464 the structure of the evaluator, the wish to support tail-recursive
465 generic functions, and efficiency. Since the generic function
466 dispatch mechanism has changed, there is no longer a need for such an
467 expensive representation, and the representation has been simplified.
469 This should not make any difference for most users.
471 ** GOOPS support has been cleaned up.
473 Some code has been moved from eval.c to objects.c and code in both of
474 these compilation units has been cleaned up and better structured.
476 *** New functions for applying generic functions
478 New function: SCM scm_apply_generic (GENERIC, ARGS)
479 New function: SCM scm_call_generic_0 (GENERIC)
480 New function: SCM scm_call_generic_1 (GENERIC, ARG1)
481 New function: SCM scm_call_generic_2 (GENERIC, ARG1, ARG2)
482 New function: SCM scm_call_generic_3 (GENERIC, ARG1, ARG2, ARG3)
484 ** Deprecated function: scm_make_named_hook
486 It is now replaced by:
488 ** New function: SCM scm_create_hook (const char *name, int arity)
490 Creates a hook in the same way as make-hook above but also
491 binds a variable named NAME to it.
493 This is the typical way of creating a hook from C code.
495 Currently, the variable is created in the "current" module.
496 This might change when we get the new module system.
498 [The behaviour is identical to scm_make_named_hook.]
502 Changes since Guile 1.3:
504 * Changes to mailing lists
506 ** Some of the Guile mailing lists have moved to sourceware.cygnus.com.
508 See the README file to find current addresses for all the Guile
511 * Changes to the distribution
513 ** Readline support is no longer included with Guile by default.
515 Based on the different license terms of Guile and Readline, we
516 concluded that Guile should not *by default* cause the linking of
517 Readline into an application program. Readline support is now offered
518 as a separate module, which is linked into an application only when
519 you explicitly specify it.
521 Although Guile is GNU software, its distribution terms add a special
522 exception to the usual GNU General Public License (GPL). Guile's
523 license includes a clause that allows you to link Guile with non-free
524 programs. We add this exception so as not to put Guile at a
525 disadvantage vis-a-vis other extensibility packages that support other
528 In contrast, the GNU Readline library is distributed under the GNU
529 General Public License pure and simple. This means that you may not
530 link Readline, even dynamically, into an application unless it is
531 distributed under a free software license that is compatible the GPL.
533 Because of this difference in distribution terms, an application that
534 can use Guile may not be able to use Readline. Now users will be
535 explicitly offered two independent decisions about the use of these
538 You can activate the readline support by issuing
540 (use-modules (readline-activator))
543 from your ".guile" file, for example.
545 * Changes to the stand-alone interpreter
547 ** All builtins now print as primitives.
548 Previously builtin procedures not belonging to the fundamental subr
549 types printed as #<compiled closure #<primitive-procedure gsubr-apply>>.
550 Now, they print as #<primitive-procedure NAME>.
552 ** Backtraces slightly more intelligible.
553 gsubr-apply and macro transformer application frames no longer appear
556 * Changes to Scheme functions and syntax
558 ** Guile now correctly handles internal defines by rewriting them into
559 their equivalent letrec. Previously, internal defines would
560 incrementally add to the innermost environment, without checking
561 whether the restrictions specified in RnRS were met. This lead to the
562 correct behaviour when these restriction actually were met, but didn't
563 catch all illegal uses. Such an illegal use could lead to crashes of
564 the Guile interpreter or or other unwanted results. An example of
565 incorrect internal defines that made Guile behave erratically:
577 The problem with this example is that the definition of `c' uses the
578 value of `b' directly. This confuses the meoization machine of Guile
579 so that the second call of `b' (this time in a larger environment that
580 also contains bindings for `c' and `d') refers to the binding of `c'
581 instead of `a'. You could also make Guile crash with a variation on
586 (define (b flag) (if flag a 1))
587 (define c (1+ (b flag)))
595 From now on, Guile will issue an `Unbound variable: b' error message
600 A hook contains a list of functions which should be called on
601 particular occasions in an existing program. Hooks are used for
604 A window manager might have a hook before-window-map-hook. The window
605 manager uses the function run-hooks to call all functions stored in
606 before-window-map-hook each time a window is mapped. The user can
607 store functions in the hook using add-hook!.
609 In Guile, hooks are first class objects.
611 *** New function: make-hook [N_ARGS]
613 Return a hook for hook functions which can take N_ARGS arguments.
614 The default value for N_ARGS is 0.
616 (See also scm_make_named_hook below.)
618 *** New function: add-hook! HOOK PROC [APPEND_P]
620 Put PROC at the beginning of the list of functions stored in HOOK.
621 If APPEND_P is supplied, and non-false, put PROC at the end instead.
623 PROC must be able to take the number of arguments specified when the
626 If PROC already exists in HOOK, then remove it first.
628 *** New function: remove-hook! HOOK PROC
630 Remove PROC from the list of functions in HOOK.
632 *** New function: reset-hook! HOOK
634 Clear the list of hook functions stored in HOOK.
636 *** New function: run-hook HOOK ARG1 ...
638 Run all hook functions stored in HOOK with arguments ARG1 ... .
639 The number of arguments supplied must correspond to the number given
640 when the hook was created.
642 ** The function `dynamic-link' now takes optional keyword arguments.
643 The only keyword argument that is currently defined is `:global
644 BOOL'. With it, you can control whether the shared library will be
645 linked in global mode or not. In global mode, the symbols from the
646 linked library can be used to resolve references from other
647 dynamically linked libraries. In non-global mode, the linked
648 library is essentially invisible and can only be accessed via
649 `dynamic-func', etc. The default is now to link in global mode.
650 Previously, the default has been non-global mode.
652 The `#:global' keyword is only effective on platforms that support
653 the dlopen family of functions.
655 ** New function `provided?'
657 - Function: provided? FEATURE
658 Return true iff FEATURE is supported by this installation of
659 Guile. FEATURE must be a symbol naming a feature; the global
660 variable `*features*' is a list of available features.
662 ** Changes to the module (ice-9 expect):
664 *** The expect-strings macro now matches `$' in a regular expression
665 only at a line-break or end-of-file by default. Previously it would
666 match the end of the string accumulated so far. The old behaviour
667 can be obtained by setting the variable `expect-strings-exec-flags'
670 *** The expect-strings macro now uses a variable `expect-strings-exec-flags'
671 for the regexp-exec flags. If `regexp/noteol' is included, then `$'
672 in a regular expression will still match before a line-break or
673 end-of-file. The default is `regexp/noteol'.
675 *** The expect-strings macro now uses a variable
676 `expect-strings-compile-flags' for the flags to be supplied to
677 `make-regexp'. The default is `regexp/newline', which was previously
680 *** The expect macro now supplies two arguments to a match procedure:
681 the current accumulated string and a flag to indicate whether
682 end-of-file has been reached. Previously only the string was supplied.
683 If end-of-file is reached, the match procedure will be called an
684 additional time with the same accumulated string as the previous call
685 but with the flag set.
687 ** New module (ice-9 format), implementing the Common Lisp `format' function.
689 This code, and the documentation for it that appears here, was
690 borrowed from SLIB, with minor adaptations for Guile.
692 - Function: format DESTINATION FORMAT-STRING . ARGUMENTS
693 An almost complete implementation of Common LISP format description
694 according to the CL reference book `Common LISP' from Guy L.
695 Steele, Digital Press. Backward compatible to most of the
696 available Scheme format implementations.
698 Returns `#t', `#f' or a string; has side effect of printing
699 according to FORMAT-STRING. If DESTINATION is `#t', the output is
700 to the current output port and `#t' is returned. If DESTINATION
701 is `#f', a formatted string is returned as the result of the call.
702 NEW: If DESTINATION is a string, DESTINATION is regarded as the
703 format string; FORMAT-STRING is then the first argument and the
704 output is returned as a string. If DESTINATION is a number, the
705 output is to the current error port if available by the
706 implementation. Otherwise DESTINATION must be an output port and
709 FORMAT-STRING must be a string. In case of a formatting error
710 format returns `#f' and prints a message on the current output or
711 error port. Characters are output as if the string were output by
712 the `display' function with the exception of those prefixed by a
713 tilde (~). For a detailed description of the FORMAT-STRING syntax
714 please consult a Common LISP format reference manual. For a test
715 suite to verify this format implementation load `formatst.scm'.
716 Please send bug reports to `lutzeb@cs.tu-berlin.de'.
718 Note: `format' is not reentrant, i.e. only one `format'-call may
719 be executed at a time.
722 *** Format Specification (Format version 3.0)
724 Please consult a Common LISP format reference manual for a detailed
725 description of the format string syntax. For a demonstration of the
726 implemented directives see `formatst.scm'.
728 This implementation supports directive parameters and modifiers (`:'
729 and `@' characters). Multiple parameters must be separated by a comma
730 (`,'). Parameters can be numerical parameters (positive or negative),
731 character parameters (prefixed by a quote character (`''), variable
732 parameters (`v'), number of rest arguments parameter (`#'), empty and
733 default parameters. Directive characters are case independent. The
734 general form of a directive is:
736 DIRECTIVE ::= ~{DIRECTIVE-PARAMETER,}[:][@]DIRECTIVE-CHARACTER
738 DIRECTIVE-PARAMETER ::= [ [-|+]{0-9}+ | 'CHARACTER | v | # ]
740 *** Implemented CL Format Control Directives
742 Documentation syntax: Uppercase characters represent the
743 corresponding control directive characters. Lowercase characters
744 represent control directive parameter descriptions.
747 Any (print as `display' does).
751 `~MINCOL,COLINC,MINPAD,PADCHARA'
755 S-expression (print as `write' does).
759 `~MINCOL,COLINC,MINPAD,PADCHARS'
765 print number sign always.
768 print comma separated.
770 `~MINCOL,PADCHAR,COMMACHARD'
776 print number sign always.
779 print comma separated.
781 `~MINCOL,PADCHAR,COMMACHARX'
787 print number sign always.
790 print comma separated.
792 `~MINCOL,PADCHAR,COMMACHARO'
798 print number sign always.
801 print comma separated.
803 `~MINCOL,PADCHAR,COMMACHARB'
808 `~N,MINCOL,PADCHAR,COMMACHARR'
812 print a number as a Roman numeral.
815 print a number as an "old fashioned" Roman numeral.
818 print a number as an ordinal English number.
821 print a number as a cardinal English number.
826 prints `y' and `ies'.
829 as `~P but jumps 1 argument backward.'
832 as `~@P but jumps 1 argument backward.'
837 prints a character as the reader can understand it (i.e. `#\'
841 prints a character as emacs does (eg. `^C' for ASCII 03).
844 Fixed-format floating-point (prints a flonum like MMM.NNN).
845 `~WIDTH,DIGITS,SCALE,OVERFLOWCHAR,PADCHARF'
847 If the number is positive a plus sign is printed.
850 Exponential floating-point (prints a flonum like MMM.NNN`E'EE).
851 `~WIDTH,DIGITS,EXPONENTDIGITS,SCALE,OVERFLOWCHAR,PADCHAR,EXPONENTCHARE'
853 If the number is positive a plus sign is printed.
856 General floating-point (prints a flonum either fixed or
858 `~WIDTH,DIGITS,EXPONENTDIGITS,SCALE,OVERFLOWCHAR,PADCHAR,EXPONENTCHARG'
860 If the number is positive a plus sign is printed.
863 Dollars floating-point (prints a flonum in fixed with signs
865 `~DIGITS,SCALE,WIDTH,PADCHAR$'
867 If the number is positive a plus sign is printed.
870 A sign is always printed and appears before the padding.
873 The sign appears before the padding.
881 print newline if not at the beginning of the output line.
883 prints `~&' and then N-1 newlines.
888 print N page separators.
898 newline is ignored, white space left.
901 newline is left, white space ignored.
912 Indirection (expects indirect arguments as a list).
914 extracts indirect arguments from format arguments.
917 Case conversion (converts by `string-downcase').
919 converts by `string-capitalize'.
922 converts by `string-capitalize-first'.
925 converts by `string-upcase'.
928 Argument Jumping (jumps 1 argument forward).
930 jumps N arguments forward.
933 jumps 1 argument backward.
936 jumps N arguments backward.
939 jumps to the 0th argument.
942 jumps to the Nth argument (beginning from 0)
944 `~[STR0~;STR1~;...~;STRN~]'
945 Conditional Expression (numerical clause conditional).
947 take argument from N.
950 true test conditional.
953 if-else-then conditional.
959 default clause follows.
962 Iteration (args come from the next argument (a list)).
964 at most N iterations.
967 args from next arg (a list of lists).
970 args from the rest of arguments.
973 args from the rest args (lists).
984 aborts if N <= M <= K
986 *** Not Implemented CL Format Control Directives
989 print `#f' as an empty list (see below).
992 print `#f' as an empty list (see below).
998 (sorry I don't understand its semantics completely)
1000 *** Extended, Replaced and Additional Control Directives
1002 `~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHD'
1003 `~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHX'
1004 `~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHO'
1005 `~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHB'
1006 `~N,MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHR'
1007 COMMAWIDTH is the number of characters between two comma
1011 print a R4RS complex number as `~F~@Fi' with passed parameters for
1015 Pretty print formatting of an argument for scheme code lists.
1021 Flushes the output if format DESTINATION is a port.
1024 Print a `#\space' character
1026 print N `#\space' characters.
1029 Print a `#\tab' character
1031 print N `#\tab' characters.
1034 Takes N as an integer representation for a character. No arguments
1035 are consumed. N is converted to a character by `integer->char'. N
1036 must be a positive decimal number.
1039 Print out readproof. Prints out internal objects represented as
1040 `#<...>' as strings `"#<...>"' so that the format output can always
1041 be processed by `read'.
1044 Print out readproof. Prints out internal objects represented as
1045 `#<...>' as strings `"#<...>"' so that the format output can always
1046 be processed by `read'.
1049 Prints information and a copyright notice on the format
1052 prints format version.
1055 may also print number strings, i.e. passing a number as a string
1056 and format it accordingly.
1058 *** Configuration Variables
1060 The format module exports some configuration variables to suit the
1061 systems and users needs. There should be no modification necessary for
1062 the configuration that comes with Guile. Format detects automatically
1063 if the running scheme system implements floating point numbers and
1066 format:symbol-case-conv
1067 Symbols are converted by `symbol->string' so the case type of the
1068 printed symbols is implementation dependent.
1069 `format:symbol-case-conv' is a one arg closure which is either
1070 `#f' (no conversion), `string-upcase', `string-downcase' or
1071 `string-capitalize'. (default `#f')
1073 format:iobj-case-conv
1074 As FORMAT:SYMBOL-CASE-CONV but applies for the representation of
1075 implementation internal objects. (default `#f')
1078 The character prefixing the exponent value in `~E' printing.
1081 *** Compatibility With Other Format Implementations
1087 Downward compatible except for padding support and `~A', `~S',
1088 `~P', `~X' uppercase printing. SLIB format 1.4 uses C-style
1089 `printf' padding support which is completely replaced by the CL
1090 `format' padding style.
1093 Downward compatible except for `~', which is not documented
1094 (ignores all characters inside the format string up to a newline
1095 character). (7.1 implements `~a', `~s', ~NEWLINE, `~~', `~%',
1096 numerical and variable parameters and `:/@' modifiers in the CL
1100 Downward compatible except for `~A' and `~S' which print in
1101 uppercase. (Elk implements `~a', `~s', `~~', and `~%' (no
1102 directive parameters or modifiers)).
1105 Downward compatible except for an optional destination parameter:
1106 S2C accepts a format call without a destination which returns a
1107 formatted string. This is equivalent to a #f destination in S2C.
1108 (S2C implements `~a', `~s', `~c', `~%', and `~~' (no directive
1109 parameters or modifiers)).
1112 ** Changes to string-handling functions.
1114 These functions were added to support the (ice-9 format) module, above.
1116 *** New function: string-upcase STRING
1117 *** New function: string-downcase STRING
1119 These are non-destructive versions of the existing string-upcase! and
1120 string-downcase! functions.
1122 *** New function: string-capitalize! STRING
1123 *** New function: string-capitalize STRING
1125 These functions convert the first letter of each word in the string to
1128 (string-capitalize "howdy there")
1131 As with the other functions, string-capitalize! modifies the string in
1132 place, while string-capitalize returns a modified copy of its argument.
1134 *** New function: string-ci->symbol STRING
1136 Return a symbol whose name is STRING, but having the same case as if
1137 the symbol had be read by `read'.
1139 Guile can be configured to be sensitive or insensitive to case
1140 differences in Scheme identifiers. If Guile is case-insensitive, all
1141 symbols are converted to lower case on input. The `string-ci->symbol'
1142 function returns a symbol whose name in STRING, transformed as Guile
1143 would if STRING were input.
1145 *** New function: substring-move! STRING1 START END STRING2 START
1147 Copy the substring of STRING1 from START (inclusive) to END
1148 (exclusive) to STRING2 at START. STRING1 and STRING2 may be the same
1149 string, and the source and destination areas may overlap; in all
1150 cases, the function behaves as if all the characters were copied
1153 *** Extended functions: substring-move-left! substring-move-right!
1155 These functions now correctly copy arbitrarily overlapping substrings;
1156 they are both synonyms for substring-move!.
1159 ** New module (ice-9 getopt-long), with the function `getopt-long'.
1161 getopt-long is a function for parsing command-line arguments in a
1162 manner consistent with other GNU programs.
1164 (getopt-long ARGS GRAMMAR)
1165 Parse the arguments ARGS according to the argument list grammar GRAMMAR.
1167 ARGS should be a list of strings. Its first element should be the
1168 name of the program; subsequent elements should be the arguments
1169 that were passed to the program on the command line. The
1170 `program-arguments' procedure returns a list of this form.
1172 GRAMMAR is a list of the form:
1173 ((OPTION (PROPERTY VALUE) ...) ...)
1175 Each OPTION should be a symbol. `getopt-long' will accept a
1176 command-line option named `--OPTION'.
1177 Each option can have the following (PROPERTY VALUE) pairs:
1179 (single-char CHAR) --- Accept `-CHAR' as a single-character
1180 equivalent to `--OPTION'. This is how to specify traditional
1182 (required? BOOL) --- If BOOL is true, the option is required.
1183 getopt-long will raise an error if it is not found in ARGS.
1184 (value BOOL) --- If BOOL is #t, the option accepts a value; if
1185 it is #f, it does not; and if it is the symbol
1186 `optional', the option may appear in ARGS with or
1188 (predicate FUNC) --- If the option accepts a value (i.e. you
1189 specified `(value #t)' for this option), then getopt
1190 will apply FUNC to the value, and throw an exception
1191 if it returns #f. FUNC should be a procedure which
1192 accepts a string and returns a boolean value; you may
1193 need to use quasiquotes to get it into GRAMMAR.
1195 The (PROPERTY VALUE) pairs may occur in any order, but each
1196 property may occur only once. By default, options do not have
1197 single-character equivalents, are not required, and do not take
1200 In ARGS, single-character options may be combined, in the usual
1201 Unix fashion: ("-x" "-y") is equivalent to ("-xy"). If an option
1202 accepts values, then it must be the last option in the
1203 combination; the value is the next argument. So, for example, using
1204 the following grammar:
1205 ((apples (single-char #\a))
1206 (blimps (single-char #\b) (value #t))
1207 (catalexis (single-char #\c) (value #t)))
1208 the following argument lists would be acceptable:
1209 ("-a" "-b" "bang" "-c" "couth") ("bang" and "couth" are the values
1210 for "blimps" and "catalexis")
1211 ("-ab" "bang" "-c" "couth") (same)
1212 ("-ac" "couth" "-b" "bang") (same)
1213 ("-abc" "couth" "bang") (an error, since `-b' is not the
1214 last option in its combination)
1216 If an option's value is optional, then `getopt-long' decides
1217 whether it has a value by looking at what follows it in ARGS. If
1218 the next element is a string, and it does not appear to be an
1219 option itself, then that string is the option's value.
1221 The value of a long option can appear as the next element in ARGS,
1222 or it can follow the option name, separated by an `=' character.
1223 Thus, using the same grammar as above, the following argument lists
1225 ("--apples" "Braeburn" "--blimps" "Goodyear")
1226 ("--apples=Braeburn" "--blimps" "Goodyear")
1227 ("--blimps" "Goodyear" "--apples=Braeburn")
1229 If the option "--" appears in ARGS, argument parsing stops there;
1230 subsequent arguments are returned as ordinary arguments, even if
1231 they resemble options. So, in the argument list:
1232 ("--apples" "Granny Smith" "--" "--blimp" "Goodyear")
1233 `getopt-long' will recognize the `apples' option as having the
1234 value "Granny Smith", but it will not recognize the `blimp'
1235 option; it will return the strings "--blimp" and "Goodyear" as
1236 ordinary argument strings.
1238 The `getopt-long' function returns the parsed argument list as an
1239 assocation list, mapping option names --- the symbols from GRAMMAR
1240 --- onto their values, or #t if the option does not accept a value.
1241 Unused options do not appear in the alist.
1243 All arguments that are not the value of any option are returned
1244 as a list, associated with the empty list.
1246 `getopt-long' throws an exception if:
1247 - it finds an unrecognized option in ARGS
1248 - a required option is omitted
1249 - an option that requires an argument doesn't get one
1250 - an option that doesn't accept an argument does get one (this can
1251 only happen using the long option `--opt=value' syntax)
1252 - an option predicate fails
1257 `((lockfile-dir (required? #t)
1260 (predicate ,file-is-directory?))
1261 (verbose (required? #f)
1264 (x-includes (single-char #\x))
1265 (rnet-server (single-char #\y)
1266 (predicate ,string?))))
1268 (getopt-long '("my-prog" "-vk" "/tmp" "foo1" "--x-includes=/usr/include"
1269 "--rnet-server=lamprod" "--" "-fred" "foo2" "foo3")
1271 => ((() "foo1" "-fred" "foo2" "foo3")
1272 (rnet-server . "lamprod")
1273 (x-includes . "/usr/include")
1274 (lockfile-dir . "/tmp")
1277 ** The (ice-9 getopt-gnu-style) module is obsolete; use (ice-9 getopt-long).
1279 It will be removed in a few releases.
1281 ** New syntax: lambda*
1282 ** New syntax: define*
1283 ** New syntax: define*-public
1284 ** New syntax: defmacro*
1285 ** New syntax: defmacro*-public
1286 Guile now supports optional arguments.
1288 `lambda*', `define*', `define*-public', `defmacro*' and
1289 `defmacro*-public' are identical to the non-* versions except that
1290 they use an extended type of parameter list that has the following BNF
1291 syntax (parentheses are literal, square brackets indicate grouping,
1292 and `*', `+' and `?' have the usual meaning):
1294 ext-param-list ::= ( [identifier]* [#&optional [ext-var-decl]+]?
1295 [#&key [ext-var-decl]+ [#&allow-other-keys]?]?
1296 [[#&rest identifier]|[. identifier]]? ) | [identifier]
1298 ext-var-decl ::= identifier | ( identifier expression )
1300 The semantics are best illustrated with the following documentation
1301 and examples for `lambda*':
1304 lambda extended for optional and keyword arguments
1306 lambda* creates a procedure that takes optional arguments. These
1307 are specified by putting them inside brackets at the end of the
1308 paramater list, but before any dotted rest argument. For example,
1309 (lambda* (a b #&optional c d . e) '())
1310 creates a procedure with fixed arguments a and b, optional arguments c
1311 and d, and rest argument e. If the optional arguments are omitted
1312 in a call, the variables for them are unbound in the procedure. This
1313 can be checked with the bound? macro.
1315 lambda* can also take keyword arguments. For example, a procedure
1317 (lambda* (#&key xyzzy larch) '())
1318 can be called with any of the argument lists (#:xyzzy 11)
1319 (#:larch 13) (#:larch 42 #:xyzzy 19) (). Whichever arguments
1320 are given as keywords are bound to values.
1322 Optional and keyword arguments can also be given default values
1323 which they take on when they are not present in a call, by giving a
1324 two-item list in place of an optional argument, for example in:
1325 (lambda* (foo #&optional (bar 42) #&key (baz 73)) (list foo bar baz))
1326 foo is a fixed argument, bar is an optional argument with default
1327 value 42, and baz is a keyword argument with default value 73.
1328 Default value expressions are not evaluated unless they are needed
1329 and until the procedure is called.
1331 lambda* now supports two more special parameter list keywords.
1333 lambda*-defined procedures now throw an error by default if a
1334 keyword other than one of those specified is found in the actual
1335 passed arguments. However, specifying #&allow-other-keys
1336 immediately after the kyword argument declarations restores the
1337 previous behavior of ignoring unknown keywords. lambda* also now
1338 guarantees that if the same keyword is passed more than once, the
1339 last one passed is the one that takes effect. For example,
1340 ((lambda* (#&key (heads 0) (tails 0)) (display (list heads tails)))
1341 #:heads 37 #:tails 42 #:heads 99)
1342 would result in (99 47) being displayed.
1344 #&rest is also now provided as a synonym for the dotted syntax rest
1345 argument. The argument lists (a . b) and (a #&rest b) are equivalent in
1346 all respects to lambda*. This is provided for more similarity to DSSSL,
1347 MIT-Scheme and Kawa among others, as well as for refugees from other
1350 Further documentation may be found in the optargs.scm file itself.
1352 The optional argument module also exports the macros `let-optional',
1353 `let-optional*', `let-keywords', `let-keywords*' and `bound?'. These
1354 are not documented here because they may be removed in the future, but
1355 full documentation is still available in optargs.scm.
1357 ** New syntax: and-let*
1358 Guile now supports the `and-let*' form, described in the draft SRFI-2.
1360 Syntax: (land* (<clause> ...) <body> ...)
1361 Each <clause> should have one of the following forms:
1362 (<variable> <expression>)
1365 Each <variable> or <bound-variable> should be an identifier. Each
1366 <expression> should be a valid expression. The <body> should be a
1367 possibly empty sequence of expressions, like the <body> of a
1370 Semantics: A LAND* expression is evaluated by evaluating the
1371 <expression> or <bound-variable> of each of the <clause>s from
1372 left to right. The value of the first <expression> or
1373 <bound-variable> that evaluates to a false value is returned; the
1374 remaining <expression>s and <bound-variable>s are not evaluated.
1375 The <body> forms are evaluated iff all the <expression>s and
1376 <bound-variable>s evaluate to true values.
1378 The <expression>s and the <body> are evaluated in an environment
1379 binding each <variable> of the preceding (<variable> <expression>)
1380 clauses to the value of the <expression>. Later bindings
1381 shadow earlier bindings.
1383 Guile's and-let* macro was contributed by Michael Livshin.
1385 ** New sorting functions
1387 *** New function: sorted? SEQUENCE LESS?
1388 Returns `#t' when the sequence argument is in non-decreasing order
1389 according to LESS? (that is, there is no adjacent pair `... x y
1390 ...' for which `(less? y x)').
1392 Returns `#f' when the sequence contains at least one out-of-order
1393 pair. It is an error if the sequence is neither a list nor a
1396 *** New function: merge LIST1 LIST2 LESS?
1397 LIST1 and LIST2 are sorted lists.
1398 Returns the sorted list of all elements in LIST1 and LIST2.
1400 Assume that the elements a and b1 in LIST1 and b2 in LIST2 are "equal"
1401 in the sense that (LESS? x y) --> #f for x, y in {a, b1, b2},
1402 and that a < b1 in LIST1. Then a < b1 < b2 in the result.
1403 (Here "<" should read "comes before".)
1405 *** New procedure: merge! LIST1 LIST2 LESS?
1406 Merges two lists, re-using the pairs of LIST1 and LIST2 to build
1407 the result. If the code is compiled, and LESS? constructs no new
1408 pairs, no pairs at all will be allocated. The first pair of the
1409 result will be either the first pair of LIST1 or the first pair of
1412 *** New function: sort SEQUENCE LESS?
1413 Accepts either a list or a vector, and returns a new sequence
1414 which is sorted. The new sequence is the same type as the input.
1415 Always `(sorted? (sort sequence less?) less?)'. The original
1416 sequence is not altered in any way. The new sequence shares its
1417 elements with the old one; no elements are copied.
1419 *** New procedure: sort! SEQUENCE LESS
1420 Returns its sorted result in the original boxes. No new storage is
1421 allocated at all. Proper usage: (set! slist (sort! slist <))
1423 *** New function: stable-sort SEQUENCE LESS?
1424 Similar to `sort' but stable. That is, if "equal" elements are
1425 ordered a < b in the original sequence, they will have the same order
1428 *** New function: stable-sort! SEQUENCE LESS?
1429 Similar to `sort!' but stable.
1430 Uses temporary storage when sorting vectors.
1432 *** New functions: sort-list, sort-list!
1433 Added for compatibility with scsh.
1435 ** New built-in random number support
1437 *** New function: random N [STATE]
1438 Accepts a positive integer or real N and returns a number of the
1439 same type between zero (inclusive) and N (exclusive). The values
1440 returned have a uniform distribution.
1442 The optional argument STATE must be of the type produced by
1443 `copy-random-state' or `seed->random-state'. It defaults to the value
1444 of the variable `*random-state*'. This object is used to maintain the
1445 state of the pseudo-random-number generator and is altered as a side
1446 effect of the `random' operation.
1448 *** New variable: *random-state*
1449 Holds a data structure that encodes the internal state of the
1450 random-number generator that `random' uses by default. The nature
1451 of this data structure is implementation-dependent. It may be
1452 printed out and successfully read back in, but may or may not
1453 function correctly as a random-number state object in another
1456 *** New function: copy-random-state [STATE]
1457 Returns a new object of type suitable for use as the value of the
1458 variable `*random-state*' and as a second argument to `random'.
1459 If argument STATE is given, a copy of it is returned. Otherwise a
1460 copy of `*random-state*' is returned.
1462 *** New function: seed->random-state SEED
1463 Returns a new object of type suitable for use as the value of the
1464 variable `*random-state*' and as a second argument to `random'.
1465 SEED is a string or a number. A new state is generated and
1466 initialized using SEED.
1468 *** New function: random:uniform [STATE]
1469 Returns an uniformly distributed inexact real random number in the
1470 range between 0 and 1.
1472 *** New procedure: random:solid-sphere! VECT [STATE]
1473 Fills VECT with inexact real random numbers the sum of whose
1474 squares is less than 1.0. Thinking of VECT as coordinates in
1475 space of dimension N = `(vector-length VECT)', the coordinates are
1476 uniformly distributed within the unit N-shere. The sum of the
1477 squares of the numbers is returned. VECT can be either a vector
1478 or a uniform vector of doubles.
1480 *** New procedure: random:hollow-sphere! VECT [STATE]
1481 Fills VECT with inexact real random numbers the sum of whose squares
1482 is equal to 1.0. Thinking of VECT as coordinates in space of
1483 dimension n = `(vector-length VECT)', the coordinates are uniformly
1484 distributed over the surface of the unit n-shere. VECT can be either
1485 a vector or a uniform vector of doubles.
1487 *** New function: random:normal [STATE]
1488 Returns an inexact real in a normal distribution with mean 0 and
1489 standard deviation 1. For a normal distribution with mean M and
1490 standard deviation D use `(+ M (* D (random:normal)))'.
1492 *** New procedure: random:normal-vector! VECT [STATE]
1493 Fills VECT with inexact real random numbers which are independent and
1494 standard normally distributed (i.e., with mean 0 and variance 1).
1495 VECT can be either a vector or a uniform vector of doubles.
1497 *** New function: random:exp STATE
1498 Returns an inexact real in an exponential distribution with mean 1.
1499 For an exponential distribution with mean U use (* U (random:exp)).
1501 ** The range of logand, logior, logxor, logtest, and logbit? have changed.
1503 These functions now operate on numbers in the range of a C unsigned
1506 These functions used to operate on numbers in the range of a C signed
1507 long; however, this seems inappropriate, because Guile integers don't
1510 ** New function: make-guardian
1511 This is an implementation of guardians as described in
1512 R. Kent Dybvig, Carl Bruggeman, and David Eby (1993) "Guardians in a
1513 Generation-Based Garbage Collector" ACM SIGPLAN Conference on
1514 Programming Language Design and Implementation, June 1993
1515 ftp://ftp.cs.indiana.edu/pub/scheme-repository/doc/pubs/guardians.ps.gz
1517 ** New functions: delq1!, delv1!, delete1!
1518 These procedures behave similar to delq! and friends but delete only
1519 one object if at all.
1521 ** New function: unread-string STRING PORT
1522 Unread STRING to PORT, that is, push it back onto the port so that
1523 next read operation will work on the pushed back characters.
1525 ** unread-char can now be called multiple times
1526 If unread-char is called multiple times, the unread characters will be
1527 read again in last-in first-out order.
1529 ** the procedures uniform-array-read! and uniform-array-write! now
1530 work on any kind of port, not just ports which are open on a file.
1532 ** Now 'l' in a port mode requests line buffering.
1534 ** The procedure truncate-file now works on string ports as well
1535 as file ports. If the size argument is omitted, the current
1536 file position is used.
1538 ** new procedure: seek PORT/FDES OFFSET WHENCE
1539 The arguments are the same as for the old fseek procedure, but it
1540 works on string ports as well as random-access file ports.
1542 ** the fseek procedure now works on string ports, since it has been
1543 redefined using seek.
1545 ** the setvbuf procedure now uses a default size if mode is _IOFBF and
1546 size is not supplied.
1548 ** the newline procedure no longer flushes the port if it's not
1549 line-buffered: previously it did if it was the current output port.
1551 ** open-pipe and close-pipe are no longer primitive procedures, but
1552 an emulation can be obtained using `(use-modules (ice-9 popen))'.
1554 ** the freopen procedure has been removed.
1556 ** new procedure: drain-input PORT
1557 Drains PORT's read buffers (including any pushed-back characters)
1558 and returns the contents as a single string.
1560 ** New function: map-in-order PROC LIST1 LIST2 ...
1561 Version of `map' which guarantees that the procedure is applied to the
1562 lists in serial order.
1564 ** Renamed `serial-array-copy!' and `serial-array-map!' to
1565 `array-copy-in-order!' and `array-map-in-order!'. The old names are
1566 now obsolete and will go away in release 1.5.
1568 ** New syntax: collect BODY1 ...
1569 Version of `begin' which returns a list of the results of the body
1570 forms instead of the result of the last body form. In contrast to
1571 `begin', `collect' allows an empty body.
1573 ** New functions: read-history FILENAME, write-history FILENAME
1574 Read/write command line history from/to file. Returns #t on success
1575 and #f if an error occured.
1577 ** `ls' and `lls' in module (ice-9 ls) now handle no arguments.
1579 These procedures return a list of definitions available in the specified
1580 argument, a relative module reference. In the case of no argument,
1581 `(current-module)' is now consulted for definitions to return, instead
1582 of simply returning #f, the former behavior.
1584 ** The #/ syntax for lists is no longer supported.
1586 Earlier versions of Scheme accepted this syntax, but printed a
1589 ** Guile no longer consults the SCHEME_LOAD_PATH environment variable.
1591 Instead, you should set GUILE_LOAD_PATH to tell Guile where to find
1594 * Changes to the gh_ interface
1598 Now takes a second argument which is the result array. If this
1599 pointer is NULL, a new array is malloced (the old behaviour).
1601 ** gh_chars2byvect, gh_shorts2svect, gh_floats2fvect, gh_scm2chars,
1602 gh_scm2shorts, gh_scm2longs, gh_scm2floats
1606 * Changes to the scm_ interface
1608 ** Function: scm_make_named_hook (char* name, int n_args)
1610 Creates a hook in the same way as make-hook above but also
1611 binds a variable named NAME to it.
1613 This is the typical way of creating a hook from C code.
1615 Currently, the variable is created in the "current" module. This
1616 might change when we get the new module system.
1618 ** The smob interface
1620 The interface for creating smobs has changed. For documentation, see
1621 data-rep.info (made from guile-core/doc/data-rep.texi).
1623 *** Deprecated function: SCM scm_newsmob (scm_smobfuns *)
1625 >>> This function will be removed in 1.3.4. <<<
1629 *** Function: SCM scm_make_smob_type (const char *name, scm_sizet size)
1630 This function adds a new smob type, named NAME, with instance size
1631 SIZE to the system. The return value is a tag that is used in
1632 creating instances of the type. If SIZE is 0, then no memory will
1633 be allocated when instances of the smob are created, and nothing
1634 will be freed by the default free function.
1636 *** Function: void scm_set_smob_mark (long tc, SCM (*mark) (SCM))
1637 This function sets the smob marking procedure for the smob type
1638 specified by the tag TC. TC is the tag returned by
1639 `scm_make_smob_type'.
1641 *** Function: void scm_set_smob_free (long tc, SCM (*mark) (SCM))
1642 This function sets the smob freeing procedure for the smob type
1643 specified by the tag TC. TC is the tag returned by
1644 `scm_make_smob_type'.
1646 *** Function: void scm_set_smob_print (tc, print)
1648 - Function: void scm_set_smob_print (long tc,
1649 scm_sizet (*print) (SCM,
1653 This function sets the smob printing procedure for the smob type
1654 specified by the tag TC. TC is the tag returned by
1655 `scm_make_smob_type'.
1657 *** Function: void scm_set_smob_equalp (long tc, SCM (*equalp) (SCM, SCM))
1658 This function sets the smob equality-testing predicate for the
1659 smob type specified by the tag TC. TC is the tag returned by
1660 `scm_make_smob_type'.
1662 *** Macro: void SCM_NEWSMOB (SCM var, long tc, void *data)
1663 Make VALUE contain a smob instance of the type with type code TC and
1664 smob data DATA. VALUE must be previously declared as C type `SCM'.
1666 *** Macro: fn_returns SCM_RETURN_NEWSMOB (long tc, void *data)
1667 This macro expands to a block of code that creates a smob instance
1668 of the type with type code TC and smob data DATA, and returns that
1669 `SCM' value. It should be the last piece of code in a block.
1671 ** The interfaces for using I/O ports and implementing port types
1672 (ptobs) have changed significantly. The new interface is based on
1673 shared access to buffers and a new set of ptob procedures.
1675 *** scm_newptob has been removed
1679 *** Function: SCM scm_make_port_type (type_name, fill_buffer, write_flush)
1681 - Function: SCM scm_make_port_type (char *type_name,
1682 int (*fill_buffer) (SCM port),
1683 void (*write_flush) (SCM port));
1685 Similarly to the new smob interface, there is a set of function
1686 setters by which the user can customize the behaviour of his port
1687 type. See ports.h (scm_set_port_XXX).
1689 ** scm_strport_to_string: New function: creates a new string from
1690 a string port's buffer.
1692 ** Plug in interface for random number generators
1693 The variable `scm_the_rng' in random.c contains a value and three
1694 function pointers which together define the current random number
1695 generator being used by the Scheme level interface and the random
1696 number library functions.
1698 The user is free to replace the default generator with the generator
1701 *** Variable: size_t scm_the_rng.rstate_size
1702 The size of the random state type used by the current RNG
1705 *** Function: unsigned long scm_the_rng.random_bits (scm_rstate *STATE)
1706 Given the random STATE, return 32 random bits.
1708 *** Function: void scm_the_rng.init_rstate (scm_rstate *STATE, chars *S, int N)
1709 Seed random state STATE using string S of length N.
1711 *** Function: scm_rstate *scm_the_rng.copy_rstate (scm_rstate *STATE)
1712 Given random state STATE, return a malloced copy.
1715 The default RNG is the MWC (Multiply With Carry) random number
1716 generator described by George Marsaglia at the Department of
1717 Statistics and Supercomputer Computations Research Institute, The
1718 Florida State University (http://stat.fsu.edu/~geo).
1720 It uses 64 bits, has a period of 4578426017172946943 (4.6e18), and
1721 passes all tests in the DIEHARD test suite
1722 (http://stat.fsu.edu/~geo/diehard.html). The generation of 32 bits
1723 costs one multiply and one add on platforms which either supports long
1724 longs (gcc does this on most systems) or have 64 bit longs. The cost
1725 is four multiply on other systems but this can be optimized by writing
1726 scm_i_uniform32 in assembler.
1728 These functions are provided through the scm_the_rng interface for use
1729 by libguile and the application.
1731 *** Function: unsigned long scm_i_uniform32 (scm_i_rstate *STATE)
1732 Given the random STATE, return 32 random bits.
1733 Don't use this function directly. Instead go through the plugin
1734 interface (see "Plug in interface" above).
1736 *** Function: void scm_i_init_rstate (scm_i_rstate *STATE, char *SEED, int N)
1737 Initialize STATE using SEED of length N.
1739 *** Function: scm_i_rstate *scm_i_copy_rstate (scm_i_rstate *STATE)
1740 Return a malloc:ed copy of STATE. This function can easily be re-used
1741 in the interfaces to other RNGs.
1743 ** Random number library functions
1744 These functions use the current RNG through the scm_the_rng interface.
1745 It might be a good idea to use these functions from your C code so
1746 that only one random generator is used by all code in your program.
1748 The default random state is stored in:
1750 *** Variable: SCM scm_var_random_state
1751 Contains the vcell of the Scheme variable "*random-state*" which is
1752 used as default state by all random number functions in the Scheme
1757 double x = scm_c_uniform01 (SCM_RSTATE (SCM_CDR (scm_var_random_state)));
1759 *** Function: scm_rstate *scm_c_default_rstate (void)
1760 This is a convenience function which returns the value of
1761 scm_var_random_state. An error message is generated if this value
1762 isn't a random state.
1764 *** Function: scm_rstate *scm_c_make_rstate (char *SEED, int LENGTH)
1765 Make a new random state from the string SEED of length LENGTH.
1767 It is generally not a good idea to use multiple random states in a
1768 program. While subsequent random numbers generated from one random
1769 state are guaranteed to be reasonably independent, there is no such
1770 guarantee for numbers generated from different random states.
1772 *** Macro: unsigned long scm_c_uniform32 (scm_rstate *STATE)
1773 Return 32 random bits.
1775 *** Function: double scm_c_uniform01 (scm_rstate *STATE)
1776 Return a sample from the uniform(0,1) distribution.
1778 *** Function: double scm_c_normal01 (scm_rstate *STATE)
1779 Return a sample from the normal(0,1) distribution.
1781 *** Function: double scm_c_exp1 (scm_rstate *STATE)
1782 Return a sample from the exp(1) distribution.
1784 *** Function: unsigned long scm_c_random (scm_rstate *STATE, unsigned long M)
1785 Return a sample from the discrete uniform(0,M) distribution.
1787 *** Function: SCM scm_c_random_bignum (scm_rstate *STATE, SCM M)
1788 Return a sample from the discrete uniform(0,M) distribution.
1789 M must be a bignum object. The returned value may be an INUM.
1793 Changes in Guile 1.3 (released Monday, October 19, 1998):
1795 * Changes to the distribution
1797 ** We renamed the SCHEME_LOAD_PATH environment variable to GUILE_LOAD_PATH.
1798 To avoid conflicts, programs should name environment variables after
1799 themselves, except when there's a common practice establishing some
1802 For now, Guile supports both GUILE_LOAD_PATH and SCHEME_LOAD_PATH,
1803 giving the former precedence, and printing a warning message if the
1804 latter is set. Guile 1.4 will not recognize SCHEME_LOAD_PATH at all.
1806 ** The header files related to multi-byte characters have been removed.
1807 They were: libguile/extchrs.h and libguile/mbstrings.h. Any C code
1808 which referred to these explicitly will probably need to be rewritten,
1809 since the support for the variant string types has been removed; see
1812 ** The header files append.h and sequences.h have been removed. These
1813 files implemented non-R4RS operations which would encourage
1814 non-portable programming style and less easy-to-read code.
1816 * Changes to the stand-alone interpreter
1818 ** New procedures have been added to implement a "batch mode":
1820 *** Function: batch-mode?
1822 Returns a boolean indicating whether the interpreter is in batch
1825 *** Function: set-batch-mode?! ARG
1827 If ARG is true, switches the interpreter to batch mode. The `#f'
1828 case has not been implemented.
1830 ** Guile now provides full command-line editing, when run interactively.
1831 To use this feature, you must have the readline library installed.
1832 The Guile build process will notice it, and automatically include
1835 The readline library is available via anonymous FTP from any GNU
1836 mirror site; the canonical location is "ftp://prep.ai.mit.edu/pub/gnu".
1838 ** the-last-stack is now a fluid.
1840 * Changes to the procedure for linking libguile with your programs
1842 ** You can now use the `guile-config' utility to build programs that use Guile.
1844 Guile now includes a command-line utility called `guile-config', which
1845 can provide information about how to compile and link programs that
1848 *** `guile-config compile' prints any C compiler flags needed to use Guile.
1849 You should include this command's output on the command line you use
1850 to compile C or C++ code that #includes the Guile header files. It's
1851 usually just a `-I' flag to help the compiler find the Guile headers.
1854 *** `guile-config link' prints any linker flags necessary to link with Guile.
1856 This command writes to its standard output a list of flags which you
1857 must pass to the linker to link your code against the Guile library.
1858 The flags include '-lguile' itself, any other libraries the Guile
1859 library depends upon, and any `-L' flags needed to help the linker
1860 find those libraries.
1862 For example, here is a Makefile rule that builds a program named 'foo'
1863 from the object files ${FOO_OBJECTS}, and links them against Guile:
1866 ${CC} ${CFLAGS} ${FOO_OBJECTS} `guile-config link` -o foo
1868 Previous Guile releases recommended that you use autoconf to detect
1869 which of a predefined set of libraries were present on your system.
1870 It is more robust to use `guile-config', since it records exactly which
1871 libraries the installed Guile library requires.
1873 This was originally called `build-guile', but was renamed to
1874 `guile-config' before Guile 1.3 was released, to be consistent with
1875 the analogous script for the GTK+ GUI toolkit, which is called
1879 ** Use the GUILE_FLAGS macro in your configure.in file to find Guile.
1881 If you are using the GNU autoconf package to configure your program,
1882 you can use the GUILE_FLAGS autoconf macro to call `guile-config'
1883 (described above) and gather the necessary values for use in your
1886 The GUILE_FLAGS macro expands to configure script code which runs the
1887 `guile-config' script, to find out where Guile's header files and
1888 libraries are installed. It sets two variables, marked for
1889 substitution, as by AC_SUBST.
1891 GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
1892 code that uses Guile header files. This is almost always just a
1895 GUILE_LDFLAGS --- flags to pass to the linker to link a
1896 program against Guile. This includes `-lguile' for the Guile
1897 library itself, any libraries that Guile itself requires (like
1898 -lqthreads), and so on. It may also include a -L flag to tell the
1899 compiler where to find the libraries.
1901 GUILE_FLAGS is defined in the file guile.m4, in the top-level
1902 directory of the Guile distribution. You can copy it into your
1903 package's aclocal.m4 file, and then use it in your configure.in file.
1905 If you are using the `aclocal' program, distributed with GNU automake,
1906 to maintain your aclocal.m4 file, the Guile installation process
1907 installs guile.m4 where aclocal will find it. All you need to do is
1908 use GUILE_FLAGS in your configure.in file, and then run `aclocal';
1909 this will copy the definition of GUILE_FLAGS into your aclocal.m4
1913 * Changes to Scheme functions and syntax
1915 ** Multi-byte strings have been removed, as have multi-byte and wide
1916 ports. We felt that these were the wrong approach to
1917 internationalization support.
1919 ** New function: readline [PROMPT]
1920 Read a line from the terminal, and allow the user to edit it,
1921 prompting with PROMPT. READLINE provides a large set of Emacs-like
1922 editing commands, lets the user recall previously typed lines, and
1923 works on almost every kind of terminal, including dumb terminals.
1925 READLINE assumes that the cursor is at the beginning of the line when
1926 it is invoked. Thus, you can't print a prompt yourself, and then call
1927 READLINE; you need to package up your prompt as a string, pass it to
1928 the function, and let READLINE print the prompt itself. This is
1929 because READLINE needs to know the prompt's screen width.
1931 For Guile to provide this function, you must have the readline
1932 library, version 2.1 or later, installed on your system. Readline is
1933 available via anonymous FTP from prep.ai.mit.edu in pub/gnu, or from
1934 any GNU mirror site.
1936 See also ADD-HISTORY function.
1938 ** New function: add-history STRING
1939 Add STRING as the most recent line in the history used by the READLINE
1940 command. READLINE does not add lines to the history itself; you must
1941 call ADD-HISTORY to make previous input available to the user.
1943 ** The behavior of the read-line function has changed.
1945 This function now uses standard C library functions to read the line,
1946 for speed. This means that it doesn not respect the value of
1947 scm-line-incrementors; it assumes that lines are delimited with
1950 (Note that this is read-line, the function that reads a line of text
1951 from a port, not readline, the function that reads a line from a
1952 terminal, providing full editing capabilities.)
1954 ** New module (ice-9 getopt-gnu-style): Parse command-line arguments.
1956 This module provides some simple argument parsing. It exports one
1959 Function: getopt-gnu-style ARG-LS
1960 Parse a list of program arguments into an alist of option
1963 Each item in the list of program arguments is examined to see if
1964 it meets the syntax of a GNU long-named option. An argument like
1965 `--MUMBLE' produces an element of the form (MUMBLE . #t) in the
1966 returned alist, where MUMBLE is a keyword object with the same
1967 name as the argument. An argument like `--MUMBLE=FROB' produces
1968 an element of the form (MUMBLE . FROB), where FROB is a string.
1970 As a special case, the returned alist also contains a pair whose
1971 car is the symbol `rest'. The cdr of this pair is a list
1972 containing all the items in the argument list that are not options
1973 of the form mentioned above.
1975 The argument `--' is treated specially: all items in the argument
1976 list appearing after such an argument are not examined, and are
1977 returned in the special `rest' list.
1979 This function does not parse normal single-character switches.
1980 You will need to parse them out of the `rest' list yourself.
1982 ** The read syntax for byte vectors and short vectors has changed.
1984 Instead of #bytes(...), write #y(...).
1986 Instead of #short(...), write #h(...).
1988 This may seem nutty, but, like the other uniform vectors, byte vectors
1989 and short vectors want to have the same print and read syntax (and,
1990 more basic, want to have read syntax!). Changing the read syntax to
1991 use multiple characters after the hash sign breaks with the
1992 conventions used in R5RS and the conventions used for the other
1993 uniform vectors. It also introduces complexity in the current reader,
1994 both on the C and Scheme levels. (The Right solution is probably to
1995 change the syntax and prototypes for uniform vectors entirely.)
1998 ** The new module (ice-9 session) provides useful interactive functions.
2000 *** New procedure: (apropos REGEXP OPTION ...)
2002 Display a list of top-level variables whose names match REGEXP, and
2003 the modules they are imported from. Each OPTION should be one of the
2006 value --- Show the value of each matching variable.
2007 shadow --- Show bindings shadowed by subsequently imported modules.
2008 full --- Same as both `shadow' and `value'.
2012 guile> (apropos "trace" 'full)
2013 debug: trace #<procedure trace args>
2014 debug: untrace #<procedure untrace args>
2015 the-scm-module: display-backtrace #<compiled-closure #<primitive-procedure gsubr-apply>>
2016 the-scm-module: before-backtrace-hook ()
2017 the-scm-module: backtrace #<primitive-procedure backtrace>
2018 the-scm-module: after-backtrace-hook ()
2019 the-scm-module: has-shown-backtrace-hint? #f
2022 ** There are new functions and syntax for working with macros.
2024 Guile implements macros as a special object type. Any variable whose
2025 top-level binding is a macro object acts as a macro. The macro object
2026 specifies how the expression should be transformed before evaluation.
2028 *** Macro objects now print in a reasonable way, resembling procedures.
2030 *** New function: (macro? OBJ)
2031 True iff OBJ is a macro object.
2033 *** New function: (primitive-macro? OBJ)
2034 Like (macro? OBJ), but true only if OBJ is one of the Guile primitive
2035 macro transformers, implemented in eval.c rather than Scheme code.
2037 Why do we have this function?
2038 - For symmetry with procedure? and primitive-procedure?,
2039 - to allow custom print procedures to tell whether a macro is
2040 primitive, and display it differently, and
2041 - to allow compilers and user-written evaluators to distinguish
2042 builtin special forms from user-defined ones, which could be
2045 *** New function: (macro-type OBJ)
2046 Return a value indicating what kind of macro OBJ is. Possible return
2049 The symbol `syntax' --- a macro created by procedure->syntax.
2050 The symbol `macro' --- a macro created by procedure->macro.
2051 The symbol `macro!' --- a macro created by procedure->memoizing-macro.
2052 The boolean #f --- if OBJ is not a macro object.
2054 *** New function: (macro-name MACRO)
2055 Return the name of the macro object MACRO's procedure, as returned by
2058 *** New function: (macro-transformer MACRO)
2059 Return the transformer procedure for MACRO.
2061 *** New syntax: (use-syntax MODULE ... TRANSFORMER)
2063 Specify a new macro expander to use in the current module. Each
2064 MODULE is a module name, with the same meaning as in the `use-modules'
2065 form; each named module's exported bindings are added to the current
2066 top-level environment. TRANSFORMER is an expression evaluated in the
2067 resulting environment which must yield a procedure to use as the
2068 module's eval transformer: every expression evaluated in this module
2069 is passed to this function, and the result passed to the Guile
2072 *** macro-eval! is removed. Use local-eval instead.
2074 ** Some magic has been added to the printer to better handle user
2075 written printing routines (like record printers, closure printers).
2077 The problem is that these user written routines must have access to
2078 the current `print-state' to be able to handle fancy things like
2079 detection of circular references. These print-states have to be
2080 passed to the builtin printing routines (display, write, etc) to
2081 properly continue the print chain.
2083 We didn't want to change all existing print code so that it
2084 explicitly passes thru a print state in addition to a port. Instead,
2085 we extented the possible values that the builtin printing routines
2086 accept as a `port'. In addition to a normal port, they now also take
2087 a pair of a normal port and a print-state. Printing will go to the
2088 port and the print-state will be used to control the detection of
2089 circular references, etc. If the builtin function does not care for a
2090 print-state, it is simply ignored.
2092 User written callbacks are now called with such a pair as their
2093 `port', but because every function now accepts this pair as a PORT
2094 argument, you don't have to worry about that. In fact, it is probably
2095 safest to not check for these pairs.
2097 However, it is sometimes necessary to continue a print chain on a
2098 different port, for example to get a intermediate string
2099 representation of the printed value, mangle that string somehow, and
2100 then to finally print the mangled string. Use the new function
2102 inherit-print-state OLD-PORT NEW-PORT
2104 for this. It constructs a new `port' that prints to NEW-PORT but
2105 inherits the print-state of OLD-PORT.
2107 ** struct-vtable-offset renamed to vtable-offset-user
2109 ** New constants: vtable-index-layout, vtable-index-vtable, vtable-index-printer
2111 ** There is now a fourth (optional) argument to make-vtable-vtable and
2112 make-struct when constructing new types (vtables). This argument
2113 initializes field vtable-index-printer of the vtable.
2115 ** The detection of circular references has been extended to structs.
2116 That is, a structure that -- in the process of being printed -- prints
2117 itself does not lead to infinite recursion.
2119 ** There is now some basic support for fluids. Please read
2120 "libguile/fluid.h" to find out more. It is accessible from Scheme with
2121 the following functions and macros:
2123 Function: make-fluid
2125 Create a new fluid object. Fluids are not special variables or
2126 some other extension to the semantics of Scheme, but rather
2127 ordinary Scheme objects. You can store them into variables (that
2128 are still lexically scoped, of course) or into any other place you
2129 like. Every fluid has a initial value of `#f'.
2131 Function: fluid? OBJ
2133 Test whether OBJ is a fluid.
2135 Function: fluid-ref FLUID
2136 Function: fluid-set! FLUID VAL
2138 Access/modify the fluid FLUID. Modifications are only visible
2139 within the current dynamic root (that includes threads).
2141 Function: with-fluids* FLUIDS VALUES THUNK
2143 FLUIDS is a list of fluids and VALUES a corresponding list of
2144 values for these fluids. Before THUNK gets called the values are
2145 installed in the fluids and the old values of the fluids are
2146 saved in the VALUES list. When the flow of control leaves THUNK
2147 or reenters it, the values get swapped again. You might think of
2148 this as a `safe-fluid-excursion'. Note that the VALUES list is
2149 modified by `with-fluids*'.
2151 Macro: with-fluids ((FLUID VALUE) ...) FORM ...
2153 The same as `with-fluids*' but with a different syntax. It looks
2154 just like `let', but both FLUID and VALUE are evaluated. Remember,
2155 fluids are not special variables but ordinary objects. FLUID
2156 should evaluate to a fluid.
2158 ** Changes to system call interfaces:
2160 *** close-port, close-input-port and close-output-port now return a
2161 boolean instead of an `unspecified' object. #t means that the port
2162 was successfully closed, while #f means it was already closed. It is
2163 also now possible for these procedures to raise an exception if an
2164 error occurs (some errors from write can be delayed until close.)
2166 *** the first argument to chmod, fcntl, ftell and fseek can now be a
2169 *** the third argument to fcntl is now optional.
2171 *** the first argument to chown can now be a file descriptor or a port.
2173 *** the argument to stat can now be a port.
2175 *** The following new procedures have been added (most use scsh
2178 *** procedure: close PORT/FD
2179 Similar to close-port (*note close-port: Closing Ports.), but also
2180 works on file descriptors. A side effect of closing a file
2181 descriptor is that any ports using that file descriptor are moved
2182 to a different file descriptor and have their revealed counts set
2185 *** procedure: port->fdes PORT
2186 Returns the integer file descriptor underlying PORT. As a side
2187 effect the revealed count of PORT is incremented.
2189 *** procedure: fdes->ports FDES
2190 Returns a list of existing ports which have FDES as an underlying
2191 file descriptor, without changing their revealed counts.
2193 *** procedure: fdes->inport FDES
2194 Returns an existing input port which has FDES as its underlying
2195 file descriptor, if one exists, and increments its revealed count.
2196 Otherwise, returns a new input port with a revealed count of 1.
2198 *** procedure: fdes->outport FDES
2199 Returns an existing output port which has FDES as its underlying
2200 file descriptor, if one exists, and increments its revealed count.
2201 Otherwise, returns a new output port with a revealed count of 1.
2203 The next group of procedures perform a `dup2' system call, if NEWFD
2204 (an integer) is supplied, otherwise a `dup'. The file descriptor to be
2205 duplicated can be supplied as an integer or contained in a port. The
2206 type of value returned varies depending on which procedure is used.
2208 All procedures also have the side effect when performing `dup2' that
2209 any ports using NEWFD are moved to a different file descriptor and have
2210 their revealed counts set to zero.
2212 *** procedure: dup->fdes PORT/FD [NEWFD]
2213 Returns an integer file descriptor.
2215 *** procedure: dup->inport PORT/FD [NEWFD]
2216 Returns a new input port using the new file descriptor.
2218 *** procedure: dup->outport PORT/FD [NEWFD]
2219 Returns a new output port using the new file descriptor.
2221 *** procedure: dup PORT/FD [NEWFD]
2222 Returns a new port if PORT/FD is a port, with the same mode as the
2223 supplied port, otherwise returns an integer file descriptor.
2225 *** procedure: dup->port PORT/FD MODE [NEWFD]
2226 Returns a new port using the new file descriptor. MODE supplies a
2227 mode string for the port (*note open-file: File Ports.).
2229 *** procedure: setenv NAME VALUE
2230 Modifies the environment of the current process, which is also the
2231 default environment inherited by child processes.
2233 If VALUE is `#f', then NAME is removed from the environment.
2234 Otherwise, the string NAME=VALUE is added to the environment,
2235 replacing any existing string with name matching NAME.
2237 The return value is unspecified.
2239 *** procedure: truncate-file OBJ SIZE
2240 Truncates the file referred to by OBJ to at most SIZE bytes. OBJ
2241 can be a string containing a file name or an integer file
2242 descriptor or port open for output on the file. The underlying
2243 system calls are `truncate' and `ftruncate'.
2245 The return value is unspecified.
2247 *** procedure: setvbuf PORT MODE [SIZE]
2248 Set the buffering mode for PORT. MODE can be:
2256 block buffered, using a newly allocated buffer of SIZE bytes.
2257 However if SIZE is zero or unspecified, the port will be made
2260 This procedure should not be used after I/O has been performed with
2263 Ports are usually block buffered by default, with a default buffer
2264 size. Procedures e.g., *Note open-file: File Ports, which accept a
2265 mode string allow `0' to be added to request an unbuffered port.
2267 *** procedure: fsync PORT/FD
2268 Copies any unwritten data for the specified output file descriptor
2269 to disk. If PORT/FD is a port, its buffer is flushed before the
2270 underlying file descriptor is fsync'd. The return value is
2273 *** procedure: open-fdes PATH FLAGS [MODES]
2274 Similar to `open' but returns a file descriptor instead of a port.
2276 *** procedure: execle PATH ENV [ARG] ...
2277 Similar to `execl', but the environment of the new process is
2278 specified by ENV, which must be a list of strings as returned by
2279 the `environ' procedure.
2281 This procedure is currently implemented using the `execve' system
2282 call, but we call it `execle' because of its Scheme calling
2285 *** procedure: strerror ERRNO
2286 Returns the Unix error message corresponding to ERRNO, an integer.
2288 *** procedure: primitive-exit [STATUS]
2289 Terminate the current process without unwinding the Scheme stack.
2290 This is would typically be useful after a fork. The exit status
2291 is STATUS if supplied, otherwise zero.
2293 *** procedure: times
2294 Returns an object with information about real and processor time.
2295 The following procedures accept such an object as an argument and
2296 return a selected component:
2299 The current real time, expressed as time units relative to an
2303 The CPU time units used by the calling process.
2306 The CPU time units used by the system on behalf of the
2310 The CPU time units used by terminated child processes of the
2311 calling process, whose status has been collected (e.g., using
2315 Similarly, the CPU times units used by the system on behalf of
2316 terminated child processes.
2318 ** Removed: list-length
2319 ** Removed: list-append, list-append!
2320 ** Removed: list-reverse, list-reverse!
2322 ** array-map renamed to array-map!
2324 ** serial-array-map renamed to serial-array-map!
2326 ** catch doesn't take #f as first argument any longer
2328 Previously, it was possible to pass #f instead of a key to `catch'.
2329 That would cause `catch' to pass a jump buffer object to the procedure
2330 passed as second argument. The procedure could then use this jump
2331 buffer objekt as an argument to throw.
2333 This mechanism has been removed since its utility doesn't motivate the
2334 extra complexity it introduces.
2336 ** The `#/' notation for lists now provokes a warning message from Guile.
2337 This syntax will be removed from Guile in the near future.
2339 To disable the warning message, set the GUILE_HUSH environment
2340 variable to any non-empty value.
2342 ** The newline character now prints as `#\newline', following the
2343 normal Scheme notation, not `#\nl'.
2345 * Changes to the gh_ interface
2347 ** The gh_enter function now takes care of loading the Guile startup files.
2348 gh_enter works by calling scm_boot_guile; see the remarks below.
2350 ** Function: void gh_write (SCM x)
2352 Write the printed representation of the scheme object x to the current
2353 output port. Corresponds to the scheme level `write'.
2355 ** gh_list_length renamed to gh_length.
2357 ** vector handling routines
2359 Several major changes. In particular, gh_vector() now resembles
2360 (vector ...) (with a caveat -- see manual), and gh_make_vector() now
2361 exists and behaves like (make-vector ...). gh_vset() and gh_vref()
2362 have been renamed gh_vector_set_x() and gh_vector_ref(). Some missing
2363 vector-related gh_ functions have been implemented.
2365 ** pair and list routines
2367 Implemented several of the R4RS pair and list functions that were
2370 ** gh_scm2doubles, gh_doubles2scm, gh_doubles2dvect
2372 New function. Converts double arrays back and forth between Scheme
2375 * Changes to the scm_ interface
2377 ** The function scm_boot_guile now takes care of loading the startup files.
2379 Guile's primary initialization function, scm_boot_guile, now takes
2380 care of loading `boot-9.scm', in the `ice-9' module, to initialize
2381 Guile, define the module system, and put together some standard
2382 bindings. It also loads `init.scm', which is intended to hold
2383 site-specific initialization code.
2385 Since Guile cannot operate properly until boot-9.scm is loaded, there
2386 is no reason to separate loading boot-9.scm from Guile's other
2387 initialization processes.
2389 This job used to be done by scm_compile_shell_switches, which didn't
2390 make much sense; in particular, it meant that people using Guile for
2391 non-shell-like applications had to jump through hoops to get Guile
2392 initialized properly.
2394 ** The function scm_compile_shell_switches no longer loads the startup files.
2395 Now, Guile always loads the startup files, whenever it is initialized;
2396 see the notes above for scm_boot_guile and scm_load_startup_files.
2398 ** Function: scm_load_startup_files
2399 This new function takes care of loading Guile's initialization file
2400 (`boot-9.scm'), and the site initialization file, `init.scm'. Since
2401 this is always called by the Guile initialization process, it's
2402 probably not too useful to call this yourself, but it's there anyway.
2404 ** The semantics of smob marking have changed slightly.
2406 The smob marking function (the `mark' member of the scm_smobfuns
2407 structure) is no longer responsible for setting the mark bit on the
2408 smob. The generic smob handling code in the garbage collector will
2409 set this bit. The mark function need only ensure that any other
2410 objects the smob refers to get marked.
2412 Note that this change means that the smob's GC8MARK bit is typically
2413 already set upon entry to the mark function. Thus, marking functions
2414 which look like this:
2417 if (SCM_GC8MARKP (ptr))
2419 SCM_SETGC8MARK (ptr);
2420 ... mark objects to which the smob refers ...
2423 are now incorrect, since they will return early, and fail to mark any
2424 other objects the smob refers to. Some code in the Guile library used
2427 ** The semantics of the I/O port functions in scm_ptobfuns have changed.
2429 If you have implemented your own I/O port type, by writing the
2430 functions required by the scm_ptobfuns and then calling scm_newptob,
2431 you will need to change your functions slightly.
2433 The functions in a scm_ptobfuns structure now expect the port itself
2434 as their argument; they used to expect the `stream' member of the
2435 port's scm_port_table structure. This allows functions in an
2436 scm_ptobfuns structure to easily access the port's cell (and any flags
2437 it its CAR), and the port's scm_port_table structure.
2439 Guile now passes the I/O port itself as the `port' argument in the
2440 following scm_ptobfuns functions:
2442 int (*free) (SCM port);
2443 int (*fputc) (int, SCM port);
2444 int (*fputs) (char *, SCM port);
2445 scm_sizet (*fwrite) SCM_P ((char *ptr,
2449 int (*fflush) (SCM port);
2450 int (*fgetc) (SCM port);
2451 int (*fclose) (SCM port);
2453 The interfaces to the `mark', `print', `equalp', and `fgets' methods
2456 If you have existing code which defines its own port types, it is easy
2457 to convert your code to the new interface; simply apply SCM_STREAM to
2458 the port argument to yield the value you code used to expect.
2460 Note that since both the port and the stream have the same type in the
2461 C code --- they are both SCM values --- the C compiler will not remind
2462 you if you forget to update your scm_ptobfuns functions.
2465 ** Function: int scm_internal_select (int fds,
2469 struct timeval *timeout);
2471 This is a replacement for the `select' function provided by the OS.
2472 It enables I/O blocking and sleeping to happen for one cooperative
2473 thread without blocking other threads. It also avoids busy-loops in
2474 these situations. It is intended that all I/O blocking and sleeping
2475 will finally go through this function. Currently, this function is
2476 only available on systems providing `gettimeofday' and `select'.
2478 ** Function: SCM scm_internal_stack_catch (SCM tag,
2479 scm_catch_body_t body,
2481 scm_catch_handler_t handler,
2484 A new sibling to the other two C level `catch' functions
2485 scm_internal_catch and scm_internal_lazy_catch. Use it if you want
2486 the stack to be saved automatically into the variable `the-last-stack'
2487 (scm_the_last_stack_var) on error. This is necessary if you want to
2488 use advanced error reporting, such as calling scm_display_error and
2489 scm_display_backtrace. (They both take a stack object as argument.)
2491 ** Function: SCM scm_spawn_thread (scm_catch_body_t body,
2493 scm_catch_handler_t handler,
2496 Spawns a new thread. It does a job similar to
2497 scm_call_with_new_thread but takes arguments more suitable when
2498 spawning threads from application C code.
2500 ** The hook scm_error_callback has been removed. It was originally
2501 intended as a way for the user to install his own error handler. But
2502 that method works badly since it intervenes between throw and catch,
2503 thereby changing the semantics of expressions like (catch #t ...).
2504 The correct way to do it is to use one of the C level catch functions
2505 in throw.c: scm_internal_catch/lazy_catch/stack_catch.
2507 ** Removed functions:
2509 scm_obj_length, scm_list_length, scm_list_append, scm_list_append_x,
2510 scm_list_reverse, scm_list_reverse_x
2512 ** New macros: SCM_LISTn where n is one of the integers 0-9.
2514 These can be used for pretty list creation from C. The idea is taken
2515 from Erick Gallesio's STk.
2517 ** scm_array_map renamed to scm_array_map_x
2519 ** mbstrings are now removed
2521 This means that the type codes scm_tc7_mb_string and
2522 scm_tc7_mb_substring has been removed.
2524 ** scm_gen_putc, scm_gen_puts, scm_gen_write, and scm_gen_getc have changed.
2526 Since we no longer support multi-byte strings, these I/O functions
2527 have been simplified, and renamed. Here are their old names, and
2528 their new names and arguments:
2530 scm_gen_putc -> void scm_putc (int c, SCM port);
2531 scm_gen_puts -> void scm_puts (char *s, SCM port);
2532 scm_gen_write -> void scm_lfwrite (char *ptr, scm_sizet size, SCM port);
2533 scm_gen_getc -> void scm_getc (SCM port);
2536 ** The macros SCM_TYP7D and SCM_TYP7SD has been removed.
2538 ** The macro SCM_TYP7S has taken the role of the old SCM_TYP7D
2540 SCM_TYP7S now masks away the bit which distinguishes substrings from
2543 ** scm_catch_body_t: Backward incompatible change!
2545 Body functions to scm_internal_catch and friends do not any longer
2546 take a second argument. This is because it is no longer possible to
2547 pass a #f arg to catch.
2549 ** Calls to scm_protect_object and scm_unprotect now nest properly.
2551 The function scm_protect_object protects its argument from being freed
2552 by the garbage collector. scm_unprotect_object removes that
2555 These functions now nest properly. That is, for every object O, there
2556 is a counter which scm_protect_object(O) increments and
2557 scm_unprotect_object(O) decrements, if the counter is greater than
2558 zero. Every object's counter is zero when it is first created. If an
2559 object's counter is greater than zero, the garbage collector will not
2560 reclaim its storage.
2562 This allows you to use scm_protect_object in your code without
2563 worrying that some other function you call will call
2564 scm_unprotect_object, and allow it to be freed. Assuming that the
2565 functions you call are well-behaved, and unprotect only those objects
2566 they protect, you can follow the same rule and have confidence that
2567 objects will be freed only at appropriate times.
2570 Changes in Guile 1.2 (released Tuesday, June 24 1997):
2572 * Changes to the distribution
2574 ** Nightly snapshots are now available from ftp.red-bean.com.
2575 The old server, ftp.cyclic.com, has been relinquished to its rightful
2578 Nightly snapshots of the Guile development sources are now available via
2579 anonymous FTP from ftp.red-bean.com, as /pub/guile/guile-snap.tar.gz.
2581 Via the web, that's: ftp://ftp.red-bean.com/pub/guile/guile-snap.tar.gz
2582 For getit, that's: ftp.red-bean.com:/pub/guile/guile-snap.tar.gz
2584 ** To run Guile without installing it, the procedure has changed a bit.
2586 If you used a separate build directory to compile Guile, you'll need
2587 to include the build directory in SCHEME_LOAD_PATH, as well as the
2588 source directory. See the `INSTALL' file for examples.
2590 * Changes to the procedure for linking libguile with your programs
2592 ** The standard Guile load path for Scheme code now includes
2593 $(datadir)/guile (usually /usr/local/share/guile). This means that
2594 you can install your own Scheme files there, and Guile will find them.
2595 (Previous versions of Guile only checked a directory whose name
2596 contained the Guile version number, so you had to re-install or move
2597 your Scheme sources each time you installed a fresh version of Guile.)
2599 The load path also includes $(datadir)/guile/site; we recommend
2600 putting individual Scheme files there. If you want to install a
2601 package with multiple source files, create a directory for them under
2604 ** Guile 1.2 will now use the Rx regular expression library, if it is
2605 installed on your system. When you are linking libguile into your own
2606 programs, this means you will have to link against -lguile, -lqt (if
2607 you configured Guile with thread support), and -lrx.
2609 If you are using autoconf to generate configuration scripts for your
2610 application, the following lines should suffice to add the appropriate
2611 libraries to your link command:
2613 ### Find Rx, quickthreads and libguile.
2614 AC_CHECK_LIB(rx, main)
2615 AC_CHECK_LIB(qt, main)
2616 AC_CHECK_LIB(guile, scm_shell)
2618 The Guile 1.2 distribution does not contain sources for the Rx
2619 library, as Guile 1.0 did. If you want to use Rx, you'll need to
2620 retrieve it from a GNU FTP site and install it separately.
2622 * Changes to Scheme functions and syntax
2624 ** The dynamic linking features of Guile are now enabled by default.
2625 You can disable them by giving the `--disable-dynamic-linking' option
2628 (dynamic-link FILENAME)
2630 Find the object file denoted by FILENAME (a string) and link it
2631 into the running Guile application. When everything works out,
2632 return a Scheme object suitable for representing the linked object
2633 file. Otherwise an error is thrown. How object files are
2634 searched is system dependent.
2636 (dynamic-object? VAL)
2638 Determine whether VAL represents a dynamically linked object file.
2640 (dynamic-unlink DYNOBJ)
2642 Unlink the indicated object file from the application. DYNOBJ
2643 should be one of the values returned by `dynamic-link'.
2645 (dynamic-func FUNCTION DYNOBJ)
2647 Search the C function indicated by FUNCTION (a string or symbol)
2648 in DYNOBJ and return some Scheme object that can later be used
2649 with `dynamic-call' to actually call this function. Right now,
2650 these Scheme objects are formed by casting the address of the
2651 function to `long' and converting this number to its Scheme
2654 (dynamic-call FUNCTION DYNOBJ)
2656 Call the C function indicated by FUNCTION and DYNOBJ. The
2657 function is passed no arguments and its return value is ignored.
2658 When FUNCTION is something returned by `dynamic-func', call that
2659 function and ignore DYNOBJ. When FUNCTION is a string (or symbol,
2660 etc.), look it up in DYNOBJ; this is equivalent to
2662 (dynamic-call (dynamic-func FUNCTION DYNOBJ) #f)
2664 Interrupts are deferred while the C function is executing (with
2665 SCM_DEFER_INTS/SCM_ALLOW_INTS).
2667 (dynamic-args-call FUNCTION DYNOBJ ARGS)
2669 Call the C function indicated by FUNCTION and DYNOBJ, but pass it
2670 some arguments and return its return value. The C function is
2671 expected to take two arguments and return an `int', just like
2674 int c_func (int argc, char **argv);
2676 ARGS must be a list of strings and is converted into an array of
2677 `char *'. The array is passed in ARGV and its size in ARGC. The
2678 return value is converted to a Scheme number and returned from the
2679 call to `dynamic-args-call'.
2681 When dynamic linking is disabled or not supported on your system,
2682 the above functions throw errors, but they are still available.
2684 Here is a small example that works on GNU/Linux:
2686 (define libc-obj (dynamic-link "libc.so"))
2687 (dynamic-args-call 'rand libc-obj '())
2689 See the file `libguile/DYNAMIC-LINKING' for additional comments.
2691 ** The #/ syntax for module names is depreciated, and will be removed
2692 in a future version of Guile. Instead of
2700 The latter syntax is more consistent with existing Lisp practice.
2702 ** Guile now does fancier printing of structures. Structures are the
2703 underlying implementation for records, which in turn are used to
2704 implement modules, so all of these object now print differently and in
2705 a more informative way.
2707 The Scheme printer will examine the builtin variable *struct-printer*
2708 whenever it needs to print a structure object. When this variable is
2709 not `#f' it is deemed to be a procedure and will be applied to the
2710 structure object and the output port. When *struct-printer* is `#f'
2711 or the procedure return `#f' the structure object will be printed in
2712 the boring #<struct 80458270> form.
2714 This hook is used by some routines in ice-9/boot-9.scm to implement
2715 type specific printing routines. Please read the comments there about
2718 One of the more specific uses of structs are records. The printing
2719 procedure that could be passed to MAKE-RECORD-TYPE is now actually
2720 called. It should behave like a *struct-printer* procedure (described
2723 ** Guile now supports a new R4RS-compliant syntax for keywords. A
2724 token of the form #:NAME, where NAME has the same syntax as a Scheme
2725 symbol, is the external representation of the keyword named NAME.
2726 Keyword objects print using this syntax as well, so values containing
2727 keyword objects can be read back into Guile. When used in an
2728 expression, keywords are self-quoting objects.
2730 Guile suports this read syntax, and uses this print syntax, regardless
2731 of the current setting of the `keyword' read option. The `keyword'
2732 read option only controls whether Guile recognizes the `:NAME' syntax,
2733 which is incompatible with R4RS. (R4RS says such token represent
2736 ** Guile has regular expression support again. Guile 1.0 included
2737 functions for matching regular expressions, based on the Rx library.
2738 In Guile 1.1, the Guile/Rx interface was removed to simplify the
2739 distribution, and thus Guile had no regular expression support. Guile
2740 1.2 again supports the most commonly used functions, and supports all
2741 of SCSH's regular expression functions.
2743 If your system does not include a POSIX regular expression library,
2744 and you have not linked Guile with a third-party regexp library such as
2745 Rx, these functions will not be available. You can tell whether your
2746 Guile installation includes regular expression support by checking
2747 whether the `*features*' list includes the `regex' symbol.
2749 *** regexp functions
2751 By default, Guile supports POSIX extended regular expressions. That
2752 means that the characters `(', `)', `+' and `?' are special, and must
2753 be escaped if you wish to match the literal characters.
2755 This regular expression interface was modeled after that implemented
2756 by SCSH, the Scheme Shell. It is intended to be upwardly compatible
2757 with SCSH regular expressions.
2759 **** Function: string-match PATTERN STR [START]
2760 Compile the string PATTERN into a regular expression and compare
2761 it with STR. The optional numeric argument START specifies the
2762 position of STR at which to begin matching.
2764 `string-match' returns a "match structure" which describes what,
2765 if anything, was matched by the regular expression. *Note Match
2766 Structures::. If STR does not match PATTERN at all,
2767 `string-match' returns `#f'.
2769 Each time `string-match' is called, it must compile its PATTERN
2770 argument into a regular expression structure. This operation is
2771 expensive, which makes `string-match' inefficient if the same regular
2772 expression is used several times (for example, in a loop). For better
2773 performance, you can compile a regular expression in advance and then
2774 match strings against the compiled regexp.
2776 **** Function: make-regexp STR [FLAGS]
2777 Compile the regular expression described by STR, and return the
2778 compiled regexp structure. If STR does not describe a legal
2779 regular expression, `make-regexp' throws a
2780 `regular-expression-syntax' error.
2782 FLAGS may be the bitwise-or of one or more of the following:
2784 **** Constant: regexp/extended
2785 Use POSIX Extended Regular Expression syntax when interpreting
2786 STR. If not set, POSIX Basic Regular Expression syntax is used.
2787 If the FLAGS argument is omitted, we assume regexp/extended.
2789 **** Constant: regexp/icase
2790 Do not differentiate case. Subsequent searches using the
2791 returned regular expression will be case insensitive.
2793 **** Constant: regexp/newline
2794 Match-any-character operators don't match a newline.
2796 A non-matching list ([^...]) not containing a newline matches a
2799 Match-beginning-of-line operator (^) matches the empty string
2800 immediately after a newline, regardless of whether the FLAGS
2801 passed to regexp-exec contain regexp/notbol.
2803 Match-end-of-line operator ($) matches the empty string
2804 immediately before a newline, regardless of whether the FLAGS
2805 passed to regexp-exec contain regexp/noteol.
2807 **** Function: regexp-exec REGEXP STR [START [FLAGS]]
2808 Match the compiled regular expression REGEXP against `str'. If
2809 the optional integer START argument is provided, begin matching
2810 from that position in the string. Return a match structure
2811 describing the results of the match, or `#f' if no match could be
2814 FLAGS may be the bitwise-or of one or more of the following:
2816 **** Constant: regexp/notbol
2817 The match-beginning-of-line operator always fails to match (but
2818 see the compilation flag regexp/newline above) This flag may be
2819 used when different portions of a string are passed to
2820 regexp-exec and the beginning of the string should not be
2821 interpreted as the beginning of the line.
2823 **** Constant: regexp/noteol
2824 The match-end-of-line operator always fails to match (but see the
2825 compilation flag regexp/newline above)
2827 **** Function: regexp? OBJ
2828 Return `#t' if OBJ is a compiled regular expression, or `#f'
2831 Regular expressions are commonly used to find patterns in one string
2832 and replace them with the contents of another string.
2834 **** Function: regexp-substitute PORT MATCH [ITEM...]
2835 Write to the output port PORT selected contents of the match
2836 structure MATCH. Each ITEM specifies what should be written, and
2837 may be one of the following arguments:
2839 * A string. String arguments are written out verbatim.
2841 * An integer. The submatch with that number is written.
2843 * The symbol `pre'. The portion of the matched string preceding
2844 the regexp match is written.
2846 * The symbol `post'. The portion of the matched string
2847 following the regexp match is written.
2849 PORT may be `#f', in which case nothing is written; instead,
2850 `regexp-substitute' constructs a string from the specified ITEMs
2853 **** Function: regexp-substitute/global PORT REGEXP TARGET [ITEM...]
2854 Similar to `regexp-substitute', but can be used to perform global
2855 substitutions on STR. Instead of taking a match structure as an
2856 argument, `regexp-substitute/global' takes two string arguments: a
2857 REGEXP string describing a regular expression, and a TARGET string
2858 which should be matched against this regular expression.
2860 Each ITEM behaves as in REGEXP-SUBSTITUTE, with the following
2863 * A function may be supplied. When this function is called, it
2864 will be passed one argument: a match structure for a given
2865 regular expression match. It should return a string to be
2866 written out to PORT.
2868 * The `post' symbol causes `regexp-substitute/global' to recurse
2869 on the unmatched portion of STR. This *must* be supplied in
2870 order to perform global search-and-replace on STR; if it is
2871 not present among the ITEMs, then `regexp-substitute/global'
2872 will return after processing a single match.
2874 *** Match Structures
2876 A "match structure" is the object returned by `string-match' and
2877 `regexp-exec'. It describes which portion of a string, if any, matched
2878 the given regular expression. Match structures include: a reference to
2879 the string that was checked for matches; the starting and ending
2880 positions of the regexp match; and, if the regexp included any
2881 parenthesized subexpressions, the starting and ending positions of each
2884 In each of the regexp match functions described below, the `match'
2885 argument must be a match structure returned by a previous call to
2886 `string-match' or `regexp-exec'. Most of these functions return some
2887 information about the original target string that was matched against a
2888 regular expression; we will call that string TARGET for easy reference.
2890 **** Function: regexp-match? OBJ
2891 Return `#t' if OBJ is a match structure returned by a previous
2892 call to `regexp-exec', or `#f' otherwise.
2894 **** Function: match:substring MATCH [N]
2895 Return the portion of TARGET matched by subexpression number N.
2896 Submatch 0 (the default) represents the entire regexp match. If
2897 the regular expression as a whole matched, but the subexpression
2898 number N did not match, return `#f'.
2900 **** Function: match:start MATCH [N]
2901 Return the starting position of submatch number N.
2903 **** Function: match:end MATCH [N]
2904 Return the ending position of submatch number N.
2906 **** Function: match:prefix MATCH
2907 Return the unmatched portion of TARGET preceding the regexp match.
2909 **** Function: match:suffix MATCH
2910 Return the unmatched portion of TARGET following the regexp match.
2912 **** Function: match:count MATCH
2913 Return the number of parenthesized subexpressions from MATCH.
2914 Note that the entire regular expression match itself counts as a
2915 subexpression, and failed submatches are included in the count.
2917 **** Function: match:string MATCH
2918 Return the original TARGET string.
2920 *** Backslash Escapes
2922 Sometimes you will want a regexp to match characters like `*' or `$'
2923 exactly. For example, to check whether a particular string represents
2924 a menu entry from an Info node, it would be useful to match it against
2925 a regexp like `^* [^:]*::'. However, this won't work; because the
2926 asterisk is a metacharacter, it won't match the `*' at the beginning of
2927 the string. In this case, we want to make the first asterisk un-magic.
2929 You can do this by preceding the metacharacter with a backslash
2930 character `\'. (This is also called "quoting" the metacharacter, and
2931 is known as a "backslash escape".) When Guile sees a backslash in a
2932 regular expression, it considers the following glyph to be an ordinary
2933 character, no matter what special meaning it would ordinarily have.
2934 Therefore, we can make the above example work by changing the regexp to
2935 `^\* [^:]*::'. The `\*' sequence tells the regular expression engine
2936 to match only a single asterisk in the target string.
2938 Since the backslash is itself a metacharacter, you may force a
2939 regexp to match a backslash in the target string by preceding the
2940 backslash with itself. For example, to find variable references in a
2941 TeX program, you might want to find occurrences of the string `\let\'
2942 followed by any number of alphabetic characters. The regular expression
2943 `\\let\\[A-Za-z]*' would do this: the double backslashes in the regexp
2944 each match a single backslash in the target string.
2946 **** Function: regexp-quote STR
2947 Quote each special character found in STR with a backslash, and
2948 return the resulting string.
2950 *Very important:* Using backslash escapes in Guile source code (as
2951 in Emacs Lisp or C) can be tricky, because the backslash character has
2952 special meaning for the Guile reader. For example, if Guile encounters
2953 the character sequence `\n' in the middle of a string while processing
2954 Scheme code, it replaces those characters with a newline character.
2955 Similarly, the character sequence `\t' is replaced by a horizontal tab.
2956 Several of these "escape sequences" are processed by the Guile reader
2957 before your code is executed. Unrecognized escape sequences are
2958 ignored: if the characters `\*' appear in a string, they will be
2959 translated to the single character `*'.
2961 This translation is obviously undesirable for regular expressions,
2962 since we want to be able to include backslashes in a string in order to
2963 escape regexp metacharacters. Therefore, to make sure that a backslash
2964 is preserved in a string in your Guile program, you must use *two*
2965 consecutive backslashes:
2967 (define Info-menu-entry-pattern (make-regexp "^\\* [^:]*"))
2969 The string in this example is preprocessed by the Guile reader before
2970 any code is executed. The resulting argument to `make-regexp' is the
2971 string `^\* [^:]*', which is what we really want.
2973 This also means that in order to write a regular expression that
2974 matches a single backslash character, the regular expression string in
2975 the source code must include *four* backslashes. Each consecutive pair
2976 of backslashes gets translated by the Guile reader to a single
2977 backslash, and the resulting double-backslash is interpreted by the
2978 regexp engine as matching a single backslash character. Hence:
2980 (define tex-variable-pattern (make-regexp "\\\\let\\\\=[A-Za-z]*"))
2982 The reason for the unwieldiness of this syntax is historical. Both
2983 regular expression pattern matchers and Unix string processing systems
2984 have traditionally used backslashes with the special meanings described
2985 above. The POSIX regular expression specification and ANSI C standard
2986 both require these semantics. Attempting to abandon either convention
2987 would cause other kinds of compatibility problems, possibly more severe
2988 ones. Therefore, without extending the Scheme reader to support
2989 strings with different quoting conventions (an ungainly and confusing
2990 extension when implemented in other languages), we must adhere to this
2991 cumbersome escape syntax.
2993 * Changes to the gh_ interface
2995 * Changes to the scm_ interface
2997 * Changes to system call interfaces:
2999 ** The value returned by `raise' is now unspecified. It throws an exception
3002 *** A new procedure `sigaction' can be used to install signal handlers
3004 (sigaction signum [action] [flags])
3006 signum is the signal number, which can be specified using the value
3009 If action is omitted, sigaction returns a pair: the CAR is the current
3010 signal hander, which will be either an integer with the value SIG_DFL
3011 (default action) or SIG_IGN (ignore), or the Scheme procedure which
3012 handles the signal, or #f if a non-Scheme procedure handles the
3013 signal. The CDR contains the current sigaction flags for the handler.
3015 If action is provided, it is installed as the new handler for signum.
3016 action can be a Scheme procedure taking one argument, or the value of
3017 SIG_DFL (default action) or SIG_IGN (ignore), or #f to restore
3018 whatever signal handler was installed before sigaction was first used.
3019 Flags can optionally be specified for the new handler (SA_RESTART is
3020 always used if the system provides it, so need not be specified.) The
3021 return value is a pair with information about the old handler as
3024 This interface does not provide access to the "signal blocking"
3025 facility. Maybe this is not needed, since the thread support may
3026 provide solutions to the problem of consistent access to data
3029 *** A new procedure `flush-all-ports' is equivalent to running
3030 `force-output' on every port open for output.
3032 ** Guile now provides information on how it was built, via the new
3033 global variable, %guile-build-info. This variable records the values
3034 of the standard GNU makefile directory variables as an assocation
3035 list, mapping variable names (symbols) onto directory paths (strings).
3036 For example, to find out where the Guile link libraries were
3037 installed, you can say:
3039 guile -c "(display (assq-ref %guile-build-info 'libdir)) (newline)"
3042 * Changes to the scm_ interface
3044 ** The new function scm_handle_by_message_noexit is just like the
3045 existing scm_handle_by_message function, except that it doesn't call
3046 exit to terminate the process. Instead, it prints a message and just
3047 returns #f. This might be a more appropriate catch-all handler for
3048 new dynamic roots and threads.
3051 Changes in Guile 1.1 (released Friday, May 16 1997):
3053 * Changes to the distribution.
3055 The Guile 1.0 distribution has been split up into several smaller
3057 guile-core --- the Guile interpreter itself.
3058 guile-tcltk --- the interface between the Guile interpreter and
3059 Tcl/Tk; Tcl is an interpreter for a stringy language, and Tk
3060 is a toolkit for building graphical user interfaces.
3061 guile-rgx-ctax --- the interface between Guile and the Rx regular
3062 expression matcher, and the translator for the Ctax
3063 programming language. These are packaged together because the
3064 Ctax translator uses Rx to parse Ctax source code.
3066 This NEWS file describes the changes made to guile-core since the 1.0
3069 We no longer distribute the documentation, since it was either out of
3070 date, or incomplete. As soon as we have current documentation, we
3075 * Changes to the stand-alone interpreter
3077 ** guile now accepts command-line arguments compatible with SCSH, Olin
3078 Shivers' Scheme Shell.
3080 In general, arguments are evaluated from left to right, but there are
3081 exceptions. The following switches stop argument processing, and
3082 stash all remaining command-line arguments as the value returned by
3083 the (command-line) function.
3084 -s SCRIPT load Scheme source code from FILE, and exit
3085 -c EXPR evalute Scheme expression EXPR, and exit
3086 -- stop scanning arguments; run interactively
3088 The switches below are processed as they are encountered.
3089 -l FILE load Scheme source code from FILE
3090 -e FUNCTION after reading script, apply FUNCTION to
3091 command line arguments
3092 -ds do -s script at this point
3093 --emacs enable Emacs protocol (experimental)
3094 -h, --help display this help and exit
3095 -v, --version display version information and exit
3096 \ read arguments from following script lines
3098 So, for example, here is a Guile script named `ekko' (thanks, Olin)
3099 which re-implements the traditional "echo" command:
3101 #!/usr/local/bin/guile -s
3104 (map (lambda (arg) (display arg) (display " "))
3108 (main (command-line))
3110 Suppose we invoke this script as follows:
3112 ekko a speckled gecko
3114 Through the magic of Unix script processing (triggered by the `#!'
3115 token at the top of the file), /usr/local/bin/guile receives the
3116 following list of command-line arguments:
3118 ("-s" "./ekko" "a" "speckled" "gecko")
3120 Unix inserts the name of the script after the argument specified on
3121 the first line of the file (in this case, "-s"), and then follows that
3122 with the arguments given to the script. Guile loads the script, which
3123 defines the `main' function, and then applies it to the list of
3124 remaining command-line arguments, ("a" "speckled" "gecko").
3126 In Unix, the first line of a script file must take the following form:
3128 #!INTERPRETER ARGUMENT
3130 where INTERPRETER is the absolute filename of the interpreter
3131 executable, and ARGUMENT is a single command-line argument to pass to
3134 You may only pass one argument to the interpreter, and its length is
3135 limited. These restrictions can be annoying to work around, so Guile
3136 provides a general mechanism (borrowed from, and compatible with,
3137 SCSH) for circumventing them.
3139 If the ARGUMENT in a Guile script is a single backslash character,
3140 `\', Guile will open the script file, parse arguments from its second
3141 and subsequent lines, and replace the `\' with them. So, for example,
3142 here is another implementation of the `ekko' script:
3144 #!/usr/local/bin/guile \
3148 (for-each (lambda (arg) (display arg) (display " "))
3152 If the user invokes this script as follows:
3154 ekko a speckled gecko
3156 Unix expands this into
3158 /usr/local/bin/guile \ ekko a speckled gecko
3160 When Guile sees the `\' argument, it replaces it with the arguments
3161 read from the second line of the script, producing:
3163 /usr/local/bin/guile -e main -s ekko a speckled gecko
3165 This tells Guile to load the `ekko' script, and apply the function
3166 `main' to the argument list ("a" "speckled" "gecko").
3168 Here is how Guile parses the command-line arguments:
3169 - Each space character terminates an argument. This means that two
3170 spaces in a row introduce an empty-string argument.
3171 - The tab character is not permitted (unless you quote it with the
3172 backslash character, as described below), to avoid confusion.
3173 - The newline character terminates the sequence of arguments, and will
3174 also terminate a final non-empty argument. (However, a newline
3175 following a space will not introduce a final empty-string argument;
3176 it only terminates the argument list.)
3177 - The backslash character is the escape character. It escapes
3178 backslash, space, tab, and newline. The ANSI C escape sequences
3179 like \n and \t are also supported. These produce argument
3180 constituents; the two-character combination \n doesn't act like a
3181 terminating newline. The escape sequence \NNN for exactly three
3182 octal digits reads as the character whose ASCII code is NNN. As
3183 above, characters produced this way are argument constituents.
3184 Backslash followed by other characters is not allowed.
3186 * Changes to the procedure for linking libguile with your programs
3188 ** Guile now builds and installs a shared guile library, if your
3189 system support shared libraries. (It still builds a static library on
3190 all systems.) Guile automatically detects whether your system
3191 supports shared libraries. To prevent Guile from buildisg shared
3192 libraries, pass the `--disable-shared' flag to the configure script.
3194 Guile takes longer to compile when it builds shared libraries, because
3195 it must compile every file twice --- once to produce position-
3196 independent object code, and once to produce normal object code.
3198 ** The libthreads library has been merged into libguile.
3200 To link a program against Guile, you now need only link against
3201 -lguile and -lqt; -lthreads is no longer needed. If you are using
3202 autoconf to generate configuration scripts for your application, the
3203 following lines should suffice to add the appropriate libraries to
3206 ### Find quickthreads and libguile.
3207 AC_CHECK_LIB(qt, main)
3208 AC_CHECK_LIB(guile, scm_shell)
3210 * Changes to Scheme functions
3212 ** Guile Scheme's special syntax for keyword objects is now optional,
3213 and disabled by default.
3215 The syntax variation from R4RS made it difficult to port some
3216 interesting packages to Guile. The routines which accepted keyword
3217 arguments (mostly in the module system) have been modified to also
3218 accept symbols whose names begin with `:'.
3220 To change the keyword syntax, you must first import the (ice-9 debug)
3222 (use-modules (ice-9 debug))
3224 Then you can enable the keyword syntax as follows:
3225 (read-set! keywords 'prefix)
3227 To disable keyword syntax, do this:
3228 (read-set! keywords #f)
3230 ** Many more primitive functions accept shared substrings as
3231 arguments. In the past, these functions required normal, mutable
3232 strings as arguments, although they never made use of this
3235 ** The uniform array functions now operate on byte vectors. These
3236 functions are `array-fill!', `serial-array-copy!', `array-copy!',
3237 `serial-array-map', `array-map', `array-for-each', and
3240 ** The new functions `trace' and `untrace' implement simple debugging
3241 support for Scheme functions.
3243 The `trace' function accepts any number of procedures as arguments,
3244 and tells the Guile interpreter to display each procedure's name and
3245 arguments each time the procedure is invoked. When invoked with no
3246 arguments, `trace' returns the list of procedures currently being
3249 The `untrace' function accepts any number of procedures as arguments,
3250 and tells the Guile interpreter not to trace them any more. When
3251 invoked with no arguments, `untrace' untraces all curretly traced
3254 The tracing in Guile has an advantage over most other systems: we
3255 don't create new procedure objects, but mark the procedure objects
3256 themselves. This means that anonymous and internal procedures can be
3259 ** The function `assert-repl-prompt' has been renamed to
3260 `set-repl-prompt!'. It takes one argument, PROMPT.
3261 - If PROMPT is #f, the Guile read-eval-print loop will not prompt.
3262 - If PROMPT is a string, we use it as a prompt.
3263 - If PROMPT is a procedure accepting no arguments, we call it, and
3264 display the result as a prompt.
3265 - Otherwise, we display "> ".
3267 ** The new function `eval-string' reads Scheme expressions from a
3268 string and evaluates them, returning the value of the last expression
3269 in the string. If the string contains no expressions, it returns an
3272 ** The new function `thunk?' returns true iff its argument is a
3273 procedure of zero arguments.
3275 ** `defined?' is now a builtin function, instead of syntax. This
3276 means that its argument should be quoted. It returns #t iff its
3277 argument is bound in the current module.
3279 ** The new syntax `use-modules' allows you to add new modules to your
3280 environment without re-typing a complete `define-module' form. It
3281 accepts any number of module names as arguments, and imports their
3282 public bindings into the current module.
3284 ** The new function (module-defined? NAME MODULE) returns true iff
3285 NAME, a symbol, is defined in MODULE, a module object.
3287 ** The new function `builtin-bindings' creates and returns a hash
3288 table containing copies of all the root module's bindings.
3290 ** The new function `builtin-weak-bindings' does the same as
3291 `builtin-bindings', but creates a doubly-weak hash table.
3293 ** The `equal?' function now considers variable objects to be
3294 equivalent if they have the same name and the same value.
3296 ** The new function `command-line' returns the command-line arguments
3297 given to Guile, as a list of strings.
3299 When using guile as a script interpreter, `command-line' returns the
3300 script's arguments; those processed by the interpreter (like `-s' or
3301 `-c') are omitted. (In other words, you get the normal, expected
3302 behavior.) Any application that uses scm_shell to process its
3303 command-line arguments gets this behavior as well.
3305 ** The new function `load-user-init' looks for a file called `.guile'
3306 in the user's home directory, and loads it if it exists. This is
3307 mostly for use by the code generated by scm_compile_shell_switches,
3308 but we thought it might also be useful in other circumstances.
3310 ** The new function `log10' returns the base-10 logarithm of its
3313 ** Changes to I/O functions
3315 *** The functions `read', `primitive-load', `read-and-eval!', and
3316 `primitive-load-path' no longer take optional arguments controlling
3317 case insensitivity and a `#' parser.
3319 Case sensitivity is now controlled by a read option called
3320 `case-insensitive'. The user can add new `#' syntaxes with the
3321 `read-hash-extend' function (see below).
3323 *** The new function `read-hash-extend' allows the user to change the
3324 syntax of Guile Scheme in a somewhat controlled way.
3326 (read-hash-extend CHAR PROC)
3327 When parsing S-expressions, if we read a `#' character followed by
3328 the character CHAR, use PROC to parse an object from the stream.
3329 If PROC is #f, remove any parsing procedure registered for CHAR.
3331 The reader applies PROC to two arguments: CHAR and an input port.
3333 *** The new functions read-delimited and read-delimited! provide a
3334 general mechanism for doing delimited input on streams.
3336 (read-delimited DELIMS [PORT HANDLE-DELIM])
3337 Read until we encounter one of the characters in DELIMS (a string),
3338 or end-of-file. PORT is the input port to read from; it defaults to
3339 the current input port. The HANDLE-DELIM parameter determines how
3340 the terminating character is handled; it should be one of the
3343 'trim omit delimiter from result
3344 'peek leave delimiter character in input stream
3345 'concat append delimiter character to returned value
3346 'split return a pair: (RESULT . TERMINATOR)
3348 HANDLE-DELIM defaults to 'peek.
3350 (read-delimited! DELIMS BUF [PORT HANDLE-DELIM START END])
3351 A side-effecting variant of `read-delimited'.
3353 The data is written into the string BUF at the indices in the
3354 half-open interval [START, END); the default interval is the whole
3355 string: START = 0 and END = (string-length BUF). The values of
3356 START and END must specify a well-defined interval in BUF, i.e.
3357 0 <= START <= END <= (string-length BUF).
3359 It returns NBYTES, the number of bytes read. If the buffer filled
3360 up without a delimiter character being found, it returns #f. If the
3361 port is at EOF when the read starts, it returns the EOF object.
3363 If an integer is returned (i.e., the read is successfully terminated
3364 by reading a delimiter character), then the HANDLE-DELIM parameter
3365 determines how to handle the terminating character. It is described
3366 above, and defaults to 'peek.
3368 (The descriptions of these functions were borrowed from the SCSH
3369 manual, by Olin Shivers and Brian Carlstrom.)
3371 *** The `%read-delimited!' function is the primitive used to implement
3372 `read-delimited' and `read-delimited!'.
3374 (%read-delimited! DELIMS BUF GOBBLE? [PORT START END])
3376 This returns a pair of values: (TERMINATOR . NUM-READ).
3377 - TERMINATOR describes why the read was terminated. If it is a
3378 character or the eof object, then that is the value that terminated
3379 the read. If it is #f, the function filled the buffer without finding
3380 a delimiting character.
3381 - NUM-READ is the number of characters read into BUF.
3383 If the read is successfully terminated by reading a delimiter
3384 character, then the gobble? parameter determines what to do with the
3385 terminating character. If true, the character is removed from the
3386 input stream; if false, the character is left in the input stream
3387 where a subsequent read operation will retrieve it. In either case,
3388 the character is also the first value returned by the procedure call.
3390 (The descriptions of this function was borrowed from the SCSH manual,
3391 by Olin Shivers and Brian Carlstrom.)
3393 *** The `read-line' and `read-line!' functions have changed; they now
3394 trim the terminator by default; previously they appended it to the
3395 returned string. For the old behavior, use (read-line PORT 'concat).
3397 *** The functions `uniform-array-read!' and `uniform-array-write!' now
3398 take new optional START and END arguments, specifying the region of
3399 the array to read and write.
3401 *** The `ungetc-char-ready?' function has been removed. We feel it's
3402 inappropriate for an interface to expose implementation details this
3405 ** Changes to the Unix library and system call interface
3407 *** The new fcntl function provides access to the Unix `fcntl' system
3410 (fcntl PORT COMMAND VALUE)
3411 Apply COMMAND to PORT's file descriptor, with VALUE as an argument.
3412 Values for COMMAND are:
3414 F_DUPFD duplicate a file descriptor
3415 F_GETFD read the descriptor's close-on-exec flag
3416 F_SETFD set the descriptor's close-on-exec flag to VALUE
3417 F_GETFL read the descriptor's flags, as set on open
3418 F_SETFL set the descriptor's flags, as set on open to VALUE
3419 F_GETOWN return the process ID of a socket's owner, for SIGIO
3420 F_SETOWN set the process that owns a socket to VALUE, for SIGIO
3421 FD_CLOEXEC not sure what this is
3423 For details, see the documentation for the fcntl system call.
3425 *** The arguments to `select' have changed, for compatibility with
3426 SCSH. The TIMEOUT parameter may now be non-integral, yielding the
3427 expected behavior. The MILLISECONDS parameter has been changed to
3428 MICROSECONDS, to more closely resemble the underlying system call.
3429 The RVEC, WVEC, and EVEC arguments can now be vectors; the type of the
3430 corresponding return set will be the same.
3432 *** The arguments to the `mknod' system call have changed. They are
3435 (mknod PATH TYPE PERMS DEV)
3436 Create a new file (`node') in the file system. PATH is the name of
3437 the file to create. TYPE is the kind of file to create; it should
3438 be 'fifo, 'block-special, or 'char-special. PERMS specifies the
3439 permission bits to give the newly created file. If TYPE is
3440 'block-special or 'char-special, DEV specifies which device the
3441 special file refers to; its interpretation depends on the kind of
3442 special file being created.
3444 *** The `fork' function has been renamed to `primitive-fork', to avoid
3445 clashing with various SCSH forks.
3447 *** The `recv' and `recvfrom' functions have been renamed to `recv!'
3448 and `recvfrom!'. They no longer accept a size for a second argument;
3449 you must pass a string to hold the received value. They no longer
3450 return the buffer. Instead, `recv' returns the length of the message
3451 received, and `recvfrom' returns a pair containing the packet's length
3452 and originating address.
3454 *** The file descriptor datatype has been removed, as have the
3455 `read-fd', `write-fd', `close', `lseek', and `dup' functions.
3456 We plan to replace these functions with a SCSH-compatible interface.
3458 *** The `create' function has been removed; it's just a special case
3461 *** There are new functions to break down process termination status
3462 values. In the descriptions below, STATUS is a value returned by
3465 (status:exit-val STATUS)
3466 If the child process exited normally, this function returns the exit
3467 code for the child process (i.e., the value passed to exit, or
3468 returned from main). If the child process did not exit normally,
3469 this function returns #f.
3471 (status:stop-sig STATUS)
3472 If the child process was suspended by a signal, this function
3473 returns the signal that suspended the child. Otherwise, it returns
3476 (status:term-sig STATUS)
3477 If the child process terminated abnormally, this function returns
3478 the signal that terminated the child. Otherwise, this function
3481 POSIX promises that exactly one of these functions will return true on
3482 a valid STATUS value.
3484 These functions are compatible with SCSH.
3486 *** There are new accessors and setters for the broken-out time vectors
3487 returned by `localtime', `gmtime', and that ilk. They are:
3489 Component Accessor Setter
3490 ========================= ============ ============
3491 seconds tm:sec set-tm:sec
3492 minutes tm:min set-tm:min
3493 hours tm:hour set-tm:hour
3494 day of the month tm:mday set-tm:mday
3495 month tm:mon set-tm:mon
3496 year tm:year set-tm:year
3497 day of the week tm:wday set-tm:wday
3498 day in the year tm:yday set-tm:yday
3499 daylight saving time tm:isdst set-tm:isdst
3500 GMT offset, seconds tm:gmtoff set-tm:gmtoff
3501 name of time zone tm:zone set-tm:zone
3503 *** There are new accessors for the vectors returned by `uname',
3504 describing the host system:
3507 ============================================== ================
3508 name of the operating system implementation utsname:sysname
3509 network name of this machine utsname:nodename
3510 release level of the operating system utsname:release
3511 version level of the operating system utsname:version
3512 machine hardware platform utsname:machine
3514 *** There are new accessors for the vectors returned by `getpw',
3515 `getpwnam', `getpwuid', and `getpwent', describing entries from the
3516 system's user database:
3519 ====================== =================
3520 user name passwd:name
3521 user password passwd:passwd
3524 real name passwd:gecos
3525 home directory passwd:dir
3526 shell program passwd:shell
3528 *** There are new accessors for the vectors returned by `getgr',
3529 `getgrnam', `getgrgid', and `getgrent', describing entries from the
3530 system's group database:
3533 ======================= ============
3534 group name group:name
3535 group password group:passwd
3537 group members group:mem
3539 *** There are new accessors for the vectors returned by `gethost',
3540 `gethostbyaddr', `gethostbyname', and `gethostent', describing
3544 ========================= ===============
3545 official name of host hostent:name
3546 alias list hostent:aliases
3547 host address type hostent:addrtype
3548 length of address hostent:length
3549 list of addresses hostent:addr-list
3551 *** There are new accessors for the vectors returned by `getnet',
3552 `getnetbyaddr', `getnetbyname', and `getnetent', describing internet
3556 ========================= ===============
3557 official name of net netent:name
3558 alias list netent:aliases
3559 net number type netent:addrtype
3560 net number netent:net
3562 *** There are new accessors for the vectors returned by `getproto',
3563 `getprotobyname', `getprotobynumber', and `getprotoent', describing
3567 ========================= ===============
3568 official protocol name protoent:name
3569 alias list protoent:aliases
3570 protocol number protoent:proto
3572 *** There are new accessors for the vectors returned by `getserv',
3573 `getservbyname', `getservbyport', and `getservent', describing
3577 ========================= ===============
3578 official service name servent:name
3579 alias list servent:aliases
3580 port number servent:port
3581 protocol to use servent:proto
3583 *** There are new accessors for the sockaddr structures returned by
3584 `accept', `getsockname', `getpeername', `recvfrom!':
3587 ======================================== ===============
3588 address format (`family') sockaddr:fam
3589 path, for file domain addresses sockaddr:path
3590 address, for internet domain addresses sockaddr:addr
3591 TCP or UDP port, for internet sockaddr:port
3593 *** The `getpwent', `getgrent', `gethostent', `getnetent',
3594 `getprotoent', and `getservent' functions now return #f at the end of
3595 the user database. (They used to throw an exception.)
3597 Note that calling MUMBLEent function is equivalent to calling the
3598 corresponding MUMBLE function with no arguments.
3600 *** The `setpwent', `setgrent', `sethostent', `setnetent',
3601 `setprotoent', and `setservent' routines now take no arguments.
3603 *** The `gethost', `getproto', `getnet', and `getserv' functions now
3604 provide more useful information when they throw an exception.
3606 *** The `lnaof' function has been renamed to `inet-lnaof'.
3608 *** Guile now claims to have the `current-time' feature.
3610 *** The `mktime' function now takes an optional second argument ZONE,
3611 giving the time zone to use for the conversion. ZONE should be a
3612 string, in the same format as expected for the "TZ" environment variable.
3614 *** The `strptime' function now returns a pair (TIME . COUNT), where
3615 TIME is the parsed time as a vector, and COUNT is the number of
3616 characters from the string left unparsed. This function used to
3617 return the remaining characters as a string.
3619 *** The `gettimeofday' function has replaced the old `time+ticks' function.
3620 The return value is now (SECONDS . MICROSECONDS); the fractional
3621 component is no longer expressed in "ticks".
3623 *** The `ticks/sec' constant has been removed, in light of the above change.
3625 * Changes to the gh_ interface
3627 ** gh_eval_str() now returns an SCM object which is the result of the
3630 ** gh_scm2str() now copies the Scheme data to a caller-provided C
3633 ** gh_scm2newstr() now makes a C array, copies the Scheme data to it,
3634 and returns the array
3636 ** gh_scm2str0() is gone: there is no need to distinguish
3637 null-terminated from non-null-terminated, since gh_scm2newstr() allows
3638 the user to interpret the data both ways.
3640 * Changes to the scm_ interface
3642 ** The new function scm_symbol_value0 provides an easy way to get a
3643 symbol's value from C code:
3645 SCM scm_symbol_value0 (char *NAME)
3646 Return the value of the symbol named by the null-terminated string
3647 NAME in the current module. If the symbol named NAME is unbound in
3648 the current module, return SCM_UNDEFINED.
3650 ** The new function scm_sysintern0 creates new top-level variables,
3651 without assigning them a value.
3653 SCM scm_sysintern0 (char *NAME)
3654 Create a new Scheme top-level variable named NAME. NAME is a
3655 null-terminated string. Return the variable's value cell.
3657 ** The function scm_internal_catch is the guts of catch. It handles
3658 all the mechanics of setting up a catch target, invoking the catch
3659 body, and perhaps invoking the handler if the body does a throw.
3661 The function is designed to be usable from C code, but is general
3662 enough to implement all the semantics Guile Scheme expects from throw.
3664 TAG is the catch tag. Typically, this is a symbol, but this function
3665 doesn't actually care about that.
3667 BODY is a pointer to a C function which runs the body of the catch;
3668 this is the code you can throw from. We call it like this:
3669 BODY (BODY_DATA, JMPBUF)
3671 BODY_DATA is just the BODY_DATA argument we received; we pass it
3672 through to BODY as its first argument. The caller can make
3673 BODY_DATA point to anything useful that BODY might need.
3674 JMPBUF is the Scheme jmpbuf object corresponding to this catch,
3675 which we have just created and initialized.
3677 HANDLER is a pointer to a C function to deal with a throw to TAG,
3678 should one occur. We call it like this:
3679 HANDLER (HANDLER_DATA, THROWN_TAG, THROW_ARGS)
3681 HANDLER_DATA is the HANDLER_DATA argument we recevied; it's the
3682 same idea as BODY_DATA above.
3683 THROWN_TAG is the tag that the user threw to; usually this is
3684 TAG, but it could be something else if TAG was #t (i.e., a
3685 catch-all), or the user threw to a jmpbuf.
3686 THROW_ARGS is the list of arguments the user passed to the THROW
3689 BODY_DATA is just a pointer we pass through to BODY. HANDLER_DATA
3690 is just a pointer we pass through to HANDLER. We don't actually
3691 use either of those pointers otherwise ourselves. The idea is
3692 that, if our caller wants to communicate something to BODY or
3693 HANDLER, it can pass a pointer to it as MUMBLE_DATA, which BODY and
3694 HANDLER can then use. Think of it as a way to make BODY and
3695 HANDLER closures, not just functions; MUMBLE_DATA points to the
3698 Of course, it's up to the caller to make sure that any data a
3699 MUMBLE_DATA needs is protected from GC. A common way to do this is
3700 to make MUMBLE_DATA a pointer to data stored in an automatic
3701 structure variable; since the collector must scan the stack for
3702 references anyway, this assures that any references in MUMBLE_DATA
3705 ** The new function scm_internal_lazy_catch is exactly like
3706 scm_internal_catch, except:
3708 - It does not unwind the stack (this is the major difference).
3709 - If handler returns, its value is returned from the throw.
3710 - BODY always receives #f as its JMPBUF argument (since there's no
3711 jmpbuf associated with a lazy catch, because we don't unwind the
3714 ** scm_body_thunk is a new body function you can pass to
3715 scm_internal_catch if you want the body to be like Scheme's `catch'
3716 --- a thunk, or a function of one argument if the tag is #f.
3718 BODY_DATA is a pointer to a scm_body_thunk_data structure, which
3719 contains the Scheme procedure to invoke as the body, and the tag
3720 we're catching. If the tag is #f, then we pass JMPBUF (created by
3721 scm_internal_catch) to the body procedure; otherwise, the body gets
3724 ** scm_handle_by_proc is a new handler function you can pass to
3725 scm_internal_catch if you want the handler to act like Scheme's catch
3726 --- call a procedure with the tag and the throw arguments.
3728 If the user does a throw to this catch, this function runs a handler
3729 procedure written in Scheme. HANDLER_DATA is a pointer to an SCM
3730 variable holding the Scheme procedure object to invoke. It ought to
3731 be a pointer to an automatic variable (i.e., one living on the stack),
3732 or the procedure object should be otherwise protected from GC.
3734 ** scm_handle_by_message is a new handler function to use with
3735 `scm_internal_catch' if you want Guile to print a message and die.
3736 It's useful for dealing with throws to uncaught keys at the top level.
3738 HANDLER_DATA, if non-zero, is assumed to be a char * pointing to a
3739 message header to print; if zero, we use "guile" instead. That
3740 text is followed by a colon, then the message described by ARGS.
3742 ** The return type of scm_boot_guile is now void; the function does
3743 not return a value, and indeed, never returns at all.
3745 ** The new function scm_shell makes it easy for user applications to
3746 process command-line arguments in a way that is compatible with the
3747 stand-alone guile interpreter (which is in turn compatible with SCSH,
3750 To use the scm_shell function, first initialize any guile modules
3751 linked into your application, and then call scm_shell with the values
3752 of ARGC and ARGV your `main' function received. scm_shell will add
3753 any SCSH-style meta-arguments from the top of the script file to the
3754 argument vector, and then process the command-line arguments. This
3755 generally means loading a script file or starting up an interactive
3756 command interpreter. For details, see "Changes to the stand-alone
3759 ** The new functions scm_get_meta_args and scm_count_argv help you
3760 implement the SCSH-style meta-argument, `\'.
3762 char **scm_get_meta_args (int ARGC, char **ARGV)
3763 If the second element of ARGV is a string consisting of a single
3764 backslash character (i.e. "\\" in Scheme notation), open the file
3765 named by the following argument, parse arguments from it, and return
3766 the spliced command line. The returned array is terminated by a
3769 For details of argument parsing, see above, under "guile now accepts
3770 command-line arguments compatible with SCSH..."
3772 int scm_count_argv (char **ARGV)
3773 Count the arguments in ARGV, assuming it is terminated by a null
3776 For an example of how these functions might be used, see the source
3777 code for the function scm_shell in libguile/script.c.
3779 You will usually want to use scm_shell instead of calling this
3782 ** The new function scm_compile_shell_switches turns an array of
3783 command-line arguments into Scheme code to carry out the actions they
3784 describe. Given ARGC and ARGV, it returns a Scheme expression to
3785 evaluate, and calls scm_set_program_arguments to make any remaining
3786 command-line arguments available to the Scheme code. For example,
3787 given the following arguments:
3789 -e main -s ekko a speckled gecko
3791 scm_set_program_arguments will return the following expression:
3793 (begin (load "ekko") (main (command-line)) (quit))
3795 You will usually want to use scm_shell instead of calling this
3798 ** The function scm_shell_usage prints a usage message appropriate for
3799 an interpreter that uses scm_compile_shell_switches to handle its
3800 command-line arguments.
3802 void scm_shell_usage (int FATAL, char *MESSAGE)
3803 Print a usage message to the standard error output. If MESSAGE is
3804 non-zero, write it before the usage message, followed by a newline.
3805 If FATAL is non-zero, exit the process, using FATAL as the
3806 termination status. (If you want to be compatible with Guile,
3807 always use 1 as the exit status when terminating due to command-line
3810 You will usually want to use scm_shell instead of calling this
3813 ** scm_eval_0str now returns SCM_UNSPECIFIED if the string contains no
3814 expressions. It used to return SCM_EOL. Earth-shattering.
3816 ** The macros for declaring scheme objects in C code have been
3817 rearranged slightly. They are now:
3819 SCM_SYMBOL (C_NAME, SCHEME_NAME)
3820 Declare a static SCM variable named C_NAME, and initialize it to
3821 point to the Scheme symbol whose name is SCHEME_NAME. C_NAME should
3822 be a C identifier, and SCHEME_NAME should be a C string.
3824 SCM_GLOBAL_SYMBOL (C_NAME, SCHEME_NAME)
3825 Just like SCM_SYMBOL, but make C_NAME globally visible.
3827 SCM_VCELL (C_NAME, SCHEME_NAME)
3828 Create a global variable at the Scheme level named SCHEME_NAME.
3829 Declare a static SCM variable named C_NAME, and initialize it to
3830 point to the Scheme variable's value cell.
3832 SCM_GLOBAL_VCELL (C_NAME, SCHEME_NAME)
3833 Just like SCM_VCELL, but make C_NAME globally visible.
3835 The `guile-snarf' script writes initialization code for these macros
3836 to its standard output, given C source code as input.
3838 The SCM_GLOBAL macro is gone.
3840 ** The scm_read_line and scm_read_line_x functions have been replaced
3841 by Scheme code based on the %read-delimited! procedure (known to C
3842 code as scm_read_delimited_x). See its description above for more
3845 ** The function scm_sys_open has been renamed to scm_open. It now
3846 returns a port instead of an FD object.
3848 * The dynamic linking support has changed. For more information, see
3849 libguile/DYNAMIC-LINKING.
3854 User-visible changes from Thursday, September 5, 1996 until Guile 1.0
3857 * Changes to the 'guile' program:
3859 ** Guile now loads some new files when it starts up. Guile first
3860 searches the load path for init.scm, and loads it if found. Then, if
3861 Guile is not being used to execute a script, and the user's home
3862 directory contains a file named `.guile', Guile loads that.
3864 ** You can now use Guile as a shell script interpreter.
3866 To paraphrase the SCSH manual:
3868 When Unix tries to execute an executable file whose first two
3869 characters are the `#!', it treats the file not as machine code to
3870 be directly executed by the native processor, but as source code
3871 to be executed by some interpreter. The interpreter to use is
3872 specified immediately after the #! sequence on the first line of
3873 the source file. The kernel reads in the name of the interpreter,
3874 and executes that instead. It passes the interpreter the source
3875 filename as its first argument, with the original arguments
3876 following. Consult the Unix man page for the `exec' system call
3877 for more information.
3879 Now you can use Guile as an interpreter, using a mechanism which is a
3880 compatible subset of that provided by SCSH.
3882 Guile now recognizes a '-s' command line switch, whose argument is the
3883 name of a file of Scheme code to load. It also treats the two
3884 characters `#!' as the start of a comment, terminated by `!#'. Thus,
3885 to make a file of Scheme code directly executable by Unix, insert the
3886 following two lines at the top of the file:
3888 #!/usr/local/bin/guile -s
3891 Guile treats the argument of the `-s' command-line switch as the name
3892 of a file of Scheme code to load, and treats the sequence `#!' as the
3893 start of a block comment, terminated by `!#'.
3895 For example, here's a version of 'echo' written in Scheme:
3897 #!/usr/local/bin/guile -s
3899 (let loop ((args (cdr (program-arguments))))
3902 (display (car args))
3903 (if (pair? (cdr args))
3905 (loop (cdr args)))))
3908 Why does `#!' start a block comment terminated by `!#', instead of the
3909 end of the line? That is the notation SCSH uses, and although we
3910 don't yet support the other SCSH features that motivate that choice,
3911 we would like to be backward-compatible with any existing Guile
3912 scripts once we do. Furthermore, if the path to Guile on your system
3913 is too long for your kernel, you can start the script with this
3917 exec /really/long/path/to/guile -s "$0" ${1+"$@"}
3920 Note that some very old Unix systems don't support the `#!' syntax.
3923 ** You can now run Guile without installing it.
3925 Previous versions of the interactive Guile interpreter (`guile')
3926 couldn't start up unless Guile's Scheme library had been installed;
3927 they used the value of the environment variable `SCHEME_LOAD_PATH'
3928 later on in the startup process, but not to find the startup code
3929 itself. Now Guile uses `SCHEME_LOAD_PATH' in all searches for Scheme
3932 To run Guile without installing it, build it in the normal way, and
3933 then set the environment variable `SCHEME_LOAD_PATH' to a
3934 colon-separated list of directories, including the top-level directory
3935 of the Guile sources. For example, if you unpacked Guile so that the
3936 full filename of this NEWS file is /home/jimb/guile-1.0b3/NEWS, then
3939 export SCHEME_LOAD_PATH=/home/jimb/my-scheme:/home/jimb/guile-1.0b3
3942 ** Guile's read-eval-print loop no longer prints #<unspecified>
3943 results. If the user wants to see this, she can evaluate the
3944 expression (assert-repl-print-unspecified #t), perhaps in her startup
3947 ** Guile no longer shows backtraces by default when an error occurs;
3948 however, it does display a message saying how to get one, and how to
3949 request that they be displayed by default. After an error, evaluate
3951 to see a backtrace, and
3952 (debug-enable 'backtrace)
3953 to see them by default.
3957 * Changes to Guile Scheme:
3959 ** Guile now distinguishes between #f and the empty list.
3961 This is for compatibility with the IEEE standard, the (possibly)
3962 upcoming Revised^5 Report on Scheme, and many extant Scheme
3965 Guile used to have #f and '() denote the same object, to make Scheme's
3966 type system more compatible with Emacs Lisp's. However, the change
3967 caused too much trouble for Scheme programmers, and we found another
3968 way to reconcile Emacs Lisp with Scheme that didn't require this.
3971 ** Guile's delq, delv, delete functions, and their destructive
3972 counterparts, delq!, delv!, and delete!, now remove all matching
3973 elements from the list, not just the first. This matches the behavior
3974 of the corresponding Emacs Lisp functions, and (I believe) the Maclisp
3975 functions which inspired them.
3977 I recognize that this change may break code in subtle ways, but it
3978 seems best to make the change before the FSF's first Guile release,
3982 ** The compiled-library-path function has been deleted from libguile.
3984 ** The facilities for loading Scheme source files have changed.
3986 *** The variable %load-path now tells Guile which directories to search
3987 for Scheme code. Its value is a list of strings, each of which names
3990 *** The variable %load-extensions now tells Guile which extensions to
3991 try appending to a filename when searching the load path. Its value
3992 is a list of strings. Its default value is ("" ".scm").
3994 *** (%search-load-path FILENAME) searches the directories listed in the
3995 value of the %load-path variable for a Scheme file named FILENAME,
3996 with all the extensions listed in %load-extensions. If it finds a
3997 match, then it returns its full filename. If FILENAME is absolute, it
3998 returns it unchanged. Otherwise, it returns #f.
4000 %search-load-path will not return matches that refer to directories.
4002 *** (primitive-load FILENAME :optional CASE-INSENSITIVE-P SHARP)
4003 uses %seach-load-path to find a file named FILENAME, and loads it if
4004 it finds it. If it can't read FILENAME for any reason, it throws an
4007 The arguments CASE-INSENSITIVE-P and SHARP are interpreted as by the
4010 *** load uses the same searching semantics as primitive-load.
4012 *** The functions %try-load, try-load-with-path, %load, load-with-path,
4013 basic-try-load-with-path, basic-load-with-path, try-load-module-with-
4014 path, and load-module-with-path have been deleted. The functions
4015 above should serve their purposes.
4017 *** If the value of the variable %load-hook is a procedure,
4018 `primitive-load' applies its value to the name of the file being
4019 loaded (without the load path directory name prepended). If its value
4020 is #f, it is ignored. Otherwise, an error occurs.
4022 This is mostly useful for printing load notification messages.
4025 ** The function `eval!' is no longer accessible from the scheme level.
4026 We can't allow operations which introduce glocs into the scheme level,
4027 because Guile's type system can't handle these as data. Use `eval' or
4028 `read-and-eval!' (see below) as replacement.
4030 ** The new function read-and-eval! reads an expression from PORT,
4031 evaluates it, and returns the result. This is more efficient than
4032 simply calling `read' and `eval', since it is not necessary to make a
4033 copy of the expression for the evaluator to munge.
4035 Its optional arguments CASE_INSENSITIVE_P and SHARP are interpreted as
4036 for the `read' function.
4039 ** The function `int?' has been removed; its definition was identical
4040 to that of `integer?'.
4042 ** The functions `<?', `<?', `<=?', `=?', `>?', and `>=?'. Code should
4043 use the R4RS names for these functions.
4045 ** The function object-properties no longer returns the hash handle;
4046 it simply returns the object's property list.
4048 ** Many functions have been changed to throw errors, instead of
4049 returning #f on failure. The point of providing exception handling in
4050 the language is to simplify the logic of user code, but this is less
4051 useful if Guile's primitives don't throw exceptions.
4053 ** The function `fileno' has been renamed from `%fileno'.
4055 ** The function primitive-mode->fdes returns #t or #f now, not 1 or 0.
4058 * Changes to Guile's C interface:
4060 ** The library's initialization procedure has been simplified.
4061 scm_boot_guile now has the prototype:
4063 void scm_boot_guile (int ARGC,
4065 void (*main_func) (),
4068 scm_boot_guile calls MAIN_FUNC, passing it CLOSURE, ARGC, and ARGV.
4069 MAIN_FUNC should do all the work of the program (initializing other
4070 packages, reading user input, etc.) before returning. When MAIN_FUNC
4071 returns, call exit (0); this function never returns. If you want some
4072 other exit value, MAIN_FUNC may call exit itself.
4074 scm_boot_guile arranges for program-arguments to return the strings
4075 given by ARGC and ARGV. If MAIN_FUNC modifies ARGC/ARGV, should call
4076 scm_set_program_arguments with the final list, so Scheme code will
4077 know which arguments have been processed.
4079 scm_boot_guile establishes a catch-all catch handler which prints an
4080 error message and exits the process. This means that Guile exits in a
4081 coherent way when system errors occur and the user isn't prepared to
4082 handle it. If the user doesn't like this behavior, they can establish
4083 their own universal catcher in MAIN_FUNC to shadow this one.
4085 Why must the caller do all the real work from MAIN_FUNC? The garbage
4086 collector assumes that all local variables of type SCM will be above
4087 scm_boot_guile's stack frame on the stack. If you try to manipulate
4088 SCM values after this function returns, it's the luck of the draw
4089 whether the GC will be able to find the objects you allocate. So,
4090 scm_boot_guile function exits, rather than returning, to discourage
4091 people from making that mistake.
4093 The IN, OUT, and ERR arguments were removed; there are other
4094 convenient ways to override these when desired.
4096 The RESULT argument was deleted; this function should never return.
4098 The BOOT_CMD argument was deleted; the MAIN_FUNC argument is more
4102 ** Guile's header files should no longer conflict with your system's
4105 In order to compile code which #included <libguile.h>, previous
4106 versions of Guile required you to add a directory containing all the
4107 Guile header files to your #include path. This was a problem, since
4108 Guile's header files have names which conflict with many systems'
4111 Now only <libguile.h> need appear in your #include path; you must
4112 refer to all Guile's other header files as <libguile/mumble.h>.
4113 Guile's installation procedure puts libguile.h in $(includedir), and
4114 the rest in $(includedir)/libguile.
4117 ** Two new C functions, scm_protect_object and scm_unprotect_object,
4118 have been added to the Guile library.
4120 scm_protect_object (OBJ) protects OBJ from the garbage collector.
4121 OBJ will not be freed, even if all other references are dropped,
4122 until someone does scm_unprotect_object (OBJ). Both functions
4125 Note that calls to scm_protect_object do not nest. You can call
4126 scm_protect_object any number of times on a given object, and the
4127 next call to scm_unprotect_object will unprotect it completely.
4129 Basically, scm_protect_object and scm_unprotect_object just
4130 maintain a list of references to things. Since the GC knows about
4131 this list, all objects it mentions stay alive. scm_protect_object
4132 adds its argument to the list; scm_unprotect_object remove its
4133 argument from the list.
4136 ** scm_eval_0str now returns the value of the last expression
4139 ** The new function scm_read_0str reads an s-expression from a
4140 null-terminated string, and returns it.
4142 ** The new function `scm_stdio_to_port' converts a STDIO file pointer
4143 to a Scheme port object.
4145 ** The new function `scm_set_program_arguments' allows C code to set
4146 the value returned by the Scheme `program-arguments' function.
4151 * Guile no longer includes sophisticated Tcl/Tk support.
4153 The old Tcl/Tk support was unsatisfying to us, because it required the
4154 user to link against the Tcl library, as well as Tk and Guile. The
4155 interface was also un-lispy, in that it preserved Tcl/Tk's practice of
4156 referring to widgets by names, rather than exporting widgets to Scheme
4157 code as a special datatype.
4159 In the Usenix Tk Developer's Workshop held in July 1996, the Tcl/Tk
4160 maintainers described some very interesting changes in progress to the
4161 Tcl/Tk internals, which would facilitate clean interfaces between lone
4162 Tk and other interpreters --- even for garbage-collected languages
4163 like Scheme. They expected the new Tk to be publicly available in the
4166 Since it seems that Guile might soon have a new, cleaner interface to
4167 lone Tk, and that the old Guile/Tk glue code would probably need to be
4168 completely rewritten, we (Jim Blandy and Richard Stallman) have
4169 decided not to support the old code. We'll spend the time instead on
4170 a good interface to the newer Tk, as soon as it is available.
4172 Until then, gtcltk-lib provides trivial, low-maintenance functionality.
4175 Copyright information:
4177 Copyright (C) 1996,1997 Free Software Foundation, Inc.
4179 Permission is granted to anyone to make or distribute verbatim copies
4180 of this document as received, in any medium, provided that the
4181 copyright notice and this permission notice are preserved,
4182 thus giving the recipient permission to redistribute in turn.
4184 Permission is granted to distribute modified versions
4185 of this document, or of portions of it,
4186 under the above conditions, provided also that they
4187 carry prominent notices stating who last changed them.
4192 paragraph-separate: "[
\f]*$"