<< JunoStorage.mesa>> << >> <> <> <> << Definitions of record types for (image points and expanded constraints/actions) used by JunoTop (via JunoImage, JunoAlgebra, and JunoOldSolver). Also allocation and deallocation procedures.>> << This module is logically superfluous. A cleaner idea woud be to keep only the x,y and solver stuff in the point records, and not have constraints and action records at all. The points of the current image chould be kept in an a-list, with the frozen and winding number stuff kept separately; the actions and constraints shuld be kept as symbolic expressions (see JunoAlgebra). However, that would require too much allocation.deallocation/narrowing, and might slow down Juno significantly. >> <<>> DIRECTORY Imager USING [Pair]; JunoStorage: DEFINITIONS = BEGIN << - - - - COORDINATES >> Coords: TYPE = Imager.Pair; -- RECORD[x, y: REAL] <> IntCoords: TYPE = RECORD [x, y: INTEGER]; <> << - - - - POINTS >> Point: TYPE = REF PointRec; PointList: TYPE = RECORD [first, last: REF PointRec]; <> PointRec: TYPE = RECORD [coords: Coords _ [0, 0], -- coordinates of point. frozen: BOOL _ FALSE, -- p was frozen by user. visible: BOOL _ FALSE, -- false for control points of strings link: Point, -- next point in list -- Input/output data for JunoImage, JunoOldSolver and JunoBody: wn: INTEGER _ 0, -- winding number (#0 for blue-selected points) copy: Point _ NIL, -- copy of point, or target in point identification. name: ATOM _ NIL, -- used when building procedures fixed: BOOL _ FALSE, -- TRUE = don't solve for/don't locally declare this point. -- Temporary mark used internally in JunoImage, JunoBody, JunoOldSolver: mark: BOOL _ FALSE, -- general-purpose mark bit -- Temporary data used only by JunoOldSolver: xCol, yCol: INTEGER _ 0, -- columns corresp. to each coordinate in tableau old: Coords _ [0, 0] -- round values of x, y in previous iteration. ]; NewPoint: PROC [coords: Coords, visible: BOOL _ FALSE] RETURNS [p: Point]; <> <> DeletePoint: PROC [p, ant: Point, list: PointList] RETURNS [newList: PointList]; <> InsertPoint: PROC [p, ant: Point, list: PointList] RETURNS [newList: PointList]; <> GcPoints: PROC[start: Point, lim: Point _ NIL]; <> << - - - - REFERENCE FRAMES>> Frame: TYPE = RECORD [org, hor, ver: Point]; -- reference frame for constraints & c nullFrame: Frame = [NIL, NIL, NIL]; -- null reference frame << - - - - ITEMS (CONSTRAINTS AND ACTIONS)>> Item: TYPE = REF ItemRec; -- to a constraint or action record ItemKind: TYPE = {hor, ver, para, perp, cong, at, ccw, -- constraints draw, print, call, -- proper actions font, size, face, justified, paint, width}; -- state-pushing actions ConstrKind: TYPE = ItemKind[hor..ccw]; ActionKind: TYPE = ItemKind[draw..width]; ProperActionKind: TYPE = ItemKind[draw..call]; StatePushingActionKind: TYPE = ItemKind[font..width]; ItemList: TYPE = RECORD [first, last: Item]; <> ItemRec: TYPE = RECORD [link: Item, kind: ItemKind, frame: Frame _ [NIL, NIL, NIL], -- reference frame for constraints (and actions?) args: ItemArgs -- action and constraint arguments ]; ItemArgs: TYPE = LIST OF REF ANY; -- arguments of constraints and actions: << hor: [i, j: Point] -- (i,j) horizontal ver: [i, j: Point] -- (i,j) vertical para: [i, j, k, l: Point] -- (i,j) parallel to (k,l) perp: [i, j, k, l: Point] -- (i,j) perpendicular to (k,l) cong: [i, j, k, l: Point] -- (i,j) congruent to (k,l) at: [p: Point, x, y: REF REAL] -- p at (x,y) (relative to the given frame) ccw: [i, j, k: Point] -- (i,j,k) to be counterclockwise (rel to frame)>> << draw: [p, q: Point] or [p, r, s, q: Point] print: [p: Point, rope: ROPE] call: [func: ATOM, p1, p2, ..., pn: Point] (where func is function name)>> << font: [font: ROPE] size: [size: REF INT] face: [face: ATOM] (one of $regular, $bold, $italic, $boldItalic) paint: [color: ATOM] (one of $black, $white, $gray, $red, $orange, etc.) width: [width: REF REAL] justified: [justification: ATOM] (one of $left, $center, $right)>> NewItem: PROC [kind: ItemKind, args: ItemArgs, frame: Frame _ nullFrame] RETURNS [item: Item]; <> DeleteItem: PROC [item, ant: Item, list: ItemList] RETURNS [newList: ItemList]; <> InsertItem: PROC [item, ant: Item, list: ItemList] RETURNS [newList: ItemList]; <> GcItems: PROC[start: Item, lim: Item _ NIL]; <> <> << - - - - LISTS>> List: TYPE = LIST OF REF ANY; Cons: PROC [first: REF ANY, rest: List] RETURNS [cons: List]; <> GcList: PROC[start: List, lim: List _ NIL]; <> END.