ReadLib.mesa
Christophe Cuenod April 1, 1989 4:42:40 pm PST
Reads a .lib file and output the results on the screen for test
DIRECTORY
Commander USING [CommandProc, Register],
ExpertLibRead USING [LibTable, PinNumber, ReadLibFile, RelativePinPosition],
IO USING [GetTokenRope, card, int, PutF, RIS, rope, STREAM],
Rope USING [ROPE],
IntHashTable USING [EachPairAction, Pairs];
ReadLib: CEDAR PROGRAM
IMPORTS Commander, ExpertLibRead, IO, IntHashTable =
BEGIN
ROPE: TYPE = Rope.ROPE;
ReadLibProc: Commander.CommandProc = BEGIN
PrintOneLine: IntHashTable.EachPairAction ~ {
IF ExpertLibRead.PinNumber[libTable, key] >1 THEN {
IO.PutF[cmd.out, "LibEntry: %g\tpin1: %g %g\tpin2: %g\t%g\n", IO.card[key],
IO.int[ExpertLibRead.RelativePinPosition[libTable, key, 1].x],
IO.int[ExpertLibRead.RelativePinPosition[libTable, key, 1].y],
IO.int[ExpertLibRead.RelativePinPosition[libTable, key, 2].x],
IO.int[ExpertLibRead.RelativePinPosition[libTable, key, 2].y]];
}
ELSE {
IO.PutF[cmd.out, "LibEntry: %g\tpin1: %g %g\n", IO.card[key],
IO.int[ExpertLibRead.RelativePinPosition[libTable, key, 1].x],
IO.int[ExpertLibRead.RelativePinPosition[libTable, key, 1].y]];
};
};
libTable: ExpertLibRead.LibTable;
stream: IO.STREAMIO.RIS[cmd.commandLine];
inputName: ROPEIO.GetTokenRope[stream].token;
IO.PutF[cmd.out, "Reading %g\n", IO.rope[inputName]];
libTable ← ExpertLibRead.ReadLibFile[inputName];
[] ← IntHashTable.Pairs[libTable, PrintOneLine];
END;
Commander.Register[
key: "ReadLib", proc: ReadLibProc, doc: "Read an Expert .lib file"];
END.