--File: IPTopOps.mesa
Last Edited by: CSChow, February 1, 1985 11:01:27 am PST
--Intro: This is the top-level interface of all the edit and stack operations on the system.
-- I'll not try to give documentation to individual operation. One way to know
-- the effect of the operations is to use them and look at the source codes (and good luck.)
--General Comment: If you want to be able to use undo and redo facility,
-- keepTrack must be set to TRUE, and if at any point in the sequence of operations, one of
-- the operation is called (by the user) without keepTrack = TRUE, then the stacks should
-- be reset since any previous information is no longer consistent.
-- SO IF YOU ARE A CLIENT (NOT AN IMPLEMENTOR) YOU ALMOST ALWAYS
-- USE keepTrack: TRUE.
-- The chkArgs BOOL is a new design idea, it allows supression of argument checkings
-- (for building new edit operations.)
--Impl: This interface is exported by:
-- (i) IPTopEditOpsImpl,
-- (ii) IPTopStackOpsImpl, and
-- (iii) IPTopEditOpsExtraImpl
DIRECTORY
Rope,
RefStack,
IP,
IPCoTab USING[Component, CornerTypes],
IPCTG USING[Channel, Side, ChType],
IPTop USING [Ref],
IPTopOpRecs;
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: BOOLFALSE] RETURNS [fr: TOR.FRBreakCross, ir: TOR.IRFormCross];
FormCross: PROC[top: IPTop.Ref, ch1, ch2: IPCTG.Channel, keepTrack: BOOLFALSE] RETURNS [fr: TOR.FRFormCross, ir: TOR.IRBreakCross];
BreakCrosses: PROC[top: IPTop.Ref, refCh, chBnd1, chBnd2: IPCTG.Channel, keepTrack: BOOLFALSE] RETURNS [fr, ir: TOR.RComposite];
FormZ: PROC[top: IPTop.Ref, comp1, comp2: IPCoTab.Component, zType: IPCTG.Side, keepTrack: BOOLFALSE] RETURNS [fr: TOR.FRFormZ, ir: TOR.IRRemoveZ];
RemoveZ: PROC[top: IPTop.Ref, zSpine: IPCTG.Channel, keepTrack: BOOLFALSE] RETURNS [fr: TOR.FRRemoveZ, ir: TOR.IRFormZ];
LtoT: PROC[top: IPTop.Ref, ch: IPCTG.Channel, whichEnd: IPCTG.Side, keepTrack: BOOLFALSE] RETURNS [fr: TOR.FRLtoT, ir: TOR.RComposite];
TtoL: PROC [top: IPTop.Ref, co: IPCoTab.Component, ch: IPCTG.Channel, lType: IPCTG.Side, keepTrack: BOOLFALSE] RETURNS [fr: TOR.FRTtoL, ir: TOR.IRLtoT];
FlexKnee: PROC [top: IPTop.Ref, leg, floor: IPCTG.Channel, whichEnd: IPCTG.Side, keepTrack: BOOLFALSE] RETURNS [fr: TOR.FRFlexKnee, ir: TOR.RComposite];
ExtendKnee: PROC [top: IPTop.Ref, shin: IPCTG.Channel, keepTrack: BOOLFALSE] RETURNS [fr: TOR.FRExtendKnee, ir: TOR.IRFlexKnee];
Grow: PROC[top: IPTop.Ref, co: IPCoTab.Component, chToSplit, negBnd, posBnd: IPCTG.Channel, keepTrack: BOOLFALSE] RETURNS [fr, ir: TOR.RComposite];
Grow1: PROC[top: IPTop.Ref, co, host: IPCoTab.Component, hostCorner: IPCoTab.CornerTypes, keepTrack: BOOLFALSE] RETURNS [fr: TOR.FRGrow1, ir: TOR.IRRemoveCoAtCorner];
Shrink: PROC[top: IPTop.Ref, co: IPCoTab.Component, shrinkDirectionHint: IPCTG.ChType, keepTrack: BOOLFALSE] RETURNS [fr, ir: TOR.RComposite];
FlipT: PROC [top: IPTop.Ref, chToBend, attachTo: IPCTG.Channel, whichEnd: IPCTG.Side, keepTrack: BOOLFALSE] RETURNS [fr: TOR.FRFlipT, ir: TOR.RComposite];
ClearNegCorner: PROC[top: IPTop.Ref, co: IPCoTab.Component, corner: IPCoTab.CornerTypes, chToUse: IPCTG.ChType, breakOtherIfX, keepTrack: BOOLFALSE] RETURNS [fr, ir: TOR.RComposite]; --returns NIL if nothing to do--
ClearAllNegCorners: PROC[top: IPTop.Ref, co: IPCoTab.Component, chToUse: IPCTG.ChType, breakOtherIfX, keepTrack: BOOLFALSE] 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: BOOLFALSE] RETURNS [fr, ir: TOR.RAny]; --returns NIL if nothing to do--
ClearAllLCorners: PROC[top: IPTop.Ref, co: IPCoTab.Component, hint: IPCTG.ChType, keepTrack: BOOLFALSE] 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: BOOLFALSE] RETURNS [fr, ir: TOR.RAny]; --returns NIL if nothing to do--
Mirror: PROC[top: IPTop.Ref, co: IPCoTab.Component, mirrorOrientation: IPCTG.ChType, keepTrack: BOOLFALSE] RETURNS [fr, ir: TOR.ROrient];
Rotate: PROC[top: IPTop.Ref, co: IPCoTab.Component, numberOfRot: INT ← 1, keepTrack: BOOLFALSE] RETURNS [fr, ir: TOR.ROrient];
Orient: PROC[top: IPTop.Ref, co: IPCoTab.Component, operation: IP.Orientation, keepTrack: BOOLFALSE] RETURNS [fr, ir: TOR.ROrient];
SetComponent: PROC[top: IPTop.Ref, co: IPCoTab.Component, active: BOOL, atPosition: IP.IntVector, keepTrack: BOOLFALSE] RETURNS [fr, ir: TOR.RSetComponent];
MoveComponent: PROC [top: IPTop.Ref, co: IPCoTab.Component, by: IP.IntVector, keepTrack: BOOLFALSE] RETURNS [fr, ir: TOR.RMoveComponent];
SwapComponents: PROC[top: IPTop.Ref, co1, co2: IPCoTab.Component, keepTrack: BOOLFALSE] 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: BOOLTRUE, 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.