www.delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2013/04/18/10:12:06

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
X-Envelope-From: paubert AT iram DOT es
From: Gabriel Paubert <paubert AT iram DOT es>
To: geda-user AT delorie DOT com
Cc: Gabriel Paubert <paubert AT iram DOT es>
Subject: [geda-user] =?UTF-8?q?=5BPATCH=202/3=5D=20Add=200=2E1mil=20resolution=20in=20pcb-printf=20and=20update=20comments=2E?=
Date: Thu, 18 Apr 2013 16:11:20 +0200
Message-Id: <1366294282-8688-2-git-send-email-paubert@iram.es>
X-Mailer: git-send-email 1.7.10.4
In-Reply-To: <1366294282-8688-1-git-send-email-paubert@iram.es>
References: <20130418140806 DOT GA8618 AT gra-vd1 DOT iram DOT es>
<1366294282-8688-1-git-send-email-paubert AT iram DOT es>
MIME-Version: 1.0
X-Spamina-Bogosity: Unsure
X-Spam-Score: 0.0 (/)
X-Spam-Report: Content analysis details: (0.0 points)
pts rule name description
---- ---------------------- --------------------------------------------------
_SUMMARY_
Reply-To: geda-user AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: geda-user AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

The 0.1mil is needed for proper imperial drill file generation.
Apart form this, the list of %m unit modifiers is now properly
documented and a redundant test was removed.
---
 src/pcb-printf.c |    7 +++++--
 src/pcb-printf.h |   16 ++++++++++++----
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/src/pcb-printf.c b/src/pcb-printf.c
index a434834..e53df64 100644
--- a/src/pcb-printf.c
+++ b/src/pcb-printf.c
@@ -84,6 +84,9 @@ static Unit Units[] = {
   { 0, "mil",  NULL, 'l', 1,     IMPERIAL, ALLOW_MIL,  2,
                0.1, 1.0, 10, 100, 1000,
                { "" } },
+  { 0, "dmil", NULL, 't', 10,   IMPERIAL, ALLOW_DMIL, 0,
+               1, 10, 100, 1000, 10000,
+               { "" } },
   { 0, "cmil", NULL, 'c', 100,   IMPERIAL, ALLOW_CMIL, 0,
                1, 10, 100, 1000, 10000,
                { "pcb" } }
@@ -358,11 +361,11 @@ static gchar *CoordsToString(Coord coord[], int n_coords, const char *printf_spe
   for (i = 0; i < n_coords; ++i)
     value[i] = value[i] * Units[n].scale_factor;
 
-  /* Create sprintf specifier, using default_prec no preciscion is given */
+  /* Create sprintf specifier, using default_prec no precision is given */
   i = 0;
   while (printf_spec[i] == '%' || isdigit(printf_spec[i]) ||
          printf_spec[i] == '-' || printf_spec[i] == '+' ||
-         printf_spec[i] == '#' || printf_spec[i] == '0')
+         printf_spec[i] == '#')
     ++i;
   if (printf_spec[i] == '.')
     printf_buff = g_strdup_printf (", %sf", printf_spec);
diff --git a/src/pcb-printf.h b/src/pcb-printf.h
index 3d4e0d2..6d044d7 100644
--- a/src/pcb-printf.h
+++ b/src/pcb-printf.h
@@ -34,9 +34,16 @@
  *  it.
  *
  * The new specifiers are:
+ *   %mk    output a measure in km
+ *   %mf    output a measure in meters
+ *   %me    output a measure in cm
  *   %mm    output a measure in mm
+ *   %mu    output a measure in µm
+ *   %mn    output a measure in nm
  *   %mM    output a measure in scaled (mm/um) metric
  *   %ml    output a measure in mil
+ *   %mc    output a measure in cmil
+ *   %mt    output a measure in 1/10 of mils (for Excellon drill files)
  *   %mL    output a measure in scaled (mil/in) imperial
  *   %ms    output a measure in most natural mm/mil units
  *   %mS    output a measure in most natural scaled units
@@ -79,12 +86,13 @@ enum e_allow {
   ALLOW_KM = 32,
 
   ALLOW_CMIL = 1024,
-  ALLOW_MIL  = 2048,
-  ALLOW_IN   = 4096,
+  ALLOW_DMIL = 2048,
+  ALLOW_MIL  = 4096,
+  ALLOW_IN   = 8192,
 
   ALLOW_METRIC   = ALLOW_NM | ALLOW_UM | ALLOW_MM |
                    ALLOW_CM | ALLOW_M  | ALLOW_KM,
-  ALLOW_IMPERIAL = ALLOW_CMIL | ALLOW_MIL | ALLOW_IN,
+  ALLOW_IMPERIAL = ALLOW_CMIL | ALLOW_DMIL | ALLOW_MIL | ALLOW_IN,
   /* This is all units allowed in parse_l.l */
 #if 0
   ALLOW_READABLE = ALLOW_NM | ALLOW_UM | ALLOW_MM |
@@ -94,7 +102,7 @@ enum e_allow {
   ALLOW_READABLE = ALLOW_MIL | ALLOW_MM,
 #endif
 
-  ALLOW_ALL = ~0
+  ALLOW_ALL = ~ALLOW_DMIL
 };
 
 enum e_family { METRIC, IMPERIAL };
-- 
1.7.10.4

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019