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

Comparing ray/src/util/makedist.c (file contents):
Revision 2.4 by greg, Sat Feb 22 02:07:30 2003 UTC vs.
Revision 2.5 by schorsch, Fri Mar 26 21:36:19 2004 UTC

# Line 15 | Line 15 | static const char      RCSid[] = "$Id$";
15   *              Default axes are (x1,x2,x3) = (x,y,z).
16   */
17  
18 #include  <stdio.h>
19
18   #include <stdlib.h>
19 + #include <unistd.h>
20 + #include <stdio.h>
21 + #include <string.h>
22 + #include <sys/types.h>
23 + #include <sys/wait.h>
24  
25 + #include  "rtmath.h"
26   #include  "random.h"
23
27   #include  "setscan.h"
28  
29   #ifndef BSD
30   #define vfork           fork
31   #endif
32  
30 #define  FTINY          1e-7
31
32 #define  PI             3.14159265358979324
33
33   #define  atorad(a)      ((PI/180.0) * (a))
34  
35   char  *rtargv[128] = {"rtrace", "-h"};
# Line 56 | Line 55 | int  header = 1;                       /* print header? */
55  
56   char  *progname;                        /* program name */
57  
58 + static void printargs(int ac, char **av, FILE *fp);
59 + static void fixaxes(void);
60 + static int doscan(void);
61 + static FILE * scanstart(void);
62 + static int scanend(FILE *fp);
63 + static void sendsamples(FILE *fp);
64 + static void writesample(FILE *fp, ANGLE a, ANGLE b);
65 + static double readsample(FILE *fp);
66  
67 < main(argc, argv)
68 < int  argc;
69 < char  *argv[];
67 >
68 > int
69 > main(
70 >        int  argc,
71 >        char  *argv[]
72 > )
73   {
74          int  i;
75  
# Line 208 | Line 218 | badopt:
218  
219          fixaxes();
220  
221 <        if (header)
222 <                if (userformat > 0)
221 >        if (header) {
222 >                if (userformat > 0) {
223                          printf("Alpha\tBeta\tRadiance\n");
224 <                else {
224 >                } else {
225                          printargs(argc, argv, stdout);
226                          putchar('\n');
227                  }
228 +        }
229  
230          if (doscan() == -1)
231                  exit(1);
# Line 223 | Line 234 | badopt:
234   }
235  
236  
237 < printargs(ac, av, fp)           /* print arguments to a file */
238 < int  ac;
239 < char  **av;
240 < FILE  *fp;
237 > static void
238 > printargs(              /* print arguments to a file */
239 >        int  ac,
240 >        char  **av,
241 >        FILE  *fp
242 > )
243   {
244          while (ac-- > 0) {
245                  fputs(*av++, fp);
# Line 236 | Line 249 | FILE  *fp;
249   }
250  
251  
252 < fixaxes()                               /* make sure axes are OK */
252 > static void
253 > fixaxes(void)                           /* make sure axes are OK */
254   {
241        extern double  normalize(), fdot();
255          double  d;
256          register int  i;
257  
# Line 258 | Line 271 | axerr:
271   }
272  
273  
274 < doscan()                                /* do scan for target */
274 > static int
275 > doscan(void)                            /* do scan for target */
276   {
277          FILE  *fopen(), *scanstart();
278          double  readsample();
# Line 276 | Line 290 | doscan()                               /* do scan for target */
290   }
291  
292  
293 < FILE *
294 < scanstart()                     /* open scanner pipeline */
293 > static FILE *
294 > scanstart(void)                 /* open scanner pipeline */
295   {
296          int  status;
297          char  *fgets();
# Line 332 | Line 346 | err:
346   }
347  
348  
349 < scanend(fp)             /* done with scanner input */
350 < FILE  *fp;
349 > static int
350 > scanend(                /* done with scanner input */
351 >        FILE  *fp
352 > )
353   {
354          int  status;
355  
# Line 346 | Line 362 | FILE  *fp;
362   }
363  
364  
365 < sendsamples(fp)                 /* send our samples to fp */
366 < FILE  *fp;
365 > static void
366 > sendsamples(                    /* send our samples to fp */
367 >        FILE  *fp
368 > )
369   {
370          ANGLE  *a, *b;
371  
# Line 357 | Line 375 | FILE  *fp;
375   }
376  
377  
378 < writesample(fp, a, b)           /* write out sample ray grid */
379 < FILE  *fp;
380 < ANGLE  a, b;
378 > static void
379 > writesample(            /* write out sample ray grid */
380 >        FILE    *fp,
381 >        ANGLE   a,
382 >        ANGLE   b
383 > )
384   {
385          double  sin(), cos();
386          float  sp[6];
# Line 395 | Line 416 | ANGLE  a, b;
416   }
417  
418  
419 < double
420 < readsample(fp)                  /* read in sample ray grid */
421 < FILE  *fp;
419 > static double
420 > readsample(                     /* read in sample ray grid */
421 >        FILE  *fp
422 > )
423   {
424          float  col[3];
425          double  sum;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines