aboutsummaryrefslogtreecommitdiffstats
path: root/scm.texi
diff options
context:
space:
mode:
Diffstat (limited to 'scm.texi')
-rw-r--r--scm.texi1215
1 files changed, 773 insertions, 442 deletions
diff --git a/scm.texi b/scm.texi
index 16a33d0..f0cd485 100644
--- a/scm.texi
+++ b/scm.texi
@@ -114,86 +114,13 @@ home page:
@end iftex
@menu
-* Copying::
* SCM Features::
* SCM Authors::
+* Copying::
* Bibliography::
@end menu
-@node Copying, SCM Features, Overview, Overview
-@section Copying
-
-@center COPYRIGHT (c) 1989 BY
-@center PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS.
-@center ALL RIGHTS RESERVED
-
-@noindent
-Permission to use, copy, modify, distribute and sell this software
-and its documentation for any purpose and without fee is hereby
-granted, provided that the above copyright notice appear in all copies
-and that both that copyright notice and this permission notice appear
-in supporting documentation, and that the name of Paradigm Associates
-Inc not be used in advertising or publicity pertaining to distribution
-of the software without specific, written prior permission.
-
-@noindent
-PARADIGM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-PARADIGM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-@noindent
-gjc@@paradigm.com
-@flushright
-Phone: 617-492-6079
-@end flushright
-@flushleft
-Paradigm Associates Inc
-29 Putnam Ave, Suite 6
-Cambridge, MA 02138
-@end flushleft
-
-@sp 2
-
-@center Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995
-@center Free Software Foundation, Inc.
-@center 59 Temple Place, Suite 330, Boston, MA 02111, USA
-
-@noindent
-Permission to use, copy, modify, distribute, and sell this software and
-its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation.
-
-@center NO WARRANTY
-
-@noindent
-BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
-THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
-EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
-ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH
-YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
-NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-@noindent
-IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR
-DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL
-DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM
-(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
-INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF
-THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR
-OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-@node SCM Features, SCM Authors, Copying, Overview
+@node SCM Features, SCM Authors, Overview, Overview
@section Features
@itemize @bullet
@@ -243,14 +170,14 @@ timing information printed interactively (the @code{verbose} function).
@code{Restart}, @code{quit}, and @code{exec}.
@end itemize
-@node SCM Authors, Bibliography, SCM Features, Overview
+@node SCM Authors, Copying, SCM Features, Overview
@section Authors
@table @b
-@item Aubrey Jaffer (jaffer @@ ai.mit.edu)
+@item Aubrey Jaffer (jaffer @@ alum.mit.edu)
Most of SCM.
@item Radey Shouman
-Arrays. @code{gsubr}s, compiled closures, records, Ecache, syntax-rules
+Arrays, @code{gsubr}s, compiled closures, records, Ecache, syntax-rules
macros, and @dfn{safeport}s.
@item Jerry D. Hedden
Real and Complex functions. Fast mixed type arithmetics.
@@ -268,33 +195,94 @@ C-stack and being able to garbage collect off the C-stack
There are many other contributors to SCM. They are acknowledged in the
file @file{ChangeLog}, a log of changes that have been made to scm.
-@node Bibliography, , SCM Authors, Overview
+@node Copying, Bibliography, SCM Authors, Overview
+@section Copyright
+
+@noindent
+Authors have assigned their SCM copyrights to:
+@sp 1
+
+@center Free Software Foundation, Inc.
+@center 59 Temple Place, Suite 330, Boston, MA 02111, USA
+
+@noindent
+Permission to use, copy, modify, distribute, and sell this software and
+its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation.
+
+@center NO WARRANTY
+
+@noindent
+BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
+THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
+EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
+ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH
+YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
+NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+@noindent
+IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR
+DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL
+DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM
+(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
+INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF
+THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR
+OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+
+@heading SIOD copyright
+@sp 1
+
+@center COPYRIGHT (c) 1989 BY
+@center PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS.
+@center ALL RIGHTS RESERVED
+
+@noindent
+Permission to use, copy, modify, distribute and sell this software
+and its documentation for any purpose and without fee is hereby
+granted, provided that the above copyright notice appear in all copies
+and that both that copyright notice and this permission notice appear
+in supporting documentation, and that the name of Paradigm Associates
+Inc not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+@noindent
+PARADIGM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+PARADIGM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+@noindent
+gjc@@paradigm.com
+@flushright
+Phone: 617-492-6079
+@end flushright
+@flushleft
+Paradigm Associates Inc
+29 Putnam Ave, Suite 6
+Cambridge, MA 02138
+@end flushleft
+
+@node Bibliography, , Copying, Overview
@section Bibliography
@table @asis
+
@item [IEEE]
@cindex IEEE
@cite{IEEE Standard 1178-1990. IEEE Standard for the Scheme
Programming Language.} IEEE, New York, 1991.
-@item [Simply]
-@cindex Simply
-Brian Harvey and Matthew Wright.
-@ifset html
-<A HREF="http://HTTP.CS.Berkeley.EDU/~bh/simply-toc.html">
-@end ifset
-@cite{Simply Scheme: Introducing Computer Science}
-@ifset html
-</A>
-@end ifset
-MIT Press, 1994 ISBN 0-262-08226-8
-
-@item [SICP]
-@cindex SICP
-Harold Abelson and Gerald Jay Sussman with Julie Sussman.
-@cite{Structure and Interpretation of Computer Programs.}
-MIT Press, Cambridge, 1985.
-
@item [R4RS]
@cindex R4RS
William Clinger and Jonathan Rees, Editors.
@@ -345,17 +333,46 @@ Hygienic Macros Through Explicit Renaming
@cite{Lisp Pointers} Volume IV, Number 4 (December 1991),
pp 17-23.
-@item [GUILE]
-@cindex GUILE
-Tom Lord.
+@item [SICP]
+@cindex SICP
+Harold Abelson and Gerald Jay Sussman with Julie Sussman.
+@cite{Structure and Interpretation of Computer Programs.}
+MIT Press, Cambridge, 1985.
+
+@item [Simply]
+@cindex Simply
+Brian Harvey and Matthew Wright.
+@ifset html
+<A HREF="http://HTTP.CS.Berkeley.EDU/~bh/simply-toc.html">
+@end ifset
+@cite{Simply Scheme: Introducing Computer Science}
+@ifset html
+</A>
+@end ifset
+MIT Press, 1994 ISBN 0-262-08226-8
+
+@item [SchemePrimer]
+@cindex SchemePrimer
+犬飼大(Dai Inukai)
@ifset html
-<A HREF="http://www.cygnus.com/library/ctr/guile.html">
+<A HREF="http://www.shuwasystem.co.jp/SchemePrimer/">
@end ifset
-The Guile Architecture for Ubiquitous Computing.
+@cite{入門Scheme}
@ifset html
</A>
@end ifset
-@cite{Usenix Symposium on Tcl/Tk}, 1995.
+1999年12月初版 ISBN4-87966-954-7
+
+@c @item [GUILE]
+@c @cindex GUILE
+@c Free Software Foundation
+@c @ifset html
+@c <A HREF="http://www.gnu.org/software/guile/guile.html">
+@c @end ifset
+@c Guile: Project GNU's extension language
+@c @ifset html
+@c </A>
+@c @end ifset
@item [SLIB]
@cindex SLIB
@@ -367,7 +384,7 @@ SLIB, The Portable Scheme Library.
@ifset html
</A>
@end ifset
-Version 2c5, Jan 1999.
+Version 2c8, June 2000.
@ifinfo
@ref{Top, , , slib, SLIB}.
@@ -383,7 +400,7 @@ JACAL Symbolic Mathematics System.
@ifset html
</A>
@end ifset
-Version 1a9, Jan 1999.
+Version 1b0, Sep 1999.
@ifinfo
@ref{Top, , , jacal, JACAL}.
@@ -424,40 +441,29 @@ Documentation of the Xlib - SCM Language X Interface.
The SCM distribution has @dfn{Makefile} which contains rules for making
@dfn{scmlit}, a ``bare-bones'' version of SCM sufficient for running
-@file{build.scm}. @file{build.scm} is used to compile (or create
-scripts to compile) full featured versions.
+@file{build}. @file{build} is used to compile (or create scripts to
+compile) full featured versions.
Makefiles are not portable to the majority of platforms. If
@file{Makefile} works for you, good; If not, I don't want to hear about
-it. If you need to compile SCM without build.scm, there are several
-ways to proceed:
+it. If you need to compile SCM without build, there are several ways to
+proceed:
@itemize @bullet
@item
-Use SCM on a different platform to run @file{build.scm} to create a
-script to build SCM;
+Use the @uref{http://swissnet.ai.mit.edu/~jaffer/buildscm.html, build}
+web page to create custom batch scripts for compiling SCM.
@item
-Use another implementation of Scheme to run @file{build.scm} to create a
-script to build SCM;
+Use SCM on a different platform to run @file{build} to create a script
+to build SCM;
@item
-Create your own script or @file{Makefile}.
-
-@item
-Buy a SCM executable from jaffer @@ ai.mit.edu. See the end of the
-@file{ANNOUNCE} file in the distribution for details.
+Use another implementation of Scheme to run @file{build} to create a
+script to build SCM;
@item
-Use scmconfig (From: bos@@scrg.cs.tcd.ie):
-
-Build and install scripts using GNU @dfn{autoconf} are available from
-@file{scmconfig4e3.tar.gz} in the distribution directories. See
-@file{README.unix} in @file{scmconfig4e3.tar.gz} for further
-instructions.
-
-@emph{Note:} The last release of scmconfig (4e3) was on March 20, 1996.
-I am moving it to the OLD subdirectory until someone submits an update.
+Create your own script or @file{Makefile}.
@end itemize
@@ -474,34 +480,34 @@ low priority. SLIB is available from the same sites as SCM:
@ifclear html
@itemize @bullet
@item
-swissnet.ai.mit.edu:/pub/scm/slib2c7.tar.gz
+swissnet.ai.mit.edu:/pub/scm/slib2d4.tar.gz
@item
-ftp.gnu.org:/pub/gnu/jacal/slib2c7.tar.gz
+ftp.gnu.org:/pub/gnu/jacal/slib2d4.tar.gz
@item
-ftp.cs.indiana.edu:/pub/scheme-repository/imp/slib2c7.tar.gz
+ftp.cs.indiana.edu:/pub/scheme-repository/imp/slib2d4.tar.gz
@end itemize
@end ifclear
@ifset html
@itemize @bullet
@item
-<A HREF="http://swissnet.ai.mit.edu/ftpdir/scm/slib2c7.zip">
-http://swissnet.ai.mit.edu/ftpdir/scm/slib2c7.zip
+<A HREF="http://swissnet.ai.mit.edu/ftpdir/scm/slib2d4.zip">
+http://swissnet.ai.mit.edu/ftpdir/scm/slib2d4.zip
</A>
@item
-<A HREF="ftp://ftp.gnu.org/pub/gnu/jacal/slib2c7.tar.gz">
-ftp.gnu.org:/pub/gnu/jacal/slib2c7.tar.gz
+<A HREF="ftp://ftp.gnu.org/pub/gnu/jacal/slib2d4.tar.gz">
+ftp.gnu.org:/pub/gnu/jacal/slib2d4.tar.gz
</A>
@item
-<A HREF="ftp://ftp.cs.indiana.edu/pub/scheme-repository/code/lib/slib2c7.tar.gz">
-ftp.cs.indiana.edu:/pub/scheme-repository/code/lib/slib2c7.tar.gz
+<A HREF="ftp://ftp.cs.indiana.edu/pub/scheme-repository/code/lib/slib2d4.tar.gz">
+ftp.cs.indiana.edu:/pub/scheme-repository/code/lib/slib2d4.tar.gz
</A>
@end itemize
@end ifset
@noindent
-Unpack SLIB (@samp{tar xzf slib2c7.tar.gz} or @samp{unzip -ao
-slib2c7.zip}) in an appropriate directory for your system; both
+Unpack SLIB (@samp{tar xzf slib2d4.tar.gz} or @samp{unzip -ao
+slib2d4.zip}) in an appropriate directory for your system; both
@code{tar} and @code{unzip} will create the directory @file{slib}.
@noindent
@@ -541,11 +547,12 @@ absolute pathnames are recommended.
@node Building SCM, Installing Dynamic Linking, SLIB, Installing SCM
@section Building SCM
-The file @dfn{build.scm} builds and runs a relational database of how to
-compile and link SCM executables. It has information for most platforms
-which SCM has been ported to (of which I have been notified). Some of
-this information is old, incorrect, or incomplete. Send corrections and
-additions to jaffer @@ ai.mit.edu.
+The file @dfn{build} loads the file @dfn{build.scm}, which constructs a
+relational database of how to compile and link SCM executables.
+@file{build.scm} has information for the platforms which SCM has been
+ported to (of which I have been notified). Some of this information is
+old, incorrect, or incomplete. Send corrections and additions to jaffer
+@@ ai.mit.edu.
@menu
* Invoking Build::
@@ -558,7 +565,7 @@ additions to jaffer @@ ai.mit.edu.
@noindent
The @emph{all} method will also work for MS-DOS and unix. Use
-the @emph{all} method if you encounter problems with @file{build.scm}.
+the @emph{all} method if you encounter problems with @file{build}.
@table @asis
@item MS-DOS
@@ -566,12 +573,12 @@ From the SCM source directory, type @samp{build} followed by up to 9
command line arguments.
@item unix
-From the SCM source directory, type @samp{./build.scm} followed by command
+From the SCM source directory, type @samp{./build} followed by command
line arguments.
@item @emph{all}
From the SCM source directory, start @samp{scm} or @samp{scmlit} and
-type @code{(load "build.scm")}. Alternatively, start @samp{scm} or
+type @code{(load "build")}. Alternatively, start @samp{scm} or
@samp{scmlit} with the command line argument @samp{-ilbuild}.
@end table
@@ -582,18 +589,20 @@ script with the @code{arrays}, @code{inexact}, and @code{bignums}
options as defaults.
@example
-bash$ ./build.scm
+bash$ ./build
@print{}
-#!/bin/sh
+#! /bin/sh
+# unix (linux) script created by SLIB/batch
+# ================ Write file with C defines
rm -f scmflags.h
-echo '#define IMPLINIT "/home/jaffer/scm/Init@value{SCMVERSION}.scm"'>>scmflags.h
+echo '#define IMPLINIT "Init@value{SCMVERSION}.scm"'>>scmflags.h
echo '#define BIGNUMS'>>scmflags.h
echo '#define FLOATS'>>scmflags.h
echo '#define ARRAYS'>>scmflags.h
-gcc -O2 -c continue.c scm.c findexec.c script.c time.c repl.c scl.c \
- eval.c sys.c subr.c unif.c rope.c
-gcc -rdynamic -o scm continue.o scm.o findexec.o script.o time.o \
- repl.o scl.o eval.o sys.o subr.o unif.o rope.o -lm -lc
+# ================ Compile C source files
+gcc -O2 -c continue.c scm.c scmmain.c findexec.c script.c time.c repl.c scl.c eval.c sys.c subr.c debug.c unif.c rope.c
+# ================ Link C object files
+gcc -rdynamic -o scm continue.o scm.o scmmain.o findexec.o script.o time.o repl.o scl.o eval.o sys.o subr.o debug.o unif.o rope.o -lm -lc
@end example
@noindent
@@ -602,21 +611,18 @@ or @samp{--platform=} option. This will create a script for the
platform named in the @samp{-p} or @samp{--platform=} option.
@example
-bash$ ./build.scm -p vms
+bash$ ./build -o scmlit -p darwin -F lit
@print{}
-$DELETE scmflags.h
-$CREATE scmflags.h
-$DECK
-#define IMPLINIT "/home/jaffer/scm/Init@value{SCMVERSION}.scm"
-#define BIGNUMS
-#define FLOATS
-#define ARRAYS
-$EOD
-$ cc continue scm findexec script time repl scl eval sys subr unif rope
-$ macro setjump
-$ link continue,scm,findexec,script,time,repl,scl,eval,sys,subr,unif,rope,setjump,sys$input/opt
- -lc,sys$share:vaxcrtl/share
-$RENAME continue.exe scm.exe
+#! /bin/sh
+# unix (darwin) script created by SLIB/batch
+# ================ Write file with C defines
+rm -f scmflags.h
+echo '#define IMPLINIT "Init@value{SCMVERSION}.scm"'>>scmflags.h
+# ================ Compile C source files
+cc -O3 -c continue.c scm.c scmmain.c findexec.c script.c time.c repl.c scl.c eval.c sys.c subr.c debug.c unif.c rope.c
+# ================ Link C object files
+mv -f scmlit scmlit~
+cc -o scmlit continue.o scm.o scmmain.o findexec.o script.o time.o repl.o scl.o eval.o sys.o subr.o debug.o unif.o rope.o
@end example
@@ -731,7 +737,7 @@ dos
@item
vms
@item
-amigados
+amigaos (was amigados)
@item
system
@@ -789,7 +795,7 @@ compile and link your file at compile time, use the @samp{-c} and
@example
bash$ build -c foo.c -i init_foo
@print{}
-#!/bin/sh
+#! /bin/sh
rm -f scmflags.h
echo '#define IMPLINIT "/home/jaffer/scm/Init@value{SCMVERSION}.scm"'>>scmflags.h
echo '#define COMPILED_INITS init_foo();'>>scmflags.h
@@ -808,7 +814,7 @@ To make a dynamically loadable object file use the @code{-t dll} option:
@example
bash$ build -t dll -c foo.c
@print{}
-#!/bin/sh
+#! /bin/sh
rm -f scmflags.h
echo '#define IMPLINIT "/home/jaffer/scm/Init@value{SCMVERSION}.scm"'>>scmflags.h
echo '#define BIGNUMS'>>scmflags.h
@@ -987,8 +993,9 @@ __WATCOMC__ Watcom C on MS-DOS
__ZTC__ Zortech C
_AIX AIX operating system
+__APPLE__ Apple Darwin
AMIGA SAS/C 5.10 or Dice C on AMIGA
-__amigados__ Gnu CC on AMIGA
+__amigaos__ Gnu CC on AMIGA
atarist ATARI-ST under Gnu CC
__FreeBSD__ FreeBSD
GNUDOS DJGPP (obsolete in version 1.08)
@@ -997,11 +1004,12 @@ hpux HP-UX
linux Linux
macintosh Macintosh (THINK_C and __MWERKS__ define)
MCH_AMIGA Aztec_c 5.2a on AMIGA
+__MACH__ Apple Darwin
MSDOS Microsoft C 5.10 and 6.00A
__MSDOS__ Turbo C, Borland C, and DJGPP
nosve Control Data NOS/VE
SVR2 System V Revision 2.
-__svr4__ SunOS
+__SVR4 SunOS
THINK_C developement environment for the Macintosh
ultrix VAX with ULTRIX operating system.
unix most Unix and similar systems and DJGPP (!?)
@@ -1021,6 +1029,8 @@ hp9000s800 HP RISC processor
__i386__ DJGPP
i386 DJGPP
MULTIMAX Encore computer
+ppc PowerPC
+__ppc__ PowerPC
pyr Pyramid 9810 processor
__sgi__ Silicon Graphics Inc.
sparc SPARC processor
@@ -1159,13 +1169,13 @@ digits of pi.
> (load "pi")
;loading "pi"
;done loading "pi.scm"
-;Evaluation took 20 mSec (0 in gc) 767 cells work, 233 bytes other
+;Evaluation took 20 ms (0 in gc) 767 cells work, 233.B other
#<unspecified>
> (pi 100 5)
00003 14159 26535 89793 23846 26433 83279 50288 41971 69399
37510 58209 74944 59230 78164 06286 20899 86280 34825 34211
70679
-;Evaluation took 550 mSec (60 in gc) 36976 cells work, 1548 bytes other
+;Evaluation took 550 ms (60 in gc) 36976 cells work, 1548.B other
#<unspecified>
@end example
@@ -1220,7 +1230,7 @@ call-with-current-continuations.
@noindent
Reported problems and solutions are grouped under Compiling, Linking,
Running, and Testing. If you don't find your problem listed there, you
-can send a bug report to @code{jaffer @@ ai.mit.edu}. The bug report
+can send a bug report to @code{jaffer @@ alum.mit.edu}. The bug report
should include:
@enumerate
@@ -1262,10 +1272,11 @@ vendor is recommended.
@section Invoking SCM
@example
-@exdent @b{ scm } [-a @i{kbytes}] [-ibvqmu] [-p @i{number}]
-@w{[-c @i{expression}]} @w{[-e @i{expression}]} @w{[-f @i{filename}]}
-@w{[-l @i{filename}]} @w{[-r @i{feature}]} @w{[-- | - | -s]}
-@w{[@i{filename}]} @w{[@i{arguments} @dots{}]}
+@exdent @b{ scm } [-a @i{kbytes}] [-muvbiq] @w{[--version]} @w{[--help]}
+@w{[[-]-no-init-file]} @w{[-p @i{int}]} @w{[-r @i{feature}]} @w{[-h @i{feature}]}
+@w{[-d @i{filename}]} @w{[-f @i{filename}]} @w{[-l @i{filename}]}
+@w{[-c @i{expression}]} @w{[-e @i{expression}]} @w{[-o @i{dumpname}]}
+@w{[-- | - | -s]} @w{[@i{filename}]} @w{[@i{arguments} @dots{}]}
@end example
@noindent
@@ -1291,7 +1302,7 @@ Unless the option @code{-no-init-file} or @code{--no-init-file} occurs
in the command line, @file{Init@value{SCMVERSION}.scm} checks to see if
there is file @file{ScmInit.scm} in the path specified by the
environment variable @var{HOME} (or in the current directory if
-@var{HOME} is undefined). If it finds such a file it is loaded.
+@var{HOME} is undefined). If it finds such a file it is loaded.
@noindent
@file{Init@value{SCMVERSION}.scm} then looks for command input from one
@@ -1311,12 +1322,12 @@ Extensions, #!}.
@noindent
The options are processed in the order specified on the command line.
-@deffn {Command Option} -a kb
-specifies that @code{scm} should allocate an initial heapsize of
-@var{kb} kilobytes. This option, if present, must be the first on
-the command line. If not specified, the default is
-@code{INIT_HEAP_SIZE} in source file @file{setjump.h} which the
-distribution sets at @code{25000*sizeof(cell)}.
+@deffn {Command Option} -a k
+specifies that @code{scm} should allocate an initial heapsize of @var{k}
+kilobytes. This option, if present, must be the first on the command
+line. If not specified, the default is @code{INIT_HEAP_SIZE} in source
+file @file{setjump.h} which the distribution sets at
+@code{25000*sizeof(cell)}.
@end deffn
@deffn {Command Option} -no-init-file
@@ -1324,72 +1335,101 @@ distribution sets at @code{25000*sizeof(cell)}.
Inhibits the loading of @file{ScmInit.scm} as described above.
@end deffn
-@deffn {Command Option} -e expression
-@deffnx {Command Option} -c expression
-specifies that the scheme expression @var{expression} is to be
-evaluated. These options are inspired by @code{perl} and @code{sh}
-respectively. On Amiga systems the entire option and argument need to be
-enclosed in quotes. For instance @samp{"-e(newline)"}.
+@deffn {Command Option} ---help
+prints usage information and URI; then exit.
+@end deffn
+
+@deffn {Command Option} ---version
+prints version information and exit.
@end deffn
@deffn {Command Option} -r feature
-requires @var{feature}. This will load a file from [SLIB] if that
-@var{feature} is not already supported. If @var{feature} is 2, 3, 4, or
-5 @code{scm} will require the features neccessary to support [R2RS],
-[R3RS], [R4RS], or [R5RS], respectively.
+requires @var{feature}. This will load a file from [SLIB] if that
+@var{feature} is not already provided. If @var{feature} is 2, 2rs,
+r2rs, 3, 3rs, r3rs, 4, 4rs, r4rs, 5, 5rs, or r5rs; @code{scm} will
+require the features neccessary to support [R2RS], [R3RS], [R4RS], or
+[R5RS], respectively.
+@end deffn
+
+@deffn {Command Option} -h feature
+provides @var{feature}.
@end deffn
@deffn {Command Option} -l filename
@deffnx {Command Option} -f filename
-loads @var{filename}. @code{Scm} will load the first (unoptioned) file
+loads @var{filename}. @code{Scm} will load the first (unoptioned) file
named on the command line if no @code{-c}, @code{-e}, @code{-f},
@code{-l}, or @code{-s} option preceeds
it.
@end deffn
+@deffn {Command Option} -d filename
+Loads SLIB @code{databases} feature and opens @var{filename} as a
+database.
+@end deffn
+
+@deffn {Command Option} -e expression
+@deffnx {Command Option} -c expression
+specifies that the scheme expression @var{expression} is to be
+evaluated. These options are inspired by @code{perl} and @code{sh}
+respectively. On Amiga systems the entire option and argument need to be
+enclosed in quotes. For instance @samp{"-e(newline)"}.
+@end deffn
+
+@deffn {Command Option} -o dumpname
+saves the current SCM session as the executable program @file{dumpname}.
+This option works only in SCM builds supporting @code{dump}
+(@pxref{Dump}).
+
+If options appear on the command line after @samp{-o @var{dumpname}},
+then the saved session will continue with processing those options when
+it is invoked. Otherwise the (new) command line is processed as usual
+when the saved image is invoked.
+@end deffn
+
@deffn {Command Option} -p level
-sets the prolixity (verboseness) to @var{level}. This is the same as
+sets the prolixity (verboseness) to @var{level}. This is the same as
the @code{scm} command (verobse @var{level}).
@end deffn
@deffn {Command Option} -v
(verbose mode) specifies that @code{scm} will print prompts, evaluation
-times, notice of loading files, and garbage collection statistics. This
+times, notice of loading files, and garbage collection statistics. This
is the same as @code{-p3}.
@end deffn
@deffn {Command Option} -q
(quiet mode) specifies that @code{scm} will print no extra
-information. This is the same as @code{-p0}.
+information. This is the same as @code{-p0}.
@end deffn
@deffn {Command Option} -m
specifies that subsequent loads, evaluations, and user interactions will
-be with syntax-rules macro capability. To use a specific syntax-rules
+be with syntax-rules macro capability. To use a specific syntax-rules
macro implementation from [SLIB] (instead of [SLIB]'s default) put
@code{-r} @var{macropackage} before @code{-m} on the command line.
@end deffn
@deffn {Command Option} -u
specifies that subsequent loads, evaluations, and user interactions will
-be without syntax-rules macro capability. syntax-rules macro capability
+be without syntax-rules macro capability. Syntax-rules macro capability
can be restored by a subsequent @code{-m} on the command line or from
Scheme code.
@end deffn
@deffn {Command Option} -i
-specifies that @code{scm} should run interactively. That means that
+specifies that @code{scm} should run interactively. That means that
@code{scm} will not terminate until the @code{(quit)} or @code{(exit)}
-command is given, even if there are errors. It also sets the prolixity
-level to 2 if it is less than 2. This will print prompts, evaluation
-times, and notice of loading files. The prolixity level can be set by
-subsequent options. If @code{scm} is started from a tty, it will assume
+command is given, even if there are errors. It also sets the prolixity
+level to 2 if it is less than 2. This will print prompts, evaluation
+times, and notice of loading files. The prolixity level can be set by
+subsequent options. If @code{scm} is started from a tty, it will assume
that it should be interactive unless given a subsequent @code{-b}
option.
@end deffn
@deffn {Command Option} -b
-specifies that @code{scm} should run non-interactively. That means that
+specifies that @code{scm} should run non-interactively. That means that
@code{scm} will terminate after processing the command line or if there
are errors.
@end deffn
@@ -1404,29 +1444,6 @@ treated as program aguments.
specifies that there are no more options on the command line.
@end deffn
-@deffn {Command Option} -d filename
-loads SLIB database-utilities and opens @var{filename} as a database.
-@end deffn
-
-@deffn {Command Option} -o filename
-saves the current SCM session as the executable program @file{filename}.
-This option works only in SCM builds supporting @code{dump}
-(@pxref{Dump}).
-
-If options appear on the command line after @samp{-o @var{filename}},
-then the saved session will continue with processing those options when
-it is invoked. Otherwise the (new) command line is processed as usual
-when the saved image is invoked.
-@end deffn
-
-@deffn {Command Option} ---help
-prints usage information and URL; then exit.
-@end deffn
-
-@deffn {Command Option} ---version
-prints version information and exit.
-@end deffn
-
@node Invocation Examples, SCM Variables, SCM Options, Operational Features
@section Invocation Examples
@@ -1464,7 +1481,7 @@ Like above but @code{rev4-optional-procedures} are also loaded.
@defvr {Environment Variable} SCM_INIT_PATH
is the pathname where @code{scm} will look for its initialization
-code. The default is the file @file{Init@value{SCMVERSION}.scm} in the
+code. The default is the file @file{Init@value{SCMVERSION}.scm} in the
source directory.
@end defvr
@@ -1485,22 +1502,22 @@ is not defined, the default is @samp{ed}.
@section Scheme Variables
@defvar *argv*
-contains the list of arguments to the program. @code{*argv*} can change
-during argument processing. This list is suitable for use as an argument
+contains the list of arguments to the program. @code{*argv*} can change
+during argument processing. This list is suitable for use as an argument
to [SLIB] @code{getopt}.
@end defvar
-@defvar *R4RS-macro*
+@defvar *syntax-rules*
controls whether loading and interaction support syntax-rules
-macros. Define this in @file{ScmInit.scm} or files specified on the
-command line. This can be overridden by subsequent @code{-m} and
+macros. Define this in @file{ScmInit.scm} or files specified on the
+command line. This can be overridden by subsequent @code{-m} and
@code{-u} options.
@end defvar
@defvar *interactive*
controls interactivity as explained for the @code{-i} and @code{-b}
-options. Define this in @file{ScmInit.scm} or files specified on the
-command line. This can be overridden by subsequent @code{-i} and
+options. Define this in @file{ScmInit.scm} or files specified on the
+command line. This can be overridden by subsequent @code{-i} and
@code{-b} options.
@end defvar
@@ -1529,6 +1546,12 @@ systems, SCM can also tail-call another program. @xref{I/O-Extensions,
execp}.
@end defun
+@deffn {Callback procedure} boot-tail dumped?
+@code{boot-tail} is called by @code{scm_top_level} just before entering
+interactive top-level. If @code{boot-tail} calls @code{quit}, then
+interactive top-level is not entered.
+@end deffn
+
@defun program-arguments
Returns a list of strings of the arguments scm was called with.
@end defun
@@ -1699,7 +1722,7 @@ GNU Emacs. PSD runs slowly, so start by instrumenting only a few
functions at a time.
@lisp
http://swissnet.ai.mit.edu/ftpdir/scm/slib-psd1-3.tar.gz
-ftp.gnu.org:pub/gnu/jacal/slib-psd1-3.tar.gz
+swissnet.ai.mit.edu:/pub/scm/slib-psd1-3.tar.gz
ftp.maths.tcd.ie:pub/bosullvn/jacal/slib-psd1-3.tar.gz
ftp.cs.indiana.edu:/pub/scheme-repository/utl/slib-psd1-3.tar.gz
@end lisp
@@ -1953,14 +1976,16 @@ no prompt or information is printed.
@item >= 1
a prompt is printed.
@item >= 2
-the CPU time is printed after each top level form evaluated.
+messages bracketing file loading are printed.
@item >= 3
-messages about heap growth are printed.
+the CPU time is printed after each top level form evaluated;
+notifications of heap growth printed.
@item >= 4
-garbage collection (@pxref{Garbage Collection}) messages are printed.
+a garbage collection summary is printed after each top level form
+evaluated;
@item >= 5
-a warning will be printed for each top-level symbol which is defined
-more than one time.
+a message for each GC (@pxref{Garbage Collection}) is printed;
+warnings issued for top-level symbols redefined.
@end table
@end defun
@@ -2070,7 +2095,7 @@ This combination of interpretatons allows SCM source files to be used as
POSIX shell-scripts if the first line is:
@example
-#!/usr/local/bin/scm \
+#! /usr/local/bin/scm \
@end example
@noindent
@@ -2189,7 +2214,7 @@ moved.
@noindent
The following approach solves these problems at the expense of slower
-startup. Make @samp{#!/bin/sh} the first line and prepend every
+startup. Make @samp{#! /bin/sh} the first line and prepend every
subsequent line to be executed by the shell with @code{:;}. The last
line to be executed by the shell should contain an @dfn{exec} command;
@code{exec} tail-calls its argument.
@@ -2253,6 +2278,7 @@ http://swissnet.ai.mit.edu/~jaffer/SLIB.html
* Interrupts:: and exceptions
* Process Synchronization:: Because interrupts are preemptive
* Files and Ports::
+* Line Numbers::
* Soft Ports:: Emulate I/O devices
* Syntax Extensions::
* Low Level Syntactic Hooks::
@@ -2396,9 +2422,10 @@ values returned by @code{current-input-port} and
@defvar *load-pathname*
Is set to the pathname given as argument to @code{load},
-@code{try-load}, and @code{dyn:link} (@pxref{Compiling And Linking}).
-@code{*load-pathname*} is used to compute the value of @ref{Vicinity,
-program-vicinity, , slib, SLIB}.
+@code{try-load}, and @code{dyn:link}
+(@pxref{Compiling And Linking, , , hobbit, Hobbit}).
+@code{*load-pathname*} is used to compute the value of
+@ref{Vicinity, program-vicinity, , slib, SLIB}.
@end defvar
@defun line-number
@@ -2413,8 +2440,10 @@ not open to a file the result is unspecified.
@defun port-line port
@defunx port-column port
If @var{port} is a tracked port, return the current line (column) number,
-otherwise return @code{#f}. Line numbers begin with 1, the column number is
-zero if there are no characters on the current line.
+otherwise return @code{#f}. Line and column numbers begin with 1.
+The column number applies to the next character to be read; if that
+character is a newline, then the column number will be one more than
+the length of the line.
@end defun
@defun eval obj
@@ -2581,9 +2610,77 @@ To unestablish a response for an error set the handler symbol to
@code{#f}. For instance, @code{(set! could-not-open #f)}.
@end deffn
+@deffn {Callback procedure} gc-hook @dots{}
+Allows a Scheme procedure to be run shortly after each garbage collection.
+This procedure will not be run recursively. If it runs long enough
+to cause a garbage collection before returning a warning will be
+printed.
+@end deffn
+
+@defun add-finalizer object finalizer
+@var{object} may be any garbage collected object, that is, any object
+other than an immediate integer, character, or special token such
+as @code{#f} or @code{#t}, @xref{Immediates}. @var{finalizer} is
+a thunk, or procedure taking no arguments.
+
+@var{finalizer} will be invoked asynchronously exactly once some time
+after @var{object} becomes eligible for garbage collection. A reference
+to @var{object} in the environment of @var{finalizer} will not prevent
+finalization, but will delay the reclamation of @var{object} at least
+until the next garbage collection. A reference to @var{object} in some
+other object's finalizer will necessarily prevent finalization until both
+objects are eligible for garbage collection.
+
+Finalizers are not run in any predictable order. All finalizers will be
+run by the time the program ends.
+
+This facility was based on the paper by Simon Peyton Jones, et al,
+``Stretching the storage manager: weak pointers and stable names in
+Haskell'', Proc. 11th International Workshop on the Implementation of
+Functional Languages, The Netherlands, September 7-10 1999,
+Springer-Verlag LNCS.
+
+@end defun
+
@node Process Synchronization, Files and Ports, Interrupts, The Language
@section Process Synchronization
+@noindent
+An @dfn{exchanger} is a procedure of one argument regulating mutually
+@cindex exchanger
+exclusive access to a resource. When a exchanger is called, its current
+content is returned, while being replaced by its argument in an atomic
+operation.
+
+@defun make-exchanger obj
+
+Returns a new exchanger with the argument @var{obj} as its initial
+content.
+
+@example
+(define queue (make-exchanger (list a)))
+@end example
+
+A queue implemented as an exchanger holding a list can be protected from
+reentrant execution thus:
+
+@example
+(define (pop queue)
+ (let ((lst #f))
+ (dynamic-wind
+ (lambda () (set! lst (queue #f)))
+ (lambda () (and lst (not (null? lst))
+ (let ((ret (car lst)))
+ (set! lst (cdr lst))
+ ret)))
+ (lambda () (and lst (queue lst))))))
+
+(pop queue) @result{} a
+
+(pop queue) @result{} #f
+@end example
+@end defun
+
@defun make-arbiter name
Returns an object of type arbiter and name @var{name}. Its state is
@@ -2602,7 +2699,7 @@ Returns @code{#t} and unlocks @var{arbiter} if @var{arbiter} was locked.
Otherwise, returns @code{#f}.
@end defun
-@node Files and Ports, Soft Ports, Process Synchronization, The Language
+@node Files and Ports, Line Numbers, Process Synchronization, The Language
@section Files and Ports
@noindent
@@ -2626,12 +2723,16 @@ Internal functions opening files @dfn{callback} to the SCM function
@defvrx Constant open_both
Contain modes strings specifying that a file is to be opened for
reading, writing, and both reading and writing respectively.
+
+Both input and output functions can be used with io-ports. An end of
+file must be read or a file-set-position done on the port between a read
+operation and a write operation or vice-versa.
@end defvr
@defun _ionbf modestr
Returns a version of @var{modestr} which when @code{open-file} is called
-with it as the second argument will return an unbuffered port. A
-non-file input-port must be unbuffered in order for @code{char-ready?} and
+with it as the second argument will return an unbuffered port. An
+input-port must be unbuffered in order for @code{char-ready?} and
@code{wait-for-input} to work correctly on it. The initial value of
@code{(current-input-port)} is unbuffered if the platform supports it.
@end defun
@@ -2640,20 +2741,28 @@ non-file input-port must be unbuffered in order for @code{char-ready?} and
Returns a version of @var{modestr} which when @code{open-file} is called
with it as the second argument will return a tracked port. A tracked
port maintains current line and column numbers, which may be queried
-with @code{port_line} and @code{port_column}.
+with @code{port-line} and @code{port-column}.
@end defun
-@defun close-port port
-Closes @var{port}. The same as close-input-port and close-output-port.
+@defun _exclusive modestr
+Returns a version of @var{modestr} which when @code{open-file} is called
+with it as the second argument will return a port only if the named file
+does not already exist. This functionality is provided by calling
+@code{try-create-file} @xref{I/O-Extensions}, which is not available
+for all platforms.
+@end defun
+
+@defun port-closed? port
+Returns #t if @var{port} is closed.
@end defun
-@defun open-io-file filename
-@defunx close-io-port port
-These functions are analogous to the standard scheme file functions.
-The ports are open to @var{filename} in read/write mode. Both input and
-output functions can be used with io-ports. An end of file must be read
-or a file-set-position done on the port between a read operation and a
-write operation or vice-versa.
+@defun port-type obj
+If @var{obj} is not a port returns false, otherwise returns
+a symbol describing the port type, for example string or pipe.
+@end defun
+
+@defun close-port port
+Closes @var{port}. The same as close-input-port and close-output-port.
@end defun
@defun current-error-port
@@ -2677,6 +2786,15 @@ and with-error-to-file in that the first argument is a port, rather
than a string naming a file.
@end defun
+@defun call-with-outputs thunk proc
+Calls the @var{thunk} procedure while the current-output-port and
+current-error-port are directed to string-ports. If @var{thunk}
+returns, the @var{proc} procedure is called with the output-string, the
+error-string, and the value returned by @var{thunk}. If @var{thunk}
+does not return a value (perhaps because of error), @var{proc} is called
+with just the output-string and the error-string as arguments.
+@end defun
+
@deffn {procedure} char-ready?
@deffnx {procedure} char-ready? port
@@ -2726,12 +2844,76 @@ Returns @code{#t} if @var{port} is input or output to a serial non-file device.
Outputs a newline to optional argument @var{port} unless the current
output column number of @var{port} is known to be zero, ie output will
start at the beginning of a new line. @var{port} defaults to
-@code{current-output-port}. If @var{port} is not a tracked port
+@code{current-output-port}. If @var{port} is not a tracked port
@code{freshline} is equivalent to @code{newline}.
@end defun
+@defun open-ports
+Returns a list of all currently open ports, excluding string ports,
+see @xref{String Ports, , , slib, SLIB}. This may be useful after
+a fork @xref{Posix Extensions}, or for debugging. Bear in mind that
+ports that would be closed by gc will be kept open by a reference to
+this list.
+@end defun
+
+
+@node Line Numbers, Soft Ports, Files and Ports, The Language
+@section Line Numbers
+
+Scheme code define by load may optionally contain line number
+information. Currently this information is used only for reporting
+expansion time errors, but in the future run-time error messages may
+also include line number information.
+
+@defun try-load pathname reader
+This is the primitive for loading, @var{pathname} is the name of
+a file containing Scheme code, and optional argument @var{reader} is
+a function of one argument, a port. @var{reader} should read and
+return Scheme code as list structure. The default value is @code{read},
+which is used if @var{reader} is not supplied or is false.
+@end defun
+
+Line number objects are disjoint from integers or other Scheme types.
+When evaluated or loaded as Scheme code, an s-expression containing a
+line-number in the car is equivalent to the cdr of the s-expression. A
+pair consisting of a line-number in the car and a vector in the cdr is
+equivalent to the vector. The meaning of s-expressions with
+line-numbers in other positions is undefined.
-@node Soft Ports, Syntax Extensions, Files and Ports, The Language
+@defun read-numbered port
+Behaves like @code{read}, except that every s-expression read will be
+replaced with a cons of a line-number object and the sexp actually read.
+This replacement is done only if @var{port} is a tracked port
+See @xref{Files and Ports}.
+@end defun
+
+@defun integer->line-number int
+Returns a line-number object with value @var{int}. @var{int} should
+be an exact non-negative integer.
+@end defun
+
+@defun line-number->integer linum
+Returns the value of line-number object @var{linum} as an integer.
+@end defun
+
+@defun line-number? obj
+Returns true if and only if @var{obj} is a line-number object.
+@end defun
+
+@defvar *load-reader*
+@defvarx *slib-load-reader*
+The value of @code{*load-reader*} should be a value acceptable as
+the second argument to @code{try-load} (note that #f is acceptable).
+This value will be used to read code during calls to @code{scm:load}.
+The value of @code{*slib-load-reader*} will similarly be used during
+calls to @code{slib:load} and @code{require}.
+
+In order to disable all line-numbering, it is sufficient to set!
+@code{*load-reader*} and @code{*slib-load-reader*} to #f.
+@end defvar
+
+
+@node Soft Ports, Syntax Extensions, Line Numbers, The Language
@section Soft Ports
@noindent
@@ -2766,6 +2948,9 @@ If thunk 3 returns @code{#f} or an @code{eof-object} (@pxref{Input,
eof-object?, ,r5rs, Revised(5) Scheme}) it indicates that the port has
reached end-of-file. For example:
+If it is necessary to explicitly close the port when it is garbage
+collected, (@pxref{Interrupts, add-finalizer}).
+
@example
(define stdout (current-output-port))
(define p (make-soft-port
@@ -2917,9 +3102,9 @@ is bound. The result of the @samp{set!} expression is unspecified.
@end example
@end defspec
-@defspec casev key clause1 clause2 @dots{}
-@code{casev} is an extension of standard Scheme @code{case}: Each
-@var{clause} of a @code{casev} statement must have as first element a
+@defspec qase key clause1 clause2 @dots{}
+@code{qase} is an extension of standard Scheme @code{case}: Each
+@var{clause} of a @code{qase} statement must have as first element a
list containing elements which are:
@itemize @bullet
@@ -2932,7 +3117,7 @@ a comma followed by an at-sign (@@) followed by the name of a symbolic
constant whose value is a list.
@end itemize
-A @code{casev} statement is equivalent to a @code{case} statement in
+A @code{qase} statement is equivalent to a @code{case} statement in
which these symbolic constants preceded by commas have been replaced by
the values of the constants, and all symbolic constants preceded by
comma-at-signs have been replaced by the elements of the list values of
@@ -2941,20 +3126,20 @@ similar to that of @code{quasiquote} except that the unquoted
expressions must be @dfn{symbolic constants}.
Symbolic constants are defined using @code{defconst}, their values are
-substituted in the head of each @code{casev} clause during macro
+substituted in the head of each @code{qase} clause during macro
expansion. @code{defconst} constants should be defined before use.
-@code{casev} can be substituted for any correct use of @code{case}.
+@code{qase} can be substituted for any correct use of @code{case}.
@format
@t{(defconst unit '1)
(defconst semivowels '(w y))
-(casev (* 2 3)
+(qase (* 2 3)
((2 3 5 7) 'prime)
((,unit 4 6 8 9) 'composite)) ==> composite
-(casev (car '(c d))
+(qase (car '(c d))
((a) 'a)
((b) 'b)) ==> @emph{unspecified}
-(casev (car '(c d))
+(qase (car '(c d))
((a e i o u) 'vowel)
((,@@semivowels) 'semivowel)
(else 'consonant)) ==> consonant
@@ -2964,10 +3149,97 @@ expansion. @code{defconst} constants should be defined before use.
@end defspec
@noindent
+@findex defmacro
+@findex macroexpand
+@findex macroexpand-1
+@findex gentemp
SCM also supports the following constructs from Common Lisp:
@code{defmacro}, @code{macroexpand}, @code{macroexpand-1}, and
@code{gentemp}. @xref{Defmacro, , , slib, SLIB}.
+SCM @code{defmacro} is extended over that described for SLIB:
+
+@lisp
+(defmacro (macro-name . arguments) body)
+@end lisp
+
+is equivalent to
+
+@lisp
+(defmacro macro-name arguments body)
+@end lisp
+
+As in Common Lisp, an element of the formal argument list for
+@code{defmacro} may be a possibly nested list, in which case the
+corresponding actual argument must be a list with as many members as the
+formal argument. Rest arguments are indicated by improper lists, as in
+Scheme. It is an error if the actual argument list does not have the
+tree structure required by the formal argument list.
+
+For example:
+
+@lisp
+(defmacro (let1 ((name value)) . body)
+ `((lambda (,name) ,@@body) ,value))
+
+(let1 ((x (foo))) (print x) x) @equiv{} ((lambda (x) (print x) x) (foo))
+
+(let1 not legal syntax) @error{} not "does not match" ((name value))
+@end lisp
+
+@findex syntax-rules
+SCM supports [R5RS] @code{syntax-rules} macros
+@xref{Macros, , ,r5rs, Revised(5) Scheme}.
+
+The pattern language is extended by the syntax @code{(... <obj>)}, which
+is identical to @code{<obj>} except that ellipses in @code{<obj>} are
+treated as ordinary identifiers in a template, or as literals in a
+pattern. In particular, @code{(... ...)} quotes the ellipsis token
+@code{...} in a pattern or template.
+
+For example:
+@lisp
+(define-syntax check-tree
+ (syntax-rules ()
+ ((_ (?pattern (... ...)) ?obj)
+ (let loop ((obj ?obj))
+ (or (null? obj)
+ (and (pair? obj)
+ (check-tree ?pattern (car obj))
+ (loop (cdr obj))))))
+ ((_ (?first . ?rest) ?obj)
+ (let ((obj ?obj))
+ (and (pair? obj)
+ (check-tree ?first (car obj))
+ (check-tree ?rest (cdr obj)))))
+ ((_ ?atom ?obj) #t)))
+
+(check-tree ((a b) ...) '((1 2) (3 4) (5 6))) @result{} #t
+
+(check-tree ((a b) ...) '((1 2) (3 4) not-a-2list) @result{} #f
+@end lisp
+
+Note that although the ellipsis is matched as a literal token in the
+defined macro it is not included in the literals list for
+@code{syntax-rules}.
+
+The pattern language is also extended to support identifier macros. A
+reference to an identifier macro keyword that is not the first
+identifier in a form may expand into Scheme code, rather than raising a
+``keyword as variable'' error. The pattern for expansion of such a bare
+macro keyword is a single identifier, as in other syntax rules the
+identifier is ignored.
+
+For example:
+@lisp
+(define-syntax eight
+ (syntax-rules ()
+ (_ 8)))
+
+(+ 3 eight) @result{} 11
+(eight) @result{} ERROR
+(set! eight 9) @result{} ERROR
+@end lisp
@node Low Level Syntactic Hooks, Syntactic Hooks for Hygienic Macros, Syntax Extensions, The Language
@section Low Level Syntactic Hooks
@@ -2998,7 +3270,6 @@ defining it. Call this saved value if an invocation's syntax is not
recognized. This will allow @code{#+}, @code{#-}, @code{#!}, and
@ref{Uniform Array}s to still be supported (as they use @code{read:sharp}).
-
@defun procedure->syntax proc
Returns a @dfn{macro} which, when a symbol defined to this value appears
as the first symbol in an expression, returns the result of applying
@@ -3007,6 +3278,7 @@ as the first symbol in an expression, returns the result of applying
@defun procedure->macro proc
@defunx procedure->memoizing-macro proc
+@defunx procedure->identifier-macro
Returns a @dfn{macro} which, when a symbol defined to this value appears
as the first symbol in an expression, evaluates the result of applying
@var{proc} to the expression and the environment. The value returned
@@ -3015,19 +3287,34 @@ from @var{proc} which has been passed to
@var{proc}. For example:
@example
-(define trace
+(defsyntax trace
(procedure->macro
(lambda (x env) `(set! ,(cadr x) (tracef ,(cadr x) ',(cadr x))))))
(trace @i{foo}) @equiv{} (set! @i{foo} (tracef @i{foo} '@i{foo})).
@end example
+
+@code{PROCEDURE->IDENTIFIER-MACRO} is similar to
+@code{PROCEDURE->MEMOIZING-MACRO} except that @var{proc} is also
+called in case the symbol bound to the macro appears in an expression
+but @emph{not} as the first symbol, that is, when it looks like a
+variable reference. In that case, the form passed to @var{proc} is
+a single identifier.
+
@end defun
-@defun environment->tree env
-An @dfn{environment} is an opaque object representing lexical bindings.
-@code{environment->tree} returns a representation of the environment
-@var{env} as a list of environment frames. There are 2 types of
-environment frames:
+@defspec defsyntax name expr
+Defines @var{name} as a macro keyword bound to the result of evaluating
+@var{expr}, which should be a macro. Using @code{define} for this
+purpose may not result in @var{name} being interpreted as a macro
+keyword.
+@end defspec
+
+An @dfn{environment} is a list of frames representing lexical bindings.
+Only the names and scope of the bindings are included in environments
+passed to macro expanders -- run-time values are not included.
+
+There are several types of environment frames:
@table @code
@item ((lambda (variable1 @dots{}) @dots{}) value1 @dots{})
@@ -3035,17 +3322,58 @@ environment frames:
@itemx (letrec ((variable1 value1) @dots{}) @dots{})
result in a single enviroment frame:
@example
-((variable1 @dots{}) value1 @dots{})
+
+(variable1 variable2 @dots{})
+
@end example
@item (let ((variable1 value1)) @dots{})
@itemx (let* ((variable1 value1) @dots{}) @dots{})
result in an environment frame for each variable:
@example
-(variable1 . value1) (variable2 . value2) @dots{}
+
+variable1 variable2 @dots{}
+
@end example
+
+@item (let-syntax ((key1 macro1) (key2 macro2)) @dots{})
+@itemx (letrec-syntax ((key1 value1) (key2 value2)) @dots{})
+Lexically bound macros result in environment frames consisting of
+a marker and an alist of keywords and macro objects:
+@example
+
+(<env-syntax-marker> (key1 . value1) (key2 . value2))
+
+@end example
+Currently <env-syntax-marker> is the integer 6.
+
+@item line numbers
+Line numbers (@pxref{Line Numbers}) may be included in the environment
+as frame entries to indicate the line number on which a function is
+defined. They are ignored for variable lookup.
+@example
+
+#<line 8>
+
+@end example
+
+@item miscellaneous
+Debugging information is stored in environments in a plist format: Any
+exact integer stored as an environment frame may be followed by any
+value. The two frame entries are ignored when doing variable lookup.
+Load file names, procedure names, and closure documentation strings
+are stored in this format.
+@example
+
+<env-filename-marker> "foo.scm" <env-procedure-name-marker> foo @dots{}
+
+@end example
+
+Currently <env-filename-marker> is the integer 1 and
+<env-procedure-name-marker> the integer 2.
+
+
@end table
-@end defun
@defspec @@apply procedure argument-list
Returns the result of applying @var{procedure} to @var{argument-list}.
@@ -3063,15 +3391,6 @@ Thus a mutable environment can be treated as both a list and local
bindings.
@end defspec
-@defspec @@call-with-current-continuation procedure
-Returns the result of applying @var{procedure} to the current
-continuation. A @dfn{continuation} is a SCM object of type
-@code{contin} (@pxref{Continuations}). The procedure
-@code{(call-with-current-continuation @var{procedure})} is defined to
-have the same effect as @code{(@@call-with-current-continuation
-procedure)}.
-@end defspec
-
@node Syntactic Hooks for Hygienic Macros, , Low Level Syntactic Hooks, The Language
@section Syntactic Hooks for Hygienic Macros
@@ -3124,7 +3443,8 @@ Returns the symbol obtained by recursively extracting the parent of
If an identifier returned by this version of @code{gentemp} is inserted
in a binding position as the name of a variable then it is guaranteed
-that no other identifier may denote that variable. If an identifier
+that no other identifier (except one produced by passing the first to
+@code{renamed-identifier}) may denote that variable. If an identifier
returned by @code{gentemp} is inserted free, then it will denote the
top-level value bound to its parent, the symbol named ``An unlikely
variable''. This behavior, of course, is meant to be put to good use:
@@ -3155,17 +3475,10 @@ be restricted to the lexical scope of its environment.
There is another restriction imposed for implementation convenience:
Macros passing their lexical environments to @code{renamed-identifier}
-may be lexically bound only by the special forms @code{@@let-syntax} or
-@code{@@letrec-syntax}. No error is signaled if this restriction is not
+may be lexically bound only by the special forms @code{let-syntax} or
+@code{letrec-syntax}. No error is signaled if this restriction is not
met, but synthetic identifier lookup will not work properly.
-@defspec @@let-syntax
-@defspecx @@letrec-syntax
-Behave as @code{let} and @code{letrec}, but may also put extra
-information in the lexical environment so that @code{renamed-identifier}
-will work properly during expansion of the macros bound by these forms.
-@end defspec
-
In order to maintain referential transparency it is necessary to
determine whether two identifiers have the same denotation. With
synthetic identifiers it is not necessary that two identifiers be
@@ -3174,8 +3487,8 @@ synthetic identifiers it is not necessary that two identifiers be
@defun identifier-equal? id1 id2 env
Returns @code{#t} if identifiers @var{id1} and @var{id2} denote the same
binding in lexical environment @var{env}, and @code{#f} otherwise.
-@var{env} must be a lexical environment passed to a macro transformer
-during macro expansion.
+@var{env} must either be a lexical environment passed to a macro transformer
+during macro expansion or the empty list.
For example,
@lisp
@@ -3240,7 +3553,7 @@ proposed by W. Clinger [Exrename] is supported. Syntax may be defined
in @code{define-syntax}, @code{let-syntax}, and @code{letrec-syntax}
using @code{renaming-transformer} instead of @code{syntax-rules}.
@var{proc} should evaluate to a procedure accepting three arguments:
-@var{expr}, @var{rename}, and @var{compare}. @var{expr} is a
+@var{expr}, @var{rename}, and @var{compare}. @var{expr} is a
representation of Scheme code to be expanded, as list structure.
@var{rename} is a procedure accepting an identifier and returning an
identifier renamed in the definition environment of the new syntax.
@@ -3252,72 +3565,47 @@ both denote the same binding in the usage environment of the new syntax.
@chapter Packages
@menu
-* Compiling And Linking:: Hobbit
* Dynamic Linking::
* Dump:: Create Fast-Booting Executables
* Numeric:: Numeric Language Extensions
* Arrays:: As in APL
+* Records:: Define new aggregate data types
* I/O-Extensions:: i/o-extensions
* Posix Extensions:: posix
+* Unix Extensions:: non-posix unix
* Regular Expression Pattern Matching:: regex
* Line Editing:: edit-line
* Curses:: Screen Control
* Sockets:: Cruise the Net
@end menu
+@cindex Xlib
+@cindex Xlibscm
+@cindex xlib
+@cindex xlibscm
+@cindex x
+@cindex X
+@cindex graphics
+@cindex hobbit
@menu
* Xlib: (Xlibscm). X Window Graphics.
+* Hobbit: (hobbit). Scheme-to-C Compiler.
@end menu
-@node Compiling And Linking, Dynamic Linking, Packages, Packages
-@section Compiling And Linking
-
-@defun compile-file name1 name2 @dots{}
-If the HOBBIT compiler is installed in the
-@code{(implementation-vicinity)}, compiles the files @var{name1}
-@var{name2} @dots{} to an object file name @var{name1}<object-suffix>,
-where <object-suffix> is the object file suffix for your computer (for
-instance, @file{.o}). @var{name1} must be in the current directory;
-@var{name2} @dots{} can be in other directories.
-@end defun
+@iftex
+@section hobbit
-@defun link-named-scm name module1 @dots{}
-Creates a new SCM executable with name @var{name}. @var{name} will
-include the object modules @var{module1} @dots{} which can be produced
-with @code{compile-file}.
+@ifset html
+<A HREF="hobbit_toc.html">
+@code{(require 'compile)}
-@example
-cd ~/scm/
-scm -e'(link-named-scm"cute""cube")'
-(delete-file "scmflags.h")
-(call-with-output-file
- "scmflags.h"
- (lambda (fp)
- (for-each
- (lambda (string) (write-line string fp))
- '("#define IMPLINIT \"/home/jaffer/scm/Init@value{SCMVERSION}.scm\""
- "#define COMPILED_INITS init_cube();"
- "#define BIGNUMS"
- "#define FLOATS"
- "#define ARRAYS"))))
-(system "gcc -Wall -O2 -c continue.c findexec.c time.c
- repl.c scl.c eval.c sys.c subr.c unif.c rope.c scm.c")
-@dots{}
-scm.c: In function `scm_init_extensions':
-scm.c:95: warning: implicit declaration of function `init_cube'
-scm.c: In function `scm_cat_path':
-scm.c:589: warning: implicit declaration of function `realloc'
-scm.c:594: warning: implicit declaration of function `malloc'
-scm.c: In function `scm_try_path':
-scm.c:612: warning: implicit declaration of function `free'
-(system "cc -o cute continue.o findexec.o time.o repl.o scl.o
- eval.o sys.o subr.o unif.o rope.o scm.o cube.o -lm -lc")
-
-Compilation finished at Sun Jul 21 00:59:17
-@end example
-@end defun
+@dfn{hobbit}
+</A>
+is a SCM->C compiler.
+@end ifset
+@end iftex
-@node Dynamic Linking, Dump, Compiling And Linking, Packages
+@node Dynamic Linking, Dump, Packages, Packages
@section Dynamic Linking
@noindent
@@ -3492,10 +3780,12 @@ dump is the last expression in that file.
@item
Calls @code{gc}.
@item
+@findex boot-tail
Creates an executable program named @var{newpath} which continues the
state of the current SCM session when invoked. The optional argument
-@var{thunk}, if provided, should be a procedure of no arguments. This
-procedure will be called in the restored executable.
+@var{thunk}, if provided, should be a procedure of no arguments;
+@var{boot-tail} will be set to this procedure, causing it to be called
+in the restored executable.
If the optional argument is missing or a boolean, SCM's standard command
line processing will be called in the restored executable.
@@ -3527,10 +3817,6 @@ arguments for the curent invocation. More specifically,
from the dumping session. Command line processing is done on
the value of the identifier @code{*argv*}.
-The thunk @code{boot-tail} is called by SCM to process command line
-arguments. @code{dump} sets @code{boot-tail} to the @var{thunk} it is
-called with.
-
The following example shows how to create @samp{rscm}, which is like
regular scm, but which loads faster and has the @samp{random} package
alreadly provided.
@@ -3574,10 +3860,23 @@ The immediate integer closest to positive infinity.
The immediate integer closest to negative infinity.
@end defvr
+@defvr Constant $pi
+@defvrx Constant pi
+The ratio of the circumference to the diameter of a circle.
+@end defvr
+
@noindent
These procedures augment the standard capabilities in @ref{Numerical
operations, , ,r5rs, Revised(5) Scheme}.
+@defun pi* z
+@code{(* pi @var{z})}
+@end defun
+
+@defun pi/ z
+@code{(/ pi @var{z})}
+@end defun
+
@defun sinh z
@defunx cosh z
@defunx tanh z
@@ -3627,7 +3926,7 @@ an error if the value which should be returned by a call to @code{$expt}
is not real.
@end defun
-@node Arrays, I/O-Extensions, Numeric, Packages
+@node Arrays, Records, Numeric, Packages
@section Arrays
@menu
@@ -3765,7 +4064,7 @@ Returns a list of inclusive bounds of integers.
@defun array-dimensions array
@code{Array-dimensions} is similar to @code{array-shape} but replaces
-elements with a @code{0} minimum with one greater than the maximum. So:
+elements with a @code{0} minimum with one greater than the maximum. So:
@example
(array-dimensions (make-array 'foo '(-1 3) 5)) @result{} ((-1 3) 5)
@end example
@@ -3811,7 +4110,7 @@ If @var{array} may be @dfn{unrolled} into a one dimensional shared array
without changing their order (last subscript changing fastest), then
@code{array-contents} returns that shared array, otherwise it returns
@code{#f}. All arrays made by @var{make-array} and
-@var{make-uniform-array} may be unrolled, some arrays made by
+@var{create-array} may be unrolled, some arrays made by
@var{make-shared-array} may not be.
If the optional argument @var{strict} is provided, a shared array will
@@ -3864,7 +4163,7 @@ One can implement @var{array-indexes} as
Another example:
@example
(define (apl:index-generator n)
- (let ((v (make-uniform-vector n 1)))
+ (let ((v (make-vector n 1)))
(array-index-map! v (lambda (i) i))
v))
@end example
@@ -3880,6 +4179,7 @@ a conventional array if it is not. This function is used internally
by @code{array-map!} and friends to handle scalar arguments.
@end defun
+
@node Uniform Array, Bit Vectors, Array Mapping, Arrays
@subsection Uniform Array
@@ -3889,28 +4189,14 @@ the same type. Uniform vectors occupy less storage than conventional
vectors. Uniform Array procedures also work on vectors,
uniform-vectors, bit-vectors, and strings.
-@noindent
-@var{prototype} arguments in the following procedures are interpreted
-according to the table:
-
-@example
-prototype type display prefix
-
-#t boolean (bit-vector) #At
-#\a char (string) #A\
-integer >0 unsigned integer #Au
-integer <0 signed integer #Ae
-1.0 float (single precision) #Aif
-1/3 double (double precision float) #Aid
-+i complex (double precision) #Aic
-() conventional vector #A
-@end example
+SLIB now supports uniform arrys. The primary array creation procedure
+is @code{create-array}, detailed in @xref{Arrays, , , slib, SLIB}.
@noindent
Unshared uniform character 0-based arrays of rank 1 (dimension)
are equivalent to (and can't be distinguished from) strings.
@example
-(make-uniform-array #\a 3) @result{} "$q2"
+(create-array "" 3) @result{} "$q2"
@end example
@noindent
@@ -3918,7 +4204,7 @@ Unshared uniform boolean 0-based arrays of rank 1 (dimension) are
equivalent to (and can't be distinguished from) @ref{Bit Vectors,
bit-vectors}.
@example
-(make-uniform-array #t 3) @result{} #*000
+(create-array '#at() 3) @result{} #*000
@equiv{}
#At(#f #f #f) @result{} #*000
@equiv{}
@@ -3926,39 +4212,41 @@ bit-vectors}.
@end example
@noindent
-Other uniform vectors are written in a form similar to that of general
-arrays, except that one or more modifying characters are put between
-the #\A character and the contents list. For example, @code{'#Ae(3 5 9)}
-returns a uniform vector of signed integers.
+@var{prototype} arguments in the following procedures are interpreted
+according to the table:
-@defun uniform-vector-ref uve index
-Returns the element at the @var{index} element in @var{uve}.
-@end defun
+@example
+prototype type display prefix
+
+() conventional vector #a
++64i complex (double precision) #ac64
+64.0 double (double precision) #ar64
+32.0 float (single precision) #ar32
+32 unsigned integer (32-bit) #au32
+-32 signed integer (32-bit) #as32
+-16 signed integer (16-bit) #as16
+#\a char (string) #a\
+#t boolean (bit-vector) #at
+@end example
-@defun uniform-vector-set! uve index new-value
-Sets the element at the @var{index} element in @var{uve} to
-@var{new-value}. The value returned by @code{uniform-vector-set!} is
-unspecified.
-@end defun
+@noindent
+Other uniform vectors are written in a form similar to that of general
+arrays, except that one or more modifying characters are put between the
+#\A character and the contents list. For example, @code{'#As32(3 5 9)}
+returns a uniform vector of signed integers.
@defun array? obj prototype
Returns @code{#t} if the @var{obj} is an array of type corresponding to
@var{prototype}, and @code{#f} if not.
@end defun
-@defun make-uniform-array prototype bound1 bound2 @dots{}
-Creates and returns a uniform array of type corresponding to
-@var{prototype} that has as many dimensions as there are @var{bound}s.
-@end defun
-
@defun array-prototype array
Returns an object that would produce an array of the same type as
@var{array}, if used as the @var{prototype} for
-@code{make-uniform-array}.
+@code{list->uniform-array}.
@end defun
@defun list->uniform-array rank prot lst
-@defunx list->uniform-vector prot lst
Returns a uniform array of the type indicated by prototype @var{prot}
with elements the same as those of @var{lst}. Elements must be of the
appropriate type, no coercions are done.
@@ -3977,14 +4265,8 @@ Stores @var{fill} in every element of @var{uve}. The value returned is
unspecified.
@end defun
-@defun uniform-vector-length uve
-Returns the number of elements in @var{uve}.
-@end defun
-
@defun dimensions->uniform-array dims prototype fill
@defunx dimensions->uniform-array dims prototype
-@defunx make-uniform-vector length prototype fill
-@defunx make-uniform-vector length prototype
Creates and returns a uniform array or vector of type corresponding to
@var{prototype} with dimensions @var{dims} or length @var{length}. If
the @var{fill} argument is supplied, the returned array is filled with
@@ -3993,8 +4275,6 @@ this value.
@defun uniform-array-read! ura
@defunx uniform-array-read! ura port
-@defunx uniform-vector-read! uve
-@defunx uniform-vector-read! uve port
Attempts to read all elements of @var{ura}, in lexicographic order, as
binary objects from @var{port}. If an end of file is encountered during
uniform-array-read! the objects up to that point only are put into @var{ura}
@@ -4008,10 +4288,8 @@ returned by @code{(current-input-port)}.
@defun uniform-array-write ura
@defunx uniform-array-write ura port
-@defunx uniform-vector-write uve
-@defunx uniform-vector-write uve port
-Writes all elements of @var{ura} as binary objects to @var{port}. The
-number of of objects actually written is returned. @var{port} may be
+Writes all elements of @var{ura} as binary objects to @var{port}. The
+number of of objects actually written is returned. @var{port} may be
omitted, in which case it defaults to the value returned by
@code{(current-output-port)}.
@end defun
@@ -4043,7 +4321,6 @@ if the array element is not an exact integer or if @var{val} is not
boolean.
@end defun
-
@node Bit Vectors, , Uniform Array, Arrays
@subsection Bit Vectors
@@ -4093,8 +4370,26 @@ Returns
@var{bv} is not modified.
@end defun
+@node Records, I/O-Extensions, Arrays, Packages
+@section Records
+
+SCM provides user-definable datatypes with the same interface as SLIB,
+see @xref{Records, , , slib, SLIB}, with the following extension.
+
+@defun record-printer-set! rtd printer
+Causes records of type @var{rtd} to be printed in a user-specified format.
+@var{rtd} must be a record type descriptor returned by @code{make-record-type},
+@var{printer} a procedure accepting three arguments: the record to be printed,
+the port to print to, and a boolean which is true if the record is being
+written on behalf of @code{write} and false if for @code{display}.
+If @var{printer} returns #f, the default record printer will be called.
-@node I/O-Extensions, Posix Extensions, Arrays, Packages
+A @var{printer} value of #f means use the default printer.
+
+Only the default printer will be used when printing error messages.
+@end defun
+
+@node I/O-Extensions, Posix Extensions, Records, Packages
@section I/O-Extensions
@noindent
@@ -4103,7 +4398,7 @@ If @code{'i/o-extensions} is provided (by linking in @file{ioext.o}),
@defun stat <port-or-string>
Returns a vector of integers describing the argument. The argument
-can be either a string or an open input port. If the argument is an
+can be either a string or an open input port. If the argument is an
open port then the returned vector describes the file to which the
port is opened; If the argument is a string then the returned vector
describes the file named by that string. If there exists no file with
@@ -4154,6 +4449,14 @@ written. If @var{port} is not open to a file the action of
@code{file-set-position} is unspecified.
@end defun
+@defun try-create-file name modes perms
+If the file with name @var{name} already exists, return @code{#f},
+otherwise try to create and open the file like @code{try-open-file},
+@xref{Files and Ports}. If the optional integer argument @var{perms} is
+provided, it is used as the permissions of the new file (modified by
+the current umask).
+@end defun
+
@defun reopen-file filename modes port
Closes port @var{port} and reopens it with @var{filename} and
@var{modes}. @code{reopen-file} returns @code{#t} if successful,
@@ -4333,7 +4636,7 @@ Like @code{execl} and @code{execlp} except that the set of arguments to
@end defun
@defun putenv string
-adds or removes definitions from the @dfn{environment}. If the
+adds or removes definitions from the @dfn{environment}. If the
@var{string} is of the form @samp{NAME=VALUE}, the definition is added
to the environment. Otherwise, the @var{string} is interpreted as the
name of an environment variable, and any definition for this variable in
@@ -4351,7 +4654,7 @@ To access environment variables, use @code{getenv} (@pxref{System
Interface, getenv, , slib, SLIB}).
@end defun
-@node Posix Extensions, Regular Expression Pattern Matching, I/O-Extensions, Packages
+@node Posix Extensions, Unix Extensions, I/O-Extensions, Packages
@section Posix Extensions
@noindent
@@ -4379,6 +4682,15 @@ the standard input of the system command @var{string}. If a pipe cannot
be created @code{#f} is returned.
@end defun
+@defun broken-pipe port
+If this function is defined at top level, it will be called when an
+output pipe is closed from the other side (this is the condition under
+which a SIGPIPE is sent). The already closed @var{port} will be passed
+so that any necessary cleanup may be done. An error is not signaled
+when output to a pipe fails in this way, but any further output to
+the closed pipe will cause an error to be signaled.
+@end defun
+
@defun close-port pipe
Closes the @var{pipe}, rendering it incapable of delivering or accepting
characters. This routine has no effect if the pipe has already been
@@ -4406,6 +4718,11 @@ Returns the process ID of the parent of the current process.
For a process's own ID @xref{I/O-Extensions, getpid}.
@end defun
+@defun getlogin
+Returns the (login) name of the user logged in on the controlling
+terminal of the process, or #f if this information cannot be determined.
+@end defun
+
@defun getuid
Returns the real user ID of this process.
@end defun
@@ -4531,12 +4848,13 @@ stopped, and whose status has not been reported.
Which means both of the above.
@end enumerate
-The return value is normally the process ID of the child process whose
-status is reported. If the @code{WNOHANG} option was specified and no
-child process is waiting to be noticed, the value is zero. A value of
-@code{#f} is returned in case of error and @code{errno} is set. For
-information about the @code{errno} codes @xref{Process Completion, , ,
-GNU C Library, libc}.
+The return value normally is the exit status of the child process,
+including the exit value along with flags indicating whether a coredump
+was generated or the child terminated as a result of a signal. If the
+@code{WNOHANG} option was specified and no child process is waiting to
+be noticed, the value is zero. A value of @code{#f} is returned in case
+of error and @code{errno} is set. For information about the
+@code{errno} codes @xref{Process Completion, , , GNU C Library, libc}.
@end defun
@defun uname
@@ -4653,6 +4971,7 @@ string containing the file name of termainal device; otherwise
@code{#f}.
@end defun
+@node Unix Extensions, Regular Expression Pattern Matching, Posix Extensions, Packages
@section Unix Extensions
@noindent
@@ -4660,7 +4979,7 @@ If @code{'unix} is provided (by linking in @file{unix.o}), the following
functions are defined:
@noindent
-These @dfn{priveledged} and symbolic link functions are not in Posix:
+These @dfn{privileged} and symbolic link functions are not in Posix:
@defun symlink oldname newname
The @code{symlink} function makes a symbolic link to @var{oldname} named
@@ -4690,7 +5009,7 @@ Increment the priority of the current process by @var{increment}.
@defun acct filename
When called with the name of an exisitng file as argument, accounting is
-turned on, records for each terminating pro-cess are appended to
+turned on, records for each terminating process are appended to
@var{filename} as it terminates. An argument of @code{#f} causes
accounting to be turned off.
@@ -4712,7 +5031,8 @@ sync() only schedules the writes, so it may return before the actual
writing is done. The value returned is unspecified.
@end defun
-@node Regular Expression Pattern Matching, Line Editing, Posix Extensions, Packages
+
+@node Regular Expression Pattern Matching, Line Editing, Unix Extensions, Packages
@section Regular Expression Pattern Matching
These functions are defined in @file{rgx.c} using a POSIX or GNU
@@ -4728,7 +5048,7 @@ expression, or an integer error code suitable as an argument to
@code{regerror}.
@var{flags} in @code{regcomp} is a string of option letters used to
-control the compilation of the regular expression. The letters may
+control the compilation of the regular expression. The letters may
consist of:
@table @samp
@@ -4796,7 +5116,7 @@ a list of a string and a set of option letters.
@item string
The string to be operated upon.
@item start
-The character position at which to begin the search or match. If absent,
+The character position at which to begin the search or match. If absent,
the default is zero.
@exdent @emph{Compiled _GNU_SOURCE and using GNU libregex only:}
@@ -4807,7 +5127,7 @@ will be performed.
@item len
The search is allowed to examine only the first @var{len} characters of
-@var{string}. If absent, the entire string may be examined.
+@var{string}. If absent, the entire string may be examined.
@end table
@end defun
@@ -4981,7 +5301,7 @@ terminal, it is also necessary to call @code{idlok}.
@defun nodelay win bf
This option causes wgetch to be a non-blocking call. If no input is
-ready, wgetch will return an eof-object. If disabled, wgetch will hang
+ready, wgetch will return an eof-object. If disabled, wgetch will hang
until a key is pressed.
@end defun
@@ -5528,7 +5848,7 @@ successful.
@defunx socket:bind unix-socket pathname
Returns @var{inet-socket} bound to the integer @var{port-number} or the
@var{unix-socket} bound to new socket in the file system at location
-@var{pathname}. Returns @code{#f} if not successful. Binding a
+@var{pathname}. Returns @code{#f} if not successful. Binding a
@var{unix-socket} creates a socket in the file system that must be
deleted by the caller when it is no longer needed (using
@code{delete-file}).
@@ -6011,6 +6331,10 @@ uniform vector of integers
uniform vector of non-negative integers
@end deftp
+@deftp Header tc7_svect
+uniform vector of short integers
+@end deftp
+
@deftp Header tc7_fvect
uniform vector of short inexact real numbers
@end deftp
@@ -6343,7 +6667,7 @@ bvect .........long length....G0010101 ..........long *words...........
ivect .........long length....G0011101 ..........long *words...........
uvect .........long length....G0011111 ......unsigned long *words......
spare G0100101
- spare G0100111
+svect .........long length....G0100111 ........ short *words...........
fvect .........long length....G0101101 .........float *words...........
dvect .........long length....G0101111 ........double *words...........
cvect .........long length....G0110101 ........double *words...........
@@ -6459,7 +6783,7 @@ unmarked, gc_mark sets the mark bit in @var{obj}, then calls
@code{gc_mark()} is tail-called (looped).
@end deftypefun
-@deftypefun void mark_locations (STACKITEM @var{x[]}, sizet @var{len}))
+@deftypefun void mark_locations (STACKITEM @var{x}[], sizet @var{len}))
The function @code{mark_locations} is used for marking segments of
C-stack or saved segments of C-stack (marked continuations). The
argument @var{len} is the size of the stack in units of size
@@ -6499,6 +6823,9 @@ object is freed. If the type header of smob is collected, the smob's
@node Memory Management for Environments, Signals, Garbage Collection, Operations
@subsection Memory Management for Environments
+@cindex memory management
+@cindex environments
+@cindex ecache
@itemize @bullet
@item
@dfn{Ecache} was designed and implemented by Radey Shouman.
@@ -6592,6 +6919,7 @@ and swept almost like any ordinary segment of the general purpose
heap. The only difference is that pairs from the copying heap that
become free during a sweep phase are not added to the freelist.
+@cindex NO_ENV_CACHE
The environment cache is disabled by adding @code{#define NO_ENV_CACHE}
to @file{eval.c}; all environment cells are then allocated from the
regular heap.
@@ -6958,9 +7286,10 @@ free0(ptr) is provided which does not free any storage and returns 0.
is 0 or a function of 3 arguments. The first, of type @code{SCM}, is
the smob object. The second, of type @code{SCM}, is the stream on which
to write the result. The third, of type int, is 1 if the object should
-be @code{write}n, 0 if it should be @code{display}ed. This function
-should return non-zero if it printed, and zero otherwise (in which case
-a hexadecimal number will be printed).
+be @code{write}n, 0 if it should be @code{display}ed, and 2 if it should
+be @code{write}n for an error report. This function should return non-zero
+if it printed, and zero otherwise (in which case a hexadecimal number will
+be printed).
@item smob.equalp
is 0 or a function of 2 @code{SCM} arguments. Both of these arguments
will be of type @code{tc16@i{foo}}. This function should return
@@ -7024,7 +7353,7 @@ The following functions are provided for that purpose:
@deftypefunx {char *} must_malloc (long @var{len}, char *@var{what})
@var{len} is the number of bytes that should be allocated, @var{what} is
a string to be used in error or gc messages. @code{must_malloc} returns
-a pointer to newly allocated memory. @code{must_malloc_cell} returns a
+a pointer to newly allocated memory. @code{must_malloc_cell} returns a
newly allocated cell whose @code{car} is @var{c} and whose @code{cdr} is
a pointer to newly allocated memory.
@end deftypefun
@@ -7039,7 +7368,7 @@ argument @var{where} the address of a block of memory of length @var{olen}
allocated by @code{must_malloc} and returns the address of a block of
length @var{len}.
-The contents of the reallocated block will be unchanged up the the
+The contents of the reallocated block will be unchanged up to the
minimum of the old and new sizes.
@var{what} is a pointer to a string used for error and gc messages.
@@ -7047,7 +7376,9 @@ minimum of the old and new sizes.
@code{must_malloc}, @code{must_malloc_cell}, @code{must_realloc}, and
@code{must_realloc_cell} must be called with interrupts deferred
-@xref{Signals}.
+@xref{Signals}. @code{must_realloc} and @code{must_realloc_cell} must
+not be called during initialization (non-zero errjmp_bad) -- the initial
+allocations must be large enough.
@deftypefun void must_free (char *@var{ptr}, sizet @var{len})
@code{must_free} is used to free a block of memory allocated by the
@@ -7251,7 +7582,7 @@ int main(argc, argv)
fprintf(stderr, "dld_find_executable(%s): %s\n", argv[0], execpath);
implpath = find_impl_file(execpath, "scm", INIT_FILE_NAME, dirsep);
fprintf(stderr, "implpath: %s\n", implpath);
- scm_init_from_argv(argc, argv, 0, 0);
+ scm_init_from_argv(argc, argv, 0L, 0, 0);
retval = scm_top_level(implpath, user_main);