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_LIBRARYMENU 10
62 #define STEP_LIBRARYENTRY 20
63 #define STEP_RUBBERBAND 100
66 /* ---------------------------------------------------------------------------
73 } DynamicStringType
, *DynamicStringTypePtr
;
75 RubberbandTypePtr
GetRubberbandMemory (void);
76 PinTypePtr
GetPinMemory (ElementTypePtr
);
77 PadTypePtr
GetPadMemory (ElementTypePtr
);
78 PinTypePtr
GetViaMemory (DataTypePtr
);
79 LineTypePtr
GetLineMemory (LayerTypePtr
);
80 ArcTypePtr
GetArcMemory (LayerTypePtr
);
81 RatTypePtr
GetRatMemory (DataTypePtr
);
82 TextTypePtr
GetTextMemory (LayerTypePtr
);
83 PolygonTypePtr
GetPolygonMemory (LayerTypePtr
);
84 PointTypePtr
GetPointMemoryInPolygon (PolygonTypePtr
);
85 ElementTypePtr
GetElementMemory (DataTypePtr
);
86 BoxTypePtr
GetBoxMemory (BoxListTypePtr
);
87 ConnectionTypePtr
GetConnectionMemory (NetTypePtr
);
88 NetTypePtr
GetNetMemory (NetListTypePtr
);
89 NetListTypePtr
GetNetListMemory (NetListListTypePtr
);
90 LibraryMenuTypePtr
GetLibraryMenuMemory (LibraryTypePtr
);
91 LibraryEntryTypePtr
GetLibraryEntryMemory (LibraryMenuTypePtr
);
92 ElementTypeHandle
GetDrillElementMemory (DrillTypePtr
);
93 PinTypeHandle
GetDrillPinMemory (DrillTypePtr
);
94 DrillTypePtr
GetDrillInfoDrillMemory (DrillInfoTypePtr
);
95 void **GetPointerMemory (PointerListTypePtr
);
96 void *MyCalloc (size_t, size_t, const char *);
97 void *MyMalloc (size_t, const char *);
98 void *MyRealloc (void *, size_t, const char *);
99 char *MyStrdup (char *s
, const char *);
100 /* void MyFree (void **); */
101 #define MYFREE(x) do { SaveFree(x); (x)=NULL; } while (0)
102 void FreePolygonMemory (PolygonTypePtr
);
103 void FreeElementMemory (ElementTypePtr
);
104 void FreePCBMemory (PCBTypePtr
);
105 void FreeBoxListMemory (BoxListTypePtr
);
106 void FreeNetListListMemory (NetListListTypePtr
);
107 void FreeNetListMemory (NetListTypePtr
);
108 void FreeNetMemory (NetTypePtr
);
109 void FreeDataMemory (DataTypePtr
);
110 void FreeLibraryMemory (LibraryTypePtr
);
111 void FreePointerListMemory (PointerListTypePtr
);
112 void SaveFree (void *);
113 void DSAddCharacter (DynamicStringTypePtr
, char);
114 void DSAddString (DynamicStringTypePtr
, const char *);
115 void DSClearString (DynamicStringTypePtr
);
116 char *StripWhiteSpaceAndDup (char *);
119 char *strdup (const char *);
122 #ifndef HAVE_LIBDMALLOC
123 #define malloc(x) calloc(1,(x))