Index: trunk/doc/TODO.cleanup =================================================================== --- trunk/doc/TODO.cleanup (revision 26975) +++ trunk/doc/TODO.cleanup (revision 26976) @@ -1,3 +1,2 @@ - rename: - conf_* - - netlist2.h netlist.h Index: trunk/scconfig/Rev.h =================================================================== --- trunk/scconfig/Rev.h (revision 26975) +++ trunk/scconfig/Rev.h (revision 26976) @@ -1 +1 @@ -static const int myrev = 26946; +static const int myrev = 26976; Index: trunk/scconfig/Rev.tab =================================================================== --- trunk/scconfig/Rev.tab (revision 26975) +++ trunk/scconfig/Rev.tab (revision 26976) @@ -1,3 +1,4 @@ +26976 configure rename netlist2.[ch] to netlist.[ch] 26946 configure hidlib: split DAD from hid_attrib 26906 configure hidlib: split hidlib into modular rndlib and install relevant headers 26716 configure gtk: merge lib_gtk_hid into lib_gtk_common Index: trunk/src/netlist2.c =================================================================== --- trunk/src/netlist2.c (revision 26975) +++ trunk/src/netlist2.c (nonexistent) @@ -1,967 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2019 Tibor 'Igor2' Palinkas - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Contact: - * Project page: http://repo.hu/projects/pcb-rnd - * lead developer: http://repo.hu/projects/pcb-rnd/contact.html - * mailing list: pcb-rnd (at) list.repo.hu (send "subscribe") - */ - -#include "config.h" -#include -#include -#include -#include - -#include "board.h" -#include "data.h" -#include "data_it.h" -#include "event.h" -#include "compat_misc.h" -#include "layer_grp.h" -#include "find.h" -#include "obj_term.h" -#include "conf_core.h" -#include "undo.h" -#include "obj_rat_draw.h" -#include "obj_subc_parent.h" -#include "search.h" -#include "remove.h" -#include "draw.h" - -#define TDL_DONT_UNDEF -#include "netlist2.h" -#include - -void pcb_net_term_free_fields(pcb_net_term_t *term) -{ - pcb_attribute_free(&term->Attributes); - free(term->refdes); - free(term->term); -} - -void pcb_net_term_free(pcb_net_term_t *term) -{ - pcb_net_term_free_fields(term); - free(term); -} - -static pcb_net_term_t *pcb_net_term_alloc(pcb_net_t *net, const char *refdes, const char *term) -{ - pcb_net_term_t *t; - - t = calloc(sizeof(pcb_net_term_t), 1); - t->type = PCB_OBJ_NET_TERM; - t->parent_type = PCB_PARENT_NET; - t->parent.net = net; - t->refdes = pcb_strdup(refdes); - t->term = pcb_strdup(term); - pcb_termlist_append(&net->conns, t); - return t; -} - -pcb_net_term_t *pcb_net_term_get(pcb_net_t *net, const char *refdes, const char *term, pcb_bool alloc) -{ - pcb_net_term_t *t; - - /* for allocation this is slow, O(N^2) algorithm, but other than a few - biggish networks like GND, there won't be too many connections anyway) */ - for(t = pcb_termlist_first(&net->conns); t != NULL; t = pcb_termlist_next(t)) { - if ((strcmp(t->refdes, refdes) == 0) && (strcmp(t->term, term) == 0)) - return t; - } - - if (alloc) - return pcb_net_term_alloc(net, refdes, term); - return NULL; -} - -pcb_net_term_t *pcb_net_term_get_by_obj(pcb_net_t *net, const pcb_any_obj_t *obj) -{ - pcb_data_t *data; - pcb_subc_t *sc; - - if (obj->term == NULL) - return NULL; - - if (obj->parent_type == PCB_PARENT_LAYER) - data = obj->parent.layer->parent.data; - else if (obj->parent_type == PCB_PARENT_DATA) - data = obj->parent.data; - else - return NULL; - - if (data->parent_type != PCB_PARENT_SUBC) - return NULL; - - sc = data->parent.subc; - if (sc->refdes == NULL) - return NULL; - - return pcb_net_term_get(net, sc->refdes, obj->term, pcb_false); -} - -pcb_net_term_t *pcb_net_term_get_by_pinname(pcb_net_t *net, const char *pinname, pcb_bool alloc) -{ - char tmp[256]; - char *pn, *refdes, *term; - int len = strlen(pinname)+1; - pcb_net_term_t *t = NULL; - - if (len <= sizeof(tmp)) { - pn = tmp; - memcpy(pn, pinname, len); - } - else - pn = pcb_strdup(pinname); - - - refdes = pn; - term = strchr(refdes, '-'); - if (term != NULL) { - *term = '\0'; - term++; - t = pcb_net_term_get(net, refdes, term, alloc); - } - - if (pn != tmp) - free(pn); - return t; - -} - - -int pcb_net_term_del(pcb_net_t *net, pcb_net_term_t *term) -{ - pcb_termlist_remove(term); - pcb_net_term_free(term); - return 0; -} - - -int pcb_net_term_del_by_name(pcb_net_t *net, const char *refdes, const char *term) -{ - pcb_net_term_t *t; - - for(t = pcb_termlist_first(&net->conns); t != NULL; t = pcb_termlist_next(t)) - if ((strcmp(t->refdes, refdes) == 0) && (strcmp(t->term, term) == 0)) - return pcb_net_term_del(net, t); - - return -1; -} - -pcb_bool pcb_net_name_valid(const char *netname) -{ - for(;*netname != '\0'; netname++) { - if (isalnum(*netname)) continue; - switch(*netname) { - case '_': - break; - return pcb_false; - } - } - return pcb_true; -} - -static pcb_net_t *pcb_net_alloc(pcb_board_t *pcb, pcb_netlist_t *nl, const char *netname) -{ - pcb_net_t *net; - - net = calloc(sizeof(pcb_net_t), 1); - net->type = PCB_OBJ_NET; - net->parent_type = PCB_PARENT_BOARD; - net->parent.board = pcb; - net->name = pcb_strdup(netname); - htsp_set(nl, net->name, net); - return net; -} - -pcb_net_t *pcb_net_get(pcb_board_t *pcb, pcb_netlist_t *nl, const char *netname, pcb_bool alloc) -{ - pcb_net_t *net; - - if (nl == NULL) - return NULL; - - if (!pcb_net_name_valid(netname)) - return NULL; - - net = htsp_get(nl, netname); - if (net != NULL) - return net; - - if (alloc) - return pcb_net_alloc(pcb, nl, netname); - - return NULL; -} - -pcb_net_t *pcb_net_get_icase(pcb_board_t *pcb, pcb_netlist_t *nl, const char *name) -{ - htsp_entry_t *e; - - for(e = htsp_first(nl); e != NULL; e = htsp_next(nl, e)) { - pcb_net_t *net = e->value; - if (pcb_strcasecmp(name, net->name) == 0) - break; - } - - if (e == NULL) - return NULL; - return e->value; -} - -pcb_net_t *pcb_net_get_regex(pcb_board_t *pcb, pcb_netlist_t *nl, const char *rx) -{ - htsp_entry_t *e; - re_sei_t *regex; - - regex = re_sei_comp(rx); - if (re_sei_errno(regex) != 0) - return NULL; - - for(e = htsp_first(nl); e != NULL; e = htsp_next(nl, e)) { - pcb_net_t *net = e->value; - if (re_sei_exec(regex, net->name)) - break; - } - re_sei_free(regex); - - if (e == NULL) - return NULL; - return e->value; -} - -pcb_net_t *pcb_net_get_user(pcb_board_t *pcb, pcb_netlist_t *nl, const char *name_or_rx) -{ - pcb_net_t *net = pcb_net_get(pcb, nl, name_or_rx, 0); - if (net == NULL) - net = pcb_net_get_icase(pcb, nl, name_or_rx); - if (net == NULL) - net = pcb_net_get_regex(pcb, nl, name_or_rx); - return net; -} - -void pcb_net_free_fields(pcb_net_t *net) -{ - pcb_attribute_free(&net->Attributes); - free(net->name); - for(;;) { - pcb_net_term_t *term = pcb_termlist_first(&net->conns); - if (term == NULL) - break; - pcb_termlist_remove(term); - pcb_net_term_free(term); - } -} - -void pcb_net_free(pcb_net_t *net) -{ - pcb_net_free_fields(net); - free(net); -} - -int pcb_net_del(pcb_netlist_t *nl, const char *netname) -{ - htsp_entry_t *e; - - if (nl == NULL) - return -1; - - e = htsp_getentry(nl, netname); - if (e == NULL) - return -1; - - pcb_net_free(e->value); - - htsp_delentry(nl, e); - return 0; -} - -/* crawl from a single terminal; "first" sould be a pointer to an int - initialized to 0. Returns number of objects found. */ -static pcb_cardinal_t pcb_net_term_crawl(const pcb_board_t *pcb, pcb_net_term_t *term, pcb_find_t *fctx, int *first, pcb_cardinal_t *missing) -{ - pcb_any_obj_t *o; - -/* there can be multiple terminals with the same ID, but it is enough to run find from the first: find.c will consider them all */ - o = pcb_term_find_name(pcb, pcb->Data, PCB_LYT_COPPER, term->refdes, term->term, NULL, NULL); - if (o == NULL) { - if (missing != NULL) - (*missing)++; - return 0; - } - - if ((*first) == 0) { - *first = 1; - return pcb_find_from_obj(fctx, PCB->Data, o); - } - - if (PCB_FIND_IS_MARKED(fctx, o)) - return 0; /* already visited, no need to run 'find' again */ - - return pcb_find_from_obj_next(fctx, PCB->Data, o); -} - -void pcb_net_short_ctx_init(pcb_short_ctx_t *sctx, const pcb_board_t *pcb, pcb_net_t *net) -{ - sctx->pcb = pcb; - sctx->current_net = net; - sctx->changed = 0; - sctx->missing = 0; - sctx->num_shorts = 0; - htsp_init(&sctx->found, strhash, strkeyeq); -} - -void pcb_net_short_ctx_uninit(pcb_short_ctx_t *sctx) -{ - htsp_entry_t *e; - for(e = htsp_first(&sctx->found); e != NULL; e = htsp_next(&sctx->found, e)) - free(e->key); - htsp_uninit(&sctx->found); - if (sctx->changed) { - pcb_gui->invalidate_all(pcb_gui); - conf_core.temp.rat_warn = pcb_true; - } -} - -/* Return 1 if net1-net2 (or net2-net1) is already seen as a short, return 0 - else. Save net1-net2 as seen. */ -static int short_ctx_is_dup(pcb_short_ctx_t *sctx, pcb_net_t *net1, pcb_net_t *net2) -{ - char *key; - int order; - - order = strcmp(net1->name, net2->name); - - if (order == 0) { - pcb_message(PCB_MSG_ERROR, "netlist internal error: short_ctx_is_dup() net %s shorted with itself?!\n", net1->name); - return 1; - } - if (order > 0) - key = pcb_concat(net1->name, "-", net2->name, NULL); - else - key = pcb_concat(net2->name, "-", net1->name, NULL); - - if (htsp_has(&sctx->found, key)) { - free(key); - return 1; - } - - htsp_set(&sctx->found, key, net1); - return 0; -} - -/* Short circuit found between net and an offender object that should not - be part of the net but is connected to the net */ -static void net_found_short(pcb_short_ctx_t *sctx, pcb_any_obj_t *offender) -{ - pcb_subc_t *sc = pcb_obj_parent_subc(offender); - int handled = 0; - - pcb_net_term_t *offt = pcb_net_find_by_refdes_term(&sctx->pcb->netlist[PCB_NETLIST_EDITED], sc->refdes, offender->term); - pcb_net_t *offn = NULL; - const char *offnn = ""; - - if (offt != NULL) { - offn = offt->parent.net; - offnn = offn->name; - if (short_ctx_is_dup(sctx, sctx->current_net, offn)) - return; - } - - if (offnn != NULL) - pcb_message(PCB_MSG_WARNING, "SHORT: net \"%s\" is shorted to \"%s\" at terminal %s-%s\n", sctx->current_net->name, offnn, sc->refdes, offender->term); - else - pcb_message(PCB_MSG_WARNING, "SHORT: net \"%s\" is shorted to terminal %s-%s\n", sctx->current_net->name, sc->refdes, offender->term); - - pcb_event(&PCB->hidlib, PCB_EVENT_NET_INDICATE_SHORT, "pppp", sctx->current_net, offender, offn, &handled); - if (!handled) { - pcb_net_term_t *orig_t = pcb_termlist_first(&sctx->current_net->conns); - pcb_any_obj_t *orig_o = pcb_term_find_name(sctx->pcb, sctx->pcb->Data, PCB_LYT_COPPER, orig_t->refdes, orig_t->term, NULL, NULL); - - /* dummy fallback: warning-highlight the two terminals */ - PCB_FLAG_SET(PCB_FLAG_WARN, offender); - if (orig_o != NULL) - PCB_FLAG_SET(PCB_FLAG_WARN, orig_o); - } - sctx->changed++; - sctx->num_shorts++; -} - -static int net_short_check(pcb_find_t *fctx, pcb_any_obj_t *new_obj, pcb_any_obj_t *arrived_from, pcb_found_conn_type_t ctype) -{ - if (new_obj->term != NULL) { - pcb_net_term_t *t; - pcb_short_ctx_t *sctx = fctx->user_data; - pcb_subc_t *sc = pcb_obj_parent_subc(new_obj); - - if ((sc == NULL) || (sc->refdes == NULL)) - return 0; - - /* if new_obj is a terminal on our net, return */ - for(t = pcb_termlist_first(&sctx->current_net->conns); t != NULL; t = pcb_termlist_next(t)) - if ((strcmp(t->refdes, sc->refdes) == 0) && (strcmp(t->term, new_obj->term) == 0)) - return 0; - - /* new_obj is not on our net but has a refdes-term -> must be a short */ - net_found_short(fctx->user_data, new_obj); - } - - return 0; -} - -pcb_cardinal_t pcb_net_crawl_flag(pcb_board_t *pcb, pcb_net_t *net, unsigned long setf, unsigned long clrf) -{ - pcb_find_t fctx; - pcb_net_term_t *t; - pcb_cardinal_t res = 0, n; - pcb_short_ctx_t sctx; - int first = 0; - - pcb_net_short_ctx_init(&sctx, pcb, net); - - memset(&fctx, 0, sizeof(fctx)); - fctx.flag_set = setf; - fctx.flag_clr = clrf; - fctx.flag_chg_undoable = 1; - fctx.only_mark_rats = 1; /* do not trust rats, but do mark them */ - fctx.user_data = &sctx; - fctx.found_cb = net_short_check; - - for(t = pcb_termlist_first(&net->conns), n = 0; t != NULL; t = pcb_termlist_next(t), n++) { - res += pcb_net_term_crawl(pcb, t, &fctx, &first, NULL); - } - - pcb_find_free(&fctx); - pcb_net_short_ctx_uninit(&sctx); - return res; -} - -pcb_net_term_t *pcb_net_find_by_refdes_term(const pcb_netlist_t *nl, const char *refdes, const char *term) -{ - htsp_entry_t *e; - - for(e = htsp_first(nl); e != NULL; e = htsp_next(nl, e)) { - pcb_net_t *net = (pcb_net_t *)e->value; - pcb_net_term_t *t; - - for(t = pcb_termlist_first(&net->conns); t != NULL; t = pcb_termlist_next(t)) - if ((strcmp(t->refdes, refdes) == 0) && (strcmp(t->term, term) == 0)) - return t; - } - - return NULL; -} - -pcb_net_term_t *pcb_net_find_by_pinname(const pcb_netlist_t *nl, const char *pinname) -{ - char tmp[256]; - char *pn, *refdes, *term; - int len = strlen(pinname)+1; - pcb_net_term_t *t = NULL; - - if (len <= sizeof(tmp)) { - pn = tmp; - memcpy(pn, pinname, len); - } - else - pn = pcb_strdup(pinname); - - refdes = pn; - term = strchr(refdes, '-'); - if (term != NULL) { - *term = '\0'; - term++; - t = pcb_net_find_by_refdes_term(nl, refdes, term); - } - - if (pn != tmp) - free(pn); - return t; -} - -pcb_net_term_t *pcb_net_find_by_obj(const pcb_netlist_t *nl, const pcb_any_obj_t *obj) -{ - const pcb_subc_t *sc; - - if (obj->term == NULL) - return NULL; - - sc = pcb_obj_parent_subc(obj); - if (sc == NULL) - return NULL; - - return pcb_net_find_by_refdes_term(nl, sc->refdes, obj->term); -} - - - -static int netname_sort(const void *va, const void *vb) -{ - const pcb_net_t **a = (const pcb_net_t **)va; - const pcb_net_t **b = (const pcb_net_t **)vb; - return strcmp((*a)->name, (*b)->name); -} - -pcb_net_t **pcb_netlist_sort(pcb_netlist_t *nl) -{ - pcb_net_t **arr; - htsp_entry_t *e; - long n; - - if (nl->used == 0) - return NULL; - arr = malloc((nl->used+1) * sizeof(pcb_net_t)); - - for(e = htsp_first(nl), n = 0; e != NULL; e = htsp_next(nl, e), n++) - arr[n] = e->value; - qsort(arr, nl->used, sizeof(pcb_net_t *), netname_sort); - arr[nl->used] = NULL; - return arr; -} - -#include "netlist_geo.c" - -pcb_cardinal_t pcb_net_map_subnets(pcb_short_ctx_t *sctx, pcb_rat_accuracy_t acc, vtp0_t *subnets) -{ - pcb_find_t fctx; - pcb_net_term_t *t; - pcb_cardinal_t drawn = 0, r, n, s1, s2, su, sd; - pcb_subnet_dist_t *connmx; - char *done; - int left, first = 0; - pcb_rat_t *line; - - - memset(&fctx, 0, sizeof(fctx)); - fctx.consider_rats = 1; /* keep existing rats and their connections */ - fctx.list_found = 1; - fctx.user_data = sctx; - fctx.found_cb = net_short_check; - - /* each component of a desired network is called a subnet; already connected - objects of each subnet is collected on a vtp0_t; object-lists per submnet - is saved in variable "subnets" */ - for(t = pcb_termlist_first(&sctx->current_net->conns), n = 0; t != NULL; t = pcb_termlist_next(t), n++) { - r = pcb_net_term_crawl(sctx->pcb, t, &fctx, &first, &sctx->missing); - if (r > 0) { - vtp0_t *objs = malloc(sizeof(vtp0_t)); - memcpy(objs, &fctx.found, sizeof(vtp0_t)); - vtp0_append(subnets, objs); - memset(&fctx.found, 0, sizeof(vtp0_t)); - } - } - - /* find the shortest connection between any two subnets and save the info - in connmx */ - connmx = calloc(sizeof(pcb_subnet_dist_t), vtp0_len(subnets) * vtp0_len(subnets)); - for(s1 = 0; s1 < vtp0_len(subnets); s1++) { - for(s2 = s1+1; s2 < vtp0_len(subnets); s2++) { - connmx[s2 * vtp0_len(subnets) + s1] = connmx[s1 * vtp0_len(subnets) + s2] = pcb_subnet_dist(sctx->pcb, subnets->array[s1], subnets->array[s2], acc); - } - } - - /* Start collecting subnets into one bug snowball of newly connected - subnets. done[subnet] is 1 if a subnet is already in the snowball. - Use a greedy algorithm: mark the first subnet as dine, then always - add the shortest from any 'undone' subnet to any 'done' */ - done = calloc(vtp0_len(subnets), 1); - done[0] = 1; - for(left = vtp0_len(subnets)-1; left > 0; left--) { - double best_dist = HUGE_VAL; - int bestu; - pcb_subnet_dist_t *best = NULL, *curr; - - for(su = 1; su < vtp0_len(subnets); su++) { - if (done[su]) continue; - for(sd = 0; sd < vtp0_len(subnets); sd++) { - curr = &connmx[su * vtp0_len(subnets) + sd]; - if ((done[sd]) && (curr->dist2 < best_dist)) { - bestu = su; - best_dist = curr->dist2; - best = curr; - } - } - } - - if (best == NULL) { - /* Unlikely: if there are enough restrictions on the search, e.g. - PCB_RATACC_ONLY_MANHATTAN for the old autorouter is on and some - subnets have only heavy terminals made of non-manhattan-lines, - we will not find a connection. When best is NULL, that means - no connection found between any undone subnet to any done subnet - found, so some subnets will remain disconnected (there is no point - in looping more, this won't improve) */ - sctx->missing++; - break; - } - - /* best connection is 'best' between from 'undone' network bestu; draw the rat */ - line = pcb_rat_new(sctx->pcb->Data, -1, - best->o1x, best->o1y, best->o2x, best->o2y, best->o1g, best->o2g, - conf_core.appearance.rat_thickness, pcb_no_flags(), - best->o1, best->o2); - if (line != NULL) { - if (best->dist2 == 0) - PCB_FLAG_SET(PCB_FLAG_VIA, line); - pcb_undo_add_obj_to_create(PCB_OBJ_RAT, line, line, line); - pcb_rat_invalidate_draw(line); - drawn++; - } - else - sctx->missing++; - done[bestu] = 1; - } - - /* cleanup */ - free(connmx); - free(done); - pcb_find_free(&fctx); - return drawn; -} - -void pcb_net_reset_subnets(vtp0_t *subnets) -{ - pcb_cardinal_t n; - for(n = 0; n < vtp0_len(subnets); n++) - vtp0_uninit(subnets->array[n]); - subnets->used = 0; -} - -void pcb_net_free_subnets(vtp0_t *subnets) -{ - pcb_net_reset_subnets(subnets); - vtp0_uninit(subnets); -} - - -pcb_cardinal_t pcb_net_add_rats(const pcb_board_t *pcb, pcb_net_t *net, pcb_rat_accuracy_t acc) -{ - pcb_cardinal_t res; - pcb_short_ctx_t sctx; - vtp0_t subnets; - - vtp0_init(&subnets); - pcb_net_short_ctx_init(&sctx, pcb, net); - res = pcb_net_map_subnets(&sctx, acc, &subnets); - pcb_net_short_ctx_uninit(&sctx); - pcb_net_free_subnets(&subnets); - return res; -} - - -pcb_cardinal_t pcb_net_add_all_rats(const pcb_board_t *pcb, pcb_rat_accuracy_t acc) -{ - htsp_entry_t *e; - pcb_cardinal_t drawn = 0; - pcb_short_ctx_t sctx; - vtp0_t subnets; - - vtp0_init(&subnets); - - pcb_net_short_ctx_init(&sctx, pcb, NULL); - - for(e = htsp_first(&pcb->netlist[PCB_NETLIST_EDITED]); e != NULL; e = htsp_next(&pcb->netlist[PCB_NETLIST_EDITED], e)) { - pcb_net_t *net = e->value; - if (acc & PCB_RATACC_ONLY_SELECTED) { - pcb_net_term_t *t; - int has_selection = 0; - for(t = pcb_termlist_first(&net->conns); t != NULL; t = pcb_termlist_next(t)) { - pcb_any_obj_t *o = pcb_term_find_name(pcb, pcb->Data, PCB_LYT_COPPER, t->refdes, t->term, NULL, NULL); - if ((o != NULL) && (PCB_FLAG_TEST(PCB_FLAG_SELECTED, o))) { - has_selection = 1; - break; - } - } - if (!has_selection) - continue; - } - - sctx.current_net = net; - if (sctx.current_net->inhibit_rats) - continue; - drawn += pcb_net_map_subnets(&sctx, acc, &subnets); - pcb_net_reset_subnets(&subnets); - } - - if (acc & PCB_RATACC_INFO) { - long rem = ratlist_length(&pcb->Data->Rat); - if (rem > 0) - pcb_message(PCB_MSG_INFO, "%d rat line%s remaining\n", rem, rem > 1 ? "s" : ""); - else if (acc & PCB_RATACC_ONLY_SELECTED) - pcb_message(PCB_MSG_WARNING, "No rat for any network that has selected terminal\n"); - else if (sctx.missing > 0) - pcb_message(PCB_MSG_WARNING, "Nothing more to add, but there are\neither rat-lines in the layout, disabled nets\nin the net-list, or missing components\n"); - else if (sctx.num_shorts == 0) - pcb_message(PCB_MSG_INFO, "Congratulations!!\n" "The layout is complete and has no shorted nets.\n"); - } - - vtp0_uninit(&subnets); - pcb_net_short_ctx_uninit(&sctx); - return drawn; -} - -void pcb_netlist_changed(int force_unfreeze) -{ - if (force_unfreeze) - PCB->netlist_frozen = 0; - if (PCB->netlist_frozen) - PCB->netlist_needs_update = 1; - else { - PCB->netlist_needs_update = 0; - pcb_event(&PCB->hidlib, PCB_EVENT_NETLIST_CHANGED, NULL); - } -} - -void pcb_netlist_init(pcb_netlist_t *nl) -{ - htsp_init(nl, strhash, strkeyeq); -} - - -void pcb_netlist_uninit(pcb_netlist_t *nl) -{ - htsp_entry_t *e; - - for(e = htsp_first(nl); e != NULL; e = htsp_next(nl, e)) - pcb_net_free(e->value); - - htsp_uninit(nl); -} - -void pcb_netlist_copy(pcb_board_t *pcb, pcb_netlist_t *dst, pcb_netlist_t *src) -{ - htsp_entry_t *e; - - assert(dst->used == 0); - for(e = htsp_first(src); e != NULL; e = htsp_next(src, e)) { - pcb_net_t *src_net, *dst_net; - pcb_net_term_t *src_term, *dst_term; - - src_net = e->value; - dst_net = pcb_net_alloc(pcb, dst, src_net->name); - dst_net->export_tmp = src_net->export_tmp; - dst_net->inhibit_rats = src_net->inhibit_rats; - pcb_attribute_copy_all(&dst_net->Attributes, &src_net->Attributes); - - for(src_term = pcb_termlist_first(&src_net->conns); src_term != NULL; src_term = pcb_termlist_next(src_term)) { - dst_term = pcb_net_term_alloc(dst_net, src_term->refdes, src_term->term); - pcb_attribute_copy_all(&dst_term->Attributes, &src_term->Attributes); - } - } -} - -/* Return the (most natural) copper group the obj is in */ -static pcb_layergrp_id_t get_side_group(pcb_board_t *pcb, pcb_any_obj_t *obj) -{ - switch(obj->type) { - case PCB_OBJ_ARC: - case PCB_OBJ_LINE: - case PCB_OBJ_POLY: - case PCB_OBJ_TEXT: - return pcb_layer_get_group_(obj->parent.layer); - case PCB_OBJ_PSTK: - if (pcb_pstk_shape((pcb_pstk_t *)obj, PCB_LYT_COPPER | PCB_LYT_TOP, 0) != NULL) - return pcb_layergrp_get_top_copper(); - if (pcb_pstk_shape((pcb_pstk_t *)obj, PCB_LYT_COPPER | PCB_LYT_BOTTOM, 0) != NULL) - return pcb_layergrp_get_bottom_copper(); - default: return -1; - } -} - -static pcb_rat_t *pcb_net_create_by_rat_(pcb_board_t *pcb, pcb_coord_t x1, pcb_coord_t y1, pcb_coord_t x2, pcb_coord_t y2, pcb_any_obj_t *o1, pcb_any_obj_t *o2, pcb_bool interactive) -{ - pcb_subc_t *sc1, *sc2, *sctmp; - pcb_net_t *net1 = NULL, *net2 = NULL, *ntmp, *target_net = NULL; - pcb_layergrp_id_t group1, group2; - pcb_rat_t *res; - static long netname_cnt = 0; - char ratname_[32], *ratname, *id; - long old_len, new_len; - - if ((o1 == o2) || (o1 == NULL) || (o2 == NULL)) { - pcb_message(PCB_MSG_ERROR, "Missing start or end terminal\n"); - return NULL; - } - - { /* make sure at least one of the terminals is not on a net */ - pcb_net_term_t *term1, *term2; - - sc1 = pcb_obj_parent_subc(o1); - sc2 = pcb_obj_parent_subc(o2); - if ((sc1 == NULL) || (sc2 == NULL) || (sc1->refdes == NULL) || (sc2->refdes == NULL)) { - pcb_message(PCB_MSG_ERROR, "Both start or end terminal must be in a subcircuit with refdes\n"); - return NULL; - } - - term1 = pcb_net_find_by_refdes_term(&pcb->netlist[PCB_NETLIST_EDITED], sc1->refdes, o1->term); - term2 = pcb_net_find_by_refdes_term(&pcb->netlist[PCB_NETLIST_EDITED], sc2->refdes, o2->term); - if (term1 != NULL) net1 = term1->parent.net; - if (term2 != NULL) net1 = term2->parent.net; - - if ((net1 == net2) && (net1 != NULL)) { - pcb_message(PCB_MSG_ERROR, "Those terminals are already on the same net (%s)\n", net1->name); - return NULL; - } - if ((net1 != NULL) && (net2 != NULL)) { - pcb_message(PCB_MSG_ERROR, "Can not connect two existing nets with a rat (%s and %s)\n", net1->name, net2->name); - return NULL; - } - } - - /* swap vars so it's always o1 is off-net (and o2 may be in a net) */ - if (net1 != NULL) { - pcb_any_obj_t *otmp; - otmp = o1; o1 = o2; o2 = otmp; - sctmp = sc1; sc1 = sc2; sc2 = sctmp; - ntmp = net1; net1 = net2; net2 = ntmp; - } - - group1 = get_side_group(pcb, o1); - group2 = get_side_group(pcb, o2); - if ((group1 == -1) && (group2 == -1)) { - pcb_message(PCB_MSG_ERROR, "Can not determine copper layer group of that terminal\n"); - return NULL; - } - - /* passed all sanity checks, o1 is off-net; figure the target_net (create it if needed) */ - if ((net1 == NULL) && (net2 == NULL)) { - do { - sprintf(ratname_, "pcbrnd%ld", ++netname_cnt); - } while(htsp_has(&pcb->netlist[PCB_NETLIST_EDITED], ratname_)); - if (interactive) { - ratname = pcb_hid_prompt_for("Name of the new net", ratname_, "rat net name"); - if (ratname == NULL) /* cancel */ - return NULL; - } - else - ratname = ratname_; - target_net = pcb_net_get(pcb, &pcb->netlist[PCB_NETLIST_EDITED], ratname, 1); - - assert(target_net != NULL); - if (ratname != ratname_) - free(ratname); - } - else - target_net = net2; - - /* create the rat and add terminals in the target_net */ - res = pcb_rat_new(pcb->Data, -1, x1, y1, x2, y2, group1, group2, conf_core.appearance.rat_thickness, pcb_no_flags(), o1, o2); - - old_len = pcb_termlist_length(&target_net->conns); - pcb_net_term_get(target_net, sc1->refdes, o1->term, 1); - new_len = pcb_termlist_length(&target_net->conns); - if (new_len != old_len) { - id = pcb_concat(sc1->refdes, "-", o1->term, NULL); - pcb_ratspatch_append(pcb, RATP_ADD_CONN, id, target_net->name, NULL); - free(id); - } - - old_len = new_len; - pcb_net_term_get(target_net, sc2->refdes, o2->term, 1); - new_len = pcb_termlist_length(&target_net->conns); - if (new_len != old_len) { - id = pcb_concat(sc2->refdes, "-", o2->term, NULL); - pcb_ratspatch_append(pcb, RATP_ADD_CONN, id, target_net->name, NULL); - free(id); - } - - pcb_netlist_changed(0); - return res; -} - -static pcb_any_obj_t *find_rat_end(pcb_board_t *pcb, pcb_coord_t x, pcb_coord_t y, const char *loc) -{ - void *ptr1, *ptr2, *ptr3; - pcb_any_obj_t *o; - pcb_objtype_t type = pcb_search_obj_by_location(PCB_OBJ_CLASS_TERM | PCB_OBJ_SUBC_PART, &ptr1, &ptr2, &ptr3, x, y, 5); - pcb_subc_t *sc; - - o = ptr2; - if ((type == PCB_OBJ_VOID) || (o->term == NULL)) { - pcb_message(PCB_MSG_ERROR, "Can't find a terminal at %s\n", loc); - return NULL; - } - - sc = pcb_obj_parent_subc(o); - if ((sc == NULL) || (sc->refdes == NULL)) { - pcb_message(PCB_MSG_ERROR, "The terminal terminal found at %s is not part of a subc with refdes\n", loc); - return NULL; - } - - return o; -} - -pcb_rat_t *pcb_net_create_by_rat_coords(pcb_board_t *pcb, pcb_coord_t x1, pcb_coord_t y1, pcb_coord_t x2, pcb_coord_t y2, pcb_bool interactive) -{ - pcb_any_obj_t *os, *oe; - if ((x1 == x2) && (y1 == y2)) - return NULL; - - os = find_rat_end(pcb, x1, y1, "rat line start"); - oe = find_rat_end(pcb, x2, y2, "rat line end"); - - return pcb_net_create_by_rat_(pcb, x1, y1, x2, y2, os, oe, interactive); -} - - -pcb_cardinal_t pcb_net_ripup(pcb_board_t *pcb, pcb_net_t *net) -{ - pcb_find_t fctx; - pcb_net_term_t *t; - pcb_cardinal_t res, n; - pcb_any_obj_t *o, *lasto; - pcb_data_it_t it; - int first = 0; - - memset(&fctx, 0, sizeof(fctx)); - fctx.only_mark_rats = 1; /* do not trust rats, but do mark them */ - - for(t = pcb_termlist_first(&net->conns), n = 0; t != NULL; t = pcb_termlist_next(t), n++) - pcb_net_term_crawl(pcb, t, &fctx, &first, NULL); - - pcb_undo_save_serial(); - pcb_draw_inhibit_inc(); - - /* always remove the (n-1)th object; removing the current iterator object - confuses the iteration */ - res = 0; - lasto = NULL; - o = pcb_data_first(&it, pcb->Data, PCB_OBJ_CLASS_REAL & (~PCB_OBJ_SUBC)); - for(;;) { - if ((lasto != NULL) && (PCB_DFLAG_TEST(&lasto->Flags, fctx.mark))) { - pcb_remove_object(lasto->type, lasto->parent.any, lasto, lasto); - res++; - } - lasto = o; - if (lasto == NULL) - break; - o = pcb_data_next(&it); - } - - pcb_undo_restore_serial(); - if (res > 0) - pcb_undo_inc_serial(); - - pcb_draw_inhibit_dec(); - pcb_find_free(&fctx); - return res; -} Index: trunk/src/netlist2.h =================================================================== --- trunk/src/netlist2.h (revision 26975) +++ trunk/src/netlist2.h (nonexistent) @@ -1,191 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2019 Tibor 'Igor2' Palinkas - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Contact: - * Project page: http://repo.hu/projects/pcb-rnd - * lead developer: http://repo.hu/projects/pcb-rnd/contact.html - * mailing list: pcb-rnd (at) list.repo.hu (send "subscribe") - */ - -#ifndef PCB_NETLIST2_H -#define PCB_NETLIST2_H - -#include -#include -#include -#include "board.h" -#include "obj_common.h" - -struct pcb_net_term_s { - PCB_ANY_OBJ_FIELDS; - char *refdes; - char *term; - gdl_elem_t link; /* a net is mainly an ordered list of terminals */ -}; - -typedef enum { /* bitfield */ - PCB_RATACC_PRECISE = 1, /* find the shortest rats, precisely (expensive); if unset, use a simplified algo e.g. considering only endpoints of lines */ - PCB_RATACC_ONLY_MANHATTAN = 2, /* the old autorouter doesn't like non-manhattan lines and arcs */ - PCB_RATACC_ONLY_SELECTED = 4, - PCB_RATACC_INFO = 8 /* print INFO messages in the log about how many rats are to go */ -} pcb_rat_accuracy_t; - -/* List of refdes-terminals */ -#define TDL(x) pcb_termlist_ ## x -#define TDL_LIST_T pcb_termlist_t -#define TDL_ITEM_T pcb_net_term_t -#define TDL_FIELD link -#define TDL_SIZE_T size_t -#define TDL_FUNC - -#define pcb_termlist_foreach(list, iterator, loop_elem) \ - gdl_foreach_((&((list)->lst)), (iterator), (loop_elem)) - - -#include -#include - - -struct pcb_net_s { - PCB_ANY_OBJ_FIELDS; - char *name; - pcb_cardinal_t export_tmp; /* filled in and used by export code; valid only until the end of exporting */ - unsigned inhibit_rats:1; - pcb_termlist_t conns; -}; - - -/* Initialize an empty netlist */ -void pcb_netlist_init(pcb_netlist_t *nl); - -/* Free all memory (including nets and terminals) of a netlist */ -void pcb_netlist_uninit(pcb_netlist_t *nl); - -/* Copy all fields from src to dst, assuming dst is empty */ -void pcb_netlist_copy(pcb_board_t *pcb, pcb_netlist_t *dst, pcb_netlist_t *src); - -/* Look up (or allocate) a net by name within a netlist. Returns NULL on error */ -pcb_net_t *pcb_net_get(pcb_board_t *pcb, pcb_netlist_t *nl, const char *netname, pcb_bool alloc); -pcb_net_t *pcb_net_get_icase(pcb_board_t *pcb, pcb_netlist_t *nl, const char *name); /* read-only, case-insnensitive */ -pcb_net_t *pcb_net_get_regex(pcb_board_t *pcb, pcb_netlist_t *nl, const char *regex); -pcb_net_t *pcb_net_get_user(pcb_board_t *pcb, pcb_netlist_t *nl, const char *name_or_rx); /* run all three above in order, until one succeeds */ - - -/* Remove a net from a netlist by namel returns 0 on removal, -1 on error */ -int pcb_net_del(pcb_netlist_t *nl, const char *netname); - -/* Look up (or allocate) a terminal within a net. Pinname is "refdes-termid". - Returns NULL on error */ -pcb_net_term_t *pcb_net_term_get(pcb_net_t *net, const char *refdes, const char *term, pcb_bool alloc); -pcb_net_term_t *pcb_net_term_get_by_obj(pcb_net_t *net, const pcb_any_obj_t *obj); -pcb_net_term_t *pcb_net_term_get_by_pinname(pcb_net_t *net, const char *pinname, pcb_bool alloc); - -/* Remove term from its net and free all fields and term itself */ -int pcb_net_term_del(pcb_net_t *net, pcb_net_term_t *term); -int pcb_net_term_del_by_name(pcb_net_t *net, const char *refdes, const char *term); - - -/* Crawl a net and clear&set flags on each object belonging to the net - and. Return the number of objects found */ -pcb_cardinal_t pcb_net_crawl_flag(pcb_board_t *pcb, pcb_net_t *net, unsigned long setf, unsigned long clrf); - - -/* Slow, linear search for a terminal, by pinname ("refdes-pinnumber") or - separate refdes and terminal ID. */ -pcb_net_term_t *pcb_net_find_by_pinname(const pcb_netlist_t *nl, const char *pinname); -pcb_net_term_t *pcb_net_find_by_refdes_term(const pcb_netlist_t *nl, const char *refdes, const char *term); -pcb_net_term_t *pcb_net_find_by_obj(const pcb_netlist_t *nl, const pcb_any_obj_t *obj); - -/* Create an alphabetic sorted, NULL terminated array from the nets; - the return value is valid until any change to nl and should be free'd - by the caller. Pointers in the array are the same as in the has table, - should not be free'd. */ -pcb_net_t **pcb_netlist_sort(pcb_netlist_t *nl); - -/* Create missing rat lines */ -pcb_cardinal_t pcb_net_add_rats(const pcb_board_t *pcb, pcb_net_t *net, pcb_rat_accuracy_t acc); -pcb_cardinal_t pcb_net_add_all_rats(const pcb_board_t *pcb, pcb_rat_accuracy_t acc); - -/* Create a new network or a new net connection by drawing a rat line between two terminals */ -pcb_rat_t *pcb_net_create_by_rat_coords(pcb_board_t *pcb, pcb_coord_t x1, pcb_coord_t y1, pcb_coord_t x2, pcb_coord_t y2, pcb_bool interactive); - -/* Undoably remove all non-subc-part copper objects that are connected to net. - Return the number of removals. */ -pcb_cardinal_t pcb_net_ripup(pcb_board_t *pcb, pcb_net_t *net); - -void pcb_netlist_changed(int force_unfreeze); - -pcb_bool pcb_net_name_valid(const char *netname); - -/*** subnet mapping ***/ - -typedef struct { - const pcb_board_t *pcb; - pcb_net_t *current_net; - htsp_t found; - pcb_cardinal_t changed, missing, num_shorts; -} pcb_short_ctx_t; - -void pcb_net_short_ctx_init(pcb_short_ctx_t *sctx, const pcb_board_t *pcb, pcb_net_t *net); -void pcb_net_short_ctx_uninit(pcb_short_ctx_t *sctx); - -/* Search and collect all subnets of a net, adding rat lines in between them. - Caller provided subnets is a vector of vtp0_t items that each contain - (pcb_any_obj_t *) pointers to subnet objects */ -pcb_cardinal_t pcb_net_map_subnets(pcb_short_ctx_t *sctx, pcb_rat_accuracy_t acc, vtp0_t *subnets); - -void pcb_net_reset_subnets(vtp0_t *subnets); /* clear the subnet list to zero items, but don't free the array ("malloc cache") */ -void pcb_net_free_subnets(vtp0_t *subnets); /* same as reset but also free the array */ - - - -/*** looping ***/ - -typedef struct pcb_net_it_s { - pcb_netlist_t *nl; - htsp_entry_t *next; -} pcb_net_it_t; - -PCB_INLINE pcb_net_t *pcb_net_next(pcb_net_it_t *it) -{ - pcb_net_t *res; - if (it->next == NULL) - return NULL; - res = it->next->value; - it->next = htsp_next(it->nl, it->next); - return res; -} - -PCB_INLINE pcb_net_t *pcb_net_first(pcb_net_it_t *it, pcb_netlist_t *nl) -{ - it->nl = nl; - it->next = htsp_first(nl); - return pcb_net_next(it); -} - -/*** Internal ***/ -void pcb_net_free_fields(pcb_net_t *net); -void pcb_net_free(pcb_net_t *net); -void pcb_net_term_free_fields(pcb_net_term_t *term); -void pcb_net_term_free(pcb_net_term_t *term); - -void pcb_netlist_geo_init(void); - -#endif Index: trunk/src/Makefile.dep =================================================================== --- trunk/src/Makefile.dep (revision 26975) +++ trunk/src/Makefile.dep (revision 26976) @@ -134,7 +134,7 @@ ../src_3rd/liblihata/lihata.h list_conf.h conf_core.h obj_pstk_inlines.h \ data.h thermal.h polygon1_gen.h \ ../src_plugins/lib_compat_help/pstk_compat.h obj_pstk.h \ - ../src_plugins/lib_netmap/netmap.h netlist2.h dolists.h + ../src_plugins/lib_netmap/netmap.h netlist.h dolists.h ../src_plugins/asm/asm.o: ../src_plugins/asm/asm.c ../config.h \ ../src_3rd/genvector/gds_char.h ../src_3rd/genvector/genvector_impl.h \ ../src_3rd/genvector/genvector_undef.h ../src_3rd/genlist/gendlist.h \ @@ -229,7 +229,7 @@ ../src_3rd/genht/ht.h ../src_3rd/genht/hash.h obj_pstk_list.h obj_pstk.h \ ../src_3rd/genvector/vtp0.h vtpadstack.h obj_pstk_shape.h polygon.h \ vtpadstack_t.h draw.h error.h layer.h intersect.h rtree.h macro.h move.h \ - netlist2.h remove.h rotate.h compat_misc.h obj_rat.h obj_term.h \ + netlist.h remove.h rotate.h compat_misc.h obj_rat.h obj_term.h \ obj_pstk_inlines.h data.h thermal.h polygon1_gen.h data_it.h ../src_plugins/autoroute/action.o: ../src_plugins/autoroute/action.c \ ../config.h ../src_plugins/autoroute/autoroute.h board.h \ @@ -272,7 +272,7 @@ ../src_3rd/genht/ht.h ../src_3rd/genht/hash.h obj_pstk_list.h obj_pstk.h \ vtpadstack.h obj_pstk_shape.h polygon.h vtpadstack_t.h macro.h \ ../src_plugins/autoroute/autoroute.h board.h vtroutestyle.h rats_patch.h \ - board.h hidlib.h box.h draw.h error.h find.h heap.h rtree.h netlist2.h \ + board.h hidlib.h box.h draw.h error.h find.h heap.h rtree.h netlist.h \ ../src_plugins/autoroute/mtspace.h ../src_plugins/autoroute/vector.h \ polygon.h remove.h obj_pinvia_therm.h undo.h ../src_3rd/libuundo/uundo.h \ undo_old.h pcb-printf.h layer.h obj_line_draw.h draw.h obj_pstk_draw.h \ @@ -465,7 +465,7 @@ buffer.h obj_rat_list.h obj_rat.h idpath.h obj_subc_list.h obj_subc.h \ ../src_3rd/libminuid/libminuid.h ht_subc.h ../src_3rd/genht/ht.h \ obj_pstk_list.h obj_pstk.h vtpadstack.h draw.h obj_term.h rtree.h \ - search.h search_r.h netlist2.h ../src_plugins/dialogs/dlg_search.h \ + search.h search_r.h netlist.h ../src_plugins/dialogs/dlg_search.h \ ../src_plugins/dialogs/dlg_undo.c ../src_3rd/libuundo/uundo.h event.h \ undo.h undo_old.h ../src_plugins/dialogs/dlg_netlist.c \ ../src_plugins/dialogs/dlg_plugins.c \ @@ -1086,7 +1086,7 @@ vtpadstack_t.h error.h buffer.h change.h draw.h undo.h \ ../src_3rd/libuundo/uundo.h undo_old.h pcb-printf.h polygon.h \ compat_misc.h layer.h safe_fs.h conf.h pcb-printf.h \ - ../src_3rd/liblihata/lihata.h list_conf.h netlist2.h hid.h hid_nogui.h \ + ../src_3rd/liblihata/lihata.h list_conf.h netlist.h hid.h hid_nogui.h \ actions.h hid_init.h ../src_3rd/puplug/puplug.h ../src_3rd/puplug/libs.h \ ../src_3rd/puplug/os_dep.h ../src_3rd/puplug/config.h \ ../src_3rd/puplug/libs.h hid_attrib.h hid_cam.h hid_attrib.h plugins.h \ @@ -1300,7 +1300,7 @@ ../src_3rd/genvector/vtp0.h vtpadstack.h obj_pstk_shape.h polygon.h \ vtpadstack_t.h safe_fs.h conf.h pcb-printf.h \ ../src_3rd/liblihata/lihata.h list_conf.h conf_core.h hidlib_conf.h \ - compat_misc.h netlist2.h math_helper.h layer.h obj_arc.h obj_line.h \ + compat_misc.h netlist.h math_helper.h layer.h obj_arc.h obj_line.h \ obj_poly.h obj_subc.h obj_pstk.h obj_pstk_inlines.h data.h thermal.h \ polygon1_gen.h hid.h hid_nogui.h hid_cam.h hid_attrib.h hid_attrib.h \ hid_init.h ../src_3rd/puplug/puplug.h ../src_3rd/puplug/libs.h \ @@ -1556,7 +1556,7 @@ obj_subc_list.h obj_subc.h ../src_3rd/libminuid/libminuid.h rtree.h \ ../src_3rd/genrtree/genrtree_api.h rtree2_compat.h ht_subc.h \ ../src_3rd/genht/ht.h obj_pstk_list.h obj_pstk.h vtpadstack.h \ - obj_pstk_shape.h polygon.h vtpadstack_t.h data_it.h data.h netlist2.h \ + obj_pstk_shape.h polygon.h vtpadstack_t.h data_it.h data.h netlist.h \ plugins.h ../src_3rd/puplug/puplug.h ../src_3rd/puplug/libs.h \ ../src_3rd/puplug/os_dep.h ../src_3rd/puplug/config.h \ ../src_3rd/puplug/libs.h ../src_3rd/puplug/error.h pcb-printf.h \ @@ -1713,7 +1713,7 @@ ../src_3rd/puplug/libs.h ../src_3rd/puplug/os_dep.h \ ../src_3rd/puplug/config.h ../src_3rd/puplug/libs.h \ ../src_3rd/puplug/error.h compat_misc.h obj_pstk_inlines.h thermal.h \ - polygon1_gen.h obj_subc_op.h operation.h layer.h netlist2.h safe_fs.h \ + polygon1_gen.h obj_subc_op.h operation.h layer.h netlist.h safe_fs.h \ macro.h operation.h ../src_plugins/export_xy/xy_conf.h conf.h hid.h \ hid_nogui.h hid_attrib.h hid_cam.h hid_attrib.h hid_init.h \ ../src_plugins/lib_compat_help/elem_rot.h \ @@ -2310,7 +2310,7 @@ ../src_3rd/genrtree/genrtree_api.h rtree2_compat.h ht_subc.h \ ../src_3rd/genht/ht.h ../src_3rd/genht/hash.h obj_pstk_list.h obj_pstk.h \ ../src_3rd/genvector/vtp0.h vtpadstack.h obj_pstk_shape.h polygon.h \ - vtpadstack_t.h find.h netlist2.h board.h vtroutestyle.h rats_patch.h \ + vtpadstack_t.h find.h netlist.h board.h vtroutestyle.h rats_patch.h \ hidlib.h select.h operation.h undo.h ../src_3rd/libuundo/uundo.h \ undo_old.h remove.h crosshair.h draw.h event.h fptr_cast.h hid.h \ actions.h ../src_plugins/hid_lesstif/lesstif.h hid_cfg_input.h hid_cfg.h \ @@ -2456,7 +2456,7 @@ ../src_3rd/genrtree/genrtree_api.h rtree2_compat.h ht_subc.h \ ../src_3rd/genht/ht.h ../src_3rd/genht/hash.h obj_pstk_list.h obj_pstk.h \ ../src_3rd/genvector/vtp0.h vtpadstack.h obj_pstk_shape.h polygon.h \ - vtpadstack_t.h error.h netlist2.h plugins.h ../src_3rd/puplug/puplug.h \ + vtpadstack_t.h error.h netlist.h plugins.h ../src_3rd/puplug/puplug.h \ ../src_3rd/puplug/libs.h ../src_3rd/puplug/os_dep.h \ ../src_3rd/puplug/config.h ../src_3rd/puplug/libs.h \ ../src_3rd/puplug/error.h compat_misc.h safe_fs.h conf.h pcb-printf.h \ @@ -2695,7 +2695,7 @@ ../src_3rd/genrtree/genrtree_api.h rtree2_compat.h ht_subc.h \ ../src_3rd/genht/ht.h ../src_3rd/genht/hash.h obj_pstk_list.h obj_pstk.h \ vtpadstack.h obj_pstk_shape.h polygon.h vtpadstack_t.h rats_patch.h \ - compat_misc.h paths.h safe_fs.h macro.h netlist2.h + compat_misc.h paths.h safe_fs.h macro.h netlist.h ../src_plugins/import_sch/import_sch.o: \ ../src_plugins/import_sch/import_sch.c ../config.h conf_core.h conf.h \ global_typedefs.h pcb_bool.h pcb-printf.h \ @@ -2853,7 +2853,7 @@ rats_patch.h board.h hidlib.h plug_io.h conf.h pcb-printf.h \ ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/dom.h \ ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ - ../src_3rd/genvector/vtp0.h list_conf.h error.h netlist2.h data.h \ + ../src_3rd/genvector/vtp0.h list_conf.h error.h netlist.h data.h \ crosshair.h vtonpoint.h hid.h error.h route.h buffer.h \ ../src_3rd/libfungw/fungw.h ../src_3rd/genht/htpp.h obj_rat_list.h \ obj_rat.h idpath.h obj_subc_list.h obj_subc.h \ @@ -2903,7 +2903,7 @@ ../src_3rd/genvector/vtp0.h vtpadstack.h obj_pstk_shape.h polygon.h \ vtpadstack_t.h plug_io.h conf.h pcb-printf.h \ ../src_3rd/liblihata/lihata.h list_conf.h error.h pcb_bool.h safe_fs.h \ - compat_misc.h layer_grp.h conf_core.h math_helper.h actions.h netlist2.h \ + compat_misc.h layer_grp.h conf_core.h math_helper.h actions.h netlist.h \ polygon_offs.h ../src_plugins/io_dsn/read.h ../src_plugins/io_dsn/write.o: ../src_plugins/io_dsn/write.c ../config.h \ plug_io.h global_typedefs.h pcb_bool.h conf.h pcb-printf.h \ @@ -2927,7 +2927,7 @@ ../src_3rd/genht/ht.h ../src_3rd/genht/hash.h obj_pstk_list.h obj_pstk.h \ vtpadstack.h obj_pstk_shape.h polygon.h vtpadstack_t.h layer.h \ layer_grp.h ../src_plugins/io_dsn/write.h \ - ../src_plugins/lib_netmap/netmap.h netlist2.h + ../src_plugins/lib_netmap/netmap.h netlist.h ../src_plugins/io_eagle/eagle_bin.o: ../src_plugins/io_eagle/eagle_bin.c \ ../config.h ../src_plugins/io_eagle/eagle_bin.h \ ../src_plugins/io_eagle/egb_tree.h ../src_3rd/genht/htss.h \ @@ -3125,7 +3125,7 @@ ../src_3rd/genht/ht.h ../src_3rd/genht/hash.h obj_pstk_list.h obj_pstk.h \ vtpadstack.h obj_pstk_shape.h polygon.h vtpadstack_t.h compat_misc.h \ polygon.h obj_subc_parent.h data.h obj_pstk_inlines.h thermal.h \ - polygon1_gen.h ../src_plugins/lib_netmap/netmap.h netlist2.h \ + polygon1_gen.h ../src_plugins/lib_netmap/netmap.h netlist.h \ funchash_core.h funchash.h funchash_core_list.h ../src_3rd/genht/htpi.h ../src_plugins/io_kicad/io_kicad.o: ../src_plugins/io_kicad/io_kicad.c \ ../config.h plugins.h ../src_3rd/puplug/puplug.h \ @@ -3190,7 +3190,7 @@ vtpadstack.h obj_pstk_shape.h polygon.h vtpadstack_t.h \ ../src_plugins/io_kicad/read.h layer.h polygon.h plug_footprint.h \ vtlibrary.h data.h misc_util.h conf_core.h move.h macro.h rotate.h \ - compat_misc.h safe_fs.h attrib.h netlist2.h math_helper.h \ + compat_misc.h safe_fs.h attrib.h netlist.h math_helper.h \ obj_pstk_inlines.h thermal.h polygon1_gen.h \ ../src_plugins/lib_compat_help/pstk_compat.h obj_pstk.h \ ../src_plugins/lib_compat_help/pstk_help.h \ @@ -3249,7 +3249,7 @@ ../src_3rd/genrtree/genrtree_api.h rtree2_compat.h ht_subc.h \ ../src_3rd/genht/ht.h ../src_3rd/genht/hash.h obj_pstk_list.h obj_pstk.h \ vtpadstack.h obj_pstk_shape.h polygon.h vtpadstack_t.h \ - ../src_plugins/io_kicad/write.h layer.h netlist2.h obj_pstk_inlines.h \ + ../src_plugins/io_kicad/write.h layer.h netlist.h obj_pstk_inlines.h \ data.h thermal.h polygon1_gen.h funchash_core.h funchash.h \ funchash_core_list.h ../src_plugins/lib_compat_help/pstk_compat.h \ obj_pstk.h @@ -3300,7 +3300,7 @@ ../src_3rd/genrtree/genrtree_api.h rtree2_compat.h ht_subc.h \ ../src_3rd/genht/ht.h ../src_3rd/genht/hash.h obj_pstk_list.h obj_pstk.h \ vtpadstack.h obj_pstk_shape.h polygon.h vtpadstack_t.h \ - ../src_plugins/io_kicad_legacy/write.h layer.h netlist2.h macro.h \ + ../src_plugins/io_kicad_legacy/write.h layer.h netlist.h macro.h \ obj_pstk_inlines.h data.h thermal.h polygon1_gen.h \ ../src_plugins/io_kicad_legacy/../io_kicad/uniq_name.h \ ../src_plugins/lib_compat_help/pstk_compat.h obj_pstk.h @@ -3372,7 +3372,7 @@ pcb_minuid.h thermal.h polygon1_gen.h \ ../src_plugins/io_lihata/io_lihata.h conf.h \ ../src_plugins/io_lihata/lht_conf.h safe_fs.h plug_footprint.h \ - vtlibrary.h data.h vtpadstack.h obj_pstk_inlines.h thermal.h netlist2.h \ + vtlibrary.h data.h vtpadstack.h obj_pstk_inlines.h thermal.h netlist.h \ ../src_plugins/lib_compat_help/subc_help.h \ ../src_plugins/lib_compat_help/pstk_compat.h obj_pstk.h \ ../src_plugins/lib_compat_help/elem_rot.h @@ -3406,7 +3406,7 @@ ../src_3rd/liblhtpers/lhtpers.h ../src_plugins/io_lihata/io_lihata.h \ conf.h ../src_plugins/io_lihata/lht_conf.h paths.h obj_subc_list.h \ pcb_minuid.h safe_fs.h thermal.h polygon1_gen.h funchash_core.h \ - funchash.h funchash_core_list.h netlist2.h hid_dad.h compat_misc.h \ + funchash.h funchash_core_list.h netlist.h hid_dad.h compat_misc.h \ hid_attrib.h hid_dad_spin.h ../src_plugins/lib_compat_help/pstk_compat.h \ obj_pstk.h ../src_plugins/io_lihata/write_style.o: \ @@ -3490,7 +3490,7 @@ polygon1_gen.h remove.h flag_str.h compat_fs.h compat_misc.h paths.h \ rats_patch.h actions.h ../src_plugins/io_pcb/attribs.h route_style.h \ obj_poly.h thermal.h polygon1_gen.h event.h macro.h funchash_core.h \ - funchash.h funchash_core_list.h netlist2.h \ + funchash.h funchash_core_list.h netlist.h \ ../src_plugins/lib_compat_help/layer_compat.h \ ../src_plugins/lib_compat_help/pstk_compat.h obj_pstk.h \ ../src_plugins/lib_compat_help/subc_help.h obj_subc.h \ @@ -3565,7 +3565,7 @@ ../src_plugins/io_pcb/file.h plug_io.h ../src_plugins/io_pcb/parse_l.h \ polygon.h remove.h rtree.h flag_str.h obj_pinvia_therm.h rats_patch.h \ route_style.h compat_misc.h ../src_plugins/lib_compat_help/pstk_compat.h \ - obj_pstk.h netlist2.h ../src_plugins/io_pcb/parse_y.h + obj_pstk.h netlist.h ../src_plugins/io_pcb/parse_y.h ../src_plugins/io_tedax/footprint.o: ../src_plugins/io_tedax/footprint.c \ ../config.h ../src_3rd/genht/htsp.h ../src_3rd/genht/ht.h \ ../src_3rd/genht/htip.h ../src_3rd/genht/hash.h \ @@ -3733,7 +3733,7 @@ ../src_3rd/genvector/vtp0.h vtpadstack.h obj_pstk_shape.h polygon.h \ vtpadstack_t.h error.h pcb-printf.h compat_misc.h actions.h safe_fs.h \ conf.h pcb-printf.h ../src_3rd/liblihata/lihata.h list_conf.h obj_subc.h \ - netlist2.h ../src_plugins/io_tedax/tnetlist.h \ + netlist.h ../src_plugins/io_tedax/tnetlist.h \ ../src_plugins/io_tedax/parse.h ../src_plugins/jostle/jostle.o: ../src_plugins/jostle/jostle.c \ ../config.h board.h ../src_3rd/genht/htsp.h ../src_3rd/genht/ht.h \ @@ -4629,7 +4629,7 @@ data.h crosshair.h buffer.h ../src_3rd/libfungw/fungw.h obj_rat_list.h \ obj_rat.h idpath.h obj_subc_list.h obj_subc.h ht_subc.h \ ../src_3rd/genht/ht.h ../src_3rd/genht/hash.h obj_pstk_list.h obj_pstk.h \ - vtpadstack.h obj_pstk_shape.h polygon.h vtpadstack_t.h netlist2.h \ + vtpadstack.h obj_pstk_shape.h polygon.h vtpadstack_t.h netlist.h \ ../src_plugins/lib_hid_pcbui/status.h event.h conf.h actions.h ../src_plugins/lib_hid_pcbui/toolbar.o: \ ../src_plugins/lib_hid_pcbui/toolbar.c ../config.h \ @@ -4662,7 +4662,7 @@ obj_line_list.h obj_line.h obj_poly_list.h obj_poly.h polyarea.h \ obj_text_list.h obj_text.h font.h ../src_3rd/genht/htip.h box.h \ math_helper.h misc_util.h ../src_3rd/genvector/gds_char.h layer_grp.h \ - rats_patch.h board.h hidlib.h netlist2.h ../src_3rd/genvector/vtp0.h \ + rats_patch.h board.h hidlib.h netlist.h ../src_3rd/genvector/vtp0.h \ data.h crosshair.h vtonpoint.h hid.h ../src_3rd/liblihata/dom.h \ ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h error.h \ route.h buffer.h ../src_3rd/libfungw/fungw.h obj_rat_list.h obj_rat.h \ @@ -4922,7 +4922,7 @@ undo.h ../src_3rd/libuundo/uundo.h undo_old.h plugins.h \ ../src_3rd/puplug/puplug.h ../src_3rd/puplug/libs.h \ ../src_3rd/puplug/os_dep.h ../src_3rd/puplug/config.h \ - ../src_3rd/puplug/libs.h ../src_3rd/puplug/error.h netlist2.h \ + ../src_3rd/puplug/libs.h ../src_3rd/puplug/error.h netlist.h \ compat_misc.h obj_common.h obj_subc_parent.h data.h \ ../src_plugins/mincut/pcb-mincut/graph.h \ ../src_plugins/mincut/pcb-mincut/../../../config.h \ @@ -4957,7 +4957,7 @@ ../src_3rd/puplug/os_dep.h ../src_3rd/puplug/config.h \ ../src_3rd/puplug/libs.h ../src_3rd/puplug/error.h actions.h \ plug_footprint.h vtlibrary.h data.h obj_subc.h macro.h compat_misc.h \ - netlist2.h dolists.h + netlist.h dolists.h ../src_plugins/order/order.o: ../src_plugins/order/order.c ../config.h \ actions.h hid.h ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ ../src_3rd/liblihata/parser.h ../src_3rd/genht/htsp.h \ @@ -5338,7 +5338,7 @@ ../src_3rd/puplug/os_dep.h ../src_3rd/puplug/config.h \ ../src_3rd/puplug/libs.h ../src_3rd/puplug/error.h actions.h conf_core.h \ conf.h pcb-printf.h ../src_3rd/liblihata/lihata.h list_conf.h \ - compat_misc.h netlist2.h safe_fs.h macro.h pcb-printf.h dolists.h + compat_misc.h netlist.h safe_fs.h macro.h pcb-printf.h dolists.h ../src_plugins/renumber/renumberblock.o: \ ../src_plugins/renumber/renumberblock.c ../config.h board.h \ ../src_3rd/genht/htsp.h ../src_3rd/genht/ht.h global_typedefs.h \ @@ -5415,7 +5415,7 @@ ../src_plugins/report/report_conf.h conf.h compat_misc.h layer.h \ obj_term.h obj_pstk.h obj_pstk_inlines.h thermal.h polygon1_gen.h \ obj_subc_parent.h hid_dad.h compat_misc.h hid_attrib.h hid_dad_spin.h \ - netlist2.h ../src_3rd/genregex/regex_sei.h \ + netlist.h ../src_3rd/genregex/regex_sei.h \ ../src_3rd/genregex/regex_templ.h ../src_3rd/genregex/regex.h dolists.h \ ../src_plugins/report/report_conf_fields.h ../src_plugins/rubberband_orig/fgeometry.o: \ @@ -5682,7 +5682,7 @@ vtpadstack.h obj_pstk_shape.h polygon.h vtpadstack_t.h event.h \ list_common.h obj_line_list.h obj_pstk.h obj_pstk_inlines.h data.h \ thermal.h polygon1_gen.h obj_subc_parent.h pcb-printf.h search.h tool.h \ - layer_ui.h netlist2.h ../src_plugins/sketch_route/sktypedefs.h \ + layer_ui.h netlist.h ../src_plugins/sketch_route/sktypedefs.h \ ../src_plugins/sketch_route/wire.h \ ../src_plugins/sketch_route/cdt/typedefs.h \ ../src_plugins/sketch_route/cdt/list/list.h \ @@ -5757,7 +5757,7 @@ ../src_3rd/genht/ht.h ../src_3rd/genht/hash.h obj_pstk_list.h obj_pstk.h \ ../src_3rd/genvector/vtp0.h vtpadstack.h obj_pstk_shape.h polygon.h \ vtpadstack_t.h hid.h rtree.h undo.h ../src_3rd/libuundo/uundo.h \ - undo_old.h netlist2.h error.h move.h draw.h plugins.h \ + undo_old.h netlist.h error.h move.h draw.h plugins.h \ ../src_3rd/puplug/puplug.h ../src_3rd/puplug/libs.h \ ../src_3rd/puplug/os_dep.h ../src_3rd/puplug/config.h \ ../src_3rd/puplug/libs.h ../src_3rd/puplug/error.h actions.h obj_subc.h \ @@ -6040,7 +6040,7 @@ vtpadstack_t.h conf_core.h conf.h pcb-printf.h \ ../src_3rd/liblihata/lihata.h list_conf.h hidlib_conf.h plug_io.h \ compat_misc.h actions.h paths.h undo.h ../src_3rd/libuundo/uundo.h \ - undo_old.h draw.h event.h safe_fs.h tool.h netlist2.h defpcb_internal.c \ + undo_old.h draw.h event.h safe_fs.h tool.h netlist.h defpcb_internal.c \ obj_pstk_inlines.h thermal.h polygon1_gen.h box.o: box.c ../config.h rotate.h global_typedefs.h pcb_bool.h \ compat_misc.h box.h math_helper.h obj_common.h flag.h globalconst.h \ @@ -6393,7 +6393,7 @@ compat_misc.h hid_init.h ../src_3rd/puplug/puplug.h \ ../src_3rd/puplug/libs.h ../src_3rd/puplug/os_dep.h \ ../src_3rd/puplug/config.h ../src_3rd/puplug/libs.h layer_vis.h \ - safe_fs.h tool.h netlist2.h + safe_fs.h tool.h netlist.h file_loaded.o: file_loaded.c ../config.h ../src_3rd/genht/hash.h \ file_loaded.h ../src_3rd/genht/htsp.h ../src_3rd/genht/ht.h \ compat_misc.h @@ -6857,7 +6857,7 @@ ../src_3rd/puplug/libs.h build_run.h file_loaded.h flag_str.h plugins.h \ ../src_3rd/puplug/error.h plug_footprint.h vtlibrary.h plug_import.h \ event.h funchash.h conf_core.h hidlib_conf.h layer_vis.h layer_ui.h \ - pcb_minuid.h tool.h netlist2.h extobj.h draw.h actions.h actions_pcb.h \ + pcb_minuid.h tool.h netlist.h extobj.h draw.h actions.h actions_pcb.h \ hid_init.h compat_misc.h dolists.h generated_lists.h main_act.o: main_act.c ../config.h undo.h ../src_3rd/libuundo/uundo.h \ undo_old.h global_typedefs.h pcb_bool.h change.h board.h \ @@ -6913,7 +6913,7 @@ select.h operation.h undo.h ../src_3rd/libuundo/uundo.h undo_old.h \ event.h actions.h compat_misc.h obj_arc_op.h obj_line_op.h obj_text_op.h \ obj_subc_op.h obj_poly_op.h obj_pstk_op.h obj_rat_op.h -netlist2.o: netlist2.c ../config.h ../src_3rd/genht/htsp.h \ +netlist.o: netlist.c ../config.h ../src_3rd/genht/htsp.h \ ../src_3rd/genht/ht.h ../src_3rd/genht/hash.h \ ../src_3rd/genregex/regex_sei.h ../src_3rd/genregex/regex_templ.h \ ../src_3rd/genregex/regex.h board.h global_typedefs.h pcb_bool.h \ @@ -6937,7 +6937,7 @@ vtpadstack_t.h data_it.h event.h compat_misc.h find.h obj_term.h \ conf_core.h conf.h pcb-printf.h ../src_3rd/liblihata/lihata.h \ list_conf.h undo.h ../src_3rd/libuundo/uundo.h undo_old.h obj_rat_draw.h \ - obj_subc_parent.h search.h remove.h draw.h netlist2.h \ + obj_subc_parent.h search.h remove.h draw.h netlist.h \ ../src_3rd/genlist/gentdlist_impl.c netlist_geo.c obj_pstk_inlines.h \ thermal.h polygon1_gen.h netlist_act.o: netlist_act.c ../config.h ../src_3rd/genregex/regex_sei.h \ @@ -6963,7 +6963,7 @@ ../src_3rd/genvector/vtp0.h vtpadstack.h obj_pstk_shape.h polygon.h \ vtpadstack_t.h data_it.h board.h vtroutestyle.h rats_patch.h hidlib.h \ plug_io.h conf.h pcb-printf.h ../src_3rd/liblihata/lihata.h list_conf.h \ - actions.h compat_misc.h netlist2.h find.h obj_term.h search.h \ + actions.h compat_misc.h netlist.h find.h obj_term.h search.h \ obj_subc_parent.h obj_arc.o: obj_arc.c ../config.h board.h ../src_3rd/genht/htsp.h \ ../src_3rd/genht/ht.h global_typedefs.h pcb_bool.h vtroutestyle.h unit.h \ @@ -7581,7 +7581,7 @@ ../src_3rd/genht/ht.h ../src_3rd/genht/hash.h obj_pstk_list.h obj_pstk.h \ vtpadstack.h obj_pstk_shape.h polygon.h vtpadstack_t.h undo.h \ ../src_3rd/libuundo/uundo.h undo_old.h find.h remove.h funchash_core.h \ - funchash.h funchash_core_list.h actions.h netlist2.h draw.h \ + funchash.h funchash_core_list.h actions.h netlist.h draw.h \ obj_rat_draw.h rats_patch.o: rats_patch.c rats_patch.h board.h ../config.h \ ../src_3rd/genht/htsp.h ../src_3rd/genht/ht.h global_typedefs.h \ @@ -7606,7 +7606,7 @@ vtpadstack_t.h move.h compat_misc.h safe_fs.h conf.h pcb-printf.h \ ../src_3rd/liblihata/lihata.h list_conf.h funchash_core.h funchash.h \ funchash_core_list.h search.h undo.h ../src_3rd/libuundo/uundo.h \ - undo_old.h conf_core.h netlist2.h + undo_old.h conf_core.h netlist.h remove.o: remove.c ../config.h conf_core.h conf.h global_typedefs.h \ pcb_bool.h pcb-printf.h ../src_3rd/genvector/gds_char.h \ ../src_3rd/genvector/genvector_impl.h \ @@ -7982,7 +7982,7 @@ ../src_3rd/genht/ht.h ../src_3rd/genht/hash.h obj_pstk_list.h obj_pstk.h \ vtpadstack.h obj_pstk_shape.h polygon.h vtpadstack_t.h draw.h \ draw_wireframe.h find.h search.h tool.h undo.h \ - ../src_3rd/libuundo/uundo.h undo_old.h netlist2.h obj_line_draw.h \ + ../src_3rd/libuundo/uundo.h undo_old.h netlist.h obj_line_draw.h \ obj_pstk_draw.h obj_rat_draw.h route_draw.h \ ../src_plugins/lib_compat_help/pstk_compat.h obj_pstk.h tool_lock.o: tool_lock.c ../config.h board.h ../src_3rd/genht/htsp.h \ @@ -8242,7 +8242,7 @@ ../src_3rd/genvector/vtp0.h vtpadstack.h obj_pstk_shape.h polygon.h \ vtpadstack_t.h draw.h move.h insert.h remove.h rotate.h compat_misc.h \ search.h undo.h undo_old.h flag_str.h conf_core.h conf.h pcb-printf.h \ - ../src_3rd/liblihata/lihata.h list_conf.h netlist2.h obj_poly_draw.h \ + ../src_3rd/liblihata/lihata.h list_conf.h netlist.h obj_poly_draw.h \ obj_subc_parent.h brave.h undo_old_str.h unit.o: unit.c ../config.h compat_misc.h unit.h global_typedefs.h \ pcb_bool.h Index: trunk/src/Makefile.in =================================================================== --- trunk/src/Makefile.in (revision 26975) +++ trunk/src/Makefile.in (revision 26976) @@ -178,7 +178,7 @@ main.o main_act.o move.o - netlist2.o + netlist.o netlist_act.o object_act.o obj_common.o Index: trunk/src/board.c =================================================================== --- trunk/src/board.c (revision 26975) +++ trunk/src/board.c (revision 26976) @@ -41,7 +41,7 @@ #include "safe_fs.h" #include "tool.h" #include "layer.h" -#include "netlist2.h" +#include "netlist.h" pcb_board_t *PCB; Index: trunk/src/file_act.c =================================================================== --- trunk/src/file_act.c (revision 26975) +++ trunk/src/file_act.c (revision 26976) @@ -52,7 +52,7 @@ #include "layer_vis.h" #include "safe_fs.h" #include "tool.h" -#include "netlist2.h" +#include "netlist.h" static const char pcb_acts_LoadFrom[] = "LoadFrom(Layout|LayoutToBuffer|SubcToBuffer|Netlist|Revert,filename[,format])"; Index: trunk/src/main.c =================================================================== --- trunk/src/main.c (revision 26975) +++ trunk/src/main.c (revision 26976) @@ -69,7 +69,7 @@ #include "pcb_minuid.h" #include "tool.h" #include "color.h" -#include "netlist2.h" +#include "netlist.h" #include "extobj.h" #include "actions.h" Index: trunk/src/netlist.c =================================================================== --- trunk/src/netlist.c (nonexistent) +++ trunk/src/netlist.c (revision 26976) @@ -0,0 +1,967 @@ +/* + * COPYRIGHT + * + * pcb-rnd, interactive printed circuit board design + * Copyright (C) 2019 Tibor 'Igor2' Palinkas + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Contact: + * Project page: http://repo.hu/projects/pcb-rnd + * lead developer: http://repo.hu/projects/pcb-rnd/contact.html + * mailing list: pcb-rnd (at) list.repo.hu (send "subscribe") + */ + +#include "config.h" +#include +#include +#include +#include + +#include "board.h" +#include "data.h" +#include "data_it.h" +#include "event.h" +#include "compat_misc.h" +#include "layer_grp.h" +#include "find.h" +#include "obj_term.h" +#include "conf_core.h" +#include "undo.h" +#include "obj_rat_draw.h" +#include "obj_subc_parent.h" +#include "search.h" +#include "remove.h" +#include "draw.h" + +#define TDL_DONT_UNDEF +#include "netlist.h" +#include + +void pcb_net_term_free_fields(pcb_net_term_t *term) +{ + pcb_attribute_free(&term->Attributes); + free(term->refdes); + free(term->term); +} + +void pcb_net_term_free(pcb_net_term_t *term) +{ + pcb_net_term_free_fields(term); + free(term); +} + +static pcb_net_term_t *pcb_net_term_alloc(pcb_net_t *net, const char *refdes, const char *term) +{ + pcb_net_term_t *t; + + t = calloc(sizeof(pcb_net_term_t), 1); + t->type = PCB_OBJ_NET_TERM; + t->parent_type = PCB_PARENT_NET; + t->parent.net = net; + t->refdes = pcb_strdup(refdes); + t->term = pcb_strdup(term); + pcb_termlist_append(&net->conns, t); + return t; +} + +pcb_net_term_t *pcb_net_term_get(pcb_net_t *net, const char *refdes, const char *term, pcb_bool alloc) +{ + pcb_net_term_t *t; + + /* for allocation this is slow, O(N^2) algorithm, but other than a few + biggish networks like GND, there won't be too many connections anyway) */ + for(t = pcb_termlist_first(&net->conns); t != NULL; t = pcb_termlist_next(t)) { + if ((strcmp(t->refdes, refdes) == 0) && (strcmp(t->term, term) == 0)) + return t; + } + + if (alloc) + return pcb_net_term_alloc(net, refdes, term); + return NULL; +} + +pcb_net_term_t *pcb_net_term_get_by_obj(pcb_net_t *net, const pcb_any_obj_t *obj) +{ + pcb_data_t *data; + pcb_subc_t *sc; + + if (obj->term == NULL) + return NULL; + + if (obj->parent_type == PCB_PARENT_LAYER) + data = obj->parent.layer->parent.data; + else if (obj->parent_type == PCB_PARENT_DATA) + data = obj->parent.data; + else + return NULL; + + if (data->parent_type != PCB_PARENT_SUBC) + return NULL; + + sc = data->parent.subc; + if (sc->refdes == NULL) + return NULL; + + return pcb_net_term_get(net, sc->refdes, obj->term, pcb_false); +} + +pcb_net_term_t *pcb_net_term_get_by_pinname(pcb_net_t *net, const char *pinname, pcb_bool alloc) +{ + char tmp[256]; + char *pn, *refdes, *term; + int len = strlen(pinname)+1; + pcb_net_term_t *t = NULL; + + if (len <= sizeof(tmp)) { + pn = tmp; + memcpy(pn, pinname, len); + } + else + pn = pcb_strdup(pinname); + + + refdes = pn; + term = strchr(refdes, '-'); + if (term != NULL) { + *term = '\0'; + term++; + t = pcb_net_term_get(net, refdes, term, alloc); + } + + if (pn != tmp) + free(pn); + return t; + +} + + +int pcb_net_term_del(pcb_net_t *net, pcb_net_term_t *term) +{ + pcb_termlist_remove(term); + pcb_net_term_free(term); + return 0; +} + + +int pcb_net_term_del_by_name(pcb_net_t *net, const char *refdes, const char *term) +{ + pcb_net_term_t *t; + + for(t = pcb_termlist_first(&net->conns); t != NULL; t = pcb_termlist_next(t)) + if ((strcmp(t->refdes, refdes) == 0) && (strcmp(t->term, term) == 0)) + return pcb_net_term_del(net, t); + + return -1; +} + +pcb_bool pcb_net_name_valid(const char *netname) +{ + for(;*netname != '\0'; netname++) { + if (isalnum(*netname)) continue; + switch(*netname) { + case '_': + break; + return pcb_false; + } + } + return pcb_true; +} + +static pcb_net_t *pcb_net_alloc(pcb_board_t *pcb, pcb_netlist_t *nl, const char *netname) +{ + pcb_net_t *net; + + net = calloc(sizeof(pcb_net_t), 1); + net->type = PCB_OBJ_NET; + net->parent_type = PCB_PARENT_BOARD; + net->parent.board = pcb; + net->name = pcb_strdup(netname); + htsp_set(nl, net->name, net); + return net; +} + +pcb_net_t *pcb_net_get(pcb_board_t *pcb, pcb_netlist_t *nl, const char *netname, pcb_bool alloc) +{ + pcb_net_t *net; + + if (nl == NULL) + return NULL; + + if (!pcb_net_name_valid(netname)) + return NULL; + + net = htsp_get(nl, netname); + if (net != NULL) + return net; + + if (alloc) + return pcb_net_alloc(pcb, nl, netname); + + return NULL; +} + +pcb_net_t *pcb_net_get_icase(pcb_board_t *pcb, pcb_netlist_t *nl, const char *name) +{ + htsp_entry_t *e; + + for(e = htsp_first(nl); e != NULL; e = htsp_next(nl, e)) { + pcb_net_t *net = e->value; + if (pcb_strcasecmp(name, net->name) == 0) + break; + } + + if (e == NULL) + return NULL; + return e->value; +} + +pcb_net_t *pcb_net_get_regex(pcb_board_t *pcb, pcb_netlist_t *nl, const char *rx) +{ + htsp_entry_t *e; + re_sei_t *regex; + + regex = re_sei_comp(rx); + if (re_sei_errno(regex) != 0) + return NULL; + + for(e = htsp_first(nl); e != NULL; e = htsp_next(nl, e)) { + pcb_net_t *net = e->value; + if (re_sei_exec(regex, net->name)) + break; + } + re_sei_free(regex); + + if (e == NULL) + return NULL; + return e->value; +} + +pcb_net_t *pcb_net_get_user(pcb_board_t *pcb, pcb_netlist_t *nl, const char *name_or_rx) +{ + pcb_net_t *net = pcb_net_get(pcb, nl, name_or_rx, 0); + if (net == NULL) + net = pcb_net_get_icase(pcb, nl, name_or_rx); + if (net == NULL) + net = pcb_net_get_regex(pcb, nl, name_or_rx); + return net; +} + +void pcb_net_free_fields(pcb_net_t *net) +{ + pcb_attribute_free(&net->Attributes); + free(net->name); + for(;;) { + pcb_net_term_t *term = pcb_termlist_first(&net->conns); + if (term == NULL) + break; + pcb_termlist_remove(term); + pcb_net_term_free(term); + } +} + +void pcb_net_free(pcb_net_t *net) +{ + pcb_net_free_fields(net); + free(net); +} + +int pcb_net_del(pcb_netlist_t *nl, const char *netname) +{ + htsp_entry_t *e; + + if (nl == NULL) + return -1; + + e = htsp_getentry(nl, netname); + if (e == NULL) + return -1; + + pcb_net_free(e->value); + + htsp_delentry(nl, e); + return 0; +} + +/* crawl from a single terminal; "first" sould be a pointer to an int + initialized to 0. Returns number of objects found. */ +static pcb_cardinal_t pcb_net_term_crawl(const pcb_board_t *pcb, pcb_net_term_t *term, pcb_find_t *fctx, int *first, pcb_cardinal_t *missing) +{ + pcb_any_obj_t *o; + +/* there can be multiple terminals with the same ID, but it is enough to run find from the first: find.c will consider them all */ + o = pcb_term_find_name(pcb, pcb->Data, PCB_LYT_COPPER, term->refdes, term->term, NULL, NULL); + if (o == NULL) { + if (missing != NULL) + (*missing)++; + return 0; + } + + if ((*first) == 0) { + *first = 1; + return pcb_find_from_obj(fctx, PCB->Data, o); + } + + if (PCB_FIND_IS_MARKED(fctx, o)) + return 0; /* already visited, no need to run 'find' again */ + + return pcb_find_from_obj_next(fctx, PCB->Data, o); +} + +void pcb_net_short_ctx_init(pcb_short_ctx_t *sctx, const pcb_board_t *pcb, pcb_net_t *net) +{ + sctx->pcb = pcb; + sctx->current_net = net; + sctx->changed = 0; + sctx->missing = 0; + sctx->num_shorts = 0; + htsp_init(&sctx->found, strhash, strkeyeq); +} + +void pcb_net_short_ctx_uninit(pcb_short_ctx_t *sctx) +{ + htsp_entry_t *e; + for(e = htsp_first(&sctx->found); e != NULL; e = htsp_next(&sctx->found, e)) + free(e->key); + htsp_uninit(&sctx->found); + if (sctx->changed) { + pcb_gui->invalidate_all(pcb_gui); + conf_core.temp.rat_warn = pcb_true; + } +} + +/* Return 1 if net1-net2 (or net2-net1) is already seen as a short, return 0 + else. Save net1-net2 as seen. */ +static int short_ctx_is_dup(pcb_short_ctx_t *sctx, pcb_net_t *net1, pcb_net_t *net2) +{ + char *key; + int order; + + order = strcmp(net1->name, net2->name); + + if (order == 0) { + pcb_message(PCB_MSG_ERROR, "netlist internal error: short_ctx_is_dup() net %s shorted with itself?!\n", net1->name); + return 1; + } + if (order > 0) + key = pcb_concat(net1->name, "-", net2->name, NULL); + else + key = pcb_concat(net2->name, "-", net1->name, NULL); + + if (htsp_has(&sctx->found, key)) { + free(key); + return 1; + } + + htsp_set(&sctx->found, key, net1); + return 0; +} + +/* Short circuit found between net and an offender object that should not + be part of the net but is connected to the net */ +static void net_found_short(pcb_short_ctx_t *sctx, pcb_any_obj_t *offender) +{ + pcb_subc_t *sc = pcb_obj_parent_subc(offender); + int handled = 0; + + pcb_net_term_t *offt = pcb_net_find_by_refdes_term(&sctx->pcb->netlist[PCB_NETLIST_EDITED], sc->refdes, offender->term); + pcb_net_t *offn = NULL; + const char *offnn = ""; + + if (offt != NULL) { + offn = offt->parent.net; + offnn = offn->name; + if (short_ctx_is_dup(sctx, sctx->current_net, offn)) + return; + } + + if (offnn != NULL) + pcb_message(PCB_MSG_WARNING, "SHORT: net \"%s\" is shorted to \"%s\" at terminal %s-%s\n", sctx->current_net->name, offnn, sc->refdes, offender->term); + else + pcb_message(PCB_MSG_WARNING, "SHORT: net \"%s\" is shorted to terminal %s-%s\n", sctx->current_net->name, sc->refdes, offender->term); + + pcb_event(&PCB->hidlib, PCB_EVENT_NET_INDICATE_SHORT, "pppp", sctx->current_net, offender, offn, &handled); + if (!handled) { + pcb_net_term_t *orig_t = pcb_termlist_first(&sctx->current_net->conns); + pcb_any_obj_t *orig_o = pcb_term_find_name(sctx->pcb, sctx->pcb->Data, PCB_LYT_COPPER, orig_t->refdes, orig_t->term, NULL, NULL); + + /* dummy fallback: warning-highlight the two terminals */ + PCB_FLAG_SET(PCB_FLAG_WARN, offender); + if (orig_o != NULL) + PCB_FLAG_SET(PCB_FLAG_WARN, orig_o); + } + sctx->changed++; + sctx->num_shorts++; +} + +static int net_short_check(pcb_find_t *fctx, pcb_any_obj_t *new_obj, pcb_any_obj_t *arrived_from, pcb_found_conn_type_t ctype) +{ + if (new_obj->term != NULL) { + pcb_net_term_t *t; + pcb_short_ctx_t *sctx = fctx->user_data; + pcb_subc_t *sc = pcb_obj_parent_subc(new_obj); + + if ((sc == NULL) || (sc->refdes == NULL)) + return 0; + + /* if new_obj is a terminal on our net, return */ + for(t = pcb_termlist_first(&sctx->current_net->conns); t != NULL; t = pcb_termlist_next(t)) + if ((strcmp(t->refdes, sc->refdes) == 0) && (strcmp(t->term, new_obj->term) == 0)) + return 0; + + /* new_obj is not on our net but has a refdes-term -> must be a short */ + net_found_short(fctx->user_data, new_obj); + } + + return 0; +} + +pcb_cardinal_t pcb_net_crawl_flag(pcb_board_t *pcb, pcb_net_t *net, unsigned long setf, unsigned long clrf) +{ + pcb_find_t fctx; + pcb_net_term_t *t; + pcb_cardinal_t res = 0, n; + pcb_short_ctx_t sctx; + int first = 0; + + pcb_net_short_ctx_init(&sctx, pcb, net); + + memset(&fctx, 0, sizeof(fctx)); + fctx.flag_set = setf; + fctx.flag_clr = clrf; + fctx.flag_chg_undoable = 1; + fctx.only_mark_rats = 1; /* do not trust rats, but do mark them */ + fctx.user_data = &sctx; + fctx.found_cb = net_short_check; + + for(t = pcb_termlist_first(&net->conns), n = 0; t != NULL; t = pcb_termlist_next(t), n++) { + res += pcb_net_term_crawl(pcb, t, &fctx, &first, NULL); + } + + pcb_find_free(&fctx); + pcb_net_short_ctx_uninit(&sctx); + return res; +} + +pcb_net_term_t *pcb_net_find_by_refdes_term(const pcb_netlist_t *nl, const char *refdes, const char *term) +{ + htsp_entry_t *e; + + for(e = htsp_first(nl); e != NULL; e = htsp_next(nl, e)) { + pcb_net_t *net = (pcb_net_t *)e->value; + pcb_net_term_t *t; + + for(t = pcb_termlist_first(&net->conns); t != NULL; t = pcb_termlist_next(t)) + if ((strcmp(t->refdes, refdes) == 0) && (strcmp(t->term, term) == 0)) + return t; + } + + return NULL; +} + +pcb_net_term_t *pcb_net_find_by_pinname(const pcb_netlist_t *nl, const char *pinname) +{ + char tmp[256]; + char *pn, *refdes, *term; + int len = strlen(pinname)+1; + pcb_net_term_t *t = NULL; + + if (len <= sizeof(tmp)) { + pn = tmp; + memcpy(pn, pinname, len); + } + else + pn = pcb_strdup(pinname); + + refdes = pn; + term = strchr(refdes, '-'); + if (term != NULL) { + *term = '\0'; + term++; + t = pcb_net_find_by_refdes_term(nl, refdes, term); + } + + if (pn != tmp) + free(pn); + return t; +} + +pcb_net_term_t *pcb_net_find_by_obj(const pcb_netlist_t *nl, const pcb_any_obj_t *obj) +{ + const pcb_subc_t *sc; + + if (obj->term == NULL) + return NULL; + + sc = pcb_obj_parent_subc(obj); + if (sc == NULL) + return NULL; + + return pcb_net_find_by_refdes_term(nl, sc->refdes, obj->term); +} + + + +static int netname_sort(const void *va, const void *vb) +{ + const pcb_net_t **a = (const pcb_net_t **)va; + const pcb_net_t **b = (const pcb_net_t **)vb; + return strcmp((*a)->name, (*b)->name); +} + +pcb_net_t **pcb_netlist_sort(pcb_netlist_t *nl) +{ + pcb_net_t **arr; + htsp_entry_t *e; + long n; + + if (nl->used == 0) + return NULL; + arr = malloc((nl->used+1) * sizeof(pcb_net_t)); + + for(e = htsp_first(nl), n = 0; e != NULL; e = htsp_next(nl, e), n++) + arr[n] = e->value; + qsort(arr, nl->used, sizeof(pcb_net_t *), netname_sort); + arr[nl->used] = NULL; + return arr; +} + +#include "netlist_geo.c" + +pcb_cardinal_t pcb_net_map_subnets(pcb_short_ctx_t *sctx, pcb_rat_accuracy_t acc, vtp0_t *subnets) +{ + pcb_find_t fctx; + pcb_net_term_t *t; + pcb_cardinal_t drawn = 0, r, n, s1, s2, su, sd; + pcb_subnet_dist_t *connmx; + char *done; + int left, first = 0; + pcb_rat_t *line; + + + memset(&fctx, 0, sizeof(fctx)); + fctx.consider_rats = 1; /* keep existing rats and their connections */ + fctx.list_found = 1; + fctx.user_data = sctx; + fctx.found_cb = net_short_check; + + /* each component of a desired network is called a subnet; already connected + objects of each subnet is collected on a vtp0_t; object-lists per submnet + is saved in variable "subnets" */ + for(t = pcb_termlist_first(&sctx->current_net->conns), n = 0; t != NULL; t = pcb_termlist_next(t), n++) { + r = pcb_net_term_crawl(sctx->pcb, t, &fctx, &first, &sctx->missing); + if (r > 0) { + vtp0_t *objs = malloc(sizeof(vtp0_t)); + memcpy(objs, &fctx.found, sizeof(vtp0_t)); + vtp0_append(subnets, objs); + memset(&fctx.found, 0, sizeof(vtp0_t)); + } + } + + /* find the shortest connection between any two subnets and save the info + in connmx */ + connmx = calloc(sizeof(pcb_subnet_dist_t), vtp0_len(subnets) * vtp0_len(subnets)); + for(s1 = 0; s1 < vtp0_len(subnets); s1++) { + for(s2 = s1+1; s2 < vtp0_len(subnets); s2++) { + connmx[s2 * vtp0_len(subnets) + s1] = connmx[s1 * vtp0_len(subnets) + s2] = pcb_subnet_dist(sctx->pcb, subnets->array[s1], subnets->array[s2], acc); + } + } + + /* Start collecting subnets into one bug snowball of newly connected + subnets. done[subnet] is 1 if a subnet is already in the snowball. + Use a greedy algorithm: mark the first subnet as dine, then always + add the shortest from any 'undone' subnet to any 'done' */ + done = calloc(vtp0_len(subnets), 1); + done[0] = 1; + for(left = vtp0_len(subnets)-1; left > 0; left--) { + double best_dist = HUGE_VAL; + int bestu; + pcb_subnet_dist_t *best = NULL, *curr; + + for(su = 1; su < vtp0_len(subnets); su++) { + if (done[su]) continue; + for(sd = 0; sd < vtp0_len(subnets); sd++) { + curr = &connmx[su * vtp0_len(subnets) + sd]; + if ((done[sd]) && (curr->dist2 < best_dist)) { + bestu = su; + best_dist = curr->dist2; + best = curr; + } + } + } + + if (best == NULL) { + /* Unlikely: if there are enough restrictions on the search, e.g. + PCB_RATACC_ONLY_MANHATTAN for the old autorouter is on and some + subnets have only heavy terminals made of non-manhattan-lines, + we will not find a connection. When best is NULL, that means + no connection found between any undone subnet to any done subnet + found, so some subnets will remain disconnected (there is no point + in looping more, this won't improve) */ + sctx->missing++; + break; + } + + /* best connection is 'best' between from 'undone' network bestu; draw the rat */ + line = pcb_rat_new(sctx->pcb->Data, -1, + best->o1x, best->o1y, best->o2x, best->o2y, best->o1g, best->o2g, + conf_core.appearance.rat_thickness, pcb_no_flags(), + best->o1, best->o2); + if (line != NULL) { + if (best->dist2 == 0) + PCB_FLAG_SET(PCB_FLAG_VIA, line); + pcb_undo_add_obj_to_create(PCB_OBJ_RAT, line, line, line); + pcb_rat_invalidate_draw(line); + drawn++; + } + else + sctx->missing++; + done[bestu] = 1; + } + + /* cleanup */ + free(connmx); + free(done); + pcb_find_free(&fctx); + return drawn; +} + +void pcb_net_reset_subnets(vtp0_t *subnets) +{ + pcb_cardinal_t n; + for(n = 0; n < vtp0_len(subnets); n++) + vtp0_uninit(subnets->array[n]); + subnets->used = 0; +} + +void pcb_net_free_subnets(vtp0_t *subnets) +{ + pcb_net_reset_subnets(subnets); + vtp0_uninit(subnets); +} + + +pcb_cardinal_t pcb_net_add_rats(const pcb_board_t *pcb, pcb_net_t *net, pcb_rat_accuracy_t acc) +{ + pcb_cardinal_t res; + pcb_short_ctx_t sctx; + vtp0_t subnets; + + vtp0_init(&subnets); + pcb_net_short_ctx_init(&sctx, pcb, net); + res = pcb_net_map_subnets(&sctx, acc, &subnets); + pcb_net_short_ctx_uninit(&sctx); + pcb_net_free_subnets(&subnets); + return res; +} + + +pcb_cardinal_t pcb_net_add_all_rats(const pcb_board_t *pcb, pcb_rat_accuracy_t acc) +{ + htsp_entry_t *e; + pcb_cardinal_t drawn = 0; + pcb_short_ctx_t sctx; + vtp0_t subnets; + + vtp0_init(&subnets); + + pcb_net_short_ctx_init(&sctx, pcb, NULL); + + for(e = htsp_first(&pcb->netlist[PCB_NETLIST_EDITED]); e != NULL; e = htsp_next(&pcb->netlist[PCB_NETLIST_EDITED], e)) { + pcb_net_t *net = e->value; + if (acc & PCB_RATACC_ONLY_SELECTED) { + pcb_net_term_t *t; + int has_selection = 0; + for(t = pcb_termlist_first(&net->conns); t != NULL; t = pcb_termlist_next(t)) { + pcb_any_obj_t *o = pcb_term_find_name(pcb, pcb->Data, PCB_LYT_COPPER, t->refdes, t->term, NULL, NULL); + if ((o != NULL) && (PCB_FLAG_TEST(PCB_FLAG_SELECTED, o))) { + has_selection = 1; + break; + } + } + if (!has_selection) + continue; + } + + sctx.current_net = net; + if (sctx.current_net->inhibit_rats) + continue; + drawn += pcb_net_map_subnets(&sctx, acc, &subnets); + pcb_net_reset_subnets(&subnets); + } + + if (acc & PCB_RATACC_INFO) { + long rem = ratlist_length(&pcb->Data->Rat); + if (rem > 0) + pcb_message(PCB_MSG_INFO, "%d rat line%s remaining\n", rem, rem > 1 ? "s" : ""); + else if (acc & PCB_RATACC_ONLY_SELECTED) + pcb_message(PCB_MSG_WARNING, "No rat for any network that has selected terminal\n"); + else if (sctx.missing > 0) + pcb_message(PCB_MSG_WARNING, "Nothing more to add, but there are\neither rat-lines in the layout, disabled nets\nin the net-list, or missing components\n"); + else if (sctx.num_shorts == 0) + pcb_message(PCB_MSG_INFO, "Congratulations!!\n" "The layout is complete and has no shorted nets.\n"); + } + + vtp0_uninit(&subnets); + pcb_net_short_ctx_uninit(&sctx); + return drawn; +} + +void pcb_netlist_changed(int force_unfreeze) +{ + if (force_unfreeze) + PCB->netlist_frozen = 0; + if (PCB->netlist_frozen) + PCB->netlist_needs_update = 1; + else { + PCB->netlist_needs_update = 0; + pcb_event(&PCB->hidlib, PCB_EVENT_NETLIST_CHANGED, NULL); + } +} + +void pcb_netlist_init(pcb_netlist_t *nl) +{ + htsp_init(nl, strhash, strkeyeq); +} + + +void pcb_netlist_uninit(pcb_netlist_t *nl) +{ + htsp_entry_t *e; + + for(e = htsp_first(nl); e != NULL; e = htsp_next(nl, e)) + pcb_net_free(e->value); + + htsp_uninit(nl); +} + +void pcb_netlist_copy(pcb_board_t *pcb, pcb_netlist_t *dst, pcb_netlist_t *src) +{ + htsp_entry_t *e; + + assert(dst->used == 0); + for(e = htsp_first(src); e != NULL; e = htsp_next(src, e)) { + pcb_net_t *src_net, *dst_net; + pcb_net_term_t *src_term, *dst_term; + + src_net = e->value; + dst_net = pcb_net_alloc(pcb, dst, src_net->name); + dst_net->export_tmp = src_net->export_tmp; + dst_net->inhibit_rats = src_net->inhibit_rats; + pcb_attribute_copy_all(&dst_net->Attributes, &src_net->Attributes); + + for(src_term = pcb_termlist_first(&src_net->conns); src_term != NULL; src_term = pcb_termlist_next(src_term)) { + dst_term = pcb_net_term_alloc(dst_net, src_term->refdes, src_term->term); + pcb_attribute_copy_all(&dst_term->Attributes, &src_term->Attributes); + } + } +} + +/* Return the (most natural) copper group the obj is in */ +static pcb_layergrp_id_t get_side_group(pcb_board_t *pcb, pcb_any_obj_t *obj) +{ + switch(obj->type) { + case PCB_OBJ_ARC: + case PCB_OBJ_LINE: + case PCB_OBJ_POLY: + case PCB_OBJ_TEXT: + return pcb_layer_get_group_(obj->parent.layer); + case PCB_OBJ_PSTK: + if (pcb_pstk_shape((pcb_pstk_t *)obj, PCB_LYT_COPPER | PCB_LYT_TOP, 0) != NULL) + return pcb_layergrp_get_top_copper(); + if (pcb_pstk_shape((pcb_pstk_t *)obj, PCB_LYT_COPPER | PCB_LYT_BOTTOM, 0) != NULL) + return pcb_layergrp_get_bottom_copper(); + default: return -1; + } +} + +static pcb_rat_t *pcb_net_create_by_rat_(pcb_board_t *pcb, pcb_coord_t x1, pcb_coord_t y1, pcb_coord_t x2, pcb_coord_t y2, pcb_any_obj_t *o1, pcb_any_obj_t *o2, pcb_bool interactive) +{ + pcb_subc_t *sc1, *sc2, *sctmp; + pcb_net_t *net1 = NULL, *net2 = NULL, *ntmp, *target_net = NULL; + pcb_layergrp_id_t group1, group2; + pcb_rat_t *res; + static long netname_cnt = 0; + char ratname_[32], *ratname, *id; + long old_len, new_len; + + if ((o1 == o2) || (o1 == NULL) || (o2 == NULL)) { + pcb_message(PCB_MSG_ERROR, "Missing start or end terminal\n"); + return NULL; + } + + { /* make sure at least one of the terminals is not on a net */ + pcb_net_term_t *term1, *term2; + + sc1 = pcb_obj_parent_subc(o1); + sc2 = pcb_obj_parent_subc(o2); + if ((sc1 == NULL) || (sc2 == NULL) || (sc1->refdes == NULL) || (sc2->refdes == NULL)) { + pcb_message(PCB_MSG_ERROR, "Both start or end terminal must be in a subcircuit with refdes\n"); + return NULL; + } + + term1 = pcb_net_find_by_refdes_term(&pcb->netlist[PCB_NETLIST_EDITED], sc1->refdes, o1->term); + term2 = pcb_net_find_by_refdes_term(&pcb->netlist[PCB_NETLIST_EDITED], sc2->refdes, o2->term); + if (term1 != NULL) net1 = term1->parent.net; + if (term2 != NULL) net1 = term2->parent.net; + + if ((net1 == net2) && (net1 != NULL)) { + pcb_message(PCB_MSG_ERROR, "Those terminals are already on the same net (%s)\n", net1->name); + return NULL; + } + if ((net1 != NULL) && (net2 != NULL)) { + pcb_message(PCB_MSG_ERROR, "Can not connect two existing nets with a rat (%s and %s)\n", net1->name, net2->name); + return NULL; + } + } + + /* swap vars so it's always o1 is off-net (and o2 may be in a net) */ + if (net1 != NULL) { + pcb_any_obj_t *otmp; + otmp = o1; o1 = o2; o2 = otmp; + sctmp = sc1; sc1 = sc2; sc2 = sctmp; + ntmp = net1; net1 = net2; net2 = ntmp; + } + + group1 = get_side_group(pcb, o1); + group2 = get_side_group(pcb, o2); + if ((group1 == -1) && (group2 == -1)) { + pcb_message(PCB_MSG_ERROR, "Can not determine copper layer group of that terminal\n"); + return NULL; + } + + /* passed all sanity checks, o1 is off-net; figure the target_net (create it if needed) */ + if ((net1 == NULL) && (net2 == NULL)) { + do { + sprintf(ratname_, "pcbrnd%ld", ++netname_cnt); + } while(htsp_has(&pcb->netlist[PCB_NETLIST_EDITED], ratname_)); + if (interactive) { + ratname = pcb_hid_prompt_for("Name of the new net", ratname_, "rat net name"); + if (ratname == NULL) /* cancel */ + return NULL; + } + else + ratname = ratname_; + target_net = pcb_net_get(pcb, &pcb->netlist[PCB_NETLIST_EDITED], ratname, 1); + + assert(target_net != NULL); + if (ratname != ratname_) + free(ratname); + } + else + target_net = net2; + + /* create the rat and add terminals in the target_net */ + res = pcb_rat_new(pcb->Data, -1, x1, y1, x2, y2, group1, group2, conf_core.appearance.rat_thickness, pcb_no_flags(), o1, o2); + + old_len = pcb_termlist_length(&target_net->conns); + pcb_net_term_get(target_net, sc1->refdes, o1->term, 1); + new_len = pcb_termlist_length(&target_net->conns); + if (new_len != old_len) { + id = pcb_concat(sc1->refdes, "-", o1->term, NULL); + pcb_ratspatch_append(pcb, RATP_ADD_CONN, id, target_net->name, NULL); + free(id); + } + + old_len = new_len; + pcb_net_term_get(target_net, sc2->refdes, o2->term, 1); + new_len = pcb_termlist_length(&target_net->conns); + if (new_len != old_len) { + id = pcb_concat(sc2->refdes, "-", o2->term, NULL); + pcb_ratspatch_append(pcb, RATP_ADD_CONN, id, target_net->name, NULL); + free(id); + } + + pcb_netlist_changed(0); + return res; +} + +static pcb_any_obj_t *find_rat_end(pcb_board_t *pcb, pcb_coord_t x, pcb_coord_t y, const char *loc) +{ + void *ptr1, *ptr2, *ptr3; + pcb_any_obj_t *o; + pcb_objtype_t type = pcb_search_obj_by_location(PCB_OBJ_CLASS_TERM | PCB_OBJ_SUBC_PART, &ptr1, &ptr2, &ptr3, x, y, 5); + pcb_subc_t *sc; + + o = ptr2; + if ((type == PCB_OBJ_VOID) || (o->term == NULL)) { + pcb_message(PCB_MSG_ERROR, "Can't find a terminal at %s\n", loc); + return NULL; + } + + sc = pcb_obj_parent_subc(o); + if ((sc == NULL) || (sc->refdes == NULL)) { + pcb_message(PCB_MSG_ERROR, "The terminal terminal found at %s is not part of a subc with refdes\n", loc); + return NULL; + } + + return o; +} + +pcb_rat_t *pcb_net_create_by_rat_coords(pcb_board_t *pcb, pcb_coord_t x1, pcb_coord_t y1, pcb_coord_t x2, pcb_coord_t y2, pcb_bool interactive) +{ + pcb_any_obj_t *os, *oe; + if ((x1 == x2) && (y1 == y2)) + return NULL; + + os = find_rat_end(pcb, x1, y1, "rat line start"); + oe = find_rat_end(pcb, x2, y2, "rat line end"); + + return pcb_net_create_by_rat_(pcb, x1, y1, x2, y2, os, oe, interactive); +} + + +pcb_cardinal_t pcb_net_ripup(pcb_board_t *pcb, pcb_net_t *net) +{ + pcb_find_t fctx; + pcb_net_term_t *t; + pcb_cardinal_t res, n; + pcb_any_obj_t *o, *lasto; + pcb_data_it_t it; + int first = 0; + + memset(&fctx, 0, sizeof(fctx)); + fctx.only_mark_rats = 1; /* do not trust rats, but do mark them */ + + for(t = pcb_termlist_first(&net->conns), n = 0; t != NULL; t = pcb_termlist_next(t), n++) + pcb_net_term_crawl(pcb, t, &fctx, &first, NULL); + + pcb_undo_save_serial(); + pcb_draw_inhibit_inc(); + + /* always remove the (n-1)th object; removing the current iterator object + confuses the iteration */ + res = 0; + lasto = NULL; + o = pcb_data_first(&it, pcb->Data, PCB_OBJ_CLASS_REAL & (~PCB_OBJ_SUBC)); + for(;;) { + if ((lasto != NULL) && (PCB_DFLAG_TEST(&lasto->Flags, fctx.mark))) { + pcb_remove_object(lasto->type, lasto->parent.any, lasto, lasto); + res++; + } + lasto = o; + if (lasto == NULL) + break; + o = pcb_data_next(&it); + } + + pcb_undo_restore_serial(); + if (res > 0) + pcb_undo_inc_serial(); + + pcb_draw_inhibit_dec(); + pcb_find_free(&fctx); + return res; +} Index: trunk/src/netlist.h =================================================================== --- trunk/src/netlist.h (nonexistent) +++ trunk/src/netlist.h (revision 26976) @@ -0,0 +1,191 @@ +/* + * COPYRIGHT + * + * pcb-rnd, interactive printed circuit board design + * Copyright (C) 2019 Tibor 'Igor2' Palinkas + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Contact: + * Project page: http://repo.hu/projects/pcb-rnd + * lead developer: http://repo.hu/projects/pcb-rnd/contact.html + * mailing list: pcb-rnd (at) list.repo.hu (send "subscribe") + */ + +#ifndef PCB_NETLIST2_H +#define PCB_NETLIST2_H + +#include +#include +#include +#include "board.h" +#include "obj_common.h" + +struct pcb_net_term_s { + PCB_ANY_OBJ_FIELDS; + char *refdes; + char *term; + gdl_elem_t link; /* a net is mainly an ordered list of terminals */ +}; + +typedef enum { /* bitfield */ + PCB_RATACC_PRECISE = 1, /* find the shortest rats, precisely (expensive); if unset, use a simplified algo e.g. considering only endpoints of lines */ + PCB_RATACC_ONLY_MANHATTAN = 2, /* the old autorouter doesn't like non-manhattan lines and arcs */ + PCB_RATACC_ONLY_SELECTED = 4, + PCB_RATACC_INFO = 8 /* print INFO messages in the log about how many rats are to go */ +} pcb_rat_accuracy_t; + +/* List of refdes-terminals */ +#define TDL(x) pcb_termlist_ ## x +#define TDL_LIST_T pcb_termlist_t +#define TDL_ITEM_T pcb_net_term_t +#define TDL_FIELD link +#define TDL_SIZE_T size_t +#define TDL_FUNC + +#define pcb_termlist_foreach(list, iterator, loop_elem) \ + gdl_foreach_((&((list)->lst)), (iterator), (loop_elem)) + + +#include +#include + + +struct pcb_net_s { + PCB_ANY_OBJ_FIELDS; + char *name; + pcb_cardinal_t export_tmp; /* filled in and used by export code; valid only until the end of exporting */ + unsigned inhibit_rats:1; + pcb_termlist_t conns; +}; + + +/* Initialize an empty netlist */ +void pcb_netlist_init(pcb_netlist_t *nl); + +/* Free all memory (including nets and terminals) of a netlist */ +void pcb_netlist_uninit(pcb_netlist_t *nl); + +/* Copy all fields from src to dst, assuming dst is empty */ +void pcb_netlist_copy(pcb_board_t *pcb, pcb_netlist_t *dst, pcb_netlist_t *src); + +/* Look up (or allocate) a net by name within a netlist. Returns NULL on error */ +pcb_net_t *pcb_net_get(pcb_board_t *pcb, pcb_netlist_t *nl, const char *netname, pcb_bool alloc); +pcb_net_t *pcb_net_get_icase(pcb_board_t *pcb, pcb_netlist_t *nl, const char *name); /* read-only, case-insnensitive */ +pcb_net_t *pcb_net_get_regex(pcb_board_t *pcb, pcb_netlist_t *nl, const char *regex); +pcb_net_t *pcb_net_get_user(pcb_board_t *pcb, pcb_netlist_t *nl, const char *name_or_rx); /* run all three above in order, until one succeeds */ + + +/* Remove a net from a netlist by namel returns 0 on removal, -1 on error */ +int pcb_net_del(pcb_netlist_t *nl, const char *netname); + +/* Look up (or allocate) a terminal within a net. Pinname is "refdes-termid". + Returns NULL on error */ +pcb_net_term_t *pcb_net_term_get(pcb_net_t *net, const char *refdes, const char *term, pcb_bool alloc); +pcb_net_term_t *pcb_net_term_get_by_obj(pcb_net_t *net, const pcb_any_obj_t *obj); +pcb_net_term_t *pcb_net_term_get_by_pinname(pcb_net_t *net, const char *pinname, pcb_bool alloc); + +/* Remove term from its net and free all fields and term itself */ +int pcb_net_term_del(pcb_net_t *net, pcb_net_term_t *term); +int pcb_net_term_del_by_name(pcb_net_t *net, const char *refdes, const char *term); + + +/* Crawl a net and clear&set flags on each object belonging to the net + and. Return the number of objects found */ +pcb_cardinal_t pcb_net_crawl_flag(pcb_board_t *pcb, pcb_net_t *net, unsigned long setf, unsigned long clrf); + + +/* Slow, linear search for a terminal, by pinname ("refdes-pinnumber") or + separate refdes and terminal ID. */ +pcb_net_term_t *pcb_net_find_by_pinname(const pcb_netlist_t *nl, const char *pinname); +pcb_net_term_t *pcb_net_find_by_refdes_term(const pcb_netlist_t *nl, const char *refdes, const char *term); +pcb_net_term_t *pcb_net_find_by_obj(const pcb_netlist_t *nl, const pcb_any_obj_t *obj); + +/* Create an alphabetic sorted, NULL terminated array from the nets; + the return value is valid until any change to nl and should be free'd + by the caller. Pointers in the array are the same as in the has table, + should not be free'd. */ +pcb_net_t **pcb_netlist_sort(pcb_netlist_t *nl); + +/* Create missing rat lines */ +pcb_cardinal_t pcb_net_add_rats(const pcb_board_t *pcb, pcb_net_t *net, pcb_rat_accuracy_t acc); +pcb_cardinal_t pcb_net_add_all_rats(const pcb_board_t *pcb, pcb_rat_accuracy_t acc); + +/* Create a new network or a new net connection by drawing a rat line between two terminals */ +pcb_rat_t *pcb_net_create_by_rat_coords(pcb_board_t *pcb, pcb_coord_t x1, pcb_coord_t y1, pcb_coord_t x2, pcb_coord_t y2, pcb_bool interactive); + +/* Undoably remove all non-subc-part copper objects that are connected to net. + Return the number of removals. */ +pcb_cardinal_t pcb_net_ripup(pcb_board_t *pcb, pcb_net_t *net); + +void pcb_netlist_changed(int force_unfreeze); + +pcb_bool pcb_net_name_valid(const char *netname); + +/*** subnet mapping ***/ + +typedef struct { + const pcb_board_t *pcb; + pcb_net_t *current_net; + htsp_t found; + pcb_cardinal_t changed, missing, num_shorts; +} pcb_short_ctx_t; + +void pcb_net_short_ctx_init(pcb_short_ctx_t *sctx, const pcb_board_t *pcb, pcb_net_t *net); +void pcb_net_short_ctx_uninit(pcb_short_ctx_t *sctx); + +/* Search and collect all subnets of a net, adding rat lines in between them. + Caller provided subnets is a vector of vtp0_t items that each contain + (pcb_any_obj_t *) pointers to subnet objects */ +pcb_cardinal_t pcb_net_map_subnets(pcb_short_ctx_t *sctx, pcb_rat_accuracy_t acc, vtp0_t *subnets); + +void pcb_net_reset_subnets(vtp0_t *subnets); /* clear the subnet list to zero items, but don't free the array ("malloc cache") */ +void pcb_net_free_subnets(vtp0_t *subnets); /* same as reset but also free the array */ + + + +/*** looping ***/ + +typedef struct pcb_net_it_s { + pcb_netlist_t *nl; + htsp_entry_t *next; +} pcb_net_it_t; + +PCB_INLINE pcb_net_t *pcb_net_next(pcb_net_it_t *it) +{ + pcb_net_t *res; + if (it->next == NULL) + return NULL; + res = it->next->value; + it->next = htsp_next(it->nl, it->next); + return res; +} + +PCB_INLINE pcb_net_t *pcb_net_first(pcb_net_it_t *it, pcb_netlist_t *nl) +{ + it->nl = nl; + it->next = htsp_first(nl); + return pcb_net_next(it); +} + +/*** Internal ***/ +void pcb_net_free_fields(pcb_net_t *net); +void pcb_net_free(pcb_net_t *net); +void pcb_net_term_free_fields(pcb_net_term_t *term); +void pcb_net_term_free(pcb_net_term_t *term); + +void pcb_netlist_geo_init(void); + +#endif Index: trunk/src/netlist_act.c =================================================================== --- trunk/src/netlist_act.c (revision 26975) +++ trunk/src/netlist_act.c (revision 26976) @@ -44,7 +44,7 @@ #include "plug_io.h" #include "actions.h" #include "compat_misc.h" -#include "netlist2.h" +#include "netlist.h" #include "data_it.h" #include "find.h" #include "obj_term.h" Index: trunk/src/rats_act.c =================================================================== --- trunk/src/rats_act.c (revision 26975) +++ trunk/src/rats_act.c (revision 26976) @@ -43,7 +43,7 @@ #include "funchash_core.h" #include "obj_rat.h" #include "actions.h" -#include "netlist2.h" +#include "netlist.h" #include "draw.h" #include "obj_rat_draw.h" Index: trunk/src/rats_patch.c =================================================================== --- trunk/src/rats_patch.c (revision 26975) +++ trunk/src/rats_patch.c (revision 26976) @@ -39,7 +39,7 @@ #include "search.h" #include "undo.h" #include "conf_core.h" -#include "netlist2.h" +#include "netlist.h" static void rats_patch_remove(pcb_board_t *pcb, pcb_ratspatch_line_t * n, int do_free); Index: trunk/src/tool_line.c =================================================================== --- trunk/src/tool_line.c (revision 26975) +++ trunk/src/tool_line.c (revision 26976) @@ -48,7 +48,7 @@ #include "search.h" #include "tool.h" #include "undo.h" -#include "netlist2.h" +#include "netlist.h" #include "obj_line_draw.h" #include "obj_pstk_draw.h" Index: trunk/src/undo_old.c =================================================================== --- trunk/src/undo_old.c (revision 26975) +++ trunk/src/undo_old.c (revision 26976) @@ -63,7 +63,7 @@ #include "flag_str.h" #include "conf_core.h" #include "compat_misc.h" -#include "netlist2.h" +#include "netlist.h" #include "obj_poly_draw.h" #include "obj_subc_parent.h" Index: trunk/src_plugins/autoplace/autoplace.c =================================================================== --- trunk/src_plugins/autoplace/autoplace.c (revision 26975) +++ trunk/src_plugins/autoplace/autoplace.c (revision 26976) @@ -60,7 +60,7 @@ #include "rtree.h" #include "macro.h" #include "move.h" -#include "netlist2.h" +#include "netlist.h" #include "remove.h" #include "rotate.h" #include "obj_rat.h" Index: trunk/src_plugins/autoroute/autoroute.c =================================================================== --- trunk/src_plugins/autoroute/autoroute.c (revision 26975) +++ trunk/src_plugins/autoroute/autoroute.c (revision 26976) @@ -74,7 +74,7 @@ #include "find.h" #include "heap.h" #include "rtree.h" -#include "netlist2.h" +#include "netlist.h" #include "mtspace.h" #include "polygon.h" #include "remove.h" Index: trunk/src_plugins/dialogs/dlg_netlist.c =================================================================== --- trunk/src_plugins/dialogs/dlg_netlist.c (revision 26975) +++ trunk/src_plugins/dialogs/dlg_netlist.c (revision 26976) @@ -25,7 +25,7 @@ */ #include "event.h" -#include "netlist2.h" +#include "netlist.h" #include const char *dlg_netlist_cookie = "netlist dialog"; Index: trunk/src_plugins/dialogs/dlg_pinout.c =================================================================== --- trunk/src_plugins/dialogs/dlg_pinout.c (revision 26975) +++ trunk/src_plugins/dialogs/dlg_pinout.c (revision 26976) @@ -33,7 +33,7 @@ #include "rtree.h" #include "search.h" #include "search_r.h" -#include "netlist2.h" +#include "netlist.h" typedef struct{ PCB_DAD_DECL_NOINIT(dlg) Index: trunk/src_plugins/export_dsn/dsn.c =================================================================== --- trunk/src_plugins/export_dsn/dsn.c (revision 26975) +++ trunk/src_plugins/export_dsn/dsn.c (revision 26976) @@ -55,7 +55,7 @@ #include "compat_misc.h" #include "layer.h" #include "safe_fs.h" -#include "netlist2.h" +#include "netlist.h" #include "hid.h" #include "hid_nogui.h" Index: trunk/src_plugins/export_ipcd356/ipcd356.c =================================================================== --- trunk/src_plugins/export_ipcd356/ipcd356.c (revision 26975) +++ trunk/src_plugins/export_ipcd356/ipcd356.c (revision 26976) @@ -36,7 +36,7 @@ #include "conf_core.h" #include "hidlib_conf.h" #include "compat_misc.h" -#include "netlist2.h" +#include "netlist.h" #include "math_helper.h" #include "layer.h" #include "obj_arc.h" Index: trunk/src_plugins/export_stat/stat.c =================================================================== --- trunk/src_plugins/export_stat/stat.c (revision 26975) +++ trunk/src_plugins/export_stat/stat.c (revision 26976) @@ -48,7 +48,7 @@ #include "board.h" #include "data.h" #include "data_it.h" -#include "netlist2.h" +#include "netlist.h" #include "plugins.h" #include "pcb-printf.h" #include "compat_misc.h" Index: trunk/src_plugins/export_xy/xy.c =================================================================== --- trunk/src_plugins/export_xy/xy.c (revision 26975) +++ trunk/src_plugins/export_xy/xy.c (revision 26976) @@ -21,7 +21,7 @@ #include "obj_pstk_inlines.h" #include "obj_subc_op.h" #include "layer.h" -#include "netlist2.h" +#include "netlist.h" #include "safe_fs.h" #include "macro.h" #include "operation.h" Index: trunk/src_plugins/hid_lesstif/netlist.c =================================================================== --- trunk/src_plugins/hid_lesstif/netlist.c (revision 26975) +++ trunk/src_plugins/hid_lesstif/netlist.c (revision 26976) @@ -11,7 +11,7 @@ #include "data.h" #include "find.h" -#include "netlist2.h" +#include "netlist.h" #include "select.h" #include "undo.h" #include "remove.h" Index: trunk/src_plugins/import_edif/edif.c =================================================================== --- trunk/src_plugins/import_edif/edif.c (revision 26975) +++ trunk/src_plugins/import_edif/edif.c (revision 26976) @@ -107,7 +107,7 @@ #include "board.h" #include "data.h" #include "error.h" -#include "netlist2.h" +#include "netlist.h" #include "plugins.h" #include "compat_misc.h" #include "safe_fs.h" Index: trunk/src_plugins/import_edif/edif.y =================================================================== --- trunk/src_plugins/import_edif/edif.y (revision 26975) +++ trunk/src_plugins/import_edif/edif.y (revision 26976) @@ -30,7 +30,7 @@ #include "board.h" #include "data.h" #include "error.h" -#include "netlist2.h" +#include "netlist.h" #include "plugins.h" #include "compat_misc.h" #include "safe_fs.h" Index: trunk/src_plugins/import_netlist/import_netlist.c =================================================================== --- trunk/src_plugins/import_netlist/import_netlist.c (revision 26975) +++ trunk/src_plugins/import_netlist/import_netlist.c (revision 26976) @@ -42,7 +42,7 @@ #include "paths.h" #include "safe_fs.h" #include "macro.h" -#include "netlist2.h" +#include "netlist.h" static pcb_plug_import_t import_netlist; Index: trunk/src_plugins/io_autotrax/write.c =================================================================== --- trunk/src_plugins/io_autotrax/write.c (revision 26975) +++ trunk/src_plugins/io_autotrax/write.c (revision 26976) @@ -31,7 +31,7 @@ #include "board.h" #include "plug_io.h" #include "error.h" -#include "netlist2.h" +#include "netlist.h" #include "data.h" #include "write.h" #include "layer.h" Index: trunk/src_plugins/io_dsn/read.c =================================================================== --- trunk/src_plugins/io_dsn/read.c (revision 26975) +++ trunk/src_plugins/io_dsn/read.c (revision 26976) @@ -44,7 +44,7 @@ #include "conf_core.h" #include "math_helper.h" #include "actions.h" -#include "netlist2.h" +#include "netlist.h" #include "polygon_offs.h" #include "read.h" Index: trunk/src_plugins/io_kicad/read.c =================================================================== --- trunk/src_plugins/io_kicad/read.c (revision 26975) +++ trunk/src_plugins/io_kicad/read.c (revision 26976) @@ -52,7 +52,7 @@ #include "rotate.h" #include "safe_fs.h" #include "attrib.h" -#include "netlist2.h" +#include "netlist.h" #include "math_helper.h" #include "obj_pstk_inlines.h" Index: trunk/src_plugins/io_kicad/write.c =================================================================== --- trunk/src_plugins/io_kicad/write.c (revision 26975) +++ trunk/src_plugins/io_kicad/write.c (revision 26976) @@ -35,7 +35,7 @@ #include "data.h" #include "write.h" #include "layer.h" -#include "netlist2.h" +#include "netlist.h" #include "obj_pstk_inlines.h" #include "funchash_core.h" Index: trunk/src_plugins/io_kicad_legacy/write.c =================================================================== --- trunk/src_plugins/io_kicad_legacy/write.c (revision 26975) +++ trunk/src_plugins/io_kicad_legacy/write.c (revision 26976) @@ -34,7 +34,7 @@ #include "data.h" #include "write.h" #include "layer.h" -#include "netlist2.h" +#include "netlist.h" #include "macro.h" #include "obj_pstk_inlines.h" Index: trunk/src_plugins/io_lihata/read.c =================================================================== --- trunk/src_plugins/io_lihata/read.c (revision 26975) +++ trunk/src_plugins/io_lihata/read.c (revision 26976) @@ -56,7 +56,7 @@ #include "plug_footprint.h" #include "vtpadstack.h" #include "obj_pstk_inlines.h" -#include "netlist2.h" +#include "netlist.h" #include "../src_plugins/lib_compat_help/subc_help.h" #include "../src_plugins/lib_compat_help/pstk_compat.h" Index: trunk/src_plugins/io_lihata/write.c =================================================================== --- trunk/src_plugins/io_lihata/write.c (revision 26975) +++ trunk/src_plugins/io_lihata/write.c (revision 26976) @@ -53,7 +53,7 @@ #include "safe_fs.h" #include "thermal.h" #include "funchash_core.h" -#include "netlist2.h" +#include "netlist.h" #include "hid_dad.h" #include "src_plugins/lib_compat_help/pstk_compat.h" Index: trunk/src_plugins/io_pcb/file.c =================================================================== --- trunk/src_plugins/io_pcb/file.c (revision 26975) +++ trunk/src_plugins/io_pcb/file.c (revision 26976) @@ -69,7 +69,7 @@ #include "event.h" #include "macro.h" #include "funchash_core.h" -#include "netlist2.h" +#include "netlist.h" #include "src_plugins/lib_compat_help/layer_compat.h" #include "src_plugins/lib_compat_help/pstk_compat.h" Index: trunk/src_plugins/io_pcb/parse_y.c =================================================================== --- trunk/src_plugins/io_pcb/parse_y.c (revision 26975) +++ trunk/src_plugins/io_pcb/parse_y.c (revision 26976) @@ -125,7 +125,7 @@ #include "route_style.h" #include "compat_misc.h" #include "src_plugins/lib_compat_help/pstk_compat.h" -#include "netlist2.h" +#include "netlist.h" /* frame between the groundplane and the copper or mask - noone seems to remember what these two are for; changing them may have unforeseen Index: trunk/src_plugins/io_pcb/parse_y.y =================================================================== --- trunk/src_plugins/io_pcb/parse_y.y (revision 26975) +++ trunk/src_plugins/io_pcb/parse_y.y (revision 26976) @@ -48,7 +48,7 @@ #include "route_style.h" #include "compat_misc.h" #include "src_plugins/lib_compat_help/pstk_compat.h" -#include "netlist2.h" +#include "netlist.h" /* frame between the groundplane and the copper or mask - noone seems to remember what these two are for; changing them may have unforeseen Index: trunk/src_plugins/io_tedax/tnetlist.c =================================================================== --- trunk/src_plugins/io_tedax/tnetlist.c (revision 26975) +++ trunk/src_plugins/io_tedax/tnetlist.c (revision 26976) @@ -39,7 +39,7 @@ #include "actions.h" #include "safe_fs.h" #include "obj_subc.h" -#include "netlist2.h" +#include "netlist.h" #include "tnetlist.h" #include "parse.h" Index: trunk/src_plugins/lib_hid_pcbui/status.c =================================================================== --- trunk/src_plugins/lib_hid_pcbui/status.c (revision 26975) +++ trunk/src_plugins/lib_hid_pcbui/status.c (revision 26976) @@ -40,7 +40,7 @@ #include "find.h" #include "obj_subc.h" #include "obj_subc_parent.h" -#include "netlist2.h" +#include "netlist.h" #include "status.h" Index: trunk/src_plugins/lib_netmap/netmap.c =================================================================== --- trunk/src_plugins/lib_netmap/netmap.c (revision 26975) +++ trunk/src_plugins/lib_netmap/netmap.c (revision 26976) @@ -32,7 +32,7 @@ #include "netmap.h" #include "data.h" #include "find.h" -#include "netlist2.h" +#include "netlist.h" #include "pcb-printf.h" #include "plugins.h" Index: trunk/src_plugins/lib_netmap/netmap.h =================================================================== --- trunk/src_plugins/lib_netmap/netmap.h (revision 26975) +++ trunk/src_plugins/lib_netmap/netmap.h (revision 26976) @@ -26,7 +26,7 @@ #include #include "board.h" -#include "netlist2.h" +#include "netlist.h" typedef struct dyn_net_s dyn_net_t; typedef struct dyn_obj_s dyn_obj_t; Index: trunk/src_plugins/mincut/rats_mincut.c =================================================================== --- trunk/src_plugins/mincut/rats_mincut.c (revision 26975) +++ trunk/src_plugins/mincut/rats_mincut.c (revision 26976) @@ -41,7 +41,7 @@ #include "search.h" #include "undo.h" #include "plugins.h" -#include "netlist2.h" +#include "netlist.h" #include "compat_misc.h" #include "obj_common.h" #include "obj_subc_parent.h" Index: trunk/src_plugins/oldactions/oldactions.c =================================================================== --- trunk/src_plugins/oldactions/oldactions.c (revision 26975) +++ trunk/src_plugins/oldactions/oldactions.c (revision 26976) @@ -44,7 +44,7 @@ #include "obj_subc.h" #include "macro.h" #include "compat_misc.h" -#include "netlist2.h" +#include "netlist.h" static void conf_toggle(conf_role_t role, const char *path) { Index: trunk/src_plugins/renumber/renumber.c =================================================================== --- trunk/src_plugins/renumber/renumber.c (revision 26975) +++ trunk/src_plugins/renumber/renumber.c (revision 26976) @@ -42,7 +42,7 @@ #include "actions.h" #include "conf_core.h" #include "compat_misc.h" -#include "netlist2.h" +#include "netlist.h" #include "safe_fs.h" #include "macro.h" Index: trunk/src_plugins/report/report.c =================================================================== --- trunk/src_plugins/report/report.c (revision 26975) +++ trunk/src_plugins/report/report.c (revision 26976) @@ -65,7 +65,7 @@ #include "obj_pstk_inlines.h" #include "obj_subc_parent.h" #include "hid_dad.h" -#include "netlist2.h" +#include "netlist.h" #include Index: trunk/src_plugins/sketch_route/sketch_route.c =================================================================== --- trunk/src_plugins/sketch_route/sketch_route.c (revision 26975) +++ trunk/src_plugins/sketch_route/sketch_route.c (revision 26976) @@ -47,7 +47,7 @@ #include "search.h" #include "tool.h" #include "layer_ui.h" -#include "netlist2.h" +#include "netlist.h" #include "sktypedefs.h" #include "wire.h" Index: trunk/src_plugins/smartdisperse/smartdisperse.c =================================================================== --- trunk/src_plugins/smartdisperse/smartdisperse.c (revision 26975) +++ trunk/src_plugins/smartdisperse/smartdisperse.c (revision 26976) @@ -25,7 +25,7 @@ #include "hid.h" #include "rtree.h" #include "undo.h" -#include "netlist2.h" +#include "netlist.h" #include "error.h" #include "move.h" #include "draw.h"