-- Stub file was translated on January 3, 1984 0:09 am by Lupine of December 20, 1983 1:22 pm -- Source interface ThSmarts came from file ThSmarts.bcd, which was created on January 3, 1984 0:09 am with version stamp 355B#46B#14036406517B from source of December 19, 1983 2:07 pm. -- The RPC stub modules for ThSmarts are: -- ThSmartsRpcControl.mesa; -- ThSmartsRpcClientImpl.mesa; -- ThSmartsRpcBinderImpl.mesa; -- ThSmartsRpcServerImpl.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 Lark, RPC, Thrush, ThSmarts, ThSmartsRpcControl USING [InterMdsCallsOnly, LupineProtocolVersion, ProcedureIndex, SignalIndex], 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, 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]--; ThSmartsRpcServerImpl: MONITOR IMPORTS ThSmarts, RpcPrivate: RPCLupine, Lupine: LupineRuntime, Atom, Rope EXPORTS ThSmartsRpcControl SHARES ThSmarts, ThSmartsRpcControl, Rope = BEGIN OPEN ThSmarts, RpcControl: ThSmartsRpcControl, 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 "ThSmarts~355B#46B#14036406517B", 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 END; -- Catch public signals. -- Call public procedures (still in dispatcher). SELECT LOOPHOLE[pkt.data[0], RpcControl.ProcedureIndex] FROM Progress => RETURN[ ProgressStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; ENDCASE => RETURN[Lupine.DispatchingError[]]; END; -- ServerDispatcher -- Public procedure dispatcher stubs. ProgressStub: --PROCEDURE [shh: SHHH, smartsID: Thrush.SmartsHandle, -- event: ConvEvent, yourParty: BOOL, latestEvent: BOOL, informationOnly: -- BOOL] -- RETURNS [d: Disposition]-- RpcPrivate.Dispatcher = BEGIN event: ConvEvent; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, smartsID (1): Thrush.SmartsHandle, yourParty (3): BOOL, latestEvent (4): BOOL, informationOnly (5): BOOL]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ d (0): Disposition]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength _ 6; BEGIN -- Unmarshal event: ConvEvent from pkt.data[pktLength]. isNIL: Lupine.NilHeader; isNIL _ pkt.data[pktLength]; pktLength _ pktLength+1; IF isNIL THEN event _ NIL ELSE BEGIN event _ (paramZones.gc.NEW[Thrush.ConvEventBody]); BEGIN -- Unmarshal event^: Thrush.ConvEventBody from pkt.data[pktLength]. pktLength _ Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength, dataAdr: LOOPHOLE[event], dataLength: SIZE[Thrush.ConvEventBody], alwaysOnePkt: TRUE]; -- Restore garbled REFs to NIL following copy. BEGIN OPEN record: event^; LOOPHOLE[record.spec, LONG POINTER] _ NIL; LOOPHOLE[record.keyTable, LONG POINTER] _ NIL; LOOPHOLE[record.intervalSpec, LONG POINTER] _ NIL; LOOPHOLE[record.address, LONG POINTER] _ NIL; LOOPHOLE[record.comment, LONG POINTER] _ NIL; END; -- OPEN record: event^. BEGIN OPEN record: event^; BEGIN -- Unmarshal record.spec: Lark.ConnectionSpec from -- pkt.data[pktLength]. isNIL: Lupine.NilHeader; isNIL _ pkt.data[pktLength]; pktLength _ pktLength+1; IF isNIL THEN record.spec _ NIL ELSE BEGIN record.spec _ (paramZones.gc.NEW[Lark.ConnectionSpecRec]); BEGIN -- Unmarshal record.spec^: Lark.ConnectionSpecRec -- from pkt.data[pktLength]. pktLength _ Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength, dataAdr: LOOPHOLE[record.spec], dataLength: SIZE[Lark.ConnectionSpecRec], alwaysOnePkt: TRUE]; END; -- Unmarshal record.spec^. END; -- IF isNIL. END; -- Unmarshal record.spec. BEGIN -- Unmarshal record.keyTable: Lark.KeyTable from -- pkt.data[pktLength]. BEGIN -- Unmarshal record.keyTable^: Lark.KeyTableBody -- from pkt.data[pktLength]. recordIsNIL: Lupine.NilHeader; recordIsNIL _ pkt.data[pktLength]; pktLength _ pktLength+1; IF recordIsNIL THEN record.keyTable _ NIL ELSE BEGIN seqLength: Lupine.SequenceHeader; seqLength _ Lupine.RpcPktDoubleWord[pkt, pktLength]^; pktLength _ pktLength + 2; record.keyTable _ (paramZones.gc.NEW[Lark.KeyTableBody[Lupine.SHORT[seqLength]]]); pktLength _ Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength, dataAdr: LOOPHOLE[record.keyTable], dataLength: SIZE[Lark.KeyTableBody[LENGTH[DESCRIPTOR[record.keyTable^]]]], alwaysOnePkt: TRUE]; END; -- IF recordIsNIL. END; -- Unmarshal record.keyTable^. END; -- Unmarshal record.keyTable. BEGIN -- Unmarshal record.intervalSpec: IntervalSpec from -- pkt.data[pktLength]. isNIL: Lupine.NilHeader; isNIL _ pkt.data[pktLength]; pktLength _ pktLength+1; IF isNIL THEN record.intervalSpec _ NIL ELSE BEGIN record.intervalSpec _ (paramZones.gc.NEW[IntervalSpecBody]); BEGIN -- Unmarshal record.intervalSpec^: IntervalSpecBody -- from pkt.data[pktLength]. pktLength _ Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength, dataAdr: LOOPHOLE[record.intervalSpec], dataLength: SIZE[IntervalSpecBody], alwaysOnePkt: TRUE]; END; -- Unmarshal record.intervalSpec^. END; -- IF isNIL. END; -- Unmarshal record.intervalSpec. BEGIN -- Unmarshal record.address: ROPE from pkt.data[pktLength]. ropeIsNIL: Lupine.NilHeader; ropeIsNIL _ pkt.data[pktLength]; pktLength _ pktLength+1; IF ropeIsNIL THEN record.address _ NIL ELSE BEGIN ropeLength: Lupine.RopeHeader; textRope: Rope.Text; ropeLength _ pkt.data[pktLength]; pktLength _ pktLength+1; IF ropeLength > RpcPrivate.maxShortStringLength THEN Lupine.UnmarshalingError; record.address _ textRope _ Rope.NewText[size: ropeLength]; pktLength _ Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength, dataAdr: BASE[DESCRIPTOR[textRope.text]], dataLength: Lupine.WordsForChars[ropeLength], alwaysOnePkt: TRUE]; END; -- IF ropeIsNIL. END; -- Unmarshal record.address. BEGIN -- Unmarshal record.comment: ROPE from pkt.data[pktLength]. ropeIsNIL: Lupine.NilHeader; ropeIsNIL _ pkt.data[pktLength]; pktLength _ pktLength+1; IF ropeIsNIL THEN record.comment _ NIL ELSE BEGIN ropeLength: Lupine.RopeHeader; textRope: Rope.Text; ropeLength _ pkt.data[pktLength]; pktLength _ pktLength+1; IF ropeLength > RpcPrivate.maxShortStringLength THEN Lupine.UnmarshalingError; record.comment _ textRope _ Rope.NewText[size: ropeLength]; pktLength _ Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength, dataAdr: BASE[DESCRIPTOR[textRope.text]], dataLength: Lupine.WordsForChars[ropeLength], alwaysOnePkt: TRUE]; END; -- IF ropeIsNIL. END; -- Unmarshal record.comment. END; -- OPEN record: event^. END; -- Unmarshal event^. END; -- IF isNIL. END; -- Unmarshal event. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; [resPkt.d] _ Progress[localConversation, argPkt.smartsID, event, argPkt.yourParty, argPkt.latestEvent, argPkt.informationOnly]; pktLength _ 1; RETURN[returnLength: pktLength]; END; -- ProgressStub. -- No module initialization. END. -- ThSmartsRpcServerImpl.