| 1 | greg | 2.1 | #ifndef lint | 
| 2 | greg | 2.30 | static const char       RCSid[] = "$Id: rcmain.c,v 2.29 2023/02/25 16:17:11 greg Exp $"; | 
| 3 | greg | 2.1 | #endif | 
| 4 |  |  | /* | 
| 5 |  |  | *  rcmain.c - main for rtcontrib ray contribution tracer | 
| 6 |  |  | */ | 
| 7 |  |  |  | 
| 8 |  |  | #include "copyright.h" | 
| 9 |  |  |  | 
| 10 |  |  | #include <signal.h> | 
| 11 | greg | 2.10 | #include <time.h> | 
| 12 | greg | 2.1 | #include "rcontrib.h" | 
| 13 | greg | 2.6 | #include "random.h" | 
| 14 | greg | 2.1 | #include "source.h" | 
| 15 |  |  | #include "ambient.h" | 
| 16 | greg | 2.14 | #include "pmapray.h" | 
| 17 |  |  | #include "pmapcontrib.h" | 
| 18 | greg | 2.1 |  | 
| 19 |  |  | int     gargc;                          /* global argc */ | 
| 20 |  |  | char    **gargv;                        /* global argv */ | 
| 21 |  |  | char    *octname;                       /* global octree name */ | 
| 22 |  |  | char    *progname;                      /* global argv[0] */ | 
| 23 |  |  |  | 
| 24 |  |  | char    *sigerr[NSIG];                  /* signal error messages */ | 
| 25 |  |  |  | 
| 26 |  |  | int     nproc = 1;                      /* number of processes requested */ | 
| 27 |  |  | int     nchild = 0;                     /* number of children (-1 in child) */ | 
| 28 |  |  |  | 
| 29 |  |  | int     inpfmt = 'a';                   /* input format */ | 
| 30 |  |  | int     outfmt = 'a';                   /* output format */ | 
| 31 |  |  |  | 
| 32 |  |  | int     header = 1;                     /* output header? */ | 
| 33 |  |  | int     force_open = 0;                 /* truncate existing output? */ | 
| 34 |  |  | int     recover = 0;                    /* recover previous output? */ | 
| 35 |  |  | int     accumulate = 1;                 /* input rays per output record */ | 
| 36 |  |  | int     contrib = 0;                    /* computing contributions? */ | 
| 37 |  |  |  | 
| 38 |  |  | int     xres = 0;                       /* horizontal (scan) size */ | 
| 39 |  |  | int     yres = 0;                       /* vertical resolution */ | 
| 40 |  |  |  | 
| 41 |  |  | int     using_stdout = 0;               /* are we using stdout? */ | 
| 42 |  |  |  | 
| 43 |  |  | int     imm_irrad = 0;                  /* compute immediate irradiance? */ | 
| 44 |  |  | int     lim_dist = 0;                   /* limit distance? */ | 
| 45 |  |  |  | 
| 46 | greg | 2.19 | int     report_intvl = 0;               /* reporting interval (seconds) */ | 
| 47 |  |  |  | 
| 48 | greg | 2.20 | char    **modname = NULL;               /* ordered modifier name list */ | 
| 49 |  |  | int     nmods = 0;                      /* number of modifiers */ | 
| 50 |  |  | int     modasiz = 0;                    /* allocated modifier array size */ | 
| 51 | greg | 2.1 |  | 
| 52 | greg | 2.4 | void    (*addobjnotify[8])() = {ambnotify, NULL}; | 
| 53 |  |  |  | 
| 54 | greg | 2.18 | char    RCCONTEXT[] = "RC.";            /* our special evaluation context */ | 
| 55 | greg | 2.1 |  | 
| 56 | greg | 2.22 | #if defined(_WIN32) || defined(_WIN64) | 
| 57 | greg | 2.23 | #define RCONTRIB_FEATURES       "Accumulation\nSummation\nRecovery\n" \ | 
| 58 | greg | 2.22 | "ValueContribution\nImmediateIrradiance\n" \ | 
| 59 | greg | 2.24 | "ProgressReporting\nDistanceLimiting\n" \ | 
| 60 |  |  | "Outputs=V,W\n" | 
| 61 | greg | 2.22 | #else | 
| 62 |  |  | #define RCONTRIB_FEATURES       "Multiprocessing\n" \ | 
| 63 | greg | 2.23 | "Accumulation\nSummation\nRecovery\n" \ | 
| 64 | greg | 2.22 | "ValueContribution\nImmediateIrradiance\n" \ | 
| 65 | greg | 2.24 | "ProgressReporting\nDistanceLimiting\n" \ | 
| 66 |  |  | "Outputs=V,W\n" | 
| 67 | greg | 2.22 | #endif | 
| 68 | greg | 2.1 |  | 
| 69 |  |  | static void | 
| 70 |  |  | printdefaults(void)                     /* print default values to stdout */ | 
| 71 |  |  | { | 
| 72 | greg | 2.3 | printf("-c %-5d\t\t\t# accumulated rays per record\n", accumulate); | 
| 73 |  |  | printf("-V%c\t\t\t\t# output %s\n", contrib ? '+' : '-', | 
| 74 |  |  | contrib ? "contributions" : "coefficients"); | 
| 75 | greg | 2.1 | if (imm_irrad) | 
| 76 |  |  | printf("-I+\t\t\t\t# immediate irradiance on\n"); | 
| 77 |  |  | printf("-n %-2d\t\t\t\t# number of rendering processes\n", nproc); | 
| 78 |  |  | printf("-x %-9d\t\t\t# %s\n", xres, | 
| 79 |  |  | yres && xres ? "x resolution" : "flush interval"); | 
| 80 |  |  | printf("-y %-9d\t\t\t# y resolution\n", yres); | 
| 81 |  |  | printf(lim_dist ? "-ld+\t\t\t\t# limit distance on\n" : | 
| 82 |  |  | "-ld-\t\t\t\t# limit distance off\n"); | 
| 83 |  |  | printf("-h%c\t\t\t\t# %s header\n", header ? '+' : '-', | 
| 84 |  |  | header ? "output" : "no"); | 
| 85 |  |  | printf("-f%c%c\t\t\t\t# format input/output = %s/%s\n", | 
| 86 |  |  | inpfmt, outfmt, formstr(inpfmt), formstr(outfmt)); | 
| 87 |  |  | printf(erract[WARNING].pf != NULL ? | 
| 88 |  |  | "-w+\t\t\t\t# warning messages on\n" : | 
| 89 |  |  | "-w-\t\t\t\t# warning messages off\n"); | 
| 90 |  |  | print_rdefaults(); | 
| 91 |  |  | } | 
| 92 |  |  |  | 
| 93 |  |  |  | 
| 94 |  |  | static void | 
| 95 |  |  | onsig(                          /* fatal signal */ | 
| 96 |  |  | int  signo | 
| 97 |  |  | ) | 
| 98 |  |  | { | 
| 99 |  |  | static int  gotsig = 0; | 
| 100 |  |  |  | 
| 101 |  |  | if (gotsig++)                   /* two signals and we're gone! */ | 
| 102 |  |  | _exit(signo); | 
| 103 |  |  |  | 
| 104 |  |  | #ifdef SIGALRM | 
| 105 |  |  | alarm(15);                      /* allow 15 seconds to clean up */ | 
| 106 |  |  | signal(SIGALRM, SIG_DFL);       /* make certain we do die */ | 
| 107 |  |  | #endif | 
| 108 |  |  | eputs("signal - "); | 
| 109 |  |  | eputs(sigerr[signo]); | 
| 110 |  |  | eputs("\n"); | 
| 111 |  |  | quit(3); | 
| 112 |  |  | } | 
| 113 |  |  |  | 
| 114 |  |  |  | 
| 115 |  |  | static void | 
| 116 |  |  | sigdie(                 /* set fatal signal */ | 
| 117 |  |  | int  signo, | 
| 118 |  |  | char  *msg | 
| 119 |  |  | ) | 
| 120 |  |  | { | 
| 121 |  |  | if (signal(signo, onsig) == SIG_IGN) | 
| 122 |  |  | signal(signo, SIG_IGN); | 
| 123 |  |  | sigerr[signo] = msg; | 
| 124 |  |  | } | 
| 125 |  |  |  | 
| 126 |  |  |  | 
| 127 |  |  | /* set input/output format */ | 
| 128 |  |  | static void | 
| 129 |  |  | setformat(const char *fmt) | 
| 130 |  |  | { | 
| 131 |  |  | switch (fmt[0]) { | 
| 132 |  |  | case 'f': | 
| 133 |  |  | case 'd': | 
| 134 |  |  | SET_FILE_BINARY(stdin); | 
| 135 |  |  | /* fall through */ | 
| 136 |  |  | case 'a': | 
| 137 |  |  | inpfmt = fmt[0]; | 
| 138 |  |  | break; | 
| 139 |  |  | default: | 
| 140 |  |  | goto fmterr; | 
| 141 |  |  | } | 
| 142 |  |  | switch (fmt[1]) { | 
| 143 |  |  | case '\0': | 
| 144 |  |  | outfmt = inpfmt; | 
| 145 |  |  | return; | 
| 146 |  |  | case 'a': | 
| 147 |  |  | case 'f': | 
| 148 |  |  | case 'd': | 
| 149 |  |  | case 'c': | 
| 150 |  |  | outfmt = fmt[1]; | 
| 151 |  |  | break; | 
| 152 |  |  | default: | 
| 153 |  |  | goto fmterr; | 
| 154 |  |  | } | 
| 155 |  |  | if (!fmt[2]) | 
| 156 |  |  | return; | 
| 157 |  |  | fmterr: | 
| 158 |  |  | sprintf(errmsg, "Illegal i/o format: -f%s", fmt); | 
| 159 |  |  | error(USER, errmsg); | 
| 160 |  |  | } | 
| 161 |  |  |  | 
| 162 |  |  |  | 
| 163 |  |  | /* Set overriding options */ | 
| 164 |  |  | static void | 
| 165 |  |  | override_options(void) | 
| 166 |  |  | { | 
| 167 |  |  | shadthresh = 0; | 
| 168 |  |  | ambssamp = 0; | 
| 169 |  |  | ambacc = 0; | 
| 170 |  |  | if (accumulate <= 0)    /* no output flushing for single record */ | 
| 171 |  |  | xres = yres = 0; | 
| 172 |  |  | } | 
| 173 |  |  |  | 
| 174 |  |  |  | 
| 175 |  |  | int | 
| 176 |  |  | main(int argc, char *argv[]) | 
| 177 |  |  | { | 
| 178 |  |  | #define  check(ol,al)           if (argv[i][ol] || \ | 
| 179 |  |  | badarg(argc-i-1,argv+i+1,al)) \ | 
| 180 |  |  | goto badopt | 
| 181 | schorsch | 2.15 | #define  check_bool(olen,var)           switch (argv[i][olen]) { \ | 
| 182 | greg | 2.1 | case '\0': var = !var; break; \ | 
| 183 |  |  | case 'y': case 'Y': case 't': case 'T': \ | 
| 184 |  |  | case '+': case '1': var = 1; break; \ | 
| 185 |  |  | case 'n': case 'N': case 'f': case 'F': \ | 
| 186 |  |  | case '-': case '0': var = 0; break; \ | 
| 187 |  |  | default: goto badopt; } | 
| 188 |  |  | char    *curout = NULL; | 
| 189 | greg | 2.12 | char    *prms = NULL; | 
| 190 | greg | 2.1 | char    *binval = NULL; | 
| 191 |  |  | int     bincnt = 0; | 
| 192 |  |  | int     rval; | 
| 193 |  |  | int     i; | 
| 194 |  |  | /* global program name */ | 
| 195 |  |  | progname = argv[0] = fixargv0(argv[0]); | 
| 196 |  |  | gargv = argv; | 
| 197 |  |  | gargc = argc; | 
| 198 | greg | 2.22 | /* feature check only? */ | 
| 199 |  |  | strcat(RFeatureList, RCONTRIB_FEATURES); | 
| 200 | greg | 2.26 | if (argc > 1 && !strcmp(argv[1], "-features")) | 
| 201 | greg | 2.22 | return feature_status(argc-2, argv+2); | 
| 202 | greg | 2.28 | #if defined(_WIN32) || defined(_WIN64)  /* increase file limit to maximum */ | 
| 203 |  |  | for (i = 8192; i > _IOB_ENTRIES; i >>= 1) | 
| 204 | greg | 2.30 | if (_setmaxstdio(i) == i) | 
| 205 | greg | 2.28 | break; | 
| 206 | greg | 2.17 | #endif | 
| 207 | greg | 2.1 | /* initialize calcomp routines early */ | 
| 208 |  |  | initfunc(); | 
| 209 | greg | 2.21 | calcontext(RCCONTEXT); | 
| 210 | greg | 2.1 | /* option city */ | 
| 211 |  |  | for (i = 1; i < argc; i++) { | 
| 212 |  |  | /* expand arguments */ | 
| 213 |  |  | while ((rval = expandarg(&argc, &argv, i)) > 0) | 
| 214 |  |  | ; | 
| 215 |  |  | if (rval < 0) { | 
| 216 |  |  | sprintf(errmsg, "cannot expand '%s'", argv[i]); | 
| 217 |  |  | error(SYSTEM, errmsg); | 
| 218 |  |  | } | 
| 219 |  |  | if (argv[i] == NULL || argv[i][0] != '-') | 
| 220 |  |  | break;                  /* break from options */ | 
| 221 |  |  | if (!strcmp(argv[i], "-version")) { | 
| 222 |  |  | puts(VersionID); | 
| 223 |  |  | quit(0); | 
| 224 |  |  | } | 
| 225 |  |  | if (!strcmp(argv[i], "-defaults") || | 
| 226 |  |  | !strcmp(argv[i], "-help")) { | 
| 227 |  |  | override_options(); | 
| 228 |  |  | printdefaults(); | 
| 229 |  |  | quit(0); | 
| 230 |  |  | } | 
| 231 |  |  | rval = getrenderopt(argc-i, argv+i); | 
| 232 |  |  | if (rval >= 0) { | 
| 233 |  |  | i += rval; | 
| 234 |  |  | continue; | 
| 235 |  |  | } | 
| 236 |  |  | switch (argv[i][1]) { | 
| 237 |  |  | case 'n':                       /* number of cores */ | 
| 238 |  |  | check(2,"i"); | 
| 239 |  |  | nproc = atoi(argv[++i]); | 
| 240 |  |  | if (nproc <= 0) | 
| 241 |  |  | error(USER, "bad number of processes"); | 
| 242 |  |  | break; | 
| 243 |  |  | case 'V':                       /* output contributions */ | 
| 244 | schorsch | 2.15 | check_bool(2,contrib); | 
| 245 | greg | 2.1 | break; | 
| 246 |  |  | case 'x':                       /* x resolution */ | 
| 247 |  |  | check(2,"i"); | 
| 248 |  |  | xres = atoi(argv[++i]); | 
| 249 |  |  | break; | 
| 250 |  |  | case 'y':                       /* y resolution */ | 
| 251 |  |  | check(2,"i"); | 
| 252 |  |  | yres = atoi(argv[++i]); | 
| 253 |  |  | break; | 
| 254 |  |  | case 'w':                       /* warnings */ | 
| 255 | greg | 2.2 | rval = (erract[WARNING].pf != NULL); | 
| 256 | schorsch | 2.15 | check_bool(2,rval); | 
| 257 | greg | 2.1 | if (rval) erract[WARNING].pf = wputs; | 
| 258 |  |  | else erract[WARNING].pf = NULL; | 
| 259 |  |  | break; | 
| 260 |  |  | case 'e':                       /* expression */ | 
| 261 |  |  | check(2,"s"); | 
| 262 |  |  | scompile(argv[++i], NULL, 0); | 
| 263 |  |  | break; | 
| 264 |  |  | case 'l':                       /* limit distance */ | 
| 265 |  |  | if (argv[i][2] != 'd') | 
| 266 |  |  | goto badopt; | 
| 267 | schorsch | 2.15 | check_bool(3,lim_dist); | 
| 268 | greg | 2.1 | break; | 
| 269 |  |  | case 'I':                       /* immed. irradiance */ | 
| 270 | schorsch | 2.15 | check_bool(2,imm_irrad); | 
| 271 | greg | 2.1 | break; | 
| 272 |  |  | case 'f':                       /* file or force or format */ | 
| 273 |  |  | if (!argv[i][2]) { | 
| 274 |  |  | check(2,"s"); | 
| 275 |  |  | loadfunc(argv[++i]); | 
| 276 |  |  | break; | 
| 277 |  |  | } | 
| 278 |  |  | if (argv[i][2] == 'o') { | 
| 279 | schorsch | 2.15 | check_bool(3,force_open); | 
| 280 | greg | 2.1 | break; | 
| 281 |  |  | } | 
| 282 |  |  | setformat(argv[i]+2); | 
| 283 |  |  | break; | 
| 284 |  |  | case 'o':                       /* output */ | 
| 285 |  |  | check(2,"s"); | 
| 286 |  |  | curout = argv[++i]; | 
| 287 |  |  | break; | 
| 288 |  |  | case 'c':                       /* input rays per output */ | 
| 289 |  |  | check(2,"i"); | 
| 290 |  |  | accumulate = atoi(argv[++i]); | 
| 291 |  |  | break; | 
| 292 |  |  | case 'r':                       /* recover output */ | 
| 293 | schorsch | 2.15 | check_bool(2,recover); | 
| 294 | greg | 2.1 | break; | 
| 295 |  |  | case 'h':                       /* header output */ | 
| 296 | schorsch | 2.15 | check_bool(2,header); | 
| 297 | greg | 2.1 | break; | 
| 298 | greg | 2.12 | case 'p':                       /* parameter setting(s) */ | 
| 299 |  |  | check(2,"s"); | 
| 300 | greg | 2.13 | set_eparams(prms = argv[++i]); | 
| 301 | greg | 2.12 | break; | 
| 302 | greg | 2.1 | case 'b':                       /* bin expression/count */ | 
| 303 |  |  | if (argv[i][2] == 'n') { | 
| 304 |  |  | check(3,"s"); | 
| 305 |  |  | bincnt = (int)(eval(argv[++i]) + .5); | 
| 306 |  |  | break; | 
| 307 |  |  | } | 
| 308 |  |  | check(2,"s"); | 
| 309 |  |  | binval = argv[++i]; | 
| 310 |  |  | break; | 
| 311 |  |  | case 'm':                       /* modifier name */ | 
| 312 |  |  | check(2,"s"); | 
| 313 | greg | 2.12 | addmodifier(argv[++i], curout, prms, binval, bincnt); | 
| 314 | greg | 2.1 | break; | 
| 315 |  |  | case 'M':                       /* modifier file */ | 
| 316 |  |  | check(2,"s"); | 
| 317 | greg | 2.12 | addmodfile(argv[++i], curout, prms, binval, bincnt); | 
| 318 | greg | 2.1 | break; | 
| 319 | greg | 2.19 | case 't':                       /* reporting interval */ | 
| 320 |  |  | check(2,"i"); | 
| 321 |  |  | report_intvl = atoi(argv[++i]); | 
| 322 |  |  | break; | 
| 323 | greg | 2.1 | default: | 
| 324 |  |  | goto badopt; | 
| 325 |  |  | } | 
| 326 |  |  | } | 
| 327 | greg | 2.11 | if (nmods <= 0) | 
| 328 |  |  | error(USER, "missing required modifier argument"); | 
| 329 | greg | 2.1 | /* override some option settings */ | 
| 330 |  |  | override_options(); | 
| 331 |  |  | /* initialize object types */ | 
| 332 |  |  | initotypes(); | 
| 333 |  |  | /* initialize urand */ | 
| 334 |  |  | if (rand_samp) { | 
| 335 |  |  | srandom((long)time(0)); | 
| 336 |  |  | initurand(0); | 
| 337 |  |  | } else { | 
| 338 |  |  | srandom(0L); | 
| 339 |  |  | initurand(2048); | 
| 340 |  |  | } | 
| 341 |  |  | /* set up signal handling */ | 
| 342 |  |  | sigdie(SIGINT, "Interrupt"); | 
| 343 |  |  | #ifdef SIGHUP | 
| 344 |  |  | sigdie(SIGHUP, "Hangup"); | 
| 345 |  |  | #endif | 
| 346 |  |  | sigdie(SIGTERM, "Terminate"); | 
| 347 |  |  | #ifdef SIGPIPE | 
| 348 |  |  | sigdie(SIGPIPE, "Broken pipe"); | 
| 349 |  |  | #endif | 
| 350 |  |  | #ifdef SIGALRM | 
| 351 |  |  | sigdie(SIGALRM, "Alarm clock"); | 
| 352 |  |  | #endif | 
| 353 |  |  | #ifdef  SIGXCPU | 
| 354 |  |  | sigdie(SIGXCPU, "CPU limit exceeded"); | 
| 355 |  |  | sigdie(SIGXFSZ, "File size exceeded"); | 
| 356 |  |  | #endif | 
| 357 |  |  | #ifdef  NICE | 
| 358 |  |  | nice(NICE);                     /* lower priority */ | 
| 359 |  |  | #endif | 
| 360 |  |  | /* get octree */ | 
| 361 |  |  | if (i == argc) | 
| 362 |  |  | octname = NULL; | 
| 363 |  |  | else if (i == argc-1) | 
| 364 |  |  | octname = argv[i]; | 
| 365 |  |  | else | 
| 366 |  |  | goto badopt; | 
| 367 |  |  | if (octname == NULL) | 
| 368 |  |  | error(USER, "missing octree argument"); | 
| 369 |  |  |  | 
| 370 |  |  | readoct(octname, ~(IO_FILES|IO_INFO), &thescene, NULL); | 
| 371 |  |  | nsceneobjs = nobjects; | 
| 372 |  |  |  | 
| 373 | greg | 2.14 | /* PMAP: set up & load photon maps */ | 
| 374 |  |  | ray_init_pmap(); | 
| 375 |  |  |  | 
| 376 | greg | 2.1 | marksources();                  /* find and mark sources */ | 
| 377 | greg | 2.14 |  | 
| 378 |  |  | /* PMAP: init photon map for light source contributions */ | 
| 379 |  |  | initPmapContrib(&modconttab, nmods); | 
| 380 | greg | 2.1 |  | 
| 381 |  |  | setambient();                   /* initialize ambient calculation */ | 
| 382 | greg | 2.14 |  | 
| 383 | greg | 2.2 | rcontrib();                     /* trace ray contributions (loop) */ | 
| 384 | greg | 2.1 |  | 
| 385 |  |  | ambsync();                      /* flush ambient file */ | 
| 386 |  |  |  | 
| 387 | greg | 2.14 | /* PMAP: free photon maps */ | 
| 388 |  |  | ray_done_pmap(); | 
| 389 |  |  |  | 
| 390 | greg | 2.1 | quit(0);        /* exit clean */ | 
| 391 |  |  |  | 
| 392 |  |  | badopt: | 
| 393 |  |  | fprintf(stderr, | 
| 394 | greg | 2.16 | "Usage: %s [-n nprocs][-V][-c count][-r][-e expr][-f source][-o ospec][-p p1=V1,p2=V2][-b binv][-bn N] {-m mod | -M file} [rtrace options] octree\n", | 
| 395 | greg | 2.1 | progname); | 
| 396 |  |  | sprintf(errmsg, "command line error at '%s'", argv[i]); | 
| 397 |  |  | error(USER, errmsg); | 
| 398 |  |  | return(1);      /* pro forma return */ | 
| 399 |  |  |  | 
| 400 |  |  | #undef  check | 
| 401 | schorsch | 2.15 | #undef  check_bool | 
| 402 | greg | 2.1 | } | 
| 403 |  |  |  | 
| 404 |  |  |  | 
| 405 |  |  | void | 
| 406 |  |  | wputs(                          /* warning output function */ | 
| 407 | greg | 2.27 | const char      *s | 
| 408 | greg | 2.1 | ) | 
| 409 |  |  | { | 
| 410 |  |  | int  lasterrno = errno; | 
| 411 |  |  | eputs(s); | 
| 412 |  |  | errno = lasterrno; | 
| 413 |  |  | } | 
| 414 |  |  |  | 
| 415 |  |  |  | 
| 416 |  |  | void | 
| 417 |  |  | eputs(                          /* put string to stderr */ | 
| 418 | greg | 2.27 | const char  *s | 
| 419 | greg | 2.1 | ) | 
| 420 |  |  | { | 
| 421 |  |  | static int  midline = 0; | 
| 422 |  |  |  | 
| 423 |  |  | if (!*s) | 
| 424 |  |  | return; | 
| 425 |  |  | if (!midline++) { | 
| 426 |  |  | fputs(progname, stderr); | 
| 427 |  |  | fputs(": ", stderr); | 
| 428 |  |  | } | 
| 429 |  |  | fputs(s, stderr); | 
| 430 |  |  | if (s[strlen(s)-1] == '\n') { | 
| 431 |  |  | fflush(stderr); | 
| 432 |  |  | midline = 0; | 
| 433 |  |  | } | 
| 434 |  |  | } |