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


Ulm's Oberon Library:
CompilerDatabases


NAME

CompilerDatabases - general interface for the retrieval and storage of program text sources and results of compilation runs

SYNOPSIS

TYPE Database = POINTER TO DatabaseRec;
TYPE DatabaseRec = RECORD (Services.ObjectRec) END;


TYPE LookupProc = PROCEDURE ( db: Database; modname: ConstStrings.String; type: CompilerObjects.ObjectType; arch: Architectures.Architecture; keys: CompilerKeys.Set; VAR header: CompilerObjects.Header; VAR text: PersistentTexts.Text; errors: RelatedEvents.Object) : BOOLEAN; TYPE LookupHeaderProc = PROCEDURE ( db: Database; modname: ConstStrings.String; type: CompilerObjects.ObjectType; arch: Architectures.Architecture; keys: CompilerKeys.Set; VAR header: CompilerObjects.Header; errors: RelatedEvents.Object) : BOOLEAN; TYPE StoreProc = PROCEDURE ( db: Database; header: CompilerObjects.Header; text: PersistentTexts.Text; errors: RelatedEvents.Object) : BOOLEAN; TYPE LookupSrcProc = PROCEDURE ( db: Database; modname: ConstStrings.String; kind: CompilerSources.SourceKind; VAR src: CompilerSources.Source; errors: RelatedEvents.Object) : BOOLEAN; TYPE StoreSrcProc = PROCEDURE ( db: Database; src: CompilerSources.Source; errors: RelatedEvents.Object) : BOOLEAN; TYPE Interface = POINTER TO InterfaceRec; TYPE InterfaceRec = RECORD (Objects.ObjectRec) lookup: LookupProc; lookupHeader: LookupHeaderProc; store: StoreProc; lookupSrc: LookupSrcProc; storeSrc: StoreSrcProc; END;

PROCEDURE Init(db: Database; if: Interface);

PROCEDURE LookupSrc(db: Database; modname: ConstStrings.String; kind: CompilerSources.SourceKind; VAR src: CompilerSources.Source; errors: RelatedEvents.Object) : BOOLEAN; PROCEDURE StoreSrc(db: Database; src: CompilerSources.Source; errors: RelatedEvents.Object) : BOOLEAN;

PROCEDURE Lookup(db: Database; modname: ConstStrings.String; type: CompilerObjects.ObjectType; arch: Architectures.Architecture; keys: CompilerKeys.Set; VAR header: CompilerObjects.Header; VAR text: PersistentTexts.Text; errors: RelatedEvents.Object) : BOOLEAN; PROCEDURE LookupHeader(db: Database; modname: ConstStrings.String; type: CompilerObjects.ObjectType; arch: Architectures.Architecture; keys: CompilerKeys.Set; VAR header: CompilerObjects.Header; errors: RelatedEvents.Object) : BOOLEAN; PROCEDURE Store(db: Database; header: CompilerObjects.Header; text: PersistentTexts.Text; errors: RelatedEvents.Object) : BOOLEAN;

DESCRIPTION

CompilerDatabases provides a general interface for databases that allow to store and to retrieve program sources and the results of compilation runs.

This interface does not provide authorization parameters for the retrieval and the storage of database objects. Instead, implementations like CDB accept these parameters through their constructors and use them internally subsequently. Consequently, this interface should not be supported for RemoteObjects. Access to remote databases should be supported on lower abstraction levels as it is has been implemented by CDBNames and RemoteCDBNames.

Only insertion and retrieval are supported. Database objects cannot be deleted through this interface. Instead, implementations are free to garbage collect objects following their criterias or to support delete operations through other channels (e.g. through the Names interface). This interface provides just the view to a compiler database that is needed by compilers and their associated tools. Hence only the retrieval of the most current sources and compilation results that fulfil the given criterias are supported. There are no iterators that allow to examine the entire database.

Two types of objects are supported: source objects and objects that represent the result of a compilation run.

Sources are persistent objects of type CompilerSources.Source that provide a Streams access to the program text and meta informations including a module name, source type, a time stamp, and the compilation parameters. New sources can be uploaded to the database using StoreSrc. Retrieval of the most current source of a module is possible using LookupSrc.

Results of compilation runs are represented by two objects: a header object of type CompilerObjects.Header that contains all meta informations and an object of type CompilerObjects.Object that is enclosed by a PersistentTexts.Text object.

This interface supports a two-phase compilation architecture where the first pass creates architecture-independent results and a second pass delivers architecture-dependent code together with all informations that are required to link it to an executable or to load it dynamically. On retrievals, NIL may be passed to arch to select the architecture-independent result. Otherwise, if arch is non-NIL, the architecture of the result, if any, is guaranteed to match arch according to Architectures.Compatible. In addition, compilation results returned, if any, conform to the set of compilation keys given through keys.

LookupHeader returns on success just the header while the result of Lookup includes the entire (possibly huge) compilation result.

StoreSrc and Store allow to insert source and compilation result objects into the database.

The interface that is passed to Init is expected to follow the semantics of the client procedures described above.

DIAGNOSTICS

All procedures return FALSE in case of failures and relate associated error events to errors.

SEE ALSO

CDB
standard implementation of this interface
CompilerObjects
general base type of persistent compiler objects
CompilerSources
persistent source texts and related meta information
PersistentTexts
enclosure of persistent objects

Edited by: borchert, last change: 2004/06/03, revision: 1.1, converted to HTML: 2004/06/03

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