*** empty log message ***
[bpt/guile.git] / NEWS
CommitLineData
f7b47737 1Guile NEWS --- history of user-visible changes. -*- text -*-
d21ffe26 2Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
5c54da76
JB
3See the end for copying conditions.
4
e1b6c710 5Please send Guile bug reports to bug-guile@gnu.org.
5c54da76 6\f
f3227c7a
JB
7Changes since Guile 1.3:
8
6ca345f3
JB
9* Changes to mailing lists
10
11** Some of the Guile mailing lists have moved to sourceware.cygnus.com.
12
13See the README file to find current addresses for all the Guile
14mailing lists.
15
d77fb593
JB
16* Changes to the distribution
17
1d335863
JB
18** Readline support is no longer included with Guile by default.
19
20Based on the different license terms of Guile and Readline, we
21concluded that Guile should not *by default* cause the linking of
22Readline into an application program. Readline support is now offered
23as a separate module, which is linked into an application only when
24you explicitly specify it.
25
26Although Guile is GNU software, its distribution terms add a special
27exception to the usual GNU General Public License (GPL). Guile's
28license includes a clause that allows you to link Guile with non-free
29programs. We add this exception so as not to put Guile at a
30disadvantage vis-a-vis other extensibility packages that support other
31languages.
32
33In contrast, the GNU Readline library is distributed under the GNU
34General Public License pure and simple. This means that you may not
35link Readline, even dynamically, into an application unless it is
36distributed under a free software license that is compatible the GPL.
37
38Because of this difference in distribution terms, an application that
39can use Guile may not be able to use Readline. Now users will be
40explicitly offered two independent decisions about the use of these
41two packages.
d77fb593 42
0e8a8468
MV
43You can activate the readline support by issuing
44
45 (use-modules (readline-activator))
46 (activate-readline)
47
48from your ".guile" file, for example.
49
e4eae9b1
MD
50* Changes to the stand-alone interpreter
51
67ad463a
MD
52** All builtins now print as primitives.
53Previously builtin procedures not belonging to the fundamental subr
54types printed as #<compiled closure #<primitive-procedure gsubr-apply>>.
55Now, they print as #<primitive-procedure NAME>.
56
57** Backtraces slightly more intelligible.
58gsubr-apply and macro transformer application frames no longer appear
59in backtraces.
60
69c6acbb
JB
61* Changes to Scheme functions and syntax
62
2a52b429
MD
63** Guile now correctly handles internal defines by rewriting them into
64their equivalent letrec. Previously, internal defines would
65incrementally add to the innermost environment, without checking
66whether the restrictions specified in RnRS were met. This lead to the
67correct behaviour when these restriction actually were met, but didn't
68catch all illegal uses. Such an illegal use could lead to crashes of
69the Guile interpreter or or other unwanted results. An example of
70incorrect internal defines that made Guile behave erratically:
71
72 (let ()
73 (define a 1)
74 (define (b) a)
75 (define c (1+ (b)))
76 (define d 3)
77
78 (b))
79
80 => 2
81
82The problem with this example is that the definition of `c' uses the
83value of `b' directly. This confuses the meoization machine of Guile
84so that the second call of `b' (this time in a larger environment that
85also contains bindings for `c' and `d') refers to the binding of `c'
86instead of `a'. You could also make Guile crash with a variation on
87this theme:
88
89 (define (foo flag)
90 (define a 1)
91 (define (b flag) (if flag a 1))
92 (define c (1+ (b flag)))
93 (define d 3)
94
95 (b #t))
96
97 (foo #f)
98 (foo #t)
99
100From now on, Guile will issue an `Unbound variable: b' error message
101for both examples.
102
36d3d540
MD
103** Hooks
104
105A hook contains a list of functions which should be called on
106particular occasions in an existing program. Hooks are used for
107customization.
108
109A window manager might have a hook before-window-map-hook. The window
110manager uses the function run-hooks to call all functions stored in
111before-window-map-hook each time a window is mapped. The user can
112store functions in the hook using add-hook!.
113
114In Guile, hooks are first class objects.
115
116*** New function: make-hook [N_ARGS]
117
118Return a hook for hook functions which can take N_ARGS arguments.
119The default value for N_ARGS is 0.
120
ad91d6c3
MD
121(See also scm_make_named_hook below.)
122
36d3d540
MD
123*** New function: add-hook! HOOK PROC [APPEND_P]
124
125Put PROC at the beginning of the list of functions stored in HOOK.
126If APPEND_P is supplied, and non-false, put PROC at the end instead.
127
128PROC must be able to take the number of arguments specified when the
129hook was created.
130
131If PROC already exists in HOOK, then remove it first.
132
133*** New function: remove-hook! HOOK PROC
134
135Remove PROC from the list of functions in HOOK.
136
137*** New function: reset-hook! HOOK
138
139Clear the list of hook functions stored in HOOK.
140
141*** New function: run-hook HOOK ARG1 ...
142
143Run all hook functions stored in HOOK with arguments ARG1 ... .
144The number of arguments supplied must correspond to the number given
145when the hook was created.
146
56a19408
MV
147** The function `dynamic-link' now takes optional keyword arguments.
148 The only keyword argument that is currently defined is `:global
149 BOOL'. With it, you can control whether the shared library will be
150 linked in global mode or not. In global mode, the symbols from the
151 linked library can be used to resolve references from other
152 dynamically linked libraries. In non-global mode, the linked
153 library is essentially invisible and can only be accessed via
154 `dynamic-func', etc. The default is now to link in global mode.
155 Previously, the default has been non-global mode.
156
157 The `#:global' keyword is only effective on platforms that support
158 the dlopen family of functions.
159
ad226f25 160** New function `provided?'
b7e13f65
JB
161
162 - Function: provided? FEATURE
163 Return true iff FEATURE is supported by this installation of
164 Guile. FEATURE must be a symbol naming a feature; the global
165 variable `*features*' is a list of available features.
166
ad226f25
JB
167** Changes to the module (ice-9 expect):
168
169*** The expect-strings macro now matches `$' in a regular expression
170 only at a line-break or end-of-file by default. Previously it would
ab711359
JB
171 match the end of the string accumulated so far. The old behaviour
172 can be obtained by setting the variable `expect-strings-exec-flags'
173 to 0.
ad226f25
JB
174
175*** The expect-strings macro now uses a variable `expect-strings-exec-flags'
176 for the regexp-exec flags. If `regexp/noteol' is included, then `$'
177 in a regular expression will still match before a line-break or
178 end-of-file. The default is `regexp/noteol'.
179
180*** The expect-strings macro now uses a variable
181 `expect-strings-compile-flags' for the flags to be supplied to
182 `make-regexp'. The default is `regexp/newline', which was previously
183 hard-coded.
184
185*** The expect macro now supplies two arguments to a match procedure:
ab711359
JB
186 the current accumulated string and a flag to indicate whether
187 end-of-file has been reached. Previously only the string was supplied.
188 If end-of-file is reached, the match procedure will be called an
189 additional time with the same accumulated string as the previous call
190 but with the flag set.
ad226f25 191
b7e13f65
JB
192** New module (ice-9 format), implementing the Common Lisp `format' function.
193
194This code, and the documentation for it that appears here, was
195borrowed from SLIB, with minor adaptations for Guile.
196
197 - Function: format DESTINATION FORMAT-STRING . ARGUMENTS
198 An almost complete implementation of Common LISP format description
199 according to the CL reference book `Common LISP' from Guy L.
200 Steele, Digital Press. Backward compatible to most of the
201 available Scheme format implementations.
202
203 Returns `#t', `#f' or a string; has side effect of printing
204 according to FORMAT-STRING. If DESTINATION is `#t', the output is
205 to the current output port and `#t' is returned. If DESTINATION
206 is `#f', a formatted string is returned as the result of the call.
207 NEW: If DESTINATION is a string, DESTINATION is regarded as the
208 format string; FORMAT-STRING is then the first argument and the
209 output is returned as a string. If DESTINATION is a number, the
210 output is to the current error port if available by the
211 implementation. Otherwise DESTINATION must be an output port and
212 `#t' is returned.
213
214 FORMAT-STRING must be a string. In case of a formatting error
215 format returns `#f' and prints a message on the current output or
216 error port. Characters are output as if the string were output by
217 the `display' function with the exception of those prefixed by a
218 tilde (~). For a detailed description of the FORMAT-STRING syntax
219 please consult a Common LISP format reference manual. For a test
220 suite to verify this format implementation load `formatst.scm'.
221 Please send bug reports to `lutzeb@cs.tu-berlin.de'.
222
223 Note: `format' is not reentrant, i.e. only one `format'-call may
224 be executed at a time.
225
226
227*** Format Specification (Format version 3.0)
228
229 Please consult a Common LISP format reference manual for a detailed
230description of the format string syntax. For a demonstration of the
231implemented directives see `formatst.scm'.
232
233 This implementation supports directive parameters and modifiers (`:'
234and `@' characters). Multiple parameters must be separated by a comma
235(`,'). Parameters can be numerical parameters (positive or negative),
236character parameters (prefixed by a quote character (`''), variable
237parameters (`v'), number of rest arguments parameter (`#'), empty and
238default parameters. Directive characters are case independent. The
239general form of a directive is:
240
241DIRECTIVE ::= ~{DIRECTIVE-PARAMETER,}[:][@]DIRECTIVE-CHARACTER
242
243DIRECTIVE-PARAMETER ::= [ [-|+]{0-9}+ | 'CHARACTER | v | # ]
244
245*** Implemented CL Format Control Directives
246
247 Documentation syntax: Uppercase characters represent the
248corresponding control directive characters. Lowercase characters
249represent control directive parameter descriptions.
250
251`~A'
252 Any (print as `display' does).
253 `~@A'
254 left pad.
255
256 `~MINCOL,COLINC,MINPAD,PADCHARA'
257 full padding.
258
259`~S'
260 S-expression (print as `write' does).
261 `~@S'
262 left pad.
263
264 `~MINCOL,COLINC,MINPAD,PADCHARS'
265 full padding.
266
267`~D'
268 Decimal.
269 `~@D'
270 print number sign always.
271
272 `~:D'
273 print comma separated.
274
275 `~MINCOL,PADCHAR,COMMACHARD'
276 padding.
277
278`~X'
279 Hexadecimal.
280 `~@X'
281 print number sign always.
282
283 `~:X'
284 print comma separated.
285
286 `~MINCOL,PADCHAR,COMMACHARX'
287 padding.
288
289`~O'
290 Octal.
291 `~@O'
292 print number sign always.
293
294 `~:O'
295 print comma separated.
296
297 `~MINCOL,PADCHAR,COMMACHARO'
298 padding.
299
300`~B'
301 Binary.
302 `~@B'
303 print number sign always.
304
305 `~:B'
306 print comma separated.
307
308 `~MINCOL,PADCHAR,COMMACHARB'
309 padding.
310
311`~NR'
312 Radix N.
313 `~N,MINCOL,PADCHAR,COMMACHARR'
314 padding.
315
316`~@R'
317 print a number as a Roman numeral.
318
319`~:@R'
320 print a number as an "old fashioned" Roman numeral.
321
322`~:R'
323 print a number as an ordinal English number.
324
325`~:@R'
326 print a number as a cardinal English number.
327
328`~P'
329 Plural.
330 `~@P'
331 prints `y' and `ies'.
332
333 `~:P'
334 as `~P but jumps 1 argument backward.'
335
336 `~:@P'
337 as `~@P but jumps 1 argument backward.'
338
339`~C'
340 Character.
341 `~@C'
342 prints a character as the reader can understand it (i.e. `#\'
343 prefixing).
344
345 `~:C'
346 prints a character as emacs does (eg. `^C' for ASCII 03).
347
348`~F'
349 Fixed-format floating-point (prints a flonum like MMM.NNN).
350 `~WIDTH,DIGITS,SCALE,OVERFLOWCHAR,PADCHARF'
351 `~@F'
352 If the number is positive a plus sign is printed.
353
354`~E'
355 Exponential floating-point (prints a flonum like MMM.NNN`E'EE).
356 `~WIDTH,DIGITS,EXPONENTDIGITS,SCALE,OVERFLOWCHAR,PADCHAR,EXPONENTCHARE'
357 `~@E'
358 If the number is positive a plus sign is printed.
359
360`~G'
361 General floating-point (prints a flonum either fixed or
362 exponential).
363 `~WIDTH,DIGITS,EXPONENTDIGITS,SCALE,OVERFLOWCHAR,PADCHAR,EXPONENTCHARG'
364 `~@G'
365 If the number is positive a plus sign is printed.
366
367`~$'
368 Dollars floating-point (prints a flonum in fixed with signs
369 separated).
370 `~DIGITS,SCALE,WIDTH,PADCHAR$'
371 `~@$'
372 If the number is positive a plus sign is printed.
373
374 `~:@$'
375 A sign is always printed and appears before the padding.
376
377 `~:$'
378 The sign appears before the padding.
379
380`~%'
381 Newline.
382 `~N%'
383 print N newlines.
384
385`~&'
386 print newline if not at the beginning of the output line.
387 `~N&'
388 prints `~&' and then N-1 newlines.
389
390`~|'
391 Page Separator.
392 `~N|'
393 print N page separators.
394
395`~~'
396 Tilde.
397 `~N~'
398 print N tildes.
399
400`~'<newline>
401 Continuation Line.
402 `~:'<newline>
403 newline is ignored, white space left.
404
405 `~@'<newline>
406 newline is left, white space ignored.
407
408`~T'
409 Tabulation.
410 `~@T'
411 relative tabulation.
412
413 `~COLNUM,COLINCT'
414 full tabulation.
415
416`~?'
417 Indirection (expects indirect arguments as a list).
418 `~@?'
419 extracts indirect arguments from format arguments.
420
421`~(STR~)'
422 Case conversion (converts by `string-downcase').
423 `~:(STR~)'
424 converts by `string-capitalize'.
425
426 `~@(STR~)'
427 converts by `string-capitalize-first'.
428
429 `~:@(STR~)'
430 converts by `string-upcase'.
431
432`~*'
433 Argument Jumping (jumps 1 argument forward).
434 `~N*'
435 jumps N arguments forward.
436
437 `~:*'
438 jumps 1 argument backward.
439
440 `~N:*'
441 jumps N arguments backward.
442
443 `~@*'
444 jumps to the 0th argument.
445
446 `~N@*'
447 jumps to the Nth argument (beginning from 0)
448
449`~[STR0~;STR1~;...~;STRN~]'
450 Conditional Expression (numerical clause conditional).
451 `~N['
452 take argument from N.
453
454 `~@['
455 true test conditional.
456
457 `~:['
458 if-else-then conditional.
459
460 `~;'
461 clause separator.
462
463 `~:;'
464 default clause follows.
465
466`~{STR~}'
467 Iteration (args come from the next argument (a list)).
468 `~N{'
469 at most N iterations.
470
471 `~:{'
472 args from next arg (a list of lists).
473
474 `~@{'
475 args from the rest of arguments.
476
477 `~:@{'
478 args from the rest args (lists).
479
480`~^'
481 Up and out.
482 `~N^'
483 aborts if N = 0
484
485 `~N,M^'
486 aborts if N = M
487
488 `~N,M,K^'
489 aborts if N <= M <= K
490
491*** Not Implemented CL Format Control Directives
492
493`~:A'
494 print `#f' as an empty list (see below).
495
496`~:S'
497 print `#f' as an empty list (see below).
498
499`~<~>'
500 Justification.
501
502`~:^'
503 (sorry I don't understand its semantics completely)
504
505*** Extended, Replaced and Additional Control Directives
506
507`~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHD'
508`~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHX'
509`~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHO'
510`~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHB'
511`~N,MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHR'
512 COMMAWIDTH is the number of characters between two comma
513 characters.
514
515`~I'
516 print a R4RS complex number as `~F~@Fi' with passed parameters for
517 `~F'.
518
519`~Y'
520 Pretty print formatting of an argument for scheme code lists.
521
522`~K'
523 Same as `~?.'
524
525`~!'
526 Flushes the output if format DESTINATION is a port.
527
528`~_'
529 Print a `#\space' character
530 `~N_'
531 print N `#\space' characters.
532
533`~/'
534 Print a `#\tab' character
535 `~N/'
536 print N `#\tab' characters.
537
538`~NC'
539 Takes N as an integer representation for a character. No arguments
540 are consumed. N is converted to a character by `integer->char'. N
541 must be a positive decimal number.
542
543`~:S'
544 Print out readproof. Prints out internal objects represented as
545 `#<...>' as strings `"#<...>"' so that the format output can always
546 be processed by `read'.
547
548`~:A'
549 Print out readproof. Prints out internal objects represented as
550 `#<...>' as strings `"#<...>"' so that the format output can always
551 be processed by `read'.
552
553`~Q'
554 Prints information and a copyright notice on the format
555 implementation.
556 `~:Q'
557 prints format version.
558
559`~F, ~E, ~G, ~$'
560 may also print number strings, i.e. passing a number as a string
561 and format it accordingly.
562
563*** Configuration Variables
564
565 The format module exports some configuration variables to suit the
566systems and users needs. There should be no modification necessary for
567the configuration that comes with Guile. Format detects automatically
568if the running scheme system implements floating point numbers and
569complex numbers.
570
571format:symbol-case-conv
572 Symbols are converted by `symbol->string' so the case type of the
573 printed symbols is implementation dependent.
574 `format:symbol-case-conv' is a one arg closure which is either
575 `#f' (no conversion), `string-upcase', `string-downcase' or
576 `string-capitalize'. (default `#f')
577
578format:iobj-case-conv
579 As FORMAT:SYMBOL-CASE-CONV but applies for the representation of
580 implementation internal objects. (default `#f')
581
582format:expch
583 The character prefixing the exponent value in `~E' printing.
584 (default `#\E')
585
586*** Compatibility With Other Format Implementations
587
588SLIB format 2.x:
589 See `format.doc'.
590
591SLIB format 1.4:
592 Downward compatible except for padding support and `~A', `~S',
593 `~P', `~X' uppercase printing. SLIB format 1.4 uses C-style
594 `printf' padding support which is completely replaced by the CL
595 `format' padding style.
596
597MIT C-Scheme 7.1:
598 Downward compatible except for `~', which is not documented
599 (ignores all characters inside the format string up to a newline
600 character). (7.1 implements `~a', `~s', ~NEWLINE, `~~', `~%',
601 numerical and variable parameters and `:/@' modifiers in the CL
602 sense).
603
604Elk 1.5/2.0:
605 Downward compatible except for `~A' and `~S' which print in
606 uppercase. (Elk implements `~a', `~s', `~~', and `~%' (no
607 directive parameters or modifiers)).
608
609Scheme->C 01nov91:
610 Downward compatible except for an optional destination parameter:
611 S2C accepts a format call without a destination which returns a
612 formatted string. This is equivalent to a #f destination in S2C.
613 (S2C implements `~a', `~s', `~c', `~%', and `~~' (no directive
614 parameters or modifiers)).
615
616
e7d37b0a 617** Changes to string-handling functions.
b7e13f65 618
e7d37b0a 619These functions were added to support the (ice-9 format) module, above.
b7e13f65 620
e7d37b0a
JB
621*** New function: string-upcase STRING
622*** New function: string-downcase STRING
b7e13f65 623
e7d37b0a
JB
624These are non-destructive versions of the existing string-upcase! and
625string-downcase! functions.
b7e13f65 626
e7d37b0a
JB
627*** New function: string-capitalize! STRING
628*** New function: string-capitalize STRING
629
630These functions convert the first letter of each word in the string to
631upper case. Thus:
632
633 (string-capitalize "howdy there")
634 => "Howdy There"
635
636As with the other functions, string-capitalize! modifies the string in
637place, while string-capitalize returns a modified copy of its argument.
638
639*** New function: string-ci->symbol STRING
640
641Return a symbol whose name is STRING, but having the same case as if
642the symbol had be read by `read'.
643
644Guile can be configured to be sensitive or insensitive to case
645differences in Scheme identifiers. If Guile is case-insensitive, all
646symbols are converted to lower case on input. The `string-ci->symbol'
647function returns a symbol whose name in STRING, transformed as Guile
648would if STRING were input.
649
650*** New function: substring-move! STRING1 START END STRING2 START
651
652Copy the substring of STRING1 from START (inclusive) to END
653(exclusive) to STRING2 at START. STRING1 and STRING2 may be the same
654string, and the source and destination areas may overlap; in all
655cases, the function behaves as if all the characters were copied
656simultanously.
657
658*** Extended functions: substring-move-left! substring-move-right!
659
660These functions now correctly copy arbitrarily overlapping substrings;
661they are both synonyms for substring-move!.
b7e13f65 662
b7e13f65 663
deaceb4e
JB
664** New module (ice-9 getopt-long), with the function `getopt-long'.
665
666getopt-long is a function for parsing command-line arguments in a
667manner consistent with other GNU programs.
668
669(getopt-long ARGS GRAMMAR)
670Parse the arguments ARGS according to the argument list grammar GRAMMAR.
671
672ARGS should be a list of strings. Its first element should be the
673name of the program; subsequent elements should be the arguments
674that were passed to the program on the command line. The
675`program-arguments' procedure returns a list of this form.
676
677GRAMMAR is a list of the form:
678((OPTION (PROPERTY VALUE) ...) ...)
679
680Each OPTION should be a symbol. `getopt-long' will accept a
681command-line option named `--OPTION'.
682Each option can have the following (PROPERTY VALUE) pairs:
683
684 (single-char CHAR) --- Accept `-CHAR' as a single-character
685 equivalent to `--OPTION'. This is how to specify traditional
686 Unix-style flags.
687 (required? BOOL) --- If BOOL is true, the option is required.
688 getopt-long will raise an error if it is not found in ARGS.
689 (value BOOL) --- If BOOL is #t, the option accepts a value; if
690 it is #f, it does not; and if it is the symbol
691 `optional', the option may appear in ARGS with or
692 without a value.
693 (predicate FUNC) --- If the option accepts a value (i.e. you
694 specified `(value #t)' for this option), then getopt
695 will apply FUNC to the value, and throw an exception
696 if it returns #f. FUNC should be a procedure which
697 accepts a string and returns a boolean value; you may
698 need to use quasiquotes to get it into GRAMMAR.
699
700The (PROPERTY VALUE) pairs may occur in any order, but each
701property may occur only once. By default, options do not have
702single-character equivalents, are not required, and do not take
703values.
704
705In ARGS, single-character options may be combined, in the usual
706Unix fashion: ("-x" "-y") is equivalent to ("-xy"). If an option
707accepts values, then it must be the last option in the
708combination; the value is the next argument. So, for example, using
709the following grammar:
710 ((apples (single-char #\a))
711 (blimps (single-char #\b) (value #t))
712 (catalexis (single-char #\c) (value #t)))
713the following argument lists would be acceptable:
714 ("-a" "-b" "bang" "-c" "couth") ("bang" and "couth" are the values
715 for "blimps" and "catalexis")
716 ("-ab" "bang" "-c" "couth") (same)
717 ("-ac" "couth" "-b" "bang") (same)
718 ("-abc" "couth" "bang") (an error, since `-b' is not the
719 last option in its combination)
720
721If an option's value is optional, then `getopt-long' decides
722whether it has a value by looking at what follows it in ARGS. If
723the next element is a string, and it does not appear to be an
724option itself, then that string is the option's value.
725
726The value of a long option can appear as the next element in ARGS,
727or it can follow the option name, separated by an `=' character.
728Thus, using the same grammar as above, the following argument lists
729are equivalent:
730 ("--apples" "Braeburn" "--blimps" "Goodyear")
731 ("--apples=Braeburn" "--blimps" "Goodyear")
732 ("--blimps" "Goodyear" "--apples=Braeburn")
733
734If the option "--" appears in ARGS, argument parsing stops there;
735subsequent arguments are returned as ordinary arguments, even if
736they resemble options. So, in the argument list:
737 ("--apples" "Granny Smith" "--" "--blimp" "Goodyear")
738`getopt-long' will recognize the `apples' option as having the
739value "Granny Smith", but it will not recognize the `blimp'
740option; it will return the strings "--blimp" and "Goodyear" as
741ordinary argument strings.
742
743The `getopt-long' function returns the parsed argument list as an
744assocation list, mapping option names --- the symbols from GRAMMAR
745--- onto their values, or #t if the option does not accept a value.
746Unused options do not appear in the alist.
747
748All arguments that are not the value of any option are returned
749as a list, associated with the empty list.
750
751`getopt-long' throws an exception if:
752- it finds an unrecognized option in ARGS
753- a required option is omitted
754- an option that requires an argument doesn't get one
755- an option that doesn't accept an argument does get one (this can
756 only happen using the long option `--opt=value' syntax)
757- an option predicate fails
758
759So, for example:
760
761(define grammar
762 `((lockfile-dir (required? #t)
763 (value #t)
764 (single-char #\k)
765 (predicate ,file-is-directory?))
766 (verbose (required? #f)
767 (single-char #\v)
768 (value #f))
769 (x-includes (single-char #\x))
770 (rnet-server (single-char #\y)
771 (predicate ,string?))))
772
773(getopt-long '("my-prog" "-vk" "/tmp" "foo1" "--x-includes=/usr/include"
774 "--rnet-server=lamprod" "--" "-fred" "foo2" "foo3")
775 grammar)
776=> ((() "foo1" "-fred" "foo2" "foo3")
777 (rnet-server . "lamprod")
778 (x-includes . "/usr/include")
779 (lockfile-dir . "/tmp")
780 (verbose . #t))
781
782** The (ice-9 getopt-gnu-style) module is obsolete; use (ice-9 getopt-long).
783
784It will be removed in a few releases.
785
08394899
MS
786** New syntax: lambda*
787** New syntax: define*
788** New syntax: define*-public
789** New syntax: defmacro*
790** New syntax: defmacro*-public
791Guile now supports optional arguments.
792
793`lambda*', `define*', `define*-public', `defmacro*' and
794`defmacro*-public' are identical to the non-* versions except that
795they use an extended type of parameter list that has the following BNF
796syntax (parentheses are literal, square brackets indicate grouping,
797and `*', `+' and `?' have the usual meaning):
798
799 ext-param-list ::= ( [identifier]* [#&optional [ext-var-decl]+]?
800 [#&key [ext-var-decl]+ [#&allow-other-keys]?]?
801 [[#&rest identifier]|[. identifier]]? ) | [identifier]
802
803 ext-var-decl ::= identifier | ( identifier expression )
804
805The semantics are best illustrated with the following documentation
806and examples for `lambda*':
807
808 lambda* args . body
809 lambda extended for optional and keyword arguments
810
811 lambda* creates a procedure that takes optional arguments. These
812 are specified by putting them inside brackets at the end of the
813 paramater list, but before any dotted rest argument. For example,
814 (lambda* (a b #&optional c d . e) '())
815 creates a procedure with fixed arguments a and b, optional arguments c
816 and d, and rest argument e. If the optional arguments are omitted
817 in a call, the variables for them are unbound in the procedure. This
818 can be checked with the bound? macro.
819
820 lambda* can also take keyword arguments. For example, a procedure
821 defined like this:
822 (lambda* (#&key xyzzy larch) '())
823 can be called with any of the argument lists (#:xyzzy 11)
824 (#:larch 13) (#:larch 42 #:xyzzy 19) (). Whichever arguments
825 are given as keywords are bound to values.
826
827 Optional and keyword arguments can also be given default values
828 which they take on when they are not present in a call, by giving a
829 two-item list in place of an optional argument, for example in:
830 (lambda* (foo #&optional (bar 42) #&key (baz 73)) (list foo bar baz))
831 foo is a fixed argument, bar is an optional argument with default
832 value 42, and baz is a keyword argument with default value 73.
833 Default value expressions are not evaluated unless they are needed
834 and until the procedure is called.
835
836 lambda* now supports two more special parameter list keywords.
837
838 lambda*-defined procedures now throw an error by default if a
839 keyword other than one of those specified is found in the actual
840 passed arguments. However, specifying #&allow-other-keys
841 immediately after the kyword argument declarations restores the
842 previous behavior of ignoring unknown keywords. lambda* also now
843 guarantees that if the same keyword is passed more than once, the
844 last one passed is the one that takes effect. For example,
845 ((lambda* (#&key (heads 0) (tails 0)) (display (list heads tails)))
846 #:heads 37 #:tails 42 #:heads 99)
847 would result in (99 47) being displayed.
848
849 #&rest is also now provided as a synonym for the dotted syntax rest
850 argument. The argument lists (a . b) and (a #&rest b) are equivalent in
851 all respects to lambda*. This is provided for more similarity to DSSSL,
852 MIT-Scheme and Kawa among others, as well as for refugees from other
853 Lisp dialects.
854
855Further documentation may be found in the optargs.scm file itself.
856
857The optional argument module also exports the macros `let-optional',
858`let-optional*', `let-keywords', `let-keywords*' and `bound?'. These
859are not documented here because they may be removed in the future, but
860full documentation is still available in optargs.scm.
861
2e132553
JB
862** New syntax: and-let*
863Guile now supports the `and-let*' form, described in the draft SRFI-2.
864
865Syntax: (land* (<clause> ...) <body> ...)
866Each <clause> should have one of the following forms:
867 (<variable> <expression>)
868 (<expression>)
869 <bound-variable>
870Each <variable> or <bound-variable> should be an identifier. Each
871<expression> should be a valid expression. The <body> should be a
872possibly empty sequence of expressions, like the <body> of a
873lambda form.
874
875Semantics: A LAND* expression is evaluated by evaluating the
876<expression> or <bound-variable> of each of the <clause>s from
877left to right. The value of the first <expression> or
878<bound-variable> that evaluates to a false value is returned; the
879remaining <expression>s and <bound-variable>s are not evaluated.
880The <body> forms are evaluated iff all the <expression>s and
881<bound-variable>s evaluate to true values.
882
883The <expression>s and the <body> are evaluated in an environment
884binding each <variable> of the preceding (<variable> <expression>)
885clauses to the value of the <expression>. Later bindings
886shadow earlier bindings.
887
888Guile's and-let* macro was contributed by Michael Livshin.
889
36d3d540
MD
890** New sorting functions
891
892*** New function: sorted? SEQUENCE LESS?
ed8c8636
MD
893Returns `#t' when the sequence argument is in non-decreasing order
894according to LESS? (that is, there is no adjacent pair `... x y
895...' for which `(less? y x)').
896
897Returns `#f' when the sequence contains at least one out-of-order
898pair. It is an error if the sequence is neither a list nor a
899vector.
900
36d3d540 901*** New function: merge LIST1 LIST2 LESS?
ed8c8636
MD
902LIST1 and LIST2 are sorted lists.
903Returns the sorted list of all elements in LIST1 and LIST2.
904
905Assume that the elements a and b1 in LIST1 and b2 in LIST2 are "equal"
906in the sense that (LESS? x y) --> #f for x, y in {a, b1, b2},
907and that a < b1 in LIST1. Then a < b1 < b2 in the result.
908(Here "<" should read "comes before".)
909
36d3d540 910*** New procedure: merge! LIST1 LIST2 LESS?
ed8c8636
MD
911Merges two lists, re-using the pairs of LIST1 and LIST2 to build
912the result. If the code is compiled, and LESS? constructs no new
913pairs, no pairs at all will be allocated. The first pair of the
914result will be either the first pair of LIST1 or the first pair of
915LIST2.
916
36d3d540 917*** New function: sort SEQUENCE LESS?
ed8c8636
MD
918Accepts either a list or a vector, and returns a new sequence
919which is sorted. The new sequence is the same type as the input.
920Always `(sorted? (sort sequence less?) less?)'. The original
921sequence is not altered in any way. The new sequence shares its
922elements with the old one; no elements are copied.
923
36d3d540 924*** New procedure: sort! SEQUENCE LESS
ed8c8636
MD
925Returns its sorted result in the original boxes. No new storage is
926allocated at all. Proper usage: (set! slist (sort! slist <))
927
36d3d540 928*** New function: stable-sort SEQUENCE LESS?
ed8c8636
MD
929Similar to `sort' but stable. That is, if "equal" elements are
930ordered a < b in the original sequence, they will have the same order
931in the result.
932
36d3d540 933*** New function: stable-sort! SEQUENCE LESS?
ed8c8636
MD
934Similar to `sort!' but stable.
935Uses temporary storage when sorting vectors.
936
36d3d540 937*** New functions: sort-list, sort-list!
ed8c8636
MD
938Added for compatibility with scsh.
939
36d3d540
MD
940** New built-in random number support
941
942*** New function: random N [STATE]
3e8370c3
MD
943Accepts a positive integer or real N and returns a number of the
944same type between zero (inclusive) and N (exclusive). The values
945returned have a uniform distribution.
946
947The optional argument STATE must be of the type produced by
416075f1
MD
948`copy-random-state' or `seed->random-state'. It defaults to the value
949of the variable `*random-state*'. This object is used to maintain the
950state of the pseudo-random-number generator and is altered as a side
951effect of the `random' operation.
3e8370c3 952
36d3d540 953*** New variable: *random-state*
3e8370c3
MD
954Holds a data structure that encodes the internal state of the
955random-number generator that `random' uses by default. The nature
956of this data structure is implementation-dependent. It may be
957printed out and successfully read back in, but may or may not
958function correctly as a random-number state object in another
959implementation.
960
36d3d540 961*** New function: copy-random-state [STATE]
3e8370c3
MD
962Returns a new object of type suitable for use as the value of the
963variable `*random-state*' and as a second argument to `random'.
964If argument STATE is given, a copy of it is returned. Otherwise a
965copy of `*random-state*' is returned.
416075f1 966
36d3d540 967*** New function: seed->random-state SEED
416075f1
MD
968Returns a new object of type suitable for use as the value of the
969variable `*random-state*' and as a second argument to `random'.
970SEED is a string or a number. A new state is generated and
971initialized using SEED.
3e8370c3 972
36d3d540 973*** New function: random:uniform [STATE]
3e8370c3
MD
974Returns an uniformly distributed inexact real random number in the
975range between 0 and 1.
976
36d3d540 977*** New procedure: random:solid-sphere! VECT [STATE]
3e8370c3
MD
978Fills VECT with inexact real random numbers the sum of whose
979squares is less than 1.0. Thinking of VECT as coordinates in
980space of dimension N = `(vector-length VECT)', the coordinates are
981uniformly distributed within the unit N-shere. The sum of the
982squares of the numbers is returned. VECT can be either a vector
983or a uniform vector of doubles.
984
36d3d540 985*** New procedure: random:hollow-sphere! VECT [STATE]
3e8370c3
MD
986Fills VECT with inexact real random numbers the sum of whose squares
987is equal to 1.0. Thinking of VECT as coordinates in space of
988dimension n = `(vector-length VECT)', the coordinates are uniformly
989distributed over the surface of the unit n-shere. VECT can be either
990a vector or a uniform vector of doubles.
991
36d3d540 992*** New function: random:normal [STATE]
3e8370c3
MD
993Returns an inexact real in a normal distribution with mean 0 and
994standard deviation 1. For a normal distribution with mean M and
995standard deviation D use `(+ M (* D (random:normal)))'.
996
36d3d540 997*** New procedure: random:normal-vector! VECT [STATE]
3e8370c3
MD
998Fills VECT with inexact real random numbers which are independent and
999standard normally distributed (i.e., with mean 0 and variance 1).
1000VECT can be either a vector or a uniform vector of doubles.
1001
36d3d540 1002*** New function: random:exp STATE
3e8370c3
MD
1003Returns an inexact real in an exponential distribution with mean 1.
1004For an exponential distribution with mean U use (* U (random:exp)).
1005
69c6acbb
JB
1006** The range of logand, logior, logxor, logtest, and logbit? have changed.
1007
1008These functions now operate on numbers in the range of a C unsigned
1009long.
1010
1011These functions used to operate on numbers in the range of a C signed
1012long; however, this seems inappropriate, because Guile integers don't
1013overflow.
1014
ba4ee0d6
MD
1015** New function: make-guardian
1016This is an implementation of guardians as described in
1017R. Kent Dybvig, Carl Bruggeman, and David Eby (1993) "Guardians in a
1018Generation-Based Garbage Collector" ACM SIGPLAN Conference on
1019Programming Language Design and Implementation, June 1993
1020ftp://ftp.cs.indiana.edu/pub/scheme-repository/doc/pubs/guardians.ps.gz
1021
88ceea5c
MD
1022** New functions: delq1!, delv1!, delete1!
1023These procedures behave similar to delq! and friends but delete only
1024one object if at all.
1025
55254a6a
MD
1026** New function: unread-string STRING PORT
1027Unread STRING to PORT, that is, push it back onto the port so that
1028next read operation will work on the pushed back characters.
1029
1030** unread-char can now be called multiple times
1031If unread-char is called multiple times, the unread characters will be
1032read again in last-in first-out order.
1033
9e97c52d
GH
1034** the procedures uniform-array-read! and uniform-array-write! now
1035work on any kind of port, not just ports which are open on a file.
1036
1037** now 'l' in a port mode requests line buffering.
1038
69bc9ff3
GH
1039** The procedure truncate-file now works on string ports as well
1040as file ports. If the size argument is omitted, the current
1b9c3dae 1041file position is used.
9e97c52d 1042
c94577b4 1043** new procedure: seek PORT/FDES OFFSET WHENCE
9e97c52d
GH
1044The arguments are the same as for the old fseek procedure, but it
1045works on string ports as well as random-access file ports.
1046
1047** the fseek procedure now works on string ports, since it has been
c94577b4 1048redefined using seek.
9e97c52d
GH
1049
1050** the setvbuf procedure now uses a default size if mode is _IOFBF and
1051size is not supplied.
1052
1053** the newline procedure no longer flushes the port if it's not
1054line-buffered: previously it did if it was the current output port.
1055
1056** open-pipe and close-pipe are no longer primitive procedures, but
1057an emulation can be obtained using `(use-modules (ice-9 popen))'.
1058
1059** the freopen procedure has been removed.
1060
1061** new procedure: drain-input PORT
1062Drains PORT's read buffers (including any pushed-back characters)
1063and returns the contents as a single string.
1064
67ad463a 1065** New function: map-in-order PROC LIST1 LIST2 ...
d41b3904
MD
1066Version of `map' which guarantees that the procedure is applied to the
1067lists in serial order.
1068
67ad463a
MD
1069** Renamed `serial-array-copy!' and `serial-array-map!' to
1070`array-copy-in-order!' and `array-map-in-order!'. The old names are
1071now obsolete and will go away in release 1.5.
1072
cf7132b3 1073** New syntax: collect BODY1 ...
d41b3904
MD
1074Version of `begin' which returns a list of the results of the body
1075forms instead of the result of the last body form. In contrast to
cf7132b3 1076`begin', `collect' allows an empty body.
d41b3904 1077
e4eae9b1
MD
1078** New functions: read-history FILENAME, write-history FILENAME
1079Read/write command line history from/to file. Returns #t on success
1080and #f if an error occured.
1081
d21ffe26
JB
1082** `ls' and `lls' in module (ice-9 ls) now handle no arguments.
1083
1084These procedures return a list of definitions available in the specified
1085argument, a relative module reference. In the case of no argument,
1086`(current-module)' is now consulted for definitions to return, instead
1087of simply returning #f, the former behavior.
1088
f8c9d497
JB
1089** The #/ syntax for lists is no longer supported.
1090
1091Earlier versions of Scheme accepted this syntax, but printed a
1092warning.
1093
1094** Guile no longer consults the SCHEME_LOAD_PATH environment variable.
1095
1096Instead, you should set GUILE_LOAD_PATH to tell Guile where to find
1097modules.
1098
3ffc7a36
MD
1099* Changes to the gh_ interface
1100
1101** gh_scm2doubles
1102
1103Now takes a second argument which is the result array. If this
1104pointer is NULL, a new array is malloced (the old behaviour).
1105
1106** gh_chars2byvect, gh_shorts2svect, gh_floats2fvect, gh_scm2chars,
1107 gh_scm2shorts, gh_scm2longs, gh_scm2floats
1108
1109New functions.
1110
3e8370c3
MD
1111* Changes to the scm_ interface
1112
ad91d6c3
MD
1113** Function: scm_make_named_hook (char* name, int n_args)
1114
1115Creates a hook in the same way as make-hook above but also
1116binds a variable named NAME to it.
1117
1118This is the typical way of creating a hook from C code.
1119
1120Currently, the variable is created in the root module. This will
1121change when we get the new module system.
1122
16a5a9a4
MD
1123** The smob interface
1124
1125The interface for creating smobs has changed. For documentation, see
1126data-rep.info (made from guile-core/doc/data-rep.texi).
1127
1128*** Deprecated function: SCM scm_newsmob (scm_smobfuns *)
1129
1130>>> This function will be removed in 1.3.4. <<<
1131
1132It is replaced by:
1133
1134*** Function: SCM scm_make_smob_type (const char *name, scm_sizet size)
1135This function adds a new smob type, named NAME, with instance size
1136SIZE to the system. The return value is a tag that is used in
1137creating instances of the type. If SIZE is 0, then no memory will
1138be allocated when instances of the smob are created, and nothing
1139will be freed by the default free function.
1140
1141*** Function: void scm_set_smob_mark (long tc, SCM (*mark) (SCM))
1142This function sets the smob marking procedure for the smob type
1143specified by the tag TC. TC is the tag returned by
1144`scm_make_smob_type'.
1145
1146*** Function: void scm_set_smob_free (long tc, SCM (*mark) (SCM))
1147This function sets the smob freeing procedure for the smob type
1148specified by the tag TC. TC is the tag returned by
1149`scm_make_smob_type'.
1150
1151*** Function: void scm_set_smob_print (tc, print)
1152
1153 - Function: void scm_set_smob_print (long tc,
1154 scm_sizet (*print) (SCM,
1155 SCM,
1156 scm_print_state *))
1157
1158This function sets the smob printing procedure for the smob type
1159specified by the tag TC. TC is the tag returned by
1160`scm_make_smob_type'.
1161
1162*** Function: void scm_set_smob_equalp (long tc, SCM (*equalp) (SCM, SCM))
1163This function sets the smob equality-testing predicate for the
1164smob type specified by the tag TC. TC is the tag returned by
1165`scm_make_smob_type'.
1166
1167*** Macro: void SCM_NEWSMOB (SCM var, long tc, void *data)
1168Make VALUE contain a smob instance of the type with type code TC and
1169smob data DATA. VALUE must be previously declared as C type `SCM'.
1170
1171*** Macro: fn_returns SCM_RETURN_NEWSMOB (long tc, void *data)
1172This macro expands to a block of code that creates a smob instance
1173of the type with type code TC and smob data DATA, and returns that
1174`SCM' value. It should be the last piece of code in a block.
1175
9e97c52d
GH
1176** The interfaces for using I/O ports and implementing port types
1177(ptobs) have changed significantly. The new interface is based on
1178shared access to buffers and a new set of ptob procedures.
1179
16a5a9a4
MD
1180*** scm_newptob has been removed
1181
1182It is replaced by:
1183
1184*** Function: SCM scm_make_port_type (type_name, fill_buffer, write_flush)
1185
1186- Function: SCM scm_make_port_type (char *type_name,
1187 int (*fill_buffer) (SCM port),
1188 void (*write_flush) (SCM port));
1189
1190Similarly to the new smob interface, there is a set of function
1191setters by which the user can customize the behaviour of his port
544e9093 1192type. See ports.h (scm_set_port_XXX).
16a5a9a4 1193
9e97c52d
GH
1194** scm_strport_to_string: New function: creates a new string from
1195a string port's buffer.
1196
3e8370c3
MD
1197** Plug in interface for random number generators
1198The variable `scm_the_rng' in random.c contains a value and three
1199function pointers which together define the current random number
1200generator being used by the Scheme level interface and the random
1201number library functions.
1202
1203The user is free to replace the default generator with the generator
1204of his own choice.
1205
1206*** Variable: size_t scm_the_rng.rstate_size
1207The size of the random state type used by the current RNG
1208measured in chars.
1209
1210*** Function: unsigned long scm_the_rng.random_bits (scm_rstate *STATE)
1211Given the random STATE, return 32 random bits.
1212
1213*** Function: void scm_the_rng.init_rstate (scm_rstate *STATE, chars *S, int N)
1214Seed random state STATE using string S of length N.
1215
1216*** Function: scm_rstate *scm_the_rng.copy_rstate (scm_rstate *STATE)
1217Given random state STATE, return a malloced copy.
1218
1219** Default RNG
1220The default RNG is the MWC (Multiply With Carry) random number
1221generator described by George Marsaglia at the Department of
1222Statistics and Supercomputer Computations Research Institute, The
1223Florida State University (http://stat.fsu.edu/~geo).
1224
1225It uses 64 bits, has a period of 4578426017172946943 (4.6e18), and
1226passes all tests in the DIEHARD test suite
1227(http://stat.fsu.edu/~geo/diehard.html). The generation of 32 bits
1228costs one multiply and one add on platforms which either supports long
1229longs (gcc does this on most systems) or have 64 bit longs. The cost
1230is four multiply on other systems but this can be optimized by writing
1231scm_i_uniform32 in assembler.
1232
1233These functions are provided through the scm_the_rng interface for use
1234by libguile and the application.
1235
1236*** Function: unsigned long scm_i_uniform32 (scm_i_rstate *STATE)
1237Given the random STATE, return 32 random bits.
1238Don't use this function directly. Instead go through the plugin
1239interface (see "Plug in interface" above).
1240
1241*** Function: void scm_i_init_rstate (scm_i_rstate *STATE, char *SEED, int N)
1242Initialize STATE using SEED of length N.
1243
1244*** Function: scm_i_rstate *scm_i_copy_rstate (scm_i_rstate *STATE)
1245Return a malloc:ed copy of STATE. This function can easily be re-used
1246in the interfaces to other RNGs.
1247
1248** Random number library functions
1249These functions use the current RNG through the scm_the_rng interface.
1250It might be a good idea to use these functions from your C code so
1251that only one random generator is used by all code in your program.
1252
259529f2 1253The default random state is stored in:
3e8370c3
MD
1254
1255*** Variable: SCM scm_var_random_state
1256Contains the vcell of the Scheme variable "*random-state*" which is
1257used as default state by all random number functions in the Scheme
1258level interface.
1259
1260Example:
1261
259529f2 1262 double x = scm_c_uniform01 (SCM_RSTATE (SCM_CDR (scm_var_random_state)));
3e8370c3 1263
259529f2
MD
1264*** Function: scm_rstate *scm_c_default_rstate (void)
1265This is a convenience function which returns the value of
1266scm_var_random_state. An error message is generated if this value
1267isn't a random state.
1268
1269*** Function: scm_rstate *scm_c_make_rstate (char *SEED, int LENGTH)
1270Make a new random state from the string SEED of length LENGTH.
1271
1272It is generally not a good idea to use multiple random states in a
1273program. While subsequent random numbers generated from one random
1274state are guaranteed to be reasonably independent, there is no such
1275guarantee for numbers generated from different random states.
1276
1277*** Macro: unsigned long scm_c_uniform32 (scm_rstate *STATE)
1278Return 32 random bits.
1279
1280*** Function: double scm_c_uniform01 (scm_rstate *STATE)
3e8370c3
MD
1281Return a sample from the uniform(0,1) distribution.
1282
259529f2 1283*** Function: double scm_c_normal01 (scm_rstate *STATE)
3e8370c3
MD
1284Return a sample from the normal(0,1) distribution.
1285
259529f2 1286*** Function: double scm_c_exp1 (scm_rstate *STATE)
3e8370c3
MD
1287Return a sample from the exp(1) distribution.
1288
259529f2
MD
1289*** Function: unsigned long scm_c_random (scm_rstate *STATE, unsigned long M)
1290Return a sample from the discrete uniform(0,M) distribution.
1291
1292*** Function: SCM scm_c_random_bignum (scm_rstate *STATE, SCM M)
3e8370c3 1293Return a sample from the discrete uniform(0,M) distribution.
259529f2 1294M must be a bignum object. The returned value may be an INUM.
3e8370c3 1295
9e97c52d 1296
f3227c7a 1297\f
d23bbf3e 1298Changes in Guile 1.3 (released Monday, October 19, 1998):
c484bf7f
JB
1299
1300* Changes to the distribution
1301
e2d6569c
JB
1302** We renamed the SCHEME_LOAD_PATH environment variable to GUILE_LOAD_PATH.
1303To avoid conflicts, programs should name environment variables after
1304themselves, except when there's a common practice establishing some
1305other convention.
1306
1307For now, Guile supports both GUILE_LOAD_PATH and SCHEME_LOAD_PATH,
1308giving the former precedence, and printing a warning message if the
1309latter is set. Guile 1.4 will not recognize SCHEME_LOAD_PATH at all.
1310
1311** The header files related to multi-byte characters have been removed.
1312They were: libguile/extchrs.h and libguile/mbstrings.h. Any C code
1313which referred to these explicitly will probably need to be rewritten,
1314since the support for the variant string types has been removed; see
1315below.
1316
1317** The header files append.h and sequences.h have been removed. These
1318files implemented non-R4RS operations which would encourage
1319non-portable programming style and less easy-to-read code.
3a97e020 1320
c484bf7f
JB
1321* Changes to the stand-alone interpreter
1322
2e368582 1323** New procedures have been added to implement a "batch mode":
ec4ab4fd 1324
2e368582 1325*** Function: batch-mode?
ec4ab4fd
GH
1326
1327 Returns a boolean indicating whether the interpreter is in batch
1328 mode.
1329
2e368582 1330*** Function: set-batch-mode?! ARG
ec4ab4fd
GH
1331
1332 If ARG is true, switches the interpreter to batch mode. The `#f'
1333 case has not been implemented.
1334
2e368582
JB
1335** Guile now provides full command-line editing, when run interactively.
1336To use this feature, you must have the readline library installed.
1337The Guile build process will notice it, and automatically include
1338support for it.
1339
1340The readline library is available via anonymous FTP from any GNU
1341mirror site; the canonical location is "ftp://prep.ai.mit.edu/pub/gnu".
1342
a5d6d578
MD
1343** the-last-stack is now a fluid.
1344
c484bf7f
JB
1345* Changes to the procedure for linking libguile with your programs
1346
71f20534 1347** You can now use the `guile-config' utility to build programs that use Guile.
2e368582 1348
2adfe1c0 1349Guile now includes a command-line utility called `guile-config', which
71f20534
JB
1350can provide information about how to compile and link programs that
1351use Guile.
1352
1353*** `guile-config compile' prints any C compiler flags needed to use Guile.
1354You should include this command's output on the command line you use
1355to compile C or C++ code that #includes the Guile header files. It's
1356usually just a `-I' flag to help the compiler find the Guile headers.
1357
1358
1359*** `guile-config link' prints any linker flags necessary to link with Guile.
8aa5c148 1360
71f20534 1361This command writes to its standard output a list of flags which you
8aa5c148
JB
1362must pass to the linker to link your code against the Guile library.
1363The flags include '-lguile' itself, any other libraries the Guile
1364library depends upon, and any `-L' flags needed to help the linker
1365find those libraries.
2e368582
JB
1366
1367For example, here is a Makefile rule that builds a program named 'foo'
1368from the object files ${FOO_OBJECTS}, and links them against Guile:
1369
1370 foo: ${FOO_OBJECTS}
2adfe1c0 1371 ${CC} ${CFLAGS} ${FOO_OBJECTS} `guile-config link` -o foo
2e368582 1372
e2d6569c
JB
1373Previous Guile releases recommended that you use autoconf to detect
1374which of a predefined set of libraries were present on your system.
2adfe1c0 1375It is more robust to use `guile-config', since it records exactly which
e2d6569c
JB
1376libraries the installed Guile library requires.
1377
2adfe1c0
JB
1378This was originally called `build-guile', but was renamed to
1379`guile-config' before Guile 1.3 was released, to be consistent with
1380the analogous script for the GTK+ GUI toolkit, which is called
1381`gtk-config'.
1382
2e368582 1383
8aa5c148
JB
1384** Use the GUILE_FLAGS macro in your configure.in file to find Guile.
1385
1386If you are using the GNU autoconf package to configure your program,
1387you can use the GUILE_FLAGS autoconf macro to call `guile-config'
1388(described above) and gather the necessary values for use in your
1389Makefiles.
1390
1391The GUILE_FLAGS macro expands to configure script code which runs the
1392`guile-config' script, to find out where Guile's header files and
1393libraries are installed. It sets two variables, marked for
1394substitution, as by AC_SUBST.
1395
1396 GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
1397 code that uses Guile header files. This is almost always just a
1398 -I flag.
1399
1400 GUILE_LDFLAGS --- flags to pass to the linker to link a
1401 program against Guile. This includes `-lguile' for the Guile
1402 library itself, any libraries that Guile itself requires (like
1403 -lqthreads), and so on. It may also include a -L flag to tell the
1404 compiler where to find the libraries.
1405
1406GUILE_FLAGS is defined in the file guile.m4, in the top-level
1407directory of the Guile distribution. You can copy it into your
1408package's aclocal.m4 file, and then use it in your configure.in file.
1409
1410If you are using the `aclocal' program, distributed with GNU automake,
1411to maintain your aclocal.m4 file, the Guile installation process
1412installs guile.m4 where aclocal will find it. All you need to do is
1413use GUILE_FLAGS in your configure.in file, and then run `aclocal';
1414this will copy the definition of GUILE_FLAGS into your aclocal.m4
1415file.
1416
1417
c484bf7f 1418* Changes to Scheme functions and syntax
7ad3c1e7 1419
02755d59 1420** Multi-byte strings have been removed, as have multi-byte and wide
e2d6569c
JB
1421ports. We felt that these were the wrong approach to
1422internationalization support.
02755d59 1423
2e368582
JB
1424** New function: readline [PROMPT]
1425Read a line from the terminal, and allow the user to edit it,
1426prompting with PROMPT. READLINE provides a large set of Emacs-like
1427editing commands, lets the user recall previously typed lines, and
1428works on almost every kind of terminal, including dumb terminals.
1429
1430READLINE assumes that the cursor is at the beginning of the line when
1431it is invoked. Thus, you can't print a prompt yourself, and then call
1432READLINE; you need to package up your prompt as a string, pass it to
1433the function, and let READLINE print the prompt itself. This is
1434because READLINE needs to know the prompt's screen width.
1435
8cd57bd0
JB
1436For Guile to provide this function, you must have the readline
1437library, version 2.1 or later, installed on your system. Readline is
1438available via anonymous FTP from prep.ai.mit.edu in pub/gnu, or from
1439any GNU mirror site.
2e368582
JB
1440
1441See also ADD-HISTORY function.
1442
1443** New function: add-history STRING
1444Add STRING as the most recent line in the history used by the READLINE
1445command. READLINE does not add lines to the history itself; you must
1446call ADD-HISTORY to make previous input available to the user.
1447
8cd57bd0
JB
1448** The behavior of the read-line function has changed.
1449
1450This function now uses standard C library functions to read the line,
1451for speed. This means that it doesn not respect the value of
1452scm-line-incrementors; it assumes that lines are delimited with
1453#\newline.
1454
1455(Note that this is read-line, the function that reads a line of text
1456from a port, not readline, the function that reads a line from a
1457terminal, providing full editing capabilities.)
1458
1a0106ef
JB
1459** New module (ice-9 getopt-gnu-style): Parse command-line arguments.
1460
1461This module provides some simple argument parsing. It exports one
1462function:
1463
1464Function: getopt-gnu-style ARG-LS
1465 Parse a list of program arguments into an alist of option
1466 descriptions.
1467
1468 Each item in the list of program arguments is examined to see if
1469 it meets the syntax of a GNU long-named option. An argument like
1470 `--MUMBLE' produces an element of the form (MUMBLE . #t) in the
1471 returned alist, where MUMBLE is a keyword object with the same
1472 name as the argument. An argument like `--MUMBLE=FROB' produces
1473 an element of the form (MUMBLE . FROB), where FROB is a string.
1474
1475 As a special case, the returned alist also contains a pair whose
1476 car is the symbol `rest'. The cdr of this pair is a list
1477 containing all the items in the argument list that are not options
1478 of the form mentioned above.
1479
1480 The argument `--' is treated specially: all items in the argument
1481 list appearing after such an argument are not examined, and are
1482 returned in the special `rest' list.
1483
1484 This function does not parse normal single-character switches.
1485 You will need to parse them out of the `rest' list yourself.
1486
8cd57bd0
JB
1487** The read syntax for byte vectors and short vectors has changed.
1488
1489Instead of #bytes(...), write #y(...).
1490
1491Instead of #short(...), write #h(...).
1492
1493This may seem nutty, but, like the other uniform vectors, byte vectors
1494and short vectors want to have the same print and read syntax (and,
1495more basic, want to have read syntax!). Changing the read syntax to
1496use multiple characters after the hash sign breaks with the
1497conventions used in R5RS and the conventions used for the other
1498uniform vectors. It also introduces complexity in the current reader,
1499both on the C and Scheme levels. (The Right solution is probably to
1500change the syntax and prototypes for uniform vectors entirely.)
1501
1502
1503** The new module (ice-9 session) provides useful interactive functions.
1504
1505*** New procedure: (apropos REGEXP OPTION ...)
1506
1507Display a list of top-level variables whose names match REGEXP, and
1508the modules they are imported from. Each OPTION should be one of the
1509following symbols:
1510
1511 value --- Show the value of each matching variable.
1512 shadow --- Show bindings shadowed by subsequently imported modules.
1513 full --- Same as both `shadow' and `value'.
1514
1515For example:
1516
1517 guile> (apropos "trace" 'full)
1518 debug: trace #<procedure trace args>
1519 debug: untrace #<procedure untrace args>
1520 the-scm-module: display-backtrace #<compiled-closure #<primitive-procedure gsubr-apply>>
1521 the-scm-module: before-backtrace-hook ()
1522 the-scm-module: backtrace #<primitive-procedure backtrace>
1523 the-scm-module: after-backtrace-hook ()
1524 the-scm-module: has-shown-backtrace-hint? #f
1525 guile>
1526
1527** There are new functions and syntax for working with macros.
1528
1529Guile implements macros as a special object type. Any variable whose
1530top-level binding is a macro object acts as a macro. The macro object
1531specifies how the expression should be transformed before evaluation.
1532
1533*** Macro objects now print in a reasonable way, resembling procedures.
1534
1535*** New function: (macro? OBJ)
1536True iff OBJ is a macro object.
1537
1538*** New function: (primitive-macro? OBJ)
1539Like (macro? OBJ), but true only if OBJ is one of the Guile primitive
1540macro transformers, implemented in eval.c rather than Scheme code.
1541
dbdd0c16
JB
1542Why do we have this function?
1543- For symmetry with procedure? and primitive-procedure?,
1544- to allow custom print procedures to tell whether a macro is
1545 primitive, and display it differently, and
1546- to allow compilers and user-written evaluators to distinguish
1547 builtin special forms from user-defined ones, which could be
1548 compiled.
1549
8cd57bd0
JB
1550*** New function: (macro-type OBJ)
1551Return a value indicating what kind of macro OBJ is. Possible return
1552values are:
1553
1554 The symbol `syntax' --- a macro created by procedure->syntax.
1555 The symbol `macro' --- a macro created by procedure->macro.
1556 The symbol `macro!' --- a macro created by procedure->memoizing-macro.
1557 The boolean #f --- if OBJ is not a macro object.
1558
1559*** New function: (macro-name MACRO)
1560Return the name of the macro object MACRO's procedure, as returned by
1561procedure-name.
1562
1563*** New function: (macro-transformer MACRO)
1564Return the transformer procedure for MACRO.
1565
1566*** New syntax: (use-syntax MODULE ... TRANSFORMER)
1567
1568Specify a new macro expander to use in the current module. Each
1569MODULE is a module name, with the same meaning as in the `use-modules'
1570form; each named module's exported bindings are added to the current
1571top-level environment. TRANSFORMER is an expression evaluated in the
1572resulting environment which must yield a procedure to use as the
1573module's eval transformer: every expression evaluated in this module
1574is passed to this function, and the result passed to the Guile
1575interpreter.
1576
1577*** macro-eval! is removed. Use local-eval instead.
29521173 1578
8d9dcb3c
MV
1579** Some magic has been added to the printer to better handle user
1580written printing routines (like record printers, closure printers).
1581
1582The problem is that these user written routines must have access to
7fbd77df 1583the current `print-state' to be able to handle fancy things like
8d9dcb3c
MV
1584detection of circular references. These print-states have to be
1585passed to the builtin printing routines (display, write, etc) to
1586properly continue the print chain.
1587
1588We didn't want to change all existing print code so that it
8cd57bd0 1589explicitly passes thru a print state in addition to a port. Instead,
8d9dcb3c
MV
1590we extented the possible values that the builtin printing routines
1591accept as a `port'. In addition to a normal port, they now also take
1592a pair of a normal port and a print-state. Printing will go to the
1593port and the print-state will be used to control the detection of
1594circular references, etc. If the builtin function does not care for a
1595print-state, it is simply ignored.
1596
1597User written callbacks are now called with such a pair as their
1598`port', but because every function now accepts this pair as a PORT
1599argument, you don't have to worry about that. In fact, it is probably
1600safest to not check for these pairs.
1601
1602However, it is sometimes necessary to continue a print chain on a
1603different port, for example to get a intermediate string
1604representation of the printed value, mangle that string somehow, and
1605then to finally print the mangled string. Use the new function
1606
1607 inherit-print-state OLD-PORT NEW-PORT
1608
1609for this. It constructs a new `port' that prints to NEW-PORT but
1610inherits the print-state of OLD-PORT.
1611
ef1ea498
MD
1612** struct-vtable-offset renamed to vtable-offset-user
1613
1614** New constants: vtable-index-layout, vtable-index-vtable, vtable-index-printer
1615
1616** There is now a fourth (optional) argument to make-vtable-vtable and
1617 make-struct when constructing new types (vtables). This argument
1618 initializes field vtable-index-printer of the vtable.
1619
4851dc57
MV
1620** The detection of circular references has been extended to structs.
1621That is, a structure that -- in the process of being printed -- prints
1622itself does not lead to infinite recursion.
1623
1624** There is now some basic support for fluids. Please read
1625"libguile/fluid.h" to find out more. It is accessible from Scheme with
1626the following functions and macros:
1627
9c3fb66f
MV
1628Function: make-fluid
1629
1630 Create a new fluid object. Fluids are not special variables or
1631 some other extension to the semantics of Scheme, but rather
1632 ordinary Scheme objects. You can store them into variables (that
1633 are still lexically scoped, of course) or into any other place you
1634 like. Every fluid has a initial value of `#f'.
04c76b58 1635
9c3fb66f 1636Function: fluid? OBJ
04c76b58 1637
9c3fb66f 1638 Test whether OBJ is a fluid.
04c76b58 1639
9c3fb66f
MV
1640Function: fluid-ref FLUID
1641Function: fluid-set! FLUID VAL
04c76b58
MV
1642
1643 Access/modify the fluid FLUID. Modifications are only visible
1644 within the current dynamic root (that includes threads).
1645
9c3fb66f
MV
1646Function: with-fluids* FLUIDS VALUES THUNK
1647
1648 FLUIDS is a list of fluids and VALUES a corresponding list of
1649 values for these fluids. Before THUNK gets called the values are
1650 installed in the fluids and the old values of the fluids are
1651 saved in the VALUES list. When the flow of control leaves THUNK
1652 or reenters it, the values get swapped again. You might think of
1653 this as a `safe-fluid-excursion'. Note that the VALUES list is
1654 modified by `with-fluids*'.
1655
1656Macro: with-fluids ((FLUID VALUE) ...) FORM ...
1657
1658 The same as `with-fluids*' but with a different syntax. It looks
1659 just like `let', but both FLUID and VALUE are evaluated. Remember,
1660 fluids are not special variables but ordinary objects. FLUID
1661 should evaluate to a fluid.
04c76b58 1662
e2d6569c 1663** Changes to system call interfaces:
64d01d13 1664
e2d6569c 1665*** close-port, close-input-port and close-output-port now return a
64d01d13
GH
1666boolean instead of an `unspecified' object. #t means that the port
1667was successfully closed, while #f means it was already closed. It is
1668also now possible for these procedures to raise an exception if an
1669error occurs (some errors from write can be delayed until close.)
1670
e2d6569c 1671*** the first argument to chmod, fcntl, ftell and fseek can now be a
6afcd3b2
GH
1672file descriptor.
1673
e2d6569c 1674*** the third argument to fcntl is now optional.
6afcd3b2 1675
e2d6569c 1676*** the first argument to chown can now be a file descriptor or a port.
6afcd3b2 1677
e2d6569c 1678*** the argument to stat can now be a port.
6afcd3b2 1679
e2d6569c 1680*** The following new procedures have been added (most use scsh
64d01d13
GH
1681interfaces):
1682
e2d6569c 1683*** procedure: close PORT/FD
ec4ab4fd
GH
1684 Similar to close-port (*note close-port: Closing Ports.), but also
1685 works on file descriptors. A side effect of closing a file
1686 descriptor is that any ports using that file descriptor are moved
1687 to a different file descriptor and have their revealed counts set
1688 to zero.
1689
e2d6569c 1690*** procedure: port->fdes PORT
ec4ab4fd
GH
1691 Returns the integer file descriptor underlying PORT. As a side
1692 effect the revealed count of PORT is incremented.
1693
e2d6569c 1694*** procedure: fdes->ports FDES
ec4ab4fd
GH
1695 Returns a list of existing ports which have FDES as an underlying
1696 file descriptor, without changing their revealed counts.
1697
e2d6569c 1698*** procedure: fdes->inport FDES
ec4ab4fd
GH
1699 Returns an existing input port which has FDES as its underlying
1700 file descriptor, if one exists, and increments its revealed count.
1701 Otherwise, returns a new input port with a revealed count of 1.
1702
e2d6569c 1703*** procedure: fdes->outport FDES
ec4ab4fd
GH
1704 Returns an existing output port which has FDES as its underlying
1705 file descriptor, if one exists, and increments its revealed count.
1706 Otherwise, returns a new output port with a revealed count of 1.
1707
1708 The next group of procedures perform a `dup2' system call, if NEWFD
1709(an integer) is supplied, otherwise a `dup'. The file descriptor to be
1710duplicated can be supplied as an integer or contained in a port. The
64d01d13
GH
1711type of value returned varies depending on which procedure is used.
1712
ec4ab4fd
GH
1713 All procedures also have the side effect when performing `dup2' that
1714any ports using NEWFD are moved to a different file descriptor and have
64d01d13
GH
1715their revealed counts set to zero.
1716
e2d6569c 1717*** procedure: dup->fdes PORT/FD [NEWFD]
ec4ab4fd 1718 Returns an integer file descriptor.
64d01d13 1719
e2d6569c 1720*** procedure: dup->inport PORT/FD [NEWFD]
ec4ab4fd 1721 Returns a new input port using the new file descriptor.
64d01d13 1722
e2d6569c 1723*** procedure: dup->outport PORT/FD [NEWFD]
ec4ab4fd 1724 Returns a new output port using the new file descriptor.
64d01d13 1725
e2d6569c 1726*** procedure: dup PORT/FD [NEWFD]
ec4ab4fd
GH
1727 Returns a new port if PORT/FD is a port, with the same mode as the
1728 supplied port, otherwise returns an integer file descriptor.
64d01d13 1729
e2d6569c 1730*** procedure: dup->port PORT/FD MODE [NEWFD]
ec4ab4fd
GH
1731 Returns a new port using the new file descriptor. MODE supplies a
1732 mode string for the port (*note open-file: File Ports.).
64d01d13 1733
e2d6569c 1734*** procedure: setenv NAME VALUE
ec4ab4fd
GH
1735 Modifies the environment of the current process, which is also the
1736 default environment inherited by child processes.
64d01d13 1737
ec4ab4fd
GH
1738 If VALUE is `#f', then NAME is removed from the environment.
1739 Otherwise, the string NAME=VALUE is added to the environment,
1740 replacing any existing string with name matching NAME.
64d01d13 1741
ec4ab4fd 1742 The return value is unspecified.
956055a9 1743
e2d6569c 1744*** procedure: truncate-file OBJ SIZE
6afcd3b2
GH
1745 Truncates the file referred to by OBJ to at most SIZE bytes. OBJ
1746 can be a string containing a file name or an integer file
1747 descriptor or port open for output on the file. The underlying
1748 system calls are `truncate' and `ftruncate'.
1749
1750 The return value is unspecified.
1751
e2d6569c 1752*** procedure: setvbuf PORT MODE [SIZE]
7a6f1ffa
GH
1753 Set the buffering mode for PORT. MODE can be:
1754 `_IONBF'
1755 non-buffered
1756
1757 `_IOLBF'
1758 line buffered
1759
1760 `_IOFBF'
1761 block buffered, using a newly allocated buffer of SIZE bytes.
1762 However if SIZE is zero or unspecified, the port will be made
1763 non-buffered.
1764
1765 This procedure should not be used after I/O has been performed with
1766 the port.
1767
1768 Ports are usually block buffered by default, with a default buffer
1769 size. Procedures e.g., *Note open-file: File Ports, which accept a
1770 mode string allow `0' to be added to request an unbuffered port.
1771
e2d6569c 1772*** procedure: fsync PORT/FD
6afcd3b2
GH
1773 Copies any unwritten data for the specified output file descriptor
1774 to disk. If PORT/FD is a port, its buffer is flushed before the
1775 underlying file descriptor is fsync'd. The return value is
1776 unspecified.
1777
e2d6569c 1778*** procedure: open-fdes PATH FLAGS [MODES]
6afcd3b2
GH
1779 Similar to `open' but returns a file descriptor instead of a port.
1780
e2d6569c 1781*** procedure: execle PATH ENV [ARG] ...
6afcd3b2
GH
1782 Similar to `execl', but the environment of the new process is
1783 specified by ENV, which must be a list of strings as returned by
1784 the `environ' procedure.
1785
1786 This procedure is currently implemented using the `execve' system
1787 call, but we call it `execle' because of its Scheme calling
1788 interface.
1789
e2d6569c 1790*** procedure: strerror ERRNO
ec4ab4fd
GH
1791 Returns the Unix error message corresponding to ERRNO, an integer.
1792
e2d6569c 1793*** procedure: primitive-exit [STATUS]
6afcd3b2
GH
1794 Terminate the current process without unwinding the Scheme stack.
1795 This is would typically be useful after a fork. The exit status
1796 is STATUS if supplied, otherwise zero.
1797
e2d6569c 1798*** procedure: times
6afcd3b2
GH
1799 Returns an object with information about real and processor time.
1800 The following procedures accept such an object as an argument and
1801 return a selected component:
1802
1803 `tms:clock'
1804 The current real time, expressed as time units relative to an
1805 arbitrary base.
1806
1807 `tms:utime'
1808 The CPU time units used by the calling process.
1809
1810 `tms:stime'
1811 The CPU time units used by the system on behalf of the
1812 calling process.
1813
1814 `tms:cutime'
1815 The CPU time units used by terminated child processes of the
1816 calling process, whose status has been collected (e.g., using
1817 `waitpid').
1818
1819 `tms:cstime'
1820 Similarly, the CPU times units used by the system on behalf of
1821 terminated child processes.
7ad3c1e7 1822
e2d6569c
JB
1823** Removed: list-length
1824** Removed: list-append, list-append!
1825** Removed: list-reverse, list-reverse!
1826
1827** array-map renamed to array-map!
1828
1829** serial-array-map renamed to serial-array-map!
1830
660f41fa
MD
1831** catch doesn't take #f as first argument any longer
1832
1833Previously, it was possible to pass #f instead of a key to `catch'.
1834That would cause `catch' to pass a jump buffer object to the procedure
1835passed as second argument. The procedure could then use this jump
1836buffer objekt as an argument to throw.
1837
1838This mechanism has been removed since its utility doesn't motivate the
1839extra complexity it introduces.
1840
332d00f6
JB
1841** The `#/' notation for lists now provokes a warning message from Guile.
1842This syntax will be removed from Guile in the near future.
1843
1844To disable the warning message, set the GUILE_HUSH environment
1845variable to any non-empty value.
1846
8cd57bd0
JB
1847** The newline character now prints as `#\newline', following the
1848normal Scheme notation, not `#\nl'.
1849
c484bf7f
JB
1850* Changes to the gh_ interface
1851
8986901b
JB
1852** The gh_enter function now takes care of loading the Guile startup files.
1853gh_enter works by calling scm_boot_guile; see the remarks below.
1854
5424b4f7
MD
1855** Function: void gh_write (SCM x)
1856
1857Write the printed representation of the scheme object x to the current
1858output port. Corresponds to the scheme level `write'.
1859
3a97e020
MD
1860** gh_list_length renamed to gh_length.
1861
8d6787b6
MG
1862** vector handling routines
1863
1864Several major changes. In particular, gh_vector() now resembles
1865(vector ...) (with a caveat -- see manual), and gh_make_vector() now
956328d2
MG
1866exists and behaves like (make-vector ...). gh_vset() and gh_vref()
1867have been renamed gh_vector_set_x() and gh_vector_ref(). Some missing
8d6787b6
MG
1868vector-related gh_ functions have been implemented.
1869
7fee59bd
MG
1870** pair and list routines
1871
1872Implemented several of the R4RS pair and list functions that were
1873missing.
1874
171422a9
MD
1875** gh_scm2doubles, gh_doubles2scm, gh_doubles2dvect
1876
1877New function. Converts double arrays back and forth between Scheme
1878and C.
1879
c484bf7f
JB
1880* Changes to the scm_ interface
1881
8986901b
JB
1882** The function scm_boot_guile now takes care of loading the startup files.
1883
1884Guile's primary initialization function, scm_boot_guile, now takes
1885care of loading `boot-9.scm', in the `ice-9' module, to initialize
1886Guile, define the module system, and put together some standard
1887bindings. It also loads `init.scm', which is intended to hold
1888site-specific initialization code.
1889
1890Since Guile cannot operate properly until boot-9.scm is loaded, there
1891is no reason to separate loading boot-9.scm from Guile's other
1892initialization processes.
1893
1894This job used to be done by scm_compile_shell_switches, which didn't
1895make much sense; in particular, it meant that people using Guile for
1896non-shell-like applications had to jump through hoops to get Guile
1897initialized properly.
1898
1899** The function scm_compile_shell_switches no longer loads the startup files.
1900Now, Guile always loads the startup files, whenever it is initialized;
1901see the notes above for scm_boot_guile and scm_load_startup_files.
1902
1903** Function: scm_load_startup_files
1904This new function takes care of loading Guile's initialization file
1905(`boot-9.scm'), and the site initialization file, `init.scm'. Since
1906this is always called by the Guile initialization process, it's
1907probably not too useful to call this yourself, but it's there anyway.
1908
87148d9e
JB
1909** The semantics of smob marking have changed slightly.
1910
1911The smob marking function (the `mark' member of the scm_smobfuns
1912structure) is no longer responsible for setting the mark bit on the
1913smob. The generic smob handling code in the garbage collector will
1914set this bit. The mark function need only ensure that any other
1915objects the smob refers to get marked.
1916
1917Note that this change means that the smob's GC8MARK bit is typically
1918already set upon entry to the mark function. Thus, marking functions
1919which look like this:
1920
1921 {
1922 if (SCM_GC8MARKP (ptr))
1923 return SCM_BOOL_F;
1924 SCM_SETGC8MARK (ptr);
1925 ... mark objects to which the smob refers ...
1926 }
1927
1928are now incorrect, since they will return early, and fail to mark any
1929other objects the smob refers to. Some code in the Guile library used
1930to work this way.
1931
1cf84ea5
JB
1932** The semantics of the I/O port functions in scm_ptobfuns have changed.
1933
1934If you have implemented your own I/O port type, by writing the
1935functions required by the scm_ptobfuns and then calling scm_newptob,
1936you will need to change your functions slightly.
1937
1938The functions in a scm_ptobfuns structure now expect the port itself
1939as their argument; they used to expect the `stream' member of the
1940port's scm_port_table structure. This allows functions in an
1941scm_ptobfuns structure to easily access the port's cell (and any flags
1942it its CAR), and the port's scm_port_table structure.
1943
1944Guile now passes the I/O port itself as the `port' argument in the
1945following scm_ptobfuns functions:
1946
1947 int (*free) (SCM port);
1948 int (*fputc) (int, SCM port);
1949 int (*fputs) (char *, SCM port);
1950 scm_sizet (*fwrite) SCM_P ((char *ptr,
1951 scm_sizet size,
1952 scm_sizet nitems,
1953 SCM port));
1954 int (*fflush) (SCM port);
1955 int (*fgetc) (SCM port);
1956 int (*fclose) (SCM port);
1957
1958The interfaces to the `mark', `print', `equalp', and `fgets' methods
1959are unchanged.
1960
1961If you have existing code which defines its own port types, it is easy
1962to convert your code to the new interface; simply apply SCM_STREAM to
1963the port argument to yield the value you code used to expect.
1964
1965Note that since both the port and the stream have the same type in the
1966C code --- they are both SCM values --- the C compiler will not remind
1967you if you forget to update your scm_ptobfuns functions.
1968
1969
933a7411
MD
1970** Function: int scm_internal_select (int fds,
1971 SELECT_TYPE *rfds,
1972 SELECT_TYPE *wfds,
1973 SELECT_TYPE *efds,
1974 struct timeval *timeout);
1975
1976This is a replacement for the `select' function provided by the OS.
1977It enables I/O blocking and sleeping to happen for one cooperative
1978thread without blocking other threads. It also avoids busy-loops in
1979these situations. It is intended that all I/O blocking and sleeping
1980will finally go through this function. Currently, this function is
1981only available on systems providing `gettimeofday' and `select'.
1982
5424b4f7
MD
1983** Function: SCM scm_internal_stack_catch (SCM tag,
1984 scm_catch_body_t body,
1985 void *body_data,
1986 scm_catch_handler_t handler,
1987 void *handler_data)
1988
1989A new sibling to the other two C level `catch' functions
1990scm_internal_catch and scm_internal_lazy_catch. Use it if you want
1991the stack to be saved automatically into the variable `the-last-stack'
1992(scm_the_last_stack_var) on error. This is necessary if you want to
1993use advanced error reporting, such as calling scm_display_error and
1994scm_display_backtrace. (They both take a stack object as argument.)
1995
df366c26
MD
1996** Function: SCM scm_spawn_thread (scm_catch_body_t body,
1997 void *body_data,
1998 scm_catch_handler_t handler,
1999 void *handler_data)
2000
2001Spawns a new thread. It does a job similar to
2002scm_call_with_new_thread but takes arguments more suitable when
2003spawning threads from application C code.
2004
88482b31
MD
2005** The hook scm_error_callback has been removed. It was originally
2006intended as a way for the user to install his own error handler. But
2007that method works badly since it intervenes between throw and catch,
2008thereby changing the semantics of expressions like (catch #t ...).
2009The correct way to do it is to use one of the C level catch functions
2010in throw.c: scm_internal_catch/lazy_catch/stack_catch.
2011
3a97e020
MD
2012** Removed functions:
2013
2014scm_obj_length, scm_list_length, scm_list_append, scm_list_append_x,
2015scm_list_reverse, scm_list_reverse_x
2016
2017** New macros: SCM_LISTn where n is one of the integers 0-9.
2018
2019These can be used for pretty list creation from C. The idea is taken
2020from Erick Gallesio's STk.
2021
298aa6e3
MD
2022** scm_array_map renamed to scm_array_map_x
2023
527da704
MD
2024** mbstrings are now removed
2025
2026This means that the type codes scm_tc7_mb_string and
2027scm_tc7_mb_substring has been removed.
2028
8cd57bd0
JB
2029** scm_gen_putc, scm_gen_puts, scm_gen_write, and scm_gen_getc have changed.
2030
2031Since we no longer support multi-byte strings, these I/O functions
2032have been simplified, and renamed. Here are their old names, and
2033their new names and arguments:
2034
2035scm_gen_putc -> void scm_putc (int c, SCM port);
2036scm_gen_puts -> void scm_puts (char *s, SCM port);
2037scm_gen_write -> void scm_lfwrite (char *ptr, scm_sizet size, SCM port);
2038scm_gen_getc -> void scm_getc (SCM port);
2039
2040
527da704
MD
2041** The macros SCM_TYP7D and SCM_TYP7SD has been removed.
2042
2043** The macro SCM_TYP7S has taken the role of the old SCM_TYP7D
2044
2045SCM_TYP7S now masks away the bit which distinguishes substrings from
2046strings.
2047
660f41fa
MD
2048** scm_catch_body_t: Backward incompatible change!
2049
2050Body functions to scm_internal_catch and friends do not any longer
2051take a second argument. This is because it is no longer possible to
2052pass a #f arg to catch.
2053
a8e05009
JB
2054** Calls to scm_protect_object and scm_unprotect now nest properly.
2055
2056The function scm_protect_object protects its argument from being freed
2057by the garbage collector. scm_unprotect_object removes that
2058protection.
2059
2060These functions now nest properly. That is, for every object O, there
2061is a counter which scm_protect_object(O) increments and
2062scm_unprotect_object(O) decrements, if the counter is greater than
2063zero. Every object's counter is zero when it is first created. If an
2064object's counter is greater than zero, the garbage collector will not
2065reclaim its storage.
2066
2067This allows you to use scm_protect_object in your code without
2068worrying that some other function you call will call
2069scm_unprotect_object, and allow it to be freed. Assuming that the
2070functions you call are well-behaved, and unprotect only those objects
2071they protect, you can follow the same rule and have confidence that
2072objects will be freed only at appropriate times.
2073
c484bf7f
JB
2074\f
2075Changes in Guile 1.2 (released Tuesday, June 24 1997):
cf78e9e8 2076
737c9113
JB
2077* Changes to the distribution
2078
832b09ed
JB
2079** Nightly snapshots are now available from ftp.red-bean.com.
2080The old server, ftp.cyclic.com, has been relinquished to its rightful
2081owner.
2082
2083Nightly snapshots of the Guile development sources are now available via
2084anonymous FTP from ftp.red-bean.com, as /pub/guile/guile-snap.tar.gz.
2085
2086Via the web, that's: ftp://ftp.red-bean.com/pub/guile/guile-snap.tar.gz
2087For getit, that's: ftp.red-bean.com:/pub/guile/guile-snap.tar.gz
2088
0fcab5ed
JB
2089** To run Guile without installing it, the procedure has changed a bit.
2090
2091If you used a separate build directory to compile Guile, you'll need
2092to include the build directory in SCHEME_LOAD_PATH, as well as the
2093source directory. See the `INSTALL' file for examples.
2094
737c9113
JB
2095* Changes to the procedure for linking libguile with your programs
2096
94982a4e
JB
2097** The standard Guile load path for Scheme code now includes
2098$(datadir)/guile (usually /usr/local/share/guile). This means that
2099you can install your own Scheme files there, and Guile will find them.
2100(Previous versions of Guile only checked a directory whose name
2101contained the Guile version number, so you had to re-install or move
2102your Scheme sources each time you installed a fresh version of Guile.)
2103
2104The load path also includes $(datadir)/guile/site; we recommend
2105putting individual Scheme files there. If you want to install a
2106package with multiple source files, create a directory for them under
2107$(datadir)/guile.
2108
2109** Guile 1.2 will now use the Rx regular expression library, if it is
2110installed on your system. When you are linking libguile into your own
2111programs, this means you will have to link against -lguile, -lqt (if
2112you configured Guile with thread support), and -lrx.
27590f82
JB
2113
2114If you are using autoconf to generate configuration scripts for your
2115application, the following lines should suffice to add the appropriate
2116libraries to your link command:
2117
2118### Find Rx, quickthreads and libguile.
2119AC_CHECK_LIB(rx, main)
2120AC_CHECK_LIB(qt, main)
2121AC_CHECK_LIB(guile, scm_shell)
2122
94982a4e
JB
2123The Guile 1.2 distribution does not contain sources for the Rx
2124library, as Guile 1.0 did. If you want to use Rx, you'll need to
2125retrieve it from a GNU FTP site and install it separately.
2126
b83b8bee
JB
2127* Changes to Scheme functions and syntax
2128
e035e7e6
MV
2129** The dynamic linking features of Guile are now enabled by default.
2130You can disable them by giving the `--disable-dynamic-linking' option
2131to configure.
2132
e035e7e6
MV
2133 (dynamic-link FILENAME)
2134
2135 Find the object file denoted by FILENAME (a string) and link it
2136 into the running Guile application. When everything works out,
2137 return a Scheme object suitable for representing the linked object
2138 file. Otherwise an error is thrown. How object files are
2139 searched is system dependent.
2140
2141 (dynamic-object? VAL)
2142
2143 Determine whether VAL represents a dynamically linked object file.
2144
2145 (dynamic-unlink DYNOBJ)
2146
2147 Unlink the indicated object file from the application. DYNOBJ
2148 should be one of the values returned by `dynamic-link'.
2149
2150 (dynamic-func FUNCTION DYNOBJ)
2151
2152 Search the C function indicated by FUNCTION (a string or symbol)
2153 in DYNOBJ and return some Scheme object that can later be used
2154 with `dynamic-call' to actually call this function. Right now,
2155 these Scheme objects are formed by casting the address of the
2156 function to `long' and converting this number to its Scheme
2157 representation.
2158
2159 (dynamic-call FUNCTION DYNOBJ)
2160
2161 Call the C function indicated by FUNCTION and DYNOBJ. The
2162 function is passed no arguments and its return value is ignored.
2163 When FUNCTION is something returned by `dynamic-func', call that
2164 function and ignore DYNOBJ. When FUNCTION is a string (or symbol,
2165 etc.), look it up in DYNOBJ; this is equivalent to
2166
2167 (dynamic-call (dynamic-func FUNCTION DYNOBJ) #f)
2168
2169 Interrupts are deferred while the C function is executing (with
2170 SCM_DEFER_INTS/SCM_ALLOW_INTS).
2171
2172 (dynamic-args-call FUNCTION DYNOBJ ARGS)
2173
2174 Call the C function indicated by FUNCTION and DYNOBJ, but pass it
2175 some arguments and return its return value. The C function is
2176 expected to take two arguments and return an `int', just like
2177 `main':
2178
2179 int c_func (int argc, char **argv);
2180
2181 ARGS must be a list of strings and is converted into an array of
2182 `char *'. The array is passed in ARGV and its size in ARGC. The
2183 return value is converted to a Scheme number and returned from the
2184 call to `dynamic-args-call'.
2185
0fcab5ed
JB
2186When dynamic linking is disabled or not supported on your system,
2187the above functions throw errors, but they are still available.
2188
e035e7e6
MV
2189Here is a small example that works on GNU/Linux:
2190
2191 (define libc-obj (dynamic-link "libc.so"))
2192 (dynamic-args-call 'rand libc-obj '())
2193
2194See the file `libguile/DYNAMIC-LINKING' for additional comments.
2195
27590f82
JB
2196** The #/ syntax for module names is depreciated, and will be removed
2197in a future version of Guile. Instead of
2198
2199 #/foo/bar/baz
2200
2201instead write
2202
2203 (foo bar baz)
2204
2205The latter syntax is more consistent with existing Lisp practice.
2206
5dade857
MV
2207** Guile now does fancier printing of structures. Structures are the
2208underlying implementation for records, which in turn are used to
2209implement modules, so all of these object now print differently and in
2210a more informative way.
2211
161029df
JB
2212The Scheme printer will examine the builtin variable *struct-printer*
2213whenever it needs to print a structure object. When this variable is
2214not `#f' it is deemed to be a procedure and will be applied to the
2215structure object and the output port. When *struct-printer* is `#f'
2216or the procedure return `#f' the structure object will be printed in
2217the boring #<struct 80458270> form.
5dade857
MV
2218
2219This hook is used by some routines in ice-9/boot-9.scm to implement
2220type specific printing routines. Please read the comments there about
2221"printing structs".
2222
2223One of the more specific uses of structs are records. The printing
2224procedure that could be passed to MAKE-RECORD-TYPE is now actually
2225called. It should behave like a *struct-printer* procedure (described
2226above).
2227
b83b8bee
JB
2228** Guile now supports a new R4RS-compliant syntax for keywords. A
2229token of the form #:NAME, where NAME has the same syntax as a Scheme
2230symbol, is the external representation of the keyword named NAME.
2231Keyword objects print using this syntax as well, so values containing
1e5afba0
JB
2232keyword objects can be read back into Guile. When used in an
2233expression, keywords are self-quoting objects.
b83b8bee
JB
2234
2235Guile suports this read syntax, and uses this print syntax, regardless
2236of the current setting of the `keyword' read option. The `keyword'
2237read option only controls whether Guile recognizes the `:NAME' syntax,
2238which is incompatible with R4RS. (R4RS says such token represent
2239symbols.)
737c9113
JB
2240
2241** Guile has regular expression support again. Guile 1.0 included
2242functions for matching regular expressions, based on the Rx library.
2243In Guile 1.1, the Guile/Rx interface was removed to simplify the
2244distribution, and thus Guile had no regular expression support. Guile
94982a4e
JB
22451.2 again supports the most commonly used functions, and supports all
2246of SCSH's regular expression functions.
2409cdfa 2247
94982a4e
JB
2248If your system does not include a POSIX regular expression library,
2249and you have not linked Guile with a third-party regexp library such as
2250Rx, these functions will not be available. You can tell whether your
2251Guile installation includes regular expression support by checking
2252whether the `*features*' list includes the `regex' symbol.
737c9113 2253
94982a4e 2254*** regexp functions
161029df 2255
94982a4e
JB
2256By default, Guile supports POSIX extended regular expressions. That
2257means that the characters `(', `)', `+' and `?' are special, and must
2258be escaped if you wish to match the literal characters.
e1a191a8 2259
94982a4e
JB
2260This regular expression interface was modeled after that implemented
2261by SCSH, the Scheme Shell. It is intended to be upwardly compatible
2262with SCSH regular expressions.
2263
2264**** Function: string-match PATTERN STR [START]
2265 Compile the string PATTERN into a regular expression and compare
2266 it with STR. The optional numeric argument START specifies the
2267 position of STR at which to begin matching.
2268
2269 `string-match' returns a "match structure" which describes what,
2270 if anything, was matched by the regular expression. *Note Match
2271 Structures::. If STR does not match PATTERN at all,
2272 `string-match' returns `#f'.
2273
2274 Each time `string-match' is called, it must compile its PATTERN
2275argument into a regular expression structure. This operation is
2276expensive, which makes `string-match' inefficient if the same regular
2277expression is used several times (for example, in a loop). For better
2278performance, you can compile a regular expression in advance and then
2279match strings against the compiled regexp.
2280
2281**** Function: make-regexp STR [FLAGS]
2282 Compile the regular expression described by STR, and return the
2283 compiled regexp structure. If STR does not describe a legal
2284 regular expression, `make-regexp' throws a
2285 `regular-expression-syntax' error.
2286
2287 FLAGS may be the bitwise-or of one or more of the following:
2288
2289**** Constant: regexp/extended
2290 Use POSIX Extended Regular Expression syntax when interpreting
2291 STR. If not set, POSIX Basic Regular Expression syntax is used.
2292 If the FLAGS argument is omitted, we assume regexp/extended.
2293
2294**** Constant: regexp/icase
2295 Do not differentiate case. Subsequent searches using the
2296 returned regular expression will be case insensitive.
2297
2298**** Constant: regexp/newline
2299 Match-any-character operators don't match a newline.
2300
2301 A non-matching list ([^...]) not containing a newline matches a
2302 newline.
2303
2304 Match-beginning-of-line operator (^) matches the empty string
2305 immediately after a newline, regardless of whether the FLAGS
2306 passed to regexp-exec contain regexp/notbol.
2307
2308 Match-end-of-line operator ($) matches the empty string
2309 immediately before a newline, regardless of whether the FLAGS
2310 passed to regexp-exec contain regexp/noteol.
2311
2312**** Function: regexp-exec REGEXP STR [START [FLAGS]]
2313 Match the compiled regular expression REGEXP against `str'. If
2314 the optional integer START argument is provided, begin matching
2315 from that position in the string. Return a match structure
2316 describing the results of the match, or `#f' if no match could be
2317 found.
2318
2319 FLAGS may be the bitwise-or of one or more of the following:
2320
2321**** Constant: regexp/notbol
2322 The match-beginning-of-line operator always fails to match (but
2323 see the compilation flag regexp/newline above) This flag may be
2324 used when different portions of a string are passed to
2325 regexp-exec and the beginning of the string should not be
2326 interpreted as the beginning of the line.
2327
2328**** Constant: regexp/noteol
2329 The match-end-of-line operator always fails to match (but see the
2330 compilation flag regexp/newline above)
2331
2332**** Function: regexp? OBJ
2333 Return `#t' if OBJ is a compiled regular expression, or `#f'
2334 otherwise.
2335
2336 Regular expressions are commonly used to find patterns in one string
2337and replace them with the contents of another string.
2338
2339**** Function: regexp-substitute PORT MATCH [ITEM...]
2340 Write to the output port PORT selected contents of the match
2341 structure MATCH. Each ITEM specifies what should be written, and
2342 may be one of the following arguments:
2343
2344 * A string. String arguments are written out verbatim.
2345
2346 * An integer. The submatch with that number is written.
2347
2348 * The symbol `pre'. The portion of the matched string preceding
2349 the regexp match is written.
2350
2351 * The symbol `post'. The portion of the matched string
2352 following the regexp match is written.
2353
2354 PORT may be `#f', in which case nothing is written; instead,
2355 `regexp-substitute' constructs a string from the specified ITEMs
2356 and returns that.
2357
2358**** Function: regexp-substitute/global PORT REGEXP TARGET [ITEM...]
2359 Similar to `regexp-substitute', but can be used to perform global
2360 substitutions on STR. Instead of taking a match structure as an
2361 argument, `regexp-substitute/global' takes two string arguments: a
2362 REGEXP string describing a regular expression, and a TARGET string
2363 which should be matched against this regular expression.
2364
2365 Each ITEM behaves as in REGEXP-SUBSTITUTE, with the following
2366 exceptions:
2367
2368 * A function may be supplied. When this function is called, it
2369 will be passed one argument: a match structure for a given
2370 regular expression match. It should return a string to be
2371 written out to PORT.
2372
2373 * The `post' symbol causes `regexp-substitute/global' to recurse
2374 on the unmatched portion of STR. This *must* be supplied in
2375 order to perform global search-and-replace on STR; if it is
2376 not present among the ITEMs, then `regexp-substitute/global'
2377 will return after processing a single match.
2378
2379*** Match Structures
2380
2381 A "match structure" is the object returned by `string-match' and
2382`regexp-exec'. It describes which portion of a string, if any, matched
2383the given regular expression. Match structures include: a reference to
2384the string that was checked for matches; the starting and ending
2385positions of the regexp match; and, if the regexp included any
2386parenthesized subexpressions, the starting and ending positions of each
2387submatch.
2388
2389 In each of the regexp match functions described below, the `match'
2390argument must be a match structure returned by a previous call to
2391`string-match' or `regexp-exec'. Most of these functions return some
2392information about the original target string that was matched against a
2393regular expression; we will call that string TARGET for easy reference.
2394
2395**** Function: regexp-match? OBJ
2396 Return `#t' if OBJ is a match structure returned by a previous
2397 call to `regexp-exec', or `#f' otherwise.
2398
2399**** Function: match:substring MATCH [N]
2400 Return the portion of TARGET matched by subexpression number N.
2401 Submatch 0 (the default) represents the entire regexp match. If
2402 the regular expression as a whole matched, but the subexpression
2403 number N did not match, return `#f'.
2404
2405**** Function: match:start MATCH [N]
2406 Return the starting position of submatch number N.
2407
2408**** Function: match:end MATCH [N]
2409 Return the ending position of submatch number N.
2410
2411**** Function: match:prefix MATCH
2412 Return the unmatched portion of TARGET preceding the regexp match.
2413
2414**** Function: match:suffix MATCH
2415 Return the unmatched portion of TARGET following the regexp match.
2416
2417**** Function: match:count MATCH
2418 Return the number of parenthesized subexpressions from MATCH.
2419 Note that the entire regular expression match itself counts as a
2420 subexpression, and failed submatches are included in the count.
2421
2422**** Function: match:string MATCH
2423 Return the original TARGET string.
2424
2425*** Backslash Escapes
2426
2427 Sometimes you will want a regexp to match characters like `*' or `$'
2428exactly. For example, to check whether a particular string represents
2429a menu entry from an Info node, it would be useful to match it against
2430a regexp like `^* [^:]*::'. However, this won't work; because the
2431asterisk is a metacharacter, it won't match the `*' at the beginning of
2432the string. In this case, we want to make the first asterisk un-magic.
2433
2434 You can do this by preceding the metacharacter with a backslash
2435character `\'. (This is also called "quoting" the metacharacter, and
2436is known as a "backslash escape".) When Guile sees a backslash in a
2437regular expression, it considers the following glyph to be an ordinary
2438character, no matter what special meaning it would ordinarily have.
2439Therefore, we can make the above example work by changing the regexp to
2440`^\* [^:]*::'. The `\*' sequence tells the regular expression engine
2441to match only a single asterisk in the target string.
2442
2443 Since the backslash is itself a metacharacter, you may force a
2444regexp to match a backslash in the target string by preceding the
2445backslash with itself. For example, to find variable references in a
2446TeX program, you might want to find occurrences of the string `\let\'
2447followed by any number of alphabetic characters. The regular expression
2448`\\let\\[A-Za-z]*' would do this: the double backslashes in the regexp
2449each match a single backslash in the target string.
2450
2451**** Function: regexp-quote STR
2452 Quote each special character found in STR with a backslash, and
2453 return the resulting string.
2454
2455 *Very important:* Using backslash escapes in Guile source code (as
2456in Emacs Lisp or C) can be tricky, because the backslash character has
2457special meaning for the Guile reader. For example, if Guile encounters
2458the character sequence `\n' in the middle of a string while processing
2459Scheme code, it replaces those characters with a newline character.
2460Similarly, the character sequence `\t' is replaced by a horizontal tab.
2461Several of these "escape sequences" are processed by the Guile reader
2462before your code is executed. Unrecognized escape sequences are
2463ignored: if the characters `\*' appear in a string, they will be
2464translated to the single character `*'.
2465
2466 This translation is obviously undesirable for regular expressions,
2467since we want to be able to include backslashes in a string in order to
2468escape regexp metacharacters. Therefore, to make sure that a backslash
2469is preserved in a string in your Guile program, you must use *two*
2470consecutive backslashes:
2471
2472 (define Info-menu-entry-pattern (make-regexp "^\\* [^:]*"))
2473
2474 The string in this example is preprocessed by the Guile reader before
2475any code is executed. The resulting argument to `make-regexp' is the
2476string `^\* [^:]*', which is what we really want.
2477
2478 This also means that in order to write a regular expression that
2479matches a single backslash character, the regular expression string in
2480the source code must include *four* backslashes. Each consecutive pair
2481of backslashes gets translated by the Guile reader to a single
2482backslash, and the resulting double-backslash is interpreted by the
2483regexp engine as matching a single backslash character. Hence:
2484
2485 (define tex-variable-pattern (make-regexp "\\\\let\\\\=[A-Za-z]*"))
2486
2487 The reason for the unwieldiness of this syntax is historical. Both
2488regular expression pattern matchers and Unix string processing systems
2489have traditionally used backslashes with the special meanings described
2490above. The POSIX regular expression specification and ANSI C standard
2491both require these semantics. Attempting to abandon either convention
2492would cause other kinds of compatibility problems, possibly more severe
2493ones. Therefore, without extending the Scheme reader to support
2494strings with different quoting conventions (an ungainly and confusing
2495extension when implemented in other languages), we must adhere to this
2496cumbersome escape syntax.
2497
7ad3c1e7
GH
2498* Changes to the gh_ interface
2499
2500* Changes to the scm_ interface
2501
2502* Changes to system call interfaces:
94982a4e 2503
7ad3c1e7 2504** The value returned by `raise' is now unspecified. It throws an exception
e1a191a8
GH
2505if an error occurs.
2506
94982a4e 2507*** A new procedure `sigaction' can be used to install signal handlers
115b09a5
GH
2508
2509(sigaction signum [action] [flags])
2510
2511signum is the signal number, which can be specified using the value
2512of SIGINT etc.
2513
2514If action is omitted, sigaction returns a pair: the CAR is the current
2515signal hander, which will be either an integer with the value SIG_DFL
2516(default action) or SIG_IGN (ignore), or the Scheme procedure which
2517handles the signal, or #f if a non-Scheme procedure handles the
2518signal. The CDR contains the current sigaction flags for the handler.
2519
2520If action is provided, it is installed as the new handler for signum.
2521action can be a Scheme procedure taking one argument, or the value of
2522SIG_DFL (default action) or SIG_IGN (ignore), or #f to restore
2523whatever signal handler was installed before sigaction was first used.
2524Flags can optionally be specified for the new handler (SA_RESTART is
2525always used if the system provides it, so need not be specified.) The
2526return value is a pair with information about the old handler as
2527described above.
2528
2529This interface does not provide access to the "signal blocking"
2530facility. Maybe this is not needed, since the thread support may
2531provide solutions to the problem of consistent access to data
2532structures.
e1a191a8 2533
94982a4e 2534*** A new procedure `flush-all-ports' is equivalent to running
89ea5b7c
GH
2535`force-output' on every port open for output.
2536
94982a4e
JB
2537** Guile now provides information on how it was built, via the new
2538global variable, %guile-build-info. This variable records the values
2539of the standard GNU makefile directory variables as an assocation
2540list, mapping variable names (symbols) onto directory paths (strings).
2541For example, to find out where the Guile link libraries were
2542installed, you can say:
2543
2544guile -c "(display (assq-ref %guile-build-info 'libdir)) (newline)"
2545
2546
2547* Changes to the scm_ interface
2548
2549** The new function scm_handle_by_message_noexit is just like the
2550existing scm_handle_by_message function, except that it doesn't call
2551exit to terminate the process. Instead, it prints a message and just
2552returns #f. This might be a more appropriate catch-all handler for
2553new dynamic roots and threads.
2554
cf78e9e8 2555\f
c484bf7f 2556Changes in Guile 1.1 (released Friday, May 16 1997):
f3b1485f
JB
2557
2558* Changes to the distribution.
2559
2560The Guile 1.0 distribution has been split up into several smaller
2561pieces:
2562guile-core --- the Guile interpreter itself.
2563guile-tcltk --- the interface between the Guile interpreter and
2564 Tcl/Tk; Tcl is an interpreter for a stringy language, and Tk
2565 is a toolkit for building graphical user interfaces.
2566guile-rgx-ctax --- the interface between Guile and the Rx regular
2567 expression matcher, and the translator for the Ctax
2568 programming language. These are packaged together because the
2569 Ctax translator uses Rx to parse Ctax source code.
2570
095936d2
JB
2571This NEWS file describes the changes made to guile-core since the 1.0
2572release.
2573
48d224d7
JB
2574We no longer distribute the documentation, since it was either out of
2575date, or incomplete. As soon as we have current documentation, we
2576will distribute it.
2577
0fcab5ed
JB
2578
2579
f3b1485f
JB
2580* Changes to the stand-alone interpreter
2581
48d224d7
JB
2582** guile now accepts command-line arguments compatible with SCSH, Olin
2583Shivers' Scheme Shell.
2584
2585In general, arguments are evaluated from left to right, but there are
2586exceptions. The following switches stop argument processing, and
2587stash all remaining command-line arguments as the value returned by
2588the (command-line) function.
2589 -s SCRIPT load Scheme source code from FILE, and exit
2590 -c EXPR evalute Scheme expression EXPR, and exit
2591 -- stop scanning arguments; run interactively
2592
2593The switches below are processed as they are encountered.
2594 -l FILE load Scheme source code from FILE
2595 -e FUNCTION after reading script, apply FUNCTION to
2596 command line arguments
2597 -ds do -s script at this point
2598 --emacs enable Emacs protocol (experimental)
2599 -h, --help display this help and exit
2600 -v, --version display version information and exit
2601 \ read arguments from following script lines
2602
2603So, for example, here is a Guile script named `ekko' (thanks, Olin)
2604which re-implements the traditional "echo" command:
2605
2606#!/usr/local/bin/guile -s
2607!#
2608(define (main args)
2609 (map (lambda (arg) (display arg) (display " "))
2610 (cdr args))
2611 (newline))
2612
2613(main (command-line))
2614
2615Suppose we invoke this script as follows:
2616
2617 ekko a speckled gecko
2618
2619Through the magic of Unix script processing (triggered by the `#!'
2620token at the top of the file), /usr/local/bin/guile receives the
2621following list of command-line arguments:
2622
2623 ("-s" "./ekko" "a" "speckled" "gecko")
2624
2625Unix inserts the name of the script after the argument specified on
2626the first line of the file (in this case, "-s"), and then follows that
2627with the arguments given to the script. Guile loads the script, which
2628defines the `main' function, and then applies it to the list of
2629remaining command-line arguments, ("a" "speckled" "gecko").
2630
095936d2
JB
2631In Unix, the first line of a script file must take the following form:
2632
2633#!INTERPRETER ARGUMENT
2634
2635where INTERPRETER is the absolute filename of the interpreter
2636executable, and ARGUMENT is a single command-line argument to pass to
2637the interpreter.
2638
2639You may only pass one argument to the interpreter, and its length is
2640limited. These restrictions can be annoying to work around, so Guile
2641provides a general mechanism (borrowed from, and compatible with,
2642SCSH) for circumventing them.
2643
2644If the ARGUMENT in a Guile script is a single backslash character,
2645`\', Guile will open the script file, parse arguments from its second
2646and subsequent lines, and replace the `\' with them. So, for example,
2647here is another implementation of the `ekko' script:
2648
2649#!/usr/local/bin/guile \
2650-e main -s
2651!#
2652(define (main args)
2653 (for-each (lambda (arg) (display arg) (display " "))
2654 (cdr args))
2655 (newline))
2656
2657If the user invokes this script as follows:
2658
2659 ekko a speckled gecko
2660
2661Unix expands this into
2662
2663 /usr/local/bin/guile \ ekko a speckled gecko
2664
2665When Guile sees the `\' argument, it replaces it with the arguments
2666read from the second line of the script, producing:
2667
2668 /usr/local/bin/guile -e main -s ekko a speckled gecko
2669
2670This tells Guile to load the `ekko' script, and apply the function
2671`main' to the argument list ("a" "speckled" "gecko").
2672
2673Here is how Guile parses the command-line arguments:
2674- Each space character terminates an argument. This means that two
2675 spaces in a row introduce an empty-string argument.
2676- The tab character is not permitted (unless you quote it with the
2677 backslash character, as described below), to avoid confusion.
2678- The newline character terminates the sequence of arguments, and will
2679 also terminate a final non-empty argument. (However, a newline
2680 following a space will not introduce a final empty-string argument;
2681 it only terminates the argument list.)
2682- The backslash character is the escape character. It escapes
2683 backslash, space, tab, and newline. The ANSI C escape sequences
2684 like \n and \t are also supported. These produce argument
2685 constituents; the two-character combination \n doesn't act like a
2686 terminating newline. The escape sequence \NNN for exactly three
2687 octal digits reads as the character whose ASCII code is NNN. As
2688 above, characters produced this way are argument constituents.
2689 Backslash followed by other characters is not allowed.
2690
48d224d7
JB
2691* Changes to the procedure for linking libguile with your programs
2692
2693** Guile now builds and installs a shared guile library, if your
2694system support shared libraries. (It still builds a static library on
2695all systems.) Guile automatically detects whether your system
2696supports shared libraries. To prevent Guile from buildisg shared
2697libraries, pass the `--disable-shared' flag to the configure script.
2698
2699Guile takes longer to compile when it builds shared libraries, because
2700it must compile every file twice --- once to produce position-
2701independent object code, and once to produce normal object code.
2702
2703** The libthreads library has been merged into libguile.
2704
2705To link a program against Guile, you now need only link against
2706-lguile and -lqt; -lthreads is no longer needed. If you are using
2707autoconf to generate configuration scripts for your application, the
2708following lines should suffice to add the appropriate libraries to
2709your link command:
2710
2711### Find quickthreads and libguile.
2712AC_CHECK_LIB(qt, main)
2713AC_CHECK_LIB(guile, scm_shell)
f3b1485f
JB
2714
2715* Changes to Scheme functions
2716
095936d2
JB
2717** Guile Scheme's special syntax for keyword objects is now optional,
2718and disabled by default.
2719
2720The syntax variation from R4RS made it difficult to port some
2721interesting packages to Guile. The routines which accepted keyword
2722arguments (mostly in the module system) have been modified to also
2723accept symbols whose names begin with `:'.
2724
2725To change the keyword syntax, you must first import the (ice-9 debug)
2726module:
2727 (use-modules (ice-9 debug))
2728
2729Then you can enable the keyword syntax as follows:
2730 (read-set! keywords 'prefix)
2731
2732To disable keyword syntax, do this:
2733 (read-set! keywords #f)
2734
2735** Many more primitive functions accept shared substrings as
2736arguments. In the past, these functions required normal, mutable
2737strings as arguments, although they never made use of this
2738restriction.
2739
2740** The uniform array functions now operate on byte vectors. These
2741functions are `array-fill!', `serial-array-copy!', `array-copy!',
2742`serial-array-map', `array-map', `array-for-each', and
2743`array-index-map!'.
2744
2745** The new functions `trace' and `untrace' implement simple debugging
2746support for Scheme functions.
2747
2748The `trace' function accepts any number of procedures as arguments,
2749and tells the Guile interpreter to display each procedure's name and
2750arguments each time the procedure is invoked. When invoked with no
2751arguments, `trace' returns the list of procedures currently being
2752traced.
2753
2754The `untrace' function accepts any number of procedures as arguments,
2755and tells the Guile interpreter not to trace them any more. When
2756invoked with no arguments, `untrace' untraces all curretly traced
2757procedures.
2758
2759The tracing in Guile has an advantage over most other systems: we
2760don't create new procedure objects, but mark the procedure objects
2761themselves. This means that anonymous and internal procedures can be
2762traced.
2763
2764** The function `assert-repl-prompt' has been renamed to
2765`set-repl-prompt!'. It takes one argument, PROMPT.
2766- If PROMPT is #f, the Guile read-eval-print loop will not prompt.
2767- If PROMPT is a string, we use it as a prompt.
2768- If PROMPT is a procedure accepting no arguments, we call it, and
2769 display the result as a prompt.
2770- Otherwise, we display "> ".
2771
2772** The new function `eval-string' reads Scheme expressions from a
2773string and evaluates them, returning the value of the last expression
2774in the string. If the string contains no expressions, it returns an
2775unspecified value.
2776
2777** The new function `thunk?' returns true iff its argument is a
2778procedure of zero arguments.
2779
2780** `defined?' is now a builtin function, instead of syntax. This
2781means that its argument should be quoted. It returns #t iff its
2782argument is bound in the current module.
2783
2784** The new syntax `use-modules' allows you to add new modules to your
2785environment without re-typing a complete `define-module' form. It
2786accepts any number of module names as arguments, and imports their
2787public bindings into the current module.
2788
2789** The new function (module-defined? NAME MODULE) returns true iff
2790NAME, a symbol, is defined in MODULE, a module object.
2791
2792** The new function `builtin-bindings' creates and returns a hash
2793table containing copies of all the root module's bindings.
2794
2795** The new function `builtin-weak-bindings' does the same as
2796`builtin-bindings', but creates a doubly-weak hash table.
2797
2798** The `equal?' function now considers variable objects to be
2799equivalent if they have the same name and the same value.
2800
2801** The new function `command-line' returns the command-line arguments
2802given to Guile, as a list of strings.
2803
2804When using guile as a script interpreter, `command-line' returns the
2805script's arguments; those processed by the interpreter (like `-s' or
2806`-c') are omitted. (In other words, you get the normal, expected
2807behavior.) Any application that uses scm_shell to process its
2808command-line arguments gets this behavior as well.
2809
2810** The new function `load-user-init' looks for a file called `.guile'
2811in the user's home directory, and loads it if it exists. This is
2812mostly for use by the code generated by scm_compile_shell_switches,
2813but we thought it might also be useful in other circumstances.
2814
2815** The new function `log10' returns the base-10 logarithm of its
2816argument.
2817
2818** Changes to I/O functions
2819
2820*** The functions `read', `primitive-load', `read-and-eval!', and
2821`primitive-load-path' no longer take optional arguments controlling
2822case insensitivity and a `#' parser.
2823
2824Case sensitivity is now controlled by a read option called
2825`case-insensitive'. The user can add new `#' syntaxes with the
2826`read-hash-extend' function (see below).
2827
2828*** The new function `read-hash-extend' allows the user to change the
2829syntax of Guile Scheme in a somewhat controlled way.
2830
2831(read-hash-extend CHAR PROC)
2832 When parsing S-expressions, if we read a `#' character followed by
2833 the character CHAR, use PROC to parse an object from the stream.
2834 If PROC is #f, remove any parsing procedure registered for CHAR.
2835
2836 The reader applies PROC to two arguments: CHAR and an input port.
2837
2838*** The new functions read-delimited and read-delimited! provide a
2839general mechanism for doing delimited input on streams.
2840
2841(read-delimited DELIMS [PORT HANDLE-DELIM])
2842 Read until we encounter one of the characters in DELIMS (a string),
2843 or end-of-file. PORT is the input port to read from; it defaults to
2844 the current input port. The HANDLE-DELIM parameter determines how
2845 the terminating character is handled; it should be one of the
2846 following symbols:
2847
2848 'trim omit delimiter from result
2849 'peek leave delimiter character in input stream
2850 'concat append delimiter character to returned value
2851 'split return a pair: (RESULT . TERMINATOR)
2852
2853 HANDLE-DELIM defaults to 'peek.
2854
2855(read-delimited! DELIMS BUF [PORT HANDLE-DELIM START END])
2856 A side-effecting variant of `read-delimited'.
2857
2858 The data is written into the string BUF at the indices in the
2859 half-open interval [START, END); the default interval is the whole
2860 string: START = 0 and END = (string-length BUF). The values of
2861 START and END must specify a well-defined interval in BUF, i.e.
2862 0 <= START <= END <= (string-length BUF).
2863
2864 It returns NBYTES, the number of bytes read. If the buffer filled
2865 up without a delimiter character being found, it returns #f. If the
2866 port is at EOF when the read starts, it returns the EOF object.
2867
2868 If an integer is returned (i.e., the read is successfully terminated
2869 by reading a delimiter character), then the HANDLE-DELIM parameter
2870 determines how to handle the terminating character. It is described
2871 above, and defaults to 'peek.
2872
2873(The descriptions of these functions were borrowed from the SCSH
2874manual, by Olin Shivers and Brian Carlstrom.)
2875
2876*** The `%read-delimited!' function is the primitive used to implement
2877`read-delimited' and `read-delimited!'.
2878
2879(%read-delimited! DELIMS BUF GOBBLE? [PORT START END])
2880
2881This returns a pair of values: (TERMINATOR . NUM-READ).
2882- TERMINATOR describes why the read was terminated. If it is a
2883 character or the eof object, then that is the value that terminated
2884 the read. If it is #f, the function filled the buffer without finding
2885 a delimiting character.
2886- NUM-READ is the number of characters read into BUF.
2887
2888If the read is successfully terminated by reading a delimiter
2889character, then the gobble? parameter determines what to do with the
2890terminating character. If true, the character is removed from the
2891input stream; if false, the character is left in the input stream
2892where a subsequent read operation will retrieve it. In either case,
2893the character is also the first value returned by the procedure call.
2894
2895(The descriptions of this function was borrowed from the SCSH manual,
2896by Olin Shivers and Brian Carlstrom.)
2897
2898*** The `read-line' and `read-line!' functions have changed; they now
2899trim the terminator by default; previously they appended it to the
2900returned string. For the old behavior, use (read-line PORT 'concat).
2901
2902*** The functions `uniform-array-read!' and `uniform-array-write!' now
2903take new optional START and END arguments, specifying the region of
2904the array to read and write.
2905
f348c807
JB
2906*** The `ungetc-char-ready?' function has been removed. We feel it's
2907inappropriate for an interface to expose implementation details this
2908way.
095936d2
JB
2909
2910** Changes to the Unix library and system call interface
2911
2912*** The new fcntl function provides access to the Unix `fcntl' system
2913call.
2914
2915(fcntl PORT COMMAND VALUE)
2916 Apply COMMAND to PORT's file descriptor, with VALUE as an argument.
2917 Values for COMMAND are:
2918
2919 F_DUPFD duplicate a file descriptor
2920 F_GETFD read the descriptor's close-on-exec flag
2921 F_SETFD set the descriptor's close-on-exec flag to VALUE
2922 F_GETFL read the descriptor's flags, as set on open
2923 F_SETFL set the descriptor's flags, as set on open to VALUE
2924 F_GETOWN return the process ID of a socket's owner, for SIGIO
2925 F_SETOWN set the process that owns a socket to VALUE, for SIGIO
2926 FD_CLOEXEC not sure what this is
2927
2928For details, see the documentation for the fcntl system call.
2929
2930*** The arguments to `select' have changed, for compatibility with
2931SCSH. The TIMEOUT parameter may now be non-integral, yielding the
2932expected behavior. The MILLISECONDS parameter has been changed to
2933MICROSECONDS, to more closely resemble the underlying system call.
2934The RVEC, WVEC, and EVEC arguments can now be vectors; the type of the
2935corresponding return set will be the same.
2936
2937*** The arguments to the `mknod' system call have changed. They are
2938now:
2939
2940(mknod PATH TYPE PERMS DEV)
2941 Create a new file (`node') in the file system. PATH is the name of
2942 the file to create. TYPE is the kind of file to create; it should
2943 be 'fifo, 'block-special, or 'char-special. PERMS specifies the
2944 permission bits to give the newly created file. If TYPE is
2945 'block-special or 'char-special, DEV specifies which device the
2946 special file refers to; its interpretation depends on the kind of
2947 special file being created.
2948
2949*** The `fork' function has been renamed to `primitive-fork', to avoid
2950clashing with various SCSH forks.
2951
2952*** The `recv' and `recvfrom' functions have been renamed to `recv!'
2953and `recvfrom!'. They no longer accept a size for a second argument;
2954you must pass a string to hold the received value. They no longer
2955return the buffer. Instead, `recv' returns the length of the message
2956received, and `recvfrom' returns a pair containing the packet's length
2957and originating address.
2958
2959*** The file descriptor datatype has been removed, as have the
2960`read-fd', `write-fd', `close', `lseek', and `dup' functions.
2961We plan to replace these functions with a SCSH-compatible interface.
2962
2963*** The `create' function has been removed; it's just a special case
2964of `open'.
2965
2966*** There are new functions to break down process termination status
2967values. In the descriptions below, STATUS is a value returned by
2968`waitpid'.
2969
2970(status:exit-val STATUS)
2971 If the child process exited normally, this function returns the exit
2972 code for the child process (i.e., the value passed to exit, or
2973 returned from main). If the child process did not exit normally,
2974 this function returns #f.
2975
2976(status:stop-sig STATUS)
2977 If the child process was suspended by a signal, this function
2978 returns the signal that suspended the child. Otherwise, it returns
2979 #f.
2980
2981(status:term-sig STATUS)
2982 If the child process terminated abnormally, this function returns
2983 the signal that terminated the child. Otherwise, this function
2984 returns false.
2985
2986POSIX promises that exactly one of these functions will return true on
2987a valid STATUS value.
2988
2989These functions are compatible with SCSH.
2990
2991*** There are new accessors and setters for the broken-out time vectors
48d224d7
JB
2992returned by `localtime', `gmtime', and that ilk. They are:
2993
2994 Component Accessor Setter
2995 ========================= ============ ============
2996 seconds tm:sec set-tm:sec
2997 minutes tm:min set-tm:min
2998 hours tm:hour set-tm:hour
2999 day of the month tm:mday set-tm:mday
3000 month tm:mon set-tm:mon
3001 year tm:year set-tm:year
3002 day of the week tm:wday set-tm:wday
3003 day in the year tm:yday set-tm:yday
3004 daylight saving time tm:isdst set-tm:isdst
3005 GMT offset, seconds tm:gmtoff set-tm:gmtoff
3006 name of time zone tm:zone set-tm:zone
3007
095936d2
JB
3008*** There are new accessors for the vectors returned by `uname',
3009describing the host system:
48d224d7
JB
3010
3011 Component Accessor
3012 ============================================== ================
3013 name of the operating system implementation utsname:sysname
3014 network name of this machine utsname:nodename
3015 release level of the operating system utsname:release
3016 version level of the operating system utsname:version
3017 machine hardware platform utsname:machine
3018
095936d2
JB
3019*** There are new accessors for the vectors returned by `getpw',
3020`getpwnam', `getpwuid', and `getpwent', describing entries from the
3021system's user database:
3022
3023 Component Accessor
3024 ====================== =================
3025 user name passwd:name
3026 user password passwd:passwd
3027 user id passwd:uid
3028 group id passwd:gid
3029 real name passwd:gecos
3030 home directory passwd:dir
3031 shell program passwd:shell
3032
3033*** There are new accessors for the vectors returned by `getgr',
3034`getgrnam', `getgrgid', and `getgrent', describing entries from the
3035system's group database:
3036
3037 Component Accessor
3038 ======================= ============
3039 group name group:name
3040 group password group:passwd
3041 group id group:gid
3042 group members group:mem
3043
3044*** There are new accessors for the vectors returned by `gethost',
3045`gethostbyaddr', `gethostbyname', and `gethostent', describing
3046internet hosts:
3047
3048 Component Accessor
3049 ========================= ===============
3050 official name of host hostent:name
3051 alias list hostent:aliases
3052 host address type hostent:addrtype
3053 length of address hostent:length
3054 list of addresses hostent:addr-list
3055
3056*** There are new accessors for the vectors returned by `getnet',
3057`getnetbyaddr', `getnetbyname', and `getnetent', describing internet
3058networks:
3059
3060 Component Accessor
3061 ========================= ===============
3062 official name of net netent:name
3063 alias list netent:aliases
3064 net number type netent:addrtype
3065 net number netent:net
3066
3067*** There are new accessors for the vectors returned by `getproto',
3068`getprotobyname', `getprotobynumber', and `getprotoent', describing
3069internet protocols:
3070
3071 Component Accessor
3072 ========================= ===============
3073 official protocol name protoent:name
3074 alias list protoent:aliases
3075 protocol number protoent:proto
3076
3077*** There are new accessors for the vectors returned by `getserv',
3078`getservbyname', `getservbyport', and `getservent', describing
3079internet protocols:
3080
3081 Component Accessor
3082 ========================= ===============
3083 official service name servent:name
3084 alias list servent:aliases
3085 port number servent:port
3086 protocol to use servent:proto
3087
3088*** There are new accessors for the sockaddr structures returned by
3089`accept', `getsockname', `getpeername', `recvfrom!':
3090
3091 Component Accessor
3092 ======================================== ===============
3093 address format (`family') sockaddr:fam
3094 path, for file domain addresses sockaddr:path
3095 address, for internet domain addresses sockaddr:addr
3096 TCP or UDP port, for internet sockaddr:port
3097
3098*** The `getpwent', `getgrent', `gethostent', `getnetent',
3099`getprotoent', and `getservent' functions now return #f at the end of
3100the user database. (They used to throw an exception.)
3101
3102Note that calling MUMBLEent function is equivalent to calling the
3103corresponding MUMBLE function with no arguments.
3104
3105*** The `setpwent', `setgrent', `sethostent', `setnetent',
3106`setprotoent', and `setservent' routines now take no arguments.
3107
3108*** The `gethost', `getproto', `getnet', and `getserv' functions now
3109provide more useful information when they throw an exception.
3110
3111*** The `lnaof' function has been renamed to `inet-lnaof'.
3112
3113*** Guile now claims to have the `current-time' feature.
3114
3115*** The `mktime' function now takes an optional second argument ZONE,
3116giving the time zone to use for the conversion. ZONE should be a
3117string, in the same format as expected for the "TZ" environment variable.
3118
3119*** The `strptime' function now returns a pair (TIME . COUNT), where
3120TIME is the parsed time as a vector, and COUNT is the number of
3121characters from the string left unparsed. This function used to
3122return the remaining characters as a string.
3123
3124*** The `gettimeofday' function has replaced the old `time+ticks' function.
3125The return value is now (SECONDS . MICROSECONDS); the fractional
3126component is no longer expressed in "ticks".
3127
3128*** The `ticks/sec' constant has been removed, in light of the above change.
6685dc83 3129
ea00ecba
MG
3130* Changes to the gh_ interface
3131
3132** gh_eval_str() now returns an SCM object which is the result of the
3133evaluation
3134
aaef0d2a
MG
3135** gh_scm2str() now copies the Scheme data to a caller-provided C
3136array
3137
3138** gh_scm2newstr() now makes a C array, copies the Scheme data to it,
3139and returns the array
3140
3141** gh_scm2str0() is gone: there is no need to distinguish
3142null-terminated from non-null-terminated, since gh_scm2newstr() allows
3143the user to interpret the data both ways.
3144
f3b1485f
JB
3145* Changes to the scm_ interface
3146
095936d2
JB
3147** The new function scm_symbol_value0 provides an easy way to get a
3148symbol's value from C code:
3149
3150SCM scm_symbol_value0 (char *NAME)
3151 Return the value of the symbol named by the null-terminated string
3152 NAME in the current module. If the symbol named NAME is unbound in
3153 the current module, return SCM_UNDEFINED.
3154
3155** The new function scm_sysintern0 creates new top-level variables,
3156without assigning them a value.
3157
3158SCM scm_sysintern0 (char *NAME)
3159 Create a new Scheme top-level variable named NAME. NAME is a
3160 null-terminated string. Return the variable's value cell.
3161
3162** The function scm_internal_catch is the guts of catch. It handles
3163all the mechanics of setting up a catch target, invoking the catch
3164body, and perhaps invoking the handler if the body does a throw.
3165
3166The function is designed to be usable from C code, but is general
3167enough to implement all the semantics Guile Scheme expects from throw.
3168
3169TAG is the catch tag. Typically, this is a symbol, but this function
3170doesn't actually care about that.
3171
3172BODY is a pointer to a C function which runs the body of the catch;
3173this is the code you can throw from. We call it like this:
3174 BODY (BODY_DATA, JMPBUF)
3175where:
3176 BODY_DATA is just the BODY_DATA argument we received; we pass it
3177 through to BODY as its first argument. The caller can make
3178 BODY_DATA point to anything useful that BODY might need.
3179 JMPBUF is the Scheme jmpbuf object corresponding to this catch,
3180 which we have just created and initialized.
3181
3182HANDLER is a pointer to a C function to deal with a throw to TAG,
3183should one occur. We call it like this:
3184 HANDLER (HANDLER_DATA, THROWN_TAG, THROW_ARGS)
3185where
3186 HANDLER_DATA is the HANDLER_DATA argument we recevied; it's the
3187 same idea as BODY_DATA above.
3188 THROWN_TAG is the tag that the user threw to; usually this is
3189 TAG, but it could be something else if TAG was #t (i.e., a
3190 catch-all), or the user threw to a jmpbuf.
3191 THROW_ARGS is the list of arguments the user passed to the THROW
3192 function.
3193
3194BODY_DATA is just a pointer we pass through to BODY. HANDLER_DATA
3195is just a pointer we pass through to HANDLER. We don't actually
3196use either of those pointers otherwise ourselves. The idea is
3197that, if our caller wants to communicate something to BODY or
3198HANDLER, it can pass a pointer to it as MUMBLE_DATA, which BODY and
3199HANDLER can then use. Think of it as a way to make BODY and
3200HANDLER closures, not just functions; MUMBLE_DATA points to the
3201enclosed variables.
3202
3203Of course, it's up to the caller to make sure that any data a
3204MUMBLE_DATA needs is protected from GC. A common way to do this is
3205to make MUMBLE_DATA a pointer to data stored in an automatic
3206structure variable; since the collector must scan the stack for
3207references anyway, this assures that any references in MUMBLE_DATA
3208will be found.
3209
3210** The new function scm_internal_lazy_catch is exactly like
3211scm_internal_catch, except:
3212
3213- It does not unwind the stack (this is the major difference).
3214- If handler returns, its value is returned from the throw.
3215- BODY always receives #f as its JMPBUF argument (since there's no
3216 jmpbuf associated with a lazy catch, because we don't unwind the
3217 stack.)
3218
3219** scm_body_thunk is a new body function you can pass to
3220scm_internal_catch if you want the body to be like Scheme's `catch'
3221--- a thunk, or a function of one argument if the tag is #f.
3222
3223BODY_DATA is a pointer to a scm_body_thunk_data structure, which
3224contains the Scheme procedure to invoke as the body, and the tag
3225we're catching. If the tag is #f, then we pass JMPBUF (created by
3226scm_internal_catch) to the body procedure; otherwise, the body gets
3227no arguments.
3228
3229** scm_handle_by_proc is a new handler function you can pass to
3230scm_internal_catch if you want the handler to act like Scheme's catch
3231--- call a procedure with the tag and the throw arguments.
3232
3233If the user does a throw to this catch, this function runs a handler
3234procedure written in Scheme. HANDLER_DATA is a pointer to an SCM
3235variable holding the Scheme procedure object to invoke. It ought to
3236be a pointer to an automatic variable (i.e., one living on the stack),
3237or the procedure object should be otherwise protected from GC.
3238
3239** scm_handle_by_message is a new handler function to use with
3240`scm_internal_catch' if you want Guile to print a message and die.
3241It's useful for dealing with throws to uncaught keys at the top level.
3242
3243HANDLER_DATA, if non-zero, is assumed to be a char * pointing to a
3244message header to print; if zero, we use "guile" instead. That
3245text is followed by a colon, then the message described by ARGS.
3246
3247** The return type of scm_boot_guile is now void; the function does
3248not return a value, and indeed, never returns at all.
3249
f3b1485f
JB
3250** The new function scm_shell makes it easy for user applications to
3251process command-line arguments in a way that is compatible with the
3252stand-alone guile interpreter (which is in turn compatible with SCSH,
3253the Scheme shell).
3254
3255To use the scm_shell function, first initialize any guile modules
3256linked into your application, and then call scm_shell with the values
7ed46dc8 3257of ARGC and ARGV your `main' function received. scm_shell will add
f3b1485f
JB
3258any SCSH-style meta-arguments from the top of the script file to the
3259argument vector, and then process the command-line arguments. This
3260generally means loading a script file or starting up an interactive
3261command interpreter. For details, see "Changes to the stand-alone
3262interpreter" above.
3263
095936d2
JB
3264** The new functions scm_get_meta_args and scm_count_argv help you
3265implement the SCSH-style meta-argument, `\'.
3266
3267char **scm_get_meta_args (int ARGC, char **ARGV)
3268 If the second element of ARGV is a string consisting of a single
3269 backslash character (i.e. "\\" in Scheme notation), open the file
3270 named by the following argument, parse arguments from it, and return
3271 the spliced command line. The returned array is terminated by a
3272 null pointer.
3273
3274 For details of argument parsing, see above, under "guile now accepts
3275 command-line arguments compatible with SCSH..."
3276
3277int scm_count_argv (char **ARGV)
3278 Count the arguments in ARGV, assuming it is terminated by a null
3279 pointer.
3280
3281For an example of how these functions might be used, see the source
3282code for the function scm_shell in libguile/script.c.
3283
3284You will usually want to use scm_shell instead of calling this
3285function yourself.
3286
3287** The new function scm_compile_shell_switches turns an array of
3288command-line arguments into Scheme code to carry out the actions they
3289describe. Given ARGC and ARGV, it returns a Scheme expression to
3290evaluate, and calls scm_set_program_arguments to make any remaining
3291command-line arguments available to the Scheme code. For example,
3292given the following arguments:
3293
3294 -e main -s ekko a speckled gecko
3295
3296scm_set_program_arguments will return the following expression:
3297
3298 (begin (load "ekko") (main (command-line)) (quit))
3299
3300You will usually want to use scm_shell instead of calling this
3301function yourself.
3302
3303** The function scm_shell_usage prints a usage message appropriate for
3304an interpreter that uses scm_compile_shell_switches to handle its
3305command-line arguments.
3306
3307void scm_shell_usage (int FATAL, char *MESSAGE)
3308 Print a usage message to the standard error output. If MESSAGE is
3309 non-zero, write it before the usage message, followed by a newline.
3310 If FATAL is non-zero, exit the process, using FATAL as the
3311 termination status. (If you want to be compatible with Guile,
3312 always use 1 as the exit status when terminating due to command-line
3313 usage problems.)
3314
3315You will usually want to use scm_shell instead of calling this
3316function yourself.
48d224d7
JB
3317
3318** scm_eval_0str now returns SCM_UNSPECIFIED if the string contains no
095936d2
JB
3319expressions. It used to return SCM_EOL. Earth-shattering.
3320
3321** The macros for declaring scheme objects in C code have been
3322rearranged slightly. They are now:
3323
3324SCM_SYMBOL (C_NAME, SCHEME_NAME)
3325 Declare a static SCM variable named C_NAME, and initialize it to
3326 point to the Scheme symbol whose name is SCHEME_NAME. C_NAME should
3327 be a C identifier, and SCHEME_NAME should be a C string.
3328
3329SCM_GLOBAL_SYMBOL (C_NAME, SCHEME_NAME)
3330 Just like SCM_SYMBOL, but make C_NAME globally visible.
3331
3332SCM_VCELL (C_NAME, SCHEME_NAME)
3333 Create a global variable at the Scheme level named SCHEME_NAME.
3334 Declare a static SCM variable named C_NAME, and initialize it to
3335 point to the Scheme variable's value cell.
3336
3337SCM_GLOBAL_VCELL (C_NAME, SCHEME_NAME)
3338 Just like SCM_VCELL, but make C_NAME globally visible.
3339
3340The `guile-snarf' script writes initialization code for these macros
3341to its standard output, given C source code as input.
3342
3343The SCM_GLOBAL macro is gone.
3344
3345** The scm_read_line and scm_read_line_x functions have been replaced
3346by Scheme code based on the %read-delimited! procedure (known to C
3347code as scm_read_delimited_x). See its description above for more
3348information.
48d224d7 3349
095936d2
JB
3350** The function scm_sys_open has been renamed to scm_open. It now
3351returns a port instead of an FD object.
ea00ecba 3352
095936d2
JB
3353* The dynamic linking support has changed. For more information, see
3354libguile/DYNAMIC-LINKING.
ea00ecba 3355
f7b47737
JB
3356\f
3357Guile 1.0b3
3065a62a 3358
f3b1485f
JB
3359User-visible changes from Thursday, September 5, 1996 until Guile 1.0
3360(Sun 5 Jan 1997):
3065a62a 3361
4b521edb 3362* Changes to the 'guile' program:
3065a62a 3363
4b521edb
JB
3364** Guile now loads some new files when it starts up. Guile first
3365searches the load path for init.scm, and loads it if found. Then, if
3366Guile is not being used to execute a script, and the user's home
3367directory contains a file named `.guile', Guile loads that.
c6486f8a 3368
4b521edb 3369** You can now use Guile as a shell script interpreter.
3065a62a
JB
3370
3371To paraphrase the SCSH manual:
3372
3373 When Unix tries to execute an executable file whose first two
3374 characters are the `#!', it treats the file not as machine code to
3375 be directly executed by the native processor, but as source code
3376 to be executed by some interpreter. The interpreter to use is
3377 specified immediately after the #! sequence on the first line of
3378 the source file. The kernel reads in the name of the interpreter,
3379 and executes that instead. It passes the interpreter the source
3380 filename as its first argument, with the original arguments
3381 following. Consult the Unix man page for the `exec' system call
3382 for more information.
3383
1a1945be
JB
3384Now you can use Guile as an interpreter, using a mechanism which is a
3385compatible subset of that provided by SCSH.
3386
3065a62a
JB
3387Guile now recognizes a '-s' command line switch, whose argument is the
3388name of a file of Scheme code to load. It also treats the two
3389characters `#!' as the start of a comment, terminated by `!#'. Thus,
3390to make a file of Scheme code directly executable by Unix, insert the
3391following two lines at the top of the file:
3392
3393#!/usr/local/bin/guile -s
3394!#
3395
3396Guile treats the argument of the `-s' command-line switch as the name
3397of a file of Scheme code to load, and treats the sequence `#!' as the
3398start of a block comment, terminated by `!#'.
3399
3400For example, here's a version of 'echo' written in Scheme:
3401
3402#!/usr/local/bin/guile -s
3403!#
3404(let loop ((args (cdr (program-arguments))))
3405 (if (pair? args)
3406 (begin
3407 (display (car args))
3408 (if (pair? (cdr args))
3409 (display " "))
3410 (loop (cdr args)))))
3411(newline)
3412
3413Why does `#!' start a block comment terminated by `!#', instead of the
3414end of the line? That is the notation SCSH uses, and although we
3415don't yet support the other SCSH features that motivate that choice,
3416we would like to be backward-compatible with any existing Guile
3763761c
JB
3417scripts once we do. Furthermore, if the path to Guile on your system
3418is too long for your kernel, you can start the script with this
3419horrible hack:
3420
3421#!/bin/sh
3422exec /really/long/path/to/guile -s "$0" ${1+"$@"}
3423!#
3065a62a
JB
3424
3425Note that some very old Unix systems don't support the `#!' syntax.
3426
c6486f8a 3427
4b521edb 3428** You can now run Guile without installing it.
6685dc83
JB
3429
3430Previous versions of the interactive Guile interpreter (`guile')
3431couldn't start up unless Guile's Scheme library had been installed;
3432they used the value of the environment variable `SCHEME_LOAD_PATH'
3433later on in the startup process, but not to find the startup code
3434itself. Now Guile uses `SCHEME_LOAD_PATH' in all searches for Scheme
3435code.
3436
3437To run Guile without installing it, build it in the normal way, and
3438then set the environment variable `SCHEME_LOAD_PATH' to a
3439colon-separated list of directories, including the top-level directory
3440of the Guile sources. For example, if you unpacked Guile so that the
3441full filename of this NEWS file is /home/jimb/guile-1.0b3/NEWS, then
3442you might say
3443
3444 export SCHEME_LOAD_PATH=/home/jimb/my-scheme:/home/jimb/guile-1.0b3
3445
c6486f8a 3446
4b521edb
JB
3447** Guile's read-eval-print loop no longer prints #<unspecified>
3448results. If the user wants to see this, she can evaluate the
3449expression (assert-repl-print-unspecified #t), perhaps in her startup
48d224d7 3450file.
6685dc83 3451
4b521edb
JB
3452** Guile no longer shows backtraces by default when an error occurs;
3453however, it does display a message saying how to get one, and how to
3454request that they be displayed by default. After an error, evaluate
3455 (backtrace)
3456to see a backtrace, and
3457 (debug-enable 'backtrace)
3458to see them by default.
6685dc83 3459
6685dc83 3460
d9fb83d9 3461
4b521edb
JB
3462* Changes to Guile Scheme:
3463
3464** Guile now distinguishes between #f and the empty list.
3465
3466This is for compatibility with the IEEE standard, the (possibly)
3467upcoming Revised^5 Report on Scheme, and many extant Scheme
3468implementations.
3469
3470Guile used to have #f and '() denote the same object, to make Scheme's
3471type system more compatible with Emacs Lisp's. However, the change
3472caused too much trouble for Scheme programmers, and we found another
3473way to reconcile Emacs Lisp with Scheme that didn't require this.
3474
3475
3476** Guile's delq, delv, delete functions, and their destructive
c6486f8a
JB
3477counterparts, delq!, delv!, and delete!, now remove all matching
3478elements from the list, not just the first. This matches the behavior
3479of the corresponding Emacs Lisp functions, and (I believe) the Maclisp
3480functions which inspired them.
3481
3482I recognize that this change may break code in subtle ways, but it
3483seems best to make the change before the FSF's first Guile release,
3484rather than after.
3485
3486
4b521edb 3487** The compiled-library-path function has been deleted from libguile.
6685dc83 3488
4b521edb 3489** The facilities for loading Scheme source files have changed.
c6486f8a 3490
4b521edb 3491*** The variable %load-path now tells Guile which directories to search
6685dc83
JB
3492for Scheme code. Its value is a list of strings, each of which names
3493a directory.
3494
4b521edb
JB
3495*** The variable %load-extensions now tells Guile which extensions to
3496try appending to a filename when searching the load path. Its value
3497is a list of strings. Its default value is ("" ".scm").
3498
3499*** (%search-load-path FILENAME) searches the directories listed in the
3500value of the %load-path variable for a Scheme file named FILENAME,
3501with all the extensions listed in %load-extensions. If it finds a
3502match, then it returns its full filename. If FILENAME is absolute, it
3503returns it unchanged. Otherwise, it returns #f.
6685dc83 3504
4b521edb
JB
3505%search-load-path will not return matches that refer to directories.
3506
3507*** (primitive-load FILENAME :optional CASE-INSENSITIVE-P SHARP)
3508uses %seach-load-path to find a file named FILENAME, and loads it if
3509it finds it. If it can't read FILENAME for any reason, it throws an
3510error.
6685dc83
JB
3511
3512The arguments CASE-INSENSITIVE-P and SHARP are interpreted as by the
4b521edb
JB
3513`read' function.
3514
3515*** load uses the same searching semantics as primitive-load.
3516
3517*** The functions %try-load, try-load-with-path, %load, load-with-path,
3518basic-try-load-with-path, basic-load-with-path, try-load-module-with-
3519path, and load-module-with-path have been deleted. The functions
3520above should serve their purposes.
3521
3522*** If the value of the variable %load-hook is a procedure,
3523`primitive-load' applies its value to the name of the file being
3524loaded (without the load path directory name prepended). If its value
3525is #f, it is ignored. Otherwise, an error occurs.
3526
3527This is mostly useful for printing load notification messages.
3528
3529
3530** The function `eval!' is no longer accessible from the scheme level.
3531We can't allow operations which introduce glocs into the scheme level,
3532because Guile's type system can't handle these as data. Use `eval' or
3533`read-and-eval!' (see below) as replacement.
3534
3535** The new function read-and-eval! reads an expression from PORT,
3536evaluates it, and returns the result. This is more efficient than
3537simply calling `read' and `eval', since it is not necessary to make a
3538copy of the expression for the evaluator to munge.
3539
3540Its optional arguments CASE_INSENSITIVE_P and SHARP are interpreted as
3541for the `read' function.
3542
3543
3544** The function `int?' has been removed; its definition was identical
3545to that of `integer?'.
3546
3547** The functions `<?', `<?', `<=?', `=?', `>?', and `>=?'. Code should
3548use the R4RS names for these functions.
3549
3550** The function object-properties no longer returns the hash handle;
3551it simply returns the object's property list.
3552
3553** Many functions have been changed to throw errors, instead of
3554returning #f on failure. The point of providing exception handling in
3555the language is to simplify the logic of user code, but this is less
3556useful if Guile's primitives don't throw exceptions.
3557
3558** The function `fileno' has been renamed from `%fileno'.
3559
3560** The function primitive-mode->fdes returns #t or #f now, not 1 or 0.
3561
3562
3563* Changes to Guile's C interface:
3564
3565** The library's initialization procedure has been simplified.
3566scm_boot_guile now has the prototype:
3567
3568void scm_boot_guile (int ARGC,
3569 char **ARGV,
3570 void (*main_func) (),
3571 void *closure);
3572
3573scm_boot_guile calls MAIN_FUNC, passing it CLOSURE, ARGC, and ARGV.
3574MAIN_FUNC should do all the work of the program (initializing other
3575packages, reading user input, etc.) before returning. When MAIN_FUNC
3576returns, call exit (0); this function never returns. If you want some
3577other exit value, MAIN_FUNC may call exit itself.
3578
3579scm_boot_guile arranges for program-arguments to return the strings
3580given by ARGC and ARGV. If MAIN_FUNC modifies ARGC/ARGV, should call
3581scm_set_program_arguments with the final list, so Scheme code will
3582know which arguments have been processed.
3583
3584scm_boot_guile establishes a catch-all catch handler which prints an
3585error message and exits the process. This means that Guile exits in a
3586coherent way when system errors occur and the user isn't prepared to
3587handle it. If the user doesn't like this behavior, they can establish
3588their own universal catcher in MAIN_FUNC to shadow this one.
3589
3590Why must the caller do all the real work from MAIN_FUNC? The garbage
3591collector assumes that all local variables of type SCM will be above
3592scm_boot_guile's stack frame on the stack. If you try to manipulate
3593SCM values after this function returns, it's the luck of the draw
3594whether the GC will be able to find the objects you allocate. So,
3595scm_boot_guile function exits, rather than returning, to discourage
3596people from making that mistake.
3597
3598The IN, OUT, and ERR arguments were removed; there are other
3599convenient ways to override these when desired.
3600
3601The RESULT argument was deleted; this function should never return.
3602
3603The BOOT_CMD argument was deleted; the MAIN_FUNC argument is more
3604general.
3605
3606
3607** Guile's header files should no longer conflict with your system's
3608header files.
3609
3610In order to compile code which #included <libguile.h>, previous
3611versions of Guile required you to add a directory containing all the
3612Guile header files to your #include path. This was a problem, since
3613Guile's header files have names which conflict with many systems'
3614header files.
3615
3616Now only <libguile.h> need appear in your #include path; you must
3617refer to all Guile's other header files as <libguile/mumble.h>.
3618Guile's installation procedure puts libguile.h in $(includedir), and
3619the rest in $(includedir)/libguile.
3620
3621
3622** Two new C functions, scm_protect_object and scm_unprotect_object,
3623have been added to the Guile library.
3624
3625scm_protect_object (OBJ) protects OBJ from the garbage collector.
3626OBJ will not be freed, even if all other references are dropped,
3627until someone does scm_unprotect_object (OBJ). Both functions
3628return OBJ.
3629
3630Note that calls to scm_protect_object do not nest. You can call
3631scm_protect_object any number of times on a given object, and the
3632next call to scm_unprotect_object will unprotect it completely.
3633
3634Basically, scm_protect_object and scm_unprotect_object just
3635maintain a list of references to things. Since the GC knows about
3636this list, all objects it mentions stay alive. scm_protect_object
3637adds its argument to the list; scm_unprotect_object remove its
3638argument from the list.
3639
3640
3641** scm_eval_0str now returns the value of the last expression
3642evaluated.
3643
3644** The new function scm_read_0str reads an s-expression from a
3645null-terminated string, and returns it.
3646
3647** The new function `scm_stdio_to_port' converts a STDIO file pointer
3648to a Scheme port object.
3649
3650** The new function `scm_set_program_arguments' allows C code to set
e80c8fea 3651the value returned by the Scheme `program-arguments' function.
6685dc83 3652
6685dc83 3653\f
1a1945be
JB
3654Older changes:
3655
3656* Guile no longer includes sophisticated Tcl/Tk support.
3657
3658The old Tcl/Tk support was unsatisfying to us, because it required the
3659user to link against the Tcl library, as well as Tk and Guile. The
3660interface was also un-lispy, in that it preserved Tcl/Tk's practice of
3661referring to widgets by names, rather than exporting widgets to Scheme
3662code as a special datatype.
3663
3664In the Usenix Tk Developer's Workshop held in July 1996, the Tcl/Tk
3665maintainers described some very interesting changes in progress to the
3666Tcl/Tk internals, which would facilitate clean interfaces between lone
3667Tk and other interpreters --- even for garbage-collected languages
3668like Scheme. They expected the new Tk to be publicly available in the
3669fall of 1996.
3670
3671Since it seems that Guile might soon have a new, cleaner interface to
3672lone Tk, and that the old Guile/Tk glue code would probably need to be
3673completely rewritten, we (Jim Blandy and Richard Stallman) have
3674decided not to support the old code. We'll spend the time instead on
3675a good interface to the newer Tk, as soon as it is available.
5c54da76 3676
8512dea6 3677Until then, gtcltk-lib provides trivial, low-maintenance functionality.
deb95d71 3678
5c54da76
JB
3679\f
3680Copyright information:
3681
ea00ecba 3682Copyright (C) 1996,1997 Free Software Foundation, Inc.
5c54da76
JB
3683
3684 Permission is granted to anyone to make or distribute verbatim copies
3685 of this document as received, in any medium, provided that the
3686 copyright notice and this permission notice are preserved,
3687 thus giving the recipient permission to redistribute in turn.
3688
3689 Permission is granted to distribute modified versions
3690 of this document, or of portions of it,
3691 under the above conditions, provided also that they
3692 carry prominent notices stating who last changed them.
3693
48d224d7
JB
3694\f
3695Local variables:
3696mode: outline
3697paragraph-separate: "[ \f]*$"
3698end:
3699