7 |
|
* 1/4/89 |
8 |
|
*/ |
9 |
|
|
10 |
– |
#include "standard.h" |
10 |
|
#include "platform.h" |
11 |
+ |
#include "rtprocess.h" |
12 |
+ |
#include "rterror.h" |
13 |
+ |
#include "rtmisc.h" |
14 |
|
#include "color.h" |
15 |
|
#include "calcomp.h" |
16 |
|
#include "view.h" |
34 |
|
|
35 |
|
char ourfmt[LPICFMT+1] = PICFMT; /* input picture format */ |
36 |
|
|
37 |
+ |
char StandardInput[] = "<stdin>"; |
38 |
|
char Command[] = "<Command>"; |
39 |
|
char vcolin[3][4] = {"ri", "gi", "bi"}; |
40 |
|
char vcolout[3][4] = {"ro", "go", "bo"}; |
72 |
|
int wrongformat = 0; |
73 |
|
int gotview; |
74 |
|
|
72 |
– |
FILE *popen(); |
75 |
|
|
76 |
< |
extern char *emalloc(); |
76 |
> |
static gethfunc tabputs; |
77 |
> |
static void checkfile(void); |
78 |
> |
static double rgb_bright(COLOR clr); |
79 |
> |
static double xyz_bright(COLOR clr); |
80 |
> |
static void init(void); |
81 |
> |
static void combine(void); |
82 |
> |
static void advance(void); |
83 |
> |
static double l_expos(char *nam); |
84 |
> |
static double l_pixaspect(char *nm); |
85 |
> |
static double l_colin(char *nam); |
86 |
> |
static double l_ray(char *nam); |
87 |
> |
static double l_psize(char *nm); |
88 |
|
|
89 |
|
|
90 |
< |
main(argc, argv) |
91 |
< |
int argc; |
92 |
< |
char *argv[]; |
90 |
> |
int |
91 |
> |
main( |
92 |
> |
int argc, |
93 |
> |
char *argv[] |
94 |
> |
) |
95 |
|
{ |
96 |
|
int original; |
97 |
|
double f; |
98 |
< |
int a, i; |
98 |
> |
int a; |
99 |
|
SET_DEFAULT_BINARY(); |
100 |
|
SET_FILE_BINARY(stdin); |
101 |
|
SET_FILE_BINARY(stdout); |
138 |
|
if (argv[a][0] == '-') |
139 |
|
switch (argv[a][1]) { |
140 |
|
case '\0': |
141 |
< |
input[nfiles].name = "<stdin>"; |
141 |
> |
input[nfiles].name = StandardInput; |
142 |
|
input[nfiles].fp = stdin; |
143 |
|
break; |
144 |
|
case 'o': |
231 |
|
eputs( |
232 |
|
" [-w][-x xr][-y yr][-e expr][-f file] [ [-o][-s f][-c r g b] pic ..]\n"); |
233 |
|
quit(1); |
234 |
+ |
return 1; /* pro forma return */ |
235 |
|
} |
236 |
|
|
237 |
|
|
238 |
< |
tabputs(s) /* put out string preceded by a tab */ |
239 |
< |
char *s; |
238 |
> |
static int |
239 |
> |
tabputs( /* put out string preceded by a tab */ |
240 |
> |
char *s, |
241 |
> |
void *p |
242 |
> |
) |
243 |
|
{ |
244 |
|
char fmt[32]; |
245 |
|
double d; |
271 |
|
} |
272 |
|
|
273 |
|
|
274 |
< |
checkfile() /* ready a file */ |
274 |
> |
static void |
275 |
> |
checkfile(void) /* ready a file */ |
276 |
|
{ |
277 |
|
register int i; |
278 |
|
/* process header */ |
311 |
|
} |
312 |
|
|
313 |
|
|
314 |
< |
double |
315 |
< |
rgb_bright(clr) |
316 |
< |
COLOR clr; |
314 |
> |
static double |
315 |
> |
rgb_bright( |
316 |
> |
COLOR clr |
317 |
> |
) |
318 |
|
{ |
319 |
|
return(bright(clr)); |
320 |
|
} |
321 |
|
|
322 |
|
|
323 |
< |
double |
324 |
< |
xyz_bright(clr) |
325 |
< |
COLOR clr; |
323 |
> |
static double |
324 |
> |
xyz_bright( |
325 |
> |
COLOR clr |
326 |
> |
) |
327 |
|
{ |
328 |
|
return(clr[CIEY]); |
329 |
|
} |
332 |
|
double (*ourbright)() = rgb_bright; |
333 |
|
|
334 |
|
|
335 |
< |
init() /* perform final setup */ |
335 |
> |
static void |
336 |
> |
init(void) /* perform final setup */ |
337 |
|
{ |
338 |
|
double l_colin(char *), l_expos(char *), l_pixaspect(char *), |
339 |
|
l_ray(char *), l_psize(char *); |
363 |
|
} |
364 |
|
|
365 |
|
|
366 |
< |
combine() /* combine pictures */ |
366 |
> |
static void |
367 |
> |
combine(void) /* combine pictures */ |
368 |
|
{ |
369 |
|
EPNODE *coldef[3], *brtdef; |
370 |
|
COLOR *scanout; |
422 |
|
} |
423 |
|
|
424 |
|
|
425 |
< |
advance() /* read in data for next scanline */ |
425 |
> |
static void |
426 |
> |
advance(void) /* read in data for next scanline */ |
427 |
|
{ |
428 |
|
int ytarget; |
429 |
|
register COLOR *st; |
451 |
|
} |
452 |
|
|
453 |
|
|
454 |
< |
double |
455 |
< |
l_expos(nam) /* return picture exposure */ |
456 |
< |
register char *nam; |
454 |
> |
static double |
455 |
> |
l_expos( /* return picture exposure */ |
456 |
> |
register char *nam |
457 |
> |
) |
458 |
|
{ |
459 |
|
register int fn, n; |
460 |
|
|
469 |
|
return(colval(input[fn].expos,n)); |
470 |
|
eputs("Bad call to l_expos()!\n"); |
471 |
|
quit(1); |
472 |
+ |
return 1; /* pro forma return */ |
473 |
|
} |
474 |
|
|
475 |
|
|
476 |
< |
double |
476 |
> |
static double |
477 |
|
l_pixaspect(char *nm) /* return pixel aspect ratio */ |
478 |
|
{ |
479 |
|
register int fn; |
485 |
|
} |
486 |
|
|
487 |
|
|
488 |
< |
double |
489 |
< |
l_colin(nam) /* return color value for picture */ |
490 |
< |
register char *nam; |
488 |
> |
static double |
489 |
> |
l_colin( /* return color value for picture */ |
490 |
> |
register char *nam |
491 |
> |
) |
492 |
|
{ |
493 |
|
int fn; |
494 |
|
register int n, xoff, yoff; |
537 |
|
return(colval(input[fn].scan[MIDSCN+yoff][xscan+xoff],n)); |
538 |
|
eputs("Bad call to l_colin()!\n"); |
539 |
|
quit(1); |
540 |
+ |
return 1; /* pro forma return */ |
541 |
|
} |
542 |
|
|
543 |
|
|
544 |
< |
double |
545 |
< |
l_ray(nam) /* return ray origin or direction */ |
546 |
< |
register char *nam; |
544 |
> |
static double |
545 |
> |
l_ray( /* return ray origin or direction */ |
546 |
> |
register char *nam |
547 |
> |
) |
548 |
|
{ |
549 |
|
static unsigned long ltick[MAXINP]; |
550 |
|
static FVECT lorg[MAXINP], ldir[MAXINP]; |
578 |
|
return(i < 3 ? lorg[fn][i] : ldir[fn][i-3]); |
579 |
|
eputs("Bad call to l_ray()!\n"); |
580 |
|
quit(1); |
581 |
+ |
return 1; /* pro forma return */ |
582 |
|
} |
583 |
|
|
584 |
|
|
585 |
< |
double |
585 |
> |
static double |
586 |
|
l_psize(char *nm) /* compute pixel size in steradians */ |
587 |
|
{ |
588 |
|
static unsigned long ltick[MAXINP]; |
628 |
|
} |
629 |
|
|
630 |
|
|
631 |
< |
void |
632 |
< |
wputs(msg) |
602 |
< |
char *msg; |
631 |
> |
extern void |
632 |
> |
wputs(char *msg) |
633 |
|
{ |
634 |
|
if (!nowarn) |
635 |
|
eputs(msg); |
636 |
|
} |
637 |
|
|
638 |
|
|
639 |
< |
void |
640 |
< |
eputs(msg) |
611 |
< |
char *msg; |
639 |
> |
extern void |
640 |
> |
eputs(char *msg) |
641 |
|
{ |
642 |
|
fputs(msg, stderr); |
643 |
|
} |
644 |
|
|
645 |
|
|
646 |
< |
void |
647 |
< |
quit(code) /* exit gracefully */ |
619 |
< |
int code; |
646 |
> |
extern void |
647 |
> |
quit(int code) /* exit gracefully */ |
648 |
|
{ |
649 |
|
register int i; |
650 |
|
/* close input files */ |