DIRECTORY InternalExpr USING [EXPR], Imager USING [Context, Color]; MathDisplay: CEDAR DEFINITIONS ~ BEGIN EXPR: TYPE ~ InternalExpr.EXPR; BOXTREE: TYPE ~ REF BoxTreeRep; BoxTreeRep: TYPE ; -- use implementation type Selection: TYPE ~ RECORD[expr: EXPR, color: Imager.Color]; Format: PUBLIC PROC[expr: EXPR] RETURNS [BOXTREE]; Paint: PUBLIC PROC [box: BOXTREE, context: Imager.Context, selections: LIST OF Selection]; Selectable: PROC[expr: EXPR] RETURNS[BOOL]; SelectableParent: PROC[expr: EXPR] RETURNS[EXPR]; SelectableChild: PROC[expr: EXPR] RETURNS[EXPR]; SelectableSibling: PROC[expr: EXPR] RETURNS[EXPR]; Replace: PROC[expr, old, new: EXPR] RETURNS[EXPR]; unable: ERROR[reason: ATOM]; noSelection: ERROR; END. ’MathDisplay.mesa Mcisaac, July 23, 1987 3:36:04 pm PDT Definitions for Displaying Mathematical Expressions Type Redefinitions Type Definitions Display & Formatting returns a boxed expression formatted in user space paints a boxed expression in the imager space given by context Selection Operations 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 expression expr with new substituted for old. caveats: Return value must be reformatted before Paint[]'ing. Note that new is used (not a copy). Signals & Errors Κ2˜šœ™Icode™%—J˜JšΠac3™3K™šΟk ˜ Jšœ žœžœ˜Jšœžœ˜—K˜KšΟn œžœž ˜šœž˜K™K˜šΟb™K˜Kšžœžœžœ˜—K™šŸ™K™KšΠkrΟr‘’‘’ ˜Kš’ ‘’Πcr˜-K˜Kš’ ‘’‘’œ’˜:K™—šŸ™K˜š Ÿœžœžœ žœžœ˜2Kšœ2™2K˜—š Ÿœžœžœžœ'žœžœ ˜ZKšœ>™>K˜K˜——šŸ™K™šŸ œžœ žœžœ˜+Kšœ-™-—K™šŸœžœ žœ˜1Kšœ;™;Kšœ<™™>—K™šŸœžœžœ˜2KšœJ™JK™=Kšœ-™-—K˜—šŸ™K™Kšœžœ žœ˜Kšœ žœ˜K˜——šžœ˜Kšœ˜——…—ή²