-- Stub file was translated on January 24, 1984 3:04 pm by Lupine of December 20, 1983 1:22 pm -- Source interface ColorVersatec came from file ColorVersatec.bcd, which was created on January 24, 1984 3:04 pm with version stamp 116B#324B#1237612162B from source of January 24, 1984 3:01 pm. -- The RPC stub modules for ColorVersatec are: -- ColorVersatecRpcControl.mesa; -- ColorVersatecRpcClientImpl.mesa; -- ColorVersatecRpcBinderImpl.mesa; -- ColorVersatecRpcServerImpl.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 Process, Rope, ColorVersatec, ColorVersatecRpcControl 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, NilHeader, ProtocolError, RopeHeader, RpcPktDoubleWord, -- RuntimeError, SequenceHeader, SHORT, StartNextPkt, StringHeader, -- StubPktDoubleWord, TranslationError, UnmarshalingError, UnmarshalingExprError, -- WordsForChars]--, Atom --USING SOME OF [GetPName, MakeAtom]--; ColorVersatecRpcServerImpl: MONITOR IMPORTS ColorVersatec, RpcPrivate: RPCLupine, Lupine: LupineRuntime, Atom, Rope EXPORTS ColorVersatecRpcControl SHARES ColorVersatec, ColorVersatecRpcControl, Rope = BEGIN OPEN ColorVersatec, RpcControl: ColorVersatecRpcControl, 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 "ColorVersatec~116B#324B#1237612162B", 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 Failed --ERROR [reason: Rope.ROPE]-- => BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.SignalIndex ← Failed]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 1; lastPkt: BOOLEAN; RpcPrivate.StartSignal[signalPkt: pkt]; argPkt.transferIndex ← Failed; BEGIN -- Marshal reason: Rope.ROPE to pkt.data[pktLength]. IF pktLength+2 > RpcPrivate.maxDataLength THEN pktLength ← Lupine.StartNextPkt[pkt: pkt, pktLength: pktLength]; pkt.data[pktLength] ← reason=NIL; pktLength ← pktLength+1; IF reason # NIL THEN BEGIN textRope: Rope.Text = Rope.InlineFlatten[r: reason]; 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 reason # NIL. END; -- Marshal reason. [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 0]; Lupine.RuntimeError; -- Impossible to RESUME an ERROR. END; -- Failed. END; -- Catch public signals. -- Call public procedures (still in dispatcher). SELECT LOOPHOLE[pkt.data[0], RpcControl.ProcedureIndex] FROM StartPass => RETURN[ StartPassStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; SetStipples => RETURN[ SetStipplesStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; OrBand => RETURN[ OrBandStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; PlotOliverScanLine => RETURN[ PlotOliverScanLineStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; PlotScanLine => RETURN[ PlotScanLineStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; ResetTimeout => RETURN[ ResetTimeoutStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; EndPlot => RETURN[ EndPlotStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; ENDCASE => RETURN[Lupine.DispatchingError[]]; END; -- ServerDispatcher -- Public procedure dispatcher stubs. StartPassStub: --PROCEDURE [id: PlotId, color: Color, function: PlotterFunction, -- lengthInScanLines: INT, width: INT, timeout: Process.Seconds] -- RETURNS [newId: PlotId, bandHeight: [1..256]]-- RpcPrivate.Dispatcher = INLINE BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, id (1): PlotId, color (3): Color, function (4): PlotterFunction, lengthInScanLines (5): INT, width (7): INT, timeout (9): Process.Seconds]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ newId (0): PlotId, bandHeight (2): [1..256]]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength; Lupine.CheckPktLength[pkt: pkt, pktLength: 10]; [resPkt.newId, resPkt.bandHeight] ← StartPass[argPkt.id, argPkt.color, argPkt.function, argPkt.lengthInScanLines, argPkt.width, argPkt.timeout]; pktLength ← 3; RETURN[returnLength: pktLength]; END; -- StartPassStub. SetStipplesStub: --PROCEDURE [id: PlotId, stipples: Stipples]-- RpcPrivate.Dispatcher = INLINE BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, id (1): PlotId, stipples (3): Stipples]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength; Lupine.CheckPktLength[pkt: pkt, pktLength: 131]; SetStipples[argPkt.id, argPkt.stipples]; pktLength ← 0; RETURN[returnLength: pktLength]; END; -- SetStipplesStub. OrBandStub: --PROCEDURE [id: PlotId, block: OrBlockRef]-- RpcPrivate.Dispatcher = INLINE BEGIN id: PlotId; block: OrBlockRef; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, id (1): PlotId]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 3; BEGIN -- OnePkt. onePkt: BOOLEAN = lastPkt; IF ~onePkt THEN BEGIN -- Must move statics from pkt now. [id: id] ← argPkt↑; END; BEGIN -- Unmarshal block: OrBlockRef from pkt.data[pktLength]. BEGIN -- Unmarshal block↑: OrBlock 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 block ← NIL ELSE BEGIN seqLength: Lupine.SequenceHeader; seqLength ← Lupine.RpcPktDoubleWord[pkt, pktLength]↑; pktLength ← pktLength + 2; block ← (paramZones.gc.NEW[OrBlock[Lupine.SHORT[seqLength]]]); pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength, dataAdr: LOOPHOLE[block], dataLength: SIZE[OrBlock[LENGTH[DESCRIPTOR[block↑]]]], alwaysOnePkt: FALSE]; END; -- IF recordIsNIL. END; -- Unmarshal block↑. END; -- Unmarshal block. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; IF onePkt THEN OrBand[argPkt.id, block] ELSE OrBand[id, block]; END; -- OnePkt. pktLength ← 0; RETURN[returnLength: pktLength]; END; -- OrBandStub. PlotOliverScanLineStub: --PROCEDURE [id: PlotId, line: OliverScanLineRef]-- RpcPrivate.Dispatcher = INLINE BEGIN id: PlotId; line: OliverScanLineRef; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, id (1): PlotId]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 3; BEGIN -- OnePkt. onePkt: BOOLEAN = lastPkt; IF ~onePkt THEN BEGIN -- Must move statics from pkt now. [id: id] ← argPkt↑; END; BEGIN -- Unmarshal line: OliverScanLineRef from pkt.data[pktLength]. BEGIN -- Unmarshal line↑: OliverScanLine 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 line ← NIL ELSE BEGIN seqLength: Lupine.SequenceHeader; seqLength ← Lupine.RpcPktDoubleWord[pkt, pktLength]↑; pktLength ← pktLength + 2; line ← (paramZones.gc.NEW[OliverScanLine[Lupine.SHORT[seqLength]]]); pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength, dataAdr: LOOPHOLE[line], dataLength: SIZE[OliverScanLine[LENGTH[DESCRIPTOR[line↑]]]], alwaysOnePkt: FALSE]; END; -- IF recordIsNIL. END; -- Unmarshal line↑. END; -- Unmarshal line. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; IF onePkt THEN PlotOliverScanLine[argPkt.id, line] ELSE PlotOliverScanLine[id, line]; END; -- OnePkt. pktLength ← 0; RETURN[returnLength: pktLength]; END; -- PlotOliverScanLineStub. PlotScanLineStub: --PROCEDURE [id: PlotId, line: BasicScanLineRef]-- RpcPrivate.Dispatcher = INLINE BEGIN id: PlotId; line: BasicScanLineRef; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, id (1): PlotId]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 3; BEGIN -- OnePkt. onePkt: BOOLEAN = lastPkt; IF ~onePkt THEN BEGIN -- Must move statics from pkt now. [id: id] ← argPkt↑; END; BEGIN -- Unmarshal line: BasicScanLineRef from pkt.data[pktLength]. BEGIN -- Unmarshal line↑: BasicScanLine 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 line ← NIL ELSE BEGIN seqLength: Lupine.SequenceHeader; seqLength ← Lupine.RpcPktDoubleWord[pkt, pktLength]↑; pktLength ← pktLength + 2; line ← (paramZones.gc.NEW[BasicScanLine[Lupine.SHORT[seqLength]]]); pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength, dataAdr: LOOPHOLE[line], dataLength: SIZE[BasicScanLine[LENGTH[DESCRIPTOR[line↑]]]], alwaysOnePkt: FALSE]; END; -- IF recordIsNIL. END; -- Unmarshal line↑. END; -- Unmarshal line. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; IF onePkt THEN PlotScanLine[argPkt.id, line] ELSE PlotScanLine[id, line]; END; -- OnePkt. pktLength ← 0; RETURN[returnLength: pktLength]; END; -- PlotScanLineStub. ResetTimeoutStub: --PROCEDURE [id: PlotId]-- RpcPrivate.Dispatcher = INLINE BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, id (1): PlotId]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength; Lupine.CheckPktLength[pkt: pkt, pktLength: 3]; ResetTimeout[argPkt.id]; pktLength ← 0; RETURN[returnLength: pktLength]; END; -- ResetTimeoutStub. EndPlotStub: --PROCEDURE [id: PlotId]-- RpcPrivate.Dispatcher = INLINE BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, id (1): PlotId]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength; Lupine.CheckPktLength[pkt: pkt, pktLength: 3]; EndPlot[argPkt.id]; pktLength ← 0; RETURN[returnLength: pktLength]; END; -- EndPlotStub. -- No module initialization. END. -- ColorVersatecRpcServerImpl.