-- Stub file was translated on September 14, 1983 9:14 am by Lupine of September 14, 1983 9:07 am -- Source interface Target came from file Target.bcd, which was created on September 14, 1983 9:06 am with version stamp 234#314#6453236363 from source of September 14, 1983 9:06 am. -- The RPC stub modules for Target are: -- TargetRpcControl.mesa; -- TargetRpcClientImpl.mesa; -- TargetRpcBinderImpl.mesa; -- TargetRpcServerImpl.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, Target, TargetRpcControl USING [InterMdsCallsOnly, LupineProtocolVersion, ProcedureIndex, SignalIndex], RPC USING [InterfaceName, standardZones, Zones], 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]--; TargetRpcClientImpl: MONITOR IMPORTS RpcPrivate: RPCLupine, Lupine: LupineRuntime, Atom, Rope EXPORTS Target, TargetRpcControl SHARES Target, TargetRpcControl, Rope = BEGIN OPEN Target, RpcControl: TargetRpcControl, 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 "Target~234#314#6453236363", 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. Basic: PUBLIC SAFE PROCEDURE = TRUSTED BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex _ Basic]; 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]; argPkt.transferIndex _ Basic; [returnLength: , lastPkt: lastPkt] _ RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 0, signalHandler: ClientDispatcher]; Lupine.CheckPktLength[pkt: pkt, pktLength: 0]; RETURN[]; END; -- Basic. Simple: PUBLIC SAFE PROCEDURE [first: INT, second: REF INT] RETURNS [a: Rope.ROPE, b: ATOM] = TRUSTED BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex _ Simple, first (1): INT]; pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+254] OF WORD; pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer]; argPkt: POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength _ 3; lastPkt: BOOLEAN; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface]; argPkt^ _ [first: first]; BEGIN -- Marshal second: REF INT to pkt.data[pktLength]. pkt.data[pktLength] _ second=NIL; pktLength _ pktLength+1; IF second # NIL THEN BEGIN Lupine.StubPktDoubleWord[pkt, pktLength]^ _ second^; pktLength _ pktLength + 2; END; END; -- Marshal second. [returnLength: , lastPkt: lastPkt] _ RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 254, signalHandler: ClientDispatcher]; pktLength _ 0; BEGIN -- Unmarshal a: Rope.ROPE from pkt.data[pktLength]. ropeIsNIL: Lupine.NilHeader; IF pktLength+2 > RpcPrivate.maxDataLength THEN pktLength _ Lupine.FinishThisPkt[pkt: pkt, pktLength: pktLength]; ropeIsNIL _ pkt.data[pktLength]; pktLength _ pktLength+1; IF ropeIsNIL THEN a _ NIL ELSE BEGIN ropeLength: Lupine.RopeHeader; textRope: Rope.Text; ropeLength _ pkt.data[pktLength]; pktLength _ pktLength+1; IF ropeLength > LAST[NAT] THEN Lupine.UnmarshalingError; a _ textRope _ Rope.NewText[size: ropeLength]; pktLength _ Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength, dataAdr: BASE[DESCRIPTOR[textRope.text]], dataLength: Lupine.WordsForChars[ropeLength], alwaysOnePkt: FALSE]; END; -- IF ropeIsNIL. END; -- Unmarshal a. BEGIN -- Unmarshal b: ATOM from pkt.data[pktLength]. pNameOfAtom: Rope.ROPE; ropeIsNIL: Lupine.NilHeader; IF pktLength+2 > RpcPrivate.maxDataLength THEN pktLength _ Lupine.FinishThisPkt[pkt: pkt, pktLength: pktLength]; ropeIsNIL _ pkt.data[pktLength]; pktLength _ pktLength+1; IF ropeIsNIL THEN pNameOfAtom _ NIL ELSE BEGIN ropeLength: Lupine.RopeHeader; textRope: Rope.Text; ropeLength _ pkt.data[pktLength]; pktLength _ pktLength+1; IF ropeLength > LAST[NAT] THEN Lupine.UnmarshalingError; pNameOfAtom _ textRope _ Rope.NewText[size: ropeLength]; pktLength _ Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength, dataAdr: BASE[DESCRIPTOR[textRope.text]], dataLength: Lupine.WordsForChars[ropeLength], alwaysOnePkt: FALSE]; END; -- IF ropeIsNIL. b _ Atom.MakeAtom[--pName:-- pNameOfAtom]; END; -- Unmarshal b. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; RETURN[a, b]; END; -- Simple. -- Remote public signals and errors. Exception: PUBLIC ERROR [why: Reason] = CODE; Consultation: PUBLIC SAFE SIGNAL = 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 Exception => RETURN[ ExceptionStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; Consultation => RETURN[ ConsultationStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; ENDCASE => RETURN[Lupine.DispatchingError[]]; END; -- ClientDispatcher -- Public signal and error dispatcher stubs. ExceptionStub: --ERROR [why: Reason]-- RpcPrivate.Dispatcher = INLINE BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.SignalIndex, why (1): Reason]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; Lupine.CheckPktLength[pkt: pkt, pktLength: 2]; ERROR Exception[argPkt.why]; END; -- ExceptionStub. ConsultationStub: --SIGNAL-- RpcPrivate.Dispatcher = INLINE BEGIN pktLength: RpcPrivate.DataLength; Lupine.CheckPktLength[pkt: pkt, pktLength: 1]; SIGNAL Consultation[]; pktLength _ 0; RETURN[returnLength: pktLength]; END; -- ConsultationStub. -- No module initialization. END. -- TargetRpcClientImpl.