Several internal registers control the operation of CM. A register of
type
is accessible via a variable of type
controller,
i.e., a pair of get and set functions.5 Any invocation of the corresponding get function reads
the current value of the register. An invocation of the set
function replaces the current value with the argument given to
set.
Controllers are members of CM.Control, a sub-structure of structure CM.
type 'a controller = { get: unit -> 'a, set: 'a -> unit }
structure Control : sig
val verbose : bool controller
val debug : bool controller
val keep_going : bool controller
val parse_caching : int controller
val warn_obsolete : bool controller
val conserve_memory : bool controller
val generate_index : bool controller
end
CM.Control.verbose can be used to turn off CM's progress messages. The default is true and can be overriden at startup time by the environment variable CM_VERBOSE.
In the case of a compile-time error CM.Contol.keep_going instructs the CM.recomp phase to continue working on parts of the dependency graph that are not related to the error. (This does not work for outright syntax errors because a correct parse is needed before CM can construct the dependency graph.) The default is false, meaning ``quit on first error'', and can be overriden at startup by the environment variable CM_KEEP_GOING.
CM.Control.parse_caching sets a limit on how many parse trees are cached in main memory. In certain cases CM must parse source files in order to be able to calculate the dependency graph. Later, the same files may need to be compiled, in which case an existing parse tree saves the time to parse the file again. Keeping parse trees can be expensive in terms of memory usage. Moreover, CM makes special efforts to avoid re-parsing files in the first place unless they have actually been modified. Therefore, it may not make much sense to set this value very high. The default is 100 and can be overriden at startup time by the environment variable CM_PARSE_CACHING.
This version of CM uses an ML-inspired syntax for expressions in its conditional compilation subsystem (see Section 7). However, for the time being it will accept most of the original C-inspired expressions but produces a warning for each occurrence of an old-style operator. CM.Control.warn_obsolete can be used to turn these warnings off. The default is true, meaning ``warnings are issued'', and can be overriden at startup time by the environment variable CM_WARN_OBSOLETE.
CM.Control.debug can be used to turn on debug mode. This currently has the effect of dumping a trace of the master-slave protocol for parallel and distributed compilation (see Section 12) to TextIO.stdOut. The default is false and can be overriden at startup time by the environment variable CM_DEBUG.
Using CM.Control.conserve_memory, CM can be told to be slightly more conservative with its use of main memory at the expense of occasionally incurring additional input from stable library files. This does not save very much and, therefore, is normally turned off. The default ( false) can be overridden at startup by the environment variable CM_CONSERVE_MEMORY.
CM.Control.generate_index is used to control the generation of human-readable index files (see section 10.2). The default setting is false and can be overridden at startup by the environment variable CM_GENERATE_INDEX.