pcb 4.1.1
An interactive printed circuit board layout editor.

misc.h

Go to the documentation of this file.
00001 
00035 #ifndef PCB_MISC_H
00036 #define PCB_MISC_H
00037 
00038 #include <stdlib.h>
00039 #include "global.h"
00040 #include "mymem.h"
00041 
00042 enum unitflags { UNIT_PERCENT = 1 };
00043 
00044 typedef struct {
00045   const char *suffix;
00046   double scale;
00047   enum unitflags flags;
00048 } UnitList[];
00049 
00050 double Distance (double x1, double y1, double x2, double y2);
00051 Angle  NormalizeAngle (Angle a);
00052 
00053 void r_delete_element (DataType *, ElementType *);
00054 void SetLineBoundingBox (LineType *);
00055 void SetArcBoundingBox (ArcType *);
00056 void SetPointBoundingBox (PointType *);
00057 void SetPinBoundingBox (PinType *);
00058 void SetPadBoundingBox (PadType *);
00059 void SetPolygonBoundingBox (PolygonType *);
00060 void SetElementBoundingBox (DataType *, ElementType *, FontType *);
00061 bool IsDataEmpty (DataType *);
00062 bool IsLayerEmpty (LayerType *);
00063 bool IsLayerNumEmpty (int);
00064 bool IsLayerGroupEmpty (int);
00065 bool IsPasteEmpty (int);
00066 void CountHoles (int *, int *, const BoxType *);
00067 void CountHolesEx (int *, int *, const BoxType *, Cardinal, Cardinal);
00068 BoxType * GetDataBoundingBox (DataType *);
00069 void CenterDisplay (Coord, Coord, bool warp_pointer);
00070 void SetFontInfo (FontType *);
00071 char *make_route_string (RouteStyleType rs[], int n_styles);
00072 int ParseGroupString (char *, LayerGroupType *, int * /* LayerN */);
00073 int ParseRouteString (char *, RouteStyleType *, const char *);
00074 void QuitApplication (void);
00075 char *EvaluateFilename (char *, char *, char *, char *);
00076 char *ExpandFilename (char *, char *);
00077 void SetTextBoundingBox (FontType *, TextType *);
00078 
00079 void SaveOutputWindow (void);
00080 int GetLayerNumber (DataType *, LayerType *);
00081 int GetLayerGroupNumberByPointer (LayerType *);
00082 int GetLayerGroupNumberByNumber (Cardinal);
00083 int GetLayerGroupNumberBySide (int);
00084 int ChangeGroupVisibility (int, bool, bool);
00085 void LayerStringToLayerStack (char *);
00086 
00087 
00088 BoxType * GetObjectBoundingBox (int, void *, void *, void *);
00089 void ResetStackAndVisibility (void);
00090 void SaveStackAndVisibility (void);
00091 void RestoreStackAndVisibility (void);
00092 char *GetWorkingDirectory (char *);
00093 void CreateQuotedString (DynamicStringType *, char *);
00094 BoxType * GetArcEnds (ArcType *);
00095 void ChangeArcAngles (LayerType *, ArcType *, Angle, Angle);
00096 char *UniqueElementName (DataType *, char *);
00097 void AttachForCopy (Coord, Coord);
00098 double GetValue (const char *, const char *, bool *);
00099 double GetValueEx (const char *, const char *, bool *, UnitList, const char *);
00100 double GetUnitlessValue (const char *, bool *);
00101 int FileExists (const char *);
00102 char *Concat (const char *, ...);       /* end with NULL */
00103 
00104 char *pcb_author ();
00105 char *AttributeGetFromList (AttributeListType *list, char *name);
00106 int AttributePutToList (AttributeListType *list, const char *name, const char *value, int replace);
00107 /* Simplistic version: Takes a pointer to an object, looks up attributes in it.  */
00108 #define AttributeGet(OBJ,name) AttributeGetFromList (&(OBJ->Attributes), name)
00109 /* Simplistic version: Takes a pointer to an object, sets attributes in it.  */
00110 #define AttributePut(OBJ,name,value) AttributePutToList (&(OBJ->Attributes), name, value, 1)
00111 void AttributeRemoveFromList(AttributeListType *list, char *name);
00112 /* Simplistic version of Remove.  */
00113 #define AttributeRemove(OBJ, name) AttributeRemoveFromList (&(OBJ->Attributes), name)
00114 
00115 /* For passing modified flags to other functions. */
00116 FlagType MakeFlags (unsigned int);
00117 FlagType OldFlags (unsigned int);
00118 FlagType AddFlags (FlagType, unsigned int);
00119 FlagType MaskFlags (FlagType, unsigned int);
00120 #define         NoFlags() MakeFlags(0)
00121 
00122 /* Layer Group Functions */
00123 
00124 int MoveLayerToGroup (int layer, int group);
00125 char *LayerGroupsToString (LayerGroupType *);
00130 void MakeLayerGroupsDefault ();
00131 
00132 extern const char *c_dtostr(double d);
00133 char * GetInfoString (void);
00134 void AssignDefaultLayerTypes ();
00135 int ElementOrientation (ElementType *e);
00136 
00137 /* Buried vias Functions */
00138 bool IsLayerMoveSafe (int, int);
00139 void ChangeBuriedViasAfterLayerMove (int, int);
00140 void ChangeBuriedViasAfterLayerCreate (int);
00141 void ChangeBuriedViasAfterLayerDelete (int);
00142 bool ViaIsOnLayerGroup (PinType *, int);
00143 bool ViaIsOnAnyVisibleLayer (PinType *);
00144 void SanitizeBuriedVia (PinType *);
00145 
00146 int GetMaxBottomLayer ();
00147 
00148 
00149 
00153 void NetlistChanged (int force_unfreeze);
00154 
00155 /*
00156  * Check whether mkdir() is mkdir or _mkdir, and whether it takes one
00157  * or two arguments.  WIN32 mkdir takes one argument and POSIX takes
00158  * two.
00159  */
00160 #if HAVE_MKDIR
00161         #if MKDIR_TAKES_ONE_ARG
00162          /* MinGW32 */
00163 #include <io.h> /* mkdir under MinGW only takes one argument */
00164          #define MKDIR(a, b) mkdir(a)
00165         #else
00166          #define MKDIR(a, b) mkdir(a, b)
00167         #endif
00168 #else
00169         #if HAVE__MKDIR
00170          /* plain Windows 32 */
00171          #define MKDIR(a, b) _mkdir(a)
00172         #else
00173          #define MKDIR(a, b) pcb_mkdir(a, b)
00174          #define MKDIR_IS_PCBMKDIR 1
00175          int pcb_mkdir (const char *path, int mode);
00176         #endif
00177 #endif
00178 
00179 
00180 #endif /* PCB_MISC_H */
00181