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];
};
 
}.