-- Copyright (C) 1986 by Xerox Corporation. All rights reserved. -- Stub file was translated on January 22, 1986 11:12:53 pm PST by Lupine of May 23, 1985 8:38:08 am PDT -- Source interface RPCEcho came from file RPCEcho.bcd, which was created on January 22, 1986 11:12:49 pm PST with version stamp 234#307#33210351347 from source of January 22, 1986 11:11:54 pm PST. -- The RPC stub modules for RPCEcho are: -- RPCEchoRpcControl.mesa; -- RPCEchoRpcClientImpl.mesa; -- RPCEchoRpcBinderImpl.mesa; -- RPCEchoRpcServerImpl.mesa. -- The parameters for this translation are: -- Target language = Cedar -- Default parameter passing = VALUE -- Deallocate server heap arguments = TRUE -- Inline RpcServerImpl dispatcher stubs = TRUE -- 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 Rope, RPCEcho, RPCEchoRpcControl USING [InterfaceRecord, InterMdsCallsOnly, LupineProtocolVersion, ProcedureIndex, SignalIndex], RPC --USING SOME OF [InterfaceName, standardZones, Zones]--, RPCLupine --USING SOME OF [Alloc, Call, DataLength, DeAlloc, Dispatcher, -- GetPkt, 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, MarshalAtom, MarshalRope, NilHeader, ProtocolError, -- RopeHeader, RpcPktDoubleWord, RuntimeError, SequenceHeader, SHORT, -- StartNextPkt, StringHeader, StubPktDoubleWord, TranslationError, -- UnmarshalingError, UnmarshalingExprError, UnmarshalAtom, UnmarshalRope, -- WordsForChars]--, Atom --USING SOME OF [GetPName, MakeAtom]--, PrincOpsUtils --USING SOME OF [Enter, Exit]--, VM --USING SOME OF [AddressForPageNumber, PageCount, PageNumber, -- PageNumberForAddress, PagesForWords]--; RPCEchoRpcClientImpl: MONITOR IMPORTS RpcPrivate: RPCLupine, Lupine: LupineRuntime, Atom, PrincOpsUtils, Rope EXPORTS RPCEcho, RPCEchoRpcControl SHARES RPCEcho, RPCEchoRpcControl, Rope = BEGIN OPEN RPCEcho, RpcControl: RPCEchoRpcControl, 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]}; myInterface ← RpcPrivate.ImportInterface [ interface: [ type: IF ~IsNull[interfaceName.type] THEN interfaceName.type ELSE "RPCEcho~234#307#33210351347", 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. Simple: PUBLIC SAFE PROCEDURE = TRUSTED BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← Simple]; pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+1] OF WORD; pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 1; lastPkt: BOOLEAN; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface]; argPkt.transferIndex ← Simple; [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 0, signalHandler: ClientDispatcher]; Lupine.CheckPktLength[pkt: pkt, pktLength: 0]; RETURN[]; END; -- Simple. SloshTenWords: PUBLIC SAFE PROCEDURE [tenWords: TenWords] RETURNS [mumble: TenWords] = TRUSTED BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← SloshTenWords, tenWords (1): TenWords]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ mumble (0): TenWords]; pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+11] OF WORD; pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 11; lastPkt: BOOLEAN; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface]; argPkt↑ ← [tenWords: tenWords]; [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 10, signalHandler: ClientDispatcher]; [mumble: mumble] ← resPkt↑; Lupine.CheckPktLength[pkt: pkt, pktLength: 10]; RETURN[mumble]; END; -- SloshTenWords. SloshPage: PUBLIC SAFE PROCEDURE [page: Page] RETURNS [mumble: Page] = TRUSTED BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← SloshPage]; pkt: RpcPrivate.RPCPkt = RpcPrivate.GetPkt[space: RpcPrivate.AllocInline[RpcPrivate.pktOverhead+254]]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 1; lastPkt: BOOLEAN; BEGIN ENABLE UNWIND => RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254]; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface]; argPkt.transferIndex ← SloshPage; BEGIN -- Marshal page: Page to pkt.data[pktLength]. pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength: pktLength, dataAdr: @page, dataLength: SIZE[Page], alwaysOnePkt: FALSE]; END; -- Marshal page. [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 254, signalHandler: ClientDispatcher]; pktLength ← 0; BEGIN -- Unmarshal mumble: Page from pkt.data[pktLength]. pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength, dataAdr: @mumble, dataLength: SIZE[Page], alwaysOnePkt: FALSE]; END; -- Unmarshal mumble. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; RpcPrivate.DeAllocInline[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254]; RETURN[mumble]; END; -- UNWIND. END; -- SloshPage. SloshTenPages: PUBLIC SAFE PROCEDURE [pages: TenPages] RETURNS [mumble: TenPages] = TRUSTED BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← SloshTenPages]; pkt: RpcPrivate.RPCPkt = RpcPrivate.GetPkt[space: RpcPrivate.AllocInline[RpcPrivate.pktOverhead+254]]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 1; lastPkt: BOOLEAN; BEGIN ENABLE UNWIND => RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254]; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface]; argPkt.transferIndex ← SloshTenPages; BEGIN -- Marshal pages: TenPages to pkt.data[pktLength]. pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength: pktLength, dataAdr: @pages, dataLength: SIZE[TenPages], alwaysOnePkt: FALSE]; END; -- Marshal pages. [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 254, signalHandler: ClientDispatcher]; pktLength ← 0; BEGIN -- Unmarshal mumble: TenPages from pkt.data[pktLength]. pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength, dataAdr: @mumble, dataLength: SIZE[TenPages], alwaysOnePkt: FALSE]; END; -- Unmarshal mumble. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; RpcPrivate.DeAllocInline[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254]; RETURN[mumble]; END; -- UNWIND. END; -- SloshTenPages. PushPage: PUBLIC SAFE PROCEDURE [page: Page] = TRUSTED BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← PushPage]; pkt: RpcPrivate.RPCPkt = RpcPrivate.GetPkt[space: RpcPrivate.AllocInline[RpcPrivate.pktOverhead+254]]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 1; lastPkt: BOOLEAN; BEGIN ENABLE UNWIND => RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254]; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface]; argPkt.transferIndex ← PushPage; BEGIN -- Marshal page: Page to pkt.data[pktLength]. pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength: pktLength, dataAdr: @page, dataLength: SIZE[Page], alwaysOnePkt: FALSE]; END; -- Marshal page. [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 0, signalHandler: ClientDispatcher]; Lupine.CheckPktLength[pkt: pkt, pktLength: 0]; RpcPrivate.DeAllocInline[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254]; RETURN[]; END; -- UNWIND. END; -- PushPage. PullPage: PUBLIC SAFE PROCEDURE RETURNS [mumble: Page] = TRUSTED BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← PullPage]; pkt: RpcPrivate.RPCPkt = RpcPrivate.GetPkt[space: RpcPrivate.AllocInline[RpcPrivate.pktOverhead+254]]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 1; lastPkt: BOOLEAN; BEGIN ENABLE UNWIND => RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254]; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface]; argPkt.transferIndex ← PullPage; [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 254, signalHandler: ClientDispatcher]; pktLength ← 0; BEGIN -- Unmarshal mumble: Page from pkt.data[pktLength]. pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength, dataAdr: @mumble, dataLength: SIZE[Page], alwaysOnePkt: FALSE]; END; -- Unmarshal mumble. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; RpcPrivate.DeAllocInline[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254]; RETURN[mumble]; END; -- UNWIND. END; -- PullPage. DoAtom: PUBLIC SAFE PROCEDURE [atom: ATOM] = TRUSTED BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← DoAtom]; pkt: RpcPrivate.RPCPkt = RpcPrivate.GetPkt[space: RpcPrivate.AllocInline[RpcPrivate.pktOverhead+254]]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 1; lastPkt: BOOLEAN; BEGIN ENABLE UNWIND => RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254]; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface]; argPkt.transferIndex ← DoAtom; BEGIN -- Marshal atom: ATOM to pkt.data[pktLength]. pNameOfAtom: Rope.Text = Atom.GetPName[atom: atom]; IF pktLength+2 > RpcPrivate.maxDataLength THEN pktLength ← Lupine.StartNextPkt[pkt: pkt, pktLength: pktLength]; pkt.data[pktLength] ← pNameOfAtom=NIL; pktLength ← pktLength+1; IF pNameOfAtom # NIL THEN BEGIN textRope: Rope.Text = Rope.InlineFlatten[r: pNameOfAtom]; 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: FALSE]; END; -- IF pNameOfAtom # NIL. END; -- Marshal atom. [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 0, signalHandler: ClientDispatcher]; Lupine.CheckPktLength[pkt: pkt, pktLength: 0]; RpcPrivate.DeAllocInline[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254]; RETURN[]; END; -- UNWIND. END; -- DoAtom. DoRope: PUBLIC SAFE PROCEDURE [rope: ROPE] = TRUSTED BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← DoRope]; pkt: RpcPrivate.RPCPkt = RpcPrivate.GetPkt[space: RpcPrivate.AllocInline[RpcPrivate.pktOverhead+254]]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 1; lastPkt: BOOLEAN; BEGIN ENABLE UNWIND => RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254]; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface]; argPkt.transferIndex ← DoRope; BEGIN -- Marshal rope: ROPE to pkt.data[pktLength]. IF pktLength+2 > RpcPrivate.maxDataLength THEN pktLength ← Lupine.StartNextPkt[pkt: pkt, pktLength: pktLength]; pkt.data[pktLength] ← rope=NIL; pktLength ← pktLength+1; IF rope # NIL THEN BEGIN textRope: Rope.Text = Rope.InlineFlatten[r: rope]; 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: FALSE]; END; -- IF rope # NIL. END; -- Marshal rope. [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 0, signalHandler: ClientDispatcher]; Lupine.CheckPktLength[pkt: pkt, pktLength: 0]; RpcPrivate.DeAllocInline[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254]; RETURN[]; END; -- UNWIND. END; -- DoRope. -- Remote public signals and errors. Error: PUBLIC ERROR = CODE; -- 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 Error => RETURN[ ErrorStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; ENDCASE => RETURN[Lupine.DispatchingError[]]; END; -- ClientDispatcher -- Public signal and error dispatcher stubs. ErrorStub: --ERROR-- RpcPrivate.Dispatcher = INLINE BEGIN Lupine.CheckPktLength[pkt: pkt, pktLength: 1]; ERROR Error[]; END; -- ErrorStub. -- No module initialization. END. -- RPCEchoRpcClientImpl.