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