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

Comparing ray/src/util/rtcontrib.c (file contents):
Revision 1.32 by greg, Thu Oct 6 16:28:59 2005 UTC vs.
Revision 1.34 by greg, Tue Oct 11 04:27:41 2005 UTC

# Line 63 | Line 63 | static void
63   closestream(void *p)
64   {
65          STREAMOUT       *sop = (STREAMOUT *)p;
66 +        int             status;
67          if (sop->reclen == CNT_PIPE)
68 <                pclose(sop->ofp);
68 >                status = pclose(sop->ofp);
69          else
70 <                fclose(sop->ofp);
70 >                status = fclose(sop->ofp);
71 >        if (status)
72 >                error(SYSTEM, "error closing output stream");
73          free(p);
74   }
75  
# Line 699 | Line 702 | getostream(const char *ospec, const char *mname, int b
702                  sop = (STREAMOUT *)malloc(sizeof(STREAMOUT));
703                  if (sop == NULL)
704                          error(SYSTEM, "out of memory in getostream");
705 <                sop->reclen = oname[0] == '!' ? CNT_PIPE : 0;
705 >                sop->reclen = oname[0] == '!' ? CNT_PIPE : CNT_UNKNOWN;
706                  sop->ofp = NULL;                /* open iff noopen==0 */
707                  lep->data = (char *)sop;
708          }
709          if (!noopen && sop->ofp == NULL) {      /* open output stream */
710 <                int             i;
710 >                long            i;
711                  if (oname[0] == '!')            /* output to command */
712                          sop->ofp = popen(oname+1, "w");
713                  else
# Line 731 | Line 734 | getostream(const char *ospec, const char *mname, int b
734                  }
735                  printresolu(sop->ofp);
736                                                  /* play catch-up */
737 <                for (i = 0; i < lastdone; i++) {
737 >                for (i = sop->reclen > 1 ? sop->reclen*lastdone : lastdone;
738 >                                                                i--; ) {
739                          static const DCOLOR     nocontrib = BLKCOLOR;
740                          put_contrib(nocontrib, sop->ofp);
741                          if (outfmt == 'a')
# Line 1039 | Line 1043 | trace_contribs(FILE *fin)
1043                                                  /* loop over input */
1044          while ((iblen = getinp(inpbuf, fin)) > 0) {
1045                  if (lastray+1 < lastray ||      /* need reset? */
1046 <                                queue_length() > 5*nrtprocs()) {
1046 >                                queue_length() > 10*nrtprocs()) {
1047                          while (wait_rproc() != NULL)
1048                                  process_queue();
1049 <                        lastdone = lastray = 0;
1049 >                        if (lastray+1 < lastray)
1050 >                                lastdone = lastray = 0;
1051                  }
1052                  rtp = get_rproc();              /* get avail. rtrace process */
1053                  rtp->raynum = ++lastray;        /* assign ray to it */
# Line 1125 | Line 1130 | recover_output(FILE *fin)
1130                          if (oent->data != NULL) {
1131                                  sout = *(STREAMOUT *)oent->data;
1132                          } else {
1133 <                                sout.reclen = 0;
1133 >                                sout.reclen = CNT_UNKNOWN;
1134                                  sout.ofp = NULL;
1135                          }
1136                          if (sout.ofp != NULL) { /* already open? */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines