--- ray/src/hd/genrhgrid.c 1998/01/06 17:19:42 3.1 +++ ray/src/hd/genrhgrid.c 2004/01/01 11:21:55 3.8 @@ -1,13 +1,14 @@ -/* Copyright (c) 1998 Silicon Graphics, Inc. */ - #ifndef lint -static char SCCSid[] = "$SunId$ SGI"; +static const char RCSid[] = "$Id: genrhgrid.c,v 3.8 2004/01/01 11:21:55 schorsch Exp $"; #endif - /* * Generate renderable grids from a holodeck file */ +#include + +#include "platform.h" +#include "resolu.h" #include "holo.h" char *progname; /* global argv[0] */ @@ -15,15 +16,21 @@ char *progname; /* global argv[0] */ char *mat, *name; /* material and object id */ double rad; /* grid line radius */ +static void gridsect(char *fname, int sect); +static void putgrid(HOLO *hp); +static void putline(FVECT wp[2]); -main(argc, argv) -int argc; -char *argv[]; + +int +main( + int argc, + char *argv[] +) { int sect; progname = argv[0]; - if (argc < 5 | argc > 6) + if ((argc < 5) | (argc > 6)) goto userr; mat = argv[1]; name = argv[2]; @@ -40,15 +47,16 @@ userr: } -gridsect(fname, sect) /* get specified section(s) and print grids */ -char *fname; -int sect; +void +gridsect( /* get specified section(s) and print grids */ + char *fname, + int sect +) { - extern long ftell(); FILE *fp; HOLO hdsect; int fd; - int4 nextloc; + int32 nextloc; int n; /* open holodeck file */ if ((fp = fopen(fname, "r")) == NULL) { @@ -64,9 +72,9 @@ int sect; nextloc = ftell(fp); /* get stdio position */ fclose(fp); /* done with stdio */ for (n = 0; nextloc > 0L; n++) { /* get the section(s) */ - lseek(fd, (long)nextloc, 0); + lseek(fd, (off_t)nextloc, SEEK_SET); read(fd, (char *)&nextloc, sizeof(nextloc)); - if (sect < 0 | n == sect) { + if ((sect < 0) | (n == sect)) { read(fd, (char *)&hdsect, sizeof(HDGRID)); hdcompgrid(&hdsect); putgrid(&hdsect); /* print grid */ @@ -75,8 +83,10 @@ int sect; } -putgrid(hp) /* run through holodeck section grid lines */ -register HOLO *hp; +void +putgrid( /* run through holodeck section grid lines */ + register HOLO *hp +) { register int w, i; int g0, g1; @@ -123,8 +133,10 @@ register HOLO *hp; } -putline(wp) /* put out a line */ -register FVECT wp[2]; +void +putline( /* put out a line */ + register FVECT wp[2] +) { static int cnt = 0;