Index: trunk/src/drc.h =================================================================== --- trunk/src/drc.h (revision 21177) +++ trunk/src/drc.h (revision 21178) @@ -31,7 +31,7 @@ #include #include "unit.h" -#include "vtid.h" +#include "idpath.h" #include "box.h" typedef struct drc_violation_s pcb_drc_violation_t; @@ -49,7 +49,7 @@ pcb_coord_t measured_value; pcb_coord_t required_value; - vtid_t objs[2]; /* two groups of offending objects */ + pcb_idpath_list_t objs[2]; /* two groups of offending objects */ gdl_elem_t link; /* always part of a list */ }; Index: trunk/src/drc_list.c =================================================================== --- trunk/src/drc_list.c (revision 21177) +++ trunk/src/drc_list.c (revision 21178) @@ -40,6 +40,8 @@ void pcb_drc_free(pcb_drc_violation_t *item) { pcb_drc_list_remove(item); + pcb_idpath_list_clear(&item->objs[0]); + pcb_idpath_list_clear(&item->objs[1]); free(item->title); free(item->explanation); free(item); Index: trunk/src/find_drc.c =================================================================== --- trunk/src/find_drc.c (revision 21177) +++ trunk/src/find_drc.c (revision 21178) @@ -46,7 +46,7 @@ static pcb_drc_violation_t *pcb_drc_violation_new( const char *title, const char *explanation, pcb_bool have_measured, pcb_coord_t measured_value, - pcb_coord_t required_value, vtid_t objs[2]) + pcb_coord_t required_value, pcb_idpath_list_t objs[2]) { pcb_drc_violation_t *violation = calloc(sizeof(pcb_drc_violation_t), 1); @@ -82,8 +82,10 @@ static void GotoError(void); /* Build a list of the of offending items by ID */ -static void drc_append_obj(vtid_t objs[2], pcb_any_obj_t *obj) +static void drc_append_obj(pcb_idpath_list_t objs[2], pcb_any_obj_t *obj) { + pcb_idpath_t *idp; + switch(obj->type) { case PCB_OBJ_LINE: case PCB_OBJ_ARC: @@ -90,11 +92,14 @@ case PCB_OBJ_POLY: case PCB_OBJ_PSTK: case PCB_OBJ_RAT: - vtid_append(&objs[0], obj->ID); - return; - + idp = pcb_obj2idpath(obj); + if (idp == NULL) + pcb_message(PCB_MSG_ERROR, "Internal error in drc_append_obj: can not resolve object id path\n"); + else + pcb_idpath_list_append(&objs[0], idp); + break; default: - fprintf(stderr, "Internal error in drc_append_obj: unknown object type %i\n", thing_type); + pcb_message(PCB_MSG_ERROR, "Internal error in drc_append_obj: unknown object type %i\n", obj->type); } } @@ -121,17 +126,18 @@ void drc_auto_loc(pcb_drc_violation_t *v) { int g; - size_t n; pcb_box_t b; pcb_any_obj_t *obj; + pcb_idpath_t *idp; /* special case: no object - leave coords unloaded/invalid */ - if ((v->objs[0].used < 1) && (v->objs[1].used < 1)) + if ((pcb_idpath_list_length(&v->objs[0]) < 1) && (pcb_idpath_list_length(&v->objs[1]) < 1)) return; /* special case: single objet in group A, use the center */ - if (v->objs[0].used == 1) { - obj = htip_get(&PCB->Data->id2obj, v->objs[0].array[0]); + if (pcb_idpath_list_length(&v->objs[0]) == 1) { + idp = pcb_idpath_list_first(&v->objs[0]); + obj = pcb_idpath2obj(PCB->Data, idp); if (obj != NULL) { v->have_coord = 1; pcb_obj_center(obj, &v->x, &v->y); @@ -143,8 +149,8 @@ b.X1 = b.Y1 = PCB_MAX_COORD; b.X2 = b.Y2 = -PCB_MAX_COORD; for(g = 0; g < 2; g++) { - for(n = 0; n < v->objs[g].used; n++) { - obj = htip_get(&PCB->Data->id2obj, v->objs[g].array[n]); + for(idp = pcb_idpath_list_first(&v->objs[g]); idp != NULL; idp = pcb_idpath_list_next(idp)) { + obj = pcb_idpath2obj(PCB->Data, idp); if (obj != NULL) { v->have_coord = 1; pcb_box_bump_box(&b, &obj->BoundingBox); @@ -189,7 +195,7 @@ pcb_line_t *line = (pcb_line_t *)ptr2; pcb_arc_t *arc = (pcb_arc_t *)ptr2; pcb_pstk_t *ps = (pcb_pstk_t *)ptr2; - vtid_t objs[2]; + pcb_idpath_list_t objs[2]; memset(objs, 0, sizeof(objs)); @@ -251,7 +257,7 @@ static int drc_text(pcb_drc_list_t *lst, pcb_layer_t *layer, pcb_text_t *text, pcb_coord_t min_wid) { pcb_drc_violation_t *violation; - vtid_t objs[2]; + pcb_idpath_list_t objs[2]; memset(objs, 0, sizeof(objs)); @@ -285,7 +291,7 @@ { pcb_drc_violation_t *violation; int nopastecnt = 0; - vtid_t objs[2]; + pcb_idpath_list_t objs[2]; memset(objs, 0, sizeof(objs)); @@ -511,7 +517,7 @@ static pcb_bool DRCFind(pcb_drc_list_t *lst, int What, void *ptr1, void *ptr2, void *ptr3) { pcb_drc_violation_t *violation; - vtid_t objs[2]; + pcb_idpath_list_t objs[2]; memset(objs, 0, sizeof(objs));