<<-- EditAddrs.Mesa>> <<-- written by Paxton. March 1981>> <<-- last written by Paxton. August 11, 1982 10:32 am>> <<-- **** Persistent addressing ****>> DIRECTORY TextNode; EditAddrs: DEFINITIONS = BEGIN Ref: TYPE = REF Body; Body: TYPE = RECORD [addrs: Pair]; RefTextNode: TYPE = TextNode.RefTextNode; Offset: TYPE = TextNode.Offset; Pair: TYPE = REF PairBody; PairBody: TYPE = RECORD [next: Pair, addr: REF, location: Offset]; Create: PROC RETURNS [Ref]; PutAddr: PROC [ref: Ref, addr: REF, location: Offset]; <<-- assigns addr to location in ref>> <<-- ok if addr was previously assigned elsewhere>> RemAddr: PROC [ref: Ref, addr: REF]; <<-- removes the given addr>> GetAddr: PROC [ref: Ref, addr: REF] RETURNS [location: Offset]; <<-- generates OffsetAddrs.AddrNotFound if the addr is not in the mapping>> AddrNotFound: ERROR; TryGetAddr: PROC [ref: Ref, addr: REF] RETURNS [found: BOOLEAN, location: Offset]; MapAddrs: PROC [ref: Ref, action: MapAddrsAction] RETURNS [BOOLEAN]; <<-- apply the action to each addr&location pair for the ref>> <<-- returns true if&when an action returns true>> MapAddrsAction: TYPE = PROC [addr: REF, location: Offset] RETURNS [BOOLEAN]; <<-- **** notify proc registration ****>> AddNotifyProc, RemoveNotifyProc: PROC [proc: AddrNotifyProc]; AddrNotifyProc: TYPE = PROC [node: RefTextNode, new: PROC [old: Offset] RETURNS [Offset]]; <<-- **** Editing Operations for persistent addrs ****>> Replace: PROC [node: RefTextNode, start, len, newlen: Offset]; <<-- replace chars in [start..start+len) by newlen chars>> <<-- addrs that are in the replaced section move to start>> <<-- add (newlen-len) to addrs that are after the replaced section>> <<-- **** Update Functions for persistent addrs ****>> AfterReplace: PROC [initLoc, start, len, newlen: Offset] RETURNS [newLoc: Offset]; Start: PROC; -- for initialization only END.