DIRECTORY Atom USING [MakeAtomFromRefText], Basics USING [ShortNumber, LowByte], RefText USING [line, AppendChar], Rope USING [ROPE, FromRefText], MicroDefs, MicroOps USING [GetSymbol], MicroUtils USING []; MicroUtilsImpl: CEDAR PROGRAM IMPORTS Atom, Basics, RefText, Rope, MicroOps EXPORTS MicroUtils = BEGIN OPEN MicroDefs; pnameBuf: REF TEXT _ NEW[TEXT[RefText.line]]; GetCharAtPointer: PUBLIC PROC[aPtr: LONG POINTER TO WORD] RETURNS[ch: CHAR] = TRUSTED { byte: BYTE _ Basics.LowByte[aPtr^]; RETURN[LOOPHOLE[byte, CHAR] ]; }; PutCharAtPointer: PUBLIC PROC[aPtr: LONG POINTER TO WORD, ch: CHAR] = TRUSTED { sn: Basics.ShortNumber; sn.hi _ 0; sn.lo _ LOOPHOLE[ch, BYTE]; aPtr^ _ LOOPHOLE[sn, INTEGER]; }; ValNotChar: SIGNAL[val: WORD] = CODE; AtomAtPointer: PUBLIC PROC[ePtr: LONG POINTER TO WORD, len: INTEGER] RETURNS[symb: ATOM] = { pnameBuf.length _ 0; IF len = 0 THEN RETURN[NIL]; IF len > 64 THEN ERROR; FOR i: INTEGER IN [0..len) DO val: WORD; TRUSTED { val _ (ePtr+i)^ }; IF val < 40B OR val > 377B THEN SIGNAL ValNotChar[val]; TRUSTED { [] _ RefText.AppendChar[pnameBuf, GetCharAtPointer[ePtr+i]] }; ENDLOOP; RETURN[Atom.MakeAtomFromRefText[pnameBuf]]; }; RopeAtPointer: PUBLIC PROC[aPtr: LONG POINTER TO WORD, lx: INTEGER] RETURNS[name: Rope.ROPE] = { pnameBuf.length _ 0; IF lx = 0 THEN RETURN[NIL]; IF lx > 100 THEN ERROR; FOR i: INTEGER IN [0..lx) DO TRUSTED { [] _ RefText.AppendChar[pnameBuf, GetCharAtPointer[aPtr+i]] }; ENDLOOP; RETURN[Rope.FromRefText[pnameBuf]]; }; MoveBlock: PUBLIC PROC[to, from: LONG POINTER TO WORD, num: INTEGER] = TRUSTED { FOR i: INTEGER IN [0..num) DO to^ _ from^; to _ to + 1; from _ from + 1; ENDLOOP; }; GetSymbolMemSink: PUBLIC PROC[symIndex: INTEGER] RETURNS[INTEGER] = { sObj: SymbolObj = MicroOps.GetSymbol[symIndex]; mObj: SymbolObj = MicroOps.GetSymbol[sObj.sMisc]; mem: Memory = NARROW[mObj.sData]; RETURN[mem.sinkIndex]; }; GetSymbolMemSource: PUBLIC PROC[symIndex: INTEGER] RETURNS[INTEGER] = { sObj: SymbolObj = MicroOps.GetSymbol[symIndex]; mObj: SymbolObj = MicroOps.GetSymbol[sObj.sMisc]; mem: Memory = NARROW[mObj.sData]; RETURN[mem.sourceIndex]; }; END. ΄MicroUtilsImpl.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Willie-sue, July 29, 1987 4:24:29 pm PDT taken from --.bcpl moves num words from from to to ΚΞ˜šœ™Icodešœ Οmœ1™