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

Comparing ray/src/cv/thf2rad.c (file contents):
Revision 2.1 by greg, Tue Nov 12 17:01:57 1991 UTC vs.
Revision 2.8 by schorsch, Sat Nov 15 17:54:06 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1990 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /* Copyright (c) 1988 Regents of the University of California */
5  
6   /*
# Line 12 | Line 9 | static char SCCSid[] = "$SunId$ LBL";
9   *      12/21/88
10   */
11  
12 + #include <stdlib.h>
13   #include <stdio.h>
14 + #include <string.h>
15 + #include <math.h>
16  
17   #define MAXSTR          128             /* maximum string or id length */
18   #define MAXPTS          2048            /* maximum points per object */
# Line 23 | Line 23 | typedef struct {
23  
24   double  rad = 0.0;                      /* line radius */
25  
26 + static void thf2rad(char *name, char *file);
27 + static int cvobject(char *name, char *file, FILE *fp);
28 + static void header(int ac, char **av);
29 + static void point(char *mat, char *nam, POINT *pos);
30 + static void line(char *mat, char *nam, POINT *p1, POINT *p2);
31 + static void loc(POINT *p);
32 + static void readerr(char *file, char *err);
33  
34 < main(argc, argv)
35 < int     argc;
36 < char    *argv[];
34 >
35 > int
36 > main(
37 >        int     argc,
38 >        char    *argv[]
39 > )
40   {
31        extern double   atof();
41          char    *name = NULL;
42          int     an;
43  
# Line 59 | Line 68 | char   *argv[];
68   }
69  
70  
71 < thf2rad(name, file)             /* convert things file */
72 < char    *name, *file;
71 > void
72 > thf2rad(                /* convert things file */
73 >        char    *name,
74 >        char    *file
75 > )
76   {
77          char    nambuf[MAXSTR];
78          register char   *cp;
# Line 80 | Line 92 | char   *name, *file;
92                  if (name == NULL)
93                          name = file;
94          }
95 <        for (cp = nambuf; *cp = *name++; cp++)
95 >        for (cp = nambuf; (*cp = *name++); cp++)
96                  ;
97                                  /* get objects from file */
98          on = 0;
# Line 89 | Line 101 | char   *name, *file;
101   }
102  
103  
104 < cvobject(name, file, fp)        /* convert next object in things file */
105 < char    *name, *file;
106 < FILE    *fp;
104 > int
105 > cvobject(       /* convert next object in things file */
106 >        char    *name,
107 >        char    *file,
108 >        FILE    *fp
109 > )
110   {
111          static POINT    parr[MAXPTS];
112          static unsigned char    haspt[MAXPTS/8];
# Line 157 | Line 172 | FILE   *fp;
172   }
173  
174  
175 < header(ac, av)                  /* print header */
176 < int     ac;
177 < char    **av;
175 > void
176 > header(                 /* print header */
177 >        int     ac,
178 >        char    **av
179 > )
180   {
181          putchar('#');
182          while (ac--) {
# Line 170 | Line 187 | char   **av;
187   }
188  
189  
190 < point(mat, nam, pos)            /* print point */
191 < char    *mat, *nam;
192 < POINT   *pos;
190 > void
191 > point(          /* print point */
192 >        char    *mat,
193 >        char    *nam,
194 >        POINT   *pos
195 > )
196   {
197          if (rad <= 0.0)
198                  return;
# Line 183 | Line 203 | POINT  *pos;
203   }
204  
205  
206 < line(mat, nam, p1, p2)          /* print line */
207 < char    *mat, *nam;
208 < POINT   *p1, *p2;
206 > void
207 > line(           /* print line */
208 >        char    *mat,
209 >        char    *nam,
210 >        POINT   *p1,
211 >        POINT   *p2
212 > )
213   {
214          if (rad <= 0.0)
215                  return;
# Line 197 | Line 221 | POINT  *p1, *p2;
221   }
222  
223  
224 < loc(p)                          /* print location */
225 < register POINT  *p;
224 > void
225 > loc(                            /* print location */
226 >        register POINT  *p
227 > )
228   {
229          printf("\t%14.8g\t%14.8g\t%14.8g\n", p->x, p->y, p->z);
230   }
231  
232  
233 < readerr(file, err)              /* print read error and exit */
234 < char    *file, *err;
233 > void
234 > readerr(                /* print read error and exit */
235 >        char    *file,
236 >        char    *err
237 > )
238   {
239          fprintf(stderr, "%s: %s\n", file, err);
240          exit(1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines