* expect.scm: (expect-regexec): new procedure, use it in
[bpt/guile.git] / NEWS
CommitLineData
f7b47737
JB
1Guile NEWS --- history of user-visible changes. -*- text -*-
2Copyright (C) 1996, 1997 Free Software Foundation, Inc.
5c54da76
JB
3See the end for copying conditions.
4
16f2ebea 5Please send Guile bug reports to bug-guile@prep.ai.mit.edu.
5c54da76 6\f
c484bf7f
JB
7Changes since Guile 1.2:
8
9* Changes to the distribution
10
3a97e020
MD
11** libguile/append.h, libguile/append.c, libguile/sequences.h,
12libguile/sequences.c removed.
13
c484bf7f
JB
14* Changes to the stand-alone interpreter
15
16* Changes to the procedure for linking libguile with your programs
17
18* Changes to Scheme functions and syntax
7ad3c1e7 19
8d9dcb3c
MV
20** Some magic has been added to the printer to better handle user
21written printing routines (like record printers, closure printers).
22
23The problem is that these user written routines must have access to
24the current `prine-state' to be able to handle fancy things like
25detection of circular references. These print-states have to be
26passed to the builtin printing routines (display, write, etc) to
27properly continue the print chain.
28
29We didn't want to change all existing print code so that it
30explicitely passes thru a print state in addition to a port. Instead,
31we extented the possible values that the builtin printing routines
32accept as a `port'. In addition to a normal port, they now also take
33a pair of a normal port and a print-state. Printing will go to the
34port and the print-state will be used to control the detection of
35circular references, etc. If the builtin function does not care for a
36print-state, it is simply ignored.
37
38User written callbacks are now called with such a pair as their
39`port', but because every function now accepts this pair as a PORT
40argument, you don't have to worry about that. In fact, it is probably
41safest to not check for these pairs.
42
43However, it is sometimes necessary to continue a print chain on a
44different port, for example to get a intermediate string
45representation of the printed value, mangle that string somehow, and
46then to finally print the mangled string. Use the new function
47
48 inherit-print-state OLD-PORT NEW-PORT
49
50for this. It constructs a new `port' that prints to NEW-PORT but
51inherits the print-state of OLD-PORT.
52
ef1ea498
MD
53** struct-vtable-offset renamed to vtable-offset-user
54
55** New constants: vtable-index-layout, vtable-index-vtable, vtable-index-printer
56
57** There is now a fourth (optional) argument to make-vtable-vtable and
58 make-struct when constructing new types (vtables). This argument
59 initializes field vtable-index-printer of the vtable.
60
4851dc57
MV
61** The detection of circular references has been extended to structs.
62That is, a structure that -- in the process of being printed -- prints
63itself does not lead to infinite recursion.
64
65** There is now some basic support for fluids. Please read
66"libguile/fluid.h" to find out more. It is accessible from Scheme with
67the following functions and macros:
68
9c3fb66f
MV
69Function: make-fluid
70
71 Create a new fluid object. Fluids are not special variables or
72 some other extension to the semantics of Scheme, but rather
73 ordinary Scheme objects. You can store them into variables (that
74 are still lexically scoped, of course) or into any other place you
75 like. Every fluid has a initial value of `#f'.
04c76b58 76
9c3fb66f 77Function: fluid? OBJ
04c76b58 78
9c3fb66f 79 Test whether OBJ is a fluid.
04c76b58 80
9c3fb66f
MV
81Function: fluid-ref FLUID
82Function: fluid-set! FLUID VAL
04c76b58
MV
83
84 Access/modify the fluid FLUID. Modifications are only visible
85 within the current dynamic root (that includes threads).
86
9c3fb66f
MV
87Function: with-fluids* FLUIDS VALUES THUNK
88
89 FLUIDS is a list of fluids and VALUES a corresponding list of
90 values for these fluids. Before THUNK gets called the values are
91 installed in the fluids and the old values of the fluids are
92 saved in the VALUES list. When the flow of control leaves THUNK
93 or reenters it, the values get swapped again. You might think of
94 this as a `safe-fluid-excursion'. Note that the VALUES list is
95 modified by `with-fluids*'.
96
97Macro: with-fluids ((FLUID VALUE) ...) FORM ...
98
99 The same as `with-fluids*' but with a different syntax. It looks
100 just like `let', but both FLUID and VALUE are evaluated. Remember,
101 fluids are not special variables but ordinary objects. FLUID
102 should evaluate to a fluid.
04c76b58 103
3a97e020
MD
104** Removed procedures:
105
106list-length, list-append, list-append!, list-reverse, list-reverse!
107
298aa6e3
MD
108** array-map renamed to array-map!
109
110** serial-array-map renamed to serial-array-map!
111
64d01d13
GH
112* Changes to system call interfaces:
113
114** close-port, close-input-port and close-output-port now return a
115boolean instead of an `unspecified' object. #t means that the port
116was successfully closed, while #f means it was already closed. It is
117also now possible for these procedures to raise an exception if an
118error occurs (some errors from write can be delayed until close.)
119
6afcd3b2
GH
120** the first argument to chmod, fcntl, ftell and fseek can now be a
121file descriptor.
122
123** the third argument to fcntl is now optional.
124
125** the first argument to chown can now be a file descriptor or a port.
126
127** the argument to stat can now be a port.
128
64d01d13
GH
129** The following new procedures have been added (most use scsh
130interfaces):
131
132** close PORT/FD
133Similar to close-port, but also works on file descriptors. A side
134effect of closing a file descriptor is that any ports using that file
135descriptor are moved to a different file descriptor and have
136their revealed counts set to zero.
137
138The next five procedures perform a dup2 system call, if NEWFD (an
139integer) is supplied, otherwise a dup. The file descriptor to be
140duplicated can be supplied as an integer or wrapped in a port. The
141type of value returned varies depending on which procedure is used.
142
143All procedures also have the side effect when performing dup2 that any
144ports using NEWFD are moved to a different file descriptor and have
145their revealed counts set to zero.
146
147** dup->fdes PORT/FD [NEWFD]
148Returns an integer file descriptor.
149
150** dup->inport PORT/FD [NEWFD]
151Returns a new input port using the new file descriptor.
152
153** dup->outport PORT/FD [NEWFD]
154Returns a new output port using the new file descriptor.
155
156** dup PORT/FD [NEWFD]
157Returns a new port if PORT/FD is a port, with the same mode as the
158supplied port, otherwise returns an integer file descriptor.
159
160** dup->port PORT/FD MODE [NEWFD]
161Returns a new port using the new file descriptor. MODE supplies a
162mode string for the port (as for `open-file').
163
64d01d13
GH
164** port->fdes PORT
165Returns the integer file descriptor underlying PORT. As a
166side effect the revealed count of PORT is incremented.
167
168** fdes->inport FDES
169Returns an existing input port which has FDES as its underlying file
170descriptor, if one exists, and increments its revealed count.
171Otherwise, returns a new input port with a revealed count of 1.
172
173** fdes->outport FDES
174Returns an existing output port which has FDES as its underlying file
175descriptor, if one exists, and increments its revealed count.
176Otherwise, returns a new output port with a revealed count of 1.
177
7a6f1ffa 178** setenv NAME VALUE
956055a9
GH
179If VALUE is `#f', removes NAME from the environment. Otherwise
180adds the string NAME=VALUE to the environment, replacing any previous
181value for NAME.
182
6afcd3b2
GH
183** truncate-file OBJ SIZE
184 Truncates the file referred to by OBJ to at most SIZE bytes. OBJ
185 can be a string containing a file name or an integer file
186 descriptor or port open for output on the file. The underlying
187 system calls are `truncate' and `ftruncate'.
188
189 The return value is unspecified.
190
7a6f1ffa
GH
191** setvbuf PORT MODE [SIZE]
192 Set the buffering mode for PORT. MODE can be:
193 `_IONBF'
194 non-buffered
195
196 `_IOLBF'
197 line buffered
198
199 `_IOFBF'
200 block buffered, using a newly allocated buffer of SIZE bytes.
201 However if SIZE is zero or unspecified, the port will be made
202 non-buffered.
203
204 This procedure should not be used after I/O has been performed with
205 the port.
206
207 Ports are usually block buffered by default, with a default buffer
208 size. Procedures e.g., *Note open-file: File Ports, which accept a
209 mode string allow `0' to be added to request an unbuffered port.
210
6afcd3b2
GH
211** fsync PORT/FD
212 Copies any unwritten data for the specified output file descriptor
213 to disk. If PORT/FD is a port, its buffer is flushed before the
214 underlying file descriptor is fsync'd. The return value is
215 unspecified.
216
217** open-fdes PATH FLAGS [MODES]
218 Similar to `open' but returns a file descriptor instead of a port.
219
220** procedure: execle PATH ENV [ARG] ...
221 Similar to `execl', but the environment of the new process is
222 specified by ENV, which must be a list of strings as returned by
223 the `environ' procedure.
224
225 This procedure is currently implemented using the `execve' system
226 call, but we call it `execle' because of its Scheme calling
227 interface.
228
229** procedure: primitive-exit [STATUS]
230 Terminate the current process without unwinding the Scheme stack.
231 This is would typically be useful after a fork. The exit status
232 is STATUS if supplied, otherwise zero.
233
234** procedure: times
235 Returns an object with information about real and processor time.
236 The following procedures accept such an object as an argument and
237 return a selected component:
238
239 `tms:clock'
240 The current real time, expressed as time units relative to an
241 arbitrary base.
242
243 `tms:utime'
244 The CPU time units used by the calling process.
245
246 `tms:stime'
247 The CPU time units used by the system on behalf of the
248 calling process.
249
250 `tms:cutime'
251 The CPU time units used by terminated child processes of the
252 calling process, whose status has been collected (e.g., using
253 `waitpid').
254
255 `tms:cstime'
256 Similarly, the CPU times units used by the system on behalf of
257 terminated child processes.
7ad3c1e7 258
c484bf7f
JB
259* Changes to the gh_ interface
260
5424b4f7
MD
261** Function: void gh_write (SCM x)
262
263Write the printed representation of the scheme object x to the current
264output port. Corresponds to the scheme level `write'.
265
3a97e020
MD
266** gh_list_length renamed to gh_length.
267
c484bf7f
JB
268* Changes to the scm_ interface
269
5424b4f7
MD
270** Function: SCM scm_internal_stack_catch (SCM tag,
271 scm_catch_body_t body,
272 void *body_data,
273 scm_catch_handler_t handler,
274 void *handler_data)
275
276A new sibling to the other two C level `catch' functions
277scm_internal_catch and scm_internal_lazy_catch. Use it if you want
278the stack to be saved automatically into the variable `the-last-stack'
279(scm_the_last_stack_var) on error. This is necessary if you want to
280use advanced error reporting, such as calling scm_display_error and
281scm_display_backtrace. (They both take a stack object as argument.)
282
88482b31
MD
283** The hook scm_error_callback has been removed. It was originally
284intended as a way for the user to install his own error handler. But
285that method works badly since it intervenes between throw and catch,
286thereby changing the semantics of expressions like (catch #t ...).
287The correct way to do it is to use one of the C level catch functions
288in throw.c: scm_internal_catch/lazy_catch/stack_catch.
289
3a97e020
MD
290** Removed functions:
291
292scm_obj_length, scm_list_length, scm_list_append, scm_list_append_x,
293scm_list_reverse, scm_list_reverse_x
294
295** New macros: SCM_LISTn where n is one of the integers 0-9.
296
297These can be used for pretty list creation from C. The idea is taken
298from Erick Gallesio's STk.
299
298aa6e3
MD
300** scm_array_map renamed to scm_array_map_x
301
c484bf7f
JB
302\f
303Changes in Guile 1.2 (released Tuesday, June 24 1997):
cf78e9e8 304
737c9113
JB
305* Changes to the distribution
306
832b09ed
JB
307** Nightly snapshots are now available from ftp.red-bean.com.
308The old server, ftp.cyclic.com, has been relinquished to its rightful
309owner.
310
311Nightly snapshots of the Guile development sources are now available via
312anonymous FTP from ftp.red-bean.com, as /pub/guile/guile-snap.tar.gz.
313
314Via the web, that's: ftp://ftp.red-bean.com/pub/guile/guile-snap.tar.gz
315For getit, that's: ftp.red-bean.com:/pub/guile/guile-snap.tar.gz
316
0fcab5ed
JB
317** To run Guile without installing it, the procedure has changed a bit.
318
319If you used a separate build directory to compile Guile, you'll need
320to include the build directory in SCHEME_LOAD_PATH, as well as the
321source directory. See the `INSTALL' file for examples.
322
737c9113
JB
323* Changes to the procedure for linking libguile with your programs
324
94982a4e
JB
325** The standard Guile load path for Scheme code now includes
326$(datadir)/guile (usually /usr/local/share/guile). This means that
327you can install your own Scheme files there, and Guile will find them.
328(Previous versions of Guile only checked a directory whose name
329contained the Guile version number, so you had to re-install or move
330your Scheme sources each time you installed a fresh version of Guile.)
331
332The load path also includes $(datadir)/guile/site; we recommend
333putting individual Scheme files there. If you want to install a
334package with multiple source files, create a directory for them under
335$(datadir)/guile.
336
337** Guile 1.2 will now use the Rx regular expression library, if it is
338installed on your system. When you are linking libguile into your own
339programs, this means you will have to link against -lguile, -lqt (if
340you configured Guile with thread support), and -lrx.
27590f82
JB
341
342If you are using autoconf to generate configuration scripts for your
343application, the following lines should suffice to add the appropriate
344libraries to your link command:
345
346### Find Rx, quickthreads and libguile.
347AC_CHECK_LIB(rx, main)
348AC_CHECK_LIB(qt, main)
349AC_CHECK_LIB(guile, scm_shell)
350
94982a4e
JB
351The Guile 1.2 distribution does not contain sources for the Rx
352library, as Guile 1.0 did. If you want to use Rx, you'll need to
353retrieve it from a GNU FTP site and install it separately.
354
b83b8bee
JB
355* Changes to Scheme functions and syntax
356
e035e7e6
MV
357** The dynamic linking features of Guile are now enabled by default.
358You can disable them by giving the `--disable-dynamic-linking' option
359to configure.
360
e035e7e6
MV
361 (dynamic-link FILENAME)
362
363 Find the object file denoted by FILENAME (a string) and link it
364 into the running Guile application. When everything works out,
365 return a Scheme object suitable for representing the linked object
366 file. Otherwise an error is thrown. How object files are
367 searched is system dependent.
368
369 (dynamic-object? VAL)
370
371 Determine whether VAL represents a dynamically linked object file.
372
373 (dynamic-unlink DYNOBJ)
374
375 Unlink the indicated object file from the application. DYNOBJ
376 should be one of the values returned by `dynamic-link'.
377
378 (dynamic-func FUNCTION DYNOBJ)
379
380 Search the C function indicated by FUNCTION (a string or symbol)
381 in DYNOBJ and return some Scheme object that can later be used
382 with `dynamic-call' to actually call this function. Right now,
383 these Scheme objects are formed by casting the address of the
384 function to `long' and converting this number to its Scheme
385 representation.
386
387 (dynamic-call FUNCTION DYNOBJ)
388
389 Call the C function indicated by FUNCTION and DYNOBJ. The
390 function is passed no arguments and its return value is ignored.
391 When FUNCTION is something returned by `dynamic-func', call that
392 function and ignore DYNOBJ. When FUNCTION is a string (or symbol,
393 etc.), look it up in DYNOBJ; this is equivalent to
394
395 (dynamic-call (dynamic-func FUNCTION DYNOBJ) #f)
396
397 Interrupts are deferred while the C function is executing (with
398 SCM_DEFER_INTS/SCM_ALLOW_INTS).
399
400 (dynamic-args-call FUNCTION DYNOBJ ARGS)
401
402 Call the C function indicated by FUNCTION and DYNOBJ, but pass it
403 some arguments and return its return value. The C function is
404 expected to take two arguments and return an `int', just like
405 `main':
406
407 int c_func (int argc, char **argv);
408
409 ARGS must be a list of strings and is converted into an array of
410 `char *'. The array is passed in ARGV and its size in ARGC. The
411 return value is converted to a Scheme number and returned from the
412 call to `dynamic-args-call'.
413
0fcab5ed
JB
414When dynamic linking is disabled or not supported on your system,
415the above functions throw errors, but they are still available.
416
e035e7e6
MV
417Here is a small example that works on GNU/Linux:
418
419 (define libc-obj (dynamic-link "libc.so"))
420 (dynamic-args-call 'rand libc-obj '())
421
422See the file `libguile/DYNAMIC-LINKING' for additional comments.
423
27590f82
JB
424** The #/ syntax for module names is depreciated, and will be removed
425in a future version of Guile. Instead of
426
427 #/foo/bar/baz
428
429instead write
430
431 (foo bar baz)
432
433The latter syntax is more consistent with existing Lisp practice.
434
5dade857
MV
435** Guile now does fancier printing of structures. Structures are the
436underlying implementation for records, which in turn are used to
437implement modules, so all of these object now print differently and in
438a more informative way.
439
161029df
JB
440The Scheme printer will examine the builtin variable *struct-printer*
441whenever it needs to print a structure object. When this variable is
442not `#f' it is deemed to be a procedure and will be applied to the
443structure object and the output port. When *struct-printer* is `#f'
444or the procedure return `#f' the structure object will be printed in
445the boring #<struct 80458270> form.
5dade857
MV
446
447This hook is used by some routines in ice-9/boot-9.scm to implement
448type specific printing routines. Please read the comments there about
449"printing structs".
450
451One of the more specific uses of structs are records. The printing
452procedure that could be passed to MAKE-RECORD-TYPE is now actually
453called. It should behave like a *struct-printer* procedure (described
454above).
455
b83b8bee
JB
456** Guile now supports a new R4RS-compliant syntax for keywords. A
457token of the form #:NAME, where NAME has the same syntax as a Scheme
458symbol, is the external representation of the keyword named NAME.
459Keyword objects print using this syntax as well, so values containing
1e5afba0
JB
460keyword objects can be read back into Guile. When used in an
461expression, keywords are self-quoting objects.
b83b8bee
JB
462
463Guile suports this read syntax, and uses this print syntax, regardless
464of the current setting of the `keyword' read option. The `keyword'
465read option only controls whether Guile recognizes the `:NAME' syntax,
466which is incompatible with R4RS. (R4RS says such token represent
467symbols.)
737c9113
JB
468
469** Guile has regular expression support again. Guile 1.0 included
470functions for matching regular expressions, based on the Rx library.
471In Guile 1.1, the Guile/Rx interface was removed to simplify the
472distribution, and thus Guile had no regular expression support. Guile
94982a4e
JB
4731.2 again supports the most commonly used functions, and supports all
474of SCSH's regular expression functions.
2409cdfa 475
94982a4e
JB
476If your system does not include a POSIX regular expression library,
477and you have not linked Guile with a third-party regexp library such as
478Rx, these functions will not be available. You can tell whether your
479Guile installation includes regular expression support by checking
480whether the `*features*' list includes the `regex' symbol.
737c9113 481
94982a4e 482*** regexp functions
161029df 483
94982a4e
JB
484By default, Guile supports POSIX extended regular expressions. That
485means that the characters `(', `)', `+' and `?' are special, and must
486be escaped if you wish to match the literal characters.
e1a191a8 487
94982a4e
JB
488This regular expression interface was modeled after that implemented
489by SCSH, the Scheme Shell. It is intended to be upwardly compatible
490with SCSH regular expressions.
491
492**** Function: string-match PATTERN STR [START]
493 Compile the string PATTERN into a regular expression and compare
494 it with STR. The optional numeric argument START specifies the
495 position of STR at which to begin matching.
496
497 `string-match' returns a "match structure" which describes what,
498 if anything, was matched by the regular expression. *Note Match
499 Structures::. If STR does not match PATTERN at all,
500 `string-match' returns `#f'.
501
502 Each time `string-match' is called, it must compile its PATTERN
503argument into a regular expression structure. This operation is
504expensive, which makes `string-match' inefficient if the same regular
505expression is used several times (for example, in a loop). For better
506performance, you can compile a regular expression in advance and then
507match strings against the compiled regexp.
508
509**** Function: make-regexp STR [FLAGS]
510 Compile the regular expression described by STR, and return the
511 compiled regexp structure. If STR does not describe a legal
512 regular expression, `make-regexp' throws a
513 `regular-expression-syntax' error.
514
515 FLAGS may be the bitwise-or of one or more of the following:
516
517**** Constant: regexp/extended
518 Use POSIX Extended Regular Expression syntax when interpreting
519 STR. If not set, POSIX Basic Regular Expression syntax is used.
520 If the FLAGS argument is omitted, we assume regexp/extended.
521
522**** Constant: regexp/icase
523 Do not differentiate case. Subsequent searches using the
524 returned regular expression will be case insensitive.
525
526**** Constant: regexp/newline
527 Match-any-character operators don't match a newline.
528
529 A non-matching list ([^...]) not containing a newline matches a
530 newline.
531
532 Match-beginning-of-line operator (^) matches the empty string
533 immediately after a newline, regardless of whether the FLAGS
534 passed to regexp-exec contain regexp/notbol.
535
536 Match-end-of-line operator ($) matches the empty string
537 immediately before a newline, regardless of whether the FLAGS
538 passed to regexp-exec contain regexp/noteol.
539
540**** Function: regexp-exec REGEXP STR [START [FLAGS]]
541 Match the compiled regular expression REGEXP against `str'. If
542 the optional integer START argument is provided, begin matching
543 from that position in the string. Return a match structure
544 describing the results of the match, or `#f' if no match could be
545 found.
546
547 FLAGS may be the bitwise-or of one or more of the following:
548
549**** Constant: regexp/notbol
550 The match-beginning-of-line operator always fails to match (but
551 see the compilation flag regexp/newline above) This flag may be
552 used when different portions of a string are passed to
553 regexp-exec and the beginning of the string should not be
554 interpreted as the beginning of the line.
555
556**** Constant: regexp/noteol
557 The match-end-of-line operator always fails to match (but see the
558 compilation flag regexp/newline above)
559
560**** Function: regexp? OBJ
561 Return `#t' if OBJ is a compiled regular expression, or `#f'
562 otherwise.
563
564 Regular expressions are commonly used to find patterns in one string
565and replace them with the contents of another string.
566
567**** Function: regexp-substitute PORT MATCH [ITEM...]
568 Write to the output port PORT selected contents of the match
569 structure MATCH. Each ITEM specifies what should be written, and
570 may be one of the following arguments:
571
572 * A string. String arguments are written out verbatim.
573
574 * An integer. The submatch with that number is written.
575
576 * The symbol `pre'. The portion of the matched string preceding
577 the regexp match is written.
578
579 * The symbol `post'. The portion of the matched string
580 following the regexp match is written.
581
582 PORT may be `#f', in which case nothing is written; instead,
583 `regexp-substitute' constructs a string from the specified ITEMs
584 and returns that.
585
586**** Function: regexp-substitute/global PORT REGEXP TARGET [ITEM...]
587 Similar to `regexp-substitute', but can be used to perform global
588 substitutions on STR. Instead of taking a match structure as an
589 argument, `regexp-substitute/global' takes two string arguments: a
590 REGEXP string describing a regular expression, and a TARGET string
591 which should be matched against this regular expression.
592
593 Each ITEM behaves as in REGEXP-SUBSTITUTE, with the following
594 exceptions:
595
596 * A function may be supplied. When this function is called, it
597 will be passed one argument: a match structure for a given
598 regular expression match. It should return a string to be
599 written out to PORT.
600
601 * The `post' symbol causes `regexp-substitute/global' to recurse
602 on the unmatched portion of STR. This *must* be supplied in
603 order to perform global search-and-replace on STR; if it is
604 not present among the ITEMs, then `regexp-substitute/global'
605 will return after processing a single match.
606
607*** Match Structures
608
609 A "match structure" is the object returned by `string-match' and
610`regexp-exec'. It describes which portion of a string, if any, matched
611the given regular expression. Match structures include: a reference to
612the string that was checked for matches; the starting and ending
613positions of the regexp match; and, if the regexp included any
614parenthesized subexpressions, the starting and ending positions of each
615submatch.
616
617 In each of the regexp match functions described below, the `match'
618argument must be a match structure returned by a previous call to
619`string-match' or `regexp-exec'. Most of these functions return some
620information about the original target string that was matched against a
621regular expression; we will call that string TARGET for easy reference.
622
623**** Function: regexp-match? OBJ
624 Return `#t' if OBJ is a match structure returned by a previous
625 call to `regexp-exec', or `#f' otherwise.
626
627**** Function: match:substring MATCH [N]
628 Return the portion of TARGET matched by subexpression number N.
629 Submatch 0 (the default) represents the entire regexp match. If
630 the regular expression as a whole matched, but the subexpression
631 number N did not match, return `#f'.
632
633**** Function: match:start MATCH [N]
634 Return the starting position of submatch number N.
635
636**** Function: match:end MATCH [N]
637 Return the ending position of submatch number N.
638
639**** Function: match:prefix MATCH
640 Return the unmatched portion of TARGET preceding the regexp match.
641
642**** Function: match:suffix MATCH
643 Return the unmatched portion of TARGET following the regexp match.
644
645**** Function: match:count MATCH
646 Return the number of parenthesized subexpressions from MATCH.
647 Note that the entire regular expression match itself counts as a
648 subexpression, and failed submatches are included in the count.
649
650**** Function: match:string MATCH
651 Return the original TARGET string.
652
653*** Backslash Escapes
654
655 Sometimes you will want a regexp to match characters like `*' or `$'
656exactly. For example, to check whether a particular string represents
657a menu entry from an Info node, it would be useful to match it against
658a regexp like `^* [^:]*::'. However, this won't work; because the
659asterisk is a metacharacter, it won't match the `*' at the beginning of
660the string. In this case, we want to make the first asterisk un-magic.
661
662 You can do this by preceding the metacharacter with a backslash
663character `\'. (This is also called "quoting" the metacharacter, and
664is known as a "backslash escape".) When Guile sees a backslash in a
665regular expression, it considers the following glyph to be an ordinary
666character, no matter what special meaning it would ordinarily have.
667Therefore, we can make the above example work by changing the regexp to
668`^\* [^:]*::'. The `\*' sequence tells the regular expression engine
669to match only a single asterisk in the target string.
670
671 Since the backslash is itself a metacharacter, you may force a
672regexp to match a backslash in the target string by preceding the
673backslash with itself. For example, to find variable references in a
674TeX program, you might want to find occurrences of the string `\let\'
675followed by any number of alphabetic characters. The regular expression
676`\\let\\[A-Za-z]*' would do this: the double backslashes in the regexp
677each match a single backslash in the target string.
678
679**** Function: regexp-quote STR
680 Quote each special character found in STR with a backslash, and
681 return the resulting string.
682
683 *Very important:* Using backslash escapes in Guile source code (as
684in Emacs Lisp or C) can be tricky, because the backslash character has
685special meaning for the Guile reader. For example, if Guile encounters
686the character sequence `\n' in the middle of a string while processing
687Scheme code, it replaces those characters with a newline character.
688Similarly, the character sequence `\t' is replaced by a horizontal tab.
689Several of these "escape sequences" are processed by the Guile reader
690before your code is executed. Unrecognized escape sequences are
691ignored: if the characters `\*' appear in a string, they will be
692translated to the single character `*'.
693
694 This translation is obviously undesirable for regular expressions,
695since we want to be able to include backslashes in a string in order to
696escape regexp metacharacters. Therefore, to make sure that a backslash
697is preserved in a string in your Guile program, you must use *two*
698consecutive backslashes:
699
700 (define Info-menu-entry-pattern (make-regexp "^\\* [^:]*"))
701
702 The string in this example is preprocessed by the Guile reader before
703any code is executed. The resulting argument to `make-regexp' is the
704string `^\* [^:]*', which is what we really want.
705
706 This also means that in order to write a regular expression that
707matches a single backslash character, the regular expression string in
708the source code must include *four* backslashes. Each consecutive pair
709of backslashes gets translated by the Guile reader to a single
710backslash, and the resulting double-backslash is interpreted by the
711regexp engine as matching a single backslash character. Hence:
712
713 (define tex-variable-pattern (make-regexp "\\\\let\\\\=[A-Za-z]*"))
714
715 The reason for the unwieldiness of this syntax is historical. Both
716regular expression pattern matchers and Unix string processing systems
717have traditionally used backslashes with the special meanings described
718above. The POSIX regular expression specification and ANSI C standard
719both require these semantics. Attempting to abandon either convention
720would cause other kinds of compatibility problems, possibly more severe
721ones. Therefore, without extending the Scheme reader to support
722strings with different quoting conventions (an ungainly and confusing
723extension when implemented in other languages), we must adhere to this
724cumbersome escape syntax.
725
7ad3c1e7
GH
726* Changes to the gh_ interface
727
728* Changes to the scm_ interface
729
730* Changes to system call interfaces:
94982a4e 731
7ad3c1e7 732** The value returned by `raise' is now unspecified. It throws an exception
e1a191a8
GH
733if an error occurs.
734
94982a4e 735*** A new procedure `sigaction' can be used to install signal handlers
115b09a5
GH
736
737(sigaction signum [action] [flags])
738
739signum is the signal number, which can be specified using the value
740of SIGINT etc.
741
742If action is omitted, sigaction returns a pair: the CAR is the current
743signal hander, which will be either an integer with the value SIG_DFL
744(default action) or SIG_IGN (ignore), or the Scheme procedure which
745handles the signal, or #f if a non-Scheme procedure handles the
746signal. The CDR contains the current sigaction flags for the handler.
747
748If action is provided, it is installed as the new handler for signum.
749action can be a Scheme procedure taking one argument, or the value of
750SIG_DFL (default action) or SIG_IGN (ignore), or #f to restore
751whatever signal handler was installed before sigaction was first used.
752Flags can optionally be specified for the new handler (SA_RESTART is
753always used if the system provides it, so need not be specified.) The
754return value is a pair with information about the old handler as
755described above.
756
757This interface does not provide access to the "signal blocking"
758facility. Maybe this is not needed, since the thread support may
759provide solutions to the problem of consistent access to data
760structures.
e1a191a8 761
94982a4e 762*** A new procedure `flush-all-ports' is equivalent to running
89ea5b7c
GH
763`force-output' on every port open for output.
764
94982a4e
JB
765** Guile now provides information on how it was built, via the new
766global variable, %guile-build-info. This variable records the values
767of the standard GNU makefile directory variables as an assocation
768list, mapping variable names (symbols) onto directory paths (strings).
769For example, to find out where the Guile link libraries were
770installed, you can say:
771
772guile -c "(display (assq-ref %guile-build-info 'libdir)) (newline)"
773
774
775* Changes to the scm_ interface
776
777** The new function scm_handle_by_message_noexit is just like the
778existing scm_handle_by_message function, except that it doesn't call
779exit to terminate the process. Instead, it prints a message and just
780returns #f. This might be a more appropriate catch-all handler for
781new dynamic roots and threads.
782
cf78e9e8 783\f
c484bf7f 784Changes in Guile 1.1 (released Friday, May 16 1997):
f3b1485f
JB
785
786* Changes to the distribution.
787
788The Guile 1.0 distribution has been split up into several smaller
789pieces:
790guile-core --- the Guile interpreter itself.
791guile-tcltk --- the interface between the Guile interpreter and
792 Tcl/Tk; Tcl is an interpreter for a stringy language, and Tk
793 is a toolkit for building graphical user interfaces.
794guile-rgx-ctax --- the interface between Guile and the Rx regular
795 expression matcher, and the translator for the Ctax
796 programming language. These are packaged together because the
797 Ctax translator uses Rx to parse Ctax source code.
798
095936d2
JB
799This NEWS file describes the changes made to guile-core since the 1.0
800release.
801
48d224d7
JB
802We no longer distribute the documentation, since it was either out of
803date, or incomplete. As soon as we have current documentation, we
804will distribute it.
805
0fcab5ed
JB
806
807
f3b1485f
JB
808* Changes to the stand-alone interpreter
809
48d224d7
JB
810** guile now accepts command-line arguments compatible with SCSH, Olin
811Shivers' Scheme Shell.
812
813In general, arguments are evaluated from left to right, but there are
814exceptions. The following switches stop argument processing, and
815stash all remaining command-line arguments as the value returned by
816the (command-line) function.
817 -s SCRIPT load Scheme source code from FILE, and exit
818 -c EXPR evalute Scheme expression EXPR, and exit
819 -- stop scanning arguments; run interactively
820
821The switches below are processed as they are encountered.
822 -l FILE load Scheme source code from FILE
823 -e FUNCTION after reading script, apply FUNCTION to
824 command line arguments
825 -ds do -s script at this point
826 --emacs enable Emacs protocol (experimental)
827 -h, --help display this help and exit
828 -v, --version display version information and exit
829 \ read arguments from following script lines
830
831So, for example, here is a Guile script named `ekko' (thanks, Olin)
832which re-implements the traditional "echo" command:
833
834#!/usr/local/bin/guile -s
835!#
836(define (main args)
837 (map (lambda (arg) (display arg) (display " "))
838 (cdr args))
839 (newline))
840
841(main (command-line))
842
843Suppose we invoke this script as follows:
844
845 ekko a speckled gecko
846
847Through the magic of Unix script processing (triggered by the `#!'
848token at the top of the file), /usr/local/bin/guile receives the
849following list of command-line arguments:
850
851 ("-s" "./ekko" "a" "speckled" "gecko")
852
853Unix inserts the name of the script after the argument specified on
854the first line of the file (in this case, "-s"), and then follows that
855with the arguments given to the script. Guile loads the script, which
856defines the `main' function, and then applies it to the list of
857remaining command-line arguments, ("a" "speckled" "gecko").
858
095936d2
JB
859In Unix, the first line of a script file must take the following form:
860
861#!INTERPRETER ARGUMENT
862
863where INTERPRETER is the absolute filename of the interpreter
864executable, and ARGUMENT is a single command-line argument to pass to
865the interpreter.
866
867You may only pass one argument to the interpreter, and its length is
868limited. These restrictions can be annoying to work around, so Guile
869provides a general mechanism (borrowed from, and compatible with,
870SCSH) for circumventing them.
871
872If the ARGUMENT in a Guile script is a single backslash character,
873`\', Guile will open the script file, parse arguments from its second
874and subsequent lines, and replace the `\' with them. So, for example,
875here is another implementation of the `ekko' script:
876
877#!/usr/local/bin/guile \
878-e main -s
879!#
880(define (main args)
881 (for-each (lambda (arg) (display arg) (display " "))
882 (cdr args))
883 (newline))
884
885If the user invokes this script as follows:
886
887 ekko a speckled gecko
888
889Unix expands this into
890
891 /usr/local/bin/guile \ ekko a speckled gecko
892
893When Guile sees the `\' argument, it replaces it with the arguments
894read from the second line of the script, producing:
895
896 /usr/local/bin/guile -e main -s ekko a speckled gecko
897
898This tells Guile to load the `ekko' script, and apply the function
899`main' to the argument list ("a" "speckled" "gecko").
900
901Here is how Guile parses the command-line arguments:
902- Each space character terminates an argument. This means that two
903 spaces in a row introduce an empty-string argument.
904- The tab character is not permitted (unless you quote it with the
905 backslash character, as described below), to avoid confusion.
906- The newline character terminates the sequence of arguments, and will
907 also terminate a final non-empty argument. (However, a newline
908 following a space will not introduce a final empty-string argument;
909 it only terminates the argument list.)
910- The backslash character is the escape character. It escapes
911 backslash, space, tab, and newline. The ANSI C escape sequences
912 like \n and \t are also supported. These produce argument
913 constituents; the two-character combination \n doesn't act like a
914 terminating newline. The escape sequence \NNN for exactly three
915 octal digits reads as the character whose ASCII code is NNN. As
916 above, characters produced this way are argument constituents.
917 Backslash followed by other characters is not allowed.
918
48d224d7
JB
919* Changes to the procedure for linking libguile with your programs
920
921** Guile now builds and installs a shared guile library, if your
922system support shared libraries. (It still builds a static library on
923all systems.) Guile automatically detects whether your system
924supports shared libraries. To prevent Guile from buildisg shared
925libraries, pass the `--disable-shared' flag to the configure script.
926
927Guile takes longer to compile when it builds shared libraries, because
928it must compile every file twice --- once to produce position-
929independent object code, and once to produce normal object code.
930
931** The libthreads library has been merged into libguile.
932
933To link a program against Guile, you now need only link against
934-lguile and -lqt; -lthreads is no longer needed. If you are using
935autoconf to generate configuration scripts for your application, the
936following lines should suffice to add the appropriate libraries to
937your link command:
938
939### Find quickthreads and libguile.
940AC_CHECK_LIB(qt, main)
941AC_CHECK_LIB(guile, scm_shell)
f3b1485f
JB
942
943* Changes to Scheme functions
944
095936d2
JB
945** Guile Scheme's special syntax for keyword objects is now optional,
946and disabled by default.
947
948The syntax variation from R4RS made it difficult to port some
949interesting packages to Guile. The routines which accepted keyword
950arguments (mostly in the module system) have been modified to also
951accept symbols whose names begin with `:'.
952
953To change the keyword syntax, you must first import the (ice-9 debug)
954module:
955 (use-modules (ice-9 debug))
956
957Then you can enable the keyword syntax as follows:
958 (read-set! keywords 'prefix)
959
960To disable keyword syntax, do this:
961 (read-set! keywords #f)
962
963** Many more primitive functions accept shared substrings as
964arguments. In the past, these functions required normal, mutable
965strings as arguments, although they never made use of this
966restriction.
967
968** The uniform array functions now operate on byte vectors. These
969functions are `array-fill!', `serial-array-copy!', `array-copy!',
970`serial-array-map', `array-map', `array-for-each', and
971`array-index-map!'.
972
973** The new functions `trace' and `untrace' implement simple debugging
974support for Scheme functions.
975
976The `trace' function accepts any number of procedures as arguments,
977and tells the Guile interpreter to display each procedure's name and
978arguments each time the procedure is invoked. When invoked with no
979arguments, `trace' returns the list of procedures currently being
980traced.
981
982The `untrace' function accepts any number of procedures as arguments,
983and tells the Guile interpreter not to trace them any more. When
984invoked with no arguments, `untrace' untraces all curretly traced
985procedures.
986
987The tracing in Guile has an advantage over most other systems: we
988don't create new procedure objects, but mark the procedure objects
989themselves. This means that anonymous and internal procedures can be
990traced.
991
992** The function `assert-repl-prompt' has been renamed to
993`set-repl-prompt!'. It takes one argument, PROMPT.
994- If PROMPT is #f, the Guile read-eval-print loop will not prompt.
995- If PROMPT is a string, we use it as a prompt.
996- If PROMPT is a procedure accepting no arguments, we call it, and
997 display the result as a prompt.
998- Otherwise, we display "> ".
999
1000** The new function `eval-string' reads Scheme expressions from a
1001string and evaluates them, returning the value of the last expression
1002in the string. If the string contains no expressions, it returns an
1003unspecified value.
1004
1005** The new function `thunk?' returns true iff its argument is a
1006procedure of zero arguments.
1007
1008** `defined?' is now a builtin function, instead of syntax. This
1009means that its argument should be quoted. It returns #t iff its
1010argument is bound in the current module.
1011
1012** The new syntax `use-modules' allows you to add new modules to your
1013environment without re-typing a complete `define-module' form. It
1014accepts any number of module names as arguments, and imports their
1015public bindings into the current module.
1016
1017** The new function (module-defined? NAME MODULE) returns true iff
1018NAME, a symbol, is defined in MODULE, a module object.
1019
1020** The new function `builtin-bindings' creates and returns a hash
1021table containing copies of all the root module's bindings.
1022
1023** The new function `builtin-weak-bindings' does the same as
1024`builtin-bindings', but creates a doubly-weak hash table.
1025
1026** The `equal?' function now considers variable objects to be
1027equivalent if they have the same name and the same value.
1028
1029** The new function `command-line' returns the command-line arguments
1030given to Guile, as a list of strings.
1031
1032When using guile as a script interpreter, `command-line' returns the
1033script's arguments; those processed by the interpreter (like `-s' or
1034`-c') are omitted. (In other words, you get the normal, expected
1035behavior.) Any application that uses scm_shell to process its
1036command-line arguments gets this behavior as well.
1037
1038** The new function `load-user-init' looks for a file called `.guile'
1039in the user's home directory, and loads it if it exists. This is
1040mostly for use by the code generated by scm_compile_shell_switches,
1041but we thought it might also be useful in other circumstances.
1042
1043** The new function `log10' returns the base-10 logarithm of its
1044argument.
1045
1046** Changes to I/O functions
1047
1048*** The functions `read', `primitive-load', `read-and-eval!', and
1049`primitive-load-path' no longer take optional arguments controlling
1050case insensitivity and a `#' parser.
1051
1052Case sensitivity is now controlled by a read option called
1053`case-insensitive'. The user can add new `#' syntaxes with the
1054`read-hash-extend' function (see below).
1055
1056*** The new function `read-hash-extend' allows the user to change the
1057syntax of Guile Scheme in a somewhat controlled way.
1058
1059(read-hash-extend CHAR PROC)
1060 When parsing S-expressions, if we read a `#' character followed by
1061 the character CHAR, use PROC to parse an object from the stream.
1062 If PROC is #f, remove any parsing procedure registered for CHAR.
1063
1064 The reader applies PROC to two arguments: CHAR and an input port.
1065
1066*** The new functions read-delimited and read-delimited! provide a
1067general mechanism for doing delimited input on streams.
1068
1069(read-delimited DELIMS [PORT HANDLE-DELIM])
1070 Read until we encounter one of the characters in DELIMS (a string),
1071 or end-of-file. PORT is the input port to read from; it defaults to
1072 the current input port. The HANDLE-DELIM parameter determines how
1073 the terminating character is handled; it should be one of the
1074 following symbols:
1075
1076 'trim omit delimiter from result
1077 'peek leave delimiter character in input stream
1078 'concat append delimiter character to returned value
1079 'split return a pair: (RESULT . TERMINATOR)
1080
1081 HANDLE-DELIM defaults to 'peek.
1082
1083(read-delimited! DELIMS BUF [PORT HANDLE-DELIM START END])
1084 A side-effecting variant of `read-delimited'.
1085
1086 The data is written into the string BUF at the indices in the
1087 half-open interval [START, END); the default interval is the whole
1088 string: START = 0 and END = (string-length BUF). The values of
1089 START and END must specify a well-defined interval in BUF, i.e.
1090 0 <= START <= END <= (string-length BUF).
1091
1092 It returns NBYTES, the number of bytes read. If the buffer filled
1093 up without a delimiter character being found, it returns #f. If the
1094 port is at EOF when the read starts, it returns the EOF object.
1095
1096 If an integer is returned (i.e., the read is successfully terminated
1097 by reading a delimiter character), then the HANDLE-DELIM parameter
1098 determines how to handle the terminating character. It is described
1099 above, and defaults to 'peek.
1100
1101(The descriptions of these functions were borrowed from the SCSH
1102manual, by Olin Shivers and Brian Carlstrom.)
1103
1104*** The `%read-delimited!' function is the primitive used to implement
1105`read-delimited' and `read-delimited!'.
1106
1107(%read-delimited! DELIMS BUF GOBBLE? [PORT START END])
1108
1109This returns a pair of values: (TERMINATOR . NUM-READ).
1110- TERMINATOR describes why the read was terminated. If it is a
1111 character or the eof object, then that is the value that terminated
1112 the read. If it is #f, the function filled the buffer without finding
1113 a delimiting character.
1114- NUM-READ is the number of characters read into BUF.
1115
1116If the read is successfully terminated by reading a delimiter
1117character, then the gobble? parameter determines what to do with the
1118terminating character. If true, the character is removed from the
1119input stream; if false, the character is left in the input stream
1120where a subsequent read operation will retrieve it. In either case,
1121the character is also the first value returned by the procedure call.
1122
1123(The descriptions of this function was borrowed from the SCSH manual,
1124by Olin Shivers and Brian Carlstrom.)
1125
1126*** The `read-line' and `read-line!' functions have changed; they now
1127trim the terminator by default; previously they appended it to the
1128returned string. For the old behavior, use (read-line PORT 'concat).
1129
1130*** The functions `uniform-array-read!' and `uniform-array-write!' now
1131take new optional START and END arguments, specifying the region of
1132the array to read and write.
1133
f348c807
JB
1134*** The `ungetc-char-ready?' function has been removed. We feel it's
1135inappropriate for an interface to expose implementation details this
1136way.
095936d2
JB
1137
1138** Changes to the Unix library and system call interface
1139
1140*** The new fcntl function provides access to the Unix `fcntl' system
1141call.
1142
1143(fcntl PORT COMMAND VALUE)
1144 Apply COMMAND to PORT's file descriptor, with VALUE as an argument.
1145 Values for COMMAND are:
1146
1147 F_DUPFD duplicate a file descriptor
1148 F_GETFD read the descriptor's close-on-exec flag
1149 F_SETFD set the descriptor's close-on-exec flag to VALUE
1150 F_GETFL read the descriptor's flags, as set on open
1151 F_SETFL set the descriptor's flags, as set on open to VALUE
1152 F_GETOWN return the process ID of a socket's owner, for SIGIO
1153 F_SETOWN set the process that owns a socket to VALUE, for SIGIO
1154 FD_CLOEXEC not sure what this is
1155
1156For details, see the documentation for the fcntl system call.
1157
1158*** The arguments to `select' have changed, for compatibility with
1159SCSH. The TIMEOUT parameter may now be non-integral, yielding the
1160expected behavior. The MILLISECONDS parameter has been changed to
1161MICROSECONDS, to more closely resemble the underlying system call.
1162The RVEC, WVEC, and EVEC arguments can now be vectors; the type of the
1163corresponding return set will be the same.
1164
1165*** The arguments to the `mknod' system call have changed. They are
1166now:
1167
1168(mknod PATH TYPE PERMS DEV)
1169 Create a new file (`node') in the file system. PATH is the name of
1170 the file to create. TYPE is the kind of file to create; it should
1171 be 'fifo, 'block-special, or 'char-special. PERMS specifies the
1172 permission bits to give the newly created file. If TYPE is
1173 'block-special or 'char-special, DEV specifies which device the
1174 special file refers to; its interpretation depends on the kind of
1175 special file being created.
1176
1177*** The `fork' function has been renamed to `primitive-fork', to avoid
1178clashing with various SCSH forks.
1179
1180*** The `recv' and `recvfrom' functions have been renamed to `recv!'
1181and `recvfrom!'. They no longer accept a size for a second argument;
1182you must pass a string to hold the received value. They no longer
1183return the buffer. Instead, `recv' returns the length of the message
1184received, and `recvfrom' returns a pair containing the packet's length
1185and originating address.
1186
1187*** The file descriptor datatype has been removed, as have the
1188`read-fd', `write-fd', `close', `lseek', and `dup' functions.
1189We plan to replace these functions with a SCSH-compatible interface.
1190
1191*** The `create' function has been removed; it's just a special case
1192of `open'.
1193
1194*** There are new functions to break down process termination status
1195values. In the descriptions below, STATUS is a value returned by
1196`waitpid'.
1197
1198(status:exit-val STATUS)
1199 If the child process exited normally, this function returns the exit
1200 code for the child process (i.e., the value passed to exit, or
1201 returned from main). If the child process did not exit normally,
1202 this function returns #f.
1203
1204(status:stop-sig STATUS)
1205 If the child process was suspended by a signal, this function
1206 returns the signal that suspended the child. Otherwise, it returns
1207 #f.
1208
1209(status:term-sig STATUS)
1210 If the child process terminated abnormally, this function returns
1211 the signal that terminated the child. Otherwise, this function
1212 returns false.
1213
1214POSIX promises that exactly one of these functions will return true on
1215a valid STATUS value.
1216
1217These functions are compatible with SCSH.
1218
1219*** There are new accessors and setters for the broken-out time vectors
48d224d7
JB
1220returned by `localtime', `gmtime', and that ilk. They are:
1221
1222 Component Accessor Setter
1223 ========================= ============ ============
1224 seconds tm:sec set-tm:sec
1225 minutes tm:min set-tm:min
1226 hours tm:hour set-tm:hour
1227 day of the month tm:mday set-tm:mday
1228 month tm:mon set-tm:mon
1229 year tm:year set-tm:year
1230 day of the week tm:wday set-tm:wday
1231 day in the year tm:yday set-tm:yday
1232 daylight saving time tm:isdst set-tm:isdst
1233 GMT offset, seconds tm:gmtoff set-tm:gmtoff
1234 name of time zone tm:zone set-tm:zone
1235
095936d2
JB
1236*** There are new accessors for the vectors returned by `uname',
1237describing the host system:
48d224d7
JB
1238
1239 Component Accessor
1240 ============================================== ================
1241 name of the operating system implementation utsname:sysname
1242 network name of this machine utsname:nodename
1243 release level of the operating system utsname:release
1244 version level of the operating system utsname:version
1245 machine hardware platform utsname:machine
1246
095936d2
JB
1247*** There are new accessors for the vectors returned by `getpw',
1248`getpwnam', `getpwuid', and `getpwent', describing entries from the
1249system's user database:
1250
1251 Component Accessor
1252 ====================== =================
1253 user name passwd:name
1254 user password passwd:passwd
1255 user id passwd:uid
1256 group id passwd:gid
1257 real name passwd:gecos
1258 home directory passwd:dir
1259 shell program passwd:shell
1260
1261*** There are new accessors for the vectors returned by `getgr',
1262`getgrnam', `getgrgid', and `getgrent', describing entries from the
1263system's group database:
1264
1265 Component Accessor
1266 ======================= ============
1267 group name group:name
1268 group password group:passwd
1269 group id group:gid
1270 group members group:mem
1271
1272*** There are new accessors for the vectors returned by `gethost',
1273`gethostbyaddr', `gethostbyname', and `gethostent', describing
1274internet hosts:
1275
1276 Component Accessor
1277 ========================= ===============
1278 official name of host hostent:name
1279 alias list hostent:aliases
1280 host address type hostent:addrtype
1281 length of address hostent:length
1282 list of addresses hostent:addr-list
1283
1284*** There are new accessors for the vectors returned by `getnet',
1285`getnetbyaddr', `getnetbyname', and `getnetent', describing internet
1286networks:
1287
1288 Component Accessor
1289 ========================= ===============
1290 official name of net netent:name
1291 alias list netent:aliases
1292 net number type netent:addrtype
1293 net number netent:net
1294
1295*** There are new accessors for the vectors returned by `getproto',
1296`getprotobyname', `getprotobynumber', and `getprotoent', describing
1297internet protocols:
1298
1299 Component Accessor
1300 ========================= ===============
1301 official protocol name protoent:name
1302 alias list protoent:aliases
1303 protocol number protoent:proto
1304
1305*** There are new accessors for the vectors returned by `getserv',
1306`getservbyname', `getservbyport', and `getservent', describing
1307internet protocols:
1308
1309 Component Accessor
1310 ========================= ===============
1311 official service name servent:name
1312 alias list servent:aliases
1313 port number servent:port
1314 protocol to use servent:proto
1315
1316*** There are new accessors for the sockaddr structures returned by
1317`accept', `getsockname', `getpeername', `recvfrom!':
1318
1319 Component Accessor
1320 ======================================== ===============
1321 address format (`family') sockaddr:fam
1322 path, for file domain addresses sockaddr:path
1323 address, for internet domain addresses sockaddr:addr
1324 TCP or UDP port, for internet sockaddr:port
1325
1326*** The `getpwent', `getgrent', `gethostent', `getnetent',
1327`getprotoent', and `getservent' functions now return #f at the end of
1328the user database. (They used to throw an exception.)
1329
1330Note that calling MUMBLEent function is equivalent to calling the
1331corresponding MUMBLE function with no arguments.
1332
1333*** The `setpwent', `setgrent', `sethostent', `setnetent',
1334`setprotoent', and `setservent' routines now take no arguments.
1335
1336*** The `gethost', `getproto', `getnet', and `getserv' functions now
1337provide more useful information when they throw an exception.
1338
1339*** The `lnaof' function has been renamed to `inet-lnaof'.
1340
1341*** Guile now claims to have the `current-time' feature.
1342
1343*** The `mktime' function now takes an optional second argument ZONE,
1344giving the time zone to use for the conversion. ZONE should be a
1345string, in the same format as expected for the "TZ" environment variable.
1346
1347*** The `strptime' function now returns a pair (TIME . COUNT), where
1348TIME is the parsed time as a vector, and COUNT is the number of
1349characters from the string left unparsed. This function used to
1350return the remaining characters as a string.
1351
1352*** The `gettimeofday' function has replaced the old `time+ticks' function.
1353The return value is now (SECONDS . MICROSECONDS); the fractional
1354component is no longer expressed in "ticks".
1355
1356*** The `ticks/sec' constant has been removed, in light of the above change.
6685dc83 1357
ea00ecba
MG
1358* Changes to the gh_ interface
1359
1360** gh_eval_str() now returns an SCM object which is the result of the
1361evaluation
1362
aaef0d2a
MG
1363** gh_scm2str() now copies the Scheme data to a caller-provided C
1364array
1365
1366** gh_scm2newstr() now makes a C array, copies the Scheme data to it,
1367and returns the array
1368
1369** gh_scm2str0() is gone: there is no need to distinguish
1370null-terminated from non-null-terminated, since gh_scm2newstr() allows
1371the user to interpret the data both ways.
1372
f3b1485f
JB
1373* Changes to the scm_ interface
1374
095936d2
JB
1375** The new function scm_symbol_value0 provides an easy way to get a
1376symbol's value from C code:
1377
1378SCM scm_symbol_value0 (char *NAME)
1379 Return the value of the symbol named by the null-terminated string
1380 NAME in the current module. If the symbol named NAME is unbound in
1381 the current module, return SCM_UNDEFINED.
1382
1383** The new function scm_sysintern0 creates new top-level variables,
1384without assigning them a value.
1385
1386SCM scm_sysintern0 (char *NAME)
1387 Create a new Scheme top-level variable named NAME. NAME is a
1388 null-terminated string. Return the variable's value cell.
1389
1390** The function scm_internal_catch is the guts of catch. It handles
1391all the mechanics of setting up a catch target, invoking the catch
1392body, and perhaps invoking the handler if the body does a throw.
1393
1394The function is designed to be usable from C code, but is general
1395enough to implement all the semantics Guile Scheme expects from throw.
1396
1397TAG is the catch tag. Typically, this is a symbol, but this function
1398doesn't actually care about that.
1399
1400BODY is a pointer to a C function which runs the body of the catch;
1401this is the code you can throw from. We call it like this:
1402 BODY (BODY_DATA, JMPBUF)
1403where:
1404 BODY_DATA is just the BODY_DATA argument we received; we pass it
1405 through to BODY as its first argument. The caller can make
1406 BODY_DATA point to anything useful that BODY might need.
1407 JMPBUF is the Scheme jmpbuf object corresponding to this catch,
1408 which we have just created and initialized.
1409
1410HANDLER is a pointer to a C function to deal with a throw to TAG,
1411should one occur. We call it like this:
1412 HANDLER (HANDLER_DATA, THROWN_TAG, THROW_ARGS)
1413where
1414 HANDLER_DATA is the HANDLER_DATA argument we recevied; it's the
1415 same idea as BODY_DATA above.
1416 THROWN_TAG is the tag that the user threw to; usually this is
1417 TAG, but it could be something else if TAG was #t (i.e., a
1418 catch-all), or the user threw to a jmpbuf.
1419 THROW_ARGS is the list of arguments the user passed to the THROW
1420 function.
1421
1422BODY_DATA is just a pointer we pass through to BODY. HANDLER_DATA
1423is just a pointer we pass through to HANDLER. We don't actually
1424use either of those pointers otherwise ourselves. The idea is
1425that, if our caller wants to communicate something to BODY or
1426HANDLER, it can pass a pointer to it as MUMBLE_DATA, which BODY and
1427HANDLER can then use. Think of it as a way to make BODY and
1428HANDLER closures, not just functions; MUMBLE_DATA points to the
1429enclosed variables.
1430
1431Of course, it's up to the caller to make sure that any data a
1432MUMBLE_DATA needs is protected from GC. A common way to do this is
1433to make MUMBLE_DATA a pointer to data stored in an automatic
1434structure variable; since the collector must scan the stack for
1435references anyway, this assures that any references in MUMBLE_DATA
1436will be found.
1437
1438** The new function scm_internal_lazy_catch is exactly like
1439scm_internal_catch, except:
1440
1441- It does not unwind the stack (this is the major difference).
1442- If handler returns, its value is returned from the throw.
1443- BODY always receives #f as its JMPBUF argument (since there's no
1444 jmpbuf associated with a lazy catch, because we don't unwind the
1445 stack.)
1446
1447** scm_body_thunk is a new body function you can pass to
1448scm_internal_catch if you want the body to be like Scheme's `catch'
1449--- a thunk, or a function of one argument if the tag is #f.
1450
1451BODY_DATA is a pointer to a scm_body_thunk_data structure, which
1452contains the Scheme procedure to invoke as the body, and the tag
1453we're catching. If the tag is #f, then we pass JMPBUF (created by
1454scm_internal_catch) to the body procedure; otherwise, the body gets
1455no arguments.
1456
1457** scm_handle_by_proc is a new handler function you can pass to
1458scm_internal_catch if you want the handler to act like Scheme's catch
1459--- call a procedure with the tag and the throw arguments.
1460
1461If the user does a throw to this catch, this function runs a handler
1462procedure written in Scheme. HANDLER_DATA is a pointer to an SCM
1463variable holding the Scheme procedure object to invoke. It ought to
1464be a pointer to an automatic variable (i.e., one living on the stack),
1465or the procedure object should be otherwise protected from GC.
1466
1467** scm_handle_by_message is a new handler function to use with
1468`scm_internal_catch' if you want Guile to print a message and die.
1469It's useful for dealing with throws to uncaught keys at the top level.
1470
1471HANDLER_DATA, if non-zero, is assumed to be a char * pointing to a
1472message header to print; if zero, we use "guile" instead. That
1473text is followed by a colon, then the message described by ARGS.
1474
1475** The return type of scm_boot_guile is now void; the function does
1476not return a value, and indeed, never returns at all.
1477
f3b1485f
JB
1478** The new function scm_shell makes it easy for user applications to
1479process command-line arguments in a way that is compatible with the
1480stand-alone guile interpreter (which is in turn compatible with SCSH,
1481the Scheme shell).
1482
1483To use the scm_shell function, first initialize any guile modules
1484linked into your application, and then call scm_shell with the values
7ed46dc8 1485of ARGC and ARGV your `main' function received. scm_shell will add
f3b1485f
JB
1486any SCSH-style meta-arguments from the top of the script file to the
1487argument vector, and then process the command-line arguments. This
1488generally means loading a script file or starting up an interactive
1489command interpreter. For details, see "Changes to the stand-alone
1490interpreter" above.
1491
095936d2
JB
1492** The new functions scm_get_meta_args and scm_count_argv help you
1493implement the SCSH-style meta-argument, `\'.
1494
1495char **scm_get_meta_args (int ARGC, char **ARGV)
1496 If the second element of ARGV is a string consisting of a single
1497 backslash character (i.e. "\\" in Scheme notation), open the file
1498 named by the following argument, parse arguments from it, and return
1499 the spliced command line. The returned array is terminated by a
1500 null pointer.
1501
1502 For details of argument parsing, see above, under "guile now accepts
1503 command-line arguments compatible with SCSH..."
1504
1505int scm_count_argv (char **ARGV)
1506 Count the arguments in ARGV, assuming it is terminated by a null
1507 pointer.
1508
1509For an example of how these functions might be used, see the source
1510code for the function scm_shell in libguile/script.c.
1511
1512You will usually want to use scm_shell instead of calling this
1513function yourself.
1514
1515** The new function scm_compile_shell_switches turns an array of
1516command-line arguments into Scheme code to carry out the actions they
1517describe. Given ARGC and ARGV, it returns a Scheme expression to
1518evaluate, and calls scm_set_program_arguments to make any remaining
1519command-line arguments available to the Scheme code. For example,
1520given the following arguments:
1521
1522 -e main -s ekko a speckled gecko
1523
1524scm_set_program_arguments will return the following expression:
1525
1526 (begin (load "ekko") (main (command-line)) (quit))
1527
1528You will usually want to use scm_shell instead of calling this
1529function yourself.
1530
1531** The function scm_shell_usage prints a usage message appropriate for
1532an interpreter that uses scm_compile_shell_switches to handle its
1533command-line arguments.
1534
1535void scm_shell_usage (int FATAL, char *MESSAGE)
1536 Print a usage message to the standard error output. If MESSAGE is
1537 non-zero, write it before the usage message, followed by a newline.
1538 If FATAL is non-zero, exit the process, using FATAL as the
1539 termination status. (If you want to be compatible with Guile,
1540 always use 1 as the exit status when terminating due to command-line
1541 usage problems.)
1542
1543You will usually want to use scm_shell instead of calling this
1544function yourself.
48d224d7
JB
1545
1546** scm_eval_0str now returns SCM_UNSPECIFIED if the string contains no
095936d2
JB
1547expressions. It used to return SCM_EOL. Earth-shattering.
1548
1549** The macros for declaring scheme objects in C code have been
1550rearranged slightly. They are now:
1551
1552SCM_SYMBOL (C_NAME, SCHEME_NAME)
1553 Declare a static SCM variable named C_NAME, and initialize it to
1554 point to the Scheme symbol whose name is SCHEME_NAME. C_NAME should
1555 be a C identifier, and SCHEME_NAME should be a C string.
1556
1557SCM_GLOBAL_SYMBOL (C_NAME, SCHEME_NAME)
1558 Just like SCM_SYMBOL, but make C_NAME globally visible.
1559
1560SCM_VCELL (C_NAME, SCHEME_NAME)
1561 Create a global variable at the Scheme level named SCHEME_NAME.
1562 Declare a static SCM variable named C_NAME, and initialize it to
1563 point to the Scheme variable's value cell.
1564
1565SCM_GLOBAL_VCELL (C_NAME, SCHEME_NAME)
1566 Just like SCM_VCELL, but make C_NAME globally visible.
1567
1568The `guile-snarf' script writes initialization code for these macros
1569to its standard output, given C source code as input.
1570
1571The SCM_GLOBAL macro is gone.
1572
1573** The scm_read_line and scm_read_line_x functions have been replaced
1574by Scheme code based on the %read-delimited! procedure (known to C
1575code as scm_read_delimited_x). See its description above for more
1576information.
48d224d7 1577
095936d2
JB
1578** The function scm_sys_open has been renamed to scm_open. It now
1579returns a port instead of an FD object.
ea00ecba 1580
095936d2
JB
1581* The dynamic linking support has changed. For more information, see
1582libguile/DYNAMIC-LINKING.
ea00ecba 1583
f7b47737
JB
1584\f
1585Guile 1.0b3
3065a62a 1586
f3b1485f
JB
1587User-visible changes from Thursday, September 5, 1996 until Guile 1.0
1588(Sun 5 Jan 1997):
3065a62a 1589
4b521edb 1590* Changes to the 'guile' program:
3065a62a 1591
4b521edb
JB
1592** Guile now loads some new files when it starts up. Guile first
1593searches the load path for init.scm, and loads it if found. Then, if
1594Guile is not being used to execute a script, and the user's home
1595directory contains a file named `.guile', Guile loads that.
c6486f8a 1596
4b521edb 1597** You can now use Guile as a shell script interpreter.
3065a62a
JB
1598
1599To paraphrase the SCSH manual:
1600
1601 When Unix tries to execute an executable file whose first two
1602 characters are the `#!', it treats the file not as machine code to
1603 be directly executed by the native processor, but as source code
1604 to be executed by some interpreter. The interpreter to use is
1605 specified immediately after the #! sequence on the first line of
1606 the source file. The kernel reads in the name of the interpreter,
1607 and executes that instead. It passes the interpreter the source
1608 filename as its first argument, with the original arguments
1609 following. Consult the Unix man page for the `exec' system call
1610 for more information.
1611
1a1945be
JB
1612Now you can use Guile as an interpreter, using a mechanism which is a
1613compatible subset of that provided by SCSH.
1614
3065a62a
JB
1615Guile now recognizes a '-s' command line switch, whose argument is the
1616name of a file of Scheme code to load. It also treats the two
1617characters `#!' as the start of a comment, terminated by `!#'. Thus,
1618to make a file of Scheme code directly executable by Unix, insert the
1619following two lines at the top of the file:
1620
1621#!/usr/local/bin/guile -s
1622!#
1623
1624Guile treats the argument of the `-s' command-line switch as the name
1625of a file of Scheme code to load, and treats the sequence `#!' as the
1626start of a block comment, terminated by `!#'.
1627
1628For example, here's a version of 'echo' written in Scheme:
1629
1630#!/usr/local/bin/guile -s
1631!#
1632(let loop ((args (cdr (program-arguments))))
1633 (if (pair? args)
1634 (begin
1635 (display (car args))
1636 (if (pair? (cdr args))
1637 (display " "))
1638 (loop (cdr args)))))
1639(newline)
1640
1641Why does `#!' start a block comment terminated by `!#', instead of the
1642end of the line? That is the notation SCSH uses, and although we
1643don't yet support the other SCSH features that motivate that choice,
1644we would like to be backward-compatible with any existing Guile
3763761c
JB
1645scripts once we do. Furthermore, if the path to Guile on your system
1646is too long for your kernel, you can start the script with this
1647horrible hack:
1648
1649#!/bin/sh
1650exec /really/long/path/to/guile -s "$0" ${1+"$@"}
1651!#
3065a62a
JB
1652
1653Note that some very old Unix systems don't support the `#!' syntax.
1654
c6486f8a 1655
4b521edb 1656** You can now run Guile without installing it.
6685dc83
JB
1657
1658Previous versions of the interactive Guile interpreter (`guile')
1659couldn't start up unless Guile's Scheme library had been installed;
1660they used the value of the environment variable `SCHEME_LOAD_PATH'
1661later on in the startup process, but not to find the startup code
1662itself. Now Guile uses `SCHEME_LOAD_PATH' in all searches for Scheme
1663code.
1664
1665To run Guile without installing it, build it in the normal way, and
1666then set the environment variable `SCHEME_LOAD_PATH' to a
1667colon-separated list of directories, including the top-level directory
1668of the Guile sources. For example, if you unpacked Guile so that the
1669full filename of this NEWS file is /home/jimb/guile-1.0b3/NEWS, then
1670you might say
1671
1672 export SCHEME_LOAD_PATH=/home/jimb/my-scheme:/home/jimb/guile-1.0b3
1673
c6486f8a 1674
4b521edb
JB
1675** Guile's read-eval-print loop no longer prints #<unspecified>
1676results. If the user wants to see this, she can evaluate the
1677expression (assert-repl-print-unspecified #t), perhaps in her startup
48d224d7 1678file.
6685dc83 1679
4b521edb
JB
1680** Guile no longer shows backtraces by default when an error occurs;
1681however, it does display a message saying how to get one, and how to
1682request that they be displayed by default. After an error, evaluate
1683 (backtrace)
1684to see a backtrace, and
1685 (debug-enable 'backtrace)
1686to see them by default.
6685dc83 1687
6685dc83 1688
d9fb83d9 1689
4b521edb
JB
1690* Changes to Guile Scheme:
1691
1692** Guile now distinguishes between #f and the empty list.
1693
1694This is for compatibility with the IEEE standard, the (possibly)
1695upcoming Revised^5 Report on Scheme, and many extant Scheme
1696implementations.
1697
1698Guile used to have #f and '() denote the same object, to make Scheme's
1699type system more compatible with Emacs Lisp's. However, the change
1700caused too much trouble for Scheme programmers, and we found another
1701way to reconcile Emacs Lisp with Scheme that didn't require this.
1702
1703
1704** Guile's delq, delv, delete functions, and their destructive
c6486f8a
JB
1705counterparts, delq!, delv!, and delete!, now remove all matching
1706elements from the list, not just the first. This matches the behavior
1707of the corresponding Emacs Lisp functions, and (I believe) the Maclisp
1708functions which inspired them.
1709
1710I recognize that this change may break code in subtle ways, but it
1711seems best to make the change before the FSF's first Guile release,
1712rather than after.
1713
1714
4b521edb 1715** The compiled-library-path function has been deleted from libguile.
6685dc83 1716
4b521edb 1717** The facilities for loading Scheme source files have changed.
c6486f8a 1718
4b521edb 1719*** The variable %load-path now tells Guile which directories to search
6685dc83
JB
1720for Scheme code. Its value is a list of strings, each of which names
1721a directory.
1722
4b521edb
JB
1723*** The variable %load-extensions now tells Guile which extensions to
1724try appending to a filename when searching the load path. Its value
1725is a list of strings. Its default value is ("" ".scm").
1726
1727*** (%search-load-path FILENAME) searches the directories listed in the
1728value of the %load-path variable for a Scheme file named FILENAME,
1729with all the extensions listed in %load-extensions. If it finds a
1730match, then it returns its full filename. If FILENAME is absolute, it
1731returns it unchanged. Otherwise, it returns #f.
6685dc83 1732
4b521edb
JB
1733%search-load-path will not return matches that refer to directories.
1734
1735*** (primitive-load FILENAME :optional CASE-INSENSITIVE-P SHARP)
1736uses %seach-load-path to find a file named FILENAME, and loads it if
1737it finds it. If it can't read FILENAME for any reason, it throws an
1738error.
6685dc83
JB
1739
1740The arguments CASE-INSENSITIVE-P and SHARP are interpreted as by the
4b521edb
JB
1741`read' function.
1742
1743*** load uses the same searching semantics as primitive-load.
1744
1745*** The functions %try-load, try-load-with-path, %load, load-with-path,
1746basic-try-load-with-path, basic-load-with-path, try-load-module-with-
1747path, and load-module-with-path have been deleted. The functions
1748above should serve their purposes.
1749
1750*** If the value of the variable %load-hook is a procedure,
1751`primitive-load' applies its value to the name of the file being
1752loaded (without the load path directory name prepended). If its value
1753is #f, it is ignored. Otherwise, an error occurs.
1754
1755This is mostly useful for printing load notification messages.
1756
1757
1758** The function `eval!' is no longer accessible from the scheme level.
1759We can't allow operations which introduce glocs into the scheme level,
1760because Guile's type system can't handle these as data. Use `eval' or
1761`read-and-eval!' (see below) as replacement.
1762
1763** The new function read-and-eval! reads an expression from PORT,
1764evaluates it, and returns the result. This is more efficient than
1765simply calling `read' and `eval', since it is not necessary to make a
1766copy of the expression for the evaluator to munge.
1767
1768Its optional arguments CASE_INSENSITIVE_P and SHARP are interpreted as
1769for the `read' function.
1770
1771
1772** The function `int?' has been removed; its definition was identical
1773to that of `integer?'.
1774
1775** The functions `<?', `<?', `<=?', `=?', `>?', and `>=?'. Code should
1776use the R4RS names for these functions.
1777
1778** The function object-properties no longer returns the hash handle;
1779it simply returns the object's property list.
1780
1781** Many functions have been changed to throw errors, instead of
1782returning #f on failure. The point of providing exception handling in
1783the language is to simplify the logic of user code, but this is less
1784useful if Guile's primitives don't throw exceptions.
1785
1786** The function `fileno' has been renamed from `%fileno'.
1787
1788** The function primitive-mode->fdes returns #t or #f now, not 1 or 0.
1789
1790
1791* Changes to Guile's C interface:
1792
1793** The library's initialization procedure has been simplified.
1794scm_boot_guile now has the prototype:
1795
1796void scm_boot_guile (int ARGC,
1797 char **ARGV,
1798 void (*main_func) (),
1799 void *closure);
1800
1801scm_boot_guile calls MAIN_FUNC, passing it CLOSURE, ARGC, and ARGV.
1802MAIN_FUNC should do all the work of the program (initializing other
1803packages, reading user input, etc.) before returning. When MAIN_FUNC
1804returns, call exit (0); this function never returns. If you want some
1805other exit value, MAIN_FUNC may call exit itself.
1806
1807scm_boot_guile arranges for program-arguments to return the strings
1808given by ARGC and ARGV. If MAIN_FUNC modifies ARGC/ARGV, should call
1809scm_set_program_arguments with the final list, so Scheme code will
1810know which arguments have been processed.
1811
1812scm_boot_guile establishes a catch-all catch handler which prints an
1813error message and exits the process. This means that Guile exits in a
1814coherent way when system errors occur and the user isn't prepared to
1815handle it. If the user doesn't like this behavior, they can establish
1816their own universal catcher in MAIN_FUNC to shadow this one.
1817
1818Why must the caller do all the real work from MAIN_FUNC? The garbage
1819collector assumes that all local variables of type SCM will be above
1820scm_boot_guile's stack frame on the stack. If you try to manipulate
1821SCM values after this function returns, it's the luck of the draw
1822whether the GC will be able to find the objects you allocate. So,
1823scm_boot_guile function exits, rather than returning, to discourage
1824people from making that mistake.
1825
1826The IN, OUT, and ERR arguments were removed; there are other
1827convenient ways to override these when desired.
1828
1829The RESULT argument was deleted; this function should never return.
1830
1831The BOOT_CMD argument was deleted; the MAIN_FUNC argument is more
1832general.
1833
1834
1835** Guile's header files should no longer conflict with your system's
1836header files.
1837
1838In order to compile code which #included <libguile.h>, previous
1839versions of Guile required you to add a directory containing all the
1840Guile header files to your #include path. This was a problem, since
1841Guile's header files have names which conflict with many systems'
1842header files.
1843
1844Now only <libguile.h> need appear in your #include path; you must
1845refer to all Guile's other header files as <libguile/mumble.h>.
1846Guile's installation procedure puts libguile.h in $(includedir), and
1847the rest in $(includedir)/libguile.
1848
1849
1850** Two new C functions, scm_protect_object and scm_unprotect_object,
1851have been added to the Guile library.
1852
1853scm_protect_object (OBJ) protects OBJ from the garbage collector.
1854OBJ will not be freed, even if all other references are dropped,
1855until someone does scm_unprotect_object (OBJ). Both functions
1856return OBJ.
1857
1858Note that calls to scm_protect_object do not nest. You can call
1859scm_protect_object any number of times on a given object, and the
1860next call to scm_unprotect_object will unprotect it completely.
1861
1862Basically, scm_protect_object and scm_unprotect_object just
1863maintain a list of references to things. Since the GC knows about
1864this list, all objects it mentions stay alive. scm_protect_object
1865adds its argument to the list; scm_unprotect_object remove its
1866argument from the list.
1867
1868
1869** scm_eval_0str now returns the value of the last expression
1870evaluated.
1871
1872** The new function scm_read_0str reads an s-expression from a
1873null-terminated string, and returns it.
1874
1875** The new function `scm_stdio_to_port' converts a STDIO file pointer
1876to a Scheme port object.
1877
1878** The new function `scm_set_program_arguments' allows C code to set
1879the value teruturned by the Scheme `program-arguments' function.
6685dc83 1880
6685dc83 1881\f
1a1945be
JB
1882Older changes:
1883
1884* Guile no longer includes sophisticated Tcl/Tk support.
1885
1886The old Tcl/Tk support was unsatisfying to us, because it required the
1887user to link against the Tcl library, as well as Tk and Guile. The
1888interface was also un-lispy, in that it preserved Tcl/Tk's practice of
1889referring to widgets by names, rather than exporting widgets to Scheme
1890code as a special datatype.
1891
1892In the Usenix Tk Developer's Workshop held in July 1996, the Tcl/Tk
1893maintainers described some very interesting changes in progress to the
1894Tcl/Tk internals, which would facilitate clean interfaces between lone
1895Tk and other interpreters --- even for garbage-collected languages
1896like Scheme. They expected the new Tk to be publicly available in the
1897fall of 1996.
1898
1899Since it seems that Guile might soon have a new, cleaner interface to
1900lone Tk, and that the old Guile/Tk glue code would probably need to be
1901completely rewritten, we (Jim Blandy and Richard Stallman) have
1902decided not to support the old code. We'll spend the time instead on
1903a good interface to the newer Tk, as soon as it is available.
5c54da76 1904
8512dea6 1905Until then, gtcltk-lib provides trivial, low-maintenance functionality.
deb95d71 1906
5c54da76
JB
1907\f
1908Copyright information:
1909
ea00ecba 1910Copyright (C) 1996,1997 Free Software Foundation, Inc.
5c54da76
JB
1911
1912 Permission is granted to anyone to make or distribute verbatim copies
1913 of this document as received, in any medium, provided that the
1914 copyright notice and this permission notice are preserved,
1915 thus giving the recipient permission to redistribute in turn.
1916
1917 Permission is granted to distribute modified versions
1918 of this document, or of portions of it,
1919 under the above conditions, provided also that they
1920 carry prominent notices stating who last changed them.
1921
48d224d7
JB
1922\f
1923Local variables:
1924mode: outline
1925paragraph-separate: "[ \f]*$"
1926end:
1927