CDSilImpl.mesa
by Ch. Jacobi August 11, 1983 3:56 pm
last edited Christian Jacobi December 2, 1983 11:41 am
DIRECTORY
CD,
CDOps,
CDPanel,
CDSil,
CDTechnology,
CDValue,
CDViewer,
Commander USING [CommandProc, Register],
Rope,
TerminalIO,
UserProfile;
CDSilImpl: CEDAR PROGRAM
IMPORTS CD, CDTechnology, CDOps, CDPanel, CDValue, CDViewer, Commander, Rope, TerminalIO, UserProfile
EXPORTS CDSil =
BEGIN
s1: CARDINAL = 1;
s2: CARDINAL = 16;
s3: CARDINAL = 16*16;
s4: CARDINAL = 16*16*16;
ss: CARDINAL = s1+s2+s3+s4;
sf: CARDINAL = s1+s3;
--4bit colors--
green: CARDINAL = 1;
blue: CARDINAL = 2;
red: CARDINAL = 4;
yellow: CARDINAL = 14;
black: CARDINAL = 12;
xred: PUBLIC CD.Level;
xblue: PUBLIC CD.Level;
xyellow: PUBLIC CD.Level;
xgreen: PUBLIC CD.Level;
xblack: PUBLIC CD.Level;
xgrey1: PUBLIC CD.Level;
NewSWorld: Commander.CommandProc =
BEGIN
design: CD.Design ~ CDOps.CreateDesign[cdsil];
[] ← CDViewer.CreateViewer[design];
END;
cdsil: PUBLIC CD.Technology ~ CD.RegisterTechnology[$chipnsil, "chipnsil"];
tipTable: Rope.ROPENIL;
NoteProfileChange: UserProfile.ProfileChangedProc =
-- PROC [reason: ProfileChangeReason]
BEGIN
newTipTable: Rope.ROPE ← UserProfile.Token[
key: "Chipndale.Chipnsil.TIPTable",
default: "Chipndale.TIP"
];
IF ~Rope.Equal[tipTable, newTipTable] THEN {
CDTechnology.SetTipTable[cdsil, newTipTable];
tipTable ← newTipTable
}
END;
Init: PROC [] =
BEGIN
TerminalIO.WriteRope["ChiPencil impl\n"];
xblack ← CD.NewLevel[cdsil, $xblack];
xgrey1 ← CD.NewLevel[cdsil, $xgrey1];
xred ← CD.NewLevel[cdsil, $xred];
xblue ← CD.NewLevel[cdsil, $xblue];
xyellow ← CD.NewLevel[cdsil, $xyellow];
xgreen ← CD.NewLevel[cdsil, $xgreen];
UserProfile.CallWhenProfileChanges[NoteProfileChange];
CDTechnology.TeachColor[xblack, 4,
CDTechnology.Brick[0EH*1111H, 0DH*1111H, 0BH*1111H, 07H*1111H]];
CDTechnology.TeachColor[xblack, 1,
CDTechnology.Brick[0EH*1111H, 0DH*1111H, 0BH*1111H, 07H*1111H]];
CDTechnology.TeachColor[xblack, 8,
CDTechnology.Brick[0EH*1111H, 0DH*1111H, 0BH*1111H, 07H*1111H]];
CDTechnology.TeachColor[xgrey1, 4,
CDTechnology.Brick[05H*1111H, 0AH*1111H, 05H*1111H, 0AH*1111H]];
CDTechnology.TeachColor[xgrey1, 1,
CDTechnology.Brick[05H*1111H, 0AH*1111H, 05H*1111H, 0AH*1111H]];
CDTechnology.TeachColor[xgrey1, 8,
CDTechnology.Brick[05H*1111H, 0AH*1111H, 05H*1111H, 0AH*1111H]];
CDTechnology.TeachColor[xgreen, 4, CDTechnology.Brick4[green]];
CDTechnology.TeachColor[xgreen, 1, [4*ss, ss, 4*ss, ss]];
CDTechnology.TeachColor[xgreen, 8, [1*sf, 1*sf, 1*sf, 1*sf]];
CDTechnology.TeachColor[xred, 4, CDTechnology.Brick4[red]];
CDTechnology.TeachColor[xred, 1, [8*ss, 4*ss, 2*ss, 1*ss]];
CDTechnology.TeachColor[xred, 8, [4*sf, 4*sf, 4*sf, 4*sf]];
CDTechnology.TeachColor[xblue, 4, CDTechnology.Brick4[blue]];
CDTechnology.TeachColor[xblue, 1, [8*ss, 2*ss, 0, 0]];
CDTechnology.TeachColor[xblue, 8, [2*sf, 2*sf, 2*sf, 2*sf]];
CDTechnology.TeachColor[xyellow, 1, [2*ss, 2*ss, 2*ss, 2*ss]];
CDTechnology.TeachColor[xyellow, 4, CDTechnology.Brick4[yellow]];
CDTechnology.TeachColor[xyellow, 8, [14, 14, 14, 14]];
CDPanel.DefineLevelEntry[cdsil, xblack, "black", 0, 2*CD.lambda];
CDPanel.DefineLevelEntry[cdsil, xgrey1, "grey", 0, 2*CD.lambda];
Do not yet support colors
CDPanel.DefineLevelEntry[cdsil, xgreen, "green", 0, 2*CD.lambda];
CDPanel.DefineLevelEntry[cdsil, xred, "red", 0, 2*CD.lambda];
CDPanel.DefineLevelEntry[cdsil, xblue, "blue", 0, 2*CD.lambda];
CDPanel.DefineLevelEntry[cdsil, xyellow, "yellow", 0, 2*CD.lambda];
CDPanel.DefineIntEntry[cdValueKey: $CDxSelectNewMode, tech: cdsil,
text: "select new:", min: 0, max: 1, default: 1];
CDPanel.DefineNewLine[cdsil];
CDPanel.DefineIntEntry[cdValueKey: $CDxStepValue, tech: cdsil, text: "step moves size:", min: 1, default: 4];
CDPanel.DefineIntEntry[cdValueKey: $CDxStretchyMove, tech: cdsil,
text: "stretchy:", min: 0, max: 1, default: 0];
CDPanel.DefineNewLine[cdsil];
CDValue.StoreInt[boundTo: cdsil, key: $CDxInitScale, value: 10];
CDValue.StoreInt[boundTo: cdsil, key: $CDxInitGrid, value: 16];
Commander.Register[
key: "cdnewsil",
proc: NewSWorld,
doc: "Creates new chipndale 'sil' design"
];
END;
Init[]
END.