DIRECTORY RTBasic USING [Type, nullType], Rope USING [ROPE, Text], List USING [AList]; Atom: CEDAR DEFINITIONS IMPORTS Rope = BEGIN PropList: TYPE = List.AList; NILNotAnAtom: ERROR; emptyAtom: ATOM; -- atom with pname = "" MakeAtom: PROC [pName: Rope.ROPE] RETURNS[ATOM]; MakeAtomFromChar: PROC [char: CHARACTER] RETURNS[ATOM]; IsAnAtom: PROC [type: RTBasic.Type, dereferenced: BOOLEAN _ FALSE] RETURNS[BOOLEAN]; Gensym: PROC [c: CHARACTER _ 'A] RETURNS[ATOM]; GetPName: PROC[atom: ATOM] RETURNS[pName: Rope.Text]; Length: PROC [self: ATOM] RETURNS[LONG INTEGER]; GetPropertyList: PROC [atom: ATOM] RETURNS[List.AList]; -- gets entire property list GetProp: PROC [atom: ATOM, prop: REF ANY] RETURNS[REF ANY]; GetPropFromList: PROC [propList: PropList, prop: REF ANY] RETURNS[REF ANY]; PutProp: PROC [atom: ATOM, prop: REF ANY, val: REF ANY]; PutPropOnList: PROC [propList: PropList, prop: REF ANY, val: REF ANY] RETURNS[PropList]; RemProp: PROC [atom: ATOM, prop: REF ANY]; RemPropFromList: PROC [propList: PropList, prop: REF ANY] RETURNS[PropList]; TypePutProp: PRIVATE PROC [type: RTBasic.Type _ RTBasic.nullType, prop: ATOM, val: REF ANY]; TypeGetProp: PRIVATE PROC [type: RTBasic.Type _ RTBasic.nullType, prop: ATOM, dereferenced: BOOLEAN _ FALSE, ref: REF ANY _ NIL] RETURNS[REF ANY]; MapAtoms: PROC[proc: PROC[atom: ATOM]]; FindAtom: PROC[proc: PROC[atom: ATOM] RETURNS[stop: BOOLEAN]] RETURNS[ATOM]; END. change log 10-Feb-82 14:47:48 added zone for atoms. Changed all prop arguments from ATOM to REF ANY. Added pointer to Paxtons Reftab. 18-Feb-82 12:14:50 changed GetPName to return Rope.Text instead of REF TEXT June 1, 1982 3:28 pm name of argument to MakeAtom changed from ref to pName August 31, 1982 1:51 pm TypePutProp, TypeGetProp now private. ψAtom.Mesa last edited October 26, 1982 4:15 pm by Warren Teitelman Types Creating Atoms The following identity holds: Rope.Equal[r1,r2] <=> MakeAtom[r1] = MakeAtom[r2]. In particular, MakeAtom[""] = MakeAtom[NIL] = emptyAtom. Note that NIL # MakeAtom[NIL]. e.g. if x: TYPE = LIST OF REF ANY, and you obtain a tv for the first element of x, its type is of REF ANY. The only way to find out if this is an atom is to ask whether the type of its referent, i.e. Range[type], is the same as that of the type of the range of ATOM. This procedure does that for you. If dereferenced = TRUE, then type is the type of the referent, and in this case the test is whether type is equivalent to the range of ATOM. returns a new atom of the form c000n, incrementing n each time. PNames number of characters in pname property list operations provides a way of associating information with unique keys (atoms) using a single global name space. Note: An alternative way of associating information with unique keys... that can be arbitrary REFS, in a non-global fashion using specific structures (hash tables) is provided by the RefTab interface, which is also exported by ListsAndAtoms.bcd Property List Operations for types the following provide property list operations for types. Note that using them will invoke the runtime type package. associates val and prop for type, i.e. TypeGetProp[type, prop] will return val. If type is a ref type, also makes the association with the referent type, so that if TypeGetProp is called with type the referent type and dereferenced = TRUE, it will return val. The purpose of this is to enable you to start with a REF ANY, get the type for its referent, but find the attachment that corresponds to the REF ANY. If the TV interface allowed us to backup from the type of a referent to the type of a REF to that thing, then this would ot be necessary. returns the indicated association if any. dereferenced=TRUE means that type is the referent type for the object you are interested in. In this case, if the client previously did a type attachment on the reftype, (see above) TypeGetProp will be able to find it. If type is not specified, ref will be used to compute it (i.e. TVForReferent). In this case, dereferenced is implicitly TRUE. enumeration of atoms Κ‹– "Cedar" style˜J˜Jšœ ™ Jšœ8™8J˜šΟk ˜ Jšœœ˜Jšœœœ˜Jšœœ ˜J˜—JšΠblœœ œœ ˜(Jšœ˜headšΟn™JšŸœœ˜JšŸ œœ˜—šŸ™JšŸ œœΟc˜(š Ÿœœœœœ˜0Jšœ¨™¨—Jš Ÿœœ œœœ˜7š Ÿœœ$œœœœ˜TJš Ύ™Ύ—š Ÿœœ œœœ˜/Jš ?™?——šŸ™JšŸœœœœ˜6š Ÿœœœœœœ˜0Jš ™——šœ™Jšœd™dšœG™GJšœ­™­—J˜Jš Ÿœœœœ ˜TJšŸœœœœœœœœ˜;JšŸœœœœœœœ˜KJšŸœœœœœœœ˜9JšŸ œœœœœœœ ˜XJš Ÿœœœœœ˜+Jš Ÿœœœœœ ˜L—šœ"™"Jšœu™uJ˜š Ÿ œœœ/œœœ˜\Jš ₯™₯—šŸ œœœ/œœœœœœœœœ˜’Jš …™…Jšœ}™}——šœ™JšŸœœœœ˜'JšŸœœœœœœœœ˜LJ˜—Jšœ˜J˜J˜ J˜JšœIœœœ"˜zJšœCœ˜KJ˜KJ˜=J˜J˜—…—τw