DIRECTORY MathExpr USING [AtomClass, CompoundClass], List USING [AList, Assoc, PutAssoc], MathDB; MathDBImpl: CEDAR PROGRAM IMPORTS List EXPORTS MathDB ~ BEGIN AtomClass: TYPE ~ MathExpr.AtomClass; CompoundClass: TYPE ~ MathExpr.CompoundClass; GlobalAtomClasses: List.AList _ NIL; GlobalCompoundClasses: List.AList _ NIL; AtomClassNames: PUBLIC LIST OF ATOM _ NIL; CompoundClassNames: PUBLIC LIST OF ATOM _ NIL; ResetAtomClasses: PUBLIC PROC[] ~ { GlobalAtomClasses _ NIL; AtomClassNames _ NIL; }; ResetCompoundClasses: PUBLIC PROC[] ~ { GlobalCompoundClasses _ NIL; CompoundClassNames _ NIL; }; InstallAtomClass: PUBLIC PROC[class: AtomClass] ~ { GlobalAtomClasses _ List.PutAssoc[key: class.name, val: class, aList: GlobalAtomClasses]; AtomClassNames _ CONS[class.name, AtomClassNames]; }; InstallCompoundClass: PUBLIC PROC[class: CompoundClass] ~ { GlobalCompoundClasses _ List.PutAssoc[key: class.name, val: class, aList: GlobalCompoundClasses]; CompoundClassNames _ CONS[class.name, CompoundClassNames]; }; LookupAtomClass: PUBLIC PROC[name: ATOM] RETURNS[AtomClass] ~ { atomClass: AtomClass _ NARROW[List.Assoc[key: name, aList: GlobalAtomClasses]]; IF atomClass = NIL THEN ERROR notFound; RETURN[atomClass]; }; LookupCompoundClass: PUBLIC PROC[name: ATOM] RETURNS[CompoundClass] ~ { compoundClass: CompoundClass _ NARROW[List.Assoc[key: name, aList: GlobalCompoundClasses]]; IF compoundClass = NIL THEN ERROR notFound; RETURN[compoundClass]; }; notFound: PUBLIC ERROR = CODE; END. ŒMathDBImpl.mesa Carl Waldspurger, July 30, 1986 11:22:37 am PDT Math Object "DataBase" Operations Abbreviations from Imported Interfaces Global "DataBase" Lists Exported DB Indexes Class "DataBase" Operations effects: Resets (i.e. destroys) the global AtomClass DataBase effects: Resets (i.e. destroys) the global CompoundClass DataBase effects: Installs class in global AtomClass DataBase add atom class to database - not very efficient, but does the job add atom class name to index effects: Installs class in global CompoundClass DataBase add compound class to database - not very efficient, but does the job add compound class name to index effects: Returns the AtomClass object associated with name. SIGNALS notFound if no association exists effects: Returns the CompoundClass object associated with name. SIGNALS notFound if no association exists Signals & Errors Κ˜Jšœ™Jšœ/™/J˜JšΟn!™!J˜codešΟk ˜ Kšœ žœ˜*Kšœžœ˜$Kšœ˜K˜K˜—š œžœžœ˜Kšžœ˜ Kšžœ ˜K˜Kšž˜K˜Kš&™&˜Kšœ žœ˜%Kšœžœ˜-K˜K˜—Kš™˜Kšœžœ˜$Kšœžœ˜(K˜—K˜š™K˜Kš œžœžœžœžœžœ˜*Kš œžœžœžœžœžœ˜.K˜K˜—K˜Kš™™šœž œ˜#Kšœ>™>Kšœžœ˜Kšœžœ˜K˜K˜—šœž œ˜'KšœB™BKšœžœ˜Kšœžœ˜K˜—K˜K˜šœžœžœ˜3Kšœ5™5K™KšœB™BK˜YK˜Kšœ™Kšœžœ˜2K˜K˜—šœžœžœ˜;Kšœ9™9K™KšœE™EK˜aK˜Kšœ ™ Kšœžœ!˜:K˜—K˜š œžœžœžœžœ˜?Kšœ<™