DIRECTORY MathBox USING [BOX], MathTypes USING [Style], 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; AtomBoxProc: TYPE ~ PROC[value: ROPE, style: Style] RETURNS[ImagerFont.Extents]; AtomPaintProc: TYPE ~ PROC[value: ROPE, 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]; AtomToASRopeProc: TYPE ~ PROC[value: ROPE] 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) ]; TaggedOffset: TYPE ~ RECORD [ tag: ATOM, offset: Offset ]; 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: TaggedOffset] 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 30, 1986 4:31:48 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 atom value 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š œ œœœœ˜P—˜Kšœ"™"Kš œœœœ1œ˜\K˜KšœH™HK™!Kšœœœœœœœœœœ˜FK˜Kšœ?™?Kšœœœœœœœœœœœ˜KK˜Kšœ™Kš œœœœœœ˜9K˜—K˜Kšž™˜Kšœ™šœ œ˜šœ˜KšœœÏc˜&KšœŸ˜,KšœŸ˜)K˜K˜——šœ œ˜šœ˜KšœœŸ˜&KšœŸ'˜9KšœŸ'˜7K˜K˜——šœœ˜šœ˜Kšœ9Ÿ˜RKšœœŸ2˜CK˜K˜——šœœ˜šœ˜Kšœœ˜ K˜K˜K˜—K˜——K˜Kšž™˜š žœœ2œœœ˜kKšœE™EKšœ$™$K˜—š ž œœ2œœœ˜iKšœC™CKšœ$™$K˜—K˜—Kšž™˜šžœœœœœœœ.œœœœœ˜}KšœE™EKšœ>™>—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šœ˜——…— €