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

Comparing ray/src/px/pvalue.c (file contents):
Revision 2.2 by greg, Thu Dec 19 14:52:04 1991 UTC vs.
Revision 2.3 by greg, Fri May 8 10:58:52 1992 UTC

# Line 33 | Line 33 | int  reverse = 0;              /* reverse conversion? */
33   int  format = 'a';              /* input/output format */
34   char  *fmtid = "ascii";         /* format identifier for header */
35  
36 < int  header = 1;                /* do header */
36 > int  header = 1;                /* do header? */
37  
38 + int  resolution = 1;            /* put/get resolution string? */
39 +
40   int  wrongformat = 0;           /* wrong input format? */
41  
42   double  gamcor = 1.0;           /* gamma correction */
# Line 63 | Line 65 | char  **argv;
65                          case 'h':               /* header */
66                                  header = argv[i][0] == '+';
67                                  break;
68 +                        case 'H':               /* resolution string */
69 +                                resolution = argv[i][0] == '+';
70 +                                break;
71                          case 'u':               /* unique values */
72                                  uniq = argv[i][0] == '-';
73                                  break;
# Line 112 | Line 117 | char  **argv;
117                                  }
118                                  break;
119                          case 'x':               /* x resolution */
120 +                                resolution = 0;
121                                  if (argv[i][0] == '-')
122                                          picres.or |= XDECR;
123                                  picres.xr = atoi(argv[++i]);
124                                  break;
125                          case 'y':               /* y resolution */
126 +                                resolution = 0;
127                                  if (argv[i][0] == '-')
128                                          picres.or |= YDECR;
129                                  if (picres.xr == 0)
# Line 160 | Line 167 | unkopt:
167                          fprintf(stderr, "%s: wrong input format\n", progname);
168                          quit(1);
169                  }
170 <                if (picres.xr <= 0 || picres.yr <= 0)   /* get resolution */
171 <                        if (!fgetsresolu(&picres, fin)) {
172 <                                fprintf(stderr, "%s: missing resolution\n",
173 <                                                progname);
174 <                                quit(1);
175 <                        }
170 >                                        /* get resolution */
171 >                if ((resolution && !fgetsresolu(&picres, fin)) ||
172 >                                picres.xr <= 0 || picres.yr <= 0) {
173 >                        fprintf(stderr, "%s: missing resolution\n", progname);
174 >                        quit(1);
175 >                }
176                                                  /* add to header */
177                  printargs(i, argv, stdout);
178                  fputformat(COLRFMT, stdout);
179                  putchar('\n');
180 <                fputsresolu(&picres, stdout);
180 >                fputsresolu(&picres, stdout);   /* always put resolution */
181                  valtopix();
182          } else {
183                                                  /* get header */
# Line 180 | Line 187 | unkopt:
187                                          progname);
188                          quit(1);
189                  }
190 <
191 <                if (picres.xr <= 0 || picres.yr <= 0)   /* get picture size */
192 <                        if (!fgetsresolu(&picres, fin)) {
193 <                                fprintf(stderr, "%s: missing resolution\n",
187 <                                                progname);
188 <                                quit(1);
189 <                        }
190 >                if (!fgetsresolu(&picres, fin)) {
191 >                        fprintf(stderr, "%s: missing resolution\n", progname);
192 >                        quit(1);
193 >                }
194                  if (header) {
195                          printargs(i, argv, stdout);
196                          fputformat(fmtid, stdout);
197                          putchar('\n');
198                  }
199 +                if (resolution)                 /* put resolution */
200 +                        fputsresolu(&picres, stdout);
201                  pixtoval();
202          }
203  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines