DIRECTORY TEditDocument USING [Selection, SelectionRec], TEditSelection; TEditSelectionAllocImpl: CEDAR MONITOR EXPORTS TEditSelection = BEGIN OPEN TEditSelection; pSel: PUBLIC TEditDocument.Selection _ Create[]; sSel: PUBLIC TEditDocument.Selection _ Create[]; fSel: PUBLIC TEditDocument.Selection _ Create[]; oldSel: PUBLIC TEditDocument.Selection _ Create[]; nilSel: PUBLIC TEditDocument.Selection _ Create[]; tSel1, tSel2, tSel3: TEditDocument.Selection; -- cache of temporary selection records Create: PUBLIC PROC RETURNS [TEditDocument.Selection] = { RETURN [NEW[TEditDocument.SelectionRec]] }; Alloc: PUBLIC ENTRY PROC RETURNS [tSel: TEditDocument.Selection] = { ENABLE UNWIND => NULL; IF tSel3 # NIL THEN { tSel _ tSel3; tSel3 _ NIL } ELSE IF tSel2 # NIL THEN { tSel _ tSel2; tSel2 _ NIL } ELSE IF tSel1 # NIL THEN { tSel _ tSel1; tSel1 _ NIL } ELSE tSel _ Create[]; }; Free: PUBLIC ENTRY PROC [tSel: TEditDocument.Selection] = { ENABLE UNWIND => NULL; IF tSel3 = tSel OR tSel2 = tSel OR tSel1 = tSel THEN ERROR; IF tSel3 = NIL THEN tSel3 _ tSel ELSE IF tSel2 = NIL THEN tSel2 _ tSel ELSE IF tSel1 = NIL THEN tSel1 _ tSel; }; Copy: PUBLIC ENTRY PROC [source, dest: TEditDocument.Selection] = { ENABLE UNWIND => NULL; dest^ _ source^; }; END. ΈTEditSelectionAllocImpl.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Edited by Paxton on December 28, 1982 2:01 pm Doug Wyatt, March 3, 1985 6:28:45 pm PST ΚN˜codešœ™Kšœ Οmœ1™