DIRECTORY CD, Rope, TokenIO; CDProperties: CEDAR DEFINITIONS = BEGIN PropList: TYPE = CD.PropList; PropRef: TYPE = CD.PropRef; --ABSOLUTELY NEVER NIL InitPropRef: PROC [] RETURNS [PropRef] = INLINE { RETURN [NEW[PropList_NIL]] }; RegisterProperty: PROC [prop: REF, registrationKey: REF_NIL] RETURNS [first: BOOL]; PutProp: PROC [onto: REF, prop: REF, val: REF_NIL]; GetProp: PROC [from: REF, prop: REF] RETURNS [REF]; GetListProp: PROC [propList: PropList, prop: REF] RETURNS [REF]; PutInstanceProp: PROC [onto: CD.Instance, prop: REF, val: REF_NIL]; PutDesignProp: PROC [onto: CD.Design, prop: REF, val: REF_NIL]; PutTechnologyProp: PROC [onto: CD.Technology, prop: REF, val: REF_NIL]; PutAtomProp: PROC [onto: ATOM, prop: REF, val: REF_NIL]; PutObjectProp: PROC [onto: CD.Object, prop: REF, val: REF_NIL]; PutLayerProp: PROC [onto: CD.Layer, prop: REF, val: REF_NIL]; PutPRefProp: PROC [onto: CD.PropRef, prop: REF, val: REF_NIL]; GetInstanceProp: PROC [from: CD.Instance, prop: REF] RETURNS [REF] = INLINE { RETURN [GetListProp[from.properties, prop]] }; GetDesignProp: PROC [from: CD.Design, prop: REF] RETURNS [REF] = INLINE { RETURN [GetListProp[from.properties^, prop]] }; GetTechnologyProp: PROC [from: CD.Technology, prop: REF] RETURNS [REF] = INLINE { RETURN [GetListProp[from.properties^, prop]] }; GetAtomProp: PROC [from: ATOM, prop: REF] RETURNS [REF]; GetObjectProp: PROC [from: CD.Object, prop: REF] RETURNS [REF] = INLINE { RETURN [GetListProp[from.properties, prop]] }; GetLayerProp: PROC [from: CD.Layer, prop: REF] RETURNS [REF]; GetPRefProp: PROC [from: CD.PropRef, prop: REF] RETURNS [REF] = INLINE { RETURN [GetListProp[from^, prop]] }; PutPropProp: PROC [onto: REF, key1, key2: REF_, val: REF_NIL]; GetPropProp: PROC [from: REF, key1, key2: REF_] RETURNS [REF]; InstallProcs: PROC [prop: REF, procs: PropertyProcsRec _ [properties: NIL]]; FetchProcs: PROC [prop: REF] RETURNS [PropertyProcs]; Register: PROC [prop: ATOM, procs: PropertyProcsRec _ [properties: NIL], registrationKey: REF _ NIL] RETURNS [sameProp: ATOM]; PropertyProcs: TYPE = REF PropertyProcsRec; PropertyProcsRec: TYPE = RECORD [ makeCopy: MakeCopyProc _ NIL, internalWrite: InternalPWriteProc _ NIL, internalRead: InternalPReadProc _ NIL, prettyPrint: PrettyPrintProc _ NIL, exclusive: BOOL _ FALSE, --the implementation requests others not too fool with autoRem: BOOL _ FALSE, --removed on direct edits supressTruth: BOOL _ FALSE, --dont write for permanent files reserved: BOOL _ FALSE, --for experiments key: REF _ NIL, --the prop field of registration properties: PropList _ NIL ]; MakeCopyProc: TYPE = PROC [prop: REF, val: REF, purpose: REF_NIL] RETURNS [valCopy: REF]; InternalPWriteProc: TYPE = PROC [h: TokenIO.Handle, prop: REF, val: REF]; InternalPReadProc: TYPE = PROC [h: TokenIO.Handle, prop: ATOM] RETURNS [val: REF]; PrettyPrintProc: TYPE = PROC [prop: REF, val: REF] RETURNS [r: Rope.ROPE]; CopyProps: PROC [propList: PropList, putOnto: REF, purpose: REF_NIL]; AppendProps: PROC [winner, looser: PropList_NIL, putOnto: REF, purpose: REF_NIL]; DCopyProps: PROC [propList: PropList, purpose: REF_NIL] RETURNS [copy: PropList]; DAppendProps: PROC [winner, looser: PropList_NIL, purpose: REF_NIL] RETURNS [copy: PropList]; DoWithinLock: PRIVATE PROC [p: PROC]; DontCopy: PROC [prop: REF, val: REF, purpose: REF_NIL] RETURNS [nil: REF]; CopyVal: PROC [prop: REF, val: REF, purpose: REF_NIL] RETURNS [valCopy: REF]; DontPWrite: PROC [h: TokenIO.Handle, prop: REF, val: REF]; RopePWrite: PROC [h: TokenIO.Handle, prop: REF, val: REF]; RopePRead: PROC [h: TokenIO.Handle, prop: ATOM] RETURNS [val: REF]; IntPWrite: PROC [h: TokenIO.Handle, prop: REF, val: REF]; IntPRead: PROC [h: TokenIO.Handle, prop: ATOM] RETURNS [val: REF]; AtomPWrite: PROC [h: TokenIO.Handle, prop: REF, val: REF]; AtomPRead: PROC [h: TokenIO.Handle, prop: ATOM] RETURNS [val: REF]; SomePWrite: PROC [h: TokenIO.Handle, prop: REF, val: REF]; SomePRead: PROC [h: TokenIO.Handle, prop: ATOM] RETURNS [val: REF]; END. ζCDProperties.mesa a ChipNDale module Copyright c 1983, 1987 by Xerox Corporation. All rights reserved. Created by Christian Jacobi, September 27, 1983 2:06 pm Last edited by: Christian Jacobi, January 6, 1987 11:37:50 am PST Rules for property usage A property list requires following the ChipNDale access and registration rules when it is of type CD.PropList, CDProperties.PropList, CD.PropRef, CDProperties.PropRef or a derived type from one of those. Violating access rules can cause chaos for ChipNDale. Violating registration rules might prevent correct behaviour of unrelated ChipNDale tools; it is considered unfair. Access rules Don't modify ChipNDale PropList's directly with Properties; (PutProp can not monitor writing back the result parameter) Registration rules Atoms which start with the letters "CDX" or "CDx" (e.g. $CDxNMosTransitors) must be manual registered by the registrar and RegisterProperty must not be used. Atoms which start with the letters "CDY" or "CDy" (e.g. $CDyNMosTransitors) must not be registered, and there is no waranty of non-conflict. These may be used for debugging only. Atoms which start with other letters must be registered with RegisterProperty. RegisterProperty allows a registrationKey to enable re-registration. Use your name or the module name of the module you are implementing as registrationKey. Other REF-types need not be registered, since no conflicts may occur. Every module is allowed to introduce only a finite (fixed at compile time) number of "property names"s; they are kept in a table for "ever". Property registrations cannot be removed, since they may reside somewhere in the stored data. --Types and registration --Use only CDProperties to modify ChipNDale PropList's; Never Properties directly. --Initialization value for a PropRef --An object MUST be not accessible for ChipNDale until all its PropRef's are initialized. --Registers "prop" for usage; any program which wants to use an ATOM as a "prop" can --make sure it is the only user of this "prop". --If registrationKey#NIL and registrationKey is equal to registrationKey of previous --registration, a property registered again, otherwise raise CD.Error[doubleRegistration] --if prop is re-registered. --Usage -- Puts a prop val pair on a property list -- onto must not be of type PropList -- a NIL val removes the property -- It is the callers responsibility not to change properties of immutable objects -- unless the property is not considered part of the object itself. --Fetches a value from a property list; NIL if not found --Fetches a value from a property list; NIL if not found --PutProp and GetProp "understand" the following types: CD.Instance CD.Object CD.PropRef (CDProperties.PropRef) some more types which are only of secondary importance. --Speed-ups and special cases --Putting a NIL val removes the property in all cases -- It is the callers responsibility not to change properties of immutable things -- unless the property is not considered part of the things itself. --this property is NOT fetchable with Atom.GetProp --The onto Atom need not be registered anywhere, the registration of the --prop is enough to prevent conflicts. --warning: different objects may share bits, property owners loose! --does NOT fetch properties put on an ATOM with Atom.PutProp --The from Atom need not be registered anywhere, the registration of the --prop is enough to prevent conflicts --warning: different objects may share bits, property owners loose! --Two dimensional properties --Put value as property using the key sequence [key1, key2] --[of course: onto's key1 property is a property list, with a key2 property] --For simplicity: implementation might fail on concurrent PutPropProp's --Get property using key sequence [key1, key2] --[assumes: onto's key1 property is a property list, with a key2 property] --General property procedures --Installs procedures for a property registration. --Overwrites values for which procs has non NIL entries (except key). --prop must be registered and owned by caller. --Exceptional: The actual parameter procs.properties might have been created --with Properties directly. --Fetches the property registration --Don't copy PropertyProcs^; it can be extended by future calls of InstallProcs --Short cut for conveniance --sameProp returns prop again, to be used in declarations --Parameters and raised exceptions are the same as in RegisterProperty and InstallProcs --The procedure types of PropertyProcs will be called within CDProperties monitor lock. --They must not call any other procedure from CDProperties (wedges!!); But they may --call Properties directly. --valCopy: may be NIL if property should not be copied --purpose: -- copy procs will not recognize most purposes... -- but a particular property might want a particular handling from some tool --Copies properties individually using their MakeCopyProc's and defaults for some types --The resulting propList is put on putOnto --Copies properties individually using their MakeCopyProc's and defaults for some types. --Works like first copying looser, then copying winner. --copy is a different list from both, looser and winner --The resulting propList copy is put on putOnto --Like CopyProps, but returns PropList; --Consider: if you assign the copy to somewhere, the previous PropList might have been --changed after making the copy and before the assignment is finished. --Like AppendProps, but returns PropList; --Consider: if you assign the copy to somewhere, the previous PropList might have been --changed after making the copy and before the assignment is finished. --Executes arbitrary code within CDProperties monitor lock. Dangerous. --Must not call any other procedure from CDProperties (wedges!!) --May call Properties directly --Particular property procedures for clients implementing properties --to be shure that no copy is made; trivial procedure --copy of val; trivial procedure; is for some types a default anyway Design considerations A registeration procedure for property names is needed to prevent the same property name beeing used by two independent modules. Props are unique, and not used per technology since they hang on objects where the technology does not hang and some procs haven't a design or technology parameter. Κ §˜codešœ&™&Kšœ Οmœ7™BKšœ7™7K™AK˜—šΟk ˜ Kšžœ˜—K˜KšΟn œžœž œ˜"Kšž˜K˜šΟb™K™KšœΟ™ΟK™Kšœ5™5Kšœs™sK™—š  ™ Kšœw™wK™—š ™Kšœ™K™Kšœ³™³K™Kšœξ™ξK™K™EK™KšœŒ™ŒK™Kšœ_™_—K™K™Kšœ™K˜Kšœ žœžœ ˜šœ žœžœ Οc˜2KšœR™RK˜—šŸ œžœžœ žœ˜1Kšœ$™$Kšœ\™\Kšžœžœ žœ˜K˜K˜—š Ÿœžœžœžœžœ žœ˜SKšœU™UKšœ0™0KšœU™UKšœZ™ZKšœ™K™—K˜Kšœ™K˜š Ÿœžœžœžœžœžœ˜3Kšœ*™*Kšœ$™$Kšœ!™!KšœQ™QKšœG™GK˜—š Ÿœžœžœžœžœžœ˜3Kšœ8™8K˜—š Ÿ œžœžœžœžœ˜@Kšœ8™8K˜—šœ7žœ žœc™«K˜—K˜šœ™Kšœ5™5KšœP™PKšœG™GKšœ™—K˜Kš Ÿœžœžœžœžœžœ˜CKš Ÿ œžœžœžœžœžœ˜?Kš Ÿœžœžœžœžœžœ˜Gš Ÿ œžœžœžœžœžœ˜8Kšœ2™2KšœH™HKšœ&™&—š Ÿ œžœžœžœžœžœ˜?K™C—Kš Ÿ œžœžœžœžœžœ˜=š Ÿ œžœžœžœžœžœ˜>K™—šŸœžœžœžœžœžœžœ˜MKšžœ%˜+K˜—šŸ œžœžœžœžœžœžœ˜IKšžœ&˜,K˜—šŸœžœžœžœžœžœžœ˜QKšžœ&˜,K˜—š Ÿ œžœžœžœžœžœ˜8Kšœ&žœ™Kšœ=™=JšœL™LKšœH™HK˜—š Ÿ œžœžœžœžœžœ˜>Kšœ0™0JšœJ™JK˜—K™Kšœ™K˜šŸ œžœžœ)žœ˜LKšœ2™2KšœE™EKšœ.™.KšœM™MKšœ™K™—šŸ œžœžœžœ˜5Kšœ#™#KšœP™PK˜—šŸœžœžœ)žœžœžœžœ žœ˜~Kšœ™Kšœ9™9KšœW™WK˜—K˜Kšœžœžœ˜+šœžœžœ˜"Kšœžœ˜Kšœ$žœ˜*Kšœ"žœ˜&Kšœžœ˜#Kšœ žœžœ‘6˜OKšœ žœžœ‘˜1Kšœžœžœ‘ ˜