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