MrEd starts up with the following sequence:
A different system can be specified with the ``-s '' flag; this flag must be the fist command line flag and the system file name must be the next argument. (Command line flags on the Macintosh are discussed below.)
In addition to setting the MzScheme library path, the system defines two global path variables:
Both mred:system-source-directory and mred:plt-home-directory are normalized paths.
These are the recognized command-line flags:
-e The next argument
is evaluated as a Scheme expression. The -f flag can be specified
many times to load many files.
-f The next argument is treated as a Scheme filename and is
loaded. The -f flag can be specified many times to load many
files.
-nu This is used to specify a non-unit startup. See below
for more information.
-- If this flag is encountered, all remaining command line
areguments are treated as filenames and are opened for editing.
For example, this Unix shell command starts up MrEd with the default
system, defines testing to be #t, and loads the file
``myprog.ss'' and opens ``mynextprog.ss'' for editing
mred -e "(define testing #t)" -f myprog.ss mynextprog.ss
^ and mzlib:core^, and defines all of the identifiers in the signature mred:application^. That signed unit is then linked with mred@, to produce all of the system.
The user setup is not always loaded last. In general it is loaded when all
of the variables that begin with ``mred:'' are defined. So, if you
are using the ``-nu'' flag, the user setup is loaded before any of
the files on the command line are loaded and if you are not using the
``-nu'' flag, the user setup is loaded after all of the command line
arguments have been processed.
If you are writing your own MrEd application, you will need to redefine
mred:make-application@. It should return a signed unit matching the
mred:application^ signature. It should import identifiers
defined in
mred^ and in mzlib:core^. mred^
contains all of the
system, and mred:application^ contains two identifiers,
console and eval-string. console should be a
frame which will be used as the application's main frame. If it is not a
frame, MrEd will create a frame with only a quit button to be the
application's main frame. eval-string should take one argument, a
string, and evaluate it. If your application does not include an evaluator
eval-string can just return (void).
Also, you may want to redefine mred:make-invokable-unit. mred:make-invokable-unit builds a signed compound unit which links together the system and the result of mred:make-application@. If your applicatoin needs to change the linking interface, redefine mred:make-invokable-unit. See mrsystem.ss in the MrEd system directory for an example.
If you want to make a mred application without using units, pass -nu
on the command line before loading your files. If you use -nu, MrEd
will call mred:startup with no arguments and use the value that
mred:startup returns as the default application frame.
If the system is not found, or if there is an uncaught error while the system is loaded, then the load is aborted and a plain text editing window is opened.