DIRECTORY Interpress USING [Master], Rope USING [ROPE]; IPInstructions: CEDAR DEFINITIONS = BEGIN Cardinal: TYPE ~ INT --[0..maxCardinal]--; ROPE: TYPE ~ Rope.ROPE; StackOpProcs: TYPE = RECORD [ pushIdentifier: PROCEDURE [id: ATOM]_ NIL, pushInteger: PROCEDURE [int: INT] _ NIL, pushNothing: PROCEDURE -- No value or NOP -- _ NIL, pushRational: PROCEDURE [n, d: INT]_ NIL, pushReal: PROCEDURE [r: REAL]_ NIL, pushString: PROCEDURE [s: ROPE]_ NIL, makeVec: PROCEDURE [cnt: Cardinal]_ NIL ]; StackOps: TYPE = REF StackOpProcs; InstPtr: TYPE = REF; -- to external or default instructions as defined by client InputProc: TYPE = PROCEDURE [ instr: InstPtr, default: BOOLEAN, instID: ATOM, ops: StackOps]; InstructionsRecord: TYPE = RECORD [-- opaque type referenced in Interpress instr: InstPtr _ NIL, inputProc: InputProc]; Instructions: TYPE = REF InstructionsRecord; BaseTypes: TYPE = {number, identifier, vector}; Any: TYPE = REF; -- to instructions as defined internally Vector: TYPE = REF; -- to internal representation of a vector GetInstruction: PROCEDURE [master: Interpress.Master, page: CARDINAL, id: ATOM] RETURNS [ref: Any, type: BaseTypes]; GetProperty: PROCEDURE [id: ATOM, vec: Vector] RETURNS [ref: Any, type: BaseTypes]; Get: PROCEDURE [ix: Cardinal, vec: Vector] RETURNS [ref: Any, type: BaseTypes]; RunGet: PROCEDURE [ix: Cardinal, vec: Vector] RETURNS [ref: Any, type: BaseTypes]; RunSize: PROCEDURE [vec: Vector] RETURNS [Cardinal]; VectorShape: PROCEDURE [vec: Vector] RETURNS [lowerBound: Cardinal, size: INT -- [0..maxCardinal+1] --]; VectorFromAny: PROCEDURE [a: Any] RETURNS [Vector]; CardinalFromAny: PROCEDURE [a: Any] RETURNS [Cardinal]; RealFromAny: PROCEDURE [a: Any] RETURNS [REAL]; IdentifierFromAny: PROCEDURE [a: Any] RETURNS [ATOM]; END. LOG 17Dec86 - castillo. PFile: IPInstructions.mesa Last edited by castillo: 17-Dec-86 10: 48: 49 Copyright (C) Xerox Corporation 1986. All rights reserved. Allan Wax: December 22, 1986 10:10:34 am PST This interface assumes knowledge of the way instructions are structured into vectors. Although it hides from client the way they are represented internally. It also allows the client to input instructions (as represented externally by the client), and to get instructions values as well To input instructions the client will provide the interpreter with a handle to the InstructionsRecord. This record contains a handle to the input instructions (in a format defined by client), and an InputProc callback. The interpreter will call the client for any instruction it needs. It will specify whether the instruction should come from the default (default=TRUE) package or the external (FALSE). It will provide an instruction ID (the name of the instruction is the name as defined in the Interpress 3.0 Standard as an ATOM) that will identify that particular instruction, and a collection of procedures that the client will need to provide this information to the client. It is expected that the client will know how the instruction is stored into vectors, altough it does not need to know how the vectors are actually represented internally. The client will use all the push operations and may terminate them with a makeVec call if the value is a vector. For IDs not defined in the interface the client should form it's own atom To output instructions first it is assumed that the client know how an instruction is represented in a vector (not caring how a vector is represented internally). The client will call GetInstruction given a master handle, a page number and the instruction ID to get a handle to its representation. The client will be given a handle to an opaque type (Any), and the type of the handle. Given the type of the AnyHandle, a *FromAny proc could be used to extract its content, if it is a vector, then other Get* procs are available to further expand the vector. If the AnyHandle is NIL then the instruction was not there. ΚZ˜JšΟnœ™Jšœ0™0šœ:™:Icodešœ,™,—˜Jšœœ™œJ˜Jšœ™—J˜šΟk ˜ Jšœ žœ ˜Kšœžœžœ˜—J˜šœžœž œ˜#Kšž˜K˜—˜Jš œμžœžœ"žœZΠbkœϋ™—˜Kšœ žœžΟcœ˜*Kšžœžœžœ˜J˜šœžœžœ˜Jšœž œžœžœ˜*Jšœ ž œžœžœ˜(Jšœ ž œ œžœ˜3Jšœž œžœžœ˜)Jšœ ž œžœžœ˜#Jšœ ž œžœžœ˜%Jšœ ž œž˜'J˜——˜Jšœ žœžœ˜"—˜Jšœ žœžœ ;˜P—˜šœ žœž œ˜Jšœžœ žœ˜?——˜šœžœžœ '˜JJšœžœ˜J˜——˜Jšœžœžœ˜,—J˜˜Jšœ€žœΏžœ$™θJ˜Jšœ žœ ˜/Jšœžœžœ (˜9Jšœžœžœ )˜=—J˜˜šœž œ#žœžœ˜OJšžœ˜$——J˜˜Jš œž œžœžœ˜S—˜Jšœž œžœ˜O—˜Jšœž œžœ˜R—J˜˜Jšœž œžœ ˜4—˜Jš  œž œžœžœ œ˜h—J˜˜Jš œž œ žœ ˜3—˜Jšœž œ žœ ˜7J˜Jš œž œ žœžœ˜/J˜Jšœž œ žœžœ˜5J˜Jšžœ˜—J˜Jšž˜J˜—…—$Ξ