--- ray/src/hd/genrhgrid.c 2003/05/29 16:26:21 3.3 +++ ray/src/hd/genrhgrid.c 2004/01/01 11:21:55 3.8 @@ -1,10 +1,14 @@ #ifndef lint -static const char RCSid[] = "$Id: genrhgrid.c,v 3.3 2003/05/29 16:26:21 greg Exp $"; +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] */ @@ -12,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]; @@ -37,14 +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 +) { FILE *fp; HOLO hdsect; int fd; - int4 nextloc; + int32 nextloc; int n; /* open holodeck file */ if ((fp = fopen(fname, "r")) == NULL) { @@ -60,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, (off_t)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 */ @@ -71,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; @@ -119,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;