DIRECTORY ImagerFont USING [Extents], MathTypes USING [FormatClass], Vector USING [VEC]; MathBox: CEDAR DEFINITIONS ~ BEGIN VEC: TYPE ~ Vector.VEC; FmtClass: TYPE ~ MathTypes.FormatClass; 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, formatClass: FmtClass, type: BoxType, extents: ImagerFont.Extents _ [0.0, 0.0, 0.0, 0.0], offset: VEC _ [0.0, 0.0], subscriptHint, superscriptHint: BOX _ NIL] RETURNS[BOX]; ChangeOffset: PROC[box: BOX, newOffset: VEC] RETURNS[BOX]; ChangeExtents: PROC[box: BOX, newExtents: ImagerFont.Extents] RETURNS[BOX]; ChangeType: PROC[box: BOX, newType: BoxType] RETURNS[BOX]; ChangeFormatClass: PROC[box: BOX, newFormatClass: FmtClass] RETURNS[BOX]; ChangeSubHint: PROC[box: BOX, subscriptHint: BOX] RETURNS[BOX]; ChangeSuperHint: PUBLIC PROC[box: BOX, superscriptHint: BOX] 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]; FormatClass: PROC[b: BOX] RETURNS[FmtClass]; 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]; SubscriptHint: PROC[b: BOX] RETURNS[BOX]; SuperscriptHint: PROC[b: BOX] RETURNS[BOX]; 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 24, 1986 6:25:15 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. effects: Returns a new BOX which is box with type newType. effects: Returns a new BOX which is box with format class newFormatClass. effects: Returns a new BOX which is box with subscript hint subscriptHint. effects: Returns a new BOX which is box with superscript hint superscriptHint. 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 format class associated 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. effects: Returns box within b to subscript instead of b. Returns NIL if no hint exists. effects: Returns box within b to superscript instead of b. Returns NIL if no hint exists. 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˜J˜šΟnœœ œ˜J˜Jš˜J˜Jšž%™%™Jšœœ œ˜Jšœ œ˜'—J™Jšž™˜Jšœ(™(J™Jšœœœ Οc˜2JšœœŸ˜'J˜Jšœ œ˜%—Icode˜K™Kšž™˜š žœœœœœœ˜)Kšœ1™1K™—š žœœœœœœ˜/Kšœ<™