Next: Image-building commands, Previous: Inspector, Up: Command processor
The Scheme48 command processor can be controlled programmatically by command programs, programs written in the exec language. This language is essentially a mirror of the commands but in a syntax using S-expressions. The language also includes all of Scheme. The exec language is defined as part of the exec package.
Sets the interaction environment to be the exec package. If an argument is passed, it is set temporarily, only to run the given command.
Commands in the exec language are invoked as procedures in Scheme. Arguments should be passed as follows:
(in
'frobbotz)
.
(dump "frob.image")
.
(in
'mumble '(undefine frobnicate))
, even though simply `,undefine
frobnicate' would become (undefine 'frobnicate)
.
The reason for this is that the command invocation in the exec language is different from a list that represents a command invocation passed as an argument to another command; since commands in the exec language are ordinary procedures, the arguments must be quoted, but the quoted arguments are not themselves evaluated: they are applied as commands.
An argument to a command that expects a command invocation can also be
a procedure, which would simply be called with zero arguments. For
instance, (config (lambda () (display (interaction-environment))
(newline)))
will call the given procedure with the interaction
environment set to the config package.
(user '(run (+ 1 2)))
.
Command programs can be loaded by running the ,load command
in the exec package. Scripts to load application bundles are usually
written in the exec language and loaded into the exec package. For
example, this command program, when loaded into the exec package, will
load foo.scm into the config package, ensure that the package
frobbotzim
is loaded, and open the quuxim
structure in
the user package:
(config '(load "foo.scm")) (load-package 'frobbotzim) (user '(open quuxim))