-- Stub file was translated on December 19, 1983 1:38 pm by Lupine of October 25, 1983 10:51 am -- Source interface Lark came from file Lark.bcd, which was created on December 19, 1983 1:34 pm with version stamp 363B#357B#6104565341B from source of December 19, 1983 1:34 pm. -- The RPC stub modules for Lark are: -- LarkRpcControl.mesa; -- LarkRpcClientImpl.mesa; -- LarkRpcBinderImpl.mesa; -- LarkRpcServerImpl.mesa. -- The parameters for this translation are: -- Target language = Cedar -- Default parameter passing = VALUE -- Deallocate server heap arguments = TRUE -- Inline RpcServerImpl dispatcher stubs = FALSE -- Declare signals = TRUE -- Warn about short POINTER ("MDS") allocations = TRUE -- Maximum number of dynamic heap NEWs = 50, MDS NEWs = 50 -- Acceptable parameter protocols = VersionRange[1..1]. DIRECTORY DESFace, PupTypes, RPC, RPCPkt, Lark, LarkRpcControl USING [InterMdsCallsOnly, LupineProtocolVersion, ProcedureIndex, SignalIndex], RPCLupine --USING SOME OF [Call, DataLength, Dispatcher, GetStubPkt, -- ImportHandle, ImportInterface, maxDataLength, maxPrincipalLength, -- maxShortStringLength, pktOverhead, ReceiveExtraPkt, SendPrelimPkt, -- StartCall, StartSignal, StubPkt, UnimportInterface]--, LupineRuntime --USING SOME OF [BindingError, CheckPktLength, CopyFromPkt, -- CopyFromMultiplePkts, CopyToPkt, CopyToMultiplePkts, defaultZones, -- DispatchingError, FinishThisPkt, ListHeader, MarshalingError, -- MarshalingExprError, NilHeader, ProtocolError, RopeHeader, RpcPktDoubleWord, -- RuntimeError, SequenceHeader, SHORT, StartNextPkt, StringHeader, -- StubPktDoubleWord, TranslationError, UnmarshalingError, UnmarshalingExprError, -- WordsForChars]--, Atom --USING SOME OF [GetPName, MakeAtom]--, Rope --USING SOME OF [InlineFlatten, Length, NewText, Text]--; LarkRpcClientImpl: MONITOR IMPORTS RpcPrivate: RPCLupine, Lupine: LupineRuntime, Atom, Rope EXPORTS Lark, LarkRpcControl SHARES Lark, LarkRpcControl, Rope = BEGIN OPEN Lark, RpcControl: LarkRpcControl, RpcPublic: RPC; -- Standard remote binding routines. bound: BOOLEAN ← FALSE; myInterface: RpcPrivate.ImportHandle; paramZones: RpcPublic.Zones ← RpcPublic.standardZones; ImportInterface: PUBLIC ENTRY SAFE PROCEDURE [ interfaceName: RpcPublic.InterfaceName, parameterStorage: RpcPublic.Zones ] = TRUSTED BEGIN ENABLE UNWIND => NULL; IsNull: PROCEDURE [string: Rope.ROPE] RETURNS [BOOLEAN] = INLINE {RETURN[string.Length[] = 0]}; IF bound THEN Lupine.BindingError; myInterface ← RpcPrivate.ImportInterface [ interface: [ type: IF ~IsNull[interfaceName.type] THEN interfaceName.type ELSE "Lark~363B#357B#6104565341B", instance: interfaceName.instance, version: interfaceName.version ], localOnly: RpcControl.InterMdsCallsOnly, stubProtocol: RpcControl.LupineProtocolVersion ]; paramZones ← [ gc: IF parameterStorage.gc # NIL THEN parameterStorage.gc ELSE Lupine.defaultZones.gc, heap: IF parameterStorage.heap # NIL THEN parameterStorage.heap ELSE Lupine.defaultZones.heap, mds: IF parameterStorage.mds # NIL THEN parameterStorage.mds ELSE Lupine.defaultZones.mds ]; bound ← TRUE; END; UnimportInterface: PUBLIC ENTRY SAFE PROCEDURE = TRUSTED BEGIN ENABLE UNWIND => NULL; IF ~bound THEN Lupine.BindingError; myInterface ← RpcPrivate.UnimportInterface[myInterface]; paramZones ← RpcPublic.standardZones; bound ← FALSE; END; -- Remote public procedure stubs. Reset: PUBLIC SAFE PROCEDURE [shh: SHHH, rName: ROPE] = TRUSTED BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← Reset]; pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+35] OF WORD; pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer]; argPkt: POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 1; lastPkt: BOOLEAN; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation: shh]; argPkt.transferIndex ← Reset; BEGIN -- Marshal rName: ROPE to pkt.data[pktLength]. pkt.data[pktLength] ← rName=NIL; pktLength ← pktLength+1; IF rName # NIL THEN BEGIN textRope: Rope.Text = Rope.InlineFlatten[r: rName]; IF textRope.length > RpcPrivate.maxShortStringLength THEN Lupine.MarshalingError; pkt.data[pktLength] ← textRope.length; pktLength ← pktLength+1; pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength: pktLength, dataAdr: BASE[DESCRIPTOR[textRope.text]], dataLength: Lupine.WordsForChars[textRope.length], alwaysOnePkt: TRUE]; END; -- IF rName # NIL. END; -- Marshal rName. [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 0, signalHandler: ClientDispatcher]; Lupine.CheckPktLength[pkt: pkt, pktLength: 0]; RETURN[]; END; -- Reset. GenerateTones: PUBLIC SAFE PROCEDURE [shh: SHHH, f1: Hertz, f2: Hertz, modulation: Hertz, on: Milliseconds, off: Milliseconds, repetitions: CARDINAL, waveTable: CARDINAL, queueIt: BOOLEAN, notify: CommandEvent] RETURNS [--ok:-- BOOLEAN] = TRUSTED BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← GenerateTones, f1 (1): Hertz, f2 (2): Hertz, modulation (3): Hertz, on (4): Milliseconds, off (5): Milliseconds, repetitions (6): CARDINAL, waveTable (7): CARDINAL, queueIt (8): BOOLEAN, notify (9): CommandEvent]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ ok (0): BOOLEAN]; pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+10] OF WORD; pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer]; argPkt: POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 10; lastPkt: BOOLEAN; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation: shh]; argPkt↑ ← [f1: f1, f2: f2, modulation: modulation, on: on, off: off, repetitions: repetitions, waveTable: waveTable, queueIt: queueIt, notify: notify]; [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 1, signalHandler: ClientDispatcher]; Lupine.CheckPktLength[pkt: pkt, pktLength: 1]; RETURN[resPkt.ok]; END; -- GenerateTones. Feep: PUBLIC SAFE PROCEDURE [shh: SHHH, on: Milliseconds, off: Milliseconds, waveTable: CARDINAL, queueIt: BOOLEAN, notify: CommandEvent, events: CommandEvents] RETURNS [--ok:-- BOOLEAN] = TRUSTED BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← Feep, on (1): Milliseconds, off (2): Milliseconds, waveTable (3): CARDINAL, queueIt (4): BOOLEAN, notify (5): CommandEvent]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ ok (0): BOOLEAN]; pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+42] OF WORD; pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer]; argPkt: POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 6; lastPkt: BOOLEAN; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation: shh]; argPkt↑ ← [on: on, off: off, waveTable: waveTable, queueIt: queueIt, notify: notify]; BEGIN -- Marshal events: CommandEvents to pkt.data[pktLength]. BEGIN -- Marshal events↑: CommandEventSequence to pkt.data[pktLength]. pkt.data[pktLength] ← events=NIL; pktLength ← pktLength+1; IF events # NIL THEN BEGIN -- Record has a sequence, put its length up front. Lupine.StubPktDoubleWord[pkt, pktLength]↑ ← LENGTH[DESCRIPTOR[events↑]]; pktLength ← pktLength + 2; pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength: pktLength, dataAdr: LOOPHOLE[events], dataLength: SIZE[CommandEventSequence[LENGTH[DESCRIPTOR[events↑]]]], alwaysOnePkt: TRUE]; END; -- IF events # NIL. END; -- Marshal events↑. END; -- Marshal events. [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 1, signalHandler: ClientDispatcher]; Lupine.CheckPktLength[pkt: pkt, pktLength: 1]; RETURN[resPkt.ok]; END; -- Feep. Commands: PUBLIC SAFE PROCEDURE [shh: SHHH, events: CommandEvents] = TRUSTED BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← Commands]; pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+37] OF WORD; pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer]; argPkt: POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 1; lastPkt: BOOLEAN; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation: shh]; argPkt.transferIndex ← Commands; BEGIN -- Marshal events: CommandEvents to pkt.data[pktLength]. BEGIN -- Marshal events↑: CommandEventSequence to pkt.data[pktLength]. pkt.data[pktLength] ← events=NIL; pktLength ← pktLength+1; IF events # NIL THEN BEGIN -- Record has a sequence, put its length up front. Lupine.StubPktDoubleWord[pkt, pktLength]↑ ← LENGTH[DESCRIPTOR[events↑]]; pktLength ← pktLength + 2; pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength: pktLength, dataAdr: LOOPHOLE[events], dataLength: SIZE[CommandEventSequence[LENGTH[DESCRIPTOR[events↑]]]], alwaysOnePkt: TRUE]; END; -- IF events # NIL. END; -- Marshal events↑. END; -- Marshal events. [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 0, signalHandler: ClientDispatcher]; Lupine.CheckPktLength[pkt: pkt, pktLength: 0]; RETURN[]; END; -- Commands. Connect: PUBLIC SAFE PROCEDURE [shh: SHHH, specs: ConnectionSpec] = TRUSTED BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← Connect]; pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+13] OF WORD; pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer]; argPkt: POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 1; lastPkt: BOOLEAN; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation: shh]; argPkt.transferIndex ← Connect; BEGIN -- Marshal specs: ConnectionSpec to pkt.data[pktLength]. pkt.data[pktLength] ← specs=NIL; pktLength ← pktLength+1; IF specs # NIL THEN BEGIN -- Marshal specs↑: ConnectionSpecRec to pkt.data[pktLength]. pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength: pktLength, dataAdr: LOOPHOLE[specs], dataLength: SIZE[ConnectionSpecRec], alwaysOnePkt: TRUE]; END; -- Marshal specs↑. END; -- Marshal specs. [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 0, signalHandler: ClientDispatcher]; Lupine.CheckPktLength[pkt: pkt, pktLength: 0]; RETURN[]; END; -- Connect. Disconnect: PUBLIC SAFE PROCEDURE [shh: SHHH, buffer: VoiceBuffer] = TRUSTED BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← Disconnect, buffer (1): VoiceBuffer]; pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+2] OF WORD; pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer]; argPkt: POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 2; lastPkt: BOOLEAN; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation: shh]; argPkt↑ ← [buffer: buffer]; [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 0, signalHandler: ClientDispatcher]; Lupine.CheckPktLength[pkt: pkt, pktLength: 0]; RETURN[]; END; -- Disconnect. PleaseRegister: PUBLIC SAFE PROCEDURE [shh: SHHH] = TRUSTED BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← PleaseRegister]; pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+1] OF WORD; pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer]; argPkt: POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 1; lastPkt: BOOLEAN; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation: shh]; argPkt.transferIndex ← PleaseRegister; [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 0, signalHandler: ClientDispatcher]; Lupine.CheckPktLength[pkt: pkt, pktLength: 0]; RETURN[]; END; -- PleaseRegister. WhatIsStatus: PUBLIC SAFE PROCEDURE [shh: SHHH, which: CARDINAL] RETURNS [--next:-- CARDINAL, --events:-- StatusEvents] = TRUSTED BEGIN events: StatusEvents; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← WhatIsStatus, which (1): CARDINAL]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ next (0): CARDINAL]; pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+69] OF WORD; pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer]; argPkt: POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 2; lastPkt: BOOLEAN; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation: shh]; argPkt↑ ← [which: which]; [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 69, signalHandler: ClientDispatcher]; pktLength ← 1; BEGIN -- Unmarshal events: StatusEvents from pkt.data[pktLength]. BEGIN -- Unmarshal events↑: StatusEventSequence from pkt.data[pktLength]. recordIsNIL: Lupine.NilHeader; recordIsNIL ← pkt.data[pktLength]; pktLength ← pktLength+1; IF recordIsNIL THEN events ← NIL ELSE BEGIN seqLength: Lupine.SequenceHeader; seqLength ← Lupine.StubPktDoubleWord[pkt, pktLength]↑; pktLength ← pktLength + 2; events ← (paramZones.gc.NEW[StatusEventSequence[Lupine.SHORT[seqLength]]]); pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength, dataAdr: LOOPHOLE[events], dataLength: SIZE[StatusEventSequence[LENGTH[DESCRIPTOR[events↑]]]], alwaysOnePkt: TRUE]; END; -- IF recordIsNIL. END; -- Unmarshal events↑. END; -- Unmarshal events. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; RETURN[resPkt.next, events]; END; -- WhatIsStatus. WhatAreConnections: PUBLIC SAFE PROCEDURE [shh: SHHH, which: CARDINAL] RETURNS [--next:-- CARDINAL, --specs:-- ConnectionSpec] = TRUSTED BEGIN specs: ConnectionSpec; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← WhatAreConnections, which (1): CARDINAL]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ next (0): CARDINAL]; pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+13] OF WORD; pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer]; argPkt: POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 2; lastPkt: BOOLEAN; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation: shh]; argPkt↑ ← [which: which]; [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 13, signalHandler: ClientDispatcher]; pktLength ← 1; BEGIN -- Unmarshal specs: ConnectionSpec from pkt.data[pktLength]. isNIL: Lupine.NilHeader; isNIL ← pkt.data[pktLength]; pktLength ← pktLength+1; IF isNIL THEN specs ← NIL ELSE BEGIN specs ← (paramZones.gc.NEW[ConnectionSpecRec]); BEGIN -- Unmarshal specs↑: ConnectionSpecRec from pkt.data[pktLength]. pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength, dataAdr: LOOPHOLE[specs], dataLength: SIZE[ConnectionSpecRec], alwaysOnePkt: TRUE]; END; -- Unmarshal specs↑. END; -- IF isNIL. END; -- Unmarshal specs. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; RETURN[resPkt.next, specs]; END; -- WhatAreConnections. WhatAreTones: PUBLIC SAFE PROCEDURE [shh: SHHH] RETURNS [--anonP1id2593838:-- BOOLEAN] = TRUSTED BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← WhatAreTones]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ anonP1id2593838 (0): BOOLEAN]; pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+1] OF WORD; pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer]; argPkt: POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 1; lastPkt: BOOLEAN; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation: shh]; argPkt.transferIndex ← WhatAreTones; [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 1, signalHandler: ClientDispatcher]; Lupine.CheckPktLength[pkt: pkt, pktLength: 1]; RETURN[resPkt.anonP1id2593838]; END; -- WhatAreTones. SetKeyTable: PUBLIC SAFE PROCEDURE [shh: SHHH, table: KeyTable] = TRUSTED BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← SetKeyTable]; pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+73] OF WORD; pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer]; argPkt: POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 1; lastPkt: BOOLEAN; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation: shh]; argPkt.transferIndex ← SetKeyTable; BEGIN -- Marshal table: KeyTable to pkt.data[pktLength]. BEGIN -- Marshal table↑: KeyTableBody to pkt.data[pktLength]. pkt.data[pktLength] ← table=NIL; pktLength ← pktLength+1; IF table # NIL THEN BEGIN -- Record has a sequence, put its length up front. Lupine.StubPktDoubleWord[pkt, pktLength]↑ ← LENGTH[DESCRIPTOR[table↑]]; pktLength ← pktLength + 2; pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength: pktLength, dataAdr: LOOPHOLE[table], dataLength: SIZE[KeyTableBody[LENGTH[DESCRIPTOR[table↑]]]], alwaysOnePkt: TRUE]; END; -- IF table # NIL. END; -- Marshal table↑. END; -- Marshal table. [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 0, signalHandler: ClientDispatcher]; Lupine.CheckPktLength[pkt: pkt, pktLength: 0]; RETURN[]; END; -- SetKeyTable. CommandString: PUBLIC SAFE PROCEDURE [shh: SHHH, device: Device, commands: ROPE] = TRUSTED BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← CommandString, device (1): Device]; pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+36] OF WORD; pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer]; argPkt: POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 2; lastPkt: BOOLEAN; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation: shh]; argPkt↑ ← [device: device]; BEGIN -- Marshal commands: ROPE to pkt.data[pktLength]. pkt.data[pktLength] ← commands=NIL; pktLength ← pktLength+1; IF commands # NIL THEN BEGIN textRope: Rope.Text = Rope.InlineFlatten[r: commands]; IF textRope.length > RpcPrivate.maxShortStringLength THEN Lupine.MarshalingError; pkt.data[pktLength] ← textRope.length; pktLength ← pktLength+1; pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength: pktLength, dataAdr: BASE[DESCRIPTOR[textRope.text]], dataLength: Lupine.WordsForChars[textRope.length], alwaysOnePkt: TRUE]; END; -- IF commands # NIL. END; -- Marshal commands. [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 0, signalHandler: ClientDispatcher]; Lupine.CheckPktLength[pkt: pkt, pktLength: 0]; RETURN[]; END; -- CommandString. PleaseLogin: PUBLIC SAFE PROCEDURE [shh: SHHH] RETURNS [--will:-- BOOL] = TRUSTED BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← PleaseLogin]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ will (0): BOOL]; pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+1] OF WORD; pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer]; argPkt: POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 1; lastPkt: BOOLEAN; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation: shh]; argPkt.transferIndex ← PleaseLogin; [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 1, signalHandler: ClientDispatcher]; Lupine.CheckPktLength[pkt: pkt, pktLength: 1]; RETURN[resPkt.will]; END; -- PleaseLogin. EchoSupression: PUBLIC SAFE PROCEDURE [shh: SHHH, echo: EchoParameters] = TRUSTED BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← EchoSupression]; pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+10] OF WORD; pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer]; argPkt: POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 1; lastPkt: BOOLEAN; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation: shh]; argPkt.transferIndex ← EchoSupression; BEGIN -- Marshal echo: EchoParameters to pkt.data[pktLength]. pkt.data[pktLength] ← echo=NIL; pktLength ← pktLength+1; IF echo # NIL THEN BEGIN -- Marshal echo↑: EchoParameterRecord to pkt.data[pktLength]. pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength: pktLength, dataAdr: LOOPHOLE[echo], dataLength: SIZE[EchoParameterRecord], alwaysOnePkt: TRUE]; END; -- Marshal echo↑. END; -- Marshal echo. [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 0, signalHandler: ClientDispatcher]; Lupine.CheckPktLength[pkt: pkt, pktLength: 0]; RETURN[]; END; -- EchoSupression. SetHostNumber: PUBLIC SAFE PROCEDURE [shh: SHHH, host: Machine] = TRUSTED BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← SetHostNumber, host (1): Machine]; pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+2] OF WORD; pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer]; argPkt: POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 2; lastPkt: BOOLEAN; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation: shh]; argPkt↑ ← [host: host]; [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 0, signalHandler: ClientDispatcher]; Lupine.CheckPktLength[pkt: pkt, pktLength: 0]; RETURN[]; END; -- SetHostNumber. -- Remote public signals and errors. -- Public signal and error dispatcher. ClientDispatcher: --PROCEDURE [pkt: RPCPkt, callLength: DataLength, -- lastPkt: BOOLEAN, localConversation: Conversation] RETURNS [returnLength: -- DataLength]-- RpcPrivate.Dispatcher = BEGIN SELECT LOOPHOLE[pkt.data[0], RpcControl.SignalIndex] FROM ENDCASE => RETURN[Lupine.DispatchingError[]]; END; -- ClientDispatcher -- Public signal and error dispatcher stubs. -- No module initialization. END. -- LarkRpcClientImpl.