DIRECTORY ImagerFont USING [Extents], Vector USING [VEC]; MathBox: CEDAR DEFINITIONS ~ BEGIN VEC: TYPE ~ Vector.VEC; BOX: TYPE ~ REF BoxRep; -- external abstract type BoxRep: TYPE; -- internal concrete rep BoxType: TYPE ~ {absolute, relative}; Scale: PROC[b: BOX, v: VEC] RETURNS[BOX]; Inside: PROC[b: BOX, x, y: REAL] RETURNS[BOOL]; AlignHorizontal: PROC[box1: ImagerFont.Extents, offset1: REAL, box2: BOX, offset2: REAL] RETURNS[REAL]; AlignVertical: PROC[box1: ImagerFont.Extents, offset1: REAL, box2: BOX, offset2: REAL] RETURNS[REAL]; RelToAbsBox: PROC[relBox, parentBox: BOX] RETURNS[BOX]; MakeBox: PROC[tag: ATOM, aliases: LIST OF ATOM, type: BoxType, extents: ImagerFont.Extents _ [0.0, 0.0, 0.0, 0.0], offset: VEC _ [0.0, 0.0]] RETURNS[BOX]; ChangeOffset: PROC[box: BOX, newOffset: VEC] RETURNS[BOX]; ChangeExtents: PROC[box: BOX, newExtents: ImagerFont.Extents] RETURNS[BOX]; Width: PROC[b: BOX] RETURNS[REAL]; Height: PROC[b: BOX] RETURNS[REAL]; Tag: PROC[b: BOX] RETURNS[ATOM]; Aliases: PROC[b: BOX] RETURNS[LIST OF ATOM]; Extents: PROC[b: BOX] RETURNS[ImagerFont.Extents]; Offset: PROC[b: BOX] RETURNS[VEC]; Origin: PROC[b: BOX] RETURNS[VEC]; Type: PROC[b: BOX] RETURNS[BoxType]; GetBox: PROC[tag: ATOM, boxes: LIST OF BOX, useAliases: BOOL _ TRUE] RETURNS[BOX]; MapBoxList: PROC[boxes: LIST OF BOX, proc: PROC[b: BOX] RETURNS[BOX]] RETURNS[LIST OF BOX]; boxNotFound: ERROR; wrongBoxType: ERROR; END. ΪMathBox.mesa Carl Waldspurger, August 11, 1986 1:32:06 pm PDT Type Abbreviations for Imported Types Type Definitions A BOX is an IMMUTABLE named bounding box Operations on BOX effects: Returns the BOX which is b scaled by v. effects: Returns TRUE if the point [x, y] is enclosed by b. Otherwise returns FALSE. effects: Horizontally aligns box1 with box2 such that the points (offset1 * WIDTH[box1]) and (offset2 * WIDTH[box2]) are aligned. Offsets are measured from the left edge of a box. Returns the x offset for box1. effects: Vertically aligns box1 with box2 s.t. the points (offset1 * HEIGHT[box1]) and (offset2 * HEIGHT[box2]) are aligned. Offsets are measured from the bottom edge of a box. Returns the y offset for box1. requires: relBox is a relative BOX, parentBox is an absolute BOX effects: Converts relBox (relative units) into an absBox (absolute units) by positioning it relative to parentBox Constructors effects: Constructs and returns a new BOX with the specified parameters. effects: Returns a new BOX which is box with offset newOffset. effects: Returns a new BOX which is box with Extents newExtents. Selectors effects: Returns the width of b. effects: Returns the height of b. effects: Returns the tag associated with b. effects: Returns the aliases assocaited with b effects: Returns the extents of b. effects: Returns the offset vector of b. effects: Returns the origin vector [b.Extents.leftExtent, b.Extents.descent] effects: Returns relative if b is in relative units; Else returns absolute. Box List Operations effects: Returns the BOX in boxes associated with tag. If useAliases = TRUE, then checks for BOX in boxes with alias tag. SIGNALS boxNotFound if no association exists. effects: Constructs a new LIST OF BOX by applying proc to each BOX in boxes. Element positions in list are not preserved. Signals & Errors Κ—˜Jšœ ™ Jšœ0™0J˜šΟk ˜ Jšœ œ ˜Jšœœœ˜—J˜J˜šΟnœœ œ˜J˜Jš˜J˜Jšž%™%™Jšœœ œ˜—J™Jšž™˜Jšœ(™(J™Jšœœœ Οc˜2JšœœŸ˜'J˜Jšœ œ˜%—Icode˜K™Kšž™˜š žœœœœœœ˜)Kšœ1™1K™—š žœœœœœœ˜/Kšœ<™