CDConditionsCommands.mesa (part of Chipndale)
by Christian Jacobi July 11, 1983 3:42 pm
last edited Christian Jacobi November 2, 1983 4:06 pm
DIRECTORY
CD,
CDConditions,
CDOps,
CDOrient,
CDSequencer,
Rope,
TerminalIO;
CDConditionsCommands: CEDAR PROGRAM
IMPORTS CDConditions, CDSequencer, CDOps, TerminalIO =
BEGIN
ChangeConditionS: PROC [comm: CDSequencer.Command] =
BEGIN
fileName, procedureText: Rope.ROPE;
ob: CD.ObPtr;
first: CD.ApplicationPtr;
multiple: BOOL;
TerminalIO.WriteRope["make object conditional\n"];
[first, multiple] ← CDOps.SelectedApplication[comm.design];
IF first=NIL THEN {TerminalIO.WriteRope[" no selected object\n"]; RETURN};
IF multiple THEN {
TerminalIO.WriteRope[" not done for now\n"]; RETURN;
--[done: multiple, cellOb: ob] ← CDCells.CreateCellSelected[comm.design, "-dummy"];
--IF NOT multiple THEN {TerminalIO.WriteRope["not done\n"]; RETURN};
};
IF ISTYPE[first.ob.specificRef, CDConditions.CondPtr] THEN {
cp: CDConditions.CondPtr ← NARROW[first.ob.specificRef];
ob ← first.ob;
TerminalIO.WriteRope[" current condition is: ["];
TerminalIO.WriteRope[cp.procName];
TerminalIO.WriteRope["] on "];
TerminalIO.WriteRope[cp.fileName];
TerminalIO.WriteRope["\n"];
}
ELSE {
CDOps.RemoveApplication[comm.design, first];
ob ← CDConditions.CreateCondition[design: comm.design, ob: first.ob, condition: NIL, data: NIL];
CDOps.AddAnObject[comm.design, ob, first.location, first.orientation];
TerminalIO.WriteRope[" object made conditional\n"];
};
fileName ← TerminalIO.RequestRope[" filename > "];
procedureText ← TerminalIO.RequestRope[" (module.)procedure > "];
IF CDConditions.ChangeCondition[design: comm.design, ob: ob, procName: procedureText, fileName: fileName, data: NIL] THEN TerminalIO.WriteRope[" done\n"]
ELSE TerminalIO.WriteRope[" not done\n"]
END;
ChangeConditionP: PROC [comm: CDSequencer.Command] =
BEGIN
fileName, procedureText: Rope.ROPE;
ob: CD.ObPtr;
app: CD.ApplicationPtr;
multiple: BOOL;
TerminalIO.WriteRope["make object conditional\n"];
app ← CDOps.PointedApplication[comm.design, comm.pos];
IF app=NIL THEN {TerminalIO.WriteRope[" no selected object\n"]; RETURN};
IF ISTYPE[app.ob.specificRef, CDConditions.CondPtr] THEN {
cp: CDConditions.CondPtr ← NARROW[app.ob.specificRef];
ob ← app.ob;
TerminalIO.WriteRope[" current condition is: ["];
TerminalIO.WriteRope[cp.procName];
TerminalIO.WriteRope["] on "];
TerminalIO.WriteRope[cp.fileName];
TerminalIO.WriteRope["\n"];
}
ELSE {
CDOps.RemoveApplication[comm.design, app];
ob ← CDConditions.CreateCondition[design: comm.design, ob: app.ob, condition: NIL, data: NIL];
CDOps.AddAnObject[comm.design, ob, app.location, app.orientation];
TerminalIO.WriteRope[" object made conditional\n"];
};
fileName ← TerminalIO.RequestRope[" filename > "];
procedureText ← TerminalIO.RequestRope[" (module.)procedure > "];
IF CDConditions.ChangeCondition[design: comm.design, ob: ob, procName: procedureText, fileName: fileName, data: NIL] THEN TerminalIO.WriteRope[" done\n"]
ELSE TerminalIO.WriteRope[" not done\n"]
END;
CheckConditions: PROC [comm: CDSequencer.Command] =
BEGIN
all, done: BOOLFALSE;
TerminalIO.WriteRope["check conditional objects\n"];
IF comm.a=$CheckAllConditions THEN all ← TRUE
ELSE IF comm.a=$CheckUnloadedConditions THEN all ← FALSE
ELSE all ← TerminalIO.RequestSelection[
label: "load conditional code",
choice: LIST["all", "unloaded only"]]=1;
IF all THEN TerminalIO.WriteRope[" reload all conditionals\n"]
ELSE TerminalIO.WriteRope[" load unloaded conditionals\n"];
done ← CDConditions.UpdateConditions[comm.design, all];
IF done THEN {
TerminalIO.WriteRope[" successfull; but:"] ;
TerminalIO.WriteRope[" Warning: Imported designs are not checked; a reloading of conditionals can be forced by re-importing the designs\n"] ;
}
ELSE TerminalIO.WriteRope[" not successfull\n"];
END;
CDSequencer.ImplementCommand[$CheckConditions, CheckConditions];
CDSequencer.ImplementCommand[$CheckUnloadedConditions, CheckConditions];
CDSequencer.ImplementCommand[$CheckAllConditions, CheckConditions];
CDSequencer.ImplementCommand[$DrawConditionS, ChangeConditionS];
CDSequencer.ImplementCommand[$DrawConditionP, ChangeConditionP];
--remove-- CDSequencer.ImplementCommand[$DrawCondition, ChangeConditionS];
END.