IPTopOps:
CEDAR
DEFINITIONS
IMPORTS RefStack= BEGIN OPEN TOR: IPTopOpRecs;
InvalidArgs: ERROR[op: ATOM];
UndoStackEmpty: ERROR;
BreakCross: PROC [top: IPTop.Ref, refCh, chToBreak: IPCTG.Channel, keepTrack: BOOL ← FALSE] RETURNS [fr: TOR.FRBreakCross, ir: TOR.IRFormCross];
FormCross: PROC[top: IPTop.Ref, ch1, ch2: IPCTG.Channel, keepTrack: BOOL ← FALSE] RETURNS [fr: TOR.FRFormCross, ir: TOR.IRBreakCross];
BreakCrosses: PROC[top: IPTop.Ref, refCh, chBnd1, chBnd2: IPCTG.Channel, keepTrack: BOOL ← FALSE] RETURNS [fr, ir: TOR.RComposite];
FormZ: PROC[top: IPTop.Ref, comp1, comp2: IPCoTab.Component, zType: IPCTG.Side, keepTrack: BOOL ← FALSE] RETURNS [fr: TOR.FRFormZ, ir: TOR.IRRemoveZ];
RemoveZ: PROC[top: IPTop.Ref, zSpine: IPCTG.Channel, keepTrack: BOOL ← FALSE] RETURNS [fr: TOR.FRRemoveZ, ir: TOR.IRFormZ];
LtoT: PROC[top: IPTop.Ref, ch: IPCTG.Channel, whichEnd: IPCTG.Side, keepTrack: BOOL ← FALSE] RETURNS [fr: TOR.FRLtoT, ir: TOR.RComposite];
TtoL: PROC [top: IPTop.Ref, co: IPCoTab.Component, ch: IPCTG.Channel, lType: IPCTG.Side, keepTrack: BOOL ← FALSE] RETURNS [fr: TOR.FRTtoL, ir: TOR.IRLtoT];
FlexKnee: PROC [top: IPTop.Ref, leg, floor: IPCTG.Channel, whichEnd: IPCTG.Side, keepTrack: BOOL ← FALSE] RETURNS [fr: TOR.FRFlexKnee, ir: TOR.RComposite];
ExtendKnee: PROC [top: IPTop.Ref, shin: IPCTG.Channel, keepTrack: BOOL ← FALSE] RETURNS [fr: TOR.FRExtendKnee, ir: TOR.IRFlexKnee];
Grow: PROC[top: IPTop.Ref, co: IPCoTab.Component, chToSplit, negBnd, posBnd: IPCTG.Channel, keepTrack: BOOL ← FALSE] RETURNS [fr, ir: TOR.RComposite];
Grow1: PROC[top: IPTop.Ref, co, host: IPCoTab.Component, hostCorner: IPCoTab.CornerTypes, keepTrack: BOOL ← FALSE] RETURNS [fr: TOR.FRGrow1, ir: TOR.IRRemoveCoAtCorner];
Shrink: PROC[top: IPTop.Ref, co: IPCoTab.Component, shrinkDirectionHint: IPCTG.ChType, keepTrack: BOOL ← FALSE] RETURNS [fr, ir: TOR.RComposite];
FlipT: PROC [top: IPTop.Ref, chToBend, attachTo: IPCTG.Channel, whichEnd: IPCTG.Side, keepTrack: BOOL ← FALSE] RETURNS [fr: TOR.FRFlipT, ir: TOR.RComposite];
ClearNegCorner: PROC[top: IPTop.Ref, co: IPCoTab.Component, corner: IPCoTab.CornerTypes, chToUse: IPCTG.ChType, breakOtherIfX, keepTrack: BOOL ← FALSE] RETURNS [fr, ir: TOR.RComposite]; --returns NIL if nothing to do--
ClearAllNegCorners: PROC[top: IPTop.Ref, co: IPCoTab.Component, chToUse: IPCTG.ChType, breakOtherIfX, keepTrack: BOOL ← FALSE] RETURNS [fr, ir: TOR.RComposite]; --returns NIL if nothing to do--
ClearLCorner: PROC[top: IPTop.Ref, co: IPCoTab.Component, corner: IPCoTab.CornerTypes, hint: IPCTG.ChType, keepTrack: BOOL ← FALSE] RETURNS [fr, ir: TOR.RAny]; --returns NIL if nothing to do--
ClearAllLCorners: PROC[top: IPTop.Ref, co: IPCoTab.Component, hint: IPCTG.ChType, keepTrack: BOOL ← FALSE] RETURNS [fr, ir: TOR.RComposite]; --returns NIL if nothing to do--
BreakXAtCorner: PROC [top: IPTop.Ref, co: IPCoTab.Component, corner: IPCoTab.CornerTypes, chToBreak: IPCTG.ChType, keepTrack: BOOL ← FALSE] RETURNS [fr, ir: TOR.RAny]; --returns NIL if nothing to do--
Mirror: PROC[top: IPTop.Ref, co: IPCoTab.Component, mirrorOrientation: IPCTG.ChType, keepTrack: BOOL ← FALSE] RETURNS [fr, ir: TOR.ROrient];
Rotate: PROC[top: IPTop.Ref, co: IPCoTab.Component, numberOfRot: INT ← 1, keepTrack: BOOL ← FALSE] RETURNS [fr, ir: TOR.ROrient];
Orient: PROC[top: IPTop.Ref, co: IPCoTab.Component, operation: IP.Orientation, keepTrack: BOOL ← FALSE] RETURNS [fr, ir: TOR.ROrient];
SetComponent: PROC[top: IPTop.Ref, co: IPCoTab.Component, active: BOOL, atPosition: IP.IntVector, keepTrack: BOOL ← FALSE] RETURNS [fr, ir: TOR.RSetComponent];
MoveComponent: PROC [top: IPTop.Ref, co: IPCoTab.Component, by: IP.IntVector, keepTrack: BOOL ← FALSE] RETURNS [fr, ir: TOR.RMoveComponent];
SwapComponents: PROC[top: IPTop.Ref, co1, co2: IPCoTab.Component, keepTrack: BOOL ← FALSE] RETURNS [fr, ir: TOR.RSwapComponents];
SpawnComps:
PROC[top: IPTop.Ref, comp: IPCoTab.Component, negChildName, posChildName: Rope.
ROPE, negChildShape, posChildShape:
IP.ShapeRep, splitDirection:
IP.OrientationTypes, chkArgs, keepTrack:
BOOL ←
TRUE, negChild, posChild: IPCoTab.Component ←
NIL]
RETURNS [fr:
TOR.FRSpawnComps, ir:
TOR.RComposite];
-- chkArgs = FALSE => no checking on arguments
-- negChild, posChild are for implementors
SetCompShape:
PROC[top: IPTop.Ref, comp: IPCoTab.Component, shape:
IP.ShapeRep, chkArgs, keepTrack:
BOOL ← TRUE]
RETURNS [fr, ir:
TOR.RSetCompShape];
-- chkArgs = FALSE => no checking on arguments
FormZChk: PROC[top: IPTop.Ref, comp1, comp2: IPCoTab.Component, zType: IPCTG.Side] RETURNS [BOOL];
FlipTChk: PROC[top: IPTop.Ref, chToBend, attachTo: IPCTG.Channel, whichEnd: IPCTG.Side] RETURNS [BOOL];
SpawnCompsChk: PUBLIC PROC[top: IPTop.Ref, comp: IPCoTab.Component, negChildName, posChildName: Rope.ROPE, negChildShape, posChildShape: IP.ShapeRep, splitDirection: IP.OrientationTypes] RETURNS [BOOL];
SetCompShapeChk: PUBLIC PROC[comp: IPCoTab.Component, shape: IP.ShapeRep] RETURNS [BOOL];
--Stack related operations:
StackSize: PROC[top: IPTop.Ref] RETURNS [NAT];
ResetStacks: PROC[top: IPTop.Ref];
GetTrack:
PROC[top: IPTop.Ref, after:
NAT ← 0]
RETURNS [
LIST
OF
REF];
--after = 0 <=> Get track from bottomost
Undo: PROC[top: IPTop.Ref, n: NAT] RETURNS [LIST OF REF]; --returns the track to the previous state before undo--
Undo1: PROC[top: IPTop.Ref] RETURNS [REF]; --returns the previous step ie. the step undone--
Redo: PROC[top: IPTop.Ref, track: LIST OF REF]; --Traverse track and keep Track--
Redo1: PROC[top: IPTop.Ref, step: REF]; --Take a step and keepTrack--
PushStacks:
PROC[top: IPTop.Ref, fr, ir:
TOR.RAny] =
INLINE {
RefStack.Push[top.redoStack, fr];
RefStack.Push[top.undoStack, ir]
}; --PushStacks
Cons2: PROC[r1: REF, l1: LIST OF REF, r2: REF, l2: LIST OF REF] RETURNS [result1, result2: LIST OF REF] = INLINE {result1 ← CONS[r1, l1]; result2 ← CONS[r2, l2];}; --Cons2--
END.