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.3 by greg, Mon Aug 2 14:35:13 1993 UTC vs.
Revision 2.5 by schorsch, Fri Mar 26 21:36:19 2004 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1991 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   /*
5   *  makedist.c - program to make a source distribution.
6   *
# Line 18 | Line 15 | static char SCCSid[] = "$SunId$ LBL";
15   *              Default axes are (x1,x2,x3) = (x,y,z).
16   */
17  
18 < #include  <stdio.h>
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"
24
27   #include  "setscan.h"
28  
29   #ifndef BSD
30   #define vfork           fork
31   #endif
32  
31 #define  FTINY          1e-7
32
33 #define  PI             3.14159265358979324
34
33   #define  atorad(a)      ((PI/180.0) * (a))
34  
35   char  *rtargv[128] = {"rtrace", "-h"};
# Line 39 | Line 37 | int  rtargc = 2;
37  
38   #define  passarg(s)     (rtargv[rtargc++] = s)
39  
42 #ifdef  DCL_ATOF
43 extern double  atof();
44 #endif
45                                        /* default angles */
40   ANGLE  alpha[181] = {10, 25, 40, 55, 70, 85, AEND};
41   ANGLE  beta[361] = {0,30,60,90,120,150,180,210,240,270,300,330,AEND};
42  
# Line 61 | 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 213 | 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 228 | 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 241 | 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   {
246        extern double  normalize(), fdot();
255          double  d;
256          register int  i;
257  
# Line 263 | 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 281 | 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 337 | 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 351 | 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 362 | 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 400 | 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