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