Next: System Interface, Previous: Standards Support, Up: Other Packages [Contents][Index]
If (provided? 'abort)
:
Resumes the top level Read-Eval-Print loop. If provided, abort
is used by the break
and debug
packages.
Next: Quick Print, Previous: Session Support, Up: Session Support [Contents][Index]
(require 'repl)
Here is a read-eval-print-loop which, given an eval, evaluates forms.
read
s, repl:eval
s and write
s expressions from
(current-input-port)
to (current-output-port)
until an
end-of-file is encountered. load
, slib:eval
,
slib:error
, and repl:quit
dynamically bound during
repl:top-level
.
Exits from the invocation of repl:top-level
.
The repl:
procedures establish, as much as is possible to do
portably, a top level environment supporting macros.
repl:top-level
uses dynamic-wind
to catch error conditions
and interrupts. If your implementation supports this you are all set.
Otherwise, if there is some way your implementation can catch error
conditions and interrupts, then have them call slib:error
. It
will display its arguments and reenter repl:top-level
.
slib:error
dynamically bound by repl:top-level
.
To have your top level loop always use macros, add any interrupt catching lines and the following lines to your Scheme init file:
(require 'macro) (require 'repl) (repl:top-level macro:eval)
Next: Debug, Previous: Repl, Up: Session Support [Contents][Index]
(require 'qp)
When displaying error messages and warnings, it is paramount that the output generated for circular lists and large data structures be limited. This section supplies a procedure to do this. It could be much improved.
Notice that the neccessity for truncating output eliminates Common-Lisp’s Format (version 3.1) from consideration; even when variables
*print-level*
and*print-level*
are set, huge strings and bit-vectors are not limited.
qp
writes its arguments, separated by spaces, to
(current-output-port)
. qp
compresses printing by
substituting ‘...’ for substructure it does not have sufficient
room to print. qpn
is like qp
but outputs a newline
before returning. qpr
is like qpn
except that it returns
its last argument.
*qp-width* is the largest number of characters that qp
should use. If *qp-width* is #f, then all items will be
write
n. If *qp-width* is 0, then all items except
procedures will be write
n; procedures will be indicated by
‘#[proc]’.
Next: Breakpoints, Previous: Quick Print, Up: Session Support [Contents][Index]
(require 'debug)
Requiring debug
automatically requires trace
and
break
.
An application with its own datatypes may want to substitute its own
printer for qp
. This example shows how to do this:
(define qpn (lambda args) …) (provide 'qp) (require 'debug)
Breakpoints (see Breakpoints) all procedures define
d at
top-level in file ….
Next: Tracing, Previous: Debug, Up: Session Support [Contents][Index]
(require 'break)
If your Scheme implementation does not support break
or
abort
, a message will appear when you (require 'break)
or
(require 'debug)
telling you to type (init-debug)
. This
is in order to establish a top-level continuation. Typing
(init-debug)
at top level sets up a continuation for
break
.
Returns from the top level continuation and pushes the continuation from which it was called on a continuation stack.
Pops the topmost continuation off of the continuation stack and returns an unspecified value to it.
Pops the topmost continuation off of the continuation stack and returns arg1 … to it.
Redefines the top-level named procedures given as arguments so that
breakpoint
is called before calling proc1 ….
With no arguments, makes sure that all the currently broken identifiers are broken (even if those identifiers have been redefined) and returns a list of the broken identifiers.
Turns breakpoints off for its arguments.
With no arguments, unbreaks all currently broken identifiers and returns a list of these formerly broken identifiers.
These are procedures for breaking. If defmacros are not natively supported by your implementation, these might be more convenient to use.
To break, type
(set! symbol (breakf symbol))
or
(set! symbol (breakf symbol 'symbol))
or
(define symbol (breakf function))
or
(define symbol (breakf function 'symbol))
To unbreak, type
(set! symbol (unbreakf symbol))
Previous: Breakpoints, Up: Session Support [Contents][Index]
(require 'trace)
This feature provides three ways to monitor procedure invocations:
Pushes the procedure-name when the procedure is called; pops when it returns.
Pushes the procedure-name and arguments when the procedure is called; pops when it returns.
Pushes the procedure-name and prints ‘CALL procedure-name arg1 …’ when the procdure is called; pops and prints ‘RETN procedure-name value’ when the procedure returns.
If a traced procedure calls itself or untraced procedures which call it, stack, track, and trace will limit the number of stack pushes to debug:max-count.
Prints the call-stack to port or the current-error-port.
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.
Traces the top-level named procedures given as arguments.
With no arguments, makes sure that all the currently tracked identifiers are tracked (even if those identifiers have been redefined) and returns a list of the tracked identifiers.
Traces the top-level named procedures given as arguments.
With no arguments, makes sure that all the currently stacked identifiers are stacked (even if those identifiers have been redefined) and returns a list of the stacked identifiers.
Turns tracing, tracking, and off for its arguments.
With no arguments, untraces all currently traced identifiers and returns a list of these formerly traced identifiers.
Turns tracing, tracking, and off for its arguments.
With no arguments, untracks all currently tracked identifiers and returns a list of these formerly tracked identifiers.
Turns tracing, stacking, and off for its arguments.
With no arguments, unstacks all currently stacked identifiers and returns a list of these formerly stacked identifiers.
These are procedures for tracing. If defmacros are not natively supported by your implementation, these might be more convenient to use.
To trace, type
(set! symbol (tracef symbol))
or
(set! symbol (tracef symbol 'symbol))
or
(define symbol (tracef function))
or
(define symbol (tracef function 'symbol))
Removes tracing, tracking, or stacking for proc. To untrace, type
(set! symbol (untracef symbol))
Next: System Interface, Previous: Standards Support, Up: Other Packages [Contents][Index]