RTBasic.mesa
Copyright Ó 1985, 1986, 1987 by Xerox Corporation. All rights reserved.
by Bryan Preas August 29, 1985 2:48:22 pm PDT
last edited by Bryan Preas April 3, 1987 2:21:43 pm PST
DIRECTORY
Basics, CD, CDCells, DABasics, PW, Rope;
RTBasic: CEDAR DEFINITIONS
IMPORTS CD, CDCells, PW
= {
Types
SideOrNone: TYPE = DABasics.SideOrNone;
Side: TYPE = DABasics.Side;
LRSide: TYPE = DABasics.LRSide;
TBSide: TYPE = DABasics.TBSide;
Direction: TYPE = DABasics.Direction;
AboveOrBelow: TYPE = {above, below};
sideName: ARRAY Side OF Rope.ROPE;
Errors
Error: ERROR [errorType: ErrorType ← callingError, explanation: Rope.ROPENIL];
Signal: SIGNAL [signalType: ErrorType ← callingError, explanation: Rope.ROPENIL];
ErrorType: TYPE = {programmingError, callingError, noResource, designRuleViolation, other};
Procedures
OtherSide: PROCEDURE [side: Side]
RETURNS [Side];
OtherDirection: PROCEDURE [direction: Direction]
RETURNS [Direction];
OtherRelation: PROCEDURE [aboveOrBelow: AboveOrBelow]
RETURNS [AboveOrBelow];
SimpleCompare: PROCEDURE [result1, result2: DABasics.Number]
RETURNS [result: Basics.Comparison];
IRSize: PROC [obj: CD.Object] RETURNS [CD.Position] ~ INLINE{
RETURN[CD.InterestSize[obj]]};
SetCDCellName: PROC [obj: CD.Object, name: Rope.ROPE] ~ INLINE{
PW.SetName[obj, name]};
GetCDCellName: PROC [obj: CD.Object] RETURNS [Rope.ROPE]~ INLINE{
RETURN[PW.Name[obj]]};
CDCellIsEmpty: PROC [obj: CD.Object] RETURNS [BOOLEAN] ~ INLINE{
RETURN[CDCells.IsEmpty[obj]]};
RepositionCell: PROC [obj: CD.Object] ~ INLINE{
IF ~CDCellIsEmpty[obj] THEN [] ← CDCells.ResizeCell[NIL, obj]};
Range Types and Procedures
Range: TYPE = RECORD [
l, r: DABasics.Number];
RangeList: TYPE = LIST OF Range;
RefRange: TYPE = REF Range;
Overlap: PROC [r1, r2: Range] RETURNS [overlap: Range];
get the overlap of seg1, seg2
Overlaps: PUBLIC PROC [r1, r2: Range] RETURNS [BOOL] =
INLINE {RETURN [(r1.l<=r2.r) AND (r2.l<=r1.r)]};
Equal: PUBLIC PROC [r1, r2: Range] RETURNS [BOOL] =
INLINE {RETURN [(r1.l=r2.l) AND (r1.r=r2.r)]};
Gap: PROC [r1, r2: Range] RETURNS [gap: Range];
get the gap of seg1, seg2
Span: PROC [r1, r2: Range] RETURNS [result: Range];
determnie span of ranges 1 and 2
PQ Types and Procedures
PQPos: TYPE = RECORD[
p: DABasics.Number,
q: DABasics.Number];
PQRectRef: TYPE = REF PQRect;
PQRect: TYPE = RECORD[
c1, c2: PQPos];
PQRectList: TYPE = LIST OF PQRect;
XYToPQ: PROC [pDir: Direction, pos: DABasics.Position] RETURNS [pqPos: PQPos];
convert a position from x-y to p-q space.
PQToXY: PROC [pDir: Direction, pqPos: PQPos] RETURNS [pos: DABasics.Position];
convert a position from p-q to x-y space.
AddPoints: PROC [p, s: RTBasic.PQPos] RETURNS [RTBasic.PQPos] =
--p displaced by d
INLINE {RETURN [RTBasic.PQPos[p: p.p+s.p, q: p.q+s.q]]};
SubPoints: PROC [pos, neg: RTBasic.PQPos] RETURNS [RTBasic.PQPos] =
--pos displaced by -neg
INLINE {RETURN [RTBasic.PQPos[p: pos.p-neg.p, q: pos.q-neg.q]]};
}.