CDParametrizedComands.mesa
by Christian Jacobi October 26, 1983 6:12 pm
last edited Christian Jacobi November 2, 1983 4:48 pm
DIRECTORY
CD,
CDSequencer,
TerminalIO,
Rope,
CDCallSpecific;
CDParametrizedComands: CEDAR PROGRAM
IMPORTS CDSequencer, TerminalIO, CDCallSpecific =
BEGIN
ExpandSelected: PROC [comm: CDSequencer.Command] =
BEGIN
n: NAT;
TerminalIO.WriteRope["Expand selected: "];
n ← CDCallSpecific.CallForSelected[comm.design, $Expand];
TerminalIO.WriteInt[n]; TerminalIO.WriteRope[" objects expanded\n"];
END;
ExpandPointed: PROC [comm: CDSequencer.Command] =
BEGIN
n: NAT;
TerminalIO.WriteRope["Expand pointed: "];
n ← CDCallSpecific.CallForPointed[comm.design, comm.pos, $Expand];
TerminalIO.WriteInt[n]; TerminalIO.WriteRope[" objects expanded\n"];
END;
WidenSelected: PROC [comm: CDSequencer.Command] =
BEGIN
n: NAT;
off: REF CD.DesignPosition←NEW[CD.DesignPosition←[CD.lambda, 0]];
TerminalIO.WriteRope["Widen selected: "];
n ← CDCallSpecific.CallForSelected[design: comm.design, objectSpecific: $Lengthen, x: off];
TerminalIO.WriteInt[n]; TerminalIO.WriteRope[" objects widen\n"];
END;
WidenPointed: PROC [comm: CDSequencer.Command] =
BEGIN
n: NAT;
off: REF CD.DesignPosition←NEW[CD.DesignPosition←[CD.lambda, 0]];
TerminalIO.WriteRope["Widen pointed: "];
n ← CDCallSpecific.CallForPointed[design: comm.design, point: comm.pos, objectSpecific: $Lengthen, x: off];
TerminalIO.WriteInt[n]; TerminalIO.WriteRope[" objects widen\n"];
END;
ShortenSelected: PROC [comm: CDSequencer.Command] =
BEGIN
n: NAT;
off: REF CD.DesignPosition←NEW[CD.DesignPosition←[0, -CD.lambda]];
TerminalIO.WriteRope["Shorten selected: "];
n ← CDCallSpecific.CallForSelected[design: comm.design, objectSpecific: $Lengthen, x: off];
TerminalIO.WriteInt[n]; TerminalIO.WriteRope[" objects shorten\n"];
END;
ShortenPointed: PROC [comm: CDSequencer.Command] =
BEGIN
n: NAT;
off: REF CD.DesignPosition←NEW[CD.DesignPosition←[0, -CD.lambda]];
TerminalIO.WriteRope["Shorten pointed: "];
n ← CDCallSpecific.CallForPointed[design: comm.design, point: comm.pos, objectSpecific: $Lengthen, x: off];
TerminalIO.WriteInt[n]; TerminalIO.WriteRope[" objects shorten\n"];
END;
LengthenSelected: PROC [comm: CDSequencer.Command] =
BEGIN
n: NAT;
off: REF CD.DesignPosition←NEW[CD.DesignPosition←[0, CD.lambda]];
TerminalIO.WriteRope["Lengthen selected: "];
n ← CDCallSpecific.CallForSelected[design: comm.design, objectSpecific: $Lengthen, x: off];
TerminalIO.WriteInt[n]; TerminalIO.WriteRope[" objects lengthen\n"];
END;
LengthenPointed: PROC [comm: CDSequencer.Command] =
BEGIN
n: NAT;
off: REF CD.DesignPosition←NEW[CD.DesignPosition←[0, CD.lambda]];
TerminalIO.WriteRope["Lengthen pointed: "];
n ← CDCallSpecific.CallForPointed[design: comm.design, point: comm.pos, objectSpecific: $Lengthen, x: off];
TerminalIO.WriteInt[n]; TerminalIO.WriteRope[" objects lengthen\n"];
END;
NarrowSelected: PROC [comm: CDSequencer.Command] =
BEGIN
n: NAT;
off: REF CD.DesignPosition←NEW[CD.DesignPosition←[-CD.lambda, 0]];
TerminalIO.WriteRope["Narrow selected: "];
n ← CDCallSpecific.CallForSelected[design: comm.design, objectSpecific: $Lengthen, x: off];
TerminalIO.WriteInt[n]; TerminalIO.WriteRope[" objects narrowed\n"];
END;
NarrowPointed: PROC [comm: CDSequencer.Command] =
BEGIN
n: NAT;
off: REF CD.DesignPosition←NEW[CD.DesignPosition←[-CD.lambda, 0]];
TerminalIO.WriteRope["Narrow pointed: "];
n ← CDCallSpecific.CallForPointed[design: comm.design, point: comm.pos, objectSpecific: $Lengthen, x: off];
TerminalIO.WriteInt[n]; TerminalIO.WriteRope[" objects narrowed\n"];
END;
DefaultSelected: PROC [comm: CDSequencer.Command] =
BEGIN
n: NAT;
TerminalIO.WriteRope["Default selected: "];
n ← CDCallSpecific.CallForSelected[comm.design, $Default];
TerminalIO.WriteInt[n]; TerminalIO.WriteRope[" objects defaulted\n"];
END;
DefaultPointed: PROC [comm: CDSequencer.Command] =
BEGIN
n: NAT;
TerminalIO.WriteRope["Default pointed: "];
n ← CDCallSpecific.CallForPointed[comm.design, comm.pos, $Default];
TerminalIO.WriteInt[n]; TerminalIO.WriteRope[" objects defaulted\n"];
END;
IncCountPointed: PROC [comm: CDSequencer.Command] =
BEGIN
n: NAT;
TerminalIO.WriteRope["inc count: "];
n ← CDCallSpecific.CallForPointed[comm.design, comm.pos, $IncCount];
TerminalIO.WriteInt[n]; TerminalIO.WriteRope[" objects incremented count\n"];
END;
DecCountPointed: PROC [comm: CDSequencer.Command] =
BEGIN
n: NAT;
TerminalIO.WriteRope["dec count: "];
n ← CDCallSpecific.CallForPointed[comm.design, comm.pos, $DecCount];
TerminalIO.WriteInt[n]; TerminalIO.WriteRope[" objects decremented count\n"];
END;
IncCountSelected: PROC [comm: CDSequencer.Command] =
BEGIN
n: NAT;
TerminalIO.WriteRope["inc count: "];
n ← CDCallSpecific.CallForSelected[comm.design, $IncCount];
TerminalIO.WriteInt[n]; TerminalIO.WriteRope[" objects incremented count\n"];
END;
DecCountSelected: PROC [comm: CDSequencer.Command] =
BEGIN
n: NAT;
TerminalIO.WriteRope["dec count: "];
n ← CDCallSpecific.CallForSelected[comm.design, $DecCount];
TerminalIO.WriteInt[n]; TerminalIO.WriteRope[" objects decremented count\n"];
END;
SpecifyAlter: PROC [] RETURNS [code: ATOM←NIL, x: REF←NIL] =
BEGIN
step: CD.DesignNumber = CD.lambda;
SELECT TerminalIO.RequestSelection["alter", LIST["dec w", "dec l", "inc w", "inc l", "dec par", "inc par"]] FROM
1 => {code ← $ChangeExt; x ← NEW[CD.DesignPosition←[-step, 0]]};
2 => {code ← $ChangeExt; x ← NEW[CD.DesignPosition←[0, -step]]};
3 => {code ← $ChangeExt; x ← NEW[CD.DesignPosition←[step, 0]]};
4 => {code ← $ChangeExt; x ← NEW[CD.DesignPosition←[0, step]]};
5 => {code ← $ChangeParam; x ← NEW[CD.DesignNumber←-step]};
6 => {code ← $ChangeParam; x ← NEW[CD.DesignNumber←step]};
ENDCASE => {code ← NIL}
END;
AlterPointed: PROC [comm: CDSequencer.Command] =
BEGIN
code: ATOM;
x: REF;
n: CARDINAL;
TerminalIO.WriteRope["alter pointed: "];
[code, x] ← SpecifyAlter[];
n ← CDCallSpecific.CallForPointed[design: comm.design, point: comm.pos, objectSpecific: code, x: x];
TerminalIO.WriteInt[n]; TerminalIO.WriteRope[" objects altered\n"];
END;
AlterSelected: PROC [comm: CDSequencer.Command] =
BEGIN
code: ATOM;
x: REF;
n: CARDINAL;
TerminalIO.WriteRope["alter selected: "];
[code, x] ← SpecifyAlter[];
n ← CDCallSpecific.CallForSelected[design: comm.design, objectSpecific: code, x: x];
TerminalIO.WriteInt[n]; TerminalIO.WriteRope[" objects altered\n"];
END;
Impl: PROC [] =
BEGIN
CDSequencer.ImplementCommand[$AlterP, AlterPointed];
CDSequencer.ImplementCommand[$AlterS, AlterSelected];
CDSequencer.ImplementCommand[$ExpandS, ExpandSelected];
CDSequencer.ImplementCommand[$ExpandP, ExpandPointed];
CDSequencer.ImplementCommand[$WidenS, WidenSelected];
CDSequencer.ImplementCommand[$WidenP, WidenPointed];
CDSequencer.ImplementCommand[$ShortenS, ShortenSelected];
CDSequencer.ImplementCommand[$ShortenP, ShortenPointed];
-- old --CDSequencer.ImplementCommand[$LenthenS, LengthenSelected];
CDSequencer.ImplementCommand[$LengthenS, LengthenSelected];
-- old --CDSequencer.ImplementCommand[$LenthenP, LengthenPointed];
CDSequencer.ImplementCommand[$LengthenP, LengthenPointed];
CDSequencer.ImplementCommand[$NarrowS, NarrowSelected];
CDSequencer.ImplementCommand[$NarrowP, NarrowPointed];
CDSequencer.ImplementCommand[$DefaultS, DefaultSelected];
CDSequencer.ImplementCommand[$DefaultP, DefaultPointed];
CDSequencer.ImplementCommand[$IncCountS, IncCountSelected];
CDSequencer.ImplementCommand[$IncCountP, IncCountPointed];
CDSequencer.ImplementCommand[$DecCountS, DecCountSelected];
CDSequencer.ImplementCommand[$DecCountP, DecCountPointed];
END;
Impl[];
END.