DIRECTORY Basics USING [Comparison], FS USING [AccessOptions], IO USING [STREAM]; PS: CEDAR DEFINITIONS ~ BEGIN Comparison: TYPE ~ Basics.Comparison; STREAM: TYPE ~ IO.STREAM; Text: TYPE ~ REF READONLY TEXT; MutableText: TYPE ~ REF TEXT; TypeCode: TYPE ~ {null, integer, real, boolean, array, string, name, dict, operator, file, mark, save, font}; Access: TYPE ~ {none, executeOnly, readOnly, unlimited}; Any: TYPE ~ RECORD [val: Val, ref: REF]; Val: TYPE ~ RECORD [ executable: BOOL, variant: SELECT type: TypeCode FROM null => [], integer => [int: INT], real => [real: REAL], boolean => [bool: BOOL], array => [access: Access, start, length: ArrayIndex], -- ref: ArrayRef string => [access: Access, start, length: StringIndex], -- ref: StringRef dict => [], -- ref: DictRef file => [access: Access], -- ref: FileRef name => [], -- ref: NameRef operator => [], -- ref: OperatorRef mark => [], save => [level: Level], font => [], -- ref: FontRef ENDCASE ]; null: Any ~ [val: [executable: FALSE, variant: null[]], ref: NIL]; mark: Any ~ [val: [executable: FALSE, variant: mark[]], ref: NIL]; Array: TYPE ~ RECORD [val: Val.array, ref: ArrayRef]; ArrayRef: TYPE ~ REF ArrayRep; ArrayRep: TYPE ~ RECORD [level: Level, elements: SEQUENCE size: ArrayIndex OF Any]; ArrayIndex: TYPE ~ NAT; String: TYPE ~ RECORD [val: Val.string, ref: StringRef]; StringRef: TYPE ~ REF StringRep; StringRep: TYPE ~ RECORD [level: Level, elements: SEQUENCE size: StringIndex OF CHAR]; StringIndex: TYPE ~ NAT; Dict: TYPE ~ RECORD [val: Val.dict, ref: DictRef]; DictRef: TYPE ~ REF DictRep; DictRep: TYPE ~ RECORD [ level: Level, access: Access, length: DictIndex, maxlength: DictIndex, tuples: SEQUENCE mod: DictIndex OF Tuple ]; DictIndex: TYPE ~ NAT; Tuple: TYPE ~ RECORD [key: Any, val: Any]; nullTuple: Tuple ~ [null, null]; File: TYPE ~ RECORD [val: Val.file, ref: FileRef]; FileRef: TYPE ~ REF FileRep; FileRep: TYPE ~ RECORD [stream: STREAM]; Name: TYPE ~ RECORD [val: Val.name, ref: NameRef]; NameRef: TYPE ~ REF NameRep; NameRep: TYPE ~ RECORD [level: Level, string: String, hash: CARDINAL]; Operator: TYPE ~ RECORD [val: Val.operator, ref: OperatorRef]; OperatorRef: TYPE ~ REF OperatorRep; OperatorRep: TYPE ~ RECORD [proc: OperatorProc, text: Text]; OperatorProc: TYPE ~ PROC [self: Root]; Level: TYPE ~ [0..16); RestoreItem: TYPE ~ REF RestoreItemRep; RestoreItemRep: TYPE ~ RECORD [ next: RestoreItem, variant: SELECT tag: * FROM array => [ref, copy: ArrayRef], string => [ref, copy: StringRef], dict => [ref, copy: DictRef], ENDCASE ]; StackIndex: TYPE ~ NAT; OStack: TYPE ~ REF OStackRep; OStackRep: TYPE ~ RECORD [SEQUENCE size: StackIndex OF Any]; DStack: TYPE ~ REF DStackRep; DStackRep: TYPE ~ RECORD [SEQUENCE size: StackIndex OF Dict]; RestoreStack: TYPE ~ REF RestoreStackRep; RestoreStackRep: TYPE ~ ARRAY Level OF RestoreItem; Root: TYPE ~ REF RootRep; RootRep: TYPE ~ RECORD [ zone: ZONE, buffer: MutableText, ostack: OStack, -- operand stack osize: StackIndex, -- size of ostack ocount: StackIndex, -- current depth of ostack dstack: DStack, -- dictionary stack dsize: StackIndex, -- size of dstack dcount: StackIndex, -- current depth of dstack esize: StackIndex, -- size of "estack" ecount: StackIndex, -- depth of "estack" restore: RestoreStack, -- save/restore stack level: Level, -- current save level systemdict: Dict, userdict: Dict, errordict: Dict, nameDict: Dict, -- string => name stdin: File, stdout: File, stderr: File, scratch: Scratch, graphics: Graphics ]; Scratch: TYPE ~ REF ScratchRep; ScratchRep: TYPE; Graphics: TYPE ~ REF GraphicsRep; GraphicsRep: TYPE; Error: ERROR [error: ErrorCode]; ErrorCode: TYPE ~ {dictfull, dictstackoverflow, dictstackunderflow, execstackoverflow, interrupt, invalidaccess, invalidexit, invalidfileaccess, invalidfont, invalidrestore, ioerror, limitcheck, nocurrentpoint, rangecheck, stackoverflow, stackunderflow, syntaxerror, timeout, typecheck, undefined, undefinedfilename, undefinedresult, unimplemented, unmatchedmark, unregistered, VMerror}; Bug: ERROR; Type: PROC [x: Any] RETURNS [TypeCode] ~ INLINE { RETURN [x.val.type] }; NameFromType: PROC [self: Root, type: TypeCode] RETURNS [Name]; XCheck: PROC [x: Any] RETURNS [BOOL] ~ INLINE { RETURN [x.val.executable] }; CvLit: PROC [x: Any] RETURNS [Any] ~ INLINE { x.val.executable _ FALSE; RETURN[x] }; CvX: PROC [x: Any] RETURNS [Any] ~ INLINE { x.val.executable _ TRUE; RETURN[x] }; IntFromAny: PROC [x: Any] RETURNS [INT]; RealFromAny: PROC [x: Any] RETURNS [REAL]; BoolFromAny: PROC [x: Any] RETURNS [BOOL]; ArrayFromAny: PROC [x: Any, access: Access] RETURNS [Array]; StringFromAny: PROC [x: Any, access: Access] RETURNS [String]; DictFromAny: PROC [x: Any, access: Access] RETURNS [Dict]; FileFromAny: PROC [x: Any, access: Access] RETURNS [File]; NameFromAny: PROC [x: Any] RETURNS [Name]; OperatorFromAny: PROC [x: Any] RETURNS [Operator]; AnyFromInt: PROC [INT] RETURNS [Any]; AnyFromReal: PROC [REAL] RETURNS [Any]; AnyFromBool: PROC [BOOL] RETURNS [Any]; AnyFromArray: PROC [Array] RETURNS [Any]; AnyFromString: PROC [String] RETURNS [Any]; AnyFromDict: PROC [Dict] RETURNS [Any]; AnyFromFile: PROC [File] RETURNS [Any]; AnyFromName: PROC [Name] RETURNS [Any]; AnyFromOperator: PROC [Operator] RETURNS [Any]; PushAny: PROC [self: Root, x: Any]; PushInt: PROC [self: Root, int: INT]; PushReal: PROC [self: Root, real: REAL]; PushBool: PROC [self: Root, bool: BOOL]; PushArray: PROC [self: Root, array: Array]; PushString: PROC [self: Root, string: String]; PushDict: PROC [self: Root, dict: Dict]; PushFile: PROC [self: Root, file: File]; PushName: PROC [self: Root, name: Name]; PushLevel: PROC [self: Root, level: Level]; PopAny: PROC [self: Root] RETURNS [Any]; PopInt: PROC [self: Root] RETURNS [INT]; PopReal: PROC [self: Root] RETURNS [REAL]; PopBool: PROC [self: Root] RETURNS [BOOL]; PopArray: PROC [self: Root, access: Access] RETURNS [Array]; PopString: PROC [self: Root, access: Access] RETURNS [String]; PopDict: PROC [self: Root, access: Access] RETURNS [Dict]; PopFile: PROC [self: Root, access: Access] RETURNS [File]; PopName: PROC [self: Root] RETURNS [Name]; PopOperator: PROC [self: Root] RETURNS [Operator]; PopLevel: PROC [self: Root] RETURNS [Level]; PopProc: PROC [self: Root] RETURNS [Any]; PushMark: PROC [self: Root]; PopMark: PROC [self: Root]; Copy: PROC [self: Root, n: INT]; Roll: PROC [self: Root, n, j: INT]; Index: PROC [self: Root, n: INT] RETURNS [Any]; Clear: PROC [self: Root]; Count: PROC [self: Root] RETURNS [StackIndex] ~ INLINE { RETURN [self.ocount] }; ClearToMark: PROC [self: Root]; CountToMark: PROC [self: Root] RETURNS [StackIndex]; TypeIndex: PROC [self: Root, n: StackIndex] RETURNS [TypeCode]; Ceiling: PROC [real: REAL] RETURNS [REAL]; Floor: PROC [real: REAL] RETURNS [REAL]; Round: PROC [real: REAL] RETURNS [REAL]; Truncate: PROC [real: REAL] RETURNS [REAL]; Rand: PROC [self: Root] RETURNS [INT]; SRand: PROC [self: Root, seed: INT]; RRand: PROC [self: Root] RETURNS [INT]; ArrayCreate: PROC [self: Root, size: INT] RETURNS [Array]; ArrayAccess: PROC [array: Array] RETURNS [Access] ~ INLINE { RETURN [array.val.access] }; ArraySetAccess: PROC [array: Array, access: Access] RETURNS [Array] ~ INLINE { array.val.access _ access; RETURN [array] }; ArrayLength: PROC [array: Array] RETURNS [ArrayIndex] ~ INLINE { RETURN [array.val.length] }; ArrayGet: PROC [array: Array, index: INT] RETURNS [Any]; ArrayPut: PROC [self: Root, array: Array, index: INT, x: Any]; ArrayGetInterval: PROC [array: Array, index, count: INT] RETURNS [Array]; ArrayPutInterval: PROC [self: Root, array: Array, index: INT, interval: Array]; ArrayCopy: PROC [self: Root, array: Array, from: Array] RETURNS [Array]; ArrayForAll: PROC [array: Array, action: PROC [Any]]; ALoad: PROC [self: Root, array: Array]; AStore: PROC [self: Root, array: Array]; StringCreate: PROC [self: Root, size: INT] RETURNS [String]; StringCreateFromText: PROC [self: Root, text: Text] RETURNS [String]; StringAccess: PROC [string: String] RETURNS [Access] ~ INLINE { RETURN [string.val.access] }; StringSetAccess: PROC [string: String, access: Access] RETURNS [String] ~ INLINE { string.val.access _ access; RETURN [string] }; StringLength: PROC [string: String] RETURNS [StringIndex] ~ INLINE { RETURN [string.val.length] }; StringGet: PROC [string: String, index: INT] RETURNS [CHAR]; StringPut: PROC [self: Root, string: String, index: INT, x: CHAR]; StringGetInterval: PROC [string: String, index, count: INT] RETURNS [String]; StringPutInterval: PROC [self: Root, string: String, index: INT, interval: String]; StringCopy: PROC [self: Root, string: String, from: String] RETURNS [String]; StringForAll: PROC [string: String, action: PROC [CHAR]]; Search: PROC [string, seek: String, anchor: BOOL] RETURNS [found: BOOL, index: INT]; StringEq: PROC [string1, string2: String] RETURNS [BOOL]; StringCompare: PROC [string1, string2: String] RETURNS [Comparison]; StringToken: PROC [self: Root, string: String] RETURNS [found: BOOL, token: Any, post: String]; DictCreate: PROC [self: Root, size: INT] RETURNS [Dict]; DictAccess: PROC [dict: Dict] RETURNS [Access] ~ INLINE { RETURN [dict.ref.access] }; DictSetAccess: PROC [self: Root, dict: Dict, access: Access] RETURNS [Dict] ~ INLINE { dict.ref.access _ access; RETURN [dict] }; DictLength: PROC [dict: Dict] RETURNS [DictIndex] ~ INLINE { RETURN [dict.ref.length] }; DictMaxLength: PROC [dict: Dict] RETURNS [DictIndex] ~ INLINE { RETURN [dict.ref.maxlength] }; DictGet: PROC [dict: Dict, key: Any] RETURNS [Any]; DictGetText: PROC [dict: Dict, text: Text] RETURNS [Any]; DictPut: PROC [self: Root, dict: Dict, key: Any, val: Any, name: BOOL _ FALSE]; Known: PROC [dict: Dict, key: Any] RETURNS [BOOL]; DictCopy: PROC [self: Root, dict: Dict, from: Dict] RETURNS [Dict]; DictForAll: PROC [dict: Dict, action: PROC [Any, Any]]; Begin: PROC [self: Root, dict: Dict]; End: PROC [self: Root]; Def: PROC [self: Root, key: Any, val: Any]; Load: PROC [self: Root, key: Any] RETURNS [Any]; Store: PROC [self: Root, key: Any, val: Any]; Where: PROC [self: Root, key: Any] RETURNS [found: BOOL, where: Dict]; CurrentDict: PROC [self: Root] RETURNS [Dict]; CountDictStack: PROC [self: Root] RETURNS [StackIndex]; DictStack: PROC [self: Root, array: Array] RETURNS [Array]; Eq: PROC [x1, x2: Any] RETURNS [BOOL]; EqText: PROC [x: Any, text: Text] RETURNS [BOOL]; Compare: PROC [x1, x2: Any] RETURNS [Comparison]; FileAccessMode: TYPE ~ FS.AccessOptions; FileCreate: PROC [self: Root, string: String, accessMode: FileAccessMode] RETURNS [File]; FileFromStream: PROC [self: Root, stream: STREAM] RETURNS [File]; FileAccess: PROC [file: File] RETURNS [Access] ~ INLINE { RETURN [file.val.access] }; FileSetAccess: PROC [file: File, access: Access] RETURNS [File] ~ INLINE { file.val.access _ access; RETURN [file] }; Read: PROC [file: File] RETURNS [CHAR]; EndOfFile: ERROR; Write: PROC [file: File, char: CHAR]; ReadHexString: PROC [self: Root, file: File, string: String] RETURNS [String, BOOL]; WriteHexString: PROC [file: File, string: String]; ReadString: PROC [self: Root, file: File, string: String] RETURNS [String, BOOL]; WriteString: PROC [file: File, string: String]; ReadLine: PROC [self: Root, file: File, string: String] RETURNS [String, BOOL]; BytesAvailable: PROC [file: File] RETURNS [INT]; FlushFile: PROC [file: File]; ResetFile: PROC [file: File]; CloseFile: PROC [file: File]; Status: PROC [file: File] RETURNS [BOOL]; FileToken: PROC [self: Root, file: File] RETURNS [found: BOOL, token: Any]; Echo: PROC [self: Root, echo: BOOL]; NameLength: PROC [name: Name] RETURNS [INT]; NameFromText: PROC [self: Root, text: Text] RETURNS [Name]; NameFromString: PROC [self: Root, string: String] RETURNS [Name]; IntFromChar: PROC [char: CHAR] RETURNS [INT] ~ INLINE { RETURN [ORD[char]] }; CharFromInt: PROC [int: INT] RETURNS [CHAR]; RealFromInt: PROC [int: INT] RETURNS [REAL] ~ INLINE { RETURN [REAL[int]] }; IntFromReal: PROC [real: REAL] RETURNS [INT]; IntFromString: PROC [String] RETURNS [INT]; RealFromString: PROC [String] RETURNS [REAL]; StringFromInt: PROC [self: Root, string: String, int: INT, radix: INT _ 10] RETURNS [String]; StringFromReal: PROC [self: Root, string: String, real: REAL] RETURNS [String]; StringFromName: PROC [self: Root, string: String, name: Name] RETURNS [String]; StringFromOperator: PROC [self: Root, string: String, operator: Operator] RETURNS [String]; StringFromText: PROC [self: Root, string: String, text: Text, start: NAT _ 0, len: NAT _ NAT.LAST] RETURNS [String]; Save: PROC [self: Root] RETURNS [Level]; Restore: PROC [self: Root, level: Level]; Execute: PROC [self: Root, x: Any, directly: BOOL _ FALSE]; CurrentFile: SIGNAL RETURNS [File]; Exit: SIGNAL; Stop: ERROR; Quit: ERROR; Register: PROC [self: Root, text: Text, val: Any]; RegisterOperator: PROC [self: Root, text: Text, proc: OperatorProc]; NoteInitialization: PROC [PROC [Root]]; END. ΊPS.mesa Copyright Σ 1986, 1987 by Xerox Corporation. All rights reserved. Doug Wyatt, August 21, 1987 1:57:15 pm PDT Type declarations random: Random.RandomStream, Errors Types and attributes Operand stack manipulation operators Arithmetic and math operators Array operators String operators Dictionary operators Relational operators File operators Name operators Conversion operators Virtual memory operators Execution Initialization Κ˜codešœ™KšœB™BK™*—K˜šΟk ˜ Kšœœ˜Kšœœ˜Kšœœœ˜—K˜KšΡbklœœ ˜šœ˜K˜Kšœ œ˜%Kšœœœœ˜—head™Kš œœœœœ˜šœ œœœ˜K˜—šœ œ_˜mK˜—šœœ,˜8K˜—Kšœœœœ˜(šœœœ˜Kšœ œ˜šœ œ˜#Kšœ ˜ Kšœœ˜Kšœœ˜Kšœœ˜Kšœ6Οc˜FKšœ8Ÿ˜IKšœ Ÿ˜KšœŸ˜)Kšœ Ÿ˜KšœŸ˜#Kšœ ˜ Kšœ˜Kšœ Ÿ˜Kš˜—K˜K˜—Kšœœœ˜Bšœœœ˜BK˜—Kšœœœ!˜5Kšœ œœ ˜Kš œ œœœœ˜Sšœ œœ˜K˜—Kšœœœ#˜8Kšœ œœ ˜ Kš œ œœœœœ˜Všœ œœ˜K˜—Kšœœœ˜2Kšœ œœ ˜šœ œœ˜K˜ Kšœ˜Kšœ˜Kšœ˜Kšœœœ˜(Kšœ˜—Kšœ œœ˜Kšœœœ˜*˜ K˜—Kšœœœ˜2Kšœ œœ ˜šœ œœ œ˜(K˜—Kšœœœ˜2Kšœ œœ ˜šœ œœ&œ˜FK˜—Kšœ œœ'˜>Jšœ œœ ˜$Jšœ œœ"˜<šœœœ˜'K˜—šœœ ˜K˜—Kšœ œœ˜'šœœœ˜K˜šœ œ˜K˜K˜!K˜Kš˜—K˜K˜—šœ œœ˜K˜—Kšœœœ ˜š œ œœœœ˜Kš  œœœ˜:Kš  œœœ˜:Kš  œœ œ˜*Kš œœ œ ˜2Mš  œœœœ˜%Kš  œœœœ˜'Kš  œœœœ˜'Kš  œœ œ˜)Kš  œœ œ˜+Kš  œœœ˜'Kš  œœœ˜'Kš  œœœ˜'Kš œœ œ˜/—™$Kš œœ˜#Kš œœœ˜%Kš œœœ˜(Kš œœœ˜(Kš  œœ˜+Kš  œœ˜.Kš œœ˜(Kš œœ˜(Kš œœ˜(Kš  œœ˜+Mš œœœ˜(Kš œœœœ˜(Kš œœœœ˜*Kš œœœœ˜*Kš œœœ ˜Kš œœœ˜:Kš œœœ˜:Kš œœœ˜*Kš  œœœ ˜2Kš œœœ ˜,Kš œœœ˜)Mš œœ˜Kš œœ˜Mš œœœ˜ Kš œœœ˜#Kš œœœœ˜/Kš œœ˜Kš  œœœœœ˜PKš  œœ˜Kš  œœœ˜4Mš  œœœ ˜?—™Mš  œœœœœ˜*Kš  œœœœœ˜(Kš  œœœœœ˜(Kš  œœœœœ˜+Mš œœœœ˜&Kš œœœ˜$Kš œœœœ˜'—™Kš  œœœœ ˜:š  œœœ ˜1Kšœœœ˜'—š œœ œ˜CKšœœœ ˜7—š  œœœ ˜5Kšœœœ˜'—Kš œœœœ˜8Kš œœ#œ ˜>Kš œœœœ ˜IKš œœ#œ˜OKš  œœ)œ ˜HKš  œœœ˜5Mš œœ˜'Kš œœ˜(—™Kš  œœœœ ˜