ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/pcomb.c
(Generate patch)

Comparing ray/src/px/pcomb.c (file contents):
Revision 2.24 by schorsch, Sun Jun 8 12:03:10 2003 UTC vs.
Revision 2.32 by schorsch, Sun Mar 28 20:33:14 2004 UTC

# Line 7 | Line 7 | static const char      RCSid[] = "$Id$";
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"
# Line 32 | Line 34 | int    nfiles;                         /* number of input files */
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"};
# Line 69 | Line 72 | char   *progname;                      /* global argv[0] */
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);
# Line 109 | Line 124 | char   *argv[];
124          for (nfiles = 0; nfiles < MAXINP; nfiles++) {
125                  setcolor(input[nfiles].coef, 1.0, 1.0, 1.0);
126                  setcolor(input[nfiles].expos, 1.0, 1.0, 1.0);
127 <                copystruct(&input[nfiles].vw, &stdview);
127 >                input[nfiles].vw = stdview;
128                  input[nfiles].pa = 1.0;
129          }
130          nfiles = 0;
# Line 123 | Line 138 | char   *argv[];
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':
# Line 216 | Line 231 | usage:
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;
# Line 252 | Line 271 | char   *s;
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 */
# Line 291 | Line 311 | checkfile()                    /* ready a file */
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   }
# Line 310 | Line 332 | COLOR  clr;
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(), l_expos(), l_pixaspect(), l_ray(), l_psize();
338 >        double  l_colin(char *), l_expos(char *), l_pixaspect(char *),
339 >                        l_ray(char *), l_psize(char *);
340          register int    i;
341                                                  /* define constants */
342          varset("PI", ':', PI);
# Line 339 | Line 363 | init()                                 /* perform final setup */
363   }
364  
365  
366 < combine()                       /* combine pictures */
366 > static void
367 > combine(void)                   /* combine pictures */
368   {
369          EPNODE  *coldef[3], *brtdef;
370          COLOR   *scanout;
# Line 397 | Line 422 | combine()                      /* combine pictures */
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;
# Line 425 | Line 451 | advance()                      /* read in data for next scanline */
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  
# Line 442 | Line 469 | register char  *nam;
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
477 < l_pixaspect()                   /* return pixel aspect ratio */
476 > static double
477 > l_pixaspect(char *nm)           /* return pixel aspect ratio */
478   {
479          register int    fn;
480  
# Line 457 | Line 485 | l_pixaspect()                  /* return pixel aspect ratio */
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;
# Line 508 | Line 537 | register char  *nam;
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];
551          static double   ldist[MAXINP];
552 <        FLOAT   loc[2];
552 >        RREAL   loc[2];
553          int     fn;
554          register int    i;
555  
# Line 547 | Line 578 | register char  *nam;
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
586 < l_psize()                       /* compute pixel size in steradians */
585 > static double
586 > l_psize(char *nm)               /* compute pixel size in steradians */
587   {
588          static unsigned long    ltick[MAXINP];
589          static double   psize[MAXINP];
590          FVECT   dir0, org, dirx, diry;
591 <        FLOAT   locx[2], locy[2];
591 >        RREAL   locx[2], locy[2];
592          double  d;
593          int     fn;
594          register int    i;
# Line 596 | Line 628 | l_psize()                      /* compute pixel size in steradians */
628   }
629  
630  
631 < void
632 < wputs(msg)
601 < char    *msg;
631 > extern void
632 > wputs(char      *msg)
633   {
634          if (!nowarn)
635                  eputs(msg);
636   }
637  
638  
639 < void
640 < eputs(msg)
610 < char    *msg;
639 > extern void
640 > eputs(char *msg)
641   {
642          fputs(msg, stderr);
643   }
644  
645  
646 < void
647 < quit(code)              /* exit gracefully */
618 < int  code;
646 > extern void
647 > quit(int code)          /* exit gracefully */
648   {
649          register int  i;
650                                  /* close input files */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines