DIRECTORY Rope USING [ROPE], TextNode USING [MaxLen, Offset, Ref, RefTextNode], UndoEvent USING [Ref]; AbbrevExpand: CEDAR DEFINITIONS = BEGIN RefTextNode: TYPE = TextNode.RefTextNode; Ref: TYPE = TextNode.Ref; Offset: TYPE = TextNode.Offset; MaxLen: Offset = TextNode.MaxLen; ROPE: TYPE = Rope.ROPE; Event: TYPE = UndoEvent.Ref; Load: PROC [fileName, dictName: ROPE, start: Offset _ 0, len: Offset _ MaxLen] RETURNS [count: NAT]; Clear: PROC [dictName: ROPE]; IllFormedDef: ERROR; Expand: PROC [keyNode: RefTextNode, keyEnd: Offset, dict: ROPE, event: Event _ NIL] RETURNS [foundIt: BOOLEAN, keyDeterminesDict: BOOLEAN, keyStart, keyLen, resultLen: Offset, commands: LIST OF REF ANY]; Start: PROC; -- for initialization only END. ¶AbbrevExpand.mesa written by Bill Paxton, August 1981 last edit by Bill Paxton, April 5, 1982 1:35 pm Doug Wyatt, January 17, 1984 5:53:33 pm PST This is the interface for abbreviation expansion in Tioga -- the following take an atom as the name of the dictionary to operate on -- will automatically try to load file with extension "Abbreviations" -- only tries this once per session -- must explicitly load it -- reads the file and adds the abbreviations to the specified dictionary -- returns number of abbreviations -- removes all entries from the dictionary -- if when try to Expand, definition not of form =, then get error -- key must be 1 or more alphadigits -- optionally can have blanks (spaces/tabs/cr's) between key and "=" -- looks in dictionary for entry with matching key -- match ignores capitalization of keys -- unless key is of form . -- in which case it only looks in the specified dictionary -- and returns with keyDeterminesDict=TRUE -- if finds a matching entry, then -- replace key text by text from entry -- if key in entry is followed by blanks before "=", -- then skip one blank in text after the "=" -- if key text was all upper case, force new text uppercase also -- if key text not all upper but had initial cap, -- make new text have an initial cap -- otherwise, don't change capitalization of new text -- if first character of key had looks, add those looks to new text -- if entry node has a nonnull type name, set key node type name -- if entry node has children, insert copies of them as children of key node -- return start and len of new text -- can optionally have command list enclosed in ( )'s between key name and '= -- ***** Initialization ÊV˜šœ™Jšœ#™#Jšœ/™/J™+—J˜Jšœ9™9J˜šÏk ˜ Jšœœœ˜Jšœ œ$˜2Jšœ œ˜J˜—Jšœ˜Jšœ˜J˜Jšœ œ˜)Jšœœ˜Jšœœ˜J˜!Jšœœœ˜Jšœœ˜J˜JšÏcI™IšžE™EJšž#™#Jšž™J˜—šÏnœ˜ Jšœœ*˜CJšœ œ˜JšžH™HJšž"™"J˜—šŸœœ œ˜Jšž*™*J˜—šœœ˜JšžM™MJšž$™$JšžD™DJ˜—šŸœ˜ Jšœ-œœ˜Fšœ œœ&˜[Jš œ œœœœ˜—šž2™2Jšž'™'—šž-™-šž:™:Jšž*™*——šž"™"šž&™&šž4™4Jšž,™,——Jšž@™@šž2™2Jšž$™$—Jšž5™5JšžC™CJšž@™@JšžL™LJšž#™#—JšžM™MJ˜J˜—Jšž™J˜JšŸœœž˜'J˜Jšœ˜J˜—…—ê ö