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 To: geda-user AT delorie DOT com Cc: Gabriel Paubert Subject: [geda-user] [PATCH 2/3] pcb-printf: Add 0.1mil resolution, improve documentation and a small cleanup. Date: Fri, 19 Apr 2013 12:25:37 +0200 Message-Id: <1366367138-16165-3-git-send-email-paubert@iram.es> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1366367138-16165-1-git-send-email-paubert@iram.es> References: <1366367138-16165-1-git-send-email-paubert AT iram DOT es> 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 Precedence: bulk 0.1mil resolution is needed for improved imperial drill file generation. Apart form this, the list of %m unit modifiers is now fully 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..9f4f735 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 um + * %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