The CM.sources function can be used to find the names of all source files that a given library depends on. It returns the names of all files involved with the exception of skeleton files and binfiles (see Section 10). Stable libraries are represented by their library file; their description file or consitutent members are not listed.
Normally, the function reports actual file names as used for accessing the file system. For (stable) library files this behavior can be inconvenient because these names depend on architecture and operating system. For this reason, CM.sources accepts an optional pair of strings that then will be used in place of the architecture- and OS-specific part of these names.
val sources :
{ arch: string, os: string } option ->
string ->
{ file: string, class: string, derived: bool } list option
In case there was some error analyzing the specified library or group, CM.sources returns NONE. Otherwise the result is a list of records, each carrying a file name, the corresponding class, and information about whether or not the source was created by some tool.
Examples:
Option.map (List.filter (not o #derived))
(CM.sources (SOME { arch = "$ARCH", os = "$OPSYS" })
"foo.cm");
A call of CM.sources similar to the one shown here is used by
the auxiliary script ml-makedepend (see
Section 14.2).
Option.map (List.filter (fn x => #class x = "noweb"))
(CM.sources NONE "foo.cm");