<> <<>> <> <> <> <> <> <> <> DIRECTORY HerculesAlgebra USING [Value, PointPtr, PointList, Frame, Se]; HerculesStorage: DEFINITIONS = BEGIN OPEN Alg: HerculesAlgebra; <<>> <<- - - - POINTS >> PointPtr: TYPE = Alg.PointPtr; PointList: TYPE = Alg.PointList; NewPoint: PROC [x, y: REAL, visible: BOOL _ TRUE] RETURNS [p: PointPtr]; DeletePoint: PROC [p, pAnt: PointPtr, list: PointList] RETURNS [newList: PointList]; -- Deletes the point p from the list. If pAnt is not NIL, it should be the previous point in list. InsertPoint: PROC [p, pAnt: PointPtr, list: PointList] RETURNS [newList: PointList]; -- Inserts the point p into the list, just after pAnt -- (if pAnt=NIL inserts at beginning) GcPoint: PROC[p: PointPtr]; <<- - - - CONSTRAINTS >> ConstrKind: TYPE = {hor, ver, para, perp, cong, at, ccw}; -- kind of constraint ConstrPtr: TYPE = REF ConstrRec; -- to some kind of constraint record ConstrList: TYPE = ConstrPtr; -- linked by link field. ConstrRec: TYPE = RECORD [ link: ConstrPtr, frame: Alg.Frame, -- for relativized constraints constr: SELECT kind: ConstrKind FROM hor => -- Constrains (i,j) to be horizontal [i, j: PointPtr _ NIL], ver => -- Constrains (i,j) to be vertical [i, j: PointPtr _ NIL], para => -- Constrains (i,j), (k,l) to be parallel [i, j, k, l: PointPtr _ NIL], perp => -- Constrains (i,j), (k,l) to be perpendicular (relative to the given frame) [i, j, k, l: PointPtr _ NIL], cong => -- Constrains segments (i,j), (k,l) to be congruent (relative to the given frame) [i, j, k, l: PointPtr _ NIL], at => -- Constrains p to have coordinates (x,y) (relative to the given frame) [p: PointPtr _ NIL, x, y: REAL _ 0], ccw => -- Constrains (i,j,k) to be counterclockwise (rel to frame) [i, j, k: PointPtr _ NIL], ENDCASE]; HorPtr: TYPE = REF hor ConstrRec; VerPtr: TYPE = REF ver ConstrRec; ParaPtr: TYPE = REF para ConstrRec; PerpPtr: TYPE = REF perp ConstrRec; CongPtr: TYPE = REF cong ConstrRec; AtPtr: TYPE = REF at ConstrRec; CcwPtr: TYPE = REF ccw ConstrRec; NewHor: PROC [i,j: PointPtr] RETURNS [cp: HorPtr]; NewVer: PROC [i,j: PointPtr] RETURNS [cp: VerPtr]; NewPara: PROC [i,j,k,l: PointPtr] RETURNS [cp: ParaPtr]; NewPerp: PROC [i,j,k,l: PointPtr, frame: Alg.Frame _ [NIL,NIL, NIL]] RETURNS [cp: PerpPtr]; NewCong: PROC [i,j,k,l: PointPtr, frame: Alg.Frame _ [NIL,NIL, NIL]] RETURNS [cp: CongPtr]; NewAt: PROC [p: PointPtr, x,y: REAL, frame: Alg.Frame _ [NIL,NIL, NIL]] RETURNS [cp: AtPtr]; NewCcw: PROC [i,j,k: PointPtr, frame: Alg.Frame _ [NIL,NIL, NIL]] RETURNS [cp: CcwPtr]; DeleteConstr: PROC [c, cAnt: ConstrPtr, list: ConstrList] RETURNS [newList: ConstrList]; -- Deletes the constraint c from the list. If cAnt is not NIL, it should be the previous constraint in list. InsertConstr: PROC [c, cAnt: ConstrPtr, list: ConstrList] RETURNS [newList: ConstrList]; -- Inserts the constraint c into the list, just after cAnt -- (if cAnt=NIL inserts at beginning) GcConstr: PROC[cp: ConstrPtr]; <<- - - - ACTIONS >> ActionPtr: TYPE = REF ActionRec; -- to some kind of action record ActionList: TYPE = RECORD [first, last: ActionPtr]; -- linked by link field in chronological (painting) order.; ActionRec: TYPE = RECORD [link: ActionPtr, op: Alg.Se, -- operation (usually atom, the function name; may be lambda expr. or FunVal) arg: Alg.Value -- argument (usually list of points) ]; NewAction: PROC [op: Alg.Se, arg: Alg.Value] RETURNS [ap: ActionPtr]; DeleteAction: PROC [a, aAnt: ActionPtr, list: ActionList] RETURNS [newList: ActionList]; -- Deletes the action a from the list. If aAnt is not NIL, it should be the previous action in list. InsertAction: PROC [a, aAnt: ActionPtr, list: ActionList] RETURNS [newList: ActionList]; -- Inserts the action a into the list, just after aAnt -- (if aAnt=NIL inserts at beginning) GcAction: PROC[ap: ActionPtr]; <<- - - - IMAGES >> Image: TYPE = RECORD [points: PointList, constrs: ConstrList, actions: ActionList]; END. <> <<-- Added Tioga formatting>> <<-- Made all actions and predicated into variants of Item>> <<-- Replaced constructionList by the general itemLpad, itemRpad mechanism>> <<-- Added frame field to constraints.>> <<-- Name changes: AdLin--> AddPara, etc.>> <> <<>> <> <<-- Added perp and $= constraints>> <<-- Added relativized constraints>> <> <<>> <> <> <<>> <> <> <<>> <> << -- ItemRec split into ActionRec and ConstrRec -- Moved lists of points, constraints and actions on current (unnamed) image to HerculesTop >> <> <<>> <> <> <<>> <> <> <<>> <> <> <<>> <> <>