RTBasicImpl.mesa
Copyright Ó 1986, 1987 by Xerox Corporation. All rights reserved.
last edited by Bryan Preas April 19, 1987 4:08:10 pm PDT
DIRECTORY
Basics, D2Basic, Rope, RTBasic;
RTBasicImpl: CEDAR PROGRAM
EXPORTS RTBasic = BEGIN
Signals and Errors
Error: PUBLIC ERROR[errorType: RTBasic.ErrorType ← callingError, explanation: Rope.ROPENIL] = CODE;
Signal: PUBLIC SIGNAL[signalType: RTBasic.ErrorType ← callingError, explanation: Rope.ROPENIL] = CODE;
Procedures
OtherSide: PUBLIC PROCEDURE [side: RTBasic.Side]
RETURNS [RTBasic.Side] = {
RETURN[otherSide[side]]};
OtherDirection: PUBLIC PROCEDURE [direction: RTBasic.Direction]
RETURNS [RTBasic.Direction] = {
RETURN[otherDirection[direction]]};
OtherRelation: PUBLIC PROCEDURE [aboveOrBelow: RTBasic.AboveOrBelow]
RETURNS [RTBasic.AboveOrBelow] = {
RETURN[otherRelation[aboveOrBelow]]};
SimpleCompare: PUBLIC PROCEDURE [result1, result2: D2Basic.Number]
RETURNS [result: Basics.Comparison] = {
result ← IF result1 < result2 THEN less
ELSE IF result1 > result2 THEN greater
ELSE equal};
XYToPQ: PUBLIC PROC [pDir: RTBasic.Direction, pos: D2Basic.Vector] RETURNS [pqPos: RTBasic.PQPos] = {
convert a position from x-y to p-q space.
SELECT pDir FROM
horizontal => pqPos ← [pos.x, pos.y];
vertical => pqPos ← [pos.y, pos.x];
ENDCASE};
PQToXY: PUBLIC PROC [pDir: RTBasic.Direction, pqPos: RTBasic.PQPos] RETURNS [pos: D2Basic.Vector] = {
convert a position from p-q to x-y space.
SELECT pDir FROM
horizontal => pos ← [pqPos.p, pqPos.q];
vertical => pos ← [pqPos.q, pqPos.p];
ENDCASE};
Variables
sideName: PUBLIC ARRAY RTBasic.Side OF Rope.ROPE ← ["bottom", "top", "left", "right"];
otherRelation: ARRAY RTBasic.AboveOrBelow OF RTBasic.AboveOrBelow ← [below, above];
otherDirection: ARRAY RTBasic.Direction OF RTBasic.Direction ← [vertical, horizontal];
otherSide: ARRAY RTBasic.Side OF RTBasic.Side ← [top, bottom, right, left];
END.