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

Comparing ray/src/cal/tabfunc.c (file contents):
Revision 1.1 by greg, Sat Feb 22 02:07:20 2003 UTC vs.
Revision 1.4 by schorsch, Mon Jul 14 20:02:29 2003 UTC

# Line 9 | Line 9 | static const char      RCSid[] = "$Id$";
9  
10   #include <stdio.h>
11   #include <stdlib.h>
12 + #include <string.h>
13   #include <math.h>
14   #include <ctype.h>
15 + #include <sys/types.h>
16  
17 + #include "rtprocess.h" /* getpid() */
18 + #include "rtmath.h"
19 + #include "rtio.h"
20 +
21   #define  isdelim(c)     (isspace(c) || (c)==',')
22  
23   #define  MAXTAB         1024            /* maximum number of data rows */
24   #define  MAXLINE        4096            /* maximum line width (characters) */
19 #define  FLOAT          float           /* real type (precision) */
25   #define  OUTFMT         "%.7g"          /* output format conversion string */
26  
27   int     interpolate = 0;
# Line 24 | Line 29 | char   *progname;
29   char    **func;
30   int     nfuncs;
31  
32 < FLOAT   abscissa[MAXTAB];               /* independent values (first column) */
33 < FLOAT   (*ordinate)[MAXTAB];            /* dependent values (other columns) */
32 > RREAL   abscissa[MAXTAB];               /* independent values (first column) */
33 > RREAL   (*ordinate)[MAXTAB];            /* dependent values (other columns) */
34   int     tabsize = 0;                    /* final table size (number of rows) */
35   char    locID[16];                      /* local identifier (for uniqueness) */
36  
37 < extern char     *fgets(), *fskip(), *absc_exp();
37 > /*extern char   *fgets(), *fskip(), *absc_exp();*/
38  
39 + static void load_data(FILE *fp);
40 + static void print_funcs(char *xe);
41 + static void putlist(register RREAL *av, int al, register int pos);
42 + static char * absc_exp(void);
43  
44 < main(argc, argv)
45 < int     argc;
46 < char    **argv;
44 > int
45 > main(
46 > int     argc,
47 > char    **argv
48 > )
49   {
50          progname = argv[0];
51          argv++;
# Line 52 | Line 63 | char   **argv;
63          }
64          func = argv;
65          nfuncs = argc;
66 <        ordinate = (FLOAT (*)[MAXTAB])malloc(nfuncs*MAXTAB*sizeof(FLOAT));
66 >        ordinate = (RREAL (*)[MAXTAB])malloc(nfuncs*MAXTAB*sizeof(RREAL));
67          if (ordinate == NULL) {
68                  fprintf(stderr, "%s: not enough memory\n", progname);
69                  exit(1);
# Line 64 | Line 75 | char   **argv;
75   }
76  
77  
78 < load_data(fp)                   /* load tabular data from fp */
79 < FILE    *fp;
78 > static void
79 > load_data(                      /* load tabular data from fp */
80 > FILE    *fp
81 > )
82   {
83          int     lineno;
84          char    *err;
# Line 110 | Line 123 | fatal:
123   }
124  
125  
126 < char *
127 < absc_exp()                      /* produce expression for abscissa */
126 > static char *
127 > absc_exp(void)                  /* produce expression for abscissa */
128   {
129          static char     ourexp[64];
130          double  step, eps;
# Line 164 | Line 177 | absc_exp()                     /* produce expression for abscissa */
177   }
178  
179  
180 < print_funcs(xe)                 /* print functions */
181 < char    *xe;
180 > static void
181 > print_funcs(                    /* print functions */
182 > char    *xe
183 > )
184   {
185          int     xelen;
186          register int    i;
# Line 190 | Line 205 | char   *xe;
205   }
206  
207  
208 < putlist(av, al, pos)            /* put out array of values */
209 < register FLOAT  *av;
210 < int     al;
211 < register int    pos;
208 > static void
209 > putlist(                /* put out array of values */
210 > register RREAL  *av,
211 > int     al,
212 > register int    pos
213 > )
214   {
215          char    obuf[32];
216          int     len;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines