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.3 by schorsch, Thu Jun 26 00:58:09 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 + #ifdef _WIN32
16 + #include <process.h> /* getpid() */
17 + #else
18 + #include <sys/types.h>
19 + #include <unistd.h>
20 + #endif
21  
22 + #include "standard.h"
23 + #include "platform.h"
24 +
25   #define  isdelim(c)     (isspace(c) || (c)==',')
26  
27   #define  MAXTAB         1024            /* maximum number of data rows */
28   #define  MAXLINE        4096            /* maximum line width (characters) */
19 #define  FLOAT          float           /* real type (precision) */
29   #define  OUTFMT         "%.7g"          /* output format conversion string */
30  
31   int     interpolate = 0;
# Line 24 | Line 33 | char   *progname;
33   char    **func;
34   int     nfuncs;
35  
36 < FLOAT   abscissa[MAXTAB];               /* independent values (first column) */
37 < FLOAT   (*ordinate)[MAXTAB];            /* dependent values (other columns) */
36 > RREAL   abscissa[MAXTAB];               /* independent values (first column) */
37 > RREAL   (*ordinate)[MAXTAB];            /* dependent values (other columns) */
38   int     tabsize = 0;                    /* final table size (number of rows) */
39   char    locID[16];                      /* local identifier (for uniqueness) */
40  
41 < extern char     *fgets(), *fskip(), *absc_exp();
41 > /*extern char   *fgets(), *fskip(), *absc_exp();*/
42  
43 + static void load_data(FILE *fp);
44 + static void print_funcs(char *xe);
45 + static void putlist(register RREAL *av, int al, register int pos);
46 + static char * absc_exp(void);
47  
48 < main(argc, argv)
49 < int     argc;
50 < char    **argv;
48 > int
49 > main(
50 > int     argc,
51 > char    **argv
52 > )
53   {
54          progname = argv[0];
55          argv++;
# Line 52 | Line 67 | char   **argv;
67          }
68          func = argv;
69          nfuncs = argc;
70 <        ordinate = (FLOAT (*)[MAXTAB])malloc(nfuncs*MAXTAB*sizeof(FLOAT));
70 >        ordinate = (RREAL (*)[MAXTAB])malloc(nfuncs*MAXTAB*sizeof(RREAL));
71          if (ordinate == NULL) {
72                  fprintf(stderr, "%s: not enough memory\n", progname);
73                  exit(1);
# Line 64 | Line 79 | char   **argv;
79   }
80  
81  
82 < load_data(fp)                   /* load tabular data from fp */
83 < FILE    *fp;
82 > static void
83 > load_data(                      /* load tabular data from fp */
84 > FILE    *fp
85 > )
86   {
87          int     lineno;
88          char    *err;
# Line 110 | Line 127 | fatal:
127   }
128  
129  
130 < char *
131 < absc_exp()                      /* produce expression for abscissa */
130 > static char *
131 > absc_exp(void)                  /* produce expression for abscissa */
132   {
133          static char     ourexp[64];
134          double  step, eps;
# Line 164 | Line 181 | absc_exp()                     /* produce expression for abscissa */
181   }
182  
183  
184 < print_funcs(xe)                 /* print functions */
185 < char    *xe;
184 > static void
185 > print_funcs(                    /* print functions */
186 > char    *xe
187 > )
188   {
189          int     xelen;
190          register int    i;
# Line 190 | Line 209 | char   *xe;
209   }
210  
211  
212 < putlist(av, al, pos)            /* put out array of values */
213 < register FLOAT  *av;
214 < int     al;
215 < register int    pos;
212 > static void
213 > putlist(                /* put out array of values */
214 > register RREAL  *av,
215 > int     al,
216 > register int    pos
217 > )
218   {
219          char    obuf[32];
220          int     len;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines