| [Top] | [Contents] | [Index] | [ ? ] |
This manual is for SCM (version 5e3, October 2006), and algorithmic language Scheme implementation.
Copyright © 1990-2006 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the author.
| 1. Overview | ||
| 2. Installing SCM | How to | |
| 3. Operational Features | ||
| 4. The Language | Reference. | |
| 5. Packages | Optional Capabilities. | |
| 6. The Implementation | How it works. | |
| Index |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Scm is a portable Scheme implementation written in C. Scm provides a machine independent platform for [JACAL], a symbolic algebra system.
| 1.1 Features | ||
| 1.2 Authors | ||
| 1.3 Copyright | ||
| 1.4 Bibliography |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
logand, logor, logxor,
lognot, ash, logcount, integer-length,
bit-extract, defmacro, macroexpand,
macroexpand1, gentemp, defvar, force-output,
software-type, get-decoded-time,
get-internal-run-time, get-internal-real-time,
delete-file, rename-file, copy-tree, acons,
and eval.
Char-code-limit, most-positive-fixnum,
most-negative-fixnum, and internal-time-units-per-second
constants. slib:features and *load-pathname* variables.
verbose function).
Restart, quit, and exec.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Most of SCM.
Arrays, gsubrs, compiled closures, records, Ecache, syntax-rules
macros, and safeports.
Real and Complex functions. Fast mixed type arithmetics.
Syntax checking and memoization of special forms by evaluator. Storage allocation strategy and parameters.
Siod, written by George Carrette, was the starting point for SCM. The major innovations taken from Siod are the evaluator's use of the C-stack and being able to garbage collect off the C-stack (see section Garbage Collection).
There are many other contributors to SCM. They are acknowledged in the file `ChangeLog', a log of changes that have been made to scm.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Authors have assigned their SCM copyrights to:
Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111, USA
| 1.3.1 The SCM License | ||
| 1.3.2 SIOD copyright |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The license of SCM consists of the GNU GPL plus a special statement giving blanket permission to link with non-free software. This is the license statement as found in any individual file that it applies to:
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this software; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
As a special exception, the Free Software Foundation gives permission for additional uses of the text contained in its release of SCM.
The exception is that, if you link the SCM library with other files to produce an executable, this does not by itself cause the resulting executable to be covered by the GNU General Public License. Your use of that executable is in no way restricted on account of linking the SCM library code into it.
This exception does not however invalidate any other reasons why the executable file might be covered by the GNU General Public License.
This exception applies only to the code released by the Free Software Foundation under the name SCM. If you copy code from other Free Software Foundation releases into a copy of SCM, as the General Public License permits, the exception does not apply to the code that you add in this way. To avoid misleading anyone as to the status of such modified files, you must delete this exception notice from them.
If you write modifications of your own for SCM, it is your choice whether to permit this exception to apply to your modifications. If you do not wish that, delete this exception notice.
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.
NO WARRANTY
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.
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.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
COPYRIGHT © 1989 BY
PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS.
ALL RIGHTS RESERVED
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.
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.
gjc@paradigm.com
Phone: 617-492-6079
Paradigm Associates Inc 29 Putnam Ave, Suite 6 Cambridge, MA 02138
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
IEEE Standard 1178-1990. IEEE Standard for the Scheme Programming Language. IEEE, New York, 1991.
William Clinger and Jonathan Rees, Editors. <A HREF="r4rs_toc.html"> Revised(4) Report on the Algorithmic Language Scheme. </A> ACM Lisp Pointers Volume IV, Number 3 (July-September 1991), pp. 1-55.
Richard Kelsey and William Clinger and Jonathan (Rees, editors) <A HREF="r5rs_toc.html"> Revised(5) Report on the Algorithmic Language Scheme. </A> Higher-Order and Symbolic Computation Volume 11, Number 1 (1998), pp. 7-105, and ACM SIGPLAN Notices 33(9), September 1998.
William Clinger <A HREF="http://www.cs.indiana.edu/scheme-repository/doc.proposals.html"> Hygienic Macros Through Explicit Renaming </A> Lisp Pointers Volume IV, Number 4 (December 1991), pp 17-23.
Harold Abelson and Gerald Jay Sussman with Julie Sussman. Structure and Interpretation of Computer Programs. MIT Press, Cambridge, 1985.
Brian Harvey and Matthew Wright. <A HREF="http://HTTP.CS.Berkeley.EDU/~bh/simply-toc.html"> Simply Scheme: Introducing Computer Science </A> MIT Press, 1994 ISBN 0-262-08226-8
犬飼大(Dai Inukai) <A HREF="http://www.shuwasystem.co.jp/SchemePrimer/"> 入門Scheme </A> 1999年12月初版 ISBN4-87966-954-7
Todd R. Eigenschink, Dave Love, and Aubrey Jaffer. <A HREF="slib_toc.html"> SLIB, The Portable Scheme Library. </A> Version 2c8, June 2000.
Aubrey Jaffer. <A HREF="jacal_toc.html"> JACAL Symbolic Mathematics System. </A> Version 1b0, Sep 1999.
Documentation of scm extensions (beyond Scheme standards).
Documentation on the internal representation and how to extend or
include scm in other programs.
Documentation of the Xlib - SCM Language X Interface.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 2.1 Making SCM | Bootstrapping. | |
| 2.2 SLIB | REQUIREd reading. | |
| 2.3 Building SCM | ||
| 2.4 Installing Dynamic Linking | ||
| 2.5 Configure Module Catalog | ||
| 2.6 Saving Images | Make Fast-Booting Executables | |
| 2.7 Automatic C Preprocessor Definitions | ||
| 2.8 Problems Compiling | ||
| 2.9 Problems Linking | ||
| 2.10 Problems Running | ||
| 2.11 Testing | ||
| 2.12 Reporting Problems |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The SCM distribution has Makefile which contains rules for making scmlit, a "bare-bones" version of SCM sufficient for running `build'. `build' is used to compile (or create scripts to compile) full featured versions.
Makefiles are not portable to the majority of platforms. If `Makefile' works for you, good; If not, I don't want to hear about it. If you need to compile SCM without build, there are several ways to proceed:
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[SLIB] is a portable Scheme library meant to provide compatibility and utility functions for all standard Scheme implementations. Although SLIB is not neccessary to run SCM, I strongly suggest you obtain and install it. Bug reports about running SCM without SLIB have very low priority. SLIB is available from the same sites as SCM:
Unpack SLIB (`tar xzf slib3a4.tar.gz' or `unzip -ao
slib3a4.zip') in an appropriate directory for your system; both
tar and unzip will create the directory `slib'.
Then create a file `require.scm' in the SCM implementation-vicinity (this is the same directory as where the file `Init5e3.scm' is installed). `require.scm' should have the contents:
(define (library-vicinity) "/usr/local/lib/slib/") |
where the pathname string `/usr/local/lib/slib/' is to be replaced by the pathname into which you installed SLIB. Absolute pathnames are recommended here; if you use a relative pathname, SLIB can get confused when the working directory is changed (see section chmod). The way to specify a relative pathname is to append it to the implementation-vicinity, which is absolute:
(define library-vicinity
(let ((lv (string-append (implementation-vicinity) "../slib/")))
(lambda () lv)))
|
Alternatively, you can set the (shell) environment variable
SCHEME_LIBRARY_PATH to the pathname of the SLIB directory
(see section Environment Variables). If
set, the environment variable overrides `require.scm'. Again,
absolute pathnames are recommended.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The file build loads the file build.scm, which constructs a relational database of how to compile and link SCM executables. `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.
| 2.3.1 Invoking Build | ||
| 2.3.2 Build Options | ||
| 2.3.3 Compiling and Linking Custom Files |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The all method will also work for MS-DOS and unix. Use the all method if you encounter problems with `build'.
From the SCM source directory, type `build' followed by up to 9 command line arguments.
From the SCM source directory, type `./build' followed by command line arguments.
From the SCM source directory, start `scm' or `scmlit' and
type (load "build"). Alternatively, start `scm' or
`scmlit' with the command line argument `-ilbuild'.
Invoking build without the `-F' option will build or create a shell
script with the arrays, inexact, and bignums
options as defaults.
bash$ ./build -| #! /bin/sh # unix (linux) script created by SLIB/batch # ================ Write file with C defines rm -f scmflags.h echo '#define IMPLINIT "Init5e3.scm"'>>scmflags.h echo '#define BIGNUMS'>>scmflags.h echo '#define FLOATS'>>scmflags.h echo '#define ARRAYS'>>scmflags.h # ================ 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 |
To cross compile for another platform, invoke build with the `-p' or `--platform=' option. This will create a script for the platform named in the `-p' or `--platform=' option.
bash$ ./build -o scmlit -p darwin -F lit -| #! /bin/sh # unix (darwin) script created by SLIB/batch # ================ Write file with C defines rm -f scmflags.h echo '#define IMPLINIT "Init5e3.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 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The options to build specify what, where, and how to build a SCM program or dynamically linked module. These options are unrelated to the SCM command line options.
specifies that the compilation should be for a computer/operating-system combination called platform-name. Note The case of platform-name is distinguised. The current platform-names are all lower-case.
The platforms defined by table platform in `build.scm' are:
Table: platform name processor operating-system compiler #f processor-family operating-system #f symbol processor-family operating-system symbol symbol symbol symbol symbol ================= ================= ================= ================= *unknown* *unknown* unix cc acorn-unixlib acorn *unknown* cc aix powerpc aix cc alpha-elf alpha unix cc alpha-linux alpha linux gcc amiga-aztec m68000 amiga cc amiga-dice-c m68000 amiga dcc amiga-gcc m68000 amiga gcc amiga-sas m68000 amiga lc atari-st-gcc m68000 atari.st gcc atari-st-turbo-c m68000 atari.st tcc borland-c i8086 ms-dos bcc darwin powerpc unix cc djgpp i386 ms-dos gcc freebsd i386 unix cc gcc *unknown* unix gcc gnu-win32 i386 unix gcc highc i386 ms-dos hc386 hp-ux hp-risc hp-ux cc irix mips irix gcc linux i386 linux gcc linux-aout i386 linux gcc linux-ia64 ia64 linux gcc microsoft-c i8086 ms-dos cl microsoft-c-nt i386 ms-dos cl microsoft-quick-c i8086 ms-dos qcl ms-dos i8086 ms-dos cc netbsd *unknown* unix gcc openbsd *unknown* unix gcc os/2-cset i386 os/2 icc os/2-emx i386 os/2 gcc osf1 alpha unix cc plan9-8 i386 plan9 8c sunos sparc sunos cc svr4 *unknown* unix cc svr4-gcc-sun-ld sparc sunos gcc turbo-c i8086 ms-dos tcc unicos cray unicos cc unix *unknown* unix cc vms vax vms cc vms-gcc vax vms gcc watcom-9.0 i386 ms-dos wcc386p |
specifies that the build options contained in pathname be spliced into the argument list at this point. The use of option files can separate functional features from platform-specific ones.
The `Makefile' calls out builds with the options in `.opt' files:
Options for Makefile targets mydlls, myturtle, and x.so.
Options for udgdbscm and gdbscm.
Options for libscm.a.
Options for pgscm, which instruments C functions.
Options for targets udscm4 and dscm4 (scm).
Options for targets udscm5 and dscm5 (scm).
The Makefile creates options files it depends on only if they do not already exist.
specifies that the compilation should produce an executable or object name of filename. The default is `scm'. Executable suffixes will be added if neccessary, e.g. `scm' ⇒ `scm.exe'.
specifies that the libname should be linked with the executable produced. If compile flags or include directories (`-I') are needed, they are automatically supplied for compilations. The `c' library is always included. SCM features specify any libraries they need; so you shouldn't need this option often.
specifies that the definition should be made in any C source compilations. If compile flags or include directories (`-I') are needed, they are automatically supplied for compilations. SCM features specify any flags they need; so you shouldn't need this option often.
specifies that that flag will be put on compiler command-lines.
specifies that that flag will be put on linker command-lines.
specifies that pathname should be the default location of the SCM initialization file `Init5e3.scm'. SCM tries several likely locations before resorting to pathname (see section File-System Habitat). If not specified, the current directory (where build is building) is used.
specifies that the C source files pathname … are to be compiled.
specifies that the object files pathname … are to be linked.
specifies that the C functions call … are to be invoked during initialization.
specifies in general terms what sort of thing to build. The choices are:
executable program.
library module.
archived dynamically linked library object files.
dynamically linked library object file.
The default is to build an executable.
specifies how to build. The default is to create a batch file for the host system. The SLIB file `batch.scm' knows how to create batch files for:
This option executes the compilation and linking commands through the
use of the system procedure.
This option outputs Scheme code.
specifies where to write the build script. The default is to display it
on (current-output-port).
specifies to build the given features into the executable. The defined features are:
Alias for ARRAYS
array-map! and array-for-each (arrays must also be featured).
Use if you want arrays, uniform-arrays and uniform-vectors.
Large precision integers.
Treating strings as byte-vectors.
Define this for extra checking of interrupt masking and some simple checks for proper use of malloc and free. This is for debugging C code in `sys.c', `eval.c', `repl.c' and makes the interpreter several times slower than usual.
Normally, the number of arguments arguments to interpreted closures (from LAMBDA) are checked if the function part of a form is not a symbol or only the first time the form is executed if the function part is a symbol. defining `reckless' disables any checking. If you want to have SCM always check the number of arguments to interpreted closures define feature `cautious'.
If you only need straight stack continuations, executables compile with this feature will run faster and use less storage than not having it. Machines with unusual stacks need this. Also, if you incorporate new C code into scm which uses VMS system services or library routines (which need to unwind the stack in an ordrly manner) you may need to use this feature.
Use if you want to use compiled closures.
For the curses screen management package.
Turns on the features `cautious' and
`careful-interrupt-masking'; uses
-g flags for debugging SCM source code.
Sequence comparison
SCM normally converts references to local variables to ILOCs, which make programs run faster. If SCM is badly broken, try using this option to disable the MEMOIZE_LOCALS feature.
Convert a running scheme program into an executable file.
Be able to load compiled files while running.
interface to the editline or GNU readline library.
Use if you want floats to display in engineering notation (exponents always multiples of 3) instead of scientific notation.
make_gsubr for arbitrary (< 11) arguments to C functions.
Commonly available I/O extensions: exec, line I/O, file positioning, file delete and rename, and directory functions.
Use if you want floating point numbers.
Lightweight - no features
C level support for hygienic and referentially transparent macros (syntax-rules macros).
Client connections to the mysql databases.
Use if you want segments of unused heap to not be freed up after garbage collection. This may increase time in GC for *very* large working sets.
No features
Posix functions available on all Unix-like systems. fork and process functions, user and group IDs, file permissions, and link.
If your scheme code runs without any errors you can disable almost all error checking by compiling all files with `reckless'.
The Record package provides a facility for user to define their own record data types. See SLIB for documentation.
String regular expression matching.
These procedures were specified in the Revised^2 Report on Scheme but not in R4RS.
Use if you want to run code from:
Harold Abelson and Gerald Jay Sussman with Julie Sussman. Structure and Interpretation of Computer Programs. The MIT Press, Cambridge, Massachusetts, USA, 1985.
Differences from R5RS are:
Use if you want all inexact real numbers to be single precision. This only has an effect if SINGLES is also defined (which is the default). This does not affect complex numbers.
BSD socket interface. Socket addr functions require inexacts or bignums for 32-bit precision.
Use if you want the ticks and ticks-interrupt functions.
Turtle graphics calls for both Borland-C and X11 from sjm@ee.tut.fi.
Those unix features which have not made it into the Posix specs: nice, acct, lstat, readlink, symlink, mknod and sync.
WB database with relational wrapper.
Microsoft Windows executable.
Alias for Xlib feature.
Interface to Xlib graphics routines.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A correspondent asks:
How can we link in our own c files to the SCM interpreter so that we can add our own functionality? (e.g. we have a bunch of tcp functions we want access to). Would this involve changing build.scm or the Makefile or both?
(see section Changing Scm has instructions describing the C code format). Suppose a C file foo.c has functions you wish to add to SCM. To compile and link your file at compile time, use the `-c' and `-i' options to build:
bash$ ./build -c foo.c -i init_foo
-|
#! /bin/sh
rm -f scmflags.h
echo '#define IMPLINIT "/home/jaffer/scm/Init5e3.scm"'>>scmflags.h
echo '#define COMPILED_INITS init_foo();'>>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 foo.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 foo.o -lm -lc
|
To make a dynamically loadable object file use the -t dll option:
bash$ ./build -t dll -c foo.c -| #! /bin/sh rm -f scmflags.h echo '#define IMPLINIT "/home/jaffer/scm/Init5e3.scm"'>>scmflags.h echo '#define BIGNUMS'>>scmflags.h echo '#define FLOATS'>>scmflags.h echo '#define ARRAYS'>>scmflags.h echo '#define DLL'>>scmflags.h gcc -O2 -fpic -c foo.c gcc -shared -o foo.so foo.o -lm -lc |
Once `foo.c' compiles correctly (and your SCM build supports
dynamic-loading), you can load the compiled file with the Scheme command
(load "./foo.so"). See Configure Module Catalog for how to
add a compiled dll file to SLIB's catalog.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Dynamic linking has not been ported to all platforms. Operating systems
in the BSD family (a.out binary format) can usually be ported to
DLD. The dl library (#define SUN_DL for SCM) was a
proposed POSIX standard and may be available on other machines with
COFF binary format. For notes about porting to MS-Windows and
finishing the port to VMS VMS Dynamic Linking.
DLD is a library package of C functions that performs dynamic link editing on Linux, VAX (Ultrix), Sun 3 (SunOS 3.4 and 4.0), SPARCstation (SunOS 4.0), Sequent Symmetry (Dynix), and Atari ST. It is available from:
<A HREF="ftp://ftp.gnu.org/pub/gnu/dld-3.3.tar.gz"> ftp.gnu.org:pub/gnu/dld-3.3.tar.gz </A>
These notes about using libdl on SunOS are from `gcc.info':
On a Sun, linking using GNU CC fails to find a shared library and reports that the library doesn't exist at all.
This happens if you are using the GNU linker, because it does only static linking and looks only for unshared libraries. If you have a shared library with no unshared counterpart, the GNU linker won't find anything.
We hope to make a linker which supports Sun shared libraries, but please don't ask when it will be finished-we don't know.
Sun forgot to include a static version of `libdl.a' with some versions of SunOS (mainly 4.1). This results in undefined symbols when linking static binaries (that is, if you use `-static'). If you see undefined symbols `_dlclose', `_dlsym' or `_dlopen' when linking, compile and link against the file `mit/util/misc/dlsym.c' from the MIT version of X windows.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The SLIB module catalog can be extended to define other
require-able packages by adding calls to the Scheme source file
`mkimpcat.scm'. Within `mkimpcat.scm', the following
procedures are defined.
feature should be a symbol. object-file should be a string
naming a file containing compiled object-code. Each libn
argument should be either a string naming a library file or #f.
If object-file exists, the add-link procedure registers
symbol feature so that the first time require is called
with the symbol feature as its argument, object-file and the
lib1 … are dynamically linked into the executing SCM
session.
If object-file exists, add-link returns #t,
otherwise it returns #f.
For example, to install a compiled dll `foo', add these lines to `mkimpcat.scm':
(add-link 'foo
(in-vicinity (implementation-vicinity) "foo"
link:able-suffix))
|
alias and feature are symbols. The procedure
add-alias registers alias as an alias for feature.
An unspecified value is returned.
add-alias causes (require 'alias) to behave like
(require 'feature).
feature is a symbol. filename is a string naming a file
containing Scheme source code. The procedure add-source
registers feature so that the first time require is called
with the symbol feature as its argument, the file filename
will be loaded. An unspecified value is returned.
Remember to delete the file `slibcat' after modifying the file `mkimpcat.scm' in order to force SLIB to rebuild its cache.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In SCM, the ability to save running program images is called dump
(see section Dump). In order to make dump available to SCM, build
with feature `dump'. dumped executables are compatible with
dynamic linking.
Most of the code for dump is taken from `emacs-19.34/src/unex*.c'. No modifications to the emacs source code were required to use `unexelf.c'. Dump has not been ported to all platforms. If `unexec.c' or `unexelf.c' don't work for you, try using the appropriate `unex*.c' file from emacs.
The `dscm4' and `dscm5' targets in the SCM `Makefile' save images from `udscm4' and `udscm5' executables respectively.
Recent Linux innovations interfere with dump. For:
Remove the `#' from the line `#SETARCH = setarch i386' in the `Makefile'.
http://jamesthornton.com/writing/emacs-compile.html writes: [For FC3] combreloc has become the default for recent GNU ld, which breaks the unexec/undump on all versions of both Emacs and XEmacs...
Override by adding the following to `udscm5.opt': `--linker-options="-z nocombreloc"'
http://www.opensubscriber.com/message/emacs-devel@gnu.org/1007118.html mentions the exec-shield feature. Kernels later than 2.6.11 must do (as root):
echo 0 > /proc/sys/kernel/randomize_va_space |
before dumping. `Makefile' has this `randomize_va_space' stuffing scripted for targets `dscm4' and `dscm5'. You must either set `randomize_va_space' to 0 or run as root to dump.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These `#defines' are automatically provided by preprocessors of
various C compilers. SCM uses the presence or absence of these
definitions to configure include file locations and aliases for
library functions. If the definition(s) corresponding to your system
type is missing as your system is configured, add -Dflag to
the compilation command lines or add a #define flag line to
`scmfig.h' or the beginning of `scmfig.h'.
#define Platforms: ------- ---------- ARM_ULIB Huw Rogers free unix library for acorn archimedes AZTEC_C Aztec_C 5.2a __CYGWIN__ Cygwin __CYGWIN32__ Cygwin _DCC Dice C on AMIGA __GNUC__ Gnu CC (and DJGPP) __EMX__ Gnu C port (gcc/emx 0.8e) to OS/2 2.0 __HIGHC__ MetaWare High C __IBMC__ C-Set++ on OS/2 2.1 _MSC_VER MS VisualC++ 4.2 MWC Mark Williams C on COHERENT __MWERKS__ Metrowerks Compiler; Macintosh and WIN32 (?) _POSIX_SOURCE ?? _QC Microsoft QuickC __STDC__ ANSI C compliant __TURBOC__ Turbo C and Borland C __USE_POSIX ?? __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 __amigaos__ Gnu CC on AMIGA atarist ATARI-ST under Gnu CC __FreeBSD__ FreeBSD GNUDOS DJGPP (obsolete in version 1.08) __GO32__ DJGPP (future?) hpux HP-UX linux Linux macintosh Macintosh (THINK_C and __MWERKS__ define) MCH_AMIGA Aztec_c 5.2a on AMIGA __MACH__ Apple Darwin __MINGW32__ MinGW - Minimalist GNU for Windows MSDOS Microsoft C 5.10 and 6.00A _MSDOS Microsoft CLARM and CLTHUMB compilers. __MSDOS__ Turbo C, Borland C, and DJGPP __NetBSD__ NetBSD nosve Control Data NOS/VE SVR2 System V Revision 2. sun SunOS __SVR4 SunOS THINK_C developement environment for the Macintosh ultrix VAX with ULTRIX operating system. unix most Unix and similar systems and DJGPP (!?) __unix__ Gnu CC and DJGPP _UNICOS Cray operating system vaxc VAX C compiler VAXC VAX C compiler vax11c VAX C compiler VAX11 VAX C compiler _Windows Borland C 3.1 compiling for Windows _WIN32 MS VisualC++ 4.2 and Cygwin (Win32 API) _WIN32_WCE MS Windows CE vms (and VMS) VAX-11 C under VMS. __alpha DEC Alpha processor __alpha__ DEC Alpha processor hp9000s800 HP RISC processor __ia64 GCC on IA64 __ia64__ GCC on IA64 _LONGLONG GCC on IA64 __i386__ DJGPP i386 DJGPP _M_ARM Microsoft CLARM compiler defines as 4 for ARM. _M_ARMT Microsoft CLTHUMB compiler defines as 4 for Thumb. MULTIMAX Encore computer ppc PowerPC __ppc__ PowerPC pyr Pyramid 9810 processor __sgi__ Silicon Graphics Inc. sparc SPARC processor sequent Sequent computer tahoe CCI Tahoe processor vax VAX processor __x86_64 AMD Opteron |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
FILE | PROBLEM / MESSAGE | HOW TO FIX |
*.c | include file not found. | Correct the status of STDC_HEADERS in scmfig.h. |
fix #include statement or add #define for system type to scmfig.h. | ||
*.c | Function should return a value. | Ignore. |
Parameter is never used. | ||
Condition is always false. | ||
Unreachable code in function. | ||
scm.c | assignment between incompatible types. | Change SIGRETTYPE in scm.c. |
time.c | CLK_TCK redefined. | incompatablility between <stdlib.h> and <sys/types.h>. |
Remove STDC_HEADERS in scmfig.h. | ||
Edit <sys/types.h> to remove incompatability. | ||
subr.c | Possibly incorrect assignment in function lgcd. | Ignore. |
sys.c | statement not reached. | Ignore. |
constant in conditional expression. | ||
sys.c | undeclared, outside of functions. | #undef STDC_HEADERS in scmfig.h. |
scl.c | syntax error. | #define SYSTNAME to your system type in scl.c (softtype). |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
PROBLEM | HOW TO FIX |
_sin etc. missing. | Uncomment LIBS in makefile. |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
PROBLEM | HOW TO FIX |
Opening message and then machine crashes. | Change memory model option to C compiler (or makefile). |
Make sure sizet definition is correct in scmfig.h. | |
Reduce the size of HEAP_SEG_SIZE in setjump.h. | |
Input hangs. | #define NOSETBUF |
ERROR: heap: need larger initial. | Increase initial heap allocation using -a<kb> or INIT_HEAP_SIZE. |
ERROR: Could not allocate. | Check sizet definition. |
Use 32 bit compiler mode. | |
Don't try to run as subproccess. | |
remove <FLAG> in scmfig.h and recompile scm. | Do so and recompile files. |
add <FLAG> in scmfig.h and recompile scm. | |
ERROR: Init5e3.scm not found. | Assign correct IMPLINIT in makefile or scmfig.h. |
Define environment variable SCM_INIT_PATH to be the full pathname of Init5e3.scm. | |
WARNING: require.scm not found. | Define environment variable SCHEME_LIBRARY_PATH to be the full pathname of the scheme library [SLIB]. |
Change library-vicinity in Init5e3.scm to point to library or remove. | |
Make sure the value of (library-vicinity) has a trailing file separator (like / or \). |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Loading `r4rstest.scm' in the distribution will run an [R4RS]
conformance test on scm.
> (load "r4rstest.scm")
-|
;loading "r4rstest.scm"
SECTION(2 1)
SECTION(3 4)
#<primitive-procedure boolean?>
#<primitive-procedure char?>
#<primitive-procedure null?>
#<primitive-procedure number?>
…
|
Loading `pi.scm' in the distribution will enable you to compute digits of pi.
> (load "pi") ;loading "pi" ;done loading "pi.scm" ;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 ms (60 in gc) 36976 cells work, 1548.B other #<unspecified> |
Loading `bench.scm' will compute and display performance statistics of SCM running `pi.scm'. `make bench' or `make benchlit' appends the performance report to the file `BenchLog', facilitating tracking effects of changes to SCM on performance.
PROBLEM | HOW TO FIX |
Runs some and then machine crashes. | See above under machine crashes. |
Runs some and then ERROR: … (after a GC has happened). | Remove optimization option to C compiler and recompile. |
#define SHORT_ALIGN in `scmfig.h'. | |
Some symbol names print incorrectly. | Change memory model option to C compiler (or makefile). |
Check that HEAP_SEG_SIZE fits within sizet. | |
Increase size of HEAP_SEG_SIZE (or INIT_HEAP_SIZE if it is smaller than HEAP_SEG_SIZE). | |
ERROR: Rogue pointer in Heap. | See above under machine crashes. |
Newlines don't appear correctly in output files. | Check file mode (define OPEN_… in `Init5e3.scm'). |
Spaces or control characters appear in symbol names. | Check character defines in `scmfig.h'. |
Negative numbers turn positive. | Check SRS in `scmfig.h'. |
;ERROR: bignum: numerical overflow | Increase NUMDIGS_MAX in `scmfig.h' and recompile. |
VMS: Couldn't unwind stack. | #define CHEAP_CONTINUATIONS in `scmfig.h'. |
VAX: botched longjmp. |
You are experiencing a GC problem peculiar to the Sparc. The problem is that SCM doesn't know how to clear register windows. Every location which is not reused still gets marked at GC time. This causes lots of stuff which should be collected to not be. This will be a problem with any conservative GC until we find what instruction will clear the register windows. This problem is exacerbated by using lots of call-with-current-continuations. A possible fix for dynthrow() is commented out in `continue.c'.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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 agj @ alum.mit.edu. The bug report
should include:
SCM_INIT_PATH and
SCHEME_LIBRARY_PATH.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
scm [-a kbytes] [-muvbiq] [--version] [--help] [[-]-no-init-file] [-p int] [-r feature] [-h feature] [-d filename] [-f filename] [-l filename] [-c expression] [-e expression] [-o dumpname] [-- | - | -s] [filename] [arguments …] |
Upon startup scm loads the file specified by by the environment
variable SCM_INIT_PATH.
If SCM_INIT_PATH is not defined or if the file it names is not
present, scm tries to find the directory containing the
executable file. If it is able to locate the executable, scm
looks for the initialization file (usually
`Init5e3.scm') in platform-dependent directories
relative to this directory. See File-System Habitat for a
blow-by-blow description.
As a last resort (if initialization file cannot be located), the C compile parameter IMPLINIT (defined in the makefile or `scmfig.h') is tried.
Unless the option -no-init-file or --no-init-file occurs
in the command line, or if scm is being invoked as a script,
`Init5e3.scm' checks to see if there is file
`ScmInit.scm' in the path specified by the environment variable
HOME (or in the current directory if HOME is undefined).
If it finds such a file, then it is loaded.
`Init5e3.scm' then looks for command input from one of three sources: From an option on the command line, from a file named on the command line, or from standard input.
This explanation applies to SCMLIT or other builds of SCM.
Scheme-code files can also invoke SCM and its variants. See section #!.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The options are processed in the order specified on the command line.
specifies that scm should allocate an initial heapsize of k
kilobytes. This option, if present, must be the first on the command
line. If not specified, the default is INIT_HEAP_SIZE in source
file `setjump.h' which the distribution sets at
25000*sizeof(cell).
Inhibits the loading of `ScmInit.scm' as described above.
prints usage information and URI; then exit.
prints version information and exit.
requires feature. This will load a file from [SLIB] if that
feature is not already provided. If feature is 2, 2rs, or
r2rs; 3, 3rs, or r3rs; 4, 4rs, or r4rs; 5, 5rs, or r5rs; scm
will require the features neccessary to support [R2RS]; [R3RS];
[R4RS]; or [R5RS], respectively.
provides feature.
loads filename. Scm will load the first (unoptioned)
file named on the command line if no -c, -e, -f,
-l, or -s option preceeds it.
Loads SLIB databases feature and opens filename as a
database.
specifies that the scheme expression expression is to be
evaluated. These options are inspired by perl and sh
respectively. On Amiga systems the entire option and argument need to be
enclosed in quotes. For instance `"-e(newline)"'.
saves the current SCM session as the executable program `dumpname'.
This option works only in SCM builds supporting dump
(see section Dump).
If options appear on the command line after `-o 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.
sets the prolixity (verboseness) to level. This is the same as
the scm command (verobse level).
(verbose mode) specifies that scm will print prompts, evaluation
times, notice of loading files, and garbage collection statistics. This
is the same as -p3.
(quiet mode) specifies that scm will print no extra
information. This is the same as -p0.
specifies that subsequent loads, evaluations, and user interactions will
be with syntax-rules macro capability. To use a specific syntax-rules
macro implementation from [SLIB] (instead of [SLIB]'s default) put
-r macropackage before -m on the command line.
specifies that subsequent loads, evaluations, and user interactions will
be without syntax-rules macro capability. Syntax-rules macro capability
can be restored by a subsequent -m on the command line or from
Scheme code.
specifies that scm should run interactively. That means that
scm will not terminate until the (quit) or (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 scm is started from a tty, it will assume
that it should be interactive unless given a subsequent -b
option.
specifies that scm should run non-interactively. That means that
scm will terminate after processing the command line or if there
are errors.
specifies, by analogy with sh, that scm should run
interactively and that further options are to be treated as program
aguments.
specifies that further options are to be treated as program aguments.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
% scm foo.scmLoads and executes the contents of `foo.scm' and then enters interactive session.
% scm -f foo.scm arg1 arg2 arg3Parameters arg1, arg2, and arg3 are stored in the
global list *argv*; Loads and executes the contents of
`foo.scm' and exits.
% scm -s foo.scm arg1 arg2Sets *argv* to ("foo.scm" "arg1" "arg2") and enters interactive
session.
% scm -e `(write (list-ref *argv* *optind*))' barPrints `"bar"'.
% scm -rpretty-print -r format -iLoads pretty-print and format and enters interactive
session.
% scm -r5Loads dynamic-wind, values, and syntax-rules macros and
enters interactive (with macros) session.
% scm -r5 -r4Like above but rev4-optional-procedures are also loaded.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
is the pathname where scm will look for its initialization
code. The default is the file `Init5e3.scm' in the
source directory.
is the [SLIB] Scheme library directory.
is the directory where `Init5e3.scm' will look for the user initialization file `ScmInit.scm'.
is the name of the program which ed will call. If EDITOR
is not defined, the default is `ed'.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
contains the list of arguments to the program. *argv* can change
during argument processing. This list is suitable for use as an argument
to [SLIB] getopt.
controls whether loading and interaction support syntax-rules
macros. Define this in `ScmInit.scm' or files specified on the
command line. This can be overridden by subsequent -m and
-u options.
controls interactivity as explained for the -i and -b
options. Define this in `ScmInit.scm' or files specified on the
command line. This can be overridden by subsequent -i and
-b options.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Aliases for exit (see exit: (slib)System section `System' in SLIB). On many
systems, SCM can also tail-call another program. See section execp.
boot-tail is called by scm_top_level just before entering
interactive top-level. If boot-tail calls quit, then
interactive top-level is not entered.
Returns a list of strings of the arguments scm was called with.
Returns the (login) name of the user logged in on the controlling terminal of the process, or #f if this information cannot be determined.
For documentation of the procedures getenv and system
See (slib)System Interface section `System Interface' in SLIB.
If SCM is compiled under VMS this vms-debug will invoke the VMS
debugger.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The value of the environment variable EDITOR (or just ed
if it isn't defined) is invoked as a command with arguments arg1
….
If SCM is compiled under VMS ed will invoke the editor with a
single the single argument filename.
Editing of Scheme code is supported by emacs. Buffers holding files ending in .scm are automatically put into scheme-mode.
If your Emacs can run a process in a buffer you can use the Emacs command `M-x run-scheme' with SCM. Otherwise, use the emacs command `M-x suspend-emacs'; or see "other systems" below.
There is lisp (and scheme) mode available by use of the package `LISP.E'. It offers several different indentation formats. With this package, buffers holding files ending in `.L', `.LSP', `.S', and `.SCM' (my modification) are automatically put into lisp-mode.
It is possible to run a process in a buffer under Epsilon. With Epsilon 5.0 the command line options `-e512 -m0' are neccessary to manage RAM properly. It has been reported that when compiling SCM with Turbo C, you need to `#define NOSETBUF' for proper operation in a process buffer with Epsilon 5.0.
One can also call out to an editor from SCM if RAM is at a premium; See "under other systems" below.
Define the environment variable `EDITOR' to be the name of the
editing program you use. The SCM procedure (ed arg1 …)
will invoke your editor and return to SCM when you exit the editor. The
following definition is convenient:
(define (e) (ed "work.scm") (load "work.scm")) |
Typing `(e)' will invoke the editor with the file of interest. After editing, the modified file will be loaded.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The cautious option of build
(see section Build Options) supports debugging in Scheme.
If SCM is built with the `CAUTIOUS' flag, then when an error occurs, a stack trace of certain pending calls are printed as part of the default error response. A (memoized) expression and newline are printed for each partially evaluated combination whose procedure is not builtin. See Memoized Expressions for how to read memoized expressions.
Also as the result of the `CAUTIOUS' flag, both error and
user-interrupt (invoked by C-c) to print stack traces and
conclude by calling breakpoint (see (slib)Breakpoints section `Breakpoints' in SLIB) instead of aborting to top level. Under either condition,
program execution can be resumed by (continue).
In this configuration one can interrupt a running Scheme program with
C-c, inspect or modify top-level values, trace or untrace
procedures, and continue execution with (continue).
If verbose (see section verbose) is called with an
argument greater than 2, then the interpreter will check stack size
periodically. If the size of stack in use exceeds the C #define
STACK_LIMIT (default is HEAP_SEG_SIZE), SCM generates a
`stack' segment violation.
There are several SLIB macros which so useful that SCM automatically loads the appropriate module from SLIB if they are invoked.
Traces the top-level named procedures given as arguments.
With no arguments, makes sure that all the currently traced identifiers are traced (even if those identifiers have been redefined) and returns a list of the traced identifiers.
Turns tracing off for its arguments.
With no arguments, untraces all currently traced identifiers and returns a list of these formerly traced identifiers.
The routines I use most frequently for debugging are:
Print writes all its arguments, separated by spaces.
Print outputs a newline at the end and returns the value
of the last argument.
One can just insert `(print '<label>' and `)' around an expression in order to see its values as a program operates.
Pprint pretty-prints (see (slib)Pretty-Print section `Pretty-Print' in SLIB) all
its arguments, separated by newlines. Pprint returns the value
of the last argument.
One can just insert `(pprint '<label>' and `)' around an
expression in order to see its values as a program operates.
Note pretty-print does not format procedures.
When typing at top level, pprint is not a good way to see
nested structure because it will return the last object
pretty-printed, which could be large. pp is a better choice.
Pprint pretty-prints (see (slib)Pretty-Print section `Pretty-Print' in SLIB) all
its arguments, separated by newlines. pp returns
#<unspecified>.
Writes name if supplied; then writes the names and values of the
closest lexical bindings enclosing the call to Print-args.
(define (foo a b) (print-args foo) (+ a b)) (foo 3 6) -| In foo: a = 3; b = 6; ⇒ 9 |
Sometimes more elaborate measures are needed to print values in a useful manner. When the values to be printed may have very large (or infinite) external representations, (slib)Quick Print section `Quick Print' in SLIB, can be used.
When trace is not sufficient to find program flow problems,
<A HREF="http://www.cs.tut.fi/staff/pk/scheme/psd/article/article.html">
SLIB-PSD, the Portable Scheme Debugger
</A>
offers source code debugging from
GNU Emacs. PSD runs slowly, so start by instrumenting only a few
functions at a time.
http://swiss.csail.mit.edu/ftpdir/scm/slib-psd1-3.tar.gz swiss.csail.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 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions are defined in `debug.c', all operate on captured continuations:
Prints information about the code being executed and the environment scopes active for continuation frame n of continuation CONT. A "continuation frame" is an entry in the environment stack; a new frame is pushed when the environment is replaced or extended in a non-tail call context. Frame 0 is the top of the stack.
Prints the environment for continuation frame n of continuation cont. This contains just the names, not the values, of the environment.
will print information about active lexical scopes for environment env.
Evaluates expr in the environment defined by continuation frame n of continuation CONT and returns the result. Values in the environment may be returned or SET!.
stack-trace also now accepts an optional continuation
argument. stack-trace differs from frame-trace in that
it truncates long output using safeports and prints code from all
available frames.
(define k #f) (define (foo x y) (set! k (call-with-current-continuation identity)) #f) (let ((a 3) (b 4)) (foo a b) #f) (stack-trace k) -| ;STACK TRACE 1; ((#@set! #@k (#@call-with-current-continuation #@identity)) #f ... 2; (#@let ((a 3) (b 4)) (#@foo #@a #@b) #f) … #t |
(frame-trace k 0) -| (#@call-with-current-continuation #@identity) ; in scope: ; (x y) procedure foo#<unspecified> |
(frame-trace k 1) -| ((#@set! #@k (#@call-with-current-continuation #@identity)) #f) ; in scope: ; (x y) procedure foo#<unspecified> |
(frame-trace k 2) -| (#@let ((a 3) (b 4)) (#@foo #@a #@b) #f) ; in scope: ; (a b . #@let)#<unspecified> |
(frame-trace k 3) -| (#@let ((a 3) (b 4)) (#@foo #@a #@b) #f) ; in top level environment. |
(frame->environment k 0) -| ((x y) 2 foo) |
(scope-trace (frame->environment k 0)) -| ; in scope: ; (x y) procedure foo#<unspecified> |
(frame-eval k 0 'x) ⇒ 3 (frame-eval k 0 '(set! x 8)) (frame-eval k 0 'x) ⇒ 8 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A computer-language implementation designer faces choices of how reflexive to make the implementation in handling exceptions and errors; that is, how much of the error and exception routines should be written in the language itself. The design of a portable implementation is further constrained by the need to have (almost) all errors print meaningful messages, even when the implementation itself is not functioning correctly. Therefore, SCM implements much of its error response code in C.
The following common error and conditions are handled by C code. Those with callback names after them can also be handled by Scheme code (see section Interrupts). If the callback identifier is not defined at top level, the default error handler (C code) is invoked. There are many other error messages which are not treated specially.
Wrong type in argument
Wrong type in argument 1
Wrong type in argument 2
Wrong type in argument 3
Wrong type in argument 4
Wrong type in argument 5
Wrong number of args
numerical overflow
Argument out of range
(out-of-storage)
GC is (thrashing)
(end-of-program)
(hang-up)
(user-interrupt)
(arithmetic-error)
bus error
segment violation
(alarm-interrupt)
(virtual-alarm-interrupt)
(profile-alarm-interrupt)
When SCM encounters a non-fatal error, it aborts evaluation of the
current form, prints a message explaining the error, and resumes the top
level read-eval-print loop. The value of errobj is the offending
object if appropriate. The builtin procedure error does
not set errobj.
errno and perror report ANSI C errors encountered during a
call to a system or library function.
With no argument returns the current value of the system variable
errno. When given an argument, errno sets the system
variable errno to n and returns the previous value of
errno. (errno 0) will clear outstanding errors. This is
recommended after try-load returns #f since this occurs
when the file could not be opened.
Prints on standard error output the argument string, a colon,
followed by a space, the error message corresponding to the current
value of errno and a newline. The value returned is unspecified.
warn and error provide a uniform way for Scheme code to
signal warnings and errors.
Alias for slib:warn: (slib)System section `System' in SLIB. Outputs an error
message containing the arguments. warn is defined in
`Init5e3.scm'.
Alias for slib:error: (slib)System section `System' in SLIB. Outputs an error
message containing the arguments, aborts evaluation of the current form
and resumes the top level read-eval-print loop. Error is defined
in `Init5e3.scm'.
If SCM is built with the `CAUTIOUS' flag, then when an error occurs, a stack trace of certain pending calls are printed as part of the default error response. A (memoized) expression and newline are printed for each partially evaluated combination whose procedure is not builtin. See Memoized Expressions for how to read memoized expressions.
Also as the result of the `CAUTIOUS' flag, both error and
user-interrupt (invoked by C-c) are defined to print stack
traces and conclude by calling breakpoint (see (slib)Breakpoints section `Breakpoints' in SLIB). This allows the user to interract with SCM as with Lisp
systems.
Prints information describing the stack of partially evaluated
expressions. stack-trace returns #t if any lines were
printed and #f otherwise. See `Init5e3.scm'
for an example of the use of stack-trace.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
SCM memoizes the address of each occurence of an identifier's value when first encountering it in a source expression. Subsequent executions of that memoized expression is faster because the memoized reference encodes where in the top-level or local environment its value is.
When procedures are displayed, the memoized locations appear in a format different from references which have not yet been executed. I find this a convenient aid to locating bugs and untested expressions.
For instance, open-input-file is defined as follows in
`Init5e3.scm':
(define (open-input-file str)
(or (open-file str OPEN_READ)
(and (procedure? could-not-open) (could-not-open) #f)
(error "OPEN-INPUT-FILE couldn't open file " str)))
|
If open-input-file has not yet been used, the displayed procedure
is similar to the original definition (lines wrapped for readability):
open-input-file ⇒ #<CLOSURE (str) (or (open-file str open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we open a file using open-input-file, the sections of code
used become memoized:
(open-input-file "r4rstest.scm") ⇒ #<input-port 3> open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we cause open-input-file to execute other sections of code,
they too become memoized:
(open-input-file "foo.scm") ⇒ ERROR: No such file or directory ERROR: OPEN-INPUT-FILE couldn't open file "foo.scm" open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (#@and (#@procedure? #@could-not-open) (could-not-open) #f) (#@error "OPEN-INPUT-FILE couldn't open file " #@0+0))> |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The variable *interactive* determines whether the SCM session is interactive, or should quit after the command line is processed. *interactive* is controlled directly by the command-line options `-b', `-i', and `-s' (see section Invoking SCM). If none of these options are specified, the rules to determine interactivity are more complicated; see `Init5e3.scm' for details.
Resumes the top level Read-Eval-Print loop.
Restarts the SCM program with the same arguments as it was originally invoked. All `-l' loaded files are loaded again; If those files have changed, those changes will be reflected in the new session.
Note When running a saved executable (see section Dump),
restart is redefined to be exec-self.
Exits and immediately re-invokes the same executable with the same
arguments. If the executable file has been changed or replaced since
the beginning of the current session, the new executable will be
invoked. This differentiates exec-self from restart.
Controls how much monitoring information is printed. If n is:
no prompt or information is printed.
a prompt is printed.
messages bracketing file loading are printed.
the CPU time is printed after each top level form evaluated; notifications of heap growth printed; the interpreter checks stack depth periodically.
a garbage collection summary is printed after each top level form evaluated;
a message for each GC (see section Garbage Collection) is printed; warnings issued for top-level symbols redefined.
Scans all of SCM objects and reclaims for further use those that are no longer accessible.
Prints out statistics about SCM's current use of storage. (room #t)
also gives the hexadecimal heap segment and stack bounds.
Contains the version string (e.g. `5e3') of SCM.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to dump a saved executable or to dynamically-link using DLD,
SCM must know where its executable file is. Sometimes SCM
(see section Executable Pathname) guesses incorrectly the location of the
currently running executable. In that case, the correct path can be set
by calling execpath with the pathname.
Returns the path (string) which SCM uses to find the executable file whose invocation the currently running session is, or #f if the path is not set.
Sets the path to #f or newpath, respectively. The old path
is returned.
For other configuration constants and procedures See (slib)Configuration section `Configuration' in SLIB.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 3.13.1 Unix Scheme Scripts | From Olin Shivers' Scheme Shell | |
| 3.13.2 MS-DOS Compatible Scripts | Run in MS-DOS and Unix | |
| 3.13.3 Unix Shell Scripts | Use /bin/sh to run Scheme |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In reading this section, keep in mind that the first line of a script
file has (different) meanings to SCM and the operating system
(execve).
On unix systems, a Shell-Script is a file (with execute
permissions) whose first two characters are `#!'. The
interpreter argument must be the pathname of the program to
process the rest of the file. The directories named by environment
variable PATH are not searched to find interpreter.
When executing a shell-script, the operating system invokes interpreter with a single argument encapsulating the rest of the first line's contents (if not just whitespace), the pathname of the Scheme Script file, and then any arguments which the shell-script was invoked with.
Put one space character between `#!' and the first character of interpreter (`/'). The interpreter name is followed by ` \'; SCM substitutes the second line of file for `\' (and the rest of the line), then appends any arguments given on the command line invoking this Scheme-Script.
When SCM executes the script, the Scheme variable *script* will be set to the script pathname. The last argument before `!#' on the second line should be `-'; SCM will load the script file, preserve the unprocessed arguments, and set *argv* to a list of the script pathname and the unprocessed arguments.
Note that the interpreter, not the operating system, provides the `\' substitution; this will only take place if interpreter is a SCM or SCSH interpreter.
When the first two characters of the file being loaded are #! and
a `\' is present before a newline in the file, all characters up
to `!#' will be ignored by SCM read.
This combination of interpretatons allows SCM source files to be used as POSIX shell-scripts if the first line is:
#! /usr/local/bin/scm \ |
The following Scheme-Script prints factorial of its argument:
#! /usr/local/bin/scm \ %0 %*
- !#
(define (fact.script args)
(cond ((and (= 1 (length args))
(string->number (car args)))
=> (lambda (n) (print (fact n)) #t))
(else (fact.usage))))
(define (fact.usage)
(print *argv*)
(display "\
Usage: fact N
Returns the factorial of N.
"
(current-error-port))
#f)
(define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n)))))
(if *script* (exit (fact.script (list-tail *argv* *optind*))))
|
./fact 32 ⇒ 263130836933693530167218012160000000 |
If the wrong number of arguments is given, fact prints its
argv with usage information.
./fact 3 2
-|
("./fact" "3" "2")
Usage: fact N
Returns the factorial of N.
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If open-input-file has not yet been used, the displayed procedure
is similar to the original definition (lines wrapped for readability):
open-input-file ⇒ #<CLOSURE (str) (or (open-file str open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we open a file using open-input-file, the sections of code
used become memoized:
(open-input-file "r4rstest.scm") ⇒ #<input-port 3> open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we cause open-input-file to execute other sections of code,
they too become memoized:
(open-input-file "foo.scm") ⇒ ERROR: No such file or directory ERROR: OPEN-INPUT-FILE couldn't open file "foo.scm" open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (#@and (#@procedure? #@could-not-open) (could-not-open) #f) (#@error "OPEN-INPUT-FILE couldn't open file " #@0+0))> |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The variable *interactive* determines whether the SCM session is interactive, or should quit after the command line is processed. *interactive* is controlled directly by the command-line options `-b', `-i', and `-s' (see section Invoking SCM). If none of these options are specified, the rules to determine interactivity are more complicated; see `Init5e3.scm' for details.
Resumes the top level Read-Eval-Print loop.
Restarts the SCM program with the same arguments as it was originally invoked. All `-l' loaded files are loaded again; If those files have changed, those changes will be reflected in the new session.
Note When running a saved executable (see section Dump),
restart is redefined to be exec-self.
Exits and immediately re-invokes the same executable with the same
arguments. If the executable file has been changed or replaced since
the beginning of the current session, the new executable will be
invoked. This differentiates exec-self from restart.
Controls how much monitoring information is printed. If n is:
no prompt or information is printed.
a prompt is printed.
messages bracketing file loading are printed.
the CPU time is printed after each top level form evaluated; notifications of heap growth printed; the interpreter checks stack depth periodically.
a garbage collection summary is printed after each top level form evaluated;
a message for each GC (see section Garbage Collection) is printed; warnings issued for top-level symbols redefined.
Scans all of SCM objects and reclaims for further use those that are no longer accessible.
Prints out statistics about SCM's current use of storage. (room #t)
also gives the hexadecimal heap segment and stack bounds.
Contains the version string (e.g. `5e3') of SCM.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to dump a saved executable or to dynamically-link using DLD,
SCM must know where its executable file is. Sometimes SCM
(see section Executable Pathname) guesses incorrectly the location of the
currently running executable. In that case, the correct path can be set
by calling execpath with the pathname.
Returns the path (string) which SCM uses to find the executable file whose invocation the currently running session is, or #f if the path is not set.
Sets the path to #f or newpath, respectively. The old path
is returned.
For other configuration constants and procedures See (slib)Configuration section `Configuration' in SLIB.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 3.13.1 Unix Scheme Scripts | From Olin Shivers' Scheme Shell | |
| 3.13.2 MS-DOS Compatible Scripts | Run in MS-DOS and Unix | |
| 3.13.3 Unix Shell Scripts | Use /bin/sh to run Scheme |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In reading this section, keep in mind that the first line of a script
file has (different) meanings to SCM and the operating system
(execve).
On unix systems, a Shell-Script is a file (with execute
permissions) whose first two characters are `#!'. The
interpreter argument must be the pathname of the program to
process the rest of the file. The directories named by environment
variable PATH are not searched to find interpreter.
When executing a shell-script, the operating system invokes interpreter with a single argument encapsulating the rest of the first line's contents (if not just whitespace), the pathname of the Scheme Script file, and then any arguments which the shell-script was invoked with.
Put one space character between `#!' and the first character of interpreter (`/'). The interpreter name is followed by ` \'; SCM substitutes the second line of file for `\' (and the rest of the line), then appends any arguments given on the command line invoking this Scheme-Script.
When SCM executes the script, the Scheme variable *script* will be set to the script pathname. The last argument before `!#' on the second line should be `-'; SCM will load the script file, preserve the unprocessed arguments, and set *argv* to a list of the script pathname and the unprocessed arguments.
Note that the interpreter, not the operating system, provides the `\' substitution; this will only take place if interpreter is a SCM or SCSH interpreter.
When the first two characters of the file being loaded are #! and
a `\' is present before a newline in the file, all characters up
to `!#' will be ignored by SCM read.
This combination of interpretatons allows SCM source files to be used as POSIX shell-scripts if the first line is:
#! /usr/local/bin/scm \ |
The following Scheme-Script prints factorial of its argument:
#! /usr/local/bin/scm \ %0 %*
- !#
(define (fact.script args)
(cond ((and (= 1 (length args))
(string->number (car args)))
=> (lambda (n) (print (fact n)) #t))
(else (fact.usage))))
(define (fact.usage)
(print *argv*)
(display "\
Usage: fact N
Returns the factorial of N.
"
(current-error-port))
#f)
(define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n)))))
(if *script* (exit (fact.script (list-tail *argv* *optind*))))
|
./fact 32 ⇒ 263130836933693530167218012160000000 |
If the wrong number of arguments is given, fact prints its
argv with usage information.
./fact 3 2
-|
("./fact" "3" "2")
Usage: fact N
Returns the factorial of N.
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If open-input-file has not yet been used, the displayed procedure
is similar to the original definition (lines wrapped for readability):
open-input-file ⇒ #<CLOSURE (str) (or (open-file str open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we open a file using open-input-file, the sections of code
used become memoized:
(open-input-file "r4rstest.scm") ⇒ #<input-port 3> open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we cause open-input-file to execute other sections of code,
they too become memoized:
(open-input-file "foo.scm") ⇒ ERROR: No such file or directory ERROR: OPEN-INPUT-FILE couldn't open file "foo.scm" open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (#@and (#@procedure? #@could-not-open) (could-not-open) #f) (#@error "OPEN-INPUT-FILE couldn't open file " #@0+0))> |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The variable *interactive* determines whether the SCM session is interactive, or should quit after the command line is processed. *interactive* is controlled directly by the command-line options `-b', `-i', and `-s' (see section Invoking SCM). If none of these options are specified, the rules to determine interactivity are more complicated; see `Init5e3.scm' for details.
Resumes the top level Read-Eval-Print loop.
Restarts the SCM program with the same arguments as it was originally invoked. All `-l' loaded files are loaded again; If those files have changed, those changes will be reflected in the new session.
Note When running a saved executable (see section Dump),
restart is redefined to be exec-self.
Exits and immediately re-invokes the same executable with the same
arguments. If the executable file has been changed or replaced since
the beginning of the current session, the new executable will be
invoked. This differentiates exec-self from restart.
Controls how much monitoring information is printed. If n is:
no prompt or information is printed.
a prompt is printed.
messages bracketing file loading are printed.
the CPU time is printed after each top level form evaluated; notifications of heap growth printed; the interpreter checks stack depth periodically.
a garbage collection summary is printed after each top level form evaluated;
a message for each GC (see section Garbage Collection) is printed; warnings issued for top-level symbols redefined.
Scans all of SCM objects and reclaims for further use those that are no longer accessible.
Prints out statistics about SCM's current use of storage. (room #t)
also gives the hexadecimal heap segment and stack bounds.
Contains the version string (e.g. `5e3') of SCM.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to dump a saved executable or to dynamically-link using DLD,
SCM must know where its executable file is. Sometimes SCM
(see section Executable Pathname) guesses incorrectly the location of the
currently running executable. In that case, the correct path can be set
by calling execpath with the pathname.
Returns the path (string) which SCM uses to find the executable file whose invocation the currently running session is, or #f if the path is not set.
Sets the path to #f or newpath, respectively. The old path
is returned.
For other configuration constants and procedures See (slib)Configuration section `Configuration' in SLIB.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 3.13.1 Unix Scheme Scripts | From Olin Shivers' Scheme Shell | |
| 3.13.2 MS-DOS Compatible Scripts | Run in MS-DOS and Unix | |
| 3.13.3 Unix Shell Scripts | Use /bin/sh to run Scheme |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In reading this section, keep in mind that the first line of a script
file has (different) meanings to SCM and the operating system
(execve).
On unix systems, a Shell-Script is a file (with execute
permissions) whose first two characters are `#!'. The
interpreter argument must be the pathname of the program to
process the rest of the file. The directories named by environment
variable PATH are not searched to find interpreter.
When executing a shell-script, the operating system invokes interpreter with a single argument encapsulating the rest of the first line's contents (if not just whitespace), the pathname of the Scheme Script file, and then any arguments which the shell-script was invoked with.
Put one space character between `#!' and the first character of interpreter (`/'). The interpreter name is followed by ` \'; SCM substitutes the second line of file for `\' (and the rest of the line), then appends any arguments given on the command line invoking this Scheme-Script.
When SCM executes the script, the Scheme variable *script* will be set to the script pathname. The last argument before `!#' on the second line should be `-'; SCM will load the script file, preserve the unprocessed arguments, and set *argv* to a list of the script pathname and the unprocessed arguments.
Note that the interpreter, not the operating system, provides the `\' substitution; this will only take place if interpreter is a SCM or SCSH interpreter.
When the first two characters of the file being loaded are #! and
a `\' is present before a newline in the file, all characters up
to `!#' will be ignored by SCM read.
This combination of interpretatons allows SCM source files to be used as POSIX shell-scripts if the first line is:
#! /usr/local/bin/scm \ |
The following Scheme-Script prints factorial of its argument:
#! /usr/local/bin/scm \ %0 %*
- !#
(define (fact.script args)
(cond ((and (= 1 (length args))
(string->number (car args)))
=> (lambda (n) (print (fact n)) #t))
(else (fact.usage))))
(define (fact.usage)
(print *argv*)
(display "\
Usage: fact N
Returns the factorial of N.
"
(current-error-port))
#f)
(define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n)))))
(if *script* (exit (fact.script (list-tail *argv* *optind*))))
|
./fact 32 ⇒ 263130836933693530167218012160000000 |
If the wrong number of arguments is given, fact prints its
argv with usage information.
./fact 3 2
-|
("./fact" "3" "2")
Usage: fact N
Returns the factorial of N.
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If open-input-file has not yet been used, the displayed procedure
is similar to the original definition (lines wrapped for readability):
open-input-file ⇒ #<CLOSURE (str) (or (open-file str open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we open a file using open-input-file, the sections of code
used become memoized:
(open-input-file "r4rstest.scm") ⇒ #<input-port 3> open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we cause open-input-file to execute other sections of code,
they too become memoized:
(open-input-file "foo.scm") ⇒ ERROR: No such file or directory ERROR: OPEN-INPUT-FILE couldn't open file "foo.scm" open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (#@and (#@procedure? #@could-not-open) (could-not-open) #f) (#@error "OPEN-INPUT-FILE couldn't open file " #@0+0))> |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The variable *interactive* determines whether the SCM session is interactive, or should quit after the command line is processed. *interactive* is controlled directly by the command-line options `-b', `-i', and `-s' (see section Invoking SCM). If none of these options are specified, the rules to determine interactivity are more complicated; see `Init5e3.scm' for details.
Resumes the top level Read-Eval-Print loop.
Restarts the SCM program with the same arguments as it was originally invoked. All `-l' loaded files are loaded again; If those files have changed, those changes will be reflected in the new session.
Note When running a saved executable (see section Dump),
restart is redefined to be exec-self.
Exits and immediately re-invokes the same executable with the same
arguments. If the executable file has been changed or replaced since
the beginning of the current session, the new executable will be
invoked. This differentiates exec-self from restart.
Controls how much monitoring information is printed. If n is:
no prompt or information is printed.
a prompt is printed.
messages bracketing file loading are printed.
the CPU time is printed after each top level form evaluated; notifications of heap growth printed; the interpreter checks stack depth periodically.
a garbage collection summary is printed after each top level form evaluated;
a message for each GC (see section Garbage Collection) is printed; warnings issued for top-level symbols redefined.
Scans all of SCM objects and reclaims for further use those that are no longer accessible.
Prints out statistics about SCM's current use of storage. (room #t)
also gives the hexadecimal heap segment and stack bounds.
Contains the version string (e.g. `5e3') of SCM.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to dump a saved executable or to dynamically-link using DLD,
SCM must know where its executable file is. Sometimes SCM
(see section Executable Pathname) guesses incorrectly the location of the
currently running executable. In that case, the correct path can be set
by calling execpath with the pathname.
Returns the path (string) which SCM uses to find the executable file whose invocation the currently running session is, or #f if the path is not set.
Sets the path to #f or newpath, respectively. The old path
is returned.
For other configuration constants and procedures See (slib)Configuration section `Configuration' in SLIB.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 3.13.1 Unix Scheme Scripts | From Olin Shivers' Scheme Shell | |
| 3.13.2 MS-DOS Compatible Scripts | Run in MS-DOS and Unix | |
| 3.13.3 Unix Shell Scripts | Use /bin/sh to run Scheme |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In reading this section, keep in mind that the first line of a script
file has (different) meanings to SCM and the operating system
(execve).
On unix systems, a Shell-Script is a file (with execute
permissions) whose first two characters are `#!'. The
interpreter argument must be the pathname of the program to
process the rest of the file. The directories named by environment
variable PATH are not searched to find interpreter.
When executing a shell-script, the operating system invokes interpreter with a single argument encapsulating the rest of the first line's contents (if not just whitespace), the pathname of the Scheme Script file, and then any arguments which the shell-script was invoked with.
Put one space character between `#!' and the first character of interpreter (`/'). The interpreter name is followed by ` \'; SCM substitutes the second line of file for `\' (and the rest of the line), then appends any arguments given on the command line invoking this Scheme-Script.
When SCM executes the script, the Scheme variable *script* will be set to the script pathname. The last argument before `!#' on the second line should be `-'; SCM will load the script file, preserve the unprocessed arguments, and set *argv* to a list of the script pathname and the unprocessed arguments.
Note that the interpreter, not the operating system, provides the `\' substitution; this will only take place if interpreter is a SCM or SCSH interpreter.
When the first two characters of the file being loaded are #! and
a `\' is present before a newline in the file, all characters up
to `!#' will be ignored by SCM read.
This combination of interpretatons allows SCM source files to be used as POSIX shell-scripts if the first line is:
#! /usr/local/bin/scm \ |
The following Scheme-Script prints factorial of its argument:
#! /usr/local/bin/scm \ %0 %*
- !#
(define (fact.script args)
(cond ((and (= 1 (length args))
(string->number (car args)))
=> (lambda (n) (print (fact n)) #t))
(else (fact.usage))))
(define (fact.usage)
(print *argv*)
(display "\
Usage: fact N
Returns the factorial of N.
"
(current-error-port))
#f)
(define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n)))))
(if *script* (exit (fact.script (list-tail *argv* *optind*))))
|
./fact 32 ⇒ 263130836933693530167218012160000000 |
If the wrong number of arguments is given, fact prints its
argv with usage information.
./fact 3 2
-|
("./fact" "3" "2")
Usage: fact N
Returns the factorial of N.
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If open-input-file has not yet been used, the displayed procedure
is similar to the original definition (lines wrapped for readability):
open-input-file ⇒ #<CLOSURE (str) (or (open-file str open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we open a file using open-input-file, the sections of code
used become memoized:
(open-input-file "r4rstest.scm") ⇒ #<input-port 3> open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we cause open-input-file to execute other sections of code,
they too become memoized:
(open-input-file "foo.scm") ⇒ ERROR: No such file or directory ERROR: OPEN-INPUT-FILE couldn't open file "foo.scm" open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (#@and (#@procedure? #@could-not-open) (could-not-open) #f) (#@error "OPEN-INPUT-FILE couldn't open file " #@0+0))> |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The variable *interactive* determines whether the SCM session is interactive, or should quit after the command line is processed. *interactive* is controlled directly by the command-line options `-b', `-i', and `-s' (see section Invoking SCM). If none of these options are specified, the rules to determine interactivity are more complicated; see `Init5e3.scm' for details.
Resumes the top level Read-Eval-Print loop.
Restarts the SCM program with the same arguments as it was originally invoked. All `-l' loaded files are loaded again; If those files have changed, those changes will be reflected in the new session.
Note When running a saved executable (see section Dump),
restart is redefined to be exec-self.
Exits and immediately re-invokes the same executable with the same
arguments. If the executable file has been changed or replaced since
the beginning of the current session, the new executable will be
invoked. This differentiates exec-self from restart.
Controls how much monitoring information is printed. If n is:
no prompt or information is printed.
a prompt is printed.
messages bracketing file loading are printed.
the CPU time is printed after each top level form evaluated; notifications of heap growth printed; the interpreter checks stack depth periodically.
a garbage collection summary is printed after each top level form evaluated;
a message for each GC (see section Garbage Collection) is printed; warnings issued for top-level symbols redefined.
Scans all of SCM objects and reclaims for further use those that are no longer accessible.
Prints out statistics about SCM's current use of storage. (room #t)
also gives the hexadecimal heap segment and stack bounds.
Contains the version string (e.g. `5e3') of SCM.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to dump a saved executable or to dynamically-link using DLD,
SCM must know where its executable file is. Sometimes SCM
(see section Executable Pathname) guesses incorrectly the location of the
currently running executable. In that case, the correct path can be set
by calling execpath with the pathname.
Returns the path (string) which SCM uses to find the executable file whose invocation the currently running session is, or #f if the path is not set.
Sets the path to #f or newpath, respectively. The old path
is returned.
For other configuration constants and procedures See (slib)Configuration section `Configuration' in SLIB.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 3.13.1 Unix Scheme Scripts | From Olin Shivers' Scheme Shell | |
| 3.13.2 MS-DOS Compatible Scripts | Run in MS-DOS and Unix | |
| 3.13.3 Unix Shell Scripts | Use /bin/sh to run Scheme |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In reading this section, keep in mind that the first line of a script
file has (different) meanings to SCM and the operating system
(execve).
On unix systems, a Shell-Script is a file (with execute
permissions) whose first two characters are `#!'. The
interpreter argument must be the pathname of the program to
process the rest of the file. The directories named by environment
variable PATH are not searched to find interpreter.
When executing a shell-script, the operating system invokes interpreter with a single argument encapsulating the rest of the first line's contents (if not just whitespace), the pathname of the Scheme Script file, and then any arguments which the shell-script was invoked with.
Put one space character between `#!' and the first character of interpreter (`/'). The interpreter name is followed by ` \'; SCM substitutes the second line of file for `\' (and the rest of the line), then appends any arguments given on the command line invoking this Scheme-Script.
When SCM executes the script, the Scheme variable *script* will be set to the script pathname. The last argument before `!#' on the second line should be `-'; SCM will load the script file, preserve the unprocessed arguments, and set *argv* to a list of the script pathname and the unprocessed arguments.
Note that the interpreter, not the operating system, provides the `\' substitution; this will only take place if interpreter is a SCM or SCSH interpreter.
When the first two characters of the file being loaded are #! and
a `\' is present before a newline in the file, all characters up
to `!#' will be ignored by SCM read.
This combination of interpretatons allows SCM source files to be used as POSIX shell-scripts if the first line is:
#! /usr/local/bin/scm \ |
The following Scheme-Script prints factorial of its argument:
#! /usr/local/bin/scm \ %0 %*
- !#
(define (fact.script args)
(cond ((and (= 1 (length args))
(string->number (car args)))
=> (lambda (n) (print (fact n)) #t))
(else (fact.usage))))
(define (fact.usage)
(print *argv*)
(display "\
Usage: fact N
Returns the factorial of N.
"
(current-error-port))
#f)
(define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n)))))
(if *script* (exit (fact.script (list-tail *argv* *optind*))))
|
./fact 32 ⇒ 263130836933693530167218012160000000 |
If the wrong number of arguments is given, fact prints its
argv with usage information.
./fact 3 2
-|
("./fact" "3" "2")
Usage: fact N
Returns the factorial of N.
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If open-input-file has not yet been used, the displayed procedure
is similar to the original definition (lines wrapped for readability):
open-input-file ⇒ #<CLOSURE (str) (or (open-file str open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we open a file using open-input-file, the sections of code
used become memoized:
(open-input-file "r4rstest.scm") ⇒ #<input-port 3> open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we cause open-input-file to execute other sections of code,
they too become memoized:
(open-input-file "foo.scm") ⇒ ERROR: No such file or directory ERROR: OPEN-INPUT-FILE couldn't open file "foo.scm" open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (#@and (#@procedure? #@could-not-open) (could-not-open) #f) (#@error "OPEN-INPUT-FILE couldn't open file " #@0+0))> |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The variable *interactive* determines whether the SCM session is interactive, or should quit after the command line is processed. *interactive* is controlled directly by the command-line options `-b', `-i', and `-s' (see section Invoking SCM). If none of these options are specified, the rules to determine interactivity are more complicated; see `Init5e3.scm' for details.
Resumes the top level Read-Eval-Print loop.
Restarts the SCM program with the same arguments as it was originally invoked. All `-l' loaded files are loaded again; If those files have changed, those changes will be reflected in the new session.
Note When running a saved executable (see section Dump),
restart is redefined to be exec-self.
Exits and immediately re-invokes the same executable with the same
arguments. If the executable file has been changed or replaced since
the beginning of the current session, the new executable will be
invoked. This differentiates exec-self from restart.
Controls how much monitoring information is printed. If n is:
no prompt or information is printed.
a prompt is printed.
messages bracketing file loading are printed.
the CPU time is printed after each top level form evaluated; notifications of heap growth printed; the interpreter checks stack depth periodically.
a garbage collection summary is printed after each top level form evaluated;
a message for each GC (see section Garbage Collection) is printed; warnings issued for top-level symbols redefined.
Scans all of SCM objects and reclaims for further use those that are no longer accessible.
Prints out statistics about SCM's current use of storage. (room #t)
also gives the hexadecimal heap segment and stack bounds.
Contains the version string (e.g. `5e3') of SCM.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to dump a saved executable or to dynamically-link using DLD,
SCM must know where its executable file is. Sometimes SCM
(see section Executable Pathname) guesses incorrectly the location of the
currently running executable. In that case, the correct path can be set
by calling execpath with the pathname.
Returns the path (string) which SCM uses to find the executable file whose invocation the currently running session is, or #f if the path is not set.
Sets the path to #f or newpath, respectively. The old path
is returned.
For other configuration constants and procedures See (slib)Configuration section `Configuration' in SLIB.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 3.13.1 Unix Scheme Scripts | From Olin Shivers' Scheme Shell | |
| 3.13.2 MS-DOS Compatible Scripts | Run in MS-DOS and Unix | |
| 3.13.3 Unix Shell Scripts | Use /bin/sh to run Scheme |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In reading this section, keep in mind that the first line of a script
file has (different) meanings to SCM and the operating system
(execve).
On unix systems, a Shell-Script is a file (with execute
permissions) whose first two characters are `#!'. The
interpreter argument must be the pathname of the program to
process the rest of the file. The directories named by environment
variable PATH are not searched to find interpreter.
When executing a shell-script, the operating system invokes interpreter with a single argument encapsulating the rest of the first line's contents (if not just whitespace), the pathname of the Scheme Script file, and then any arguments which the shell-script was invoked with.
Put one space character between `#!' and the first character of interpreter (`/'). The interpreter name is followed by ` \'; SCM substitutes the second line of file for `\' (and the rest of the line), then appends any arguments given on the command line invoking this Scheme-Script.
When SCM executes the script, the Scheme variable *script* will be set to the script pathname. The last argument before `!#' on the second line should be `-'; SCM will load the script file, preserve the unprocessed arguments, and set *argv* to a list of the script pathname and the unprocessed arguments.
Note that the interpreter, not the operating system, provides the `\' substitution; this will only take place if interpreter is a SCM or SCSH interpreter.
When the first two characters of the file being loaded are #! and
a `\' is present before a newline in the file, all characters up
to `!#' will be ignored by SCM read.
This combination of interpretatons allows SCM source files to be used as POSIX shell-scripts if the first line is:
#! /usr/local/bin/scm \ |
The following Scheme-Script prints factorial of its argument:
#! /usr/local/bin/scm \ %0 %*
- !#
(define (fact.script args)
(cond ((and (= 1 (length args))
(string->number (car args)))
=> (lambda (n) (print (fact n)) #t))
(else (fact.usage))))
(define (fact.usage)
(print *argv*)
(display "\
Usage: fact N
Returns the factorial of N.
"
(current-error-port))
#f)
(define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n)))))
(if *script* (exit (fact.script (list-tail *argv* *optind*))))
|
./fact 32 ⇒ 263130836933693530167218012160000000 |
If the wrong number of arguments is given, fact prints its
argv with usage information.
./fact 3 2
-|
("./fact" "3" "2")
Usage: fact N
Returns the factorial of N.
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If open-input-file has not yet been used, the displayed procedure
is similar to the original definition (lines wrapped for readability):
open-input-file ⇒ #<CLOSURE (str) (or (open-file str open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we open a file using open-input-file, the sections of code
used become memoized:
(open-input-file "r4rstest.scm") ⇒ #<input-port 3> open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we cause open-input-file to execute other sections of code,
they too become memoized:
(open-input-file "foo.scm") ⇒ ERROR: No such file or directory ERROR: OPEN-INPUT-FILE couldn't open file "foo.scm" open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (#@and (#@procedure? #@could-not-open) (could-not-open) #f) (#@error "OPEN-INPUT-FILE couldn't open file " #@0+0))> |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The variable *interactive* determines whether the SCM session is interactive, or should quit after the command line is processed. *interactive* is controlled directly by the command-line options `-b', `-i', and `-s' (see section Invoking SCM). If none of these options are specified, the rules to determine interactivity are more complicated; see `Init5e3.scm' for details.
Resumes the top level Read-Eval-Print loop.
Restarts the SCM program with the same arguments as it was originally invoked. All `-l' loaded files are loaded again; If those files have changed, those changes will be reflected in the new session.
Note When running a saved executable (see section Dump),
restart is redefined to be exec-self.
Exits and immediately re-invokes the same executable with the same
arguments. If the executable file has been changed or replaced since
the beginning of the current session, the new executable will be
invoked. This differentiates exec-self from restart.
Controls how much monitoring information is printed. If n is:
no prompt or information is printed.
a prompt is printed.
messages bracketing file loading are printed.
the CPU time is printed after each top level form evaluated; notifications of heap growth printed; the interpreter checks stack depth periodically.
a garbage collection summary is printed after each top level form evaluated;
a message for each GC (see section Garbage Collection) is printed; warnings issued for top-level symbols redefined.
Scans all of SCM objects and reclaims for further use those that are no longer accessible.
Prints out statistics about SCM's current use of storage. (room #t)
also gives the hexadecimal heap segment and stack bounds.
Contains the version string (e.g. `5e3') of SCM.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to dump a saved executable or to dynamically-link using DLD,
SCM must know where its executable file is. Sometimes SCM
(see section Executable Pathname) guesses incorrectly the location of the
currently running executable. In that case, the correct path can be set
by calling execpath with the pathname.
Returns the path (string) which SCM uses to find the executable file whose invocation the currently running session is, or #f if the path is not set.
Sets the path to #f or newpath, respectively. The old path
is returned.
For other configuration constants and procedures See (slib)Configuration section `Configuration' in SLIB.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 3.13.1 Unix Scheme Scripts | From Olin Shivers' Scheme Shell | |
| 3.13.2 MS-DOS Compatible Scripts | Run in MS-DOS and Unix | |
| 3.13.3 Unix Shell Scripts | Use /bin/sh to run Scheme |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In reading this section, keep in mind that the first line of a script
file has (different) meanings to SCM and the operating system
(execve).
On unix systems, a Shell-Script is a file (with execute
permissions) whose first two characters are `#!'. The
interpreter argument must be the pathname of the program to
process the rest of the file. The directories named by environment
variable PATH are not searched to find interpreter.
When executing a shell-script, the operating system invokes interpreter with a single argument encapsulating the rest of the first line's contents (if not just whitespace), the pathname of the Scheme Script file, and then any arguments which the shell-script was invoked with.
Put one space character between `#!' and the first character of interpreter (`/'). The interpreter name is followed by ` \'; SCM substitutes the second line of file for `\' (and the rest of the line), then appends any arguments given on the command line invoking this Scheme-Script.
When SCM executes the script, the Scheme variable *script* will be set to the script pathname. The last argument before `!#' on the second line should be `-'; SCM will load the script file, preserve the unprocessed arguments, and set *argv* to a list of the script pathname and the unprocessed arguments.
Note that the interpreter, not the operating system, provides the `\' substitution; this will only take place if interpreter is a SCM or SCSH interpreter.
When the first two characters of the file being loaded are #! and
a `\' is present before a newline in the file, all characters up
to `!#' will be ignored by SCM read.
This combination of interpretatons allows SCM source files to be used as POSIX shell-scripts if the first line is:
#! /usr/local/bin/scm \ |
The following Scheme-Script prints factorial of its argument:
#! /usr/local/bin/scm \ %0 %*
- !#
(define (fact.script args)
(cond ((and (= 1 (length args))
(string->number (car args)))
=> (lambda (n) (print (fact n)) #t))
(else (fact.usage))))
(define (fact.usage)
(print *argv*)
(display "\
Usage: fact N
Returns the factorial of N.
"
(current-error-port))
#f)
(define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n)))))
(if *script* (exit (fact.script (list-tail *argv* *optind*))))
|
./fact 32 ⇒ 263130836933693530167218012160000000 |
If the wrong number of arguments is given, fact prints its
argv with usage information.
./fact 3 2
-|
("./fact" "3" "2")
Usage: fact N
Returns the factorial of N.
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If open-input-file has not yet been used, the displayed procedure
is similar to the original definition (lines wrapped for readability):
open-input-file ⇒ #<CLOSURE (str) (or (open-file str open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we open a file using open-input-file, the sections of code
used become memoized:
(open-input-file "r4rstest.scm") ⇒ #<input-port 3> open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we cause open-input-file to execute other sections of code,
they too become memoized:
(open-input-file "foo.scm") ⇒ ERROR: No such file or directory ERROR: OPEN-INPUT-FILE couldn't open file "foo.scm" open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (#@and (#@procedure? #@could-not-open) (could-not-open) #f) (#@error "OPEN-INPUT-FILE couldn't open file " #@0+0))> |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The variable *interactive* determines whether the SCM session is interactive, or should quit after the command line is processed. *interactive* is controlled directly by the command-line options `-b', `-i', and `-s' (see section Invoking SCM). If none of these options are specified, the rules to determine interactivity are more complicated; see `Init5e3.scm' for details.
Resumes the top level Read-Eval-Print loop.
Restarts the SCM program with the same arguments as it was originally invoked. All `-l' loaded files are loaded again; If those files have changed, those changes will be reflected in the new session.
Note When running a saved executable (see section Dump),
restart is redefined to be exec-self.
Exits and immediately re-invokes the same executable with the same
arguments. If the executable file has been changed or replaced since
the beginning of the current session, the new executable will be
invoked. This differentiates exec-self from restart.
Controls how much monitoring information is printed. If n is:
no prompt or information is printed.
a prompt is printed.
messages bracketing file loading are printed.
the CPU time is printed after each top level form evaluated; notifications of heap growth printed; the interpreter checks stack depth periodically.
a garbage collection summary is printed after each top level form evaluated;
a message for each GC (see section Garbage Collection) is printed; warnings issued for top-level symbols redefined.
Scans all of SCM objects and reclaims for further use those that are no longer accessible.
Prints out statistics about SCM's current use of storage. (room #t)
also gives the hexadecimal heap segment and stack bounds.
Contains the version string (e.g. `5e3') of SCM.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to dump a saved executable or to dynamically-link using DLD,
SCM must know where its executable file is. Sometimes SCM
(see section Executable Pathname) guesses incorrectly the location of the
currently running executable. In that case, the correct path can be set
by calling execpath with the pathname.
Returns the path (string) which SCM uses to find the executable file whose invocation the currently running session is, or #f if the path is not set.
Sets the path to #f or newpath, respectively. The old path
is returned.
For other configuration constants and procedures See (slib)Configuration section `Configuration' in SLIB.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 3.13.1 Unix Scheme Scripts | From Olin Shivers' Scheme Shell | |
| 3.13.2 MS-DOS Compatible Scripts | Run in MS-DOS and Unix | |
| 3.13.3 Unix Shell Scripts | Use /bin/sh to run Scheme |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In reading this section, keep in mind that the first line of a script
file has (different) meanings to SCM and the operating system
(execve).
On unix systems, a Shell-Script is a file (with execute
permissions) whose first two characters are `#!'. The
interpreter argument must be the pathname of the program to
process the rest of the file. The directories named by environment
variable PATH are not searched to find interpreter.
When executing a shell-script, the operating system invokes interpreter with a single argument encapsulating the rest of the first line's contents (if not just whitespace), the pathname of the Scheme Script file, and then any arguments which the shell-script was invoked with.
Put one space character between `#!' and the first character of interpreter (`/'). The interpreter name is followed by ` \'; SCM substitutes the second line of file for `\' (and the rest of the line), then appends any arguments given on the command line invoking this Scheme-Script.
When SCM executes the script, the Scheme variable *script* will be set to the script pathname. The last argument before `!#' on the second line should be `-'; SCM will load the script file, preserve the unprocessed arguments, and set *argv* to a list of the script pathname and the unprocessed arguments.
Note that the interpreter, not the operating system, provides the `\' substitution; this will only take place if interpreter is a SCM or SCSH interpreter.
When the first two characters of the file being loaded are #! and
a `\' is present before a newline in the file, all characters up
to `!#' will be ignored by SCM read.
This combination of interpretatons allows SCM source files to be used as POSIX shell-scripts if the first line is:
#! /usr/local/bin/scm \ |
The following Scheme-Script prints factorial of its argument:
#! /usr/local/bin/scm \ %0 %*
- !#
(define (fact.script args)
(cond ((and (= 1 (length args))
(string->number (car args)))
=> (lambda (n) (print (fact n)) #t))
(else (fact.usage))))
(define (fact.usage)
(print *argv*)
(display "\
Usage: fact N
Returns the factorial of N.
"
(current-error-port))
#f)
(define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n)))))
(if *script* (exit (fact.script (list-tail *argv* *optind*))))
|
./fact 32 ⇒ 263130836933693530167218012160000000 |
If the wrong number of arguments is given, fact prints its
argv with usage information.
./fact 3 2
-|
("./fact" "3" "2")
Usage: fact N
Returns the factorial of N.
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If open-input-file has not yet been used, the displayed procedure
is similar to the original definition (lines wrapped for readability):
open-input-file ⇒ #<CLOSURE (str) (or (open-file str open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we open a file using open-input-file, the sections of code
used become memoized:
(open-input-file "r4rstest.scm") ⇒ #<input-port 3> open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we cause open-input-file to execute other sections of code,
they too become memoized:
(open-input-file "foo.scm") ⇒ ERROR: No such file or directory ERROR: OPEN-INPUT-FILE couldn't open file "foo.scm" open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (#@and (#@procedure? #@could-not-open) (could-not-open) #f) (#@error "OPEN-INPUT-FILE couldn't open file " #@0+0))> |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The variable *interactive* determines whether the SCM session is interactive, or should quit after the command line is processed. *interactive* is controlled directly by the command-line options `-b', `-i', and `-s' (see section Invoking SCM). If none of these options are specified, the rules to determine interactivity are more complicated; see `Init5e3.scm' for details.
Resumes the top level Read-Eval-Print loop.
Restarts the SCM program with the same arguments as it was originally invoked. All `-l' loaded files are loaded again; If those files have changed, those changes will be reflected in the new session.
Note When running a saved executable (see section Dump),
restart is redefined to be exec-self.
Exits and immediately re-invokes the same executable with the same
arguments. If the executable file has been changed or replaced since
the beginning of the current session, the new executable will be
invoked. This differentiates exec-self from restart.
Controls how much monitoring information is printed. If n is:
no prompt or information is printed.
a prompt is printed.
messages bracketing file loading are printed.
the CPU time is printed after each top level form evaluated; notifications of heap growth printed; the interpreter checks stack depth periodically.
a garbage collection summary is printed after each top level form evaluated;
a message for each GC (see section Garbage Collection) is printed; warnings issued for top-level symbols redefined.
Scans all of SCM objects and reclaims for further use those that are no longer accessible.
Prints out statistics about SCM's current use of storage. (room #t)
also gives the hexadecimal heap segment and stack bounds.
Contains the version string (e.g. `5e3') of SCM.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to dump a saved executable or to dynamically-link using DLD,
SCM must know where its executable file is. Sometimes SCM
(see section Executable Pathname) guesses incorrectly the location of the
currently running executable. In that case, the correct path can be set
by calling execpath with the pathname.
Returns the path (string) which SCM uses to find the executable file whose invocation the currently running session is, or #f if the path is not set.
Sets the path to #f or newpath, respectively. The old path
is returned.
For other configuration constants and procedures See (slib)Configuration section `Configuration' in SLIB.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 3.13.1 Unix Scheme Scripts | From Olin Shivers' Scheme Shell | |
| 3.13.2 MS-DOS Compatible Scripts | Run in MS-DOS and Unix | |
| 3.13.3 Unix Shell Scripts | Use /bin/sh to run Scheme |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In reading this section, keep in mind that the first line of a script
file has (different) meanings to SCM and the operating system
(execve).
On unix systems, a Shell-Script is a file (with execute
permissions) whose first two characters are `#!'. The
interpreter argument must be the pathname of the program to
process the rest of the file. The directories named by environment
variable PATH are not searched to find interpreter.
When executing a shell-script, the operating system invokes interpreter with a single argument encapsulating the rest of the first line's contents (if not just whitespace), the pathname of the Scheme Script file, and then any arguments which the shell-script was invoked with.
Put one space character between `#!' and the first character of interpreter (`/'). The interpreter name is followed by ` \'; SCM substitutes the second line of file for `\' (and the rest of the line), then appends any arguments given on the command line invoking this Scheme-Script.
When SCM executes the script, the Scheme variable *script* will be set to the script pathname. The last argument before `!#' on the second line should be `-'; SCM will load the script file, preserve the unprocessed arguments, and set *argv* to a list of the script pathname and the unprocessed arguments.
Note that the interpreter, not the operating system, provides the `\' substitution; this will only take place if interpreter is a SCM or SCSH interpreter.
When the first two characters of the file being loaded are #! and
a `\' is present before a newline in the file, all characters up
to `!#' will be ignored by SCM read.
This combination of interpretatons allows SCM source files to be used as POSIX shell-scripts if the first line is:
#! /usr/local/bin/scm \ |
The following Scheme-Script prints factorial of its argument:
#! /usr/local/bin/scm \ %0 %*
- !#
(define (fact.script args)
(cond ((and (= 1 (length args))
(string->number (car args)))
=> (lambda (n) (print (fact n)) #t))
(else (fact.usage))))
(define (fact.usage)
(print *argv*)
(display "\
Usage: fact N
Returns the factorial of N.
"
(current-error-port))
#f)
(define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n)))))
(if *script* (exit (fact.script (list-tail *argv* *optind*))))
|
./fact 32 ⇒ 263130836933693530167218012160000000 |
If the wrong number of arguments is given, fact prints its
argv with usage information.
./fact 3 2
-|
("./fact" "3" "2")
Usage: fact N
Returns the factorial of N.
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If open-input-file has not yet been used, the displayed procedure
is similar to the original definition (lines wrapped for readability):
open-input-file ⇒ #<CLOSURE (str) (or (open-file str open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we open a file using open-input-file, the sections of code
used become memoized:
(open-input-file "r4rstest.scm") ⇒ #<input-port 3> open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we cause open-input-file to execute other sections of code,
they too become memoized:
(open-input-file "foo.scm") ⇒ ERROR: No such file or directory ERROR: OPEN-INPUT-FILE couldn't open file "foo.scm" open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (#@and (#@procedure? #@could-not-open) (could-not-open) #f) (#@error "OPEN-INPUT-FILE couldn't open file " #@0+0))> |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The variable *interactive* determines whether the SCM session is interactive, or should quit after the command line is processed. *interactive* is controlled directly by the command-line options `-b', `-i', and `-s' (see section Invoking SCM). If none of these options are specified, the rules to determine interactivity are more complicated; see `Init5e3.scm' for details.
Resumes the top level Read-Eval-Print loop.
Restarts the SCM program with the same arguments as it was originally invoked. All `-l' loaded files are loaded again; If those files have changed, those changes will be reflected in the new session.
Note When running a saved executable (see section Dump),
restart is redefined to be exec-self.
Exits and immediately re-invokes the same executable with the same
arguments. If the executable file has been changed or replaced since
the beginning of the current session, the new executable will be
invoked. This differentiates exec-self from restart.
Controls how much monitoring information is printed. If n is:
no prompt or information is printed.
a prompt is printed.
messages bracketing file loading are printed.
the CPU time is printed after each top level form evaluated; notifications of heap growth printed; the interpreter checks stack depth periodically.
a garbage collection summary is printed after each top level form evaluated;
a message for each GC (see section Garbage Collection) is printed; warnings issued for top-level symbols redefined.
Scans all of SCM objects and reclaims for further use those that are no longer accessible.
Prints out statistics about SCM's current use of storage. (room #t)
also gives the hexadecimal heap segment and stack bounds.
Contains the version string (e.g. `5e3') of SCM.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to dump a saved executable or to dynamically-link using DLD,
SCM must know where its executable file is. Sometimes SCM
(see section Executable Pathname) guesses incorrectly the location of the
currently running executable. In that case, the correct path can be set
by calling execpath with the pathname.
Returns the path (string) which SCM uses to find the executable file whose invocation the currently running session is, or #f if the path is not set.
Sets the path to #f or newpath, respectively. The old path
is returned.
For other configuration constants and procedures See (slib)Configuration section `Configuration' in SLIB.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 3.13.1 Unix Scheme Scripts | From Olin Shivers' Scheme Shell | |
| 3.13.2 MS-DOS Compatible Scripts | Run in MS-DOS and Unix | |
| 3.13.3 Unix Shell Scripts | Use /bin/sh to run Scheme |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In reading this section, keep in mind that the first line of a script
file has (different) meanings to SCM and the operating system
(execve).
On unix systems, a Shell-Script is a file (with execute
permissions) whose first two characters are `#!'. The
interpreter argument must be the pathname of the program to
process the rest of the file. The directories named by environment
variable PATH are not searched to find interpreter.
When executing a shell-script, the operating system invokes interpreter with a single argument encapsulating the rest of the first line's contents (if not just whitespace), the pathname of the Scheme Script file, and then any arguments which the shell-script was invoked with.
Put one space character between `#!' and the first character of interpreter (`/'). The interpreter name is followed by ` \'; SCM substitutes the second line of file for `\' (and the rest of the line), then appends any arguments given on the command line invoking this Scheme-Script.
When SCM executes the script, the Scheme variable *script* will be set to the script pathname. The last argument before `!#' on the second line should be `-'; SCM will load the script file, preserve the unprocessed arguments, and set *argv* to a list of the script pathname and the unprocessed arguments.
Note that the interpreter, not the operating system, provides the `\' substitution; this will only take place if interpreter is a SCM or SCSH interpreter.
When the first two characters of the file being loaded are #! and
a `\' is present before a newline in the file, all characters up
to `!#' will be ignored by SCM read.
This combination of interpretatons allows SCM source files to be used as POSIX shell-scripts if the first line is:
#! /usr/local/bin/scm \ |
The following Scheme-Script prints factorial of its argument:
#! /usr/local/bin/scm \ %0 %*
- !#
(define (fact.script args)
(cond ((and (= 1 (length args))
(string->number (car args)))
=> (lambda (n) (print (fact n)) #t))
(else (fact.usage))))
(define (fact.usage)
(print *argv*)
(display "\
Usage: fact N
Returns the factorial of N.
"
(current-error-port))
#f)
(define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n)))))
(if *script* (exit (fact.script (list-tail *argv* *optind*))))
|
./fact 32 ⇒ 263130836933693530167218012160000000 |
If the wrong number of arguments is given, fact prints its
argv with usage information.
./fact 3 2
-|
("./fact" "3" "2")
Usage: fact N
Returns the factorial of N.
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If open-input-file has not yet been used, the displayed procedure
is similar to the original definition (lines wrapped for readability):
open-input-file ⇒ #<CLOSURE (str) (or (open-file str open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we open a file using open-input-file, the sections of code
used become memoized:
(open-input-file "r4rstest.scm") ⇒ #<input-port 3> open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we cause open-input-file to execute other sections of code,
they too become memoized:
(open-input-file "foo.scm") ⇒ ERROR: No such file or directory ERROR: OPEN-INPUT-FILE couldn't open file "foo.scm" open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (#@and (#@procedure? #@could-not-open) (could-not-open) #f) (#@error "OPEN-INPUT-FILE couldn't open file " #@0+0))> |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The variable *interactive* determines whether the SCM session is interactive, or should quit after the command line is processed. *interactive* is controlled directly by the command-line options `-b', `-i', and `-s' (see section Invoking SCM). If none of these options are specified, the rules to determine interactivity are more complicated; see `Init5e3.scm' for details.
Resumes the top level Read-Eval-Print loop.
Restarts the SCM program with the same arguments as it was originally invoked. All `-l' loaded files are loaded again; If those files have changed, those changes will be reflected in the new session.
Note When running a saved executable (see section Dump),
restart is redefined to be exec-self.
Exits and immediately re-invokes the same executable with the same
arguments. If the executable file has been changed or replaced since
the beginning of the current session, the new executable will be
invoked. This differentiates exec-self from restart.
Controls how much monitoring information is printed. If n is:
no prompt or information is printed.
a prompt is printed.
messages bracketing file loading are printed.
the CPU time is printed after each top level form evaluated; notifications of heap growth printed; the interpreter checks stack depth periodically.
a garbage collection summary is printed after each top level form evaluated;
a message for each GC (see section Garbage Collection) is printed; warnings issued for top-level symbols redefined.
Scans all of SCM objects and reclaims for further use those that are no longer accessible.
Prints out statistics about SCM's current use of storage. (room #t)
also gives the hexadecimal heap segment and stack bounds.
Contains the version string (e.g. `5e3') of SCM.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to dump a saved executable or to dynamically-link using DLD,
SCM must know where its executable file is. Sometimes SCM
(see section Executable Pathname) guesses incorrectly the location of the
currently running executable. In that case, the correct path can be set
by calling execpath with the pathname.
Returns the path (string) which SCM uses to find the executable file whose invocation the currently running session is, or #f if the path is not set.
Sets the path to #f or newpath, respectively. The old path
is returned.
For other configuration constants and procedures See (slib)Configuration section `Configuration' in SLIB.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 3.13.1 Unix Scheme Scripts | From Olin Shivers' Scheme Shell | |
| 3.13.2 MS-DOS Compatible Scripts | Run in MS-DOS and Unix | |
| 3.13.3 Unix Shell Scripts | Use /bin/sh to run Scheme |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In reading this section, keep in mind that the first line of a script
file has (different) meanings to SCM and the operating system
(execve).
On unix systems, a Shell-Script is a file (with execute
permissions) whose first two characters are `#!'. The
interpreter argument must be the pathname of the program to
process the rest of the file. The directories named by environment
variable PATH are not searched to find interpreter.
When executing a shell-script, the operating system invokes interpreter with a single argument encapsulating the rest of the first line's contents (if not just whitespace), the pathname of the Scheme Script file, and then any arguments which the shell-script was invoked with.
Put one space character between `#!' and the first character of interpreter (`/'). The interpreter name is followed by ` \'; SCM substitutes the second line of file for `\' (and the rest of the line), then appends any arguments given on the command line invoking this Scheme-Script.
When SCM executes the script, the Scheme variable *script* will be set to the script pathname. The last argument before `!#' on the second line should be `-'; SCM will load the script file, preserve the unprocessed arguments, and set *argv* to a list of the script pathname and the unprocessed arguments.
Note that the interpreter, not the operating system, provides the `\' substitution; this will only take place if interpreter is a SCM or SCSH interpreter.
When the first two characters of the file being loaded are #! and
a `\' is present before a newline in the file, all characters up
to `!#' will be ignored by SCM read.
This combination of interpretatons allows SCM source files to be used as POSIX shell-scripts if the first line is:
#! /usr/local/bin/scm \ |
The following Scheme-Script prints factorial of its argument:
#! /usr/local/bin/scm \ %0 %*
- !#
(define (fact.script args)
(cond ((and (= 1 (length args))
(string->number (car args)))
=> (lambda (n) (print (fact n)) #t))
(else (fact.usage))))
(define (fact.usage)
(print *argv*)
(display "\
Usage: fact N
Returns the factorial of N.
"
(current-error-port))
#f)
(define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n)))))
(if *script* (exit (fact.script (list-tail *argv* *optind*))))
|
./fact 32 ⇒ 263130836933693530167218012160000000 |
If the wrong number of arguments is given, fact prints its
argv with usage information.
./fact 3 2
-|
("./fact" "3" "2")
Usage: fact N
Returns the factorial of N.
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If open-input-file has not yet been used, the displayed procedure
is similar to the original definition (lines wrapped for readability):
open-input-file ⇒ #<CLOSURE (str) (or (open-file str open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we open a file using open-input-file, the sections of code
used become memoized:
(open-input-file "r4rstest.scm") ⇒ #<input-port 3> open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we cause open-input-file to execute other sections of code,
they too become memoized:
(open-input-file "foo.scm") ⇒ ERROR: No such file or directory ERROR: OPEN-INPUT-FILE couldn't open file "foo.scm" open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (#@and (#@procedure? #@could-not-open) (could-not-open) #f) (#@error "OPEN-INPUT-FILE couldn't open file " #@0+0))> |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The variable *interactive* determines whether the SCM session is interactive, or should quit after the command line is processed. *interactive* is controlled directly by the command-line options `-b', `-i', and `-s' (see section Invoking SCM). If none of these options are specified, the rules to determine interactivity are more complicated; see `Init5e3.scm' for details.
Resumes the top level Read-Eval-Print loop.
Restarts the SCM program with the same arguments as it was originally invoked. All `-l' loaded files are loaded again; If those files have changed, those changes will be reflected in the new session.
Note When running a saved executable (see section Dump),
restart is redefined to be exec-self.
Exits and immediately re-invokes the same executable with the same
arguments. If the executable file has been changed or replaced since
the beginning of the current session, the new executable will be
invoked. This differentiates exec-self from restart.
Controls how much monitoring information is printed. If n is:
no prompt or information is printed.
a prompt is printed.
messages bracketing file loading are printed.
the CPU time is printed after each top level form evaluated; notifications of heap growth printed; the interpreter checks stack depth periodically.
a garbage collection summary is printed after each top level form evaluated;
a message for each GC (see section Garbage Collection) is printed; warnings issued for top-level symbols redefined.
Scans all of SCM objects and reclaims for further use those that are no longer accessible.
Prints out statistics about SCM's current use of storage. (room #t)
also gives the hexadecimal heap segment and stack bounds.
Contains the version string (e.g. `5e3') of SCM.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to dump a saved executable or to dynamically-link using DLD,
SCM must know where its executable file is. Sometimes SCM
(see section Executable Pathname) guesses incorrectly the location of the
currently running executable. In that case, the correct path can be set
by calling execpath with the pathname.
Returns the path (string) which SCM uses to find the executable file whose invocation the currently running session is, or #f if the path is not set.
Sets the path to #f or newpath, respectively. The old path
is returned.
For other configuration constants and procedures See (slib)Configuration section `Configuration' in SLIB.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 3.13.1 Unix Scheme Scripts | From Olin Shivers' Scheme Shell | |
| 3.13.2 MS-DOS Compatible Scripts | Run in MS-DOS and Unix | |
| 3.13.3 Unix Shell Scripts | Use /bin/sh to run Scheme |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In reading this section, keep in mind that the first line of a script
file has (different) meanings to SCM and the operating system
(execve).
On unix systems, a Shell-Script is a file (with execute
permissions) whose first two characters are `#!'. The
interpreter argument must be the pathname of the program to
process the rest of the file. The directories named by environment
variable PATH are not searched to find interpreter.
When executing a shell-script, the operating system invokes interpreter with a single argument encapsulating the rest of the first line's contents (if not just whitespace), the pathname of the Scheme Script file, and then any arguments which the shell-script was invoked with.
Put one space character between `#!' and the first character of interpreter (`/'). The interpreter name is followed by ` \'; SCM substitutes the second line of file for `\' (and the rest of the line), then appends any arguments given on the command line invoking this Scheme-Script.
When SCM executes the script, the Scheme variable *script* will be set to the script pathname. The last argument before `!#' on the second line should be `-'; SCM will load the script file, preserve the unprocessed arguments, and set *argv* to a list of the script pathname and the unprocessed arguments.
Note that the interpreter, not the operating system, provides the `\' substitution; this will only take place if interpreter is a SCM or SCSH interpreter.
When the first two characters of the file being loaded are #! and
a `\' is present before a newline in the file, all characters up
to `!#' will be ignored by SCM read.
This combination of interpretatons allows SCM source files to be used as POSIX shell-scripts if the first line is:
#! /usr/local/bin/scm \ |
The following Scheme-Script prints factorial of its argument:
#! /usr/local/bin/scm \ %0 %*
- !#
(define (fact.script args)
(cond ((and (= 1 (length args))
(string->number (car args)))
=> (lambda (n) (print (fact n)) #t))
(else (fact.usage))))
(define (fact.usage)
(print *argv*)
(display "\
Usage: fact N
Returns the factorial of N.
"
(current-error-port))
#f)
(define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n)))))
(if *script* (exit (fact.script (list-tail *argv* *optind*))))
|
./fact 32 ⇒ 263130836933693530167218012160000000 |
If the wrong number of arguments is given, fact prints its
argv with usage information.
./fact 3 2
-|
("./fact" "3" "2")
Usage: fact N
Returns the factorial of N.
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If open-input-file has not yet been used, the displayed procedure
is similar to the original definition (lines wrapped for readability):
open-input-file ⇒ #<CLOSURE (str) (or (open-file str open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we open a file using open-input-file, the sections of code
used become memoized:
(open-input-file "r4rstest.scm") ⇒ #<input-port 3> open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we cause open-input-file to execute other sections of code,
they too become memoized:
(open-input-file "foo.scm") ⇒ ERROR: No such file or directory ERROR: OPEN-INPUT-FILE couldn't open file "foo.scm" open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (#@and (#@procedure? #@could-not-open) (could-not-open) #f) (#@error "OPEN-INPUT-FILE couldn't open file " #@0+0))> |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The variable *interactive* determines whether the SCM session is interactive, or should quit after the command line is processed. *interactive* is controlled directly by the command-line options `-b', `-i', and `-s' (see section Invoking SCM). If none of these options are specified, the rules to determine interactivity are more complicated; see `Init5e3.scm' for details.
Resumes the top level Read-Eval-Print loop.
Restarts the SCM program with the same arguments as it was originally invoked. All `-l' loaded files are loaded again; If those files have changed, those changes will be reflected in the new session.
Note When running a saved executable (see section Dump),
restart is redefined to be exec-self.
Exits and immediately re-invokes the same executable with the same
arguments. If the executable file has been changed or replaced since
the beginning of the current session, the new executable will be
invoked. This differentiates exec-self from restart.
Controls how much monitoring information is printed. If n is:
no prompt or information is printed.
a prompt is printed.
messages bracketing file loading are printed.
the CPU time is printed after each top level form evaluated; notifications of heap growth printed; the interpreter checks stack depth periodically.
a garbage collection summary is printed after each top level form evaluated;
a message for each GC (see section Garbage Collection) is printed; warnings issued for top-level symbols redefined.
Scans all of SCM objects and reclaims for further use those that are no longer accessible.
Prints out statistics about SCM's current use of storage. (room #t)
also gives the hexadecimal heap segment and stack bounds.
Contains the version string (e.g. `5e3') of SCM.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to dump a saved executable or to dynamically-link using DLD,
SCM must know where its executable file is. Sometimes SCM
(see section Executable Pathname) guesses incorrectly the location of the
currently running executable. In that case, the correct path can be set
by calling execpath with the pathname.
Returns the path (string) which SCM uses to find the executable file whose invocation the currently running session is, or #f if the path is not set.
Sets the path to #f or newpath, respectively. The old path
is returned.
For other configuration constants and procedures See (slib)Configuration section `Configuration' in SLIB.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 3.13.1 Unix Scheme Scripts | From Olin Shivers' Scheme Shell | |
| 3.13.2 MS-DOS Compatible Scripts | Run in MS-DOS and Unix | |
| 3.13.3 Unix Shell Scripts | Use /bin/sh to run Scheme |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In reading this section, keep in mind that the first line of a script
file has (different) meanings to SCM and the operating system
(execve).
On unix systems, a Shell-Script is a file (with execute
permissions) whose first two characters are `#!'. The
interpreter argument must be the pathname of the program to
process the rest of the file. The directories named by environment
variable PATH are not searched to find interpreter.
When executing a shell-script, the operating system invokes interpreter with a single argument encapsulating the rest of the first line's contents (if not just whitespace), the pathname of the Scheme Script file, and then any arguments which the shell-script was invoked with.
Put one space character between `#!' and the first character of interpreter (`/'). The interpreter name is followed by ` \'; SCM substitutes the second line of file for `\' (and the rest of the line), then appends any arguments given on the command line invoking this Scheme-Script.
When SCM executes the script, the Scheme variable *script* will be set to the script pathname. The last argument before `!#' on the second line should be `-'; SCM will load the script file, preserve the unprocessed arguments, and set *argv* to a list of the script pathname and the unprocessed arguments.
Note that the interpreter, not the operating system, provides the `\' substitution; this will only take place if interpreter is a SCM or SCSH interpreter.
When the first two characters of the file being loaded are #! and
a `\' is present before a newline in the file, all characters up
to `!#' will be ignored by SCM read.
This combination of interpretatons allows SCM source files to be used as POSIX shell-scripts if the first line is:
#! /usr/local/bin/scm \ |
The following Scheme-Script prints factorial of its argument:
#! /usr/local/bin/scm \ %0 %*
- !#
(define (fact.script args)
(cond ((and (= 1 (length args))
(string->number (car args)))
=> (lambda (n) (print (fact n)) #t))
(else (fact.usage))))
(define (fact.usage)
(print *argv*)
(display "\
Usage: fact N
Returns the factorial of N.
"
(current-error-port))
#f)
(define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n)))))
(if *script* (exit (fact.script (list-tail *argv* *optind*))))
|
./fact 32 ⇒ 263130836933693530167218012160000000 |
If the wrong number of arguments is given, fact prints its
argv with usage information.
./fact 3 2
-|
("./fact" "3" "2")
Usage: fact N
Returns the factorial of N.
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If open-input-file has not yet been used, the displayed procedure
is similar to the original definition (lines wrapped for readability):
open-input-file ⇒ #<CLOSURE (str) (or (open-file str open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we open a file using open-input-file, the sections of code
used become memoized:
(open-input-file "r4rstest.scm") ⇒ #<input-port 3> open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we cause open-input-file to execute other sections of code,
they too become memoized:
(open-input-file "foo.scm") ⇒ ERROR: No such file or directory ERROR: OPEN-INPUT-FILE couldn't open file "foo.scm" open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (#@and (#@procedure? #@could-not-open) (could-not-open) #f) (#@error "OPEN-INPUT-FILE couldn't open file " #@0+0))> |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The variable *interactive* determines whether the SCM session is interactive, or should quit after the command line is processed. *interactive* is controlled directly by the command-line options `-b', `-i', and `-s' (see section Invoking SCM). If none of these options are specified, the rules to determine interactivity are more complicated; see `Init5e3.scm' for details.
Resumes the top level Read-Eval-Print loop.
Restarts the SCM program with the same arguments as it was originally invoked. All `-l' loaded files are loaded again; If those files have changed, those changes will be reflected in the new session.
Note When running a saved executable (see section Dump),
restart is redefined to be exec-self.
Exits and immediately re-invokes the same executable with the same
arguments. If the executable file has been changed or replaced since
the beginning of the current session, the new executable will be
invoked. This differentiates exec-self from restart.
Controls how much monitoring information is printed. If n is:
no prompt or information is printed.
a prompt is printed.
messages bracketing file loading are printed.
the CPU time is printed after each top level form evaluated; notifications of heap growth printed; the interpreter checks stack depth periodically.
a garbage collection summary is printed after each top level form evaluated;
a message for each GC (see section Garbage Collection) is printed; warnings issued for top-level symbols redefined.
Scans all of SCM objects and reclaims for further use those that are no longer accessible.
Prints out statistics about SCM's current use of storage. (room #t)
also gives the hexadecimal heap segment and stack bounds.
Contains the version string (e.g. `5e3') of SCM.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to dump a saved executable or to dynamically-link using DLD,
SCM must know where its executable file is. Sometimes SCM
(see section Executable Pathname) guesses incorrectly the location of the
currently running executable. In that case, the correct path can be set
by calling execpath with the pathname.
Returns the path (string) which SCM uses to find the executable file whose invocation the currently running session is, or #f if the path is not set.
Sets the path to #f or newpath, respectively. The old path
is returned.
For other configuration constants and procedures See (slib)Configuration section `Configuration' in SLIB.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 3.13.1 Unix Scheme Scripts | From Olin Shivers' Scheme Shell | |
| 3.13.2 MS-DOS Compatible Scripts | Run in MS-DOS and Unix | |
| 3.13.3 Unix Shell Scripts | Use /bin/sh to run Scheme |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In reading this section, keep in mind that the first line of a script
file has (different) meanings to SCM and the operating system
(execve).
On unix systems, a Shell-Script is a file (with execute
permissions) whose first two characters are `#!'. The
interpreter argument must be the pathname of the program to
process the rest of the file. The directories named by environment
variable PATH are not searched to find interpreter.
When executing a shell-script, the operating system invokes interpreter with a single argument encapsulating the rest of the first line's contents (if not just whitespace), the pathname of the Scheme Script file, and then any arguments which the shell-script was invoked with.
Put one space character between `#!' and the first character of interpreter (`/'). The interpreter name is followed by ` \'; SCM substitutes the second line of file for `\' (and the rest of the line), then appends any arguments given on the command line invoking this Scheme-Script.
When SCM executes the script, the Scheme variable *script* will be set to the script pathname. The last argument before `!#' on the second line should be `-'; SCM will load the script file, preserve the unprocessed arguments, and set *argv* to a list of the script pathname and the unprocessed arguments.
Note that the interpreter, not the operating system, provides the `\' substitution; this will only take place if interpreter is a SCM or SCSH interpreter.
When the first two characters of the file being loaded are #! and
a `\' is present before a newline in the file, all characters up
to `!#' will be ignored by SCM read.
This combination of interpretatons allows SCM source files to be used as POSIX shell-scripts if the first line is:
#! /usr/local/bin/scm \ |
The following Scheme-Script prints factorial of its argument:
#! /usr/local/bin/scm \ %0 %*
- !#
(define (fact.script args)
(cond ((and (= 1 (length args))
(string->number (car args)))
=> (lambda (n) (print (fact n)) #t))
(else (fact.usage))))
(define (fact.usage)
(print *argv*)
(display "\
Usage: fact N
Returns the factorial of N.
"
(current-error-port))
#f)
(define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n)))))
(if *script* (exit (fact.script (list-tail *argv* *optind*))))
|
./fact 32 ⇒ 263130836933693530167218012160000000 |
If the wrong number of arguments is given, fact prints its
argv with usage information.
./fact 3 2
-|
("./fact" "3" "2")
Usage: fact N
Returns the factorial of N.
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If open-input-file has not yet been used, the displayed procedure
is similar to the original definition (lines wrapped for readability):
open-input-file ⇒ #<CLOSURE (str) (or (open-file str open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we open a file using open-input-file, the sections of code
used become memoized:
(open-input-file "r4rstest.scm") ⇒ #<input-port 3> open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we cause open-input-file to execute other sections of code,
they too become memoized:
(open-input-file "foo.scm") ⇒ ERROR: No such file or directory ERROR: OPEN-INPUT-FILE couldn't open file "foo.scm" open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (#@and (#@procedure? #@could-not-open) (could-not-open) #f) (#@error "OPEN-INPUT-FILE couldn't open file " #@0+0))> |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The variable *interactive* determines whether the SCM session is interactive, or should quit after the command line is processed. *interactive* is controlled directly by the command-line options `-b', `-i', and `-s' (see section Invoking SCM). If none of these options are specified, the rules to determine interactivity are more complicated; see `Init5e3.scm' for details.
Resumes the top level Read-Eval-Print loop.
Restarts the SCM program with the same arguments as it was originally invoked. All `-l' loaded files are loaded again; If those files have changed, those changes will be reflected in the new session.
Note When running a saved executable (see section Dump),
restart is redefined to be exec-self.
Exits and immediately re-invokes the same executable with the same
arguments. If the executable file has been changed or replaced since
the beginning of the current session, the new executable will be
invoked. This differentiates exec-self from restart.
Controls how much monitoring information is printed. If n is:
no prompt or information is printed.
a prompt is printed.
messages bracketing file loading are printed.
the CPU time is printed after each top level form evaluated; notifications of heap growth printed; the interpreter checks stack depth periodically.
a garbage collection summary is printed after each top level form evaluated;
a message for each GC (see section Garbage Collection) is printed; warnings issued for top-level symbols redefined.
Scans all of SCM objects and reclaims for further use those that are no longer accessible.
Prints out statistics about SCM's current use of storage. (room #t)
also gives the hexadecimal heap segment and stack bounds.
Contains the version string (e.g. `5e3') of SCM.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to dump a saved executable or to dynamically-link using DLD,
SCM must know where its executable file is. Sometimes SCM
(see section Executable Pathname) guesses incorrectly the location of the
currently running executable. In that case, the correct path can be set
by calling execpath with the pathname.
Returns the path (string) which SCM uses to find the executable file whose invocation the currently running session is, or #f if the path is not set.
Sets the path to #f or newpath, respectively. The old path
is returned.
For other configuration constants and procedures See (slib)Configuration section `Configuration' in SLIB.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 3.13.1 Unix Scheme Scripts | From Olin Shivers' Scheme Shell | |
| 3.13.2 MS-DOS Compatible Scripts | Run in MS-DOS and Unix | |
| 3.13.3 Unix Shell Scripts | Use /bin/sh to run Scheme |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In reading this section, keep in mind that the first line of a script
file has (different) meanings to SCM and the operating system
(execve).
On unix systems, a Shell-Script is a file (with execute
permissions) whose first two characters are `#!'. The
interpreter argument must be the pathname of the program to
process the rest of the file. The directories named by environment
variable PATH are not searched to find interpreter.
When executing a shell-script, the operating system invokes interpreter with a single argument encapsulating the rest of the first line's contents (if not just whitespace), the pathname of the Scheme Script file, and then any arguments which the shell-script was invoked with.
Put one space character between `#!' and the first character of interpreter (`/'). The interpreter name is followed by ` \'; SCM substitutes the second line of file for `\' (and the rest of the line), then appends any arguments given on the command line invoking this Scheme-Script.
When SCM executes the script, the Scheme variable *script* will be set to the script pathname. The last argument before `!#' on the second line should be `-'; SCM will load the script file, preserve the unprocessed arguments, and set *argv* to a list of the script pathname and the unprocessed arguments.
Note that the interpreter, not the operating system, provides the `\' substitution; this will only take place if interpreter is a SCM or SCSH interpreter.
When the first two characters of the file being loaded are #! and
a `\' is present before a newline in the file, all characters up
to `!#' will be ignored by SCM read.
This combination of interpretatons allows SCM source files to be used as POSIX shell-scripts if the first line is:
#! /usr/local/bin/scm \ |
The following Scheme-Script prints factorial of its argument:
#! /usr/local/bin/scm \ %0 %*
- !#
(define (fact.script args)
(cond ((and (= 1 (length args))
(string->number (car args)))
=> (lambda (n) (print (fact n)) #t))
(else (fact.usage))))
(define (fact.usage)
(print *argv*)
(display "\
Usage: fact N
Returns the factorial of N.
"
(current-error-port))
#f)
(define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n)))))
(if *script* (exit (fact.script (list-tail *argv* *optind*))))
|
./fact 32 ⇒ 263130836933693530167218012160000000 |
If the wrong number of arguments is given, fact prints its
argv with usage information.
./fact 3 2
-|
("./fact" "3" "2")
Usage: fact N
Returns the factorial of N.
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If open-input-file has not yet been used, the displayed procedure
is similar to the original definition (lines wrapped for readability):
open-input-file ⇒ #<CLOSURE (str) (or (open-file str open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we open a file using open-input-file, the sections of code
used become memoized:
(open-input-file "r4rstest.scm") ⇒ #<input-port 3> open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we cause open-input-file to execute other sections of code,
they too become memoized:
(open-input-file "foo.scm") ⇒ ERROR: No such file or directory ERROR: OPEN-INPUT-FILE couldn't open file "foo.scm" open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (#@and (#@procedure? #@could-not-open) (could-not-open) #f) (#@error "OPEN-INPUT-FILE couldn't open file " #@0+0))> |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The variable *interactive* determines whether the SCM session is interactive, or should quit after the command line is processed. *interactive* is controlled directly by the command-line options `-b', `-i', and `-s' (see section Invoking SCM). If none of these options are specified, the rules to determine interactivity are more complicated; see `Init5e3.scm' for details.
Resumes the top level Read-Eval-Print loop.
Restarts the SCM program with the same arguments as it was originally invoked. All `-l' loaded files are loaded again; If those files have changed, those changes will be reflected in the new session.
Note When running a saved executable (see section Dump),
restart is redefined to be exec-self.
Exits and immediately re-invokes the same executable with the same
arguments. If the executable file has been changed or replaced since
the beginning of the current session, the new executable will be
invoked. This differentiates exec-self from restart.
Controls how much monitoring information is printed. If n is:
no prompt or information is printed.
a prompt is printed.
messages bracketing file loading are printed.
the CPU time is printed after each top level form evaluated; notifications of heap growth printed; the interpreter checks stack depth periodically.
a garbage collection summary is printed after each top level form evaluated;
a message for each GC (see section Garbage Collection) is printed; warnings issued for top-level symbols redefined.
Scans all of SCM objects and reclaims for further use those that are no longer accessible.
Prints out statistics about SCM's current use of storage. (room #t)
also gives the hexadecimal heap segment and stack bounds.
Contains the version string (e.g. `5e3') of SCM.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to dump a saved executable or to dynamically-link using DLD,
SCM must know where its executable file is. Sometimes SCM
(see section Executable Pathname) guesses incorrectly the location of the
currently running executable. In that case, the correct path can be set
by calling execpath with the pathname.
Returns the path (string) which SCM uses to find the executable file whose invocation the currently running session is, or #f if the path is not set.
Sets the path to #f or newpath, respectively. The old path
is returned.
For other configuration constants and procedures See (slib)Configuration section `Configuration' in SLIB.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 3.13.1 Unix Scheme Scripts | From Olin Shivers' Scheme Shell | |
| 3.13.2 MS-DOS Compatible Scripts | Run in MS-DOS and Unix | |
| 3.13.3 Unix Shell Scripts | Use /bin/sh to run Scheme |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In reading this section, keep in mind that the first line of a script
file has (different) meanings to SCM and the operating system
(execve).
On unix systems, a Shell-Script is a file (with execute
permissions) whose first two characters are `#!'. The
interpreter argument must be the pathname of the program to
process the rest of the file. The directories named by environment
variable PATH are not searched to find interpreter.
When executing a shell-script, the operating system invokes interpreter with a single argument encapsulating the rest of the first line's contents (if not just whitespace), the pathname of the Scheme Script file, and then any arguments which the shell-script was invoked with.
Put one space character between `#!' and the first character of interpreter (`/'). The interpreter name is followed by ` \'; SCM substitutes the second line of file for `\' (and the rest of the line), then appends any arguments given on the command line invoking this Scheme-Script.
When SCM executes the script, the Scheme variable *script* will be set to the script pathname. The last argument before `!#' on the second line should be `-'; SCM will load the script file, preserve the unprocessed arguments, and set *argv* to a list of the script pathname and the unprocessed arguments.
Note that the interpreter, not the operating system, provides the `\' substitution; this will only take place if interpreter is a SCM or SCSH interpreter.
When the first two characters of the file being loaded are #! and
a `\' is present before a newline in the file, all characters up
to `!#' will be ignored by SCM read.
This combination of interpretatons allows SCM source files to be used as POSIX shell-scripts if the first line is:
#! /usr/local/bin/scm \ |
The following Scheme-Script prints factorial of its argument:
#! /usr/local/bin/scm \ %0 %*
- !#
(define (fact.script args)
(cond ((and (= 1 (length args))
(string->number (car args)))
=> (lambda (n) (print (fact n)) #t))
(else (fact.usage))))
(define (fact.usage)
(print *argv*)
(display "\
Usage: fact N
Returns the factorial of N.
"
(current-error-port))
#f)
(define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n)))))
(if *script* (exit (fact.script (list-tail *argv* *optind*))))
|
./fact 32 ⇒ 263130836933693530167218012160000000 |
If the wrong number of arguments is given, fact prints its
argv with usage information.
./fact 3 2
-|
("./fact" "3" "2")
Usage: fact N
Returns the factorial of N.
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If open-input-file has not yet been used, the displayed procedure
is similar to the original definition (lines wrapped for readability):
open-input-file ⇒ #<CLOSURE (str) (or (open-file str open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we open a file using open-input-file, the sections of code
used become memoized:
(open-input-file "r4rstest.scm") ⇒ #<input-port 3> open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we cause open-input-file to execute other sections of code,
they too become memoized:
(open-input-file "foo.scm") ⇒ ERROR: No such file or directory ERROR: OPEN-INPUT-FILE couldn't open file "foo.scm" open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (#@and (#@procedure? #@could-not-open) (could-not-open) #f) (#@error "OPEN-INPUT-FILE couldn't open file " #@0+0))> |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The variable *interactive* determines whether the SCM session is interactive, or should quit after the command line is processed. *interactive* is controlled directly by the command-line options `-b', `-i', and `-s' (see section Invoking SCM). If none of these options are specified, the rules to determine interactivity are more complicated; see `Init5e3.scm' for details.
Resumes the top level Read-Eval-Print loop.
Restarts the SCM program with the same arguments as it was originally invoked. All `-l' loaded files are loaded again; If those files have changed, those changes will be reflected in the new session.
Note When running a saved executable (see section Dump),
restart is redefined to be exec-self.
Exits and immediately re-invokes the same executable with the same
arguments. If the executable file has been changed or replaced since
the beginning of the current session, the new executable will be
invoked. This differentiates exec-self from restart.
Controls how much monitoring information is printed. If n is:
no prompt or information is printed.
a prompt is printed.
messages bracketing file loading are printed.
the CPU time is printed after each top level form evaluated; notifications of heap growth printed; the interpreter checks stack depth periodically.
a garbage collection summary is printed after each top level form evaluated;
a message for each GC (see section Garbage Collection) is printed; warnings issued for top-level symbols redefined.
Scans all of SCM objects and reclaims for further use those that are no longer accessible.
Prints out statistics about SCM's current use of storage. (room #t)
also gives the hexadecimal heap segment and stack bounds.
Contains the version string (e.g. `5e3') of SCM.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to dump a saved executable or to dynamically-link using DLD,
SCM must know where its executable file is. Sometimes SCM
(see section Executable Pathname) guesses incorrectly the location of the
currently running executable. In that case, the correct path can be set
by calling execpath with the pathname.
Returns the path (string) which SCM uses to find the executable file whose invocation the currently running session is, or #f if the path is not set.
Sets the path to #f or newpath, respectively. The old path
is returned.
For other configuration constants and procedures See (slib)Configuration section `Configuration' in SLIB.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 3.13.1 Unix Scheme Scripts | From Olin Shivers' Scheme Shell | |
| 3.13.2 MS-DOS Compatible Scripts | Run in MS-DOS and Unix | |
| 3.13.3 Unix Shell Scripts | Use /bin/sh to run Scheme |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In reading this section, keep in mind that the first line of a script
file has (different) meanings to SCM and the operating system
(execve).
On unix systems, a Shell-Script is a file (with execute
permissions) whose first two characters are `#!'. The
interpreter argument must be the pathname of the program to
process the rest of the file. The directories named by environment
variable PATH are not searched to find interpreter.
When executing a shell-script, the operating system invokes interpreter with a single argument encapsulating the rest of the first line's contents (if not just whitespace), the pathname of the Scheme Script file, and then any arguments which the shell-script was invoked with.
Put one space character between `#!' and the first character of interpreter (`/'). The interpreter name is followed by ` \'; SCM substitutes the second line of file for `\' (and the rest of the line), then appends any arguments given on the command line invoking this Scheme-Script.
When SCM executes the script, the Scheme variable *script* will be set to the script pathname. The last argument before `!#' on the second line should be `-'; SCM will load the script file, preserve the unprocessed arguments, and set *argv* to a list of the script pathname and the unprocessed arguments.
Note that the interpreter, not the operating system, provides the `\' substitution; this will only take place if interpreter is a SCM or SCSH interpreter.
When the first two characters of the file being loaded are #! and
a `\' is present before a newline in the file, all characters up
to `!#' will be ignored by SCM read.
This combination of interpretatons allows SCM source files to be used as POSIX shell-scripts if the first line is:
#! /usr/local/bin/scm \ |
The following Scheme-Script prints factorial of its argument:
#! /usr/local/bin/scm \ %0 %*
- !#
(define (fact.script args)
(cond ((and (= 1 (length args))
(string->number (car args)))
=> (lambda (n) (print (fact n)) #t))
(else (fact.usage))))
(define (fact.usage)
(print *argv*)
(display "\
Usage: fact N
Returns the factorial of N.
"
(current-error-port))
#f)
(define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n)))))
(if *script* (exit (fact.script (list-tail *argv* *optind*))))
|
./fact 32 ⇒ 263130836933693530167218012160000000 |
If the wrong number of arguments is given, fact prints its
argv with usage information.
./fact 3 2
-|
("./fact" "3" "2")
Usage: fact N
Returns the factorial of N.
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If open-input-file has not yet been used, the displayed procedure
is similar to the original definition (lines wrapped for readability):
open-input-file ⇒ #<CLOSURE (str) (or (open-file str open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we open a file using open-input-file, the sections of code
used become memoized:
(open-input-file "r4rstest.scm") ⇒ #<input-port 3> open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we cause open-input-file to execute other sections of code,
they too become memoized:
(open-input-file "foo.scm") ⇒ ERROR: No such file or directory ERROR: OPEN-INPUT-FILE couldn't open file "foo.scm" open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (#@and (#@procedure? #@could-not-open) (could-not-open) #f) (#@error "OPEN-INPUT-FILE couldn't open file " #@0+0))> |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The variable *interactive* determines whether the SCM session is interactive, or should quit after the command line is processed. *interactive* is controlled directly by the command-line options `-b', `-i', and `-s' (see section Invoking SCM). If none of these options are specified, the rules to determine interactivity are more complicated; see `Init5e3.scm' for details.
Resumes the top level Read-Eval-Print loop.
Restarts the SCM program with the same arguments as it was originally invoked. All `-l' loaded files are loaded again; If those files have changed, those changes will be reflected in the new session.
Note When running a saved executable (see section Dump),
restart is redefined to be exec-self.
Exits and immediately re-invokes the same executable with the same
arguments. If the executable file has been changed or replaced since
the beginning of the current session, the new executable will be
invoked. This differentiates exec-self from restart.
Controls how much monitoring information is printed. If n is:
no prompt or information is printed.
a prompt is printed.
messages bracketing file loading are printed.
the CPU time is printed after each top level form evaluated; notifications of heap growth printed; the interpreter checks stack depth periodically.
a garbage collection summary is printed after each top level form evaluated;
a message for each GC (see section Garbage Collection) is printed; warnings issued for top-level symbols redefined.
Scans all of SCM objects and reclaims for further use those that are no longer accessible.
Prints out statistics about SCM's current use of storage. (room #t)
also gives the hexadecimal heap segment and stack bounds.
Contains the version string (e.g. `5e3') of SCM.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to dump a saved executable or to dynamically-link using DLD,
SCM must know where its executable file is. Sometimes SCM
(see section Executable Pathname) guesses incorrectly the location of the
currently running executable. In that case, the correct path can be set
by calling execpath with the pathname.
Returns the path (string) which SCM uses to find the executable file whose invocation the currently running session is, or #f if the path is not set.
Sets the path to #f or newpath, respectively. The old path
is returned.
For other configuration constants and procedures See (slib)Configuration section `Configuration' in SLIB.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 3.13.1 Unix Scheme Scripts | From Olin Shivers' Scheme Shell | |
| 3.13.2 MS-DOS Compatible Scripts | Run in MS-DOS and Unix | |
| 3.13.3 Unix Shell Scripts | Use /bin/sh to run Scheme |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In reading this section, keep in mind that the first line of a script
file has (different) meanings to SCM and the operating system
(execve).
On unix systems, a Shell-Script is a file (with execute
permissions) whose first two characters are `#!'. The
interpreter argument must be the pathname of the program to
process the rest of the file. The directories named by environment
variable PATH are not searched to find interpreter.
When executing a shell-script, the operating system invokes interpreter with a single argument encapsulating the rest of the first line's contents (if not just whitespace), the pathname of the Scheme Script file, and then any arguments which the shell-script was invoked with.
Put one space character between `#!' and the first character of interpreter (`/'). The interpreter name is followed by ` \'; SCM substitutes the second line of file for `\' (and the rest of the line), then appends any arguments given on the command line invoking this Scheme-Script.
When SCM executes the script, the Scheme variable *script* will be set to the script pathname. The last argument before `!#' on the second line should be `-'; SCM will load the script file, preserve the unprocessed arguments, and set *argv* to a list of the script pathname and the unprocessed arguments.
Note that the interpreter, not the operating system, provides the `\' substitution; this will only take place if interpreter is a SCM or SCSH interpreter.
When the first two characters of the file being loaded are #! and
a `\' is present before a newline in the file, all characters up
to `!#' will be ignored by SCM read.
This combination of interpretatons allows SCM source files to be used as POSIX shell-scripts if the first line is:
#! /usr/local/bin/scm \ |
The following Scheme-Script prints factorial of its argument:
#! /usr/local/bin/scm \ %0 %*
- !#
(define (fact.script args)
(cond ((and (= 1 (length args))
(string->number (car args)))
=> (lambda (n) (print (fact n)) #t))
(else (fact.usage))))
(define (fact.usage)
(print *argv*)
(display "\
Usage: fact N
Returns the factorial of N.
"
(current-error-port))
#f)
(define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n)))))
(if *script* (exit (fact.script (list-tail *argv* *optind*))))
|
./fact 32 ⇒ 263130836933693530167218012160000000 |
If the wrong number of arguments is given, fact prints its
argv with usage information.
./fact 3 2
-|
("./fact" "3" "2")
Usage: fact N
Returns the factorial of N.
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If open-input-file has not yet been used, the displayed procedure
is similar to the original definition (lines wrapped for readability):
open-input-file ⇒ #<CLOSURE (str) (or (open-file str open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we open a file using open-input-file, the sections of code
used become memoized:
(open-input-file "r4rstest.scm") ⇒ #<input-port 3> open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we cause open-input-file to execute other sections of code,
they too become memoized:
(open-input-file "foo.scm") ⇒ ERROR: No such file or directory ERROR: OPEN-INPUT-FILE couldn't open file "foo.scm" open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (#@and (#@procedure? #@could-not-open) (could-not-open) #f) (#@error "OPEN-INPUT-FILE couldn't open file " #@0+0))> |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The variable *interactive* determines whether the SCM session is interactive, or should quit after the command line is processed. *interactive* is controlled directly by the command-line options `-b', `-i', and `-s' (see section Invoking SCM). If none of these options are specified, the rules to determine interactivity are more complicated; see `Init5e3.scm' for details.
Resumes the top level Read-Eval-Print loop.
Restarts the SCM program with the same arguments as it was originally invoked. All `-l' loaded files are loaded again; If those files have changed, those changes will be reflected in the new session.
Note When running a saved executable (see section Dump),
restart is redefined to be exec-self.
Exits and immediately re-invokes the same executable with the same
arguments. If the executable file has been changed or replaced since
the beginning of the current session, the new executable will be
invoked. This differentiates exec-self from restart.
Controls how much monitoring information is printed. If n is:
no prompt or information is printed.
a prompt is printed.
messages bracketing file loading are printed.
the CPU time is printed after each top level form evaluated; notifications of heap growth printed; the interpreter checks stack depth periodically.
a garbage collection summary is printed after each top level form evaluated;
a message for each GC (see section Garbage Collection) is printed; warnings issued for top-level symbols redefined.
Scans all of SCM objects and reclaims for further use those that are no longer accessible.
Prints out statistics about SCM's current use of storage. (room #t)
also gives the hexadecimal heap segment and stack bounds.
Contains the version string (e.g. `5e3') of SCM.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to dump a saved executable or to dynamically-link using DLD,
SCM must know where its executable file is. Sometimes SCM
(see section Executable Pathname) guesses incorrectly the location of the
currently running executable. In that case, the correct path can be set
by calling execpath with the pathname.
Returns the path (string) which SCM uses to find the executable file whose invocation the currently running session is, or #f if the path is not set.
Sets the path to #f or newpath, respectively. The old path
is returned.
For other configuration constants and procedures See (slib)Configuration section `Configuration' in SLIB.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 3.13.1 Unix Scheme Scripts | From Olin Shivers' Scheme Shell | |
| 3.13.2 MS-DOS Compatible Scripts | Run in MS-DOS and Unix | |
| 3.13.3 Unix Shell Scripts | Use /bin/sh to run Scheme |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In reading this section, keep in mind that the first line of a script
file has (different) meanings to SCM and the operating system
(execve).
On unix systems, a Shell-Script is a file (with execute
permissions) whose first two characters are `#!'. The
interpreter argument must be the pathname of the program to
process the rest of the file. The directories named by environment
variable PATH are not searched to find interpreter.
When executing a shell-script, the operating system invokes interpreter with a single argument encapsulating the rest of the first line's contents (if not just whitespace), the pathname of the Scheme Script file, and then any arguments which the shell-script was invoked with.
Put one space character between `#!' and the first character of interpreter (`/'). The interpreter name is followed by ` \'; SCM substitutes the second line of file for `\' (and the rest of the line), then appends any arguments given on the command line invoking this Scheme-Script.
When SCM executes the script, the Scheme variable *script* will be set to the script pathname. The last argument before `!#' on the second line should be `-'; SCM will load the script file, preserve the unprocessed arguments, and set *argv* to a list of the script pathname and the unprocessed arguments.
Note that the interpreter, not the operating system, provides the `\' substitution; this will only take place if interpreter is a SCM or SCSH interpreter.
When the first two characters of the file being loaded are #! and
a `\' is present before a newline in the file, all characters up
to `!#' will be ignored by SCM read.
This combination of interpretatons allows SCM source files to be used as POSIX shell-scripts if the first line is:
#! /usr/local/bin/scm \ |
The following Scheme-Script prints factorial of its argument:
#! /usr/local/bin/scm \ %0 %*
- !#
(define (fact.script args)
(cond ((and (= 1 (length args))
(string->number (car args)))
=> (lambda (n) (print (fact n)) #t))
(else (fact.usage))))
(define (fact.usage)
(print *argv*)
(display "\
Usage: fact N
Returns the factorial of N.
"
(current-error-port))
#f)
(define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n)))))
(if *script* (exit (fact.script (list-tail *argv* *optind*))))
|
./fact 32 ⇒ 263130836933693530167218012160000000 |
If the wrong number of arguments is given, fact prints its
argv with usage information.
./fact 3 2
-|
("./fact" "3" "2")
Usage: fact N
Returns the factorial of N.
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If open-input-file has not yet been used, the displayed procedure
is similar to the original definition (lines wrapped for readability):
open-input-file ⇒ #<CLOSURE (str) (or (open-file str open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we open a file using open-input-file, the sections of code
used become memoized:
(open-input-file "r4rstest.scm") ⇒ #<input-port 3> open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we cause open-input-file to execute other sections of code,
they too become memoized:
(open-input-file "foo.scm") ⇒ ERROR: No such file or directory ERROR: OPEN-INPUT-FILE couldn't open file "foo.scm" open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (#@and (#@procedure? #@could-not-open) (could-not-open) #f) (#@error "OPEN-INPUT-FILE couldn't open file " #@0+0))> |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The variable *interactive* determines whether the SCM session is interactive, or should quit after the command line is processed. *interactive* is controlled directly by the command-line options `-b', `-i', and `-s' (see section Invoking SCM). If none of these options are specified, the rules to determine interactivity are more complicated; see `Init5e3.scm' for details.
Resumes the top level Read-Eval-Print loop.
Restarts the SCM program with the same arguments as it was originally invoked. All `-l' loaded files are loaded again; If those files have changed, those changes will be reflected in the new session.
Note When running a saved executable (see section Dump),
restart is redefined to be exec-self.
Exits and immediately re-invokes the same executable with the same
arguments. If the executable file has been changed or replaced since
the beginning of the current session, the new executable will be
invoked. This differentiates exec-self from restart.
Controls how much monitoring information is printed. If n is:
no prompt or information is printed.
a prompt is printed.
messages bracketing file loading are printed.
the CPU time is printed after each top level form evaluated; notifications of heap growth printed; the interpreter checks stack depth periodically.
a garbage collection summary is printed after each top level form evaluated;
a message for each GC (see section Garbage Collection) is printed; warnings issued for top-level symbols redefined.
Scans all of SCM objects and reclaims for further use those that are no longer accessible.
Prints out statistics about SCM's current use of storage. (room #t)
also gives the hexadecimal heap segment and stack bounds.
Contains the version string (e.g. `5e3') of SCM.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to dump a saved executable or to dynamically-link using DLD,
SCM must know where its executable file is. Sometimes SCM
(see section Executable Pathname) guesses incorrectly the location of the
currently running executable. In that case, the correct path can be set
by calling execpath with the pathname.
Returns the path (string) which SCM uses to find the executable file whose invocation the currently running session is, or #f if the path is not set.
Sets the path to #f or newpath, respectively. The old path
is returned.
For other configuration constants and procedures See (slib)Configuration section `Configuration' in SLIB.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 3.13.1 Unix Scheme Scripts | From Olin Shivers' Scheme Shell | |
| 3.13.2 MS-DOS Compatible Scripts | Run in MS-DOS and Unix | |
| 3.13.3 Unix Shell Scripts | Use /bin/sh to run Scheme |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In reading this section, keep in mind that the first line of a script
file has (different) meanings to SCM and the operating system
(execve).
On unix systems, a Shell-Script is a file (with execute
permissions) whose first two characters are `#!'. The
interpreter argument must be the pathname of the program to
process the rest of the file. The directories named by environment
variable PATH are not searched to find interpreter.
When executing a shell-script, the operating system invokes interpreter with a single argument encapsulating the rest of the first line's contents (if not just whitespace), the pathname of the Scheme Script file, and then any arguments which the shell-script was invoked with.
Put one space character between `#!' and the first character of interpreter (`/'). The interpreter name is followed by ` \'; SCM substitutes the second line of file for `\' (and the rest of the line), then appends any arguments given on the command line invoking this Scheme-Script.
When SCM executes the script, the Scheme variable *script* will be set to the script pathname. The last argument before `!#' on the second line should be `-'; SCM will load the script file, preserve the unprocessed arguments, and set *argv* to a list of the script pathname and the unprocessed arguments.
Note that the interpreter, not the operating system, provides the `\' substitution; this will only take place if interpreter is a SCM or SCSH interpreter.
When the first two characters of the file being loaded are #! and
a `\' is present before a newline in the file, all characters up
to `!#' will be ignored by SCM read.
This combination of interpretatons allows SCM source files to be used as POSIX shell-scripts if the first line is:
#! /usr/local/bin/scm \ |
The following Scheme-Script prints factorial of its argument:
#! /usr/local/bin/scm \ %0 %*
- !#
(define (fact.script args)
(cond ((and (= 1 (length args))
(string->number (car args)))
=> (lambda (n) (print (fact n)) #t))
(else (fact.usage))))
(define (fact.usage)
(print *argv*)
(display "\
Usage: fact N
Returns the factorial of N.
"
(current-error-port))
#f)
(define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n)))))
(if *script* (exit (fact.script (list-tail *argv* *optind*))))
|
./fact 32 ⇒ 263130836933693530167218012160000000 |
If the wrong number of arguments is given, fact prints its
argv with usage information.
./fact 3 2
-|
("./fact" "3" "2")
Usage: fact N
Returns the factorial of N.
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If open-input-file has not yet been used, the displayed procedure
is similar to the original definition (lines wrapped for readability):
open-input-file ⇒ #<CLOSURE (str) (or (open-file str open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we open a file using open-input-file, the sections of code
used become memoized:
(open-input-file "r4rstest.scm") ⇒ #<input-port 3> open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we cause open-input-file to execute other sections of code,
they too become memoized:
(open-input-file "foo.scm") ⇒ ERROR: No such file or directory ERROR: OPEN-INPUT-FILE couldn't open file "foo.scm" open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (#@and (#@procedure? #@could-not-open) (could-not-open) #f) (#@error "OPEN-INPUT-FILE couldn't open file " #@0+0))> |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The variable *interactive* determines whether the SCM session is interactive, or should quit after the command line is processed. *interactive* is controlled directly by the command-line options `-b', `-i', and `-s' (see section Invoking SCM). If none of these options are specified, the rules to determine interactivity are more complicated; see `Init5e3.scm' for details.
Resumes the top level Read-Eval-Print loop.
Restarts the SCM program with the same arguments as it was originally invoked. All `-l' loaded files are loaded again; If those files have changed, those changes will be reflected in the new session.
Note When running a saved executable (see section Dump),
restart is redefined to be exec-self.
Exits and immediately re-invokes the same executable with the same
arguments. If the executable file has been changed or replaced since
the beginning of the current session, the new executable will be
invoked. This differentiates exec-self from restart.
Controls how much monitoring information is printed. If n is:
no prompt or information is printed.
a prompt is printed.
messages bracketing file loading are printed.
the CPU time is printed after each top level form evaluated; notifications of heap growth printed; the interpreter checks stack depth periodically.
a garbage collection summary is printed after each top level form evaluated;
a message for each GC (see section Garbage Collection) is printed; warnings issued for top-level symbols redefined.
Scans all of SCM objects and reclaims for further use those that are no longer accessible.
Prints out statistics about SCM's current use of storage. (room #t)
also gives the hexadecimal heap segment and stack bounds.
Contains the version string (e.g. `5e3') of SCM.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to dump a saved executable or to dynamically-link using DLD,
SCM must know where its executable file is. Sometimes SCM
(see section Executable Pathname) guesses incorrectly the location of the
currently running executable. In that case, the correct path can be set
by calling execpath with the pathname.
Returns the path (string) which SCM uses to find the executable file whose invocation the currently running session is, or #f if the path is not set.
Sets the path to #f or newpath, respectively. The old path
is returned.
For other configuration constants and procedures See (slib)Configuration section `Configuration' in SLIB.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 3.13.1 Unix Scheme Scripts | From Olin Shivers' Scheme Shell | |
| 3.13.2 MS-DOS Compatible Scripts | Run in MS-DOS and Unix | |
| 3.13.3 Unix Shell Scripts | Use /bin/sh to run Scheme |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In reading this section, keep in mind that the first line of a script
file has (different) meanings to SCM and the operating system
(execve).
On unix systems, a Shell-Script is a file (with execute
permissions) whose first two characters are `#!'. The
interpreter argument must be the pathname of the program to
process the rest of the file. The directories named by environment
variable PATH are not searched to find interpreter.
When executing a shell-script, the operating system invokes interpreter with a single argument encapsulating the rest of the first line's contents (if not just whitespace), the pathname of the Scheme Script file, and then any arguments which the shell-script was invoked with.
Put one space character between `#!' and the first character of interpreter (`/'). The interpreter name is followed by ` \'; SCM substitutes the second line of file for `\' (and the rest of the line), then appends any arguments given on the command line invoking this Scheme-Script.
When SCM executes the script, the Scheme variable *script* will be set to the script pathname. The last argument before `!#' on the second line should be `-'; SCM will load the script file, preserve the unprocessed arguments, and set *argv* to a list of the script pathname and the unprocessed arguments.
Note that the interpreter, not the operating system, provides the `\' substitution; this will only take place if interpreter is a SCM or SCSH interpreter.
When the first two characters of the file being loaded are #! and
a `\' is present before a newline in the file, all characters up
to `!#' will be ignored by SCM read.
This combination of interpretatons allows SCM source files to be used as POSIX shell-scripts if the first line is:
#! /usr/local/bin/scm \ |
The following Scheme-Script prints factorial of its argument:
#! /usr/local/bin/scm \ %0 %*
- !#
(define (fact.script args)
(cond ((and (= 1 (length args))
(string->number (car args)))
=> (lambda (n) (print (fact n)) #t))
(else (fact.usage))))
(define (fact.usage)
(print *argv*)
(display "\
Usage: fact N
Returns the factorial of N.
"
(current-error-port))
#f)
(define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n)))))
(if *script* (exit (fact.script (list-tail *argv* *optind*))))
|
./fact 32 ⇒ 263130836933693530167218012160000000 |
If the wrong number of arguments is given, fact prints its
argv with usage information.
./fact 3 2
-|
("./fact" "3" "2")
Usage: fact N
Returns the factorial of N.
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If open-input-file has not yet been used, the displayed procedure
is similar to the original definition (lines wrapped for readability):
open-input-file ⇒ #<CLOSURE (str) (or (open-file str open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we open a file using open-input-file, the sections of code
used become memoized:
(open-input-file "r4rstest.scm") ⇒ #<input-port 3> open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we cause open-input-file to execute other sections of code,
they too become memoized:
(open-input-file "foo.scm") ⇒ ERROR: No such file or directory ERROR: OPEN-INPUT-FILE couldn't open file "foo.scm" open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (#@and (#@procedure? #@could-not-open) (could-not-open) #f) (#@error "OPEN-INPUT-FILE couldn't open file " #@0+0))> |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The variable *interactive* determines whether the SCM session is interactive, or should quit after the command line is processed. *interactive* is controlled directly by the command-line options `-b', `-i', and `-s' (see section Invoking SCM). If none of these options are specified, the rules to determine interactivity are more complicated; see `Init5e3.scm' for details.
Resumes the top level Read-Eval-Print loop.
Restarts the SCM program with the same arguments as it was originally invoked. All `-l' loaded files are loaded again; If those files have changed, those changes will be reflected in the new session.
Note When running a saved executable (see section Dump),
restart is redefined to be exec-self.
Exits and immediately re-invokes the same executable with the same
arguments. If the executable file has been changed or replaced since
the beginning of the current session, the new executable will be
invoked. This differentiates exec-self from restart.
Controls how much monitoring information is printed. If n is:
no prompt or information is printed.
a prompt is printed.
messages bracketing file loading are printed.
the CPU time is printed after each top level form evaluated; notifications of heap growth printed; the interpreter checks stack depth periodically.
a garbage collection summary is printed after each top level form evaluated;
a message for each GC (see section Garbage Collection) is printed; warnings issued for top-level symbols redefined.
Scans all of SCM objects and reclaims for further use those that are no longer accessible.
Prints out statistics about SCM's current use of storage. (room #t)
also gives the hexadecimal heap segment and stack bounds.
Contains the version string (e.g. `5e3') of SCM.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to dump a saved executable or to dynamically-link using DLD,
SCM must know where its executable file is. Sometimes SCM
(see section Executable Pathname) guesses incorrectly the location of the
currently running executable. In that case, the correct path can be set
by calling execpath with the pathname.
Returns the path (string) which SCM uses to find the executable file whose invocation the currently running session is, or #f if the path is not set.
Sets the path to #f or newpath, respectively. The old path
is returned.
For other configuration constants and procedures See (slib)Configuration section `Configuration' in SLIB.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 3.13.1 Unix Scheme Scripts | From Olin Shivers' Scheme Shell | |
| 3.13.2 MS-DOS Compatible Scripts | Run in MS-DOS and Unix | |
| 3.13.3 Unix Shell Scripts | Use /bin/sh to run Scheme |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In reading this section, keep in mind that the first line of a script
file has (different) meanings to SCM and the operating system
(execve).
On unix systems, a Shell-Script is a file (with execute
permissions) whose first two characters are `#!'. The
interpreter argument must be the pathname of the program to
process the rest of the file. The directories named by environment
variable PATH are not searched to find interpreter.
When executing a shell-script, the operating system invokes interpreter with a single argument encapsulating the rest of the first line's contents (if not just whitespace), the pathname of the Scheme Script file, and then any arguments which the shell-script was invoked with.
Put one space character between `#!' and the first character of interpreter (`/'). The interpreter name is followed by ` \'; SCM substitutes the second line of file for `\' (and the rest of the line), then appends any arguments given on the command line invoking this Scheme-Script.
When SCM executes the script, the Scheme variable *script* will be set to the script pathname. The last argument before `!#' on the second line should be `-'; SCM will load the script file, preserve the unprocessed arguments, and set *argv* to a list of the script pathname and the unprocessed arguments.
Note that the interpreter, not the operating system, provides the `\' substitution; this will only take place if interpreter is a SCM or SCSH interpreter.
When the first two characters of the file being loaded are #! and
a `\' is present before a newline in the file, all characters up
to `!#' will be ignored by SCM read.
This combination of interpretatons allows SCM source files to be used as POSIX shell-scripts if the first line is:
#! /usr/local/bin/scm \ |
The following Scheme-Script prints factorial of its argument:
#! /usr/local/bin/scm \ %0 %*
- !#
(define (fact.script args)
(cond ((and (= 1 (length args))
(string->number (car args)))
=> (lambda (n) (print (fact n)) #t))
(else (fact.usage))))
(define (fact.usage)
(print *argv*)
(display "\
Usage: fact N
Returns the factorial of N.
"
(current-error-port))
#f)
(define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n)))))
(if *script* (exit (fact.script (list-tail *argv* *optind*))))
|
./fact 32 ⇒ 263130836933693530167218012160000000 |
If the wrong number of arguments is given, fact prints its
argv with usage information.
./fact 3 2
-|
("./fact" "3" "2")
Usage: fact N
Returns the factorial of N.
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If open-input-file has not yet been used, the displayed procedure
is similar to the original definition (lines wrapped for readability):
open-input-file ⇒ #<CLOSURE (str) (or (open-file str open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we open a file using open-input-file, the sections of code
used become memoized:
(open-input-file "r4rstest.scm") ⇒ #<input-port 3> open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we cause open-input-file to execute other sections of code,
they too become memoized:
(open-input-file "foo.scm") ⇒ ERROR: No such file or directory ERROR: OPEN-INPUT-FILE couldn't open file "foo.scm" open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (#@and (#@procedure? #@could-not-open) (could-not-open) #f) (#@error "OPEN-INPUT-FILE couldn't open file " #@0+0))> |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The variable *interactive* determines whether the SCM session is interactive, or should quit after the command line is processed. *interactive* is controlled directly by the command-line options `-b', `-i', and `-s' (see section Invoking SCM). If none of these options are specified, the rules to determine interactivity are more complicated; see `Init5e3.scm' for details.
Resumes the top level Read-Eval-Print loop.
Restarts the SCM program with the same arguments as it was originally invoked. All `-l' loaded files are loaded again; If those files have changed, those changes will be reflected in the new session.
Note When running a saved executable (see section Dump),
restart is redefined to be exec-self.
Exits and immediately re-invokes the same executable with the same
arguments. If the executable file has been changed or replaced since
the beginning of the current session, the new executable will be
invoked. This differentiates exec-self from restart.
Controls how much monitoring information is printed. If n is:
no prompt or information is printed.
a prompt is printed.
messages bracketing file loading are printed.
the CPU time is printed after each top level form evaluated; notifications of heap growth printed; the interpreter checks stack depth periodically.
a garbage collection summary is printed after each top level form evaluated;
a message for each GC (see section Garbage Collection) is printed; warnings issued for top-level symbols redefined.
Scans all of SCM objects and reclaims for further use those that are no longer accessible.
Prints out statistics about SCM's current use of storage. (room #t)
also gives the hexadecimal heap segment and stack bounds.
Contains the version string (e.g. `5e3') of SCM.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to dump a saved executable or to dynamically-link using DLD,
SCM must know where its executable file is. Sometimes SCM
(see section Executable Pathname) guesses incorrectly the location of the
currently running executable. In that case, the correct path can be set
by calling execpath with the pathname.
Returns the path (string) which SCM uses to find the executable file whose invocation the currently running session is, or #f if the path is not set.
Sets the path to #f or newpath, respectively. The old path
is returned.
For other configuration constants and procedures See (slib)Configuration section `Configuration' in SLIB.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 3.13.1 Unix Scheme Scripts | From Olin Shivers' Scheme Shell | |
| 3.13.2 MS-DOS Compatible Scripts | Run in MS-DOS and Unix | |
| 3.13.3 Unix Shell Scripts | Use /bin/sh to run Scheme |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In reading this section, keep in mind that the first line of a script
file has (different) meanings to SCM and the operating system
(execve).
On unix systems, a Shell-Script is a file (with execute
permissions) whose first two characters are `#!'. The
interpreter argument must be the pathname of the program to
process the rest of the file. The directories named by environment
variable PATH are not searched to find interpreter.
When executing a shell-script, the operating system invokes interpreter with a single argument encapsulating the rest of the first line's contents (if not just whitespace), the pathname of the Scheme Script file, and then any arguments which the shell-script was invoked with.
Put one space character between `#!' and the first character of interpreter (`/'). The interpreter name is followed by ` \'; SCM substitutes the second line of file for `\' (and the rest of the line), then appends any arguments given on the command line invoking this Scheme-Script.
When SCM executes the script, the Scheme variable *script* will be set to the script pathname. The last argument before `!#' on the second line should be `-'; SCM will load the script file, preserve the unprocessed arguments, and set *argv* to a list of the script pathname and the unprocessed arguments.
Note that the interpreter, not the operating system, provides the `\' substitution; this will only take place if interpreter is a SCM or SCSH interpreter.
When the first two characters of the file being loaded are #! and
a `\' is present before a newline in the file, all characters up
to `!#' will be ignored by SCM read.
This combination of interpretatons allows SCM source files to be used as POSIX shell-scripts if the first line is:
#! /usr/local/bin/scm \ |
The following Scheme-Script prints factorial of its argument:
#! /usr/local/bin/scm \ %0 %*
- !#
(define (fact.script args)
(cond ((and (= 1 (length args))
(string->number (car args)))
=> (lambda (n) (print (fact n)) #t))
(else (fact.usage))))
(define (fact.usage)
(print *argv*)
(display "\
Usage: fact N
Returns the factorial of N.
"
(current-error-port))
#f)
(define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n)))))
(if *script* (exit (fact.script (list-tail *argv* *optind*))))
|
./fact 32 ⇒ 263130836933693530167218012160000000 |
If the wrong number of arguments is given, fact prints its
argv with usage information.
./fact 3 2
-|
("./fact" "3" "2")
Usage: fact N
Returns the factorial of N.
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If open-input-file has not yet been used, the displayed procedure
is similar to the original definition (lines wrapped for readability):
open-input-file ⇒ #<CLOSURE (str) (or (open-file str open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we open a file using open-input-file, the sections of code
used become memoized:
(open-input-file "r4rstest.scm") ⇒ #<input-port 3> open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we cause open-input-file to execute other sections of code,
they too become memoized:
(open-input-file "foo.scm") ⇒ ERROR: No such file or directory ERROR: OPEN-INPUT-FILE couldn't open file "foo.scm" open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (#@and (#@procedure? #@could-not-open) (could-not-open) #f) (#@error "OPEN-INPUT-FILE couldn't open file " #@0+0))> |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The variable *interactive* determines whether the SCM session is interactive, or should quit after the command line is processed. *interactive* is controlled directly by the command-line options `-b', `-i', and `-s' (see section Invoking SCM). If none of these options are specified, the rules to determine interactivity are more complicated; see `Init5e3.scm' for details.
Resumes the top level Read-Eval-Print loop.
Restarts the SCM program with the same arguments as it was originally invoked. All `-l' loaded files are loaded again; If those files have changed, those changes will be reflected in the new session.
Note When running a saved executable (see section Dump),
restart is redefined to be exec-self.
Exits and immediately re-invokes the same executable with the same
arguments. If the executable file has been changed or replaced since
the beginning of the current session, the new executable will be
invoked. This differentiates exec-self from restart.
Controls how much monitoring information is printed. If n is:
no prompt or information is printed.
a prompt is printed.
messages bracketing file loading are printed.
the CPU time is printed after each top level form evaluated; notifications of heap growth printed; the interpreter checks stack depth periodically.
a garbage collection summary is printed after each top level form evaluated;
a message for each GC (see section Garbage Collection) is printed; warnings issued for top-level symbols redefined.
Scans all of SCM objects and reclaims for further use those that are no longer accessible.
Prints out statistics about SCM's current use of storage. (room #t)
also gives the hexadecimal heap segment and stack bounds.
Contains the version string (e.g. `5e3') of SCM.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to dump a saved executable or to dynamically-link using DLD,
SCM must know where its executable file is. Sometimes SCM
(see section Executable Pathname) guesses incorrectly the location of the
currently running executable. In that case, the correct path can be set
by calling execpath with the pathname.
Returns the path (string) which SCM uses to find the executable file whose invocation the currently running session is, or #f if the path is not set.
Sets the path to #f or newpath, respectively. The old path
is returned.
For other configuration constants and procedures See (slib)Configuration section `Configuration' in SLIB.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 3.13.1 Unix Scheme Scripts | From Olin Shivers' Scheme Shell | |
| 3.13.2 MS-DOS Compatible Scripts | Run in MS-DOS and Unix | |
| 3.13.3 Unix Shell Scripts | Use /bin/sh to run Scheme |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In reading this section, keep in mind that the first line of a script
file has (different) meanings to SCM and the operating system
(execve).
On unix systems, a Shell-Script is a file (with execute
permissions) whose first two characters are `#!'. The
interpreter argument must be the pathname of the program to
process the rest of the file. The directories named by environment
variable PATH are not searched to find interpreter.
When executing a shell-script, the operating system invokes interpreter with a single argument encapsulating the rest of the first line's contents (if not just whitespace), the pathname of the Scheme Script file, and then any arguments which the shell-script was invoked with.
Put one space character between `#!' and the first character of interpreter (`/'). The interpreter name is followed by ` \'; SCM substitutes the second line of file for `\' (and the rest of the line), then appends any arguments given on the command line invoking this Scheme-Script.
When SCM executes the script, the Scheme variable *script* will be set to the script pathname. The last argument before `!#' on the second line should be `-'; SCM will load the script file, preserve the unprocessed arguments, and set *argv* to a list of the script pathname and the unprocessed arguments.
Note that the interpreter, not the operating system, provides the `\' substitution; this will only take place if interpreter is a SCM or SCSH interpreter.
When the first two characters of the file being loaded are #! and
a `\' is present before a newline in the file, all characters up
to `!#' will be ignored by SCM read.
This combination of interpretatons allows SCM source files to be used as POSIX shell-scripts if the first line is:
#! /usr/local/bin/scm \ |
The following Scheme-Script prints factorial of its argument:
#! /usr/local/bin/scm \ %0 %*
- !#
(define (fact.script args)
(cond ((and (= 1 (length args))
(string->number (car args)))
=> (lambda (n) (print (fact n)) #t))
(else (fact.usage))))
(define (fact.usage)
(print *argv*)
(display "\
Usage: fact N
Returns the factorial of N.
"
(current-error-port))
#f)
(define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n)))))
(if *script* (exit (fact.script (list-tail *argv* *optind*))))
|
./fact 32 ⇒ 263130836933693530167218012160000000 |
If the wrong number of arguments is given, fact prints its
argv with usage information.
./fact 3 2
-|
("./fact" "3" "2")
Usage: fact N
Returns the factorial of N.
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If open-input-file has not yet been used, the displayed procedure
is similar to the original definition (lines wrapped for readability):
open-input-file ⇒ #<CLOSURE (str) (or (open-file str open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we open a file using open-input-file, the sections of code
used become memoized:
(open-input-file "r4rstest.scm") ⇒ #<input-port 3> open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we cause open-input-file to execute other sections of code,
they too become memoized:
(open-input-file "foo.scm") ⇒ ERROR: No such file or directory ERROR: OPEN-INPUT-FILE couldn't open file "foo.scm" open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (#@and (#@procedure? #@could-not-open) (could-not-open) #f) (#@error "OPEN-INPUT-FILE couldn't open file " #@0+0))> |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The variable *interactive* determines whether the SCM session is interactive, or should quit after the command line is processed. *interactive* is controlled directly by the command-line options `-b', `-i', and `-s' (see section Invoking SCM). If none of these options are specified, the rules to determine interactivity are more complicated; see `Init5e3.scm' for details.
Resumes the top level Read-Eval-Print loop.
Restarts the SCM program with the same arguments as it was originally invoked. All `-l' loaded files are loaded again; If those files have changed, those changes will be reflected in the new session.
Note When running a saved executable (see section Dump),
restart is redefined to be exec-self.
Exits and immediately re-invokes the same executable with the same
arguments. If the executable file has been changed or replaced since
the beginning of the current session, the new executable will be
invoked. This differentiates exec-self from restart.
Controls how much monitoring information is printed. If n is:
no prompt or information is printed.
a prompt is printed.
messages bracketing file loading are printed.
the CPU time is printed after each top level form evaluated; notifications of heap growth printed; the interpreter checks stack depth periodically.
a garbage collection summary is printed after each top level form evaluated;
a message for each GC (see section Garbage Collection) is printed; warnings issued for top-level symbols redefined.
Scans all of SCM objects and reclaims for further use those that are no longer accessible.
Prints out statistics about SCM's current use of storage. (room #t)
also gives the hexadecimal heap segment and stack bounds.
Contains the version string (e.g. `5e3') of SCM.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to dump a saved executable or to dynamically-link using DLD,
SCM must know where its executable file is. Sometimes SCM
(see section Executable Pathname) guesses incorrectly the location of the
currently running executable. In that case, the correct path can be set
by calling execpath with the pathname.
Returns the path (string) which SCM uses to find the executable file whose invocation the currently running session is, or #f if the path is not set.
Sets the path to #f or newpath, respectively. The old path
is returned.
For other configuration constants and procedures See (slib)Configuration section `Configuration' in SLIB.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 3.13.1 Unix Scheme Scripts | From Olin Shivers' Scheme Shell | |
| 3.13.2 MS-DOS Compatible Scripts | Run in MS-DOS and Unix | |
| 3.13.3 Unix Shell Scripts | Use /bin/sh to run Scheme |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In reading this section, keep in mind that the first line of a script
file has (different) meanings to SCM and the operating system
(execve).
On unix systems, a Shell-Script is a file (with execute
permissions) whose first two characters are `#!'. The
interpreter argument must be the pathname of the program to
process the rest of the file. The directories named by environment
variable PATH are not searched to find interpreter.
When executing a shell-script, the operating system invokes interpreter with a single argument encapsulating the rest of the first line's contents (if not just whitespace), the pathname of the Scheme Script file, and then any arguments which the shell-script was invoked with.
Put one space character between `#!' and the first character of interpreter (`/'). The interpreter name is followed by ` \'; SCM substitutes the second line of file for `\' (and the rest of the line), then appends any arguments given on the command line invoking this Scheme-Script.
When SCM executes the script, the Scheme variable *script* will be set to the script pathname. The last argument before `!#' on the second line should be `-'; SCM will load the script file, preserve the unprocessed arguments, and set *argv* to a list of the script pathname and the unprocessed arguments.
Note that the interpreter, not the operating system, provides the `\' substitution; this will only take place if interpreter is a SCM or SCSH interpreter.
When the first two characters of the file being loaded are #! and
a `\' is present before a newline in the file, all characters up
to `!#' will be ignored by SCM read.
This combination of interpretatons allows SCM source files to be used as POSIX shell-scripts if the first line is:
#! /usr/local/bin/scm \ |
The following Scheme-Script prints factorial of its argument:
#! /usr/local/bin/scm \ %0 %*
- !#
(define (fact.script args)
(cond ((and (= 1 (length args))
(string->number (car args)))
=> (lambda (n) (print (fact n)) #t))
(else (fact.usage))))
(define (fact.usage)
(print *argv*)
(display "\
Usage: fact N
Returns the factorial of N.
"
(current-error-port))
#f)
(define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n)))))
(if *script* (exit (fact.script (list-tail *argv* *optind*))))
|
./fact 32 ⇒ 263130836933693530167218012160000000 |
If the wrong number of arguments is given, fact prints its
argv with usage information.
./fact 3 2
-|
("./fact" "3" "2")
Usage: fact N
Returns the factorial of N.
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If open-input-file has not yet been used, the displayed procedure
is similar to the original definition (lines wrapped for readability):
open-input-file ⇒ #<CLOSURE (str) (or (open-file str open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we open a file using open-input-file, the sections of code
used become memoized:
(open-input-file "r4rstest.scm") ⇒ #<input-port 3> open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we cause open-input-file to execute other sections of code,
they too become memoized:
(open-input-file "foo.scm") ⇒ ERROR: No such file or directory ERROR: OPEN-INPUT-FILE couldn't open file "foo.scm" open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (#@and (#@procedure? #@could-not-open) (could-not-open) #f) (#@error "OPEN-INPUT-FILE couldn't open file " #@0+0))> |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The variable *interactive* determines whether the SCM session is interactive, or should quit after the command line is processed. *interactive* is controlled directly by the command-line options `-b', `-i', and `-s' (see section Invoking SCM). If none of these options are specified, the rules to determine interactivity are more complicated; see `Init5e3.scm' for details.
Resumes the top level Read-Eval-Print loop.
Restarts the SCM program with the same arguments as it was originally invoked. All `-l' loaded files are loaded again; If those files have changed, those changes will be reflected in the new session.
Note When running a saved executable (see section Dump),
restart is redefined to be exec-self.
Exits and immediately re-invokes the same executable with the same
arguments. If the executable file has been changed or replaced since
the beginning of the current session, the new executable will be
invoked. This differentiates exec-self from restart.
Controls how much monitoring information is printed. If n is:
no prompt or information is printed.
a prompt is printed.
messages bracketing file loading are printed.
the CPU time is printed after each top level form evaluated; notifications of heap growth printed; the interpreter checks stack depth periodically.
a garbage collection summary is printed after each top level form evaluated;
a message for each GC (see section Garbage Collection) is printed; warnings issued for top-level symbols redefined.
Scans all of SCM objects and reclaims for further use those that are no longer accessible.
Prints out statistics about SCM's current use of storage. (room #t)
also gives the hexadecimal heap segment and stack bounds.
Contains the version string (e.g. `5e3') of SCM.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to dump a saved executable or to dynamically-link using DLD,
SCM must know where its executable file is. Sometimes SCM
(see section Executable Pathname) guesses incorrectly the location of the
currently running executable. In that case, the correct path can be set
by calling execpath with the pathname.
Returns the path (string) which SCM uses to find the executable file whose invocation the currently running session is, or #f if the path is not set.
Sets the path to #f or newpath, respectively. The old path
is returned.
For other configuration constants and procedures See (slib)Configuration section `Configuration' in SLIB.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 3.13.1 Unix Scheme Scripts | From Olin Shivers' Scheme Shell | |
| 3.13.2 MS-DOS Compatible Scripts | Run in MS-DOS and Unix | |
| 3.13.3 Unix Shell Scripts | Use /bin/sh to run Scheme |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In reading this section, keep in mind that the first line of a script
file has (different) meanings to SCM and the operating system
(execve).
On unix systems, a Shell-Script is a file (with execute
permissions) whose first two characters are `#!'. The
interpreter argument must be the pathname of the program to
process the rest of the file. The directories named by environment
variable PATH are not searched to find interpreter.
When executing a shell-script, the operating system invokes interpreter with a single argument encapsulating the rest of the first line's contents (if not just whitespace), the pathname of the Scheme Script file, and then any arguments which the shell-script was invoked with.
Put one space character between `#!' and the first character of interpreter (`/'). The interpreter name is followed by ` \'; SCM substitutes the second line of file for `\' (and the rest of the line), then appends any arguments given on the command line invoking this Scheme-Script.
When SCM executes the script, the Scheme variable *script* will be set to the script pathname. The last argument before `!#' on the second line should be `-'; SCM will load the script file, preserve the unprocessed arguments, and set *argv* to a list of the script pathname and the unprocessed arguments.
Note that the interpreter, not the operating system, provides the `\' substitution; this will only take place if interpreter is a SCM or SCSH interpreter.
When the first two characters of the file being loaded are #! and
a `\' is present before a newline in the file, all characters up
to `!#' will be ignored by SCM read.
This combination of interpretatons allows SCM source files to be used as POSIX shell-scripts if the first line is:
#! /usr/local/bin/scm \ |
The following Scheme-Script prints factorial of its argument:
#! /usr/local/bin/scm \ %0 %*
- !#
(define (fact.script args)
(cond ((and (= 1 (length args))
(string->number (car args)))
=> (lambda (n) (print (fact n)) #t))
(else (fact.usage))))
(define (fact.usage)
(print *argv*)
(display "\
Usage: fact N
Returns the factorial of N.
"
(current-error-port))
#f)
(define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n)))))
(if *script* (exit (fact.script (list-tail *argv* *optind*))))
|
./fact 32 ⇒ 263130836933693530167218012160000000 |
If the wrong number of arguments is given, fact prints its
argv with usage information.
./fact 3 2
-|
("./fact" "3" "2")
Usage: fact N
Returns the factorial of N.
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If open-input-file has not yet been used, the displayed procedure
is similar to the original definition (lines wrapped for readability):
open-input-file ⇒ #<CLOSURE (str) (or (open-file str open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we open a file using open-input-file, the sections of code
used become memoized:
(open-input-file "r4rstest.scm") ⇒ #<input-port 3> open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we cause open-input-file to execute other sections of code,
they too become memoized:
(open-input-file "foo.scm") ⇒ ERROR: No such file or directory ERROR: OPEN-INPUT-FILE couldn't open file "foo.scm" open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (#@and (#@procedure? #@could-not-open) (could-not-open) #f) (#@error "OPEN-INPUT-FILE couldn't open file " #@0+0))> |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The variable *interactive* determines whether the SCM session is interactive, or should quit after the command line is processed. *interactive* is controlled directly by the command-line options `-b', `-i', and `-s' (see section Invoking SCM). If none of these options are specified, the rules to determine interactivity are more complicated; see `Init5e3.scm' for details.
Resumes the top level Read-Eval-Print loop.
Restarts the SCM program with the same arguments as it was originally invoked. All `-l' loaded files are loaded again; If those files have changed, those changes will be reflected in the new session.
Note When running a saved executable (see section Dump),
restart is redefined to be exec-self.
Exits and immediately re-invokes the same executable with the same
arguments. If the executable file has been changed or replaced since
the beginning of the current session, the new executable will be
invoked. This differentiates exec-self from restart.
Controls how much monitoring information is printed. If n is:
no prompt or information is printed.
a prompt is printed.
messages bracketing file loading are printed.
the CPU time is printed after each top level form evaluated; notifications of heap growth printed; the interpreter checks stack depth periodically.
a garbage collection summary is printed after each top level form evaluated;
a message for each GC (see section Garbage Collection) is printed; warnings issued for top-level symbols redefined.
Scans all of SCM objects and reclaims for further use those that are no longer accessible.
Prints out statistics about SCM's current use of storage. (room #t)
also gives the hexadecimal heap segment and stack bounds.
Contains the version string (e.g. `5e3') of SCM.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to dump a saved executable or to dynamically-link using DLD,
SCM must know where its executable file is. Sometimes SCM
(see section Executable Pathname) guesses incorrectly the location of the
currently running executable. In that case, the correct path can be set
by calling execpath with the pathname.
Returns the path (string) which SCM uses to find the executable file whose invocation the currently running session is, or #f if the path is not set.
Sets the path to #f or newpath, respectively. The old path
is returned.
For other configuration constants and procedures See (slib)Configuration section `Configuration' in SLIB.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 3.13.1 Unix Scheme Scripts | From Olin Shivers' Scheme Shell | |
| 3.13.2 MS-DOS Compatible Scripts | Run in MS-DOS and Unix | |
| 3.13.3 Unix Shell Scripts | Use /bin/sh to run Scheme |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In reading this section, keep in mind that the first line of a script
file has (different) meanings to SCM and the operating system
(execve).
On unix systems, a Shell-Script is a file (with execute
permissions) whose first two characters are `#!'. The
interpreter argument must be the pathname of the program to
process the rest of the file. The directories named by environment
variable PATH are not searched to find interpreter.
When executing a shell-script, the operating system invokes interpreter with a single argument encapsulating the rest of the first line's contents (if not just whitespace), the pathname of the Scheme Script file, and then any arguments which the shell-script was invoked with.
Put one space character between `#!' and the first character of interpreter (`/'). The interpreter name is followed by ` \'; SCM substitutes the second line of file for `\' (and the rest of the line), then appends any arguments given on the command line invoking this Scheme-Script.
When SCM executes the script, the Scheme variable *script* will be set to the script pathname. The last argument before `!#' on the second line should be `-'; SCM will load the script file, preserve the unprocessed arguments, and set *argv* to a list of the script pathname and the unprocessed arguments.
Note that the interpreter, not the operating system, provides the `\' substitution; this will only take place if interpreter is a SCM or SCSH interpreter.
When the first two characters of the file being loaded are #! and
a `\' is present before a newline in the file, all characters up
to `!#' will be ignored by SCM read.
This combination of interpretatons allows SCM source files to be used as POSIX shell-scripts if the first line is:
#! /usr/local/bin/scm \ |
The following Scheme-Script prints factorial of its argument:
#! /usr/local/bin/scm \ %0 %*
- !#
(define (fact.script args)
(cond ((and (= 1 (length args))
(string->number (car args)))
=> (lambda (n) (print (fact n)) #t))
(else (fact.usage))))
(define (fact.usage)
(print *argv*)
(display "\
Usage: fact N
Returns the factorial of N.
"
(current-error-port))
#f)
(define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n)))))
(if *script* (exit (fact.script (list-tail *argv* *optind*))))
|
./fact 32 ⇒ 263130836933693530167218012160000000 |
If the wrong number of arguments is given, fact prints its
argv with usage information.
./fact 3 2
-|
("./fact" "3" "2")
Usage: fact N
Returns the factorial of N.
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If open-input-file has not yet been used, the displayed procedure
is similar to the original definition (lines wrapped for readability):
open-input-file ⇒ #<CLOSURE (str) (or (open-file str open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we open a file using open-input-file, the sections of code
used become memoized:
(open-input-file "r4rstest.scm") ⇒ #<input-port 3> open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))> |
If we cause open-input-file to execute other sections of code,
they too become memoized:
(open-input-file "foo.scm") ⇒ ERROR: No such file or directory ERROR: OPEN-INPUT-FILE couldn't open file "foo.scm" open-input-file ⇒ #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) (#@and (#@procedure? #@could-not-open) (could-not-open) #f) (#@error "OPEN-INPUT-FILE couldn't open file " #@0+0))> |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The variable *interactive* determines whether the SCM session is interactive, or should quit after the command line is processed. *interactive* is controlled directly by the command-line options `-b', `-i', and `-s' (see section Invoking SCM). If none of these options are specified, the rules to determine interactivity are more complicated; see `Init5e3.scm' for details.
Resumes the top level Read-Eval-Print loop.
Restarts the SCM program with the same arguments as it was originally invoked. All `-l' loaded files are loaded again; If those files have changed, those changes will be reflected in the new session.
Note When running a saved executable (see section Dump),
restart is redefined to be exec-self.
Exits and immediately re-invokes the same executable with the same
arguments. If the executable file has been changed or replaced since
the beginning of the current session, the new executable will be
invoked. This differentiates exec-self from restart.
Controls how much monitoring information is printed. If n is:
no prompt or information is printed.
a prompt is printed.
messages bracketing file loading are printed.
the CPU time is printed after each top level form evaluated; notifications of heap growth printed; the interpreter checks stack depth periodically.
a garbage collection summary is printed after each top level form evaluated;
a message for each GC (see section Garbage Collection) is printed; warnings issued for top-level symbols redefined.
Scans all of SCM objects and reclaims for further use those that are no longer accessible.
Prints out statistics about SCM's current use of storage. (room #t)
also gives the hexadecimal heap segment and stack bounds.
Contains the version string (e.g. `5e3') of SCM.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to dump a saved executable or to dynamically-link using DLD,
SCM must know where its executable file is. Sometimes SCM
(see section Executable Pathname) guesses incorrectly the location of the
currently running executable. In that case, the correct path can be set
by calling execpath with the pathname.
Returns the path (string) which SCM uses to find the executable file whose invocation the currently running session is, or #f if the path is not set.
Sets the path to #f or newpath, respectively. The old path
is returned.
For other configuration constants and procedures See (slib)Configuration section `Configuration' in SLIB.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 3.13.1 Unix Scheme Scripts | From Olin Shivers' Scheme Shell | |
| 3.13.2 MS-DOS Compatible Scripts | Run in MS-DOS and Unix | |
| 3.13.3 Unix Shell Scripts | Use /bin/sh to run Scheme |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] |