Oberon || Library || Module Index || Search Engine || Definition || Module


Ulm's Oberon Library:
ObjectLoader


NAME

ObjectLoader - load and possibly generate compilation results from the compiler database

SYNOPSIS

(* log levels *)
CONST logLoading = 0;
CONST logLoadingResult = 1;
CONST logCompiling = 2; (* includes 3 and 4 *)
CONST logStoring = 5;
CONST logChecks = 6;
CONST logErrors = 7;


CONST noSrcFound = 0; CONST compilationFailed = 1; CONST loadFailed = 2; CONST refCycle = 3; CONST errors = 4; TYPE ErrorCode = SHORTINT; (* noSrcFound ... *) TYPE ErrorEvent = POINTER TO ErrorEventRec; TYPE ErrorEventRec = RECORD (Events.EventRec) code: ErrorCode; modname: ConstStrings.String; END; VAR error: Events.EventType; VAR errormsg: ARRAY errors OF Events.Message;

PROCEDURE UpToDate(context: Compilers.Context; header: CompilerObjects.Header) : BOOLEAN;

PROCEDURE LoadObject(compiler: Compilers.Compiler; context: Compilers.Context; modname: ConstStrings.String; type: CompilerObjects.ObjectType; arch: Architectures.Architecture; VAR header: CompilerObjects.Header; VAR object: CompilerObjects.Object; errors: RelatedEvents.Object) : BOOLEAN;

PROCEDURE LoadText(compiler: Compilers.Compiler; context: Compilers.Context; modname: ConstStrings.String; type: CompilerObjects.ObjectType; arch: Architectures.Architecture; VAR header: CompilerObjects.Header; VAR text: PersistentTexts.Text; errors: RelatedEvents.Object) : BOOLEAN;

PROCEDURE LoadHeader(compiler: Compilers.Compiler; context: Compilers.Context; modname: ConstStrings.String; type: CompilerObjects.ObjectType; arch: Architectures.Architecture; VAR header: CompilerObjects.Header; errors: RelatedEvents.Object) : BOOLEAN;

DESCRIPTION

ObjectLoader attempts to load specified targets from the database associated with context (see Compilers and CompilerDatabases), and generates them using compiler if they are missing or no longer up-to-date. Newly generated compilation results may be stored back into the database in dependence of the cachemode field of the context parameter.

Targets are specified by a module name (modname), an object type (CompilerObjects.public or CompilerObjects.private), and the architecture arch which may be NIL for architecture-independent targets.

All compilation results within the database consist of a header and a persistent text (see PersistentTexts). The latter encapsulates a module object that is part of a modularized structure (see ModularizedStructures). The header (of type CompilerObjects.Header) provides meta informations of a compilation result including all its dependencies (see CompilerKeys).

LoadHeader just loads the header of a target, LoadText loads both, the header and the persistent text, and LoadObject works like LoadText but unpacks the encapsulated object out of the persistent text.

UpToDate allows to check whether a target of the database whose header is given is up-to-date.

DIAGNOSTICS

All error events are related to errors. This includes all events that are generated by the compiler (see CompilerErrors) and the underlying compiler database (see CompilerDatabases). Following error events are possibly raised by this module:
noSrcFound
The desired compilation result is not available and cannot be generated because source texts are missing. Please note that the name of the module whose source is missing is included in the event record type.
compilationFailed
A compilation failed. More detailed error messages may be found in the collected compilation error events (see CompilerErrors).
loadFailed
Final error event that is generated if load operations fail for whatever reason.
refCycle
A reference cycle among interfaces was detected which lead to conflicting compilation keys (see CompilerKeys). One member of the reference cycle is named by the modname field of the error event.

A log object of type CompilerLogs.Log is part of the context objects. The log allows to follow the recursion of the loading algorithm. The nesting level of the recursion is reflected by the nesting level of the log. The amount of log messages depends on the log levels which are given in ascending order:

logLoading
Tells the parameters modname, type, and arch of a loading operation.
logLoadingResult
Tells whether a load operation was successful or not.
logCompiling
Tells when the compiler is invoked. Note that a log level of at least logCompiling+1 provides the time stamp of the source, and that beginning with logCompiling+2 the source ids are provided as well.
logStoring
Tells which compilation results are stored back into the database.
logChecks
Documents all the checks that are performed to determine the up-to-date status of a module object in the database.
logErrors
Includes all compilation errors within the log.

SEE ALSO

Compilers
general interface for two-pass compilers
CompilerDatabases
interface to a persistent database where sources and compilation results are found and stored to
CompilerErrors
standardized events for compilation errors
CompilerKeys
keys that identify dependencies of compiler-generated objects
CompilerLogs
provides log about loading and compilation processes
CompilerObjects
base type for compiler objects that represent compiler results and header structures
ModularizedStructures
modularized byte sequences of persistent objects
PersistentTexts
encapsulation of persistent objects

Edited by: borchert, last change: 2004/08/25, revision: 1.1, converted to HTML: 2004/08/25

Oberon || Library || Module Index || Search Engine || Definition || Module