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

gEDA-cvs: pcb.git: branch: master updated (4101b611a84fbcd00cf984c8303502935cce38e9)



The branch, master has been updated
       via  4101b611a84fbcd00cf984c8303502935cce38e9 (commit)
       via  b7434eec4dc642adcdd5fd468bad851cad6df4ee (commit)
       via  9cb66f740b56b3743dc0e582558b3861b24617a1 (commit)
      from  d658a8846d0d4583b385549ccd604ac1a02a9bc8 (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/hid/gerber/gerber.c |   15 +++++----------
 src/pcb-printf.c        |   12 +++++++++---
 src/pcb-printf.h        |    9 ++++++++-
 3 files changed, 22 insertions(+), 14 deletions(-)


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

commit 4101b611a84fbcd00cf984c8303502935cce38e9
Author: Andrew Poelstra (local) <apoelstra@xxxxxxxxxxxxxx>
Commit: Andrew Poelstra (local) <apoelstra@xxxxxxxxxxxxxx>

    gerber.c: Use ` modifier in pcb-printf to fix internationalization bug

:100644 100644 1539f88... 9280af4... M	src/hid/gerber/gerber.c

commit b7434eec4dc642adcdd5fd468bad851cad6df4ee
Author: Andrew Poelstra (local) <apoelstra@xxxxxxxxxxxxxx>
Commit: Andrew Poelstra (local) <apoelstra@xxxxxxxxxxxxxx>

    Revert "Fix locale-dependent gerber output"
    
    This reverts commit 2473e26c7d9581753a28f1f55a4a4b7ff109a3f2.
    
    A better fix would be to use the new pcb-printf specifier,
    rather than manually using g_ascii_strtod with the COORD_TO_
    macros.

:100644 100644 4e0007b... 1539f88... M	src/hid/gerber/gerber.c

commit 9cb66f740b56b3743dc0e582558b3861b24617a1
Author: Andrew Poelstra (local) <apoelstra@xxxxxxxxxxxxxx>
Commit: Andrew Poelstra (local) <apoelstra@xxxxxxxxxxxxxx>

    Add ` modifier to pcb-printf, which forces '.' as a decimal separator
    
    This should be used for the gerber exporter and other formats
    that need to use '.' regardless of locale in order to obey their
    standards.
    
    Note that the %mr specifier (which restricts suffixes to mm and mil
    so that old pcb versions can read them) uses this by default, so no
    changes need to be made to file.c.

:100644 100644 f687e06... 183ea18... M	src/pcb-printf.c
:100644 100644 cbd9bbd... 4b37b38... M	src/pcb-printf.h

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

commit 4101b611a84fbcd00cf984c8303502935cce38e9
Author: Andrew Poelstra (local) <apoelstra@xxxxxxxxxxxxxx>
Commit: Andrew Poelstra (local) <apoelstra@xxxxxxxxxxxxxx>

    gerber.c: Use ` modifier in pcb-printf to fix internationalization bug

diff --git a/src/hid/gerber/gerber.c b/src/hid/gerber/gerber.c
index 1539f88..9280af4 100644
--- a/src/hid/gerber/gerber.c
+++ b/src/hid/gerber/gerber.c
@@ -229,13 +229,13 @@ fprintAperture (FILE *f, Aperture *aptr)
   switch (aptr->shape)
     {
     case ROUND:
-      pcb_fprintf (f, "%%ADD%dC,%.4mi*%%\r\n", aptr->dCode, aptr->width);
+      pcb_fprintf (f, "%%ADD%dC,%.4`mi*%%\r\n", aptr->dCode, aptr->width);
       break;
     case SQUARE:
-      pcb_fprintf (f, "%%ADD%dR,%.4miX%.4mi*%%\r\n", aptr->dCode, aptr->width, aptr->width);
+      pcb_fprintf (f, "%%ADD%dR,%.4`miX%.4`mi*%%\r\n", aptr->dCode, aptr->width, aptr->width);
       break;
     case OCTAGON:
-      pcb_fprintf (f, "%%AMOCT%d*5,0,8,0,0,%.4mi,22.5*%%\r\n"
+      pcb_fprintf (f, "%%AMOCT%d*5,0,8,0,0,%.4`mi,22.5*%%\r\n"
 	       "%%ADD%dOCT%d*%%\r\n", aptr->dCode,
 	       (Coord) ((double) aptr->width / COS_22_5_DEGREE), aptr->dCode,
 	       aptr->dCode);
@@ -741,7 +741,7 @@ gerber_set_layer (const char *name, int group, int empty)
 	     always six-digit 0.1 mil resolution (i.e. 001100 = 0.11")*/
 	  fprintf (f, "M48\r\n" "INCH\r\n");
 	  for (search = aptr_list->data; search; search = search->next)
-	    pcb_fprintf (f, "T%02dC%.3mi\r\n", search->dCode, search->width);
+	    pcb_fprintf (f, "T%02dC%.3`mi\r\n", search->dCode, search->width);
 	  fprintf (f, "%%\r\n");
 	  /* FIXME */
 	  return 1;

commit b7434eec4dc642adcdd5fd468bad851cad6df4ee
Author: Andrew Poelstra (local) <apoelstra@xxxxxxxxxxxxxx>
Commit: Andrew Poelstra (local) <apoelstra@xxxxxxxxxxxxxx>

    Revert "Fix locale-dependent gerber output"
    
    This reverts commit 2473e26c7d9581753a28f1f55a4a4b7ff109a3f2.
    
    A better fix would be to use the new pcb-printf specifier,
    rather than manually using g_ascii_strtod with the COORD_TO_
    macros.

diff --git a/src/hid/gerber/gerber.c b/src/hid/gerber/gerber.c
index 4e0007b..1539f88 100644
--- a/src/hid/gerber/gerber.c
+++ b/src/hid/gerber/gerber.c
@@ -226,23 +226,18 @@ findAperture (ApertureList *list, Coord width, ApertureShape shape)
 static void
 fprintAperture (FILE *f, Aperture *aptr)
 {
-  char buf[50];
-
   switch (aptr->shape)
     {
     case ROUND:
-      g_ascii_formatd (buf, 50, "%.4f", COORD_TO_INCH (aptr->width));
-      pcb_fprintf (f, "%%ADD%dC,%s*%%\r\n", aptr->dCode, buf);
+      pcb_fprintf (f, "%%ADD%dC,%.4mi*%%\r\n", aptr->dCode, aptr->width);
       break;
     case SQUARE:
-      g_ascii_formatd (buf,  50, "%.4f", COORD_TO_INCH (aptr->width));
-      pcb_fprintf (f, "%%ADD%dR,%sX%s*%%\r\n", aptr->dCode, buf, buf);
+      pcb_fprintf (f, "%%ADD%dR,%.4miX%.4mi*%%\r\n", aptr->dCode, aptr->width, aptr->width);
       break;
     case OCTAGON:
-      g_ascii_formatd (buf,  50, "%.4f", COORD_TO_INCH (aptr->width / COS_22_5_DEGREE));
-      pcb_fprintf (f, "%%AMOCT%d*5,0,8,0,0,%s,22.5*%%\r\n"
+      pcb_fprintf (f, "%%AMOCT%d*5,0,8,0,0,%.4mi,22.5*%%\r\n"
 	       "%%ADD%dOCT%d*%%\r\n", aptr->dCode,
-	       buf, aptr->dCode,
+	       (Coord) ((double) aptr->width / COS_22_5_DEGREE), aptr->dCode,
 	       aptr->dCode);
       break;
 #if 0

commit 9cb66f740b56b3743dc0e582558b3861b24617a1
Author: Andrew Poelstra (local) <apoelstra@xxxxxxxxxxxxxx>
Commit: Andrew Poelstra (local) <apoelstra@xxxxxxxxxxxxxx>

    Add ` modifier to pcb-printf, which forces '.' as a decimal separator
    
    This should be used for the gerber exporter and other formats
    that need to use '.' regardless of locale in order to obey their
    standards.
    
    Note that the %mr specifier (which restricts suffixes to mm and mil
    so that old pcb versions can read them) uses this by default, so no
    changes need to be made to file.c.

diff --git a/src/pcb-printf.c b/src/pcb-printf.c
index f687e06..183ea18 100644
--- a/src/pcb-printf.c
+++ b/src/pcb-printf.c
@@ -382,7 +382,7 @@ static gchar *CoordsToString(Coord coord[], int n_coords, const char *printf_spe
    *  (+ 2 skips the ", " for first value) */
   if (n_coords > 1)
     g_string_append_c (buff, '(');
-  if (suffix_type == FILE_MODE)
+  if (suffix_type == FILE_MODE || suffix_type == FILE_MODE_NO_SUFFIX)
     {
       g_ascii_formatd (filemode_buff, sizeof filemode_buff, printf_buff + 2, value[0]);
       g_string_append_printf (buff, "%s", filemode_buff);
@@ -391,7 +391,7 @@ static gchar *CoordsToString(Coord coord[], int n_coords, const char *printf_spe
     g_string_append_printf (buff, printf_buff + 2, value[0]);
   for (i = 1; i < n_coords; ++i)
     {
-      if (suffix_type == FILE_MODE)
+      if (suffix_type == FILE_MODE || suffix_type == FILE_MODE_NO_SUFFIX)
         {
           g_ascii_formatd (filemode_buff, sizeof filemode_buff, printf_buff, value[i]);
           g_string_append_printf (buff, "%s", filemode_buff);
@@ -407,6 +407,7 @@ static gchar *CoordsToString(Coord coord[], int n_coords, const char *printf_spe
       switch (suffix_type)
         {
         case NO_SUFFIX:
+        case FILE_MODE_NO_SUFFIX:
           break;
         case SUFFIX:
           g_string_append_printf (buff, " %s", suffix);
@@ -479,7 +480,12 @@ gchar *pcb_vprintf(const char *fmt, va_list args)
             }
           if(*fmt == '$')
             {
-              suffix = SUFFIX;
+              suffix = (suffix == NO_SUFFIX) ? SUFFIX : FILE_MODE;
+              fmt++;
+            }
+          if(*fmt == '`')
+            {
+              suffix = (suffix == SUFFIX) ? FILE_MODE : FILE_MODE_NO_SUFFIX;
               fmt++;
             }
           /* Tack full specifier onto specifier */
diff --git a/src/pcb-printf.h b/src/pcb-printf.h
index cbd9bbd..4b37b38 100644
--- a/src/pcb-printf.h
+++ b/src/pcb-printf.h
@@ -59,6 +59,8 @@
  *     #    prevents all scaling for %mS/D/1/.../9 (this should
  *          ONLY be used for debug code since its output exposes
  *          pcb's base units).
+ *     `    always use '.' as decimal separator (note that %mr uses
+ *          this by default).
  *
  * KNOWN ISSUES:
  *   No support for %zu size_t printf spec
@@ -96,7 +98,12 @@ enum e_allow {
 };
 
 enum e_family { METRIC, IMPERIAL };
-enum e_suffix { NO_SUFFIX, SUFFIX, FILE_MODE };
+enum e_suffix {
+  NO_SUFFIX,			/* no suffix  */
+  SUFFIX,			/* suffix, prefixed with ' ' */
+  FILE_MODE_NO_SUFFIX,		/* no suffix, force '.' as decimal */
+  FILE_MODE			/* suffix, force '.' as decimal */
+};
 
 struct unit {
   int index;			/* Index into Unit[] list */




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