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; |
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++; |
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); |
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; |
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; |
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; |
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; |