ExampleBaseImpl.mesa
Copyright Ó 1987 by Xerox Corporation. All rights reserved.
Bill Jackson (bj) April 22, 1987 2:23:09 am PDT
DIRECTORY
Convert USING [IntFromRope],
ExampleGenericDef USING [numberNode],
Rope USING [ROPE],
ExampleBaseDef;
ExampleBaseImpl:
CEDAR
MONITOR
IMPORTS Convert
EXPORTS ExampleBaseDef ~ {
OPEN ExampleBaseDef;
Integer: PUBLIC SIGNAL RETURNS [result: INT] ~ CODE;
FIREWALL: PUBLIC SIGNAL ~ CODE;
ValueOf:
PUBLIC
PROC [node: ExampleGenericDef.numberNode]
RETURNS [result:
INT] ~ {
result ← Convert.IntFromRope[node.text];
};
EqualOp:
PUBLIC
PROC [left: Op, right: Op]
RETURNS [yes:
BOOLEAN] ~ {
IF ( left = right )
THEN yes ← TRUE
ELSE yes ← FALSE;
};
Add:
PUBLIC
PROC [left:
INT, right:
INT]
RETURNS [result:
INT] ~ {
result ← ( left + right );
};
Subtract:
PUBLIC
PROC [left:
INT, right:
INT]
RETURNS [result:
INT] ~ {
result ← ( left - right );
};
Multipy:
PUBLIC
PROC [left:
INT, right:
INT]
RETURNS [result:
INT] ~ {
result ← ( left * right );
};
Divide:
PUBLIC
PROC [left:
INT, right:
INT]
RETURNS [result:
INT] ~ {
result ← ( left / right );
};
Signal:
PUBLIC
PROC
RETURNS [result:
INT] ~ {
result ← SIGNAL Integer[];
};
Error:
PUBLIC
PROC [message: Rope.
ROPE]
RETURNS [result:
INT] ~ {
SIGNAL FIREWALL;
};
}...