Copyright (C) 1985 by Xerox Corporation. All rights reserved.
Stub file was translated on June 22, 1985 9:34:33 pm PDT by Lupine of May 23, 1985 8:38:08 am PDT
Source interface CedarNSPrint came from file CedarNSPrint.bcd, which was created on June 22, 1985 9:34:02 pm PDT with version stamp 14#21#26004275173 from source of June 22, 1985 9:31:11 pm PDT.
The RPC stub modules for CedarNSPrint are:
CedarNSPrintRpcControl.mesa;
CedarNSPrintRpcClientImpl.mesa;
CedarNSPrintRpcBinderImpl.mesa;
CedarNSPrintRpcServerImpl.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
CedarNSPrint,
CedarNSPrintRpcControl USING [InterfaceRecord, InterMdsCallsOnly,
LupineProtocolVersion, ProcedureIndex, SignalIndex],
RPC --USING SOME OF [InterfaceName, standardZones, Zones]--,
RPCLupine --USING SOME OF [Alloc, Call, DataLength, DeAlloc, Dispatcher,
GetPkt, GetStubPkt, ImportHandle, ImportInterface, maxDataLength,
maxPrincipalLength, maxShortStringLength, pktOverhead, ReceiveExtraPkt,
-- SendPrelimPkt, StartCall, StartSignal, StubPkt, UnimportInterface]--,
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]--,
PrincOpsUtils --USING SOME OF [Enter, Exit]--,
Rope --USING SOME OF [InlineFlatten, Length, NewText, Text]--,
VM --USING SOME OF [AddressForPageNumber, PageCount, PageNumber,
-- PageNumberForAddress, PagesForWords]--;
CedarNSPrintRpcClientImpl: MONITOR
IMPORTS RpcPrivate: RPCLupine, Lupine: LupineRuntime, Atom, PrincOpsUtils,
Rope
EXPORTS CedarNSPrint, CedarNSPrintRpcControl
SHARES CedarNSPrint, CedarNSPrintRpcControl, Rope
= BEGIN OPEN CedarNSPrint, RpcControl: CedarNSPrintRpcControl, RpcPublic:
RPC;
Standard remote binding routines.
bound: BOOLEANFALSE;
myInterface: RpcPrivate.ImportHandle;
paramZones: RpcPublic.Zones ← RpcPublic.standardZones;
ImportInterface: PUBLIC ENTRY SAFE PROCEDURE [
interfaceName: RpcPublic.InterfaceName,
parameterStorage: RpcPublic.Zones ] =
TRUSTED BEGIN ENABLE UNWIND => NULL;
IsNull: PROCEDURE [string: Rope.ROPE] RETURNS [BOOLEAN] =
INLINE {RETURN[string.Length[] = 0]};
myInterface ← RpcPrivate.ImportInterface [
interface: [
type: IF ~IsNull[interfaceName.type]
THEN interfaceName.type ELSE "CedarNSPrint~14#21#26004275173",
instance: interfaceName.instance,
version: interfaceName.version ],
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;
UnimportInterface: PUBLIC ENTRY SAFE PROCEDURE =
TRUSTED BEGIN ENABLE UNWIND => NULL;
IF ~bound THEN Lupine.BindingError;
myInterface ← RpcPrivate.UnimportInterface[myInterface];
paramZones ← RpcPublic.standardZones;
bound ← FALSE;
END;
Remote public procedure stubs.
Print: PUBLIC PROCEDURE [master: Source, printAttributes: PrintAttributes,
printOptions: PrintOptions, systemElement: SystemElement]
RETURNS [printRequestID: RequestID] =
BEGIN
ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
transferIndex (0): RpcControl.ProcedureIndex ← Print, systemElement
(1): SystemElement];
ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
printRequestID (0): RequestID];
pkt: RpcPrivate.RPCPkt = RpcPrivate.GetPkt[space: RpcPrivate.AllocInline[RpcPrivate.pktOverhead+254]];
argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0];
pktLength: RpcPrivate.DataLength ← 7;
lastPkt: BOOLEAN;
BEGIN ENABLE UNWIND => RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
RpcPrivate.StartCall[callPkt: pkt, interface: myInterface];
argPkt^ ← [systemElement: systemElement];
BEGIN -- Marshal master: Source to pkt.data[pktLength].
IF pktLength+3 > RpcPrivate.maxDataLength
THEN pktLength ← Lupine.StartNextPkt[pkt: pkt, pktLength:
pktLength];
pkt.data[pktLength] ← master=NIL; pktLength ← pktLength+1;
IF master # NIL
THEN BEGIN
stringHeader: Lupine.StringHeader = [
Lengths[length: master.length, maxLength: master.maxlength]];
Lupine.RpcPktDoubleWord[pkt, pktLength]^ ← stringHeader.all;
pktLength ← pktLength + 2;
pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength: pktLength,
dataAdr: BASE[master.text], dataLength: Lupine.WordsForChars[stringHeader.length],
alwaysOnePkt: FALSE];
END; -- IF master # NIL.
END; -- Marshal master.
BEGIN -- Marshal printAttributes: PrintAttributes to pkt.data[pktLength].
IF pktLength+2 > RpcPrivate.maxDataLength
THEN pktLength ← Lupine.StartNextPkt[pkt: pkt, pktLength:
pktLength];
Lupine.RpcPktDoubleWord[pkt, pktLength]^ ← (IF BASE[printAttributes]=NIL
THEN 0 ELSE LENGTH[printAttributes]);
pktLength ← pktLength + 2;
IF BASE[printAttributes] # NIL THEN
FOR element1: CARDINAL IN [FIRST[CARDINAL]..FIRST[CARDINAL]+LENGTH[printAttributes])
DO
BEGIN -- Marshal printAttributes[element1]: PrintAttribute
to pkt.data[pktLength].
pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength: pktLength,
dataAdr: @printAttributes[element1], dataLength: SIZE[PrintAttribute],
alwaysOnePkt: FALSE];
BEGIN OPEN record: printAttributes[element1];
WITH variant: record SELECT FROM
printObjectName =>
BEGIN -- Marshal variant: MACHINE DEPENDENT RECORD
[printObjectName: String] to pkt.data[pktLength].
BEGIN OPEN record: variant;
BEGIN -- Marshal record.printObjectName: String
to pkt.data[pktLength].
BEGIN OPEN record: record.printObjectName;
BEGIN -- Marshal record.bytes: LONG POINTER
TO PACKED ARRAY CARDINAL OF [0..255] to pkt.data[pktLength].
IF pktLength+1 > RpcPrivate.maxDataLength
THEN pktLength ← Lupine.StartNextPkt[pkt:
pkt, pktLength: pktLength];
pkt.data[pktLength] ← record.bytes=NIL; pktLength
← pktLength+1;
IF record.bytes # NIL THEN
BEGIN -- Marshal record.bytes^: PACKED ARRAY
CARDINAL OF [0..255] to pkt.data[pktLength].
pktLength ← Lupine.CopyToPkt[pkt: pkt,
pktLength: pktLength, dataAdr: @record.bytes^,
dataLength: SIZE[PACKED ARRAY CARDINAL
OF [0..255]], alwaysOnePkt: FALSE];
END; -- Marshal record.bytes^.
END; -- Marshal record.bytes.
END; -- OPEN record: record.printObjectName.
END; -- Marshal record.printObjectName.
END; -- OPEN record: variant.
END; -- Marshal variant.
senderName =>
BEGIN -- Marshal variant: MACHINE DEPENDENT RECORD
[senderName: String] to pkt.data[pktLength].
BEGIN OPEN record: variant;
BEGIN -- Marshal record.senderName: String to
pkt.data[pktLength].
BEGIN OPEN record: record.senderName;
BEGIN -- Marshal record.bytes: LONG POINTER
TO PACKED ARRAY CARDINAL OF [0..255] to pkt.data[pktLength].
IF pktLength+1 > RpcPrivate.maxDataLength
THEN pktLength ← Lupine.StartNextPkt[pkt:
pkt, pktLength: pktLength];
pkt.data[pktLength] ← record.bytes=NIL; pktLength
← pktLength+1;
IF record.bytes # NIL THEN
BEGIN -- Marshal record.bytes^: PACKED ARRAY
CARDINAL OF [0..255] to pkt.data[pktLength].
pktLength ← Lupine.CopyToPkt[pkt: pkt,
pktLength: pktLength, dataAdr: @record.bytes^,
dataLength: SIZE[PACKED ARRAY CARDINAL
OF [0..255]], alwaysOnePkt: FALSE];
END; -- Marshal record.bytes^.
END; -- Marshal record.bytes.
END; -- OPEN record: record.senderName.
END; -- Marshal record.senderName.
END; -- OPEN record: variant.
END; -- Marshal variant.
ENDCASE => NULL; -- WITH variant: record.
END; -- OPEN record: printAttributes[element1].
END; -- Marshal printAttributes[element1].
ENDLOOP; -- FOR element1.
END; -- Marshal printAttributes.
BEGIN -- Marshal printOptions: PrintOptions to pkt.data[pktLength].
IF pktLength+2 > RpcPrivate.maxDataLength
THEN pktLength ← Lupine.StartNextPkt[pkt: pkt, pktLength:
pktLength];
Lupine.RpcPktDoubleWord[pkt, pktLength]^ ← (IF BASE[printOptions]=NIL
THEN 0 ELSE LENGTH[printOptions]);
pktLength ← pktLength + 2;
IF BASE[printOptions] # NIL THEN
FOR element1: CARDINAL IN [FIRST[CARDINAL]..FIRST[CARDINAL]+LENGTH[printOptions])
DO
BEGIN -- Marshal printOptions[element1]: PrintOption to
pkt.data[pktLength].
pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength: pktLength,
dataAdr: @printOptions[element1], dataLength: SIZE[PrintOption],
alwaysOnePkt: FALSE];
BEGIN OPEN record: printOptions[element1];
WITH variant: record SELECT FROM
recipientName =>
BEGIN -- Marshal variant: MACHINE DEPENDENT RECORD
[recipientName: String] to pkt.data[pktLength].
BEGIN OPEN record: variant;
BEGIN -- Marshal record.recipientName: String
to pkt.data[pktLength].
BEGIN OPEN record: record.recipientName;
BEGIN -- Marshal record.bytes: LONG POINTER
TO PACKED ARRAY CARDINAL OF [0..255] to pkt.data[pktLength].
IF pktLength+1 > RpcPrivate.maxDataLength
THEN pktLength ← Lupine.StartNextPkt[pkt:
pkt, pktLength: pktLength];
pkt.data[pktLength] ← record.bytes=NIL; pktLength
← pktLength+1;
IF record.bytes # NIL THEN
BEGIN -- Marshal record.bytes^: PACKED ARRAY
CARDINAL OF [0..255] to pkt.data[pktLength].
pktLength ← Lupine.CopyToPkt[pkt: pkt,
pktLength: pktLength, dataAdr: @record.bytes^,
dataLength: SIZE[PACKED ARRAY CARDINAL
OF [0..255]], alwaysOnePkt: FALSE];
END; -- Marshal record.bytes^.
END; -- Marshal record.bytes.
END; -- OPEN record: record.recipientName.
END; -- Marshal record.recipientName.
END; -- OPEN record: variant.
END; -- Marshal variant.
message =>
BEGIN -- Marshal variant: MACHINE DEPENDENT RECORD
[message: String] to pkt.data[pktLength].
BEGIN OPEN record: variant;
BEGIN -- Marshal record.message: String to pkt.data[pktLength].
BEGIN OPEN record: record.message;
BEGIN -- Marshal record.bytes: LONG POINTER
TO PACKED ARRAY CARDINAL OF [0..255] to pkt.data[pktLength].
IF pktLength+1 > RpcPrivate.maxDataLength
THEN pktLength ← Lupine.StartNextPkt[pkt:
pkt, pktLength: pktLength];
pkt.data[pktLength] ← record.bytes=NIL; pktLength
← pktLength+1;
IF record.bytes # NIL THEN
BEGIN -- Marshal record.bytes^: PACKED ARRAY
CARDINAL OF [0..255] to pkt.data[pktLength].
pktLength ← Lupine.CopyToPkt[pkt: pkt,
pktLength: pktLength, dataAdr: @record.bytes^,
dataLength: SIZE[PACKED ARRAY CARDINAL
OF [0..255]], alwaysOnePkt: FALSE];
END; -- Marshal record.bytes^.
END; -- Marshal record.bytes.
END; -- OPEN record: record.message.
END; -- Marshal record.message.
END; -- OPEN record: variant.
END; -- Marshal variant.
ENDCASE => NULL; -- WITH variant: record.
END; -- OPEN record: printOptions[element1].
END; -- Marshal printOptions[element1].
ENDLOOP; -- FOR element1.
END; -- Marshal printOptions.
[returnLength: , lastPkt: lastPkt] ←
RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
maxReturnLength: 5, signalHandler: ClientDispatcher];
[printRequestID: printRequestID] ← resPkt^;
Lupine.CheckPktLength[pkt: pkt, pktLength: 5];
RpcPrivate.DeAllocInline[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
RETURN[printRequestID];
END; -- UNWIND.
END; -- Print.
GetPrinterProperties: PUBLIC PROCEDURE [systemElement: SystemElement]
RETURNS [properties: PrinterProperties] =
BEGIN
ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
transferIndex (0): RpcControl.ProcedureIndex ← GetPrinterProperties,
systemElement (1): SystemElement];
pkt: RpcPrivate.RPCPkt = RpcPrivate.GetPkt[space: RpcPrivate.AllocInline[RpcPrivate.pktOverhead+254]];
argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
pktLength: RpcPrivate.DataLength ← 7;
lastPkt: BOOLEAN;
BEGIN ENABLE UNWIND => RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
RpcPrivate.StartCall[callPkt: pkt, interface: myInterface];
argPkt^ ← [systemElement: systemElement];
[returnLength: , lastPkt: lastPkt] ←
RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
maxReturnLength: 254, signalHandler: ClientDispatcher];
pktLength ← 0;
BEGIN -- Unmarshal properties: PrinterProperties from pkt.data[pktLength].
DescriptorType: TYPE = RECORD [SEQUENCE COMPUTED CARDINAL OF
PrinterProperty];
descLength: Lupine.SequenceHeader;
IF pktLength+2 > RpcPrivate.maxDataLength
THEN pktLength ← Lupine.FinishThisPkt[pkt: pkt, pktLength:
pktLength];
descLength ← Lupine.RpcPktDoubleWord[pkt, pktLength]^;
pktLength ← pktLength + 2;
properties ← DESCRIPTOR[
(paramZones.heap.NEW[DescriptorType[Lupine.SHORT[descLength]]]),
Lupine.SHORT[descLength]];
FOR element1: CARDINAL IN [FIRST[CARDINAL]..FIRST[CARDINAL]+LENGTH[properties])
DO
BEGIN -- Unmarshal properties[element1]: PrinterProperty
from pkt.data[pktLength].
pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength,
dataAdr: @properties[element1], dataLength: SIZE[PrinterProperty],
alwaysOnePkt: FALSE];
BEGIN OPEN record: properties[element1];
WITH variant: record SELECT FROM
media =>
BEGIN -- Unmarshal variant: MACHINE DEPENDENT RECORD
[media: Media] from pkt.data[pktLength].
BEGIN OPEN record: variant;
BEGIN -- Unmarshal record.media: Media from pkt.data[pktLength].
DescriptorType: TYPE = RECORD [SEQUENCE COMPUTED
CARDINAL OF Medium];
descLength: Lupine.SequenceHeader;
IF pktLength+2 > RpcPrivate.maxDataLength
THEN pktLength ← Lupine.FinishThisPkt[pkt: pkt,
pktLength: pktLength];
descLength ← Lupine.RpcPktDoubleWord[pkt, pktLength]^;
pktLength ← pktLength + 2;
record.media ← DESCRIPTOR[
(paramZones.heap.NEW[DescriptorType[Lupine.SHORT[descLength]]]),
Lupine.SHORT[descLength]];
pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength:
pktLength, dataAdr: BASE[record.media], dataLength:
SIZE[Medium]*LENGTH[record.media], alwaysOnePkt:
FALSE];
END; -- Unmarshal record.media.
END; -- OPEN record: variant.
END; -- Unmarshal variant.
ENDCASE => NULL; -- WITH variant: record.
END; -- OPEN record: properties[element1].
END; -- Unmarshal properties[element1].
ENDLOOP; -- FOR element1.
END; -- Unmarshal properties.
Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
RpcPrivate.DeAllocInline[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
RETURN[properties];
END; -- UNWIND.
END; -- GetPrinterProperties.
GetPrinterStatus: PUBLIC PROCEDURE [systemElement: SystemElement]
RETURNS [status: PrinterStatus] =
BEGIN
ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
transferIndex (0): RpcControl.ProcedureIndex ← GetPrinterStatus,
systemElement (1): SystemElement];
pkt: RpcPrivate.RPCPkt = RpcPrivate.GetPkt[space: RpcPrivate.AllocInline[RpcPrivate.pktOverhead+254]];
argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
pktLength: RpcPrivate.DataLength ← 7;
lastPkt: BOOLEAN;
BEGIN ENABLE UNWIND => RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
RpcPrivate.StartCall[callPkt: pkt, interface: myInterface];
argPkt^ ← [systemElement: systemElement];
[returnLength: , lastPkt: lastPkt] ←
RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
maxReturnLength: 254, signalHandler: ClientDispatcher];
pktLength ← 0;
BEGIN -- Unmarshal status: PrinterStatus from pkt.data[pktLength].
DescriptorType: TYPE = RECORD [SEQUENCE COMPUTED CARDINAL OF
PrinterStatusComponent];
descLength: Lupine.SequenceHeader;
IF pktLength+2 > RpcPrivate.maxDataLength
THEN pktLength ← Lupine.FinishThisPkt[pkt: pkt, pktLength:
pktLength];
descLength ← Lupine.RpcPktDoubleWord[pkt, pktLength]^;
pktLength ← pktLength + 2;
status ← DESCRIPTOR[
(paramZones.heap.NEW[DescriptorType[Lupine.SHORT[descLength]]]),
Lupine.SHORT[descLength]];
FOR element1: CARDINAL IN [FIRST[CARDINAL]..FIRST[CARDINAL]+LENGTH[status])
DO
BEGIN -- Unmarshal status[element1]: PrinterStatusComponent
from pkt.data[pktLength].
pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength,
dataAdr: @status[element1], dataLength: SIZE[PrinterStatusComponent],
alwaysOnePkt: FALSE];
BEGIN OPEN record: status[element1];
WITH variant: record SELECT FROM
media =>
BEGIN -- Unmarshal variant: MACHINE DEPENDENT RECORD
[media: Media] from pkt.data[pktLength].
BEGIN OPEN record: variant;
BEGIN -- Unmarshal record.media: Media from pkt.data[pktLength].
DescriptorType: TYPE = RECORD [SEQUENCE COMPUTED
CARDINAL OF Medium];
descLength: Lupine.SequenceHeader;
IF pktLength+2 > RpcPrivate.maxDataLength
THEN pktLength ← Lupine.FinishThisPkt[pkt: pkt,
pktLength: pktLength];
descLength ← Lupine.RpcPktDoubleWord[pkt, pktLength]^;
pktLength ← pktLength + 2;
record.media ← DESCRIPTOR[
(paramZones.heap.NEW[DescriptorType[Lupine.SHORT[descLength]]]),
Lupine.SHORT[descLength]];
pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength:
pktLength, dataAdr: BASE[record.media], dataLength:
SIZE[Medium]*LENGTH[record.media], alwaysOnePkt:
FALSE];
END; -- Unmarshal record.media.
END; -- OPEN record: variant.
END; -- Unmarshal variant.
ENDCASE => NULL; -- WITH variant: record.
END; -- OPEN record: status[element1].
END; -- Unmarshal status[element1].
ENDLOOP; -- FOR element1.
END; -- Unmarshal status.
Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
RpcPrivate.DeAllocInline[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
RETURN[status];
END; -- UNWIND.
END; -- GetPrinterStatus.
GetPrintRequestStatus: PUBLIC PROCEDURE [printRequestID: RequestID,
systemElement: SystemElement] RETURNS [status: RequestStatus] =
BEGIN
ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
transferIndex (0): RpcControl.ProcedureIndex ← GetPrintRequestStatus,
printRequestID (1): RequestID, systemElement (6): SystemElement];
pkt: RpcPrivate.RPCPkt = RpcPrivate.GetPkt[space: RpcPrivate.AllocInline[RpcPrivate.pktOverhead+254]];
argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
pktLength: RpcPrivate.DataLength ← 12;
lastPkt: BOOLEAN;
BEGIN ENABLE UNWIND => RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
RpcPrivate.StartCall[callPkt: pkt, interface: myInterface];
argPkt^ ← [printRequestID: printRequestID, systemElement: systemElement];
[returnLength: , lastPkt: lastPkt] ←
RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
maxReturnLength: 254, signalHandler: ClientDispatcher];
pktLength ← 0;
BEGIN -- Unmarshal status: RequestStatus from pkt.data[pktLength].
DescriptorType: TYPE = RECORD [SEQUENCE COMPUTED CARDINAL OF
RequestStatusComponent];
descLength: Lupine.SequenceHeader;
IF pktLength+2 > RpcPrivate.maxDataLength
THEN pktLength ← Lupine.FinishThisPkt[pkt: pkt, pktLength:
pktLength];
descLength ← Lupine.RpcPktDoubleWord[pkt, pktLength]^;
pktLength ← pktLength + 2;
status ← DESCRIPTOR[
(paramZones.heap.NEW[DescriptorType[Lupine.SHORT[descLength]]]),
Lupine.SHORT[descLength]];
FOR element1: CARDINAL IN [FIRST[CARDINAL]..FIRST[CARDINAL]+LENGTH[status])
DO
BEGIN -- Unmarshal status[element1]: RequestStatusComponent
from pkt.data[pktLength].
pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength,
dataAdr: @status[element1], dataLength: SIZE[RequestStatusComponent],
alwaysOnePkt: FALSE];
BEGIN OPEN record: status[element1];
WITH variant: record SELECT FROM
statusMessage =>
BEGIN -- Unmarshal variant: MACHINE DEPENDENT RECORD
[statusMessage: String] from pkt.data[pktLength].
BEGIN OPEN record: variant;
BEGIN -- Unmarshal record.statusMessage: String
from pkt.data[pktLength].
BEGIN OPEN record: record.statusMessage;
BEGIN -- Unmarshal record.bytes: LONG POINTER
TO PACKED ARRAY CARDINAL OF [0..255] from pkt.data[pktLength].
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 record.bytes ← NIL
ELSE BEGIN
record.bytes ← (paramZones.heap.NEW[PACKED
ARRAY CARDINAL OF [0..255]]);
BEGIN -- Unmarshal record.bytes^: PACKED
ARRAY CARDINAL OF [0..255] from pkt.data[pktLength].
pktLength ← Lupine.CopyFromPkt[pkt: pkt,
pktLength: pktLength, dataAdr: @record.bytes^,
dataLength: SIZE[PACKED ARRAY CARDINAL
OF [0..255]], alwaysOnePkt: FALSE];
END; -- Unmarshal record.bytes^.
END; -- IF isNIL.
END; -- Unmarshal record.bytes.
END; -- OPEN record: record.statusMessage.
END; -- Unmarshal record.statusMessage.
END; -- OPEN record: variant.
END; -- Unmarshal variant.
ENDCASE => NULL; -- WITH variant: record.
END; -- OPEN record: status[element1].
END; -- Unmarshal status[element1].
ENDLOOP; -- FOR element1.
END; -- Unmarshal status.
Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
RpcPrivate.DeAllocInline[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
RETURN[status];
END; -- UNWIND.
END; -- GetPrintRequestStatus.
AddressTranslationStringToNetworkAddress: PUBLIC PROCEDURE [name:
LONG STRING] RETURNS [systemElement: SystemElement, chUsed: BOOLEAN]
=
BEGIN
ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
transferIndex (0): RpcControl.ProcedureIndex ← AddressTranslationStringToNetworkAddress];
ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
systemElement (0): SystemElement, chUsed (6): BOOLEAN];
pkt: RpcPrivate.RPCPkt = RpcPrivate.GetPkt[space: RpcPrivate.AllocInline[RpcPrivate.pktOverhead+254]];
argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0];
pktLength: RpcPrivate.DataLength ← 1;
lastPkt: BOOLEAN;
BEGIN ENABLE UNWIND => RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
RpcPrivate.StartCall[callPkt: pkt, interface: myInterface];
argPkt.transferIndex ← AddressTranslationStringToNetworkAddress;
BEGIN -- Marshal name: LONG STRING to pkt.data[pktLength].
IF pktLength+3 > RpcPrivate.maxDataLength
THEN pktLength ← Lupine.StartNextPkt[pkt: pkt, pktLength:
pktLength];
pkt.data[pktLength] ← name=NIL; pktLength ← pktLength+1;
IF name # NIL
THEN BEGIN
stringHeader: Lupine.StringHeader = [
Lengths[length: name.length, maxLength: name.maxlength]];
Lupine.RpcPktDoubleWord[pkt, pktLength]^ ← stringHeader.all;
pktLength ← pktLength + 2;
pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength: pktLength,
dataAdr: BASE[name.text], dataLength: Lupine.WordsForChars[stringHeader.length],
alwaysOnePkt: FALSE];
END; -- IF name # NIL.
END; -- Marshal name.
[returnLength: , lastPkt: lastPkt] ←
RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
maxReturnLength: 7, signalHandler: ClientDispatcher];
[systemElement: systemElement, chUsed: chUsed] ← resPkt^;
Lupine.CheckPktLength[pkt: pkt, pktLength: 7];
RpcPrivate.DeAllocInline[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
RETURN[systemElement, chUsed];
END; -- UNWIND.
END; -- AddressTranslationStringToNetworkAddress.
Remote public signals and errors.
Error: PUBLIC ERROR [why: ErrorRecord] = CODE;
Public signal and error dispatcher.
ClientDispatcher: --PROCEDURE [pkt: RPCPkt, callLength: DataLength,
lastPkt: BOOLEAN, localConversation: Conversation] RETURNS [returnLength:
-- DataLength]-- RpcPrivate.Dispatcher =
BEGIN
SELECT LOOPHOLE[pkt.data[0], RpcControl.SignalIndex] FROM
Error => RETURN[
ErrorStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt,
localConversation: localConversation]];
ENDCASE => RETURN[Lupine.DispatchingError[]];
END; -- ClientDispatcher
Public signal and error dispatcher stubs.
ErrorStub: --ERROR [why: ErrorRecord]-- RpcPrivate.Dispatcher =
INLINE BEGIN
ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
transferIndex (0): RpcControl.SignalIndex, why (1): ErrorRecord];
argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
Lupine.CheckPktLength[pkt: pkt, pktLength: 3];
ERROR Error[argPkt.why];
END; -- ErrorStub.
Marshall/Unmarshal procedures.
No module initialization.
END. -- CedarNSPrintRpcClientImpl.