4 * \brief Prototypes for misc routines.
8 * <h1><b>Copyright.</b></h1>\n
10 * PCB, interactive printed circuit board design
12 * Copyright (C) 1994,1995,1996,2006 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
42 enum unitflags
{ UNIT_PERCENT
= 1 };
50 double Distance (double x1
, double y1
, double x2
, double y2
);
51 Angle
NormalizeAngle (Angle a
);
53 void r_delete_element (DataType
*, ElementType
*);
54 void SetLineBoundingBox (LineType
*);
55 void SetArcBoundingBox (ArcType
*);
56 void SetPointBoundingBox (PointType
*);
57 void SetPinBoundingBox (PinType
*);
58 void SetPadBoundingBox (PadType
*);
59 void SetPolygonBoundingBox (PolygonType
*);
60 void SetElementBoundingBox (DataType
*, ElementType
*, FontType
*);
61 bool IsDataEmpty (DataType
*);
62 bool IsLayerEmpty (LayerType
*);
63 bool IsLayerNumEmpty (int);
64 bool IsLayerGroupEmpty (int);
65 bool IsPasteEmpty (int);
66 void CountHoles (int *, int *, const BoxType
*);
67 BoxType
* GetDataBoundingBox (DataType
*);
68 void CenterDisplay (Coord
, Coord
, bool warp_pointer
);
69 void SetFontInfo (FontType
*);
70 char *make_route_string (RouteStyleType rs
[], int n_styles
);
71 int ParseGroupString (char *, LayerGroupType
*, int * /* LayerN */);
72 int ParseRouteString (char *, RouteStyleType
*, const char *);
73 void QuitApplication (void);
74 char *EvaluateFilename (char *, char *, char *, char *);
75 char *ExpandFilename (char *, char *);
76 void SetTextBoundingBox (FontType
*, TextType
*);
78 void SaveOutputWindow (void);
79 int GetLayerNumber (DataType
*, LayerType
*);
80 int GetLayerGroupNumberByPointer (LayerType
*);
81 int GetLayerGroupNumberByNumber (Cardinal
);
82 int GetLayerGroupNumberBySide (int);
83 int ChangeGroupVisibility (int, bool, bool);
84 void LayerStringToLayerStack (char *);
87 BoxType
* GetObjectBoundingBox (int, void *, void *, void *);
88 void ResetStackAndVisibility (void);
89 void SaveStackAndVisibility (void);
90 void RestoreStackAndVisibility (void);
91 char *GetWorkingDirectory (char *);
92 void CreateQuotedString (DynamicStringType
*, char *);
93 BoxType
* GetArcEnds (ArcType
*);
94 void ChangeArcAngles (LayerType
*, ArcType
*, Angle
, Angle
);
95 char *UniqueElementName (DataType
*, char *);
96 void AttachForCopy (Coord
, Coord
);
97 double GetValue (const char *, const char *, bool *);
98 double GetValueEx (const char *, const char *, bool *, UnitList
, const char *);
99 double GetUnitlessValue (const char *, bool *);
100 int FileExists (const char *);
101 char *Concat (const char *, ...); /* end with NULL */
104 char *AttributeGetFromList (AttributeListType
*list
, char *name
);
105 int AttributePutToList (AttributeListType
*list
, const char *name
, const char *value
, int replace
);
106 /* Simplistic version: Takes a pointer to an object, looks up attributes in it. */
107 #define AttributeGet(OBJ,name) AttributeGetFromList (&(OBJ->Attributes), name)
108 /* Simplistic version: Takes a pointer to an object, sets attributes in it. */
109 #define AttributePut(OBJ,name,value) AttributePutToList (&(OBJ->Attributes), name, value, 1)
110 void AttributeRemoveFromList(AttributeListType
*list
, char *name
);
111 /* Simplistic version of Remove. */
112 #define AttributeRemove(OBJ, name) AttributeRemoveFromList (&(OBJ->Attributes), name)
114 /* For passing modified flags to other functions. */
115 FlagType
MakeFlags (unsigned int);
116 FlagType
OldFlags (unsigned int);
117 FlagType
AddFlags (FlagType
, unsigned int);
118 FlagType
MaskFlags (FlagType
, unsigned int);
119 #define NoFlags() MakeFlags(0)
121 /* Layer Group Functions */
123 int MoveLayerToGroup (int layer
, int group
);
124 char *LayerGroupsToString (LayerGroupType
*);
125 /*! \todo is this an orphan prototype ?
127 * Make the current layer groups the default.
129 void MakeLayerGroupsDefault ();
131 extern const char *c_dtostr(double d
);
132 char * GetInfoString (void);
133 void AssignDefaultLayerTypes ();
134 int ElementOrientation (ElementType
*e
);
137 * \todo These are in netlist.c
139 void NetlistChanged (int force_unfreeze
);
142 * Check whether mkdir() is mkdir or _mkdir, and whether it takes one
143 * or two arguments. WIN32 mkdir takes one argument and POSIX takes
147 #if MKDIR_TAKES_ONE_ARG
149 #include <io.h> /* mkdir under MinGW only takes one argument */
150 #define MKDIR(a, b) mkdir(a)
152 #define MKDIR(a, b) mkdir(a, b)
156 /* plain Windows 32 */
157 #define MKDIR(a, b) _mkdir(a)
159 #define MKDIR(a, b) pcb_mkdir(a, b)
160 #define MKDIR_IS_PCBMKDIR 1
161 int pcb_mkdir (const char *path
, int mode
);
166 #endif /* PCB_MISC_H */