<> <> <> <> <> <> <> <> <> <<>> DIRECTORY Rope USING [ROPE], IO USING [STREAM]; GPM: CEDAR DEFINITIONS = BEGIN Handle: TYPE = REF Object; Object: TYPE = RECORD [ stream: IO.STREAM, st: REF Stack, outputChar: CHAR _ 0C, startCall: CHAR _ '&, endCall: CHAR _ ';, singleQuote: CHAR _ '', -- treat next char as if surrounded by startQuote, endQuote startQuote: CHAR _ '<, endQuote: CHAR _ '>, sepArg: CHAR _ ',, numArg: CHAR _ '~, output: REF TEXT, outputPtr: NAT _ 0, s: Index, -- next available cell in the stack e: Index, -- chain of name-value pairs for current definitions h: Index, -- index of length cell for incomplete string on top of stack <> p: Index, -- start of chain of calls entered but not yet completed f: Index, -- start of chain of calls started but not yet entered <> c: Index, -- index of next character to be scanned <> a: CHAR, -- temp for use by NextCh and Load w: Index, -- temp for use with Find q: NAT -- level of nesting inside <'s ]; Stack: TYPE = RECORD [entries: SEQUENCE length:NAT OF Entry]; Index: TYPE = [0..maxIndex] _ 0; maxIndex: NAT = LAST[NAT]; Entry: TYPE = RECORD [ data: INTEGER ]; <> < [ index: Index ],>> < [ length: Index ],>> < [ char: CHARACTER ],>> < [ name: BuiltIn ],>> <> BuiltIn: TYPE = [1..3]; DEF: BuiltIn = 1; gpmVAL: BuiltIn = 2; UPDATE: BuiltIn = 3; Open: PROC [stream: IO.STREAM] RETURNS [Handle]; Close: PROC [self: Handle]; GetChar: PROC [self: Handle] RETURNS [char: CHAR]; GetIndex: PROC [self: Handle] RETURNS [i: LONG INTEGER]; Error: ERROR [ec: ErrorCode, errorMsg: Rope.ROPE]; ErrorCode: TYPE = { MacroError, EndOfStream }; DumpToStream: PROC [output: IO.STREAM, input: Handle]; END.