<> <> DIRECTORY AMBridge, AMModel, AMModelBridge, AMTypes, BcdDefs, GetMe, LoadState, PrincOps, PrincOpsUtils, RefText, Rope, TimeStamp; GetMeImpl: CEDAR PROGRAM IMPORTS AMBridge, AMModel, AMModelBridge, AMTypes, LoadState, PrincOpsUtils, RefText, Rope EXPORTS GetMe = { ROPE: TYPE = Rope.ROPE; TV: TYPE = AMTypes.TV; GetVersion: PUBLIC PROC RETURNS [ts: TimeStamp.Stamp] = TRUSTED { myLocalFrame: PrincOps.FrameHandle _ PrincOpsUtils.MyLocalFrame[]; myLF: TV _ AMBridge.TVForFrame[myLocalFrame]; callersLF: TV _ AMTypes.DynamicParent[myLF]; callersGF: TV _ AMTypes.GlobalParent[callersLF]; context: AMModel.Context _ AMModelBridge.ContextForFrame[callersGF]; section: AMModel.Section _ AMModel.ContextSection[context]; ts _ AMModel.SectionVersion[section]; }; GetAncestorVersion: PUBLIC PROC [moduleName: ROPE] RETURNS [ts: TimeStamp.Stamp] = TRUSTED { myLocalFrame: PrincOps.FrameHandle _ PrincOpsUtils.MyLocalFrame[]; myLF: TV _ AMBridge.TVForFrame[myLocalFrame]; callersLF: TV _ AMTypes.DynamicParent[myLF]; callersGF: TV _ AMTypes.GlobalParent[callersLF]; context: AMModel.Context _ AMModelBridge.ContextForFrame[callersGF]; section: AMModel.Section _ AMModel.ContextSection[context]; WHILE NOT AMModel.SectionName[section].Equal[moduleName] DO context _ AMModel.ParentContext[context]; IF context = NIL OR AMModel.ContextClass[context] = world THEN ERROR --no such containing module--; section _ AMModel.ContextSection[context]; ENDLOOP; ts _ AMModel.SectionVersion[section]; }; StandardScrewyEncoding: PUBLIC PROC [ts: TimeStamp.Stamp] RETURNS [Rope.ROPE] = { fooey: PACKED ARRAY [0 .. 12) OF [0 .. 16) _ LOOPHOLE[ts]; rt: REF TEXT _ RefText.New[12]; FOR i: NAT IN [0 .. 12) DO rt _ RefText.AppendChar[rt, IF fooey[i] IN [0 .. 9] THEN '0 + fooey[i] ELSE 'a + fooey[i] - 10]; ENDLOOP; RETURN [Rope.FromRefText[rt]]; }; GetBCD: PUBLIC PROC RETURNS [bb: BcdDefs.BcdBase] = TRUSTED { myLocalFrame: PrincOps.FrameHandle _ PrincOpsUtils.MyLocalFrame[]; myLF: TV _ AMBridge.TVForFrame[myLocalFrame]; callersLF: TV _ AMTypes.DynamicParent[myLF]; callersGF: TV _ AMTypes.GlobalParent[callersLF]; callersGlobalFrame: PrincOps.GlobalFrameHandle _ AMBridge.GFHFromTV[callersGF]; cid: LoadState.ConfigID; mi: LoadState.ModuleIndex; LoadState.Acquire[LoadState.local, shared]; [cid, mi] _ LoadState.GlobalFrameToModule[LoadState.local, callersGlobalFrame]; bb _ LoadState.ConfigInfo[LoadState.local, cid].bcd; LoadState.Release[LoadState.local]; }; }.