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

Comparing ray/src/gen/genprism.c (file contents):
Revision 2.12 by schorsch, Sun Nov 16 10:29:38 2003 UTC vs.
Revision 2.13 by greg, Sat Jul 25 19:18:01 2020 UTC

# Line 9 | Line 9 | static const char      RCSid[] = "$Id$";
9   *              orientation.
10   */
11  
12 < #include  <stdio.h>
13 < #include  <string.h>
14 < #include <stdlib.h>
12 > #include  "rtio.h"
13 > #include  <stdlib.h>
14   #include  <math.h>
15   #include  <ctype.h>
16  
# Line 40 | Line 39 | static double  compute_rounding(void);
39  
40  
41   static void
42 < readverts(fname)                /* read vertices from a file */
44 < char  *fname;
42 > readverts(char *fname)          /* read vertices from a file */
43   {
44          FILE  *fp;
45  
# Line 58 | Line 56 | char  *fname;
56  
57  
58   static void
59 < side(n0, n1)                    /* print single side */
62 < register int  n0, n1;
59 > side(int n0, int n1)                    /* print single side */
60   {
61          printf("\n%s polygon %s.%d\n", pmtype, pname, n0+1);
62          printf("0\n0\n12\n");
# Line 75 | Line 72 | register int  n0, n1;
72  
73  
74   static void
75 < rside(n0, n1)                   /* print side with rounded edge */
79 < register int  n0, n1;
75 > rside(int n0, int n1)                   /* print side with rounded edge */
76   {
77          double  s, c, t[3];
78  
# Line 126 | Line 122 | register int  n0, n1;
122  
123  
124   static double
125 < compute_rounding()              /* compute vectors for rounding operations */
125 > compute_rounding(void)          /* compute vectors for rounding operations */
126   {
127 <        register int  i;
128 <        register double *v0, *v1;
127 >        int  i;
128 >        double  *v0, *v1;
129          double  l, asum;
130  
131          v0 = vert[nverts-1];
# Line 170 | Line 166 | compute_rounding()             /* compute vectors for rounding op
166  
167  
168   static void
169 < printends()                     /* print ends of prism */
169 > printends(void)                 /* print ends of prism */
170   {
171 <        register int  i;
171 >        int  i;
172                                                  /* bottom face */
173          printf("\n%s polygon %s.b\n", pmtype, pname);
174          printf("0\n0\n%d\n", nverts*3);
# Line 189 | Line 185 | printends()                    /* print ends of prism */
185  
186  
187   static void
188 < printrends()                    /* print ends of prism with rounding */
188 > printrends(void)                /* print ends of prism with rounding */
189   {
190 <        register int  i;
190 >        int  i;
191          double  c0[3], c1[3], cl[3];
192                                                  /* bottom face */
193          printf("\n%s polygon %s.b\n", pmtype, pname);
# Line 269 | Line 265 | printrends()                   /* print ends of prism with rounding */
265  
266  
267   static void
268 < printsides(round)               /* print prism sides */
273 < int  round;
268 > printsides(int round)           /* print prism sides */
269   {
270 <        register int  i;
270 >        int  i;
271  
272          for (i = 0; i < nverts-1; i++)
273                  if (round)
# Line 288 | Line 283 | int  round;
283   }
284  
285  
291 static void
292 printhead(ac, av)               /* print command header */
293 register int  ac;
294 register char  **av;
295 {
296        putchar('#');
297        while (ac--) {
298                putchar(' ');
299                fputs(*av++, stdout);
300        }
301        putchar('\n');
302 }
303
304
286   int
287 < main(argc, argv)
307 < int  argc;
308 < char  **argv;
287 > main(int argc, char **argv)
288   {
289          int  an;
290          
# Line 378 | Line 357 | char  **argv;
357                  }
358                  crad *= lvdir;          /* simplifies formulas */
359                  compute_rounding();
360 <                printhead(argc, argv);
360 >                fputs("# ", stdout);
361 >                printargs(argc, argv, stdout);
362                  if (do_ends)
363                          printrends();
364                  printsides(1);
365          } else {
366 <                printhead(argc, argv);
366 >                fputs("# ", stdout);
367 >                printargs(argc, argv, stdout);
368                  if (do_ends)
369                          printends();
370                  printsides(0);
371          }
372 <        exit(0);
372 >        return(0);
373   userr:
374          fprintf(stderr, "Usage: %s material name ", argv[0]);
375          fprintf(stderr, "{ - | vfile | N v1 v2 .. vN } ");
376          fprintf(stderr, "[-l lvect][-r radius][-c][-e]\n");
377 <        exit(1);
377 >        return(1);
378   }
379  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines