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