Index: trunk/src/find.h =================================================================== --- trunk/src/find.h (revision 21850) +++ trunk/src/find.h (revision 21851) @@ -36,9 +36,9 @@ typedef enum { PCB_FCT_COPPER = 1, /* copper connection */ - PCB_FCT_INTERNAL = 2, /* element-internal connection */ - PCB_FCT_RAT = 4, /* connected by a rat line */ - PCB_FCT_ELEMENT = 8, /* pin/pad is part of an element whose pins/pads are being listed */ + PCB_FCT_INTCONN = 2, /* subc internal connection, using the intconn attrib */ + PCB_FCT_RAT = 4, /* connected between a rat line and anything else */ + PCB_FCT_SUBC = 8, /* pin/pad is part of an element whose pins/pads are being listed */ PCB_FCT_START = 16 /* starting object of a query */ } pcb_found_conn_type_t; Index: trunk/src/find2.c =================================================================== --- trunk/src/find2.c (revision 21850) +++ trunk/src/find2.c (revision 21851) @@ -34,7 +34,7 @@ it's also cheap on remove! */ /* Do everything that needs to be done for an object found */ -static int pcb_find_found(pcb_find_t *ctx, pcb_any_obj_t *obj, pcb_any_obj_t *arrived_from) +static int pcb_find_found(pcb_find_t *ctx, pcb_any_obj_t *obj, pcb_any_obj_t *arrived_from, pcb_found_conn_type_t ctype) { if (ctx->list_found) vtp0_append(&ctx->found, obj); @@ -47,7 +47,7 @@ ctx->nfound++; - if ((ctx->found_cb != NULL) && (ctx->found_cb(ctx, obj, arrived_from) != 0)) { + if ((ctx->found_cb != NULL) && (ctx->found_cb(ctx, obj, arrived_from, ctype) != 0)) { ctx->aborted = 1; return 1; } @@ -56,12 +56,12 @@ } -static int pcb_find_addobj(pcb_find_t *ctx, pcb_any_obj_t *obj, pcb_any_obj_t *arrived_from) +static int pcb_find_addobj(pcb_find_t *ctx, pcb_any_obj_t *obj, pcb_any_obj_t *arrived_from, pcb_found_conn_type_t ctype) { PCB_DFLAG_SET(&obj->Flags, ctx->mark); vtp0_append(&ctx->open, obj); - if (pcb_find_found(ctx, obj, arrived_from) != 0) { + if (pcb_find_found(ctx, obj, arrived_from, ctype) != 0) { ctx->aborted = 1; return 1; } @@ -83,7 +83,7 @@ PCB_PADSTACK_LOOP(s->data); { if ((padstack != from) && (padstack->term != NULL) && (padstack->intconn == ic) && (!(PCB_DFLAG_TEST(&(padstack->Flags), ctx->mark)))) - if (pcb_find_addobj(ctx, (pcb_any_obj_t *)padstack, from_) != 0) + if (pcb_find_addobj(ctx, (pcb_any_obj_t *)padstack, from_, PCB_FCT_INTCONN) != 0) return; } PCB_END_LOOP; @@ -91,7 +91,7 @@ PCB_LINE_COPPER_LOOP(s->data); { if ((line != from) && (line->term != NULL) && (line->intconn == ic) && (!(PCB_DFLAG_TEST(&(line->Flags), ctx->mark)))) - if (pcb_find_addobj(ctx, (pcb_any_obj_t *)line, from_) != 0) + if (pcb_find_addobj(ctx, (pcb_any_obj_t *)line, from_, PCB_FCT_INTCONN) != 0) return; } PCB_ENDALL_LOOP; @@ -99,7 +99,7 @@ PCB_ARC_COPPER_LOOP(s->data); { if ((arc != from) && (arc->term != NULL) && (arc->intconn == ic) && (!(PCB_DFLAG_TEST(&(arc->Flags), ctx->mark)))) - if (pcb_find_addobj(ctx, (pcb_any_obj_t *)arc, from_) != 0) + if (pcb_find_addobj(ctx, (pcb_any_obj_t *)arc, from_, PCB_FCT_INTCONN) != 0) return; } PCB_ENDALL_LOOP; @@ -107,7 +107,7 @@ PCB_POLY_COPPER_LOOP(s->data); { if ((polygon != from) && (polygon->term != NULL) && (polygon->intconn == ic) && (!(PCB_DFLAG_TEST(&(polygon->Flags), ctx->mark)))) - if (pcb_find_addobj(ctx, (pcb_any_obj_t *)polygon, from_) != 0) + if (pcb_find_addobj(ctx, (pcb_any_obj_t *)polygon, from_, PCB_FCT_INTCONN) != 0) return; } PCB_ENDALL_LOOP; @@ -117,7 +117,7 @@ PCB_TEXT_COPPER_LOOP(s->data); { if ((text != from) && (text->term != NULL) && (text->intconn == ic) && (!(PCB_DFLAG_TEST(&(text->Flags), ctx->mark)))) - if (pcb_find_addobj(ctx, (pcb_any_obj_t *)text, from_) != 0) + if (pcb_find_addobj(ctx, (pcb_any_obj_t *)text, from_, PCB_FCT_INTCONN) != 0) return; } PCB_ENDALL_LOOP; @@ -128,12 +128,12 @@ #undef INOCN #define INOCN(a,b) int_noconn((pcb_any_obj_t *)a, (pcb_any_obj_t *)b) -#define PCB_FIND_CHECK(ctx, curr, obj) \ +#define PCB_FIND_CHECK(ctx, curr, obj, ctype) \ do { \ pcb_any_obj_t *__obj__ = (pcb_any_obj_t *)obj; \ if (!(PCB_DFLAG_TEST(&(__obj__->Flags), ctx->mark))) { \ if (!INOCN(curr, obj) && (pcb_intersect_obj_obj(curr, __obj__))) {\ - if (pcb_find_addobj(ctx, __obj__, curr) != 0) return; \ + if (pcb_find_addobj(ctx, __obj__, curr, ctype) != 0) return; \ if ((__obj__->term != NULL) && (!ctx->ignore_intconn) && (__obj__->intconn > 0)) \ int_conn(ctx, __obj__); \ } \ @@ -140,7 +140,7 @@ } \ } while(0) -void pcb_find_on_layer(pcb_find_t *ctx, pcb_layer_t *l, pcb_any_obj_t *curr, pcb_rtree_box_t *sb) +void pcb_find_on_layer(pcb_find_t *ctx, pcb_layer_t *l, pcb_any_obj_t *curr, pcb_rtree_box_t *sb, pcb_found_conn_type_t ctype) { pcb_rtree_it_t it; pcb_box_t *n; @@ -147,36 +147,36 @@ if (l->line_tree != NULL) { for(n = pcb_rtree_first(&it, l->line_tree, sb); n != NULL; n = pcb_rtree_next(&it)) - PCB_FIND_CHECK(ctx, curr, n); + PCB_FIND_CHECK(ctx, curr, n, ctype); pcb_r_end(&it); } if (l->arc_tree != NULL) { for(n = pcb_rtree_first(&it, l->arc_tree, sb); n != NULL; n = pcb_rtree_next(&it)) - PCB_FIND_CHECK(ctx, curr, n); + PCB_FIND_CHECK(ctx, curr, n, ctype); pcb_r_end(&it); } if (l->polygon_tree != NULL) { for(n = pcb_rtree_first(&it, l->polygon_tree, sb); n != NULL; n = pcb_rtree_next(&it)) - PCB_FIND_CHECK(ctx, curr, n); + PCB_FIND_CHECK(ctx, curr, n, ctype); pcb_r_end(&it); } if (l->text_tree != NULL) { for(n = pcb_rtree_first(&it, l->text_tree, sb); n != NULL; n = pcb_rtree_next(&it)) - PCB_FIND_CHECK(ctx, curr, n); + PCB_FIND_CHECK(ctx, curr, n, ctype); pcb_r_end(&it); } } -void pcb_find_on_layergrp(pcb_find_t *ctx, pcb_layergrp_t *g, pcb_any_obj_t *curr, pcb_rtree_box_t *sb) +void pcb_find_on_layergrp(pcb_find_t *ctx, pcb_layergrp_t *g, pcb_any_obj_t *curr, pcb_rtree_box_t *sb, pcb_found_conn_type_t ctype) { int n; if (g == NULL) return; for(n = 0; n < g->len; n++) - pcb_find_on_layer(ctx, &ctx->data->Layer[g->lid[n]], curr, sb); + pcb_find_on_layer(ctx, &ctx->data->Layer[g->lid[n]], curr, sb, ctype); } static void pcb_find_rat(pcb_find_t *ctx, pcb_rat_t *rat) @@ -185,16 +185,17 @@ sb.x1 = rat->Point1.X; sb.x2 = rat->Point1.X+1; sb.y1 = rat->Point1.Y; sb.y2 = rat->Point1.Y+1; - pcb_find_on_layergrp(ctx, pcb_get_layergrp(ctx->pcb, rat->group1), (pcb_any_obj_t *)rat, &sb); + pcb_find_on_layergrp(ctx, pcb_get_layergrp(ctx->pcb, rat->group1), (pcb_any_obj_t *)rat, &sb, PCB_FCT_RAT); sb.x1 = rat->Point2.X; sb.x2 = rat->Point2.X+1; sb.y1 = rat->Point2.Y; sb.y2 = rat->Point2.Y+1; - pcb_find_on_layergrp(ctx, pcb_get_layergrp(ctx->pcb, rat->group2), (pcb_any_obj_t *)rat, &sb); + pcb_find_on_layergrp(ctx, pcb_get_layergrp(ctx->pcb, rat->group2), (pcb_any_obj_t *)rat, &sb, PCB_FCT_RAT); } static unsigned long pcb_find_exec(pcb_find_t *ctx) { pcb_any_obj_t *curr; + pcb_found_conn_type_t ctype; if ((ctx->start_layergrp == NULL) && (ctx->open.used > 0) && (ctx->pcb != NULL)) { curr = ctx->open.array[0]; @@ -211,6 +212,7 @@ /* pop the last object, without reallocating to smaller, mark it found */ ctx->open.used--; curr = ctx->open.array[ctx->open.used]; + ctype = curr->type == PCB_OBJ_RAT ? PCB_FCT_RAT : PCB_FCT_COPPER; { /* search unmkared connections: iterative approach */ pcb_rtree_it_t it; @@ -219,7 +221,7 @@ if (PCB->Data->padstack_tree != NULL) { for(n = pcb_rtree_first(&it, PCB->Data->padstack_tree, sb); n != NULL; n = pcb_rtree_next(&it)) - PCB_FIND_CHECK(ctx, curr, n); + PCB_FIND_CHECK(ctx, curr, n, ctype); pcb_r_end(&it); } @@ -226,7 +228,7 @@ if ((ctx->consider_rats) && (PCB->Data->rat_tree != NULL)) { if (PCB->Data->padstack_tree != NULL) { for(n = pcb_rtree_first(&it, PCB->Data->rat_tree, sb); n != NULL; n = pcb_rtree_next(&it)) - PCB_FIND_CHECK(ctx, curr, n); + PCB_FIND_CHECK(ctx, curr, n, PCB_FCT_RAT); pcb_r_end(&it); } } @@ -240,7 +242,7 @@ TODO("find.c: implement this"); } if (pcb_pstk_shape_at_(ctx->pcb, (pcb_pstk_t *)curr, l, 0)) - pcb_find_on_layer(ctx, l, curr, sb); + pcb_find_on_layer(ctx, l, curr, sb, ctype); } } else { @@ -247,7 +249,7 @@ for(li = 0; li < ctx->start_layergrp->len; li++) { l = pcb_get_layer(ctx->data, ctx->start_layergrp->lid[li]); if (l != NULL) - pcb_find_on_layer(ctx, l, curr, sb); + pcb_find_on_layer(ctx, l, curr, sb, ctype); } } } @@ -257,7 +259,7 @@ else { /* layer objects need to be checked against same layer objects only */ assert(curr->parent_type == PCB_PARENT_LAYER); - pcb_find_on_layer(ctx, curr->parent.layer, curr, sb); + pcb_find_on_layer(ctx, curr->parent.layer, curr, sb, ctype); } } } @@ -292,7 +294,7 @@ return -1; pcb_data_dynflag_clear(data, ctx->mark); - pcb_find_addobj(ctx, from, NULL); /* add the starting object with no 'arrived_from' */ + pcb_find_addobj(ctx, from, NULL, PCB_FCT_START); /* add the starting object with no 'arrived_from' */ return pcb_find_exec(ctx); } Index: trunk/src/find2.h =================================================================== --- trunk/src/find2.h (revision 21850) +++ trunk/src/find2.h (revision 21851) @@ -48,8 +48,9 @@ it is called for the starting object as well. All object data and ctx fields are updated for new_obj before the call. arrived_from is the previous object (that already triggered a callback) from which - new_obj was first found; can be NULL for the starting object. */ - int (*found_cb)(pcb_find_t *ctx, pcb_any_obj_t *new_obj, pcb_any_obj_t *arrived_from); + new_obj was first found; can be NULL for the starting object. ctype + describes the relation between arrived_from and new_obj. */ + int (*found_cb)(pcb_find_t *ctx, pcb_any_obj_t *new_obj, pcb_any_obj_t *arrived_from, pcb_found_conn_type_t ctype); /* public state/result */ vtp0_t found; /* objects found, when list_found is 1 - of (pcb_any_obj_t *) */ Index: trunk/src/find_intconn.c =================================================================== --- trunk/src/find_intconn.c (revision 21850) +++ trunk/src/find_intconn.c (revision 21851) @@ -37,7 +37,7 @@ { if ((padstack != from_ptr) && (padstack->term != NULL) && (padstack->intconn == ic) && (!PCB_FLAG_TEST(TheFlag, padstack))) { PCB_FLAG_SET(PCB_FLAG_DRC_INTCONN, padstack); - ADD_PADSTACK_TO_LIST(padstack, from_type, from_ptr, PCB_FCT_INTERNAL, NULL); + ADD_PADSTACK_TO_LIST(padstack, from_type, from_ptr, PCB_FCT_INTCONN, NULL); } } PCB_END_LOOP; @@ -46,7 +46,7 @@ { if ((line != from_ptr) && (line->term != NULL) && (line->intconn == ic) && (!PCB_FLAG_TEST(TheFlag, line))) { PCB_FLAG_SET(PCB_FLAG_DRC_INTCONN, line); - ADD_LINE_TO_LIST(l, line, from_type, from_ptr, PCB_FCT_INTERNAL, NULL); + ADD_LINE_TO_LIST(l, line, from_type, from_ptr, PCB_FCT_INTCONN, NULL); } } PCB_ENDALL_LOOP; @@ -55,7 +55,7 @@ { if ((arc != from_ptr) && (arc->term != NULL) && (arc->intconn == ic) && (!PCB_FLAG_TEST(TheFlag, arc))) { PCB_FLAG_SET(PCB_FLAG_DRC_INTCONN, arc); - ADD_ARC_TO_LIST(l, arc, from_type, from_ptr, PCB_FCT_INTERNAL, NULL); + ADD_ARC_TO_LIST(l, arc, from_type, from_ptr, PCB_FCT_INTCONN, NULL); } } PCB_ENDALL_LOOP; @@ -64,7 +64,7 @@ { if ((polygon != from_ptr) && (polygon->term != NULL) && (polygon->intconn == ic) && (!PCB_FLAG_TEST(TheFlag, polygon))) { PCB_FLAG_SET(PCB_FLAG_DRC_INTCONN, polygon); - ADD_POLYGON_TO_LIST(l, polygon, from_type, from_ptr, PCB_FCT_INTERNAL, NULL); + ADD_POLYGON_TO_LIST(l, polygon, from_type, from_ptr, PCB_FCT_INTCONN, NULL); } } PCB_ENDALL_LOOP; @@ -75,7 +75,7 @@ { if ((text != from_ptr) && (text->term != NULL) && (text->intconn == ic) && (!PCB_FLAG_TEST(TheFlag, text))) { PCB_FLAG_SET(PCB_FLAG_DRC_INTCONN, text); - ADD_TEXT_TO_LIST(l, text, from_type, from_ptr, PCB_FCT_INTERNAL, NULL); + ADD_TEXT_TO_LIST(l, text, from_type, from_ptr, PCB_FCT_INTCONN, NULL); } } PCB_ENDALL_LOOP; Index: trunk/src_plugins/export_oldconn/oldconn.c =================================================================== --- trunk/src_plugins/export_oldconn/oldconn.c (revision 21850) +++ trunk/src_plugins/export_oldconn/oldconn.c (revision 21851) @@ -77,7 +77,7 @@ fputs("{\n", f); } -static int count_term_cb(pcb_find_t *fctx, pcb_any_obj_t *o, pcb_any_obj_t *arrived_from) +static int count_term_cb(pcb_find_t *fctx, pcb_any_obj_t *o, pcb_any_obj_t *arrived_from, pcb_found_conn_type_t ctype) { unsigned long *cnt = fctx->user_data; @@ -139,7 +139,7 @@ pcb_any_obj_t *start; } term_cb_t; -static int print_term_conn_cb(pcb_find_t *fctx, pcb_any_obj_t *o, pcb_any_obj_t *arrived_from) +static int print_term_conn_cb(pcb_find_t *fctx, pcb_any_obj_t *o, pcb_any_obj_t *arrived_from, pcb_found_conn_type_t ctype) { term_cb_t *ctx = fctx->user_data; pcb_subc_t *sc; Index: trunk/src_plugins/lib_netmap/netmap.c =================================================================== --- trunk/src_plugins/lib_netmap/netmap.c (revision 21850) +++ trunk/src_plugins/lib_netmap/netmap.c (revision 21851) @@ -45,7 +45,7 @@ return &dn->net; } -static int found(pcb_find_t *fctx, pcb_any_obj_t *obj, pcb_any_obj_t *arrived_from) +static int found(pcb_find_t *fctx, pcb_any_obj_t *obj, pcb_any_obj_t *arrived_from, pcb_found_conn_type_t ctype) { pcb_netmap_t *map = fctx->user_data; dyn_obj_t *d, *dl; Index: trunk/src_plugins/report/report.c =================================================================== --- trunk/src_plugins/report/report.c (revision 21850) +++ trunk/src_plugins/report/report.c (revision 21851) @@ -444,7 +444,7 @@ return 0; } -static int net_length_cb(pcb_find_t *fctx, pcb_any_obj_t *o, pcb_any_obj_t *arrived_from) +static int net_length_cb(pcb_find_t *fctx, pcb_any_obj_t *o, pcb_any_obj_t *arrived_from, pcb_found_conn_type_t ctype) { double *length = fctx->user_data; double dx, dy;