<> <> <<>> <> DIRECTORY Commander USING [CommandProc, Register], ExpertLibRead USING [LibEntry, LibTable, ReadLibFile], IO USING [card, GetCard, GetTokenRope, int, PutF, RIS, rope, STREAM], Rope USING [ROPE], IntHashTable USING [EachPairAction, Pairs]; ExpertFindPadStack: CEDAR PROGRAM IMPORTS Commander, ExpertLibRead, IO, IntHashTable = BEGIN ROPE: TYPE = Rope.ROPE; ExpertFindPadStackProc: Commander.CommandProc = BEGIN PrintGivenPadStack: IntHashTable.EachPairAction ~ { libEntry: ExpertLibRead.LibEntry _ NARROW[value]; FOR i : NAT IN [0..libEntry.size) DO IF libEntry[i].padStack = padStack THEN { IO.PutF[cmd.out, "Part: %g\tPin %g \tPadStack %g", IO.card[key], IO.int[i+1], IO.int[libEntry[i].padStack]]; IO.PutF[cmd.out, "\t%g\t%g\n", IO.rope[libEntry.partName], IO.rope[libEntry.partNumber]]; }; ENDLOOP; }; padStack: CARD; libTable: ExpertLibRead.LibTable; stream: IO.STREAM _ IO.RIS[cmd.commandLine]; inputName: ROPE _ IO.GetTokenRope[stream].token; padStack _ IO.GetCard[stream]; IO.PutF[cmd.out, "Reading %g\n", IO.rope[inputName]]; libTable _ ExpertLibRead.ReadLibFile[inputName]; [] _ IntHashTable.Pairs[libTable, PrintGivenPadStack]; END; Commander.Register[ key: "ExpertFindPadStack", proc: ExpertFindPadStackProc, doc: "Read an Expert .lib file and lists all the part pins with a given PadStack"]; END.