Index: trunk/util/boxsym-rnd/generator.awk =================================================================== --- trunk/util/boxsym-rnd/generator.awk (revision 2859) +++ trunk/util/boxsym-rnd/generator.awk (revision 2860) @@ -66,16 +66,8 @@ # draw pins of a given slot:loc, with first pin touching the box at x0;y0 # px and py are x and y dir for the pin line, stx and sty are stepping to # the next coord. State is stored in ST -function draw_pins(slot, ALIGN, loc, x0, y0, stx, sty ,ST,n,v,i,siden) +function draw_pins_(slot, ALIGN, loc, stx, sty, ST, currslot ,n,v,i,siden) { - if (slot == "") { # all slots - for(n = 0; n < nslots; n++) - draw_pins(SLOTS[n], ALIGN, loc, x0, y0, stx, sty, ST) - } - - ST["x"] = x0 + ALIGN[loc, "x0"] - ST["y"] = y0 + ALIGN[loc, "y0"] - ST["pdir"] = loc siden = 0 for(n = 0; n < SLOT[slot, "npins"]; n++) { @@ -83,16 +75,16 @@ if (PIN[pin, "loc"] == loc) { if (ALIGN["cfg", "expand_slot"]) { v = split(PIN[pin, "num"], A, "[:]") - for(i = 1; i <= v; i++) { - draw_pin(pin, ST, i, A) + i = currslot + if (i > v) continue + draw_pin(pin, ST, i, A) + ST["x"] += stx + ST["y"] += sty + if ((ALIGN["midgap", loc] != "") && (siden == ALIGN["midgap", loc])) { ST["x"] += stx ST["y"] += sty - if ((ALIGN["midgap", loc] != "") && (siden == ALIGN["midgap", loc])) { - ST["x"] += stx - ST["y"] += sty - } - siden++ } + siden++ } else { draw_pin(pin, ST, "", A) @@ -106,8 +98,31 @@ } } } + return siden } +function draw_pins(slot, ALIGN, loc, x0, y0, stx, sty, ST,n,currslot) +{ + if (slot == "") { # all slots + for(n = 0; n < nslots; n++) + draw_pins(SLOTS[n], ALIGN, loc, x0, y0, stx, sty, ST) + } + + ST["x"] = x0 + ALIGN[loc, "x0"] + ST["y"] = y0 + ALIGN[loc, "y0"] + + if (ALIGN["cfg", "expand_slot"]) { +# generate pins in a per slot fashion until slots run out (or at most 256 of them to avoid infinite loop) + for(currslot = 1; currslot <= 256; currslot++) { + if (draw_pins_(slot, ALIGN, loc, stx, sty, ST, currslot) == 0) + break + } + } + else + draw_pins_(slot, ALIGN, loc, stx, sty, ST, "") +} + + function draw_all_pin(sn, ALIGN, bw, bh) { bw = ALIGN["box","width"]