Index: trunk/scconfig/Rev.h =================================================================== --- trunk/scconfig/Rev.h (revision 4505) +++ trunk/scconfig/Rev.h (revision 4506) @@ -1 +1 @@ -static const int myrev = 4505; +static const int myrev = 4506; Index: trunk/scconfig/Rev.tab =================================================================== --- trunk/scconfig/Rev.tab (revision 4505) +++ trunk/scconfig/Rev.tab (revision 4506) @@ -1,4 +1,4 @@ -4505 configure unravel - the big cleanup, moving code and files +4506 configure unravel - the big cleanup, moving code and files 4450 configure io_lihata plugin config and 3rd party lib dependency fix 4398 configure io_kicad plugin interdeps and enable io_kicad by default 4375 configure custom output style support in io_lihata Index: trunk/src/Makefile.in =================================================================== --- trunk/src/Makefile.in (revision 4505) +++ trunk/src/Makefile.in (revision 4506) @@ -20,6 +20,7 @@ action_helper.o action_act.o attrib.o + box.o buffer.o change.o change_act.o Index: trunk/src/box.c =================================================================== --- trunk/src/box.c (nonexistent) +++ trunk/src/box.c (revision 4506) @@ -0,0 +1,58 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Contact addresses for paper mail and Email: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + +#warning TODO: remove this and use genvect + +#define STEP_POINT 100 +#include "box.h" + +/* --------------------------------------------------------------------------- + * get next slot for a box, allocates memory if necessary + */ +BoxTypePtr GetBoxMemory(BoxListTypePtr Boxes) +{ + BoxTypePtr box = Boxes->Box; + + /* realloc new memory if necessary and clear it */ + if (Boxes->BoxN >= Boxes->BoxMax) { + Boxes->BoxMax = STEP_POINT + (2 * Boxes->BoxMax); + box = (BoxTypePtr) realloc(box, Boxes->BoxMax * sizeof(BoxType)); + Boxes->Box = box; + memset(box + Boxes->BoxN, 0, (Boxes->BoxMax - Boxes->BoxN) * sizeof(BoxType)); + } + return (box + Boxes->BoxN++); +} + +/* --------------------------------------------------------------------------- + * frees memory used by a box list + */ +void FreeBoxListMemory(BoxListTypePtr Boxlist) +{ + if (Boxlist) { + free(Boxlist->Box); + memset(Boxlist, 0, sizeof(BoxListType)); + } +} Index: trunk/src/box.h =================================================================== --- trunk/src/box.h (revision 4505) +++ trunk/src/box.h (revision 4506) @@ -37,6 +37,12 @@ #include #include "global.h" +struct pcb_boxlist_s { + pcb_cardinal_t BoxN, /* the number of boxes contained */ + BoxMax; /* max boxes from malloc */ + BoxTypePtr Box; +}; + #include "misc_util.h" typedef enum { NORTH = 0, EAST = 1, SOUTH = 2, WEST = 3, NE = 4, SE = 5, SW = 6, NW = 7, ALL = 8 @@ -203,4 +209,7 @@ return Distance(r.X, r.Y, p->X, p->Y); } +BoxTypePtr GetBoxMemory(BoxListTypePtr); +void FreeBoxListMemory(BoxListTypePtr); + #endif /* __BOX_H_INCLUDED__ */ Index: trunk/src/global.h =================================================================== --- trunk/src/global.h (revision 4505) +++ trunk/src/global.h (revision 4506) @@ -88,13 +88,6 @@ void *(*Rat) (RatTypePtr); } ObjectFunctionType, *ObjectFunctionTypePtr; -typedef struct { - pcb_cardinal_t BoxN, /* the number of boxes contained */ - BoxMax; /* max boxes from malloc */ - BoxTypePtr Box; - -} BoxListType, *BoxListTypePtr; - /* --------------------------------------------------------------------------- * Macros called by various action routines to show usage or to report * a syntax error and fail Index: trunk/src/global_objs.h =================================================================== --- trunk/src/global_objs.h (revision 4505) +++ trunk/src/global_objs.h (revision 4506) @@ -34,6 +34,12 @@ #include "global_typedefs.h" #include "polyarea.h" +struct pcb_box_s { /* a bounding box */ + Coord X1, Y1; /* upper left */ + Coord X2, Y2; /* and lower right corner */ +}; + + /* --------------------------------------------------------------------------- * Do not change the following definitions even if they're not very * nice. It allows us to have functions act on these "base types" and @@ -59,11 +65,6 @@ PointType Point1, \ Point2 -struct BoxType { /* a bounding box */ - Coord X1, Y1; /* upper left */ - Coord X2, Y2; /* and lower right corner */ -}; - /* All on-pcb objects (elements, lines, pads, vias, rats, etc) are based on this. */ typedef struct { Index: trunk/src/global_typedefs.h =================================================================== --- trunk/src/global_typedefs.h (revision 4505) +++ trunk/src/global_typedefs.h (revision 4506) @@ -36,9 +36,9 @@ typedef struct pcb_buffer_s BufferType, *BufferTypePtr; typedef struct pcb_net_s NetType, *NetTypePtr; typedef struct pcb_rat_s ConnectionType, *ConnectionTypePtr; +typedef struct pcb_box_s BoxType, *BoxTypePtr; +typedef struct pcb_boxlist_s BoxListType, *BoxListTypePtr; - -typedef struct BoxType BoxType, *BoxTypePtr; typedef struct polygon_st PolygonType, *PolygonTypePtr; typedef struct pad_st PadType, *PadTypePtr; typedef struct pin_st PinType, *PinTypePtr, **PinTypeHandle; Index: trunk/src/hid.h =================================================================== --- trunk/src/hid.h (revision 4505) +++ trunk/src/hid.h (revision 4506) @@ -550,7 +550,7 @@ Do *not* assume that the hid that is passed is the GUI hid. This callback is also used for printing and exporting. */ struct BoxType; -void hid_expose_callback(HID * hid_, struct BoxType *region_, void *item_); +void hid_expose_callback(HID * hid_, BoxType *region_, void *item_); /* This is initially set to a "no-gui" gui, and later reset by main. hid_expose_callback also temporarily set it for drawing. */ Index: trunk/src/intersect.c =================================================================== --- trunk/src/intersect.c (revision 4505) +++ trunk/src/intersect.c (revision 4506) @@ -35,6 +35,7 @@ #include #include "intersect.h" +#include "box.h" /* --------------------------------------------------------------------------- * some local prototypes Index: trunk/src/mymem.c =================================================================== --- trunk/src/mymem.c (revision 4505) +++ trunk/src/mymem.c (revision 4506) @@ -66,23 +66,6 @@ } /* --------------------------------------------------------------------------- - * get next slot for a box, allocates memory if necessary - */ -BoxTypePtr GetBoxMemory(BoxListTypePtr Boxes) -{ - BoxTypePtr box = Boxes->Box; - - /* realloc new memory if necessary and clear it */ - if (Boxes->BoxN >= Boxes->BoxMax) { - Boxes->BoxMax = STEP_POINT + (2 * Boxes->BoxMax); - box = (BoxTypePtr) realloc(box, Boxes->BoxMax * sizeof(BoxType)); - Boxes->Box = box; - memset(box + Boxes->BoxN, 0, (Boxes->BoxMax - Boxes->BoxN) * sizeof(BoxType)); - } - return (box + Boxes->BoxN++); -} - -/* --------------------------------------------------------------------------- * get next slot for a pin, allocates memory if necessary */ PinType *GetPinMemory(ElementType * element) @@ -357,17 +340,6 @@ } /* --------------------------------------------------------------------------- - * frees memory used by a box list - */ -void FreeBoxListMemory(BoxListTypePtr Boxlist) -{ - if (Boxlist) { - free(Boxlist->Box); - memset(Boxlist, 0, sizeof(BoxListType)); - } -} - -/* --------------------------------------------------------------------------- * frees memory used by an attribute list */ static void FreeAttributeListMemory(AttributeListTypePtr list) Index: trunk/src/mymem.h =================================================================== --- trunk/src/mymem.h (revision 4505) +++ trunk/src/mymem.h (revision 4506) @@ -68,13 +68,11 @@ PointTypePtr GetPointMemoryInPolygon(PolygonTypePtr); pcb_cardinal_t *GetHoleIndexMemoryInPolygon(PolygonTypePtr); ElementTypePtr GetElementMemory(DataTypePtr); -BoxTypePtr GetBoxMemory(BoxListTypePtr); LibraryMenuTypePtr GetLibraryMenuMemory(LibraryTypePtr, int *idx); LibraryEntryTypePtr GetLibraryEntryMemory(LibraryMenuTypePtr); void FreePolygonMemory(PolygonTypePtr); void FreeElementMemory(ElementTypePtr); void FreePCBMemory(PCBTypePtr); -void FreeBoxListMemory(BoxListTypePtr); void FreeDataMemory(DataTypePtr); void FreeLibraryMemory(LibraryTypePtr); void DeleteLibraryMenuMemory(LibraryTypePtr lib, int menuidx);