DIRECTORY LupineDeclare USING [ BindingInterface, BindingRoutinesDynamic, BindingRoutinesPrivate, BindingRoutinesStandard, DispatcherHead, DispatcherSelect, DispatcherStubArm, DispatcherStubBody, DispatcherTail, Directory, DirectoryItem, ModuleHead, ProcedureIndex, ProcedureStub, SignalCatchStub, SignalCode, SignalIndex ], LupineMakeRpcModules USING [], LupineManagerPrivate USING [ CloseCodeFile, Indent, Language, ModuleName, Nest, NextOutputFile, OpenCodeFile, Options, OutputToAllFiles, StampCodeFile, StampTranslationOptions, String, StringNIL, WF1, WFL1, WFS1, WFS, WFSL ], LupineMarshal USING [ParameterProtocolVersions], LupineMarshalPrivate USING [ InitMarshalTypes, WriteMarshalProcs ], LupineSymbolTable USING [EnumerateTransfers, TransferProcedure]; LupineMakeRpcModulesImpl: PROGRAM IMPORTS Declare: LupineDeclare, LupineManagerPrivate, Private: LupineMarshalPrivate, Marshal: LupineMarshal, ST: LupineSymbolTable EXPORTS LupineMakeRpcModules = BEGIN OPEN LupineMakeRpcModules, LupineManagerPrivate; MakeRpcControlModule: PUBLIC PROCEDURE [options: Options] = BEGIN controlModuleNames: ARRAY [0..1) OF String _ [ModuleName[control]]; controlDirectoryList: ARRAY [0..3) OF Declare.DirectoryItem _ [ [module: ModuleName[interface], openName: ModuleName[openedInterface], usedIn: [shares: TRUE, beginOpen: TRUE] ], [module: ModuleName[rpcPublic], usingAll: "defaultInterfaceName, EncryptionKey, InterfaceName, Principal, standardZones, VersionRange, Zones", openName: "RpcPublic", usedIn: [beginOpen: TRUE] ], [module: ModuleName[rpcPrivate], inhibit: options.targetLanguage # Cedar OR ~options.importMultiple, usingAll: "ImportHandle", openName: "RpcPrivate", usedIn: [beginOpen: options.targetLanguage = Cedar AND options.importMultiple] ] ]; oldest, newest: LONG INTEGER; [oldestSupported: oldest, newestSupported: newest] _ Marshal.ParameterProtocolVersions[]; OpenCodeFile[ModuleName[control]]; BEGIN ENABLE UNWIND => CloseCodeFile; StampCodeFile[ModuleName[control]]; StampModuleNames; StampTranslationOptions[options]; Declare.Directory [ includeInterfaceDirectory: TRUE, extraDirectories: DESCRIPTOR[controlDirectoryList], options: options ]; Declare.ModuleHead [ moduleNames: DESCRIPTOR[controlModuleNames], moduleType: "DEFINITIONS", interfaceList: DESCRIPTOR[controlDirectoryList], options: options ]; Declare.BindingInterface[options]; WFS1[" -- Definitions for the stubs. LupineProtocolVersion: PUBLIC VersionRange = "]; WF1["[first: %g", [integer[oldest]]]; WF1[", last: %g]", [integer[newest]]]; WFS["; InterMdsCallsOnly: PUBLIC BOOLEAN = ", (IF options.defaultParamPassing=InterMds THEN "TRUE" ELSE "FALSE"), ";\n"]; Declare.ProcedureIndex[]; Declare.SignalIndex[]; WFS[" END. -- ", ModuleName[control], ".\n"]; END; -- ENABLE UNWIND => CloseCodeFile. CloseCodeFile[]; END; -- MakeRpcControlModule. MakeRpcClientModule: PUBLIC PROCEDURE [options: Options] = BEGIN clientModuleNames: ARRAY [0..1) OF String _ [ModuleName[client]]; clientDirectoryList: ARRAY [0..9) OF Declare.DirectoryItem _ [ [module: ModuleName[interface], openName: ModuleName[openedInterface], usedIn: [exports: options.targetLanguage # Cedar OR ~options.importMultiple, shares: TRUE, beginOpen: TRUE, imports: NOT options.declareSignals] ], [module: ModuleName[control], openName: "RpcControl", usedIn: [exports: TRUE, shares: TRUE, beginOpen: TRUE], usingAll: "InterfaceRecord, InterMdsCallsOnly, LupineProtocolVersion, ProcedureIndex, SignalIndex" ], [module: ModuleName[rpcPublic], openName: "RpcPublic", usedIn: [beginOpen: TRUE], usingSome: "InterfaceName, standardZones, Zones" ], [module: ModuleName[rpcPrivate], openName: "RpcPrivate", usedIn: [imports: TRUE], usingSome: "Alloc, Call, DataLength, DeAlloc, Dispatcher, GetPkt, GetStubPkt, ImportHandle, ImportInterface, maxDataLength, maxPrincipalLength, maxShortStringLength, pktOverhead, ReceiveExtraPkt, SendPrelimPkt, StartCall, StartSignal, StubPkt, UnimportInterface" ], [module: ModuleName[lupineRuntime], openName: "Lupine", usedIn: [imports: TRUE], usingSome: "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" ], [module: "Atom", usingSome: "GetPName, MakeAtom", usedIn: [imports: TRUE], forLanguage: [Cedar: TRUE] ], [module: "PrincOpsUtils", usingSome: "Enter, Exit", usedIn: [imports: TRUE], forLanguage: [Cedar: TRUE] ], [module: "Rope", usingSome: "InlineFlatten, Length, NewText, Text", usedIn: [imports: TRUE, shares: TRUE], forLanguage: [Cedar: TRUE] ], [module: "VM", usingSome: "AddressForPageNumber, PageCount, PageNumber, PageNumberForAddress, PagesForWords", forLanguage: [Cedar: TRUE] ] ]; OpenCodeFile[ModuleName[client], options.noClientModulesOut]; Private.InitMarshalTypes[]; BEGIN ENABLE UNWIND => CloseCodeFile; StampCodeFile[ModuleName[client]]; StampModuleNames; StampTranslationOptions[options]; Declare.Directory [ includeInterfaceDirectory: TRUE, extraDirectories: DESCRIPTOR[clientDirectoryList], options: options ]; Declare.ModuleHead [ moduleNames: DESCRIPTOR[clientModuleNames], moduleType: "MONITOR", interfaceList: DESCRIPTOR[clientDirectoryList], options: options ]; NextOutputFile[]; Declare.BindingRoutinesStandard[kind: import, options: options]; OutputToAllFiles[]; WFS1[" -- Remote public procedure stubs.\n"]; BEGIN DeclareInterfaceProcStub: ST.TransferProcedure = BEGIN NextOutputFile[]; Declare.ProcedureStub[ nest: 1, transfer: transfer, transferType: transferType, transferDeclaration: inInterface, signalDispatcherType: client, options: options ]; END; -- DeclareInterfaceProcStub. [] _ ST.EnumerateTransfers[proc: DeclareInterfaceProcStub, procs: TRUE]; END; -- Remote public procedure stubs. IF options.declareSignals THEN BEGIN DeclareInterfaceSignal: ST.TransferProcedure = BEGIN Declare.SignalCode[ nest: 1, transfer: transfer, transferType: transferType, transferDeclaration: inInterface, options: options ]; END; -- DeclareInterfaceSignal. WFS1[" -- Remote public signals and errors.\n"]; [] _ ST.EnumerateTransfers[ proc: DeclareInterfaceSignal, signals: TRUE, errors: TRUE ]; END -- Remote public signals and errors. ELSE WFS1[" --Remote public signals and errors are imported from the interface.\n"]; WFS1[" -- Public signal and error dispatcher.\n"]; Declare.DispatcherHead[type: client, nest: 1]; WFS1["\n"]; Declare.DispatcherSelect[type: client, nest: 1]; BEGIN DeclareDispatcherArm: ST.TransferProcedure = BEGIN Declare.DispatcherStubArm[ nest: 3, transfer: transfer, transferType: transferType, transferDeclaration: inInterface, options: options ]; END; -- DeclareDispatcherArm. [] _ ST.EnumerateTransfers[ proc: DeclareDispatcherArm, signals:TRUE, errors:TRUE ]; END; Declare.DispatcherTail[type: client, nest: 1]; WFS1[" -- Public signal and error dispatcher stubs.\n"]; BEGIN DeclareDispatcherBody: ST.TransferProcedure = BEGIN Declare.DispatcherStubBody[ nest: 1, transfer: transfer, transferType: transferType, transferDeclaration: inInterface, inlineBody: TRUE, options: options ]; END; -- DeclareDispatcherBody. [] _ ST.EnumerateTransfers[ proc: DeclareDispatcherBody, signals:TRUE, errors:TRUE ]; END; OutputToAllFiles[]; IF ~options.inlineMarshal THEN WFS1[" -- Marshall/Unmarshal procedures.\n"]; Private.WriteMarshalProcs[]; WFS[" -- No module initialization. END. -- ", ModuleName[client], ".\n"]; END; -- ENABLE UNWIND => CloseCodeFile. CloseCodeFile[]; END; -- MakeRpcClientModule. MakeRpcClientBinderModule: PUBLIC PROCEDURE [options: Options] = BEGIN clientBinderModuleNames: ARRAY [0..1) OF String _ [ModuleName[clientBinder]]; clientBinderDirectoryList: ARRAY [0..6) OF Declare.DirectoryItem _ [ [module: ModuleName[interface], usedIn: [imports: NOT options.declareSignals, shares: TRUE] ], [module: ModuleName[control], usingAll: "ImportInterface, InterfaceRecord, InterfaceRecordObject", openName: "RpcControl", usedIn: [exports: TRUE, shares: TRUE, imports: TRUE] ], [module: ModuleName[client], inhibit: options.targetLanguage = Cedar AND options.importMultiple, openName: "ClientPrototype", usedIn: [imports: TRUE] ], [module: ModuleName[rpcPublic], openName: "RpcPublic", usedIn: [beginOpen: TRUE], usingAll: "InterfaceName, Zones" ], [module: "SafeStorage", inhibit: options.targetLanguage = Cedar AND options.importMultiple, openName: "RTT", usingAll: "EnableFinalization, EstablishFinalization, FinalizationQueue, FQEmpty, FQNext, NewFQ", usedIn: [imports: TRUE], forLanguage: [Cedar: TRUE] ], [module: ModuleName[lupineRuntime], openName: "Lupine", usingAll: "defaultZones", usedIn: [imports: TRUE], forLanguage: [Mesa: TRUE] ] ]; OpenCodeFile[ModuleName[clientBinder]]; BEGIN ENABLE UNWIND => CloseCodeFile; StampCodeFile[ModuleName[clientBinder]]; StampModuleNames; StampTranslationOptions[options]; WFS1[" -- NOTE: Discard this module unless you use dynamic client binding.\n"]; Declare.Directory [ includeInterfaceDirectory: FALSE, extraDirectories: DESCRIPTOR[clientBinderDirectoryList], options: options ]; Declare.ModuleHead [ moduleNames: DESCRIPTOR[clientBinderModuleNames], moduleType: "MONITOR", interfaceList: DESCRIPTOR[clientBinderDirectoryList], options: options ]; Declare.BindingRoutinesDynamic[kind: import, options: options]; Declare.BindingRoutinesPrivate[kind: import, options: options]; WFS[" END. -- ", ModuleName[clientBinder], ".\n"]; END; -- ENABLE UNWIND => CloseCodeFile. CloseCodeFile[]; END; -- MakeRpcClientBinderModule. MakeRpcServerModule: PUBLIC PROCEDURE [options: Options] = BEGIN serverModuleNames: ARRAY [0..1) OF String _ [ModuleName[server]]; serverDirectoryList: ARRAY [0..7) OF Declare.DirectoryItem _ [ [module: ModuleName[interface], openName: ModuleName[openedInterface], usedIn: [imports: TRUE, shares: TRUE, beginOpen: TRUE] ], [module: ModuleName[control], openName: "RpcControl", usedIn: [exports: TRUE, shares: TRUE, beginOpen: TRUE], usingAll: "InterMdsCallsOnly, LupineProtocolVersion, ProcedureIndex, SignalIndex" ], [module: ModuleName[rpcPublic], openName: "RpcPublic", usedIn: [beginOpen: TRUE], usingAll: "EncryptionKey, InterfaceName, Principal, standardZones, Zones" ], [module: ModuleName[rpcPrivate], openName: "RpcPrivate", usedIn: [imports: TRUE], usingSome: "Call, DataLength, Dispatcher, ExportHandle, ExportInterface, GetStubPkt, maxDataLength, maxPrincipalLength, maxShortStringLength, pktOverhead, ReceiveExtraPkt, SendPrelimPkt, StartCall, StartSignal, StubPkt, UnexportInterface" ], [module: ModuleName[lupineRuntime], openName: "Lupine", usedIn: [imports: TRUE], usingSome: "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" ], [module: "Atom", usingSome: "GetPName, MakeAtom", usedIn: [imports: TRUE], forLanguage: [Cedar: TRUE] ], [module: "Rope", usingSome: "InlineFlatten, Length, NewText, Text", usedIn: [imports: TRUE, shares: TRUE], forLanguage: [Cedar: TRUE] ] ]; OpenCodeFile[ModuleName[server]]; Private.InitMarshalTypes[]; BEGIN ENABLE UNWIND => CloseCodeFile; StampCodeFile[ModuleName[server]]; StampModuleNames; StampTranslationOptions[options]; Declare.Directory [ includeInterfaceDirectory: TRUE, extraDirectories: DESCRIPTOR[serverDirectoryList], options: options ]; Declare.ModuleHead [ moduleNames: DESCRIPTOR[serverModuleNames], moduleType: "MONITOR", interfaceList: DESCRIPTOR[serverDirectoryList], options: options ]; Declare.BindingRoutinesStandard [kind: export, options: options]; WFS1[" -- Public procedure dispatcher and public signal and error catcher.\n"]; Declare.DispatcherHead[type: server, nest: 1]; WFS["\n", Indent[2], "-- Catch public signals.\n\n"]; WFL1[3, "ENABLE BEGIN"]; BEGIN DeclareSignalCatch: ST.TransferProcedure = BEGIN Declare.SignalCatchStub [ nest: 3, transfer: transfer, transferType: transferType, transferDeclaration: inInterface, options: options ]; END; -- DeclareSignalCatch. [] _ ST.EnumerateTransfers[ proc: DeclareSignalCatch, signals: TRUE, errors: TRUE ]; END; WFS["\n", Indent[3], "END; -- Catch public signals.\n"]; WFS["\n\n", Indent[2], "-- Call public procedures (still in dispatcher).\n\n"]; Declare.DispatcherSelect[type: server, nest: 1]; BEGIN DeclareDispatcherArm: ST.TransferProcedure = BEGIN Declare.DispatcherStubArm[ nest: 3, transfer: transfer, transferType: transferType, transferDeclaration: inInterface, options: options ]; END; -- DeclareDispatcherArm. [] _ ST.EnumerateTransfers[proc: DeclareDispatcherArm, procs: TRUE]; END; Declare.DispatcherTail[type: server, nest: 1]; WFS1[" -- Public procedure dispatcher stubs.\n"]; BEGIN DeclareDispatcherBody: ST.TransferProcedure = BEGIN Declare.DispatcherStubBody[ nest: 1, transfer: transfer, transferType: transferType, transferDeclaration: inInterface, inlineBody: options.inlineServerDispatcherStubs, options: options ]; END; -- DeclareDispatcherBody. [] _ ST.EnumerateTransfers[proc: DeclareDispatcherBody, procs: TRUE]; END; IF ~options.inlineMarshal THEN WFS1[" -- Marshall/Unmarshal procedures.\n"]; Private.WriteMarshalProcs[]; WFS[" -- No module initialization. END. -- ", ModuleName[server], ".\n"]; END; -- ENABLE UNWIND => CloseCodeFile. CloseCodeFile[]; END; -- MakeRpcServerModule. StampModuleNames: PROCEDURE = BEGIN WFSL[" -- The RPC stub modules for ", ModuleName[interface], " are: -- ", ModuleName[control], ".mesa; -- ", ModuleName[client], ".mesa; -- ", ModuleName[clientBinder], ".mesa; -- ", ModuleName[server], ".mesa.\n"]; END; -- StampModuleNames. END. -- LupineMakeRpcModulesImpl. ήLupineMakeRpcModulesImpl.mesa. Copyright c 1985 by Xerox Corporation. All rights reserved. Last edited by BZM on 11-May-82 16:25:46. Last Edited by: Birrell, September 14, 1983 9:05 am Last Edited by: Swinehart, February 8, 1985 9:05:21 am PST Bob Hagmann February 12, 1985 12:53:41 pm PST Common directory items: Cedar directory items: Mesa directory items: Generate Marshaling Routines Common directory items: Cedar directory items: Mesa directory items: This includes module initialization code, and MUST be at the end. Common directory items: Cedar directory items: Mesa directory items: Generate Marshaling Routines Private utility routines. Bob Hagmann February 12, 1985 12:53:13 pm PST changes to: MakeRpcClientModule Κ o˜headšœ™Icodešœ Οmœ1™<—Jšœ)™)J™3™:L™-—J˜šΟk ˜ šœžœ˜J˜)J˜0J˜!J˜6J˜DJ˜+—Jšœžœ˜šœžœ˜JšœB˜BJ˜PJšœ$žœžœ˜0—Jšœžœ˜0Jšœžœ)˜CJšœžœ)˜@J˜J˜—šœž˜!šž˜JšœL˜LJšœžœ˜-—Jšžœ˜Jšžœžœ,˜6J˜—J˜šΟnœžœž œ˜;Jšž˜Jšœžœžœ ˜Cšœžœžœ˜?˜J˜&Jšœžœ žœ˜*—˜J˜nJ˜Jšœžœ˜—˜ Jšœ(žœ˜CJ˜J˜Jšœ3žœ˜TJ˜——Jšœžœžœ˜˜2J˜&J˜—J˜"Jšžœžœžœ˜%J˜#J˜J˜!J˜˜Jšœžœ˜ Jšœž œ˜3J˜J˜—˜Jšœ ž œ˜,J˜Jšœž œ˜0J˜J˜—J˜"J˜JšœY˜YšœOžœ-˜Jšœžœ&žœžœ ˜CJšœ˜J˜—J˜J˜J˜šžœ,˜/J˜—JšžœΟc"˜(J˜Jšžœ ˜J˜J˜—J˜šŸœžœž œ˜:Jšž˜Jšœžœžœ˜AJšœžœžœ˜>šœ™˜J˜&šœ1žœ"žœ žœ˜kJšœ žœ˜'——˜J˜Jšœžœ žœ žœ˜7J˜e—˜J˜Jšœžœ˜Jšœ3˜3—˜ J˜Jšœžœ˜Jšœ‰˜‰—˜#J˜Jšœžœ˜J˜ή——šœ™˜J˜ Jšœžœ˜Jšœžœ˜—šœ˜Jšœ˜Jšœžœ˜Jšœžœ˜—˜J˜2Jšœžœ žœ˜&Jšœžœ˜—šœ žœ˜Jšœ^˜^Jšœžœ˜——šœ™J˜J˜—Jšœ=˜=J˜Jšžœžœžœ˜%J˜"J˜J˜!J˜˜Jšœžœ˜ Jšœž œ˜2J˜J˜—˜Jšœ ž œ˜+J˜Jšœž œ˜/J˜J˜—Jšœ˜J˜@J˜Jšœ˜J˜Jšœžœ'˜/Jšž˜šœžœ˜0Jšž˜Jšœ˜˜J˜J˜J˜!J˜J˜—Jšžœ ˜"—Jšœžœ;žœ˜HJšžœ !˜'J˜Jšžœ˜šžœž˜ šœžœ˜.Jšž˜˜J˜J˜J˜!J˜—Jšžœ ˜ —Jšœžœ*˜1šœžœ˜Jšœ'žœ žœ˜<—Jšž %˜(—JšžœQ˜UJ˜Jšœ3˜3J˜.J˜ J˜0Jšž˜šœžœ˜,Jšž˜˜#J˜J˜J˜!J˜—Jšžœ ˜—šœžœ˜Jšœ$žœ žœ˜8—Jšžœ˜J˜.J˜Jšœ9˜9Jšž˜šœžœ˜-Jšž˜˜$J˜J˜J˜!Jšœ žœ˜J˜—Jšžœ ˜—šœžœ˜Jšœ%žœ žœ˜9—Jšžœ˜J˜Jšœ˜J˜J™Jšžœžœ/˜MJ˜J˜JšžœI˜LJ˜Jšžœ "˜(J˜Jšžœ ˜J˜J˜—J˜šŸœžœž œ˜@Jšž˜Jšœžœžœ%˜MJšœžœžœ˜Dšœ™˜Jšœžœ!žœ˜>—˜J˜DJ˜Jšœžœ žœ žœ˜7—˜Jšœ(žœ˜CJ˜Jšœžœ˜—˜J˜Jšœžœ˜J˜#——šœ™˜Jšœ(žœ˜CJ˜Jšœa˜aJšœžœ˜Jšœžœ˜——šœ™˜#J˜J˜Jšœžœ˜Jšœžœ˜J˜——J˜'Jšžœžœžœ˜%J˜(J˜J˜!J˜JšœO˜O—˜˜Jšœžœ˜!Jšœž œ˜8J˜J˜—˜Jšœ ž œ˜1J˜Jšœž œ˜5J˜J˜—J˜?J˜J˜?JšœA™AJ˜Jšžœ1˜4J˜Jšžœ "˜(J˜Jšžœ ˜#J˜J˜—J˜šŸœžœž œ˜:Jšž˜Jšœžœžœ˜AJšœžœžœ˜>šœ™˜J˜&Jšœžœ žœ žœ˜9—˜J˜Jšœžœ žœ žœ˜7J˜T—˜J˜Jšœžœ˜J˜L—˜ J˜Jšœžœ˜J˜ρ—˜#J˜Jšœžœ˜J˜ή——šœ™˜J˜ Jšœžœ˜Jšœžœ˜—˜J˜2Jšœžœ žœ˜&Jšœžœ˜——šœ™J˜J˜—Jšœ!˜!J˜Jšžœžœžœ˜%J˜"J˜J˜!J˜˜Jšœžœ˜ Jšœž œ˜2J˜J˜—˜Jšœ ž œ˜+J˜Jšœž œ˜/J˜J˜—J˜AJ˜JšœP˜PJ˜.Jšžœ2˜5J˜Jšž˜šœžœ˜*Jšž˜˜"J˜J˜J˜!J˜—Jšžœ ˜—šœžœ˜Jšœ#žœ žœ˜8—Jšžœ˜Jšžœ6˜9J˜šžœ˜J˜8—J˜0Jšž˜šœžœ˜,Jšž˜˜#J˜J˜J˜!J˜—Jšžœ ˜—Jšœžœ7žœ˜DJšžœ˜J˜.J˜Jšœ2˜2Jšž˜šœžœ˜-Jšž˜˜$J˜J˜J˜!J˜0J˜—Jšžœ ˜—Jšœžœ8žœ˜EJšžœ˜J˜J™Jšžœžœ/˜MJ˜J˜JšžœI˜LJ˜Jšžœ "˜(J˜Jšžœ ˜J˜J˜—J˜Jšœ™J˜šŸœž œ˜Jšž˜JšžœΫ˜ίJšžœ ˜J˜J˜—Jšžœ ˜"™-Lšœ Οr™—L™—…—7„EΡ