previous next top contents index framed top this page unframed
Command line syntax: intlib {oneIntlibCommand}
INTLIB, the intmod librarian, is used to create and maintain intmod libraries. Putting several intmods into an intmod library eliminates the need for individual intmod files, reducing clutter in the file system.
Many INTLIB commands are similar to those of MODLIB, the objmod librarian.
“Open” intmod libraries are not open files; i.e., unlike objmod libraries opened for execution, they do not consume an operating system file handle. The files are opened when information is added to them or extracted from them and then immediately closed; however, they are considered to be “open” libraries because the MAINSAIL runtime system maintains a global list of libraries. All MAINSAIL programs that use intmods may search for them in the same global intmod library list, and all program commands that open an intmod library add it to the global list. For example, opening an intmod library with the MAINEX subcommand OPENINTLIB opens it for the purposes of the compiler, opening an intmod library in the compiler opens it for the purposes of the debugger, etc. Intmod libraries remain open until explicitly closed.
Modifying an intmod library on the global open intmod library list has undefined effects.
As described in Chapter 14 of the MAINSAIL Language Manual, intmods are searched for by default in the order:
There are no restrictions on the way MODULEs are organized in intmod libraries. An intmod library might consist of all MODULEs related to a given program, or it might consist of several unrelated “utility” MODULEs. An intmod library may also contain intmods for several different targets (this is not true of objmod libraries, which contain only objmods for the same target).
MAINSAIL does not impose a limit on the number of intmod libraries that may be open during execution, although the underlying operating system may have a limit on the number of open files.
An intmod library can be opened in the following ways:
INTLIB automatically extends the size of a library file to
accommodate new MODULEs.
However, a library file never
shrinks;
if many deletions are done without corresponding adds that
reuse the space freed by the deletions, it may be desirable to use
the COPY command to compact the library into a new file.
18.1. How INTLIB Opens Library Files
When INTLIB operates on a MODULE library file, the library
remains open for the remainder of the MAINSAIL session
(i.e., the library is added to the global open
intmod library list).
INTLIB uses an already opened library
file for a specified library
if the specified
library name is exactly equal to the name used when the library
file was first opened.
18.2. Library Size
MAINSAIL imposes no limit on the number of MODULEs in an
intmod library.
18.3. INTLIB Commands
Table 18–2 lists the available INTLIB commands. The
following conventions are used in INTLIB command descriptions:
Table 18–1. Forms of a modList Element
| Form | May Be Used in Commands |
|---|---|
| moduleName{-sysAbbrev} | all |
| fileName | ADD, DIRECTORY, LEGALNOTICE |
| moduleName{-sysAbbrev}=fileName | ADD, EXTRACT |
| sourceModuleName{-sysAbbrev}= destinationModuleName{-sysAbbrev} | COPY, MOVE |
| Command | Description |
|---|---|
| <eol> | Exit INTLIB |
| ADD dLibName modList | Add MODULE(s) to dLibName |
| COPY sLibName dLibName{ modList} | Copy MODULEs from sLibName to dLibName |
| CREATE libName | Create an empty library named libName |
| DEFINE libName s | Define libName as a substitute for (library name) s |
| DELETE sLibName modList | Delete MODULE(s) from sLibName |
| DIRECTORY libName{=fileName}{ modList} | Examine the MODULEs in library libName, writing info to file fileName |
| EXTRACT sLibName{ modList} | Create new file(s) containing copies of MODULEs in sLibName |
| LOG | Show informational messages |
| MOVE sLibName dLibName{ modList} | Move MODULE(s) from sLibName to dLibName |
| NOLOG | Suppress info messages |
| NOUPDATE | Suppress updates |
| QDIRECTORY libName={fileName}{ modList} | Print quick directory of library libName, writing info to file fileName |
| Quit | Exit INTLIB |
| READ fileName | Read INTLIB commands from file fileName |
| TARGET{ targetSystem} | Specify target operating system for subsequently opened libraries |
| UPDATE | Turn off NOUPDATE |
A very long INTLIB command may be broken across several lines by terminating each line with a backslash (\). Thus, the command lines:
add foo.lib\
abc\
def\
ghi
are equivalent to the single command line:
add foo.lib abc def ghi
To exit, type <eol> or QUIT
when you are finished using the intmod librarian.
18.3.2. ADD dLibName{,sysAbbrev} modList
Add the MODULEs specified by modList to the intmod library dLibName. modList is a list of MODULE specifications, separated by blanks. Valid MODULE specifications for this command are given in Table 18–3. MODULE specifications can be mixed within modList.
If dLibName does not exist, it is created. If free pages constitute more than a certain fraction of dLibName and dLibBame contains no hole large enough to accommodate a MODULE in modList, the library is compacted.
If sysAbbrev is specified, it is an operating system abbreviation (as given by $systemNameAbbreviation; e.g., uspa, mpnt). The specified system becomes the default target system for the purposes of the current command. The initial default target is the host system. The target for individual MODULEs may be overridden by specifying a dash followed by a system abbreviation for individual MODULEs as shown in Table 18–3.
An error message is issued if the specified target for an ADD does not match the target for which the intmod was actually compiled.
Table 18–3. INTLIB ADD Command modList Forms
| Form | Meaning |
|---|---|
| moduleName{sysAbbrev} | Add the MODULE found in the default intmod file. |
| moduleName{sysAbbrev}=fileName | Add the MODULE found in the file fileName as the MODULE moduleName. |
| fileName | Add the MODULE found in the file fileName. If an operand does not contain an equal sign and does not have the form moduleName or moduleName-sysAbbrev, it is assumed to be an intmod file name. |
Copy the MODULEs specified by modList in sLibName to dLibName. If modList is absent, copy all MODULEs in sLibName. If dLibName does not exist, it is created.
If sysAbbrev is specified for either library, it is the default system abbreviation for the current command (if it is specified for both and the two targets differ, an error message is issued). If modList contains system specifications for individual MODULEs, they override the default. An error message is issued if a MODULE name is used without a system abbreviation and no MODULE exists for the default target system.
If sysAbbrev is specified for either library, but no modList is given, only MODULEs for the specified target are copied from sLibName to dLibName. If no sysAbbrev and no modList are given, then all MODULEs (for all systems) are copied from sLibName to dLibName.
If dLibName does not exist
before the COPY command, then it contains
no holes after the command is completed.
Thus, the COPY command may be used
to compact a library with unused
space.
18.3.4. CREATE libName
Create an intmod library named libName. The library is
initially empty.
18.3.5. DEFINE libName s
libName is defined as an alias for the library named s. libName can later be used anywhere a library file name would be used as part of an INTLIB command, e.g.:
DEFINE foo /fs3/usr/fxi/fxi74200.40/src/src/fgc.ilb
ADD foo mod1 mod2 mod3
ADD foo mod4 mod5 mod6
DIRECTORY foo
The motivation for this command should be clear from the
above example.
18.3.6. DELETE sLibName{,sysAbbrev} modList
Delete the MODULEs specified in modList from the
intmod library libName.
modList is a list of MODULE names separated by blanks.
If sysAbbrev is specified, the MODULEs in modList are
deleted for the specified system; otherwise, they are
deleted for the current default target.
A system abbreviation in modList overrides the default
target.
18.3.7. DIRECTORY
libName{,sysAbbrev}{=fileName}{
modList}
List information about the MODULEs contained in the intmod library libName. libName may be the character * if the intmods reside in individual intmod files instead of in an intmod library. fileName is the name of the file to which the list is to be written. If fileName is omitted, the list is written to logFile. modList is a list of MODULE names to be included in the directory list, separated by blanks. Valid MODULE specifications for DIRECTORY are moduleName and fileName. If the MODULE resides in a library, only moduleName is permitted. If the MODULE does not reside in a library (* was specified for the library name), then if moduleName is specified, the default intmod file name is formed. If fileName is specified (the given STRING is not a possible MODULE name), the given file name is used.
If modList is omitted, all MODULEs in the intmod library are listed if sysAbbrev is omitted; if sysAbbrev is present, only MODULEs for the specified target are listed.
The information listed includes the MODULE's directory name, the MODULE name (if it differs from the directory name), the MODULE's target system, the number of pages it occupies (where a page is considered by INTLIB to be 512 characters), the date and time at which it was compiled, the version for which it was compiled, and the options with which it was compiled. Example 18–4 is a sample session with MAINSAIL showing execution of the INTLIB directory command and the resulting listing.
Example 18–4. Using the INTLIB DIRECTORY Command
| MAINSAIL (R) Version 16.20.<release> (? for help) Revision: <date> Copyright (c) 1984-1998 by XIDAK, Inc., Point Arena, California, USA. *intlib<eol> MAINSAIL (R) Intmod Librarian (? for help) Copyright (c) 1986-1998 by XIDAK, Inc., Point Arena, California, USA. INTLIB: dir qform-uir.ilb<eol> Directory of qform-uir.ilb modName target textPages date time version options ---------------------------------------------------------- dumb uirs 83 13-Mar-1998 13:53:28 16.20 C S dumbo uirs 76 13-Mar-1998 13:53:45 16.20 C S ps uirs 145 13-Mar-1998 13:54:22 16.20 C S ptronx uirs 82 13-Mar-1998 13:54:02 16.20 C S qcmds uirs 285 13-Mar-1998 13:52:35 16.20 C S qfhdr uirs 46 13-Mar-1998 13:51:33 16.20 C S qform uirs 85 13-Mar-1998 13:54:35 16.20 C S qindex uirs 91 13-Mar-1998 13:53:09 16.20 C S qpass1 uirs 136 13-Mar-1998 13:51:53 16.20 C S qpass2 uirs 46 13-Mar-1998 13:52:04 16.20 C S qpass3 uirs 131 13-Mar-1998 13:52:54 16.20 C S 11 intmods using 1206 text pages (text page = 512 chars). 1 directory textPage. 0 free textPages. 1207 total textPages. INTLIB: <eol> |
The meanings of the abbreviations shown in the options column of the directory listing, separated by spaces, are shown in Table 18–5. For example, C D L indicates that the MODULE was compiled with checking set, debuggable, and with a legal notice. Cmp, Cms, Cps, or Cmps is used to display multiple counting options. Tmp is displayed to indicate both MODTIME and PROCTIME options.
Table 18–5. Option Letters Displayed by the DIRECTORY Command
| Option Abbreviation | The MODULE Was Compiled with: |
|---|---|
| C | CHECK subcommand |
| AC | ACHECK subcommand |
| D | DEBUG subcommand |
| O | OPTIMIZE subcommand |
| A | ALIST subcommand |
| U | UNBOUND subcommand |
| IB | INLINE PROCEDUREs have bodies |
| I | INCREMENTAL subcommand |
| S | SAVEON subcommand |
| Cm | PERMODULE subcommand |
| Cp | PERPROC subcommand |
| Cs | PERSTMT subcommand |
| Tm | MODTIME subcommand |
| Tp | PROCTIME subcommand |
The DIRECTORY command may be able to display the contents of
intmod libraries for versions older than the current version;
however, XIDAK does not specify how long the INTLIB DIRECTORY
command will maintain compatibility with previous versions.
18.3.8. EXTRACT sLibName{,sysAbbrev}{ modList}
Extract (copy to individual intmod files) the specified MODULE(s) from the intmod library libName. sysAbbrev, if specified, is the default target system abbreviation for the command; otherwise, the current default target is used. modList is a list of MODULE specifications, separated by blanks. Valid MODULE specifications for this command are given in Table 18–6. Different types of MODULE specifications can be mixed within modList.
Table 18–6. INTLIB EXTRACT Command modList Forms
| Form | Meaning |
|---|---|
| moduleName{-sysAbbrev} | Extract the MODULE and write it to the default intmod file. |
| moduleName{-sysAbbrev}=fileName | Extract the MODULE with the name moduleName and write it to a file named fileName. |
If modList is omitted, all MODULEs are extracted from the library and written to their default files.
The informational messages written by INTLIB when operating on
libraries are enabled.
18.3.10. MOVE sLibName{,sysAbbrev}
dLibName{,sysAbbrev} modList
The arguments to MOVE have the same format and effect as the
arguments to COPY, except that
MODULEs copied from sLibName
are also deleted from dLibName.
18.3.11. NOLOG
The informational messages written by INTLIB when operating on
libraries are suppressed.
18.3.12. QDIRECTORY
libName{,sysAbbrev}{=fileName}{ modList}
The arguments to QDIRECTORY have the same format and effect as the
arguments to DIRECTORY, except that less information is given
about each MODULE.
18.3.13. READ fileName
READ causes INTLIB commands to be read from the named file.
The
READ command can be used to do nested
readings to an arbitrary depth.
18.3.14. TARGET{ sysAbbrev}
TARGET specifies the default target system for subsequent commands.
sysAbbrev is a system abbreviation, as given
by $systemNameAbbreviation.
If the target system is omitted, the default
target is set to the host system.
The default target is initially the host system.
18.3.15. UPDATE/NOUPDATE
Default: UPDATE
Operations modifying large libraries (i.e., adding or deleting intmods) take longer than operations on small libraries. After each INTLIB command, the updated directory list for every modified library is written to the corresponding library file, and all library files open by INTLIB are closed. This helps keep the library files in a consistent state should a system crash or other abort occur between commands, and keeps the number of open files to a minimum. As the directory gets large, it takes longer and longer to store and read it each time.
Since the storing of the directory occurs only after each command, the single command COPY srcLib dstLib is a much faster way to copy all MODULEs from srcLib to dstLib than a separate command for each MODULE. If not all MODULEs are to be copied, then the command:
COPY srcLib dstLib mod1 mod2 ... modn
is faster than n separate commands since just one library update occurs (after all the MODULEs modi have been copied).
However, there are times when it is more convenient to use a separate command for each MODULE, e.g., in a script generated by a program, or when the commands are being sent to INTLIB through calls to $executeIntlibCommands. The UPDATE and NOUPDATE commands may be used to handle such situations.
The default is UPDATE. Once the NOUPDATE command is given, all library files referenced are kept open, and directories are not written to each altered library after each command. The UPDATE command turns off this effect of NOUPDATE, and also immediately closes all libraries and updates the directories of all altered libraries. An altered library is updated when it is closed, even if NOUPDATE is in effect (all libraries are closed by INTLIB's FINAL PROCEDURE, so all libraries are updated when MAINSAIL exits).
The commands:
NOUPDATE
COPY srcLib dstLib mod1
COPY srcLib dstLib mod2
...
COPY srcLib dstLib modn
UPDATE
execute faster than the same commands without the surrounding NOUPDATE and UPDATE commands. The speed-up may be significant when many MODULEs are involved.
If the system should crash,
or if the MAINSAIL execution is aborted,
between NOUPDATE and UPDATE, the
libraries opened for output access may be
in an unrecoverable state.
The syntax of an INTLIB device prefix for a library named
libName and a MODULE named modName is given by:
The case of the letters in INTLIB and modName is not
important.
For example, on systems where $devModBrk is the character
>, a MODULE FOO in a library proj-xxx.ilb would be
specified by:
The target system of an intmod file may be specified either
by following the library name with a comma and the target system
abbreviation or by following the MODULE name with a dash and the
target system abbreviation; e.g.:
or:
If the target is not specified, the host system is assumed.
If the library is omitted in an INTLIB file specification,
i.e., if the syntax:
is used, all open intmod libraries are searched for modName.
When an INTLIB file f is opened,
f.name is modified to include
the library name and target if
these were not specified in the call to open.
INTLIB files cannot be opened for output access;
i.e., they must be opened read-only.
18.4. INTLIB as a Device Prefix
An intmod in a library can be treated as a file by specifying
an INTLIB device prefix.
This is often useful if, e.g., the debugger cannot find an intmod,
and is prompting for an intmod file name;
if the intmod resides in a library, a file name prefixed with
an INTLIB device prefix is the appropriate response.
"INTLIB(" & libName & ")" & $devModBrkStr & modName
intlib(proj-xxx.ilb)>foo
intlib(proj-xxx.ilb,upa)>foo
intlib(proj-xxx.ilb)>foo-upa
"INTLIB" & $devModBrkStr & modName
18.5. INTLIB Program Interface
INTLIB can be controlled from a user program by calling the PROCEDURE $executeIntlibCommands, declared as shown in Figure 18–7.
Figure 18–7. Declaration of $executeIntlibCommands
BOOLEAN PROCEDURE $executeIntlibCommands
(OPTIONAL STRING cmds;
OPTIONAL POINTER(textFile) f;
OPTIONAL BITS ctrlBits);
cmds is a STRING that contains exactly what would be typed by a user giving commands to INTLIB. In addition, f can indicate a file from which commands are read once cmds becomes empty. If f is omitted, cmdFile is used. To force INTLIB to return rather than read from f when cmds becomes empty, specify the QUIT command as the last command in cmds.
A return value of FALSE indicates that an error occurred during processing of a command. errMsg is called to report the error; the invoking program can intercept the error using the MAINSAIL exception mechanism. In this case, $exceptionStringArg1 starts with the substring "INTLIB:".
MAINSAIL Utilities User's Guide, Chapter 18