IncrementalLoader.mesa
Copyright Ó 1989, 1991 by Xerox Corporation. All rights reserved.
Peter B. Kessler, September 5, 1989 10:15:00 am PDT
This is a translation of xrhome/2𡤆.X/INCLUDE/xr/IncrementalLoad.h
Michael Plass, November 26, 1991 5:07 pm PST
DIRECTORY
UnixTypes;
IncrementalLoader: CEDAR DEFINITIONS ~ {
Types that should be in UnixTypes.h.
unsigned: TYPE ~ CARD32;
int: TYPE ~ INT32;
charStar: TYPE ~ UnixTypes.CHARPtr;
bool: TYPE ~ BOOLEAN;
sizet: TYPE ~ int;
timet: TYPE ~ UnixTypes.Time;
caddrt: TYPE ~ charStar;
Error result returned from many IL calls.
NIL means 'ok' ...
XRILError: TYPE ~ POINTER TO XRILErrorRep;
nullXRILError: XRILError ~ NIL;
XRILErrorRep: TYPE ~ RECORD [
ilefatal: bool, -- all incr loads since last commit are aborted
ilecode: int,  -- > 0 ==> value from Errno.h
ilemsg: charStar -- human-readable
];
Incremental Load State Locking.
Data is guaranteed to be persistent only while lock is held.
XRLockIncrementalLoadState: PROCEDURE [wait: bool] RETURNS [XRILError];
Try to acquire lock on load state.
The `wait' parameter says whether to block until it's available.
Waiting is abortable.
Result.ile𡤌ode may be ETIMEDOUT or XR�ORTED.
A successful call must be followed (eventually) by a call to UnlockIncrementalLoadState.
XRUnlockIncrementalLoadState: PROCEDURE [] RETURNS [XRILError];
Release lock on load state.
Result.ile𡤌ode may be EINVAL if lock is not held.
Incremental Load File record.
XRILFileEntry: TYPE ~ POINTER TO XRILFileEntryRep;
nullXRILFileEntry: XRILFileEntry ~ NIL;
XRILFileEntryRep: TYPE ~ RECORD [
ilfeseqNum: unsigned,
ilfecommitPoint: bool,
 file info
ilfefName: charStar,
ilfefOffset: unsigned,
ilfefMagic: unsigned,
ilfefSize: sizet,
ilfefMTime: timet,
 version stamp (supplied by installation proc)
ilfevMagic: unsigned,
ilfevLen: unsigned,
ilfevStamp: charStar,
 file type specific data (optionally supplied by reader proc)
ilferdrData: caddrt,
ilferdrDataBytes: unsigned,
 patch, text, data, bss, and common segments
ilfepAddr: caddrt,
ilfepBytes: unsigned,
ilfetAddr: caddrt,
ilfetBytes: unsigned,
ilfedAddr: caddrt,
ilfedBytes: unsigned,
ilfebAddr: caddrt,
ilfebBytes: unsigned,
ilfecAddr: caddrt,
ilfecBytes: unsigned
];
XRILGetPrevFileEntry: PROCEDURE [ilfe: XRILFileEntry] RETURNS [XRILFileEntry];
Return ILFileEntries in reverse order of loading.
Return most-recently-loaded entry if ilfe is NIL.
Return NIL at end of sequence.
To be called by an installation proc to record its version stamp.
The vStamp pointer is stored into the XR←ILFileEntry associated with pc, without being copied; thus, it can't point to a buffer in a local frame.
BEWARE: these procs don't do any locking. Concurrent calls that add version stamps for different files don't interfere with one another.
XRILAddVersionStamp: PROCEDURE [
ilfe: XRILFileEntry, vMagic: unsigned, vLen: unsigned, vStamp: caddrt]
RETURNS [];
XRILAddVersionStampUsingPC: PROCEDURE [
pc: caddrt, vMagic: unsigned, vLen: unsigned, vStamp: charStar]
RETURNS [XRILFileEntry];
Load state symbol lookup
XRILSymEntry: TYPE ~ POINTER TO XRILSymEntryRep;
nullXRILSymEntry: XRILSymEntry ~ NIL;
XRILSymEntryRep: TYPE ~ RECORD [
ilsename: charStar,
ilsetype: unsigned,
ilsevalue: unsigned,
ilsesize: unsigned,
ilseilfe: XRILFileEntry
];
ilsetypeEnum: TYPE ~ MACHINE DEPENDENT {
ILSEUNDF (00H), -- undefined
ILSEEXT (01H), -- external bit, or'ed in
ILSEABS (02H), -- absolute
ILSETEXT (04H), -- text
ILSEDATA (06H), -- data
ILSEBSS (08H), -- bss
ILSETYPE (01EH) -- mask for all the type bits
};
ilsetypeExtrasEnum: TYPE ~ MACHINE DEPENDENT {
ILSEPATCH (01CH), -- patch area address
ILSEMODULE (01EH) -- module name
};
Load state symbol lookup
PCR retains all external or text symbols.
All these symbols are accessible by name.
Only relocatable (not absolute) symbols are accessible by value.
XRILLookupSymEntry: PROCEDURE [sym: charStar, externOnly: bool]
RETURNS [XRILSymEntry];
Return XR←ILSymEntry for (most recent instance of) sym.
Note sym may be undefined (in symbol table because it has been referenced but not yet defined).
Return NIL if no instance of sym exists in load state.
If externOnly is true, symbols that aren't extern are ignored.
XRILLookupSymEntryByValue: PROCEDURE [val: unsigned]
RETURNS [XRILSymEntry];
Return XR←ILSymEntry for most recently defined text, data or bss (but not absolute) symbol of maximum value not greater than val.
Note: symbol will not be undefined.
XRILGetPrevSymEntry: PROCEDURE [ilse: XRILSymEntry, externOnly: bool]
RETURNS [XRILSymEntry];
Return XR←ILSymEntry for next most recent definition of symbol corresponding to ilse.
Return NIL if no more definitions.
If externOnly is true, symbols that aren't extern are ignored.
XRILGetPrevSymEntryByValue: PROCEDURE [ilse: XRILSymEntry]
RETURNS [XRILSymEntry];
Return XR←ILSymEntry for prev symbol def by value.
Return NIL if no more definitions.
XRILGetNextSymEntryByValue: PROCEDURE [ilse: XRILSymEntry]
RETURNS [XRILSymEntry];
Return XR←ILSymEntry for next symbol def by value.
Return NIL if no more definitions.
}.