123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701 |
- <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <!--
- Generated from manual.tex by tex2page, v 20050501
- (running on MzScheme 299.400, unix),
- (c) Dorai Sitaram,
- http://www.ccs.neu.edu/~dorai/tex2page/tex2page-doc.html
- -->
- <head>
- <title>
- The Incomplete Scheme 48 Reference Manual for release 1.6
- </title>
- <link rel="stylesheet" type="text/css" href="manual-Z-S.css" title=default>
- <meta name=robots content="noindex,follow">
- </head>
- <body>
- <div id=content>
- <div align=right class=navigation><i>[Go to <span><a href="manual.html">first</a>, <a href="manual-Z-H-4.html">previous</a></span><span>, <a href="manual-Z-H-6.html">next</a></span> page<span>; </span><span><a href="manual-Z-H-2.html#node_toc_start">contents</a></span><span><span>; </span><a href="manual-Z-H-13.html#node_index_start">index</a></span>]</i></div>
- <p></p>
- <a name="node_chap_3"></a>
- <h1 class=chapter>
- <div class=chapterheading><a href="manual-Z-H-2.html#node_toc_node_chap_3">Chapter 3</a></div><br>
- <a href="manual-Z-H-2.html#node_toc_node_chap_3">Command processor</a></h1>
- <p></p>
- <p>
- This chapter details Scheme 48's command processor, which incorporates
- both a read-eval-print loop and an interactive debugger.
- At the <tt>></tt> prompt, you can type either a Scheme form
- (expression or definition) or a command beginning with a comma.
- In
- inspection mode (see section <a href="#node_sec_3.7">3.7</a>)
- the prompt changes to <tt>:</tt> and commands
- no longer need to be preceded by a comma; input beginning with
- a letter or digit is assumed to be a command, not an expression.
- In inspection mode the command processor prints out a
- menu of selectable components for the current object of interest.</p>
- <p>
- </p>
- <a name="node_sec_3.1"></a>
- <h2><a href="manual-Z-H-2.html#node_toc_node_sec_3.1">3.1 Current focus value and <tt>##</tt></a></h2>
- <p>The command processor keeps track of a current <em>focus value</em>.
- This value is normally the last value returned by a command.
- If a command returns multiple values the focus object is a list of the
- values.
- The focus value is not changed if a command returns no values or
- a distinguished `unspecific' value.
- Examples of forms that return this unspecific value are definitions,
- uses of <tt>set!</tt>, and <tt>(if #f 0)</tt>.
- It prints as <tt>#{Unspecific}</tt>.</p>
- <p>
- The reader used by the command processor reads <tt>##</tt> as a special
- expression that evaluates to the current focus object.
- </p>
- <pre class=verbatim>> (list 'a 'b)
- '(a b)
- > (car ##)
- 'a
- > (symbol->string ##)
- "a"
- > (if #f 0)
- #{Unspecific}
- > ##
- "a"
- >
- </pre><p></p>
- <p>
- </p>
- <a name="node_sec_3.2"></a>
- <h2><a href="manual-Z-H-2.html#node_toc_node_sec_3.2">3.2 Command levels</a></h2>
- <p>If an error, keyboard interrupt, or other breakpoint occurs, or the
- <tt>,push</tt> command is used, the command
- processor invokes a recursive copy of itself, preserving the dynamic state of
- the program when the breakpoint occured.
- The recursive invocation creates a new <em>command level</em>.
- The command levels form a stack with the current level at the top.
- The command prompt indicates the number of stopped levels below the
- current one: <tt>></tt> or <tt>:</tt> for the
- base level and <tt><i>n</i>></tt> or <tt><i>n</i>:</tt> for all other levels,
- where <i>n</i> is the command-level nesting depth.
- The <tt>levels</tt> setting
- described below can be used to disable the automatic pushing of new levels.</p>
- <p>
- The command processor's evaluation package and the value of the
- current focus value are local to each command level.
- They are preserved when a new level is pushed and restored when
- it is discarded.
- The settings of all other settings are shared by all command levels.</p>
- <p>
- </p>
- <dl><dt></dt><dd>
- </dd><dt></dt><dd><eof><br>
- Discards the current command level and resumes running the level down.
- <eof> is usually
- control-<tt>D</tt> at a Unix shell or control-<tt>C</tt> control-<tt>D</tt> using
- the Emacs <tt>cmuscheme48</tt> library.<p>
- </p>
- </dd><dt></dt><dd><tt>,pop</tt><br>
- The same as <eof>.<p>
- </p>
- </dd><dt></dt><dd><tt>,proceed [<i>exp</i> <tt>...</tt></tt>]<br>
- Proceed after an interrupt or error, resuming the next command
- level down, delivering the values of <i>exp <tt>...</tt></i> to the continuation.
- Interrupt continuations discard any returned values.
- <tt>,Pop</tt> and <tt>,proceed</tt> have the same effect after an interrupt
- but behave differently after errors.
- <tt>,Proceed</tt> restarts the erroneous computation from the point where the
- error occurred (although not all errors are proceedable) while
- <tt>,pop</tt> (and <eof>) discards it and prompts for
- a new command.<p>
- </p>
- </dd><dt></dt><dd><tt>,push</tt><br>
- Pushes a new command level on above the current one.
- This is useful if the <tt>levels</tt> setting has been used
- to disable the automatic pushing of new levels for errors and interrupts.<p>
- </p>
- </dd><dt></dt><dd><tt>,reset [<i>number</i>]</tt><br>
- Pops down to a given level and restarts that level.
- <i>Number</i> defaults to zero, <tt>,reset</tt> restarts the command
- processor, discarding all existing levels.<p>
- </p>
- </dd></dl><p></p>
- <p>
- Whenever moving to an existing level, either by sending
- an <eof>
- or by using <tt>,reset</tt> or the other commands listed above,
- the command processor runs all of the <tt>dynamic-wind</tt> ``after'' thunks
- belonging to stopped computations on the discarded level(s).</p>
- <p>
- </p>
- <a name="node_sec_3.3"></a>
- <h2><a href="manual-Z-H-2.html#node_toc_node_sec_3.3">3.3 Logistical commands</a></h2>
- <p></p>
- <dl><dt></dt><dd>
- </dd><dt></dt><dd><tt>,load <i>filename <tt>...</tt></i></tt><br>
- Loads the named Scheme source file(s).
- Easier to type than <tt>(load "<i>filename</i>")</tt> because you don't have to
- shift to type the parentheses or quote marks.
- (However, it is still possible to specify a filename as a Scheme
- string literal, with quote marks -- you'll need this for filenames
- containing whitespace.)
- Also, it works in
- any package, unlike <tt>(load "<i>filename</i>")</tt>, which will work only
- work in packages in which the variable <tt>load</tt> is defined appropriately.<p>
- </p>
- </dd><dt></dt><dd><tt>,exit [<i>exp</i>]</tt>
- Exits back out to shell (or executive or whatever invoked Scheme 48
- in the first place).
- <i>Exp</i> should evaluate to an integer. The
- integer is returned to the calling program.
- The default value of <i>exp</i> is zero, which, on Unix,
- is generally interpreted as success.
- </dd></dl><p></p>
- <p>
- </p>
- <a name="node_sec_3.4"></a>
- <h2><a href="manual-Z-H-2.html#node_toc_node_sec_3.4">3.4 Module commands</a></h2>
- <p></p>
- <p>
- There are many commands related to modules.
- Only the most commonly used module commands are described here;
- documentation for the
- rest can be found in section <a href="manual-Z-H-6.html#node_sec_4.8">4.8</a>.
- There is also
- a brief description of modules, structures, and packages in section <a href="manual-Z-H-4.html#node_sec_2.6">2.6</a> below.</p>
- <p>
- </p>
- <dl><dt></dt><dd>
- </dd><dt></dt><dd><tt>,open <i>structure <tt>...</tt></i></tt><br>
- Makes the bindings in the <i>structure</i>s visible in the current package.
- The packages associated with the <i>structure</i>s will be loaded if
- this has not already been done (the <tt>ask-before-loading</tt> setting
- can be used disable the automatic loading of packages).<p>
- </p>
- </dd><dt></dt><dd><tt>,config [<i>command</i>]</tt><br>
- Executes <i>command</i> in the <tt>config</tt> package, which includes
- the module configuration language.
- For example, use
- <pre class=verbatim>,config ,load <i>filename</i>
- </pre><p>
- to load a file containing module definitions.
- If no <i>command</i> is given, the <tt>config</tt> package becomes the
- execution package for future commands.</p>
- <p>
- </p>
- </dd><dt></dt><dd><tt>,user [<i>command</i>]</tt> <br>
- This is similar to the <tt>,config</tt>. It
- moves to or executes a command in the user package (which is the
- default package when the Scheme 48 command processor starts).<p>
- </p>
- </dd></dl><p></p>
- <p>
- </p>
- <a name="node_sec_3.5"></a>
- <h2><a href="manual-Z-H-2.html#node_toc_node_sec_3.5">3.5 Debugging commands</a></h2>
- <p></p>
- <p>
- </p>
- <dl><dt></dt><dd>
- </dd><dt></dt><dd><tt>,preview</tt><br>
- Somewhat like a backtrace, but because of tail recursion you see
- less than you might in debuggers for some other languages.
- The stack to display is chosen as follows:
- <ol>
- <li><p>If the current focus object is a continuation or a thread,
- then that continuation or thread's stack is displayed.
- </p>
- <li><p>Otherwise, if the current command level was initiated because of
- a breakpoint in the next level down, then the stack at that
- breakpoint is displayed.
- </p>
- <li><p>Otherwise, there is no stack to display and a message is printed
- to that effect.
- </p>
- </ol><p>
- One line is printed out for each continuation on the chosen stack,
- going from top to bottom.</p>
- <p>
- </p>
- </dd><dt></dt><dd><tt>,run <i>exp</i></tt><br>
- Evaluate <i>exp</i>, printing the result(s) and making them
- (or a list of them, if <i>exp</i> returns multiple results)
- the new focus object.
- The <tt>,run</tt> command is useful when writing
- command programs, which are described in section <a href="#node_sec_3.8">3.8</a> below.<p>
- </p>
- </dd><dt></dt><dd><tt>,trace <i>name</i> <tt>...</tt></tt><br>
- Start tracing calls to the named procedure or procedures.
- With no arguments, displays all procedures currently traced.
- This affects the binding of <i>name</i>, not the behavior of the
- procedure that is its current value. <i>Name</i> is redefined
- to be a procedure that prints a message,
- calls the original value of <i>name</i>, prints another
- message, and finally passes along the value(s) returned by the
- original procedure.<p>
- </p>
- </dd><dt></dt><dd><tt>,untrace <i>name</i> <tt>...</tt></tt><br>
- Stop tracing calls to the named procedure or procedures.
- With no argument, stop tracing all calls to all procedures.<p>
- </p>
- </dd><dt></dt><dd><tt>,condition</tt><br>
- The <tt>,condition</tt> command displays the condition object
- describing the error or interrupt that initiated the current
- command level. The condition object becomes the current focus
- value. This is particularly useful in conjunction with
- the inspector. For example, if a procedure is passed the wrong number of
- arguments, do <tt>,condition</tt> followed by
- <tt>,inspect</tt> to inspect the
- procedure and its arguments.<p>
- </p>
- </dd><dt></dt><dd><tt>,bound? <i>name</i></tt><br>
- Display the binding of <i>name</i>, if there is one, and otherwise
- prints `<tt>Not bound</tt>'.<p>
- </p>
- </dd><dt></dt><dd><tt>,expand <i>form</i></tt>
- </dd><dt></dt><dd><tt>,expand-all <i>form</i></tt><br>
- Show macro expansion of <i>form</i>, if any.
- <tt>,expand</tt> performs a single macro expansion while
- <tt>,expand-all</tt> fully expands all macros in <i>form</i>.<p>
- </p>
- </dd><dt></dt><dd><tt>,where <i>procedure</i></tt><br>
- Display name of file containing <i>procedure</i>'s source code.
- </dd></dl><p></p>
- <p>
- </p>
- <a name="node_sec_3.6"></a>
- <h2><a href="manual-Z-H-2.html#node_toc_node_sec_3.6">3.6 Settings</a></h2>
- <p>There are a number of settings that control the behavior of the
- command processor; most of them are booleans.
- They can be set using the <tt>,set</tt> and <tt>,unset</tt> commands.</p>
- <p>
- </p>
- <dl><dt></dt><dd>
- </dd><dt></dt><dd><tt>,set <i>setting</i> [on | off | literal | ?]</tt><br>
- This sets the value of setting <i>setting</i>.
- For a boolean setting, the second argument must be <tt>on</tt> or
- <tt>off</tt>; it then defaults to <tt>on</tt>.
- Otherwise, the value must be a literal, typically a posititive number.
- If the second argument is <tt>?</tt> the value of <i>setting</i> is
- is displayed and not changed.
- Doing <tt>,set ?</tt> will display a list of the setting and
- their current values.<p>
- </p>
- </dd><dt></dt><dd><tt>,unset <i>setting</i></tt><br>
- <tt>,unset <i>setting</i></tt> is the same as
- <tt>,set <i>setting</i> off</tt>.
- </dd></dl><p></p>
- <p>
- The settings are as follows:
- </p>
- <dl><dt></dt><dd>
- </dd><dt></dt><dd><tt>batch</tt> (boolean)<br>
- In `batch mode' any error or interrupt that comes up will cause
- Scheme 48 to exit immediately with a non-zero exit status. Also,
- the command processor doesn't print prompts. Batch mode is
- off by default.<p>
- </p>
- <p>
- </p>
- </dd><dt></dt><dd><tt>levels</tt> (boolean)<br>
- Enables or disables the automatic pushing of a new command level when
- an error, interrupt, or other breakpoint occurs.
- When enabled (the default), breakpoints push a new command level,
- and <eof> (see above)
- or <tt>,reset</tt> is required to return to top level. The effects of
- pushed command levels include:
- <ul>
- <li><p>a longer prompt
- </p>
- <li><p>retention of the continuation in effect at the point of errors
- </p>
- <li><p>confusion among some newcomers
- </p>
- </ul><p>
- With <tt>levels</tt> disabled one must issue a
- <tt>,push</tt> command immediately
- following an error in order to retain the error continuation for
- debugging purposes; otherwise the continuation is lost as soon as
- the focus object changes. If you don't know anything about the
- available debugging tools, then levels might as well be disabled.</p>
- <p>
- </p>
- </dd><dt></dt><dd><tt>break-on-warnings</tt> (boolean)<br>
- Enter a new command level when a warning is produced, just as
- when an error occurs. Normally warnings only result in a displayed
- message and the program does not stop executing.<p>
- </p>
- </dd><dt></dt><dd><tt>ask-before-loading</tt> (boolean)<br>
- If on, the system will ask before loading modules that are arguments
- to the <tt>,open</tt> command. <tt>Ask-before-loading</tt> is off by
- default.
- <pre class=verbatim>> ,set ask-before-loading
- will ask before loading modules
- > ,open random
- Load structure random (y/n)? y
- >
- </pre><p></p>
- <p>
- </p>
- </dd><dt></dt><dd><tt>load-noisily</tt> (boolean)<br>
- When on, the system will print out the names of modules and files
- as they are loaded. <tt>load-noisily</tt> is off by default.
- <pre class=verbatim>> ,set load-noisily
- will notify when loading modules and files
- > ,open random
- [random /usr/local/lib/scheme48/big/random.scm]
- >
- </pre><p></p>
- <p>
- </p>
- </dd><dt></dt><dd><tt>inline-values</tt> (boolean)<br>
- This controls whether or not the compiler is allowed to substitute
- variables' values in-line.
- When <tt>inline-values</tt> mode is on,
- some Scheme procedures will be substituted in-line; when it is off,
- none will.
- Section <a href="manual-Z-H-4.html#node_sec_2.4">2.4</a>
- has more information.<p>
- </p>
- </dd><dt></dt><dd><tt>inspector-menu-limit</tt> (positive integer)<br>
- This controls how many items the displayed portion of the inspector
- menu contains at most. (See Section <a href="#node_sec_3.7">3.7</a>.)<p>
- </p>
- </dd><dt></dt><dd><tt>inspector-writing-depth</tt> (positive integer)<br>
- This controls the maximum depth to which the inspector
- prints values. (See Section <a href="#node_sec_3.7">3.7</a>.)<p>
- </p>
- </dd><dt></dt><dd><tt>inspector-writing-length</tt> (positive integer)<br>
- This controls the maximum length to which the inspector
- prints values. (See Section <a href="#node_sec_3.7">3.7</a>.)<p>
- </p>
- </dd><dt></dt><dd><tt>condition-writing-depth</tt> (positive integer)<br>
- This controls the maximum depth to which conditions
- are printed.<p>
- </p>
- </dd><dt></dt><dd><tt>condition-writing-length</tt> (positive integer)<br>
- This controls the maximum length to which conditions
- are printed.<p>
- </p>
- </dd><dt></dt><dd><tt>trace-writing-length</tt> (positive integer)<br>
- This controls the maximum length to which tracing
- prints procedure calls.
- </dd></dl><p></p>
- <p>
- </p>
- <a name="node_sec_3.7"></a>
- <h2><a href="manual-Z-H-2.html#node_toc_node_sec_3.7">3.7 Inspection mode</a></h2>
- <p></p>
- <p>
- There is a data inspector available via the <tt>,inspect</tt> and
- <tt>,debug</tt> commands.
- The inspector is particularly useful with procedures, continuations,
- and records.
- The command processor can be taken out of inspection mode by
- using the <tt>q</tt> command.
- When in inspection mode, input that begins with
- a letter or digit is read as a command, not as an expression.
- To see the value of a variable or number, do <tt>(begin <i>exp</i>)</tt>
- or use the <tt>,run <i>exp</i></tt> command.</p>
- <p>
- In inspection mode the command processor prints out a
- menu of selectable components for the current focus object.
- To inspect a particular component, just type the corresponding number in
- the menu.
- That component becomes the new focus object.
- For example:
- </p>
- <pre class=verbatim>> ,inspect '(a (b c) d)
- (a (b c) d)
- [0] a
- [1] (b c)
- [2] d
- : 1
- (b c)
- [0] b
- [1] c
- :
- </pre><p></p>
- <p>
- When a new focus object is selected the previous one is pushed onto a
- stack.
- You can pop the stack, reverting to the previous object, with
- the <tt>u</tt> command, or use the <tt>stack</tt> command to move to
- an earlier object.</p>
- <p>
- </p>
- <p>
- Commands useful when in inspection mode:
- </p>
- <ul>
- <li><p><tt>u</tt> (up) pop object stack
- </p>
- <li><p><tt>m</tt> (more) print more of a long menu
- </p>
- <li><p><tt>(<tt>...</tt>)</tt> evaluate a form and select result
- </p>
- <li><p><tt>q</tt> quit
- </p>
- <li><p><tt>template</tt> select a closure or continuation's template
- (Templates are the static components of procedures; these are found
- inside of procedures and continuations, and contain the quoted
- constants and top-level variables referred to by byte-compiled code.)
- </p>
- <li><p><tt>d</tt> (down) move to the next continuation
- (current object must be a continuation)
- </p>
- <li><p><tt>menu</tt> print the selection menu for the focus object
- </p>
- </ul><p></p>
- <p>
- Multiple selection commands (<tt>u</tt>, <tt>d</tt>, and menu indexes)
- may be put on a single line.</p>
- <p>
- </p>
- <p>
- All ordinary commands are available when in inspection mode.
- Similarly, the inspection commands can be used when not in inspection
- mode.
- For example:
- </p>
- <pre class=verbatim>> (list 'a '(b c) 'd)
- '(a (b c) d)
- > ,1
- '(b c)
- > ,menu
- [0] b
- [1] c
- >
- </pre><p></p>
- <p>
- If the current command level was initiated because of
- a breakpoint in the next level down, then
- <tt>,debug</tt> will invoke the inspector on the
- continuation at the point of the error.
- The <tt>u</tt> and <tt>d</tt> (up and down)
- commands then make the inspected-value stack look like a conventional stack
- debugger, with continuations playing the role of stack frames. <tt>D</tt> goes
- to older or deeper continuations (frames), and <tt>u</tt> goes back up to more
- recent ones.</p>
- <p>
- </p>
- <a name="node_sec_3.8"></a>
- <h2><a href="manual-Z-H-2.html#node_toc_node_sec_3.8">3.8 Command programs</a></h2>
- <p></p>
- <p>
- The <tt>exec</tt> package contains procedures that are used
- to execute the command processor's commands.
- A command <tt>,<i>foo</i></tt> is executed by applying the value of
- the identifier <i>foo</i> in the <tt>exec</tt> package to
- the (suitably parsed) command arguments.</p>
- <p>
- </p>
- <dl><dt></dt><dd>
- </dd><dt></dt><dd><tt>,exec [<i>command</i>]</tt><br>
- Evaluate <i>command</i> in the <tt>exec</tt> package.
- For example, use
- <pre class=verbatim>,exec ,load <i>filename</i>
- </pre><p>
- to load a file containing commands.
- If no <i>command</i> is given, the <tt>exec</tt> package becomes the
- execution package for future commands.
- </p>
- </dd></dl><p></p>
- <p>
- The required argument types are as follows:
- </p>
- <ul>
- <li><p>filenames should be strings
- </p>
- <li><p>other names and identifiers should be symbols
- </p>
- <li><p>expressions should be s-expressions
- </p>
- <li><p>commands (as for <tt>,config</tt> and <tt>,exec</tt> itself)
- should be lists of the form
- <tt>(<i>command-name</i> <i>argument</i> <i>...</i>)</tt>
- where <i>command-name</i> is a symbol.
- </p>
- </ul><p></p>
- <p>
- For example, the following two commands are equivalent:
- </p>
- <pre class=verbatim>,config ,load my-file.scm
- ,exec (config '(load "my-file.scm"))
- </pre><p></p>
- <p>
- The file <tt>scheme/vm/load-vm.scm</tt> in the source directory contains an
- example of an <tt>exec</tt> program.</p>
- <p>
- </p>
- <a name="node_sec_3.9"></a>
- <h2><a href="manual-Z-H-2.html#node_toc_node_sec_3.9">3.9 Building images</a></h2>
- <p></p>
- <dl><dt></dt><dd>
- </dd><dt></dt><dd><tt>,dump <i>filename</i> [<i>identification</i>]</tt><br>
- Writes the current heap out to a file, which can then be run using the
- virtual machine. The new image file includes the command processor.
- If present, <i>identification</i>
- should be a string (written with double quotes); this string will
- be part of the greeting message as the image starts up.<p>
- </p>
- </dd><dt></dt><dd><tt>,build <i>exp</i> <i>filename</i> [<i>option <tt>...</tt></i>]</tt><br>
- Like <tt>,dump</tt>, except that the image file contains the value of
- <i>exp</i>, which should be a procedure of one argument, instead of
- the command processor. When
- <i>filename</i> is resumed, that procedure will be invoked on the VM's
- <tt>-a</tt> arguments, which are passed as a list of OS strings (see
- section <a href="manual-Z-H-7.html#node_sec_5.15">5.15</a>. The
- procedure should return an integer which is
- returned to the program that invoked the VM. The command
- processor and debugging system are not included in the image
- (unless you go to some effort to preserve them, such as retaining
- a continuation).<p>
- If <tt>no-warnings</tt> appears as an <i>option</i> after the file
- name, no warnings about undefined external bindings
- (see Section <a href="manual-Z-H-10.html#node_sec_8.2">8.2</a>) will be printed upon
- resuming the image. This is useful when the definitions of
- external bindings appear in shared objects that are only loaded
- after the resumption of the image.</p>
- <p>
- Doing <tt>,flush</tt> before building an image will reduce the amount
- of debugging information in the image, making for a smaller
- image file, but if an error occurs, the error message may be less
- helpful. Doing <tt>,flush source maps</tt> before loading any programs
- used in the image will make it still smaller.
- See section <a href="#node_sec_3.10">3.10</a>
- for more information.</p>
- <p>
- </p>
- </dd></dl><p></p>
- <p>
- </p>
- <a name="node_sec_3.10"></a>
- <h2><a href="manual-Z-H-2.html#node_toc_node_sec_3.10">3.10 Resource query and control</a></h2>
- <p>.</p>
- <p>
- </p>
- <dl><dt></dt><dd>
- </dd><dt></dt><dd><tt>,time <i>exp</i></tt><br>
- Measure execution time.<p>
- </p>
- </dd><dt></dt><dd><tt>,collect</tt><br>
- Invoke the garbage collector. Ordinarily this happens
- automatically, but the command tells how much space is available
- before and after the collection.<p>
- </p>
- </dd><dt></dt><dd><tt>,keep <i>kind</i></tt>
- </dd><dt></dt><dd><tt>,flush <i>kind</i></tt><br>
- These control the amount of debugging information retained after
- compiling procedures. This information can consume a fair amount
- of space. <i>kind</i> is one of the following:
- <ul>
- <li><p><tt>maps</tt> - environment maps (local variable names, for inspector)
- </p>
- <li><p><tt>source</tt> - source code for continuations (displayed by inspector)
- </p>
- <li><p><tt>names</tt> - procedure names (as displayed by <tt>write</tt> and in error
- messages)
- </p>
- <li><p><tt>files</tt> - source file names
- </p>
- </ul><p>
- These commands refer to future compilations only, not to procedures
- that already exist. To have any effect, they must be done before
- programs are loaded. The default is to keep all four types.
- </p>
- <p>
- </p>
- </dd><dt></dt><dd><tt>,flush</tt><br>
- The flush command with no argument deletes the database of names
- of initial procedures. Doing <tt>,flush</tt> before a <tt>,build</tt> or
- <tt>,dump</tt>
- will make the resulting image significantly smaller, but will
- compromise the information content of many error
- messages.
- </dd></dl><p></p>
- <p>
- </p>
- <a name="node_sec_3.11"></a>
- <h2><a href="manual-Z-H-2.html#node_toc_node_sec_3.11">3.11 Threads</a></h2>
- <p></p>
- <p>
- Each command level has its own set of threads. These threads are suspended
- when a new level is entered and resumed when the owning level again becomes
- the current level.
- A thread that raises an error is not resumed unless
- explicitly restarted using the <tt>,proceed</tt> command.
- In addition to any threads spawned by the user, each level has a thread
- that runs the command processor on that level.
- A new command-processor thread is started if the current one
- dies or is terminated.
- When a command level is abandoned for a lower level, or when
- a level is restarted using <tt>,reset</tt>, all of the threads on that
- level are terminated and any <tt>dynamic-wind</tt> ``after'' thunks are run.</p>
- <p>
- The following commands are useful when debugging multithreaded programs:
- </p>
- <dl><dt></dt><dd>
- </dd><dt></dt><dd><tt>,resume [<i>number</i>]</tt><br>
- Pops out to a given level and resumes running all threads at that level.
- <i>Number</i> defaults to zero.<p>
- </p>
- </dd><dt></dt><dd><tt>,threads</tt><br>
- Invokes the inspector on a list of the threads running at the
- next lower command level.<p>
- </p>
- </dd><dt></dt><dd><tt>,exit-when-done [<i>exp</i>]</tt><br>
- Waits until all user threads have completed and then
- exits back out to shell (or executive or whatever invoked Scheme 48
- in the first place).
- <i>Exp</i> should evaluate to an integer which is then
- returned to the calling program.
- <p>
- </p>
- <p>
- </p>
- </dd></dl><p></p>
- <p>
- </p>
- <a name="node_sec_3.12"></a>
- <h2><a href="manual-Z-H-2.html#node_toc_node_sec_3.12">3.12 Quite obscure</a></h2>
- <p></p>
- <dl><dt></dt><dd>
- </dd><dt></dt><dd><tt>,go <i>exp</i></tt><br>
- This is like <tt>,exit <i>exp</i></tt> except that the evaluation of <i>exp</i>
- is tail-recursive with respect to the command processor. This
- means that the command processor itself can probably be GC'ed,
- should a garbage collection occur in the execution of <i>exp</i>.
- If an error occurs Scheme 48 will exit with a non-zero value.<p>
- </p>
- </dd><dt></dt><dd><tt>,translate <i>from</i> <i>to</i></tt><br>
- For <tt>load</tt> and the <tt>,load</tt> command
- (but not for <tt>open-{in|out}put-file</tt>), file
- names beginning with the string <i>from</i> will be changed so that the
- initial <i>from</i> is replaced by the string <i>to</i>. E.g.
- <pre class=verbatim><tt>,translate /usr/gjc/ /zu/gjc/</tt>
- </pre><p>
- will cause <tt>(load "/usr/gjc/foo.scm")</tt> to have the same effect as
- <tt>(load "/zu/gjc/foo.scm")</tt>.
- </p>
- <p>
- </p>
- </dd><dt></dt><dd><tt>,from-file <i>filename</i> <i>form</i> <tt>...</tt> ,end</tt><br>
- This is used by the <tt>cmuscheme48</tt> Emacs library to indicate the file
- from which the <i>form</i>s came. <i>Filename</i> is then used by the
- command processor to determine the package in which the <i>form</i>s
- are to be evaluated.
- </dd></dl><p></p>
- <p>
- </p>
- <div align=right class=navigation><i>[Go to <span><a href="manual.html">first</a>, <a href="manual-Z-H-4.html">previous</a></span><span>, <a href="manual-Z-H-6.html">next</a></span> page<span>; </span><span><a href="manual-Z-H-2.html#node_toc_start">contents</a></span><span><span>; </span><a href="manual-Z-H-13.html#node_index_start">index</a></span>]</i></div>
- <p></p>
- </div>
- </body>
- </html>
|