1 |
/* RCSid: $Id$ */ |
2 |
/* |
3 |
* mgvars.h - header file for graphing routines using variables. |
4 |
* |
5 |
* 6/23/86 |
6 |
* |
7 |
* Greg Ward Larson |
8 |
*/ |
9 |
|
10 |
/* |
11 |
* Data arrays are used to store point data. |
12 |
*/ |
13 |
|
14 |
typedef struct { |
15 |
int size; /* the size of the array */ |
16 |
float *data; /* pointer to the array */ |
17 |
} DARRAY; |
18 |
|
19 |
/* |
20 |
* Intermediate variables are not referenced |
21 |
* directly by the program, but may be used |
22 |
* for defining other variables. |
23 |
*/ |
24 |
|
25 |
typedef struct ivar { |
26 |
char *name; /* the variable name */ |
27 |
char *dfn; /* its definition */ |
28 |
struct ivar *next; /* next in list */ |
29 |
} IVAR; /* an intermediate variable */ |
30 |
|
31 |
/* |
32 |
* Variables are used for all graph parameters. The four variable |
33 |
* types are: REAL, FUNCTION, STRING and DATA. |
34 |
* Of these, only STRING and DATA must be interpreted by us; an |
35 |
* expression parser will handle the rest. |
36 |
*/ |
37 |
/* standard variables */ |
38 |
#define FTHICK 0 /* frame thickness */ |
39 |
#define GRID 1 /* grid on? */ |
40 |
#define LEGEND 2 /* legend title */ |
41 |
#define OTHICK 3 /* origin thickness */ |
42 |
#define PERIOD 4 /* period of polar plot */ |
43 |
#define SUBTITLE 5 /* subtitle */ |
44 |
#define SYMFILE 6 /* symbol file */ |
45 |
#define TSTYLE 7 /* tick mark style */ |
46 |
#define TITLE 8 /* title */ |
47 |
#define XLABEL 9 /* x axis label */ |
48 |
#define XMAP 10 /* x axis mapping */ |
49 |
#define XMAX 11 /* x axis maximum */ |
50 |
#define XMIN 12 /* x axis minimum */ |
51 |
#define XSTEP 13 /* x axis step */ |
52 |
#define YLABEL 14 /* y axis label */ |
53 |
#define YMAP 15 /* y axis mapping */ |
54 |
#define YMAX 16 /* y axis maximum */ |
55 |
#define YMIN 17 /* y axis minimum */ |
56 |
#define YSTEP 18 /* y axis step */ |
57 |
|
58 |
#define NVARS 19 /* number of standard variables */ |
59 |
|
60 |
/* curve variables */ |
61 |
#define C 0 /* the curve function */ |
62 |
#define CCOLOR 1 /* the curve color */ |
63 |
#define CDATA 2 /* the curve data */ |
64 |
#define CLABEL 3 /* the curve label */ |
65 |
#define CLINTYPE 4 /* the curve line type */ |
66 |
#define CNPOINTS 5 /* number of curve points to plot */ |
67 |
#define CSYMSIZE 6 /* the curve symbol size */ |
68 |
#define CSYMTYPE 7 /* the curve symbol type */ |
69 |
#define CTHICK 8 /* the curve line thickness */ |
70 |
|
71 |
#define NCVARS 9 /* number of curve variables */ |
72 |
|
73 |
#define MAXCUR 8 /* maximum number of curves */ |
74 |
|
75 |
/* types */ |
76 |
#define REAL 1 /* floating point */ |
77 |
#define STRING 2 /* character array */ |
78 |
#define FUNCTION 3 /* function definition */ |
79 |
#define DATA 4 /* a set of real points */ |
80 |
|
81 |
/* flags */ |
82 |
#define DEFINED 01 /* variable is defined */ |
83 |
|
84 |
typedef struct { |
85 |
char *name; /* the variable name */ |
86 |
short type; /* the variable type */ |
87 |
char *descrip; /* brief description */ |
88 |
unsigned short flags; /* DEFINED, etc. */ |
89 |
union { |
90 |
char *s; /* STRING value */ |
91 |
DARRAY d; /* DATA value */ |
92 |
char *dfn; /* variable definition */ |
93 |
} v; /* value */ |
94 |
} VARIABLE; /* a variable */ |
95 |
|
96 |
extern IVAR *ivhead; /* the intermediate list */ |
97 |
|
98 |
extern VARIABLE gparam[NVARS]; /* the graph variables */ |
99 |
extern VARIABLE cparam[MAXCUR][NCVARS]; /* the curve variables */ |
100 |
|
101 |
extern VARIABLE *vlookup(); |
102 |
|
103 |
extern double varvalue(), funvalue(); |
104 |
|
105 |
extern int errno; |
106 |
|
107 |
#define mgclear(vname) undefine(vlookup(vname)) |