--- ray/src/hd/rhpict.c 1999/03/09 15:10:26 3.7 +++ ray/src/hd/rhpict.c 2003/10/22 02:06:34 3.16 @@ -1,16 +1,15 @@ -/* Copyright (c) 1999 Silicon Graphics, Inc. */ - #ifndef lint -static char SCCSid[] = "$SunId$ SGI"; +static const char RCSid[] = "$Id: rhpict.c,v 3.16 2003/10/22 02:06:34 greg Exp $"; #endif - /* * Radiance holodeck picture generator */ +#include + +#include "platform.h" #include "rholo.h" #include "view.h" -#include "resolu.h" char *progname; /* our program name */ char *hdkfile; /* holodeck file name */ @@ -58,7 +57,7 @@ char *argv[]; pixaspect = atof(argv[++i]); else if (argv[i][2] == 'e') { expval = atof(argv[++i]); - if (argv[i][0] == '-' | argv[i][0] == '+') + if ((argv[i][0] == '-') | (argv[i][0] == '+')) expval = pow(2., expval); } else goto userr; @@ -147,7 +146,7 @@ int fn; /* render image */ if (blist.nb > 0) { render_frame(blist.bl, blist.nb); - free((char *)blist.bl); + free((void *)blist.bl); } else { sprintf(errmsg, "no section visible in frame %d", fn); error(WARNING, errmsg); @@ -171,7 +170,7 @@ render_frame(bl, nb) /* render frame from beam values register PACKHEAD *bl; int nb; { - extern int pixBeam(); + extern void pixBeam(); register HDBEAMI *bil; register int i; @@ -184,7 +183,7 @@ int nb; } hdloadbeams(bil, nb, pixBeam); pixFinish(randfrac); - free((char *)bil); + free((void *)bil); } @@ -214,18 +213,18 @@ int fn; fputs(VIEWSTR, stdout); fprintview(&myview, stdout); fputc('\n', stdout); - if (pa < 0.99 | pa > 1.01) + if ((pa < 0.99) | (pa > 1.01)) fputaspect(pa, stdout); - if (expval < 0.99 | expval > 1.01) + if ((expval < 0.99) | (expval > 1.01)) fputexpos(expval, stdout); fputformat(COLRFMT, stdout); fputc('\n', stdout); /* write resolution (standard order) */ fprtresolu(hres, vres, stdout); /* prepare image buffers */ - bzero((char *)mypixel, hres*vres*sizeof(COLOR)); - bzero((char *)myweight, hres*vres*sizeof(float)); - bzero((char *)mydepth, hres*vres*sizeof(float)); + memset((char *)mypixel, '\0', hres*vres*sizeof(COLOR)); + memset((char *)myweight, '\0', hres*vres*sizeof(float)); + memset((char *)mydepth, '\0', hres*vres*sizeof(float)); } @@ -233,17 +232,18 @@ int endpicture() /* finish and write out pixels */ { int lastr = -1, nunrend = 0; - int4 lastp, lastrp; - register int4 p; + int32 lastp, lastrp; + register int32 p; register double d; /* compute final pixel values */ for (p = hres*vres; p--; ) { if (myweight[p] <= FTINY) { - if (lastr >= 0) + if (lastr >= 0) { if (p/hres == lastp/hres) copycolor(mypixel[p], mypixel[lastp]); else copycolor(mypixel[p], mypixel[lastrp]); + } nunrend++; continue; } @@ -264,11 +264,10 @@ endpicture() /* finish and write out pixels */ initialize() /* initialize holodeck and buffers */ { - extern long ftell(); int fd; FILE *fp; int n; - int4 nextloc; + int32 nextloc; /* open holodeck file */ if ((fp = fopen(hdkfile, "r")) == NULL) { sprintf(errmsg, "cannot open \"%s\" for reading", hdkfile); @@ -286,7 +285,7 @@ initialize() /* initialize holodeck and buffers */ fd = dup(fileno(fp)); /* dup file descriptor */ fclose(fp); /* done with stdio */ for (n = 0; nextloc > 0L; n++) { /* initialize each section */ - lseek(fd, (long)nextloc, 0); + lseek(fd, (off_t)nextloc, SEEK_SET); read(fd, (char *)&nextloc, sizeof(nextloc)); hdinit(fd, NULL); } @@ -294,11 +293,12 @@ initialize() /* initialize holodeck and buffers */ mypixel = (COLOR *)bmalloc(xres*yres*sizeof(COLOR)); myweight = (float *)bmalloc(xres*yres*sizeof(float)); mydepth = (float *)bmalloc(xres*yres*sizeof(float)); - if (mypixel == NULL | myweight == NULL | mydepth == NULL) + if ((mypixel == NULL) | (myweight == NULL) | (mydepth == NULL)) error(SYSTEM, "out of memory in initialize"); } +void eputs(s) /* put error message to stderr */ register char *s; {