Yet another Defsystem
-Compiling and Loading a System

To compile and load or otherwise operate on a system, the function MK is used. MK stands for "Make", and its syntax is as follows:

    (mk <name>  <keyword-value-pairs>...)

The name is the name of a system, which should be defined in a file named "name.system" in a registry folder. To compile and load a system named "frobozz", just evaluate

    (mk :frobozz)

You can also use a string or a non-keyword symbol to specify the name of the system. YADS will load the system definition and compile and load each file as necessary. It will also require all needed modules, and recursively MK any systems the system depends on. No file or module will be loaded more than once, so circularities do not create any problems. If you have defined any :INITIALLY-DO or :FINALLY-DO forms, they will evaluated in due order.

Keywords

MK accepts the following keyword-value pairs:

• :ACTION defaults to :LOAD and is used to tell MK what operation to perform on the system. Its legal values are :LOAD, :COMPILE, :DELETE-BINARIES, :SEARCH, :REPLACE, :OPEN and :PRINT. More about these options a little further on in this document.

• :FORCE defaults to NIL. If true, it forces the loading and/or compilation of modules and files even if their update status shows that this is not necessary.

• :DRY defaults to NIL. If true, the current operation is a "dry run": the system will be unaffected, but messages will still be printed. This allows the user to explore how different MK commands would affect the system.

 :DEBUG defaults to NIL. If true, extensive debugging information is printed while the operation is in progress.

 :ARG1 and :ARG2 are used to pass arguments, for instance in search and replace situations.

Action Options

• :ACTION :LOAD is the default. MK goes through the files in the system, compiling and loading as necessary. If there is no source file for a particular binary, a warning is printed. If a binary can't be found or if it is old (meaning that its corresponding source file has been changed since the binary last was loaded), a new binary is produced and loaded. It is an error if the source file cannot be found. If :COMPILE-P is false for the component, a binary is not produced: the source file is loaded instead. External systems are compiled only if their :COMPILE-EXTERNAL-P flag is set; if not, and there is a more recent source in an external system, then that source file will be loaded instead of the obsolete binary.

• 
:ACTION :COMPILE is similar, but sources files are never loaded in absence of binaries, and all modules and systems depending on a module are also recompiled. There is rarely any need to use this option.

• :ACTION :DELETE-BINARIES removes all binaries belonging to this system. It does not remove binaries in external systems.

• :ACTION :SEARCH looks for the string given by the keyword :ARG1 among the sources of the system. A dialog box showing all matching files will be shown.

• :ACTION :REPLACE replaces one string by another, using :ARG1 for the search string and :ARG2 for the replacement string. It is currently unimplemented (="left as an exercise for the reader").

• :ACTION :OPEN looks for the source file named by :ARG1 and opens it for editing. If there are more than one file of the same name, all are opened.

• :ACTION :PRINT produces hardcopy of all files in a system.

Here are a few examples:
(mk :foo)
loads/compiles the system named "foo"
(mk :foo :action :load)
does the same thing
(mk :foo :dry t) prints messages as if foo was being loaded
(mk :foo :force t) compiles and loads sources even if it is not strictly necessary
(mk :foo :action :delete-binaries :dry t) shows which files would be deleted if all foo's binaries were removed
(mk :foo :action :search :arg1 "(defclass ") shows a list of all files containing "(defclass "
 (mk :foo :action :open :arg1 :globals opens any source file(s) named "Globals" for editing.

Command Abbreviations
A few operations are so common that we have defined "abbreviations" for them:
(MK-SEARCH system string)
searches for a given string
(MK-REPLACE system searchstr replacestr)
replaces a string with another string
(MK-OPEN system name) opens any source file(s) named name for editing
(MK-PRINT system) prints all files in the system

Editing the System Definition

The function MK-ED takes a system name and opens an editor window for that file, letting you edit the system definition:

    (mk-ed :baz)

The file "Baz.system" in the appropriate central registry folder will be opened for editing.

Obtaining a file list

Sometimes you need an list of all the source files of a system sorted by load order. This is sometimes handy if you need to produce a load file for somebody who is not using a DEFSYSTEM utility. The function FILE-COMPONENT-LIST is used to produce a load-ordered source file list. It takes two arguments:

    (file-component-list <name> <include-externals-p>)

The name is the name of a system. If include-externals-p is true, the list will include the files of all external systems loaded by :DEPENDS-ON forms as well (and any systems loaded by them in their turn, and so on).

    back to Defsystem mainpage