MAINSAIL Language Manual, Section 41.17

previous   next   top   complete contents   complete index   framed top   this page unframed


41.17. $moduleInfo

Figure 41–16. $moduleInfo
BOOLEAN
PROCEDURE   $moduleInfo (STRING cmdLine;
                         
PRODUCES POINTER($moduleRec)
                             
modList;
                         
OPTIONAL BITS ctrlBits);

$moduleInfo is used from a program to obtain information about one or more objmods, which may reside either in individual files or in libraries. The information is returned as a linked list of dynamic records of the CLASS $moduleRec, described below. The records are sorted in ascending order by MODULE name.

cmdLine has a form similar to the arguments to MODLIB's DIRECTORY command, namely:

libName{,targetAbbreviation} {modList}

where targetAbbreviation is the abbreviation of the target system for which the MODULEs were compiled; it must be specified if the target system is different from the host. libName can be * to indicate that no library is involved, i.e., that modList specifies object MODULEs in individual files. modList is a possibly empty list of MODULE specifications separated by blanks. A MODULE specification can have any one of three forms:

The last two forms are used when libName is *. The only reason to use the last form is if the fileName would appear to be a valid MODULE name. If a libName is given and modList is omitted, then information is provided for all MODULEs in the library.

ctrlBits can specify errorOK to suppress error messages, and $noLegalNotice may be set in a call to $moduleInfo to suppress fetching of the legal notice from each MODULE (this speeds up the call significantly). A result of FALSE indicates that an error occurred (e.g., a file could not be opened).

Fields of $moduleRec include:

STRING $dirName name recorded in the directory, if in a library
STRING $modName actual name of the MODULE, usually the same as $dirName
LONG INTEGER $startPage start page if in a library
LONG INTEGER $numPages number of pages
LONG INTEGER $compileDate date compiled
LONG INTEGER $compileTime time compiled
INTEGER $majorVersion major version
INTEGER $minorVersion minor version
LONG BITS $cmpBits see below
STRING $legalNoticeStr legal notice STRING
POINTER($moduleRec) $next link to next record

XIDAK reserves the right to add new fields to this CLASS.

Predefined LONG BITS constants for $cmpBits are:

$hasInitialProc the MODULE has an INITIAL PROCEDURE
$hasFinalProc the MODULE has a FINAL PROCEDURE
$inlinesHaveBodies INLINE PROCEDUREs were given bodies
$arithmeticChecked compiled with the ACHECK option
$checked compiled with the CHECK option
$debugBit compiled with the DEBUG option
$optimized compiled with the OPTIMIZE option
$countingPerModule compiled with the PERMOD option
$countingPerProc compiled with the PERPROC option
$countingPerStmt compiled with the PERSTMT option
$timingPerModule compiled with the MODTIME option
$timingPerProc compiled with the PROCTIME option
$unbound compiled with the UNBOUND option

XIDAK reserves the right to define new bits that may be set in $cmpBits.

Example 41–17. Use of $moduleInfo
PROCEDURE printModulesInLibrary (STRING libraryFileName);
BEGIN
POINTER($moduleRecp,q;
IF NOT $moduleInfo(libraryFileName,pTHEN RETURN;
write(logFile,
    "
Modules in library file ",libraryFileName,eol);
WHILE q := p DOB
    
write(logFile,p.$modName,eol);
    
p := p.$nextdispose(qEND;
END;

The caller of $moduleInfo is responsible for disposing the $moduleRec records returned by $moduleInfo when they are no longer needed.


previous   next   top   complete contents   complete index   framed top   this page unframed

MAINSAIL Language Manual, Section 41.17