Index: trunk/src/rtree2_compat.h =================================================================== --- trunk/src/rtree2_compat.h (revision 29288) +++ trunk/src/rtree2_compat.h (nonexistent) @@ -1,98 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * (this file is based on PCB, interactive printed circuit board design) - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1998,1999,2000,2001 harry eaton - * - * this file, rtree.h, was written and is - * Copyright (c) 2004 harry eaton, it's based on C. Scott's kdtree.h template - * - * 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") - * - * - * Old contact info: - * harry eaton, 6697 Buttonhole Ct, Columbia, MD 21044 USA - * haceaton@aplcomm.jhuapl.edu - * - */ - -/* Compatibility layer between the new rtree and the old rtree for the - period of transition */ - -#ifndef PCB_RTREE2_COMPAT_H -#define PCB_RTREE2_COMPAT_H - -#include - -/* callback direction to the search engine */ -typedef enum pcb_r_dir_e { - PCB_R_DIR_NOT_FOUND = 0, /* object not found or not accepted */ - PCB_R_DIR_FOUND_CONTINUE = 1, /* object found or accepted, go on searching */ - PCB_R_DIR_CANCEL = 2 /* cancel the search and return immediately */ -} pcb_r_dir_t; - -pcb_rtree_t *pcb_r_create_tree(void); -void pcb_r_destroy_tree(pcb_rtree_t **tree); -void pcb_r_free_tree_data(pcb_rtree_t *rtree, void (*free)(void *ptr)); - -void pcb_r_insert_entry(pcb_rtree_t *rtree, const pcb_box_t *which); -void pcb_r_insert_array(pcb_rtree_t *rtree, const pcb_box_t *boxlist[], pcb_cardinal_t len); - -pcb_bool pcb_r_delete_entry(pcb_rtree_t *rtree, const pcb_box_t *which); -pcb_bool pcb_r_delete_entry_free_data(pcb_rtree_t *rtree, const pcb_box_t *box, void (*free_data)(void *d)); - -/* generic search routine */ -/* region_in_search should return pcb_true if "what you're looking for" is - * within the specified region; - * rectangle_in_region should return pcb_true if the given rectangle is - * "what you're looking for". - * The search will find all rectangles matching the criteria given - * by region_in_search and rectangle_in_region and return a count of - * how many things rectangle_in_region returned pcb_true for. closure is - * used to abort the search if desired from within rectangle_in_region - * Look at the implementation of r_region_is_empty for how to - * abort the search if that is the desired behavior. - */ -pcb_r_dir_t pcb_r_search(pcb_rtree_t *rtree, const pcb_box_t *query, - pcb_r_dir_t (*region_in_search)(const pcb_box_t *region, void *closure), - pcb_r_dir_t (*rectangle_in_region)(const pcb_box_t *box, void *closure), - void *closure, int *num_found); - -/* return 0 if there are any rectangles in the given region. */ -int pcb_r_region_is_empty(pcb_rtree_t *rtree, const pcb_box_t *region); - -void pcb_r_dump_tree(pcb_rtree_t *root, int unused); - -#define PCB_RTREE_EMPTY(rt) (((rt) == NULL) || ((rt)->size == 0)) - -/* -- Iterate through an rtree; DO NOT modify the tree while iterating -- */ - -/* Get the first item, get fields of iterator set up; return can be casted to an object; returns NULL if rtree is empty */ -pcb_box_t *pcb_r_first(pcb_rtree_t *tree, pcb_rtree_it_t *it); - -/* Get the next item, return can be casted to an object; returns NULL if no more items */ -pcb_box_t *pcb_r_next(pcb_rtree_it_t *it); - -/* Free fields of the iterator - not needed anymore, will be removed */ -void pcb_r_end(pcb_rtree_it_t *it); - -#endif Index: trunk/src/Makefile.in =================================================================== --- trunk/src/Makefile.in (revision 29288) +++ trunk/src/Makefile.in (revision 29289) @@ -608,7 +608,7 @@ # rndlib: corner case: some headers are not derived from the objects sub /local/pcb/HDRS_HIDLIB {$(LIBRND)/core/hid_dlg.h } {} sub /local/pcb/HDRS_HIDLIB {polygon1.h } {} -append /local/pcb/HDRS_HIDLIB {$(LIBRND)/config.h $(LIBRND)/core/hid.h $(LIBRND)/core/global_typedefs.h $(LIBRND)/core/globalconst.h $(LIBRND)/core/math_helper.h $(LIBRND)/core/buildin.hidlib.h $(LIBRND)/core/hid_inlines.h $(LIBRND)/core/rotate.h $(LIBRND)/core/fptr_cast.h $(LIBRND)/core/safe_fs_dir.h $(LIBRND)/core/compat_inc.h } +append /local/pcb/HDRS_HIDLIB {$(LIBRND)/config.h $(LIBRND)/core/hid.h $(LIBRND)/core/global_typedefs.h $(LIBRND)/core/globalconst.h $(LIBRND)/core/math_helper.h $(LIBRND)/core/buildin.hidlib.h $(LIBRND)/core/hid_inlines.h $(LIBRND)/core/rotate.h $(LIBRND)/core/fptr_cast.h $(LIBRND)/core/safe_fs_dir.h $(LIBRND)/core/compat_inc.h $(LIBRND)/poly/rtree2_compat.h } gsub /local/pcb/HDRS_3RDLIB {../src_3rd/liblihata/dom_[^ ]*.h } {} gsub /local/pcb/HDRS_3RDLIB {../src_3rd/liblihata/tree_[^ ]*.h } {} gsub /local/pcb/HDRS_3RDLIB {../src_3rd/libfungw/fungw_ptr.h ../src_3rd/libfungw/fungw_debug.h ../src_3rd/libfungw/fungw_call.h } {} Index: trunk/src/data.h =================================================================== --- trunk/src/data.h (revision 29288) +++ trunk/src/data.h (revision 29289) @@ -40,7 +40,7 @@ #include "obj_rat_list.h" #include "obj_subc_list.h" #include "obj_pstk_list.h" -#include "rtree2_compat.h" +#include #include "vtpadstack.h" #include Index: trunk/src/librnd/poly/polyarea.c =================================================================== --- trunk/src/librnd/poly/polyarea.c (revision 29288) +++ trunk/src/librnd/poly/polyarea.c (revision 29289) @@ -55,7 +55,7 @@ #include "obj_common.h" #include "macro.h" #include -#include "rtree2_compat.h" +#include #define ROUND(a) (long)((a) > 0 ? ((a) + 0.5) : ((a) - 0.5)) Index: trunk/src/librnd/poly/rtree.c =================================================================== --- trunk/src/librnd/poly/rtree.c (revision 29288) +++ trunk/src/librnd/poly/rtree.c (revision 29289) @@ -37,7 +37,7 @@ #include #include #include -#include "rtree2_compat.h" +#include /* Temporary compatibility layer for the transition */ pcb_rtree_t *pcb_r_create_tree(void) Index: trunk/src/librnd/poly/rtree2_compat.h =================================================================== --- trunk/src/librnd/poly/rtree2_compat.h (nonexistent) +++ trunk/src/librnd/poly/rtree2_compat.h (revision 29289) @@ -0,0 +1,98 @@ +/* + * COPYRIGHT + * + * pcb-rnd, interactive printed circuit board design + * (this file is based on PCB, interactive printed circuit board design) + * Copyright (C) 1994,1995,1996 Thomas Nau + * Copyright (C) 1998,1999,2000,2001 harry eaton + * + * this file, rtree.h, was written and is + * Copyright (c) 2004 harry eaton, it's based on C. Scott's kdtree.h template + * + * 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") + * + * + * Old contact info: + * harry eaton, 6697 Buttonhole Ct, Columbia, MD 21044 USA + * haceaton@aplcomm.jhuapl.edu + * + */ + +/* Compatibility layer between the new rtree and the old rtree for the + period of transition */ + +#ifndef PCB_RTREE2_COMPAT_H +#define PCB_RTREE2_COMPAT_H + +#include + +/* callback direction to the search engine */ +typedef enum pcb_r_dir_e { + PCB_R_DIR_NOT_FOUND = 0, /* object not found or not accepted */ + PCB_R_DIR_FOUND_CONTINUE = 1, /* object found or accepted, go on searching */ + PCB_R_DIR_CANCEL = 2 /* cancel the search and return immediately */ +} pcb_r_dir_t; + +pcb_rtree_t *pcb_r_create_tree(void); +void pcb_r_destroy_tree(pcb_rtree_t **tree); +void pcb_r_free_tree_data(pcb_rtree_t *rtree, void (*free)(void *ptr)); + +void pcb_r_insert_entry(pcb_rtree_t *rtree, const pcb_box_t *which); +void pcb_r_insert_array(pcb_rtree_t *rtree, const pcb_box_t *boxlist[], pcb_cardinal_t len); + +pcb_bool pcb_r_delete_entry(pcb_rtree_t *rtree, const pcb_box_t *which); +pcb_bool pcb_r_delete_entry_free_data(pcb_rtree_t *rtree, const pcb_box_t *box, void (*free_data)(void *d)); + +/* generic search routine */ +/* region_in_search should return pcb_true if "what you're looking for" is + * within the specified region; + * rectangle_in_region should return pcb_true if the given rectangle is + * "what you're looking for". + * The search will find all rectangles matching the criteria given + * by region_in_search and rectangle_in_region and return a count of + * how many things rectangle_in_region returned pcb_true for. closure is + * used to abort the search if desired from within rectangle_in_region + * Look at the implementation of r_region_is_empty for how to + * abort the search if that is the desired behavior. + */ +pcb_r_dir_t pcb_r_search(pcb_rtree_t *rtree, const pcb_box_t *query, + pcb_r_dir_t (*region_in_search)(const pcb_box_t *region, void *closure), + pcb_r_dir_t (*rectangle_in_region)(const pcb_box_t *box, void *closure), + void *closure, int *num_found); + +/* return 0 if there are any rectangles in the given region. */ +int pcb_r_region_is_empty(pcb_rtree_t *rtree, const pcb_box_t *region); + +void pcb_r_dump_tree(pcb_rtree_t *root, int unused); + +#define PCB_RTREE_EMPTY(rt) (((rt) == NULL) || ((rt)->size == 0)) + +/* -- Iterate through an rtree; DO NOT modify the tree while iterating -- */ + +/* Get the first item, get fields of iterator set up; return can be casted to an object; returns NULL if rtree is empty */ +pcb_box_t *pcb_r_first(pcb_rtree_t *tree, pcb_rtree_it_t *it); + +/* Get the next item, return can be casted to an object; returns NULL if no more items */ +pcb_box_t *pcb_r_next(pcb_rtree_it_t *it); + +/* Free fields of the iterator - not needed anymore, will be removed */ +void pcb_r_end(pcb_rtree_it_t *it); + +#endif Index: trunk/src/obj_subc.h =================================================================== --- trunk/src/obj_subc.h (revision 29288) +++ trunk/src/obj_subc.h (revision 29289) @@ -33,7 +33,7 @@ #include "obj_common.h" #include "layer.h" #include -#include "rtree2_compat.h" +#include typedef enum pcb_subc_cached_s { Index: trunk/src/polygon.h =================================================================== --- trunk/src/polygon.h (revision 29288) +++ trunk/src/polygon.h (revision 29289) @@ -37,7 +37,7 @@ #include #include #include -#include "rtree2_compat.h" +#include /* Prototypes */ Index: trunk/src_plugins/autoroute/mtspace.c =================================================================== --- trunk/src_plugins/autoroute/mtspace.c (revision 29288) +++ trunk/src_plugins/autoroute/mtspace.c (revision 29289) @@ -52,7 +52,7 @@ #include #include "mtspace.h" #include "vector.h" -#include "rtree2_compat.h" +#include /* mtspace data structures are built on r-trees. */