Copy:
PUBLIC
PROC [cx: Context]
RETURNS [newCx: Context] =
BEGIN
CopyItem: SymTab.EachPairAction = {
[] ← SymTab.Store[newCx, key, val];
quit ← FALSE;
};
IF cx=NIL THEN ERROR;
newCx ← SymTab.Create[];
[] ← SymTab.Pairs[cx, CopyItem];
END;
Eval:
PUBLIC
PROC [cx: Context, expr:
ROPE, cedarCx: AMModel.Context ←
NIL]
RETURNS [
REF] =
TRUSTED
BEGIN
result: AMTypes.TV;
errorRope: ROPE;
noResult: BOOL;
IF cedarCx=
NIL
THEN cedarCx ← AMModelBridge.ContextForFrame[
AMBridge.TVForFrame[
PrincOpsUtils.GetReturnFrame[]
]
];
[result, errorRope, noResult] ← Interpreter.Evaluate[rope: expr, context: cedarCx, symTab: cx];
IF errorRope # NIL THEN ERROR;
RETURN[RefFromTV[result]];
END;