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

Comparing ray/src/hd/genrhgrid.c (file contents):
Revision 3.2 by greg, Sat Feb 22 02:07:24 2003 UTC vs.
Revision 3.11 by greg, Fri Jun 6 19:11:21 2025 UTC

# Line 5 | Line 5 | static const char      RCSid[] = "$Id$";
5   * Generate renderable grids from a holodeck file
6   */
7  
8 + #include <stdio.h>
9 + #include "paths.h"
10 + #include "platform.h"
11 + #include "resolu.h"
12   #include "holo.h"
13  
10 char    *progname;              /* global argv[0] */
11
14   char    *mat, *name;            /* material and object id */
15   double  rad;                    /* grid line radius */
16  
17 + static void gridsect(char *fname, int sect);
18 + static void putgrid(HOLO *hp);
19 + static void putline(FVECT wp[2]);
20  
21 < main(argc, argv)
22 < int     argc;
23 < char    *argv[];
21 >
22 > int
23 > main(
24 >        int     argc,
25 >        char    *argv[]
26 > )
27   {
28          int     sect;
29  
30 <        progname = argv[0];
31 <        if (argc < 5 | argc > 6)
30 >        fixargv0(argv[0]);
31 >        if ((argc < 5) | (argc > 6))
32                  goto userr;
33          mat = argv[1];
34          name = argv[2];
# Line 37 | Line 45 | userr:
45   }
46  
47  
48 < gridsect(fname, sect)           /* get specified section(s) and print grids */
49 < char    *fname;
50 < int     sect;
48 > void
49 > gridsect(               /* get specified section(s) and print grids */
50 >        char    *fname,
51 >        int     sect
52 > )
53   {
44        extern long     ftell();
54          FILE    *fp;
55          HOLO    hdsect;
56          int     fd;
57 <        int4    nextloc;
57 >        int32   nextloc;
58          int     n;
59                                          /* open holodeck file */
60 <        if ((fp = fopen(fname, "r")) == NULL) {
60 >        if ((fp = fopen(fname, "rb")) == NULL) {
61                  sprintf(errmsg, "cannot open \"%s\"", fname);
62                  error(SYSTEM, errmsg);
63          }
# Line 61 | Line 70 | int    sect;
70          nextloc = ftell(fp);                    /* get stdio position */
71          fclose(fp);                             /* done with stdio */
72          for (n = 0; nextloc > 0L; n++) {        /* get the section(s) */
73 <                lseek(fd, (off_t)nextloc, 0);
73 >                lseek(fd, (off_t)nextloc, SEEK_SET);
74                  read(fd, (char *)&nextloc, sizeof(nextloc));
75 <                if (sect < 0 | n == sect) {
75 >                if ((sect < 0) | (n == sect)) {
76                          read(fd, (char *)&hdsect, sizeof(HDGRID));
77                          hdcompgrid(&hdsect);
78                          putgrid(&hdsect);       /* print grid */
# Line 72 | Line 81 | int    sect;
81   }
82  
83  
84 < putgrid(hp)                     /* run through holodeck section grid lines */
85 < register HOLO   *hp;
84 > void
85 > putgrid(                        /* run through holodeck section grid lines */
86 >        HOLO    *hp
87 > )
88   {
89 <        register int    w, i;
89 >        int     w, i;
90          int     g0, g1;
91          FVECT   wp[2], mov;
92          double  d;
# Line 120 | Line 131 | register HOLO  *hp;
131   }
132  
133  
134 < putline(wp)             /* put out a line */
135 < register FVECT  wp[2];
134 > void
135 > putline(                /* put out a line */
136 >        FVECT   wp[2]
137 > )
138   {
139          static int      cnt = 0;
140  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines