* Update NEWS for removal of R4RS from distro.
[bpt/guile.git] / NEWS
CommitLineData
f7b47737 1Guile NEWS --- history of user-visible changes. -*- text -*-
6fe692e9 2Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 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
c299f186
MD
7Changes since Guile 1.4:
8
9* Changes to the distribution
10
4df36934
MG
11** New module (srfi srfi-13)
12
13Implements SRFI-13 (string library).
14
15** New module (srfi srfi-14)
16
17Implements SRFI-14 (character-set library).
18
19** New module (srfi srfi-9)
20
21This module exports define-record-type.
22
53e29a1e
RB
23** New module (srfi srfi-11):
24
25This module exports let-values and let*-values.
26
27** New module (srfi srfi-6):
28
29This is a dummy file for now, since guile already provides all of the
30srfi-6 procedures by default: open-input-string, open-output-string,
31get-output-string.
32
33** New module (srfi srfi-8):
34
35This module exports receive.
36
37** New module (srfi srfi-2):
38
39This module exports and-let*.
40
0109c4bf
MD
41** New module (ice-9 stack-catch):
42
43stack-catch is like catch, but saves the current state of the stack in
44the the-last-stack fluid for the debugger to inspect or in able to
45re-throw an error.
46
fbf0c8c7
MV
47** The module (ice-9 and-let*) has been renamed to (ice-9 and-let-star)
48
49This has been done to prevent problems on lesser operating systems
50that can't tolerate `*'s in file names. The exported macro continues
51to be named `and-let*', of course.
52
4f60cc33 53On systems that support it, there is also a compatibility module named
fbf0c8c7
MV
54(ice-9 and-let*). It will go away in the next release.
55
9d774814 56** New modules (oop goops) etc.:
14f1d9fe
MD
57
58 (oop goops)
59 (oop goops describe)
60 (oop goops save)
61 (oop goops active-slot)
62 (oop goops composite-slot)
63
9d774814
GH
64The Guile Object Oriented Programming System (GOOPS) has been
65integrated into Guile.
14f1d9fe
MD
66
67Type
68
69 (use-modules (oop goops))
70
71access GOOPS bindings.
72
73We're now ready to try some basic GOOPS functionality.
74
75Generic functions
76
77 (define-method (+ (x <string>) (y <string>))
78 (string-append x y))
79
80 (+ 1 2) --> 3
81 (+ "abc" "de") --> "abcde"
82
83User-defined types
84
85 (define-class <2D-vector> ()
86 (x #:init-value 0 #:accessor x-component #:init-keyword #:x)
87 (y #:init-value 0 #:accessor y-component #:init-keyword #:y))
88
89 (define-method write ((obj <2D-vector>) port)
90 (display (format #f "<~S, ~S>" (x-component obj) (y-component obj))
91 port))
92
93 (define v (make <2D-vector> #:x 3 #:y 4))
94 v --> <3, 4>
95
96 (define-method + ((x <2D-vector>) (y <2D-vector>))
97 (make <2D-vector>
98 #:x (+ (x-component x) (x-component y))
99 #:y (+ (y-component x) (y-component y))))
100
101 (+ v v) --> <6, 8>
102
103Asking for the type of an object
104
105 (class-of v) --> #<<class> <2D-vector> 40241ac0>
106 <2D-vector> --> #<<class> <2D-vector> 40241ac0>
107 (class-of 1) --> #<<class> <integer> 401b2a98>
108 <integer> --> #<<class> <integer> 401b2a98>
109
110 (is-a? v <2D-vector>) --> #t
111
4f60cc33
NJ
112See further in the GOOPS manual and tutorial in the `doc' directory,
113in info (goops.info) and texinfo formats.
14f1d9fe 114
9d774814
GH
115** New module (ice-9 rdelim).
116
117This exports the following procedures which were previously defined
1c8cbd62 118in the default environment:
9d774814 119
1c8cbd62
GH
120read-line read-line! read-delimited read-delimited! %read-delimited!
121%read-line write-line
9d774814 122
1c8cbd62
GH
123For backwards compatibility the definitions are still imported into the
124default environment in this version of Guile. However you should add:
9d774814
GH
125
126(use-modules (ice-9 rdelim))
127
1c8cbd62
GH
128to any program which uses the definitions, since this may change in
129future.
9d774814
GH
130
131Alternatively, if guile-scsh is installed, the (scsh rdelim) module
132can be used for similar functionality.
133
e5005373
KN
134** New module (ice-9 match)
135
136This module includes Andrew K. Wright's pattern matcher:
137
138(use-modules (ice-9 match))
139
140(match '(+ 1 2)
141 (('+ x) x)
142 (('+ x y) `(add ,x ,y))
143 (('- x y) `(sub ,x ,y))) => (add 1 2)
144
145See ice-9/match.scm for brief description or
146http://www.star-lab.com/wright/code.html for complete documentation.
147
4ce31633
KN
148This module requires SLIB to be installed and available from Guile.
149
4f60cc33
NJ
150** New module (ice-9 buffered-input)
151
152This module provides procedures to construct an input port from an
153underlying source of input that reads and returns its input in chunks.
154The underlying input source is a Scheme procedure, specified by the
155caller, which the port invokes whenever it needs more input.
156
157This is useful when building an input port whose back end is Readline
158or a UI element such as the GtkEntry widget.
159
160** Documentation
161
162The reference and tutorial documentation that was previously
163distributed separately, as `guile-doc', is now included in the core
164Guile distribution. The documentation consists of the following
165manuals.
166
167- The Guile Tutorial (guile-tut.texi) contains a tutorial introduction
168 to using Guile.
169
170- The Guile Reference Manual (guile.texi) contains (or is intended to
171 contain) reference documentation on all aspects of Guile.
172
173- The GOOPS Manual (goops.texi) contains both tutorial-style and
174 reference documentation for using GOOPS, Guile's Object Oriented
175 Programming System.
176
c3e62877
NJ
177- The Revised^5 Report on the Algorithmic Language Scheme
178 (r5rs.texi).
4f60cc33
NJ
179
180See the README file in the `doc' directory for more details.
181
9d774814
GH
182* Changes to the stand-alone interpreter
183
14fe4fe9
MV
184** Evaluation of "()", the empty list, is now an error.
185
186Previously, you could for example write (cons 1 ()); now you need to
187be more explicit and write (cons 1 '()).
188
c0997079
MD
189** It's now possible to create modules with controlled environments
190
191Example:
192
03cd374d
MD
193(use-modules (ice-9 safe))
194(define m (make-safe-module))
c0997079 195;;; m will now be a module containing only a safe subset of R5RS
9e07b666
DH
196(eval '(+ 1 2) m) --> 3
197(eval 'load m) --> ERROR: Unbound variable: load
c0997079 198
c299f186
MD
199* Changes to Scheme functions and syntax
200
8c2c9967
MV
201** The empty combination is no longer valid syntax.
202
203Previously, the expression "()" evaluated to the empty list. This has
204been changed to signal a "missing expression" error. The correct way
205to write the empty list as a literal constant is to use quote: "'()".
206
207** Auto-loading of compiled-code modules is deprecated.
208
209Guile used to be able to automatically find and link a shared
210libraries to satisfy requests for a module. For example, the module
211`(foo bar)' could be implemented by placing a shared library named
212"foo/libbar.so" (or with a different extension) in a directory on the
213load path of Guile.
214
215This has been found to be too tricky, and is no longer supported.
216What you should do instead now is to write a small Scheme file that
217explicitly calls `dynamic-link' to load the shared library and
218`dynamic-call' to initialize it.
219
220The shared libraries themselves should be installed in the usual
221places for shared libraries, with names like "libguile-foo-bar".
222
223For example, place this into a file "foo/bar.scm"
224
225 (define-module (foo bar))
226
227 (dynamic-call "foobar_init" (dynamic-link "libguile-foo-bar"))
228
229The file name passed to `dynamic-link' should not contain an
230extension. It will be provided automatically.
231
6f76852b
MV
232** The module system has been made more disciplined.
233
234The function `eval' will now save and restore the current module
235around the evaluation of the specified expression. While this
236expression is evaluated, `(current-module)' will now return the right
237module, which is the module specified as the second argument to
238`eval'.
239
240A consequence of this change is that `eval' is not particularily
241useful when you want allow the evaluated code to change what module is
242designated as the current module and have this change persist from one
243call to `eval' to the next. The read-eval-print-loop is an example
244where `eval' is now inadequate. To compensate, there is a new
245function `primitive-eval' that does not take a module specifier and
246that does not save/restore the current module. You should use this
247function together with `set-current-module', `current-module', etc
248when you want to have more control over the state that is carried from
249one eval to the next.
250
251Additionally, it has been made sure that forms that are evaluated at
252the top level are always evaluated with respect to the current module.
253Previously, subforms of top-level forms such as `begin', `case',
254etc. did not respect changes to the current module although these
255subforms are at the top-level as well.
256
257To prevent strange behaviour, the forms `define-module',
258`use-modules', `use-syntax', and `export' have been restricted to only
259work on the top level. The forms `define-public' and
260`defmacro-public' only export the new binding on the top level. They
261behave just like `define' and `defmacro', respectively, when they are
262used in a lexical environment.
263
b7d69200 264** The semantics of guardians have changed.
56495472 265
b7d69200 266The changes are for the most part compatible. An important criterion
c0a5d888
ML
267was to keep the typical usage of guardians as simple as before, but to
268make the semantics safer and (as a result) more useful.
56495472 269
c0a5d888 270*** All objects returned from guardians are now properly alive.
56495472 271
c0a5d888
ML
272It is now guaranteed that any object referenced by an object returned
273from a guardian is alive. It's now impossible for a guardian to
274return a "contained" object before its "containing" object.
56495472
ML
275
276One incompatible (but probably not very important) change resulting
277from this is that it is no longer possible to guard objects that
278indirectly reference themselves (i.e. are parts of cycles). If you do
279so accidentally, you'll get a warning.
280
c0a5d888
ML
281*** There are now two types of guardians: greedy and sharing.
282
283If you call (make-guardian #t) or just (make-guardian), you'll get a
284greedy guardian, and for (make-guardian #f) a sharing guardian.
285
286Greedy guardians are the default because they are more "defensive".
287You can only greedily guard an object once. If you guard an object
288more than once, once in a greedy guardian and the rest of times in
289sharing guardians, then it is guaranteed that the object won't be
290returned from sharing guardians as long as it is greedily guarded
291and/or alive.
292
293Guardians returned by calls to `make-guardian' can now take one more
294optional parameter, which says whether to throw an error in case an
295attempt is made to greedily guard an object that is already greedily
296guarded. The default is true, i.e. throw an error. If the parameter
297is false, the guardian invocation returns #t if guarding was
298successful and #f if it wasn't.
299
300Also, since greedy guarding is, in effect, a side-effecting operation
301on objects, a new function is introduced: `destroy-guardian!'.
302Invoking this function on a guardian renders it unoperative and, if
303the guardian is greedy, clears the "greedily guarded" property of the
304objects that were guarded by it, thus undoing the side effect.
305
306Note that all this hair is hardly very important, since guardian
307objects are usually permanent.
308
818febc0
GH
309** Escape procedures created by call-with-current-continuation now
310accept any number of arguments, as required by R5RS.
311
56426fdb
KN
312** New function `call-with-deprecation'
313
314Call a thunk, displaying a deprecation message at the first call:
315
316 (define (id x)
317 (call-with-deprecation "`id' is deprecated. Use `identity' instead."
318 (lambda ()
319 (identity x))))
320
321 guile> (id 1)
322 ;; `id' is deprecated. Use `identity' instead.
323 1
324 guile> (id 1)
325 1
326
17f367e0
MV
327** New function `make-object-property'
328
329This function returns a new `procedure with setter' P that can be used
330to attach a property to objects. When calling P as
331
332 (set! (P obj) val)
333
334where `obj' is any kind of object, it attaches `val' to `obj' in such
335a way that it can be retrieved by calling P as
336
337 (P obj)
338
339This function will replace procedure properties, symbol properties and
340source properties eventually.
341
76ef92f3
MV
342** Module (ice-9 optargs) now uses keywords instead of `#&'.
343
344Instead of #&optional, #&key, etc you should now use #:optional,
345#:key, etc. Since #:optional is a keyword, you can write it as just
346:optional when (read-set! keywords 'prefix) is active.
347
348The old reader syntax `#&' is still supported, but deprecated. It
349will be removed in the next release.
350
41d7d2af
MD
351** Backward incompatible change: eval EXP ENVIRONMENT-SPECIFIER
352
353`eval' is now R5RS, that is it takes two arguments.
354The second argument is an environment specifier, i.e. either
355
356 (scheme-report-environment 5)
357 (null-environment 5)
358 (interaction-environment)
359
360or
361
362 any module.
363
c0997079
MD
364** New define-module option: pure
365
366Tells the module system not to include any bindings from the root
367module.
368
369Example:
370
371(define-module (totally-empty-module)
372 :pure)
373
374** New define-module option: export NAME1 ...
375
376Export names NAME1 ...
377
378This option is required if you want to be able to export bindings from
379a module which doesn't import one of `define-public' or `export'.
380
381Example:
382
383(define-module (foo)
384 :pure
385 :use-module (ice-9 r5rs)
386 :export (bar))
387
388;;; Note that we're pure R5RS below this point!
389
390(define (bar)
391 ...)
392
69b5f65a
MD
393** Deprecated: scm_make_shared_substring
394
395Explicit shared substrings will disappear from Guile.
396
397Instead, "normal" strings will be implemented using sharing
398internally, combined with a copy-on-write strategy.
399
400** Deprecated: scm_read_only_string_p
401
402The concept of read-only strings will disappear in next release of
403Guile.
404
daa6ba18
DH
405** Deprecated: scm_sloppy_memq, scm_sloppy_memv, scm_sloppy_member
406
79a3dafe 407Instead, use scm_c_memq or scm_memq, scm_memv, scm_member.
daa6ba18 408
264e9cbc
GH
409** New function: read-string!/partial str [port_or_fdes [start [end]]]
410
411 Read characters from an fport or file descriptor into a string
412 STR. This procedure is scsh-compatible and can efficiently read
413 large strings. It will:
414
415 * attempt to fill the entire string, unless the START and/or
416 END arguments are supplied. i.e., START defaults to 0 and
417 END defaults to `(string-length str)'
418
419 * use the current input port if PORT_OR_FDES is not supplied.
420
421 * read any characters that are currently available, without
422 waiting for the rest (short reads are possible).
423
424 * wait for as long as it needs to for the first character to
425 become available, unless the port is in non-blocking mode
426
427 * return `#f' if end-of-file is encountered before reading any
428 characters, otherwise return the number of characters read.
429
430 * return 0 if the port is in non-blocking mode and no characters
431 are immediately available.
432
433 * return 0 if the request is for 0 bytes, with no end-of-file
434 check
435
1f3908c4
KN
436** New function: object->string OBJ
437
438Return a Scheme string obtained by printing a given object.
439
eb5c0a2a
GH
440** New function: port? X
441
442Returns a boolean indicating whether X is a port. Equivalent to
443`(or (input-port? X) (output-port? X))'.
444
efa40607
DH
445** New function: file-port?
446
447Determines whether a given object is a port that is related to a file.
448
34b56ec4
GH
449** New function: port-for-each proc
450
5bef627d
GH
451 Apply PROC to each port in the Guile port table in turn. The
452 return value is unspecified. More specifically, PROC is applied
453 exactly once to every port that exists in the system at the time
454 PORT-FOR-EACH is invoked. Changes to the port table while
455 PORT-FOR-EACH is running have no effect as far as PORT-FOR-EACH is
456 concerned.
34b56ec4
GH
457
458** New function: dup2 oldfd newfd
459
460A simple wrapper for the `dup2' system call. Copies the file
461descriptor OLDFD to descriptor number NEWFD, replacing the
462previous meaning of NEWFD. Both OLDFD and NEWFD must be integers.
463Unlike for dup->fdes or primitive-move->fdes, no attempt is made
264e9cbc 464to move away ports which are using NEWFD. The return value is
34b56ec4
GH
465unspecified.
466
467** New function: close-fdes fd
468
469A simple wrapper for the `close' system call. Close file
470descriptor FD, which must be an integer. Unlike close (*note
471close: Ports and File Descriptors.), the file descriptor will be
472closed even if a port is using it. The return value is
473unspecified.
474
94e6d793
MG
475** New function: crypt password salt
476
477Encrypts `password' using the standard unix password encryption
478algorithm.
479
480** New function: chroot path
481
482Change the root directory of the running process to `path'.
483
484** New functions: getlogin, cuserid
485
486Return the login name or the user name of the current effective user
487id, respectively.
488
489** New functions: getpriority which who, setpriority which who prio
490
491Get or set the priority of the running process.
492
493** New function: getpass prompt
494
495Read a password from the terminal, first displaying `prompt' and
496disabling echoing.
497
498** New function: flock file operation
499
500Set/remove an advisory shared or exclusive lock on `file'.
501
502** New functions: sethostname name, gethostname
503
504Set or get the hostname of the machine the current process is running
505on.
506
6d163216 507** New function: mkstemp! tmpl
4f60cc33 508
6d163216
GH
509mkstemp creates a new unique file in the file system and returns a
510new buffered port open for reading and writing to the file. TMPL
511is a string specifying where the file should be created: it must
512end with `XXXXXX' and will be changed in place to return the name
513of the temporary file.
514
62e63ba9
MG
515** New function: open-input-string string
516
517Return an input string port which delivers the characters from
4f60cc33 518`string'. This procedure, together with `open-output-string' and
62e63ba9
MG
519`get-output-string' implements SRFI-6.
520
521** New function: open-output-string
522
523Return an output string port which collects all data written to it.
524The data can then be retrieved by `get-output-string'.
525
526** New function: get-output-string
527
528Return the contents of an output string port.
529
56426fdb
KN
530** New function: identity
531
532Return the argument.
533
5bef627d
GH
534** socket, connect, accept etc., now have support for IPv6. IPv6 addresses
535 are represented in Scheme as integers with normal host byte ordering.
536
537** New function: inet-pton family address
538
539 Convert a printable string network address into an integer. Note
540 that unlike the C version of this function, the result is an
541 integer with normal host byte ordering. FAMILY can be `AF_INET'
542 or `AF_INET6'. e.g.,
543 (inet-pton AF_INET "127.0.0.1") => 2130706433
544 (inet-pton AF_INET6 "::1") => 1
545
546** New function: inet-ntop family address
547
548 Convert an integer network address into a printable string. Note
549 that unlike the C version of this function, the input is an
550 integer with normal host byte ordering. FAMILY can be `AF_INET'
551 or `AF_INET6'. e.g.,
552 (inet-ntop AF_INET 2130706433) => "127.0.0.1"
553 (inet-ntop AF_INET6 (- (expt 2 128) 1)) =>
554 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
555
56426fdb
KN
556** Deprecated: id
557
558Use `identity' instead.
559
4f60cc33
NJ
560** Deprecated: close-all-ports-except.
561
562This was intended for closing ports in a child process after a fork,
563but it has the undesirable side effect of flushing buffers.
564port-for-each is more flexible.
34b56ec4
GH
565
566** The (ice-9 popen) module now attempts to set up file descriptors in
567the child process from the current Scheme ports, instead of using the
568current values of file descriptors 0, 1, and 2 in the parent process.
569
b52e071b
DH
570** Removed function: builtin-weak-bindings
571
572There is no such concept as a weak binding any more.
573
9d774814 574** Removed constants: bignum-radix, scm-line-incrementors
0f979f3f 575
7d435120
MD
576** define-method: New syntax mandatory.
577
578The new method syntax is now mandatory:
579
580(define-method (NAME ARG-SPEC ...) BODY ...)
581(define-method (NAME ARG-SPEC ... . REST-ARG) BODY ...)
582
583 ARG-SPEC ::= ARG-NAME | (ARG-NAME TYPE)
584 REST-ARG ::= ARG-NAME
585
586If you have old code using the old syntax, import
587(oop goops old-define-method) before (oop goops) as in:
588
589 (use-modules (oop goops old-define-method) (oop goops))
590
c299f186
MD
591* Changes to the gh_ interface
592
593* Changes to the scm_ interface
594
6fe692e9
MD
595** New function: scm_c_read (SCM port, void *buffer, scm_sizet size)
596
597Used by an application to read arbitrary number of bytes from a port.
598Same semantics as libc read, except that scm_c_read only returns less
599than SIZE bytes if at end-of-file.
600
601Warning: Doesn't update port line and column counts!
602
603** New function: scm_c_write (SCM port, const void *ptr, scm_sizet size)
604
605Used by an application to write arbitrary number of bytes to an SCM
606port. Similar semantics as libc write. However, unlike libc
607write, scm_c_write writes the requested number of bytes and has no
608return value.
609
610Warning: Doesn't update port line and column counts!
611
17f367e0
MV
612** New function: scm_init_guile ()
613
614In contrast to scm_boot_guile, scm_init_guile will return normally
615after initializing Guile. It is not available on all systems, tho.
616
23ade5e7
DH
617** New functions: scm_str2symbol, scm_mem2symbol
618
619The function scm_str2symbol takes a const char* pointing to a zero-terminated
620field of characters and creates a scheme symbol object from that C string.
621The function scm_mem2symbol takes a const char* and a number of characters and
622creates a symbol from the characters in that memory area.
623
17f367e0
MV
624** New functions: scm_primitive_make_property
625 scm_primitive_property_ref
626 scm_primitive_property_set_x
627 scm_primitive_property_del_x
628
629These functions implement a new way to deal with object properties.
630See libguile/properties.c for their documentation.
631
9d47a1e6
ML
632** New function: scm_done_free (long size)
633
634This function is the inverse of scm_done_malloc. Use it to report the
635amount of smob memory you free. The previous method, which involved
636calling scm_done_malloc with negative argument, was somewhat
637unintuitive (and is still available, of course).
638
79a3dafe
DH
639** New function: scm_c_memq (SCM obj, SCM list)
640
641This function provides a fast C level alternative for scm_memq for the case
642that the list parameter is known to be a proper list. The function is a
643replacement for scm_sloppy_memq, but is stricter in its requirements on its
644list input parameter, since for anything else but a proper list the function's
645behaviour is undefined - it may even crash or loop endlessly. Further, for
646the case that the object is not found in the list, scm_c_memq returns #f which
647is similar to scm_memq, but different from scm_sloppy_memq's behaviour.
648
5d2b97cd
DH
649** New functions: scm_remember_upto_here_1, scm_remember_upto_here_2,
650scm_remember_upto_here
651
652These functions replace the function scm_remember.
653
654** Deprecated function: scm_remember
655
656Use one of the new functions scm_remember_upto_here_1,
657scm_remember_upto_here_2 or scm_remember_upto_here instead.
658
be54b15d
DH
659** New function: scm_allocate_string
660
661This function replaces the function scm_makstr.
662
663** Deprecated function: scm_makstr
664
665Use the new function scm_allocate_string instead.
666
32d0d4b1
DH
667** New global variable scm_gc_running_p introduced.
668
669Use this variable to find out if garbage collection is being executed. Up to
670now applications have used scm_gc_heap_lock to test if garbage collection was
671running, which also works because of the fact that up to know only the garbage
672collector has set this variable. But, this is an implementation detail that
673may change. Further, scm_gc_heap_lock is not set throughout gc, thus the use
674of this variable is (and has been) not fully safe anyway.
675
5b9eb8ae
DH
676** New macros: SCM_BITVECTOR_MAX_LENGTH, SCM_UVECTOR_MAX_LENGTH
677
678Use these instead of SCM_LENGTH_MAX.
679
a6d9e5ab
DH
680** New macros: SCM_CONTINUATION_LENGTH, SCM_CCLO_LENGTH, SCM_STACK_LENGTH,
681SCM_STRING_LENGTH, SCM_SYMBOL_LENGTH, SCM_UVECTOR_LENGTH,
682SCM_BITVECTOR_LENGTH, SCM_VECTOR_LENGTH.
683
684Use these instead of SCM_LENGTH.
685
93778877
DH
686** New macros: SCM_SET_CONTINUATION_LENGTH, SCM_SET_STRING_LENGTH,
687SCM_SET_SYMBOL_LENGTH, SCM_SET_VECTOR_LENGTH, SCM_SET_UVECTOR_LENGTH,
688SCM_SET_BITVECTOR_LENGTH
bc0eaf7b
DH
689
690Use these instead of SCM_SETLENGTH
691
a6d9e5ab
DH
692** New macros: SCM_STRING_CHARS, SCM_SYMBOL_CHARS, SCM_CCLO_BASE,
693SCM_VECTOR_BASE, SCM_UVECTOR_BASE, SCM_BITVECTOR_BASE, SCM_COMPLEX_MEM,
694SCM_ARRAY_MEM
695
e51fe79c
DH
696Use these instead of SCM_CHARS, SCM_UCHARS, SCM_ROCHARS, SCM_ROUCHARS or
697SCM_VELTS.
a6d9e5ab 698
6a0476fd
DH
699** New macros: SCM_SET_BIGNUM_BASE, SCM_SET_STRING_CHARS,
700SCM_SET_SYMBOL_CHARS, SCM_SET_UVECTOR_BASE, SCM_SET_BITVECTOR_BASE,
701SCM_SET_VECTOR_BASE
702
703Use these instead of SCM_SETCHARS.
704
a6d9e5ab
DH
705** New macro: SCM_BITVECTOR_P
706
707** New macro: SCM_STRING_COERCE_0TERMINATION_X
708
709Use instead of SCM_COERCE_SUBSTR.
710
30ea841d
DH
711** New macros: SCM_DIR_OPEN_P, SCM_DIR_FLAG_OPEN
712
713For directory objects, use these instead of SCM_OPDIRP and SCM_OPN.
714
b63a956d
DH
715** Deprecated macros: SCM_OUTOFRANGE, SCM_NALLOC, SCM_HUP_SIGNAL,
716SCM_INT_SIGNAL, SCM_FPE_SIGNAL, SCM_BUS_SIGNAL, SCM_SEGV_SIGNAL,
717SCM_ALRM_SIGNAL, SCM_GC_SIGNAL, SCM_TICK_SIGNAL, SCM_SIG_ORD,
d1ca2c64 718SCM_ORD_SIG, SCM_NUM_SIGS, SCM_SYMBOL_SLOTS, SCM_SLOTS, SCM_SLOPPY_STRINGP,
a6d9e5ab
DH
719SCM_VALIDATE_STRINGORSUBSTR, SCM_FREEP, SCM_NFREEP, SCM_CHARS, SCM_UCHARS,
720SCM_VALIDATE_ROSTRING, SCM_VALIDATE_ROSTRING_COPY,
721SCM_VALIDATE_NULLORROSTRING_COPY, SCM_ROLENGTH, SCM_LENGTH, SCM_HUGE_LENGTH,
b24b5e13 722SCM_SUBSTRP, SCM_SUBSTR_STR, SCM_SUBSTR_OFFSET, SCM_COERCE_SUBSTR,
34f0f2b8 723SCM_ROSTRINGP, SCM_RWSTRINGP, SCM_VALIDATE_RWSTRING, SCM_ROCHARS,
fd336365 724SCM_ROUCHARS, SCM_SETLENGTH, SCM_SETCHARS, SCM_LENGTH_MAX, SCM_GC8MARKP,
30ea841d 725SCM_SETGC8MARK, SCM_CLRGC8MARK, SCM_GCTYP16, SCM_GCCDR, SCM_SUBR_DOC,
b3fcac34
DH
726SCM_OPDIRP, SCM_VALIDATE_OPDIR, SCM_WTA, RETURN_SCM_WTA, SCM_CONST_LONG,
727SCM_WNA, SCM_FUNC_NAME, SCM_VALIDATE_NUMBER_COPY,
61045190 728SCM_VALIDATE_NUMBER_DEF_COPY, SCM_SLOPPY_CONSP, SCM_SLOPPY_NCONSP,
e038c042 729SCM_SETAND_CDR, SCM_SETOR_CDR, SCM_SETAND_CAR, SCM_SETOR_CAR
b63a956d
DH
730
731Use SCM_ASSERT_RANGE or SCM_VALIDATE_XXX_RANGE instead of SCM_OUTOFRANGE.
732Use scm_memory_error instead of SCM_NALLOC.
c1aef037 733Use SCM_STRINGP instead of SCM_SLOPPY_STRINGP.
d1ca2c64
DH
734Use SCM_VALIDATE_STRING instead of SCM_VALIDATE_STRINGORSUBSTR.
735Use SCM_FREE_CELL_P instead of SCM_FREEP/SCM_NFREEP
a6d9e5ab
DH
736Use a type specific accessor macro instead of SCM_CHARS/SCM_UCHARS.
737Use a type specific accessor instead of SCM(_|_RO|_HUGE_)LENGTH.
738Use SCM_VALIDATE_(SYMBOL|STRING) instead of SCM_VALIDATE_ROSTRING.
739Use SCM_STRING_COERCE_0TERMINATION_X instead of SCM_COERCE_SUBSTR.
b24b5e13 740Use SCM_STRINGP or SCM_SYMBOLP instead of SCM_ROSTRINGP.
f0942910
DH
741Use SCM_STRINGP instead of SCM_RWSTRINGP.
742Use SCM_VALIDATE_STRING instead of SCM_VALIDATE_RWSTRING.
34f0f2b8
DH
743Use SCM_STRING_CHARS instead of SCM_ROCHARS.
744Use SCM_STRING_UCHARS instead of SCM_ROUCHARS.
93778877 745Use a type specific setter macro instead of SCM_SETLENGTH.
6a0476fd 746Use a type specific setter macro instead of SCM_SETCHARS.
5b9eb8ae 747Use a type specific length macro instead of SCM_LENGTH_MAX.
fd336365
DH
748Use SCM_GCMARKP instead of SCM_GC8MARKP.
749Use SCM_SETGCMARK instead of SCM_SETGC8MARK.
750Use SCM_CLRGCMARK instead of SCM_CLRGC8MARK.
751Use SCM_TYP16 instead of SCM_GCTYP16.
752Use SCM_CDR instead of SCM_GCCDR.
30ea841d 753Use SCM_DIR_OPEN_P instead of SCM_OPDIRP.
276dd677
DH
754Use SCM_MISC_ERROR or SCM_WRONG_TYPE_ARG instead of SCM_WTA.
755Use SCM_MISC_ERROR or SCM_WRONG_TYPE_ARG instead of RETURN_SCM_WTA.
8dea8611 756Use SCM_VCELL_INIT instead of SCM_CONST_LONG.
b3fcac34 757Use SCM_WRONG_NUM_ARGS instead of SCM_WNA.
ced99e92
DH
758Use SCM_CONSP instead of SCM_SLOPPY_CONSP.
759Use !SCM_CONSP instead of SCM_SLOPPY_NCONSP.
b63a956d 760
f7620510
DH
761** Removed function: scm_struct_init
762
93d40df2
DH
763** Removed variable: scm_symhash_dim
764
818febc0
GH
765** Renamed function: scm_make_cont has been replaced by
766scm_make_continuation, which has a different interface.
767
cc4feeca
DH
768** Deprecated function: scm_call_catching_errors
769
770Use scm_catch or scm_lazy_catch from throw.[ch] instead.
771
28b06554
DH
772** Deprecated function: scm_strhash
773
774Use scm_string_hash instead.
775
1b9be268
DH
776** Deprecated function: scm_vector_set_length_x
777
778Instead, create a fresh vector of the desired size and copy the contents.
779
302f229e
MD
780** scm_gensym has changed prototype
781
782scm_gensym now only takes one argument.
783
784** New function: scm_gentemp (SCM prefix, SCM obarray)
785
786The builtin `gentemp' has now become a primitive.
787
1660782e
DH
788** Deprecated type tags: scm_tc7_ssymbol, scm_tc7_msymbol, scm_tcs_symbols,
789scm_tc7_lvector
28b06554
DH
790
791There is now only a single symbol type scm_tc7_symbol.
1660782e 792The tag scm_tc7_lvector was not used anyway.
28b06554 793
2f6fb7c5
KN
794** Deprecated function: scm_make_smob_type_mfpe, scm_set_smob_mfpe.
795
796Use scm_make_smob_type and scm_set_smob_XXX instead.
797
798** New function scm_set_smob_apply.
799
800This can be used to set an apply function to a smob type.
801
1f3908c4
KN
802** Deprecated function: scm_strprint_obj
803
804Use scm_object_to_string instead.
805
b3fcac34
DH
806** Deprecated function: scm_wta
807
808Use scm_wrong_type_arg, or another appropriate error signalling function
809instead.
810
c299f186 811\f
cc36e791
JB
812Changes since Guile 1.3.4:
813
80f27102
JB
814* Changes to the distribution
815
ce358662
JB
816** Trees from nightly snapshots and CVS now require you to run autogen.sh.
817
818We've changed the way we handle generated files in the Guile source
819repository. As a result, the procedure for building trees obtained
820from the nightly FTP snapshots or via CVS has changed:
821- You must have appropriate versions of autoconf, automake, and
822 libtool installed on your system. See README for info on how to
823 obtain these programs.
824- Before configuring the tree, you must first run the script
825 `autogen.sh' at the top of the source tree.
826
827The Guile repository used to contain not only source files, written by
828humans, but also some generated files, like configure scripts and
829Makefile.in files. Even though the contents of these files could be
830derived mechanically from other files present, we thought it would
831make the tree easier to build if we checked them into CVS.
832
833However, this approach means that minor differences between
834developer's installed tools and habits affected the whole team.
835So we have removed the generated files from the repository, and
836added the autogen.sh script, which will reconstruct them
837appropriately.
838
839
dc914156
GH
840** configure now has experimental options to remove support for certain
841features:
52cfc69b 842
dc914156
GH
843--disable-arrays omit array and uniform array support
844--disable-posix omit posix interfaces
845--disable-networking omit networking interfaces
846--disable-regex omit regular expression interfaces
52cfc69b
GH
847
848These are likely to become separate modules some day.
849
9764c29b 850** New configure option --enable-debug-freelist
e1b0d0ac 851
38a15cfd
GB
852This enables a debugging version of SCM_NEWCELL(), and also registers
853an extra primitive, the setter `gc-set-debug-check-freelist!'.
854
855Configure with the --enable-debug-freelist option to enable
856the gc-set-debug-check-freelist! primitive, and then use:
857
858(gc-set-debug-check-freelist! #t) # turn on checking of the freelist
859(gc-set-debug-check-freelist! #f) # turn off checking
860
861Checking of the freelist forces a traversal of the freelist and
862a garbage collection before each allocation of a cell. This can
863slow down the interpreter dramatically, so the setter should be used to
864turn on this extra processing only when necessary.
e1b0d0ac 865
9764c29b
MD
866** New configure option --enable-debug-malloc
867
868Include code for debugging of calls to scm_must_malloc/realloc/free.
869
870Checks that
871
8721. objects freed by scm_must_free has been mallocated by scm_must_malloc
8732. objects reallocated by scm_must_realloc has been allocated by
874 scm_must_malloc
8753. reallocated objects are reallocated with the same what string
876
877But, most importantly, it records the number of allocated objects of
878each kind. This is useful when searching for memory leaks.
879
880A Guile compiled with this option provides the primitive
881`malloc-stats' which returns an alist with pairs of kind and the
882number of objects of that kind.
883
e415cb06
MD
884** All includes are now referenced relative to the root directory
885
886Since some users have had problems with mixups between Guile and
887system headers, we have decided to always refer to Guile headers via
888their parent directories. This essentially creates a "private name
889space" for Guile headers. This means that the compiler only is given
890-I options for the root build and root source directory.
891
341f78c9
MD
892** Header files kw.h and genio.h have been removed.
893
894** The module (ice-9 getopt-gnu-style) has been removed.
895
e8855f8d
MD
896** New module (ice-9 documentation)
897
898Implements the interface to documentation strings associated with
899objects.
900
0c0ffe09
KN
901** New module (ice-9 time)
902
903Provides a macro `time', which displays execution time of a given form.
904
cf7a5ee5
KN
905** New module (ice-9 history)
906
907Loading this module enables value history in the repl.
908
0af43c4a 909* Changes to the stand-alone interpreter
bd9e24b3 910
67ef2dca
MD
911** New command line option --debug
912
913Start Guile with debugging evaluator and backtraces enabled.
914
915This is useful when debugging your .guile init file or scripts.
916
aa4bb95d
MD
917** New help facility
918
341f78c9
MD
919Usage: (help NAME) gives documentation about objects named NAME (a symbol)
920 (help REGEXP) ditto for objects with names matching REGEXP (a string)
921 (help ,EXPR) gives documentation for object returned by EXPR
922 (help) gives this text
923
924`help' searches among bindings exported from loaded modules, while
925`apropos' searches among bindings visible from the "current" module.
926
927Examples: (help help)
928 (help cons)
929 (help "output-string")
aa4bb95d 930
e8855f8d
MD
931** `help' and `apropos' now prints full module names
932
0af43c4a 933** Dynamic linking now uses libltdl from the libtool package.
bd9e24b3 934
0af43c4a
MD
935The old system dependent code for doing dynamic linking has been
936replaced with calls to the libltdl functions which do all the hairy
937details for us.
bd9e24b3 938
0af43c4a
MD
939The major improvement is that you can now directly pass libtool
940library names like "libfoo.la" to `dynamic-link' and `dynamic-link'
941will be able to do the best shared library job you can get, via
942libltdl.
bd9e24b3 943
0af43c4a
MD
944The way dynamic libraries are found has changed and is not really
945portable across platforms, probably. It is therefore recommended to
946use absolute filenames when possible.
947
948If you pass a filename without an extension to `dynamic-link', it will
949try a few appropriate ones. Thus, the most platform ignorant way is
950to specify a name like "libfoo", without any directories and
951extensions.
0573ddae 952
91163914
MD
953** Guile COOP threads are now compatible with LinuxThreads
954
955Previously, COOP threading wasn't possible in applications linked with
956Linux POSIX threads due to their use of the stack pointer to find the
957thread context. This has now been fixed with a workaround which uses
958the pthreads to allocate the stack.
959
62b82274
GB
960** New primitives: `pkgdata-dir', `site-dir', `library-dir'
961
9770d235
MD
962** Positions of erring expression in scripts
963
964With version 1.3.4, the location of the erring expression in Guile
965scipts is no longer automatically reported. (This should have been
966documented before the 1.3.4 release.)
967
968You can get this information by enabling recording of positions of
969source expressions and running the debugging evaluator. Put this at
970the top of your script (or in your "site" file):
971
972 (read-enable 'positions)
973 (debug-enable 'debug)
974
0573ddae
MD
975** Backtraces in scripts
976
977It is now possible to get backtraces in scripts.
978
979Put
980
981 (debug-enable 'debug 'backtrace)
982
983at the top of the script.
984
985(The first options enables the debugging evaluator.
986 The second enables backtraces.)
987
e8855f8d
MD
988** Part of module system symbol lookup now implemented in C
989
990The eval closure of most modules is now implemented in C. Since this
991was one of the bottlenecks for loading speed, Guile now loads code
992substantially faster than before.
993
f25f761d
GH
994** Attempting to get the value of an unbound variable now produces
995an exception with a key of 'unbound-variable instead of 'misc-error.
996
1a35eadc
GH
997** The initial default output port is now unbuffered if it's using a
998tty device. Previously in this situation it was line-buffered.
999
820920e6
MD
1000** gc-thunk is deprecated
1001
1002gc-thunk will be removed in next release of Guile. It has been
1003replaced by after-gc-hook.
1004
1005** New hook: after-gc-hook
1006
1007after-gc-hook takes over the role of gc-thunk. This hook is run at
1008the first SCM_TICK after a GC. (Thus, the code is run at the same
1009point during evaluation as signal handlers.)
1010
1011Note that this hook should be used only for diagnostic and debugging
1012purposes. It is not certain that it will continue to be well-defined
1013when this hook is run in the future.
1014
1015C programmers: Note the new C level hooks scm_before_gc_c_hook,
1016scm_before_sweep_c_hook, scm_after_gc_c_hook.
1017
b5074b23
MD
1018** Improvements to garbage collector
1019
1020Guile 1.4 has a new policy for triggering heap allocation and
1021determining the sizes of heap segments. It fixes a number of problems
1022in the old GC.
1023
10241. The new policy can handle two separate pools of cells
1025 (2-word/4-word) better. (The old policy would run wild, allocating
1026 more and more memory for certain programs.)
1027
10282. The old code would sometimes allocate far too much heap so that the
1029 Guile process became gigantic. The new code avoids this.
1030
10313. The old code would sometimes allocate too little so that few cells
1032 were freed at GC so that, in turn, too much time was spent in GC.
1033
10344. The old code would often trigger heap allocation several times in a
1035 row. (The new scheme predicts how large the segments needs to be
1036 in order not to need further allocation.)
1037
e8855f8d
MD
1038All in all, the new GC policy will make larger applications more
1039efficient.
1040
b5074b23
MD
1041The new GC scheme also is prepared for POSIX threading. Threads can
1042allocate private pools of cells ("clusters") with just a single
1043function call. Allocation of single cells from such a cluster can
1044then proceed without any need of inter-thread synchronization.
1045
1046** New environment variables controlling GC parameters
1047
1048GUILE_MAX_SEGMENT_SIZE Maximal segment size
1049 (default = 2097000)
1050
1051Allocation of 2-word cell heaps:
1052
1053GUILE_INIT_SEGMENT_SIZE_1 Size of initial heap segment in bytes
1054 (default = 360000)
1055
1056GUILE_MIN_YIELD_1 Minimum number of freed cells at each
1057 GC in percent of total heap size
1058 (default = 40)
1059
1060Allocation of 4-word cell heaps
1061(used for real numbers and misc other objects):
1062
1063GUILE_INIT_SEGMENT_SIZE_2, GUILE_MIN_YIELD_2
1064
1065(See entry "Way for application to customize GC parameters" under
1066 section "Changes to the scm_ interface" below.)
1067
67ef2dca
MD
1068** Guile now implements reals using 4-word cells
1069
1070This speeds up computation with reals. (They were earlier allocated
1071with `malloc'.) There is still some room for optimizations, however.
1072
1073** Some further steps toward POSIX thread support have been taken
1074
1075*** Guile's critical sections (SCM_DEFER/ALLOW_INTS)
1076don't have much effect any longer, and many of them will be removed in
1077next release.
1078
1079*** Signals
1080are only handled at the top of the evaluator loop, immediately after
1081I/O, and in scm_equalp.
1082
1083*** The GC can allocate thread private pools of pairs.
1084
0af43c4a
MD
1085* Changes to Scheme functions and syntax
1086
a0128ebe 1087** close-input-port and close-output-port are now R5RS
7c1e0b12 1088
a0128ebe 1089These procedures have been turned into primitives and have R5RS behaviour.
7c1e0b12 1090
0af43c4a
MD
1091** New procedure: simple-format PORT MESSAGE ARG1 ...
1092
1093(ice-9 boot) makes `format' an alias for `simple-format' until possibly
1094extended by the more sophisticated version in (ice-9 format)
1095
1096(simple-format port message . args)
1097Write MESSAGE to DESTINATION, defaulting to `current-output-port'.
1098MESSAGE can contain ~A (was %s) and ~S (was %S) escapes. When printed,
1099the escapes are replaced with corresponding members of ARGS:
1100~A formats using `display' and ~S formats using `write'.
1101If DESTINATION is #t, then use the `current-output-port',
1102if DESTINATION is #f, then return a string containing the formatted text.
1103Does not add a trailing newline."
1104
1105** string-ref: the second argument is no longer optional.
1106
1107** string, list->string: no longer accept strings in their arguments,
1108only characters, for compatibility with R5RS.
1109
1110** New procedure: port-closed? PORT
1111Returns #t if PORT is closed or #f if it is open.
1112
0a9e521f
MD
1113** Deprecated: list*
1114
1115The list* functionality is now provided by cons* (SRFI-1 compliant)
1116
b5074b23
MD
1117** New procedure: cons* ARG1 ARG2 ... ARGn
1118
1119Like `list', but the last arg provides the tail of the constructed list,
1120returning (cons ARG1 (cons ARG2 (cons ... ARGn))).
1121
1122Requires at least one argument. If given one argument, that argument
1123is returned as result.
1124
1125This function is called `list*' in some other Schemes and in Common LISP.
1126
341f78c9
MD
1127** Removed deprecated: serial-map, serial-array-copy!, serial-array-map!
1128
e8855f8d
MD
1129** New procedure: object-documentation OBJECT
1130
1131Returns the documentation string associated with OBJECT. The
1132procedure uses a caching mechanism so that subsequent lookups are
1133faster.
1134
1135Exported by (ice-9 documentation).
1136
1137** module-name now returns full names of modules
1138
1139Previously, only the last part of the name was returned (`session' for
1140`(ice-9 session)'). Ex: `(ice-9 session)'.
1141
894a712b
DH
1142* Changes to the gh_ interface
1143
1144** Deprecated: gh_int2scmb
1145
1146Use gh_bool2scm instead.
1147
a2349a28
GH
1148* Changes to the scm_ interface
1149
810e1aec
MD
1150** Guile primitives now carry docstrings!
1151
1152Thanks to Greg Badros!
1153
0a9e521f 1154** Guile primitives are defined in a new way: SCM_DEFINE/SCM_DEFINE1/SCM_PROC
0af43c4a 1155
0a9e521f
MD
1156Now Guile primitives are defined using the SCM_DEFINE/SCM_DEFINE1/SCM_PROC
1157macros and must contain a docstring that is extracted into foo.doc using a new
0af43c4a
MD
1158guile-doc-snarf script (that uses guile-doc-snarf.awk).
1159
0a9e521f
MD
1160However, a major overhaul of these macros is scheduled for the next release of
1161guile.
1162
0af43c4a
MD
1163** Guile primitives use a new technique for validation of arguments
1164
1165SCM_VALIDATE_* macros are defined to ease the redundancy and improve
1166the readability of argument checking.
1167
1168** All (nearly?) K&R prototypes for functions replaced with ANSI C equivalents.
1169
894a712b 1170** New macros: SCM_PACK, SCM_UNPACK
f8a72ca4
MD
1171
1172Compose/decompose an SCM value.
1173
894a712b
DH
1174The SCM type is now treated as an abstract data type and may be defined as a
1175long, a void* or as a struct, depending on the architecture and compile time
1176options. This makes it easier to find several types of bugs, for example when
1177SCM values are treated as integers without conversion. Values of the SCM type
1178should be treated as "atomic" values. These macros are used when
f8a72ca4
MD
1179composing/decomposing an SCM value, either because you want to access
1180individual bits, or because you want to treat it as an integer value.
1181
1182E.g., in order to set bit 7 in an SCM value x, use the expression
1183
1184 SCM_PACK (SCM_UNPACK (x) | 0x80)
1185
e11f8b42
DH
1186** The name property of hooks is deprecated.
1187Thus, the use of SCM_HOOK_NAME and scm_make_hook_with_name is deprecated.
1188
1189You can emulate this feature by using object properties.
1190
894a712b
DH
1191** Deprecated macros: SCM_INPORTP, SCM_OUTPORTP, SCM_CRDY, SCM_ICHRP,
1192SCM_ICHR, SCM_MAKICHR, SCM_SETJMPBUF, SCM_NSTRINGP, SCM_NRWSTRINGP,
1193SCM_NVECTORP
f8a72ca4 1194
894a712b 1195These macros will be removed in a future release of Guile.
7c1e0b12 1196
0a9e521f
MD
1197** The following types, functions and macros from numbers.h are deprecated:
1198scm_dblproc, SCM_UNEGFIXABLE, SCM_FLOBUFLEN, SCM_INEXP, SCM_CPLXP, SCM_REAL,
1199SCM_IMAG, SCM_REALPART, scm_makdbl, SCM_SINGP, SCM_NUM2DBL, SCM_NO_BIGDIG
1200
1201Further, it is recommended not to rely on implementation details for guile's
1202current implementation of bignums. It is planned to replace this
1203implementation with gmp in the future.
1204
a2349a28
GH
1205** Port internals: the rw_random variable in the scm_port structure
1206must be set to non-zero in any random access port. In recent Guile
1207releases it was only set for bidirectional random-access ports.
1208
7dcb364d
GH
1209** Port internals: the seek ptob procedure is now responsible for
1210resetting the buffers if required. The change was made so that in the
1211special case of reading the current position (i.e., seek p 0 SEEK_CUR)
1212the fport and strport ptobs can avoid resetting the buffers,
1213in particular to avoid discarding unread chars. An existing port
1214type can be fixed by adding something like the following to the
1215beginning of the ptob seek procedure:
1216
1217 if (pt->rw_active == SCM_PORT_READ)
1218 scm_end_input (object);
1219 else if (pt->rw_active == SCM_PORT_WRITE)
1220 ptob->flush (object);
1221
1222although to actually avoid resetting the buffers and discard unread
1223chars requires further hacking that depends on the characteristics
1224of the ptob.
1225
894a712b
DH
1226** Deprecated functions: scm_fseek, scm_tag
1227
1228These functions are no longer used and will be removed in a future version.
1229
f25f761d
GH
1230** The scm_sysmissing procedure is no longer used in libguile.
1231Unless it turns out to be unexpectedly useful to somebody, it will be
1232removed in a future version.
1233
0af43c4a
MD
1234** The format of error message strings has changed
1235
1236The two C procedures: scm_display_error and scm_error, as well as the
1237primitive `scm-error', now use scm_simple_format to do their work.
1238This means that the message strings of all code must be updated to use
1239~A where %s was used before, and ~S where %S was used before.
1240
1241During the period when there still are a lot of old Guiles out there,
1242you might want to support both old and new versions of Guile.
1243
1244There are basically two methods to achieve this. Both methods use
1245autoconf. Put
1246
1247 AC_CHECK_FUNCS(scm_simple_format)
1248
1249in your configure.in.
1250
1251Method 1: Use the string concatenation features of ANSI C's
1252 preprocessor.
1253
1254In C:
1255
1256#ifdef HAVE_SCM_SIMPLE_FORMAT
1257#define FMT_S "~S"
1258#else
1259#define FMT_S "%S"
1260#endif
1261
1262Then represent each of your error messages using a preprocessor macro:
1263
1264#define E_SPIDER_ERROR "There's a spider in your " ## FMT_S ## "!!!"
1265
1266In Scheme:
1267
1268(define fmt-s (if (defined? 'simple-format) "~S" "%S"))
1269(define make-message string-append)
1270
1271(define e-spider-error (make-message "There's a spider in your " fmt-s "!!!"))
1272
1273Method 2: Use the oldfmt function found in doc/oldfmt.c.
1274
1275In C:
1276
1277scm_misc_error ("picnic", scm_c_oldfmt0 ("There's a spider in your ~S!!!"),
1278 ...);
1279
1280In Scheme:
1281
1282(scm-error 'misc-error "picnic" (oldfmt "There's a spider in your ~S!!!")
1283 ...)
1284
1285
f3b5e185
MD
1286** Deprecated: coop_mutex_init, coop_condition_variable_init
1287
1288Don't use the functions coop_mutex_init and
1289coop_condition_variable_init. They will change.
1290
1291Use scm_mutex_init and scm_cond_init instead.
1292
f3b5e185
MD
1293** New function: int scm_cond_timedwait (scm_cond_t *COND, scm_mutex_t *MUTEX, const struct timespec *ABSTIME)
1294 `scm_cond_timedwait' atomically unlocks MUTEX and waits on
1295 COND, as `scm_cond_wait' does, but it also bounds the duration
1296 of the wait. If COND has not been signaled before time ABSTIME,
1297 the mutex MUTEX is re-acquired and `scm_cond_timedwait'
1298 returns the error code `ETIMEDOUT'.
1299
1300 The ABSTIME parameter specifies an absolute time, with the same
1301 origin as `time' and `gettimeofday': an ABSTIME of 0 corresponds
1302 to 00:00:00 GMT, January 1, 1970.
1303
1304** New function: scm_cond_broadcast (scm_cond_t *COND)
1305 `scm_cond_broadcast' restarts all the threads that are waiting
1306 on the condition variable COND. Nothing happens if no threads are
1307 waiting on COND.
1308
1309** New function: scm_key_create (scm_key_t *KEY, void (*destr_function) (void *))
1310 `scm_key_create' allocates a new TSD key. The key is stored in
1311 the location pointed to by KEY. There is no limit on the number
1312 of keys allocated at a given time. The value initially associated
1313 with the returned key is `NULL' in all currently executing threads.
1314
1315 The DESTR_FUNCTION argument, if not `NULL', specifies a destructor
1316 function associated with the key. When a thread terminates,
1317 DESTR_FUNCTION is called on the value associated with the key in
1318 that thread. The DESTR_FUNCTION is not called if a key is deleted
1319 with `scm_key_delete' or a value is changed with
1320 `scm_setspecific'. The order in which destructor functions are
1321 called at thread termination time is unspecified.
1322
1323 Destructors are not yet implemented.
1324
1325** New function: scm_setspecific (scm_key_t KEY, const void *POINTER)
1326 `scm_setspecific' changes the value associated with KEY in the
1327 calling thread, storing the given POINTER instead.
1328
1329** New function: scm_getspecific (scm_key_t KEY)
1330 `scm_getspecific' returns the value currently associated with
1331 KEY in the calling thread.
1332
1333** New function: scm_key_delete (scm_key_t KEY)
1334 `scm_key_delete' deallocates a TSD key. It does not check
1335 whether non-`NULL' values are associated with that key in the
1336 currently executing threads, nor call the destructor function
1337 associated with the key.
1338
820920e6
MD
1339** New function: scm_c_hook_init (scm_c_hook_t *HOOK, void *HOOK_DATA, scm_c_hook_type_t TYPE)
1340
1341Initialize a C level hook HOOK with associated HOOK_DATA and type
1342TYPE. (See scm_c_hook_run ().)
1343
1344** New function: scm_c_hook_add (scm_c_hook_t *HOOK, scm_c_hook_function_t FUNC, void *FUNC_DATA, int APPENDP)
1345
1346Add hook function FUNC with associated FUNC_DATA to HOOK. If APPENDP
1347is true, add it last, otherwise first. The same FUNC can be added
1348multiple times if FUNC_DATA differ and vice versa.
1349
1350** New function: scm_c_hook_remove (scm_c_hook_t *HOOK, scm_c_hook_function_t FUNC, void *FUNC_DATA)
1351
1352Remove hook function FUNC with associated FUNC_DATA from HOOK. A
1353function is only removed if both FUNC and FUNC_DATA matches.
1354
1355** New function: void *scm_c_hook_run (scm_c_hook_t *HOOK, void *DATA)
1356
1357Run hook HOOK passing DATA to the hook functions.
1358
1359If TYPE is SCM_C_HOOK_NORMAL, all hook functions are run. The value
1360returned is undefined.
1361
1362If TYPE is SCM_C_HOOK_OR, hook functions are run until a function
1363returns a non-NULL value. This value is returned as the result of
1364scm_c_hook_run. If all functions return NULL, NULL is returned.
1365
1366If TYPE is SCM_C_HOOK_AND, hook functions are run until a function
1367returns a NULL value, and NULL is returned. If all functions returns
1368a non-NULL value, the last value is returned.
1369
1370** New C level GC hooks
1371
1372Five new C level hooks has been added to the garbage collector.
1373
1374 scm_before_gc_c_hook
1375 scm_after_gc_c_hook
1376
1377are run before locking and after unlocking the heap. The system is
1378thus in a mode where evaluation can take place. (Except that
1379scm_before_gc_c_hook must not allocate new cells.)
1380
1381 scm_before_mark_c_hook
1382 scm_before_sweep_c_hook
1383 scm_after_sweep_c_hook
1384
1385are run when the heap is locked. These are intended for extension of
1386the GC in a modular fashion. Examples are the weaks and guardians
1387modules.
1388
b5074b23
MD
1389** Way for application to customize GC parameters
1390
1391The application can set up other default values for the GC heap
1392allocation parameters
1393
1394 GUILE_INIT_HEAP_SIZE_1, GUILE_MIN_YIELD_1,
1395 GUILE_INIT_HEAP_SIZE_2, GUILE_MIN_YIELD_2,
1396 GUILE_MAX_SEGMENT_SIZE,
1397
1398by setting
1399
1400 scm_default_init_heap_size_1, scm_default_min_yield_1,
1401 scm_default_init_heap_size_2, scm_default_min_yield_2,
1402 scm_default_max_segment_size
1403
1404respectively before callong scm_boot_guile.
1405
1406(See entry "New environment variables ..." in section
1407"Changes to the stand-alone interpreter" above.)
1408
9704841c
MD
1409** scm_protect_object/scm_unprotect_object now nest
1410
67ef2dca
MD
1411This means that you can call scm_protect_object multiple times on an
1412object and count on the object being protected until
1413scm_unprotect_object has been call the same number of times.
1414
1415The functions also have better time complexity.
1416
1417Still, it is usually possible to structure the application in a way
1418that you don't need to use these functions. For example, if you use a
1419protected standard Guile list to keep track of live objects rather
1420than some custom data type, objects will die a natural death when they
1421are no longer needed.
1422
0a9e521f
MD
1423** Deprecated type tags: scm_tc16_flo, scm_tc_flo, scm_tc_dblr, scm_tc_dblc
1424
1425Guile does not provide the float representation for inexact real numbers any
1426more. Now, only doubles are used to represent inexact real numbers. Further,
1427the tag names scm_tc_dblr and scm_tc_dblc have been changed to scm_tc16_real
1428and scm_tc16_complex, respectively.
1429
341f78c9
MD
1430** Removed deprecated type scm_smobfuns
1431
1432** Removed deprecated function scm_newsmob
1433
b5074b23
MD
1434** Warning: scm_make_smob_type_mfpe might become deprecated in a future release
1435
1436There is an ongoing discussion among the developers whether to
1437deprecate `scm_make_smob_type_mfpe' or not. Please use the current
1438standard interface (scm_make_smob_type, scm_set_smob_XXX) in new code
1439until this issue has been settled.
1440
341f78c9
MD
1441** Removed deprecated type tag scm_tc16_kw
1442
2728d7f4
MD
1443** Added type tag scm_tc16_keyword
1444
1445(This was introduced already in release 1.3.4 but was not documented
1446 until now.)
1447
67ef2dca
MD
1448** gdb_print now prints "*** Guile not initialized ***" until Guile initialized
1449
f25f761d
GH
1450* Changes to system call interfaces:
1451
28d77376
GH
1452** The "select" procedure now tests port buffers for the ability to
1453provide input or accept output. Previously only the underlying file
1454descriptors were checked.
1455
bd9e24b3
GH
1456** New variable PIPE_BUF: the maximum number of bytes that can be
1457atomically written to a pipe.
1458
f25f761d
GH
1459** If a facility is not available on the system when Guile is
1460compiled, the corresponding primitive procedure will not be defined.
1461Previously it would have been defined but would throw a system-error
1462exception if called. Exception handlers which catch this case may
1463need minor modification: an error will be thrown with key
1464'unbound-variable instead of 'system-error. Alternatively it's
1465now possible to use `defined?' to check whether the facility is
1466available.
1467
38c1d3c4
GH
1468** Procedures which depend on the timezone should now give the correct
1469result on systems which cache the TZ environment variable, even if TZ
1470is changed without calling tzset.
1471
5c11cc9d
GH
1472* Changes to the networking interfaces:
1473
1474** New functions: htons, ntohs, htonl, ntohl: for converting short and
1475long integers between network and host format. For now, it's not
1476particularly convenient to do this kind of thing, but consider:
1477
1478(define write-network-long
1479 (lambda (value port)
1480 (let ((v (make-uniform-vector 1 1 0)))
1481 (uniform-vector-set! v 0 (htonl value))
1482 (uniform-vector-write v port))))
1483
1484(define read-network-long
1485 (lambda (port)
1486 (let ((v (make-uniform-vector 1 1 0)))
1487 (uniform-vector-read! v port)
1488 (ntohl (uniform-vector-ref v 0)))))
1489
1490** If inet-aton fails, it now throws an error with key 'misc-error
1491instead of 'system-error, since errno is not relevant.
1492
1493** Certain gethostbyname/gethostbyaddr failures now throw errors with
1494specific keys instead of 'system-error. The latter is inappropriate
1495since errno will not have been set. The keys are:
afe5177e 1496'host-not-found, 'try-again, 'no-recovery and 'no-data.
5c11cc9d
GH
1497
1498** sethostent, setnetent, setprotoent, setservent: now take an
1499optional argument STAYOPEN, which specifies whether the database
1500remains open after a database entry is accessed randomly (e.g., using
1501gethostbyname for the hosts database.) The default is #f. Previously
1502#t was always used.
1503
cc36e791 1504\f
43fa9a05
JB
1505Changes since Guile 1.3.2:
1506
0fdcbcaa
MD
1507* Changes to the stand-alone interpreter
1508
1509** Debugger
1510
1511An initial version of the Guile debugger written by Chris Hanson has
1512been added. The debugger is still under development but is included
1513in the distribution anyway since it is already quite useful.
1514
1515Type
1516
1517 (debug)
1518
1519after an error to enter the debugger. Type `help' inside the debugger
1520for a description of available commands.
1521
1522If you prefer to have stack frames numbered and printed in
1523anti-chronological order and prefer up in the stack to be down on the
1524screen as is the case in gdb, you can put
1525
1526 (debug-enable 'backwards)
1527
1528in your .guile startup file. (However, this means that Guile can't
1529use indentation to indicate stack level.)
1530
1531The debugger is autoloaded into Guile at the first use.
1532
1533** Further enhancements to backtraces
1534
1535There is a new debug option `width' which controls the maximum width
1536on the screen of printed stack frames. Fancy printing parameters
1537("level" and "length" as in Common LISP) are adaptively adjusted for
1538each stack frame to give maximum information while still fitting
1539within the bounds. If the stack frame can't be made to fit by
1540adjusting parameters, it is simply cut off at the end. This is marked
1541with a `$'.
1542
1543** Some modules are now only loaded when the repl is started
1544
1545The modules (ice-9 debug), (ice-9 session), (ice-9 threads) and (ice-9
1546regex) are now loaded into (guile-user) only if the repl has been
1547started. The effect is that the startup time for scripts has been
1548reduced to 30% of what it was previously.
1549
1550Correctly written scripts load the modules they require at the top of
1551the file and should not be affected by this change.
1552
ece41168
MD
1553** Hooks are now represented as smobs
1554
6822fe53
MD
1555* Changes to Scheme functions and syntax
1556
0ce204b0
MV
1557** Readline support has changed again.
1558
1559The old (readline-activator) module is gone. Use (ice-9 readline)
1560instead, which now contains all readline functionality. So the code
1561to activate readline is now
1562
1563 (use-modules (ice-9 readline))
1564 (activate-readline)
1565
1566This should work at any time, including from the guile prompt.
1567
5d195868
JB
1568To avoid confusion about the terms of Guile's license, please only
1569enable readline for your personal use; please don't make it the
1570default for others. Here is why we make this rather odd-sounding
1571request:
1572
1573Guile is normally licensed under a weakened form of the GNU General
1574Public License, which allows you to link code with Guile without
1575placing that code under the GPL. This exception is important to some
1576people.
1577
1578However, since readline is distributed under the GNU General Public
1579License, when you link Guile with readline, either statically or
1580dynamically, you effectively change Guile's license to the strict GPL.
1581Whenever you link any strictly GPL'd code into Guile, uses of Guile
1582which are normally permitted become forbidden. This is a rather
1583non-obvious consequence of the licensing terms.
1584
1585So, to make sure things remain clear, please let people choose for
1586themselves whether to link GPL'd libraries like readline with Guile.
1587
25b0654e
JB
1588** regexp-substitute/global has changed slightly, but incompatibly.
1589
1590If you include a function in the item list, the string of the match
1591object it receives is the same string passed to
1592regexp-substitute/global, not some suffix of that string.
1593Correspondingly, the match's positions are relative to the entire
1594string, not the suffix.
1595
1596If the regexp can match the empty string, the way matches are chosen
1597from the string has changed. regexp-substitute/global recognizes the
1598same set of matches that list-matches does; see below.
1599
1600** New function: list-matches REGEXP STRING [FLAGS]
1601
1602Return a list of match objects, one for every non-overlapping, maximal
1603match of REGEXP in STRING. The matches appear in left-to-right order.
1604list-matches only reports matches of the empty string if there are no
1605other matches which begin on, end at, or include the empty match's
1606position.
1607
1608If present, FLAGS is passed as the FLAGS argument to regexp-exec.
1609
1610** New function: fold-matches REGEXP STRING INIT PROC [FLAGS]
1611
1612For each match of REGEXP in STRING, apply PROC to the match object,
1613and the last value PROC returned, or INIT for the first call. Return
1614the last value returned by PROC. We apply PROC to the matches as they
1615appear from left to right.
1616
1617This function recognizes matches according to the same criteria as
1618list-matches.
1619
1620Thus, you could define list-matches like this:
1621
1622 (define (list-matches regexp string . flags)
1623 (reverse! (apply fold-matches regexp string '() cons flags)))
1624
1625If present, FLAGS is passed as the FLAGS argument to regexp-exec.
1626
bc848f7f
MD
1627** Hooks
1628
1629*** New function: hook? OBJ
1630
1631Return #t if OBJ is a hook, otherwise #f.
1632
ece41168
MD
1633*** New function: make-hook-with-name NAME [ARITY]
1634
1635Return a hook with name NAME and arity ARITY. The default value for
1636ARITY is 0. The only effect of NAME is that it will appear when the
1637hook object is printed to ease debugging.
1638
bc848f7f
MD
1639*** New function: hook-empty? HOOK
1640
1641Return #t if HOOK doesn't contain any procedures, otherwise #f.
1642
1643*** New function: hook->list HOOK
1644
1645Return a list of the procedures that are called when run-hook is
1646applied to HOOK.
1647
b074884f
JB
1648** `map' signals an error if its argument lists are not all the same length.
1649
1650This is the behavior required by R5RS, so this change is really a bug
1651fix. But it seems to affect a lot of people's code, so we're
1652mentioning it here anyway.
1653
6822fe53
MD
1654** Print-state handling has been made more transparent
1655
1656Under certain circumstances, ports are represented as a port with an
1657associated print state. Earlier, this pair was represented as a pair
1658(see "Some magic has been added to the printer" below). It is now
1659indistinguishable (almost; see `get-print-state') from a port on the
1660user level.
1661
1662*** New function: port-with-print-state OUTPUT-PORT PRINT-STATE
1663
1664Return a new port with the associated print state PRINT-STATE.
1665
1666*** New function: get-print-state OUTPUT-PORT
1667
1668Return the print state associated with this port if it exists,
1669otherwise return #f.
1670
340a8770 1671*** New function: directory-stream? OBJECT
77242ff9 1672
340a8770 1673Returns true iff OBJECT is a directory stream --- the sort of object
77242ff9
GH
1674returned by `opendir'.
1675
0fdcbcaa
MD
1676** New function: using-readline?
1677
1678Return #t if readline is in use in the current repl.
1679
26405bc1
MD
1680** structs will be removed in 1.4
1681
1682Structs will be replaced in Guile 1.4. We will merge GOOPS into Guile
1683and use GOOPS objects as the fundamental record type.
1684
49199eaa
MD
1685* Changes to the scm_ interface
1686
26405bc1
MD
1687** structs will be removed in 1.4
1688
1689The entire current struct interface (struct.c, struct.h) will be
1690replaced in Guile 1.4. We will merge GOOPS into libguile and use
1691GOOPS objects as the fundamental record type.
1692
49199eaa
MD
1693** The internal representation of subr's has changed
1694
1695Instead of giving a hint to the subr name, the CAR field of the subr
1696now contains an index to a subr entry in scm_subr_table.
1697
1698*** New variable: scm_subr_table
1699
1700An array of subr entries. A subr entry contains the name, properties
1701and documentation associated with the subr. The properties and
1702documentation slots are not yet used.
1703
1704** A new scheme for "forwarding" calls to a builtin to a generic function
1705
1706It is now possible to extend the functionality of some Guile
1707primitives by letting them defer a call to a GOOPS generic function on
240ed66f 1708argument mismatch. This means that there is no loss of efficiency in
daf516d6 1709normal evaluation.
49199eaa
MD
1710
1711Example:
1712
daf516d6 1713 (use-modules (oop goops)) ; Must be GOOPS version 0.2.
49199eaa
MD
1714 (define-method + ((x <string>) (y <string>))
1715 (string-append x y))
1716
86a4d62e
MD
1717+ will still be as efficient as usual in numerical calculations, but
1718can also be used for concatenating strings.
49199eaa 1719
86a4d62e 1720Who will be the first one to extend Guile's numerical tower to
daf516d6
MD
1721rationals? :) [OK, there a few other things to fix before this can
1722be made in a clean way.]
49199eaa
MD
1723
1724*** New snarf macros for defining primitives: SCM_GPROC, SCM_GPROC1
1725
1726 New macro: SCM_GPROC (CNAME, SNAME, REQ, OPT, VAR, CFUNC, GENERIC)
1727
1728 New macro: SCM_GPROC1 (CNAME, SNAME, TYPE, CFUNC, GENERIC)
1729
d02cafe7 1730These do the same job as SCM_PROC and SCM_PROC1, but they also define
49199eaa
MD
1731a variable GENERIC which can be used by the dispatch macros below.
1732
1733[This is experimental code which may change soon.]
1734
1735*** New macros for forwarding control to a generic on arg type error
1736
1737 New macro: SCM_WTA_DISPATCH_1 (GENERIC, ARG1, POS, SUBR)
1738
1739 New macro: SCM_WTA_DISPATCH_2 (GENERIC, ARG1, ARG2, POS, SUBR)
1740
1741These correspond to the scm_wta function call, and have the same
1742behaviour until the user has called the GOOPS primitive
1743`enable-primitive-generic!'. After that, these macros will apply the
1744generic function GENERIC to the argument(s) instead of calling
1745scm_wta.
1746
1747[This is experimental code which may change soon.]
1748
1749*** New macros for argument testing with generic dispatch
1750
1751 New macro: SCM_GASSERT1 (COND, GENERIC, ARG1, POS, SUBR)
1752
1753 New macro: SCM_GASSERT2 (COND, GENERIC, ARG1, ARG2, POS, SUBR)
1754
1755These correspond to the SCM_ASSERT macro, but will defer control to
1756GENERIC on error after `enable-primitive-generic!' has been called.
1757
1758[This is experimental code which may change soon.]
1759
1760** New function: SCM scm_eval_body (SCM body, SCM env)
1761
1762Evaluates the body of a special form.
1763
1764** The internal representation of struct's has changed
1765
1766Previously, four slots were allocated for the procedure(s) of entities
1767and operators. The motivation for this representation had to do with
1768the structure of the evaluator, the wish to support tail-recursive
1769generic functions, and efficiency. Since the generic function
1770dispatch mechanism has changed, there is no longer a need for such an
1771expensive representation, and the representation has been simplified.
1772
1773This should not make any difference for most users.
1774
1775** GOOPS support has been cleaned up.
1776
1777Some code has been moved from eval.c to objects.c and code in both of
1778these compilation units has been cleaned up and better structured.
1779
1780*** New functions for applying generic functions
1781
1782 New function: SCM scm_apply_generic (GENERIC, ARGS)
1783 New function: SCM scm_call_generic_0 (GENERIC)
1784 New function: SCM scm_call_generic_1 (GENERIC, ARG1)
1785 New function: SCM scm_call_generic_2 (GENERIC, ARG1, ARG2)
1786 New function: SCM scm_call_generic_3 (GENERIC, ARG1, ARG2, ARG3)
1787
ece41168
MD
1788** Deprecated function: scm_make_named_hook
1789
1790It is now replaced by:
1791
1792** New function: SCM scm_create_hook (const char *name, int arity)
1793
1794Creates a hook in the same way as make-hook above but also
1795binds a variable named NAME to it.
1796
1797This is the typical way of creating a hook from C code.
1798
1799Currently, the variable is created in the "current" module.
1800This might change when we get the new module system.
1801
1802[The behaviour is identical to scm_make_named_hook.]
1803
1804
43fa9a05 1805\f
f3227c7a
JB
1806Changes since Guile 1.3:
1807
6ca345f3
JB
1808* Changes to mailing lists
1809
1810** Some of the Guile mailing lists have moved to sourceware.cygnus.com.
1811
1812See the README file to find current addresses for all the Guile
1813mailing lists.
1814
d77fb593
JB
1815* Changes to the distribution
1816
1d335863
JB
1817** Readline support is no longer included with Guile by default.
1818
1819Based on the different license terms of Guile and Readline, we
1820concluded that Guile should not *by default* cause the linking of
1821Readline into an application program. Readline support is now offered
1822as a separate module, which is linked into an application only when
1823you explicitly specify it.
1824
1825Although Guile is GNU software, its distribution terms add a special
1826exception to the usual GNU General Public License (GPL). Guile's
1827license includes a clause that allows you to link Guile with non-free
1828programs. We add this exception so as not to put Guile at a
1829disadvantage vis-a-vis other extensibility packages that support other
1830languages.
1831
1832In contrast, the GNU Readline library is distributed under the GNU
1833General Public License pure and simple. This means that you may not
1834link Readline, even dynamically, into an application unless it is
1835distributed under a free software license that is compatible the GPL.
1836
1837Because of this difference in distribution terms, an application that
1838can use Guile may not be able to use Readline. Now users will be
1839explicitly offered two independent decisions about the use of these
1840two packages.
d77fb593 1841
0e8a8468
MV
1842You can activate the readline support by issuing
1843
1844 (use-modules (readline-activator))
1845 (activate-readline)
1846
1847from your ".guile" file, for example.
1848
e4eae9b1
MD
1849* Changes to the stand-alone interpreter
1850
67ad463a
MD
1851** All builtins now print as primitives.
1852Previously builtin procedures not belonging to the fundamental subr
1853types printed as #<compiled closure #<primitive-procedure gsubr-apply>>.
1854Now, they print as #<primitive-procedure NAME>.
1855
1856** Backtraces slightly more intelligible.
1857gsubr-apply and macro transformer application frames no longer appear
1858in backtraces.
1859
69c6acbb
JB
1860* Changes to Scheme functions and syntax
1861
2a52b429
MD
1862** Guile now correctly handles internal defines by rewriting them into
1863their equivalent letrec. Previously, internal defines would
1864incrementally add to the innermost environment, without checking
1865whether the restrictions specified in RnRS were met. This lead to the
1866correct behaviour when these restriction actually were met, but didn't
1867catch all illegal uses. Such an illegal use could lead to crashes of
1868the Guile interpreter or or other unwanted results. An example of
1869incorrect internal defines that made Guile behave erratically:
1870
1871 (let ()
1872 (define a 1)
1873 (define (b) a)
1874 (define c (1+ (b)))
1875 (define d 3)
1876
1877 (b))
1878
1879 => 2
1880
1881The problem with this example is that the definition of `c' uses the
1882value of `b' directly. This confuses the meoization machine of Guile
1883so that the second call of `b' (this time in a larger environment that
1884also contains bindings for `c' and `d') refers to the binding of `c'
1885instead of `a'. You could also make Guile crash with a variation on
1886this theme:
1887
1888 (define (foo flag)
1889 (define a 1)
1890 (define (b flag) (if flag a 1))
1891 (define c (1+ (b flag)))
1892 (define d 3)
1893
1894 (b #t))
1895
1896 (foo #f)
1897 (foo #t)
1898
1899From now on, Guile will issue an `Unbound variable: b' error message
1900for both examples.
1901
36d3d540
MD
1902** Hooks
1903
1904A hook contains a list of functions which should be called on
1905particular occasions in an existing program. Hooks are used for
1906customization.
1907
1908A window manager might have a hook before-window-map-hook. The window
1909manager uses the function run-hooks to call all functions stored in
1910before-window-map-hook each time a window is mapped. The user can
1911store functions in the hook using add-hook!.
1912
1913In Guile, hooks are first class objects.
1914
1915*** New function: make-hook [N_ARGS]
1916
1917Return a hook for hook functions which can take N_ARGS arguments.
1918The default value for N_ARGS is 0.
1919
ad91d6c3
MD
1920(See also scm_make_named_hook below.)
1921
36d3d540
MD
1922*** New function: add-hook! HOOK PROC [APPEND_P]
1923
1924Put PROC at the beginning of the list of functions stored in HOOK.
1925If APPEND_P is supplied, and non-false, put PROC at the end instead.
1926
1927PROC must be able to take the number of arguments specified when the
1928hook was created.
1929
1930If PROC already exists in HOOK, then remove it first.
1931
1932*** New function: remove-hook! HOOK PROC
1933
1934Remove PROC from the list of functions in HOOK.
1935
1936*** New function: reset-hook! HOOK
1937
1938Clear the list of hook functions stored in HOOK.
1939
1940*** New function: run-hook HOOK ARG1 ...
1941
1942Run all hook functions stored in HOOK with arguments ARG1 ... .
1943The number of arguments supplied must correspond to the number given
1944when the hook was created.
1945
56a19408
MV
1946** The function `dynamic-link' now takes optional keyword arguments.
1947 The only keyword argument that is currently defined is `:global
1948 BOOL'. With it, you can control whether the shared library will be
1949 linked in global mode or not. In global mode, the symbols from the
1950 linked library can be used to resolve references from other
1951 dynamically linked libraries. In non-global mode, the linked
1952 library is essentially invisible and can only be accessed via
1953 `dynamic-func', etc. The default is now to link in global mode.
1954 Previously, the default has been non-global mode.
1955
1956 The `#:global' keyword is only effective on platforms that support
1957 the dlopen family of functions.
1958
ad226f25 1959** New function `provided?'
b7e13f65
JB
1960
1961 - Function: provided? FEATURE
1962 Return true iff FEATURE is supported by this installation of
1963 Guile. FEATURE must be a symbol naming a feature; the global
1964 variable `*features*' is a list of available features.
1965
ad226f25
JB
1966** Changes to the module (ice-9 expect):
1967
1968*** The expect-strings macro now matches `$' in a regular expression
1969 only at a line-break or end-of-file by default. Previously it would
ab711359
JB
1970 match the end of the string accumulated so far. The old behaviour
1971 can be obtained by setting the variable `expect-strings-exec-flags'
1972 to 0.
ad226f25
JB
1973
1974*** The expect-strings macro now uses a variable `expect-strings-exec-flags'
1975 for the regexp-exec flags. If `regexp/noteol' is included, then `$'
1976 in a regular expression will still match before a line-break or
1977 end-of-file. The default is `regexp/noteol'.
1978
1979*** The expect-strings macro now uses a variable
1980 `expect-strings-compile-flags' for the flags to be supplied to
1981 `make-regexp'. The default is `regexp/newline', which was previously
1982 hard-coded.
1983
1984*** The expect macro now supplies two arguments to a match procedure:
ab711359
JB
1985 the current accumulated string and a flag to indicate whether
1986 end-of-file has been reached. Previously only the string was supplied.
1987 If end-of-file is reached, the match procedure will be called an
1988 additional time with the same accumulated string as the previous call
1989 but with the flag set.
ad226f25 1990
b7e13f65
JB
1991** New module (ice-9 format), implementing the Common Lisp `format' function.
1992
1993This code, and the documentation for it that appears here, was
1994borrowed from SLIB, with minor adaptations for Guile.
1995
1996 - Function: format DESTINATION FORMAT-STRING . ARGUMENTS
1997 An almost complete implementation of Common LISP format description
1998 according to the CL reference book `Common LISP' from Guy L.
1999 Steele, Digital Press. Backward compatible to most of the
2000 available Scheme format implementations.
2001
2002 Returns `#t', `#f' or a string; has side effect of printing
2003 according to FORMAT-STRING. If DESTINATION is `#t', the output is
2004 to the current output port and `#t' is returned. If DESTINATION
2005 is `#f', a formatted string is returned as the result of the call.
2006 NEW: If DESTINATION is a string, DESTINATION is regarded as the
2007 format string; FORMAT-STRING is then the first argument and the
2008 output is returned as a string. If DESTINATION is a number, the
2009 output is to the current error port if available by the
2010 implementation. Otherwise DESTINATION must be an output port and
2011 `#t' is returned.
2012
2013 FORMAT-STRING must be a string. In case of a formatting error
2014 format returns `#f' and prints a message on the current output or
2015 error port. Characters are output as if the string were output by
2016 the `display' function with the exception of those prefixed by a
2017 tilde (~). For a detailed description of the FORMAT-STRING syntax
2018 please consult a Common LISP format reference manual. For a test
2019 suite to verify this format implementation load `formatst.scm'.
2020 Please send bug reports to `lutzeb@cs.tu-berlin.de'.
2021
2022 Note: `format' is not reentrant, i.e. only one `format'-call may
2023 be executed at a time.
2024
2025
2026*** Format Specification (Format version 3.0)
2027
2028 Please consult a Common LISP format reference manual for a detailed
2029description of the format string syntax. For a demonstration of the
2030implemented directives see `formatst.scm'.
2031
2032 This implementation supports directive parameters and modifiers (`:'
2033and `@' characters). Multiple parameters must be separated by a comma
2034(`,'). Parameters can be numerical parameters (positive or negative),
2035character parameters (prefixed by a quote character (`''), variable
2036parameters (`v'), number of rest arguments parameter (`#'), empty and
2037default parameters. Directive characters are case independent. The
2038general form of a directive is:
2039
2040DIRECTIVE ::= ~{DIRECTIVE-PARAMETER,}[:][@]DIRECTIVE-CHARACTER
2041
2042DIRECTIVE-PARAMETER ::= [ [-|+]{0-9}+ | 'CHARACTER | v | # ]
2043
2044*** Implemented CL Format Control Directives
2045
2046 Documentation syntax: Uppercase characters represent the
2047corresponding control directive characters. Lowercase characters
2048represent control directive parameter descriptions.
2049
2050`~A'
2051 Any (print as `display' does).
2052 `~@A'
2053 left pad.
2054
2055 `~MINCOL,COLINC,MINPAD,PADCHARA'
2056 full padding.
2057
2058`~S'
2059 S-expression (print as `write' does).
2060 `~@S'
2061 left pad.
2062
2063 `~MINCOL,COLINC,MINPAD,PADCHARS'
2064 full padding.
2065
2066`~D'
2067 Decimal.
2068 `~@D'
2069 print number sign always.
2070
2071 `~:D'
2072 print comma separated.
2073
2074 `~MINCOL,PADCHAR,COMMACHARD'
2075 padding.
2076
2077`~X'
2078 Hexadecimal.
2079 `~@X'
2080 print number sign always.
2081
2082 `~:X'
2083 print comma separated.
2084
2085 `~MINCOL,PADCHAR,COMMACHARX'
2086 padding.
2087
2088`~O'
2089 Octal.
2090 `~@O'
2091 print number sign always.
2092
2093 `~:O'
2094 print comma separated.
2095
2096 `~MINCOL,PADCHAR,COMMACHARO'
2097 padding.
2098
2099`~B'
2100 Binary.
2101 `~@B'
2102 print number sign always.
2103
2104 `~:B'
2105 print comma separated.
2106
2107 `~MINCOL,PADCHAR,COMMACHARB'
2108 padding.
2109
2110`~NR'
2111 Radix N.
2112 `~N,MINCOL,PADCHAR,COMMACHARR'
2113 padding.
2114
2115`~@R'
2116 print a number as a Roman numeral.
2117
2118`~:@R'
2119 print a number as an "old fashioned" Roman numeral.
2120
2121`~:R'
2122 print a number as an ordinal English number.
2123
2124`~:@R'
2125 print a number as a cardinal English number.
2126
2127`~P'
2128 Plural.
2129 `~@P'
2130 prints `y' and `ies'.
2131
2132 `~:P'
2133 as `~P but jumps 1 argument backward.'
2134
2135 `~:@P'
2136 as `~@P but jumps 1 argument backward.'
2137
2138`~C'
2139 Character.
2140 `~@C'
2141 prints a character as the reader can understand it (i.e. `#\'
2142 prefixing).
2143
2144 `~:C'
2145 prints a character as emacs does (eg. `^C' for ASCII 03).
2146
2147`~F'
2148 Fixed-format floating-point (prints a flonum like MMM.NNN).
2149 `~WIDTH,DIGITS,SCALE,OVERFLOWCHAR,PADCHARF'
2150 `~@F'
2151 If the number is positive a plus sign is printed.
2152
2153`~E'
2154 Exponential floating-point (prints a flonum like MMM.NNN`E'EE).
2155 `~WIDTH,DIGITS,EXPONENTDIGITS,SCALE,OVERFLOWCHAR,PADCHAR,EXPONENTCHARE'
2156 `~@E'
2157 If the number is positive a plus sign is printed.
2158
2159`~G'
2160 General floating-point (prints a flonum either fixed or
2161 exponential).
2162 `~WIDTH,DIGITS,EXPONENTDIGITS,SCALE,OVERFLOWCHAR,PADCHAR,EXPONENTCHARG'
2163 `~@G'
2164 If the number is positive a plus sign is printed.
2165
2166`~$'
2167 Dollars floating-point (prints a flonum in fixed with signs
2168 separated).
2169 `~DIGITS,SCALE,WIDTH,PADCHAR$'
2170 `~@$'
2171 If the number is positive a plus sign is printed.
2172
2173 `~:@$'
2174 A sign is always printed and appears before the padding.
2175
2176 `~:$'
2177 The sign appears before the padding.
2178
2179`~%'
2180 Newline.
2181 `~N%'
2182 print N newlines.
2183
2184`~&'
2185 print newline if not at the beginning of the output line.
2186 `~N&'
2187 prints `~&' and then N-1 newlines.
2188
2189`~|'
2190 Page Separator.
2191 `~N|'
2192 print N page separators.
2193
2194`~~'
2195 Tilde.
2196 `~N~'
2197 print N tildes.
2198
2199`~'<newline>
2200 Continuation Line.
2201 `~:'<newline>
2202 newline is ignored, white space left.
2203
2204 `~@'<newline>
2205 newline is left, white space ignored.
2206
2207`~T'
2208 Tabulation.
2209 `~@T'
2210 relative tabulation.
2211
2212 `~COLNUM,COLINCT'
2213 full tabulation.
2214
2215`~?'
2216 Indirection (expects indirect arguments as a list).
2217 `~@?'
2218 extracts indirect arguments from format arguments.
2219
2220`~(STR~)'
2221 Case conversion (converts by `string-downcase').
2222 `~:(STR~)'
2223 converts by `string-capitalize'.
2224
2225 `~@(STR~)'
2226 converts by `string-capitalize-first'.
2227
2228 `~:@(STR~)'
2229 converts by `string-upcase'.
2230
2231`~*'
2232 Argument Jumping (jumps 1 argument forward).
2233 `~N*'
2234 jumps N arguments forward.
2235
2236 `~:*'
2237 jumps 1 argument backward.
2238
2239 `~N:*'
2240 jumps N arguments backward.
2241
2242 `~@*'
2243 jumps to the 0th argument.
2244
2245 `~N@*'
2246 jumps to the Nth argument (beginning from 0)
2247
2248`~[STR0~;STR1~;...~;STRN~]'
2249 Conditional Expression (numerical clause conditional).
2250 `~N['
2251 take argument from N.
2252
2253 `~@['
2254 true test conditional.
2255
2256 `~:['
2257 if-else-then conditional.
2258
2259 `~;'
2260 clause separator.
2261
2262 `~:;'
2263 default clause follows.
2264
2265`~{STR~}'
2266 Iteration (args come from the next argument (a list)).
2267 `~N{'
2268 at most N iterations.
2269
2270 `~:{'
2271 args from next arg (a list of lists).
2272
2273 `~@{'
2274 args from the rest of arguments.
2275
2276 `~:@{'
2277 args from the rest args (lists).
2278
2279`~^'
2280 Up and out.
2281 `~N^'
2282 aborts if N = 0
2283
2284 `~N,M^'
2285 aborts if N = M
2286
2287 `~N,M,K^'
2288 aborts if N <= M <= K
2289
2290*** Not Implemented CL Format Control Directives
2291
2292`~:A'
2293 print `#f' as an empty list (see below).
2294
2295`~:S'
2296 print `#f' as an empty list (see below).
2297
2298`~<~>'
2299 Justification.
2300
2301`~:^'
2302 (sorry I don't understand its semantics completely)
2303
2304*** Extended, Replaced and Additional Control Directives
2305
2306`~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHD'
2307`~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHX'
2308`~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHO'
2309`~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHB'
2310`~N,MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHR'
2311 COMMAWIDTH is the number of characters between two comma
2312 characters.
2313
2314`~I'
2315 print a R4RS complex number as `~F~@Fi' with passed parameters for
2316 `~F'.
2317
2318`~Y'
2319 Pretty print formatting of an argument for scheme code lists.
2320
2321`~K'
2322 Same as `~?.'
2323
2324`~!'
2325 Flushes the output if format DESTINATION is a port.
2326
2327`~_'
2328 Print a `#\space' character
2329 `~N_'
2330 print N `#\space' characters.
2331
2332`~/'
2333 Print a `#\tab' character
2334 `~N/'
2335 print N `#\tab' characters.
2336
2337`~NC'
2338 Takes N as an integer representation for a character. No arguments
2339 are consumed. N is converted to a character by `integer->char'. N
2340 must be a positive decimal number.
2341
2342`~:S'
2343 Print out readproof. Prints out internal objects represented as
2344 `#<...>' as strings `"#<...>"' so that the format output can always
2345 be processed by `read'.
2346
2347`~:A'
2348 Print out readproof. Prints out internal objects represented as
2349 `#<...>' as strings `"#<...>"' so that the format output can always
2350 be processed by `read'.
2351
2352`~Q'
2353 Prints information and a copyright notice on the format
2354 implementation.
2355 `~:Q'
2356 prints format version.
2357
2358`~F, ~E, ~G, ~$'
2359 may also print number strings, i.e. passing a number as a string
2360 and format it accordingly.
2361
2362*** Configuration Variables
2363
2364 The format module exports some configuration variables to suit the
2365systems and users needs. There should be no modification necessary for
2366the configuration that comes with Guile. Format detects automatically
2367if the running scheme system implements floating point numbers and
2368complex numbers.
2369
2370format:symbol-case-conv
2371 Symbols are converted by `symbol->string' so the case type of the
2372 printed symbols is implementation dependent.
2373 `format:symbol-case-conv' is a one arg closure which is either
2374 `#f' (no conversion), `string-upcase', `string-downcase' or
2375 `string-capitalize'. (default `#f')
2376
2377format:iobj-case-conv
2378 As FORMAT:SYMBOL-CASE-CONV but applies for the representation of
2379 implementation internal objects. (default `#f')
2380
2381format:expch
2382 The character prefixing the exponent value in `~E' printing.
2383 (default `#\E')
2384
2385*** Compatibility With Other Format Implementations
2386
2387SLIB format 2.x:
2388 See `format.doc'.
2389
2390SLIB format 1.4:
2391 Downward compatible except for padding support and `~A', `~S',
2392 `~P', `~X' uppercase printing. SLIB format 1.4 uses C-style
2393 `printf' padding support which is completely replaced by the CL
2394 `format' padding style.
2395
2396MIT C-Scheme 7.1:
2397 Downward compatible except for `~', which is not documented
2398 (ignores all characters inside the format string up to a newline
2399 character). (7.1 implements `~a', `~s', ~NEWLINE, `~~', `~%',
2400 numerical and variable parameters and `:/@' modifiers in the CL
2401 sense).
2402
2403Elk 1.5/2.0:
2404 Downward compatible except for `~A' and `~S' which print in
2405 uppercase. (Elk implements `~a', `~s', `~~', and `~%' (no
2406 directive parameters or modifiers)).
2407
2408Scheme->C 01nov91:
2409 Downward compatible except for an optional destination parameter:
2410 S2C accepts a format call without a destination which returns a
2411 formatted string. This is equivalent to a #f destination in S2C.
2412 (S2C implements `~a', `~s', `~c', `~%', and `~~' (no directive
2413 parameters or modifiers)).
2414
2415
e7d37b0a 2416** Changes to string-handling functions.
b7e13f65 2417
e7d37b0a 2418These functions were added to support the (ice-9 format) module, above.
b7e13f65 2419
e7d37b0a
JB
2420*** New function: string-upcase STRING
2421*** New function: string-downcase STRING
b7e13f65 2422
e7d37b0a
JB
2423These are non-destructive versions of the existing string-upcase! and
2424string-downcase! functions.
b7e13f65 2425
e7d37b0a
JB
2426*** New function: string-capitalize! STRING
2427*** New function: string-capitalize STRING
2428
2429These functions convert the first letter of each word in the string to
2430upper case. Thus:
2431
2432 (string-capitalize "howdy there")
2433 => "Howdy There"
2434
2435As with the other functions, string-capitalize! modifies the string in
2436place, while string-capitalize returns a modified copy of its argument.
2437
2438*** New function: string-ci->symbol STRING
2439
2440Return a symbol whose name is STRING, but having the same case as if
2441the symbol had be read by `read'.
2442
2443Guile can be configured to be sensitive or insensitive to case
2444differences in Scheme identifiers. If Guile is case-insensitive, all
2445symbols are converted to lower case on input. The `string-ci->symbol'
2446function returns a symbol whose name in STRING, transformed as Guile
2447would if STRING were input.
2448
2449*** New function: substring-move! STRING1 START END STRING2 START
2450
2451Copy the substring of STRING1 from START (inclusive) to END
2452(exclusive) to STRING2 at START. STRING1 and STRING2 may be the same
2453string, and the source and destination areas may overlap; in all
2454cases, the function behaves as if all the characters were copied
2455simultanously.
2456
2457*** Extended functions: substring-move-left! substring-move-right!
2458
2459These functions now correctly copy arbitrarily overlapping substrings;
2460they are both synonyms for substring-move!.
b7e13f65 2461
b7e13f65 2462
deaceb4e
JB
2463** New module (ice-9 getopt-long), with the function `getopt-long'.
2464
2465getopt-long is a function for parsing command-line arguments in a
2466manner consistent with other GNU programs.
2467
2468(getopt-long ARGS GRAMMAR)
2469Parse the arguments ARGS according to the argument list grammar GRAMMAR.
2470
2471ARGS should be a list of strings. Its first element should be the
2472name of the program; subsequent elements should be the arguments
2473that were passed to the program on the command line. The
2474`program-arguments' procedure returns a list of this form.
2475
2476GRAMMAR is a list of the form:
2477((OPTION (PROPERTY VALUE) ...) ...)
2478
2479Each OPTION should be a symbol. `getopt-long' will accept a
2480command-line option named `--OPTION'.
2481Each option can have the following (PROPERTY VALUE) pairs:
2482
2483 (single-char CHAR) --- Accept `-CHAR' as a single-character
2484 equivalent to `--OPTION'. This is how to specify traditional
2485 Unix-style flags.
2486 (required? BOOL) --- If BOOL is true, the option is required.
2487 getopt-long will raise an error if it is not found in ARGS.
2488 (value BOOL) --- If BOOL is #t, the option accepts a value; if
2489 it is #f, it does not; and if it is the symbol
2490 `optional', the option may appear in ARGS with or
2491 without a value.
2492 (predicate FUNC) --- If the option accepts a value (i.e. you
2493 specified `(value #t)' for this option), then getopt
2494 will apply FUNC to the value, and throw an exception
2495 if it returns #f. FUNC should be a procedure which
2496 accepts a string and returns a boolean value; you may
2497 need to use quasiquotes to get it into GRAMMAR.
2498
2499The (PROPERTY VALUE) pairs may occur in any order, but each
2500property may occur only once. By default, options do not have
2501single-character equivalents, are not required, and do not take
2502values.
2503
2504In ARGS, single-character options may be combined, in the usual
2505Unix fashion: ("-x" "-y") is equivalent to ("-xy"). If an option
2506accepts values, then it must be the last option in the
2507combination; the value is the next argument. So, for example, using
2508the following grammar:
2509 ((apples (single-char #\a))
2510 (blimps (single-char #\b) (value #t))
2511 (catalexis (single-char #\c) (value #t)))
2512the following argument lists would be acceptable:
2513 ("-a" "-b" "bang" "-c" "couth") ("bang" and "couth" are the values
2514 for "blimps" and "catalexis")
2515 ("-ab" "bang" "-c" "couth") (same)
2516 ("-ac" "couth" "-b" "bang") (same)
2517 ("-abc" "couth" "bang") (an error, since `-b' is not the
2518 last option in its combination)
2519
2520If an option's value is optional, then `getopt-long' decides
2521whether it has a value by looking at what follows it in ARGS. If
2522the next element is a string, and it does not appear to be an
2523option itself, then that string is the option's value.
2524
2525The value of a long option can appear as the next element in ARGS,
2526or it can follow the option name, separated by an `=' character.
2527Thus, using the same grammar as above, the following argument lists
2528are equivalent:
2529 ("--apples" "Braeburn" "--blimps" "Goodyear")
2530 ("--apples=Braeburn" "--blimps" "Goodyear")
2531 ("--blimps" "Goodyear" "--apples=Braeburn")
2532
2533If the option "--" appears in ARGS, argument parsing stops there;
2534subsequent arguments are returned as ordinary arguments, even if
2535they resemble options. So, in the argument list:
2536 ("--apples" "Granny Smith" "--" "--blimp" "Goodyear")
2537`getopt-long' will recognize the `apples' option as having the
2538value "Granny Smith", but it will not recognize the `blimp'
2539option; it will return the strings "--blimp" and "Goodyear" as
2540ordinary argument strings.
2541
2542The `getopt-long' function returns the parsed argument list as an
2543assocation list, mapping option names --- the symbols from GRAMMAR
2544--- onto their values, or #t if the option does not accept a value.
2545Unused options do not appear in the alist.
2546
2547All arguments that are not the value of any option are returned
2548as a list, associated with the empty list.
2549
2550`getopt-long' throws an exception if:
2551- it finds an unrecognized option in ARGS
2552- a required option is omitted
2553- an option that requires an argument doesn't get one
2554- an option that doesn't accept an argument does get one (this can
2555 only happen using the long option `--opt=value' syntax)
2556- an option predicate fails
2557
2558So, for example:
2559
2560(define grammar
2561 `((lockfile-dir (required? #t)
2562 (value #t)
2563 (single-char #\k)
2564 (predicate ,file-is-directory?))
2565 (verbose (required? #f)
2566 (single-char #\v)
2567 (value #f))
2568 (x-includes (single-char #\x))
2569 (rnet-server (single-char #\y)
2570 (predicate ,string?))))
2571
2572(getopt-long '("my-prog" "-vk" "/tmp" "foo1" "--x-includes=/usr/include"
2573 "--rnet-server=lamprod" "--" "-fred" "foo2" "foo3")
2574 grammar)
2575=> ((() "foo1" "-fred" "foo2" "foo3")
2576 (rnet-server . "lamprod")
2577 (x-includes . "/usr/include")
2578 (lockfile-dir . "/tmp")
2579 (verbose . #t))
2580
2581** The (ice-9 getopt-gnu-style) module is obsolete; use (ice-9 getopt-long).
2582
2583It will be removed in a few releases.
2584
08394899
MS
2585** New syntax: lambda*
2586** New syntax: define*
2587** New syntax: define*-public
2588** New syntax: defmacro*
2589** New syntax: defmacro*-public
2590Guile now supports optional arguments.
2591
2592`lambda*', `define*', `define*-public', `defmacro*' and
2593`defmacro*-public' are identical to the non-* versions except that
2594they use an extended type of parameter list that has the following BNF
2595syntax (parentheses are literal, square brackets indicate grouping,
2596and `*', `+' and `?' have the usual meaning):
2597
2598 ext-param-list ::= ( [identifier]* [#&optional [ext-var-decl]+]?
2599 [#&key [ext-var-decl]+ [#&allow-other-keys]?]?
2600 [[#&rest identifier]|[. identifier]]? ) | [identifier]
2601
2602 ext-var-decl ::= identifier | ( identifier expression )
2603
2604The semantics are best illustrated with the following documentation
2605and examples for `lambda*':
2606
2607 lambda* args . body
2608 lambda extended for optional and keyword arguments
2609
2610 lambda* creates a procedure that takes optional arguments. These
2611 are specified by putting them inside brackets at the end of the
2612 paramater list, but before any dotted rest argument. For example,
2613 (lambda* (a b #&optional c d . e) '())
2614 creates a procedure with fixed arguments a and b, optional arguments c
2615 and d, and rest argument e. If the optional arguments are omitted
2616 in a call, the variables for them are unbound in the procedure. This
2617 can be checked with the bound? macro.
2618
2619 lambda* can also take keyword arguments. For example, a procedure
2620 defined like this:
2621 (lambda* (#&key xyzzy larch) '())
2622 can be called with any of the argument lists (#:xyzzy 11)
2623 (#:larch 13) (#:larch 42 #:xyzzy 19) (). Whichever arguments
2624 are given as keywords are bound to values.
2625
2626 Optional and keyword arguments can also be given default values
2627 which they take on when they are not present in a call, by giving a
2628 two-item list in place of an optional argument, for example in:
2629 (lambda* (foo #&optional (bar 42) #&key (baz 73)) (list foo bar baz))
2630 foo is a fixed argument, bar is an optional argument with default
2631 value 42, and baz is a keyword argument with default value 73.
2632 Default value expressions are not evaluated unless they are needed
2633 and until the procedure is called.
2634
2635 lambda* now supports two more special parameter list keywords.
2636
2637 lambda*-defined procedures now throw an error by default if a
2638 keyword other than one of those specified is found in the actual
2639 passed arguments. However, specifying #&allow-other-keys
2640 immediately after the kyword argument declarations restores the
2641 previous behavior of ignoring unknown keywords. lambda* also now
2642 guarantees that if the same keyword is passed more than once, the
2643 last one passed is the one that takes effect. For example,
2644 ((lambda* (#&key (heads 0) (tails 0)) (display (list heads tails)))
2645 #:heads 37 #:tails 42 #:heads 99)
2646 would result in (99 47) being displayed.
2647
2648 #&rest is also now provided as a synonym for the dotted syntax rest
2649 argument. The argument lists (a . b) and (a #&rest b) are equivalent in
2650 all respects to lambda*. This is provided for more similarity to DSSSL,
2651 MIT-Scheme and Kawa among others, as well as for refugees from other
2652 Lisp dialects.
2653
2654Further documentation may be found in the optargs.scm file itself.
2655
2656The optional argument module also exports the macros `let-optional',
2657`let-optional*', `let-keywords', `let-keywords*' and `bound?'. These
2658are not documented here because they may be removed in the future, but
2659full documentation is still available in optargs.scm.
2660
2e132553
JB
2661** New syntax: and-let*
2662Guile now supports the `and-let*' form, described in the draft SRFI-2.
2663
2664Syntax: (land* (<clause> ...) <body> ...)
2665Each <clause> should have one of the following forms:
2666 (<variable> <expression>)
2667 (<expression>)
2668 <bound-variable>
2669Each <variable> or <bound-variable> should be an identifier. Each
2670<expression> should be a valid expression. The <body> should be a
2671possibly empty sequence of expressions, like the <body> of a
2672lambda form.
2673
2674Semantics: A LAND* expression is evaluated by evaluating the
2675<expression> or <bound-variable> of each of the <clause>s from
2676left to right. The value of the first <expression> or
2677<bound-variable> that evaluates to a false value is returned; the
2678remaining <expression>s and <bound-variable>s are not evaluated.
2679The <body> forms are evaluated iff all the <expression>s and
2680<bound-variable>s evaluate to true values.
2681
2682The <expression>s and the <body> are evaluated in an environment
2683binding each <variable> of the preceding (<variable> <expression>)
2684clauses to the value of the <expression>. Later bindings
2685shadow earlier bindings.
2686
2687Guile's and-let* macro was contributed by Michael Livshin.
2688
36d3d540
MD
2689** New sorting functions
2690
2691*** New function: sorted? SEQUENCE LESS?
ed8c8636
MD
2692Returns `#t' when the sequence argument is in non-decreasing order
2693according to LESS? (that is, there is no adjacent pair `... x y
2694...' for which `(less? y x)').
2695
2696Returns `#f' when the sequence contains at least one out-of-order
2697pair. It is an error if the sequence is neither a list nor a
2698vector.
2699
36d3d540 2700*** New function: merge LIST1 LIST2 LESS?
ed8c8636
MD
2701LIST1 and LIST2 are sorted lists.
2702Returns the sorted list of all elements in LIST1 and LIST2.
2703
2704Assume that the elements a and b1 in LIST1 and b2 in LIST2 are "equal"
2705in the sense that (LESS? x y) --> #f for x, y in {a, b1, b2},
2706and that a < b1 in LIST1. Then a < b1 < b2 in the result.
2707(Here "<" should read "comes before".)
2708
36d3d540 2709*** New procedure: merge! LIST1 LIST2 LESS?
ed8c8636
MD
2710Merges two lists, re-using the pairs of LIST1 and LIST2 to build
2711the result. If the code is compiled, and LESS? constructs no new
2712pairs, no pairs at all will be allocated. The first pair of the
2713result will be either the first pair of LIST1 or the first pair of
2714LIST2.
2715
36d3d540 2716*** New function: sort SEQUENCE LESS?
ed8c8636
MD
2717Accepts either a list or a vector, and returns a new sequence
2718which is sorted. The new sequence is the same type as the input.
2719Always `(sorted? (sort sequence less?) less?)'. The original
2720sequence is not altered in any way. The new sequence shares its
2721elements with the old one; no elements are copied.
2722
36d3d540 2723*** New procedure: sort! SEQUENCE LESS
ed8c8636
MD
2724Returns its sorted result in the original boxes. No new storage is
2725allocated at all. Proper usage: (set! slist (sort! slist <))
2726
36d3d540 2727*** New function: stable-sort SEQUENCE LESS?
ed8c8636
MD
2728Similar to `sort' but stable. That is, if "equal" elements are
2729ordered a < b in the original sequence, they will have the same order
2730in the result.
2731
36d3d540 2732*** New function: stable-sort! SEQUENCE LESS?
ed8c8636
MD
2733Similar to `sort!' but stable.
2734Uses temporary storage when sorting vectors.
2735
36d3d540 2736*** New functions: sort-list, sort-list!
ed8c8636
MD
2737Added for compatibility with scsh.
2738
36d3d540
MD
2739** New built-in random number support
2740
2741*** New function: random N [STATE]
3e8370c3
MD
2742Accepts a positive integer or real N and returns a number of the
2743same type between zero (inclusive) and N (exclusive). The values
2744returned have a uniform distribution.
2745
2746The optional argument STATE must be of the type produced by
416075f1
MD
2747`copy-random-state' or `seed->random-state'. It defaults to the value
2748of the variable `*random-state*'. This object is used to maintain the
2749state of the pseudo-random-number generator and is altered as a side
2750effect of the `random' operation.
3e8370c3 2751
36d3d540 2752*** New variable: *random-state*
3e8370c3
MD
2753Holds a data structure that encodes the internal state of the
2754random-number generator that `random' uses by default. The nature
2755of this data structure is implementation-dependent. It may be
2756printed out and successfully read back in, but may or may not
2757function correctly as a random-number state object in another
2758implementation.
2759
36d3d540 2760*** New function: copy-random-state [STATE]
3e8370c3
MD
2761Returns a new object of type suitable for use as the value of the
2762variable `*random-state*' and as a second argument to `random'.
2763If argument STATE is given, a copy of it is returned. Otherwise a
2764copy of `*random-state*' is returned.
416075f1 2765
36d3d540 2766*** New function: seed->random-state SEED
416075f1
MD
2767Returns a new object of type suitable for use as the value of the
2768variable `*random-state*' and as a second argument to `random'.
2769SEED is a string or a number. A new state is generated and
2770initialized using SEED.
3e8370c3 2771
36d3d540 2772*** New function: random:uniform [STATE]
3e8370c3
MD
2773Returns an uniformly distributed inexact real random number in the
2774range between 0 and 1.
2775
36d3d540 2776*** New procedure: random:solid-sphere! VECT [STATE]
3e8370c3
MD
2777Fills VECT with inexact real random numbers the sum of whose
2778squares is less than 1.0. Thinking of VECT as coordinates in
2779space of dimension N = `(vector-length VECT)', the coordinates are
2780uniformly distributed within the unit N-shere. The sum of the
2781squares of the numbers is returned. VECT can be either a vector
2782or a uniform vector of doubles.
2783
36d3d540 2784*** New procedure: random:hollow-sphere! VECT [STATE]
3e8370c3
MD
2785Fills VECT with inexact real random numbers the sum of whose squares
2786is equal to 1.0. Thinking of VECT as coordinates in space of
2787dimension n = `(vector-length VECT)', the coordinates are uniformly
2788distributed over the surface of the unit n-shere. VECT can be either
2789a vector or a uniform vector of doubles.
2790
36d3d540 2791*** New function: random:normal [STATE]
3e8370c3
MD
2792Returns an inexact real in a normal distribution with mean 0 and
2793standard deviation 1. For a normal distribution with mean M and
2794standard deviation D use `(+ M (* D (random:normal)))'.
2795
36d3d540 2796*** New procedure: random:normal-vector! VECT [STATE]
3e8370c3
MD
2797Fills VECT with inexact real random numbers which are independent and
2798standard normally distributed (i.e., with mean 0 and variance 1).
2799VECT can be either a vector or a uniform vector of doubles.
2800
36d3d540 2801*** New function: random:exp STATE
3e8370c3
MD
2802Returns an inexact real in an exponential distribution with mean 1.
2803For an exponential distribution with mean U use (* U (random:exp)).
2804
69c6acbb
JB
2805** The range of logand, logior, logxor, logtest, and logbit? have changed.
2806
2807These functions now operate on numbers in the range of a C unsigned
2808long.
2809
2810These functions used to operate on numbers in the range of a C signed
2811long; however, this seems inappropriate, because Guile integers don't
2812overflow.
2813
ba4ee0d6
MD
2814** New function: make-guardian
2815This is an implementation of guardians as described in
2816R. Kent Dybvig, Carl Bruggeman, and David Eby (1993) "Guardians in a
2817Generation-Based Garbage Collector" ACM SIGPLAN Conference on
2818Programming Language Design and Implementation, June 1993
2819ftp://ftp.cs.indiana.edu/pub/scheme-repository/doc/pubs/guardians.ps.gz
2820
88ceea5c
MD
2821** New functions: delq1!, delv1!, delete1!
2822These procedures behave similar to delq! and friends but delete only
2823one object if at all.
2824
55254a6a
MD
2825** New function: unread-string STRING PORT
2826Unread STRING to PORT, that is, push it back onto the port so that
2827next read operation will work on the pushed back characters.
2828
2829** unread-char can now be called multiple times
2830If unread-char is called multiple times, the unread characters will be
2831read again in last-in first-out order.
2832
9e97c52d
GH
2833** the procedures uniform-array-read! and uniform-array-write! now
2834work on any kind of port, not just ports which are open on a file.
2835
b074884f 2836** Now 'l' in a port mode requests line buffering.
9e97c52d 2837
69bc9ff3
GH
2838** The procedure truncate-file now works on string ports as well
2839as file ports. If the size argument is omitted, the current
1b9c3dae 2840file position is used.
9e97c52d 2841
c94577b4 2842** new procedure: seek PORT/FDES OFFSET WHENCE
9e97c52d
GH
2843The arguments are the same as for the old fseek procedure, but it
2844works on string ports as well as random-access file ports.
2845
2846** the fseek procedure now works on string ports, since it has been
c94577b4 2847redefined using seek.
9e97c52d
GH
2848
2849** the setvbuf procedure now uses a default size if mode is _IOFBF and
2850size is not supplied.
2851
2852** the newline procedure no longer flushes the port if it's not
2853line-buffered: previously it did if it was the current output port.
2854
2855** open-pipe and close-pipe are no longer primitive procedures, but
2856an emulation can be obtained using `(use-modules (ice-9 popen))'.
2857
2858** the freopen procedure has been removed.
2859
2860** new procedure: drain-input PORT
2861Drains PORT's read buffers (including any pushed-back characters)
2862and returns the contents as a single string.
2863
67ad463a 2864** New function: map-in-order PROC LIST1 LIST2 ...
d41b3904
MD
2865Version of `map' which guarantees that the procedure is applied to the
2866lists in serial order.
2867
67ad463a
MD
2868** Renamed `serial-array-copy!' and `serial-array-map!' to
2869`array-copy-in-order!' and `array-map-in-order!'. The old names are
2870now obsolete and will go away in release 1.5.
2871
cf7132b3 2872** New syntax: collect BODY1 ...
d41b3904
MD
2873Version of `begin' which returns a list of the results of the body
2874forms instead of the result of the last body form. In contrast to
cf7132b3 2875`begin', `collect' allows an empty body.
d41b3904 2876
e4eae9b1
MD
2877** New functions: read-history FILENAME, write-history FILENAME
2878Read/write command line history from/to file. Returns #t on success
2879and #f if an error occured.
2880
d21ffe26
JB
2881** `ls' and `lls' in module (ice-9 ls) now handle no arguments.
2882
2883These procedures return a list of definitions available in the specified
2884argument, a relative module reference. In the case of no argument,
2885`(current-module)' is now consulted for definitions to return, instead
2886of simply returning #f, the former behavior.
2887
f8c9d497
JB
2888** The #/ syntax for lists is no longer supported.
2889
2890Earlier versions of Scheme accepted this syntax, but printed a
2891warning.
2892
2893** Guile no longer consults the SCHEME_LOAD_PATH environment variable.
2894
2895Instead, you should set GUILE_LOAD_PATH to tell Guile where to find
2896modules.
2897
3ffc7a36
MD
2898* Changes to the gh_ interface
2899
2900** gh_scm2doubles
2901
2902Now takes a second argument which is the result array. If this
2903pointer is NULL, a new array is malloced (the old behaviour).
2904
2905** gh_chars2byvect, gh_shorts2svect, gh_floats2fvect, gh_scm2chars,
2906 gh_scm2shorts, gh_scm2longs, gh_scm2floats
2907
2908New functions.
2909
3e8370c3
MD
2910* Changes to the scm_ interface
2911
ad91d6c3
MD
2912** Function: scm_make_named_hook (char* name, int n_args)
2913
2914Creates a hook in the same way as make-hook above but also
2915binds a variable named NAME to it.
2916
2917This is the typical way of creating a hook from C code.
2918
ece41168
MD
2919Currently, the variable is created in the "current" module. This
2920might change when we get the new module system.
ad91d6c3 2921
16a5a9a4
MD
2922** The smob interface
2923
2924The interface for creating smobs has changed. For documentation, see
2925data-rep.info (made from guile-core/doc/data-rep.texi).
2926
2927*** Deprecated function: SCM scm_newsmob (scm_smobfuns *)
2928
2929>>> This function will be removed in 1.3.4. <<<
2930
2931It is replaced by:
2932
2933*** Function: SCM scm_make_smob_type (const char *name, scm_sizet size)
2934This function adds a new smob type, named NAME, with instance size
2935SIZE to the system. The return value is a tag that is used in
2936creating instances of the type. If SIZE is 0, then no memory will
2937be allocated when instances of the smob are created, and nothing
2938will be freed by the default free function.
2939
2940*** Function: void scm_set_smob_mark (long tc, SCM (*mark) (SCM))
2941This function sets the smob marking procedure for the smob type
2942specified by the tag TC. TC is the tag returned by
2943`scm_make_smob_type'.
2944
2945*** Function: void scm_set_smob_free (long tc, SCM (*mark) (SCM))
2946This function sets the smob freeing procedure for the smob type
2947specified by the tag TC. TC is the tag returned by
2948`scm_make_smob_type'.
2949
2950*** Function: void scm_set_smob_print (tc, print)
2951
2952 - Function: void scm_set_smob_print (long tc,
2953 scm_sizet (*print) (SCM,
2954 SCM,
2955 scm_print_state *))
2956
2957This function sets the smob printing procedure for the smob type
2958specified by the tag TC. TC is the tag returned by
2959`scm_make_smob_type'.
2960
2961*** Function: void scm_set_smob_equalp (long tc, SCM (*equalp) (SCM, SCM))
2962This function sets the smob equality-testing predicate for the
2963smob type specified by the tag TC. TC is the tag returned by
2964`scm_make_smob_type'.
2965
2966*** Macro: void SCM_NEWSMOB (SCM var, long tc, void *data)
2967Make VALUE contain a smob instance of the type with type code TC and
2968smob data DATA. VALUE must be previously declared as C type `SCM'.
2969
2970*** Macro: fn_returns SCM_RETURN_NEWSMOB (long tc, void *data)
2971This macro expands to a block of code that creates a smob instance
2972of the type with type code TC and smob data DATA, and returns that
2973`SCM' value. It should be the last piece of code in a block.
2974
9e97c52d
GH
2975** The interfaces for using I/O ports and implementing port types
2976(ptobs) have changed significantly. The new interface is based on
2977shared access to buffers and a new set of ptob procedures.
2978
16a5a9a4
MD
2979*** scm_newptob has been removed
2980
2981It is replaced by:
2982
2983*** Function: SCM scm_make_port_type (type_name, fill_buffer, write_flush)
2984
2985- Function: SCM scm_make_port_type (char *type_name,
2986 int (*fill_buffer) (SCM port),
2987 void (*write_flush) (SCM port));
2988
2989Similarly to the new smob interface, there is a set of function
2990setters by which the user can customize the behaviour of his port
544e9093 2991type. See ports.h (scm_set_port_XXX).
16a5a9a4 2992
9e97c52d
GH
2993** scm_strport_to_string: New function: creates a new string from
2994a string port's buffer.
2995
3e8370c3
MD
2996** Plug in interface for random number generators
2997The variable `scm_the_rng' in random.c contains a value and three
2998function pointers which together define the current random number
2999generator being used by the Scheme level interface and the random
3000number library functions.
3001
3002The user is free to replace the default generator with the generator
3003of his own choice.
3004
3005*** Variable: size_t scm_the_rng.rstate_size
3006The size of the random state type used by the current RNG
3007measured in chars.
3008
3009*** Function: unsigned long scm_the_rng.random_bits (scm_rstate *STATE)
3010Given the random STATE, return 32 random bits.
3011
3012*** Function: void scm_the_rng.init_rstate (scm_rstate *STATE, chars *S, int N)
3013Seed random state STATE using string S of length N.
3014
3015*** Function: scm_rstate *scm_the_rng.copy_rstate (scm_rstate *STATE)
3016Given random state STATE, return a malloced copy.
3017
3018** Default RNG
3019The default RNG is the MWC (Multiply With Carry) random number
3020generator described by George Marsaglia at the Department of
3021Statistics and Supercomputer Computations Research Institute, The
3022Florida State University (http://stat.fsu.edu/~geo).
3023
3024It uses 64 bits, has a period of 4578426017172946943 (4.6e18), and
3025passes all tests in the DIEHARD test suite
3026(http://stat.fsu.edu/~geo/diehard.html). The generation of 32 bits
3027costs one multiply and one add on platforms which either supports long
3028longs (gcc does this on most systems) or have 64 bit longs. The cost
3029is four multiply on other systems but this can be optimized by writing
3030scm_i_uniform32 in assembler.
3031
3032These functions are provided through the scm_the_rng interface for use
3033by libguile and the application.
3034
3035*** Function: unsigned long scm_i_uniform32 (scm_i_rstate *STATE)
3036Given the random STATE, return 32 random bits.
3037Don't use this function directly. Instead go through the plugin
3038interface (see "Plug in interface" above).
3039
3040*** Function: void scm_i_init_rstate (scm_i_rstate *STATE, char *SEED, int N)
3041Initialize STATE using SEED of length N.
3042
3043*** Function: scm_i_rstate *scm_i_copy_rstate (scm_i_rstate *STATE)
3044Return a malloc:ed copy of STATE. This function can easily be re-used
3045in the interfaces to other RNGs.
3046
3047** Random number library functions
3048These functions use the current RNG through the scm_the_rng interface.
3049It might be a good idea to use these functions from your C code so
3050that only one random generator is used by all code in your program.
3051
259529f2 3052The default random state is stored in:
3e8370c3
MD
3053
3054*** Variable: SCM scm_var_random_state
3055Contains the vcell of the Scheme variable "*random-state*" which is
3056used as default state by all random number functions in the Scheme
3057level interface.
3058
3059Example:
3060
259529f2 3061 double x = scm_c_uniform01 (SCM_RSTATE (SCM_CDR (scm_var_random_state)));
3e8370c3 3062
259529f2
MD
3063*** Function: scm_rstate *scm_c_default_rstate (void)
3064This is a convenience function which returns the value of
3065scm_var_random_state. An error message is generated if this value
3066isn't a random state.
3067
3068*** Function: scm_rstate *scm_c_make_rstate (char *SEED, int LENGTH)
3069Make a new random state from the string SEED of length LENGTH.
3070
3071It is generally not a good idea to use multiple random states in a
3072program. While subsequent random numbers generated from one random
3073state are guaranteed to be reasonably independent, there is no such
3074guarantee for numbers generated from different random states.
3075
3076*** Macro: unsigned long scm_c_uniform32 (scm_rstate *STATE)
3077Return 32 random bits.
3078
3079*** Function: double scm_c_uniform01 (scm_rstate *STATE)
3e8370c3
MD
3080Return a sample from the uniform(0,1) distribution.
3081
259529f2 3082*** Function: double scm_c_normal01 (scm_rstate *STATE)
3e8370c3
MD
3083Return a sample from the normal(0,1) distribution.
3084
259529f2 3085*** Function: double scm_c_exp1 (scm_rstate *STATE)
3e8370c3
MD
3086Return a sample from the exp(1) distribution.
3087
259529f2
MD
3088*** Function: unsigned long scm_c_random (scm_rstate *STATE, unsigned long M)
3089Return a sample from the discrete uniform(0,M) distribution.
3090
3091*** Function: SCM scm_c_random_bignum (scm_rstate *STATE, SCM M)
3e8370c3 3092Return a sample from the discrete uniform(0,M) distribution.
259529f2 3093M must be a bignum object. The returned value may be an INUM.
3e8370c3 3094
9e97c52d 3095
f3227c7a 3096\f
d23bbf3e 3097Changes in Guile 1.3 (released Monday, October 19, 1998):
c484bf7f
JB
3098
3099* Changes to the distribution
3100
e2d6569c
JB
3101** We renamed the SCHEME_LOAD_PATH environment variable to GUILE_LOAD_PATH.
3102To avoid conflicts, programs should name environment variables after
3103themselves, except when there's a common practice establishing some
3104other convention.
3105
3106For now, Guile supports both GUILE_LOAD_PATH and SCHEME_LOAD_PATH,
3107giving the former precedence, and printing a warning message if the
3108latter is set. Guile 1.4 will not recognize SCHEME_LOAD_PATH at all.
3109
3110** The header files related to multi-byte characters have been removed.
3111They were: libguile/extchrs.h and libguile/mbstrings.h. Any C code
3112which referred to these explicitly will probably need to be rewritten,
3113since the support for the variant string types has been removed; see
3114below.
3115
3116** The header files append.h and sequences.h have been removed. These
3117files implemented non-R4RS operations which would encourage
3118non-portable programming style and less easy-to-read code.
3a97e020 3119
c484bf7f
JB
3120* Changes to the stand-alone interpreter
3121
2e368582 3122** New procedures have been added to implement a "batch mode":
ec4ab4fd 3123
2e368582 3124*** Function: batch-mode?
ec4ab4fd
GH
3125
3126 Returns a boolean indicating whether the interpreter is in batch
3127 mode.
3128
2e368582 3129*** Function: set-batch-mode?! ARG
ec4ab4fd
GH
3130
3131 If ARG is true, switches the interpreter to batch mode. The `#f'
3132 case has not been implemented.
3133
2e368582
JB
3134** Guile now provides full command-line editing, when run interactively.
3135To use this feature, you must have the readline library installed.
3136The Guile build process will notice it, and automatically include
3137support for it.
3138
3139The readline library is available via anonymous FTP from any GNU
3140mirror site; the canonical location is "ftp://prep.ai.mit.edu/pub/gnu".
3141
a5d6d578
MD
3142** the-last-stack is now a fluid.
3143
c484bf7f
JB
3144* Changes to the procedure for linking libguile with your programs
3145
71f20534 3146** You can now use the `guile-config' utility to build programs that use Guile.
2e368582 3147
2adfe1c0 3148Guile now includes a command-line utility called `guile-config', which
71f20534
JB
3149can provide information about how to compile and link programs that
3150use Guile.
3151
3152*** `guile-config compile' prints any C compiler flags needed to use Guile.
3153You should include this command's output on the command line you use
3154to compile C or C++ code that #includes the Guile header files. It's
3155usually just a `-I' flag to help the compiler find the Guile headers.
3156
3157
3158*** `guile-config link' prints any linker flags necessary to link with Guile.
8aa5c148 3159
71f20534 3160This command writes to its standard output a list of flags which you
8aa5c148
JB
3161must pass to the linker to link your code against the Guile library.
3162The flags include '-lguile' itself, any other libraries the Guile
3163library depends upon, and any `-L' flags needed to help the linker
3164find those libraries.
2e368582
JB
3165
3166For example, here is a Makefile rule that builds a program named 'foo'
3167from the object files ${FOO_OBJECTS}, and links them against Guile:
3168
3169 foo: ${FOO_OBJECTS}
2adfe1c0 3170 ${CC} ${CFLAGS} ${FOO_OBJECTS} `guile-config link` -o foo
2e368582 3171
e2d6569c
JB
3172Previous Guile releases recommended that you use autoconf to detect
3173which of a predefined set of libraries were present on your system.
2adfe1c0 3174It is more robust to use `guile-config', since it records exactly which
e2d6569c
JB
3175libraries the installed Guile library requires.
3176
2adfe1c0
JB
3177This was originally called `build-guile', but was renamed to
3178`guile-config' before Guile 1.3 was released, to be consistent with
3179the analogous script for the GTK+ GUI toolkit, which is called
3180`gtk-config'.
3181
2e368582 3182
8aa5c148
JB
3183** Use the GUILE_FLAGS macro in your configure.in file to find Guile.
3184
3185If you are using the GNU autoconf package to configure your program,
3186you can use the GUILE_FLAGS autoconf macro to call `guile-config'
3187(described above) and gather the necessary values for use in your
3188Makefiles.
3189
3190The GUILE_FLAGS macro expands to configure script code which runs the
3191`guile-config' script, to find out where Guile's header files and
3192libraries are installed. It sets two variables, marked for
3193substitution, as by AC_SUBST.
3194
3195 GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
3196 code that uses Guile header files. This is almost always just a
3197 -I flag.
3198
3199 GUILE_LDFLAGS --- flags to pass to the linker to link a
3200 program against Guile. This includes `-lguile' for the Guile
3201 library itself, any libraries that Guile itself requires (like
3202 -lqthreads), and so on. It may also include a -L flag to tell the
3203 compiler where to find the libraries.
3204
3205GUILE_FLAGS is defined in the file guile.m4, in the top-level
3206directory of the Guile distribution. You can copy it into your
3207package's aclocal.m4 file, and then use it in your configure.in file.
3208
3209If you are using the `aclocal' program, distributed with GNU automake,
3210to maintain your aclocal.m4 file, the Guile installation process
3211installs guile.m4 where aclocal will find it. All you need to do is
3212use GUILE_FLAGS in your configure.in file, and then run `aclocal';
3213this will copy the definition of GUILE_FLAGS into your aclocal.m4
3214file.
3215
3216
c484bf7f 3217* Changes to Scheme functions and syntax
7ad3c1e7 3218
02755d59 3219** Multi-byte strings have been removed, as have multi-byte and wide
e2d6569c
JB
3220ports. We felt that these were the wrong approach to
3221internationalization support.
02755d59 3222
2e368582
JB
3223** New function: readline [PROMPT]
3224Read a line from the terminal, and allow the user to edit it,
3225prompting with PROMPT. READLINE provides a large set of Emacs-like
3226editing commands, lets the user recall previously typed lines, and
3227works on almost every kind of terminal, including dumb terminals.
3228
3229READLINE assumes that the cursor is at the beginning of the line when
3230it is invoked. Thus, you can't print a prompt yourself, and then call
3231READLINE; you need to package up your prompt as a string, pass it to
3232the function, and let READLINE print the prompt itself. This is
3233because READLINE needs to know the prompt's screen width.
3234
8cd57bd0
JB
3235For Guile to provide this function, you must have the readline
3236library, version 2.1 or later, installed on your system. Readline is
3237available via anonymous FTP from prep.ai.mit.edu in pub/gnu, or from
3238any GNU mirror site.
2e368582
JB
3239
3240See also ADD-HISTORY function.
3241
3242** New function: add-history STRING
3243Add STRING as the most recent line in the history used by the READLINE
3244command. READLINE does not add lines to the history itself; you must
3245call ADD-HISTORY to make previous input available to the user.
3246
8cd57bd0
JB
3247** The behavior of the read-line function has changed.
3248
3249This function now uses standard C library functions to read the line,
3250for speed. This means that it doesn not respect the value of
3251scm-line-incrementors; it assumes that lines are delimited with
3252#\newline.
3253
3254(Note that this is read-line, the function that reads a line of text
3255from a port, not readline, the function that reads a line from a
3256terminal, providing full editing capabilities.)
3257
1a0106ef
JB
3258** New module (ice-9 getopt-gnu-style): Parse command-line arguments.
3259
3260This module provides some simple argument parsing. It exports one
3261function:
3262
3263Function: getopt-gnu-style ARG-LS
3264 Parse a list of program arguments into an alist of option
3265 descriptions.
3266
3267 Each item in the list of program arguments is examined to see if
3268 it meets the syntax of a GNU long-named option. An argument like
3269 `--MUMBLE' produces an element of the form (MUMBLE . #t) in the
3270 returned alist, where MUMBLE is a keyword object with the same
3271 name as the argument. An argument like `--MUMBLE=FROB' produces
3272 an element of the form (MUMBLE . FROB), where FROB is a string.
3273
3274 As a special case, the returned alist also contains a pair whose
3275 car is the symbol `rest'. The cdr of this pair is a list
3276 containing all the items in the argument list that are not options
3277 of the form mentioned above.
3278
3279 The argument `--' is treated specially: all items in the argument
3280 list appearing after such an argument are not examined, and are
3281 returned in the special `rest' list.
3282
3283 This function does not parse normal single-character switches.
3284 You will need to parse them out of the `rest' list yourself.
3285
8cd57bd0
JB
3286** The read syntax for byte vectors and short vectors has changed.
3287
3288Instead of #bytes(...), write #y(...).
3289
3290Instead of #short(...), write #h(...).
3291
3292This may seem nutty, but, like the other uniform vectors, byte vectors
3293and short vectors want to have the same print and read syntax (and,
3294more basic, want to have read syntax!). Changing the read syntax to
3295use multiple characters after the hash sign breaks with the
3296conventions used in R5RS and the conventions used for the other
3297uniform vectors. It also introduces complexity in the current reader,
3298both on the C and Scheme levels. (The Right solution is probably to
3299change the syntax and prototypes for uniform vectors entirely.)
3300
3301
3302** The new module (ice-9 session) provides useful interactive functions.
3303
3304*** New procedure: (apropos REGEXP OPTION ...)
3305
3306Display a list of top-level variables whose names match REGEXP, and
3307the modules they are imported from. Each OPTION should be one of the
3308following symbols:
3309
3310 value --- Show the value of each matching variable.
3311 shadow --- Show bindings shadowed by subsequently imported modules.
3312 full --- Same as both `shadow' and `value'.
3313
3314For example:
3315
3316 guile> (apropos "trace" 'full)
3317 debug: trace #<procedure trace args>
3318 debug: untrace #<procedure untrace args>
3319 the-scm-module: display-backtrace #<compiled-closure #<primitive-procedure gsubr-apply>>
3320 the-scm-module: before-backtrace-hook ()
3321 the-scm-module: backtrace #<primitive-procedure backtrace>
3322 the-scm-module: after-backtrace-hook ()
3323 the-scm-module: has-shown-backtrace-hint? #f
3324 guile>
3325
3326** There are new functions and syntax for working with macros.
3327
3328Guile implements macros as a special object type. Any variable whose
3329top-level binding is a macro object acts as a macro. The macro object
3330specifies how the expression should be transformed before evaluation.
3331
3332*** Macro objects now print in a reasonable way, resembling procedures.
3333
3334*** New function: (macro? OBJ)
3335True iff OBJ is a macro object.
3336
3337*** New function: (primitive-macro? OBJ)
3338Like (macro? OBJ), but true only if OBJ is one of the Guile primitive
3339macro transformers, implemented in eval.c rather than Scheme code.
3340
dbdd0c16
JB
3341Why do we have this function?
3342- For symmetry with procedure? and primitive-procedure?,
3343- to allow custom print procedures to tell whether a macro is
3344 primitive, and display it differently, and
3345- to allow compilers and user-written evaluators to distinguish
3346 builtin special forms from user-defined ones, which could be
3347 compiled.
3348
8cd57bd0
JB
3349*** New function: (macro-type OBJ)
3350Return a value indicating what kind of macro OBJ is. Possible return
3351values are:
3352
3353 The symbol `syntax' --- a macro created by procedure->syntax.
3354 The symbol `macro' --- a macro created by procedure->macro.
3355 The symbol `macro!' --- a macro created by procedure->memoizing-macro.
3356 The boolean #f --- if OBJ is not a macro object.
3357
3358*** New function: (macro-name MACRO)
3359Return the name of the macro object MACRO's procedure, as returned by
3360procedure-name.
3361
3362*** New function: (macro-transformer MACRO)
3363Return the transformer procedure for MACRO.
3364
3365*** New syntax: (use-syntax MODULE ... TRANSFORMER)
3366
3367Specify a new macro expander to use in the current module. Each
3368MODULE is a module name, with the same meaning as in the `use-modules'
3369form; each named module's exported bindings are added to the current
3370top-level environment. TRANSFORMER is an expression evaluated in the
3371resulting environment which must yield a procedure to use as the
3372module's eval transformer: every expression evaluated in this module
3373is passed to this function, and the result passed to the Guile
3374interpreter.
3375
3376*** macro-eval! is removed. Use local-eval instead.
29521173 3377
8d9dcb3c
MV
3378** Some magic has been added to the printer to better handle user
3379written printing routines (like record printers, closure printers).
3380
3381The problem is that these user written routines must have access to
7fbd77df 3382the current `print-state' to be able to handle fancy things like
8d9dcb3c
MV
3383detection of circular references. These print-states have to be
3384passed to the builtin printing routines (display, write, etc) to
3385properly continue the print chain.
3386
3387We didn't want to change all existing print code so that it
8cd57bd0 3388explicitly passes thru a print state in addition to a port. Instead,
8d9dcb3c
MV
3389we extented the possible values that the builtin printing routines
3390accept as a `port'. In addition to a normal port, they now also take
3391a pair of a normal port and a print-state. Printing will go to the
3392port and the print-state will be used to control the detection of
3393circular references, etc. If the builtin function does not care for a
3394print-state, it is simply ignored.
3395
3396User written callbacks are now called with such a pair as their
3397`port', but because every function now accepts this pair as a PORT
3398argument, you don't have to worry about that. In fact, it is probably
3399safest to not check for these pairs.
3400
3401However, it is sometimes necessary to continue a print chain on a
3402different port, for example to get a intermediate string
3403representation of the printed value, mangle that string somehow, and
3404then to finally print the mangled string. Use the new function
3405
3406 inherit-print-state OLD-PORT NEW-PORT
3407
3408for this. It constructs a new `port' that prints to NEW-PORT but
3409inherits the print-state of OLD-PORT.
3410
ef1ea498
MD
3411** struct-vtable-offset renamed to vtable-offset-user
3412
3413** New constants: vtable-index-layout, vtable-index-vtable, vtable-index-printer
3414
e478dffa
MD
3415** There is now a third optional argument to make-vtable-vtable
3416 (and fourth to make-struct) when constructing new types (vtables).
3417 This argument initializes field vtable-index-printer of the vtable.
ef1ea498 3418
4851dc57
MV
3419** The detection of circular references has been extended to structs.
3420That is, a structure that -- in the process of being printed -- prints
3421itself does not lead to infinite recursion.
3422
3423** There is now some basic support for fluids. Please read
3424"libguile/fluid.h" to find out more. It is accessible from Scheme with
3425the following functions and macros:
3426
9c3fb66f
MV
3427Function: make-fluid
3428
3429 Create a new fluid object. Fluids are not special variables or
3430 some other extension to the semantics of Scheme, but rather
3431 ordinary Scheme objects. You can store them into variables (that
3432 are still lexically scoped, of course) or into any other place you
3433 like. Every fluid has a initial value of `#f'.
04c76b58 3434
9c3fb66f 3435Function: fluid? OBJ
04c76b58 3436
9c3fb66f 3437 Test whether OBJ is a fluid.
04c76b58 3438
9c3fb66f
MV
3439Function: fluid-ref FLUID
3440Function: fluid-set! FLUID VAL
04c76b58
MV
3441
3442 Access/modify the fluid FLUID. Modifications are only visible
3443 within the current dynamic root (that includes threads).
3444
9c3fb66f
MV
3445Function: with-fluids* FLUIDS VALUES THUNK
3446
3447 FLUIDS is a list of fluids and VALUES a corresponding list of
3448 values for these fluids. Before THUNK gets called the values are
3449 installed in the fluids and the old values of the fluids are
3450 saved in the VALUES list. When the flow of control leaves THUNK
3451 or reenters it, the values get swapped again. You might think of
3452 this as a `safe-fluid-excursion'. Note that the VALUES list is
3453 modified by `with-fluids*'.
3454
3455Macro: with-fluids ((FLUID VALUE) ...) FORM ...
3456
3457 The same as `with-fluids*' but with a different syntax. It looks
3458 just like `let', but both FLUID and VALUE are evaluated. Remember,
3459 fluids are not special variables but ordinary objects. FLUID
3460 should evaluate to a fluid.
04c76b58 3461
e2d6569c 3462** Changes to system call interfaces:
64d01d13 3463
e2d6569c 3464*** close-port, close-input-port and close-output-port now return a
64d01d13
GH
3465boolean instead of an `unspecified' object. #t means that the port
3466was successfully closed, while #f means it was already closed. It is
3467also now possible for these procedures to raise an exception if an
3468error occurs (some errors from write can be delayed until close.)
3469
e2d6569c 3470*** the first argument to chmod, fcntl, ftell and fseek can now be a
6afcd3b2
GH
3471file descriptor.
3472
e2d6569c 3473*** the third argument to fcntl is now optional.
6afcd3b2 3474
e2d6569c 3475*** the first argument to chown can now be a file descriptor or a port.
6afcd3b2 3476
e2d6569c 3477*** the argument to stat can now be a port.
6afcd3b2 3478
e2d6569c 3479*** The following new procedures have been added (most use scsh
64d01d13
GH
3480interfaces):
3481
e2d6569c 3482*** procedure: close PORT/FD
ec4ab4fd
GH
3483 Similar to close-port (*note close-port: Closing Ports.), but also
3484 works on file descriptors. A side effect of closing a file
3485 descriptor is that any ports using that file descriptor are moved
3486 to a different file descriptor and have their revealed counts set
3487 to zero.
3488
e2d6569c 3489*** procedure: port->fdes PORT
ec4ab4fd
GH
3490 Returns the integer file descriptor underlying PORT. As a side
3491 effect the revealed count of PORT is incremented.
3492
e2d6569c 3493*** procedure: fdes->ports FDES
ec4ab4fd
GH
3494 Returns a list of existing ports which have FDES as an underlying
3495 file descriptor, without changing their revealed counts.
3496
e2d6569c 3497*** procedure: fdes->inport FDES
ec4ab4fd
GH
3498 Returns an existing input port which has FDES as its underlying
3499 file descriptor, if one exists, and increments its revealed count.
3500 Otherwise, returns a new input port with a revealed count of 1.
3501
e2d6569c 3502*** procedure: fdes->outport FDES
ec4ab4fd
GH
3503 Returns an existing output port which has FDES as its underlying
3504 file descriptor, if one exists, and increments its revealed count.
3505 Otherwise, returns a new output port with a revealed count of 1.
3506
3507 The next group of procedures perform a `dup2' system call, if NEWFD
3508(an integer) is supplied, otherwise a `dup'. The file descriptor to be
3509duplicated can be supplied as an integer or contained in a port. The
64d01d13
GH
3510type of value returned varies depending on which procedure is used.
3511
ec4ab4fd
GH
3512 All procedures also have the side effect when performing `dup2' that
3513any ports using NEWFD are moved to a different file descriptor and have
64d01d13
GH
3514their revealed counts set to zero.
3515
e2d6569c 3516*** procedure: dup->fdes PORT/FD [NEWFD]
ec4ab4fd 3517 Returns an integer file descriptor.
64d01d13 3518
e2d6569c 3519*** procedure: dup->inport PORT/FD [NEWFD]
ec4ab4fd 3520 Returns a new input port using the new file descriptor.
64d01d13 3521
e2d6569c 3522*** procedure: dup->outport PORT/FD [NEWFD]
ec4ab4fd 3523 Returns a new output port using the new file descriptor.
64d01d13 3524
e2d6569c 3525*** procedure: dup PORT/FD [NEWFD]
ec4ab4fd
GH
3526 Returns a new port if PORT/FD is a port, with the same mode as the
3527 supplied port, otherwise returns an integer file descriptor.
64d01d13 3528
e2d6569c 3529*** procedure: dup->port PORT/FD MODE [NEWFD]
ec4ab4fd
GH
3530 Returns a new port using the new file descriptor. MODE supplies a
3531 mode string for the port (*note open-file: File Ports.).
64d01d13 3532
e2d6569c 3533*** procedure: setenv NAME VALUE
ec4ab4fd
GH
3534 Modifies the environment of the current process, which is also the
3535 default environment inherited by child processes.
64d01d13 3536
ec4ab4fd
GH
3537 If VALUE is `#f', then NAME is removed from the environment.
3538 Otherwise, the string NAME=VALUE is added to the environment,
3539 replacing any existing string with name matching NAME.
64d01d13 3540
ec4ab4fd 3541 The return value is unspecified.
956055a9 3542
e2d6569c 3543*** procedure: truncate-file OBJ SIZE
6afcd3b2
GH
3544 Truncates the file referred to by OBJ to at most SIZE bytes. OBJ
3545 can be a string containing a file name or an integer file
3546 descriptor or port open for output on the file. The underlying
3547 system calls are `truncate' and `ftruncate'.
3548
3549 The return value is unspecified.
3550
e2d6569c 3551*** procedure: setvbuf PORT MODE [SIZE]
7a6f1ffa
GH
3552 Set the buffering mode for PORT. MODE can be:
3553 `_IONBF'
3554 non-buffered
3555
3556 `_IOLBF'
3557 line buffered
3558
3559 `_IOFBF'
3560 block buffered, using a newly allocated buffer of SIZE bytes.
3561 However if SIZE is zero or unspecified, the port will be made
3562 non-buffered.
3563
3564 This procedure should not be used after I/O has been performed with
3565 the port.
3566
3567 Ports are usually block buffered by default, with a default buffer
3568 size. Procedures e.g., *Note open-file: File Ports, which accept a
3569 mode string allow `0' to be added to request an unbuffered port.
3570
e2d6569c 3571*** procedure: fsync PORT/FD
6afcd3b2
GH
3572 Copies any unwritten data for the specified output file descriptor
3573 to disk. If PORT/FD is a port, its buffer is flushed before the
3574 underlying file descriptor is fsync'd. The return value is
3575 unspecified.
3576
e2d6569c 3577*** procedure: open-fdes PATH FLAGS [MODES]
6afcd3b2
GH
3578 Similar to `open' but returns a file descriptor instead of a port.
3579
e2d6569c 3580*** procedure: execle PATH ENV [ARG] ...
6afcd3b2
GH
3581 Similar to `execl', but the environment of the new process is
3582 specified by ENV, which must be a list of strings as returned by
3583 the `environ' procedure.
3584
3585 This procedure is currently implemented using the `execve' system
3586 call, but we call it `execle' because of its Scheme calling
3587 interface.
3588
e2d6569c 3589*** procedure: strerror ERRNO
ec4ab4fd
GH
3590 Returns the Unix error message corresponding to ERRNO, an integer.
3591
e2d6569c 3592*** procedure: primitive-exit [STATUS]
6afcd3b2
GH
3593 Terminate the current process without unwinding the Scheme stack.
3594 This is would typically be useful after a fork. The exit status
3595 is STATUS if supplied, otherwise zero.
3596
e2d6569c 3597*** procedure: times
6afcd3b2
GH
3598 Returns an object with information about real and processor time.
3599 The following procedures accept such an object as an argument and
3600 return a selected component:
3601
3602 `tms:clock'
3603 The current real time, expressed as time units relative to an
3604 arbitrary base.
3605
3606 `tms:utime'
3607 The CPU time units used by the calling process.
3608
3609 `tms:stime'
3610 The CPU time units used by the system on behalf of the
3611 calling process.
3612
3613 `tms:cutime'
3614 The CPU time units used by terminated child processes of the
3615 calling process, whose status has been collected (e.g., using
3616 `waitpid').
3617
3618 `tms:cstime'
3619 Similarly, the CPU times units used by the system on behalf of
3620 terminated child processes.
7ad3c1e7 3621
e2d6569c
JB
3622** Removed: list-length
3623** Removed: list-append, list-append!
3624** Removed: list-reverse, list-reverse!
3625
3626** array-map renamed to array-map!
3627
3628** serial-array-map renamed to serial-array-map!
3629
660f41fa
MD
3630** catch doesn't take #f as first argument any longer
3631
3632Previously, it was possible to pass #f instead of a key to `catch'.
3633That would cause `catch' to pass a jump buffer object to the procedure
3634passed as second argument. The procedure could then use this jump
3635buffer objekt as an argument to throw.
3636
3637This mechanism has been removed since its utility doesn't motivate the
3638extra complexity it introduces.
3639
332d00f6
JB
3640** The `#/' notation for lists now provokes a warning message from Guile.
3641This syntax will be removed from Guile in the near future.
3642
3643To disable the warning message, set the GUILE_HUSH environment
3644variable to any non-empty value.
3645
8cd57bd0
JB
3646** The newline character now prints as `#\newline', following the
3647normal Scheme notation, not `#\nl'.
3648
c484bf7f
JB
3649* Changes to the gh_ interface
3650
8986901b
JB
3651** The gh_enter function now takes care of loading the Guile startup files.
3652gh_enter works by calling scm_boot_guile; see the remarks below.
3653
5424b4f7
MD
3654** Function: void gh_write (SCM x)
3655
3656Write the printed representation of the scheme object x to the current
3657output port. Corresponds to the scheme level `write'.
3658
3a97e020
MD
3659** gh_list_length renamed to gh_length.
3660
8d6787b6
MG
3661** vector handling routines
3662
3663Several major changes. In particular, gh_vector() now resembles
3664(vector ...) (with a caveat -- see manual), and gh_make_vector() now
956328d2
MG
3665exists and behaves like (make-vector ...). gh_vset() and gh_vref()
3666have been renamed gh_vector_set_x() and gh_vector_ref(). Some missing
8d6787b6
MG
3667vector-related gh_ functions have been implemented.
3668
7fee59bd
MG
3669** pair and list routines
3670
3671Implemented several of the R4RS pair and list functions that were
3672missing.
3673
171422a9
MD
3674** gh_scm2doubles, gh_doubles2scm, gh_doubles2dvect
3675
3676New function. Converts double arrays back and forth between Scheme
3677and C.
3678
c484bf7f
JB
3679* Changes to the scm_ interface
3680
8986901b
JB
3681** The function scm_boot_guile now takes care of loading the startup files.
3682
3683Guile's primary initialization function, scm_boot_guile, now takes
3684care of loading `boot-9.scm', in the `ice-9' module, to initialize
3685Guile, define the module system, and put together some standard
3686bindings. It also loads `init.scm', which is intended to hold
3687site-specific initialization code.
3688
3689Since Guile cannot operate properly until boot-9.scm is loaded, there
3690is no reason to separate loading boot-9.scm from Guile's other
3691initialization processes.
3692
3693This job used to be done by scm_compile_shell_switches, which didn't
3694make much sense; in particular, it meant that people using Guile for
3695non-shell-like applications had to jump through hoops to get Guile
3696initialized properly.
3697
3698** The function scm_compile_shell_switches no longer loads the startup files.
3699Now, Guile always loads the startup files, whenever it is initialized;
3700see the notes above for scm_boot_guile and scm_load_startup_files.
3701
3702** Function: scm_load_startup_files
3703This new function takes care of loading Guile's initialization file
3704(`boot-9.scm'), and the site initialization file, `init.scm'. Since
3705this is always called by the Guile initialization process, it's
3706probably not too useful to call this yourself, but it's there anyway.
3707
87148d9e
JB
3708** The semantics of smob marking have changed slightly.
3709
3710The smob marking function (the `mark' member of the scm_smobfuns
3711structure) is no longer responsible for setting the mark bit on the
3712smob. The generic smob handling code in the garbage collector will
3713set this bit. The mark function need only ensure that any other
3714objects the smob refers to get marked.
3715
3716Note that this change means that the smob's GC8MARK bit is typically
3717already set upon entry to the mark function. Thus, marking functions
3718which look like this:
3719
3720 {
3721 if (SCM_GC8MARKP (ptr))
3722 return SCM_BOOL_F;
3723 SCM_SETGC8MARK (ptr);
3724 ... mark objects to which the smob refers ...
3725 }
3726
3727are now incorrect, since they will return early, and fail to mark any
3728other objects the smob refers to. Some code in the Guile library used
3729to work this way.
3730
1cf84ea5
JB
3731** The semantics of the I/O port functions in scm_ptobfuns have changed.
3732
3733If you have implemented your own I/O port type, by writing the
3734functions required by the scm_ptobfuns and then calling scm_newptob,
3735you will need to change your functions slightly.
3736
3737The functions in a scm_ptobfuns structure now expect the port itself
3738as their argument; they used to expect the `stream' member of the
3739port's scm_port_table structure. This allows functions in an
3740scm_ptobfuns structure to easily access the port's cell (and any flags
3741it its CAR), and the port's scm_port_table structure.
3742
3743Guile now passes the I/O port itself as the `port' argument in the
3744following scm_ptobfuns functions:
3745
3746 int (*free) (SCM port);
3747 int (*fputc) (int, SCM port);
3748 int (*fputs) (char *, SCM port);
3749 scm_sizet (*fwrite) SCM_P ((char *ptr,
3750 scm_sizet size,
3751 scm_sizet nitems,
3752 SCM port));
3753 int (*fflush) (SCM port);
3754 int (*fgetc) (SCM port);
3755 int (*fclose) (SCM port);
3756
3757The interfaces to the `mark', `print', `equalp', and `fgets' methods
3758are unchanged.
3759
3760If you have existing code which defines its own port types, it is easy
3761to convert your code to the new interface; simply apply SCM_STREAM to
3762the port argument to yield the value you code used to expect.
3763
3764Note that since both the port and the stream have the same type in the
3765C code --- they are both SCM values --- the C compiler will not remind
3766you if you forget to update your scm_ptobfuns functions.
3767
3768
933a7411
MD
3769** Function: int scm_internal_select (int fds,
3770 SELECT_TYPE *rfds,
3771 SELECT_TYPE *wfds,
3772 SELECT_TYPE *efds,
3773 struct timeval *timeout);
3774
3775This is a replacement for the `select' function provided by the OS.
3776It enables I/O blocking and sleeping to happen for one cooperative
3777thread without blocking other threads. It also avoids busy-loops in
3778these situations. It is intended that all I/O blocking and sleeping
3779will finally go through this function. Currently, this function is
3780only available on systems providing `gettimeofday' and `select'.
3781
5424b4f7
MD
3782** Function: SCM scm_internal_stack_catch (SCM tag,
3783 scm_catch_body_t body,
3784 void *body_data,
3785 scm_catch_handler_t handler,
3786 void *handler_data)
3787
3788A new sibling to the other two C level `catch' functions
3789scm_internal_catch and scm_internal_lazy_catch. Use it if you want
3790the stack to be saved automatically into the variable `the-last-stack'
3791(scm_the_last_stack_var) on error. This is necessary if you want to
3792use advanced error reporting, such as calling scm_display_error and
3793scm_display_backtrace. (They both take a stack object as argument.)
3794
df366c26
MD
3795** Function: SCM scm_spawn_thread (scm_catch_body_t body,
3796 void *body_data,
3797 scm_catch_handler_t handler,
3798 void *handler_data)
3799
3800Spawns a new thread. It does a job similar to
3801scm_call_with_new_thread but takes arguments more suitable when
3802spawning threads from application C code.
3803
88482b31
MD
3804** The hook scm_error_callback has been removed. It was originally
3805intended as a way for the user to install his own error handler. But
3806that method works badly since it intervenes between throw and catch,
3807thereby changing the semantics of expressions like (catch #t ...).
3808The correct way to do it is to use one of the C level catch functions
3809in throw.c: scm_internal_catch/lazy_catch/stack_catch.
3810
3a97e020
MD
3811** Removed functions:
3812
3813scm_obj_length, scm_list_length, scm_list_append, scm_list_append_x,
3814scm_list_reverse, scm_list_reverse_x
3815
3816** New macros: SCM_LISTn where n is one of the integers 0-9.
3817
3818These can be used for pretty list creation from C. The idea is taken
3819from Erick Gallesio's STk.
3820
298aa6e3
MD
3821** scm_array_map renamed to scm_array_map_x
3822
527da704
MD
3823** mbstrings are now removed
3824
3825This means that the type codes scm_tc7_mb_string and
3826scm_tc7_mb_substring has been removed.
3827
8cd57bd0
JB
3828** scm_gen_putc, scm_gen_puts, scm_gen_write, and scm_gen_getc have changed.
3829
3830Since we no longer support multi-byte strings, these I/O functions
3831have been simplified, and renamed. Here are their old names, and
3832their new names and arguments:
3833
3834scm_gen_putc -> void scm_putc (int c, SCM port);
3835scm_gen_puts -> void scm_puts (char *s, SCM port);
3836scm_gen_write -> void scm_lfwrite (char *ptr, scm_sizet size, SCM port);
3837scm_gen_getc -> void scm_getc (SCM port);
3838
3839
527da704
MD
3840** The macros SCM_TYP7D and SCM_TYP7SD has been removed.
3841
3842** The macro SCM_TYP7S has taken the role of the old SCM_TYP7D
3843
3844SCM_TYP7S now masks away the bit which distinguishes substrings from
3845strings.
3846
660f41fa
MD
3847** scm_catch_body_t: Backward incompatible change!
3848
3849Body functions to scm_internal_catch and friends do not any longer
3850take a second argument. This is because it is no longer possible to
3851pass a #f arg to catch.
3852
a8e05009
JB
3853** Calls to scm_protect_object and scm_unprotect now nest properly.
3854
3855The function scm_protect_object protects its argument from being freed
3856by the garbage collector. scm_unprotect_object removes that
3857protection.
3858
3859These functions now nest properly. That is, for every object O, there
3860is a counter which scm_protect_object(O) increments and
3861scm_unprotect_object(O) decrements, if the counter is greater than
3862zero. Every object's counter is zero when it is first created. If an
3863object's counter is greater than zero, the garbage collector will not
3864reclaim its storage.
3865
3866This allows you to use scm_protect_object in your code without
3867worrying that some other function you call will call
3868scm_unprotect_object, and allow it to be freed. Assuming that the
3869functions you call are well-behaved, and unprotect only those objects
3870they protect, you can follow the same rule and have confidence that
3871objects will be freed only at appropriate times.
3872
c484bf7f
JB
3873\f
3874Changes in Guile 1.2 (released Tuesday, June 24 1997):
cf78e9e8 3875
737c9113
JB
3876* Changes to the distribution
3877
832b09ed
JB
3878** Nightly snapshots are now available from ftp.red-bean.com.
3879The old server, ftp.cyclic.com, has been relinquished to its rightful
3880owner.
3881
3882Nightly snapshots of the Guile development sources are now available via
3883anonymous FTP from ftp.red-bean.com, as /pub/guile/guile-snap.tar.gz.
3884
3885Via the web, that's: ftp://ftp.red-bean.com/pub/guile/guile-snap.tar.gz
3886For getit, that's: ftp.red-bean.com:/pub/guile/guile-snap.tar.gz
3887
0fcab5ed
JB
3888** To run Guile without installing it, the procedure has changed a bit.
3889
3890If you used a separate build directory to compile Guile, you'll need
3891to include the build directory in SCHEME_LOAD_PATH, as well as the
3892source directory. See the `INSTALL' file for examples.
3893
737c9113
JB
3894* Changes to the procedure for linking libguile with your programs
3895
94982a4e
JB
3896** The standard Guile load path for Scheme code now includes
3897$(datadir)/guile (usually /usr/local/share/guile). This means that
3898you can install your own Scheme files there, and Guile will find them.
3899(Previous versions of Guile only checked a directory whose name
3900contained the Guile version number, so you had to re-install or move
3901your Scheme sources each time you installed a fresh version of Guile.)
3902
3903The load path also includes $(datadir)/guile/site; we recommend
3904putting individual Scheme files there. If you want to install a
3905package with multiple source files, create a directory for them under
3906$(datadir)/guile.
3907
3908** Guile 1.2 will now use the Rx regular expression library, if it is
3909installed on your system. When you are linking libguile into your own
3910programs, this means you will have to link against -lguile, -lqt (if
3911you configured Guile with thread support), and -lrx.
27590f82
JB
3912
3913If you are using autoconf to generate configuration scripts for your
3914application, the following lines should suffice to add the appropriate
3915libraries to your link command:
3916
3917### Find Rx, quickthreads and libguile.
3918AC_CHECK_LIB(rx, main)
3919AC_CHECK_LIB(qt, main)
3920AC_CHECK_LIB(guile, scm_shell)
3921
94982a4e
JB
3922The Guile 1.2 distribution does not contain sources for the Rx
3923library, as Guile 1.0 did. If you want to use Rx, you'll need to
3924retrieve it from a GNU FTP site and install it separately.
3925
b83b8bee
JB
3926* Changes to Scheme functions and syntax
3927
e035e7e6
MV
3928** The dynamic linking features of Guile are now enabled by default.
3929You can disable them by giving the `--disable-dynamic-linking' option
3930to configure.
3931
e035e7e6
MV
3932 (dynamic-link FILENAME)
3933
3934 Find the object file denoted by FILENAME (a string) and link it
3935 into the running Guile application. When everything works out,
3936 return a Scheme object suitable for representing the linked object
3937 file. Otherwise an error is thrown. How object files are
3938 searched is system dependent.
3939
3940 (dynamic-object? VAL)
3941
3942 Determine whether VAL represents a dynamically linked object file.
3943
3944 (dynamic-unlink DYNOBJ)
3945
3946 Unlink the indicated object file from the application. DYNOBJ
3947 should be one of the values returned by `dynamic-link'.
3948
3949 (dynamic-func FUNCTION DYNOBJ)
3950
3951 Search the C function indicated by FUNCTION (a string or symbol)
3952 in DYNOBJ and return some Scheme object that can later be used
3953 with `dynamic-call' to actually call this function. Right now,
3954 these Scheme objects are formed by casting the address of the
3955 function to `long' and converting this number to its Scheme
3956 representation.
3957
3958 (dynamic-call FUNCTION DYNOBJ)
3959
3960 Call the C function indicated by FUNCTION and DYNOBJ. The
3961 function is passed no arguments and its return value is ignored.
3962 When FUNCTION is something returned by `dynamic-func', call that
3963 function and ignore DYNOBJ. When FUNCTION is a string (or symbol,
3964 etc.), look it up in DYNOBJ; this is equivalent to
3965
3966 (dynamic-call (dynamic-func FUNCTION DYNOBJ) #f)
3967
3968 Interrupts are deferred while the C function is executing (with
3969 SCM_DEFER_INTS/SCM_ALLOW_INTS).
3970
3971 (dynamic-args-call FUNCTION DYNOBJ ARGS)
3972
3973 Call the C function indicated by FUNCTION and DYNOBJ, but pass it
3974 some arguments and return its return value. The C function is
3975 expected to take two arguments and return an `int', just like
3976 `main':
3977
3978 int c_func (int argc, char **argv);
3979
3980 ARGS must be a list of strings and is converted into an array of
3981 `char *'. The array is passed in ARGV and its size in ARGC. The
3982 return value is converted to a Scheme number and returned from the
3983 call to `dynamic-args-call'.
3984
0fcab5ed
JB
3985When dynamic linking is disabled or not supported on your system,
3986the above functions throw errors, but they are still available.
3987
e035e7e6
MV
3988Here is a small example that works on GNU/Linux:
3989
3990 (define libc-obj (dynamic-link "libc.so"))
3991 (dynamic-args-call 'rand libc-obj '())
3992
3993See the file `libguile/DYNAMIC-LINKING' for additional comments.
3994
27590f82
JB
3995** The #/ syntax for module names is depreciated, and will be removed
3996in a future version of Guile. Instead of
3997
3998 #/foo/bar/baz
3999
4000instead write
4001
4002 (foo bar baz)
4003
4004The latter syntax is more consistent with existing Lisp practice.
4005
5dade857
MV
4006** Guile now does fancier printing of structures. Structures are the
4007underlying implementation for records, which in turn are used to
4008implement modules, so all of these object now print differently and in
4009a more informative way.
4010
161029df
JB
4011The Scheme printer will examine the builtin variable *struct-printer*
4012whenever it needs to print a structure object. When this variable is
4013not `#f' it is deemed to be a procedure and will be applied to the
4014structure object and the output port. When *struct-printer* is `#f'
4015or the procedure return `#f' the structure object will be printed in
4016the boring #<struct 80458270> form.
5dade857
MV
4017
4018This hook is used by some routines in ice-9/boot-9.scm to implement
4019type specific printing routines. Please read the comments there about
4020"printing structs".
4021
4022One of the more specific uses of structs are records. The printing
4023procedure that could be passed to MAKE-RECORD-TYPE is now actually
4024called. It should behave like a *struct-printer* procedure (described
4025above).
4026
b83b8bee
JB
4027** Guile now supports a new R4RS-compliant syntax for keywords. A
4028token of the form #:NAME, where NAME has the same syntax as a Scheme
4029symbol, is the external representation of the keyword named NAME.
4030Keyword objects print using this syntax as well, so values containing
1e5afba0
JB
4031keyword objects can be read back into Guile. When used in an
4032expression, keywords are self-quoting objects.
b83b8bee
JB
4033
4034Guile suports this read syntax, and uses this print syntax, regardless
4035of the current setting of the `keyword' read option. The `keyword'
4036read option only controls whether Guile recognizes the `:NAME' syntax,
4037which is incompatible with R4RS. (R4RS says such token represent
4038symbols.)
737c9113
JB
4039
4040** Guile has regular expression support again. Guile 1.0 included
4041functions for matching regular expressions, based on the Rx library.
4042In Guile 1.1, the Guile/Rx interface was removed to simplify the
4043distribution, and thus Guile had no regular expression support. Guile
94982a4e
JB
40441.2 again supports the most commonly used functions, and supports all
4045of SCSH's regular expression functions.
2409cdfa 4046
94982a4e
JB
4047If your system does not include a POSIX regular expression library,
4048and you have not linked Guile with a third-party regexp library such as
4049Rx, these functions will not be available. You can tell whether your
4050Guile installation includes regular expression support by checking
4051whether the `*features*' list includes the `regex' symbol.
737c9113 4052
94982a4e 4053*** regexp functions
161029df 4054
94982a4e
JB
4055By default, Guile supports POSIX extended regular expressions. That
4056means that the characters `(', `)', `+' and `?' are special, and must
4057be escaped if you wish to match the literal characters.
e1a191a8 4058
94982a4e
JB
4059This regular expression interface was modeled after that implemented
4060by SCSH, the Scheme Shell. It is intended to be upwardly compatible
4061with SCSH regular expressions.
4062
4063**** Function: string-match PATTERN STR [START]
4064 Compile the string PATTERN into a regular expression and compare
4065 it with STR. The optional numeric argument START specifies the
4066 position of STR at which to begin matching.
4067
4068 `string-match' returns a "match structure" which describes what,
4069 if anything, was matched by the regular expression. *Note Match
4070 Structures::. If STR does not match PATTERN at all,
4071 `string-match' returns `#f'.
4072
4073 Each time `string-match' is called, it must compile its PATTERN
4074argument into a regular expression structure. This operation is
4075expensive, which makes `string-match' inefficient if the same regular
4076expression is used several times (for example, in a loop). For better
4077performance, you can compile a regular expression in advance and then
4078match strings against the compiled regexp.
4079
4080**** Function: make-regexp STR [FLAGS]
4081 Compile the regular expression described by STR, and return the
4082 compiled regexp structure. If STR does not describe a legal
4083 regular expression, `make-regexp' throws a
4084 `regular-expression-syntax' error.
4085
4086 FLAGS may be the bitwise-or of one or more of the following:
4087
4088**** Constant: regexp/extended
4089 Use POSIX Extended Regular Expression syntax when interpreting
4090 STR. If not set, POSIX Basic Regular Expression syntax is used.
4091 If the FLAGS argument is omitted, we assume regexp/extended.
4092
4093**** Constant: regexp/icase
4094 Do not differentiate case. Subsequent searches using the
4095 returned regular expression will be case insensitive.
4096
4097**** Constant: regexp/newline
4098 Match-any-character operators don't match a newline.
4099
4100 A non-matching list ([^...]) not containing a newline matches a
4101 newline.
4102
4103 Match-beginning-of-line operator (^) matches the empty string
4104 immediately after a newline, regardless of whether the FLAGS
4105 passed to regexp-exec contain regexp/notbol.
4106
4107 Match-end-of-line operator ($) matches the empty string
4108 immediately before a newline, regardless of whether the FLAGS
4109 passed to regexp-exec contain regexp/noteol.
4110
4111**** Function: regexp-exec REGEXP STR [START [FLAGS]]
4112 Match the compiled regular expression REGEXP against `str'. If
4113 the optional integer START argument is provided, begin matching
4114 from that position in the string. Return a match structure
4115 describing the results of the match, or `#f' if no match could be
4116 found.
4117
4118 FLAGS may be the bitwise-or of one or more of the following:
4119
4120**** Constant: regexp/notbol
4121 The match-beginning-of-line operator always fails to match (but
4122 see the compilation flag regexp/newline above) This flag may be
4123 used when different portions of a string are passed to
4124 regexp-exec and the beginning of the string should not be
4125 interpreted as the beginning of the line.
4126
4127**** Constant: regexp/noteol
4128 The match-end-of-line operator always fails to match (but see the
4129 compilation flag regexp/newline above)
4130
4131**** Function: regexp? OBJ
4132 Return `#t' if OBJ is a compiled regular expression, or `#f'
4133 otherwise.
4134
4135 Regular expressions are commonly used to find patterns in one string
4136and replace them with the contents of another string.
4137
4138**** Function: regexp-substitute PORT MATCH [ITEM...]
4139 Write to the output port PORT selected contents of the match
4140 structure MATCH. Each ITEM specifies what should be written, and
4141 may be one of the following arguments:
4142
4143 * A string. String arguments are written out verbatim.
4144
4145 * An integer. The submatch with that number is written.
4146
4147 * The symbol `pre'. The portion of the matched string preceding
4148 the regexp match is written.
4149
4150 * The symbol `post'. The portion of the matched string
4151 following the regexp match is written.
4152
4153 PORT may be `#f', in which case nothing is written; instead,
4154 `regexp-substitute' constructs a string from the specified ITEMs
4155 and returns that.
4156
4157**** Function: regexp-substitute/global PORT REGEXP TARGET [ITEM...]
4158 Similar to `regexp-substitute', but can be used to perform global
4159 substitutions on STR. Instead of taking a match structure as an
4160 argument, `regexp-substitute/global' takes two string arguments: a
4161 REGEXP string describing a regular expression, and a TARGET string
4162 which should be matched against this regular expression.
4163
4164 Each ITEM behaves as in REGEXP-SUBSTITUTE, with the following
4165 exceptions:
4166
4167 * A function may be supplied. When this function is called, it
4168 will be passed one argument: a match structure for a given
4169 regular expression match. It should return a string to be
4170 written out to PORT.
4171
4172 * The `post' symbol causes `regexp-substitute/global' to recurse
4173 on the unmatched portion of STR. This *must* be supplied in
4174 order to perform global search-and-replace on STR; if it is
4175 not present among the ITEMs, then `regexp-substitute/global'
4176 will return after processing a single match.
4177
4178*** Match Structures
4179
4180 A "match structure" is the object returned by `string-match' and
4181`regexp-exec'. It describes which portion of a string, if any, matched
4182the given regular expression. Match structures include: a reference to
4183the string that was checked for matches; the starting and ending
4184positions of the regexp match; and, if the regexp included any
4185parenthesized subexpressions, the starting and ending positions of each
4186submatch.
4187
4188 In each of the regexp match functions described below, the `match'
4189argument must be a match structure returned by a previous call to
4190`string-match' or `regexp-exec'. Most of these functions return some
4191information about the original target string that was matched against a
4192regular expression; we will call that string TARGET for easy reference.
4193
4194**** Function: regexp-match? OBJ
4195 Return `#t' if OBJ is a match structure returned by a previous
4196 call to `regexp-exec', or `#f' otherwise.
4197
4198**** Function: match:substring MATCH [N]
4199 Return the portion of TARGET matched by subexpression number N.
4200 Submatch 0 (the default) represents the entire regexp match. If
4201 the regular expression as a whole matched, but the subexpression
4202 number N did not match, return `#f'.
4203
4204**** Function: match:start MATCH [N]
4205 Return the starting position of submatch number N.
4206
4207**** Function: match:end MATCH [N]
4208 Return the ending position of submatch number N.
4209
4210**** Function: match:prefix MATCH
4211 Return the unmatched portion of TARGET preceding the regexp match.
4212
4213**** Function: match:suffix MATCH
4214 Return the unmatched portion of TARGET following the regexp match.
4215
4216**** Function: match:count MATCH
4217 Return the number of parenthesized subexpressions from MATCH.
4218 Note that the entire regular expression match itself counts as a
4219 subexpression, and failed submatches are included in the count.
4220
4221**** Function: match:string MATCH
4222 Return the original TARGET string.
4223
4224*** Backslash Escapes
4225
4226 Sometimes you will want a regexp to match characters like `*' or `$'
4227exactly. For example, to check whether a particular string represents
4228a menu entry from an Info node, it would be useful to match it against
4229a regexp like `^* [^:]*::'. However, this won't work; because the
4230asterisk is a metacharacter, it won't match the `*' at the beginning of
4231the string. In this case, we want to make the first asterisk un-magic.
4232
4233 You can do this by preceding the metacharacter with a backslash
4234character `\'. (This is also called "quoting" the metacharacter, and
4235is known as a "backslash escape".) When Guile sees a backslash in a
4236regular expression, it considers the following glyph to be an ordinary
4237character, no matter what special meaning it would ordinarily have.
4238Therefore, we can make the above example work by changing the regexp to
4239`^\* [^:]*::'. The `\*' sequence tells the regular expression engine
4240to match only a single asterisk in the target string.
4241
4242 Since the backslash is itself a metacharacter, you may force a
4243regexp to match a backslash in the target string by preceding the
4244backslash with itself. For example, to find variable references in a
4245TeX program, you might want to find occurrences of the string `\let\'
4246followed by any number of alphabetic characters. The regular expression
4247`\\let\\[A-Za-z]*' would do this: the double backslashes in the regexp
4248each match a single backslash in the target string.
4249
4250**** Function: regexp-quote STR
4251 Quote each special character found in STR with a backslash, and
4252 return the resulting string.
4253
4254 *Very important:* Using backslash escapes in Guile source code (as
4255in Emacs Lisp or C) can be tricky, because the backslash character has
4256special meaning for the Guile reader. For example, if Guile encounters
4257the character sequence `\n' in the middle of a string while processing
4258Scheme code, it replaces those characters with a newline character.
4259Similarly, the character sequence `\t' is replaced by a horizontal tab.
4260Several of these "escape sequences" are processed by the Guile reader
4261before your code is executed. Unrecognized escape sequences are
4262ignored: if the characters `\*' appear in a string, they will be
4263translated to the single character `*'.
4264
4265 This translation is obviously undesirable for regular expressions,
4266since we want to be able to include backslashes in a string in order to
4267escape regexp metacharacters. Therefore, to make sure that a backslash
4268is preserved in a string in your Guile program, you must use *two*
4269consecutive backslashes:
4270
4271 (define Info-menu-entry-pattern (make-regexp "^\\* [^:]*"))
4272
4273 The string in this example is preprocessed by the Guile reader before
4274any code is executed. The resulting argument to `make-regexp' is the
4275string `^\* [^:]*', which is what we really want.
4276
4277 This also means that in order to write a regular expression that
4278matches a single backslash character, the regular expression string in
4279the source code must include *four* backslashes. Each consecutive pair
4280of backslashes gets translated by the Guile reader to a single
4281backslash, and the resulting double-backslash is interpreted by the
4282regexp engine as matching a single backslash character. Hence:
4283
4284 (define tex-variable-pattern (make-regexp "\\\\let\\\\=[A-Za-z]*"))
4285
4286 The reason for the unwieldiness of this syntax is historical. Both
4287regular expression pattern matchers and Unix string processing systems
4288have traditionally used backslashes with the special meanings described
4289above. The POSIX regular expression specification and ANSI C standard
4290both require these semantics. Attempting to abandon either convention
4291would cause other kinds of compatibility problems, possibly more severe
4292ones. Therefore, without extending the Scheme reader to support
4293strings with different quoting conventions (an ungainly and confusing
4294extension when implemented in other languages), we must adhere to this
4295cumbersome escape syntax.
4296
7ad3c1e7
GH
4297* Changes to the gh_ interface
4298
4299* Changes to the scm_ interface
4300
4301* Changes to system call interfaces:
94982a4e 4302
7ad3c1e7 4303** The value returned by `raise' is now unspecified. It throws an exception
e1a191a8
GH
4304if an error occurs.
4305
94982a4e 4306*** A new procedure `sigaction' can be used to install signal handlers
115b09a5
GH
4307
4308(sigaction signum [action] [flags])
4309
4310signum is the signal number, which can be specified using the value
4311of SIGINT etc.
4312
4313If action is omitted, sigaction returns a pair: the CAR is the current
4314signal hander, which will be either an integer with the value SIG_DFL
4315(default action) or SIG_IGN (ignore), or the Scheme procedure which
4316handles the signal, or #f if a non-Scheme procedure handles the
4317signal. The CDR contains the current sigaction flags for the handler.
4318
4319If action is provided, it is installed as the new handler for signum.
4320action can be a Scheme procedure taking one argument, or the value of
4321SIG_DFL (default action) or SIG_IGN (ignore), or #f to restore
4322whatever signal handler was installed before sigaction was first used.
4323Flags can optionally be specified for the new handler (SA_RESTART is
4324always used if the system provides it, so need not be specified.) The
4325return value is a pair with information about the old handler as
4326described above.
4327
4328This interface does not provide access to the "signal blocking"
4329facility. Maybe this is not needed, since the thread support may
4330provide solutions to the problem of consistent access to data
4331structures.
e1a191a8 4332
94982a4e 4333*** A new procedure `flush-all-ports' is equivalent to running
89ea5b7c
GH
4334`force-output' on every port open for output.
4335
94982a4e
JB
4336** Guile now provides information on how it was built, via the new
4337global variable, %guile-build-info. This variable records the values
4338of the standard GNU makefile directory variables as an assocation
4339list, mapping variable names (symbols) onto directory paths (strings).
4340For example, to find out where the Guile link libraries were
4341installed, you can say:
4342
4343guile -c "(display (assq-ref %guile-build-info 'libdir)) (newline)"
4344
4345
4346* Changes to the scm_ interface
4347
4348** The new function scm_handle_by_message_noexit is just like the
4349existing scm_handle_by_message function, except that it doesn't call
4350exit to terminate the process. Instead, it prints a message and just
4351returns #f. This might be a more appropriate catch-all handler for
4352new dynamic roots and threads.
4353
cf78e9e8 4354\f
c484bf7f 4355Changes in Guile 1.1 (released Friday, May 16 1997):
f3b1485f
JB
4356
4357* Changes to the distribution.
4358
4359The Guile 1.0 distribution has been split up into several smaller
4360pieces:
4361guile-core --- the Guile interpreter itself.
4362guile-tcltk --- the interface between the Guile interpreter and
4363 Tcl/Tk; Tcl is an interpreter for a stringy language, and Tk
4364 is a toolkit for building graphical user interfaces.
4365guile-rgx-ctax --- the interface between Guile and the Rx regular
4366 expression matcher, and the translator for the Ctax
4367 programming language. These are packaged together because the
4368 Ctax translator uses Rx to parse Ctax source code.
4369
095936d2
JB
4370This NEWS file describes the changes made to guile-core since the 1.0
4371release.
4372
48d224d7
JB
4373We no longer distribute the documentation, since it was either out of
4374date, or incomplete. As soon as we have current documentation, we
4375will distribute it.
4376
0fcab5ed
JB
4377
4378
f3b1485f
JB
4379* Changes to the stand-alone interpreter
4380
48d224d7
JB
4381** guile now accepts command-line arguments compatible with SCSH, Olin
4382Shivers' Scheme Shell.
4383
4384In general, arguments are evaluated from left to right, but there are
4385exceptions. The following switches stop argument processing, and
4386stash all remaining command-line arguments as the value returned by
4387the (command-line) function.
4388 -s SCRIPT load Scheme source code from FILE, and exit
4389 -c EXPR evalute Scheme expression EXPR, and exit
4390 -- stop scanning arguments; run interactively
4391
4392The switches below are processed as they are encountered.
4393 -l FILE load Scheme source code from FILE
4394 -e FUNCTION after reading script, apply FUNCTION to
4395 command line arguments
4396 -ds do -s script at this point
4397 --emacs enable Emacs protocol (experimental)
4398 -h, --help display this help and exit
4399 -v, --version display version information and exit
4400 \ read arguments from following script lines
4401
4402So, for example, here is a Guile script named `ekko' (thanks, Olin)
4403which re-implements the traditional "echo" command:
4404
4405#!/usr/local/bin/guile -s
4406!#
4407(define (main args)
4408 (map (lambda (arg) (display arg) (display " "))
4409 (cdr args))
4410 (newline))
4411
4412(main (command-line))
4413
4414Suppose we invoke this script as follows:
4415
4416 ekko a speckled gecko
4417
4418Through the magic of Unix script processing (triggered by the `#!'
4419token at the top of the file), /usr/local/bin/guile receives the
4420following list of command-line arguments:
4421
4422 ("-s" "./ekko" "a" "speckled" "gecko")
4423
4424Unix inserts the name of the script after the argument specified on
4425the first line of the file (in this case, "-s"), and then follows that
4426with the arguments given to the script. Guile loads the script, which
4427defines the `main' function, and then applies it to the list of
4428remaining command-line arguments, ("a" "speckled" "gecko").
4429
095936d2
JB
4430In Unix, the first line of a script file must take the following form:
4431
4432#!INTERPRETER ARGUMENT
4433
4434where INTERPRETER is the absolute filename of the interpreter
4435executable, and ARGUMENT is a single command-line argument to pass to
4436the interpreter.
4437
4438You may only pass one argument to the interpreter, and its length is
4439limited. These restrictions can be annoying to work around, so Guile
4440provides a general mechanism (borrowed from, and compatible with,
4441SCSH) for circumventing them.
4442
4443If the ARGUMENT in a Guile script is a single backslash character,
4444`\', Guile will open the script file, parse arguments from its second
4445and subsequent lines, and replace the `\' with them. So, for example,
4446here is another implementation of the `ekko' script:
4447
4448#!/usr/local/bin/guile \
4449-e main -s
4450!#
4451(define (main args)
4452 (for-each (lambda (arg) (display arg) (display " "))
4453 (cdr args))
4454 (newline))
4455
4456If the user invokes this script as follows:
4457
4458 ekko a speckled gecko
4459
4460Unix expands this into
4461
4462 /usr/local/bin/guile \ ekko a speckled gecko
4463
4464When Guile sees the `\' argument, it replaces it with the arguments
4465read from the second line of the script, producing:
4466
4467 /usr/local/bin/guile -e main -s ekko a speckled gecko
4468
4469This tells Guile to load the `ekko' script, and apply the function
4470`main' to the argument list ("a" "speckled" "gecko").
4471
4472Here is how Guile parses the command-line arguments:
4473- Each space character terminates an argument. This means that two
4474 spaces in a row introduce an empty-string argument.
4475- The tab character is not permitted (unless you quote it with the
4476 backslash character, as described below), to avoid confusion.
4477- The newline character terminates the sequence of arguments, and will
4478 also terminate a final non-empty argument. (However, a newline
4479 following a space will not introduce a final empty-string argument;
4480 it only terminates the argument list.)
4481- The backslash character is the escape character. It escapes
4482 backslash, space, tab, and newline. The ANSI C escape sequences
4483 like \n and \t are also supported. These produce argument
4484 constituents; the two-character combination \n doesn't act like a
4485 terminating newline. The escape sequence \NNN for exactly three
4486 octal digits reads as the character whose ASCII code is NNN. As
4487 above, characters produced this way are argument constituents.
4488 Backslash followed by other characters is not allowed.
4489
48d224d7
JB
4490* Changes to the procedure for linking libguile with your programs
4491
4492** Guile now builds and installs a shared guile library, if your
4493system support shared libraries. (It still builds a static library on
4494all systems.) Guile automatically detects whether your system
4495supports shared libraries. To prevent Guile from buildisg shared
4496libraries, pass the `--disable-shared' flag to the configure script.
4497
4498Guile takes longer to compile when it builds shared libraries, because
4499it must compile every file twice --- once to produce position-
4500independent object code, and once to produce normal object code.
4501
4502** The libthreads library has been merged into libguile.
4503
4504To link a program against Guile, you now need only link against
4505-lguile and -lqt; -lthreads is no longer needed. If you are using
4506autoconf to generate configuration scripts for your application, the
4507following lines should suffice to add the appropriate libraries to
4508your link command:
4509
4510### Find quickthreads and libguile.
4511AC_CHECK_LIB(qt, main)
4512AC_CHECK_LIB(guile, scm_shell)
f3b1485f
JB
4513
4514* Changes to Scheme functions
4515
095936d2
JB
4516** Guile Scheme's special syntax for keyword objects is now optional,
4517and disabled by default.
4518
4519The syntax variation from R4RS made it difficult to port some
4520interesting packages to Guile. The routines which accepted keyword
4521arguments (mostly in the module system) have been modified to also
4522accept symbols whose names begin with `:'.
4523
4524To change the keyword syntax, you must first import the (ice-9 debug)
4525module:
4526 (use-modules (ice-9 debug))
4527
4528Then you can enable the keyword syntax as follows:
4529 (read-set! keywords 'prefix)
4530
4531To disable keyword syntax, do this:
4532 (read-set! keywords #f)
4533
4534** Many more primitive functions accept shared substrings as
4535arguments. In the past, these functions required normal, mutable
4536strings as arguments, although they never made use of this
4537restriction.
4538
4539** The uniform array functions now operate on byte vectors. These
4540functions are `array-fill!', `serial-array-copy!', `array-copy!',
4541`serial-array-map', `array-map', `array-for-each', and
4542`array-index-map!'.
4543
4544** The new functions `trace' and `untrace' implement simple debugging
4545support for Scheme functions.
4546
4547The `trace' function accepts any number of procedures as arguments,
4548and tells the Guile interpreter to display each procedure's name and
4549arguments each time the procedure is invoked. When invoked with no
4550arguments, `trace' returns the list of procedures currently being
4551traced.
4552
4553The `untrace' function accepts any number of procedures as arguments,
4554and tells the Guile interpreter not to trace them any more. When
4555invoked with no arguments, `untrace' untraces all curretly traced
4556procedures.
4557
4558The tracing in Guile has an advantage over most other systems: we
4559don't create new procedure objects, but mark the procedure objects
4560themselves. This means that anonymous and internal procedures can be
4561traced.
4562
4563** The function `assert-repl-prompt' has been renamed to
4564`set-repl-prompt!'. It takes one argument, PROMPT.
4565- If PROMPT is #f, the Guile read-eval-print loop will not prompt.
4566- If PROMPT is a string, we use it as a prompt.
4567- If PROMPT is a procedure accepting no arguments, we call it, and
4568 display the result as a prompt.
4569- Otherwise, we display "> ".
4570
4571** The new function `eval-string' reads Scheme expressions from a
4572string and evaluates them, returning the value of the last expression
4573in the string. If the string contains no expressions, it returns an
4574unspecified value.
4575
4576** The new function `thunk?' returns true iff its argument is a
4577procedure of zero arguments.
4578
4579** `defined?' is now a builtin function, instead of syntax. This
4580means that its argument should be quoted. It returns #t iff its
4581argument is bound in the current module.
4582
4583** The new syntax `use-modules' allows you to add new modules to your
4584environment without re-typing a complete `define-module' form. It
4585accepts any number of module names as arguments, and imports their
4586public bindings into the current module.
4587
4588** The new function (module-defined? NAME MODULE) returns true iff
4589NAME, a symbol, is defined in MODULE, a module object.
4590
4591** The new function `builtin-bindings' creates and returns a hash
4592table containing copies of all the root module's bindings.
4593
4594** The new function `builtin-weak-bindings' does the same as
4595`builtin-bindings', but creates a doubly-weak hash table.
4596
4597** The `equal?' function now considers variable objects to be
4598equivalent if they have the same name and the same value.
4599
4600** The new function `command-line' returns the command-line arguments
4601given to Guile, as a list of strings.
4602
4603When using guile as a script interpreter, `command-line' returns the
4604script's arguments; those processed by the interpreter (like `-s' or
4605`-c') are omitted. (In other words, you get the normal, expected
4606behavior.) Any application that uses scm_shell to process its
4607command-line arguments gets this behavior as well.
4608
4609** The new function `load-user-init' looks for a file called `.guile'
4610in the user's home directory, and loads it if it exists. This is
4611mostly for use by the code generated by scm_compile_shell_switches,
4612but we thought it might also be useful in other circumstances.
4613
4614** The new function `log10' returns the base-10 logarithm of its
4615argument.
4616
4617** Changes to I/O functions
4618
4619*** The functions `read', `primitive-load', `read-and-eval!', and
4620`primitive-load-path' no longer take optional arguments controlling
4621case insensitivity and a `#' parser.
4622
4623Case sensitivity is now controlled by a read option called
4624`case-insensitive'. The user can add new `#' syntaxes with the
4625`read-hash-extend' function (see below).
4626
4627*** The new function `read-hash-extend' allows the user to change the
4628syntax of Guile Scheme in a somewhat controlled way.
4629
4630(read-hash-extend CHAR PROC)
4631 When parsing S-expressions, if we read a `#' character followed by
4632 the character CHAR, use PROC to parse an object from the stream.
4633 If PROC is #f, remove any parsing procedure registered for CHAR.
4634
4635 The reader applies PROC to two arguments: CHAR and an input port.
4636
4637*** The new functions read-delimited and read-delimited! provide a
4638general mechanism for doing delimited input on streams.
4639
4640(read-delimited DELIMS [PORT HANDLE-DELIM])
4641 Read until we encounter one of the characters in DELIMS (a string),
4642 or end-of-file. PORT is the input port to read from; it defaults to
4643 the current input port. The HANDLE-DELIM parameter determines how
4644 the terminating character is handled; it should be one of the
4645 following symbols:
4646
4647 'trim omit delimiter from result
4648 'peek leave delimiter character in input stream
4649 'concat append delimiter character to returned value
4650 'split return a pair: (RESULT . TERMINATOR)
4651
4652 HANDLE-DELIM defaults to 'peek.
4653
4654(read-delimited! DELIMS BUF [PORT HANDLE-DELIM START END])
4655 A side-effecting variant of `read-delimited'.
4656
4657 The data is written into the string BUF at the indices in the
4658 half-open interval [START, END); the default interval is the whole
4659 string: START = 0 and END = (string-length BUF). The values of
4660 START and END must specify a well-defined interval in BUF, i.e.
4661 0 <= START <= END <= (string-length BUF).
4662
4663 It returns NBYTES, the number of bytes read. If the buffer filled
4664 up without a delimiter character being found, it returns #f. If the
4665 port is at EOF when the read starts, it returns the EOF object.
4666
4667 If an integer is returned (i.e., the read is successfully terminated
4668 by reading a delimiter character), then the HANDLE-DELIM parameter
4669 determines how to handle the terminating character. It is described
4670 above, and defaults to 'peek.
4671
4672(The descriptions of these functions were borrowed from the SCSH
4673manual, by Olin Shivers and Brian Carlstrom.)
4674
4675*** The `%read-delimited!' function is the primitive used to implement
4676`read-delimited' and `read-delimited!'.
4677
4678(%read-delimited! DELIMS BUF GOBBLE? [PORT START END])
4679
4680This returns a pair of values: (TERMINATOR . NUM-READ).
4681- TERMINATOR describes why the read was terminated. If it is a
4682 character or the eof object, then that is the value that terminated
4683 the read. If it is #f, the function filled the buffer without finding
4684 a delimiting character.
4685- NUM-READ is the number of characters read into BUF.
4686
4687If the read is successfully terminated by reading a delimiter
4688character, then the gobble? parameter determines what to do with the
4689terminating character. If true, the character is removed from the
4690input stream; if false, the character is left in the input stream
4691where a subsequent read operation will retrieve it. In either case,
4692the character is also the first value returned by the procedure call.
4693
4694(The descriptions of this function was borrowed from the SCSH manual,
4695by Olin Shivers and Brian Carlstrom.)
4696
4697*** The `read-line' and `read-line!' functions have changed; they now
4698trim the terminator by default; previously they appended it to the
4699returned string. For the old behavior, use (read-line PORT 'concat).
4700
4701*** The functions `uniform-array-read!' and `uniform-array-write!' now
4702take new optional START and END arguments, specifying the region of
4703the array to read and write.
4704
f348c807
JB
4705*** The `ungetc-char-ready?' function has been removed. We feel it's
4706inappropriate for an interface to expose implementation details this
4707way.
095936d2
JB
4708
4709** Changes to the Unix library and system call interface
4710
4711*** The new fcntl function provides access to the Unix `fcntl' system
4712call.
4713
4714(fcntl PORT COMMAND VALUE)
4715 Apply COMMAND to PORT's file descriptor, with VALUE as an argument.
4716 Values for COMMAND are:
4717
4718 F_DUPFD duplicate a file descriptor
4719 F_GETFD read the descriptor's close-on-exec flag
4720 F_SETFD set the descriptor's close-on-exec flag to VALUE
4721 F_GETFL read the descriptor's flags, as set on open
4722 F_SETFL set the descriptor's flags, as set on open to VALUE
4723 F_GETOWN return the process ID of a socket's owner, for SIGIO
4724 F_SETOWN set the process that owns a socket to VALUE, for SIGIO
4725 FD_CLOEXEC not sure what this is
4726
4727For details, see the documentation for the fcntl system call.
4728
4729*** The arguments to `select' have changed, for compatibility with
4730SCSH. The TIMEOUT parameter may now be non-integral, yielding the
4731expected behavior. The MILLISECONDS parameter has been changed to
4732MICROSECONDS, to more closely resemble the underlying system call.
4733The RVEC, WVEC, and EVEC arguments can now be vectors; the type of the
4734corresponding return set will be the same.
4735
4736*** The arguments to the `mknod' system call have changed. They are
4737now:
4738
4739(mknod PATH TYPE PERMS DEV)
4740 Create a new file (`node') in the file system. PATH is the name of
4741 the file to create. TYPE is the kind of file to create; it should
4742 be 'fifo, 'block-special, or 'char-special. PERMS specifies the
4743 permission bits to give the newly created file. If TYPE is
4744 'block-special or 'char-special, DEV specifies which device the
4745 special file refers to; its interpretation depends on the kind of
4746 special file being created.
4747
4748*** The `fork' function has been renamed to `primitive-fork', to avoid
4749clashing with various SCSH forks.
4750
4751*** The `recv' and `recvfrom' functions have been renamed to `recv!'
4752and `recvfrom!'. They no longer accept a size for a second argument;
4753you must pass a string to hold the received value. They no longer
4754return the buffer. Instead, `recv' returns the length of the message
4755received, and `recvfrom' returns a pair containing the packet's length
4756and originating address.
4757
4758*** The file descriptor datatype has been removed, as have the
4759`read-fd', `write-fd', `close', `lseek', and `dup' functions.
4760We plan to replace these functions with a SCSH-compatible interface.
4761
4762*** The `create' function has been removed; it's just a special case
4763of `open'.
4764
4765*** There are new functions to break down process termination status
4766values. In the descriptions below, STATUS is a value returned by
4767`waitpid'.
4768
4769(status:exit-val STATUS)
4770 If the child process exited normally, this function returns the exit
4771 code for the child process (i.e., the value passed to exit, or
4772 returned from main). If the child process did not exit normally,
4773 this function returns #f.
4774
4775(status:stop-sig STATUS)
4776 If the child process was suspended by a signal, this function
4777 returns the signal that suspended the child. Otherwise, it returns
4778 #f.
4779
4780(status:term-sig STATUS)
4781 If the child process terminated abnormally, this function returns
4782 the signal that terminated the child. Otherwise, this function
4783 returns false.
4784
4785POSIX promises that exactly one of these functions will return true on
4786a valid STATUS value.
4787
4788These functions are compatible with SCSH.
4789
4790*** There are new accessors and setters for the broken-out time vectors
48d224d7
JB
4791returned by `localtime', `gmtime', and that ilk. They are:
4792
4793 Component Accessor Setter
4794 ========================= ============ ============
4795 seconds tm:sec set-tm:sec
4796 minutes tm:min set-tm:min
4797 hours tm:hour set-tm:hour
4798 day of the month tm:mday set-tm:mday
4799 month tm:mon set-tm:mon
4800 year tm:year set-tm:year
4801 day of the week tm:wday set-tm:wday
4802 day in the year tm:yday set-tm:yday
4803 daylight saving time tm:isdst set-tm:isdst
4804 GMT offset, seconds tm:gmtoff set-tm:gmtoff
4805 name of time zone tm:zone set-tm:zone
4806
095936d2
JB
4807*** There are new accessors for the vectors returned by `uname',
4808describing the host system:
48d224d7
JB
4809
4810 Component Accessor
4811 ============================================== ================
4812 name of the operating system implementation utsname:sysname
4813 network name of this machine utsname:nodename
4814 release level of the operating system utsname:release
4815 version level of the operating system utsname:version
4816 machine hardware platform utsname:machine
4817
095936d2
JB
4818*** There are new accessors for the vectors returned by `getpw',
4819`getpwnam', `getpwuid', and `getpwent', describing entries from the
4820system's user database:
4821
4822 Component Accessor
4823 ====================== =================
4824 user name passwd:name
4825 user password passwd:passwd
4826 user id passwd:uid
4827 group id passwd:gid
4828 real name passwd:gecos
4829 home directory passwd:dir
4830 shell program passwd:shell
4831
4832*** There are new accessors for the vectors returned by `getgr',
4833`getgrnam', `getgrgid', and `getgrent', describing entries from the
4834system's group database:
4835
4836 Component Accessor
4837 ======================= ============
4838 group name group:name
4839 group password group:passwd
4840 group id group:gid
4841 group members group:mem
4842
4843*** There are new accessors for the vectors returned by `gethost',
4844`gethostbyaddr', `gethostbyname', and `gethostent', describing
4845internet hosts:
4846
4847 Component Accessor
4848 ========================= ===============
4849 official name of host hostent:name
4850 alias list hostent:aliases
4851 host address type hostent:addrtype
4852 length of address hostent:length
4853 list of addresses hostent:addr-list
4854
4855*** There are new accessors for the vectors returned by `getnet',
4856`getnetbyaddr', `getnetbyname', and `getnetent', describing internet
4857networks:
4858
4859 Component Accessor
4860 ========================= ===============
4861 official name of net netent:name
4862 alias list netent:aliases
4863 net number type netent:addrtype
4864 net number netent:net
4865
4866*** There are new accessors for the vectors returned by `getproto',
4867`getprotobyname', `getprotobynumber', and `getprotoent', describing
4868internet protocols:
4869
4870 Component Accessor
4871 ========================= ===============
4872 official protocol name protoent:name
4873 alias list protoent:aliases
4874 protocol number protoent:proto
4875
4876*** There are new accessors for the vectors returned by `getserv',
4877`getservbyname', `getservbyport', and `getservent', describing
4878internet protocols:
4879
4880 Component Accessor
4881 ========================= ===============
4882 official service name servent:name
4883 alias list servent:aliases
4884 port number servent:port
4885 protocol to use servent:proto
4886
4887*** There are new accessors for the sockaddr structures returned by
4888`accept', `getsockname', `getpeername', `recvfrom!':
4889
4890 Component Accessor
4891 ======================================== ===============
4892 address format (`family') sockaddr:fam
4893 path, for file domain addresses sockaddr:path
4894 address, for internet domain addresses sockaddr:addr
4895 TCP or UDP port, for internet sockaddr:port
4896
4897*** The `getpwent', `getgrent', `gethostent', `getnetent',
4898`getprotoent', and `getservent' functions now return #f at the end of
4899the user database. (They used to throw an exception.)
4900
4901Note that calling MUMBLEent function is equivalent to calling the
4902corresponding MUMBLE function with no arguments.
4903
4904*** The `setpwent', `setgrent', `sethostent', `setnetent',
4905`setprotoent', and `setservent' routines now take no arguments.
4906
4907*** The `gethost', `getproto', `getnet', and `getserv' functions now
4908provide more useful information when they throw an exception.
4909
4910*** The `lnaof' function has been renamed to `inet-lnaof'.
4911
4912*** Guile now claims to have the `current-time' feature.
4913
4914*** The `mktime' function now takes an optional second argument ZONE,
4915giving the time zone to use for the conversion. ZONE should be a
4916string, in the same format as expected for the "TZ" environment variable.
4917
4918*** The `strptime' function now returns a pair (TIME . COUNT), where
4919TIME is the parsed time as a vector, and COUNT is the number of
4920characters from the string left unparsed. This function used to
4921return the remaining characters as a string.
4922
4923*** The `gettimeofday' function has replaced the old `time+ticks' function.
4924The return value is now (SECONDS . MICROSECONDS); the fractional
4925component is no longer expressed in "ticks".
4926
4927*** The `ticks/sec' constant has been removed, in light of the above change.
6685dc83 4928
ea00ecba
MG
4929* Changes to the gh_ interface
4930
4931** gh_eval_str() now returns an SCM object which is the result of the
4932evaluation
4933
aaef0d2a
MG
4934** gh_scm2str() now copies the Scheme data to a caller-provided C
4935array
4936
4937** gh_scm2newstr() now makes a C array, copies the Scheme data to it,
4938and returns the array
4939
4940** gh_scm2str0() is gone: there is no need to distinguish
4941null-terminated from non-null-terminated, since gh_scm2newstr() allows
4942the user to interpret the data both ways.
4943
f3b1485f
JB
4944* Changes to the scm_ interface
4945
095936d2
JB
4946** The new function scm_symbol_value0 provides an easy way to get a
4947symbol's value from C code:
4948
4949SCM scm_symbol_value0 (char *NAME)
4950 Return the value of the symbol named by the null-terminated string
4951 NAME in the current module. If the symbol named NAME is unbound in
4952 the current module, return SCM_UNDEFINED.
4953
4954** The new function scm_sysintern0 creates new top-level variables,
4955without assigning them a value.
4956
4957SCM scm_sysintern0 (char *NAME)
4958 Create a new Scheme top-level variable named NAME. NAME is a
4959 null-terminated string. Return the variable's value cell.
4960
4961** The function scm_internal_catch is the guts of catch. It handles
4962all the mechanics of setting up a catch target, invoking the catch
4963body, and perhaps invoking the handler if the body does a throw.
4964
4965The function is designed to be usable from C code, but is general
4966enough to implement all the semantics Guile Scheme expects from throw.
4967
4968TAG is the catch tag. Typically, this is a symbol, but this function
4969doesn't actually care about that.
4970
4971BODY is a pointer to a C function which runs the body of the catch;
4972this is the code you can throw from. We call it like this:
4973 BODY (BODY_DATA, JMPBUF)
4974where:
4975 BODY_DATA is just the BODY_DATA argument we received; we pass it
4976 through to BODY as its first argument. The caller can make
4977 BODY_DATA point to anything useful that BODY might need.
4978 JMPBUF is the Scheme jmpbuf object corresponding to this catch,
4979 which we have just created and initialized.
4980
4981HANDLER is a pointer to a C function to deal with a throw to TAG,
4982should one occur. We call it like this:
4983 HANDLER (HANDLER_DATA, THROWN_TAG, THROW_ARGS)
4984where
4985 HANDLER_DATA is the HANDLER_DATA argument we recevied; it's the
4986 same idea as BODY_DATA above.
4987 THROWN_TAG is the tag that the user threw to; usually this is
4988 TAG, but it could be something else if TAG was #t (i.e., a
4989 catch-all), or the user threw to a jmpbuf.
4990 THROW_ARGS is the list of arguments the user passed to the THROW
4991 function.
4992
4993BODY_DATA is just a pointer we pass through to BODY. HANDLER_DATA
4994is just a pointer we pass through to HANDLER. We don't actually
4995use either of those pointers otherwise ourselves. The idea is
4996that, if our caller wants to communicate something to BODY or
4997HANDLER, it can pass a pointer to it as MUMBLE_DATA, which BODY and
4998HANDLER can then use. Think of it as a way to make BODY and
4999HANDLER closures, not just functions; MUMBLE_DATA points to the
5000enclosed variables.
5001
5002Of course, it's up to the caller to make sure that any data a
5003MUMBLE_DATA needs is protected from GC. A common way to do this is
5004to make MUMBLE_DATA a pointer to data stored in an automatic
5005structure variable; since the collector must scan the stack for
5006references anyway, this assures that any references in MUMBLE_DATA
5007will be found.
5008
5009** The new function scm_internal_lazy_catch is exactly like
5010scm_internal_catch, except:
5011
5012- It does not unwind the stack (this is the major difference).
5013- If handler returns, its value is returned from the throw.
5014- BODY always receives #f as its JMPBUF argument (since there's no
5015 jmpbuf associated with a lazy catch, because we don't unwind the
5016 stack.)
5017
5018** scm_body_thunk is a new body function you can pass to
5019scm_internal_catch if you want the body to be like Scheme's `catch'
5020--- a thunk, or a function of one argument if the tag is #f.
5021
5022BODY_DATA is a pointer to a scm_body_thunk_data structure, which
5023contains the Scheme procedure to invoke as the body, and the tag
5024we're catching. If the tag is #f, then we pass JMPBUF (created by
5025scm_internal_catch) to the body procedure; otherwise, the body gets
5026no arguments.
5027
5028** scm_handle_by_proc is a new handler function you can pass to
5029scm_internal_catch if you want the handler to act like Scheme's catch
5030--- call a procedure with the tag and the throw arguments.
5031
5032If the user does a throw to this catch, this function runs a handler
5033procedure written in Scheme. HANDLER_DATA is a pointer to an SCM
5034variable holding the Scheme procedure object to invoke. It ought to
5035be a pointer to an automatic variable (i.e., one living on the stack),
5036or the procedure object should be otherwise protected from GC.
5037
5038** scm_handle_by_message is a new handler function to use with
5039`scm_internal_catch' if you want Guile to print a message and die.
5040It's useful for dealing with throws to uncaught keys at the top level.
5041
5042HANDLER_DATA, if non-zero, is assumed to be a char * pointing to a
5043message header to print; if zero, we use "guile" instead. That
5044text is followed by a colon, then the message described by ARGS.
5045
5046** The return type of scm_boot_guile is now void; the function does
5047not return a value, and indeed, never returns at all.
5048
f3b1485f
JB
5049** The new function scm_shell makes it easy for user applications to
5050process command-line arguments in a way that is compatible with the
5051stand-alone guile interpreter (which is in turn compatible with SCSH,
5052the Scheme shell).
5053
5054To use the scm_shell function, first initialize any guile modules
5055linked into your application, and then call scm_shell with the values
7ed46dc8 5056of ARGC and ARGV your `main' function received. scm_shell will add
f3b1485f
JB
5057any SCSH-style meta-arguments from the top of the script file to the
5058argument vector, and then process the command-line arguments. This
5059generally means loading a script file or starting up an interactive
5060command interpreter. For details, see "Changes to the stand-alone
5061interpreter" above.
5062
095936d2
JB
5063** The new functions scm_get_meta_args and scm_count_argv help you
5064implement the SCSH-style meta-argument, `\'.
5065
5066char **scm_get_meta_args (int ARGC, char **ARGV)
5067 If the second element of ARGV is a string consisting of a single
5068 backslash character (i.e. "\\" in Scheme notation), open the file
5069 named by the following argument, parse arguments from it, and return
5070 the spliced command line. The returned array is terminated by a
5071 null pointer.
5072
5073 For details of argument parsing, see above, under "guile now accepts
5074 command-line arguments compatible with SCSH..."
5075
5076int scm_count_argv (char **ARGV)
5077 Count the arguments in ARGV, assuming it is terminated by a null
5078 pointer.
5079
5080For an example of how these functions might be used, see the source
5081code for the function scm_shell in libguile/script.c.
5082
5083You will usually want to use scm_shell instead of calling this
5084function yourself.
5085
5086** The new function scm_compile_shell_switches turns an array of
5087command-line arguments into Scheme code to carry out the actions they
5088describe. Given ARGC and ARGV, it returns a Scheme expression to
5089evaluate, and calls scm_set_program_arguments to make any remaining
5090command-line arguments available to the Scheme code. For example,
5091given the following arguments:
5092
5093 -e main -s ekko a speckled gecko
5094
5095scm_set_program_arguments will return the following expression:
5096
5097 (begin (load "ekko") (main (command-line)) (quit))
5098
5099You will usually want to use scm_shell instead of calling this
5100function yourself.
5101
5102** The function scm_shell_usage prints a usage message appropriate for
5103an interpreter that uses scm_compile_shell_switches to handle its
5104command-line arguments.
5105
5106void scm_shell_usage (int FATAL, char *MESSAGE)
5107 Print a usage message to the standard error output. If MESSAGE is
5108 non-zero, write it before the usage message, followed by a newline.
5109 If FATAL is non-zero, exit the process, using FATAL as the
5110 termination status. (If you want to be compatible with Guile,
5111 always use 1 as the exit status when terminating due to command-line
5112 usage problems.)
5113
5114You will usually want to use scm_shell instead of calling this
5115function yourself.
48d224d7
JB
5116
5117** scm_eval_0str now returns SCM_UNSPECIFIED if the string contains no
095936d2
JB
5118expressions. It used to return SCM_EOL. Earth-shattering.
5119
5120** The macros for declaring scheme objects in C code have been
5121rearranged slightly. They are now:
5122
5123SCM_SYMBOL (C_NAME, SCHEME_NAME)
5124 Declare a static SCM variable named C_NAME, and initialize it to
5125 point to the Scheme symbol whose name is SCHEME_NAME. C_NAME should
5126 be a C identifier, and SCHEME_NAME should be a C string.
5127
5128SCM_GLOBAL_SYMBOL (C_NAME, SCHEME_NAME)
5129 Just like SCM_SYMBOL, but make C_NAME globally visible.
5130
5131SCM_VCELL (C_NAME, SCHEME_NAME)
5132 Create a global variable at the Scheme level named SCHEME_NAME.
5133 Declare a static SCM variable named C_NAME, and initialize it to
5134 point to the Scheme variable's value cell.
5135
5136SCM_GLOBAL_VCELL (C_NAME, SCHEME_NAME)
5137 Just like SCM_VCELL, but make C_NAME globally visible.
5138
5139The `guile-snarf' script writes initialization code for these macros
5140to its standard output, given C source code as input.
5141
5142The SCM_GLOBAL macro is gone.
5143
5144** The scm_read_line and scm_read_line_x functions have been replaced
5145by Scheme code based on the %read-delimited! procedure (known to C
5146code as scm_read_delimited_x). See its description above for more
5147information.
48d224d7 5148
095936d2
JB
5149** The function scm_sys_open has been renamed to scm_open. It now
5150returns a port instead of an FD object.
ea00ecba 5151
095936d2
JB
5152* The dynamic linking support has changed. For more information, see
5153libguile/DYNAMIC-LINKING.
ea00ecba 5154
f7b47737
JB
5155\f
5156Guile 1.0b3
3065a62a 5157
f3b1485f
JB
5158User-visible changes from Thursday, September 5, 1996 until Guile 1.0
5159(Sun 5 Jan 1997):
3065a62a 5160
4b521edb 5161* Changes to the 'guile' program:
3065a62a 5162
4b521edb
JB
5163** Guile now loads some new files when it starts up. Guile first
5164searches the load path for init.scm, and loads it if found. Then, if
5165Guile is not being used to execute a script, and the user's home
5166directory contains a file named `.guile', Guile loads that.
c6486f8a 5167
4b521edb 5168** You can now use Guile as a shell script interpreter.
3065a62a
JB
5169
5170To paraphrase the SCSH manual:
5171
5172 When Unix tries to execute an executable file whose first two
5173 characters are the `#!', it treats the file not as machine code to
5174 be directly executed by the native processor, but as source code
5175 to be executed by some interpreter. The interpreter to use is
5176 specified immediately after the #! sequence on the first line of
5177 the source file. The kernel reads in the name of the interpreter,
5178 and executes that instead. It passes the interpreter the source
5179 filename as its first argument, with the original arguments
5180 following. Consult the Unix man page for the `exec' system call
5181 for more information.
5182
1a1945be
JB
5183Now you can use Guile as an interpreter, using a mechanism which is a
5184compatible subset of that provided by SCSH.
5185
3065a62a
JB
5186Guile now recognizes a '-s' command line switch, whose argument is the
5187name of a file of Scheme code to load. It also treats the two
5188characters `#!' as the start of a comment, terminated by `!#'. Thus,
5189to make a file of Scheme code directly executable by Unix, insert the
5190following two lines at the top of the file:
5191
5192#!/usr/local/bin/guile -s
5193!#
5194
5195Guile treats the argument of the `-s' command-line switch as the name
5196of a file of Scheme code to load, and treats the sequence `#!' as the
5197start of a block comment, terminated by `!#'.
5198
5199For example, here's a version of 'echo' written in Scheme:
5200
5201#!/usr/local/bin/guile -s
5202!#
5203(let loop ((args (cdr (program-arguments))))
5204 (if (pair? args)
5205 (begin
5206 (display (car args))
5207 (if (pair? (cdr args))
5208 (display " "))
5209 (loop (cdr args)))))
5210(newline)
5211
5212Why does `#!' start a block comment terminated by `!#', instead of the
5213end of the line? That is the notation SCSH uses, and although we
5214don't yet support the other SCSH features that motivate that choice,
5215we would like to be backward-compatible with any existing Guile
3763761c
JB
5216scripts once we do. Furthermore, if the path to Guile on your system
5217is too long for your kernel, you can start the script with this
5218horrible hack:
5219
5220#!/bin/sh
5221exec /really/long/path/to/guile -s "$0" ${1+"$@"}
5222!#
3065a62a
JB
5223
5224Note that some very old Unix systems don't support the `#!' syntax.
5225
c6486f8a 5226
4b521edb 5227** You can now run Guile without installing it.
6685dc83
JB
5228
5229Previous versions of the interactive Guile interpreter (`guile')
5230couldn't start up unless Guile's Scheme library had been installed;
5231they used the value of the environment variable `SCHEME_LOAD_PATH'
5232later on in the startup process, but not to find the startup code
5233itself. Now Guile uses `SCHEME_LOAD_PATH' in all searches for Scheme
5234code.
5235
5236To run Guile without installing it, build it in the normal way, and
5237then set the environment variable `SCHEME_LOAD_PATH' to a
5238colon-separated list of directories, including the top-level directory
5239of the Guile sources. For example, if you unpacked Guile so that the
5240full filename of this NEWS file is /home/jimb/guile-1.0b3/NEWS, then
5241you might say
5242
5243 export SCHEME_LOAD_PATH=/home/jimb/my-scheme:/home/jimb/guile-1.0b3
5244
c6486f8a 5245
4b521edb
JB
5246** Guile's read-eval-print loop no longer prints #<unspecified>
5247results. If the user wants to see this, she can evaluate the
5248expression (assert-repl-print-unspecified #t), perhaps in her startup
48d224d7 5249file.
6685dc83 5250
4b521edb
JB
5251** Guile no longer shows backtraces by default when an error occurs;
5252however, it does display a message saying how to get one, and how to
5253request that they be displayed by default. After an error, evaluate
5254 (backtrace)
5255to see a backtrace, and
5256 (debug-enable 'backtrace)
5257to see them by default.
6685dc83 5258
6685dc83 5259
d9fb83d9 5260
4b521edb
JB
5261* Changes to Guile Scheme:
5262
5263** Guile now distinguishes between #f and the empty list.
5264
5265This is for compatibility with the IEEE standard, the (possibly)
5266upcoming Revised^5 Report on Scheme, and many extant Scheme
5267implementations.
5268
5269Guile used to have #f and '() denote the same object, to make Scheme's
5270type system more compatible with Emacs Lisp's. However, the change
5271caused too much trouble for Scheme programmers, and we found another
5272way to reconcile Emacs Lisp with Scheme that didn't require this.
5273
5274
5275** Guile's delq, delv, delete functions, and their destructive
c6486f8a
JB
5276counterparts, delq!, delv!, and delete!, now remove all matching
5277elements from the list, not just the first. This matches the behavior
5278of the corresponding Emacs Lisp functions, and (I believe) the Maclisp
5279functions which inspired them.
5280
5281I recognize that this change may break code in subtle ways, but it
5282seems best to make the change before the FSF's first Guile release,
5283rather than after.
5284
5285
4b521edb 5286** The compiled-library-path function has been deleted from libguile.
6685dc83 5287
4b521edb 5288** The facilities for loading Scheme source files have changed.
c6486f8a 5289
4b521edb 5290*** The variable %load-path now tells Guile which directories to search
6685dc83
JB
5291for Scheme code. Its value is a list of strings, each of which names
5292a directory.
5293
4b521edb
JB
5294*** The variable %load-extensions now tells Guile which extensions to
5295try appending to a filename when searching the load path. Its value
5296is a list of strings. Its default value is ("" ".scm").
5297
5298*** (%search-load-path FILENAME) searches the directories listed in the
5299value of the %load-path variable for a Scheme file named FILENAME,
5300with all the extensions listed in %load-extensions. If it finds a
5301match, then it returns its full filename. If FILENAME is absolute, it
5302returns it unchanged. Otherwise, it returns #f.
6685dc83 5303
4b521edb
JB
5304%search-load-path will not return matches that refer to directories.
5305
5306*** (primitive-load FILENAME :optional CASE-INSENSITIVE-P SHARP)
5307uses %seach-load-path to find a file named FILENAME, and loads it if
5308it finds it. If it can't read FILENAME for any reason, it throws an
5309error.
6685dc83
JB
5310
5311The arguments CASE-INSENSITIVE-P and SHARP are interpreted as by the
4b521edb
JB
5312`read' function.
5313
5314*** load uses the same searching semantics as primitive-load.
5315
5316*** The functions %try-load, try-load-with-path, %load, load-with-path,
5317basic-try-load-with-path, basic-load-with-path, try-load-module-with-
5318path, and load-module-with-path have been deleted. The functions
5319above should serve their purposes.
5320
5321*** If the value of the variable %load-hook is a procedure,
5322`primitive-load' applies its value to the name of the file being
5323loaded (without the load path directory name prepended). If its value
5324is #f, it is ignored. Otherwise, an error occurs.
5325
5326This is mostly useful for printing load notification messages.
5327
5328
5329** The function `eval!' is no longer accessible from the scheme level.
5330We can't allow operations which introduce glocs into the scheme level,
5331because Guile's type system can't handle these as data. Use `eval' or
5332`read-and-eval!' (see below) as replacement.
5333
5334** The new function read-and-eval! reads an expression from PORT,
5335evaluates it, and returns the result. This is more efficient than
5336simply calling `read' and `eval', since it is not necessary to make a
5337copy of the expression for the evaluator to munge.
5338
5339Its optional arguments CASE_INSENSITIVE_P and SHARP are interpreted as
5340for the `read' function.
5341
5342
5343** The function `int?' has been removed; its definition was identical
5344to that of `integer?'.
5345
5346** The functions `<?', `<?', `<=?', `=?', `>?', and `>=?'. Code should
5347use the R4RS names for these functions.
5348
5349** The function object-properties no longer returns the hash handle;
5350it simply returns the object's property list.
5351
5352** Many functions have been changed to throw errors, instead of
5353returning #f on failure. The point of providing exception handling in
5354the language is to simplify the logic of user code, but this is less
5355useful if Guile's primitives don't throw exceptions.
5356
5357** The function `fileno' has been renamed from `%fileno'.
5358
5359** The function primitive-mode->fdes returns #t or #f now, not 1 or 0.
5360
5361
5362* Changes to Guile's C interface:
5363
5364** The library's initialization procedure has been simplified.
5365scm_boot_guile now has the prototype:
5366
5367void scm_boot_guile (int ARGC,
5368 char **ARGV,
5369 void (*main_func) (),
5370 void *closure);
5371
5372scm_boot_guile calls MAIN_FUNC, passing it CLOSURE, ARGC, and ARGV.
5373MAIN_FUNC should do all the work of the program (initializing other
5374packages, reading user input, etc.) before returning. When MAIN_FUNC
5375returns, call exit (0); this function never returns. If you want some
5376other exit value, MAIN_FUNC may call exit itself.
5377
5378scm_boot_guile arranges for program-arguments to return the strings
5379given by ARGC and ARGV. If MAIN_FUNC modifies ARGC/ARGV, should call
5380scm_set_program_arguments with the final list, so Scheme code will
5381know which arguments have been processed.
5382
5383scm_boot_guile establishes a catch-all catch handler which prints an
5384error message and exits the process. This means that Guile exits in a
5385coherent way when system errors occur and the user isn't prepared to
5386handle it. If the user doesn't like this behavior, they can establish
5387their own universal catcher in MAIN_FUNC to shadow this one.
5388
5389Why must the caller do all the real work from MAIN_FUNC? The garbage
5390collector assumes that all local variables of type SCM will be above
5391scm_boot_guile's stack frame on the stack. If you try to manipulate
5392SCM values after this function returns, it's the luck of the draw
5393whether the GC will be able to find the objects you allocate. So,
5394scm_boot_guile function exits, rather than returning, to discourage
5395people from making that mistake.
5396
5397The IN, OUT, and ERR arguments were removed; there are other
5398convenient ways to override these when desired.
5399
5400The RESULT argument was deleted; this function should never return.
5401
5402The BOOT_CMD argument was deleted; the MAIN_FUNC argument is more
5403general.
5404
5405
5406** Guile's header files should no longer conflict with your system's
5407header files.
5408
5409In order to compile code which #included <libguile.h>, previous
5410versions of Guile required you to add a directory containing all the
5411Guile header files to your #include path. This was a problem, since
5412Guile's header files have names which conflict with many systems'
5413header files.
5414
5415Now only <libguile.h> need appear in your #include path; you must
5416refer to all Guile's other header files as <libguile/mumble.h>.
5417Guile's installation procedure puts libguile.h in $(includedir), and
5418the rest in $(includedir)/libguile.
5419
5420
5421** Two new C functions, scm_protect_object and scm_unprotect_object,
5422have been added to the Guile library.
5423
5424scm_protect_object (OBJ) protects OBJ from the garbage collector.
5425OBJ will not be freed, even if all other references are dropped,
5426until someone does scm_unprotect_object (OBJ). Both functions
5427return OBJ.
5428
5429Note that calls to scm_protect_object do not nest. You can call
5430scm_protect_object any number of times on a given object, and the
5431next call to scm_unprotect_object will unprotect it completely.
5432
5433Basically, scm_protect_object and scm_unprotect_object just
5434maintain a list of references to things. Since the GC knows about
5435this list, all objects it mentions stay alive. scm_protect_object
5436adds its argument to the list; scm_unprotect_object remove its
5437argument from the list.
5438
5439
5440** scm_eval_0str now returns the value of the last expression
5441evaluated.
5442
5443** The new function scm_read_0str reads an s-expression from a
5444null-terminated string, and returns it.
5445
5446** The new function `scm_stdio_to_port' converts a STDIO file pointer
5447to a Scheme port object.
5448
5449** The new function `scm_set_program_arguments' allows C code to set
e80c8fea 5450the value returned by the Scheme `program-arguments' function.
6685dc83 5451
6685dc83 5452\f
1a1945be
JB
5453Older changes:
5454
5455* Guile no longer includes sophisticated Tcl/Tk support.
5456
5457The old Tcl/Tk support was unsatisfying to us, because it required the
5458user to link against the Tcl library, as well as Tk and Guile. The
5459interface was also un-lispy, in that it preserved Tcl/Tk's practice of
5460referring to widgets by names, rather than exporting widgets to Scheme
5461code as a special datatype.
5462
5463In the Usenix Tk Developer's Workshop held in July 1996, the Tcl/Tk
5464maintainers described some very interesting changes in progress to the
5465Tcl/Tk internals, which would facilitate clean interfaces between lone
5466Tk and other interpreters --- even for garbage-collected languages
5467like Scheme. They expected the new Tk to be publicly available in the
5468fall of 1996.
5469
5470Since it seems that Guile might soon have a new, cleaner interface to
5471lone Tk, and that the old Guile/Tk glue code would probably need to be
5472completely rewritten, we (Jim Blandy and Richard Stallman) have
5473decided not to support the old code. We'll spend the time instead on
5474a good interface to the newer Tk, as soon as it is available.
5c54da76 5475
8512dea6 5476Until then, gtcltk-lib provides trivial, low-maintenance functionality.
deb95d71 5477
5c54da76
JB
5478\f
5479Copyright information:
5480
ea00ecba 5481Copyright (C) 1996,1997 Free Software Foundation, Inc.
5c54da76
JB
5482
5483 Permission is granted to anyone to make or distribute verbatim copies
5484 of this document as received, in any medium, provided that the
5485 copyright notice and this permission notice are preserved,
5486 thus giving the recipient permission to redistribute in turn.
5487
5488 Permission is granted to distribute modified versions
5489 of this document, or of portions of it,
5490 under the above conditions, provided also that they
5491 carry prominent notices stating who last changed them.
5492
48d224d7
JB
5493\f
5494Local variables:
5495mode: outline
5496paragraph-separate: "[ \f]*$"
5497end:
5498