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 Constr: TYPE = REF ConstrRec; -- to some kind of constraint record ConstrKind: TYPE = {hor, ver, para, perp, cong, at, ccw}; -- kind of constraint ConstrList: TYPE = RECORD [first, last: Constr]; ConstrRec: TYPE = RECORD [link: Constr, frame: Frame _ [NIL, NIL, NIL], -- reference frame constr: SELECT kind: ConstrKind FROM hor => -- Constrains (i,j) to be horizontal [i, j: Point _ NIL], ver => -- Constrains (i,j) to be vertical [i, j: Point _ NIL], para => -- Constrains (i,j), (k,l) to be parallel [i, j, k, l: Point _ NIL], perp => -- Constrains (i,j), (k,l) to be perpendicular (relative to the given frame) [i, j, k, l: Point _ NIL], cong => -- Constrains segments (i,j), (k,l) to be congruent (relative to the given frame) [i, j, k, l: Point _ NIL], at => -- Constrains p to have coordinates (x,y) (relative to the given frame) [p: Point _ NIL, coords: Coords _ [0, 0]], ccw => -- Constrains (i,j,k) to be counterclockwise (rel to frame) [i, j, k: Point _ NIL], ENDCASE]; HorConstr: TYPE = REF hor ConstrRec; VerConstr: TYPE = REF ver ConstrRec; ParaConstr: TYPE = REF para ConstrRec; PerpConstr: TYPE = REF perp ConstrRec; CongConstr: TYPE = REF cong ConstrRec; AtConstr: TYPE = REF at ConstrRec; CcwConstr: TYPE = REF ccw ConstrRec; NewHor: PROC [i,j: Point] RETURNS [cp: HorConstr]; NewVer: PROC [i,j: Point] RETURNS [cp: VerConstr]; NewPara: PROC [i,j,k,l: Point] RETURNS [cp: ParaConstr]; NewPerp: PROC [i,j,k,l: Point] RETURNS [cp: PerpConstr]; NewCong: PROC [i,j,k,l: Point] RETURNS [cp: CongConstr]; NewAt: PROC [p: Point, coords: Coords] RETURNS [cp: AtConstr]; NewCcw: PROC [i,j,k: Point] RETURNS [cp: CcwConstr]; DeleteConstr: PROC [c, ant: Constr, list: ConstrList] RETURNS [newList: ConstrList]; InsertConstr: PROC [c, ant: Constr, list: ConstrList] RETURNS [newList: ConstrList]; GcConstrs: PROC[start: Constr, lim: Constr _ NIL]; Action: TYPE = REF ActionRec; -- to some kind of action record ActionList: TYPE = RECORD [first, last: Action]; ActionKind: TYPE = {draw, print, call, font, size, face, justify}; ActionArgs: TYPE = LIST OF REF ANY; -- arguments of actions: ActionRec: TYPE = RECORD [link: Action, kind: ActionKind, -- type of action args: ActionArgs -- arguments of action ]; NewAction: PROC [kind: ActionKind, args: ActionArgs] RETURNS [ap: Action]; DeleteAction: PROC [a, ant: Action, list: ActionList] RETURNS [newList: ActionList]; InsertAction: PROC [a, ant: Action, list: ActionList] RETURNS [newList: ActionList]; GcActions: PROC[start: Action, lim: Action _ 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. HasDef: PUBLIC PROC [name: REF ANY, defList: LIST OF REF ANY] RETURNS [BOOL]; constructionList: PUBLIC LIST OF ApplyRecord; AddX: PUBLIC PROC [f: REF ANY, args:LIST OF PointPtr]; -- adds (f, args) to constructionList, which is a list of ApplyRecords ApplyRecord: TYPE = RECORD [f: REF ANY, args: LIST OF PointPtr]; Basis: TYPE = REF BasisRec; BasisRec: TYPE = RECORD[head:TangentVector _ NIL, tail:Basis]; TangentVector: TYPE = REF TvRec; TvRec: TYPE = RECORD[head:PointPtr _ NIL, x, y: REAL _ 0, tail:TangentVector]; PushState: PUBLIC PROCEDURE; PopState: PUBLIC PROCEDURE; NewPoint: PROCEDURE RETURNS [r: PointPtr]; GcPoint: PROCEDURE[p:PointPtr]; NewEdge: PROCEDURE RETURNS [r: EdgePtr]; GcEdge: PROCEDURE[p:EdgePtr]; NewArc: PROCEDURE RETURNS [r: ArcPtr]; GcArc: PROCEDURE[p:ArcPtr]; NewLine: PROCEDURE RETURNS [r: LinPtr]; GcLine: PROCEDURE[p:LinPtr]; NewString: PROCEDURE RETURNS [r: StringPtr]; GcString: PROCEDURE[p: StringPtr]; NewCong: PROCEDURE RETURNS [r: CongPtr]; GcCong: PROCEDURE[p:CongPtr]; NewHor: PROCEDURE RETURNS [r: HorPtr]; GcHor: PROCEDURE[p:HorPtr]; NewVer: PROCEDURE RETURNS [r: VerPtr]; GcVer: PROCEDURE[p:VerPtr]; NewCC: PROC RETURNS [r: CCPtr]; GcCC: PROC[p: CCPtr]; NewBasis: PROC RETURNS [Basis]; GcBasis: PROC[Basis]; NewTv: PROC RETURNS [TangentVector]; GcTv: PROC[TangentVector]; AddHor: PROC[a,b:PointPtr]; AddVer: PROC[a,b:PointPtr]; AddCong: PROC[a,b,c,d:PointPtr]; AddLin: PROC[a,b,c,d:PointPtr]; AddPoint: PROC [x,y:REAL] RETURNS [PointPtr]; FindPoint: PROC [x,y:REAL] RETURNS [PointPtr]; AddEdge: PROC[a,b:PointPtr]; AddArc: PROC[a,b,c,d:PointPtr]; AddString: PROC [c,d: PointPtr, h, w, dep : REAL, stringText: Rope.ROPE, stringFont: Graphics.FontRef, fontName: Rope.ROPE, fontSize: INT, bold, italic: BOOL]; AddCC: PROC [a, b, c: PointPtr]; InitJunoStorage: PROC; ResetJunoStorage: PROC; -- reclaims all records. pointLpad, pointRpad: PointPtr; -- The lists of points, edges, arcs edgeLpad, edgeRpad: EdgePtr; -- line constraints, and cong. constraints arcLpad, arcRpad: ArcPtr; -- are padded on both sides. lineLpad, lineRpad: LinPtr; congLpad, congRpad: CongPtr; stringLpad, stringRpad: StringPtr; horLpad, horRpad: HorPtr; verLpad, verRpad: VerPtr; ccLpad, ccRpad: CCPtr; ú JunoStorage.mesa Coded June 81 by Greg Nelson. Last edited by GNelson(?) September 14, 1982 4:38 pm Last edited by Stolfi June 4, 1984 3:04:44 pm 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 would 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 - - - - CONSTRAINTS Connected by link field; last.link always NIL. Both NIL if list is empty. The following procedures create new constraint records of specific types (they allocate from pool if available): Deletes the constraint c from the list. The parameter ant is optional; if not NIL, it must be that ant.link = c. Inserts the constraint c into the list, just after ant (if ant=NIL inserts at beginning) Returns to the pool all constraint records from start (incl.) to lim (excl). - - - - ACTIONS Connected by link field; last.link always NIL. Both NIL if list is empty. 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) justify: [justification: ATOM] (one of $left, $center, $right) Creates a new action record (allocates from pool if available). Deletes the action a from the list. The parameter ant is optional; if not NIL, it must be that ant.link = a. Inserts the action a into the list, just after ant (if ant=NIL inserts at beginning) Returns to the pool all action records from start (incl.) to lim (excl). Also collects the top-level cells in the args list of each action. - - - - 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). Edited by Stolfi, March 7, 1984 3:06:21 am PST Tioga formatting Edited by Stolfi, April 11, 1984 9:09:52 pm PST Cleaned out PointRec, made constraints and actions into variant records - - - - JUNK Êܘ™™J™J™4J™3—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šžœœœ Ÿ$˜CJšœ œ'œŸ˜Pšœ œœ˜1JšŸJ™J—šœ œ˜Jš-œ#œœœŸœ œœŸ%œœŸ#œœœŸ+œœŸMœœŸRœœŸHœœ1Ÿ<œœœ˜å—Jšœ œœ˜%Jšœ œœ˜%Jšœ œœ˜'Jšœ œœ˜'Jšœ œœ˜'Jšœ œœ˜#Jšœ œœ˜%JšŸq™qJš œœœ˜3Jš œœ œ˜3Jš œœœ˜9Jš œœœ˜9Jš œœœ˜9Jšœ œœœ˜?Jš œœœ˜5šž œœ$œ˜UJšŸp™p—š  œœ$œ˜VJšŸX™X—š  œœœ˜3JšŸL™L——™Jšžœœœ Ÿ ˜?šœž œœœ˜1JšŸJ™J—Jšœ œ2˜Cš œ œœœœœŸ˜=Jšœ Ïr œ¡œ ¡œ ¡$œ(¡ œ ¡œ ¡ œ:¡œ!™Ð—šœ œ˜Jšœ#ŸœŸœ˜a—J˜š  œœ&œ˜KJšœ?™?—š  œœ$œ˜UJšœl™l—š  œœ$œ˜UJšœT™T—šœ  œœœ˜3JšŸH™HJ™B——™Jš œžœœœœœœ˜š œ œœ œœœ˜>Jšœ<™<—šœ œœœ˜,JšœU™U——šœœ˜™/J™—™0J™I——™ Jšœ œœœœœ œœœœœœ˜NJšœœœœ ˜.Jšœ œœœœœœœŸG˜‚Jš œœœœœœœ ˜AJšœœœ ˜Jšœ œœœ˜?Jšœœœ˜!Jš œœœœœ˜OJšœ  œœ œ˜Jšœ œœ œ˜Jšœ œ œœ˜+Jšœ œ œ ˜ Jšœ œ œœ˜)Jšœ œ œ ˜Jšœ œ œœ ˜'Jšœ œ œ ˜Jšœ œ œœ œ œ   œ œœ˜uJšœ œ œ˜#Jšœ œ œœ˜)Jšœ œ œ ˜Jšœ œ œœ ˜'Jšœ œ œ ˜Jšœ œ œœ ˜'Jšœ œ œ ˜Jš œ œœœ œœ ˜7Jšœ œœœ ˜ Jšœ œœ˜Jšœ œœœ˜%Jšœ œœ˜Jšœ œœ˜Jšœ œœ˜Jšœ œœ˜!Jšœ œœ˜ Jš œ œœœœ ˜.Jš œ  œœœœ ˜/Jšœ œœ˜Jšœ œœ˜ Jšœ  œœœ*œFœ œœ˜ÎJšœ œœ˜!Jšœ œœ˜Jšœ œœŸ˜1Jšœ!Ÿ$œŸ+œŸœ¦˜ë——…—B0