4 * PCB, interactive printed circuit board design
5 * Copyright (C) 1994,1995,1996 Thomas Nau
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 * Contact addresses for paper mail and Email:
22 * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany
23 * Thomas.Nau@rz.uni-ulm.de
28 /* prototypes for memory routines
31 #ifndef __MYMEM_INCLUDED__
32 #define __MYMEM_INCLUDED__
41 /* ---------------------------------------------------------------------------
42 * number of additional objects that are allocated with one system call
44 #define STEP_VIA 2000 /* block size for realloc() calls */
47 #define STEP_LINE 10000
49 #define STEP_ELEMENTLINE 10
50 #define STEP_ELEMENTARC 5
52 #define STEP_ELEMENT 50
54 #define STEP_POINT 100
55 #define STEP_SYMBOLLINE 10
56 #define STEP_SELECTORENTRY 128
57 #define STEP_REMOVELIST 500
58 #define STEP_UNDOLIST 500
59 #define STEP_POLYGON 10
60 #define STEP_POLYGONPOINT 10
61 #define STEP_POLYGONHOLEINDEX 10
62 #define STEP_LIBRARYMENU 10
63 #define STEP_LIBRARYENTRY 20
64 #define STEP_RUBBERBAND 100
67 /* ---------------------------------------------------------------------------
74 } DynamicStringType
, *DynamicStringTypePtr
;
76 RubberbandTypePtr
GetRubberbandMemory (void);
77 PinTypePtr
GetPinMemory (ElementTypePtr
);
78 PadTypePtr
GetPadMemory (ElementTypePtr
);
79 PinTypePtr
GetViaMemory (DataTypePtr
);
80 LineTypePtr
GetLineMemory (LayerTypePtr
);
81 ArcTypePtr
GetArcMemory (LayerTypePtr
);
82 RatTypePtr
GetRatMemory (DataTypePtr
);
83 TextTypePtr
GetTextMemory (LayerTypePtr
);
84 PolygonTypePtr
GetPolygonMemory (LayerTypePtr
);
85 PointTypePtr
GetPointMemoryInPolygon (PolygonTypePtr
);
86 Cardinal
*GetHoleIndexMemoryInPolygon (PolygonTypePtr
);
87 ElementTypePtr
GetElementMemory (DataTypePtr
);
88 BoxTypePtr
GetBoxMemory (BoxListTypePtr
);
89 ConnectionTypePtr
GetConnectionMemory (NetTypePtr
);
90 NetTypePtr
GetNetMemory (NetListTypePtr
);
91 NetListTypePtr
GetNetListMemory (NetListListTypePtr
);
92 LibraryMenuTypePtr
GetLibraryMenuMemory (LibraryTypePtr
);
93 LibraryEntryTypePtr
GetLibraryEntryMemory (LibraryMenuTypePtr
);
94 ElementTypeHandle
GetDrillElementMemory (DrillTypePtr
);
95 PinTypeHandle
GetDrillPinMemory (DrillTypePtr
);
96 DrillTypePtr
GetDrillInfoDrillMemory (DrillInfoTypePtr
);
97 void **GetPointerMemory (PointerListTypePtr
);
98 void *MyCalloc (size_t, size_t, const char *);
99 void *MyMalloc (size_t, const char *);
100 void *MyRealloc (void *, size_t, const char *);
101 char *MyStrdup (char *s
, const char *);
102 /* void MyFree (void **); */
103 #define MYFREE(x) do { SaveFree(x); (x)=NULL; } while (0)
104 void FreePolygonMemory (PolygonTypePtr
);
105 void FreeElementMemory (ElementTypePtr
);
106 void FreePCBMemory (PCBTypePtr
);
107 void FreeBoxListMemory (BoxListTypePtr
);
108 void FreeNetListListMemory (NetListListTypePtr
);
109 void FreeNetListMemory (NetListTypePtr
);
110 void FreeNetMemory (NetTypePtr
);
111 void FreeDataMemory (DataTypePtr
);
112 void FreeLibraryMemory (LibraryTypePtr
);
113 void FreePointerListMemory (PointerListTypePtr
);
114 void SaveFree (void *);
115 void DSAddCharacter (DynamicStringTypePtr
, char);
116 void DSAddString (DynamicStringTypePtr
, const char *);
117 void DSClearString (DynamicStringTypePtr
);
118 char *StripWhiteSpaceAndDup (char *);
121 char *strdup (const char *);
124 #ifndef HAVE_LIBDMALLOC
125 #define malloc(x) calloc(1,(x))