[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: pcb.git: branch: master updated (1a4ea522931737a60d238ce7caddf7541e99b2cd)



The branch, master has been updated
       via  1a4ea522931737a60d238ce7caddf7541e99b2cd (commit)
      from  8455c14f6bcee89ba120c403eb629e1d230e7f1b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 src/file.c       |    4 +-
 src/global.h     |  103 +++++++++++++++++++++++++++--------------------------
 src/pcb-printf.c |   33 ++++++++++-------
 3 files changed, 74 insertions(+), 66 deletions(-)


=================
 Commit Messages
=================

commit 1a4ea522931737a60d238ce7caddf7541e99b2cd
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    Introduce Coord/Angle types, convert global.h and pcb-printf to use it
    
    For now Grid (in PCB and Settings) and its increments are still
    doubles to avoid serious breakage. Will change these to Coords
    in a separate commit.
    
    Also add %ma spec for Angle, tell file.c to use it, to prevent
    printf problems with Angle when changing ctypes.

:100644 100644 c325c30... fef1046... M	src/file.c
:100644 100644 08abbb8... 94f4fae... M	src/global.h
:100644 100644 9f6734b... 7562a57... M	src/pcb-printf.c

=========
 Changes
=========

commit 1a4ea522931737a60d238ce7caddf7541e99b2cd
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    Introduce Coord/Angle types, convert global.h and pcb-printf to use it
    
    For now Grid (in PCB and Settings) and its increments are still
    doubles to avoid serious breakage. Will change these to Coords
    in a separate commit.
    
    Also add %ma spec for Angle, tell file.c to use it, to prevent
    printf problems with Angle when changing ctypes.

diff --git a/src/file.c b/src/file.c
index c325c30..fef1046 100644
--- a/src/file.c
+++ b/src/file.c
@@ -765,7 +765,7 @@ WriteElementData (FILE * FP, DataTypePtr Data)
       for (p = element->Arc; p != NULL; p = g_list_next (p))
 	{
 	  ArcType *arc = p->data;
-          pcb_fprintf (FP, "\tElementArc [%mc %mc %mc %mc %d %d %mc]\n",
+          pcb_fprintf (FP, "\tElementArc [%mc %mc %mc %mc %ma %ma %mc]\n",
                        arc->X - element->MarkX,
                        arc->Y - element->MarkY,
                        arc->Width, arc->Height,
@@ -804,7 +804,7 @@ WriteLayerData (FILE * FP, Cardinal Number, LayerTypePtr layer)
       for (n = layer->Arc; n != NULL; n = g_list_next (n))
 	{
 	  ArcType *arc = n->data;
-          pcb_fprintf (FP, "\tArc[%mc %mc %mc %mc %mc %mc %d %d %s]\n",
+          pcb_fprintf (FP, "\tArc[%mc %mc %mc %mc %mc %mc %ma %ma %s]\n",
                        arc->X, arc->Y, arc->Width,
                        arc->Height, arc->Thickness,
                        arc->Clearance, arc->StartAngle,
diff --git a/src/global.h b/src/global.h
index 08abbb8..94f4fae 100644
--- a/src/global.h
+++ b/src/global.h
@@ -83,13 +83,19 @@ typedef struct AttributeListType AttributeListType, *AttributeListTypePtr;
 # define bindtextdomain(D, Dir) (D)
 #endif /* ENABLE_NLS */
 
+
+typedef int Coord;		/* pcb base unit */
+typedef int Angle;		/* degrees */
+
+#if 1
 typedef int LocationType;
 typedef int BDimension;		/* big dimension */
+#endif
 
 /* This is used by the lexer/parser */
 typedef struct {
   int ival;
-  BDimension bval;
+  Coord bval;
   double dval;
   char has_units;
 } PLMeasure;
@@ -168,7 +174,7 @@ typedef struct
 /* Lines, pads, and rats all use this so they can be cross-cast.  */
 #define	ANYLINEFIELDS			\
 	ANYOBJECTFIELDS;		\
-	BDimension	Thickness,      \
+	Coord		Thickness,      \
                         Clearance;      \
 	PointType	Point1,		\
 			Point2
@@ -196,14 +202,14 @@ typedef struct
 
 struct BoxType		/* a bounding box */
 {
-  LocationType X1, Y1;		/* upper left */
-  LocationType X2, Y2;		/* and lower right corner */
+  Coord X1, Y1;		/* upper left */
+  Coord X2, Y2;		/* and lower right corner */
 };
 
 typedef struct
 {
-  LocationType x, y;
-  int width, height;
+  Coord x, y;
+  Coord width, height;
 } RectangleType, *RectangleTypePtr;
 
 typedef struct
@@ -230,7 +236,7 @@ typedef struct {
 
 typedef struct			/* a line/polygon point */
 {
-  LocationType X, Y, X2, Y2;	/* so Point type can be cast as BoxType */
+  Coord X, Y, X2, Y2;	/* so Point type can be cast as BoxType */
   long int ID;
 } PointType, *PointTypePtr;
 
@@ -248,8 +254,8 @@ typedef struct			/* holds information about one line */
 typedef struct
 {
   ANYOBJECTFIELDS;
-  BDimension Scale;		/* text scaling in percent */
-  LocationType X, Y;    	/* origin */
+  int Scale;		/* text scaling in percent */
+  Coord X, Y;    	/* origin */
   BYTE Direction;
   char *TextString;		/* string */
   void *Element;
@@ -273,12 +279,10 @@ struct polygon_st			/* holds information about a polygon */
 typedef struct			/* holds information about arcs */
 {
   ANYOBJECTFIELDS;
-  BDimension Thickness, Clearance;
-  LocationType Width,		/* length of axis */
-    Height, X,			/* center coordinates */
-    Y;
-  long int StartAngle,		/* the two limiting angles in degrees */
-    Delta;
+  Coord Thickness, Clearance;
+  Coord Width, Height,		/* length of axis */
+    X, Y;			/* center coordinates */
+  Angle StartAngle, Delta;	/* the two limiting angles in degrees */
 } ArcType, *ArcTypePtr;
 
 struct rtree
@@ -316,7 +320,7 @@ typedef struct			/* a rat-line */
 struct pad_st			/* a SMD pad */
 {
   ANYLINEFIELDS;
-  BDimension Mask;
+  Coord Mask;
   char *Name, *Number;		/* 'Line' */
   void *Element;
   void *Spare;
@@ -325,9 +329,8 @@ struct pad_st			/* a SMD pad */
 struct pin_st
 {
   ANYOBJECTFIELDS;
-  BDimension Thickness, Clearance, Mask, DrillingHole;
-  LocationType X,		/* center and diameter */
-    Y;
+  Coord Thickness, Clearance, Mask, DrillingHole;
+  Coord X, Y;		/* center and diameter */
   char *Name, *Number;
   void *Element;
   void *Spare;
@@ -341,8 +344,7 @@ typedef struct
   /* name on PCB second, */
   /* value third */
   /* see macro.h */
-  LocationType MarkX,		/* position mark */
-    MarkY;
+  Coord MarkX, MarkY;		/* position mark */
   Cardinal PinN;		/* number of pins */
   Cardinal PadN;		/* number of pads */
   Cardinal LineN;		/* number of lines */
@@ -364,13 +366,13 @@ typedef struct			/* a single symbol */
   bool Valid;
   Cardinal LineN,		/* number of lines */
     LineMax;
-  BDimension Width,		/* size of cell */
-    Height, Delta;		/* distance to next symbol in 0.00001'' */
+  Coord Width, Height,		/* size of cell */
+    Delta;			/* distance to next symbol */
 } SymbolType, *SymbolTypePtr;
 
 typedef struct			/* complete set of symbols */
 {
-  LocationType MaxHeight,	/* maximum cell width and height */
+  Coord MaxHeight,	/* maximum cell width and height */
     MaxWidth;
   BoxType DefaultSymbol;	/* the default symbol is a filled box */
   SymbolType Symbol[MAX_FONTPOSITION + 1];
@@ -394,7 +396,7 @@ typedef struct			/* holds all objects */
 
 typedef struct			/* holds drill information */
 {
-  BDimension DrillSize;		/* this drill's diameter */
+  Coord DrillSize;		/* this drill's diameter */
   Cardinal ElementN,		/* the number of elements using this drill size */
     ElementMax,			/* max number of elements from malloc() */
     PinCount,			/* number of pins drilled this size */
@@ -415,7 +417,7 @@ typedef struct			/* holds a range of Drill Infos */
 
 typedef struct
 {
-  BDimension Thick,		/* line thickness */
+  Coord Thick,			/* line thickness */
     Diameter,			/* via diameter */
     Hole,			/* via drill hole */
     Keepaway;			/* min. separation from other nets */
@@ -496,14 +498,14 @@ typedef struct PCBType
     *RatSelectedColor, *ConnectedColor, *WarnColor, *MaskColor;
   long CursorX,			/* cursor position as saved with layout */
     CursorY, Clipping;
-  int Bloat,			/* drc sizes saved with layout */
+  Coord Bloat,			/* drc sizes saved with layout */
     Shrink, minWid, minSlk, minDrill, minRing;
-  int GridOffsetX,		/* as saved with layout */
+  Coord GridOffsetX,		/* as saved with layout */
     GridOffsetY, MaxWidth,	/* allowed size */
     MaxHeight;
 
-  double Grid,			/* used grid with offsets */
-    Zoom,			/* zoom factor */
+  double Grid;			/* used grid with offsets */
+  double Zoom,			/* zoom factor */
     IsleArea,			/* minimum poly island to retain */
     ThermScale;			/* scale factor used with thermals */
   FontType Font;
@@ -519,8 +521,7 @@ PCBType, *PCBTypePtr;
 
 typedef struct			/* information about the paste buffer */
 {
-  LocationType X,		/* offset */
-    Y;
+  Coord X, Y;			/* offset */
   BoxType BoundingBox;
   DataTypePtr Data;		/* data; not all members of PCBType */
   /* are used */
@@ -555,8 +556,7 @@ typedef struct			/* currently marked block */
 
 typedef struct			/* currently attached object */
 {
-  LocationType X,		/* saved position when MOVE_MODE */
-    Y;				/* was entered */
+  Coord X, Y;			/* saved position when MOVE_MODE */
   BoxType BoundingBox;
   long int Type,		/* object type */
     State;
@@ -580,20 +580,20 @@ typedef struct			/* holds cursor information */
 {
   hidGC GC,			/* GC for cursor drawing */
     AttachGC;			/* and for displaying buffer contents */
-  LocationType X,		/* position in PCB coordinates */
-    Y, MinX,			/* lowest and highest coordinates */
-    MinY, MaxX, MaxY;
+  Coord X, Y,			/* position in PCB coordinates */
+    MinX, MinY,			/* lowest and highest coordinates */
+    MaxX, MaxY;
   AttachedLineType AttachedLine;	/* data of new lines... */
   AttachedBoxType AttachedBox;
   PolygonType AttachedPolygon;
   AttachedObjectType AttachedObject;	/* data of attached objects */
-  enum crosshair_shape shape; /* shape of crosshair */
+  enum crosshair_shape shape; 	/* shape of crosshair */
 } CrosshairType, *CrosshairTypePtr;
 
 typedef struct
 {
   bool status;
-  long int X, Y;
+  Coord X, Y;
 } MarkType, *MarkTypePtr;
 
 /* ---------------------------------------------------------------------------
@@ -625,18 +625,20 @@ typedef struct			/* some resources... */
     *GridColor,
     *LayerColor[MAX_LAYER],
     *LayerSelectedColor[MAX_LAYER], *WarnColor, *MaskColor;
-  int ViaThickness,		/* some preset values */
-    ViaDrillingHole, LineThickness, RatThickness, Keepaway, MaxWidth,	/* default size of a new layout */
-    MaxHeight, TextScale,	/* text scaling in % */
+  Coord ViaThickness,		/* some preset values */
+    ViaDrillingHole, LineThickness, RatThickness, Keepaway,	/* default size of a new layout */
+    MaxWidth, MaxHeight,
     AlignmentDistance, Bloat,	/* default drc sizes */
     Shrink, minWid, minSlk, minDrill, minRing;
-  double Grid,			/* grid 0.001'' */
-    IsleArea,    		/* polygon min area */
+  int TextScale;		/* text scaling in % */
+  double Grid,			/* grid in pcb-units */
     grid_increment_mm,		/* key g and <shift>g value for mil units */
     grid_increment_mil,		/* key g and <shift>g value for mil units */
     size_increment_mm,		/* key s and <shift>s value for mil units */
     size_increment_mil,		/* key s and <shift>s value for mil units */
-    line_increment_mm, line_increment_mil, clear_increment_mm, clear_increment_mil, Zoom,	/* number of shift operations for zooming */
+    line_increment_mm, line_increment_mil, clear_increment_mm, clear_increment_mil;	/* number of shift operations for zooming */
+  double Zoom,
+    IsleArea,    		/* polygon min area */
     PinoutZoom;			/* same for pinout windows */
   int PinoutNameLength,		/* max displayed length of a pinname */
     Volume,			/* the speakers volume -100..100 */
@@ -659,9 +661,9 @@ typedef struct			/* some resources... */
    *GnetlistProgram,		/* gnetlist program name */
    *MakeProgram,		/* make program name */
    *InitialLayerStack;		/* If set, the initial layer stack is set to this */
-  LocationType PinoutOffsetX,	/* offset of origin */
+  Coord PinoutOffsetX,		/* offset of origin */
     PinoutOffsetY;
-  int PinoutTextOffsetX,	/* offset of text from pin center */
+  Coord PinoutTextOffsetX,	/* offset of text from pin center */
     PinoutTextOffsetY;
   RouteStyleType RouteStyle[NUM_STYLES];	/* default routing styles */
   LayerGroupType LayerGroups;	/* default layer groups */
@@ -716,7 +718,7 @@ typedef struct
 
 typedef struct			/* holds a connection */
 {
-  LocationType X, Y;		/* coordinate of connection */
+  Coord X, Y;			/* coordinate of connection */
   long int type;		/* type of object in ptr1 - 3 */
   void *ptr1, *ptr2;		/* the object of the connection */
   Cardinal group;		/* the layer group of the connection */
@@ -764,9 +766,8 @@ struct drc_violation_st
 {
   char *title;
   char *explanation;
-  int x;
-  int y;
-  int angle;
+  Coord x, y;
+  Angle angle;
   int have_measured;
   double measured_value;
   double required_value;
diff --git a/src/pcb-printf.c b/src/pcb-printf.c
index 9f6734b..7562a57 100644
--- a/src/pcb-printf.c
+++ b/src/pcb-printf.c
@@ -81,7 +81,7 @@ static int min_sig_figs(double d)
  * string, with appropriate units. If more than one coord is
  * given, the list is enclosed in parens to make the scope of
  * the unit suffix clear.  */
-static gchar *CoordsToString(BDimension coord[], int n_coords, const char *printf_spec, enum e_allow allow, enum e_suffix suffix_type)
+static gchar *CoordsToString(Coord coord[], int n_coords, const char *printf_spec, enum e_allow allow, enum e_suffix suffix_type)
 {
   GString *buff;
   gchar *printf_buff;
@@ -236,7 +236,7 @@ static gchar *pcb_vprintf(const char *fmt, va_list args)
         {
           gchar *unit_str = NULL;
           const char *ext_unit = "";
-          BDimension value[10];
+          Coord value[10];
           int count, i;
 
           g_string_assign (spec, "");
@@ -324,8 +324,8 @@ static gchar *pcb_vprintf(const char *fmt, va_list args)
               ++fmt;
               if (*fmt == '*')
                 ext_unit = va_arg(args, const char *);
-              if (*fmt != '+')
-                value[0] = va_arg(args, BDimension);
+              if (*fmt != '+' && *fmt != 'a')
+                value[0] = va_arg(args, Coord);
               count = 1;
               switch(*fmt)
                 {
@@ -335,20 +335,20 @@ static gchar *pcb_vprintf(const char *fmt, va_list args)
                 case 'L': unit_str = CoordsToString(value, 1, spec->str, mask & ALLOW_IMPERIAL, suffix); break;
                 case 'r': unit_str = CoordsToString(value, 1, spec->str, ALLOW_READABLE, FILE_MODE); break;
                 /* All these fallthroughs are deliberate */
-                case '9': value[count++] = va_arg(args, BDimension);
-                case '8': value[count++] = va_arg(args, BDimension);
-                case '7': value[count++] = va_arg(args, BDimension);
-                case '6': value[count++] = va_arg(args, BDimension);
-                case '5': value[count++] = va_arg(args, BDimension);
-                case '4': value[count++] = va_arg(args, BDimension);
-                case '3': value[count++] = va_arg(args, BDimension);
+                case '9': value[count++] = va_arg(args, Coord);
+                case '8': value[count++] = va_arg(args, Coord);
+                case '7': value[count++] = va_arg(args, Coord);
+                case '6': value[count++] = va_arg(args, Coord);
+                case '5': value[count++] = va_arg(args, Coord);
+                case '4': value[count++] = va_arg(args, Coord);
+                case '3': value[count++] = va_arg(args, Coord);
                 case '2':
                 case 'D':
-                  value[count++] = va_arg(args, BDimension);
+                  value[count++] = va_arg(args, Coord);
                   unit_str = CoordsToString(value, count, spec->str, mask & ALLOW_ALL, suffix);
                   break;
                 case 'd':
-                  value[1] = va_arg(args, BDimension);
+                  value[1] = va_arg(args, Coord);
                   unit_str = CoordsToString(value, 2, spec->str, ALLOW_MM | ALLOW_MIL, suffix);
                   break;
                 case '*':
@@ -358,6 +358,13 @@ static gchar *pcb_vprintf(const char *fmt, va_list args)
                   if (unit_str == NULL)
                     unit_str = CoordsToString(value, 1, spec->str, mask & ALLOW_ALL, suffix);
                   break;
+                case 'a':
+                  value[0] = va_arg(args, Angle);
+                  g_string_append (spec, ".0f");
+                  if (suffix == SUFFIX)
+                    g_string_append (spec, " deg");
+                  unit_str = g_strdup_printf (spec->str, value[0]);
+                  break;
                 case '+':
                   mask = va_arg(args, enum e_allow);
                   break;




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs