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

Comparing ray/src/util/rpiece.c (file contents):
Revision 2.37 by greg, Sat Feb 22 02:07:30 2003 UTC vs.
Revision 2.42 by greg, Mon Oct 20 16:01:55 2003 UTC

# Line 5 | Line 5 | static const char      RCSid[] = "$Id$";
5   * Generate sections of a picture.
6   */
7  
8 + #include "platform.h"
9   #include "standard.h"
10  
11   #ifndef F_SETLKW
# Line 20 | Line 21 | char *argv[];
21   #else
22  
23   #include <signal.h>
24 +
25   #include "color.h"
26   #include "view.h"
27 + #include "rtprocess.h"
28  
29   #ifndef NFS
30   #define  NFS                    1
# Line 49 | Line 52 | extern char  *strerror();
52                                  /* rpict command */
53   char  *rpargv[128] = {"rpict", "-S", "1"};
54   int  rpargc = 3;
52 int  rpd[3];
55   FILE  *torp, *fromrp;
56   COLR  *pbuf;
57                                  /* our view parameters */
# Line 72 | Line 74 | unsigned  timelim = 0;
74   int  rvrlim = -1;
75  
76   int  gotalrm = 0;
77 < int  onalrm() { gotalrm++; }
77 > void  onalrm(int i) { gotalrm++; }
78  
79  
80   main(argc, argv)
# Line 210 | Line 212 | char  **av;
212          char  *err;
213          FILE  *fp;
214          int  hr, vr;
215 +        SUBPROC  rpd; /* since we don't close_process(), this can be local */
216                                          /* set up view */
217          if ((err = setview(&ourview)) != NULL) {
218                  fprintf(stderr, "%s: %s\n", progname, err);
# Line 268 | Line 271 | char  **av;
271                  goto filerr;
272          dolock(outfd, F_UNLCK);
273                                          /* start rpict process */
274 <        if (open_process(rpd, rpargv) <= 0) {
274 >        if (open_process(&rpd, rpargv) <= 0) {
275                  fprintf(stderr, "%s: cannot start %s\n", progname, rpargv[0]);
276                  exit(1);
277          }
278 <        if ((fromrp = fdopen(rpd[0], "r")) == NULL ||
279 <                        (torp = fdopen(rpd[1], "w")) == NULL) {
278 >        if ((fromrp = fdopen(rpd.r, "r")) == NULL ||
279 >                        (torp = fdopen(rpd.w, "w")) == NULL) {
280                  fprintf(stderr, "%s: cannot open stream to %s\n",
281                                  progname, rpargv[0]);
282                  exit(1);
# Line 399 | Line 402 | rpiece()                       /* render picture piece by piece */
402          VIEW  pview;
403          int  xorg, yorg;
404                                          /* compute view parameters */
405 <        copystruct(&pview, &ourview);
405 >        pview = ourview;
406          switch (ourview.type) {
407          case VT_PER:
408                  pview.horiz = 2.*180./PI*atan(
# Line 450 | Line 453 | int  xpos, ypos;
453          int  hr, vr;
454          register int  y;
455                                  /* check bounds */
456 <        if (xpos < 0 | ypos < 0 | xpos >= hmult | ypos >= vmult) {
456 >        if ((xpos < 0) | (ypos < 0) | (xpos >= hmult) | (ypos >= vmult)) {
457                  fprintf(stderr, "%s: requested piece (%d,%d) out of range\n",
458                                  progname, xpos, ypos);
459                  exit(cleanup(1));
# Line 458 | Line 461 | int  xpos, ypos;
461                                  /* check header from rpict */
462          guard_io();
463          getheader(fromrp, NULL, NULL);
464 <        if (!fscnresolu(&hr, &vr, fromrp) || hr != hres | vr != vres) {
464 >        if (!fscnresolu(&hr, &vr, fromrp) || (hr != hres) | (vr != vres)) {
465                  fprintf(stderr, "%s: resolution mismatch from %s\n",
466                                  progname, rpargv[0]);
467                  exit(cleanup(1));
# Line 503 | Line 506 | int  xpos, ypos;
506                  filerr("lock");
507   #endif
508                                  /* write new piece to file */
509 <        if (lseek(outfd, (off_t)fls.l_start, 0) < 0)
509 >        if (lseek(outfd, (off_t)fls.l_start, SEEK_SET) < 0)
510                  filerr("seek");
511          if (hmult == 1) {
512                  if (writebuf(outfd, (char *)pbuf,
# Line 516 | Line 519 | int  xpos, ypos;
519                                  filerr("write");
520                          if (y < vr-1 && lseek(outfd,
521                                          (off_t)(hmult-1)*hr*sizeof(COLR),
522 <                                        1) < 0)
522 >                                        SEEK_CUR) < 0)
523                                  filerr("seek");
524                  }
525   #if NFS

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines