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

Comparing ray/src/rt/rtrace.c (file contents):
Revision 2.91 by greg, Sun Apr 5 15:47:02 2020 UTC vs.
Revision 2.92 by greg, Sun Apr 5 23:01:34 2020 UTC

# Line 68 | Line 68 | static oputf_t  oputo, oputd, oputv, oputV, oputl, opu
68                  oputr, oputR, oputx, oputX, oputn, oputN, oputs,
69                  oputw, oputW, oputm, oputM, oputtilde;
70  
71 static void setoutput(char *vs);
71   extern void tranotify(OBJECT obj);
72 + static void setoutput(char *vs);
73 + static int is_fifo(FILE *fp);
74   static void bogusray(void);
75   static void raycast(RAY *r);
76   static void rayirrad(RAY *r);
# Line 117 | Line 118 | formstr(                               /* return format identifier */
118   }
119  
120  
121 < extern void
121 > void
122   rtrace(                         /* trace rays from file */
123          char  *fname,
124          int  nproc
# Line 461 | Line 462 | printvals(                     /* print requested ray values */
462  
463  
464   static int
465 + is_fifo(                /* check if file pointer connected to pipe */
466 +        FILE *fp
467 + )
468 + {
469 + #ifdef S_ISFIFO
470 +        struct stat  sbuf;
471 +
472 +        if (fstat(fileno(fp), &sbuf) < 0)
473 +                error(SYSTEM, "fstat() failed on input stream");
474 +        return(S_ISFIFO(sbuf.st_mode));
475 + #else
476 +        return (fp == stdin);           /* just a guess, really */
477 + #endif
478 + }
479 +
480 +
481 + static int
482   getvec(                 /* get a vector from fp */
483          FVECT  vec,
484          int  fmt,
# Line 524 | Line 542 | nextray(               /* return next ray in work group (-1.0 if EO
542                  int     rsiz = 6*20;    /* conservative ascii ray size */
543                  if (inform == 'f') rsiz = 6*sizeof(float);
544                  else if (inform == 'd') rsiz = 6*sizeof(double);
545 <                if ((inpfp == stdin) & (qlength*rsiz > 512))    /* pipe limit */
545 >                                        /* check against pipe limit */
546 >                if (qlength*rsiz > 512 && is_fifo(inpfp))
547                          inp_queue = (FVECT *)malloc(sizeof(FVECT)*2*qlength);
548                  inp_qend = -(inp_queue == NULL);        /* flag for no queue */
549          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines