#
Chapter 7
`cm.ss`: Compilation Manager

`(make-compilation-manager-load/use-compiled-handler``)` P R O C E D U R E

Returns a procedure suitable as a value for the `current-load/use-compiled` parameter (see section 7.7.1.6 in PLT MzScheme: Language Manual). The returned procedure passes it arguments on to the current `current-load/use-compiled` procedure (i.e., the one installed when this function is called), but first it automatically compiles source files to a `.zo` file if

- the file is expected to contain a module (i.e., the second argument to the handler is a symbol);

- the value of each of `current-eval`, `current-load`, and `current-namespace` is the same as when `make-compilation-manager-load/use-compiled-handler` was called;

- the value of `current-load/use-compiled` is the result of this function; and

- one of the following holds:

  - the source file is newer than the `.zo` file in the `compiled` subdirectory;

  - no `.dep` file exists next to the `.zo` file;

  - the version recorded in the `.dep` file does not match the result of `(`version`)`;

  - one of the files listed in the `.dep` file has a `.zo` timestamp newer than the one recorded in the `.dep` file.

After the handler procedure compiles a `.zo` file, it creates a corresponding `.dep` file that lists the current version, plus the `.zo` timestamp for every file that is `require`d by the module in the compiled file (including `require-for-syntax`es).

The handler caches timestamps when it checks `.dep` files, and the cache is maintained across calls to the same handler. The cache is not consulted to compare the immediate source file to its `.zo` file, which means that the caching behavior is consistent with the caching of the default module name resolver (see section 5.4 in PLT MzScheme: Language Manual).

`(managed-compile-zo``` `file``)` P R O C E D U R E

Compiles the given module source file to a `.zo`, installing a compilation-manager handler while the file is compiled (so that required modules are also compiled), and creating a `.dep` file to record the timestamps of immediate files used to compile the source (i.e., files `require`d in the source, including `require-for-syntax`es).

`(manager-trace-handler``` `proc``` [`procedure`]`)`

A parameter whose value is a procedure to return a trace string for compilation-manager actions. The procedure receives a single string argument, and its result is ignored.

`(trust-existing-zos``` `on?``` [`procedure`]`)`

A parameter that is intended for use by `Setup PLT` when installing with pre-built `.zo` files. It causes a compilation-manager load/use-compiled handler to ``touch'' out-of-date `.zo` files instead of re-compiling from source.