DIRECTORY MathExpr USING [EXPR, AtomEXPR, CompoundEXPR, AtomClass, CompoundClass, MatrixClass], MathBox USING [BOX], MathTypes USING [Style], MathRules USING [Size], Rope USING [ROPE], Imager USING [Context, Color]; MathDisplayExpr: CEDAR DEFINITIONS ~ BEGIN ROPE: TYPE ~ Rope.ROPE; EXPR: TYPE ~ MathExpr.EXPR; AtomEXPR: TYPE ~ MathExpr.AtomEXPR; CompoundEXPR: TYPE ~ MathExpr.CompoundEXPR; BOX: TYPE ~ MathBox.BOX; Style: TYPE ~ MathTypes.Style; Size: TYPE ~ MathRules.Size; AtomClass: TYPE ~ MathExpr.AtomClass; CompoundClass: TYPE ~ MathExpr.CompoundClass; MatrixClass: TYPE ~ MathExpr.MatrixClass; DisplayExpr: TYPE ~ REF DisplayExprRep; -- external abstract type DisplayExprRep: TYPE; -- internal concrete rep Selection: TYPE ~ RECORD[expr: DisplayExpr, color: Imager.Color]; MakeAtomicDisplayExpr: PROC[tag: ATOM, class: AtomClass, value: ROPE, relBox, absBox: BOX, parent: DisplayExpr _ NIL] RETURNS[DisplayExpr]; MakeCompoundDisplayExpr: PROC[tag: ATOM, class: CompoundClass, subExprs: LIST OF DisplayExpr, relBox, absBox: BOX, parent: DisplayExpr _ NIL] RETURNS[DisplayExpr]; MakeMatrixDisplayExpr: PROC[tag: ATOM, class: MatrixClass, nRows, nCols: INT, elements: LIST OF DisplayExpr, relBox, absBox: BOX, openSym, closeSym, space: DisplayExpr, parent: DisplayExpr _ NIL] RETURNS[DisplayExpr]; ASRopeFromDisplayExpr: PROC[expr: DisplayExpr] RETURNS[ROPE]; DisplayExprFromExpr: PROC[expr: EXPR] RETURNS[DisplayExpr]; ExprFromDisplayExpr: PROC[expr: DisplayExpr] RETURNS[EXPR]; Copy: PROC[expr: DisplayExpr] RETURNS[DisplayExpr]; Tag: PROC[expr: DisplayExpr] RETURNS[ATOM]; Class: PROC[expr: DisplayExpr] RETURNS[ATOM]; GetSubExprs: PROC[expr: DisplayExpr] RETURNS[LIST OF DisplayExpr]; GetDisplayExpr: PROC[tag: ATOM, exprs: LIST OF DisplayExpr] RETURNS[DisplayExpr]; Format: PROC[expr: DisplayExpr, size: Size] RETURNS[BOX]; Paint: PROC[expr: DisplayExpr, context: Imager.Context, absBox: BOX, selections: LIST OF Selection]; DisplayExprFromCoords: PROC[expr: DisplayExpr, x, y: REAL] RETURNS[DisplayExpr]; Selectable: PROC[expr: DisplayExpr] RETURNS[BOOL]; SelectableParent: PROC[expr: DisplayExpr] RETURNS[DisplayExpr]; SelectableChild: PROC[expr: DisplayExpr] RETURNS[DisplayExpr]; SelectableSibling: PROC[expr: DisplayExpr] RETURNS[DisplayExpr]; Replace: PROC[expr, old, new: DisplayExpr] RETURNS[DisplayExpr]; ReplacePair: TYPE ~ RECORD[old, new: DisplayExpr]; ReplaceN: PROC[expr: DisplayExpr, replacements: LIST OF ReplacePair] RETURNS[DisplayExpr]; unable: ERROR[reason: ATOM]; noSelection: ERROR; END. jMathDisplayExpr.mesa Carl Waldspurger, August 23, 1986 2:35:40 pm PDT Definitions for Mathematics Display Expressions Type Abbreviations from Imported Interfaces Display Expression Type Definitions A DisplayExpr is a MUTABLE math expression which is mapped to a viewer. Selection Type Definitions Display Expression Constructors effects: Constructs and returns a new atomic display expression. effects: Constructs and returns a new compound display expression. effects: Constructs and returns a new matrix display expression. Parse/UnParse Routines effects: Returns a ROPE in Dennis Arnon's AlgebraStructures form from expr. effects: Constructs and returns a new display expression from expr. All Display formatting information is set to default values. effects: Constructs and returns a new EXPR from expr. effects: Returns a distinct copy of expr. Selectors effects: Returns tag associated with expr. effects: Returns class of expr. effects: Returns subexpressions for expr. Returns NIL if no subexpressions exist. List Operations effects: Returns the DisplayExpr in exprs associated with tag. SIGNALS exprNotFound if no association exists. Format and Paint modifies: expr effects: expr is updated into a "paintable" form. Returns a bounding box for expr. SIGNALS unable[reason: ATOM] if Formatting can not be completed. modifies: expr effects: Displays expr in context, bounded by absBox. Updates absolute bounding boxes (viewer coords). SIGNALS unable[reason: ATOM] if Painting cannot be completed. Selection Operations effects: Returns the subexpression associated with coordinates [x, y] in expression expr. SIGNALS noSelection if no association exists. effects: Returns TRUE iff expr is selectable. effects: Returns the parent (enclosing expression) of expr. SIGNALS noSelection if no selectable parent exists. effects: Returns a child expressions (subexpression) for expr. SIGNALS noSelection if no selectable child exists. effects: Returns the "next" sibling expression from expr. SIGNALS noSelection if no selectable sibling exists. effects: Returns a copy of display expression expr with new substituted for old. caveats: Return value must be reformatted before Paint[]'ing. Note that new is used (not a copy). effects: Returns a copy of display expression expr with new substitured for old for each pair in replacements. caveats: Return value must be reformatted before Paint[]'ing. Note that the "new" components of replace pairs are used (not copies). Signals & Errors Κ&˜Jšœ™Jšœ0™0J˜JšΟn/™/J˜šΟk ˜ Jšœ žœžœA˜UJšœžœžœ˜Jšœ žœ ˜Jšœ žœ˜Jšœžœžœ˜Jšœžœ˜—J˜šœžœž œ˜$J˜Jšž˜J˜—headš+™+Jšžœžœžœ˜Jšžœžœ žœ˜Jšœ žœ˜#Jšœžœ˜+Jšžœžœ žœ˜Jšœžœ˜Jšœžœ˜J˜Jšœ žœ˜%Jšœžœ˜-Jšœ žœ˜)J˜—š#™#JšœG™GIcode˜Lšœ žœžœΟc˜BLšœžœŸ˜/—š™Lšœ žœžœ)˜A—š™šœžœžœžœžœžœžœ˜ŒLšœA™AL˜—šœžœžœ"žœžœžœžœžœ˜£LšœC™CL™—šœžœžœ$žœ žœžœžœ?žœžœ˜ΪLšœA™AL™——š™šœžœžœžœ˜=LšœL™LL™—šœžœžœžœ˜;LšœD™D—™IL™—šœžœžœžœ˜;Lšœ6™6L˜—šœžœžœ˜3Lšœ*™*—L™—š ™ šœžœžœžœ˜+Lšœ+™+L™—šœžœžœžœ˜-Lšœ ™ L™—š  œžœžœžœžœ˜BLšœ*™*Lšœ1™1——š™š œžœžœ žœžœžœ˜QLšœ>™>Lšœ7™7L˜——š™šœžœ žœžœ˜9Lšœ™Lšœ3™3Lšœ*™*LšœJ™J—š œžœ5žœžœžœ ˜eLšœ™Lšœ6™6Lšœ:™:LšœG™GL™——š™šœžœžœžœ˜PLšœ\™\L™7L™—š œžœžœžœ˜2Lšœ-™-L™—šœžœžœ˜?Lšœ;™;Lšœ<™Lšœ?™?Lšœ<™™>L™—šœžœžœ˜@LšœR™RL™=Lšœ-™-L™—Lšœ žœžœ˜2š œžœ"žœžœžœ˜ZLšœ9™9LšœA™AL™=LšœP™P——š™Lšœžœ žœ˜šœ žœ˜L˜——šžœ˜L˜˜L˜J˜J˜———…— π€