This chapter describes how to run MIT Scheme on a unix system or a PC running DOS, Windows 3.1, or Windows NT. It also describes how you can customize the behavior of MIT Scheme using command-line options and environment variables.
Usually, MIT Scheme is invoked by typing
scheme
at your operating system's command interpreter. (Under Windows 3.1 you must use the Program Manager's Run command, or an icon.) Scheme will load itself, clear the screen, and print something like this:
Scheme saved on Thursday December 2, 1993 at 6:18:35 PM Release 7.3.0 (beta) Microcode 11.146 Runtime 14.166
This information, which can be printed again by evaluating
(identify-world)
tells you the following version information. "Release" is the release number for the entire Scheme system. This number is changed each time a new version of Scheme is released. An "(alpha)" or "(beta)" following the release number indicates that this is a alpha- or beta-test release. "Microcode" is the version number for the part of the system that is written in C. "Runtime" is the version number for the part of the system that is written in Scheme.
Following this there may be additional version numbers for specific
subsystems. `SF' refers to the scode optimization program
sf
, `Liar' is the native-code compiler,
`Edwin' is the Emacs-like text editor,
and `Student' is the S&ICP compatibility package.
If the compiler is supported for your machine, you can invoke it by giving Scheme the `-compiler' option:
scheme -compiler
This option causes Scheme to use a larger constant space and heap, and to load the world image containing the compiler.
You can customize your setup by using a variety of tools:
-no-init-file
command line option causes Scheme to ignore the
`.scheme.init' file (see section Command-Line Options).
On PC systems these initialization files are called `scheme.ini'
and `edwin.ini' respectively and are searched for in the directory
identified by the HOME
environment variable.
One of the important parameters that can be customized is how much memory Scheme uses and how that memory is used. Scheme uses four kinds of memory:
All aspects except the last may be controlled both by command-line
options and by environment variables. MIT Scheme uses a two-space
copying garbage collector for reclaiming storage in the heap. There are
two version of Scheme which handle garbage collection differently.
Ordinary scheme
has two heaps, one for each `space'.
bchscheme
has one heap and uses a disk file for the other
`space', thus trading memory usage against garbage collection speed.
The total storage required by scheme
is:
stack + (constant + 2*heap) + extra
where stack, constant and heap are parameters that may
be selected when `scheme' starts.
For bchscheme
, which has only one heap in memory, the equation is
stack + (constant + heap) + extra
Once the storage is allocated for the constant space and the heap,
Scheme will dynamically adjust the proportion of the total that is used
for constant space. The stack and the extra microcode storage is not
included in this adjustment. Previous versions of MIT Scheme needed to
be told the amount of constant space that was required when loading your
own bands with the -band
option. Dynamic adjustment of the heap
and constant space avoids this problem; now all that is required is that
the total space is sufficient.
The Scheme procedure (print-gc-statistics)
shows how much heap
and constant space is available.
Scheme accepts the command-line options detailed in the following sections. The options may appear in any order, with the restriction that the microcode options must appear before the runtime options, and the runtime options must appear before any other arguments on the command line. (At present, any arguments other than these options will generate a warning message when Scheme starts. In the future, there will be an advertised mechanism by which the extra arguments can be handled by user code.)
These are the microcode options:
-band filename
MITSCHEME_BAND
, or if that isn't defined, `runtime.com'; in
these cases the library directories are searched, but not the working
directory.
-compiler
-large
. If the
-band
option is also specified, that is the only effect of this
option. Otherwise, the default band's filename is the value of the
environment variable MITSCHEME_COMPILER_BAND
, if defined, or
`compiler.com'; the library directories are searched to locate this
file. Note that the -compiler
option is available only on
machines with compiled-code support.
-edwin
-large
. If the
-band
option is also specified, that is the only effect of this
option. Otherwise, the default band's filename is the value of the
environment variable MITSCHEME_EDWIN_BAND
, if defined, or
`edwin.com'; the library directories are searched to locate this
file. Note that the -edwin
option is available only on machines
with compiled-code support.
-large
MITSCHEME_LARGE_HEAP MITSCHEME_LARGE_CONSTANT MITSCHEME_LARGE_STACKIf this option isn't given, the small sizes are used, specified by the environment variables
MITSCHEME_SMALL_HEAP MITSCHEME_SMALL_CONSTANT MITSCHEME_SMALL_STACKThere are reasonable built-in defaults for all of these environment variables, should any of them be undefined. Note that any or all of the defaults can be individually overridden by the
-heap
,
-constant
, and -stack
options.
Note: the Scheme procedure (print-gc-statistics)
shows how much
heap and constant space is available and in use.
-heap blocks
bchscheme
allocates only one, and uses a disk file for the other.
-constant blocks
-stack blocks
-option-summary
-emacs
-interactive
scheme < /usr/cph/foo.in >& /usr/cph/foo.out &This option only makes sense under unix.
-nocore
-library path
MITSCHEME_LIBRARY_PATH
is used; if that isn't defined,
the default is used.
On unix, the elements of the list are separated by colons, and the
default value is `/usr/local/lib/mit-scheme'. On PCs, the elements
of the list are separated by semicolons, and the default value is
`c:\scheme'.
-utabmd filename
-utab filename
MITSCHEME_UTABMD_FILE
, or if that isn't defined,
`utabmd.bin'; in these cases the library directories are searched,
but not the working directory.
-utab
is an alternate name for the -utabmd
option. At
most one of these options may be given.
-fasl filename
-band
option. This option is useful only for
maintainance and development of the MIT Scheme runtime system.
The following options are runtime options. They are processed after the microcode options and after the runtime, Edwin or some other band is loaded.
-no-init-file
-no-suspend-file
-no-suspend-file
option is given, Scheme will not write a
`scheme_suspend' file under any circumstances.
-eval
user-initial-environment
.
Unless explicitly handled, errors during evaluation are silently ignored.
-load
user-initial-environment
using the default syntax table.
Unless explicitly handled, errors during loading are silently ignored.
In addition to the above, bchscheme
recognises the following
command line options, all of which specify parameters affecting how
bchscheme
uses disk storage to do garbage collection:
-gc-directory directory
MITSCHEME_GC_DIRECTORY
is used instead, and
if that is not defined, `/tmp' is used.
-gc-end-position number
-gc-file
at which this
invocation of scheme can write. If the option is not given, the value
of environment variable MITSCHEME_GC_END_POSITION
is used
instead, and if that is not defined, it is computed from the start
position (as provided with -gc-start-position) and the heap size. The
area of the file used (and locked if possible) is the region between
-gc-start-position
and -gc-end-position
.
-gc-file filename
-gcfile filename
MITSCHEME_GC_FILE
is used, and if this is not defined, a unique
filename is generated in the directory specified with
-gc-directory
.
-gcfile
is an alias for -gc-file
. At most one of these
options should be specified.
-gc-keep
-gc-start-position number
-gc-file
at which this
invocation of scheme can write. If the option is not given, the value
of environment variable MITSCHEME_GC_START_POSITION
is used
instead, and if that is not defined, 0 is used, meaning the beginning of
the file. The area of the file used (and locked if possible) is the
region between -gc-start-position
and -gc-end-position
.
-gc-window-size blocks
MITSCHEME_GC_WINDOW_SIZE
is used instead, and if that is
not defined, the value 16 is used.
The following command line options are only used by an experimental
version of bchscheme
that uses Unix System V-style shared memory,
and only then if the gcdrone
program is installed in the lib
directory.
-gc-drone program
bchscheme
. If the option is not given, the value of
environment variable MITSCHEME_GC_DRONE
is used instead, and if
that is not defined, `gcdrone' is used.
-gc-read-overlap N
bchscheme
. If the option is not given, the value of
environment variable MITSCHEME_GC_READ_OVERLAP
is used instead,
and if that is not defined, 0 is used, disabling overlapped reads.
-gc-write-overlap N
bchscheme
. If the option is not given, the value of
environment variable MITSCHEME_GC_WRITE_OVERLAP
is used instead,
and if that is not defined, 0 is used, disabling overlapped writes.
There are many environment variables that Scheme (and Edwin, etc.) look
for. Environment variables that affect the microcode must be defined
before you start Scheme, but others can be defined or overwritten within
Scheme by using the set-environment-variable!
procedure, e.g.
(set-environment-variable! "EDWIN_FOREGROUND" "32")
The rest of this section is a summary of the environment variables that are specific to MIT Scheme. The environment variables are organised according to the parts of MIT Scheme that they affect.
These environment variables are referred to by the microcode (the executable C programs called `scheme' and `bchscheme').
MITSCHEME_BAND
(default: `runtime.com' on the library path)
-band
,
-compiler
, or -edwin
.
MITSCHEME_COMPILER_BAND
(default: `compiler.com' on the library path)
-compiler
option is given.
Overridden by -band
.
MITSCHEME_EDWIN_BAND
(default: `edwin.com' on the library path)
-edwin
option is given.
Overridden by -band
.
MITSCHEME_LARGE_CONSTANT
(default: `1000')
-large
,
-compiler
, or -edwin
options are given. Overridden by
-constant
. Note: default is somewhat larger on RISC machines.
MITSCHEME_LARGE_HEAP
(default: `1000')
-large
,
-compiler
, or -edwin
options are given. Overridden by
-heap
.
MITSCHEME_LARGE_STACK
(default: `100')
-large
,
-compiler
, or -edwin
options are given. Overridden by
-stack
.
MITSCHEME_LIBRARY_PATH
MITSCHEME_INF_DIRECTORY
MITSCHEME_SMALL_CONSTANT
(default: `400')
-constant
, -large
,
-compiler
, or -edwin
. Note: default is somewhat larger on
RISC machines.
MITSCHEME_SMALL_HEAP
(default: `250')
-heap
, -large
, -compiler
, or
-edwin
.
MITSCHEME_SMALL_STACK
(default: `100')
-stack
, -large
, -compiler
, or
-edwin
.
MITSCHEME_UTABMD_FILE
(default: `utabmd.bin' in the library path)
-utabmd
and -utab
. It is only necessary when re-building
`runtime.com'.
These environment variables are referred to by `bchscheme' (not by `scheme').
MITSCHEME_GC_DIRECTORY
(default: `/tmp')
-gc-directory
.
MITSCHEME_GC_END_POSITION
(default: start-position + heap-size)
-gc-end-position
.
MITSCHEME_GC_FILE
(default: `GCXXXXXX')
-gc-file
.
MITSCHEME_GC_START_POSITION
(default: 0)
-gc-start-position
.
MITSCHEME_GC_WINDOW_SIZE
(default: 16)
-gc-window-size
.
The following environment variables are only used by an experimental
version of Bchscheme that uses Unix System V-style shared memory, and
only then if the gcdrone
program is installed:
MITSCHEME_GC_DRONE
(default: `gcdrone')
-gc-drone
.
MITSCHEME_GC_READ_OVERLAP
(default: 0)
-gc-read-overlap
.
MITSCHEME_GC_WRITE_OVERLAP
(default: 0)
-gc-write-overlap
.
These environment variables are referred to by the Windows, Windows NT, and DOS versions of MIT Scheme.
MITSCHEME_DPMI_EXT_KBD
(default: `false')
MITSCHEME_X32_EXT_KBD
(default: `false')
MITSCHEME_TRAP_ALT_TAB
(default: `false')
MITSCHEME_TRAP_ALT_ESCAPE
(default: `false')
MITSCHEME_GEOMETRY
(default: `-1,-1,-1,-1')
MITSCHEME_FOREGROUND
(default: according to desktop color scheme)
0xff0000
for blue.
MITSCHEME_BACKGROUND
(default: according to desktop color scheme)
MITSCHEME_FOREGROUND
.
These environment variables are referred to by the runtime system.
HOME
TEMP
, TMP
TEMP
is given preference
to TMP
.
These environment variables are referred to by Edwin.
EDWIN_BINARY_DIRECTORY
(default: `edwin/autoload' on the library path)
EDWIN_INFO_DIRECTORY
(default: `edwin/info' on the library path)
EDWIN_ETC_DIRECTORY
(default: `edwin/etc' on the library path)
EDWIN_FOREGROUND
(default: none (white))
EDWIN_BACKGROUND
(default: none (black))
TERM
LINES
(default: auto-sense)
MITSCHEME_LINES
(default: auto-sense or 25)
COLUMNS
(default: auto-sense)
MITSCHEME_COLUMNS
(default: auto-sense, or 80)
There are two distinct versions of MIT Scheme that run on IBM `compatible' PCs: the DOS version is a character-mode only implementation, which can also run under Windows 3.1 as a DOS application. The Windows version runs as a graphics-based application under Windows 3.1 or Windows NT. The DOS version does not run under Windows NT.
Under Windows 3.1, Scheme must be run from the Program Manager or the File Manager. Scheme cannot be run from the command line, because only DOS programs can be run from the command line. (This is the case even with WXSERVER as it appears not to work with win32s-based programs). Windows NT overcomes this restriction, but it is still useful to know how to run Scheme from the Program Manager.
Once an icon is set up to run Scheme with some particular command line options, Scheme is run by double-clicking that icon. The rest of this section gives some tips on how to set up icons in the Program Manager that run Scheme. If you are unfamiliar with this concept you should read about it under the help topic of the Program Manager.
Under Windows NT program manager groups can be common or personal. When setting up icons in a common group it is important to make the icons independent of the vagaries of the environment of the user who is running them. It is often worthwhile doing this under Windows 3.1 and for personal groups too:
scheme.exe
and bchscheme.exe
in the icon Command line if these executables are not in a
directory on the default PATH
.
%HOMEPATH%
-eval (edit)at the end of the command line.
There are two ways you can leave Scheme. The first is to evaluate
(exit)
which will halt the Scheme system, after first requesting confirmation. Any information that was in the environment is lost, so this should not be done lightly.
The second way to leave Scheme is to suspend it; when this is done you may later restart where you left off. Unfortunately this is not possible in all operating systems -- currently it works only on unix versions that support job control (i.e. all of the unix versions for which we distribute Scheme), but not on PCs.
Scheme is suspended by evaluating
(quit)
If your system supports suspension, this will cause Scheme to stop, and
you will be returned to the operating system's command interpreter.
Scheme remains stopped, and can be continued using the job-control
commands of your command interpreter. If your system doesn't support
suspension, this procedure does nothing. (Calling the quit
procedure is analogous to typing Control-Z
, but it allows Scheme
to respond by typing a prompt when it is unsuspended.)