-- File [Ivy]<Nelson>Lupine>LupineMarshalTest.mesa. -- Last edited by BZM on 12-May-82 19:30:15. -- Last edited by Andrew Birrell on July 7, 1982 11:31 am -- This an extensive parameter marshaling exerciser for Lupine. -- It is used by LupineMarshalTestImpl and LupineMarshalTestDriver. -- LupineExerciser* provides timing and control operations. DIRECTORY --RPC USING [ShortSTRING], Rope USING [ROPE]; LupineMarshalTest: DEFINITIONS = BEGIN Null: PROC; One: PROC [one: INTEGER] RETURNS [a: INTEGER]; Four: PROC [one,two,three,four: INTEGER] RETURNS [a,b,c,d: INTEGER]; Ten: PROC [one,two,three,four,five,six,seven,eight,nine,ten: INTEGER] RETURNS [a,b,c,d,e,f,g,h,i,j: INTEGER]; Signal: SIGNAL [in: INTEGER] RETURNS [out: INTEGER]; SignalAction: TYPE = {signal, error, neither}; SignalTest: PROC [in: INTEGER, action: SignalAction] RETURNS [out: INTEGER]; Array10: TYPE = ARRAY [0..10) OF INTEGER; Array40: TYPE = ARRAY [0..40) OF INTEGER; Array100: TYPE = ARRAY [0..100) OF INTEGER; TenArray: PROC [in: Array10] RETURNS [out: Array10]; FortyArray: PROC [in: Array40] RETURNS [out: Array40]; HundredArray: PROC [in: Array100] RETURNS [out: Array100]; VARArithmetic: TYPE = LONG POINTER TO ArithmeticRecord; ArithmeticRecord: TYPE = RECORD [in, inPlus1, inTimes2: LONG INTEGER]; SimpleArithmetic: PROC [pad: VARArithmetic]; -- Semantics: pad↑ ← [pad.in, pad.in+1, pad.in*2]. RESULTArray: TYPE = LONG DESCRIPTOR FOR ARRAY OF INTEGER; FillArray: PROC [in: INTEGER, out: RESULTArray]; -- Semantics: out ← [in, in-1 ..., in-LENGTH[out]+1]. Item: TYPE = INTEGER; RESULTPages: TYPE = LONG DESCRIPTOR FOR ARRAY OF Item; ReadPages: PUBLIC PROC [item: Item, buffer: RESULTPages]; -- Semantics: buffer ← [item, ..., item]. IntList: TYPE = LIST OF READONLY LONG INTEGER ← NIL; CreateList: PROC [in: LONG INTEGER, length: INTEGER] RETURNS [out: IntList]; -- Semantics: out ← LIST[in, in-1 ..., in-length+1]. --ReadonlyString: TYPE = LONG -READONLY- RPC.ShortSTRING; --MaxReadonlyStringLength: CARDINAL = 64; - 64 is ShortSTRING maximum. ReadonlyString: TYPE = LONG POINTER TO READONLY StringBody; MaxReadonlyStringLength: CARDINAL = 248; -- 248 is onePkt maximum. VARString: TYPE = STRING; StringCopy: PROC [in: ReadonlyString, out: VARString]; -- Semantics: out[0..in.length) ← in[0..in.length). StringType: TYPE = {nil, rope, text}; StringSelection: TYPE = RECORD [ length: LONG INTEGER ← 0, char: CHARACTER ← 'a, string: SELECT type: StringType FROM nil => [], rope => [seal: INTEGER←11952, rope: Rope.ROPE], text => [text: REF READONLY TEXT, seal: LONG CARDINAL←81678] ENDCASE ] ← [string: nil[]]; CharToVariantString: PROC [ char: CHARACTER, length: INTEGER, type: StringType, makeNil: BOOLEAN] RETURNS [StringSelection]; -- Semantics (roughly): -- out[length, char, string.type[0..length)] -- ← in[length, char, (IF makeNil THEN NIL ELSE char↑length)]. Bits: TYPE = [0..13); -- Prime number taking 4 bits. BitDescriptor: TYPE = LONG DESCRIPTOR FOR PACKED ARRAY OF Bits; BitSequence: TYPE = RECORD [ fixed: PACKED ARRAY [1..128] OF Bits, dynamic: PACKED SEQUENCE length: [1..LAST[INTEGER]] OF Bits ]; BitsToSequence: PROC [in: BitDescriptor] RETURNS [out: REF READONLY BitSequence]; -- Semantics (roughly): -- out[fixed, dynamic[1..LENGTH[in]]] ← [in, in]. StringList: TYPE = DESCRIPTOR FOR ARRAY OF LONG STRING; AtomList: TYPE = LIST OF ATOM; PuntStringsToAtoms: SIGNAL; -- Check that RESUME works, and UNWIND frees storage. StringsToAtoms: PROC [in: StringList] RETURNS [out: AtomList]; -- Semantics (roughly): -- FOR i IN [0..LENGTH[in]) DO out[i] ← MakeAtom[in[i]]. END. -- LupineExerciseTest.