DIRECTORY Imager USING [Pair]; JunoStorage: DEFINITIONS = BEGIN Coords: TYPE = Imager.Pair; -- RECORD[x, y: REAL] IntCoords: TYPE = RECORD [x, y: INTEGER]; 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]; Frame: TYPE = RECORD [org, hor, ver: Point]; -- reference frame for constraints & c nullFrame: Frame = [NIL, NIL, NIL]; -- null reference frame 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: 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]; List: TYPE = LIST OF REF ANY; Cons: PROC [first: REF ANY, rest: List] RETURNS [cons: List]; GcList: PROC[start: List, lim: List _ NIL]; END. z JunoStorage.mesa Coded June 81 by Greg Nelson. Last edited by GNelson(?) September 14, 1982 4:38 pm Last edited by Stolfi June 13, 1984 9:51:09 am PDT 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. - - - - COORDINATES Coordinates of a point in the Juno system (big points from lower left corner of picture) Coordinates of a point in the Juno system (big points from lower left corner of picture), rounded to nearest integer for efficiency reasons. (Are they worthwhile?) - - - - POINTS Connected by link field; last.link always NIL. Both NIL if list is empty. Creates a new point record (allocates from pool if available). Sets the visible flag as specified, but does not paint p on the screen. Deletes the point p from the list. The parameter ant is optional; if not NIL, it must be that ant.link = p. Inserts the point p into the list, just after ant (if ant=NIL inserts at beginning) Returns to the pool all point records from start (incl.) to lim (excl). - - - - REFERENCE FRAMES - - - - ITEMS (CONSTRAINTS AND ACTIONS) Connected by link field; last.link always NIL. Both NIL if list is empty. 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) Creates a new item record (allocates from pool if available). Deletes the item from the list. The parameter ant is optional; if not NIL, it must be that ant.link = item. Inserts the item into the list, just after ant (if ant=NIL inserts at beginning) Returns to the pool all item records from start (incl.) to lim (excl). Also collects the top-level cells in the args list of each item. - - - - LISTS Same as built-in CONS, but allocates from pool if available. Returns to the pool all top-level cells in the list, from start (incl) to lim (excl). ÊA˜™™J™J™4J™4—J™¾Jšœð™ðJ™šœÏk ˜ Jšœœ˜——JšœÏb œ œ˜Jšœ˜™šœžœœÏc˜2JšœX™X—š œž œœœœ˜*Jšœ£™£——šœ™Jšœžœœœ ˜šœ œœœ ˜6JšŸJ™J—šœ œ˜Jš9œŸœ œœŸœ œœŸ'œŸœŸ@œœŸœŸ0œœŸ5œœœŸ!œ œœŸ<œŸIœœœŸœŸ.œœŸ3œŸ/œ˜ƒ—š œÏnœœœœœ ˜KšŸ>™>J™G——šœž œœ"œ˜QJšŸk™k—šœž œœ"œ˜RJšŸS™S—šœ œœœ˜0JšŸG™G——™JšœžœœœŸ&˜TJš œž œ œœœŸ˜<—™(Jšžœœœ Ÿ#˜>šœ œ˜Jš œ'ŸœŸœ)œŸ˜¢—Jš œ œ#œ,œ1œ˜¶šœ œœ˜-JšŸJ™J—šœ œ˜Jš œ3œœœŸ3œŸ#œ˜®—š œ œœœœœŸ(˜KJšœÏr œ Ÿœ¡ œ ŸœŸ¡Ÿœ¡Ÿ#œ¡œŸœ¡œŸ,œ¡œ¡œŸ0™®Jš œ ¡ œ¡œ ¡Ðkr¡œ ¡¢¡œ™žJšœ ¡¢¡œ ¡¢¡¢¡œ ¡¢¡œ<¡¢¡œ?¡¢¡¢¡œ ¡¢¡œ!™¦—šžœœ?œ˜bJšœ<Ÿ™=—šž œœ#œ˜PJšŸk™k—š  œœ#œ˜QJšŸP™P—š œœœ˜-JšŸF™FJ™@——™Jš œžœœœœœœ˜š œ œœ œœœ˜>Jšœ<™<—šœ œœœ˜,JšœU™U——Jšœœ˜—…— úµ