[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

# 2. Running Scheme

This chapter describes how to run MIT Scheme. It also describes how you can customize the behavior of MIT Scheme using command-line options and environment variables.

> 2.1 Basics of Starting Scheme |  |
> 2.2 Customizing Scheme |  |
> 2.3 Memory Usage |  |
> 2.4 Command-Line Options |  |
> 2.5 Custom Command-line Options |  |
> 2.6 Environment Variables |  |
> 2.7 Starting Scheme from Microsoft Windows |  |
> 2.8 Leaving Scheme |  |

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 2.1 Basics of Starting Scheme

Under unix and OS/2, MIT Scheme is invoked by typing

    scheme

at your operating system's command interpreter. Under Windows, MIT Scheme is invoked by double-clicking on a shortcut. In either case, Scheme will load itself and print something like this:

    Scheme saved on Monday June 17, 2002 at 12:10:46 PM
      Release 7.7.1
      Microcode 14.9
      Runtime 15.1

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. ``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 ``6.001`' is the SICP compatibility package.

You can load the compiler 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.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 2.2 Customizing Scheme

You can customize your setup by using a variety of tools:

- Command-line options. Many parameters, like memory usage and the location of libraries, may be varied by command-line options. See section 2.4 Command-Line Options.

- Command scripts or batch files. You might like to write scripts that invoke Scheme with your favorite command-line options. For example, you might not have enough memory to run Edwin or the compiler with its default memory parameters (it will print something like "Not enough memory for this configuration" and halt when started), so you can write a shell script (unix), ``.bat`' file (Windows), or ``.cmd`' file (OS/2) that will invoke Scheme with the appropriate `-heap` and other parameters.

- Scheme supports init files: an init file is a file containing Scheme code that is loaded when Scheme is started, immediately after the identification banner, and before the input prompt is printed. This file is stored in your home directory, which is normally specified by the `HOME` environment variable. Under unix, the file is called ``.scheme.init`'; on the PC it is called ``scheme.ini`'.

  In addition, when Edwin starts up, it loads a separate init file from your home directory into the Edwin environment. This file is called ``.edwin`' under unix, and ``edwin.ini`' on the PC (see section 7.1 Starting Edwin).

  You can use both of these files to define new procedures or commands, or to change defaults in the system.

  The `-no-init-file` command-line option causes Scheme to ignore the
  ``.scheme.init`' file (see section 2.4 Command-Line Options).

- Environment variables. Most microcode parameters, and some runtime system and Edwin parameters, can be specified by means of environment variables. See section 2.6 Environment Variables.

- Icons. Under OS/2 and Windows, and with some window managers under X11, it is possible to create icons that invoke Scheme with different parameters.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 2.3 Memory Usage

Some of the parameters that can be customized determine how much memory Scheme uses and how that memory is used. This section describes how Scheme's memory is organized and used; subsequent sections describe command-line options and environment variables that you can use to customize this usage for your needs.

Scheme uses four kinds of memory:

- A stack that is used for recursive procedure calls.

- A heap that is used for dynamically allocated objects, like ``cons`' cells and strings. Storage used for objects in the heap that become unreferenced is eventually reclaimed by garbage collection.

- A constant space that is used for allocated objects, like the heap. Unlike the heap, storage used for objects in constant space is not reclaimed by garbage collection. Constant space is used for objects that are essentially permanent, like procedures in the runtime system.

- Some extra storage that is used by the microcode (the part of the system that is implemented in C).

All kinds of memory except the last may be controlled either by command-line options or by environment variables.

MIT Scheme uses a two-space copying garbage collector for reclaiming storage in the heap. There are two versions of Scheme which handle garbage collection differently. The standard Scheme, called ``scheme`' under unix and ``scheme.exe`' on the PC, has two heaps, one for each "space". An alternative, called ``bchscheme`' under unix and ``bchschem.exe`' on the PC, has one heap and uses a disk file for the other "space", thus trading memory usage against garbage collection speed (see section 1.4 Optional Configuration).

The total storage required by ``scheme`' is:

    stack + (constant + 2*heap) + extra

where stack, constant and heap are parameters that are 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 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 bands with the `-band` option. Dynamic adjustment of the heap and constant space avoids this problem.

If the size of the constant space is not specified, it is automatically set to the correct size for the band being loaded. Thus, in general it is rarely necessary to explicitly set the size of the constant space. Additionally, each band requires a small amount of heap space; this amount is added to any specified heap size, so that the specified heap size is the amount of free space available.

The Scheme expression ``(print-gc-statistics)`' shows how much heap and constant space is available (see section 3.4 Garbage Collection).

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 2.4 Command-Line Options

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. Any arguments other than these options will generate a warning message when Scheme starts. If you want to define your own command-line options, see 2.5 Custom Command-line Options.

These are the microcode options:

`-compiler`
  This option specifies defaults appropriate for loading the compiler. It specifies the use of large sizes, exactly like `-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.

`-edwin`
  This option specifies defaults appropriate for loading the editor. It specifies the use of large sizes, exactly like `-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.

`-compiler -edwin`
  If both the `-compiler` and `-edwin` options are given, Scheme will load an environment containing both the compiler and the editor. The default band's filename is the value of the environment variable `MITSCHEME_ALL_BAND`, if defined, or ``all.com`'; the library directories are searched to locate this file.

`-band filename`
  Specifies the initial world image file (band) to be loaded. Searches for filename in the working directory and the library directories, using the full pathname of the first readable file of that name. If filename is an absolute pathname (on unix, this means it starts with ``/`'), then no search occurs -- filename is tested for readability and then used directly. If this option isn't given, the filename is the value of the environment variable `MITSCHEME_BAND`, or if that isn't defined, ``runtime.com`'; in these cases the library directories are searched, but not the working directory.

`-large`
  Specifies that large heap, constant, and stack sizes should be used. These are specified by the environment variables

      MITSCHEME_LARGE_HEAP
      MITSCHEME_LARGE_CONSTANT
      MITSCHEME_LARGE_STACK

  If this option isn't given, the small sizes are used, specified by the environment variables

      MITSCHEME_SMALL_HEAP
      MITSCHEME_SMALL_CONSTANT
      MITSCHEME_SMALL_STACK

  There 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 expression ``(print-gc-statistics)`' shows how much heap and constant space is available and in use (see section 3.4 Garbage Collection).

`-heap blocks`
  Specifies the size of the heap in 1024-word blocks. Overrides any default. Normally two such heaps are allocated; ``bchscheme`' allocates only one, and uses a disk file for the other.

  The size specified by this option is incremented by the amount of heap space needed by the band being loaded. Consequently, `-heap` specifies how much free space will be available in the heap when Scheme starts, independent of the amount of heap already consumed by the band.

`-constant blocks`
  Specifies the size of constant space in 1024-word blocks. Overrides any default. Constant space holds the compiled code for the runtime system and other subsystems.

`-stack blocks`
  Specifies the size of the stack in 1024-word blocks. Overrides any default. This is Scheme's stack, not the unix stack used by C programs.

`-option-summary`
  Causes Scheme to write an option summary to standard error. This shows the values of all of the settable microcode option variables.

`-emacs`
  Specifies that Scheme is running as a subprocess of GNU Emacs. This option is automatically supplied by GNU Emacs, and should not be given under other circumstances.

`-interactive`
  If this option isn't specified, and Scheme's standard I/O is not a terminal, Scheme will detach itself from its controlling terminal, which prevents it from getting signals sent to the process group of that terminal. If this option is specified, Scheme will not detach itself from the controlling terminal.

  This detaching behavior is useful for running Scheme as a background job. For example, using `bash`, the following will run Scheme as a background job, redirecting its input and output to files, and preventing it from being killed by keyboard interrupts or by logging out:

      scheme < /usr/cph/foo.in > /usr/cph/foo.out 2>&1 &

  This option is ignored under non-unix operating systems.

`-nocore`
  Specifies that Scheme should not generate a core dump under any circumstances. If this option is not given, and Scheme terminates abnormally, you will be prompted to decide whether a core dump should be generated.

  This option is ignored under non-unix operating systems.

`-library path`
  Sets the library search path to path. This is a list of directories that is searched to find various library files, such as bands. If this option is not given, the value of the environment variable `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\lib`'.

`-utabmd filename`
  Specifies that filename contains the microcode tables (the microcode tables are information that informs the runtime system about the microcode's structure). Filename is searched for in the working directory and the library directories. If this option isn't given, the filename is the value of the environment variable `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`
  Specifies that a cold load should be performed, using filename as the initial file to be loaded. If this option isn't given, a normal load is performed instead. This option may not be used together with the `-compiler`, `-edwin`, or `-band` options. This option is useful only for maintenance and development of the MIT Scheme runtime system.

In addition to the above, ``bchscheme`' recognizes the following command-line options, all of which specify parameters affecting how ``bchscheme`' uses disk storage to do garbage collection:

`-gc-directory directory`
  Specifies that directory should be used to create files for garbage collection. If the option is not given, the value of environment variable `MITSCHEME_GC_DIRECTORY` is used instead, and if that is not defined, a standard temporary directory is used (see `TMPDIR` in see section 2.6.3 Environment Variables for the Runtime System).

`-gc-file filename`
  Specifies that filename should be used for garbage collection. If the option is not given, the value of environment variable `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`
  Specifies that the GC file used for garbage collection should not be deleted when Scheme terminates. The GC file is deleted only if the file was created by this invocation of Scheme, and this option is not set.

`-gc-start-position number`
  Specifies the first byte position in the GC file at which the Scheme process can write. If not given, the value of the environment variable `MITSCHEME_GC_START_POSITION` is used, 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-end-position number`
  Specifies the last byte position in the GC file at which the Scheme process can write. If not given, the value of the environment variable `MITSCHEME_GC_END_POSITION` is used, and if that is not defined, the sum of the start position (as specified by `-gc-start-position`) and the heap size is used. 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`
  Specifies the size of the windows into new space during garbage collection. If this option is not given, the value of environment variable `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 then only if the ``gcdrone`' program is installed in the library directory.

`-gc-drone program`
  Specifies that program should be used as the drone program for overlapped I/O during garbage collection. 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`
  Specifies that Scheme should delegate at most n simultaneous disk read operations during garbage collection. 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`
  Specifies that Scheme should delegate at most n simultaneous disk write operations during garbage collection. 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.

The following options are runtime options. They are processed after the microcode options and after the image file is loaded.

`-no-init-file`
  This option causes Scheme to ignore the ``~/.scheme.init`' or ``scheme.ini`' file, normally loaded automatically when Scheme starts (if it exists).

`-suspend-file`
  Under some circumstances Scheme can write out a file called ``scheme_suspend`' in the user's home directory.(1) This file is a world image containing the complete state of the Scheme process; restoring this file continues the computation that Scheme was performing at the time the file was written.

  Normally this file is never written, but the `-suspend-file` option enables writing of this file.

`-eval expression ...`
  This option causes Scheme to evaluate the expressions following it on the command line, up to (but not including) the next option that starts with a hyphen. The expressions are evaluated in the `user-initial-environment`. Unless explicitly handled, errors during evaluation are silently ignored.

`-load file ...`
  This option causes Scheme to load the files (or lists of files) following it on the command line, up to (but not including) the next option that starts with a hyphen. The files are loaded in the `user-initial-environment`. Unless explicitly handled, errors during loading are silently ignored.

The following option is supported only when Edwin is loaded.

`-edit`
  This option causes Edwin to start immediately when Scheme is started.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 2.5 Custom Command-line Options

MIT Scheme provides a mechanism for you to define your own command-line options. This is done by registering handlers to identify particular named options and to process them when Scheme starts. Unfortunately, because of the way this mechanism is implemented, you must define the options and then save a world image containing your definitions (see section 3.3 World Images). Later, when you start Scheme using that world image, your options will be recognized.

The following procedures define command-line parsers. In each, the argument keyword defines the option that will be recognized on the command line. The keyword must be a string starting with a hyphen and containing at least one additional character.

procedure+: simple-command-line-parser keyword thunk
  Defines keyword to be a simple command-line option. When this keyword is seen on the command line, it causes thunk to be executed.

procedure+: argument-command-line-parser keyword multiple? procedure
  Defines keyword to be a command-line option that is followed by one or more command-line arguments. Procedure is a procedure that accepts one argument; when keyword is seen, it is called once for each argument.

  Multiple?, if true, says that keyword may be followed by more than one argument on the command line. In this case, procedure is called once for each argument that follows keyword and does not start with a hyphen. If multiple? is `#f`, procedure is called once, with the command-line argument following keyword. In this case, it does not matter if the following argument starts with a hyphen.

procedure+: set-command-line-parser! keyword procedure
  This low-level procedure defines keyword to be a command-line option that is defined by procedure. When keyword is seen, procedure is called with all of the command-line arguments, starting with keyword, as a single list argument. Procedure must return two values (using the `values` procedure): the unused command-line arguments (as a list), and a thunk that is executed to implement the behavior of the option.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 2.6 Environment Variables

Scheme refers to many environment variables. This section lists these variables and describes how each is used. The environment variables are organized according to the parts of MIT Scheme that they affect.

Environment variables that affect the microcode must be defined before you start Scheme; under unix or Windows, others can be defined or overwritten within Scheme by using the `set-environment-variable!` procedure, e.g.

    (set-environment-variable! "EDWIN_FOREGROUND" "32")

> 2.6.1 Environment Variables for the Microcode |  |
> 2.6.2 Environment Variables for ``bchscheme`' |  |
> 2.6.3 Environment Variables for the Runtime System |  |
> 2.6.4 Environment Variables for Edwin |  |
> 2.6.5 Environment Variables for Microsoft Windows |  |
> 2.6.6 Environment Variables for OS/2 |  |

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

### 2.6.1 Environment Variables for the Microcode

These environment variables are referred to by the microcode (the executable C programs called ``scheme`' and ``bchscheme`' under unix, and ``scheme.exe`' and ``bchschem.exe`' on the PC).

`MITSCHEME_ALL_BAND` (default: ``all.com`' on the library path)
  The initial band to be loaded if both the `-compiler` and `-edwin` options are given. Overridden by `-band`.

`MITSCHEME_BAND` (default: ``runtime.com`' on the library path)
  The initial band to be loaded. Overridden by `-band`, `-compiler`, or `-edwin`.

`MITSCHEME_COMPILER_BAND` (default: ``compiler.com`' on the library path)
  The initial band to be loaded if the `-compiler` option is given. Overridden by `-band`.

`MITSCHEME_EDWIN_BAND` (default: ``edwin.com`' on the library path)
  The initial band to be loaded if the `-edwin` option is given. Overridden by `-band`.

`MITSCHEME_LARGE_CONSTANT` (default: as needed)
  The size of constant space, in 1024-word blocks, if the `-large`, `-compiler`, or `-edwin` options are given. Overridden by `-constant`. Note: the default is computed to be the correct size for the band being loaded.

`MITSCHEME_LARGE_HEAP` (default: ``1000`')
  The size of the heap, in 1024-word blocks, if the `-large`, `-compiler`, or `-edwin` options are given. Overridden by `-heap`.

`MITSCHEME_LARGE_STACK` (default: ``100`')
  The size of the stack, in 1024-word blocks, if the `-large`, `-compiler`, or `-edwin` options are given. Overridden by `-stack`.

`MITSCHEME_LIBRARY_PATH`
  A list of directories. These directories are searched, left to right, to find bands and various other files. On unix systems the list is colon-separated, with the default ``/usr/local/lib/mit-scheme`'. On PC systems the list is semicolon-separated with the default ``c:\scheme\lib`'.

`MITSCHEME_SMALL_CONSTANT` (default: as needed)
  The size of constant space, in 1024-word blocks, if the size options are not given. Overridden by `-constant`, `-large`, `-compiler`, or `-edwin`. Note: the default is computed to be the correct size for the band being loaded.

`MITSCHEME_SMALL_HEAP` (default: ``250`')
  The size of the heap, in 1024-word blocks, if the size options are not given. Overridden by `-heap`, `-large`, `-compiler`, or `-edwin`.

`MITSCHEME_SMALL_STACK` (default: ``100`')
  The size of the stack, in 1024-word blocks, if the size options are not given. Overridden by `-stack`, `-large`, `-compiler`, or `-edwin`.

`MITSCHEME_UTABMD_FILE` (default: ``utabmd.bin`' in the library path)
  The file containing the microcode tables. Overridden by `-utabmd` and `-utab`.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

### 2.6.2 Environment Variables for ``bchscheme`'

These environment variables are referred to by ``bchscheme`' (not by ``scheme`').

`MITSCHEME_GC_DIRECTORY`
  The directory in which GC files are written. Overridden by `-gc-directory`. The default for this variable is the standard temporary directory (see `TMPDIR` in see section 2.6.3 Environment Variables for the Runtime System).

`MITSCHEME_GC_FILE` (default: ``GCXXXXXX`')
  The name of the file to use for garbage collection. If it ends in 6 `X`s, the `X`s are replaced by a letter and process id of the scheme process, thus generating a unique name. Overridden by `-gc-file`.

`MITSCHEME_GC_START_POSITION` (default: ``0`')
  The first position in the GC file to use. Overridden by `-gc-start-position`.

`MITSCHEME_GC_END_POSITION` (default: start-position+heap-size)
  The last position in the GC file to use. Overridden by `-gc-end-position`.

`MITSCHEME_GC_WINDOW_SIZE` (default: ``16`')
  The size in blocks of windows into new space (in the GC file).
  Overridden by `-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 then only if the ``gcdrone`' program is installed:

`MITSCHEME_GC_DRONE` (default: ``gcdrone`')
  The program to use as the I/O drone during garbage collection.
  Overridden by `-gc-drone`.

`MITSCHEME_GC_READ_OVERLAP` (default: ``0`')
  The maximum number of simultaneous read operations.
  Overridden by `-gc-read-overlap`.

`MITSCHEME_GC_WRITE_OVERLAP` (default: ``0`')
  The maximum number of simultaneous write operations.
  Overridden by `-gc-write-overlap`.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

### 2.6.3 Environment Variables for the Runtime System

These environment variables are referred to by the runtime system.

`HOME`
  Directory in which to look for init files. E.g. ``c:\users\joe`' or ``/home/joe`'. This variable needs to be set on OS/2 and Windows 9x. Under Windows NT/2000/XP, the environment variables `HOMEDRIVE` and `HOMEPATH`, set by the operating system, are used instead. Under unix, `HOME` is set by the login shell.

`TMPDIR`
`TEMP`
`TMP`
  Directory for various temporary files. The variables are tried in the given order. If none of them is suitable, built-in defaults are used: under unix, ``/var/tmp`', ``/usr/tmp`', ``/tmp`'; under OS/2 and Windows, ``\temp`', ``\tmp`', and ``\`' (all on the system drive).

`MITSCHEME_INF_DIRECTORY` (default: ``SRC`' on the library path)
  Directory containing the debugging information files for the Scheme system. Should contain subdirectories corresponding to the subdirectories in the source tree. For example, if its value is ``f:\random`', runtime system debugging files will be expected in ``f:\random\runtime`', while Edwin debugging files will be expected in ``f:\random\edwin`'.

`MITSCHEME_LOAD_OPTIONS` (default: ``optiondb.scm`' on the library path)
  Specifies the location of the options database file used by the `load-option` procedure.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

### 2.6.4 Environment Variables for Edwin

These environment variables are referred to by Edwin.

`EDWIN_BINARY_DIRECTORY` (default: ``edwin/autoload`' on the library path)
  Directory where Edwin expects to find files providing autoloaded facilities.

`EDWIN_INFO_DIRECTORY` (default: ``edwin/info`' on the library path)
  Directory where Edwin expects to find files for the `info' documentation subsystem.

`EDWIN_ETC_DIRECTORY` (default: ``edwin/etc`' on the library path)
  Directory where Edwin expects to find utility programs and documentation strings.

`ESHELL`
  Filename of the shell program to use in shell buffers. If not defined, the `SHELL` environment variable is used instead.

`SHELL` (default: ``/bin/sh`' (unix), ``cmd.exe`' (PC))
  Filename of the shell program to use in shell buffers and when executing shell commands. Used to initialize the `shell-path-name` editor variable.

`PATH`
  Used to initialize the `exec-path` editor variable, which is subsequently used for finding programs to be run as subprocesses.

`DISPLAY`
  Used when Edwin runs under unix and uses X11. Specifies the display on which Edwin will create windows.

`TERM`
  Used when Edwin runs under unix on a terminal. Terminal type.

`LINES` (default: auto-sense)
  Used when Edwin runs under unix on a terminal. Number of text lines on the screen, for systems that don't support ``TIOCGWINSZ`'.

`COLUMNS` (default: auto-sense)
  Used when Edwin runs under unix on a terminal. Number of text columns on the screen, for systems that don't support ``TIOCGWINSZ`'.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

### 2.6.5 Environment Variables for Microsoft Windows

These environment variables are specific to the Microsoft Windows implementation.

`MITSCHEME_FONT` (default: determined by operating system)
  A string specifying a font name and characteristics, for example ``Courier New 16 bold`'. Allowed characteristics are integer, specifying the font size in points, and the following style modifiers: ``bold`', ``italic`', ``regular`', ``underline`' and ``strikeout`'. You should specify only fixed-width fonts as variable-width fonts are not drawn correctly.

  Once in Edwin, the font can be changed with the `set-font` and `set-default-font` commands.

`MITSCHEME_GEOMETRY` (default: ``-1,-1,-1,-1`')
  Four integers separated by commas or spaces that specify the placement and size of the MIT Scheme window as a left,top,width,height quadruple. The units are screen pixels, and ``-1`' means allow the system to choose this parameter. E.g. ``-1,-1,500,300`' places a 500 by 300 pixel window at some system-determined position on the screen. The width and height include the window border and title.

`MITSCHEME_FOREGROUND` (default: according to desktop color scheme)
  A value specifying the window text color. The color is specified as hex blue, green and red values (not RGB): e.g. `0xff0000` for blue.

`MITSCHEME_BACKGROUND` (default: according to desktop color scheme)
  A value specifying the window background color. See `MITSCHEME_FOREGROUND`.

`HOMEDRIVE`
`HOMEPATH`
  These variables are used together to indicate the user's home directory. This is the preferred way to specify the home directory.

`USERNAME`
`USER`
  Specifies the login name of the user running Scheme. This is used for several different purposes. `USERNAME` is preferred; `USER` is used if `USERNAME` is not defined. If neither of these variables is defined, an error is signalled when the username is required.

`USERDIR`
  Specifies a directory that contains the home directories of users. One of the places in which Scheme looks for the user's home directory, by searching for a subdirectory with the user's login name.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

### 2.6.6 Environment Variables for OS/2

These environment variables are specific to the OS/2 implementation.

`USER`
  Specifies the login name of the user running Scheme. This is used for several different purposes. If this variable is undefined, an error is signalled when the username is required.

`USERDIR`
  Specifies a directory that contains the home directories of users. One of the places in which Scheme looks for the user's home directory, by searching for a subdirectory with the user's login name. This variable is used only when `HOME` is not defined; we recommend using `HOME` rather than `USERDIR`.

`COMSPEC`
  Specifies the command shell. This is set in all versions of OS/2 (and is required for proper operation of the operating system). Scheme uses this to determine the user's shell if the environment variable `SHELL` is not defined.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 2.7 Starting Scheme from Microsoft Windows

The Microsoft Windows version of MIT Scheme runs as a graphics-based application. Scheme is normally started using shortcuts; the installer automatically generates several different predefined shortcuts for your convenience.

The rest of this section gives some tips on how to set up shortcuts that run Scheme. If you are unfamiliar with this concept you should read about it in the system help.

- Under Windows NT, Windows 2000, or Windows XP, shortcuts can be common or personal. When setting common shortcuts it is important to make the shortcut properties independent of the vagaries of the environment of the user who is running them.

- Give the shortcut an accurate Description.

- Include absolute pathnames to ``scheme.exe`' and ``bchscheme.exe`' in the shortcut Command line.

- If you specify the `-library` command-line option then you do not have to worry about the `MITSCHEME_LIBRARY_PATH` environment variable.

- Set the shortcut's Working Directory to something sensible. On Windows NT/2000/XP you can use ``%HOMEDRIVE%%HOMEPATH%`' to make Scheme start up in the user's home directory. On Windows 9x/ME you can use ``%HOME%`' to achieve the same effect, provided that you have set the `HOME` environment variable as we recommend.

- There are several icons available in the Scheme executable -- choose one that best represents the options given on the command line.

- Specifying a band that contains Edwin is not sufficient to invoke the editor. You also have to put `-edit` at the end of the command line.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 2.8 Leaving Scheme

There are several ways that you can leave Scheme: there are two Scheme procedures that you can call; there are several Edwin commands that you can execute; and there are are graphical-interface buttons (and their associated keyboard accelerators) that you can activate.

- Two Scheme procedures that you can call. 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 procedure suspends Scheme; when this is done you may later restart where you left off. Unfortunately this is not possible in all operating systems; currently it works under unix versions that support job control (i.e. all of the unix versions for which we distribute Scheme). To suspend Scheme, evaluate

      (quit)

  If your system supports suspension, this will cause Scheme to stop, and you will be returned to the shell. Scheme remains stopped, and can be continued using the job-control commands of your shell. If your system doesn't support suspension, this procedure does nothing. (Calling the `quit` procedure is analogous to typing `C-z`, but it allows Scheme to respond by typing a prompt when it is unsuspended.)

- Several Edwin commands that you can execute, including `save-buffers-kill-scheme`, normally bound to `C-x C-c`, and `suspend-scheme`, normally bound to `C-x C-z`. These two commands correspond to the procedures `exit` and `quit`, respectively.

- Graphical-interface buttons that you can activate. Under OS/2 and Windows, closing the console window (Scheme's main window) causes Scheme to be terminated. Under any operating system, closing an Edwin window causes that window to go away, and if it is the only Edwin window, it terminates Scheme as well.

  Under OS/2, there are two distinct ways to close the console window. The first is to use any of the usual window-closing methods, such as the ``Close`' system-menu item or double-clicking on the system-menu icon. When this is done, you will be presented with a dialog that gives you the option to close the window with or without termating Scheme. The second way is to select the ``Exit`' item from the ``File`' menu, which terminates Scheme immediately with no dialog.

[ << ] | [ >> ] |  |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

This document was generated by Chris Hanson on June, 17 2002 using texi2html