<> <> <> <> <> DIRECTORY Pipal; PipalInt: CEDAR DEFINITIONS = BEGIN <> <> <> Number: TYPE = INT32; infinity: Number = LAST [Number]/2; Vector: TYPE = RECORD [ x: Number, -- horizontal dimension, going right y: Number]; -- vertical dimension, going down Position: TYPE = Vector; -- alias when a vector expresses a position Size: TYPE = Vector; -- alias when a vector expresses a size zeroVector: Vector = [0, 0]; emptySize: Size = [-infinity, -infinity]; Interval: TYPE = RECORD [ base: Number, size: Number]; < empty interval. All empty intervals are legal. Intervals are closed at the base and open at the extremity. If anyone can tell us why this should be so please do.>> <<>> Rectangle: TYPE = RECORD [ base: Vector, size: Size]; < empty rectangle. All empty rectangles are legal>> emptyRectangle: Rectangle = [[infinity/2, infinity/2], emptySize]; fullRectangle: Rectangle = [[-infinity/2, -infinity/2], [infinity, infinity]]; RectangleProc: TYPE = PROC [rect: Rectangle] RETURNS [quit: BOOL _ FALSE]; <> <<>> Orientation: TYPE = MACHINE DEPENDENT {identity(0), mirrorX(1), rotate90(2), rotate90X(3), rotate180(4), rotate180X(5), rotate270(6), rotate270X(7)}; <> <<[Reflection in x means: modify x coordinates, leave y coordinates]>> Transformation: TYPE = RECORD [translation: Vector _ zeroVector, orientation: Orientation _ identity]; <> <> VectorToRope: PROC [v: Vector] RETURNS [Pipal.ROPE]; RectangleToRope: PROC [r: Rectangle] RETURNS [Pipal.ROPE]; OrientationToRope: PROC [o: Orientation] RETURNS [Pipal.ROPE]; TransformationToRope: PROC [t: Transformation] RETURNS [Pipal.ROPE]; <> <> Add: PROC [v1, v2: Vector] RETURNS [Vector]; <> Sub: PROC [v1, v2: Vector] RETURNS [Vector]; <> Min: PROC [v1, v2: Vector] RETURNS [Vector]; Max: PROC [v1, v2: Vector] RETURNS [Vector]; Neg: PROC [v: Vector] RETURNS [Vector]; <> <> IsDegeneratedSize: PROC [s: Size] RETURNS [BOOL]; <> IsEmptySize: PROC [s: Size] RETURNS [BOOL]; <> <> IntersectionIntervals: PROC [i1, i2: Interval] RETURNS [Interval]; UnionIntervals: PROC [i1, i2: Interval] RETURNS [Interval]; DoIntervalsIntersect: PROC [i1, i2: Interval] RETURNS [BOOL]; IsInsideInterval: PROC [container, candidate: Interval] RETURNS [BOOL]; <> IsInsideIntervalNumber: PROC [container: Interval, candidate: Number] RETURNS [BOOL]; <> <> <> <> Translate: PROC [r: Rectangle, v: Vector] RETURNS [Rectangle]; Extend: PROC [r: Rectangle, n: Number] RETURNS [Rectangle]; IntersectBox: PROC [r1, r2: Rectangle] RETURNS [Rectangle]; <> BoundingBox: PROC [r1, r2: Rectangle] RETURNS [Rectangle]; <> BoundingRectangle: PROC [p1, p2: Position] RETURNS [Rectangle]; <> <> IsDegeneratedRectangle: PROC [r: Rectangle] RETURNS [BOOL]; IsEmptyRectangle: PROC [r: Rectangle] RETURNS [BOOL]; DoRectanglesIntersect: PROC [r1, r2: Rectangle] RETURNS [BOOL]; <> IsInsideRectangle: PROC [container, candidate: Rectangle] RETURNS [BOOL]; IsInsidePoint: PROC [container: Rectangle, candidate: Position] RETURNS [BOOL]; <> AlwaysQuit: RectangleProc; Extremity: PROC [r: Rectangle] RETURNS [Position]; DecomposeRect: PROC [r, clip: Rectangle, inside, outside: RectangleProc _ NIL] RETURNS [quit: BOOL _ FALSE]; <> <> <> Center: PROC [r: Rectangle] RETURNS [Position]; <> <> <> TransformVector: PROC [t: Transformation, v: Vector] RETURNS [Vector]; TransformBBox: PROC [t: Transformation, s: Size] RETURNS [Rectangle]; <> TransformRectangle: PROC [t: Transformation, r: Rectangle] RETURNS [Rectangle]; <> Compose: PROC [t1, t2: Transformation] RETURNS [Transformation]; <> <> <> enumerateMethod: Pipal.Method; EachChildProc: TYPE = PROC [transformation: Transformation, child: Pipal.Object] RETURNS [quit: BOOL _ FALSE]; EnumerateProc: TYPE = PROC [object: Pipal.Object, each: EachChildProc, transformation: Transformation _ []] RETURNS [quit: BOOL _ FALSE]; <> <> HasEnumerate: PROC [object: Pipal.Object] RETURNS [BOOL]; Enumerate: EnumerateProc; <> < crash and burn.>> <> NthChild: PROC [object: Pipal.Object, transformation: Transformation _ [], rank: NAT _ 0] RETURNS [nthTrans: Transformation, nthChild: Pipal.Object _ NIL]; <> CountChildren: PROC [object: Pipal.Object] RETURNS [count: NAT]; <> <> sizeMethod: Pipal.Method; bboxMethod: Pipal.Method; SizeProc: TYPE = PROC [object: Pipal.Object] RETURNS [size: Size]; BBoxProc: TYPE = PROC [object: Pipal.Object, transformation: Transformation] RETURNS [bbox: Rectangle]; ObjectSize: SizeProc; <> <> <> < crash and burn.>> < emptySize>> BBox: BBoxProc; <> CachedSizeFromEnumerate: SizeProc; <> CachedBBoxFromEnumerate: BBoxProc; <> <> abutBoxMethod: Pipal.Method; AbutBoxProc: TYPE = PROC [object: Pipal.Object] RETURNS [abutBox: Rectangle]; AbutBox: AbutBoxProc; <> <> <> < crash and burn.>> < emptyRectangle>> AbutBoxFromSize: AbutBoxProc; <> << For use by atomic classes which do not fiddle the abutBox.>> CachedAbutBoxFromEnumerate: AbutBoxProc; <> <> <> transformClass: Pipal.Class; Transform: TYPE = REF TransformRec; TransformRec: TYPE = RECORD [ transformation: Transformation, child: Pipal.Object]; CreateTransform: PROC [transformation: Transformation, child: Pipal.Object] RETURNS [transform: Transform]; <> translationClass: Pipal.Class; Translation: TYPE = REF TranslationRec; TranslationRec: TYPE = RECORD [ vector: Vector, child: Pipal.Object]; CreateTranslation: PROC [vector: Vector, child: Pipal.Object] RETURNS [translation: Translation]; <> orientClass: Pipal.Class; Orient: TYPE = REF OrientRec; OrientRec: TYPE = RECORD [ orientation: Orientation, child: Pipal.Object]; CreateOrient: PROC [orientation: Orientation, child: Pipal.Object] RETURNS [orient: Orient]; <> TransformObject: PROC [transformation: Transformation, child: Pipal.Object] RETURNS [Pipal.Object]; <> <> <<>> <> <> <> <<>> abutBoxProp: ATOM; CreateAbutBoxAnnotation: PROC [child: Pipal.Object, rectangle: Rectangle] RETURNS [annotation: Pipal.Annotation]; <> abutClass: Pipal.Class; Abut: TYPE = REF AbutRec; AbutRec: TYPE = RECORD [ inX: BOOL, children: SEQUENCE size: NAT OF Pipal.Object ]; <> <<>> CreateAbut: PROC [inX: BOOL, children: Pipal.Objects] RETURNS [abut: Abut]; <> <> <<>> <> HashByEnumeration: Pipal.HashProc; <> <<>> CachedHashByEnumeration: Pipal.HashProc; <> <<>> HashObjectSize: Pipal.HashProc; HashVector: PROC [vector: Vector] RETURNS [hash: CARD]; HashRectangle: PROC [rectangle: Rectangle] RETURNS [hash: CARD]; HashTransformation: PROC [transformation: Transformation] RETURNS [hash: CARD]; EqualByEnumeration: Pipal.EqualProc; <> <<>> AtEdge: PROC [abutBox: Rectangle, trans: Transformation, object: Pipal.Object] RETURNS [BOOL]; <> <<>> END. <<>>