12 |
|
#include <stdio.h> |
13 |
|
#include <stdlib.h> |
14 |
|
#include <math.h> |
15 |
+ |
#include <string.h> |
16 |
|
#include <ctype.h> |
17 |
|
|
18 |
|
#include "rtprocess.h" |
19 |
|
#include "rtmisc.h" |
20 |
+ |
#include "rterror.h" |
21 |
|
#include "rtio.h" |
22 |
+ |
#include "calcomp.h" |
23 |
|
#include "mgvars.h" |
24 |
|
|
25 |
|
#define MAXLINE 512 |
26 |
|
|
24 |
– |
#define isid(c) (isalnum(c) || (c) == '_' || (c) == '.') |
25 |
– |
|
27 |
|
#define isnum(c) (isdigit(c)||(c)=='-'||(c)=='+'||(c)=='.'||(c)=='e'||(c)=='E') |
28 |
|
|
29 |
< |
char *findfile(); |
29 |
> |
static void mgprint(register VARIABLE *vp, FILE *fp); |
30 |
> |
static void setivar(char *vname, char *fname, char *definition); |
31 |
> |
static char *findfile(char *fname, register char **pathlist); |
32 |
> |
static void loaddata(char *fname, FILE *fp, register DARRAY *dp); |
33 |
> |
static void undefine(register VARIABLE *vp); |
34 |
|
|
35 |
< |
extern char *progname, *libpath[]; |
35 |
> |
extern char *progname, *libpath[]; |
36 |
|
|
32 |
– |
#ifdef DCL_ATOF |
33 |
– |
double atof(); |
34 |
– |
#endif |
35 |
– |
|
37 |
|
IVAR *ivhead = NULL; /* intermediate variables */ |
38 |
|
|
39 |
|
VARIABLE gparam[NVARS] = { /* standard variables */ |
143 |
|
}; |
144 |
|
|
145 |
|
|
146 |
< |
mgclearall() /* clear all variable settings */ |
146 |
> |
void |
147 |
> |
mgclearall(void) /* clear all variable settings */ |
148 |
|
{ |
149 |
|
int j; |
150 |
|
register IVAR *iv; |
169 |
|
} |
170 |
|
|
171 |
|
|
172 |
< |
mgload(file) /* load a file */ |
173 |
< |
char *file; |
172 |
> |
void |
173 |
> |
mgload( /* load a file */ |
174 |
> |
char *file |
175 |
> |
) |
176 |
|
{ |
177 |
|
FILE *fp; |
178 |
|
char sbuf[MAXLINE], *fgets(); |
239 |
|
} |
240 |
|
|
241 |
|
|
242 |
< |
mgsave(file) /* save our variables */ |
243 |
< |
char *file; |
242 |
> |
void |
243 |
> |
mgsave( /* save our variables */ |
244 |
> |
char *file |
245 |
> |
) |
246 |
|
{ |
247 |
|
FILE *fp; |
248 |
|
int j; |
272 |
|
} |
273 |
|
|
274 |
|
|
275 |
< |
setmgvar(fname, fp, string) /* set a variable */ |
276 |
< |
char *fname; |
277 |
< |
FILE *fp; |
278 |
< |
char *string; |
275 |
> |
void |
276 |
> |
setmgvar( /* set a variable */ |
277 |
> |
char *fname, |
278 |
> |
FILE *fp, |
279 |
> |
char *string |
280 |
> |
) |
281 |
|
{ |
282 |
|
char name[128]; |
283 |
|
FILE *fp2; |
367 |
|
} |
368 |
|
|
369 |
|
|
370 |
< |
setivar(vname, fname, definition) /* set an intermediate variable */ |
371 |
< |
char *vname; |
372 |
< |
char *fname; |
373 |
< |
char *definition; |
370 |
> |
static void |
371 |
> |
setivar( /* set an intermediate variable */ |
372 |
> |
char *vname, |
373 |
> |
char *fname, |
374 |
> |
char *definition |
375 |
> |
) |
376 |
|
{ |
377 |
|
IVAR ivbeg; |
378 |
|
register IVAR *iv; |
397 |
|
} |
398 |
|
|
399 |
|
|
400 |
< |
mgtoa(s, vp) /* get a variable's value in ascii form */ |
401 |
< |
register char *s; |
402 |
< |
VARIABLE *vp; |
400 |
> |
void |
401 |
> |
mgtoa( /* get a variable's value in ascii form */ |
402 |
> |
register char *s, |
403 |
> |
VARIABLE *vp |
404 |
> |
) |
405 |
|
{ |
406 |
|
register char *sv; |
407 |
|
|
429 |
|
} |
430 |
|
|
431 |
|
|
432 |
< |
mgprint(vp, fp) /* print a variable definition */ |
433 |
< |
register VARIABLE *vp; |
434 |
< |
FILE *fp; |
432 |
> |
static void |
433 |
> |
mgprint( /* print a variable definition */ |
434 |
> |
register VARIABLE *vp, |
435 |
> |
FILE *fp |
436 |
> |
) |
437 |
|
{ |
438 |
|
register int i; |
439 |
|
|
469 |
|
} |
470 |
|
|
471 |
|
|
472 |
< |
undefine(vp) /* undefine a variable */ |
473 |
< |
register VARIABLE *vp; |
472 |
> |
static void |
473 |
> |
undefine( /* undefine a variable */ |
474 |
> |
register VARIABLE *vp |
475 |
> |
) |
476 |
|
{ |
477 |
|
if (vp == NULL || !(vp->flags & DEFINED)) |
478 |
|
return; |
514 |
|
} |
515 |
|
|
516 |
|
|
517 |
< |
loaddata(fname, fp, dp) /* load data from a stream */ |
518 |
< |
char *fname; |
519 |
< |
FILE *fp; |
520 |
< |
register DARRAY *dp; |
517 |
> |
static void |
518 |
> |
loaddata( /* load data from a stream */ |
519 |
> |
char *fname, |
520 |
> |
FILE *fp, |
521 |
> |
register DARRAY *dp |
522 |
> |
) |
523 |
|
{ |
524 |
|
char sbuf[MAXLINE], *fgets(); |
525 |
|
register char *cp; |
551 |
|
} |
552 |
|
|
553 |
|
|
554 |
< |
char * |
555 |
< |
findfile(fname, pathlist) /* find the file fname, return full path */ |
556 |
< |
char *fname; |
557 |
< |
register char **pathlist; |
554 |
> |
static char * |
555 |
> |
findfile( /* find the file fname, return full path */ |
556 |
> |
char *fname, |
557 |
> |
register char **pathlist |
558 |
> |
) |
559 |
|
{ |
560 |
|
static char ffname[128]; |
542 |
– |
char *strcpy(), *strcat(); |
561 |
|
register int fd; |
562 |
|
|
563 |
|
if (fname[0] == '/') |
577 |
|
|
578 |
|
|
579 |
|
int |
580 |
< |
mgcurve(c, f) /* get a curve's (unmapped) values */ |
581 |
< |
int c; |
582 |
< |
int (*f)(); |
580 |
> |
mgcurve( /* get a curve's (unmapped) values */ |
581 |
> |
int c, |
582 |
> |
void (*f)(int c, double x, double y) |
583 |
> |
) |
584 |
|
{ |
585 |
|
int nargs; |
586 |
|
double x[2], step; |
587 |
|
register VARIABLE *cv; |
588 |
|
register float *p; |
589 |
< |
register int npts; |
589 |
> |
register int npts = 0; |
590 |
|
|
591 |
|
if (c < 0 || c >= MAXCUR) |
592 |
|
return(-1); |