CedarBaseMiscImpl.Mesa
Copyright Ó 1987 by Xerox Corporation. All rights reserved.
Shoup, August 8, 1986 5:37:24 pm PDT
Bill Jackson (bj) April 10, 1987 4:43:07 pm PDT
DIRECTORY
CedarBaseMisc USING [BotchAction],
CedarSupport USING [ErrorSignal],
IO USING [STREAM, PutF, rope, int],
Rope USING [ROPE],
ThreeC4Support USING [GetSourceInfo, GetReportStream];
CedarBaseMiscImpl: CEDAR PROGRAM
IMPORTS CedarSupport, ThreeC4Support, IO
EXPORTS CedarBaseMisc ~ {
Assert: PUBLIC PROC [cond: BOOLEAN, msg: Rope.ROPE, action: CedarBaseMisc.BotchAction]
RETURNS [BOOLEAN] ~ {
s: IO.STREAM; sourcePosition: INT; sourceLength: INT;
IF ( cond ) THEN RETURN [TRUE];
s ← Output[];
[sourcePosition, sourceLength] ← SIGNAL ThreeC4Support.GetSourceInfo;
IO.PutF[s, "[%g..%g] %g\n",
IO.int[sourcePosition],
IO.int[sourcePosition+sourceLength-1],
IO.rope[msg]
];
SELECT action FROM
quit => ERROR CedarSupport.ErrorSignal;
debug => ERROR;
ENDCASE => ERROR;
};
True: PUBLIC PROC RETURNS [BOOLEAN] ~ { RETURN[TRUE] };
False: PUBLIC PROC RETURNS [BOOLEAN] ~ { RETURN[FALSE] };
Not: PUBLIC PROC [a: BOOLEAN] RETURNS [BOOLEAN] ~ { RETURN[NOT a] };
And: PUBLIC PROC [a: BOOLEAN, b: BOOLEAN] RETURNS [BOOLEAN] ~ { RETURN[a AND b] };
Or: PUBLIC PROC [a: BOOLEAN, b: BOOLEAN] RETURNS [BOOLEAN] ~ { RETURN[a OR b] };
Output: PUBLIC PROC [] RETURNS [IO.STREAM] ~ {
RETURN[SIGNAL ThreeC4Support.GetReportStream];
};
}...