<> <> <<>> <> 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.STREAM _ IO.RIS[cmd.commandLine]; inputName: ROPE _ IO.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.