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

Comparing ray/src/hd/rhcopy.c (file contents):
Revision 3.37 by greg, Tue Dec 19 20:22:36 2023 UTC vs.
Revision 3.38 by greg, Tue Dec 19 20:49:05 2023 UTC

# Line 51 | Line 51 | typedef struct {
51   } RAYPAR;
52  
53   static int openholo(char *fname, int append);
54 < static void addray(RAYPAR *rp);
54 > static int addray(RAYPAR *rp);
55   static int readval(RREAL *v, int n, FILE *fp);
56   static void readrays(FILE *fp);
57   static int writeval(RREAL *v, int n, FILE *fp);
# Line 228 | Line 228 | openholo(              /* open existing holodeck file for i/o */
228          return(n);
229   }
230  
231 < void
231 > int
232   addray(         /* add a ray to our output holodeck */
233          RAYPAR *rp
234   )
# Line 241 | Line 241 | addray(                /* add a ray to our output holodeck */
241          double  d0, d1;
242          unsigned        dc;
243          RAYVAL  *rv;
244 +        int     nsects = 0;
245                                  /* check each output section */
246          for (sn = nholosects; sn--; ) {
247                  hp = hdlist[sn];
# Line 271 | Line 272 | addray(                /* add a ray to our output holodeck */
272                  rv->r[0][0] = rr[0][0]; rv->r[0][1] = rr[0][1];
273                  rv->r[1][0] = rr[1][0]; rv->r[1][1] = rr[1][1];
274                  copycolr(rv->v, rp->cv);
275 +                ++nsects;
276          }
277 +        return nsects;
278   }
279  
280   /* Read n-vector from file stream */
# Line 325 | Line 328 | readval(RREAL *v, int n, FILE *fp)
328   static void
329   readrays(FILE *fp)
330   {
331 +        unsigned long   nread=0, ngood=0;
332 +
333          if (iofmt != 'a')
334                  SET_FILE_BINARY(fp);
335   #ifdef getc_unlocked
# Line 379 | Line 384 | readrays(FILE *fp)
384                          if (!flags)     /* got nothing, so may be normal EOF */
385                                  return;
386                  }
387 +                ++nread;
388                  if (flags & (BAD_DIR|BAD_LEN))
389                          continue;       /* just a bad ray is all -- skip */
390                  if (!(flags & GOT_VAL))
# Line 396 | Line 402 | readrays(FILE *fp)
402                          } else
403                                  goto missingData;
404                  }
405 <                addray(&ryp);           /* add our ray to holodeck */
405 >                ngood += (addray(&ryp) > 0);    /* add our ray to holodeck */
406          }
407          return;
408   missingData:
409 <        sprintf(errmsg, "insufficient data or read error for -i%s", rspec);
409 >        sprintf(errmsg, "insufficient data or read error with -i%s after %lu rays read (%lu used)",
410 >                        rspec, nread, ngood);
411          error(USER, errmsg);
412   }
413  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines