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

gEDA-cvs: pcb.git: branch: master updated (82721122dae63a96c89d273bba7abd8b3e6e8337)



The branch, master has been updated
       via  82721122dae63a96c89d273bba7abd8b3e6e8337 (commit)
       via  571d8795faffc9894ba4ca4dc26b548e38301ec4 (commit)
       via  c317b9d7a59d806d99ce56836bd3e1462226a0aa (commit)
       via  90ca501f3356f116461e945f8e51a70d34af351d (commit)
       via  b58ba40105160ac0d464aeacd9faef97d678e1e8 (commit)
       via  d5bdffc18f35fa3538a7911a39939ec75504a33b (commit)
       via  be8c3bee18c38ff5c634af5f3632446885c0ac80 (commit)
       via  da86b04ab351c441c88d04eb9221badbe95d9e5a (commit)
       via  0586f240cd08ea3f2f9b84cb6536aee6caa37285 (commit)
       via  de55cc43ba47942b67b7463a62841096182d64f6 (commit)
      from  2daa8bb0ab325e4e8667ad3090a75210acd42f9e (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/action.c     |   10 ++--
 src/autoroute.c  |   11 ++--
 src/djopt.c      |  116 +++++++++++++++++--------------------
 src/file.c       |  173 +++++++++++++++++++++++------------------------------
 src/pcb-printf.c |   21 +++++++
 src/pcb-printf.h |    9 ++-
 src/polygon.c    |    7 +-
 src/polygon1.c   |   25 ++++----
 src/puller.c     |  116 +++++++++++++++++-------------------
 src/toporouter.c |   13 ++--
 10 files changed, 243 insertions(+), 258 deletions(-)


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

commit 82721122dae63a96c89d273bba7abd8b3e6e8337
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    Convert toporouter trace code to use pcb-printf
    
    There is still a fair amount of trace code outputting
    measurements that are floating-point values. I left
    these alone since they will work independently of the
    actual type of BDimension.
    
    Everything should still be output in base units.

:100644 100644 402de74... 5a82b14... M	src/toporouter.c

commit 571d8795faffc9894ba4ca4dc26b548e38301ec4
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    Convert polygon and polygon1.c debug code to use pcb-printf

:100644 100644 2ff3433... 0b5b2d0... M	src/polygon.c
:100644 100644 1dba74c... 70d553f... M	src/polygon1.c

commit c317b9d7a59d806d99ce56836bd3e1462226a0aa
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    Convert puller.c trace code to use pcb-printf
    
    Minor changes to trace output (addition of parens,
    mainly). Should be no user-visible output. No longer
    assumes BDimension == int.

:100644 100644 bcf8fae... 8550872... M	src/puller.c

commit 90ca501f3356f116461e945f8e51a70d34af351d
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    Convert djopt.c to use pcb-printf
    
    No change in user-visible output.
    
    Debug output is slightly changed since pcb-printf likes
    to put parens around tuples, so "%d,%d" is now effectively
    "(%d, %d)". Debug output is all base units, so the numbers
    will not change until the base unit size is changed.

:100644 100644 f313127... 0b00d8e... M	src/djopt.c

commit b58ba40105160ac0d464aeacd9faef97d678e1e8
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    Convert autoroute.c debug code to use pcb-printf
    
    Should be no change in output. Only change is that
    we no longer assume BDimension == int.

:100644 100644 9005259... c799e93... M	src/autoroute.c

commit d5bdffc18f35fa3538a7911a39939ec75504a33b
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    Change action.c *WARN* lines to use pcb-printf
    
    Now instead of outputting unsuffixed cmils, warnings
    about locked/unnamed elements will refer to the part's
    position in either mm or mil, with an appropriate suffix.
    
    Non-warning-related output is unchanged.

:100644 100644 4f2e401... 8b7e6d5... M	src/action.c

commit be8c3bee18c38ff5c634af5f3632446885c0ac80
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    Convert file.c to use pcb-printf for cmil output
    
    file.c now uses pcb-printf, though in a limited way:
    everything is still output in unsuffixed cmils, though
    this is now independent of pcb's internal unit size.
    
    I have also removed the old-style output for symbols.
    
    Aside from that, everything should be the same. Any
    other change in output, or file format incompatibility
    of any kind, is a bug.

:100644 100644 682aa02... f4fb12e... M	src/file.c

commit da86b04ab351c441c88d04eb9221badbe95d9e5a
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    Add # subspecifier to pcb-printf to prevent scaling for debug output

:100644 100644 e0fe9d1... d2b31b7... M	src/pcb-printf.c
:100644 100644 6b87a85... bcf319e... M	src/pcb-printf.h

commit 0586f240cd08ea3f2f9b84cb6536aee6caa37285
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    Convert puller.c to use Distance() intead of its own function

:100644 100644 3cd2500... bcf8fae... M	src/puller.c

commit de55cc43ba47942b67b7463a62841096182d64f6
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    Add pcb_printf to pcb_*printf family of functions

:100644 100644 2ede73c... e0fe9d1... M	src/pcb-printf.c
:100644 100644 2992d1b... 6b87a85... M	src/pcb-printf.h

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

commit 82721122dae63a96c89d273bba7abd8b3e6e8337
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    Convert toporouter trace code to use pcb-printf
    
    There is still a fair amount of trace code outputting
    measurements that are floating-point values. I left
    these alone since they will work independently of the
    actual type of BDimension.
    
    Everything should still be output in base units.

diff --git a/src/toporouter.c b/src/toporouter.c
index 402de74..5a82b14 100644
--- a/src/toporouter.c
+++ b/src/toporouter.c
@@ -55,6 +55,7 @@
 
 
 #include "toporouter.h"
+#include "pcb-printf.h"
 
 static void 
 toporouter_edge_init (toporouter_edge_t *edge)
@@ -2822,7 +2823,7 @@ import_clusters(toporouter_t *r)
             cluster_join_bbox(cluster, box);
 
 #ifdef DEBUG_MERGING  
-            printf("\tLINE %d,%d\n", connection->X, connection->Y);
+            pcb_printf("\tLINE %#mD\n", connection->X, connection->Y);
 #endif        
           }else if(connection->type == PAD_TYPE) {
             PadType *pad = (PadType *) connection->ptr2;
@@ -2830,7 +2831,7 @@ import_clusters(toporouter_t *r)
             cluster_join_bbox(cluster, box);
 
 #ifdef DEBUG_MERGING  
-            printf("\tPAD %d,%d\n", connection->X, connection->Y);
+            pcb_printf("\tPAD %#mD\n", connection->X, connection->Y);
 #endif        
           }else if(connection->type == PIN_TYPE) {
 
@@ -2841,7 +2842,7 @@ import_clusters(toporouter_t *r)
             }
 
 #ifdef DEBUG_MERGING  
-            printf("\tPIN %d,%d\n", connection->X, connection->Y);
+            pcb_printf("\tPIN %#mD\n", connection->X, connection->Y);
 #endif        
           }else if(connection->type == VIA_TYPE) {
 
@@ -2852,7 +2853,7 @@ import_clusters(toporouter_t *r)
             }
 
 #ifdef DEBUG_MERGING  
-            printf("\tVIA %d,%d\n", connection->X, connection->Y);
+            pcb_printf("\tVIA %#mD\n", connection->X, connection->Y);
 #endif        
           }else if(connection->type == POLYGON_TYPE) {
             PolygonType *polygon = (PolygonType *) connection->ptr2;
@@ -2860,7 +2861,7 @@ import_clusters(toporouter_t *r)
             cluster_join_bbox(cluster, box);
 
 #ifdef DEBUG_MERGING  
-            printf("\tPOLYGON %d,%d\n", connection->X, connection->Y);
+            pcb_printf("\tPOLYGON %#mD\n", connection->X, connection->Y);
 #endif        
 
           }
@@ -6877,7 +6878,7 @@ import_route(toporouter_t *r, RatType *line)
   if(!routedata->dest) printf("couldn't locate dest\n");
 
   if(!routedata->src || !routedata->dest) {
-    printf("PROBLEM: couldn't locate rat src or dest for rat %d,%d,%d -> %d,%d,%d\n",
+    pcb_printf("PROBLEM: couldn't locate rat src or dest for rat %#mD, %d -> %#mD, %d\n",
         line->Point1.X, line->Point1.Y, line->group1, line->Point2.X, line->Point2.Y, line->group2);
     free(routedata);
     return NULL;

commit 571d8795faffc9894ba4ca4dc26b548e38301ec4
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    Convert polygon and polygon1.c debug code to use pcb-printf

diff --git a/src/polygon.c b/src/polygon.c
index 2ff3433..0b5b2d0 100644
--- a/src/polygon.c
+++ b/src/polygon.c
@@ -90,6 +90,7 @@ dicer output is used for HIDs which cannot render things with holes
 #include "find.h"
 #include "misc.h"
 #include "move.h"
+#include "pcb-printf.h"
 #include "polygon.h"
 #include "remove.h"
 #include "rtree.h"
@@ -1856,12 +1857,12 @@ MorphPolygon (LayerTypePtr layer, PolygonTypePtr poly)
 void debug_pline (PLINE *pl)
 {
   VNODE *v;
-  fprintf (stderr, "\txmin %d xmax %d ymin %d ymax %d\n",
+  pcb_fprintf (stderr, "\txmin %#mS xmax %#mS ymin %#mS ymax %#mS\n",
 	   pl->xmin, pl->xmax, pl->ymin, pl->ymax);
   v = &pl->head;
   while (v)
     {
-      fprintf(stderr, "\t\tvnode: %d,%d\n", v->point[0], v->point[1]);
+      pcb_fprintf(stderr, "\t\tvnode: %#mD\n", v->point[0], v->point[1]);
       v = v->next;
       if (v == &pl->head)
 	break;
@@ -1885,7 +1886,7 @@ debug_polygon (PolygonType *p)
   POLYAREA *pa;
   fprintf (stderr, "POLYGON %p  %d pts\n", p, p->PointN);
   for (i=0; i<p->PointN; i++)
-    fprintf(stderr, "\t%d: %d, %d\n", i, p->Points[i].X, p->Points[i].Y);
+    pcb_fprintf(stderr, "\t%d: %#mD\n", i, p->Points[i].X, p->Points[i].Y);
   if (p->HoleIndexN)
     {
       fprintf (stderr, "%d holes, starting at indices\n", p->HoleIndexN);
diff --git a/src/polygon1.c b/src/polygon1.c
index 1dba74c..70d553f 100644
--- a/src/polygon1.c
+++ b/src/polygon1.c
@@ -102,7 +102,7 @@ int vect_inters2 (Vector A, Vector B, Vector C, Vector D, Vector S1,
 #undef DEBUG_ANGLE
 #undef DEBUG
 #ifdef DEBUG
-#define DEBUGP(...) fprintf(stderr, ## __VA_ARGS__)
+#define DEBUGP(...) pcb_fprintf(stderr, ## __VA_ARGS__)
 #else
 #define DEBUGP(...)
 #endif
@@ -134,7 +134,7 @@ pline_dump (VNODE * v)
   do
     {
       n = v->next;
-      fprintf (stderr, "Line [%d %d %d %d 10 10 \"%s\"]\n",
+      pcb_fprintf (stderr, "Line [%#mS %#mS %#mS %#mS 10 10 \"%s\"]\n",
 	       v->point[0], v->point[1],
 	       n->point[0], n->point[1], theState (v));
     }
@@ -254,7 +254,7 @@ new_descriptor (VNODE * a, char poly, char side)
   l->angle = ang;
   assert (ang >= 0.0 && ang <= 4.0);
 #ifdef DEBUG_ANGLE
-  DEBUGP ("node on %c at (%d,%d) assigned angle %g on side %c\n", poly,
+  DEBUGP ("node on %c at %#mD assigned angle %g on side %c\n", poly,
 	  a->point[0], a->point[1], ang, side);
 #endif
   return l;
@@ -637,7 +637,7 @@ seg_in_seg (const BoxType * b, void *cl)
       if (new_node != NULL)
 	{
 #ifdef DEBUG_INTERSECT
-	  DEBUGP ("new intersection on segment \"i\" at (%d, %d)\n",
+	  DEBUGP ("new intersection on segment \"i\" at %#mD\n",
 	          cnt > 1 ? s2[0] : s1[0], cnt > 1 ? s2[1] : s1[1]);
 #endif
 	  i->node_insert_list =
@@ -649,7 +649,7 @@ seg_in_seg (const BoxType * b, void *cl)
       if (new_node != NULL)
 	{
 #ifdef DEBUG_INTERSECT
-	  DEBUGP ("new intersection on segment \"s\" at (%d, %d)\n",
+	  DEBUGP ("new intersection on segment \"s\" at %#mD\n",
 	          cnt > 1 ? s2[0] : s1[0], cnt > 1 ? s2[1] : s1[1]);
 #endif
 	  i->node_insert_list =
@@ -1056,7 +1056,7 @@ print_labels (PLINE * a)
 
   do
     {
-      DEBUGP ("(%d,%d)->(%d,%d) labeled %s\n", c->point[0], c->point[1],
+      DEBUGP ("%#mD->%#mD labeled %s\n", c->point[0], c->point[1],
 	      c->next->point[0], c->next->point[1], theState (c));
     }
   while ((c = c->next) != &a->head);
@@ -1568,8 +1568,7 @@ jump (VNODE ** cur, DIRECTION * cdir, J_Rule rule)
       return TRUE;
     }
 #ifdef DEBUG_JUMP
-  DEBUGP ("jump entering node at (%d, %d)\n", (*cur)->point[0],
-	  (*cur)->point[1]);
+  DEBUGP ("jump entering node at %$mD\n", (*cur)->point[0], (*cur)->point[1]);
 #endif
   if (*cdir == FORW)
     d = (*cur)->cvc_prev->prev;
@@ -1589,10 +1588,10 @@ jump (VNODE ** cur, DIRECTION * cdir, J_Rule rule)
 	    {
 #ifdef DEBUG_JUMP
 	      if (newone == FORW)
-		DEBUGP ("jump leaving node at (%d, %d)\n",
+		DEBUGP ("jump leaving node at %#mD\n",
 			e->next->point[0], e->next->point[1]);
 	      else
-		DEBUGP ("jump leaving node at (%d, %d)\n",
+		DEBUGP ("jump leaving node at %#mD\n",
 			e->point[0], e->point[1]);
 #endif
 	      *cur = d->parent;
@@ -1633,7 +1632,7 @@ Gather (VNODE * start, PLINE ** result, J_Rule v_rule, DIRECTION initdir)
 	  poly_InclVertex ((*result)->head.prev, newn);
 	}
 #ifdef DEBUG_GATHER
-      DEBUGP ("gather vertex at (%d, %d)\n", cur->point[0], cur->point[1]);
+      DEBUGP ("gather vertex at %#mD\n", cur->point[0], cur->point[1]);
 #endif
       /* Now mark the edge as included.  */
       newn = (dir == FORW ? cur : cur->prev);
@@ -3257,7 +3256,7 @@ poly_Valid (POLYAREA * p)
       do
 	{
 	  n = v->next;
-	  fprintf (stderr, "Line [%d %d %d %d 100 100 \"\"]\n",
+	  pcb_fprintf (stderr, "Line [%#mS %#mS %#mS %#mS 100 100 \"\"]\n",
 		   v->point[0], v->point[1], n->point[0], n->point[1]);
 	}
       while ((v = v->next) != &p->contours->head);
@@ -3282,7 +3281,7 @@ poly_Valid (POLYAREA * p)
 	  do
 	    {
 	      n = v->next;
-	      fprintf (stderr, "Line [%d %d %d %d 100 100 \"\"]\n",
+	      pcb_fprintf (stderr, "Line [%#mS %#mS %#mS %#mS 100 100 \"\"]\n",
 		       v->point[0], v->point[1], n->point[0], n->point[1]);
 	    }
 	  while ((v = v->next) != &c->head);

commit c317b9d7a59d806d99ce56836bd3e1462226a0aa
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    Convert puller.c trace code to use pcb-printf
    
    Minor changes to trace output (addition of parens,
    mainly). Should be no user-visible output. No longer
    assumes BDimension == int.

diff --git a/src/puller.c b/src/puller.c
index bcf8fae..8550872 100644
--- a/src/puller.c
+++ b/src/puller.c
@@ -63,6 +63,7 @@
 #include "draw.h"
 #include "misc.h"
 #include "move.h"
+#include "pcb-printf.h"
 #include "remove.h"
 #include "rtree.h"
 #include "strflags.h"
@@ -137,7 +138,7 @@ arc_endpoint_is (ArcTypePtr a, int angle, int x, int y)
       ay += a->Width * sin (rad);
     }
 #if TRACE1
-  printf (" - arc endpoint %d,%d\n", ax, ay);
+  pcb_printf (" - arc endpoint %#mD\n", ax, ay);
 #endif
   arc_dist = Distance (ax, ay, x, y);
   if (arc_exact)
@@ -278,7 +279,7 @@ dist_lp (int x1, int y1, int x2, int y2, int px, int py)
 		     - ((double)x1 - px) * ((double)y2 - y1))
 	       / den);
 #if TRACE1
-  printf("dist (%d,%d-%d,%d) to %d,%d is %f\n",
+  pcb_printf("dist %#mD-%#mD to %#mD is %f\n",
 	 x1, y1, x2, y2, px, py, rv);
 #endif
   return rv;
@@ -312,7 +313,7 @@ line_callback (const BoxType * b, void *cl)
   LineTypePtr l = (LineTypePtr) b;
   double d1, d2, t;
 #if TRACE1
-  printf ("line %d,%d .. %d,%d\n",
+  pcb_printf ("line %#mD .. %#mD\n",
 	  l->Point1.X, l->Point1.Y, l->Point2.X, l->Point2.Y);
 #endif
   d1 = Distance (l->Point1.X, l->Point1.Y, x, y);
@@ -342,7 +343,7 @@ arc_callback (const BoxType * b, void *cl)
   ArcTypePtr a = (ArcTypePtr) b;
 
 #if TRACE1
-  printf ("arc a %d,%d r %d sa %ld d %ld\n", a->X, a->Y, a->Width,
+  pcb_printf ("arc a %#mD r %#mS sa %ld d %ld\n", a->X, a->Y, a->Width,
 	  a->StartAngle, a->Delta);
 #endif
   if (!arc_endpoint_is (a, a->StartAngle, x, y)
@@ -380,7 +381,7 @@ find_pair (int Px, int Py)
   BoxType spot;
 
 #if TRACE1
-  printf ("\nPuller find_pair at %d,%d\n", Crosshair.X, Crosshair.Y);
+  pcb_printf ("\nPuller find_pair at %#mD\n", Crosshair.X, Crosshair.Y);
 #endif
 
   x = Px;
@@ -696,7 +697,7 @@ fix_arc_extra (ArcTypePtr a, Extra *e)
   e->end.x = a->X - (a->Width * cos (d2r (a->StartAngle+a->Delta)) + 0.5);
   e->end.y = a->Y + (a->Height * sin (d2r (a->StartAngle+a->Delta)) + 0.5);
 #if TRACE1
-  printf("new X,Y is %d,%d to %d,%d\n", e->start.x, e->start.y, e->end.x, e->end.y);
+  pcb_printf("new X,Y is %#mD to %#mD\n", e->start.x, e->start.y, e->end.x, e->end.y);
 #endif
 }
 
@@ -725,7 +726,7 @@ find_pair_line_callback (const BoxType * b, void *cl)
     abort1();
 #endif
 #if TRACE1
-  printf(" - %p line %d,%d or %d,%d\n", e, line->Point1.X, line->Point1.Y,
+  pcb_printf(" - %p line %#mD or %#mD\n", e, line->Point1.X, line->Point1.Y,
 	 line->Point2.X, line->Point2.Y);
 #endif
   if ((NEAR (line->Point1.X, fpcs->x) && NEAR (line->Point1.Y, fpcs->y))
@@ -759,7 +760,7 @@ find_pair_arc_callback (const BoxType * b, void *cl)
   if (arc == fpcs->me)
     return 0;
 #if TRACE1
-  printf(" - %p arc %d,%d or %d,%d\n", e, e->start.x, e->start.y, e->end.x, e->end.y);
+  pcb_printf(" - %p arc %#mD or %#mD\n", e, e->start.x, e->start.y, e->end.x, e->end.y);
 #endif
   if ((NEAR (e->start.x, fpcs->x) && NEAR (e->start.y, fpcs->y))
       || (NEAR (e->end.x, fpcs->x) && NEAR (e->end.y, fpcs->y)))
@@ -791,7 +792,7 @@ find_pairs_1 (void *me, Extra **e, int x, int y)
   fpcs.x = x;
   fpcs.y = y;
 #if TRACE1
-  printf("looking for %d,%d\n", x, y);
+  pcb_printf("looking for %#mD\n", x, y);
 #endif
   b.X1 = x - 10;
   b.X2 = x + 10;
@@ -850,7 +851,7 @@ find_pair_pinline_callback (const BoxType * b, void *cl)
 		pin->X, pin->Y) <= pin->Thickness/2)
     {
 #if TRACE1
-      printf("splitting line %d,%d-%d,%d because it passes through pin %d,%d r%d\n",
+      pcb_printf("splitting line %#mD-%#mD because it passes through pin %#mD r%d\n",
 	     line->Point1.X, line->Point1.Y,
 	     line->Point2.X, line->Point2.Y,
 	     pin->X, pin->Y, pin->Thickness/2);
@@ -880,7 +881,7 @@ check_point_in_pad (PadTypePtr pad, int x, int y, End *e)
   int inside_p;
   int t;
 
-  printf("pad %d,%d - %d,%d t %d  vs  %d,%d\n", pad->Point1.X, pad->Point1.Y,
+  pcb_printf("pad %#mD - %#mD t %#mS  vs  %#mD\n", pad->Point1.X, pad->Point1.Y,
 	 pad->Point2.X, pad->Point2.Y, pad->Thickness, x, y);
   t = (pad->Thickness+1)/2;
   if (TEST_FLAG (SQUAREFLAG, pad))
@@ -986,7 +987,7 @@ find_pair_padline_callback (const BoxType * b, void *cl)
       /* It does.  */
       /* FIXME: we should split the line.  */
 #if TRACE1
-      printf("splitting line %d,%d-%d,%d because it passes through pad %d,%d-%d,%d r%d\n",
+      pcb_printf("splitting line %#mD-%#mD because it passes through pad %#mD-%#mD r %#mS\n",
 	     line->Point1.X, line->Point1.Y,
 	     line->Point2.X, line->Point2.Y,
 	     pad->Point1.X, pad->Point1.Y,
@@ -1255,7 +1256,7 @@ print_extra (Extra *e, Extra *prev)
   if (EXTRA_IS_LINE (e))
     {
       LineTypePtr line = EXTRA2LINE (e);
-      printf(" %p L %d,%d-%d,%d", line, line->Point1.X, line->Point1.Y, line->Point2.X, line->Point2.Y);
+      pcb_printf(" %p L %#mD-%#mD", line, line->Point1.X, line->Point1.Y, line->Point2.X, line->Point2.Y);
       printf("  %s %p %s %p\n",
 	     e->start.is_pad ? "pad" : "pin", e->start.pin,
 	     e->end.is_pad ? "pad" : "pin", e->end.pin);
@@ -1263,8 +1264,8 @@ print_extra (Extra *e, Extra *prev)
   else if (EXTRA_IS_ARC (e))
     {
       ArcTypePtr arc = EXTRA2ARC (e);
-      printf(" %p A %d,%d-%d,%d", arc, e->start.x, e->start.y, e->end.x, e->end.y);
-      printf(" at %d,%d ang %ld,%ld\n", arc->X, arc->Y, arc->StartAngle, arc->Delta);
+      pcb_printf(" %p A %#mD-%#mD", arc, e->start.x, e->start.y, e->end.x, e->end.y);
+      pcb_printf(" at %#mD ang %ld,%ld\n", arc->X, arc->Y, arc->StartAngle, arc->Delta);
     }
   else if (e == &multi_next)
     {
@@ -1423,7 +1424,7 @@ gp_point_force (int x, int y, int t, End *e, int esa, int eda, int force, const
   double base_angle, rel_angle, point_angle;
 
 #if TRACE1
-  printf("\033[34mgp_point_force %d,%d %d via %s\033[0m\n", x, y, t, name);
+  pcb_printf("\033[34mgp_point_force %#mD %#mS via %s\033[0m\n", x, y, t, name);
 #endif
 
   if (start_arc)
@@ -1444,8 +1445,8 @@ gp_point_force (int x, int y, int t, End *e, int esa, int eda, int force, const
   /* See if the point is inside our start arc. */
   d = Distance (scx, scy, x, y);
 #if TRACE1
-  printf("%f = dist (%d,%d to %d,%d)\n", d, scx, scy, x, y);
-  printf("sr %d r %f d %f\n", sr, r, d);
+  pcb_printf("%f = dist #mD to %#mD\n", d, scx, scy, x, y);
+  pcb_printf("sr %#mS r %f d %f\n", sr, r, d);
 #endif
   if (d  < sr - r)
     {
@@ -1468,8 +1469,8 @@ gp_point_force (int x, int y, int t, End *e, int esa, int eda, int force, const
   /* angle between points (NOT pcb arc angles) */
   base_angle = atan2 (y - scy, x - scx);
 #if TRACE1
-  printf("%.1f = atan2 (%d-%d = %d, %d-%d = %d)\n",
-	 r2d(base_angle), y, scy, y-scy, x, scx, x-scx);
+  pcb_printf("%.1f = atan2 (%#mS-%#mS = %#mS, %#mS-%#mS = %#mS)\n",
+	     r2d(base_angle), y, scy, y-scy, x, scx, x-scx);
 #endif
 
   if ((sa_sign * sr - r) / d > 1
@@ -1539,12 +1540,12 @@ gp_point_force (int x, int y, int t, End *e, int esa, int eda, int force, const
 		       start_line->Point2.X, start_line->Point2.Y,
 		       x, y);
 #if TRACE1
-      printf("point %d,%d dist %f vs thickness %d\n", x, y, new_r, thickness);
+      pcb_printf("point %#mD dist %#mS vs thickness %#mS\n", x, y, new_r, thickness);
 #endif
       new_r -= thickness;
       new_r = (int)new_r - 1;
 #if TRACE1
-      printf(" - new thickness %f old %d\n", new_r, t);
+      pcb_printf(" - new thickness %f old %#mS\n", new_r, t);
 #endif
       if (new_r < t)
 	gp_point_force (x, y, new_r, e, esa, eda, 1, __FUNCTION__);
@@ -1594,7 +1595,7 @@ gp_point_2 (int x, int y, int t, End *e, int esa, int eda, const char *func)
     return 0;
 
 #if TRACE1
-  printf("\033[34mgp_point %d,%d %d via %s\033[0m\n", x, y, t, func);
+  pcb_printf("\033[34mgp_point %#mD %#mS via %s\033[0m\n", x, y, t, func);
 #endif
 
   /* There are two regions we care about.  For points inside our
@@ -1828,7 +1829,7 @@ create_line (LineTypePtr sample, int x1, int y1, int x2, int y2)
 {
   Extra *e;
 #if TRACE1
-  printf("create_line from %d,%d to %d,%d\n", x1, y1, x2, y2);
+  pcb_printf("create_line from %#mD to %#mD\n", x1, y1, x2, y2);
 #endif
   LineTypePtr line = CreateNewLineOnLayer (CURRENT, x1, y1, x2, y2,
 					   sample->Thickness, sample->Clearance, sample->Flags);
@@ -1852,7 +1853,7 @@ create_arc (LineTypePtr sample, int x, int y, int r, int sa, int da)
   if (r % 100 == 99)
     r++;
 #if TRACE1
-  printf("create_arc at %d,%d r %d sa %d delta %d\n", x, y, r, sa, da);
+  pcb_printf("create_arc at %#mD r %#mS sa %d delta %d\n", x, y, r, sa, da);
 #endif
   arc = CreateNewArcOnLayer (CURRENT, x, y, r, r, sa, da,
 					sample->Thickness, sample->Clearance, sample->Flags);
@@ -1946,7 +1947,7 @@ mark_line_for_deletion (LineTypePtr l)
   e->deleted = 1;
   unlink_extras (e);
 #if TRACE1
-  printf("Marked line %p for deletion %d,%d to %d,%d\n",
+  pcb_printf("Marked line %p for deletion %#mD to %#mD\n",
 	 e, l->Point1.X, l->Point1.Y, l->Point2.X, l->Point2.Y);
 #endif
 #if 0
@@ -2161,7 +2162,7 @@ maybe_pull_1 (LineTypePtr line)
   fy = ey;
   if (fx < 0)
     {
-      fprintf(stderr, "end line corrupt? f is %d,%d\n", fx, fy);
+      pcb_fprintf(stderr, "end line corrupt? f is %#mD\n", fx, fy);
       print_extra (end_extra, 0);
       if (earc_extra)
 	print_extra(earc_extra, 0);
@@ -2187,7 +2188,7 @@ maybe_pull_1 (LineTypePtr line)
   abs_angle = fa + start_angle;
 
 #if TRACE1
-  printf("\033[43;30mBest: at %d,%d r %d, angle %.1f fp %d\033[0m\n", fx, fy, fr, r2d(fa), fp);
+  pcb_printf("\033[43;30mBest: at %#mD r %#mS, angle %.1f fp %d\033[0m\n", fx, fy, fr, r2d(fa), fp);
 #endif
 
 #if 0
@@ -2230,7 +2231,7 @@ maybe_pull_1 (LineTypePtr line)
 	    new_delta -= 360;
 	}
 #if TRACE1
-      printf("merging arcs at %d,%d nd %d\n", start_arc->X, start_arc->Y, new_delta);
+      pcb_printf("merging arcs at %#mS nd %d\n", start_arc->X, start_arc->Y, new_delta);
       print_extra(sarc_extra, 0);
       print_extra(earc_extra, 0);
 #endif
@@ -2255,7 +2256,7 @@ maybe_pull_1 (LineTypePtr line)
       new_delta = 180 - r2d(abs_angle);
 #if TRACE1
       printf("new_delta starts at %d vs %d < %d\n",
-	     (int)new_delta, start_arc->StartAngle, start_arc->Delta);
+	     (int)new_delta, (int)start_arc->StartAngle, (int)start_arc->Delta);
 #endif
       if (start_arc->Delta < 0)
 	new_delta = (int)(new_delta) + 90;
@@ -2269,7 +2270,7 @@ maybe_pull_1 (LineTypePtr line)
 #if TRACE1
       printf("new_delta adjusts to %d\n", (int)new_delta);
       printf("fa = %f, new_delta ends at %.1f vs start %d\n",
-	     fa, new_delta, start_arc->StartAngle);
+	     fa, new_delta, (int)start_arc->StartAngle);
 #endif
 
       if (new_delta * start_arc->Delta <= 0)
@@ -2297,7 +2298,7 @@ maybe_pull_1 (LineTypePtr line)
     double ox = fx + fr * cos(oa);
     double oy = fy + fr * sin(oa);
 #if TRACE1
-    printf("obstacle at %d,%d angle %d = arc starts at %d,%d\n",
+    pcb_printf("obstacle at %#mD angle %d = arc starts at %#mD\n",
 	   fx, fy, (int)r2d(oa), (int)ox, (int)oy);
 #endif
 
@@ -2313,7 +2314,7 @@ maybe_pull_1 (LineTypePtr line)
   /* Step 2: If we have no obstacles, connect start and end.  */
 
 #if TRACE1
-  printf("fx %d ex %d fy %d ey %d\n", fx, ex, fy, ey);
+  pcb_printf("fx %#mS ex %#mS fy %#mS ey %#mS\n", fx, ex, fy, ey);
 #endif
   if (fx == ex && fy == ey)
     {
@@ -2385,8 +2386,8 @@ maybe_pull_1 (LineTypePtr line)
   ex = start_line->Point1.X + cos(start_angle + fa) * 10000.0;
   ey = start_line->Point1.Y + sin(start_angle + fa) * 10000.0;
 #if TRACE1
-  printf("temp point %d,%d\n", ex, ey);
-  printf("intersect %d,%d-%d,%d with %d,%d-%d,%d\n",
+  pcb_printf("temp point %#mS\n", ex, ey);
+  pcb_printf("intersect %#mS-%#mS with %#mS-%#mS\n",
 	 start_line->Point1.X, start_line->Point1.Y,
 	 ex, ey,
 	 end_line->Point1.X, end_line->Point1.Y,
@@ -2402,7 +2403,7 @@ maybe_pull_1 (LineTypePtr line)
       ey = end_line->Point2.Y;
     }	
 #if TRACE1
-  printf("new point %d,%d\n", ex, ey);
+  pcb_printf("new point %#mS\n", ex, ey);
 #endif
   MoveObject (LINEPOINT_TYPE, CURRENT, end_line, &(end_line->Point1),
 	      ex - end_line->Point1.X,

commit 90ca501f3356f116461e945f8e51a70d34af351d
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    Convert djopt.c to use pcb-printf
    
    No change in user-visible output.
    
    Debug output is slightly changed since pcb-printf likes
    to put parens around tuples, so "%d,%d" is now effectively
    "(%d, %d)". Debug output is all base units, so the numbers
    will not change until the base unit size is changed.

diff --git a/src/djopt.c b/src/djopt.c
index f313127..0b00d8e 100644
--- a/src/djopt.c
+++ b/src/djopt.c
@@ -44,6 +44,7 @@
 #include "undo.h"
 #include "strflags.h"
 #include "find.h"
+#include "pcb-printf.h"
 
 #ifdef HAVE_LIBDMALLOC
 #include <dmalloc.h>
@@ -55,7 +56,7 @@ RCSID ("$Id$");
 #define rint(x)  (ceil((x) - 0.5))
 #endif
 
-#define dprintf if(0)printf
+#define dprintf if(0)pcb_printf
 
 #define selected(x) TEST_FLAG (SELECTEDFLAG, (x))
 #define autorouted(x) TEST_FLAG (AUTOFLAG, (x))
@@ -198,19 +199,18 @@ corner_name (corner_s * c)
   bp = buf[bn] + strlen (buf[bn]);
 
   if (c->pin)
-    sprintf (bp, "pin %s:%s at %d,%d", element_name_for (c), c->pin->Number,
-	     c->x, c->y);
+    pcb_sprintf (bp, "pin %s:%s at %#mD", element_name_for (c), c->pin->Number, c->x, c->y);
   else if (c->via)
-    sprintf (bp, "via at %d,%d", c->x, c->y);
+    pcb_sprintf (bp, "via at %#mD", c->x, c->y);
   else if (c->pad)
     {
-      sprintf (bp, "pad %s:%s at %d,%d (%d,%d-%d,%d)",
+      pcb_sprintf (bp, "pad %s:%s at %#mD %#mD-%#mD",
 	       element_name_for (c), c->pad->Number, c->x, c->y,
 	       c->pad->Point1.X, c->pad->Point1.Y,
 	       c->pad->Point2.X, c->pad->Point2.Y);
     }
   else
-    sprintf (bp, "at %d,%d", c->x, c->y);
+    pcb_sprintf (bp, "at %#mD", c->x, c->y);
   sprintf (bp + strlen (bp), " n%d l%d]\033[0m", c->n_lines, c->layer);
   return buf[bn];
 }
@@ -278,7 +278,7 @@ check2 (int srcline, corner_s * c, line_s * l)
 	      || ll->e->x != ll->line->Point2.X
 	      || ll->e->y != ll->line->Point2.Y))
 	{
-	  printf ("line: %d,%d to %d,%d  pcbline: %d,%d to %d,%d\n",
+	  pcb_printf ("line: %#mD to %#mD  pcbline: %#mD to %#mD\n",
 		  ll->s->x, ll->s->y,
 		  ll->e->x, ll->e->y,
 		  ll->line->Point1.X,
@@ -523,7 +523,7 @@ add_line_to_corner (line_s * l, corner_s * c)
   c->lines = (line_s **) realloc (c->lines, n * sizeof (line_s *));
   c->lines[c->n_lines] = l;
   c->n_lines++;
-  dprintf ("add_line_to_corner %d %d\n", c->x, c->y);
+  dprintf ("add_line_to_corner %#mD\n", c->x, c->y);
 }
 
 static LineType *
@@ -589,7 +589,7 @@ new_line (corner_s * s, corner_s * e, int layer, LineType * example)
     {
       LineType *nl;
       dprintf
-	("New line \033[35m%d,%d to %d,%d from l%d t%d c%d f%s\033[0m\n",
+	("New line \033[35m%#mD to %#mD from l%d t%#mS c%#mS f%s\033[0m\n",
 	 s->x, s->y, e->x, e->y, layer, example->Thickness,
 	 example->Clearance, flags_to_string (example->Flags, LINE_TYPE));
       nl =
@@ -692,7 +692,7 @@ line_in_rect (rect_s * r, line_s * l)
   empty_rect (&lr);
   add_point_to_rect (&lr, l->s->x, l->s->y, l->line->Thickness / 2);
   add_point_to_rect (&lr, l->e->x, l->e->y, l->line->Thickness / 2);
-  dprintf ("line_in_rect %d,%d-%d,%d vs %d,%d-%d,%d\n",
+  dprintf ("line_in_rect %#mD-%#mD vs %#mD-%#mD\n",
 	   r->x1, r->y1, r->x2, r->y2, lr.x1, lr.y1, lr.x2, lr.y2);
   /* simple intersection of rectangles */
   if (lr.x1 < r->x1)
@@ -752,7 +752,7 @@ add_corner_to_rect_if (rect_s * rect, corner_s * c, rect_s * e)
   if (c->x > e->x2 && c->y > e->y2 && dist (c->x, c->y, e->x2, e->y2) > diam)
     return;
 
-  /*printf("add point %d,%d diam %d\n", c->x, c->y, diam); */
+  /*pcb_printf("add point %#mD diam %#mS\n", c->x, c->y, diam); */
   add_point_to_rect (rect, c->x, c->y, diam);
 }
 
@@ -860,8 +860,7 @@ move_corner (corner_s * c, int x, int y)
   check (c, 0);
   if (c->pad || c->pin)
     dj_abort ("move_corner: has pin or pad\n");
-  dprintf ("move_corner %p from %d,%d to %d,%d\n", (void *) c, c->x, c->y, x,
-	   y);
+  dprintf ("move_corner %p from %#mD to %#mD\n", (void *) c, c->x, c->y, x, y);
   pad = find_corner_if (x, y, c->layer);
   c->x = x;
   c->y = y;
@@ -869,7 +868,7 @@ move_corner (corner_s * c, int x, int y)
   if (via)
     {
       MoveObject (VIA_TYPE, via, via, via, x - via->X, y - via->Y);
-      dprintf ("via move %d,%d to %d,%d\n", via->X, via->Y, x, y);
+      dprintf ("via move %#mD to %#mD\n", via->X, via->Y, x, y);
     }
   for (i = 0; i < c->n_lines; i++)
     {
@@ -888,7 +887,7 @@ move_corner (corner_s * c, int x, int y)
 			  &tl->Point2, x - (tl->Point2.X),
 			  y - (tl->Point2.Y));
 	    }
-	  dprintf ("Line %p moved to %d,%d %d,%d\n", (void *) tl,
+	  dprintf ("Line %p moved to %#mD %#mD\n", (void *) tl,
 		   tl->Point1.X, tl->Point1.Y, tl->Point2.X, tl->Point2.Y);
 	}
     }
@@ -901,7 +900,7 @@ move_corner (corner_s * c, int x, int y)
 	    && c->lines[i]->s->y == c->lines[i]->e->y)
 	  {
 	    corner_s *c2 = other_corner (c->lines[i], c);
-	    dprintf ("move_corner: removing line %d,%d %d,%d %p %p\n",
+	    dprintf ("move_corner: removing line %#mD %#mD %p %p\n",
 		     c->x, c->y, c2->x, c2->y, (void *) c, (void *) c2);
 
 	    remove_line (c->lines[i]);
@@ -976,7 +975,7 @@ split_line (line_s * l, corner_s * c)
 
   check (c, l);
 
-  dprintf ("split line from %d,%d to %d,%d at %d,%d\n",
+  dprintf ("split line from %#mD to %#mD at %#mD\n",
 	   l->s->x, l->s->y, l->e->x, l->e->y, c->x, c->y);
   ls = (line_s *) malloc (sizeof (line_s));
 
@@ -1148,7 +1147,7 @@ simple_optimize_corner (corner_s * c)
     {
       /* see if no via is needed */
       if (selected (c->via))
-	dprintf ("via check: line[0] layer %d at %d,%d nl %d\n",
+	dprintf ("via check: line[0] layer %d at %#mD nl %d\n",
 		 c->lines[0]->layer, c->x, c->y, c->n_lines);
       /* We can't delete vias that connect to power planes, or vias
 	 that aren't tented (assume they're test points).  */
@@ -1158,7 +1157,7 @@ simple_optimize_corner (corner_s * c)
 	  for (i = 1; i < c->n_lines; i++)
 	    {
 	      if (selected (c->via))
-		dprintf ("           line[%d] layer %d %d,%d to %d,%d\n",
+		dprintf ("           line[%d] layer %d %#mD to %#mD\n",
 			 i, c->lines[i]->layer,
 			 c->lines[i]->s->x, c->lines[i]->s->y,
 			 c->lines[i]->e->x, c->lines[i]->e->y);
@@ -1184,7 +1183,7 @@ simple_optimize_corner (corner_s * c)
       corner_s *c0 = other_corner (c->lines[0], c);
       if (o == line_orient (c->lines[1], c2) && o != DIAGONAL)
 	{
-	  dprintf ("straight %d,%d to %d,%d to %d,%d\n",
+	  dprintf ("straight %#mD to %#mD to %#mD\n",
 		   c0->x, c0->y, c->x, c->y, c2->x, c2->y);
 	  if (selected (c->lines[0]->line))
 	    SET_FLAG (SELECTEDFLAG, c->lines[1]->line);
@@ -1215,8 +1214,7 @@ simple_optimize_corner (corner_s * c)
            * This code is probably worth keeping even when the autorouter bug is
            * fixed, as "freckles" could conceivably arise in other ways.
            */
-	  dprintf ("freckle %d,%d to %d,%d\n",
-		   c->x, c->y, c0->x, c0->y);
+	  dprintf ("freckle %#mD to %#mD\n", c->x, c->y, c0->x, c0->y);
 	  move_corner (c, c0->x, c0->y);
 	}
     }
@@ -1376,7 +1374,7 @@ orthopull_1 (corner_s * c, int fdir, int rdir, int any_sel)
 	if (max > len || max == -1)
 	  max = len;
       }
-  dprintf ("c %s %4d %4d  cn %d pull %3d  max %4d\n",
+  dprintf ("c %s %4#mD  cn %d pull %3d  max %4#mS\n",
 	   fdir == RIGHT ? "right" : "down ", c->x, c->y, cn, pull, max);
 
   switch (edir)
@@ -1460,8 +1458,7 @@ orthopull_1 (corner_s * c, int fdir, int rdir, int any_sel)
       int o, x1, x2, y1, y2;
       if (DELETED (l))
 	continue;
-      dprintf ("check line %d,%d to %d,%d\n", l->s->x, l->s->y, l->e->x,
-	       l->e->y);
+      dprintf ("check line %#mD to %#mD\n", l->s->x, l->s->y, l->e->x, l->e->y);
       if (l->s->net == c->net)
 	{
 	  dprintf ("  same net\n");
@@ -1559,8 +1556,7 @@ orthopull_1 (corner_s * c, int fdir, int rdir, int any_sel)
 	      break;
 	    }
 	  len -= r;
-	  dprintf ("  len is %d vs corner at %d,%d\n", len, cs[i]->x,
-		   cs[i]->y);
+	  dprintf ("  len is %#mS vs corner at %#mD\n", len, cs[i]->x, cs[i]->y);
 	  if (len <= 0)
 	    return 0;
 	  if (max > len)
@@ -1676,7 +1672,7 @@ orthopull ()
       c = c->next;
     }
   if (rv)
-    printf ("orthopull: %f mils saved\n", COORD_TO_MIL(rv));
+    pcb_printf ("orthopull: %ml mils saved\n", rv);
   return rv;
 }
 
@@ -1716,8 +1712,7 @@ debumpify ()
       if (ORIENT (o) == ORIENT (o1) || o1 != o2 || o1 == DIAGONAL)
 	continue;
 
-      dprintf ("\nline: %d,%d to %d,%d\n", l->s->x, l->s->y, l->e->x,
-	       l->e->y);
+      dprintf ("\nline: %#mD to %#mD\n", l->s->x, l->s->y, l->e->x, l->e->y);
       w = l->line->Thickness / 2 + SB + 1;
       empty_rect (&rr);
       add_line_to_rect (&rr, l1);
@@ -1730,7 +1725,7 @@ debumpify ()
 	rr.y1 -= w;
       if (rr.y2 != l->s->y && rr.y2 != l->e->y)
 	rr.y2 += w;
-      dprintf ("range: x %d..%d y %d..%d\n", rr.x1, rr.x2, rr.y1, rr.y2);
+      dprintf ("range: x %#mS..%#mS y %#mS..%#mS\n", rr.x1, rr.x2, rr.y1, rr.y2);
 
       c1 = other_corner (l1, l->s);
       c2 = other_corner (l2, l->e);
@@ -1751,7 +1746,7 @@ debumpify ()
 	  rp.y1 = rr.y2;
 	  rp.y2 = rr.y1;
 	}
-      dprintf ("pin r: x %d..%d y %d..%d\n", rp.x1, rp.x2, rp.y1, rp.y2);
+      dprintf ("pin r: x %#mS..%#mS y %#mS..%#mS\n", rp.x1, rp.x2, rp.y1, rp.y2);
 
       switch (o1)
 	{
@@ -1764,7 +1759,7 @@ debumpify ()
 	    step = l->s->x - c2->x;
 	  if (step > 0)
 	    {
-	      dprintf ("left step %d at %d,%d\n", step, l->s->x, l->s->y);
+	      dprintf ("left step %#mS at %#mD\n", step, l->s->x, l->s->y);
 	      move_corner (l->s, l->s->x - step, l->s->y);
 	      move_corner (l->e, l->e->x - step, l->e->y);
 	      rv += step;
@@ -1779,7 +1774,7 @@ debumpify ()
 	    step = c2->x - l->s->x;
 	  if (step > 0)
 	    {
-	      dprintf ("right step %d at %d,%d\n", step, l->s->x, l->s->y);
+	      dprintf ("right step %#mS at %#mD\n", step, l->s->x, l->s->y);
 	      move_corner (l->s, l->s->x + step, l->s->y);
 	      move_corner (l->e, l->e->x + step, l->e->y);
 	      rv += step;
@@ -1792,7 +1787,7 @@ debumpify ()
 			    l->s->y - c1->y, l->s->y - c2->y);
 	  if (step > 0)
 	    {
-	      dprintf ("up step %d at %d,%d\n", step, l->s->x, l->s->y);
+	      dprintf ("up step %#mS at %#mD\n", step, l->s->x, l->s->y);
 	      move_corner (l->s, l->s->x, l->s->y - step);
 	      move_corner (l->e, l->e->x, l->e->y - step);
 	      rv += step;
@@ -1807,7 +1802,7 @@ debumpify ()
 	    step = c2->y - l->s->y;
 	  if (step > 0)
 	    {
-	      dprintf ("down step %d at %d,%d\n", step, l->s->x, l->s->y);
+	      dprintf ("down step %#mS at %#mD\n", step, l->s->x, l->s->y);
 	      move_corner (l->s, l->s->x, l->s->y + step);
 	      move_corner (l->e, l->e->x, l->e->y + step);
 	      rv += step;
@@ -1819,7 +1814,7 @@ debumpify ()
 
   rv += simple_optimizations ();
   if (rv)
-    printf ("debumpify: %d mils saved\n", rv / 50);
+    pcb_printf ("debumpify: %ml mils saved\n", rv / 50);
   return rv;
 }
 
@@ -1864,7 +1859,7 @@ unjaggy_once ()
 	  && !(autorouted (c->lines[0]->line)
 	       || autorouted (c->lines[1]->line)))
 	continue;
-      dprintf ("simple at %d,%d\n", c->x, c->y);
+      dprintf ("simple at %#mD\n", c->x, c->y);
 
       c0 = other_corner (c->lines[0], c);
       o0 = line_orient (c->lines[0], c);
@@ -1876,7 +1871,7 @@ unjaggy_once ()
 
       if (!s0 && !s1)
 	continue;
-      dprintf ("simples at %d,%d\n", c->x, c->y);
+      dprintf ("simples at %#mD\n", c->x, c->y);
 
       w = 1;
       for (l = 0; l < c0->n_lines; l++)
@@ -1920,11 +1915,11 @@ unjaggy_once ()
 	  if (cc->net != c->net && intersecting_layers (cc->layer, c->layer))
 	    add_corner_to_rect_if (&rp, cc, &rr);
 	}
-      dprintf ("rp x %d..%d  y %d..%d\n", rp.x1, rp.x2, rp.y1, rp.y2);
+      dprintf ("rp x %#mS..%#mS  y %#mS..%#mS\n", rp.x1, rp.x2, rp.y1, rp.y2);
       if (rp.x1 <= rp.x2)	/* something triggered */
 	continue;
 
-      dprintf ("unjaggy at %d,%d layer %d\n", c->x, c->y, c->layer);
+      dprintf ("unjaggy at %#mD layer %d\n", c->x, c->y, c->layer);
       if (c->x == c0->x)
 	move_corner (c, c1->x, c0->y);
       else
@@ -2056,8 +2051,8 @@ vianudge ()
 
       /* at this point, we know we can move it */
 
-      dprintf ("vianudge: nudging via at %d,%d by %f mils saving %f\n",
-	       c->x, c->y, COORD_TO_MIL(len), COORD_TO_MIL(saved));
+      dprintf ("vianudge: nudging via at %#mD by %#mS saving %#mS\n",
+	       c->x, c->y, len, saved);
       rv += len * saved;
       move_corner (c, c2->x, c2->y);
 
@@ -2068,7 +2063,7 @@ vianudge ()
     }
 
   if (rv)
-    printf ("vianudge: %f mils saved\n", COORD_TO_MIL(rv));
+    pcb_printf ("vianudge: %ml mils saved\n", rv);
   return rv;
 }
 
@@ -2100,7 +2095,7 @@ viatrim ()
 
       my_layer = l->layer;
       other_layer = -1;
-      dprintf ("line %p on layer %d from %d,%d to %d,%d\n", (void *) l,
+      dprintf ("line %p on layer %d from %#mD to %#mD\n", (void *) l,
 	       l->layer, l->s->x, l->s->y, l->e->x, l->e->y);
       for (i = 0; i < l->s->n_lines; i++)
 	if (l->s->lines[i] != l)
@@ -2152,11 +2147,11 @@ viatrim ()
 	    continue;
 	  if (l2->s->net != l->s->net && l2->layer == other_layer)
 	    {
-	      dprintf ("checking other line %d,%d to %d,%d\n", l2->s->x,
+	      dprintf ("checking other line %#mD to %#mD\n", l2->s->x,
 		       l2->s->y, l2->e->x, l2->e->y);
 	      if (line_in_rect (&r, l2))
 		{
-		  dprintf ("line from %d,%d to %d,%d in the way\n",
+		  dprintf ("line from %#mD to %#mD in the way\n",
 			   l2->s->x, l2->s->y, l2->e->x, l2->e->y);
 		  goto viatrim_continue;
 		}
@@ -2482,7 +2477,7 @@ choose_example_line (corner_s * c1, corner_s * c2)
   for (ci = 0; ci < 2; ci++)
     for (li = 0; li < c[ci]->n_lines; li++)
       {
-	dprintf ("  try[%d,%d] \033[36m<%d,%d-%d,%d t%d c%d f%s>\033[0m\n",
+	dprintf ("  try[%d,%d] \033[36m<%#mD-%#mD t%#mS c%#mS f%s>\033[0m\n",
 		 ci, li,
 		 c[ci]->lines[li]->s->x, c[ci]->lines[li]->s->y,
 		 c[ci]->lines[li]->e->x, c[ci]->lines[li]->e->y,
@@ -2516,7 +2511,7 @@ connect_corners (corner_s * c1, corner_s * c2)
   LineType *example = ex->line;
 
   dprintf
-    ("connect_corners \033[32m%d,%d to %d,%d, example line %d,%d to %d,%d l%d\033[0m\n",
+    ("connect_corners \033[32m%#mD to %#mD, example line %#mD to %#mD l%d\033[0m\n",
      c1->x, c1->y, c2->x, c2->y, ex->s->x, ex->s->y, ex->e->x, ex->e->y,
      ex->layer);
 
@@ -2603,7 +2598,7 @@ pinsnap ()
 	      if (c->pad->Point1.X == c->pad->Point2.X)
 		{
 		  int hy = (c->pad->Point1.Y + c->pad->Point2.Y) / 2;
-		  dprintf ("pad y %d %d hy %d c %d\n", c->pad->Point1.Y,
+		  dprintf ("pad y %#mS %#mS hy %#mS c %#mS\n", c->pad->Point1.Y,
 			   c->pad->Point2.Y, hy, c->y);
 		  if (c->y < hy)
 		    top = hy;
@@ -2613,7 +2608,7 @@ pinsnap ()
 	      else
 		{
 		  int hx = (c->pad->Point1.X + c->pad->Point2.X) / 2;
-		  dprintf ("pad x %d %d hx %d c %d\n", c->pad->Point1.X,
+		  dprintf ("pad x %#mS %#mS hx %#mS c %#mS\n", c->pad->Point1.X,
 			   c->pad->Point2.X, hx, c->x);
 		  if (c->x < hx)
 		    right = hx;
@@ -2622,8 +2617,7 @@ pinsnap ()
 		}
 	    }
 
-	  dprintf ("%s x %d-%d y %d-%d\n", corner_name (c), left, right,
-		   bottom, top);
+	  dprintf ("%s x %#mS-%#mS y %#mS-%#mS\n", corner_name (c), left, right, bottom, top);
 	  for (l = 0; l <= max_copper_layer; l++)
 	    {
 	      best_dist[l] = close * 2;
@@ -2703,7 +2697,7 @@ pinsnap ()
 
       l = c->lines[0];
       lo = line_orient (l, c);
-      dprintf ("line end %d,%d orient %d\n", c->x, c->y, lo);
+      dprintf ("line end %#mD orient %d\n", c->x, c->y, lo);
 
       for (t = lines; t; t = t->next)
 	{
@@ -2721,8 +2715,7 @@ pinsnap ()
 		  && ((t->s->y < c->y && c->y < t->e->y)
 		      || (t->e->y < c->y && c->y < t->s->y)))
 		{
-		  dprintf ("found %d,%d - %d,%d\n", t->s->x, t->s->y, t->e->x,
-			   t->e->y);
+		  dprintf ("found %#mD - %#mD\n", t->s->x, t->s->y, t->e->x, t->e->y);
 		  move_corner (c, t->s->x, c->y);
 		}
 	      break;
@@ -2734,8 +2727,7 @@ pinsnap ()
 		  && ((t->s->y < c->y && c->y < t->e->y)
 		      || (t->e->y < c->y && c->y < t->s->y)))
 		{
-		  dprintf ("found %d,%d - %d,%d\n", t->s->x, t->s->y, t->e->x,
-			   t->e->y);
+		  dprintf ("found %#mD - %#mD\n", t->s->x, t->s->y, t->e->x, t->e->y);
 		  move_corner (c, t->s->x, c->y);
 		}
 	      break;
@@ -2747,8 +2739,7 @@ pinsnap ()
 		  && ((t->s->x < c->x && c->x < t->e->x)
 		      || (t->e->x < c->x && c->x < t->s->x)))
 		{
-		  dprintf ("found %d,%d - %d,%d\n", t->s->x, t->s->y, t->e->x,
-			   t->e->y);
+		  dprintf ("found %#mD - %#mD\n", t->s->x, t->s->y, t->e->x, t->e->y);
 		  move_corner (c, c->x, t->s->y);
 		}
 	      break;
@@ -2760,8 +2751,7 @@ pinsnap ()
 		  && ((t->s->x < c->x && c->x < t->e->x)
 		      || (t->e->x < c->x && c->x < t->s->x)))
 		{
-		  dprintf ("found %d,%d - %d,%d\n", t->s->x, t->s->y, t->e->x,
-			   t->e->y);
+		  dprintf ("found %#mD - %#mD\n", t->s->x, t->s->y, t->e->x, t->e->y);
 		  move_corner (c, c->x, t->s->y);
 		}
 	      break;
@@ -2821,7 +2811,7 @@ padcleaner ()
 	      && ORIENT (line_orient (l, 0)) == pad_orient (pad))
 	    {
 	      dprintf
-		("padcleaner %d,%d-%d,%d %d vs line %d,%d-%d,%d %d\n",
+		("padcleaner %#mD-%#mD %#mS vs line %#mD-%#mD %#mS\n",
 		 pad->Point1.X, pad->Point1.Y, pad->Point2.X, pad->Point2.Y,
 		 pad->Thickness, l->s->x, l->s->y, l->e->x, l->e->y,
 		 l->line->Thickness);

commit b58ba40105160ac0d464aeacd9faef97d678e1e8
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    Convert autoroute.c debug code to use pcb-printf
    
    Should be no change in output. Only change is that
    we no longer assume BDimension == int.

diff --git a/src/autoroute.c b/src/autoroute.c
index 9005259..c799e93 100644
--- a/src/autoroute.c
+++ b/src/autoroute.c
@@ -80,6 +80,7 @@
 #include "thermal.h"
 #include "undo.h"
 #include "vector.h"
+#include "pcb-printf.h"
 
 #ifdef HAVE_LIBDMALLOC
 #include <dmalloc.h>
@@ -893,7 +894,7 @@ FindRouteBoxOnLayerGroup (routedata_t * rd,
 static void
 DumpRouteBox (routebox_t * rb)
 {
-  printf ("RB: (%d,%d)-(%d,%d) l%d; ",
+  pcb_printf ("RB: %#mD-%#mD l%d; ",
 	  rb->box.X1, rb->box.Y1, rb->box.X2, rb->box.Y2, (int) rb->group);
   switch (rb->type)
     {
@@ -3567,7 +3568,7 @@ TracePath (routedata_t * rd, routebox_t * path, const routebox_t * target,
 #if defined(ROUTE_DEBUG) && defined(DEBUG_SHOW_ROUTE_BOXES)
   showroutebox (path);
 #if defined(ROUTE_VERBOSE)
-  printf ("TRACEPOINT start (%d, %d)\n", nextpoint.X, nextpoint.Y);
+  pcb_printf ("TRACEPOINT start %#mD\n", nextpoint.X, nextpoint.Y);
 #endif
 #endif
 
@@ -3597,7 +3598,7 @@ TracePath (routedata_t * rd, routebox_t * path, const routebox_t * target,
 #if defined(ROUTE_DEBUG_VERBOSE)
       printf ("TRACEPATH: ");
       DumpRouteBox (path);
-      printf ("TRACEPATH: point (%d, %d) to point (%d, %d) layer %d\n",
+      pcb_printf ("TRACEPATH: point %#mD to point %#mD layer %d\n",
 	      lastpoint.X, lastpoint.Y, nextpoint.X, nextpoint.Y,
 	      path->group);
 #endif
@@ -3657,8 +3658,8 @@ TracePath (routedata_t * rd, routebox_t * path, const routebox_t * target,
 #if defined(ROUTE_DEBUG_VERBOSE)
 	      printf ("TRACEPATH: ");
 	      DumpRouteBox (path);
-	      printf
-		("TRACEPATH: (to source) point (%d, %d) to point (%d, %d) layer %d\n",
+	      pcb_printf
+		("TRACEPATH: (to source) point %#mD to point %#mD layer %d\n",
 		 nextpoint.X, nextpoint.Y, lastpoint.X, lastpoint.Y,
 		 path->group);
 #endif

commit d5bdffc18f35fa3538a7911a39939ec75504a33b
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    Change action.c *WARN* lines to use pcb-printf
    
    Now instead of outputting unsuffixed cmils, warnings
    about locked/unnamed elements will refer to the part's
    position in either mm or mil, with an appropriate suffix.
    
    Non-warning-related output is unchanged.

diff --git a/src/action.c b/src/action.c
index 4f2e401..8b7e6d5 100644
--- a/src/action.c
+++ b/src/action.c
@@ -70,6 +70,7 @@
 #include "undo.h"
 #include "rtree.h"
 #include "macro.h"
+#include "pcb-printf.h"
 
 #include <assert.h>
 #include <stdlib.h> /* rand() */
@@ -3401,10 +3402,9 @@ ActionRenumber (int argc, char **argv, int x, int y)
 	 * add to the list of locked elements which we won't try to
 	 * renumber and whose reference designators are now reserved.
 	 */
-	fprintf (out,
-		 "*WARN* Element \"%s\" at (%d,%d) is locked and will not be renumbered.\n",
-		 UNKNOWN (NAMEONPCB_NAME (element)), element->MarkX,
-		 element->MarkY);
+	pcb_fprintf (out,
+		     "*WARN* Element \"%s\" at %$md is locked and will not be renumbered.\n",
+		      UNKNOWN (NAMEONPCB_NAME (element)), element->MarkX, element->MarkY);
 	locked_element_list[lock_cnt] = element;
 	lock_cnt++;
       }
@@ -3566,7 +3566,7 @@ ActionRenumber (int argc, char **argv, int x, int y)
 	}
       else
 	{
-	  fprintf (out, "*WARN* Element at (%d,%d) has no name.\n",
+	  pcb_fprintf (out, "*WARN* Element at %$md has no name.\n",
 		   element_list[i]->MarkX, element_list[i]->MarkY);
 	}
 

commit be8c3bee18c38ff5c634af5f3632446885c0ac80
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    Convert file.c to use pcb-printf for cmil output
    
    file.c now uses pcb-printf, though in a limited way:
    everything is still output in unsuffixed cmils, though
    this is now independent of pcb's internal unit size.
    
    I have also removed the old-style output for symbols.
    
    Aside from that, everything should be the same. Any
    other change in output, or file format incompatibility
    of any kind, is a bug.

diff --git a/src/file.c b/src/file.c
index 682aa02..f4fb12e 100644
--- a/src/file.c
+++ b/src/file.c
@@ -89,6 +89,7 @@
 #include "move.h"
 #include "mymem.h"
 #include "parse_l.h"
+#include "pcb-printf.h"
 #include "polygon.h"
 #include "rats.h"
 #include "remove.h"
@@ -569,28 +570,29 @@ WritePCBDataHeader (FILE * FP)
 
   fputs ("\nPCB[", FP);
   PrintQuotedString (FP, (char *)EMPTY (PCB->Name));
-  fprintf (FP, " %i %i]\n\n", (int) PCB->MaxWidth, (int) PCB->MaxHeight);
-  fprintf (FP, "Grid[%s %i %i %i]\n",
-	   c_dtostr (PCB->Grid), (int) PCB->GridOffsetX,
-	   (int) PCB->GridOffsetY, (int) Settings.DrawGrid);
-  fprintf (FP, "Cursor[%i %i %s]\n",
-           Crosshair.X, Crosshair.Y, c_dtostr (PCB->Zoom));
-  fprintf (FP, "PolyArea[%s]\n", c_dtostr (PCB->IsleArea));
-  fprintf (FP, "Thermal[%s]\n", c_dtostr (PCB->ThermScale));
-  fprintf (FP, "DRC[%i %i %i %i %i %i]\n", PCB->Bloat, PCB->Shrink,
-	   PCB->minWid, PCB->minSlk, PCB->minDrill, PCB->minRing);
+  pcb_fprintf (FP, " %mc %mc]\n\n", PCB->MaxWidth, PCB->MaxHeight);
+  pcb_fprintf (FP, "Grid[%s %mc %mc %d]\n",
+	       c_dtostr (PCB->Grid), PCB->GridOffsetX,
+	       PCB->GridOffsetY, Settings.DrawGrid);
+  pcb_fprintf (FP, "Cursor[%mc %mc %s]\n",
+               Crosshair.X, Crosshair.Y, c_dtostr (PCB->Zoom));
+  /* PolyArea should be output in square cmils, no suffix */
+  fprintf (FP, "PolyArea[%s]\n", c_dtostr (COORD_TO_MIL (COORD_TO_MIL (PCB->IsleArea) * 100) * 100));
+  pcb_fprintf (FP, "Thermal[%s]\n", c_dtostr (PCB->ThermScale));
+  pcb_fprintf (FP, "DRC[%mc %mc %mc %mc %mc %mc]\n", PCB->Bloat, PCB->Shrink,
+	       PCB->minWid, PCB->minSlk, PCB->minDrill, PCB->minRing);
   fprintf (FP, "Flags(%s)\n", pcbflags_to_string(PCB->Flags));
   fprintf (FP, "Groups(\"%s\")\n", LayerGroupsToString (&PCB->LayerGroups));
   fputs ("Styles[\"", FP);
   for (group = 0; group < NUM_STYLES - 1; group++)
-    fprintf (FP, "%s,%i,%i,%i,%i:", PCB->RouteStyle[group].Name,
-	     PCB->RouteStyle[group].Thick,
-	     PCB->RouteStyle[group].Diameter,
-	     PCB->RouteStyle[group].Hole, PCB->RouteStyle[group].Keepaway);
-  fprintf (FP, "%s,%i,%i,%i,%i\"]\n\n", PCB->RouteStyle[group].Name,
-	   PCB->RouteStyle[group].Thick,
-	   PCB->RouteStyle[group].Diameter,
-	   PCB->RouteStyle[group].Hole, PCB->RouteStyle[group].Keepaway);
+    pcb_fprintf (FP, "%s,%mc,%mc,%mc,%mc:", PCB->RouteStyle[group].Name,
+	         PCB->RouteStyle[group].Thick,
+	         PCB->RouteStyle[group].Diameter,
+	         PCB->RouteStyle[group].Hole, PCB->RouteStyle[group].Keepaway);
+  pcb_fprintf (FP, "%s,%mc,%mc,%mc,%mc\"]\n\n", PCB->RouteStyle[group].Name,
+	       PCB->RouteStyle[group].Thick,
+	       PCB->RouteStyle[group].Diameter,
+	       PCB->RouteStyle[group].Hole, PCB->RouteStyle[group].Keepaway);
 }
 
 /* ---------------------------------------------------------------------------
@@ -608,31 +610,16 @@ WritePCBFontData (FILE * FP)
       if (!font->Symbol[i].Valid)
 	continue;
 
-      if (isprint (i) && font->Symbol[i].Delta % 100 == 0)
-	fprintf (FP, "Symbol('%c' %i)\n(\n",
-		 (char) i, (int) font->Symbol[i].Delta / 100);
-      else if (isprint (i))
-	fprintf (FP, "Symbol['%c' %i]\n(\n",
-		 (char) i, (int) font->Symbol[i].Delta);
+      if (isprint (i))
+	pcb_fprintf (FP, "Symbol['%c' %mc]\n(\n", i, font->Symbol[i].Delta);
       else
-	fprintf (FP, "Symbol[%i %i]\n(\n", i, (int) font->Symbol[i].Delta);
+	pcb_fprintf (FP, "Symbol[%i %mc]\n(\n", i, font->Symbol[i].Delta);
 
       line = font->Symbol[i].Line;
       for (j = font->Symbol[i].LineN; j; j--, line++)
-	{
-	  if (line->Point1.X % 100 == 0
-	      && line->Point1.Y % 100 == 0
-	      && line->Point2.X % 100 == 0
-	      && line->Point2.Y % 100 == 0 && line->Thickness % 100 == 0)
-	    fprintf (FP, "\tSymbolLine(%i %i %i %i %i)\n",
-		     line->Point1.X / 100, line->Point1.Y / 100,
-		     line->Point2.X / 100, line->Point2.Y / 100,
-		     line->Thickness / 100);
-	  else
-	    fprintf (FP, "\tSymbolLine[%i %i %i %i %i]\n",
-		     line->Point1.X, line->Point1.Y,
-		     line->Point2.X, line->Point2.Y, line->Thickness);
-	}
+        pcb_fprintf (FP, "\tSymbolLine[%mc %mc %mc %mc %mc]\n",
+                     line->Point1.X, line->Point1.Y,
+                     line->Point2.X, line->Point2.Y, line->Thickness);
       fputs (")\n", FP);
     }
 }
@@ -648,9 +635,8 @@ WriteViaData (FILE * FP, DataTypePtr Data)
   for (iter = Data->Via; iter != NULL; iter = g_list_next (iter))
     {
       PinType *via = iter->data;
-      fprintf (FP, "Via[%i %i %i %i %i %i ",
-	       via->X, via->Y,
-	       via->Thickness, via->Clearance, via->Mask, via->DrillingHole);
+      pcb_fprintf (FP, "Via[%mc %mc %mc %mc %mc %mc ", via->X, via->Y,
+                   via->Thickness, via->Clearance, via->Mask, via->DrillingHole);
       PrintQuotedString (FP, (char *)EMPTY (via->Name));
       fprintf (FP, " %s]\n", F2S (via, VIA_TYPE));
     }
@@ -667,10 +653,9 @@ WritePCBRatData (FILE * FP)
   for (iter = PCB->Data->Rat; iter != NULL; iter = g_list_next (iter))
     {
       RatType *line = iter->data;
-      fprintf (FP, "Rat[%i %i %i %i %i %i ",
-	       (int) line->Point1.X, (int) line->Point1.Y,
-	       (int) line->group1, (int) line->Point2.X,
-	       (int) line->Point2.Y, (int) line->group2);
+      pcb_fprintf (FP, "Rat[%mc %mc %d %mc %mc %d ",
+                   line->Point1.X, line->Point1.Y, line->group1,
+                   line->Point2.X, line->Point2.Y, line->group2);
       fprintf (FP, " %s]\n", F2S (line, RATLINE_TYPE));
     }
 }
@@ -732,24 +717,22 @@ WriteElementData (FILE * FP, DataTypePtr Data)
       PrintQuotedString (FP, (char *)EMPTY (NAMEONPCB_NAME (element)));
       fputc (' ', FP);
       PrintQuotedString (FP, (char *)EMPTY (VALUE_NAME (element)));
-      fprintf (FP, " %i %i %i %i %i %i %s]\n(\n",
-	       (int) element->MarkX, (int) element->MarkY,
-	       (int) (DESCRIPTION_TEXT (element).X -
-		      element->MarkX),
-	       (int) (DESCRIPTION_TEXT (element).Y -
-		      element->MarkY),
-	       (int) DESCRIPTION_TEXT (element).Direction,
-	       (int) DESCRIPTION_TEXT (element).Scale,
-	       F2S (&(DESCRIPTION_TEXT (element)), ELEMENTNAME_TYPE));
+      pcb_fprintf (FP, " %mc %mc %mc %mc %mc %mc %s]\n(\n",
+                   element->MarkX, element->MarkY,
+                   DESCRIPTION_TEXT (element).X - element->MarkX,
+                   DESCRIPTION_TEXT (element).Y - element->MarkY,
+                   DESCRIPTION_TEXT (element).Direction,
+                   DESCRIPTION_TEXT (element).Scale,
+                   F2S (&(DESCRIPTION_TEXT (element)), ELEMENTNAME_TYPE));
       WriteAttributeList (FP, &element->Attributes, "\t");
       for (p = element->Pin; p != NULL; p = g_list_next (p))
 	{
 	  PinType *pin = p->data;
-	  fprintf (FP, "\tPin[%i %i %i %i %i %i ",
-		   (int) (pin->X - element->MarkX),
-		   (int) (pin->Y - element->MarkY),
-		   (int) pin->Thickness, (int) pin->Clearance,
-		   (int) pin->Mask, (int) pin->DrillingHole);
+          pcb_fprintf (FP, "\tPin[%mc %mc %mc %mc %mc %mc ",
+                       pin->X - element->MarkX,
+                       pin->Y - element->MarkY,
+                       pin->Thickness, pin->Clearance,
+                       pin->Mask, pin->DrillingHole);
 	  PrintQuotedString (FP, (char *)EMPTY (pin->Name));
 	  fprintf (FP, " ");
 	  PrintQuotedString (FP, (char *)EMPTY (pin->Number));
@@ -758,13 +741,12 @@ WriteElementData (FILE * FP, DataTypePtr Data)
       for (p = element->Pad; p != NULL; p = g_list_next (p))
 	{
 	  PadType *pad = p->data;
-	  fprintf (FP, "\tPad[%i %i %i %i %i %i %i ",
-		   (int) (pad->Point1.X - element->MarkX),
-		   (int) (pad->Point1.Y - element->MarkY),
-		   (int) (pad->Point2.X - element->MarkX),
-		   (int) (pad->Point2.Y - element->MarkY),
-		   (int) pad->Thickness, (int) pad->Clearance,
-		   (int) pad->Mask);
+          pcb_fprintf (FP, "\tPad[%mc %mc %mc %mc %mc %mc %mc ",
+                       pad->Point1.X - element->MarkX,
+                       pad->Point1.Y - element->MarkY,
+                       pad->Point2.X - element->MarkX,
+                       pad->Point2.Y - element->MarkY,
+                       pad->Thickness, pad->Clearance, pad->Mask);
 	  PrintQuotedString (FP, (char *)EMPTY (pad->Name));
 	  fprintf (FP, " ");
 	  PrintQuotedString (FP, (char *)EMPTY (pad->Number));
@@ -773,27 +755,22 @@ WriteElementData (FILE * FP, DataTypePtr Data)
       for (p = element->Line; p != NULL; p = g_list_next (p))
 	{
 	  LineType *line = p->data;
-	  fprintf (FP,
-		   "\tElementLine [%i %i %i %i %i]\n",
-		   (int) (line->Point1.X -
-			  element->MarkX),
-		   (int) (line->Point1.Y -
-			  element->MarkY),
-		   (int) (line->Point2.X -
-			  element->MarkX),
-		   (int) (line->Point2.Y -
-			  element->MarkY), (int) line->Thickness);
+          pcb_fprintf (FP, "\tElementLine [%mc %mc %mc %mc %mc]\n",
+                       line->Point1.X - element->MarkX,
+                       line->Point1.Y - element->MarkY,
+                       line->Point2.X - element->MarkX,
+                       line->Point2.Y - element->MarkY,
+                       line->Thickness);
 	}
       for (p = element->Arc; p != NULL; p = g_list_next (p))
 	{
 	  ArcType *arc = p->data;
-	  fprintf (FP,
-		   "\tElementArc [%i %i %i %i %i %i %i]\n",
-		   (int) (arc->X - element->MarkX),
-		   (int) (arc->Y - element->MarkY),
-		   (int) arc->Width, (int) arc->Height,
-		   (int) arc->StartAngle, (int) arc->Delta,
-		   (int) arc->Thickness);
+          pcb_fprintf (FP, "\tElementArc [%mc %mc %mc %mc %mc %mc %mc]\n",
+                       arc->X - element->MarkX,
+                       arc->Y - element->MarkY,
+                       arc->Width, arc->Height,
+                       arc->StartAngle, arc->Delta,
+                       arc->Thickness);
 	}
       fputs ("\n\t)\n", FP);
     }
@@ -818,27 +795,27 @@ WriteLayerData (FILE * FP, Cardinal Number, LayerTypePtr layer)
       for (n = layer->Line; n != NULL; n = g_list_next (n))
 	{
 	  LineType *line = n->data;
-	  fprintf (FP, "\tLine[%i %i %i %i %i %i %s]\n",
-		   (int) line->Point1.X, (int) line->Point1.Y,
-		   (int) line->Point2.X, (int) line->Point2.Y,
-		   (int) line->Thickness, (int) line->Clearance,
-		   F2S (line, LINE_TYPE));
+          pcb_fprintf (FP, "\tLine[%mc %mc %mc %mc %mc %mc %s]\n",
+                       line->Point1.X, line->Point1.Y,
+                       line->Point2.X, line->Point2.Y,
+                       line->Thickness, line->Clearance,
+                       F2S (line, LINE_TYPE));
 	}
       for (n = layer->Arc; n != NULL; n = g_list_next (n))
 	{
 	  ArcType *arc = n->data;
-	  fprintf (FP, "\tArc[%i %i %i %i %i %i %i %i %s]\n",
-		   (int) arc->X, (int) arc->Y, (int) arc->Width,
-		   (int) arc->Height, (int) arc->Thickness,
-		   (int) arc->Clearance, (int) arc->StartAngle,
-		   (int) arc->Delta, F2S (arc, ARC_TYPE));
+          pcb_fprintf (FP, "\tArc[%mc %mc %mc %mc %mc %mc %mc %mc %s]\n",
+                       arc->X, arc->Y, arc->Width,
+                       arc->Height, arc->Thickness,
+                       arc->Clearance, arc->StartAngle,
+                       arc->Delta, F2S (arc, ARC_TYPE));
 	}
       for (n = layer->Text; n != NULL; n = g_list_next (n))
 	{
 	  TextType *text = n->data;
-	  fprintf (FP, "\tText[%i %i %i %i ",
-		   (int) text->X, (int) text->Y,
-		   (int) text->Direction, (int) text->Scale);
+          pcb_fprintf (FP, "\tText[%mc %mc %mc %mc ",
+                       text->X, text->Y,
+                       text->Direction, text->Scale);
 	  PrintQuotedString (FP, (char *)EMPTY (text->TextString));
 	  fprintf (FP, " %s]\n", F2S (text, TEXT_TYPE));
 	}
@@ -868,7 +845,7 @@ WriteLayerData (FILE * FP, Cardinal Number, LayerTypePtr layer)
 		  if (hole)
 		    fputs ("\t", FP);
 		}
-	      fprintf (FP, "[%i %i] ", (int) point->X, (int) point->Y);
+              pcb_fprintf (FP, "[%mc %mc] ", point->X, point->Y);
 	    }
 	  if (hole > 0)
 	    fputs ("\n\t\t)", FP);

commit da86b04ab351c441c88d04eb9221badbe95d9e5a
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    Add # subspecifier to pcb-printf to prevent scaling for debug output

diff --git a/src/pcb-printf.c b/src/pcb-printf.c
index e0fe9d1..d2b31b7 100644
--- a/src/pcb-printf.c
+++ b/src/pcb-printf.c
@@ -248,6 +248,11 @@ static gchar *pcb_vprintf(const char *fmt, va_list args)
                               || *fmt == 'h' || *fmt == '-')
             g_string_append_c (spec, *fmt++);
           /* Get our sub-specifiers */
+          if(*fmt == '#')
+            {
+              mask = ALLOW_CMIL;  /* This must be pcb's base unit */
+              fmt++;
+            }
           if(*fmt == '$')
             {
               suffix = SUFFIX;
diff --git a/src/pcb-printf.h b/src/pcb-printf.h
index 6b87a85..bcf319e 100644
--- a/src/pcb-printf.h
+++ b/src/pcb-printf.h
@@ -53,9 +53,11 @@
  *   %mr    output a measure in a unit readable by parse_l.l
  *          (this will always append a unit suffix)
  *
- * These accept the usual printf modifiers for %f,
- *  as well as the additional modifier $ which is
- *  used to output a unit suffix after the measure.
+ * These accept the usual printf modifiers for %f, as well as
+ *     $    output a unit suffix after the measure
+ *     #    prevents all scaling for %mS/D/1/.../9 (this should
+ *          ONLY be used for debug code since its output exposes
+ *          pcb's base units).
  *
  * KNOWN ISSUES:
  *   No support for %zu size_t printf spec

commit 0586f240cd08ea3f2f9b84cb6536aee6caa37285
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    Convert puller.c to use Distance() intead of its own function

diff --git a/src/puller.c b/src/puller.c
index 3cd2500..bcf8fae 100644
--- a/src/puller.c
+++ b/src/puller.c
@@ -100,19 +100,10 @@ static int ex, ey;		/* fixed end of the line */
 
 /* 0 is left (-x), 90 is down (+y), 180 is right (+x), 270 is up (-y) */
 
-static double
-dist (int x1, int y1, int x2, int y2)
-{
-  double dx = x1 - x2;
-  double dy = y1 - y2;
-  double dist = sqrt (dx * dx + dy * dy);
-  return dist;
-}
-
 static int
 within (int x1, int y1, int x2, int y2, int r)
 {
-  return dist (x1, y1, x2, y2) <= r / 2;
+  return Distance (x1, y1, x2, y2) <= r / 2;
 }
 
 static int
@@ -148,7 +139,7 @@ arc_endpoint_is (ArcTypePtr a, int angle, int x, int y)
 #if TRACE1
   printf (" - arc endpoint %d,%d\n", ax, ay);
 #endif
-  arc_dist = dist (ax, ay, x, y);
+  arc_dist = Distance (ax, ay, x, y);
   if (arc_exact)
     return arc_dist < 2;
   return arc_dist < a->Thickness / 2;
@@ -282,7 +273,7 @@ intersection_of_linesegs (int x1, int y1, int x2, int y2,
 static double
 dist_lp (int x1, int y1, int x2, int y2, int px, int py)
 {
-  double den = dist (x1, y1, x2, y2);
+  double den = Distance (x1, y1, x2, y2);
   double rv = (fabs (((double)x2 - x1) * ((double)y1 - py)
 		     - ((double)x1 - px) * ((double)y2 - y1))
 	       / den);
@@ -299,12 +290,12 @@ dist_lsp (int x1, int y1, int x2, int y2, int px, int py)
 {
   double d;
   if (dot2d (x1, y1, x2, y2, px, py) < 0)
-    return dist (x1, y1, px, py);
+    return Distance (x1, y1, px, py);
   if (dot2d (x2, y2, x1, y1, px, py) < 0)
-    return dist (x2, y2, px, py);
+    return Distance (x2, y2, px, py);
   d = (fabs (((double)x2 - x1) * ((double)y1 - py)
 	     - ((double)x1 - px) * ((double)y2 - y1))
-       / dist (x1, y1, x2, y2));
+       / Distance (x1, y1, x2, y2));
   return d;
 }
 
@@ -324,8 +315,8 @@ line_callback (const BoxType * b, void *cl)
   printf ("line %d,%d .. %d,%d\n",
 	  l->Point1.X, l->Point1.Y, l->Point2.X, l->Point2.Y);
 #endif
-  d1 = dist (l->Point1.X, l->Point1.Y, x, y);
-  d2 = dist (l->Point2.X, l->Point2.Y, x, y);
+  d1 = Distance (l->Point1.X, l->Point1.Y, x, y);
+  d2 = Distance (l->Point2.X, l->Point2.Y, x, y);
   if ((d1 < 2 || d2 < 2) && !line_exact)
     {
       line_exact = 1;
@@ -496,7 +487,7 @@ Puller (int argc, char **argv, int Ux, int Uy)
   rel_angle = line_angle - arc_angle;
   base_angle = r2d (atan2 (ey - cy, cx - ex));
 
-  tangent = r2d (acos (the_arc->Width / dist (cx, cy, ex, ey)));
+  tangent = r2d (acos (the_arc->Width / Distance (cx, cy, ex, ey)));
 
 #if TRACE1
   printf ("arc %g line %g rel %g base %g\n", arc_angle, line_angle, rel_angle,
@@ -819,7 +810,7 @@ check_point_in_pin (PinTypePtr pin, int x, int y, End *e)
     inside_p = (x >= pin->X - t && x <= pin->X + t
 		&& y >= pin->Y - t && y <= pin->Y + t);
   else
-    inside_p = (dist (pin->X, pin->Y, x, y) <= t);
+    inside_p = (Distance (pin->X, pin->Y, x, y) <= t);
 
   if (inside_p)
     {
@@ -918,8 +909,8 @@ check_point_in_pad (PadTypePtr pad, int x, int y, End *e)
 	}
       if (!inside_p)
 	{
-	  if (dist (pad->Point1.X, pad->Point1.Y, x, y) <= t
-	      || dist (pad->Point2.X, pad->Point2.Y, x, y) <= t)
+	  if (Distance (pad->Point1.X, pad->Point1.Y, x, y) <= t
+	      || Distance (pad->Point2.X, pad->Point2.Y, x, y) <= t)
 	    inside_p = 1;
 	}
     }
@@ -1451,7 +1442,7 @@ gp_point_force (int x, int y, int t, End *e, int esa, int eda, int force, const
   r = t + thickness;
 
   /* See if the point is inside our start arc. */
-  d = dist (scx, scy, x, y);
+  d = Distance (scx, scy, x, y);
 #if TRACE1
   printf("%f = dist (%d,%d to %d,%d)\n", d, scx, scy, x, y);
   printf("sr %d r %f d %f\n", sr, r, d);
@@ -1565,9 +1556,9 @@ gp_point_force (int x, int y, int t, End *e, int esa, int eda, int force, const
 #endif
   if (a * se_sign == best_angle * se_sign)
     {
-      double old_d = dist (start_line->Point1.X, start_line->Point1.Y,
+      double old_d = Distance (start_line->Point1.X, start_line->Point1.Y,
 			   fx, fy);
-      double new_d = dist (start_line->Point1.X, start_line->Point1.Y,
+      double new_d = Distance (start_line->Point1.X, start_line->Point1.Y,
 			   x, y);
       if (new_d > old_d)
 	{
@@ -2177,7 +2168,7 @@ maybe_pull_1 (LineTypePtr line)
       abort();
     }
 
-  end_dist = dist (end_line->Point1.X, end_line->Point1.Y,
+  end_dist = Distance (end_line->Point1.X, end_line->Point1.Y,
 		   end_line->Point2.X, end_line->Point2.Y);
 
   start_pinpad = start_extra->start.pin;
@@ -2310,7 +2301,7 @@ maybe_pull_1 (LineTypePtr line)
 	   fx, fy, (int)r2d(oa), (int)ox, (int)oy);
 #endif
 
-    if (dist (ox, oy, end_line->Point2.X, end_line->Point2.Y)
+    if (Distance (ox, oy, end_line->Point2.X, end_line->Point2.Y)
 	< fr * SIN1D)
       {
 	/* Pretend it doesn't exist.  */

commit de55cc43ba47942b67b7463a62841096182d64f6
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    Add pcb_printf to pcb_*printf family of functions

diff --git a/src/pcb-printf.c b/src/pcb-printf.c
index 2ede73c..e0fe9d1 100644
--- a/src/pcb-printf.c
+++ b/src/pcb-printf.c
@@ -405,6 +405,22 @@ int pcb_fprintf(FILE *fh, const char *fmt, ...)
   return rv;
 }
 
+int pcb_printf(const char *fmt, ...)
+{
+  int rv;
+  gchar *tmp;
+
+  va_list args;
+  va_start(args, fmt);
+
+  tmp = pcb_vprintf (fmt, args);
+  rv = printf ("%s", tmp);
+  g_free (tmp);
+  
+  va_end(args);
+  return rv;
+}
+
 char *pcb_g_strdup_printf(const char *fmt, ...)
 {
   gchar *tmp;
diff --git a/src/pcb-printf.h b/src/pcb-printf.h
index 2992d1b..6b87a85 100644
--- a/src/pcb-printf.h
+++ b/src/pcb-printf.h
@@ -89,6 +89,7 @@ enum e_allow {
 
 int pcb_fprintf(FILE *f, const char *fmt, ...);
 int pcb_sprintf(char *string, const char *fmt, ...);
+int pcb_printf(const char *fmt, ...);
 char *pcb_g_strdup_printf(const char *fmt, ...);
 
 #endif




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