[patch] cavern in feet
David A. Riggs
david.a.riggs at gmail.com
Tue Oct 23 21:36:03 BST 2007
Unfortunately for the rest of the world, cavers here in the US still
insist on using feet instead of metric measurements for our surveys.
The following patch (cvs diff -u) adds an option (-f or --feet) to
`cavern` which displays all output using feet instead of meters.
$> patch -p0 < cavern_in_feet.diff
- DR
--
David A. Riggs <david.a.riggs at gmail.com>
-------------- next part --------------
Index: doc/cavern.sgml
===================================================================
RCS file: /usr/data/cvs/survex/doc/cavern.sgml,v
retrieving revision 1.5.2.2
diff -u -r1.5.2.2 cavern.sgml
--- doc/cavern.sgml 12 Jul 2005 21:05:39 -0000 1.5.2.2
+++ doc/cavern.sgml 23 Oct 2007 20:31:16 -0000
@@ -81,6 +81,14 @@
</VarListEntry>
<VarListEntry>
+<Term>-f, --feet</Term>
+<ListItem>
+<Para>Display measurements in feet (default meters).
+</Para>
+</ListItem>
+</VarListEntry>
+
+<VarListEntry>
<Term>--log</Term>
<ListItem>
<Para>Send screen output to a .log file.
Index: lib/messages.txt
===================================================================
RCS file: /usr/data/cvs/survex/lib/messages.txt,v
retrieving revision 1.154.2.59
diff -u -r1.154.2.59 messages.txt
--- lib/messages.txt 9 Dec 2006 06:24:52 -0000 1.154.2.59
+++ lib/messages.txt 23 Oct 2007 20:31:20 -0000
@@ -1552,77 +1552,77 @@
sk:131 Nájdené `%s', očakávané `F' alebo `B'
ro:131 Am gasit `%s', asteptam `F' sau `B'
#
-en:132 Total length of survey legs = %7.2fm (%7.2fm adjusted)
-en-us:132 Total length of survey shots = %7.2fm (%7.2fm adjusted)
-fr:132 Longueur totale de la topo = %7.2fm (%7.2fm adjusté)
-de-de,de-ch:132 Gesamtlänge der Messstrecken = %7.2fm (%7.2fm ausgeglichen)
-de:132 Gesamtlänge der Meßstrecken = %7.2fm (%7.2fm ausgeglichen)
-pt:132 Desenvolvimento linear das visadas = %7.2fm (%7.2fm corrigidos)
-ca:132 Longitut total de les tirades de topografía = %7.2fm (%7.2fm corregit)
-es:132 Longitud total de las tiradas de topografia = %7.2fm (%7.2fm corregido)
-it:132 Sviluppo spaziale = %7.2fm (%7.2fm corretto)
-#ital:132 Lunghezza totale dei tiri = %7.2fm (%7.2fm corretto)
-sk:132 Celková dĺžka zámer = %7.2fm (%7.2fm nastavené)
-ro:132 Lungimea totala a masuratorilor topografiei = %7.2fm (%7.2fm ajustat)
-#
-en:133 Total plan length of survey legs = %7.2fm
-en-us:133 Total plan length of survey shots = %7.2fm
-fr:133 Longueur totale en projection horizontale = %7.2fm
-de-de,de-ch:133 Gesamte Horizontallänge der Messstrecken = %7.2fm
-de:133 Gesamte Horizontallänge der Meßstrecken = %7.2fm
-pt:133 Desenvolvimento horizontal das visadas = %7.2fm
-ca:133 Longitut total en projecció horitzontal = %7.2fm
-es:133 Longitud total en proyección horizontal = %7.2fm
-it:133 Sviluppo planimetrico = %7.2fm
-sk:133 Celková pôdorysná dĺžka zámer %7.2fm
-#ital:133 Lunghezza totale in pianta = %7.2fm
-ro:133 Lungimea totala in plan a masuratorilor topografiei = %7.2fm
-en:134 Total vertical length of survey legs = %7.2fm
-en-us:134 Total vertical length of survey shots = %7.2fm
-fr:134 Longueur totale verticale = %7.2fm
-de-de,de-ch:134 Gesamte Vertikallänge der Messstrecken = %7.2fm
-de:134 Gesamte Vertikallänge der Meßstrecken = %7.2fm
-pt:134 Desenvolvimento vertical das visadas = %7.2fm
-ca:134 Longitut vertical total de les tirades de topografía = %7.2fm
-es:134 Longitud vertical total de las tiradas de topografia = %7.2fm
-it:134 Totale delle componenti verticali delle battute = %7.2fm
-sk:134 Celková vertikálna dĺžka zámer %7.2fm
-ro:134 Lungimea totala verticala a masuratorilor topografiei = %7.2fm
+en:132 Total length of survey legs = %7.2f%s (%7.2f%s adjusted)
+en-us:132 Total length of survey shots = %7.2f%s (%7.2f%s adjusted)
+fr:132 Longueur totale de la topo = %7.2f%s (%7.2f%s adjusté)
+de-de,de-ch:132 Gesamtlänge der Messstrecken = %7.2f%s (%7.2f%s ausgeglichen)
+de:132 Gesamtlänge der Meßstrecken = %7.2f%s (%7.2f%s ausgeglichen)
+pt:132 Desenvolvimento linear das visadas = %7.2f%s (%7.2f%s corrigidos)
+ca:132 Longitut total de les tirades de topografía = %7.2f%s (%7.2f%s corregit)
+es:132 Longitud total de las tiradas de topografia = %7.2f%s (%7.2f%s corregido)
+it:132 Sviluppo spaziale = %7.2f%s (%7.2f%s corretto)
+#ital:132 Lunghezza totale dei tiri = %7.2f%s (%7.2f%s corretto)
+sk:132 Celková dĺžka zámer = %7.2f%s (%7.2f%s nastavené)
+ro:132 Lungimea totala a masuratorilor topografiei = %7.2f%s (%7.2f%s ajustat)
+#
+en:133 Total plan length of survey legs = %7.2f%s
+en-us:133 Total plan length of survey shots = %7.2f%s
+fr:133 Longueur totale en projection horizontale = %7.2f%s
+de-de,de-ch:133 Gesamte Horizontallänge der Messstrecken = %7.2f%s
+de:133 Gesamte Horizontallänge der Meßstrecken = %7.2f%s
+pt:133 Desenvolvimento horizontal das visadas = %7.2f%s
+ca:133 Longitut total en projecció horitzontal = %7.2f%s
+es:133 Longitud total en proyección horizontal = %7.2f%s
+it:133 Sviluppo planimetrico = %7.2f%s
+sk:133 Celková pôdorysná dĺžka zámer %7.2f%s
+#ital:133 Lunghezza totale in pianta = %7.2f%s
+ro:133 Lungimea totala in plan a masuratorilor topografiei = %7.2f%s
+en:134 Total vertical length of survey legs = %7.2f%s
+en-us:134 Total vertical length of survey shots = %7.2f%s
+fr:134 Longueur totale verticale = %7.2f%s
+de-de,de-ch:134 Gesamte Vertikallänge der Messstrecken = %7.2f%s
+de:134 Gesamte Vertikallänge der Meßstrecken = %7.2f%s
+pt:134 Desenvolvimento vertical das visadas = %7.2f%s
+ca:134 Longitut vertical total de les tirades de topografía = %7.2f%s
+es:134 Longitud vertical total de las tiradas de topografia = %7.2f%s
+it:134 Totale delle componenti verticali delle battute = %7.2f%s
+sk:134 Celková vertikálna dĺžka zámer %7.2f%s
+ro:134 Lungimea totala verticala a masuratorilor topografiei = %7.2f%s
# <135> <station name> <136> <station name> <137>
# numbers are altitudes of highest and lowest stations
# GN(3): ok adapting the preposition to context
# OOOOPS, cf 148/149 below!
-en:135 "Vertical range = %4.2fm (from "
-fr:135 "Interval vertical = %4.2fm (de "
-#germ:135 "H"ohenerstreckung = %4.2fm (von "
-de:135 "Vertikale Erstreckung = %4.2fm (von "
-pt:135 "Desnível = %4.2fm (de "
-ca:135 "Desnivell total = %4.2fm (des de "
-es:135 "Desnivel total = %4.2fm (desde "
-it:135 "Dislivello totale = %4.2fm (da "
-sk:135 "Vertikálny rozsah = %4.2fm (od "
-ro:135 "Interval vertical = %4.2fm (de la "
+en:135 "Vertical range = %4.2f%s (from "
+fr:135 "Interval vertical = %4.2f%s (de "
+#germ:135 "H"ohenerstreckung = %4.2f%s (von "
+de:135 "Vertikale Erstreckung = %4.2f%s (von "
+pt:135 "Desnível = %4.2f%s (de "
+ca:135 "Desnivell total = %4.2f%s (des de "
+es:135 "Desnivel total = %4.2f%s (desde "
+it:135 "Dislivello totale = %4.2f%s (da "
+sk:135 "Vertikálny rozsah = %4.2f%s (od "
+ro:135 "Interval vertical = %4.2f%s (de la "
# for many translations, 196/197 will be the same as 136/137
-en:136 " at %4.2fm to "
-fr:136 " à %4.2fm jusqu'à "
-#germ:136 " bei %4.2fm bis "
-de:136 " auf %4.2fm bis "
-pt:136 " a %4.2fm a "
-ca:136 " a %4.2fm a "
-es:136 " en %4.2fm a "
-it:136 " a %4.2fm a "
-sk:136 " v %4.2fm do "
-ro:136 " la %4.2fm de la "
-en:137 " at %4.2fm)"
-fr:137 " à %4.2fm)"
-#germ:137 " bei %4.2fm)"
-de:137 " auf %4.2fm)"
-pt:137 " a %4.2fm)"
-ca:137 " a %4.2fm)"
-es:137 " en %4.2fm)"
-it:137 " a %4.2fm)"
-sk:137 " v %4.2fm)"
-ro:137 " la %4.2fm)"
+en:136 " at %4.2f%s to "
+fr:136 " à %4.2f%s jusqu'à "
+#germ:136 " bei %4.2f%s bis "
+de:136 " auf %4.2f%s bis "
+pt:136 " a %4.2f%s a "
+ca:136 " a %4.2f%s a "
+es:136 " en %4.2f%s a "
+it:136 " a %4.2f%s a "
+sk:136 " v %4.2f%s do "
+ro:136 " la %4.2f%s de la "
+en:137 " at %4.2f%s)"
+fr:137 " à %4.2f%s)"
+#germ:137 " bei %4.2f%s)"
+de:137 " auf %4.2f%s)"
+pt:137 " a %4.2f%s)"
+ca:137 " a %4.2f%s)"
+es:137 " en %4.2f%s)"
+it:137 " a %4.2f%s)"
+sk:137 " v %4.2f%s)"
+ro:137 " la %4.2f%s)"
en:138 There is 1 loop.
fr:138 Il y a 1 bouclage.
# GN(2): There _is_ a technical term for this which I fail to remember at the moment. (139 too)
@@ -1690,17 +1690,17 @@
ro:144 Gata.
# zh from wxWindows
#zh:144 完成。
-en:145 "Original length%7.2fm (%3d legs), moved%7.2fm (%5.2fm/leg). "
-en-us:145 "Original length%7.2fm (%3d shots), moved%7.2fm (%5.2fm/shot). "
-fr:145 "Longueur originale%7.2fm (%3d visées), réduit à%7.2fm (%5.2fm/visées). "
-de-de,de-ch:145 "Ursprüngliche Länge%7.2fm (%3d Strecken), verändert um%7.2fm (%5.2fm/Messstrecke). "
-de:145 "Ursprüngliche Länge%7.2fm (%3d Strecken), verändert um%7.2fm (%5.2fm/Meßstrecke). "
-pt:145 "Desenvolvimento Original%7.2fm (%3d visadas), deslocado%7.2fm (%5.2fm/visada). "
-ca:145 "Longitut original%7.2fm (%3d tirades), reduits %7.2fm (%5.2fm/tirada). "
-es:145 "Longitud original%7.2fm (%3d tiradas), reducidos %7.2fm (%5.2fm/tirada). "
-it:145 "Lunghezza originale%7.2fm (%3d battute), ridotta%7.2fm (%5.2fm/battuta). "
-sk:145 "Pôvodná dĺžka%7.2fm (%3d zámer), redukovaná%7.2fm (%5.2fm/zámeru). "
-ro:145 "Lungimea originala%7.2fm (%3d legs), ajustata%7.2fm (%5.2fm/masuratoare). "
+en:145 "Original length%7.2f%s (%3d legs), moved%7.2f%s (%5.2f%s/leg). "
+en-us:145 "Original length%7.2f%s (%3d shots), moved%7.2f%s (%5.2f%s/shot). "
+fr:145 "Longueur originale%7.2f%s (%3d visées), réduit à%7.2f%s (%5.2f%s/visées). "
+de-de,de-ch:145 "Ursprüngliche Länge%7.2f%s (%3d Strecken), verändert um%7.2f%s (%5.2f%s/Messstrecke). "
+de:145 "Ursprüngliche Länge%7.2f%s (%3d Strecken), verändert um%7.2f%s (%5.2f%s/Meßstrecke). "
+pt:145 "Desenvolvimento Original%7.2f%s (%3d visadas), deslocado%7.2f%s (%5.2f%s/visada). "
+ca:145 "Longitut original%7.2f%s (%3d tirades), reduits %7.2f%s (%5.2f%s/tirada). "
+es:145 "Longitud original%7.2f%s (%3d tiradas), reducidos %7.2f%s (%5.2f%s/tirada). "
+it:145 "Lunghezza originale%7.2f%s (%3d battute), ridotta%7.2f%s (%5.2f%s/battuta). "
+sk:145 "Pôvodná dĺžka%7.2f%s (%3d zámer), redukovaná%7.2f%s (%5.2f%s/zámeru). "
+ro:145 "Lungimea originala%7.2f%s (%3d legs), ajustata%7.2f%s (%5.2f%s/masuratoare). "
en:146 Error%7.2f%%
fr:146 Erreur%7.2f%%
de:146 Fehler%7.2f%%
@@ -1725,25 +1725,25 @@
ro:147 Eroare N/A
# <148> <station name> <196> <station name> <197>
# similar to <135> <station name> <136> <station name> <137>
-en:148 "North-South range = %4.2fm (from "
-fr:148 "Interval Nord-Sud = %4.2fm (de "
-de:148 "Nord-Süd-Erstreckung = %4.2fm (von "
-pt:148 "Extensão Norte-Sul = %4.2fm (de "
-ca:148 "Extensió Nord-Sud = %4.2fm (des de "
-es:148 "Extensión Norte-Sur = %4.2fm (desde "
-it:148 "Estensione Nord-Sud = %4.2fm (da "
-sk:148 "Rozsah sever-juh = %4.2fm (od "
-ro:148 "Extindere Nord-Sud = %4.2fm (de la "
+en:148 "North-South range = %4.2f%s (from "
+fr:148 "Interval Nord-Sud = %4.2f%s (de "
+de:148 "Nord-Süd-Erstreckung = %4.2f%s (von "
+pt:148 "Extensão Norte-Sul = %4.2f%s (de "
+ca:148 "Extensió Nord-Sud = %4.2f%s (des de "
+es:148 "Extensión Norte-Sur = %4.2f%s (desde "
+it:148 "Estensione Nord-Sud = %4.2f%s (da "
+sk:148 "Rozsah sever-juh = %4.2f%s (od "
+ro:148 "Extindere Nord-Sud = %4.2f%s (de la "
# <149> <station name> <196> <station name> <197>
-en:149 "East-West range = %4.2fm (from "
-fr:149 "Interval Est-Ouest = %4.2fm (de "
-de:149 "Ost-West-Erstreckung = %4.2fm (von "
-pt:149 "Extensão Leste-Oeste = %4.2fm (de "
-ca:149 "Extensió Est-Oest = %4.2fm (des de "
-es:149 "Extensión Este-Oeste = %4.2fm (desde "
-it:149 "Estensione Est-Ovest = %4.2fm (da "
-sk:149 "Rozsah východ-západ = %4.2fm (od "
-ro:149 "Extindere Est-Vest = %4.2fm (de la "
+en:149 "East-West range = %4.2f%s (from "
+fr:149 "Interval Est-Ouest = %4.2f%s (de "
+de:149 "Ost-West-Erstreckung = %4.2f%s (von "
+pt:149 "Extensão Leste-Oeste = %4.2f%s (de "
+ca:149 "Extensió Est-Oest = %4.2f%s (des de "
+es:149 "Extensión Este-Oeste = %4.2f%s (desde "
+it:149 "Estensione Est-Ovest = %4.2f%s (da "
+sk:149 "Rozsah východ-západ = %4.2f%s (od "
+ro:149 "Extindere Est-Vest = %4.2f%s (de la "
# description of --help option
#
en:150 display this help and exit
@@ -2234,24 +2234,24 @@
sk:195 ( východ, sever, výška )
ro:195 ( Est (X), Nord (Y), Altitudine Z )
# for many translations, 196/197 will be the same as 136/137
-en:196 " at %4.2fm to "
-fr:196 " à %4.2fm jusqu'à "
-de:196 " bei %4.2fm bis "
-pt:196 " a %4.2fm a "
-ca:196 " a %4.2fm a "
-es:196 " en %4.2fm a "
-it:196 " a %4.2fm a "
-sk:196 " od %4.2fm do "
-ro:196 " la %4.2fm de la "
-en:197 " at %4.2fm)"
-fr:197 " à %4.2fm)"
-de:197 " bei %4.2fm)"
-pt:197 " a %4.2fm)"
-ca:197 " a %4.2fm)"
-es:197 " en %4.2fm)"
-it:197 " a %4.2fm)"
-sk:197 " do %4.2fm)"
-ro:197 " la %4.2fm)"
+en:196 " at %4.2f%s to "
+fr:196 " à %4.2f%s jusqu'à "
+de:196 " bei %4.2f%s bis "
+pt:196 " a %4.2f%s a "
+ca:196 " a %4.2f%s a "
+es:196 " en %4.2f%s a "
+it:196 " a %4.2f%s a "
+sk:196 " od %4.2f%s do "
+ro:196 " la %4.2f%s de la "
+en:197 " at %4.2f%s)"
+fr:197 " à %4.2f%s)"
+de:197 " bei %4.2f%s)"
+pt:197 " a %4.2f%s)"
+ca:197 " a %4.2f%s)"
+es:197 " en %4.2f%s)"
+it:197 " a %4.2f%s)"
+sk:197 " do %4.2f%s)"
+ro:197 " la %4.2f%s)"
#
en:198 Expecting date, found `%s'
fr:198 On attendait une date, on a trouvé `%s'
Index: src/cavern.c
===================================================================
RCS file: /usr/data/cvs/survex/src/cavern.c,v
retrieving revision 1.66.2.16
diff -u -r1.66.2.16 cavern.c
--- src/cavern.c 3 Sep 2006 23:12:13 -0000 1.66.2.16
+++ src/cavern.c 23 Oct 2007 20:31:21 -0000
@@ -76,6 +76,9 @@
real min[3], max[3];
prefix *pfxHi[3], *pfxLo[3];
+u_units display_units;
+const char *unitstr = NULL; /* display string for units */
+
char *survey_title = NULL;
int survey_title_len;
@@ -102,6 +105,7 @@
{"quiet", no_argument, 0, 'q'},
{"no-auxiliary-files", no_argument, 0, 's'},
{"warnings-are-errors", no_argument, 0, 'w'},
+ {"feet", no_argument, 0, 'f'},
{"log", no_argument, 0, 1},
#if OS_WIN32
{"pause", no_argument, 0, 2},
@@ -111,7 +115,7 @@
{0, 0, 0, 0}
};
-#define short_opts "pao:qswz:"
+#define short_opts "pao:qswfz:"
/* TRANSLATE extract help messages to message file */
static struct help_msg help[] = {
@@ -121,7 +125,8 @@
{HLP_ENCODELONG(3), "only show brief summary (-qq for errors only)"},
{HLP_ENCODELONG(4), "do not create .err file"},
{HLP_ENCODELONG(5), "turn warnings into errors"},
- {HLP_ENCODELONG(6), "log output to .log file"},
+ {HLP_ENCODELONG(6), "display measurements in feet (default meters)"},
+ {HLP_ENCODELONG(7), "log output to .log file"},
/*{'z', "set optimizations for network reduction"},*/
{0, 0}
};
@@ -182,6 +187,9 @@
cLegs = cStns = cComponents = 0;
totadj = total = totplan = totvert = 0.0;
+ display_units = UNITS_METRES;
+ unitstr = "m"; /* default display units: meters */
+
for (d = 0; d <= 2; d++) {
min[d] = HUGE_REAL;
max[d] = -HUGE_REAL;
@@ -228,6 +236,10 @@
case 'w':
f_warnings_are_errors = 1;
break;
+ case 'f':
+ display_units = UNITS_FEET;
+ unitstr = "ft";
+ break;
case 'z': {
/* Control which network optimisations are used (development tool) */
static int first_opt_z = 1;
@@ -377,11 +389,11 @@
static void
do_range(int d, int msg1, int msg2, int msg3)
{
- printf(msg(msg1), max[d] - min[d]);
+ printf(msg(msg1), unit_conv(max[d] - min[d]), unitstr);
fprint_prefix(stdout, pfxHi[d]);
- printf(msg(msg2), max[d]);
+ printf(msg(msg2), unit_conv(max[d]), unitstr);
fprint_prefix(stdout, pfxLo[d]);
- printf(msg(msg3), min[d]);
+ printf(msg(msg3), unit_conv(min[d]), unitstr);
putnl();
}
@@ -419,24 +431,24 @@
putnl();
}
- printf(msg(/*Total length of survey legs = %7.2fm (%7.2fm adjusted)*/132),
- total, totadj);
+ printf(msg(/*Total length of survey legs = %7.2f%s (%7.2f%s adjusted)*/132),
+ unit_conv(total), unitstr, unit_conv(totadj), unitstr);
putnl();
- printf(msg(/*Total plan length of survey legs = %7.2fm*/133),
- totplan);
+ printf(msg(/*Total plan length of survey legs = %7.2f%s*/133),
+ unit_conv(totplan), unitstr);
putnl();
- printf(msg(/*Total vertical length of survey legs = %7.2fm*/134),
- totvert);
+ printf(msg(/*Total vertical length of survey legs = %7.2f%s*/134),
+ unit_conv(totvert), unitstr);
putnl();
/* If there's no underground survey, we've no ranges */
if (pfxHi[0]) {
- do_range(2, /*Vertical range = %4.2fm (from */135,
- /* at %4.2fm to */136, /* at %4.2fm)*/137);
- do_range(1, /*North-South range = %4.2fm (from */148,
- /* at %4.2fm to */196, /* at %4.2fm)*/197);
- do_range(0, /*East-West range = %4.2fm (from */149,
- /* at %4.2fm to */196, /* at %4.2fm)*/197);
+ do_range(2, /*Vertical range = %4.2f%s (from */135,
+ /* at %4.2f%s to */136, /* at %4.2f%s)*/137);
+ do_range(1, /*North-South range = %4.2f%s (from */148,
+ /* at %4.2f%s to */196, /* at %4.2f%s)*/197);
+ do_range(0, /*East-West range = %4.2f%s (from */149,
+ /* at %4.2f%s to */196, /* at %4.2f%s)*/197);
}
print_node_stats();
Index: src/cavern.h
===================================================================
RCS file: /usr/data/cvs/survex/src/cavern.h,v
retrieving revision 1.64.2.13
diff -u -r1.64.2.13 cavern.h
--- src/cavern.h 3 Sep 2006 23:12:14 -0000 1.64.2.13
+++ src/cavern.h 23 Oct 2007 20:31:21 -0000
@@ -324,6 +324,10 @@
#endif
extern real totadj, total, totplan, totvert;
extern real min[3], max[3];
+
+extern u_units display_units;
+extern const char *unitstr;
+
extern prefix *pfxHi[3], *pfxLo[3];
extern bool fQuiet; /* just show brief summary + errors */
extern bool fMute; /* just show errors */
@@ -338,6 +342,9 @@
#define reverse_leg_dirn(L) ((L)->l.reverse & MASK_REVERSEDIRN)
#define reverse_leg(L) ((L)->l.to->leg[reverse_leg_dirn(L)])
+/* Convert (metre) value to display units */
+#define unit_conv(V) ((V) / get_factor(display_units)) /* requires commands.h */
+
#if EXPLICIT_FIXED_FLAG
# define pfx_fixed(N) ((N)->pos->fFixed)
# define pos_fixed(P) ((P)->fFixed)
Index: src/commands.c
===================================================================
RCS file: /usr/data/cvs/survex/src/commands.c,v
retrieving revision 1.126.2.15
diff -u -r1.126.2.15 commands.c
--- src/commands.c 2 Jul 2006 03:44:55 -0000 1.126.2.15
+++ src/commands.c 23 Oct 2007 20:31:22 -0000
@@ -273,6 +273,13 @@
(M_PI/180.0), (M_PI/200.0), 0.01, (M_PI/180.0/60.0)
};
+/* expose factor_tab for external unit factor lookup */
+extern real
+get_factor(u_units units)
+{
+ return factor_tab[units];
+}
+
static int
get_units(unsigned long qmask, bool percent_ok)
{
Index: src/commands.h
===================================================================
RCS file: /usr/data/cvs/survex/src/commands.h,v
retrieving revision 1.11.2.4
diff -u -r1.11.2.4 commands.h
--- src/commands.h 27 Jul 2003 19:50:27 -0000 1.11.2.4
+++ src/commands.h 23 Oct 2007 20:31:22 -0000
@@ -33,4 +33,6 @@
typedef struct { const char *sz; int tok; } sztok;
int match_tok(const sztok *tab, int tab_size);
+real get_factor(u_units units);
+
#define TABSIZE(T) ((sizeof(T) / sizeof(sztok)) - 1)
Index: src/netskel.c
===================================================================
RCS file: /usr/data/cvs/survex/src/netskel.c,v
retrieving revision 1.62.2.14
diff -u -r1.62.2.14 netskel.c
--- src/netskel.c 4 Sep 2006 00:27:08 -0000 1.62.2.14
+++ src/netskel.c 23 Oct 2007 20:31:23 -0000
@@ -33,6 +33,7 @@
#include "validate.h"
#include "debug.h"
#include "cavern.h"
+#include "commands.h"
#include "filename.h"
#include "message.h"
#include "filelist.h"
@@ -716,8 +717,11 @@
if (!fSuppress) {
double sqrt_eTot = sqrt(eTot);
fputnl(fhErrStat);
- fprintf(fhErrStat, msg(/*Original length%7.2fm (%3d legs), moved%7.2fm (%5.2fm/leg). */145),
- lenTrav, cLegsTrav, sqrt_eTot, sqrt_eTot / cLegsTrav);
+ fprintf(fhErrStat,
+ msg(/*Original length%7.2f%s (%3d legs), moved%7.2f%s (%5.2f%s/leg). */145),
+ unit_conv(lenTrav), unitstr, cLegsTrav,
+ unit_conv(sqrt_eTot), unitstr,
+ unit_conv(sqrt_eTot / cLegsTrav), unitstr);
if (lenTrav > 0.0)
fprintf(fhErrStat, msg(/*Error%7.2f%%*/146), 100 * sqrt_eTot / lenTrav);
else
More information about the Survex
mailing list