4 * PCB, interactive printed circuit board design
5 * Copyright (C) 1994,1995,1996,2006 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 misc routines
38 enum unitflags
{ UNIT_PERCENT
= 1 };
46 double Distance (double x1
, double y1
, double x2
, double y2
);
47 Angle
NormalizeAngle (Angle a
);
49 void r_delete_element (DataTypePtr
, ElementTypePtr
);
50 void SetLineBoundingBox (LineTypePtr
);
51 void SetArcBoundingBox (ArcTypePtr
);
52 void SetPointBoundingBox (PointTypePtr
);
53 void SetPinBoundingBox (PinTypePtr
);
54 void SetPadBoundingBox (PadTypePtr
);
55 void SetPolygonBoundingBox (PolygonTypePtr
);
56 void SetElementBoundingBox (DataTypePtr
, ElementTypePtr
, FontTypePtr
);
57 bool IsDataEmpty (DataTypePtr
);
58 bool IsLayerEmpty (LayerTypePtr
);
59 bool IsLayerNumEmpty (int);
60 bool IsLayerGroupEmpty (int);
61 bool IsPasteEmpty (int);
62 void CountHoles (int *, int *, const BoxType
*);
63 BoxTypePtr
GetDataBoundingBox (DataTypePtr
);
64 void CenterDisplay (Coord
, Coord
);
65 void SetFontInfo (FontTypePtr
);
66 char *make_route_string (RouteStyleType rs
[], int n_styles
);
67 int ParseGroupString (char *, LayerGroupTypePtr
, int /* LayerN */);
68 int ParseRouteString (char *, RouteStyleTypePtr
, const char *);
69 void QuitApplication (void);
70 char *EvaluateFilename (char *, char *, char *, char *);
71 char *ExpandFilename (char *, char *);
72 void SetTextBoundingBox (FontTypePtr
, TextTypePtr
);
74 void SaveOutputWindow (void);
75 int GetLayerNumber (DataTypePtr
, LayerTypePtr
);
76 int GetLayerGroupNumberByPointer (LayerTypePtr
);
77 int GetLayerGroupNumberByNumber (Cardinal
);
78 int GetGroupOfLayer (int);
79 int ChangeGroupVisibility (int, bool, bool);
80 void LayerStringToLayerStack (char *);
83 BoxTypePtr
GetObjectBoundingBox (int, void *, void *, void *);
84 void ResetStackAndVisibility (void);
85 void SaveStackAndVisibility (void);
86 void RestoreStackAndVisibility (void);
87 char *GetWorkingDirectory (char *);
88 void CreateQuotedString (DynamicStringTypePtr
, char *);
89 BoxTypePtr
GetArcEnds (ArcTypePtr
);
90 void ChangeArcAngles (LayerTypePtr
, ArcTypePtr
, Angle
, Angle
);
91 char *UniqueElementName (DataTypePtr
, char *);
92 void AttachForCopy (Coord
, Coord
);
93 double GetValue (const char *, const char *, bool *);
94 double GetValueEx (const char *, const char *, bool *, UnitList
, const char *);
95 int FileExists (const char *);
96 char *Concat (const char *, ...); /* end with NULL */
100 /* Returns NULL if the name isn't found, else the value for that named
102 char *AttributeGetFromList (AttributeListType
*list
, char *name
);
103 /* Adds an attribute to the list. If the attribute already exists,
104 whether it's replaced or a second copy added depends on
105 REPLACE. Returns non-zero if an existing attribute was replaced. */
106 int AttributePutToList (AttributeListType
*list
, const char *name
, const char *value
, int replace
);
107 /* Simplistic version: Takes a pointer to an object, looks up attributes in it. */
108 #define AttributeGet(OBJ,name) AttributeGetFromList (&(OBJ->Attributes), name)
109 /* Simplistic version: Takes a pointer to an object, sets attributes in it. */
110 #define AttributePut(OBJ,name,value) AttributePutToList (&(OBJ->Attributes), name, value, 1)
111 /* Remove an attribute by name. */
112 void AttributeRemoveFromList(AttributeListType
*list
, char *name
);
113 /* Simplistic version of Remove. */
114 #define AttributeRemove(OBJ, name) AttributeRemoveFromList (&(OBJ->Attributes), name)
116 /* For passing modified flags to other functions. */
117 FlagType
MakeFlags (unsigned int);
118 FlagType
OldFlags (unsigned int);
119 FlagType
AddFlags (FlagType
, unsigned int);
120 FlagType
MaskFlags (FlagType
, unsigned int);
121 #define NoFlags() MakeFlags(0)
123 /* Layer Group Functions */
125 /* Returns group actually moved to (i.e. either group or previous) */
126 int MoveLayerToGroup (int layer
, int group
);
127 /* returns pointer to private buffer */
128 char *LayerGroupsToString (LayerGroupTypePtr
);
129 /* Make the current layer groups the default. */
130 void MakeLayerGroupsDefault ();
132 /* These act like you'd expect, except always in the C locale. */
133 extern const char *c_dtostr(double d
);
135 /* Returns a string with info about this copy of pcb. */
136 char * GetInfoString (void);
138 /* Return a relative rotation for an element, useful only for
139 comparing two similar footprints. */
140 int ElementOrientation (ElementType
*e
);
142 /* These are in netlist.c */
144 void NetlistChanged (int force_unfreeze
);
147 * Check whether mkdir() is mkdir or _mkdir, and whether it takes one
148 * or two arguments. WIN32 mkdir takes one argument and POSIX takes
152 #if MKDIR_TAKES_ONE_ARG
154 #include <io.h> /* mkdir under MinGW only takes one argument */
155 #define MKDIR(a, b) mkdir(a)
157 #define MKDIR(a, b) mkdir(a, b)
161 /* plain Windows 32 */
162 #define MKDIR(a, b) _mkdir(a)
164 #define MKDIR(a, b) pcb_mkdir(a, b)
165 #define MKDIR_IS_PCBMKDIR 1
166 int pcb_mkdir (const char *path
, int mode
);
171 #endif /* PCB_MISC_H */