-- Copyright (C) 1986 by Xerox Corporation. All rights reserved. -- Stub file was translated on May 19, 1986 10:01:03 am PDT by Lupine of February 22, 1986 5:15:54 pm PST -- Source interface ThSmarts came from file ThSmarts.bcd, which was created on May 19, 1986 10:00:40 am PDT with version stamp 13#227#21772711510 from source of May 19, 1986 9:59:17 am PDT. -- 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 = 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 Lark, LarkPlay, Pup, 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, MarshalAtom, MarshalRope, NilHeader, ProtocolError, -- RopeHeader, RpcPktDoubleWord, RuntimeError, SequenceHeader, SHORT, -- StartNextPkt, StringHeader, StubPktDoubleWord, TranslationError, -- UnmarshalingError, UnmarshalingExprError, UnmarshalAtom, UnmarshalRope, -- 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~13#227#21772711510", 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 = INLINE BEGIN smartsID: Thrush.SmartsHandle; event: ConvEvent; yourParty: BOOL; latestEvent: BOOL; informationOnly: BOOL; 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; pktLength: RpcPrivate.DataLength _ 6; BEGIN -- OnePkt. onePkt: BOOLEAN = lastPkt; IF ~onePkt THEN BEGIN -- Must move statics from pkt now. [smartsID: smartsID, yourParty: yourParty, latestEvent: latestEvent, informationOnly: informationOnly] _ argPkt^; END; BEGIN -- Unmarshal event: ConvEvent from pkt.data[pktLength]. [event, pktLength] _ UnmarshalConvEvent[pkt, pktLength]; END; -- Unmarshal event. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; resPkt _ @pkt.data[0]; IF onePkt THEN [resPkt.d] _ Progress[localConversation, argPkt.smartsID, event, argPkt.yourParty, argPkt.latestEvent, argPkt.informationOnly] ELSE [resPkt.d] _ Progress[localConversation, smartsID, event, yourParty, latestEvent, informationOnly]; END; -- OnePkt. pktLength _ 1; RETURN[returnLength: pktLength]; END; -- ProgressStub. -- Marshall/Unmarshal procedures. UnmarshalThrushDotIntervalSpec: PROC[pkt: RpcPrivate.RPCPkt, pktLength0: RpcPrivate.DataLength] RETURNS[value: Thrush.IntervalSpec, pktLength: RpcPrivate.DataLength] = BEGIN pktLength _ pktLength0; { isNIL: Lupine.NilHeader; IF pktLength+1 > RpcPrivate.maxDataLength THEN pktLength _ Lupine.FinishThisPkt[pkt: pkt, pktLength: pktLength]; isNIL _ pkt.data[pktLength]; pktLength _ pktLength+1; IF isNIL THEN value _ NIL ELSE BEGIN value _ (paramZones.gc.NEW[Thrush.IntervalSpecBody]); BEGIN -- Unmarshal value^: Thrush.IntervalSpecBody from pkt.data[pktLength]. pktLength _ Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength, dataAdr: LOOPHOLE[value], dataLength: SIZE[Thrush.IntervalSpecBody], alwaysOnePkt: FALSE]; END; -- Unmarshal value^. END; -- IF isNIL. };END; UnmarshalLarkDotConnectionSpec: PROC[pkt: RpcPrivate.RPCPkt, pktLength0: RpcPrivate.DataLength] RETURNS[value: Lark.ConnectionSpec, pktLength: RpcPrivate.DataLength] = BEGIN pktLength _ pktLength0; { isNIL: Lupine.NilHeader; IF pktLength+1 > RpcPrivate.maxDataLength THEN pktLength _ Lupine.FinishThisPkt[pkt: pkt, pktLength: pktLength]; isNIL _ pkt.data[pktLength]; pktLength _ pktLength+1; IF isNIL THEN value _ NIL ELSE BEGIN value _ (paramZones.gc.NEW[Lark.ConnectionSpecRec]); BEGIN -- Unmarshal value^: Lark.ConnectionSpecRec from pkt.data[pktLength]. pktLength _ Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength, dataAdr: LOOPHOLE[value], dataLength: SIZE[Lark.ConnectionSpecRec], alwaysOnePkt: FALSE]; END; -- Unmarshal value^. END; -- IF isNIL. };END; UnmarshalThrushDotProseSpec: PROC[pkt: RpcPrivate.RPCPkt, pktLength0: RpcPrivate.DataLength] RETURNS[value: Thrush.ProseSpec, pktLength: RpcPrivate.DataLength] = BEGIN pktLength _ pktLength0; { isNIL: Lupine.NilHeader; IF pktLength+1 > RpcPrivate.maxDataLength THEN pktLength _ Lupine.FinishThisPkt[pkt: pkt, pktLength: pktLength]; isNIL _ pkt.data[pktLength]; pktLength _ pktLength+1; IF isNIL THEN value _ NIL ELSE BEGIN value _ (paramZones.gc.NEW[Thrush.ProseSpecBody]); BEGIN -- Unmarshal value^: Thrush.ProseSpecBody from pkt.data[pktLength]. pktLength _ Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength, dataAdr: LOOPHOLE[value], dataLength: SIZE[Thrush.ProseSpecBody], alwaysOnePkt: FALSE]; -- Restore garbled REFs to NIL following copy. BEGIN OPEN record: value^; LOOPHOLE[record.prose, LONG POINTER] _ NIL; END; -- OPEN record: value^. BEGIN OPEN record: value^; BEGIN -- Unmarshal record.prose: Rope.ROPE from pkt.data[pktLength]. [record.prose, pktLength] _ Lupine.UnmarshalRope[pkt, pktLength, FALSE]; END; -- Unmarshal record.prose. END; -- OPEN record: value^. END; -- Unmarshal value^. END; -- IF isNIL. };END; UnmarshalConvEvent: PROC[pkt: RpcPrivate.RPCPkt, pktLength0: RpcPrivate.DataLength] RETURNS[value: ThSmarts.ConvEvent, pktLength: RpcPrivate.DataLength] = BEGIN pktLength _ pktLength0; { isNIL: Lupine.NilHeader; IF pktLength+1 > RpcPrivate.maxDataLength THEN pktLength _ Lupine.FinishThisPkt[pkt: pkt, pktLength: pktLength]; isNIL _ pkt.data[pktLength]; pktLength _ pktLength+1; IF isNIL THEN value _ NIL ELSE BEGIN value _ (paramZones.gc.NEW[Thrush.ConvEventBody]); BEGIN -- Unmarshal value^: Thrush.ConvEventBody from pkt.data[pktLength]. pktLength _ Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength, dataAdr: LOOPHOLE[value], dataLength: SIZE[Thrush.ConvEventBody], alwaysOnePkt: FALSE]; -- Restore garbled REFs to NIL following copy. BEGIN OPEN record: value^; LOOPHOLE[record.spec, LONG POINTER] _ NIL; LOOPHOLE[record.keyTable, LONG POINTER] _ NIL; LOOPHOLE[record.intervalSpecs, LONG POINTER] _ NIL; LOOPHOLE[record.proseSpecs, LONG POINTER] _ NIL; LOOPHOLE[record.ringTune, LONG POINTER] _ NIL; LOOPHOLE[record.address, LONG POINTER] _ NIL; LOOPHOLE[record.comment, LONG POINTER] _ NIL; END; -- OPEN record: value^. BEGIN OPEN record: value^; BEGIN -- Unmarshal record.spec: Lark.ConnectionSpec from pkt.data[pktLength]. [record.spec, pktLength] _ UnmarshalLarkDotConnectionSpec[pkt, pktLength]; END; -- Unmarshal record.spec. BEGIN -- Unmarshal record.keyTable: Lark.KeyTable from pkt.data[pktLength]. [record.keyTable, pktLength] _ UnmarshalLarkDotKeyTable[pkt, pktLength]; END; -- Unmarshal record.keyTable. BEGIN -- Unmarshal record.intervalSpecs: Thrush.IntervalSpecs -- from pkt.data[pktLength]. lastNode: Thrush.IntervalSpecs _ (record.intervalSpecs _ NIL); listLength: Lupine.ListHeader; IF pktLength+2 > RpcPrivate.maxDataLength THEN pktLength _ Lupine.FinishThisPkt[pkt: pkt, pktLength: pktLength]; listLength _ Lupine.RpcPktDoubleWord[pkt, pktLength]^; pktLength _ pktLength + 2; WHILE listLength > 0 DO thisNode3: Thrush.IntervalSpecs = paramZones.gc.CONS[--DefaultValue--,NIL]; BEGIN -- Unmarshal thisNode3.first: Thrush.IntervalSpec -- from pkt.data[pktLength]. [thisNode3.first, pktLength] _ UnmarshalThrushDotIntervalSpec[pkt, pktLength]; END; -- Unmarshal thisNode3.first. IF lastNode # NIL THEN lastNode _ (lastNode.rest _ thisNode3) ELSE lastNode _ (record.intervalSpecs _ thisNode3); listLength _ listLength - 1; ENDLOOP; -- WHILE listLength > 0. END; -- Unmarshal record.intervalSpecs. BEGIN -- Unmarshal record.proseSpecs: Thrush.ProseSpecs from -- pkt.data[pktLength]. lastNode: Thrush.ProseSpecs _ (record.proseSpecs _ NIL); listLength: Lupine.ListHeader; IF pktLength+2 > RpcPrivate.maxDataLength THEN pktLength _ Lupine.FinishThisPkt[pkt: pkt, pktLength: pktLength]; listLength _ Lupine.RpcPktDoubleWord[pkt, pktLength]^; pktLength _ pktLength + 2; WHILE listLength > 0 DO thisNode3: Thrush.ProseSpecs = paramZones.gc.CONS[--DefaultValue--,NIL]; BEGIN -- Unmarshal thisNode3.first: Thrush.ProseSpec from -- pkt.data[pktLength]. [thisNode3.first, pktLength] _ UnmarshalThrushDotProseSpec[pkt, pktLength]; END; -- Unmarshal thisNode3.first. IF lastNode # NIL THEN lastNode _ (lastNode.rest _ thisNode3) ELSE lastNode _ (record.proseSpecs _ thisNode3); listLength _ listLength - 1; ENDLOOP; -- WHILE listLength > 0. END; -- Unmarshal record.proseSpecs. BEGIN -- Unmarshal record.ringTune: LarkPlay.ToneSpec from -- pkt.data[pktLength]. [record.ringTune, pktLength] _ UnmarshalLarkPlayDotToneSpec[pkt, pktLength]; END; -- Unmarshal record.ringTune. BEGIN -- Unmarshal record.address: Thrush.ROPE from pkt.data[pktLength]. [record.address, pktLength] _ Lupine.UnmarshalRope[pkt, pktLength, TRUE]; END; -- Unmarshal record.address. BEGIN -- Unmarshal record.comment: Rope.ROPE from pkt.data[pktLength]. [record.comment, pktLength] _ Lupine.UnmarshalRope[pkt, pktLength, FALSE]; END; -- Unmarshal record.comment. END; -- OPEN record: value^. END; -- Unmarshal value^. END; -- IF isNIL. };END; UnmarshalLarkDotKeyTable: PROC[pkt: RpcPrivate.RPCPkt, pktLength0: RpcPrivate.DataLength] RETURNS[value: Lark.KeyTable, pktLength: RpcPrivate.DataLength] = BEGIN pktLength _ pktLength0; { BEGIN -- Unmarshal value^: Lark.KeyTableBody from pkt.data[pktLength]. recordIsNIL: Lupine.NilHeader; IF pktLength+3 > RpcPrivate.maxDataLength THEN pktLength _ Lupine.FinishThisPkt[pkt: pkt, pktLength: pktLength]; recordIsNIL _ pkt.data[pktLength]; pktLength _ pktLength+1; IF recordIsNIL THEN value _ NIL ELSE BEGIN seqLength: Lupine.SequenceHeader; seqLength _ Lupine.RpcPktDoubleWord[pkt, pktLength]^; pktLength _ pktLength + 2; value _ (paramZones.gc.NEW[Lark.KeyTableBody[Lupine.SHORT[seqLength]]]); pktLength _ Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength, dataAdr: LOOPHOLE[value], dataLength: SIZE[Lark.KeyTableBody[LENGTH[DESCRIPTOR[value^]]]], alwaysOnePkt: FALSE]; END; -- IF recordIsNIL. END; -- Unmarshal value^. };END; UnmarshalLarkPlayDotToneSpec: PROC[pkt: RpcPrivate.RPCPkt, pktLength0: RpcPrivate.DataLength] RETURNS[value: LarkPlay.ToneSpec, pktLength: RpcPrivate.DataLength] = BEGIN pktLength _ pktLength0; { isNIL: Lupine.NilHeader; IF pktLength+1 > RpcPrivate.maxDataLength THEN pktLength _ Lupine.FinishThisPkt[pkt: pkt, pktLength: pktLength]; isNIL _ pkt.data[pktLength]; pktLength _ pktLength+1; IF isNIL THEN value _ NIL ELSE BEGIN value _ (paramZones.gc.NEW[LarkPlay.ToneSpecRec]); BEGIN -- Unmarshal value^: LarkPlay.ToneSpecRec from pkt.data[pktLength]. pktLength _ Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength, dataAdr: LOOPHOLE[value], dataLength: SIZE[LarkPlay.ToneSpecRec], alwaysOnePkt: FALSE]; -- Restore garbled REFs to NIL following copy. BEGIN OPEN record: value^; LOOPHOLE[record.tones, LONG POINTER] _ NIL; END; -- OPEN record: value^. BEGIN OPEN record: value^; BEGIN -- Unmarshal record.tones: LIST OF LarkPlay.ToneList -- from pkt.data[pktLength]. lastNode: LIST OF LarkPlay.ToneList _ (record.tones _ NIL); listLength: Lupine.ListHeader; IF pktLength+2 > RpcPrivate.maxDataLength THEN pktLength _ Lupine.FinishThisPkt[pkt: pkt, pktLength: pktLength]; listLength _ Lupine.RpcPktDoubleWord[pkt, pktLength]^; pktLength _ pktLength + 2; WHILE listLength > 0 DO thisNode5: LIST OF LarkPlay.ToneList = paramZones.gc.CONS[--DefaultValue--,NIL]; BEGIN -- Unmarshal thisNode5.first: LarkPlay.ToneList -- from pkt.data[pktLength]. lastNode: LarkPlay.ToneList _ (thisNode5.first _ NIL); listLength: Lupine.ListHeader; IF pktLength+2 > RpcPrivate.maxDataLength THEN pktLength _ Lupine.FinishThisPkt[pkt: pkt, pktLength: pktLength]; listLength _ Lupine.RpcPktDoubleWord[pkt, pktLength]^; pktLength _ pktLength + 2; WHILE listLength > 0 DO thisNode6: LarkPlay.ToneList = paramZones.gc.CONS[--DefaultValue--,NIL]; BEGIN -- Unmarshal thisNode6.first: LarkPlay.Tone -- from pkt.data[pktLength]. pktLength _ Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength, dataAdr: @thisNode6.first, dataLength: SIZE[LarkPlay.Tone], alwaysOnePkt: FALSE]; END; -- Unmarshal thisNode6.first. IF lastNode # NIL THEN lastNode _ (lastNode.rest _ thisNode6) ELSE lastNode _ (thisNode5.first _ thisNode6); listLength _ listLength - 1; ENDLOOP; -- WHILE listLength > 0. END; -- Unmarshal thisNode5.first. IF lastNode # NIL THEN lastNode _ (lastNode.rest _ thisNode5) ELSE lastNode _ (record.tones _ thisNode5); listLength _ listLength - 1; ENDLOOP; -- WHILE listLength > 0. END; -- Unmarshal record.tones. END; -- OPEN record: value^. END; -- Unmarshal value^. END; -- IF isNIL. };END; -- No module initialization. END. -- ThSmartsRpcServerImpl.