| 1 | Guile NEWS --- history of user-visible changes. -*- text -*- |
| 2 | Copyright (C) 1996, 1997 Free Software Foundation, Inc. |
| 3 | See the end for copying conditions. |
| 4 | |
| 5 | Please send Guile bug reports to bug-guile@prep.ai.mit.edu. |
| 6 | \f |
| 7 | Changes in Guile 1.2: |
| 8 | |
| 9 | [[trim out any sections we don't need]] |
| 10 | |
| 11 | * Changes to the distribution |
| 12 | |
| 13 | * Changes to the procedure for linking libguile with your programs |
| 14 | |
| 15 | * Changes to Scheme functions |
| 16 | |
| 17 | ** Guile has regular expression support again. Guile 1.0 included |
| 18 | functions for matching regular expressions, based on the Rx library. |
| 19 | In Guile 1.1, the Guile/Rx interface was removed to simplify the |
| 20 | distribution, and thus Guile had no regular expression support. Guile |
| 21 | 1.2 now adds back the most commonly used functions, and supports all |
| 22 | of SCSH's regular expression functions. They are: |
| 23 | |
| 24 | *** [[get docs from Tim?]] |
| 25 | |
| 26 | * Changes to the gh_ interface |
| 27 | |
| 28 | * Changes to the scm_ interface |
| 29 | |
| 30 | \f |
| 31 | Changes in Guile 1.1 (Fri May 16 1997): |
| 32 | |
| 33 | * Changes to the distribution. |
| 34 | |
| 35 | The Guile 1.0 distribution has been split up into several smaller |
| 36 | pieces: |
| 37 | guile-core --- the Guile interpreter itself. |
| 38 | guile-tcltk --- the interface between the Guile interpreter and |
| 39 | Tcl/Tk; Tcl is an interpreter for a stringy language, and Tk |
| 40 | is a toolkit for building graphical user interfaces. |
| 41 | guile-rgx-ctax --- the interface between Guile and the Rx regular |
| 42 | expression matcher, and the translator for the Ctax |
| 43 | programming language. These are packaged together because the |
| 44 | Ctax translator uses Rx to parse Ctax source code. |
| 45 | |
| 46 | This NEWS file describes the changes made to guile-core since the 1.0 |
| 47 | release. |
| 48 | |
| 49 | We no longer distribute the documentation, since it was either out of |
| 50 | date, or incomplete. As soon as we have current documentation, we |
| 51 | will distribute it. |
| 52 | |
| 53 | * Changes to the stand-alone interpreter |
| 54 | |
| 55 | ** guile now accepts command-line arguments compatible with SCSH, Olin |
| 56 | Shivers' Scheme Shell. |
| 57 | |
| 58 | In general, arguments are evaluated from left to right, but there are |
| 59 | exceptions. The following switches stop argument processing, and |
| 60 | stash all remaining command-line arguments as the value returned by |
| 61 | the (command-line) function. |
| 62 | -s SCRIPT load Scheme source code from FILE, and exit |
| 63 | -c EXPR evalute Scheme expression EXPR, and exit |
| 64 | -- stop scanning arguments; run interactively |
| 65 | |
| 66 | The switches below are processed as they are encountered. |
| 67 | -l FILE load Scheme source code from FILE |
| 68 | -e FUNCTION after reading script, apply FUNCTION to |
| 69 | command line arguments |
| 70 | -ds do -s script at this point |
| 71 | --emacs enable Emacs protocol (experimental) |
| 72 | -h, --help display this help and exit |
| 73 | -v, --version display version information and exit |
| 74 | \ read arguments from following script lines |
| 75 | |
| 76 | So, for example, here is a Guile script named `ekko' (thanks, Olin) |
| 77 | which re-implements the traditional "echo" command: |
| 78 | |
| 79 | #!/usr/local/bin/guile -s |
| 80 | !# |
| 81 | (define (main args) |
| 82 | (map (lambda (arg) (display arg) (display " ")) |
| 83 | (cdr args)) |
| 84 | (newline)) |
| 85 | |
| 86 | (main (command-line)) |
| 87 | |
| 88 | Suppose we invoke this script as follows: |
| 89 | |
| 90 | ekko a speckled gecko |
| 91 | |
| 92 | Through the magic of Unix script processing (triggered by the `#!' |
| 93 | token at the top of the file), /usr/local/bin/guile receives the |
| 94 | following list of command-line arguments: |
| 95 | |
| 96 | ("-s" "./ekko" "a" "speckled" "gecko") |
| 97 | |
| 98 | Unix inserts the name of the script after the argument specified on |
| 99 | the first line of the file (in this case, "-s"), and then follows that |
| 100 | with the arguments given to the script. Guile loads the script, which |
| 101 | defines the `main' function, and then applies it to the list of |
| 102 | remaining command-line arguments, ("a" "speckled" "gecko"). |
| 103 | |
| 104 | In Unix, the first line of a script file must take the following form: |
| 105 | |
| 106 | #!INTERPRETER ARGUMENT |
| 107 | |
| 108 | where INTERPRETER is the absolute filename of the interpreter |
| 109 | executable, and ARGUMENT is a single command-line argument to pass to |
| 110 | the interpreter. |
| 111 | |
| 112 | You may only pass one argument to the interpreter, and its length is |
| 113 | limited. These restrictions can be annoying to work around, so Guile |
| 114 | provides a general mechanism (borrowed from, and compatible with, |
| 115 | SCSH) for circumventing them. |
| 116 | |
| 117 | If the ARGUMENT in a Guile script is a single backslash character, |
| 118 | `\', Guile will open the script file, parse arguments from its second |
| 119 | and subsequent lines, and replace the `\' with them. So, for example, |
| 120 | here is another implementation of the `ekko' script: |
| 121 | |
| 122 | #!/usr/local/bin/guile \ |
| 123 | -e main -s |
| 124 | !# |
| 125 | (define (main args) |
| 126 | (for-each (lambda (arg) (display arg) (display " ")) |
| 127 | (cdr args)) |
| 128 | (newline)) |
| 129 | |
| 130 | If the user invokes this script as follows: |
| 131 | |
| 132 | ekko a speckled gecko |
| 133 | |
| 134 | Unix expands this into |
| 135 | |
| 136 | /usr/local/bin/guile \ ekko a speckled gecko |
| 137 | |
| 138 | When Guile sees the `\' argument, it replaces it with the arguments |
| 139 | read from the second line of the script, producing: |
| 140 | |
| 141 | /usr/local/bin/guile -e main -s ekko a speckled gecko |
| 142 | |
| 143 | This tells Guile to load the `ekko' script, and apply the function |
| 144 | `main' to the argument list ("a" "speckled" "gecko"). |
| 145 | |
| 146 | Here is how Guile parses the command-line arguments: |
| 147 | - Each space character terminates an argument. This means that two |
| 148 | spaces in a row introduce an empty-string argument. |
| 149 | - The tab character is not permitted (unless you quote it with the |
| 150 | backslash character, as described below), to avoid confusion. |
| 151 | - The newline character terminates the sequence of arguments, and will |
| 152 | also terminate a final non-empty argument. (However, a newline |
| 153 | following a space will not introduce a final empty-string argument; |
| 154 | it only terminates the argument list.) |
| 155 | - The backslash character is the escape character. It escapes |
| 156 | backslash, space, tab, and newline. The ANSI C escape sequences |
| 157 | like \n and \t are also supported. These produce argument |
| 158 | constituents; the two-character combination \n doesn't act like a |
| 159 | terminating newline. The escape sequence \NNN for exactly three |
| 160 | octal digits reads as the character whose ASCII code is NNN. As |
| 161 | above, characters produced this way are argument constituents. |
| 162 | Backslash followed by other characters is not allowed. |
| 163 | |
| 164 | * Changes to the procedure for linking libguile with your programs |
| 165 | |
| 166 | ** Guile now builds and installs a shared guile library, if your |
| 167 | system support shared libraries. (It still builds a static library on |
| 168 | all systems.) Guile automatically detects whether your system |
| 169 | supports shared libraries. To prevent Guile from buildisg shared |
| 170 | libraries, pass the `--disable-shared' flag to the configure script. |
| 171 | |
| 172 | Guile takes longer to compile when it builds shared libraries, because |
| 173 | it must compile every file twice --- once to produce position- |
| 174 | independent object code, and once to produce normal object code. |
| 175 | |
| 176 | ** The libthreads library has been merged into libguile. |
| 177 | |
| 178 | To link a program against Guile, you now need only link against |
| 179 | -lguile and -lqt; -lthreads is no longer needed. If you are using |
| 180 | autoconf to generate configuration scripts for your application, the |
| 181 | following lines should suffice to add the appropriate libraries to |
| 182 | your link command: |
| 183 | |
| 184 | ### Find quickthreads and libguile. |
| 185 | AC_CHECK_LIB(qt, main) |
| 186 | AC_CHECK_LIB(guile, scm_shell) |
| 187 | |
| 188 | * Changes to Scheme functions |
| 189 | |
| 190 | ** Guile Scheme's special syntax for keyword objects is now optional, |
| 191 | and disabled by default. |
| 192 | |
| 193 | The syntax variation from R4RS made it difficult to port some |
| 194 | interesting packages to Guile. The routines which accepted keyword |
| 195 | arguments (mostly in the module system) have been modified to also |
| 196 | accept symbols whose names begin with `:'. |
| 197 | |
| 198 | To change the keyword syntax, you must first import the (ice-9 debug) |
| 199 | module: |
| 200 | (use-modules (ice-9 debug)) |
| 201 | |
| 202 | Then you can enable the keyword syntax as follows: |
| 203 | (read-set! keywords 'prefix) |
| 204 | |
| 205 | To disable keyword syntax, do this: |
| 206 | (read-set! keywords #f) |
| 207 | |
| 208 | ** Many more primitive functions accept shared substrings as |
| 209 | arguments. In the past, these functions required normal, mutable |
| 210 | strings as arguments, although they never made use of this |
| 211 | restriction. |
| 212 | |
| 213 | ** The uniform array functions now operate on byte vectors. These |
| 214 | functions are `array-fill!', `serial-array-copy!', `array-copy!', |
| 215 | `serial-array-map', `array-map', `array-for-each', and |
| 216 | `array-index-map!'. |
| 217 | |
| 218 | ** The new functions `trace' and `untrace' implement simple debugging |
| 219 | support for Scheme functions. |
| 220 | |
| 221 | The `trace' function accepts any number of procedures as arguments, |
| 222 | and tells the Guile interpreter to display each procedure's name and |
| 223 | arguments each time the procedure is invoked. When invoked with no |
| 224 | arguments, `trace' returns the list of procedures currently being |
| 225 | traced. |
| 226 | |
| 227 | The `untrace' function accepts any number of procedures as arguments, |
| 228 | and tells the Guile interpreter not to trace them any more. When |
| 229 | invoked with no arguments, `untrace' untraces all curretly traced |
| 230 | procedures. |
| 231 | |
| 232 | The tracing in Guile has an advantage over most other systems: we |
| 233 | don't create new procedure objects, but mark the procedure objects |
| 234 | themselves. This means that anonymous and internal procedures can be |
| 235 | traced. |
| 236 | |
| 237 | ** The function `assert-repl-prompt' has been renamed to |
| 238 | `set-repl-prompt!'. It takes one argument, PROMPT. |
| 239 | - If PROMPT is #f, the Guile read-eval-print loop will not prompt. |
| 240 | - If PROMPT is a string, we use it as a prompt. |
| 241 | - If PROMPT is a procedure accepting no arguments, we call it, and |
| 242 | display the result as a prompt. |
| 243 | - Otherwise, we display "> ". |
| 244 | |
| 245 | ** The new function `eval-string' reads Scheme expressions from a |
| 246 | string and evaluates them, returning the value of the last expression |
| 247 | in the string. If the string contains no expressions, it returns an |
| 248 | unspecified value. |
| 249 | |
| 250 | ** The new function `thunk?' returns true iff its argument is a |
| 251 | procedure of zero arguments. |
| 252 | |
| 253 | ** `defined?' is now a builtin function, instead of syntax. This |
| 254 | means that its argument should be quoted. It returns #t iff its |
| 255 | argument is bound in the current module. |
| 256 | |
| 257 | ** The new syntax `use-modules' allows you to add new modules to your |
| 258 | environment without re-typing a complete `define-module' form. It |
| 259 | accepts any number of module names as arguments, and imports their |
| 260 | public bindings into the current module. |
| 261 | |
| 262 | ** The new function (module-defined? NAME MODULE) returns true iff |
| 263 | NAME, a symbol, is defined in MODULE, a module object. |
| 264 | |
| 265 | ** The new function `builtin-bindings' creates and returns a hash |
| 266 | table containing copies of all the root module's bindings. |
| 267 | |
| 268 | ** The new function `builtin-weak-bindings' does the same as |
| 269 | `builtin-bindings', but creates a doubly-weak hash table. |
| 270 | |
| 271 | ** The `equal?' function now considers variable objects to be |
| 272 | equivalent if they have the same name and the same value. |
| 273 | |
| 274 | ** The new function `command-line' returns the command-line arguments |
| 275 | given to Guile, as a list of strings. |
| 276 | |
| 277 | When using guile as a script interpreter, `command-line' returns the |
| 278 | script's arguments; those processed by the interpreter (like `-s' or |
| 279 | `-c') are omitted. (In other words, you get the normal, expected |
| 280 | behavior.) Any application that uses scm_shell to process its |
| 281 | command-line arguments gets this behavior as well. |
| 282 | |
| 283 | ** The new function `load-user-init' looks for a file called `.guile' |
| 284 | in the user's home directory, and loads it if it exists. This is |
| 285 | mostly for use by the code generated by scm_compile_shell_switches, |
| 286 | but we thought it might also be useful in other circumstances. |
| 287 | |
| 288 | ** The new function `log10' returns the base-10 logarithm of its |
| 289 | argument. |
| 290 | |
| 291 | ** Changes to I/O functions |
| 292 | |
| 293 | *** The functions `read', `primitive-load', `read-and-eval!', and |
| 294 | `primitive-load-path' no longer take optional arguments controlling |
| 295 | case insensitivity and a `#' parser. |
| 296 | |
| 297 | Case sensitivity is now controlled by a read option called |
| 298 | `case-insensitive'. The user can add new `#' syntaxes with the |
| 299 | `read-hash-extend' function (see below). |
| 300 | |
| 301 | *** The new function `read-hash-extend' allows the user to change the |
| 302 | syntax of Guile Scheme in a somewhat controlled way. |
| 303 | |
| 304 | (read-hash-extend CHAR PROC) |
| 305 | When parsing S-expressions, if we read a `#' character followed by |
| 306 | the character CHAR, use PROC to parse an object from the stream. |
| 307 | If PROC is #f, remove any parsing procedure registered for CHAR. |
| 308 | |
| 309 | The reader applies PROC to two arguments: CHAR and an input port. |
| 310 | |
| 311 | *** The new functions read-delimited and read-delimited! provide a |
| 312 | general mechanism for doing delimited input on streams. |
| 313 | |
| 314 | (read-delimited DELIMS [PORT HANDLE-DELIM]) |
| 315 | Read until we encounter one of the characters in DELIMS (a string), |
| 316 | or end-of-file. PORT is the input port to read from; it defaults to |
| 317 | the current input port. The HANDLE-DELIM parameter determines how |
| 318 | the terminating character is handled; it should be one of the |
| 319 | following symbols: |
| 320 | |
| 321 | 'trim omit delimiter from result |
| 322 | 'peek leave delimiter character in input stream |
| 323 | 'concat append delimiter character to returned value |
| 324 | 'split return a pair: (RESULT . TERMINATOR) |
| 325 | |
| 326 | HANDLE-DELIM defaults to 'peek. |
| 327 | |
| 328 | (read-delimited! DELIMS BUF [PORT HANDLE-DELIM START END]) |
| 329 | A side-effecting variant of `read-delimited'. |
| 330 | |
| 331 | The data is written into the string BUF at the indices in the |
| 332 | half-open interval [START, END); the default interval is the whole |
| 333 | string: START = 0 and END = (string-length BUF). The values of |
| 334 | START and END must specify a well-defined interval in BUF, i.e. |
| 335 | 0 <= START <= END <= (string-length BUF). |
| 336 | |
| 337 | It returns NBYTES, the number of bytes read. If the buffer filled |
| 338 | up without a delimiter character being found, it returns #f. If the |
| 339 | port is at EOF when the read starts, it returns the EOF object. |
| 340 | |
| 341 | If an integer is returned (i.e., the read is successfully terminated |
| 342 | by reading a delimiter character), then the HANDLE-DELIM parameter |
| 343 | determines how to handle the terminating character. It is described |
| 344 | above, and defaults to 'peek. |
| 345 | |
| 346 | (The descriptions of these functions were borrowed from the SCSH |
| 347 | manual, by Olin Shivers and Brian Carlstrom.) |
| 348 | |
| 349 | *** The `%read-delimited!' function is the primitive used to implement |
| 350 | `read-delimited' and `read-delimited!'. |
| 351 | |
| 352 | (%read-delimited! DELIMS BUF GOBBLE? [PORT START END]) |
| 353 | |
| 354 | This returns a pair of values: (TERMINATOR . NUM-READ). |
| 355 | - TERMINATOR describes why the read was terminated. If it is a |
| 356 | character or the eof object, then that is the value that terminated |
| 357 | the read. If it is #f, the function filled the buffer without finding |
| 358 | a delimiting character. |
| 359 | - NUM-READ is the number of characters read into BUF. |
| 360 | |
| 361 | If the read is successfully terminated by reading a delimiter |
| 362 | character, then the gobble? parameter determines what to do with the |
| 363 | terminating character. If true, the character is removed from the |
| 364 | input stream; if false, the character is left in the input stream |
| 365 | where a subsequent read operation will retrieve it. In either case, |
| 366 | the character is also the first value returned by the procedure call. |
| 367 | |
| 368 | (The descriptions of this function was borrowed from the SCSH manual, |
| 369 | by Olin Shivers and Brian Carlstrom.) |
| 370 | |
| 371 | *** The `read-line' and `read-line!' functions have changed; they now |
| 372 | trim the terminator by default; previously they appended it to the |
| 373 | returned string. For the old behavior, use (read-line PORT 'concat). |
| 374 | |
| 375 | *** The functions `uniform-array-read!' and `uniform-array-write!' now |
| 376 | take new optional START and END arguments, specifying the region of |
| 377 | the array to read and write. |
| 378 | |
| 379 | *** The `ungetc-char-ready?' function has been removed. We feel it's |
| 380 | inappropriate for an interface to expose implementation details this |
| 381 | way. |
| 382 | |
| 383 | ** Changes to the Unix library and system call interface |
| 384 | |
| 385 | *** The new fcntl function provides access to the Unix `fcntl' system |
| 386 | call. |
| 387 | |
| 388 | (fcntl PORT COMMAND VALUE) |
| 389 | Apply COMMAND to PORT's file descriptor, with VALUE as an argument. |
| 390 | Values for COMMAND are: |
| 391 | |
| 392 | F_DUPFD duplicate a file descriptor |
| 393 | F_GETFD read the descriptor's close-on-exec flag |
| 394 | F_SETFD set the descriptor's close-on-exec flag to VALUE |
| 395 | F_GETFL read the descriptor's flags, as set on open |
| 396 | F_SETFL set the descriptor's flags, as set on open to VALUE |
| 397 | F_GETOWN return the process ID of a socket's owner, for SIGIO |
| 398 | F_SETOWN set the process that owns a socket to VALUE, for SIGIO |
| 399 | FD_CLOEXEC not sure what this is |
| 400 | |
| 401 | For details, see the documentation for the fcntl system call. |
| 402 | |
| 403 | *** The arguments to `select' have changed, for compatibility with |
| 404 | SCSH. The TIMEOUT parameter may now be non-integral, yielding the |
| 405 | expected behavior. The MILLISECONDS parameter has been changed to |
| 406 | MICROSECONDS, to more closely resemble the underlying system call. |
| 407 | The RVEC, WVEC, and EVEC arguments can now be vectors; the type of the |
| 408 | corresponding return set will be the same. |
| 409 | |
| 410 | *** The arguments to the `mknod' system call have changed. They are |
| 411 | now: |
| 412 | |
| 413 | (mknod PATH TYPE PERMS DEV) |
| 414 | Create a new file (`node') in the file system. PATH is the name of |
| 415 | the file to create. TYPE is the kind of file to create; it should |
| 416 | be 'fifo, 'block-special, or 'char-special. PERMS specifies the |
| 417 | permission bits to give the newly created file. If TYPE is |
| 418 | 'block-special or 'char-special, DEV specifies which device the |
| 419 | special file refers to; its interpretation depends on the kind of |
| 420 | special file being created. |
| 421 | |
| 422 | *** The `fork' function has been renamed to `primitive-fork', to avoid |
| 423 | clashing with various SCSH forks. |
| 424 | |
| 425 | *** The `recv' and `recvfrom' functions have been renamed to `recv!' |
| 426 | and `recvfrom!'. They no longer accept a size for a second argument; |
| 427 | you must pass a string to hold the received value. They no longer |
| 428 | return the buffer. Instead, `recv' returns the length of the message |
| 429 | received, and `recvfrom' returns a pair containing the packet's length |
| 430 | and originating address. |
| 431 | |
| 432 | *** The file descriptor datatype has been removed, as have the |
| 433 | `read-fd', `write-fd', `close', `lseek', and `dup' functions. |
| 434 | We plan to replace these functions with a SCSH-compatible interface. |
| 435 | |
| 436 | *** The `create' function has been removed; it's just a special case |
| 437 | of `open'. |
| 438 | |
| 439 | *** There are new functions to break down process termination status |
| 440 | values. In the descriptions below, STATUS is a value returned by |
| 441 | `waitpid'. |
| 442 | |
| 443 | (status:exit-val STATUS) |
| 444 | If the child process exited normally, this function returns the exit |
| 445 | code for the child process (i.e., the value passed to exit, or |
| 446 | returned from main). If the child process did not exit normally, |
| 447 | this function returns #f. |
| 448 | |
| 449 | (status:stop-sig STATUS) |
| 450 | If the child process was suspended by a signal, this function |
| 451 | returns the signal that suspended the child. Otherwise, it returns |
| 452 | #f. |
| 453 | |
| 454 | (status:term-sig STATUS) |
| 455 | If the child process terminated abnormally, this function returns |
| 456 | the signal that terminated the child. Otherwise, this function |
| 457 | returns false. |
| 458 | |
| 459 | POSIX promises that exactly one of these functions will return true on |
| 460 | a valid STATUS value. |
| 461 | |
| 462 | These functions are compatible with SCSH. |
| 463 | |
| 464 | *** There are new accessors and setters for the broken-out time vectors |
| 465 | returned by `localtime', `gmtime', and that ilk. They are: |
| 466 | |
| 467 | Component Accessor Setter |
| 468 | ========================= ============ ============ |
| 469 | seconds tm:sec set-tm:sec |
| 470 | minutes tm:min set-tm:min |
| 471 | hours tm:hour set-tm:hour |
| 472 | day of the month tm:mday set-tm:mday |
| 473 | month tm:mon set-tm:mon |
| 474 | year tm:year set-tm:year |
| 475 | day of the week tm:wday set-tm:wday |
| 476 | day in the year tm:yday set-tm:yday |
| 477 | daylight saving time tm:isdst set-tm:isdst |
| 478 | GMT offset, seconds tm:gmtoff set-tm:gmtoff |
| 479 | name of time zone tm:zone set-tm:zone |
| 480 | |
| 481 | *** There are new accessors for the vectors returned by `uname', |
| 482 | describing the host system: |
| 483 | |
| 484 | Component Accessor |
| 485 | ============================================== ================ |
| 486 | name of the operating system implementation utsname:sysname |
| 487 | network name of this machine utsname:nodename |
| 488 | release level of the operating system utsname:release |
| 489 | version level of the operating system utsname:version |
| 490 | machine hardware platform utsname:machine |
| 491 | |
| 492 | *** There are new accessors for the vectors returned by `getpw', |
| 493 | `getpwnam', `getpwuid', and `getpwent', describing entries from the |
| 494 | system's user database: |
| 495 | |
| 496 | Component Accessor |
| 497 | ====================== ================= |
| 498 | user name passwd:name |
| 499 | user password passwd:passwd |
| 500 | user id passwd:uid |
| 501 | group id passwd:gid |
| 502 | real name passwd:gecos |
| 503 | home directory passwd:dir |
| 504 | shell program passwd:shell |
| 505 | |
| 506 | *** There are new accessors for the vectors returned by `getgr', |
| 507 | `getgrnam', `getgrgid', and `getgrent', describing entries from the |
| 508 | system's group database: |
| 509 | |
| 510 | Component Accessor |
| 511 | ======================= ============ |
| 512 | group name group:name |
| 513 | group password group:passwd |
| 514 | group id group:gid |
| 515 | group members group:mem |
| 516 | |
| 517 | *** There are new accessors for the vectors returned by `gethost', |
| 518 | `gethostbyaddr', `gethostbyname', and `gethostent', describing |
| 519 | internet hosts: |
| 520 | |
| 521 | Component Accessor |
| 522 | ========================= =============== |
| 523 | official name of host hostent:name |
| 524 | alias list hostent:aliases |
| 525 | host address type hostent:addrtype |
| 526 | length of address hostent:length |
| 527 | list of addresses hostent:addr-list |
| 528 | |
| 529 | *** There are new accessors for the vectors returned by `getnet', |
| 530 | `getnetbyaddr', `getnetbyname', and `getnetent', describing internet |
| 531 | networks: |
| 532 | |
| 533 | Component Accessor |
| 534 | ========================= =============== |
| 535 | official name of net netent:name |
| 536 | alias list netent:aliases |
| 537 | net number type netent:addrtype |
| 538 | net number netent:net |
| 539 | |
| 540 | *** There are new accessors for the vectors returned by `getproto', |
| 541 | `getprotobyname', `getprotobynumber', and `getprotoent', describing |
| 542 | internet protocols: |
| 543 | |
| 544 | Component Accessor |
| 545 | ========================= =============== |
| 546 | official protocol name protoent:name |
| 547 | alias list protoent:aliases |
| 548 | protocol number protoent:proto |
| 549 | |
| 550 | *** There are new accessors for the vectors returned by `getserv', |
| 551 | `getservbyname', `getservbyport', and `getservent', describing |
| 552 | internet protocols: |
| 553 | |
| 554 | Component Accessor |
| 555 | ========================= =============== |
| 556 | official service name servent:name |
| 557 | alias list servent:aliases |
| 558 | port number servent:port |
| 559 | protocol to use servent:proto |
| 560 | |
| 561 | *** There are new accessors for the sockaddr structures returned by |
| 562 | `accept', `getsockname', `getpeername', `recvfrom!': |
| 563 | |
| 564 | Component Accessor |
| 565 | ======================================== =============== |
| 566 | address format (`family') sockaddr:fam |
| 567 | path, for file domain addresses sockaddr:path |
| 568 | address, for internet domain addresses sockaddr:addr |
| 569 | TCP or UDP port, for internet sockaddr:port |
| 570 | |
| 571 | *** The `getpwent', `getgrent', `gethostent', `getnetent', |
| 572 | `getprotoent', and `getservent' functions now return #f at the end of |
| 573 | the user database. (They used to throw an exception.) |
| 574 | |
| 575 | Note that calling MUMBLEent function is equivalent to calling the |
| 576 | corresponding MUMBLE function with no arguments. |
| 577 | |
| 578 | *** The `setpwent', `setgrent', `sethostent', `setnetent', |
| 579 | `setprotoent', and `setservent' routines now take no arguments. |
| 580 | |
| 581 | *** The `gethost', `getproto', `getnet', and `getserv' functions now |
| 582 | provide more useful information when they throw an exception. |
| 583 | |
| 584 | *** The `lnaof' function has been renamed to `inet-lnaof'. |
| 585 | |
| 586 | *** Guile now claims to have the `current-time' feature. |
| 587 | |
| 588 | *** The `mktime' function now takes an optional second argument ZONE, |
| 589 | giving the time zone to use for the conversion. ZONE should be a |
| 590 | string, in the same format as expected for the "TZ" environment variable. |
| 591 | |
| 592 | *** The `strptime' function now returns a pair (TIME . COUNT), where |
| 593 | TIME is the parsed time as a vector, and COUNT is the number of |
| 594 | characters from the string left unparsed. This function used to |
| 595 | return the remaining characters as a string. |
| 596 | |
| 597 | *** The `gettimeofday' function has replaced the old `time+ticks' function. |
| 598 | The return value is now (SECONDS . MICROSECONDS); the fractional |
| 599 | component is no longer expressed in "ticks". |
| 600 | |
| 601 | *** The `ticks/sec' constant has been removed, in light of the above change. |
| 602 | |
| 603 | * Changes to the gh_ interface |
| 604 | |
| 605 | ** gh_eval_str() now returns an SCM object which is the result of the |
| 606 | evaluation |
| 607 | |
| 608 | ** gh_scm2str() now copies the Scheme data to a caller-provided C |
| 609 | array |
| 610 | |
| 611 | ** gh_scm2newstr() now makes a C array, copies the Scheme data to it, |
| 612 | and returns the array |
| 613 | |
| 614 | ** gh_scm2str0() is gone: there is no need to distinguish |
| 615 | null-terminated from non-null-terminated, since gh_scm2newstr() allows |
| 616 | the user to interpret the data both ways. |
| 617 | |
| 618 | * Changes to the scm_ interface |
| 619 | |
| 620 | ** The new function scm_symbol_value0 provides an easy way to get a |
| 621 | symbol's value from C code: |
| 622 | |
| 623 | SCM scm_symbol_value0 (char *NAME) |
| 624 | Return the value of the symbol named by the null-terminated string |
| 625 | NAME in the current module. If the symbol named NAME is unbound in |
| 626 | the current module, return SCM_UNDEFINED. |
| 627 | |
| 628 | ** The new function scm_sysintern0 creates new top-level variables, |
| 629 | without assigning them a value. |
| 630 | |
| 631 | SCM scm_sysintern0 (char *NAME) |
| 632 | Create a new Scheme top-level variable named NAME. NAME is a |
| 633 | null-terminated string. Return the variable's value cell. |
| 634 | |
| 635 | ** The function scm_internal_catch is the guts of catch. It handles |
| 636 | all the mechanics of setting up a catch target, invoking the catch |
| 637 | body, and perhaps invoking the handler if the body does a throw. |
| 638 | |
| 639 | The function is designed to be usable from C code, but is general |
| 640 | enough to implement all the semantics Guile Scheme expects from throw. |
| 641 | |
| 642 | TAG is the catch tag. Typically, this is a symbol, but this function |
| 643 | doesn't actually care about that. |
| 644 | |
| 645 | BODY is a pointer to a C function which runs the body of the catch; |
| 646 | this is the code you can throw from. We call it like this: |
| 647 | BODY (BODY_DATA, JMPBUF) |
| 648 | where: |
| 649 | BODY_DATA is just the BODY_DATA argument we received; we pass it |
| 650 | through to BODY as its first argument. The caller can make |
| 651 | BODY_DATA point to anything useful that BODY might need. |
| 652 | JMPBUF is the Scheme jmpbuf object corresponding to this catch, |
| 653 | which we have just created and initialized. |
| 654 | |
| 655 | HANDLER is a pointer to a C function to deal with a throw to TAG, |
| 656 | should one occur. We call it like this: |
| 657 | HANDLER (HANDLER_DATA, THROWN_TAG, THROW_ARGS) |
| 658 | where |
| 659 | HANDLER_DATA is the HANDLER_DATA argument we recevied; it's the |
| 660 | same idea as BODY_DATA above. |
| 661 | THROWN_TAG is the tag that the user threw to; usually this is |
| 662 | TAG, but it could be something else if TAG was #t (i.e., a |
| 663 | catch-all), or the user threw to a jmpbuf. |
| 664 | THROW_ARGS is the list of arguments the user passed to the THROW |
| 665 | function. |
| 666 | |
| 667 | BODY_DATA is just a pointer we pass through to BODY. HANDLER_DATA |
| 668 | is just a pointer we pass through to HANDLER. We don't actually |
| 669 | use either of those pointers otherwise ourselves. The idea is |
| 670 | that, if our caller wants to communicate something to BODY or |
| 671 | HANDLER, it can pass a pointer to it as MUMBLE_DATA, which BODY and |
| 672 | HANDLER can then use. Think of it as a way to make BODY and |
| 673 | HANDLER closures, not just functions; MUMBLE_DATA points to the |
| 674 | enclosed variables. |
| 675 | |
| 676 | Of course, it's up to the caller to make sure that any data a |
| 677 | MUMBLE_DATA needs is protected from GC. A common way to do this is |
| 678 | to make MUMBLE_DATA a pointer to data stored in an automatic |
| 679 | structure variable; since the collector must scan the stack for |
| 680 | references anyway, this assures that any references in MUMBLE_DATA |
| 681 | will be found. |
| 682 | |
| 683 | ** The new function scm_internal_lazy_catch is exactly like |
| 684 | scm_internal_catch, except: |
| 685 | |
| 686 | - It does not unwind the stack (this is the major difference). |
| 687 | - If handler returns, its value is returned from the throw. |
| 688 | - BODY always receives #f as its JMPBUF argument (since there's no |
| 689 | jmpbuf associated with a lazy catch, because we don't unwind the |
| 690 | stack.) |
| 691 | |
| 692 | ** scm_body_thunk is a new body function you can pass to |
| 693 | scm_internal_catch if you want the body to be like Scheme's `catch' |
| 694 | --- a thunk, or a function of one argument if the tag is #f. |
| 695 | |
| 696 | BODY_DATA is a pointer to a scm_body_thunk_data structure, which |
| 697 | contains the Scheme procedure to invoke as the body, and the tag |
| 698 | we're catching. If the tag is #f, then we pass JMPBUF (created by |
| 699 | scm_internal_catch) to the body procedure; otherwise, the body gets |
| 700 | no arguments. |
| 701 | |
| 702 | ** scm_handle_by_proc is a new handler function you can pass to |
| 703 | scm_internal_catch if you want the handler to act like Scheme's catch |
| 704 | --- call a procedure with the tag and the throw arguments. |
| 705 | |
| 706 | If the user does a throw to this catch, this function runs a handler |
| 707 | procedure written in Scheme. HANDLER_DATA is a pointer to an SCM |
| 708 | variable holding the Scheme procedure object to invoke. It ought to |
| 709 | be a pointer to an automatic variable (i.e., one living on the stack), |
| 710 | or the procedure object should be otherwise protected from GC. |
| 711 | |
| 712 | ** scm_handle_by_message is a new handler function to use with |
| 713 | `scm_internal_catch' if you want Guile to print a message and die. |
| 714 | It's useful for dealing with throws to uncaught keys at the top level. |
| 715 | |
| 716 | HANDLER_DATA, if non-zero, is assumed to be a char * pointing to a |
| 717 | message header to print; if zero, we use "guile" instead. That |
| 718 | text is followed by a colon, then the message described by ARGS. |
| 719 | |
| 720 | ** The return type of scm_boot_guile is now void; the function does |
| 721 | not return a value, and indeed, never returns at all. |
| 722 | |
| 723 | ** The new function scm_shell makes it easy for user applications to |
| 724 | process command-line arguments in a way that is compatible with the |
| 725 | stand-alone guile interpreter (which is in turn compatible with SCSH, |
| 726 | the Scheme shell). |
| 727 | |
| 728 | To use the scm_shell function, first initialize any guile modules |
| 729 | linked into your application, and then call scm_shell with the values |
| 730 | of ARGC and ARGV your `main' function received. scm_shell will adding |
| 731 | any SCSH-style meta-arguments from the top of the script file to the |
| 732 | argument vector, and then process the command-line arguments. This |
| 733 | generally means loading a script file or starting up an interactive |
| 734 | command interpreter. For details, see "Changes to the stand-alone |
| 735 | interpreter" above. |
| 736 | |
| 737 | ** The new functions scm_get_meta_args and scm_count_argv help you |
| 738 | implement the SCSH-style meta-argument, `\'. |
| 739 | |
| 740 | char **scm_get_meta_args (int ARGC, char **ARGV) |
| 741 | If the second element of ARGV is a string consisting of a single |
| 742 | backslash character (i.e. "\\" in Scheme notation), open the file |
| 743 | named by the following argument, parse arguments from it, and return |
| 744 | the spliced command line. The returned array is terminated by a |
| 745 | null pointer. |
| 746 | |
| 747 | For details of argument parsing, see above, under "guile now accepts |
| 748 | command-line arguments compatible with SCSH..." |
| 749 | |
| 750 | int scm_count_argv (char **ARGV) |
| 751 | Count the arguments in ARGV, assuming it is terminated by a null |
| 752 | pointer. |
| 753 | |
| 754 | For an example of how these functions might be used, see the source |
| 755 | code for the function scm_shell in libguile/script.c. |
| 756 | |
| 757 | You will usually want to use scm_shell instead of calling this |
| 758 | function yourself. |
| 759 | |
| 760 | ** The new function scm_compile_shell_switches turns an array of |
| 761 | command-line arguments into Scheme code to carry out the actions they |
| 762 | describe. Given ARGC and ARGV, it returns a Scheme expression to |
| 763 | evaluate, and calls scm_set_program_arguments to make any remaining |
| 764 | command-line arguments available to the Scheme code. For example, |
| 765 | given the following arguments: |
| 766 | |
| 767 | -e main -s ekko a speckled gecko |
| 768 | |
| 769 | scm_set_program_arguments will return the following expression: |
| 770 | |
| 771 | (begin (load "ekko") (main (command-line)) (quit)) |
| 772 | |
| 773 | You will usually want to use scm_shell instead of calling this |
| 774 | function yourself. |
| 775 | |
| 776 | ** The function scm_shell_usage prints a usage message appropriate for |
| 777 | an interpreter that uses scm_compile_shell_switches to handle its |
| 778 | command-line arguments. |
| 779 | |
| 780 | void scm_shell_usage (int FATAL, char *MESSAGE) |
| 781 | Print a usage message to the standard error output. If MESSAGE is |
| 782 | non-zero, write it before the usage message, followed by a newline. |
| 783 | If FATAL is non-zero, exit the process, using FATAL as the |
| 784 | termination status. (If you want to be compatible with Guile, |
| 785 | always use 1 as the exit status when terminating due to command-line |
| 786 | usage problems.) |
| 787 | |
| 788 | You will usually want to use scm_shell instead of calling this |
| 789 | function yourself. |
| 790 | |
| 791 | ** scm_eval_0str now returns SCM_UNSPECIFIED if the string contains no |
| 792 | expressions. It used to return SCM_EOL. Earth-shattering. |
| 793 | |
| 794 | ** The macros for declaring scheme objects in C code have been |
| 795 | rearranged slightly. They are now: |
| 796 | |
| 797 | SCM_SYMBOL (C_NAME, SCHEME_NAME) |
| 798 | Declare a static SCM variable named C_NAME, and initialize it to |
| 799 | point to the Scheme symbol whose name is SCHEME_NAME. C_NAME should |
| 800 | be a C identifier, and SCHEME_NAME should be a C string. |
| 801 | |
| 802 | SCM_GLOBAL_SYMBOL (C_NAME, SCHEME_NAME) |
| 803 | Just like SCM_SYMBOL, but make C_NAME globally visible. |
| 804 | |
| 805 | SCM_VCELL (C_NAME, SCHEME_NAME) |
| 806 | Create a global variable at the Scheme level named SCHEME_NAME. |
| 807 | Declare a static SCM variable named C_NAME, and initialize it to |
| 808 | point to the Scheme variable's value cell. |
| 809 | |
| 810 | SCM_GLOBAL_VCELL (C_NAME, SCHEME_NAME) |
| 811 | Just like SCM_VCELL, but make C_NAME globally visible. |
| 812 | |
| 813 | The `guile-snarf' script writes initialization code for these macros |
| 814 | to its standard output, given C source code as input. |
| 815 | |
| 816 | The SCM_GLOBAL macro is gone. |
| 817 | |
| 818 | ** The scm_read_line and scm_read_line_x functions have been replaced |
| 819 | by Scheme code based on the %read-delimited! procedure (known to C |
| 820 | code as scm_read_delimited_x). See its description above for more |
| 821 | information. |
| 822 | |
| 823 | ** The function scm_sys_open has been renamed to scm_open. It now |
| 824 | returns a port instead of an FD object. |
| 825 | |
| 826 | * The dynamic linking support has changed. For more information, see |
| 827 | libguile/DYNAMIC-LINKING. |
| 828 | |
| 829 | \f |
| 830 | Guile 1.0b3 |
| 831 | |
| 832 | User-visible changes from Thursday, September 5, 1996 until Guile 1.0 |
| 833 | (Sun 5 Jan 1997): |
| 834 | |
| 835 | * Changes to the 'guile' program: |
| 836 | |
| 837 | ** Guile now loads some new files when it starts up. Guile first |
| 838 | searches the load path for init.scm, and loads it if found. Then, if |
| 839 | Guile is not being used to execute a script, and the user's home |
| 840 | directory contains a file named `.guile', Guile loads that. |
| 841 | |
| 842 | ** You can now use Guile as a shell script interpreter. |
| 843 | |
| 844 | To paraphrase the SCSH manual: |
| 845 | |
| 846 | When Unix tries to execute an executable file whose first two |
| 847 | characters are the `#!', it treats the file not as machine code to |
| 848 | be directly executed by the native processor, but as source code |
| 849 | to be executed by some interpreter. The interpreter to use is |
| 850 | specified immediately after the #! sequence on the first line of |
| 851 | the source file. The kernel reads in the name of the interpreter, |
| 852 | and executes that instead. It passes the interpreter the source |
| 853 | filename as its first argument, with the original arguments |
| 854 | following. Consult the Unix man page for the `exec' system call |
| 855 | for more information. |
| 856 | |
| 857 | Now you can use Guile as an interpreter, using a mechanism which is a |
| 858 | compatible subset of that provided by SCSH. |
| 859 | |
| 860 | Guile now recognizes a '-s' command line switch, whose argument is the |
| 861 | name of a file of Scheme code to load. It also treats the two |
| 862 | characters `#!' as the start of a comment, terminated by `!#'. Thus, |
| 863 | to make a file of Scheme code directly executable by Unix, insert the |
| 864 | following two lines at the top of the file: |
| 865 | |
| 866 | #!/usr/local/bin/guile -s |
| 867 | !# |
| 868 | |
| 869 | Guile treats the argument of the `-s' command-line switch as the name |
| 870 | of a file of Scheme code to load, and treats the sequence `#!' as the |
| 871 | start of a block comment, terminated by `!#'. |
| 872 | |
| 873 | For example, here's a version of 'echo' written in Scheme: |
| 874 | |
| 875 | #!/usr/local/bin/guile -s |
| 876 | !# |
| 877 | (let loop ((args (cdr (program-arguments)))) |
| 878 | (if (pair? args) |
| 879 | (begin |
| 880 | (display (car args)) |
| 881 | (if (pair? (cdr args)) |
| 882 | (display " ")) |
| 883 | (loop (cdr args))))) |
| 884 | (newline) |
| 885 | |
| 886 | Why does `#!' start a block comment terminated by `!#', instead of the |
| 887 | end of the line? That is the notation SCSH uses, and although we |
| 888 | don't yet support the other SCSH features that motivate that choice, |
| 889 | we would like to be backward-compatible with any existing Guile |
| 890 | scripts once we do. Furthermore, if the path to Guile on your system |
| 891 | is too long for your kernel, you can start the script with this |
| 892 | horrible hack: |
| 893 | |
| 894 | #!/bin/sh |
| 895 | exec /really/long/path/to/guile -s "$0" ${1+"$@"} |
| 896 | !# |
| 897 | |
| 898 | Note that some very old Unix systems don't support the `#!' syntax. |
| 899 | |
| 900 | |
| 901 | ** You can now run Guile without installing it. |
| 902 | |
| 903 | Previous versions of the interactive Guile interpreter (`guile') |
| 904 | couldn't start up unless Guile's Scheme library had been installed; |
| 905 | they used the value of the environment variable `SCHEME_LOAD_PATH' |
| 906 | later on in the startup process, but not to find the startup code |
| 907 | itself. Now Guile uses `SCHEME_LOAD_PATH' in all searches for Scheme |
| 908 | code. |
| 909 | |
| 910 | To run Guile without installing it, build it in the normal way, and |
| 911 | then set the environment variable `SCHEME_LOAD_PATH' to a |
| 912 | colon-separated list of directories, including the top-level directory |
| 913 | of the Guile sources. For example, if you unpacked Guile so that the |
| 914 | full filename of this NEWS file is /home/jimb/guile-1.0b3/NEWS, then |
| 915 | you might say |
| 916 | |
| 917 | export SCHEME_LOAD_PATH=/home/jimb/my-scheme:/home/jimb/guile-1.0b3 |
| 918 | |
| 919 | |
| 920 | ** Guile's read-eval-print loop no longer prints #<unspecified> |
| 921 | results. If the user wants to see this, she can evaluate the |
| 922 | expression (assert-repl-print-unspecified #t), perhaps in her startup |
| 923 | file. |
| 924 | |
| 925 | ** Guile no longer shows backtraces by default when an error occurs; |
| 926 | however, it does display a message saying how to get one, and how to |
| 927 | request that they be displayed by default. After an error, evaluate |
| 928 | (backtrace) |
| 929 | to see a backtrace, and |
| 930 | (debug-enable 'backtrace) |
| 931 | to see them by default. |
| 932 | |
| 933 | |
| 934 | |
| 935 | * Changes to Guile Scheme: |
| 936 | |
| 937 | ** Guile now distinguishes between #f and the empty list. |
| 938 | |
| 939 | This is for compatibility with the IEEE standard, the (possibly) |
| 940 | upcoming Revised^5 Report on Scheme, and many extant Scheme |
| 941 | implementations. |
| 942 | |
| 943 | Guile used to have #f and '() denote the same object, to make Scheme's |
| 944 | type system more compatible with Emacs Lisp's. However, the change |
| 945 | caused too much trouble for Scheme programmers, and we found another |
| 946 | way to reconcile Emacs Lisp with Scheme that didn't require this. |
| 947 | |
| 948 | |
| 949 | ** Guile's delq, delv, delete functions, and their destructive |
| 950 | counterparts, delq!, delv!, and delete!, now remove all matching |
| 951 | elements from the list, not just the first. This matches the behavior |
| 952 | of the corresponding Emacs Lisp functions, and (I believe) the Maclisp |
| 953 | functions which inspired them. |
| 954 | |
| 955 | I recognize that this change may break code in subtle ways, but it |
| 956 | seems best to make the change before the FSF's first Guile release, |
| 957 | rather than after. |
| 958 | |
| 959 | |
| 960 | ** The compiled-library-path function has been deleted from libguile. |
| 961 | |
| 962 | ** The facilities for loading Scheme source files have changed. |
| 963 | |
| 964 | *** The variable %load-path now tells Guile which directories to search |
| 965 | for Scheme code. Its value is a list of strings, each of which names |
| 966 | a directory. |
| 967 | |
| 968 | *** The variable %load-extensions now tells Guile which extensions to |
| 969 | try appending to a filename when searching the load path. Its value |
| 970 | is a list of strings. Its default value is ("" ".scm"). |
| 971 | |
| 972 | *** (%search-load-path FILENAME) searches the directories listed in the |
| 973 | value of the %load-path variable for a Scheme file named FILENAME, |
| 974 | with all the extensions listed in %load-extensions. If it finds a |
| 975 | match, then it returns its full filename. If FILENAME is absolute, it |
| 976 | returns it unchanged. Otherwise, it returns #f. |
| 977 | |
| 978 | %search-load-path will not return matches that refer to directories. |
| 979 | |
| 980 | *** (primitive-load FILENAME :optional CASE-INSENSITIVE-P SHARP) |
| 981 | uses %seach-load-path to find a file named FILENAME, and loads it if |
| 982 | it finds it. If it can't read FILENAME for any reason, it throws an |
| 983 | error. |
| 984 | |
| 985 | The arguments CASE-INSENSITIVE-P and SHARP are interpreted as by the |
| 986 | `read' function. |
| 987 | |
| 988 | *** load uses the same searching semantics as primitive-load. |
| 989 | |
| 990 | *** The functions %try-load, try-load-with-path, %load, load-with-path, |
| 991 | basic-try-load-with-path, basic-load-with-path, try-load-module-with- |
| 992 | path, and load-module-with-path have been deleted. The functions |
| 993 | above should serve their purposes. |
| 994 | |
| 995 | *** If the value of the variable %load-hook is a procedure, |
| 996 | `primitive-load' applies its value to the name of the file being |
| 997 | loaded (without the load path directory name prepended). If its value |
| 998 | is #f, it is ignored. Otherwise, an error occurs. |
| 999 | |
| 1000 | This is mostly useful for printing load notification messages. |
| 1001 | |
| 1002 | |
| 1003 | ** The function `eval!' is no longer accessible from the scheme level. |
| 1004 | We can't allow operations which introduce glocs into the scheme level, |
| 1005 | because Guile's type system can't handle these as data. Use `eval' or |
| 1006 | `read-and-eval!' (see below) as replacement. |
| 1007 | |
| 1008 | ** The new function read-and-eval! reads an expression from PORT, |
| 1009 | evaluates it, and returns the result. This is more efficient than |
| 1010 | simply calling `read' and `eval', since it is not necessary to make a |
| 1011 | copy of the expression for the evaluator to munge. |
| 1012 | |
| 1013 | Its optional arguments CASE_INSENSITIVE_P and SHARP are interpreted as |
| 1014 | for the `read' function. |
| 1015 | |
| 1016 | |
| 1017 | ** The function `int?' has been removed; its definition was identical |
| 1018 | to that of `integer?'. |
| 1019 | |
| 1020 | ** The functions `<?', `<?', `<=?', `=?', `>?', and `>=?'. Code should |
| 1021 | use the R4RS names for these functions. |
| 1022 | |
| 1023 | ** The function object-properties no longer returns the hash handle; |
| 1024 | it simply returns the object's property list. |
| 1025 | |
| 1026 | ** Many functions have been changed to throw errors, instead of |
| 1027 | returning #f on failure. The point of providing exception handling in |
| 1028 | the language is to simplify the logic of user code, but this is less |
| 1029 | useful if Guile's primitives don't throw exceptions. |
| 1030 | |
| 1031 | ** The function `fileno' has been renamed from `%fileno'. |
| 1032 | |
| 1033 | ** The function primitive-mode->fdes returns #t or #f now, not 1 or 0. |
| 1034 | |
| 1035 | |
| 1036 | * Changes to Guile's C interface: |
| 1037 | |
| 1038 | ** The library's initialization procedure has been simplified. |
| 1039 | scm_boot_guile now has the prototype: |
| 1040 | |
| 1041 | void scm_boot_guile (int ARGC, |
| 1042 | char **ARGV, |
| 1043 | void (*main_func) (), |
| 1044 | void *closure); |
| 1045 | |
| 1046 | scm_boot_guile calls MAIN_FUNC, passing it CLOSURE, ARGC, and ARGV. |
| 1047 | MAIN_FUNC should do all the work of the program (initializing other |
| 1048 | packages, reading user input, etc.) before returning. When MAIN_FUNC |
| 1049 | returns, call exit (0); this function never returns. If you want some |
| 1050 | other exit value, MAIN_FUNC may call exit itself. |
| 1051 | |
| 1052 | scm_boot_guile arranges for program-arguments to return the strings |
| 1053 | given by ARGC and ARGV. If MAIN_FUNC modifies ARGC/ARGV, should call |
| 1054 | scm_set_program_arguments with the final list, so Scheme code will |
| 1055 | know which arguments have been processed. |
| 1056 | |
| 1057 | scm_boot_guile establishes a catch-all catch handler which prints an |
| 1058 | error message and exits the process. This means that Guile exits in a |
| 1059 | coherent way when system errors occur and the user isn't prepared to |
| 1060 | handle it. If the user doesn't like this behavior, they can establish |
| 1061 | their own universal catcher in MAIN_FUNC to shadow this one. |
| 1062 | |
| 1063 | Why must the caller do all the real work from MAIN_FUNC? The garbage |
| 1064 | collector assumes that all local variables of type SCM will be above |
| 1065 | scm_boot_guile's stack frame on the stack. If you try to manipulate |
| 1066 | SCM values after this function returns, it's the luck of the draw |
| 1067 | whether the GC will be able to find the objects you allocate. So, |
| 1068 | scm_boot_guile function exits, rather than returning, to discourage |
| 1069 | people from making that mistake. |
| 1070 | |
| 1071 | The IN, OUT, and ERR arguments were removed; there are other |
| 1072 | convenient ways to override these when desired. |
| 1073 | |
| 1074 | The RESULT argument was deleted; this function should never return. |
| 1075 | |
| 1076 | The BOOT_CMD argument was deleted; the MAIN_FUNC argument is more |
| 1077 | general. |
| 1078 | |
| 1079 | |
| 1080 | ** Guile's header files should no longer conflict with your system's |
| 1081 | header files. |
| 1082 | |
| 1083 | In order to compile code which #included <libguile.h>, previous |
| 1084 | versions of Guile required you to add a directory containing all the |
| 1085 | Guile header files to your #include path. This was a problem, since |
| 1086 | Guile's header files have names which conflict with many systems' |
| 1087 | header files. |
| 1088 | |
| 1089 | Now only <libguile.h> need appear in your #include path; you must |
| 1090 | refer to all Guile's other header files as <libguile/mumble.h>. |
| 1091 | Guile's installation procedure puts libguile.h in $(includedir), and |
| 1092 | the rest in $(includedir)/libguile. |
| 1093 | |
| 1094 | |
| 1095 | ** Two new C functions, scm_protect_object and scm_unprotect_object, |
| 1096 | have been added to the Guile library. |
| 1097 | |
| 1098 | scm_protect_object (OBJ) protects OBJ from the garbage collector. |
| 1099 | OBJ will not be freed, even if all other references are dropped, |
| 1100 | until someone does scm_unprotect_object (OBJ). Both functions |
| 1101 | return OBJ. |
| 1102 | |
| 1103 | Note that calls to scm_protect_object do not nest. You can call |
| 1104 | scm_protect_object any number of times on a given object, and the |
| 1105 | next call to scm_unprotect_object will unprotect it completely. |
| 1106 | |
| 1107 | Basically, scm_protect_object and scm_unprotect_object just |
| 1108 | maintain a list of references to things. Since the GC knows about |
| 1109 | this list, all objects it mentions stay alive. scm_protect_object |
| 1110 | adds its argument to the list; scm_unprotect_object remove its |
| 1111 | argument from the list. |
| 1112 | |
| 1113 | |
| 1114 | ** scm_eval_0str now returns the value of the last expression |
| 1115 | evaluated. |
| 1116 | |
| 1117 | ** The new function scm_read_0str reads an s-expression from a |
| 1118 | null-terminated string, and returns it. |
| 1119 | |
| 1120 | ** The new function `scm_stdio_to_port' converts a STDIO file pointer |
| 1121 | to a Scheme port object. |
| 1122 | |
| 1123 | ** The new function `scm_set_program_arguments' allows C code to set |
| 1124 | the value teruturned by the Scheme `program-arguments' function. |
| 1125 | |
| 1126 | \f |
| 1127 | Older changes: |
| 1128 | |
| 1129 | * Guile no longer includes sophisticated Tcl/Tk support. |
| 1130 | |
| 1131 | The old Tcl/Tk support was unsatisfying to us, because it required the |
| 1132 | user to link against the Tcl library, as well as Tk and Guile. The |
| 1133 | interface was also un-lispy, in that it preserved Tcl/Tk's practice of |
| 1134 | referring to widgets by names, rather than exporting widgets to Scheme |
| 1135 | code as a special datatype. |
| 1136 | |
| 1137 | In the Usenix Tk Developer's Workshop held in July 1996, the Tcl/Tk |
| 1138 | maintainers described some very interesting changes in progress to the |
| 1139 | Tcl/Tk internals, which would facilitate clean interfaces between lone |
| 1140 | Tk and other interpreters --- even for garbage-collected languages |
| 1141 | like Scheme. They expected the new Tk to be publicly available in the |
| 1142 | fall of 1996. |
| 1143 | |
| 1144 | Since it seems that Guile might soon have a new, cleaner interface to |
| 1145 | lone Tk, and that the old Guile/Tk glue code would probably need to be |
| 1146 | completely rewritten, we (Jim Blandy and Richard Stallman) have |
| 1147 | decided not to support the old code. We'll spend the time instead on |
| 1148 | a good interface to the newer Tk, as soon as it is available. |
| 1149 | |
| 1150 | Until then, gtcltk-lib provides trivial, low-maintenance functionality. |
| 1151 | |
| 1152 | \f |
| 1153 | Copyright information: |
| 1154 | |
| 1155 | Copyright (C) 1996,1997 Free Software Foundation, Inc. |
| 1156 | |
| 1157 | Permission is granted to anyone to make or distribute verbatim copies |
| 1158 | of this document as received, in any medium, provided that the |
| 1159 | copyright notice and this permission notice are preserved, |
| 1160 | thus giving the recipient permission to redistribute in turn. |
| 1161 | |
| 1162 | Permission is granted to distribute modified versions |
| 1163 | of this document, or of portions of it, |
| 1164 | under the above conditions, provided also that they |
| 1165 | carry prominent notices stating who last changed them. |
| 1166 | |
| 1167 | \f |
| 1168 | Local variables: |
| 1169 | mode: outline |
| 1170 | paragraph-separate: "[ \f]*$" |
| 1171 | end: |
| 1172 | |