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