SELECT command
FROM
$Undo =>{noOfSteps:
NAT ← TerminalIO.RequestInt["Number of Steps to Undo: "];
TerminalIO.PutRope[Rope.Cat["Undoing ", Convert.RopeFromInt[noOfSteps], " steps..."]];
WHILE noOfSteps # 0
DO
prevTrack ← CONS[IPTopOps.Undo1[top], prevTrack];
noOfSteps ← noOfSteps.PRED;
ENDLOOP;
reGeom ← TRUE};
$Un1 =>{
TerminalIO.PutRope["Undo previous step..."];
prevTrack ← CONS[IPTopOps.Undo1[top], prevTrack];
reGeom ← TRUE};
$ToSoln =>{
IF trialSolns =
NIL
THEN {TerminalIO.PutRope["No Solutions .. doing nothing"]; RETURN}
ELSE {
solnNum:
INT ← TerminalIO.RequestInt[Rope.Cat[
"Select a solution in [1..",
Convert.RopeFromInt[OrderedRefArray.Size[trialSolns]],
"]: "]];
value: INT;
soln: REF;
TerminalIO.PutRope["GettingSolution... this solution has value"];
[soln, value] ← OrderedRefArray.Fetch[trialSolns, solnNum];
prevTrack ← IPTopOps.Undo[top, IPTopOps.StackSize[top]];
IPTopOps.Redo[top, NARROW[soln]];
TerminalIO.PutF1["%g", IO.int[value]];};
reGeom ← TRUE};
$Redo =>{which:
NAT ← TerminalIO.RequestSelection["OneOf: ",
LIST["Previous Track", "Go to the track kept"]];
TerminalIO.PutRope["Redoing.."];
SELECT which
FROM
1 => {
oldPrevTrack: LIST OF REF ← prevTrack;
IF prevTrack =
NIL
THEN {TerminalIO.PutRope["previous track empty...Done"]; RETURN}
ELSE {prevTrack ← IPTopOps.Undo[top, IPTopOps.StackSize[top]];
IPTopOps.Redo[top, oldPrevTrack]};
};
2 => {
prevTrack ← IPTopOps.Undo[top, IPTopOps.StackSize[top]];
IPTopOps.Redo[top, trackKept];};
ENDCASE => TerminalIO.PutRope["..Nothing to do"];
reGeom ← TRUE};
$Re1 =>{
TerminalIO.PutRope["Redoing ..."];
IF prevTrack =
NIL
THEN {TerminalIO.PutRope["nothing...Done"]; RETURN}
ELSE {TerminalIO.PutRope["1 step.."]; IPTopOps.Redo1[top, prevTrack.first];};
prevTrack ← prevTrack.rest;
reGeom ← TRUE};
$KepTrk =>{
TerminalIO.PutRope["KeepingTrack.."];
trackKept ← IPTopOps.GetTrack[top];
refreshFlag ← FALSE;};
$ClrStks => {
TerminalIO.PutRope["Clear undo and redo stacks.."];
prevTrack ← IPTopOps.GetTrack[top];
trackKept ← NIL; --What was there is now meaningless--
IPTopOps.ResetStacks[top];
refreshFlag ← FALSE;
};
$StkSz =>{
TerminalIO.PutRope[Rope.Cat["The Stacks size is: ", Convert.RopeFromInt[IPTopOps.StackSize[top]], "\n"]];
refreshFlag ← FALSE;};
ENDCASE => ERROR;