Rosemary>RoseStops.Mesa
Last Edited by: Spreitzer, March 29, 1984 6:41:18 pm PST
DIRECTORY AMBridge, AMTypes, PrincOps, PrincOpsUtils, RoseRun, RoseTypes;
RoseStops: CEDAR PROGRAM
IMPORTS AMBridge, AMTypes, PrincOpsUtils, RoseTypes
EXPORTS RoseRun =
BEGIN
Proc: TYPE = UNSAFE PROCEDURE ANY RETURNS ANY;
TV: TYPE = AMTypes.TV;
ROPE: TYPE = RoseTypes.ROPE;
DisabledList: TYPE = LIST OF Location;
Location: TYPE = RECORD [proc: Proc, pc: PrincOps.BytePC];
disableds: DisabledList ← NIL;
fudge: BOOLFALSE;
DisableableStop: PUBLIC PROC [proc: Proc, msg: ROPE, data: REF ANYNIL] = {
start, local, procTV: TV;
disProc: Proc ← NIL;
disPC: PrincOps.BytePC;
TRUSTED {start ← AMBridge.TVForFrame[PrincOpsUtils.MyLocalFrame[]]};
IF fudge
THEN TRUSTED {proc ← AMBridge.TVToProc[AMBridge.TVForProc[proc]]};
FOR local ← start, AMTypes.DynamicParent[local] DO
IF local = NIL THEN ERROR;
procTV ← NIL;
procTV ← AMTypes.Procedure[local !AMTypes.Error => CONTINUE];
IF procTV # NIL THEN {
procProc: Proc;
TRUSTED {procProc ← AMBridge.TVToProc[procTV]};
IF procProc = proc THEN EXIT;
};
ENDLOOP;
local ← AMTypes.DynamicParent[local];
procTV ← AMTypes.Procedure[local];
TRUSTED {
disProc ← AMBridge.TVToProc[procTV];
disPC ← AMBridge.ContextPC[local]};
FOR dl: DisabledList ← disableds, dl.rest WHILE dl # NIL DO
IF dl.first = [disProc, disPC] THEN RETURN;
ENDLOOP;
SIGNAL RoseTypes.Stop[msg: msg, data: data];
};
DisableThisStop: PUBLIC PROC [fh: PrincOps.FrameHandle] RETURNS [ok: BOOL] =
BEGIN
start, local, procTV: TV;
subGoal, disProc: Proc ← NIL;
disPC: PrincOps.BytePC;
TRUSTED {start ← AMBridge.TVForFrame[fh]};
FOR local ← start, AMTypes.DynamicParent[local] DO
procProc: Proc;
procTV ← NIL;
IF local = NIL THEN RETURN [FALSE];
procTV ← AMTypes.Procedure[local !AMTypes.Error => CONTINUE];
IF procTV # NIL THEN {
TRUSTED {procProc ← AMBridge.TVToProc[procTV]};
IF procProc = subGoal THEN EXIT;
IF procProc = DisableableStop THEN {
IF subGoal # NIL THEN ERROR;
procTV ← AMTypes.Argument[local, 1];
TRUSTED {subGoal ← AMBridge.TVToProc[procTV]};
};
};
ENDLOOP;
local ← AMTypes.DynamicParent[local];
procTV ← AMTypes.Procedure[local];
TRUSTED {
disProc ← AMBridge.TVToProc[procTV];
disPC ← AMBridge.ContextPC[local]};
disableds ← CONS[[disProc, disPC], disableds];
ok ← TRUE;
END;
END.