-- Copyright (C) 1985 by Xerox Corporation. All rights reserved.
-- Stub file was translated on May 15, 1985 1:02:25 pm PDT by Lupine of March 15, 1985 2:49:13 pm PST
-- Source interface ComputeServer came from file ComputeServer.bcd, which was created on May 15, 1985 1:01:00 pm PDT with version stamp 61#260#30520321217 from source of May 13, 1985 3:42:55 pm PDT.
-- The RPC stub modules for ComputeServer are:
-- ComputeServerRpcControl.mesa;
-- ComputeServerRpcClientImpl.mesa;
-- ComputeServerRpcBinderImpl.mesa;
-- ComputeServerRpcServerImpl.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
ComputeServerClient,
PupDefs,
Rope,
RPC,
ComputeServer,
ComputeServerRpcControl 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]--;
ComputeServerRpcServerImpl: MONITOR
IMPORTS ComputeServer, RpcPrivate: RPCLupine, Lupine: LupineRuntime,
Atom, Rope
EXPORTS ComputeServerRpcControl
SHARES ComputeServer, ComputeServerRpcControl, Rope
= BEGIN OPEN ComputeServer, RpcControl: ComputeServerRpcControl,
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 "ComputeServer~61#260#30520321217",
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
AskForService => RETURN[
AskForServiceStub[pkt: pkt, callLength: callLength, lastPkt:
lastPkt, localConversation: localConversation]];
DoService => RETURN[
DoServiceStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt,
localConversation: localConversation]];
AskForAbort => RETURN[
AskForAbortStub[pkt: pkt, callLength: callLength, lastPkt:
lastPkt, localConversation: localConversation]];
ENDCASE => RETURN[Lupine.DispatchingError[]];
END; -- ServerDispatcher
-- Public procedure dispatcher stubs.
AskForServiceStub: --PROCEDURE [service: Rope.ROPE, version: RPC.ShortROPE,
-- clientMachineName: RPC.ShortROPE, streamPupAddress: PupDefs.PupAddress,
-- needListener: BOOL]
-- RETURNS [found: AskResponce, serverPupAddress: PupDefs.PupAddress,
-- errMsg: Rope.ROPE]-- RpcPrivate.Dispatcher =
INLINE BEGIN
service: Rope.ROPE;
version: RPC.ShortROPE;
clientMachineName: RPC.ShortROPE;
streamPupAddress: PupDefs.PupAddress;
needListener: BOOL;
errMsg: Rope.ROPE;
ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
transferIndex (0): RpcControl.ProcedureIndex, streamPupAddress
(1): PupDefs.PupAddress, needListener (4): BOOL];
ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
found (0): AskResponce, serverPupAddress (1): PupDefs.PupAddress];
argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
resPkt: LONG POINTER TO ResultOverlay;
pktLength: RpcPrivate.DataLength ← 5;
BEGIN -- OnePkt.
onePkt: BOOLEAN = lastPkt;
IF ~onePkt THEN BEGIN -- Must move statics from pkt now.
[streamPupAddress: streamPupAddress, needListener: needListener]
← argPkt↑;
END;
BEGIN -- Unmarshal service: 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 service ← NIL
ELSE BEGIN
ropeLength: Lupine.RopeHeader;
textRope: Rope.Text;
ropeLength ← pkt.data[pktLength]; pktLength ← pktLength+1;
IF ropeLength > LAST[NAT]
THEN Lupine.UnmarshalingError;
service ← 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 service.
BEGIN -- Unmarshal version: RPC.ShortROPE 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 version ← NIL
ELSE BEGIN
ropeLength: Lupine.RopeHeader;
textRope: Rope.Text;
ropeLength ← pkt.data[pktLength]; pktLength ← pktLength+1;
IF ropeLength > RpcPrivate.maxShortStringLength
THEN Lupine.UnmarshalingError;
version ← 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 version.
BEGIN -- Unmarshal clientMachineName: RPC.ShortROPE 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 clientMachineName ← NIL
ELSE BEGIN
ropeLength: Lupine.RopeHeader;
textRope: Rope.Text;
ropeLength ← pkt.data[pktLength]; pktLength ← pktLength+1;
IF ropeLength > RpcPrivate.maxShortStringLength
THEN Lupine.UnmarshalingError;
clientMachineName ← 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 clientMachineName.
Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
resPkt ← @pkt.data[0];
IF onePkt
THEN [resPkt.found, resPkt.serverPupAddress, errMsg] ←
AskForService[service, version, clientMachineName, argPkt.streamPupAddress,
argPkt.needListener]
ELSE [resPkt.found, resPkt.serverPupAddress, errMsg] ←
AskForService[service, version, clientMachineName, streamPupAddress,
needListener];
END; -- OnePkt.
pktLength ← 4;
BEGIN -- Marshal errMsg: Rope.ROPE to pkt.data[pktLength].
IF pktLength+2 > RpcPrivate.maxDataLength
THEN pktLength ← Lupine.StartNextPkt[pkt: pkt, pktLength: pktLength];
pkt.data[pktLength] ← errMsg=NIL; pktLength ← pktLength+1;
IF errMsg # NIL
THEN BEGIN
textRope: Rope.Text = Rope.InlineFlatten[r: errMsg];
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 errMsg # NIL.
END; -- Marshal errMsg.
RETURN[returnLength: pktLength];
END; -- AskForServiceStub.
DoServiceStub: --PROCEDURE [serverPupAddress: PupDefs.PupAddress,
-- clientNetAddressRope: RPC.ShortROPE, commandLine: Rope.ROPE, WorkingDirectory:
-- Rope.ROPE, needRemoteInStream: BOOL, needRemoteOutStream: BOOL]
-- RETURNS [success: ComputeServerClient.RemoteSuccess, msg: Rope.ROPE]--
RpcPrivate.Dispatcher =
INLINE BEGIN
serverPupAddress: PupDefs.PupAddress;
clientNetAddressRope: RPC.ShortROPE;
commandLine: Rope.ROPE;
WorkingDirectory: Rope.ROPE;
needRemoteInStream: BOOL;
needRemoteOutStream: BOOL;
msg: Rope.ROPE;
ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
transferIndex (0): RpcControl.ProcedureIndex, serverPupAddress
(1): PupDefs.PupAddress, needRemoteInStream (4): BOOL, needRemoteOutStream
(5): BOOL];
ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
success (0): ComputeServerClient.RemoteSuccess];
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.
[serverPupAddress: serverPupAddress, needRemoteInStream: needRemoteInStream,
needRemoteOutStream: needRemoteOutStream] ← argPkt↑;
END;
BEGIN -- Unmarshal clientNetAddressRope: RPC.ShortROPE 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 clientNetAddressRope ← NIL
ELSE BEGIN
ropeLength: Lupine.RopeHeader;
textRope: Rope.Text;
ropeLength ← pkt.data[pktLength]; pktLength ← pktLength+1;
IF ropeLength > RpcPrivate.maxShortStringLength
THEN Lupine.UnmarshalingError;
clientNetAddressRope ← 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 clientNetAddressRope.
BEGIN -- Unmarshal commandLine: 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 commandLine ← NIL
ELSE BEGIN
ropeLength: Lupine.RopeHeader;
textRope: Rope.Text;
ropeLength ← pkt.data[pktLength]; pktLength ← pktLength+1;
IF ropeLength > LAST[NAT]
THEN Lupine.UnmarshalingError;
commandLine ← 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 commandLine.
BEGIN -- Unmarshal WorkingDirectory: 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 WorkingDirectory ← NIL
ELSE BEGIN
ropeLength: Lupine.RopeHeader;
textRope: Rope.Text;
ropeLength ← pkt.data[pktLength]; pktLength ← pktLength+1;
IF ropeLength > LAST[NAT]
THEN Lupine.UnmarshalingError;
WorkingDirectory ← 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 WorkingDirectory.
Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
resPkt ← @pkt.data[0];
IF onePkt
THEN [resPkt.success, msg] ←
DoService[argPkt.serverPupAddress, clientNetAddressRope,
commandLine, WorkingDirectory, argPkt.needRemoteInStream,
argPkt.needRemoteOutStream]
ELSE [resPkt.success, msg] ←
DoService[serverPupAddress, clientNetAddressRope, commandLine,
WorkingDirectory, needRemoteInStream, needRemoteOutStream];
END; -- OnePkt.
pktLength ← 1;
BEGIN -- Marshal msg: Rope.ROPE to pkt.data[pktLength].
IF pktLength+2 > RpcPrivate.maxDataLength
THEN pktLength ← Lupine.StartNextPkt[pkt: pkt, pktLength: pktLength];
pkt.data[pktLength] ← msg=NIL; pktLength ← pktLength+1;
IF msg # NIL
THEN BEGIN
textRope: Rope.Text = Rope.InlineFlatten[r: msg];
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 msg # NIL.
END; -- Marshal msg.
RETURN[returnLength: pktLength];
END; -- DoServiceStub.
AskForAbortStub: --PROCEDURE [serverPupAddress: PupDefs.PupAddress]--
RpcPrivate.Dispatcher =
INLINE BEGIN
ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
transferIndex (0): RpcControl.ProcedureIndex, serverPupAddress
(1): PupDefs.PupAddress];
argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
pktLength: RpcPrivate.DataLength;
Lupine.CheckPktLength[pkt: pkt, pktLength: 4];
AskForAbort[argPkt.serverPupAddress];
pktLength ← 0;
RETURN[returnLength: pktLength];
END; -- AskForAbortStub.
-- No module initialization.
END. -- ComputeServerRpcServerImpl.