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

Comparing ray/src/hd/rholo.c (file contents):
Revision 3.51 by gwlarson, Thu Aug 5 19:20:10 1999 UTC vs.
Revision 3.58 by greg, Sat Jun 21 14:48:54 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1999 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ SGI";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * Radiance holodeck generation controller
6   */
# Line 48 | Line 45 | time_t starttime;              /* time we got started */
45   time_t  endtime;                /* time we should end by */
46   time_t  reporttime;             /* time for next report */
47  
48 < long    maxdisk;                /* maximum file space (bytes) */
48 > off_t   maxdisk;                /* maximum file space (bytes) */
49  
50   int     rtargc = 1;             /* rtrace command */
51   char    *rtargv[128] = {"rtrace", NULL};
# Line 155 | Line 152 | userr:
152   }
153  
154  
155 + void
156   onsig(signo)                            /* fatal signal */
157   int  signo;
158   {
# Line 217 | Line 215 | initrholo()                    /* get our holodeck running */
215                  init_global();
216                                                  /* record disk space limit */
217          if (!vdef(DISKSPACE))
218 <                maxdisk = 0;
218 >                maxdisk = ((off_t)1<<(sizeof(off_t)*8-2)) - 1024;
219          else
220                  maxdisk = 1024.*1024.*vflt(DISKSPACE);
221                                                  /* set up memory cache */
# Line 278 | Line 276 | initrholo()                    /* get our holodeck running */
276          sigdie(SIGXFSZ, "File size exceeded");
277   #endif
278                                          /* protect holodeck file */
279 <        orig_mode = resfmode(hdlist[0]->fd, ncprocs>0 ? 0 : 0444);
279 >        orig_mode = resfmode(hdlist[0]->fd, ncprocs>0&force>=0 ? 0 : 0444);
280          return;
281   memerr:
282          error(SYSTEM, "out of memory in initrholo");
# Line 290 | Line 288 | rholo()                                /* holodeck main loop */
288          static long     nextfragwarn = 100*(1L<<20);
289          static int      idle = 0;
290          PACKET  *pl = NULL, *plend;
291 <        long    fsiz;
291 >        off_t   fsiz;
292          int     pksiz;
293          register PACKET *p;
294          time_t  t;
# Line 415 | Line 413 | creatholo(gp)                  /* create a holodeck output file */
413   HDGRID  *gp;
414   {
415          extern char     VersionID[];
416 <        int4    lastloc, nextloc;
416 >        int32   lastloc, nextloc;
417          int     n;
418          int     fd;
419          FILE    *fp;
# Line 433 | Line 431 | HDGRID *gp;
431          putw(HOLOMAGIC, fp);            /* put magic number */
432          fd = dup(fileno(fp));
433          fclose(fp);                     /* flush and close stdio stream */
434 <        lastloc = lseek(fd, 0L, 2);
434 >        lastloc = lseek(fd, (off_t)0, 2);
435          for (n = vdef(SECTION); n--; gp++) {    /* initialize each section */
436                  nextloc = 0L;
437                  write(fd, (char *)&nextloc, sizeof(nextloc));
# Line 441 | Line 439 | HDGRID *gp;
439                  if (!n)
440                          break;
441                  nextloc = hdfilen(fd);          /* write section pointer */
442 <                if (lseek(fd, (long)lastloc, 0) < 0)
442 >                if (lseek(fd, (off_t)lastloc, 0) < 0)
443                          error(SYSTEM,
444                                  "cannot seek on holodeck file in creatholo");
445                  write(fd, (char *)&nextloc, sizeof(nextloc));
446 <                lseek(fd, (long)(lastloc=nextloc), 0);
446 >                lseek(fd, (off_t)(lastloc=nextloc), 0);
447          }
448   }
449  
# Line 478 | Line 476 | char   *s;
476  
477   loadholo()                      /* start loading a holodeck from fname */
478   {
481        extern long     ftell();
479          FILE    *fp;
480          int     fd;
481          int     n;
482 <        int4    nextloc;
482 >        int32   nextloc;
483          
484          if (ncprocs > 0 & force >= 0)
485                  fp = fopen(hdkfile, "r+");
# Line 513 | Line 510 | loadholo()                     /* start loading a holodeck from fname */
510          fd = dup(fileno(fp));
511          fclose(fp);                             /* done with stdio */
512          for (n = 0; nextloc > 0L; n++) {        /* initialize each section */
513 <                lseek(fd, (long)nextloc, 0);
513 >                lseek(fd, (off_t)nextloc, 0);
514                  read(fd, (char *)&nextloc, sizeof(nextloc));
515                  hdinit(fd, NULL);
516          }
# Line 534 | Line 531 | PACKET *pl;
531          while (pl != NULL) {
532                  p = pl; pl = p->next; p->next = NULL;
533                  if (p->nr > 0) {                /* add to holodeck */
534 <                        bcopy((char *)p->ra,
535 <                                (char *)hdnewrays(hdlist[p->hd],p->bi,p->nr),
534 >                        bcopy((void *)p->ra,
535 >                                (void *)hdnewrays(hdlist[p->hd],p->bi,p->nr),
536                                  p->nr*sizeof(RAYVAL));
537                          if (outdev != NULL)     /* display it */
538                                  disp_packet((PACKHEAD *)p);
# Line 581 | Line 578 | int    vc;
578   }
579  
580  
581 + void
582   eputs(s)                        /* put error message to stderr */
583   register char  *s;
584   {
# Line 600 | Line 598 | register char  *s;
598   }
599  
600  
601 + void
602   quit(ec)                        /* exit program gracefully */
603   int     ec;
604   {
# Line 609 | Line 608 | int    ec;
608                  if (nprocs > 0)
609                          status = done_rtrace();         /* calls hdsync() */
610                  if (ncprocs > 0 & force >= 0 && vdef(REPORT)) {
611 <                        long    fsiz, fuse;
611 >                        off_t   fsiz, fuse;
612                          fsiz = hdfilen(hdlist[0]->fd);
613                          fuse = hdfiluse(hdlist[0]->fd, 1);
614                          fprintf(stderr,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines