BackStop.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Russ Atkinson, February 12, 1985 1:42:03 pm PST
Paul Rovner, November 1, 1983 5:14 pm
DIRECTORY Rope USING [ROPE];
BackStop: CEDAR DEFINITIONS = BEGIN OPEN Rope;
Call: PROC [inner: PROC] RETURNS [ROPE];
This calls the specified PROC under a protective catch phrase that catches and unwinds all signals except AMEvents.Debugged, AMEvents.Debugging, ABORTED and UNWIND, which it explicitly REJECTs. If no signals are raised by inner, Call returns NIL. Otherwise, Call returns a ROPE that describes the signal that was caught and unwound.
SuspendBackStop: SIGNAL;
ResumeBackStop: SIGNAL;
SuspendBackStop can be raised by an "inner" proc that is called by BackStop.Call to let signals that would otherwise be caught and unwound to pass thru (via REJECT). ResumeBackStop (also raised by an "inner" proc) restores BackStop.Call to its state before the (previous) matching SuspendBackStop. (SuspendBackStop .. ResumeBackStop) pairs nest. Example from the implementation of Interpreter.Evaluate: signals that arise during interpretation of everything BUT calls on client procedures are protected by BackStop.Call and yield an errorRope; signals that are raised by a client procedure pass thru Interpreter.Evaluate and (normally) are uncaught.
END.