GetMeImpl:
CEDAR
PROGRAM
IMPORTS AMBridge, AMModel, AMModelBridge, AMTypes, LoadState, PrincOpsUtils, RefText, Rope
EXPORTS GetMe =
{
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];
};
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];
};
}.