DIRECTORY Basics, CD, CDBasics, D2Basic, Rope, RTBasic; 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] = { 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] = { 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. δRTBasicImpl.mesa Copyright c 1986 by Xerox Corporation. All rights reserved. last edited by Bryan Preas April 2, 1986 3:58:39 pm PST convert a position from x-y to p-q space. convert a position from p-q to x-y space. Κ}˜šœ™Icodešœ Οmœ1™