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