| 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 |
| 15 |
> |
#include <sys/types.h> |
| 16 |
|
|
| 17 |
< |
#include "standard.h" |
| 18 |
< |
#include "platform.h" |
| 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) */ |
| 29 |
– |
/*#define FLOAT float */ /* real type (precision) */ |
| 25 |
|
#define OUTFMT "%.7g" /* output format conversion string */ |
| 26 |
|
|
| 27 |
|
int interpolate = 0; |
| 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 |
|
|
| 38 |
|
|
| 39 |
|
static void load_data(FILE *fp); |
| 40 |
|
static void print_funcs(char *xe); |
| 41 |
< |
static void putlist(register FLOAT *av, int al, register int pos); |
| 41 |
> |
static void putlist(register RREAL *av, int al, register int pos); |
| 42 |
|
static char * absc_exp(void); |
| 43 |
|
|
| 44 |
|
int |
| 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); |
| 187 |
|
|
| 188 |
|
xelen = strlen(xe); |
| 189 |
|
for (i = 0; i < nfuncs; i++) { |
| 190 |
< |
if (func[i][0] == '\0' | func[i][0] == '0') |
| 190 |
> |
if ((func[i][0] == '\0') | (func[i][0] == '0')) |
| 191 |
|
continue; |
| 192 |
|
if (interpolate) { |
| 193 |
|
printf("%s`%s(i):select(i,", func[i], locID); |
| 207 |
|
|
| 208 |
|
static void |
| 209 |
|
putlist( /* put out array of values */ |
| 210 |
< |
register FLOAT *av, |
| 210 |
> |
register RREAL *av, |
| 211 |
|
int al, |
| 212 |
|
register int pos |
| 213 |
|
) |