src/undo.c: Converted plain comments into doxygen comments.
[geda-pcb/pcjc2.git] / src / mymem.h
bloba37a33f6ed878af53815aeb06bc93f4e22471787
1 /*!
2 * \file src/mymem.h
4 * \brief Prototypes for memory routines.
6 * <hr>
8 * <h1><b>Copyright.</b></h1>\n
10 * PCB, interactive printed circuit board design
12 * Copyright (C) 1994,1995,1996 Thomas Nau
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 * Contact addresses for paper mail and Email:
30 * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany
32 * Thomas.Nau@rz.uni-ulm.de
35 #ifndef PCB_MYMEM_H
36 #define PCB_MYMEM_H
38 #ifdef HAVE_CONFIG_H
39 #include "config.h"
40 #endif
42 #include <stdlib.h>
43 #include "global.h"
45 /* ---------------------------------------------------------------------------
46 * number of additional objects that are allocated with one system call
48 #define STEP_ELEMENT 50
49 #define STEP_DRILL 30
50 #define STEP_POINT 100
51 #define STEP_SYMBOLLINE 10
52 #define STEP_SELECTORENTRY 128
53 #define STEP_REMOVELIST 500
54 #define STEP_UNDOLIST 500
55 #define STEP_POLYGONPOINT 10
56 #define STEP_POLYGONHOLEINDEX 10
57 #define STEP_LIBRARYMENU 10
58 #define STEP_LIBRARYENTRY 20
59 #define STEP_RUBBERBAND 100
61 #define STRDUP(x) (((x) != NULL) ? strdup (x) : NULL)
63 /*!
64 * \brief Dynamic string type.
66 typedef struct
68 size_t MaxLength;
69 char *Data;
70 } DynamicStringType;
72 RubberbandType * GetRubberbandMemory (void);
73 PinType * GetPinMemory (ElementType *);
74 PadType * GetPadMemory (ElementType *);
75 PinType * GetViaMemory (DataType *);
76 LineType * GetLineMemory (LayerType *);
77 ArcType * GetArcMemory (LayerType *);
78 RatType * GetRatMemory (DataType *);
79 TextType * GetTextMemory (LayerType *);
80 PolygonType * GetPolygonMemory (LayerType *);
81 PointType * GetPointMemoryInPolygon (PolygonType *);
82 Cardinal *GetHoleIndexMemoryInPolygon (PolygonType *);
83 ElementType * GetElementMemory (DataType *);
84 BoxType * GetBoxMemory (BoxListType *);
85 ConnectionType * GetConnectionMemory (NetType *);
86 NetType * GetNetMemory (NetListType *);
87 NetListType * GetNetListMemory (NetListListType *);
88 LibraryMenuType * GetLibraryMenuMemory (LibraryType *);
89 LibraryEntryType * GetLibraryEntryMemory (LibraryMenuType *);
90 ElementType **GetDrillElementMemory (DrillType *);
91 PinType ** GetDrillPinMemory (DrillType *);
92 DrillType * GetDrillInfoDrillMemory (DrillInfoType *);
93 void **GetPointerMemory (PointerListType *);
94 void FreePolygonMemory (PolygonType *);
95 void FreeElementMemory (ElementType *);
96 void FreePCBMemory (PCBType *);
97 void FreeBoxListMemory (BoxListType *);
98 void FreeNetListListMemory (NetListListType *);
99 void FreeNetListMemory (NetListType *);
100 void FreeNetMemory (NetType *);
101 void FreeDataMemory (DataType *);
102 void FreeLibraryMemory (LibraryType *);
103 void FreePointerListMemory (PointerListType *);
104 void DSAddCharacter (DynamicStringType *, char);
105 void DSAddString (DynamicStringType *, const char *);
106 void DSClearString (DynamicStringType *);
107 char *StripWhiteSpaceAndDup (const char *);
109 #ifdef NEED_STRDUP
110 char *strdup (const char *);
111 #endif
113 #ifndef HAVE_LIBDMALLOC
114 #define malloc(x) calloc(1,(x))
115 #endif
117 #endif