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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines