BackStop.mesa
Copyright Ó 1985, 1986, 1987, 1991 by Xerox Corporation. All rights reserved.
Russ Atkinson (RRA) January 19, 1987 9:18:23 pm PST
Last tweaked by Mike Spreitzer on October 5, 1989 1:47:09 pm PDT
DIRECTORY
Rope USING [ROPE];
BackStop: CEDAR DEFINITIONS = BEGIN
Call: PROC [inner: PROC] RETURNS [Rope.ROPE];
This calls the specified PROC under a protective catch phrase that catches and unwinds all signals except AMEvents.Debugged (or whatever corresponds to it, if anything), AMEvents.Debugging (similarly), 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.