RTBasicImpl.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
last edited by Bryan Preas April 2, 1986 3:58:39 pm PST
RTBasicImpl:
CEDAR
PROGRAM
IMPORTS CD, CDBasics
EXPORTS RTBasic =
BEGIN
sideName: PUBLIC ARRAY RTBasic.Side OF Rope.ROPE ← ["bottom", "top", "left", "right"];
Error: PUBLIC ERROR[errorType: RTBasic.ErrorType ← callingError, explanation: Rope.ROPE ← NIL] = CODE;
Signal:
PUBLIC
SIGNAL[signalType: RTBasic.ErrorType ← callingError, explanation: Rope.
ROPE ←
NIL] =
CODE;
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.Pos]
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.Pos] = {
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};
IRSize:
PUBLIC
PROC [obj:
CD.Object]
RETURNS [
CD.Position] =
{RETURN[CDBasics.SizeOfRect[CD.InterestRect[obj]]]};
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.