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

Comparing ray/src/rt/rc2.c (file contents):
Revision 2.5 by greg, Tue Jun 19 00:12:08 2012 UTC vs.
Revision 2.9 by greg, Thu May 29 04:56:43 2014 UTC

# Line 8 | Line 8 | static const char RCSid[] = "$Id$";
8  
9   #include "rcontrib.h"
10   #include "resolu.h"
11 < #include "platform.h"
11 > #include <ctype.h>
12  
13   /* Close output stream and free record */
14   static void
# Line 112 | Line 112 | printheader(FILE *fout, const char *info)
112          printargs(gargc-1, gargv, fout);        /* add our command */
113          fprintf(fout, "SOFTWARE= %s\n", VersionID);
114          fputnow(fout);
115 +        fputs("NCOMP=3\n", fout);               /* always RGB */
116          if (info != NULL)                       /* add extra info if given */
117                  fputs(info, fout);
118          fputformat(formstr(outfmt), fout);
# Line 132 | Line 133 | printresolu(FILE *fout, int xr, int yr)
133   STREAMOUT *
134   getostream(const char *ospec, const char *mname, int bn, int noopen)
135   {
135        /* static const DCOLOR  nocontrib = BLKCOLOR; */
136          static STREAMOUT        stdos;
137 +        char                    info[1024];
138          int                     ofl;
139          char                    oname[1024];
140          LUENT                   *lep;
# Line 143 | Line 144 | getostream(const char *ospec, const char *mname, int b
144                  if (!noopen & !using_stdout) {
145                          if (outfmt != 'a')
146                                  SET_FILE_BINARY(stdout);
147 <                        if (header)
148 <                                printheader(stdout, NULL);
147 >                        if (header) {
148 >                                sprintf(info, "NCOLS=%d\n", stdos.reclen);
149 >                                printheader(stdout, info);
150 >                        }
151                          printresolu(stdout, xres, yres);
152                          if (waitflush > 0)
153                                  fflush(stdout);
# Line 183 | Line 186 | getostream(const char *ospec, const char *mname, int b
186                  }
187          }
188          if (!noopen && sop->ofp == NULL) {      /* open output stream */
186                long            i;
189                  if (oname[0] == '!')            /* output to command */
190                          sop->ofp = popen(oname+1, "w");
191                  else                            /* else open file */
# Line 196 | Line 198 | getostream(const char *ospec, const char *mname, int b
198                  flockfile(sop->ofp);            /* avoid lock/unlock overhead */
199   #endif
200                  if (header) {
199                        char    info[512];
201                          char    *cp = info;
202                          if (ofl & OF_MODIFIER || sop->reclen == 1) {
203                                  sprintf(cp, "MODIFIER=%s\n", mname);
# Line 206 | Line 207 | getostream(const char *ospec, const char *mname, int b
207                                  sprintf(cp, "BIN=%d\n", bn);
208                                  while (*cp) ++cp;
209                          }
210 <                        *cp = '\0';
210 >                        sprintf(cp, "NCOLS=%d\n", sop->reclen);
211                          printheader(sop->ofp, info);
212                  }
213                  if (accumulate > 0) {           /* global resolution */
214                          sop->xr = xres; sop->yr = yres;
215                  }
216                  printresolu(sop->ofp, sop->xr, sop->yr);
216 #if 0
217                                                /* play catch-up */
218                for (i = accumulate > 0 ? lastdone/accumulate : 0; i--; ) {
219                        int     j = sop->reclen;
220                        if (j <= 0) j = 1;
221                        while (j--)
222                                put_contrib(nocontrib, sop->ofp);
223                        if (outfmt == 'a')
224                                putc('\n', sop->ofp);
225                }
226 #endif
217                  if (waitflush > 0)
218                          fflush(sop->ofp);
219          }
# Line 364 | Line 354 | void
354   end_record()
355   {
356          --waitflush;
357 <        lu_doall(&ofiletab, puteol, NULL);
357 >        lu_doall(&ofiletab, &puteol, NULL);
358          if (using_stdout & (outfmt == 'a'))
359                  putc('\n', stdout);
360          if (!waitflush) {
# Line 514 | Line 504 | reload_output()
504                          *(STREAMOUT *)oent->data = sout;
505                  }
506          }
507 <        lu_doall(&ofiletab, myclose, NULL);     /* close all files */
507 >        lu_doall(&ofiletab, &myclose, NULL);    /* close all files */
508   }
509  
510  
# Line 670 | Line 660 | recover_output()
660          }
661                                                  /* seek on all files */
662          nvals = lastout * outvsiz;
663 <        lu_doall(&ofiletab, myseeko, &nvals);
663 >        lu_doall(&ofiletab, &myseeko, &nvals);
664                                                  /* skip repeated input */
665          lastout *= accumulate;
666          for (nvals = 0; nvals < lastout; nvals++) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines