C2CEnables.mesa
Copyright Ó 1987, 1988, 1991 by Xerox Corporation. All rights reserved.
Christian Jacobi, February 29, 1988 2:32:49 pm PST
DIRECTORY
C2CDefs,
IntCodeDefs,
IntToIntTab;
C2CEnables: CEDAR DEFINITIONS =
BEGIN
Purpose: TYPE = {unknown, proc, enableHandler};
--we assume that a lambda is either used as proc or as enableHandler, but not for both
LabelUsageRec: TYPE = RECORD [
lambda: IntCodeDefs.LambdaNode, --the lambda for which this labelusage is defined
purposeOfLambda: Purpose ¬ unknown,
definedLabels: IntToIntTab.Table ¬ NIL,
--targets of goto's
--key: LogicalId of Label; val: >=0 if declared in this procedure
upLabels: IntToIntTab.Table¬NIL,
--defined only for enable handlers
--key: LogicalId of Label; val: number>0 (count)
--direct up-labels: labels used, but not defined in this procedure
--indirect up-labels: labels used by inner procedure, but not defined in this procedure
callers: LIST OF IntCodeDefs.LogicalId ¬ NIL
--defined only for enable handlers
--lists enable handlers which directly call this enable handler's lambda
];
LabelUsage: TYPE = REF LabelUsageRec;
LambdaLabelUsage: PROC [id: IntCodeDefs.LogicalId] RETURNS [LabelUsage];
--given an lambda - id finds the corresponding labe usage
--Used for enables to return information about the up-level goto's
IncEnableNesting: PROC [];
--enter a nesting level of code protected with an enable
DecEnableNesting: PROC [];
--exit a nesting level of code protected with an enable
PopsForJump: PROC [id: IntCodeDefs.LogicalId] RETURNS [INT];
--returns the number of enable scopes to be poped for a goto from current place to id
PopsForReturns: PROC [] RETURNS [INT];
--returns the number of enable scopes to be poped for a return from current place
END.