DIRECTORY DB, Rope, ViewerClasses; Nut: CEDAR DEFINITIONS = BEGIN OPEN DB; ROPE: TYPE = Rope.ROPE; Viewer: TYPE = ViewerClasses.Viewer; NutProc: TYPE = PROC[eName, domain: ROPE, segment: DB.Segment, lastSpawned: Viewer _ NIL] RETURNS[v: Viewer]; NoRegistration: ERROR; Register: PROC[ domain: ROPE, segment: DB.Segment, display: NutProc _ NIL, -- proc to make displayer for entity in domain edit: NutProc _ NIL, -- proc to make editor for new or old entity in domain query: NutProc _ NIL, -- proc to make queryer on domain reset: PROC[v: Viewer] _ NIL -- proc to redisplay the contents of a previously created viewer ]; DeRegister: PROC[domain: ROPE, segment: DB.Segment]; Push: PROC[ domain: ROPE, segment: DB.Segment, display: NutProc _ NIL, -- proc to make displayer for entity in domain edit: NutProc _ NIL, -- proc to make editor for new or old entity in domain query: NutProc _ NIL, -- proc to make queryer on domain reset: PROC[v: Viewer] _ NIL, -- proc to redisplay the contents of a previously created viewer register: BOOL _ FALSE -- determines whether to add new entry or change top ]; Pop: PROC[domain: ROPE, segment: DB.Segment]; PushDefaults: PROC[domain: ROPE, segment: DB.Segment]; Display: PROC[ eName, domain: ROPE, segment: DB.Segment, parent: Viewer _ NIL] RETURNS[v: Viewer]; Edit: PROC[ eName, domain: ROPE, segment: DB.Segment, parent: Viewer_ NIL] RETURNS[v: Viewer]; Query: PROC[ eName, domain: ROPE, segment: DB.Segment, parent: Viewer_ NIL ] RETURNS[v: Viewer]; ResetNuts: PROC[segment: DB.Segment]; SetSpawnedProperty: PROC[v: Viewer, new: Viewer] RETURNS[previous: Viewer]; GetSpawnedProperty: PROC[v: Viewer] RETURNS[current: Viewer]; SetFrozenProperty: PROC[v: Viewer, new: BOOL] RETURNS[previous: BOOL]; GetFrozenProperty: PROC[v: Viewer] RETURNS[current: BOOL]; GetNutInfo: PROC[v: Viewer] RETURNS[segment: Segment, domain, entity: ROPE]; ChangeName: PROC [v: Viewer, newName: Rope.ROPE]; EntityNameForViewer: PROC [v: Viewer] RETURNS [entityName: ROPE]; SetNutInfo: PROC[v: Viewer, segment: Segment, domain, entity: ROPE]; END. . . Change Log: Edited by Rick on March 18, 1982 11:50 am: Major reorganization. Register now allows registration of all or some of the three procedures, and replaces any previous registration for that domain with the new one. Edit take init REF ANY. DisplayProc, EditProc, QueryProc take new viewer on calls out from Nut, old viewer on calls into Nut. Added close and open notify procs. Edited by Rick on March 25, 1982 4:29 pm: Added user interaction procs section, dump and load stuff. WSH on April 1, 1982: added MessageConfirm Rick on April 3, 1982 4:29 pm: added width option to button. Added CreateProc feature. Willie-Sue on July 8, 1982: changed EnumerateNutList, created NutPrivate.mesa, NutListImpl.mesa Willie-Sue on July 27, 1982: changed EnumerateNutList to return LIST OF NutRec. Cattell on August 5, 1982 7:11 pm: added init parm to Display, Create procs. Added GetDBTransaction proc. Maxwell on September 8, 1982 9:29 am: moved procedures to Palm and SquirrelOps Cattell on April 12, 1983 1:16 pm: fixed up some outdated comments. Butler on June 26, 1984 3:58:24 pm PDT: Major rewrite has been completed. Push, PushDefaults, and Pop have been added. Display, Edit, and Query now take the same arguments in the same order. See NutImpl for details of implementation changes. Donahue on July 12, 1984 1:01:04 pm PDT: Changed structure of Nut one final time: Domain is passed as a ROPE, so that no opportunities for DB aborts can arise. All procs take a "parent" viewer as argument and pass "last spawned" viewer to the display, etc. proc registered. Freeze moved here from NutViewer and changed slightly. –File: Nut.mesa Implemented by: NutImpl as part of the Nuts package Contents: An interface to allow Cypress application programs for different database entity types to call each other without knowing about each other beforehand. Each application implements one or more "nut" types; nuts are viewers on Cypress entities. Created by: Rick Cattell on 11-Dec-81 12:29:29 Last edited by: Rick Cattell on July 22, 1983 2:31 pm Willie-Sue on January 21, 1983 8:48 am Jim Donahue on July 17, 1984 7:43:12 am PDT Margaret Butler on July 11, 1984 4:25:11 pm PDT Jennifer Widom on June 14, 1984 3:38:45 pm PDT Interaction between nuts: these are implemented in NutImpl.mesa. Each nut implementation registers itself as knowing how to display, edit, and query some set of domains (a domain is a type of entity, see DB), with the Register proc. Any application (or the user through Squirrel) can then call one of the following procs to invoke whoever has registered himself for an entity type (or the default implementations if no one is registered). NoRegistration is raised if no Implementations (including defaults) have been registered. Return a viewer for displaying, editing or querying the database entity with the given name and domain. Registers a display, create, and query for given domain. These will supersede the top registrations for this domain except where new procs NIL. Deregisters all procs for this domain Registers a display, create, and query for given domain. Deregisters top procs for this domain Makes the defaults for the segment be registered as the ones to use. Mainly for debugging new display et al procs. An implementor can use this to actually see the things that a specialized displayer is attempting to display. Displays e in newV. A new viewer is created if newV is NIL. If a nut implementation has registered itself for e's type, that implementation will be called, else the registered default implementation will be used. The seg argument is only necessary for system entities, which have no implicit segment. Edit e in newV. A new viewer is created if newV is NIL. If a nut implementation has registered itself for e's type, that implementation will be called, else the registered default implementation will be used. The seg argument is only necessary for system entities, which have no implicit segment Queries e in newV. A new viewer is created if newV is NIL. If a nut implementation has registered itself for e's type, that implementation will be called, else the registered default implementation will be used. The seg argument is only necessary for system entities, which have no implicit segment Call the reset proc for all current Nut viewers that are manipulating entities in the given segment. This procedure may be called after restarting due to a transaction abort, for instance. Set the "spawned" property of the first viewer to point to the second. The previous value is returned. Set the "spawned" property of the first viewer to point to the second. The previous value is returned. Set the "frozen" property of the viewer and return its previous value. If the value of this property is TRUE (the default is FALSE), then the viewer will not be used as a "spawned" viewer. Set the "frozen" property of the viewer and return its previous value. If the value of this property is TRUE (the default is FALSE), then the viewer will not be used as a "spawned" viewer. Returns information about the database entity being displayed in the viewer. These properties are set by the display, etc. procs in Nut for viewers that are created by calling through the Nut interface; they can also be set explicitly for other viewers by calling the SetNutInfo procedure given below. Change the entity name associated with the viewer (to reflect executing a DB.ChangeName on the corresponding entity). Return the DBNames form of the entity for the viewer. Sets the properties of the viewer to remember the DB entity displayed Êp˜J˜Jšœ™Jšœ3™3JšœT™TJšœR™RJšœU™UJšœ.™.J˜Jšœ™Jšœ&™&Jšœ&™&Jšœ+™+Jšœ/™/Jšœ.™.J˜šÏk ˜ Jšœ˜J˜—Jšœœ œ˜J˜Jšœœœ˜J˜Jšœœœ˜Jšœœ˜$˜Jšœ“™“J™—šÏnœœœœ œ œœ ˜mJšœh™hJ™—Jšœœ˜J™šžœœ˜Jšœœ˜ Jšœ œ ˜JšœœÏc.˜FJšœœŸ6˜LJšœœŸ!˜7JšœœœŸ@˜]J˜Jšœ9™9JšœW™WJ˜—šž œœ œ œ ˜4Jšœ%™%J™—šžœœ˜ Jšœœ˜ Jšœ œ ˜JšœœŸ.˜FJšœœŸ6˜LJšœœŸ!˜7JšœœœŸ@˜^Jšœ œœŸ4˜KJ˜Jšœ9™9J™—šžœœ œ œ ˜-Jšœ%™%J™—šž œœ œ œ ˜6J™â—J™š žœœœ œœœ ˜cJšœ®™®J˜—š žœœœ œœœ ˜^Jšœ©™©J˜—š žœœœ œœœ ˜`Jšœœ"œò™¬J˜—šž œœ œ ˜%J™½J˜—šžœœœ˜KJšœg™gJ™—šžœœ œ˜=Jšœg™gJ™—š žœœœœ œ˜FJšœ½™½J™—šžœœ œ œ˜:Jšœ½™½J™—šž œœ œ#œ˜LJšœ®™®J™—šž œœœ˜1Jšœu™u—J™šžœœ œœ˜AJšœ5™5J˜—šž œœ.œ˜DJ™EJ™—Jšœ˜J˜J˜ J˜JšœæœœŒ˜ùJ˜J˜dJ˜Jšœ'˜*J˜J˜WJ˜J˜_J˜Jšœ@œœ˜OJ˜J˜jJ˜J˜NJ˜J˜DJ˜ôJ˜˜(J˜¡—J˜J˜—…—’"˜