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

Comparing ray/src/px/pcompos.c (file contents):
Revision 2.38 by greg, Fri Jul 19 17:37:56 2019 UTC vs.
Revision 2.42 by greg, Sat Jun 7 05:09:46 2025 UTC

# Line 13 | Line 13 | static const char      RCSid[] = "$Id$";
13  
14   #include  "rtio.h"
15   #include  "platform.h"
16 #include  "paths.h"
16   #include  "rterror.h"
17   #include  "color.h"
18   #include  "resolu.h"
# Line 47 | Line 46 | char  StandardInput[] = "<stdin>";
46   char  Command[] = "<Command>";
47   char  Label[] = "<Label>";
48  
50 char  *progname;
51
49   struct {
50          char  *name;                    /* file or command name */
51          FILE  *fp;                      /* stream pointer */
# Line 61 | Line 58 | struct {
58   int  nfile;                     /* number of files */
59  
60   int  echoheader = 1;
61 < char  ourfmt[LPICFMT+1] = PICFMT;
61 > char  ourfmt[MAXFMTLEN] = PICFMT;
62   int  wrongformat = 0;
63 + double  common_expos = 1.;
64  
65 + double  this_expos;
66  
67   static gethfunc headline;
68   static void compos(void);
# Line 82 | Line 81 | headline(                      /* print line preceded by a tab */
81  
82          if (isheadid(s))
83                  return(0);
84 +        if (isexpos(s))
85 +                this_expos *= exposval(s);
86          if (formatval(fmt, s)) {
87                  if (globmatch(ourfmt, fmt)) {
88                          wrongformat = 0;
# Line 108 | Line 109 | main(
109          int  xsgn, ysgn;
110          char  *thislabel;
111          int  an;
112 +
113          SET_DEFAULT_BINARY();
114          SET_FILE_BINARY(stdin);
115          SET_FILE_BINARY(stdout);
114        progname = argv[0];
116  
117 +        fixargv0(argv[0]);              /* sets global progname */
118 +
119          for (an = 1; an < argc && argv[an][0] == '-'; an++)
120                  switch (argv[an][1]) {
121                  case 'h':
# Line 233 | Line 236 | getfile:
236                                                  /* get header */
237                  if (echoheader)
238                          printf("%s:\n", input[nfile].name);
239 +                this_expos = 1;
240                  getheader(input[nfile].fp, headline, NULL);
241 +                if (!nfile)
242 +                        common_expos = this_expos;
243 +                else if (common_expos > 0 &&
244 +                                fabs(this_expos/common_expos - 1.) > 0.02)
245 +                        common_expos = 0;
246                  if (wrongformat) {
247                          fprintf(stderr, "%s: incompatible input format\n",
248                                          input[nfile].name);
# Line 307 | Line 316 | getfile:
316          }
317                                          /* add new header info. */
318          printargs(argc, argv, stdout);
319 +        if (common_expos > 0)           /* print exposure if shared */
320 +                fputexpos(common_expos, stdout);
321          if (strcmp(ourfmt, PICFMT))
322                  fputformat(ourfmt, stdout);     /* print format if known */
323          putchar('\n');

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines