[bb90203] | 1 | /* > cavern.c |
---|
| 2 | * SURVEX Cave surveying software: data reduction main and related functions |
---|
[932f7e9] | 3 | * Copyright (C) 1991-2001 Olly Betts |
---|
[846746e] | 4 | * |
---|
[89231c4] | 5 | * This program is free software; you can redistribute it and/or modify |
---|
| 6 | * it under the terms of the GNU General Public License as published by |
---|
| 7 | * the Free Software Foundation; either version 2 of the License, or |
---|
| 8 | * (at your option) any later version. |
---|
[846746e] | 9 | * |
---|
| 10 | * This program is distributed in the hope that it will be useful, |
---|
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
[89231c4] | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 13 | * GNU General Public License for more details. |
---|
[846746e] | 14 | * |
---|
[89231c4] | 15 | * You should have received a copy of the GNU General Public License |
---|
| 16 | * along with this program; if not, write to the Free Software |
---|
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
[bb90203] | 18 | */ |
---|
| 19 | |
---|
| 20 | #ifdef HAVE_CONFIG_H |
---|
| 21 | #include <config.h> |
---|
| 22 | #endif |
---|
| 23 | |
---|
| 24 | #include <time.h> |
---|
| 25 | |
---|
[5853657] | 26 | #include "cavern.h" |
---|
| 27 | #include "cmdline.h" |
---|
| 28 | #include "commands.h" |
---|
[bb90203] | 29 | #include "datain.h" |
---|
| 30 | #include "debug.h" |
---|
| 31 | #include "message.h" |
---|
| 32 | #include "filename.h" |
---|
| 33 | #include "filelist.h" |
---|
| 34 | #include "img.h" |
---|
| 35 | #include "listpos.h" |
---|
[5853657] | 36 | #include "netbits.h" |
---|
| 37 | #include "netskel.h" |
---|
| 38 | #include "osdepend.h" |
---|
[bb90203] | 39 | #include "out.h" |
---|
[8e8057c] | 40 | #include "str.h" |
---|
[5853657] | 41 | #include "validate.h" |
---|
[bb90203] | 42 | |
---|
[647407d] | 43 | #ifdef NEW3DFORMAT |
---|
[8318645] | 44 | # if OS != RISCOS |
---|
| 45 | /* include header for getcwd() */ |
---|
| 46 | # if OS == MSDOS && defined(__TURBOC__) |
---|
| 47 | # include <dir.h> |
---|
| 48 | # else |
---|
| 49 | # include <unistd.h> |
---|
| 50 | # endif |
---|
[2d3f65a] | 51 | #endif |
---|
[407084d] | 52 | |
---|
[647407d] | 53 | #ifndef MAXPATHLEN |
---|
| 54 | #define MAXPATHLEN 1024 |
---|
| 55 | #endif |
---|
| 56 | #endif |
---|
| 57 | |
---|
[bb90203] | 58 | /* For funcs which want to be immune from messing around with different |
---|
| 59 | * calling conventions */ |
---|
| 60 | #ifndef CDECL |
---|
| 61 | # define CDECL |
---|
| 62 | #endif |
---|
| 63 | |
---|
| 64 | /* Globals */ |
---|
| 65 | node *stnlist = NULL; |
---|
| 66 | settings *pcs; |
---|
| 67 | prefix *root; |
---|
| 68 | long cLegs, cStns; |
---|
| 69 | long cComponents; |
---|
[d1878c51] | 70 | bool fExportUsed = fFalse; |
---|
[bb90203] | 71 | |
---|
| 72 | FILE *fhErrStat = NULL; |
---|
[693388e] | 73 | img *pimg = NULL; |
---|
[bb90203] | 74 | #ifndef NO_PERCENTAGE |
---|
| 75 | bool fPercent = fFalse; |
---|
| 76 | #endif |
---|
[647407d] | 77 | bool fQuiet = fFalse; /* just show brief summary + errors */ |
---|
[25ab06b] | 78 | static bool fMute = fFalse; /* just show errors */ |
---|
[647407d] | 79 | bool fSuppress = fFalse; /* only output 3d(3dx) file */ |
---|
[bb9d869] | 80 | static bool f_warnings_are_errors = fFalse; /* turn warnings into errors */ |
---|
[647407d] | 81 | |
---|
| 82 | nosurveylink *nosurveyhead; |
---|
[bb90203] | 83 | |
---|
| 84 | real totadj, total, totplan, totvert; |
---|
| 85 | real min[3], max[3]; |
---|
| 86 | prefix *pfxHi[3], *pfxLo[3]; |
---|
| 87 | |
---|
| 88 | char *survey_title = NULL; |
---|
| 89 | int survey_title_len; |
---|
| 90 | |
---|
| 91 | bool fExplicitTitle = fFalse; |
---|
| 92 | |
---|
[8e8057c] | 93 | char *fnm_output_base = NULL; |
---|
| 94 | int fnm_output_base_is_dir = 0; |
---|
| 95 | |
---|
[06a871f] | 96 | static void do_stats(void); |
---|
[bb90203] | 97 | |
---|
| 98 | static const struct option long_opts[] = { |
---|
| 99 | /* const char *name; int has_arg (0 no_argument, 1 required_*, 2 optional_*); int *flag; int val; */ |
---|
| 100 | #ifdef NO_PERCENTAGE |
---|
| 101 | {"percentage", no_argument, 0, 0}, |
---|
| 102 | {"no-percentage", no_argument, 0, 0}, |
---|
| 103 | #else |
---|
| 104 | {"percentage", no_argument, 0, 'p'}, |
---|
| 105 | {"no-percentage", no_argument, (int*)&fPercent, 0}, |
---|
| 106 | #endif |
---|
[8e8057c] | 107 | {"output", required_argument, 0, 'o'}, |
---|
[647407d] | 108 | {"quiet", no_argument, 0, 'q'}, |
---|
| 109 | {"no-auxiliary-files", no_argument, 0, 's'}, |
---|
[bb9d869] | 110 | {"warnings-are-errors", no_argument, 0, 'w'}, |
---|
[647407d] | 111 | #ifdef NEW3DFORMAT |
---|
| 112 | {"new-format", no_argument, 0, 'x'}, |
---|
[5b68ae1] | 113 | #endif |
---|
[ce6ab688] | 114 | #if (OS==WIN32) |
---|
[5b68ae1] | 115 | {"pause", no_argument, 0, 256}, |
---|
[647407d] | 116 | #endif |
---|
[bb90203] | 117 | {"help", no_argument, 0, HLP_HELP}, |
---|
| 118 | {"version", no_argument, 0, HLP_VERSION}, |
---|
| 119 | {0, 0, 0, 0} |
---|
| 120 | }; |
---|
| 121 | |
---|
[647407d] | 122 | #ifdef NEW3DFORMAT |
---|
[bb9d869] | 123 | #define short_opts "pxao:qswz:" |
---|
[647407d] | 124 | #else |
---|
[bb9d869] | 125 | #define short_opts "pao:qswz:" |
---|
[647407d] | 126 | #endif |
---|
[bb90203] | 127 | |
---|
[647407d] | 128 | /* TRANSLATE extract help messages to message file */ |
---|
[bb90203] | 129 | static struct help_msg help[] = { |
---|
| 130 | /* <-- */ |
---|
| 131 | {HLP_ENCODELONG(0), "display percentage progress"}, |
---|
[8e8057c] | 132 | {HLP_ENCODELONG(2), "set location for output files"}, |
---|
[647407d] | 133 | {HLP_ENCODELONG(3), "only show brief summary (-qq for errors only)"}, |
---|
[c7c70fe] | 134 | {HLP_ENCODELONG(4), "do not create .inf or .err files"}, |
---|
[9085f95] | 135 | {HLP_ENCODELONG(5), "turn warnings into errors"}, |
---|
[647407d] | 136 | #ifdef NEW3DFORMAT |
---|
[9085f95] | 137 | {HLP_ENCODELONG(6), "output data in chasm's 3dx format"}, |
---|
[647407d] | 138 | #endif |
---|
[8e8057c] | 139 | /*{'z', "set optimizations for network reduction"},*/ |
---|
[bb90203] | 140 | {0, 0} |
---|
| 141 | }; |
---|
| 142 | |
---|
[5b68ae1] | 143 | /* atexit functions */ |
---|
[25ab06b] | 144 | static void |
---|
| 145 | delete_output_on_error(void) |
---|
| 146 | { |
---|
[bb9d869] | 147 | if (msg_errors || (f_warnings_are_errors && msg_warnings)) |
---|
| 148 | filename_delete_output(); |
---|
[25ab06b] | 149 | } |
---|
| 150 | |
---|
[5b68ae1] | 151 | #if (OS==WIN32) |
---|
| 152 | static void |
---|
| 153 | pause_on_exit(void) |
---|
| 154 | { |
---|
| 155 | while (_kbhit()) _getch(); |
---|
| 156 | _getch(); |
---|
| 157 | } |
---|
| 158 | #endif |
---|
| 159 | |
---|
[bb90203] | 160 | extern CDECL int |
---|
| 161 | main(int argc, char **argv) |
---|
| 162 | { |
---|
| 163 | int d; |
---|
| 164 | static clock_t tmCPUStart; |
---|
| 165 | static time_t tmUserStart; |
---|
| 166 | static double tmCPU, tmUser; |
---|
| 167 | |
---|
| 168 | tmUserStart = time(NULL); |
---|
| 169 | tmCPUStart = clock(); |
---|
| 170 | init_screen(); |
---|
| 171 | |
---|
[b85e20f] | 172 | msg_init(argv[0]); |
---|
[bb90203] | 173 | |
---|
| 174 | pcs = osnew(settings); |
---|
| 175 | pcs->next = NULL; |
---|
| 176 | pcs->Translate = ((short*) osmalloc(ossizeof(short) * 257)) + 1; |
---|
| 177 | |
---|
| 178 | /* Set up root of prefix hierarchy */ |
---|
| 179 | root = osnew(prefix); |
---|
| 180 | root->up = root->right = root->down = NULL; |
---|
| 181 | root->stn = NULL; |
---|
[6adb88c] | 182 | root->pos = NULL; |
---|
[85506af] | 183 | /* FIXME: shouldn't need to set this really, but need to check that nothing assumes the value of root->ident isn't "" */ |
---|
[bb90203] | 184 | root->ident = "\\"; |
---|
[932f7e9] | 185 | root->min_export = root->max_export = 0; |
---|
[95c3272] | 186 | root->sflags = BIT(SFLAGS_SURVEY); |
---|
[016068a] | 187 | root->filename = NULL; |
---|
[647407d] | 188 | |
---|
| 189 | nosurveyhead = NULL; |
---|
[bb90203] | 190 | |
---|
| 191 | stnlist = NULL; |
---|
| 192 | cLegs = cStns = cComponents = 0; |
---|
| 193 | totadj = total = totplan = totvert = 0.0; |
---|
| 194 | |
---|
| 195 | for (d = 0; d <= 2; d++) { |
---|
| 196 | min[d] = REAL_BIG; |
---|
| 197 | max[d] = -REAL_BIG; |
---|
| 198 | pfxHi[d] = pfxLo[d] = NULL; |
---|
| 199 | } |
---|
| 200 | |
---|
[d06141c] | 201 | /* at least one argument must be given */ |
---|
[b85e20f] | 202 | cmdline_init(argc, argv, short_opts, long_opts, NULL, help, 1, -1); |
---|
[bb90203] | 203 | while (1) { |
---|
[b85e20f] | 204 | int opt = cmdline_getopt(); |
---|
[bb90203] | 205 | if (opt == EOF) break; |
---|
| 206 | switch (opt) { |
---|
| 207 | case 'p': |
---|
| 208 | #ifndef NO_PERCENTAGE |
---|
| 209 | fPercent = 1; |
---|
| 210 | #endif |
---|
| 211 | break; |
---|
[8e8057c] | 212 | case 'o': { |
---|
| 213 | /* can be a directory (in which case use basename of leaf input) |
---|
| 214 | * or a file (in which case just trim the extension off) */ |
---|
| 215 | if (fDirectory(optarg)) { |
---|
| 216 | /* this is a little tricky - we need to note the path here, |
---|
| 217 | * and then add the leaf later on (in datain.c) */ |
---|
| 218 | fnm_output_base = base_from_fnm(optarg); |
---|
| 219 | fnm_output_base_is_dir = 1; |
---|
| 220 | } else { |
---|
| 221 | osfree(fnm_output_base); /* in case of multiple -o options */ |
---|
| 222 | fnm_output_base = base_from_fnm(optarg); |
---|
| 223 | } |
---|
| 224 | break; |
---|
| 225 | } |
---|
[647407d] | 226 | #ifdef NEW3DFORMAT |
---|
| 227 | case 'x': { |
---|
| 228 | fUseNewFormat = 1; |
---|
| 229 | break; |
---|
| 230 | } |
---|
| 231 | #endif |
---|
| 232 | case 'q': |
---|
| 233 | if (fQuiet) fMute = 1; |
---|
| 234 | fQuiet = 1; |
---|
| 235 | break; |
---|
| 236 | case 's': |
---|
| 237 | fSuppress = 1; |
---|
| 238 | break; |
---|
[bb9d869] | 239 | case 'w': |
---|
| 240 | f_warnings_are_errors = 1; |
---|
| 241 | break; |
---|
[8e8057c] | 242 | case 'z': { |
---|
| 243 | /* Control which network optimisations are used (development tool) */ |
---|
| 244 | static int first_opt_z = 1; |
---|
[eb18f4d] | 245 | char c; |
---|
[8e8057c] | 246 | if (first_opt_z) { |
---|
[bb90203] | 247 | optimize = 0; |
---|
[8e8057c] | 248 | first_opt_z = 0; |
---|
[bb90203] | 249 | } |
---|
[c50391b8] | 250 | /* Lollipops, Parallel legs, Iterate mx, Delta* */ |
---|
[eb18f4d] | 251 | while ((c = *optarg++) != '\0') |
---|
[8a9f2c2] | 252 | if (islower(c)) optimize |= BITA(c); |
---|
[bb90203] | 253 | break; |
---|
[5b68ae1] | 254 | #if (OS==WIN32) |
---|
| 255 | case 256: |
---|
| 256 | atexit(pause_on_exit); |
---|
| 257 | break; |
---|
| 258 | #endif |
---|
[bb90203] | 259 | } |
---|
| 260 | } |
---|
| 261 | } |
---|
| 262 | |
---|
[5b68ae1] | 263 | if (!fMute) puts(PACKAGE" "VERSION"\n"COPYRIGHT_MSG"\n"); |
---|
[bb90203] | 264 | |
---|
[25ab06b] | 265 | atexit(delete_output_on_error); |
---|
| 266 | |
---|
[bb90203] | 267 | /* end of options, now process data files */ |
---|
| 268 | while (argv[optind]) { |
---|
| 269 | const char *fnm = argv[optind]; |
---|
| 270 | |
---|
| 271 | if (!fExplicitTitle) { |
---|
| 272 | char *lf; |
---|
[8e8057c] | 273 | lf = baseleaf_from_fnm(fnm); |
---|
[bb90203] | 274 | if (survey_title) s_catchar(&survey_title, &survey_title_len, ' '); |
---|
| 275 | s_cat(&survey_title, &survey_title_len, lf); |
---|
| 276 | osfree(lf); |
---|
| 277 | } |
---|
| 278 | |
---|
| 279 | /* Select defaults settings */ |
---|
| 280 | default_all(pcs); |
---|
[647407d] | 281 | #ifdef NEW3DFORMAT |
---|
| 282 | /* we need to get the filename of the first one for our base_source */ |
---|
| 283 | /* and also run_file */ |
---|
| 284 | if (fUseNewFormat) { |
---|
| 285 | create_twig(root, fnm); |
---|
| 286 | rhizome = root->twig_link; |
---|
| 287 | limb = get_twig(root); |
---|
| 288 | firstfilename = osstrdup(fnm); |
---|
| 289 | startingdir = osmalloc(MAXPATHLEN); |
---|
[49090c02] | 290 | #if (OS==RISCOS) |
---|
| 291 | strcpy(startingdir, "@"); |
---|
| 292 | #else |
---|
[647407d] | 293 | getcwd(startingdir, MAXPATHLEN); |
---|
[49090c02] | 294 | #endif |
---|
[647407d] | 295 | } |
---|
| 296 | #endif |
---|
[bb90203] | 297 | data_file("", fnm); /* first argument is current path */ |
---|
[cb3d1e2] | 298 | |
---|
[bb90203] | 299 | optind++; |
---|
| 300 | } |
---|
[cb3d1e2] | 301 | |
---|
[bb90203] | 302 | validate(); |
---|
| 303 | |
---|
| 304 | solve_network(/*stnlist*/); /* Find coordinates of all points */ |
---|
| 305 | validate(); |
---|
[647407d] | 306 | |
---|
[bb90203] | 307 | #ifdef NEW3DFORMAT |
---|
[647407d] | 308 | if (fUseNewFormat) { |
---|
[693388e] | 309 | cave_close(pimg); /* this actually does all the writing */ |
---|
[647407d] | 310 | } else { |
---|
[bb90203] | 311 | #endif |
---|
[693388e] | 312 | img_close(pimg); /* close .3d file */ |
---|
[647407d] | 313 | #ifdef NEW3DFORMAT |
---|
| 314 | } |
---|
| 315 | #endif |
---|
| 316 | if (fhErrStat) fclose(fhErrStat); |
---|
[bb90203] | 317 | |
---|
| 318 | out_current_action(msg(/*Calculating statistics*/120)); |
---|
[06a871f] | 319 | do_stats(); |
---|
[647407d] | 320 | if (!fQuiet) { |
---|
[f03053a7] | 321 | /* clock() typically wraps after 72 minutes, but there doesn't seem |
---|
| 322 | * to be a better way. Still 72 minutes means some cave! |
---|
| 323 | */ |
---|
[647407d] | 324 | tmCPU = (clock_t)(clock() - tmCPUStart) / (double)CLOCKS_PER_SEC; |
---|
| 325 | tmUser = difftime(time(NULL), tmUserStart); |
---|
| 326 | |
---|
| 327 | /* tmCPU is integer, tmUser not - equivalent to (ceil(tmCPU) >= tmUser) */ |
---|
| 328 | if (tmCPU + 1 > tmUser) { |
---|
[5b68ae1] | 329 | printf(msg(/*CPU time used %5.2fs*/140), tmCPU); |
---|
[647407d] | 330 | } else if (tmCPU == 0) { |
---|
| 331 | if (tmUser == 0.0) { |
---|
[5b68ae1] | 332 | printf(msg(/*Time used %5.2fs*/141), tmUser); |
---|
[647407d] | 333 | } else { |
---|
[5b68ae1] | 334 | fputs(msg(/*Time used unavailable*/142), stdout); |
---|
[647407d] | 335 | } |
---|
[bb90203] | 336 | } else { |
---|
[5b68ae1] | 337 | printf(msg(/*Time used %5.2fs (%5.2fs CPU time)*/143), tmUser, tmCPU); |
---|
[bb90203] | 338 | } |
---|
[5b68ae1] | 339 | putnl(); |
---|
[bb90203] | 340 | |
---|
[5b68ae1] | 341 | puts(msg(/*Done.*/144)); |
---|
[647407d] | 342 | } |
---|
[25ab06b] | 343 | if (msg_warnings || msg_errors) { |
---|
| 344 | printf(msg(/*There were %d warning(s) and %d non-fatal error(s).*/16), |
---|
| 345 | msg_warnings, msg_errors); |
---|
| 346 | putnl(); |
---|
[bb9d869] | 347 | /* FIXME: if (msg_errors || (f_warnings_are_errors && msg_warnings)) print "output not produced..."? */ |
---|
[25ab06b] | 348 | } |
---|
[bb9d869] | 349 | if (msg_errors || (f_warnings_are_errors && msg_warnings)) |
---|
| 350 | return EXIT_FAILURE; |
---|
| 351 | return EXIT_SUCCESS; |
---|
[bb90203] | 352 | } |
---|
| 353 | |
---|
| 354 | static void |
---|
| 355 | do_range(FILE *fh, int d, int msg1, int msg2, int msg3) |
---|
| 356 | { |
---|
[5f662da] | 357 | if (!fMute) { |
---|
| 358 | printf(msg(msg1), max[d] - min[d]); |
---|
| 359 | fprint_prefix(stdout, pfxHi[d]); |
---|
| 360 | printf(msg(msg2), max[d]); |
---|
| 361 | fprint_prefix(stdout, pfxLo[d]); |
---|
| 362 | printf(msg(msg3), min[d]); |
---|
[0ec1606] | 363 | putnl(); |
---|
[5f662da] | 364 | } |
---|
| 365 | if (fh) { |
---|
| 366 | fprintf(fh, msg(msg1), max[d] - min[d]); |
---|
| 367 | fprint_prefix(fh, pfxHi[d]); |
---|
| 368 | fprintf(fh, msg(msg2), max[d]); |
---|
| 369 | fprint_prefix(fh, pfxLo[d]); |
---|
| 370 | fprintf(fh, msg(msg3), min[d]); |
---|
[0ec1606] | 371 | fputnl(fh); |
---|
[5f662da] | 372 | } |
---|
[bb90203] | 373 | } |
---|
| 374 | |
---|
| 375 | static void |
---|
[06a871f] | 376 | do_stats(void) |
---|
[bb90203] | 377 | { |
---|
[06a871f] | 378 | FILE *fh = NULL; |
---|
[bb90203] | 379 | long cLoops = cComponents + cLegs - cStns; |
---|
| 380 | |
---|
[06a871f] | 381 | if (!fSuppress && !(msg_errors || (f_warnings_are_errors && msg_warnings))) |
---|
| 382 | fh = safe_fopen_with_ext(fnm_output_base, EXT_SVX_STAT, "w"); |
---|
[977a053] | 383 | else |
---|
| 384 | if (fMute) return; |
---|
[bb90203] | 385 | |
---|
[5b68ae1] | 386 | if (!fMute) putnl(); |
---|
[bb90203] | 387 | |
---|
[a63fdd2a] | 388 | if (cStns == 1) { |
---|
| 389 | if (!fMute) |
---|
| 390 | fputs(msg(/*Survey contains 1 survey station,*/172), stdout); |
---|
| 391 | if (fh) |
---|
| 392 | fputs(msg(/*Survey contains 1 survey station,*/172), fh); |
---|
| 393 | } else { |
---|
| 394 | if (!fMute) |
---|
| 395 | printf(msg(/*Survey contains %ld survey stations,*/173), cStns); |
---|
| 396 | if (fh) |
---|
| 397 | fprintf(fh, msg(/*Survey contains %ld survey stations,*/173), cStns); |
---|
| 398 | } |
---|
[bb90203] | 399 | |
---|
[a63fdd2a] | 400 | if (cLegs == 1) { |
---|
| 401 | if (!fMute) |
---|
| 402 | fputs(msg(/* joined by 1 leg.*/174), stdout); |
---|
| 403 | if (fh) |
---|
| 404 | fputs(msg(/* joined by 1 leg.*/174), fh); |
---|
| 405 | } else { |
---|
| 406 | if (!fMute) |
---|
| 407 | printf(msg(/* joined by %ld legs.*/175), cLegs); |
---|
| 408 | if (fh) |
---|
| 409 | fprintf(fh, msg(/* joined by %ld legs.*/175), cLegs); |
---|
| 410 | } |
---|
[bb90203] | 411 | |
---|
[a63fdd2a] | 412 | if (!fMute) putnl(); |
---|
| 413 | if (fh) fputnl(fh); |
---|
[bb90203] | 414 | |
---|
[a63fdd2a] | 415 | if (cLoops == 1) { |
---|
| 416 | if (!fMute) |
---|
| 417 | fputs(msg(/*There is 1 loop.*/138), stdout); |
---|
| 418 | if (fh) |
---|
| 419 | fputs(msg(/*There is 1 loop.*/138), fh); |
---|
| 420 | } else { |
---|
| 421 | if (!fMute) |
---|
| 422 | printf(msg(/*There are %ld loops.*/139), cLoops); |
---|
| 423 | if (fh) |
---|
| 424 | fprintf(fh, msg(/*There are %ld loops.*/139), cLoops); |
---|
| 425 | } |
---|
[bb90203] | 426 | |
---|
[a63fdd2a] | 427 | if (!fMute) putnl(); |
---|
| 428 | if (fh) fputnl(fh); |
---|
[bb90203] | 429 | |
---|
| 430 | if (cComponents != 1) { |
---|
[a63fdd2a] | 431 | if (!fMute) { |
---|
| 432 | printf(msg(/*Survey has %ld connected components.*/178), cComponents); |
---|
| 433 | putnl(); |
---|
| 434 | } |
---|
| 435 | if (fh) { |
---|
| 436 | fprintf(fh, msg(/*Survey has %ld connected components.*/178), cComponents); |
---|
| 437 | fputnl(fh); |
---|
| 438 | } |
---|
[bb90203] | 439 | } |
---|
| 440 | |
---|
[a63fdd2a] | 441 | if (!fMute) { |
---|
| 442 | printf(msg(/*Total length of survey legs = %7.2fm (%7.2fm adjusted)*/132), |
---|
| 443 | total, totadj); |
---|
| 444 | putnl(); |
---|
| 445 | printf(msg(/*Total plan length of survey legs = %7.2fm*/133), |
---|
| 446 | totplan); |
---|
| 447 | putnl(); |
---|
| 448 | printf(msg(/*Total vertical length of survey legs = %7.2fm*/134), |
---|
| 449 | totvert); |
---|
| 450 | putnl(); |
---|
| 451 | } |
---|
| 452 | if (fh) { |
---|
| 453 | fprintf(fh, msg(/*Total length of survey legs = %7.2fm (%7.2fm adjusted)*/132), |
---|
| 454 | total, totadj); |
---|
| 455 | fputnl(fh); |
---|
| 456 | fprintf(fh, msg(/*Total plan length of survey legs = %7.2fm*/133), |
---|
| 457 | totplan); |
---|
| 458 | fputnl(fh); |
---|
| 459 | fprintf(fh, msg(/*Total vertical length of survey legs = %7.2fm*/134), |
---|
| 460 | totvert); |
---|
| 461 | fputnl(fh); |
---|
| 462 | } |
---|
[bb90203] | 463 | |
---|
| 464 | do_range(fh, 2, /*Vertical range = %4.2fm (from */135, |
---|
| 465 | /* at %4.2fm to */136, /* at %4.2fm)*/137); |
---|
| 466 | do_range(fh, 1, /*North-South range = %4.2fm (from */148, |
---|
| 467 | /* at %4.2fm to */196, /* at %4.2fm)*/197); |
---|
| 468 | do_range(fh, 0, /*East-West range = %4.2fm (from */149, |
---|
| 469 | /* at %4.2fm to */196, /* at %4.2fm)*/197); |
---|
| 470 | |
---|
| 471 | print_node_stats(fh); |
---|
| 472 | /* Also, could give: |
---|
| 473 | * # nodes stations (ie have other than two references or are fixed) |
---|
| 474 | * # fixed stations (list of?) |
---|
| 475 | */ |
---|
| 476 | |
---|
[407084d] | 477 | if (fh) fclose(fh); |
---|
[bb90203] | 478 | } |
---|