QEDataManagerImpl.mesa
Arnon, November 19, 1987 4:18:58 pm PST
DIRECTORY
Basics,
Rope,
Convert,
List USING [AList, Assoc, PutAssoc]
QEDataManager;
QEDataManagerImpl: CEDAR PROGRAM
IMPORTS List, Convert
EXPORTS QEDataManager ~
BEGIN OPEN QEDataManager;
Abbreviations from Imported Interfaces
ROPE: TYPE ~ Rope.ROPE;
AList: TYPE ~ List.AList;
Simulated LoganBerry DB
LoganBerryLog: LBLog; -- a global simulated LoganBerry Log
Global registry of QE objects loaded into memory
OnlineQEObjects: List.AList ← NIL;
Operations on Public Lists of Expression Class Names, by Expr Type
ResetWorld: PUBLIC PROC[] ~ {
LoganBerryLog ← NIL;
OnlineQEObjects ← NIL;
};
OnlineQEObject: PROC [in: AlgebraClasses.Object, tryConnect: BOOLFALSE] RETURNS [out: AlgebraClasses.Object];
Checks OnlineQEObjects to see if already online, if not, loads it and enters it into OnlineQEObjects. If tryConnect = TRUE, then for each field which contains one or more QE objects, looks for those objects in OnlineQEObjects, and if found, puts pointers to the online versions in the output object. If tryConnect = FALSE, then all such fields are left containing offline objects.
InstallAtomClass: PUBLIC PROC[class: AtomClass] ~ {
effects: Installs class in global AtomClass DataBase
add atom class to database - not very efficient, but does the job
GlobalAtomClasses ← List.PutAssoc[key: class.name, val: class, aList: GlobalAtomClasses];
add atom class name to index
AtomClassNames ← CONS[class.name, AtomClassNames];
};
LookupAtomClass: PUBLIC PROC[name: ATOM] RETURNS[AtomClass] ~ {
effects: Returns the AtomClass object associated with name.
SIGNALS notFound if no association exists
atomClass: AtomClass ← NARROW[List.Assoc[key: name, aList: GlobalAtomClasses]];
IF atomClass = NIL THEN ERROR notFound;
RETURN[atomClass];
};
KillAtomClass: PUBLIC PROC[name: ATOM] ~{
GlobalAtomClasses ← KillAssoc[name, GlobalAtomClasses]
};
Public Lists of Operator Names (Operators assumed to be CompoundExprs)
GlobalOperatorTable: List.AList ← NIL;
Signals & Errors
notFound: PUBLIC ERROR = CODE;
Start Code (Reset Database)
ResetWorld[];
END.