File: ReadPCBAndKeep.mesa
Christophe Cuenod February 1, 1988 3:42:58 pm PST
Reads a .pcb file and a Keep file and output the results on the screen
DIRECTORY
Commander USING [CommandProc, Register],
ExpertPCBRead USING [Part, PCBTable, ReadPCBFile],
ExpertKeepRead USING [KeepRefDes, RefDesTable, ReadKeepFile],
IO USING [GetTokenRope, int, card, PutF, RIS, rope, STREAM],
Rope USING [Cat, ROPE],
SymTab USING [EachPairAction, Pairs];
ReadPCBAndKeep: CEDAR PROGRAM
IMPORTS Commander, ExpertKeepRead, ExpertPCBRead, IO, SymTab, Rope =
BEGIN
ROPE: TYPE = Rope.ROPE;
ReadPCBAndKeepProc: Commander.CommandProc = BEGIN
PrintOneLine: SymTab.EachPairAction ~ {
part: ExpertPCBRead.Part ← NARROW[val];
IF ExpertKeepRead.KeepRefDes[keepTable, key] THEN {
IO.PutF[cmd.out, "%g \torient: %g \tx: %g \ty: %g \tLibrary: %g\n", IO.rope[key], IO.int[part.orientation], IO.int[part.x], IO.int[part.y], IO.card[part.libraryEntry]];
};
};
pcbFile, keepFile: ROPE;
pCBTable: ExpertPCBRead.PCBTable;
keepTable: ExpertKeepRead.RefDesTable;
stream: IO.STREAMIO.RIS[cmd.commandLine];
inputName: ROPEIO.GetTokenRope[stream].token;
pcbFile ← Rope.Cat[inputName, ".pcb"];
keepFile ← Rope.Cat[inputName, ".keep"];
IO.PutF[cmd.out, "Reading %g\n", IO.rope[pcbFile]];
pCBTable ← ExpertPCBRead.ReadPCBFile[pcbFile];
IO.PutF[cmd.out, "Reading %g\n", IO.rope[keepFile]];
keepTable ← ExpertKeepRead.ReadKeepFile[keepFile];
[] ← SymTab.Pairs[pCBTable, PrintOneLine];
END;
Commander.Register[
key: "ReadPCBAndKeep", proc: ReadPCBAndKeepProc, doc: "Test of some Expert.. modules"];
END.