Index: trunk/src/rats.c =================================================================== --- trunk/src/rats.c (revision 10956) +++ trunk/src/rats.c (revision 10957) @@ -380,7 +380,7 @@ if (!pin->ratconn) { pcb_message(PCB_MSG_WARNING, _("Warning! Net \"%s\" is shorted to %s pin %s\n"), &theNet->Name[2], PCB_UNKNOWN(PCB_ELEM_NAME_REFDES(element)), PCB_UNKNOWN(pin->Number)); - pcb_stub_rat_found_short(pin, NULL, &theNet->Name[2]); + pcb_stub_rat_found_short(pin, &theNet->Name[2]); continue; } newone = pcb_true; @@ -396,7 +396,7 @@ *menu = pin->ratconn; pcb_message(PCB_MSG_WARNING, _("Warning! Net \"%s\" is shorted to net \"%s\"\n"), &theNet->Name[2], &((pcb_lib_menu_t *) (pin->ratconn))->Name[2]); - pcb_stub_rat_found_short(pin, NULL, &theNet->Name[2]); + pcb_stub_rat_found_short(pin, &theNet->Name[2]); } } } @@ -410,7 +410,7 @@ if (!pad->ratconn) { pcb_message(PCB_MSG_WARNING, _("Warning! Net \"%s\" is shorted to %s pad %s\n"), &theNet->Name[2], PCB_UNKNOWN(PCB_ELEM_NAME_REFDES(element)), PCB_UNKNOWN(pad->Number)); - pcb_stub_rat_found_short(NULL, pad, &theNet->Name[2]); + pcb_stub_rat_found_short(pad, &theNet->Name[2]); continue; } newone = pcb_true; @@ -426,7 +426,7 @@ *menu = pad->ratconn; pcb_message(PCB_MSG_WARNING, _("Warning! Net \"%s\" is shorted to net \"%s\"\n"), &theNet->Name[2], &((pcb_lib_menu_t *) (pad->ratconn))->Name[2]); - pcb_stub_rat_found_short(NULL, pad, &theNet->Name[2]); + pcb_stub_rat_found_short(pad, &theNet->Name[2]); } } } Index: trunk/src/stub_mincut.c =================================================================== --- trunk/src/stub_mincut.c (revision 10956) +++ trunk/src/stub_mincut.c (revision 10957) @@ -23,23 +23,19 @@ #include "config.h" #include #include "stub_mincut.h" -#include "obj_pinvia.h" -#include "obj_pad.h" +#include "obj_common.h" static void stub_rat_proc_shorts_dummy(void) { } -static void stub_rat_found_short_dummy(pcb_pin_t * pin, pcb_pad_t * pad, const char *with_net) +static void stub_rat_found_short_dummy(pcb_any_obj_t *term, const char *with_net) { /* original behavior: just warn at random pins/pads */ - if (pin != NULL) - PCB_FLAG_SET(PCB_FLAG_WARN, pin); - if (pad != NULL) - PCB_FLAG_SET(PCB_FLAG_WARN, pad); + PCB_FLAG_SET(PCB_FLAG_WARN, term); stub_rat_proc_shorts_dummy(); } -void (*pcb_stub_rat_found_short)(pcb_pin_t * pin, pcb_pad_t * pad, const char *with_net) = stub_rat_found_short_dummy; +void (*pcb_stub_rat_found_short)(pcb_any_obj_t *term, const char *with_net) = stub_rat_found_short_dummy; void (*pcb_stub_rat_proc_shorts)(void) = stub_rat_proc_shorts_dummy; Index: trunk/src/stub_mincut.h =================================================================== --- trunk/src/stub_mincut.h (revision 10956) +++ trunk/src/stub_mincut.h (revision 10957) @@ -22,6 +22,6 @@ #include "global_typedefs.h" -extern void (*pcb_stub_rat_found_short)(pcb_pin_t * pin, pcb_pad_t * pad, const char *with_net); +extern void (*pcb_stub_rat_found_short)(pcb_any_obj_t *term, const char *with_net); extern void (*pcb_stub_rat_proc_shorts)(void); Index: trunk/src_plugins/mincut/rats_mincut.c =================================================================== --- trunk/src_plugins/mincut/rats_mincut.c (revision 10956) +++ trunk/src_plugins/mincut/rats_mincut.c (revision 10957) @@ -96,7 +96,7 @@ } /* returns 0 on succes */ -static int proc_short(pcb_pin_t * pin, pcb_pad_t * pad, int ignore) +static int proc_short(pcb_any_obj_t *term, int ignore) { pcb_find_callback_t old_cb; pcb_coord_t x, y; @@ -111,29 +111,9 @@ if (!conf_mincut.plugins.mincut.enable) return bad_gr; - /* only one should be set, but one must be set */ - assert((pin != NULL) || (pad != NULL)); - assert((pin == NULL) || (pad == NULL)); + pcb_obj_center(term, &x, &y); + debprintf("short on terminal\n"); - if (pin != NULL) { - debprintf("short on pin!\n"); - PCB_FLAG_SET(PCB_FLAG_WARN, pin); - x = pin->X; - y = pin->Y; - } - else if (pad != NULL) { - debprintf("short on pad!\n"); - PCB_FLAG_SET(PCB_FLAG_WARN, pad); - if (PCB_FLAG_TEST(PCB_FLAG_EDGE2, pad)) { - x = pad->Point2.X; - y = pad->Point2.Y; - } - else { - x = pad->Point1.X; - y = pad->Point1.Y; - } - } - /* run only if net is not ignored */ if (ignore) return 0; @@ -337,8 +317,7 @@ typedef struct pinpad_s pinpad_t; struct pinpad_s { int ignore; /* if 1, changed our mind, do not check */ - pcb_pin_t *pin; - pcb_pad_t *pad; + pcb_any_obj_t *term; const char *with_net; /* the name of the net this pin/pad is in short with */ pinpad_t *next; }; @@ -345,13 +324,11 @@ static pinpad_t *shorts = NULL; -void rat_found_short(pcb_pin_t * pin, pcb_pad_t * pad, const char *with_net) +void rat_found_short(pcb_any_obj_t *term, const char *with_net) { pinpad_t *pp; - pp = malloc(sizeof(pinpad_t)); - pp->ignore = 0; - pp->pin = pin; - pp->pad = pad; + pp = calloc(sizeof(pinpad_t), 1); + pp->term = term; pp->with_net = with_net; pp->next = shorts; shorts = pp; @@ -364,14 +341,10 @@ for (n = shorts; n != NULL; n = next) { next = n->next; - if (n->pin != NULL) - PCB_FLAG_SET(PCB_FLAG_WARN, n->pin); - if (n->pad != NULL) - PCB_FLAG_SET(PCB_FLAG_WARN, n->pad); + PCB_FLAG_SET(PCB_FLAG_WARN, n->term); - /* run only if net is not ignored */ - if ((!bad_gr) && (proc_short(n->pin, n->pad, n->ignore) != 0)) { + if ((!bad_gr) && (proc_short(n->term, n->ignore) != 0)) { fprintf(stderr, "Can't run mincut :(\n"); bad_gr = 1; } @@ -380,8 +353,8 @@ /* check if the rest of the shorts affect the same nets - ignore them if so */ for (i = n->next; i != NULL; i = i->next) { pcb_lib_menu_t *spn, *spi; - spn = (n->pin != NULL) ? n->pin->ratconn : n->pad->ratconn; - spi = (i->pin != NULL) ? i->pin->ratconn : i->pad->ratconn; + spn = n->term->ratconn; + spi = i->term->ratconn; if ((spn == NULL) || (spi == NULL)) continue;