Back to index

radiance  4R0+20100331
mgvars.h
Go to the documentation of this file.
00001 /* RCSid: $Id: mgvars.h,v 1.4 2003/11/15 02:13:37 schorsch Exp $ */
00002 /*
00003  *  mgvars.h - header file for graphing routines using variables.
00004  *
00005  *     6/23/86
00006  *
00007  *     Greg Ward Larson
00008  */
00009 #ifndef _RAD_MGVARS_H_
00010 #define _RAD_MGVARS_H_
00011 
00012 #include <errno.h>
00013 
00014 #include "calcomp.h"
00015 
00016 #ifdef __cplusplus
00017 extern "C" {
00018 #endif
00019 
00020 /*
00021  *  Data arrays are used to store point data.
00022  */
00023 
00024 typedef struct {
00025        int  size;           /* the size of the array */
00026        float  *data;        /* pointer to the array */
00027 }  DARRAY;
00028 
00029 /*
00030  *  Intermediate variables are not referenced
00031  *  directly by the program, but may be used
00032  *  for defining other variables.
00033  */
00034 
00035 typedef struct ivar {
00036        char  *name;         /* the variable name */
00037        char  *dfn;          /* its definition */
00038        struct ivar  *next;  /* next in list */
00039 }  IVAR;             /* an intermediate variable */
00040 
00041 /*
00042  *  Variables are used for all graph parameters.  The four variable
00043  *  types are:  REAL, FUNCTION, STRING and DATA.
00044  *  Of these, only STRING and DATA must be interpreted by us; an
00045  *  expression parser will handle the rest.
00046  */
00047                             /* standard variables */
00048 #define  FTHICK             0             /* frame thickness */
00049 #define  GRID        1             /* grid on? */
00050 #define  LEGEND             2             /* legend title */
00051 #define  OTHICK             3             /* origin thickness */
00052 #define  PERIOD             4             /* period of polar plot */
00053 #define  SUBTITLE    5             /* subtitle */
00054 #define  SYMFILE     6             /* symbol file */
00055 #define  TSTYLE             7             /* tick mark style */
00056 #define  TITLE              8             /* title */
00057 #define  XLABEL             9             /* x axis label */
00058 #define  XMAP        10            /* x axis mapping */
00059 #define  XMAX        11            /* x axis maximum */
00060 #define  XMIN        12            /* x axis minimum */
00061 #define  XSTEP              13            /* x axis step */
00062 #define  YLABEL             14            /* y axis label */
00063 #define  YMAP        15            /* y axis mapping */
00064 #define  YMAX        16            /* y axis maximum */
00065 #define  YMIN        17            /* y axis minimum */
00066 #define  YSTEP              18            /* y axis step */
00067 
00068 #define  NVARS              19     /* number of standard variables */
00069 
00070                             /* curve variables */
00071 #define  C           0             /* the curve function */
00072 #define  CCOLOR             1             /* the curve color */
00073 #define  CDATA              2             /* the curve data */
00074 #define  CLABEL             3             /* the curve label */
00075 #define  CLINTYPE    4             /* the curve line type */
00076 #define  CNPOINTS    5             /* number of curve points to plot */
00077 #define  CSYMSIZE    6             /* the curve symbol size */
00078 #define  CSYMTYPE    7             /* the curve symbol type */
00079 #define  CTHICK             8             /* the curve line thickness */
00080 
00081 #define  NCVARS             9      /* number of curve variables */
00082 
00083 #define  MAXCUR             8      /* maximum number of curves */
00084 
00085                             /* types */
00086 #define  REAL        1             /* floating point */
00087 #define  STRING             2             /* character array */
00088 #define  FUNCTION    3             /* function definition */
00089 #define  DATA        4             /* a set of real points */
00090 
00091                             /* flags */
00092 #define  DEFINED     01            /*  variable is defined */
00093 
00094 typedef struct {
00095        char  *name;         /* the variable name */
00096        short  type;         /* the variable type */
00097        char  *descrip;             /* brief description */
00098        unsigned short  flags;      /* DEFINED, etc. */
00099        union {
00100               char  *s;            /* STRING value */
00101               DARRAY  d;           /* DATA value */
00102               char  *dfn;          /* variable definition */
00103        } v;                 /* value */
00104 }  VARIABLE;         /* a variable */
00105 
00106 extern IVAR  *ivhead;                            /* the intermediate list */
00107 
00108 extern VARIABLE  gparam[NVARS];                  /* the graph variables */
00109 extern VARIABLE  cparam[MAXCUR][NCVARS];  /* the curve variables */
00110 
00111 extern VARIABLE  *vlookup();
00112 
00113 #define  mgclear(vname)            undefine(vlookup(vname))
00114 
00115 extern void mgclearall(void);
00116 extern void mgload(char *file);
00117 extern void mgsave(char *file);
00118 extern void setmgvar(char *fname, FILE *fp, char *string);
00119 extern int mgcurve(int c, void (*f)(int c, double x, double y));
00120 extern void mgtoa(register char *s, VARIABLE *vp);
00121 
00122 
00123 #ifdef __cplusplus
00124 }
00125 #endif
00126 #endif /* _RAD_MGVARS_H_ */
00127