(no commit message)
[geda-pcb/pcjc2.git] / src / mymem.h
blob46061a3eda9f1a4459bb1d218b0bc87adf48c428
1 /*
2 * COPYRIGHT
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
27 /* prototypes for memory routines
30 #ifndef PCB_MYMEM_H
31 #define PCB_MYMEM_H
33 #ifdef HAVE_CONFIG_H
34 #include "config.h"
35 #endif
37 #include <stdlib.h>
38 #include "global.h"
40 /* ---------------------------------------------------------------------------
41 * number of additional objects that are allocated with one system call
43 #define STEP_ELEMENT 50
44 #define STEP_DRILL 30
45 #define STEP_POINT 100
46 #define STEP_SYMBOLLINE 10
47 #define STEP_SELECTORENTRY 128
48 #define STEP_REMOVELIST 500
49 #define STEP_UNDOLIST 500
50 #define STEP_POLYGONPOINT 10
51 #define STEP_POLYGONHOLEINDEX 10
52 #define STEP_LIBRARYMENU 10
53 #define STEP_LIBRARYENTRY 20
54 #define STEP_RUBBERBAND 100
56 #define STRDUP(x) (((x) != NULL) ? strdup (x) : NULL)
58 /* ---------------------------------------------------------------------------
59 * some memory types
61 typedef struct
63 size_t MaxLength;
64 char *Data;
65 } DynamicStringType;
67 RubberbandType * GetRubberbandMemory (void);
68 PinType * GetPinMemory (ElementType *);
69 PadType * GetPadMemory (ElementType *);
70 PinType * GetViaMemory (DataType *);
71 LineType * GetLineMemory (LayerType *);
72 ArcType * GetArcMemory (LayerType *);
73 RatType * GetRatMemory (DataType *);
74 TextType * GetTextMemory (LayerType *);
75 PolygonType * GetPolygonMemory (LayerType *);
76 PointType * GetPointMemoryInPolygon (PolygonType *);
77 Cardinal *GetHoleIndexMemoryInPolygon (PolygonType *);
78 ElementType * GetElementMemory (DataType *);
79 BoxType * GetBoxMemory (BoxListType *);
80 ConnectionType * GetConnectionMemory (NetType *);
81 NetType * GetNetMemory (NetListType *);
82 NetListType * GetNetListMemory (NetListListType *);
83 LibraryMenuType * GetLibraryMenuMemory (LibraryType *);
84 LibraryEntryType * GetLibraryEntryMemory (LibraryMenuType *);
85 ElementType **GetDrillElementMemory (DrillType *);
86 PinType ** GetDrillPinMemory (DrillType *);
87 DrillType * GetDrillInfoDrillMemory (DrillInfoType *);
88 void **GetPointerMemory (PointerListType *);
89 void FreePolygonMemory (PolygonType *);
90 void FreeElementMemory (ElementType *);
91 void FreePCBMemory (PCBType *);
92 void FreeBoxListMemory (BoxListType *);
93 void FreeNetListListMemory (NetListListType *);
94 void FreeNetListMemory (NetListType *);
95 void FreeNetMemory (NetType *);
96 void FreeDataMemory (DataType *);
97 void FreeLibraryMemory (LibraryType *);
98 void FreePointerListMemory (PointerListType *);
99 void DSAddCharacter (DynamicStringType *, char);
100 void DSAddString (DynamicStringType *, const char *);
101 void DSClearString (DynamicStringType *);
102 char *StripWhiteSpaceAndDup (const char *);
104 #ifdef NEED_STRDUP
105 char *strdup (const char *);
106 #endif
108 #ifndef HAVE_LIBDMALLOC
109 #define malloc(x) calloc(1,(x))
110 #endif
112 #endif