Index: trunk/scconfig/Rev.h =================================================================== --- trunk/scconfig/Rev.h (revision 14723) +++ trunk/scconfig/Rev.h (revision 14724) @@ -1 +1 @@ -static const int myrev = 13953; +static const int myrev = 14724; Index: trunk/scconfig/Rev.tab =================================================================== --- trunk/scconfig/Rev.tab (revision 14723) +++ trunk/scconfig/Rev.tab (revision 14724) @@ -1,3 +1,4 @@ +14724 configure subc hash and compare 13953 configure rtree switchover 13726 configure opnegl code moved to a separate plugin for reuse 13584 configure opengl -lGLU bugfix Index: trunk/src/Makefile.dep =================================================================== --- trunk/src/Makefile.dep (revision 14723) +++ trunk/src/Makefile.dep (revision 14724) @@ -1092,7 +1092,7 @@ ../src_3rd/genht/htsp.h rtree.h rtree2.h \ ../src_3rd/genrtree/genrtree_api.h rtree2_compat.h ht_subc.h \ vtpadstack.h obj_pstk_shape.h polygon.h vtpadstack_t.h error.h \ - obj_elem.h obj_elem_list.h obj_elem_op.h operation.h compat_misc.h \ + obj_subc.h obj_subc_list.h obj_subc_op.h operation.h compat_misc.h \ pcb-printf.h operation.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 list_conf.h \ @@ -6917,6 +6917,25 @@ compat_misc.h pcb_minuid.h conf_core.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 list_conf.h +obj_subc_hash.o: obj_subc_hash.c ../config.h data.h globalconst.h \ + global_typedefs.h pcb_bool.h unit.h layer.h attrib.h obj_all_list.h \ + obj_arc_list.h obj_common.h ../src_3rd/genht/hash.h \ + ../src_3rd/genlist/gendlist.h flag.h data_parent.h obj_arc.h \ + ../src_3rd/genlist/gentdlist_impl.h ../src_3rd/genlist/gendlist.h \ + ../src_3rd/genlist/gentdlist_undef.h obj_elem_list.h obj_elem.h \ + obj_line_list.h obj_line.h obj_pad_list.h obj_pad.h obj_pinvia_list.h \ + obj_pinvia.h obj_text.h font.h ../src_3rd/genht/htip.h \ + ../src_3rd/genht/ht.h obj_poly.h polyarea.h obj_poly_list.h box.h \ + math_helper.h macro.h move.h misc_util.h ../src_3rd/genvector/gds_char.h \ + ../src_3rd/genvector/genvector_impl.h \ + ../src_3rd/genvector/genvector_undef.h ht_element.h \ + ../src_3rd/genht/ht.h obj_pstk_list.h obj_pstk.h \ + ../src_3rd/genvector/vtp0.h obj_text_list.h obj_rat_list.h obj_rat.h \ + crosshair.h vtonpoint.h hid.h error.h drc.h layer_grp.h route.h const.h \ + buffer.h obj_subc_list.h obj_subc.h ../src_3rd/libminuid/libminuid.h \ + ../src_3rd/genht/htsp.h rtree.h rtree2.h \ + ../src_3rd/genrtree/genrtree_api.h rtree2_compat.h ht_subc.h \ + vtpadstack.h obj_pstk_shape.h polygon.h vtpadstack_t.h obj_subc_list.o: obj_subc_list.c ../config.h obj_subc.h \ ../src_3rd/libminuid/libminuid.h ../src_3rd/genht/htsp.h \ ../src_3rd/genht/ht.h obj_common.h ../src_3rd/genht/hash.h \ Index: trunk/src/Makefile.in =================================================================== --- trunk/src/Makefile.in (revision 14723) +++ trunk/src/Makefile.in (revision 14724) @@ -111,6 +111,7 @@ obj_rat.o obj_rat_list.o obj_subc.o + obj_subc_hash.o obj_subc_list.o obj_term.o obj_text.o Index: trunk/src/obj_subc_hash.c =================================================================== --- trunk/src/obj_subc_hash.c (nonexistent) +++ trunk/src/obj_subc_hash.c (revision 14724) @@ -0,0 +1,76 @@ +/* + * COPYRIGHT + * + * pcb-rnd, interactive printed circuit board design + * Copyright (C) 2018 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: email to pcb-rnd (at) igor2.repo.hu + * mailing list: pcb-rnd (at) list.repo.hu (send "subscribe") + */ + +#include "config.h" + +#include "data.h" +#include "layer.h" +#include "obj_subc.h" +#include "obj_arc.h" +#include "obj_line.h" +#include "obj_text.h" +#include "obj_poly.h" +#include "obj_pstk.h" + +pcb_bool_t pcb_subc_eq(const pcb_subc_t *sc1, const pcb_subc_t *sc2) +{ + return pcb_false; +} + +unsigned int pcb_subc_hash(const pcb_subc_t *sc) +{ + unsigned int hash = 0; + int lid; + pcb_host_trans_t tr; + + pcb_subc_get_host_trans(sc, &tr); + + for(lid = 0; lid < sc->data->LayerN; lid++) { + pcb_layer_t *ly = &sc->data->Layer[lid]; + gdl_iterator_t it; + pcb_line_t *l; + pcb_arc_t *a; + pcb_text_t *t; + pcb_poly_t *p; + +#warning TODO: hash layers + + linelist_foreach(&ly->Arc, &it, a) + hash ^= pcb_arc_hash(&tr, a); + + linelist_foreach(&ly->Line, &it, l) + hash ^= pcb_line_hash(&tr, l); + + textlist_foreach(&ly->Text, &it, t) + hash ^= pcb_text_hash(&tr, t); + + polylist_foreach(&ly->Polygon, &it, p) + hash ^= pcb_poly_hash(&tr, p); + } + + return hash; +} + Index: trunk/src/obj_subc_list.h =================================================================== --- trunk/src/obj_subc_list.h (revision 14723) +++ trunk/src/obj_subc_list.h (revision 14724) @@ -48,7 +48,7 @@ unsigned int pcb_subc_hash(const pcb_subc_t *e); /* Compare two subcs and return 1 if they contain the same objects. */ -int pcb_subc_eq(const pcb_subc_t *e1, const pcb_subc_t *e2); +pcb_bool_t pcb_subc_eq(const pcb_subc_t *e1, const pcb_subc_t *e2); /* Create a new local variable to be used for deduplication */ #define pcb_subclist_dedup_initializer(state) htep_t *state = NULL;