-- Copyright (C) 1985 by Xerox Corporation. All rights reserved. -- Stub file was translated on March 7, 1985 11:44:59 am PST by Lupine of March 6, 1985 8:13:46 am PST -- Source interface Target came from file Target.bcd, which was created on March 7, 1985 11:44:45 am PST with version stamp 234#313#31370206177 from source of February 11, 1985 9:18:37 am PST. -- 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 [EncryptionKey, InterfaceName, Principal, standardZones, Zones], RPCLupine --USING SOME OF [Call, DataLength, Dispatcher, ExportHandle, -- ExportInterface, GetStubPkt, maxDataLength, maxPrincipalLength, -- maxShortStringLength, pktOverhead, ReceiveExtraPkt, SendPrelimPkt, -- StartCall, StartSignal, StubPkt, UnexportInterface]--, 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]--; TargetRpcServerImpl: MONITOR IMPORTS Target, RpcPrivate: RPCLupine, Lupine: LupineRuntime, Atom, Rope EXPORTS TargetRpcControl SHARES Target, TargetRpcControl, Rope = BEGIN OPEN Target, RpcControl: TargetRpcControl, RpcPublic: RPC; -- Standard remote binding routines. bound: BOOLEAN _ FALSE; myInterface: RpcPrivate.ExportHandle; paramZones: RpcPublic.Zones _ RpcPublic.standardZones; ExportInterface: PUBLIC ENTRY SAFE PROCEDURE [ interfaceName: RpcPublic.InterfaceName, user: RpcPublic.Principal, password: RpcPublic.EncryptionKey, 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.ExportInterface [ interface: [ type: IF ~IsNull[interfaceName.type] THEN interfaceName.type ELSE "Target~234#313#31370206177", instance: interfaceName.instance, version: interfaceName.version ], user: user, password: password, dispatcher: ServerDispatcher, 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; UnexportInterface: PUBLIC ENTRY SAFE PROCEDURE = TRUSTED BEGIN ENABLE UNWIND => NULL; IF ~bound THEN Lupine.BindingError; myInterface _ RpcPrivate.UnexportInterface[myInterface]; paramZones _ RpcPublic.standardZones; bound _ FALSE; END; -- Public procedure dispatcher and public signal and error catcher. ServerDispatcher: --PROCEDURE [pkt: RPCPkt, callLength: DataLength, -- lastPkt: BOOLEAN, localConversation: Conversation] RETURNS [returnLength: -- DataLength]-- RpcPrivate.Dispatcher = BEGIN -- Catch public signals. ENABLE BEGIN Exception --ERROR [why: Reason]-- => BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.SignalIndex _ Exception, why (1): Reason]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength _ 2; lastPkt: BOOLEAN; RpcPrivate.StartSignal[signalPkt: pkt]; argPkt^ _ [why: why]; [returnLength: , lastPkt: lastPkt] _ RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 0]; Lupine.RuntimeError; -- Impossible to RESUME an ERROR. END; -- Exception. Consultation --SIGNAL-- => TRUSTED BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.SignalIndex _ Consultation]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength _ 1; lastPkt: BOOLEAN; RpcPrivate.StartSignal[signalPkt: pkt]; argPkt.transferIndex _ Consultation; [returnLength: , lastPkt: lastPkt] _ RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 0]; Lupine.CheckPktLength[pkt: pkt, pktLength: 0]; RESUME[]; END; -- Consultation. END; -- Catch public signals. -- Call public procedures (still in dispatcher). SELECT LOOPHOLE[pkt.data[0], RpcControl.ProcedureIndex] FROM Basic => RETURN[ BasicStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; Simple => RETURN[ SimpleStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; ENDCASE => RETURN[Lupine.DispatchingError[]]; END; -- ServerDispatcher -- Public procedure dispatcher stubs. BasicStub: --PROCEDURE-- RpcPrivate.Dispatcher = INLINE BEGIN pktLength: RpcPrivate.DataLength; Lupine.CheckPktLength[pkt: pkt, pktLength: 1]; Basic[]; pktLength _ 0; RETURN[returnLength: pktLength]; END; -- BasicStub. SimpleStub: --PROCEDURE [first: INT, second: REF INT] RETURNS [a: -- Rope.ROPE, b: ATOM]-- RpcPrivate.Dispatcher = INLINE BEGIN second: REF INT; a: Rope.ROPE; b: ATOM; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, first (1): INT]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength _ 3; BEGIN -- Unmarshal second: REF INT from pkt.data[pktLength]. isNIL: Lupine.NilHeader; isNIL _ pkt.data[pktLength]; pktLength _ pktLength+1; IF isNIL THEN second _ NIL ELSE BEGIN second _ (paramZones.gc.NEW[INT]); BEGIN second^ _ Lupine.RpcPktDoubleWord[pkt, pktLength]^; pktLength _ pktLength + 2; END; END; -- IF isNIL. END; -- Unmarshal second. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; [a, b] _ Simple[argPkt.first, second]; pktLength _ 0; BEGIN -- Marshal a: Rope.ROPE to pkt.data[pktLength]. IF pktLength+2 > RpcPrivate.maxDataLength THEN pktLength _ Lupine.StartNextPkt[pkt: pkt, pktLength: pktLength]; pkt.data[pktLength] _ a=NIL; pktLength _ pktLength+1; IF a # NIL THEN BEGIN textRope: Rope.Text = Rope.InlineFlatten[r: a]; 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 a # NIL. END; -- Marshal a. BEGIN -- Marshal b: ATOM to pkt.data[pktLength]. pNameOfAtom: Rope.Text = Atom.GetPName[atom: b]; 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 b. RETURN[returnLength: pktLength]; END; -- SimpleStub. -- No module initialization. END. -- TargetRpcServerImpl.