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

Comparing ray/src/util/rcode_ident.c (file contents):
Revision 2.5 by greg, Wed Jul 24 00:17:22 2019 UTC vs.
Revision 2.8 by greg, Fri Jul 26 17:45:23 2019 UTC

# Line 73 | Line 73 | scan_ident(char ident[MAXIDLEN], FILE *fp)
73   static int
74   headline(char *s, void *p)
75   {
76 <        extern const char       FMTSTR[];
77 <
78 <        if (strstr(s, FMTSTR) == s)
76 >        if (isformat(s))
77                  return 0;
78  
79          fputs(s, stdout);
# Line 214 | Line 212 | memerr:
212   }
213  
214  
215 < /* print out table IDs */
215 > /* print out ID table */
216   void
217   print_IDs(IDMAP *idmp)
218   {
# Line 222 | Line 220 | print_IDs(IDMAP *idmp)
220  
221          printf("============ %d IDs ============\n", idmp->nids);
222  
223 <        for (i = 0; i < idmp->nids; i++)
224 <                puts(mapID(idmp, i));
225 <
223 >        for (i = 0; i < idmp->nids; i++) {
224 >                fputs(mapID(idmp, i), stdout);
225 >                putchar(sepc);
226 >        }
227 >        if (sepc != '\n')
228 >                fputc('\n', stdout);
229          puts("============= END =============");
230   }
231  
# Line 234 | Line 235 | int
235   decode_select(const char *fname, int hdrflags)
236   {
237          IDMAP   *idmp = idmap_ropen(fname, hdrflags);
238 <        int     x, y;
238 >        int     i, j;
239  
240          if (!idmp)
241                  return 0;
# Line 248 | Line 249 | decode_select(const char *fname, int hdrflags)
249                  idmap_close(idmp);
250                  return 0;
251          }
252 <        while (scanf("%d %d", &x, &y) == 2) {
253 <                x = idmap_seek(idmp, x, idmp->res.yr-1 - y);
254 <                if (!x) {
252 >        while (scanf("%d %d", &i, &j) == 2) {
253 >                i = idmap_seek(idmp, i, idmp->res.yr-1 - j);
254 >                if (!i) {
255                          fputs(progname, stderr);
256                          fputs(": warning - pixel index is off map\n", stderr);
257                          continue;
258                  }
259 <                if (x > 0)
260 <                        x = idmap_next_i(idmp);
261 <                if (x < 0) {
259 >                if (i > 0)
260 >                        i = idmap_next_i(idmp);
261 >                if (i < 0) {
262                          fputs(fname, stderr);
263                          fputs(": read/seek error in decode_select()\n", stderr);
264                          idmap_close(idmp);
265                          return 0;
266                  }
267                  if (numeric) {
268 <                        printf("%d", x);
268 >                        printf("%d", i);
269                  } else {
270 <                        const char      *id = mapID(idmp, x);
270 >                        const char      *id = mapID(idmp, i);
271                          if (!id) {
272                                  fputs(fname, stderr);
273                                  fputs(": bad ID index in file\n", stderr);
# Line 308 | Line 309 | decode_all(const char *fname, int hdrflags)
309                  print_IDs(idmp);
310  
311          for (n = idmp->res.xr*idmp->res.yr; n-- > 0; ) {
312 <                int     ndx = idmap_next_i(idmp);
312 >                const int       ndx = idmap_next_i(idmp);
313                  if (ndx < 0) {
314                          fputs(fname, stderr);
315                          fputs(": unexpected EOF\n", stderr);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines