ParseUserCmd:
PUBLIC
PROC [userCmd: IntStorageDefs.UserCmd, cell:
CD.Object, design:
CD.Design, reportError: ReadCifUserCmd.ReportErrorProc] = {
userCmdText: Rope.ROPE ← NARROW[userCmd.data];
text: IO.STREAM ← IO.RIS[userCmdText];
pinName, layer: Rope.ROPE ← NIL;
center: CD.Position ← [0, 0];
pinOb: CD.Object ← NIL;
pinInst: CD.Instance ← NIL;
width, height: CARDINAL;
adjust: INT = 4;
vertAdjust, horizAdjust: INT;
cdLayer: CD.Layer ← CMos.met2;
MyBreakProc:
IO.BreakProc = {
RETURN[
SELECT char
FROM
IN [IO.NUL .. IO.SP], ',, ':, '; => sepr,
'[, '], '(, '), '{, '}, '", '+, '*, '/, '@ => break,
ENDCASE => other]};
FixPinName:
PROC
RETURNS [name: Rope.
ROPE] = {
ros: IO.STREAM ← IO.ROS[];
ris: IO.STREAM ← IO.RIS[pinName];
char: CHARACTER;
IF Rope.Equal[pinName, "VDD", FALSE] THEN RETURN["Vdd"];
IF Rope.Equal[pinName, "GND", FALSE] THEN RETURN["Gnd"];
WHILE
NOT ris.EndOf[]
DO
SELECT char ←
IO.GetChar[ris]
FROM
IN ['a..'z], IN ['A..'Z], IN ['0..'9] => ros.PutChar[char];
ENDCASE => ros.PutChar['X];
ENDLOOP;
RETURN[ros.RopeFromROS];
IF
IO.GetChar[text] # '4
THEN {
reportError[IO.PutFR["UserCmd %g not defined", IO.int[userCmd.command]], Warning];
RETURN};
pinName ← IO.GetTokenRope[text, MyBreakProc].token;
center.x ← IO.GetInt[text];
center.y ← IO.GetInt[text];
layer ← IO.GetID[text];
SELECT
TRUE
FROM
Rope.Equal[layer, "C62"] => {
width ← height ← 8;
cdLayer ← CMos.met2;
horizAdjust ← -width/2;
vertAdjust ← IF center.y < 0 THEN adjust ELSE -(adjust+height)};
Rope.Equal[layer, "C61"] => {
width ← 4; height ← 20;
cdLayer ← CMos.met;
horizAdjust ← IF center.x < 0 THEN adjust ELSE - (adjust+width);
vertAdjust ← -height/2};
ENDCASE => RETURN;
pinName ← FixPinName[];
pinOb ← CDSymbolicObjects.CreatePin[[width, height]];
pinInst ← CDCells.IncludeOb[
design: IF cell = NIL THEN design ELSE NIL,
cell: cell,
ob: pinOb,
position: [center.x/ReadCif.cifUnitsPerLambda+horizAdjust,
center.y/ReadCif.cifUnitsPerLambda+vertAdjust],
orientation: 0,
cellCSystem: originCoords,
obCSystem: interrestCoords,
mode: dontPropagate].newInst;
CDSymbolicObjects.SetName[pinInst, pinName];
CDSymbolicObjects.SetLayer[pinInst, cdLayer];
};