| 9 |
|
|
| 10 |
|
#include "platform.h" |
| 11 |
|
#include "standard.h" |
| 12 |
< |
#include "rtprocess.h" |
| 12 |
> |
#include "paths.h" |
| 13 |
|
#include "color.h" |
| 14 |
|
#include "calcomp.h" |
| 15 |
|
#include "view.h" |
| 16 |
|
|
| 17 |
< |
#define MAXINP 512 /* maximum number of input files */ |
| 18 |
< |
#define WINSIZ 64 /* scanline window size */ |
| 17 |
> |
#define MAXINP 1024 /* maximum number of input files */ |
| 18 |
> |
#define WINSIZ 127 /* scanline window size */ |
| 19 |
|
#define MIDSCN ((WINSIZ-1)/2+1) |
| 20 |
|
|
| 21 |
|
struct { |
| 31 |
|
|
| 32 |
|
int nfiles; /* number of input files */ |
| 33 |
|
|
| 34 |
+ |
VIEW commvw; /* common view parameters */ |
| 35 |
+ |
|
| 36 |
|
char ourfmt[LPICFMT+1] = PICFMT; /* input picture format */ |
| 37 |
|
|
| 38 |
|
char StandardInput[] = "<stdin>"; |
| 98 |
|
int original; |
| 99 |
|
double f; |
| 100 |
|
int a; |
| 101 |
+ |
|
| 102 |
|
SET_DEFAULT_BINARY(); |
| 103 |
|
SET_FILE_BINARY(stdin); |
| 104 |
|
SET_FILE_BINARY(stdout); |
| 105 |
|
progname = argv[0]; |
| 106 |
+ |
esupport |= E_VARIABLE|E_FUNCTION|E_RCONST; |
| 107 |
+ |
esupport &= ~(E_OUTCHAN|E_INCHAN); |
| 108 |
|
/* scan options */ |
| 109 |
|
for (a = 1; a < argc; a++) { |
| 110 |
|
if (argv[a][0] == '-') |
| 214 |
|
} |
| 215 |
|
break; |
| 216 |
|
} |
| 217 |
< |
/* set/get output resolution */ |
| 213 |
< |
if (!vardefined(vxres)) |
| 214 |
< |
varset(vxres, ':', (double)xmax); |
| 215 |
< |
if (!vardefined(vyres)) |
| 216 |
< |
varset(vyres, ':', (double)ymax); |
| 217 |
> |
/* get output resolution */ |
| 218 |
|
xres = varvalue(vxres) + .5; |
| 219 |
|
yres = varvalue(vyres) + .5; |
| 220 |
|
if (xres <= 0 || yres <= 0) { |
| 224 |
|
} |
| 225 |
|
/* complete header */ |
| 226 |
|
printargs(argc, argv, stdout); |
| 227 |
+ |
if (commvw.type) { |
| 228 |
+ |
fputs(VIEWSTR, stdout); |
| 229 |
+ |
fprintview(&commvw, stdout); |
| 230 |
+ |
fputc('\n', stdout); |
| 231 |
+ |
} |
| 232 |
|
if (strcmp(ourfmt, PICFMT)) |
| 233 |
|
fputformat(ourfmt, stdout); /* print format if known */ |
| 234 |
|
putchar('\n'); |
| 288 |
|
static void |
| 289 |
|
checkfile(void) /* ready a file */ |
| 290 |
|
{ |
| 291 |
< |
register int i; |
| 291 |
> |
int i; |
| 292 |
|
/* process header */ |
| 293 |
|
gotview = 0; |
| 294 |
|
if (echoheader) { |
| 307 |
|
} |
| 308 |
|
if (!gotview || setview(&input[nfiles].vw) != NULL) |
| 309 |
|
input[nfiles].vw.type = 0; |
| 310 |
+ |
else if (!commvw.type) |
| 311 |
+ |
commvw = input[nfiles].vw; |
| 312 |
|
if (!fgetsresolu(&input[nfiles].rs, input[nfiles].fp)) { |
| 313 |
|
eputs(input[nfiles].name); |
| 314 |
|
eputs(": bad picture size\n"); |
| 353 |
|
static void |
| 354 |
|
init(void) /* perform final setup */ |
| 355 |
|
{ |
| 356 |
< |
register int i; |
| 356 |
> |
int i; |
| 357 |
|
/* define constants */ |
| 358 |
|
varset("PI", ':', PI); |
| 359 |
|
varset(vnfiles, ':', (double)nfiles); |
| 376 |
|
ourbright = xyz_bright; |
| 377 |
|
} else |
| 378 |
|
varset(vwhteff, ':', WHTEFFICACY); |
| 379 |
+ |
/* these may be overridden */ |
| 380 |
+ |
varset(vxres, ':', (double)xmax); |
| 381 |
+ |
varset(vyres, ':', (double)ymax); |
| 382 |
|
} |
| 383 |
|
|
| 384 |
|
|
| 388 |
|
EPNODE *coldef[3], *brtdef; |
| 389 |
|
COLOR *scanout; |
| 390 |
|
double d; |
| 391 |
< |
register int i, j; |
| 391 |
> |
int i, j; |
| 392 |
|
/* check defined variables */ |
| 393 |
|
for (j = 0; j < 3; j++) { |
| 394 |
|
if (vardefined(vcolout[j])) |
| 445 |
|
advance(void) /* read in data for next scanline */ |
| 446 |
|
{ |
| 447 |
|
int ytarget; |
| 448 |
< |
register COLOR *st; |
| 449 |
< |
register int i, j; |
| 448 |
> |
COLOR *st; |
| 449 |
> |
int i, j; |
| 450 |
|
|
| 451 |
|
for (ytarget = (ypos+.5)*ymax/yres; yscan > ytarget; yscan--) |
| 452 |
|
for (i = 0; i < nfiles; i++) { |
| 515 |
|
|
| 516 |
|
static double |
| 517 |
|
l_colin( /* return color value for picture */ |
| 518 |
< |
register char *nam |
| 518 |
> |
char *nam |
| 519 |
|
) |
| 520 |
|
{ |
| 521 |
|
int fn; |
| 522 |
< |
register int n, xoff, yoff; |
| 522 |
> |
int n, xoff, yoff; |
| 523 |
|
double d; |
| 524 |
|
|
| 525 |
|
d = argument(1); |
| 574 |
|
|
| 575 |
|
static double |
| 576 |
|
l_ray( /* return ray origin or direction */ |
| 577 |
< |
register char *nam |
| 577 |
> |
char *nam |
| 578 |
|
) |
| 579 |
|
{ |
| 580 |
|
static unsigned long ltick[MAXINP]; |
| 583 |
|
RREAL loc[2]; |
| 584 |
|
double d; |
| 585 |
|
int fn; |
| 586 |
< |
register int i; |
| 586 |
> |
int i; |
| 587 |
|
|
| 588 |
|
d = argument(1); |
| 589 |
|
if (d <= -0.5 || d >= nfiles+0.5) { |
| 626 |
|
RREAL locx[2], locy[2]; |
| 627 |
|
double d; |
| 628 |
|
int fn; |
| 629 |
< |
register int i; |
| 629 |
> |
int i; |
| 630 |
|
|
| 631 |
|
d = argument(1); |
| 632 |
|
if (d <= -0.5 || d >= nfiles+0.5) { |
| 683 |
|
extern void |
| 684 |
|
quit(int code) /* exit gracefully */ |
| 685 |
|
{ |
| 686 |
< |
register int i; |
| 686 |
> |
int i; |
| 687 |
|
/* close input files */ |
| 688 |
|
for (i = 0; i < nfiles; i++) |
| 689 |
|
if (input[i].name == Command) |