DIRECTORY InternalExpr USING [EXPR], Imager USING [Context, Color]; BoxTree: CEDAR DEFINITIONS ~ BEGIN BOXTREE: TYPE ~ REF BoxTreeRep; BoxTreeRep: TYPE ; -- use implementation type STYLE: TYPE ~ RECORD [ scale: REAL _ 1.0, -- scaling factor for bounding box looks: REF ANY _ NIL -- italics, bold... ]; Selection: TYPE ~ RECORD[expr: InternalExpr.EXPR, color: Imager.Color]; Format: PUBLIC PROC [expr: InternalExpr.EXPR, style: STYLE] RETURNS [boxTree: BOXTREE]; Paint: PUBLIC PROC [boxTree: BOXTREE, context: Imager.Context, selections: LIST OF Selection]; Selectable: PROC[expr: InternalExpr.EXPR] RETURNS[BOOL]; SelectableParent: PROC[expr: InternalExpr.EXPR] RETURNS[InternalExpr.EXPR]; SelectableChild: PROC[expr: InternalExpr.EXPR] RETURNS[InternalExpr.EXPR]; SelectableSibling: PROC[expr: InternalExpr.EXPR] RETURNS[InternalExpr.EXPR]; Replace: PROC[expr, old, new: InternalExpr.EXPR] RETURNS[InternalExpr.EXPR]; unable: ERROR[reason: ATOM]; noSelection: ERROR; END. dBoxTree.mesa Definitions for Displaying Mathematical Expressions 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 ΚZ˜Jšœ ™ J˜JšΠac3™3Icode™šΟk ˜ Jšœ žœžœ˜Jšœžœ˜—K˜KšΟnœžœž ˜šœž˜K˜šŸ™K™KšΠkrΟr ‘ ‘ ˜Kš‘  ‘Πcr˜-K˜š ‘ ‘˜ š ‘˜Kš‘ ‘ ’#˜7Kš‘ ‘ ‘ ‘’˜)Kš‘˜——K˜Kš‘  ‘ ‘ ‘˜GK™—šŸ™K˜šŸœžœžœžœ žœžœ žœ˜WKšœ2™2K˜—š Ÿœžœžœ žœ'žœžœ ˜^Kšœ>™>K˜K˜——šŸ™K™šŸ œžœžœžœ˜8Kšœ-™-—K™šŸœžœžœ˜KKšœ;™;Kšœ<™™>—K™šŸœžœ$žœ˜LKšœJ™JK™=Kšœ-™-—K˜—šŸ™K™Kšœžœ žœ˜Kšœ žœ˜K˜——K˜šžœ˜Kšœ˜——…—β