File: ConnJ3.mesa
Christophe Cuenod January 15, 1988 5:08:36 pm PST
DIRECTORY
Commander USING [CommandProc, Register],
Convert USING [RopeFromInt],
Rope USING [ROPE, Equal],
FS USING [StreamOpen],
IO USING [ int, PutF, rope, Close, STREAM, PutRope, GetTokenRope, CharClass, BreakProc];
ConnJ3: CEDAR PROGRAM
IMPORTS IO, Commander, Convert, Rope, FS =
BEGIN
ROPE: TYPE = Rope.ROPE;
inputname: ROPE ← "ConnJ3.tioga";
outputName: ROPE ← "ConnJ3.part";
TokenBreak: IO.BreakProc ~ {
IF char = ' OR char = '\t OR char = '\n THEN RETURN [sepr];
RETURN [other];
};
ConnJ3Proc: Commander.CommandProc = BEGIN
i: CARD;
site: INT;
number, token: ROPE;
in: IO.STREAMFS.StreamOpen[inputname];
out: IO.STREAMFS.StreamOpen[outputName,$create];
IO.PutF[out, "4096 2048 -300 -375 200 5775 -100 -400 CON165 JCC-CON J\n"];
token ← NIL;
site ← 1;
FOR i IN [1..165] DO
number ← Convert.RopeFromInt[i];
WHILE NOT Rope.Equal[token, number] DO
token ← IO.GetTokenRope[in, TokenBreak].token;
ENDLOOP;
token ← IO.GetTokenRope[in, TokenBreak].token;
IO.PutF[out, "%g %g %g ", IO.int[-100*((i-1) MOD 3)], IO.int[100*((i-1)/3)], IO.rope[token]];
IF Rope.Equal[token, "GND"] THEN {
IO.PutF[out, "1 19 256 5 "];
}
ELSE IF Rope.Equal[token, "VCC"] THEN {
IO.PutF[out, "1 19 256 4 "];
}
ELSE {
IO.PutF[out, "255 19 %g 0 ", IO.int[site]];
site ← site + 1;
};
IF i = 1 THEN IO.PutF[out, "4\n"]
ELSE IO.PutF[out, "3\n"];
ENDLOOP;
IO.PutF[out, "-100 -275 HOLE120 255 120 %g 0 76\n", IO.int[site]];
site ← site + 1;
IO.PutF[out, "-100 5675 HOLE120 255 120 %g 0 76\n", IO.int[site]];
IO.Close[out];
cmd.out.PutRope["File ConnJ3.part Written\n"]
END;
Commander.Register[
key: "ConnJ3", proc: ConnJ3Proc, doc: "Generates a ConnJ3.part file from the ConnJ3.tioga file\n"];
END.