pcb 4.1.1
An interactive printed circuit board layout editor.

mymem.h File Reference

Prototypes for memory routines. More...

#include <stdlib.h>
#include "global.h"
Include dependency graph for mymem.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  DynamicStringType
 Dynamic string type. More...

Defines

#define STEP_ELEMENT   50
#define STEP_DRILL   30
#define STEP_POINT   100
#define STEP_SYMBOLLINE   10
#define STEP_SELECTORENTRY   128
#define STEP_REMOVELIST   500
#define STEP_UNDOLIST   500
#define STEP_POLYGONPOINT   10
#define STEP_POLYGONHOLEINDEX   10
#define STEP_LIBRARYMENU   10
#define STEP_LIBRARYENTRY   20
#define STEP_RUBBERBAND   100
#define STRDUP(x)   (((x) != NULL) ? strdup (x) : NULL)
#define malloc(x)   calloc(1,(x))

Functions

RubberbandTypeGetRubberbandMemory (void)
 Get the next slot for a rubberband connection.
PinTypeGetPinMemory (ElementType *)
 Get the next slot for a pin.
PadTypeGetPadMemory (ElementType *)
 Get the next slot for a pad.
PinTypeGetViaMemory (DataType *)
 Get the next slot for a via.
LineTypeGetLineMemory (LayerType *)
 Get the next slot for a line.
ArcTypeGetArcMemory (LayerType *)
 Get the next slot for an arc.
RatTypeGetRatMemory (DataType *)
 Get the next slot for a Rat.
TextTypeGetTextMemory (LayerType *)
 Get the next slot for a text object.
PolygonTypeGetPolygonMemory (LayerType *)
 Get the next slot for a polygon object.
PointTypeGetPointMemoryInPolygon (PolygonType *)
 Get the next slot for a point in a polygon struct.
CardinalGetHoleIndexMemoryInPolygon (PolygonType *)
 Gets the next slot for a point in a polygon struct.
ElementTypeGetElementMemory (DataType *)
 Get the next slot for an element.
BoxTypeGetBoxMemory (BoxListType *)
 Get the next slot for a box.
ConnectionTypeGetConnectionMemory (NetType *)
 Get the next slot for a connection.
NetTypeGetNetMemory (NetListType *)
 Get the next slot for a subnet.
NetListTypeGetNetListMemory (NetListListType *)
 Get the next slot for a net list.
LibraryMenuTypeGetLibraryMenuMemory (LibraryType *)
 Get the next slot for a library menu.
LibraryEntryTypeGetLibraryEntryMemory (LibraryMenuType *)
 Get the next slot for a library entry.
ElementType ** GetDrillElementMemory (DrillType *)
 Get the next slot for a DrillElement.
PinType ** GetDrillPinMemory (DrillType *)
 Get the next slot for a DrillPoint.
DrillTypeGetDrillInfoDrillMemory (DrillInfoType *)
 Get the next slot for a Drill.
void ** GetPointerMemory (PointerListType *)
void FreePolygonMemory (PolygonType *)
 Free the memory used by a polygon.
void FreeElementMemory (ElementType *)
 Free the memory used by an element.
void FreePCBMemory (PCBType *)
 Free the memory used by PCB.
void FreeBoxListMemory (BoxListType *)
 Free the memory used by a box list.
void FreeNetListListMemory (NetListListType *)
 Free the memory used by a net list.
void FreeNetListMemory (NetListType *)
 Free the memory used by a net.
void FreeNetMemory (NetType *)
 Free the memory used by a subnet.
void FreeDataMemory (DataType *)
 Free the memory used by data struct.
void FreeLibraryMemory (LibraryType *)
 Free the memory that's allocated by the library.
void FreePointerListMemory (PointerListType *)
void DSAddCharacter (DynamicStringType *, char)
 Adds one character to a dynamic string.
void DSAddString (DynamicStringType *, const char *)
 Add a string to a dynamic string.
void DSClearString (DynamicStringType *)
 Clear a dynamic string.
char * StripWhiteSpaceAndDup (const char *)
 Strips leading and trailing blanks from the passed string.

Detailed Description

Prototypes for memory routines.


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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

Contact addresses for paper mail and Email:

Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany

Thomas.Nau@rz.uni-ulm.de

Definition in file mymem.h.


Define Documentation

#define malloc (   x)    calloc(1,(x))

Definition at line 114 of file mymem.h.

#define STEP_DRILL   30

Definition at line 49 of file mymem.h.

Referenced by GetDrillInfoDrillMemory().

#define STEP_ELEMENT   50

Definition at line 48 of file mymem.h.

Referenced by GetDrillElementMemory().

#define STEP_LIBRARYENTRY   20

Definition at line 58 of file mymem.h.

Referenced by GetLibraryEntryMemory().

#define STEP_LIBRARYMENU   10

Definition at line 57 of file mymem.h.

Referenced by GetLibraryMenuMemory().

#define STEP_POINT   100
#define STEP_POLYGONHOLEINDEX   10

Definition at line 56 of file mymem.h.

Referenced by GetHoleIndexMemoryInPolygon().

#define STEP_POLYGONPOINT   10

Definition at line 55 of file mymem.h.

Referenced by GetPointMemoryInPolygon().

#define STEP_REMOVELIST   500

Definition at line 53 of file mymem.h.

Referenced by GetUndoSlot().

#define STEP_RUBBERBAND   100

Definition at line 59 of file mymem.h.

Referenced by GetRubberbandMemory().

#define STEP_SELECTORENTRY   128

Definition at line 52 of file mymem.h.

#define STEP_SYMBOLLINE   10

Definition at line 51 of file mymem.h.

Referenced by CreateNewLineInSymbol().

#define STEP_UNDOLIST   500

Definition at line 54 of file mymem.h.

Referenced by GetUndoSlot().

#define STRDUP (   x)    (((x) != NULL) ? strdup (x) : NULL)

Function Documentation

void DSAddCharacter ( DynamicStringType ,
char   
)

Adds one character to a dynamic string.

Definition at line 857 of file mymem.c.

References DynamicStringType::Data, and DSRealloc().

Referenced by CreateQuotedString(), EvaluateFilename(), ExpandFilename(), and WritePipe().

Here is the call graph for this function:

void DSAddString ( DynamicStringType ,
const char *   
)

Add a string to a dynamic string.

Definition at line 870 of file mymem.c.

References DynamicStringType::Data, and DSRealloc().

Referenced by EvaluateFilename(), GetInfoString(), ReportFoundPins(), and WritePipe().

Here is the call graph for this function:

void DSClearString ( DynamicStringType )

Clear a dynamic string.

Definition at line 885 of file mymem.c.

References DynamicStringType::Data.

Referenced by CreateQuotedString(), EvaluateFilename(), ExpandFilename(), ReportFoundPins(), and WritePipe().

void FreeBoxListMemory ( BoxListType )

Free the memory used by a box list.

Definition at line 598 of file mymem.c.

References BoxListType::Box.

Referenced by ComputeCost().

void FreeElementMemory ( ElementType )
void FreeLibraryMemory ( LibraryType )

Free the memory that's allocated by the library.

Definition at line 817 of file mymem.c.

References END_LOOP, ENTRY_LOOP, LibraryType::Menu, and MENU_LOOP.

Referenced by ActionLoadFrom(), FreePCBMemory(), and netlist_clear().

void FreeNetListListMemory ( NetListListType )

Free the memory used by a net list.

Definition at line 629 of file mymem.c.

References END_LOOP, FreeNetListMemory(), NetListListType::NetList, and NETLIST_LOOP.

Referenced by CreateRouteData(), and import_clusters().

Here is the call graph for this function:

void FreeNetListMemory ( NetListType )

Free the memory used by a net.

Definition at line 611 of file mymem.c.

References END_LOOP, FreeNetMemory(), NetListType::Net, and NET_LOOP.

Referenced by AddAllRats(), FreeNetListListMemory(), and ProcNetlist().

Here is the call graph for this function:

void FreeNetMemory ( NetType )

Free the memory used by a subnet.

Definition at line 647 of file mymem.c.

References NetType::Connection.

Referenced by DrawShortestRats(), FreeNetListMemory(), and TransferNet().

void FreePCBMemory ( PCBType )
void FreePointerListMemory ( PointerListType )

Definition at line 112 of file mymem.c.

References PointerListType::Ptr.

Referenced by AutoPlaceSelected(), CheckShorts(), ComputeCost(), and CreateRouteData().

void FreePolygonMemory ( PolygonType )

Free the memory used by a polygon.

Definition at line 579 of file mymem.c.

References polygon_st::Clipped, polygon_st::HoleIndex, polygon_st::NoHoles, polygon_st::Points, poly_Free(), and poly_FreeContours().

Referenced by DestroyCrosshair(), DestroyPolygon(), and FreeDataMemory().

Here is the call graph for this function:

ArcType* GetArcMemory ( LayerType layer)

Get the next slot for an arc.

Allocates memory if necessary.

Definition at line 328 of file mymem.c.

References LayerType::Arc, and LayerType::ArcN.

Referenced by CreateNewArcOnLayer().

BoxType* GetBoxMemory ( BoxListType Boxes)

Get the next slot for a box.

Allocates memory if necessary.

Definition at line 124 of file mymem.c.

References BoxListType::Box, box, BoxListType::BoxMax, BoxListType::BoxN, realloc(), and STEP_POINT.

Referenced by ComputeCost().

Here is the call graph for this function:

ConnectionType* GetConnectionMemory ( NetType Net)

Get the next slot for a connection.

Allocates memory if necessary.

Definition at line 147 of file mymem.c.

References NetType::Connection, NetType::ConnectionMax, NetType::ConnectionN, realloc(), and STEP_POINT.

Referenced by AddAllRats(), CollectSubnets(), GatherSubnets(), ProcNetlist(), and TransferNet().

Here is the call graph for this function:

ElementType** GetDrillElementMemory ( DrillType Drill)

Get the next slot for a DrillElement.

Allocates memory if necessary.

Definition at line 512 of file mymem.c.

References DrillType::Element, DrillType::ElementMax, DrillType::ElementN, realloc(), and STEP_ELEMENT.

Referenced by FillDrill(), and InitializeDrill().

Here is the call graph for this function:

DrillType* GetDrillInfoDrillMemory ( DrillInfoType DrillInfo)

Get the next slot for a Drill.

Allocates memory if necessary.

Definition at line 560 of file mymem.c.

References DrillInfoType::Drill, DrillInfoType::DrillMax, DrillInfoType::DrillN, realloc(), and STEP_DRILL.

Referenced by GetDrillInfo().

Here is the call graph for this function:

PinType** GetDrillPinMemory ( DrillType Drill)

Get the next slot for a DrillPoint.

Allocates memory if necessary.

Definition at line 537 of file mymem.c.

References DrillType::Pin, pin, DrillType::PinMax, DrillType::PinN, realloc(), and STEP_POINT.

Referenced by FillDrill(), and InitializeDrill().

Here is the call graph for this function:

ElementType* GetElementMemory ( DataType data)

Get the next slot for an element.

Allocates memory if necessary.

Definition at line 441 of file mymem.c.

References DataType::Element, and DataType::ElementN.

Referenced by CreateNewElement().

Cardinal* GetHoleIndexMemoryInPolygon ( PolygonType Polygon)

Gets the next slot for a point in a polygon struct.

Allocates memory if necessary.

Definition at line 419 of file mymem.c.

References polygon_st::HoleIndex, polygon_st::HoleIndexMax, polygon_st::HoleIndexN, realloc(), and STEP_POLYGONHOLEINDEX.

Referenced by CreateNewHoleInPolygon().

Here is the call graph for this function:

LibraryEntryType* GetLibraryEntryMemory ( LibraryMenuType Menu)

Get the next slot for a library entry.

Allocates memory if necessary.

Definition at line 490 of file mymem.c.

References LibraryMenuType::Entry, LibraryMenuType::EntryMax, LibraryMenuType::EntryN, realloc(), and STEP_LIBRARYENTRY.

Here is the call graph for this function:

LibraryMenuType* GetLibraryMenuMemory ( LibraryType lib)

Get the next slot for a library menu.

Allocates memory if necessary.

Definition at line 468 of file mymem.c.

References LibraryType::Menu, LibraryType::MenuMax, LibraryType::MenuN, realloc(), and STEP_LIBRARYMENU.

Here is the call graph for this function:

LineType* GetLineMemory ( LayerType layer)

Get the next slot for a line.

Allocates memory if necessary.

Definition at line 305 of file mymem.c.

References LayerType::Line, and LayerType::LineN.

Referenced by CreateNewLineOnLayer().

NetListType* GetNetListMemory ( NetListListType Netlistlist)

Get the next slot for a net list.

Allocates memory if necessary.

Definition at line 190 of file mymem.c.

References NetListListType::NetList, NetListListType::NetListMax, NetListListType::NetListN, realloc(), and STEP_POINT.

Referenced by CollectSubnets().

Here is the call graph for this function:

NetType* GetNetMemory ( NetListType Netlist)

Get the next slot for a subnet.

Allocates memory if necessary.

Definition at line 169 of file mymem.c.

References NetListType::Net, NetListType::NetMax, NetListType::NetN, realloc(), and STEP_POINT.

Referenced by AddAllRats(), CollectSubnets(), and ProcNetlist().

Here is the call graph for this function:

PadType* GetPadMemory ( ElementType element)

Get the next slot for a pad.

Allocates memory if necessary.

Definition at line 236 of file mymem.c.

References ElementType::Pad, and ElementType::PadN.

Referenced by CreateNewPad().

PinType* GetPinMemory ( ElementType element)

Get the next slot for a pin.

Allocates memory if necessary.

Definition at line 213 of file mymem.c.

References ElementType::Pin, and ElementType::PinN.

Referenced by CreateNewPin().

void** GetPointerMemory ( PointerListType )

Definition at line 95 of file mymem.c.

References PointerListType::Ptr, ptr, PointerListType::PtrMax, PointerListType::PtrN, realloc(), and STEP_POINT.

Referenced by AddIrregularObstacle(), AddLine(), AddPad(), AddPin(), CheckShorts(), collectSelectedElements(), and ComputeCost().

Here is the call graph for this function:

PointType* GetPointMemoryInPolygon ( PolygonType Polygon)

Get the next slot for a point in a polygon struct.

Allocates memory if necessary.

Definition at line 397 of file mymem.c.

References polygon_st::PointMax, polygon_st::PointN, polygon_st::Points, realloc(), and STEP_POLYGONPOINT.

Referenced by CreateNewPointInPolygon().

Here is the call graph for this function:

PolygonType* GetPolygonMemory ( LayerType layer)

Get the next slot for a polygon object.

Allocates memory if necessary.

Definition at line 374 of file mymem.c.

References LayerType::Polygon, and LayerType::PolygonN.

Referenced by CreateNewPolygon().

RatType* GetRatMemory ( DataType data)

Get the next slot for a Rat.

Allocates memory if necessary.

Definition at line 282 of file mymem.c.

References DataType::Rat, and DataType::RatN.

Referenced by CreateNewRat().

RubberbandType* GetRubberbandMemory ( void  )

Get the next slot for a rubberband connection.

Allocates memory if necessary.

Definition at line 76 of file mymem.c.

References CrosshairType::AttachedObject, Crosshair, ptr, realloc(), AttachedObjectType::Rubberband, AttachedObjectType::RubberbandMax, AttachedObjectType::RubberbandN, and STEP_RUBBERBAND.

Referenced by CreateNewRubberbandEntry().

Here is the call graph for this function:

TextType* GetTextMemory ( LayerType layer)

Get the next slot for a text object.

Allocates memory if necessary.

Definition at line 351 of file mymem.c.

References LayerType::Text, and LayerType::TextN.

Referenced by CreateNewText().

PinType* GetViaMemory ( DataType data)

Get the next slot for a via.

Allocates memory if necessary.

Definition at line 259 of file mymem.c.

References DataType::Via, and DataType::ViaN.

Referenced by CreateNewVia().

char* StripWhiteSpaceAndDup ( const char *  S)

Strips leading and trailing blanks from the passed string.

Returns:
a pointer to the new 'duped' one or NULL if the old one holds only white space characters.

Definition at line 898 of file mymem.c.

References realloc().

Referenced by ActionLoadFrom(), and ghid_route_style_selector_edit_dialog().

Here is the call graph for this function: