Index: trunk/src/obj_any.h =================================================================== --- trunk/src/obj_any.h (revision 14732) +++ trunk/src/obj_any.h (revision 14733) @@ -29,6 +29,7 @@ #ifndef PCB_OBJ_H #define PCB_OBJ_H +#include #include "obj_common.h" #include "global_typedefs.h" Index: trunk/src/obj_arc.c =================================================================== --- trunk/src/obj_arc.c (revision 14732) +++ trunk/src/obj_arc.c (revision 14733) @@ -45,6 +45,7 @@ #include "obj_arc_op.h" #include "obj_subc_parent.h" +#include "obj_hash.h" /* TODO: could be removed if draw.c could be split up */ #include "draw.h" Index: trunk/src/obj_arc.h =================================================================== --- trunk/src/obj_arc.h (revision 14732) +++ trunk/src/obj_arc.h (revision 14733) @@ -31,6 +31,7 @@ #ifndef PCB_OBJ_ARC_H #define PCB_OBJ_ARC_H +#include #include "obj_common.h" struct pcb_arc_s { /* holds information about arcs */ Index: trunk/src/obj_common.h =================================================================== --- trunk/src/obj_common.h (revision 14732) +++ trunk/src/obj_common.h (revision 14733) @@ -30,8 +30,6 @@ #define PCB_OBJ_COMMON_H #include -#include -#include #include #include "flag.h" #include "attrib.h" @@ -164,42 +162,6 @@ PCB_ANYLINEFIELDS; }; -/*** Functions and macros used for hashing ***/ - -/* compare two strings and return 0 if they are equal. NULL == NULL means equal. */ -PCB_INLINE int pcb_neqs(const char *s1, const char *s2) -{ - if ((s1 == NULL) && (s2 == NULL)) return 0; - if ((s1 == NULL) || (s2 == NULL)) return 1; - return strcmp(s1, s2) != 0; -} - -PCB_INLINE unsigned pcb_hash_coord(pcb_coord_t c) -{ - return murmurhash(&(c), sizeof(pcb_coord_t)); -} - -PCB_INLINE unsigned pcb_hash_cx(const pcb_host_trans_t *tr, pcb_coord_t c) -{ - c -= tr->ox; - return murmurhash(&(c), sizeof(pcb_coord_t)); -} - -PCB_INLINE unsigned pcb_hash_cy(const pcb_host_trans_t *tr, pcb_coord_t c) -{ - c -= tr->oy; - return murmurhash(&(c), sizeof(pcb_coord_t)); -} - -PCB_INLINE unsigned pcb_hash_angle(const pcb_host_trans_t *tr, pcb_angle_t ang) -{ - long l; - ang -= tr->rot; - ang *= 10000; - l = floor(ang); - return murmurhash(&l, sizeof(l)); -} - /* Return the geometric center of an object, as shown (center of bbox usually, but not for an arc) */ void pcb_obj_center(const pcb_any_obj_t *obj, pcb_coord_t *x, pcb_coord_t *y); Index: trunk/src/obj_hash.h =================================================================== --- trunk/src/obj_hash.h (nonexistent) +++ trunk/src/obj_hash.h (revision 14733) @@ -0,0 +1,62 @@ +/* + * COPYRIGHT + * + * pcb-rnd, interactive printed circuit board design + * Copyright (C) 2017, 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 +#include + +/* compare two strings and return 0 if they are equal. NULL == NULL means equal. */ +PCB_INLINE int pcb_neqs(const char *s1, const char *s2) +{ + if ((s1 == NULL) && (s2 == NULL)) return 0; + if ((s1 == NULL) || (s2 == NULL)) return 1; + return strcmp(s1, s2) != 0; +} + +PCB_INLINE unsigned pcb_hash_coord(pcb_coord_t c) +{ + return murmurhash(&(c), sizeof(pcb_coord_t)); +} + +PCB_INLINE unsigned pcb_hash_cx(const pcb_host_trans_t *tr, pcb_coord_t c) +{ + c -= tr->ox; + return murmurhash(&(c), sizeof(pcb_coord_t)); +} + +PCB_INLINE unsigned pcb_hash_cy(const pcb_host_trans_t *tr, pcb_coord_t c) +{ + c -= tr->oy; + return murmurhash(&(c), sizeof(pcb_coord_t)); +} + +PCB_INLINE unsigned pcb_hash_angle(const pcb_host_trans_t *tr, pcb_angle_t ang) +{ + long l; + ang -= tr->rot; + ang *= 10000; + l = floor(ang); + return murmurhash(&l, sizeof(l)); +} Index: trunk/src/obj_line.c =================================================================== --- trunk/src/obj_line.c (revision 14732) +++ trunk/src/obj_line.c (revision 14733) @@ -45,6 +45,7 @@ #include "obj_line_op.h" #include "obj_subc_parent.h" +#include "obj_hash.h" /* TODO: maybe remove this and move lines from draw here? */ #include "draw.h" Index: trunk/src/obj_line.h =================================================================== --- trunk/src/obj_line.h (revision 14732) +++ trunk/src/obj_line.h (revision 14733) @@ -31,6 +31,7 @@ #ifndef PCB_OBJ_LINE_H #define PCB_OBJ_LINE_H +#include #include "obj_common.h" struct pcb_line_s { /* holds information about one line */ Index: trunk/src/obj_pad.c =================================================================== --- trunk/src/obj_pad.c (revision 14732) +++ trunk/src/obj_pad.c (revision 14733) @@ -40,8 +40,8 @@ #include "obj_pad.h" #include "obj_pad_list.h" #include "obj_pad_op.h" +#include "obj_hash.h" - /* TODO: remove this if draw.[ch] pads are moved */ #include "draw.h" #include "obj_text_draw.h" Index: trunk/src/obj_pad.h =================================================================== --- trunk/src/obj_pad.h (revision 14732) +++ trunk/src/obj_pad.h (revision 14733) @@ -31,6 +31,7 @@ #ifndef PCB_OBJ_PAD_H #define PCB_OBJ_PAD_H +#include #include "obj_common.h" struct pcb_pad_s { /* a SMD pad */ Index: trunk/src/obj_pinvia.c =================================================================== --- trunk/src/obj_pinvia.c (revision 14732) +++ trunk/src/obj_pinvia.c (revision 14733) @@ -42,6 +42,7 @@ #include "obj_pinvia.h" #include "obj_pinvia_op.h" #include "obj_subc_parent.h" +#include "obj_hash.h" /* TODO: consider removing this by moving pin/via functions here: */ #include "draw.h" Index: trunk/src/obj_pinvia.h =================================================================== --- trunk/src/obj_pinvia.h (revision 14732) +++ trunk/src/obj_pinvia.h (revision 14733) @@ -31,6 +31,7 @@ #ifndef PCB_OBJ_PINVIA_H #define PCB_OBJ_PINVIA_H +#include #include "obj_common.h" struct pcb_pin_s { Index: trunk/src/obj_poly.c =================================================================== --- trunk/src/obj_poly.c (revision 14732) +++ trunk/src/obj_poly.c (revision 14733) @@ -48,6 +48,7 @@ #include "obj_poly_draw.h" #include "obj_subc_parent.h" +#include "obj_hash.h" /* TODO: get rid of these: */ #include "draw.h" Index: trunk/src/obj_poly.h =================================================================== --- trunk/src/obj_poly.h (revision 14732) +++ trunk/src/obj_poly.h (revision 14733) @@ -31,6 +31,7 @@ #ifndef PCB_OBJ_POLY_H #define PCB_OBJ_POLY_H +#include #include "obj_common.h" #include "polyarea.h" Index: trunk/src/obj_pstk.c =================================================================== --- trunk/src/obj_pstk.c (revision 14732) +++ trunk/src/obj_pstk.c (revision 14733) @@ -41,6 +41,7 @@ #include "obj_pstk_inlines.h" #include "obj_pstk_op.h" #include "obj_subc_parent.h" +#include "obj_hash.h" #include "operation.h" #include "search.h" #include "undo.h" Index: trunk/src/obj_pstk.h =================================================================== --- trunk/src/obj_pstk.h (revision 14732) +++ trunk/src/obj_pstk.h (revision 14733) @@ -27,6 +27,7 @@ #ifndef PCB_OBJ_PSTK_STRUCT_DECLARED #define PCB_OBJ_PSTK_STRUCT_DECLARED +#include #include #include "obj_common.h" Index: trunk/src/obj_pstk_proto.c =================================================================== --- trunk/src/obj_pstk_proto.c (revision 14732) +++ trunk/src/obj_pstk_proto.c (revision 14733) @@ -39,6 +39,7 @@ #include "rotate.h" #include "undo.h" #include "vtpadstack_t.h" +#include "obj_hash.h" static const char core_proto_cookie[] = "padstack prototypes"; Index: trunk/src/obj_rat.h =================================================================== --- trunk/src/obj_rat.h (revision 14732) +++ trunk/src/obj_rat.h (revision 14733) @@ -31,6 +31,7 @@ #ifndef PCB_OBJ_RAT_H #define PCB_OBJ_RAT_H +#include #include "obj_common.h" struct pcb_rat_line_s { /* a rat-line */ Index: trunk/src/obj_subc.h =================================================================== --- trunk/src/obj_subc.h (revision 14732) +++ trunk/src/obj_subc.h (revision 14733) @@ -27,6 +27,7 @@ #ifndef PCB_OBJ_SUBC_H #define PCB_OBJ_SUBC_H +#include #include #include #include "obj_common.h" Index: trunk/src/obj_text.c =================================================================== --- trunk/src/obj_text.c (revision 14732) +++ trunk/src/obj_text.c (revision 14733) @@ -47,6 +47,7 @@ #include "obj_arc_draw.h" #include "obj_subc_parent.h" +#include "obj_hash.h" /* TODO: remove this if draw.c is moved here: */ #include "draw.h" Index: trunk/src_plugins/autoroute/mtspace.c =================================================================== --- trunk/src_plugins/autoroute/mtspace.c (revision 14732) +++ trunk/src_plugins/autoroute/mtspace.c (revision 14733) @@ -43,6 +43,7 @@ #include "config.h" +#include #include #include