-- Copyright (C) 1985 by Xerox Corporation. All rights reserved. -- Stub file was translated on May 23, 1985 10:40:20 am PDT by Lupine of May 23, 1985 8:38:08 am PDT -- Source interface LarkSmarts came from file LarkSmarts.bcd, which was created on May 14, 1985 3:48:06 pm PDT with version stamp 72#344#2161736451 from source of December 19, 1983 1:37:07 pm PST. -- The RPC stub modules for LarkSmarts are: -- LarkSmartsRpcControl.mesa; -- LarkSmartsRpcClientImpl.mesa; -- LarkSmartsRpcBinderImpl.mesa; -- LarkSmartsRpcServerImpl.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]. -- NOTE: Discard this module unless you use dynamic client binding. DIRECTORY LarkSmarts, LarkSmartsRpcControl USING [ImportInterface, InterfaceRecord, InterfaceRecordObject], LarkSmartsRpcClientImpl, RPC USING [InterfaceName, Zones], SafeStorage USING [EnableFinalization, EstablishFinalization, FinalizationQueue, FQEmpty, FQNext, NewFQ]; LarkSmartsRpcBinderImpl: MONITOR IMPORTS RpcControl: LarkSmartsRpcControl, ClientPrototype: LarkSmartsRpcClientImpl, RTT: SafeStorage EXPORTS LarkSmartsRpcControl SHARES LarkSmarts, LarkSmartsRpcControl = BEGIN OPEN RpcPublic: RPC; -- Dynamic instantiation and binding routines. ImportNewInterface: PUBLIC SAFE PROCEDURE [ interfaceName: RpcPublic.InterfaceName, parameterStorage: RpcPublic.Zones ] RETURNS [interfaceRecord: RpcControl.InterfaceRecord] = TRUSTED BEGIN interfaceRecord _ NewInterface[]; LupineDetails[interfaceRecord].module.ImportInterface [ interfaceName: interfaceName, parameterStorage: parameterStorage ! UNWIND => FreeInterface[interfaceRecord] ]; END; UnimportNewInterface: SAFE PROCEDURE [ interfaceRecord: RpcControl.InterfaceRecord ] = TRUSTED BEGIN LupineDetails[interfaceRecord].module.UnimportInterface[]; FreeInterface[interfaceRecord]; END; -- Utility routines for interface instantiation and caching. ConcreteLupineDetails: TYPE = REF LupineDetailsObject; LupineDetailsObject: PUBLIC TYPE = RECORD [ module: ClientModule_NIL, list: RpcControl.InterfaceRecord_NIL, --package reference next: RpcControl.InterfaceRecord_NIL --free list -- ]; LupineDetails: PROCEDURE [abstractInterface: RpcControl.InterfaceRecord] RETURNS [ConcreteLupineDetails] = INLINE {RETURN[abstractInterface.lupineDetails]}; ClientModule: TYPE = POINTER TO FRAME[LarkSmartsRpcClientImpl]; clientInterfaceCache: RpcControl.InterfaceRecord _ NIL; -- free interface -- records clientInterfaceList: RpcControl.InterfaceRecord _ NIL; -- all interface -- records NewInterfaceRecord: PUBLIC SAFE PROCEDURE RETURNS [interfaceRecord: RpcControl.InterfaceRecord] = TRUSTED BEGIN interfaceRecord _ NEW[RpcControl.InterfaceRecordObject]; END; NewInterface: PROCEDURE RETURNS [interface: RpcControl.InterfaceRecord]= BEGIN GetCachedInterface: ENTRY PROCEDURE RETURNS [cachedIR: RpcControl.InterfaceRecord] = INLINE BEGIN ENABLE UNWIND => NULL; IF (cachedIR_clientInterfaceCache) # NIL THEN clientInterfaceCache _ LupineDetails[clientInterfaceCache].next; END; ReclaimInterfaces[]; IF (interface _ GetCachedInterface[]) = NIL THEN BEGIN ChainNewInterface: ENTRY PROCEDURE = INLINE BEGIN ENABLE UNWIND => NULL; interface.lupineDetails _ NEW[ LupineDetailsObject _ [module: module, list: clientInterfaceList]]; clientInterfaceList _ interface; END; -- ChainNewInterface. module: ClientModule = NEW ClientPrototype; interface _ NewInterfaceRecord[]; interface^ _ [ Register: module.Register, RecordEvent: module.RecordEvent, EventRope: module.EventRope, Login: module.Login]; ChainNewInterface[]; END; RTT.EnableFinalization[interface]; END; FreeInterface: ENTRY PROCEDURE [interface: RpcControl.InterfaceRecord]= INLINE BEGIN ENABLE UNWIND => NULL; LupineDetails[interface].next _ clientInterfaceCache; clientInterfaceCache _ interface; END; -- Finalization for dynamic interfaces. Just cache and reuse for now. freedInterfaces: RTT.FinalizationQueue = RTT.NewFQ[20]; ReclaimInterfaces: PROCEDURE = INLINE BEGIN WHILE ~RTT.FQEmpty[freedInterfaces] DO interface: RpcControl.InterfaceRecord = NARROW[RTT.FQNext[freedInterfaces]]; IF interface.lupineDetails # NIL THEN UnimportNewInterface[interface]; ENDLOOP; END; -- Module initialization. RTT.EstablishFinalization[ type: CODE[RpcControl.InterfaceRecordObject], npr: 1, fq: freedInterfaces ]; END. -- LarkSmartsRpcBinderImpl.