DIRECTORY MathBox USING [BOX], MathTypes USING [Style, AtomValue], Imager USING [Context], ImagerFont USING [Extents], Rope USING [ROPE], Vector USING [VEC]; MathRules: CEDAR DEFINITIONS ~ BEGIN VEC: TYPE ~ Vector.VEC; ROPE: TYPE ~ Rope.ROPE; BOX: TYPE ~ MathBox.BOX; Style: TYPE ~ MathTypes.Style; AtomValue: TYPE ~ MathTypes.AtomValue; AtomBoxProc: TYPE ~ PROC[value: AtomValue, style: Style] RETURNS[ImagerFont.Extents]; AtomPaintProc: TYPE ~ PROC[value: AtomValue, style: Style, context: Imager.Context, absBox: BOX]; CompoundBoxProc: TYPE ~ PROC[boxes: LIST OF BOX] RETURNS[LIST OF BOX]; CompositionProc: TYPE ~ PROC[boxes: LIST OF BOX] RETURNS[BOX, LIST OF BOX]; AtomToRopeProc: TYPE ~ PROC[value: AtomValue] RETURNS[ROPE]; Alignment2D: TYPE ~ RECORD [ tag: ATOM, -- id of box to be aligned hAttach: Alignment, -- horizontal alignment vAttach: Alignment -- vertical alignment ]; Alignment: TYPE ~ RECORD [ tag: ATOM, -- id of box to align with offset1: Offset, -- relative offset of box to be aligned offset2: Offset -- relative offset of box to align with ]; Offset: TYPE ~ RECORD [ wrt: {left, right, top, bottom, center, origin} _ left, -- offset w.r.t. location pos: REAL _ 0.0 -- relative position (deviation from w.r.t. point) ]; AlignHorizontal: PROC[box1: ImagerFont.Extents, offset1: Offset, box2: BOX, offset2: Offset] RETURNS[REAL]; AlignVertical: PROC[box1: ImagerFont.Extents, offset1: Offset, box2: BOX, offset2: Offset] RETURNS[REAL]; Compose: PROC[boxes: LIST OF BOX, alignments: LIST OF Alignment2D, hOrigin, vOrigin: ATOM] RETURNS[BOX, LIST OF BOX]; ComposeMatrix: PROC[nRows, nCols: NAT, boxes: LIST OF BOX, spaceBox, openSymBox, closeSymBox: BOX] RETURNS[BOX, LIST OF BOX, BOX, BOX]; RowColFromAtom: PROC[rc: ATOM] RETURNS[NAT, NAT]; AtomFromRowCol: PROC[row, col: NAT] RETURNS[ATOM]; Size: TYPE ~ {normal, script, scriptscript, big}; ComputeSize: PROC[base, adjustment: Size] RETURNS[Size]; VecFromSize: PROC[size: Size] RETURNS[VEC]; unable: ERROR[reason: ATOM]; badFormat: ERROR; END. ®MathRules.mesa Carl Waldspurger, August 12, 1986 5:02:44 pm PDT Imported Type Abbreviations Rule Procedure Type Definitions Computes bounding box for an atom with specified value & style Paints an Atom onto Imager context Adjusts bounding boxes for arguments & symbols by satisfying constraints Returned Boxes use Relative Units Composes Layout by satisfying spacing and alignment constraints Returns a rope from AtomValue Alignment Type Definitions two-dimensional box alignment Alignment Operations effects: Horizontally aligns box1 with box2 using specified offsets. Returns x offset for box1. effects: Vertically aligns box1 with box2 using specified offsets. Returns y offset for box1. Automated Layout Composition effects: Performs the layout composition for boxes using alignments. Returns information expected from a CompositionProc. effects: Performs the layout composition for a generalized matrix. Returns information expected by Format, preserving input row&col orderings. requires: rc is of the form $r#c# effects: Returns the row and column indexes associated with $r#c# SIGNALS badFormat if rc does not conform to the format $r#c# effects: Returns the atom $r{row}c{col} Size Type Definitions Size Operations effects: Returns the size of adjustment applied to base. effects: Returns scaling vector corresponding to size (e.g. normal = unit vec) Signals & Errors ÊŸ˜Jšœ™Jšœ0™0J˜codešÏk ˜ Kšœœœ˜Kšœ œ˜#Kšœœ ˜Kšœ œ ˜Kšœœœ˜Kšœœœ˜K˜—šÏn œœ œ˜K˜Kš˜K˜Kšž™K™Kšœœ œ˜Kšœœœ˜Kšœœ œ˜Kšœœ˜Kšœ œ˜&K˜K˜Kšž™˜Kšœ>™>Kšœ œœ!œ˜U—˜Kšœ"™"KšœœœBœ˜aK˜KšœH™HK™!Kšœœœœœœœœœœ˜FK˜Kšœ?™?Kšœœœœœœœœœœœ˜KK˜Kšœ™Kš œœœœœ˜™>—K™šž œœœ œœœ%œœœœœœœœ˜‡KšœC™CKšœU™U—K™š žœœœœœœ˜1Kšœ"™"KšœB™BKšœF™F—K™š žœœ œœœ˜2Kšœ(™(K™K™—K™—K™šž™K˜Kšœœ'˜1—K˜šž™K˜šž œœœ˜8Kšœ9™9—K™šž œœ œœ˜+KšœO™OK™——K™šž™K˜Kšœœ œ˜Kšœ œ˜K˜K˜—Kšœ˜——…—S