ConstArith.mesa
Copyright Ó 1986, 1988 by Xerox Corporation. All rights reserved.
Russ Atkinson (RRA) July 25, 1988 9:48:12 pm PDT
DIRECTORY
PBasics USING [Comparison];
ConstArith: DEFINITIONS = BEGIN
Const: TYPE = RECORD [
sign: ConstSign,
low: CARD,
high: CARD];
ConstSign: TYPE = {negative, zero, positive};
Exceptions
Overflow: ERROR;
DivByZero: ERROR;
Conversions
FromCard: PROC [card: CARD] RETURNS [Const];
FromInt: PROC [int: INT] RETURNS [Const];
ToCard: PROC [const: Const] RETURNS [CARD];
ToInt: PROC [const: Const] RETURNS [INT];
Arithmetic
Add: PROC [x,y: Const] RETURNS [Const];
Sub: PROC [x,y: Const] RETURNS [Const];
Div: PROC [x,y: Const] RETURNS [Const];
Mod: PROC [x,y: Const] RETURNS [Const];
DivMod: PROC [x,y: Const] RETURNS [q, r: Const];
Mul: PROC [x,y: Const] RETURNS [Const];
Abs: PROC [c: Const] RETURNS [Const];
Neg: PROC [c: Const] RETURNS [Const];
Comparison
Compare: PROC [c1,c2: Const] RETURNS [PBasics.Comparison];
END.