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

Comparing ray/src/px/pinterp.c (file contents):
Revision 2.9 by greg, Fri Oct 2 16:24:22 1992 UTC vs.
Revision 2.10 by greg, Thu Apr 1 11:21:18 1993 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1991 Regents of the University of California */
1 > /* Copyright (c) 1993 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 20 | Line 20 | static char SCCSid[] = "$SunId$ LBL";
20  
21   #include "resolu.h"
22  
23 #ifndef BSD
24 #define vfork           fork
25 #endif
26
23   #define pscan(y)        (ourpict+(y)*hresolu)
24   #define zscan(y)        (ourzbuf+(y)*hresolu)
25  
# Line 169 | Line 165 | char   *argv[];
165                                  goto badopt;
166                          check(3,"s");
167                          gotvfile = viewfile(argv[++i], &ourview, 0, 0);
168 <                        if (gotvfile < 0) {
169 <                                perror(argv[i]);
170 <                                exit(1);
175 <                        } else if (gotvfile == 0) {
168 >                        if (gotvfile < 0)
169 >                                syserror(argv[i]);
170 >                        else if (gotvfile == 0) {
171                                  fprintf(stderr, "%s: bad view file\n",
172                                                  argv[i]);
173                                  exit(1);
# Line 200 | Line 195 | char   *argv[];
195          ourpict = (COLR *)bmalloc(hresolu*vresolu*sizeof(COLR));
196          ourzbuf = (float *)bmalloc(hresolu*vresolu*sizeof(float));
197          if (ourpict == NULL || ourzbuf == NULL)
198 <                syserror();
198 >                syserror(progname);
199          bzero((char *)ourzbuf, hresolu*vresolu*sizeof(float));
200                                                          /* get input */
201          for ( ; i < argc; i += 2)
# Line 274 | Line 269 | char   *pfile, *zspec;
269          struct position *plast;
270          int     y;
271                                          /* open picture file */
272 <        if ((pfp = fopen(pfile, "r")) == NULL) {
273 <                perror(pfile);
279 <                exit(1);
280 <        }
272 >        if ((pfp = fopen(pfile, "r")) == NULL)
273 >                syserror(pfile);
274                                          /* get header with exposure and view */
275          theirexp = 1.0;
276          gotview = 0;
# Line 303 | Line 296 | char   *pfile, *zspec;
296          plast = (struct position *)calloc(scanlen(&tresolu),
297                          sizeof(struct position));
298          if (scanin == NULL || zin == NULL || plast == NULL)
299 <                syserror();
299 >                syserror(progname);
300                                          /* get z specification or file */
301          if ((zfd = open(zspec, O_RDONLY)) == -1) {
302                  double  zvalue;
303                  register int    x;
304 <                if (!isfloat(zspec) || (zvalue = atof(zspec)) <= 0.0) {
305 <                        perror(zspec);
304 >                if (!isfloat(zspec) || (zvalue = atof(zspec)) <= 0.0)
305 >                        syserror(zspec);
306                          exit(1);
314                }
307                  for (x = scanlen(&tresolu); x-- > 0; )
308                          zin[x] = zvalue;
309          }
# Line 522 | Line 514 | int    samp;
514                                                          /* get back buffer */
515          yback = (int *)malloc(hresolu*sizeof(int));
516          if (yback == NULL)
517 <                syserror();
517 >                syserror(progname);
518          for (x = 0; x < hresolu; x++)
519                  yback[x] = -2;
520          /*
# Line 626 | Line 618 | writepicture()                         /* write out picture */
618          fprtresolu(hresolu, vresolu, stdout);
619          for (y = vresolu-1; y >= 0; y--)
620                  if (fwritecolrs(pscan(y), hresolu, stdout) < 0)
621 <                        syserror();
621 >                        syserror(progname);
622   }
623  
624  
# Line 638 | Line 630 | char   *fname;
630          int     y;
631          float   *zout;
632  
633 <        if ((fd = open(fname, O_WRONLY|O_CREAT|O_TRUNC, 0666)) == -1) {
634 <                perror(fname);
643 <                exit(1);
644 <        }
633 >        if ((fd = open(fname, O_WRONLY|O_CREAT|O_TRUNC, 0666)) == -1)
634 >                syserror(fname);
635          if (donorm
636          && (zout = (float *)malloc(hresolu*sizeof(float))) == NULL)
637 <                syserror();
637 >                syserror(progname);
638          for (y = vresolu-1; y >= 0; y--) {
639                  if (donorm) {
640                          double  vx, yzn2;
# Line 659 | Line 649 | char   *fname;
649                  } else
650                          zout = zscan(y);
651                  if (write(fd, (char *)zout, hresolu*sizeof(float))
652 <                                < hresolu*sizeof(float)) {
653 <                        perror(fname);
664 <                        exit(1);
665 <                }
652 >                                < hresolu*sizeof(float))
653 >                        syserror(fname);
654          }
655          if (donorm)
656                  free((char *)zout);
# Line 719 | Line 707 | done:
707          *wp = NULL;
708                                                  /* start process */
709          if ((rval = open_process(PDesc, argv)) < 0)
710 <                syserror();
710 >                syserror(progname);
711          if (rval == 0) {
712                  fprintf(stderr, "%s: command not found\n", argv[0]);
713                  exit(1);
# Line 760 | Line 748 | clearqueue()                           /* process queue */
748          register float  *fbp;
749          register int    i;
750  
751 +        if (queuesiz == 0)
752 +                return;
753          fbp = fbuf;
754          for (i = 0; i < queuesiz; i++) {
755                  viewray(orig, dir, &ourview,
# Line 793 | Line 783 | clearqueue()                           /* process queue */
783   }
784  
785  
786 < syserror()                      /* report error and exit */
786 > syserror(s)                     /* report error and exit */
787 > char    *s;
788   {
789 <        perror(progname);
789 >        perror(s);
790          exit(1);
791   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines