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