DIRECTORY MathExpr USING [AtomClass, CompoundClass, MatrixClass], List USING [AList, Assoc, PutAssoc], MathDB; MathDBImpl: CEDAR PROGRAM IMPORTS List EXPORTS MathDB ~ BEGIN AtomClass: TYPE ~ MathExpr.AtomClass; CompoundClass: TYPE ~ MathExpr.CompoundClass; MatrixClass: TYPE ~ MathExpr.MatrixClass; GlobalAtomClasses: List.AList _ NIL; GlobalCompoundClasses: List.AList _ NIL; GlobalMatrixClasses: List.AList _ NIL; AtomClassNames: PUBLIC LIST OF ATOM _ NIL; CompoundClassNames: PUBLIC LIST OF ATOM _ NIL; MatrixClassNames: PUBLIC LIST OF ATOM _ NIL; ResetAtomClasses: PUBLIC PROC[] ~ { GlobalAtomClasses _ NIL; AtomClassNames _ NIL; }; ResetCompoundClasses: PUBLIC PROC[] ~ { GlobalCompoundClasses _ NIL; CompoundClassNames _ NIL; }; ResetMatrixClasses: PUBLIC PROC[] ~ { GlobalMatrixClasses _ NIL; MatrixClassNames _ 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]; }; InstallMatrixClass: PUBLIC PROC[class: MatrixClass] ~ { GlobalMatrixClasses _ List.PutAssoc[key: class.name, val: class, aList: GlobalMatrixClasses]; MatrixClassNames _ CONS[class.name, MatrixClassNames]; }; 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]; }; LookupMatrixClass: PUBLIC PROC[name: ATOM] RETURNS[MatrixClass] ~ { matrixClass: MatrixClass _ NARROW[List.Assoc[key: name, aList: GlobalMatrixClasses]]; IF matrixClass = NIL THEN ERROR notFound; RETURN[matrixClass]; }; notFound: PUBLIC ERROR = CODE; END. ΈMathDBImpl.mesa Carl Waldspurger, August 22, 1986 3:29:18 pm 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: Resets (i.e. destroys) the global MatrixClass 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: Installs class in global MatrixClass DataBase add matrix class to database add matrix 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 effects: Returns the MatrixClass object associated with name. SIGNALS notFound if no association exists Signals & Errors Κ˜Jšœ™Jšœ0™0J˜JšΟn!™!J˜codešΟk ˜ Kšœ žœ)˜7Kšœžœ˜$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šœ@™@Kšœžœ˜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˜šœž œ˜7Kšœ7™7K™Kšœ™K˜]K˜Kšœ™Kšœžœ˜6K˜—K˜K˜š œžœžœžœžœ˜?Kšœ<™™>Kšœ3™3K™Kšœžœ4˜UKšžœžœžœžœ ˜)Kšžœ˜K˜—K˜K˜—Kš™˜Kšœ žœžœžœ˜K˜K˜K˜—Kšžœ˜K˜——…—ŠU