DIRECTORY Rope USING [ROPE], IO USING [Handle]; GPM: CEDAR DEFINITIONS = BEGIN Handle: TYPE = REF Object; Object: TYPE = RECORD [ stream: IO.Handle, st: REF Stack, outputChar: CHARACTER _ 0C, startCall: CHARACTER _ '&, endCall: CHARACTER _ ';, singleQuote: CHARACTER _ '', -- treat next char as if surrounded by startQuote, endQuote startQuote: CHARACTER _ '<, endQuote: CHARACTER _ '>, sepArg: CHARACTER _ ',, numArg: CHARACTER _ '~, 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: CHARACTER, -- 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 ]; BuiltIn: TYPE = [1..3]; DEF: BuiltIn = 1; VAL: BuiltIn = 2; UPDATE: BuiltIn = 3; Open: PROC [stream: IO.Handle] RETURNS [Handle]; Close: PROC [self: Handle]; GetChar: PROC [self: Handle] RETURNS [char: CHARACTER]; GetIndex: PROC [self: Handle] RETURNS [i: LONG INTEGER]; Error: ERROR [ec: ErrorCode, errorMsg: Rope.ROPE]; ErrorCode: TYPE = { MacroError, EndOfStream }; DumpToStream: PROC [output: IO.Handle, input: Handle]; END. BGPM.Mesa last written by Paxton June 21, 1982 10:54 am originating from Strachey's General Purpose Macrogenerator as described in Computer Journal, Oct. 1965. pp. 225-241 written in Mesa by Bill Paxton, November 1981 Last Edited by: Maxwell, December 17, 1982 9:51 am h=0 means destination is output stream rather than stack i.e., have seen the & but not the matching ; c=0 means source is input stream rather than stack data: SELECT kind:* FROM index => [ index: Index ], length => [ length: Index ], char => [ char: CHARACTER ], builtin => [ name: BuiltIn ], ENDCASE]; Κ– "Mesa" style˜JšΟc™Jš-™-J˜Jš:™:Jš8™8Jš-™-Jšœ2™2J™šΟk ˜ Jšœžœžœ˜Jšžœžœ ˜J˜—Jšžœžœž˜˜Jšœžœžœ˜J˜šœžœžœ˜Jšœžœ˜Jšœžœ˜Jšœ ž œ˜Jšœ ž œ˜Jšœ ž œ˜Jšœ ž œ;˜XJšœ ž œ˜Jšœ ž œ˜Jšœž œ˜Jšœž œ˜Jšœžœžœ˜Jšœ žœ˜Jšœ #˜-Jšœ 4˜>šœ =˜GJš8™8—Jšœ 8˜Bšœ 6˜@Jš,™,—šœ (˜2Jš2™2—Jšœž œ"˜0Jšœ ˜#Jšœžœ˜%J˜J˜—Jš œžœžœ žœžœžœ˜=J˜Jšœžœ˜ Jšœ žœžœžœ˜J˜Jšœžœžœ žœ˜'—Jš™Jš™Jš™Jš™Jš™Jš ™ ˜Jšœ žœ ˜J˜Jšžœ˜Jšžœ˜Jšžœ˜J˜JšΟnœžœ žœ žœ ˜0J˜JšŸœžœ˜J˜JšŸœžœžœž œ˜7J˜Jš Ÿœžœžœžœžœ˜8J˜Jšœžœ žœ˜2J˜Jšœ žœ˜.J˜JšŸ œžœ žœ˜6J˜—Jšžœ˜J˜—…—& h