[418] | 1 | /*
|
---|
| 2 | * $Source: /tmp_mnt/n/fs/grad1/jsp/src/jgraph/RCS/jgraph.h,v $
|
---|
| 3 | * $Revision: 8.3 $
|
---|
| 4 | * $Date: 92/11/30 11:42:24 $
|
---|
| 5 | * $Author: jsp $
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #include "list.h"
|
---|
| 9 | #include "prio_list.h"
|
---|
| 10 | #ifdef LCC
|
---|
| 11 | #include <stdlib.h>
|
---|
| 12 | #endif
|
---|
| 13 |
|
---|
| 14 | #define PPI 120
|
---|
| 15 | #define FPPI 120.0
|
---|
| 16 | #define CPI 72.0
|
---|
| 17 | #define FCPI 72.0
|
---|
| 18 | #define CNULL ((char *)0)
|
---|
| 19 | #define GMNULL ((Point)0)
|
---|
| 20 | #define FSIG -10010.0
|
---|
| 21 | #define ISIG -11111111
|
---|
| 22 | #define HASH_SIZE 5.0
|
---|
| 23 | #define MHASH_SIZE 2.0
|
---|
| 24 |
|
---|
| 25 | typedef struct point {
|
---|
| 26 | struct point *flink;
|
---|
| 27 | struct point *blink;
|
---|
| 28 | float x;
|
---|
| 29 | float y;
|
---|
| 30 | char e; /* 'x' for x_ebars, 'y' for y_ebars, 'p' for neither */
|
---|
| 31 | } *Point;
|
---|
| 32 |
|
---|
| 33 | typedef struct flist {
|
---|
| 34 | struct flist *flink;
|
---|
| 35 | struct flist *blink;
|
---|
| 36 | float f;
|
---|
| 37 | } *Flist;
|
---|
| 38 |
|
---|
| 39 | typedef struct label {
|
---|
| 40 | char *label;
|
---|
| 41 | float x;
|
---|
| 42 | float y;
|
---|
| 43 | float rotate;
|
---|
| 44 | char *font;
|
---|
| 45 | float fontsize;
|
---|
| 46 | char hj;
|
---|
| 47 | char vj;
|
---|
| 48 | float gray[3];
|
---|
| 49 | char graytype;
|
---|
| 50 | float linesep;
|
---|
| 51 | float xmin;
|
---|
| 52 | float xmax;
|
---|
| 53 | float ymin;
|
---|
| 54 | float ymax;
|
---|
| 55 | int nlines;
|
---|
| 56 | } *Label;
|
---|
| 57 |
|
---|
| 58 | typedef struct curve {
|
---|
| 59 | struct curve *flink;
|
---|
| 60 | struct curve *blink;
|
---|
| 61 | int num;
|
---|
| 62 | Label l;
|
---|
| 63 | Label lmark;
|
---|
| 64 | Point pts;
|
---|
| 65 | Point yepts;
|
---|
| 66 | Point xepts;
|
---|
| 67 | int npts;
|
---|
| 68 | Point general_marks;
|
---|
| 69 | float marksize[2];
|
---|
| 70 | float fill[3];
|
---|
| 71 | float gray[3];
|
---|
| 72 | float afill[3];
|
---|
| 73 | float pfill[3];
|
---|
| 74 | float linethick;
|
---|
| 75 | float mrotate;
|
---|
| 76 | Flist gen_linetype;
|
---|
| 77 | char graytype ;
|
---|
| 78 | char filltype ;
|
---|
| 79 | char afilltype;
|
---|
| 80 | char pfilltype;
|
---|
| 81 | char pattern;
|
---|
| 82 | float parg;
|
---|
| 83 | char apattern;
|
---|
| 84 | float aparg;
|
---|
| 85 | char ppattern;
|
---|
| 86 | float pparg;
|
---|
| 87 | char marktype;
|
---|
| 88 | char linetype;
|
---|
| 89 | char *postscript;
|
---|
| 90 | char *eps;
|
---|
| 91 | int postfile;
|
---|
| 92 | int rarrow;
|
---|
| 93 | int larrow;
|
---|
| 94 | int rarrows;
|
---|
| 95 | int larrows;
|
---|
| 96 | int bezier;
|
---|
| 97 | int poly;
|
---|
| 98 | float asize[2];
|
---|
| 99 | int clip;
|
---|
| 100 | } *Curve;
|
---|
| 101 |
|
---|
| 102 | typedef struct string {
|
---|
| 103 | struct string *flink;
|
---|
| 104 | struct string *blink;
|
---|
| 105 | int num;
|
---|
| 106 | Label s;
|
---|
| 107 | } *String;
|
---|
| 108 |
|
---|
| 109 | typedef struct hash {
|
---|
| 110 | struct hash *flink;
|
---|
| 111 | struct hash *blink;
|
---|
| 112 | float loc;
|
---|
| 113 | float size;
|
---|
| 114 | int major;
|
---|
| 115 | } *Hash;
|
---|
| 116 |
|
---|
| 117 | typedef struct deflt {
|
---|
| 118 | float rotate;
|
---|
| 119 | float fontsize;
|
---|
| 120 | Point general_marks;
|
---|
| 121 | float fill;
|
---|
| 122 | float linethick;
|
---|
| 123 | float marksize[2];
|
---|
| 124 | char *font;
|
---|
| 125 | char hj;
|
---|
| 126 | char vj;
|
---|
| 127 | char marktype;
|
---|
| 128 | } *Default;
|
---|
| 129 |
|
---|
| 130 | typedef struct axis {
|
---|
| 131 | Label label;
|
---|
| 132 | Label hl;
|
---|
| 133 | float max;
|
---|
| 134 | float min;
|
---|
| 135 | float pmax;
|
---|
| 136 | float pmin;
|
---|
| 137 | float logmin;
|
---|
| 138 | float logfactor;
|
---|
| 139 | float size;
|
---|
| 140 | float psize;
|
---|
| 141 | float factor;
|
---|
| 142 | float hash_interval;
|
---|
| 143 | float hash_start;
|
---|
| 144 | float hash_scale;
|
---|
| 145 | float log_base;
|
---|
| 146 | float draw_hash_marks_at;
|
---|
| 147 | float draw_hash_labels_at;
|
---|
| 148 | float draw_at;
|
---|
| 149 | float gray[3];
|
---|
| 150 | char graytype;
|
---|
| 151 | float gr_gray[3];
|
---|
| 152 | char gr_graytype;
|
---|
| 153 | float mgr_gray[3];
|
---|
| 154 | char mgr_graytype;
|
---|
| 155 | char hash_format;
|
---|
| 156 | int grid_lines;
|
---|
| 157 | int mgrid_lines;
|
---|
| 158 | int draw_hash_labels;
|
---|
| 159 | int draw_axis_line;
|
---|
| 160 | int draw_hash_marks;
|
---|
| 161 | int draw_axis_label;
|
---|
| 162 | int auto_hash_labels;
|
---|
| 163 | int auto_hash_marks;
|
---|
| 164 | int minor_hashes;
|
---|
| 165 | int precision;
|
---|
| 166 | int start_given;
|
---|
| 167 | String hash_labels;
|
---|
| 168 | Hash hash_lines;
|
---|
| 169 | int is_x;
|
---|
| 170 | int is_lg;
|
---|
| 171 | } *Axis;
|
---|
| 172 |
|
---|
| 173 | typedef struct legend {
|
---|
| 174 | float linelength;
|
---|
| 175 | float linebreak;
|
---|
| 176 | int anylines;
|
---|
| 177 | float midspace;
|
---|
| 178 | char type; /* 'n' = off, 'u' = userdefined (use Label), 'c' = custom */
|
---|
| 179 | Label l;
|
---|
| 180 | } *Legend;
|
---|
| 181 |
|
---|
| 182 | typedef struct graph {
|
---|
| 183 | struct graph *flink;
|
---|
| 184 | struct graph *blink;
|
---|
| 185 | int num;
|
---|
| 186 | float xminval;
|
---|
| 187 | float yminval;
|
---|
| 188 | float xmaxval;
|
---|
| 189 | float ymaxval;
|
---|
| 190 | float x_translate;
|
---|
| 191 | float y_translate;
|
---|
| 192 | Axis x_axis;
|
---|
| 193 | Axis y_axis;
|
---|
| 194 | Curve curves;
|
---|
| 195 | Legend legend;
|
---|
| 196 | String strings;
|
---|
| 197 | Label title;
|
---|
| 198 | int clip;
|
---|
| 199 | int border;
|
---|
| 200 | Default def;
|
---|
| 201 | } *Graph;
|
---|
| 202 |
|
---|
| 203 | typedef struct graphs {
|
---|
| 204 | struct graphs *flink;
|
---|
| 205 | struct graphs *blink;
|
---|
| 206 | Graph g;
|
---|
| 207 | float height;
|
---|
| 208 | float width;
|
---|
| 209 | int bb[4]; /* Bounding box */
|
---|
| 210 | char *preamble;
|
---|
| 211 | char *epilogue;
|
---|
| 212 | int prefile;
|
---|
| 213 | int epifile;
|
---|
| 214 | int page;
|
---|
| 215 | } *Graphs;
|
---|
| 216 |
|
---|
| 217 | extern float ctop();
|
---|
| 218 | extern float disttop();
|
---|
| 219 | extern float intop();
|
---|
| 220 | extern float ptoc();
|
---|
| 221 | extern float ptodist();
|
---|
| 222 |
|
---|
| 223 | extern char *getlabel();
|
---|
| 224 | extern char *getmultiline();
|
---|
| 225 |
|
---|
| 226 | /* Stuff defined in jgraph.c */
|
---|
| 227 |
|
---|
| 228 | extern Curve new_line();
|
---|
| 229 | extern Curve new_curve();
|
---|
| 230 | extern Curve get_curve();
|
---|
| 231 | extern Graph new_graph();
|
---|
| 232 | extern Graph get_graph();
|
---|
| 233 | extern String new_string();
|
---|
| 234 | extern String get_string();
|
---|
| 235 | extern Label new_label();
|
---|
| 236 | extern char *MARKTYPESTRS[];
|
---|
| 237 | extern char MARKTYPES[];
|
---|
| 238 | extern int NMARKTYPES;
|
---|
| 239 | extern int NORMALMARKTYPES;
|
---|
| 240 | extern char *PATTERNS[];
|
---|
| 241 | extern char PTYPES[];
|
---|
| 242 | extern int NPATTERNS;
|
---|
[420] | 243 |
|
---|
| 244 | void new_graphs(Graphs gs);
|
---|
| 245 |
|
---|
| 246 | /* Stuff defined in printline.c */
|
---|
| 247 |
|
---|
| 248 | void print_label(Label l);
|
---|
| 249 | void set_comment(int c);
|
---|
| 250 | void comment(char *s);
|
---|
| 251 | void gsave(void);
|
---|
| 252 | void grestore(void);
|
---|
| 253 | void setlinewidth(float size);
|
---|
| 254 | void setlinestyle(char style, Flist glist);
|
---|
| 255 | void print_ebar(float x1, float y1, float x2, float ms, char orientation);
|
---|
| 256 | void start_line(float x1, float y1, Curve c);
|
---|
| 257 | void bezier_control(float x1, float y1);
|
---|
| 258 | void bezier_end(float x1, float y1);
|
---|
| 259 | void end_line(void);
|
---|
| 260 | void setfill(float x, float y, char t, float f[], char p, float a);
|
---|
| 261 | void cont_line(float x1, float y1);
|
---|
| 262 | void setgray(char t, float f[]);
|
---|
| 263 | void printline(float x1, float y1, float x2, float y2, char orientation);
|
---|
| 264 | void start_poly(float x1, float y1);
|
---|
| 265 | void cont_poly(float x1, float y1);
|
---|
| 266 | void end_poly(float x, float y, char ftype, float fill[],
|
---|
| 267 | char pattern, float parg);
|
---|
| 268 | void printellipse(float x, float y, float radius1, float radius2,
|
---|
| 269 | char ftype, float fill[], char pattern, float parg);
|
---|
| 270 | void setfont(char *f, float s);
|
---|
| 271 |
|
---|
| 272 | /* Stuff defined in edit.c */
|
---|
| 273 |
|
---|
| 274 | void copy_label(Label l1, Label l2);
|
---|
| 275 | void edit_graphs(Graphs gs);
|
---|
| 276 |
|
---|
| 277 | /* Stuff defined in token.c */
|
---|
| 278 |
|
---|
| 279 | void set_input_file(char *s);
|
---|
| 280 | int getint(int *i);
|
---|
| 281 | int getstring(char *s);
|
---|
| 282 | int getfloat(float *f);
|
---|
| 283 | void rejecttoken(void);
|
---|
| 284 |
|
---|
| 285 | /* Stuff defined in process.c */
|
---|
| 286 |
|
---|
| 287 | void process_graphs(Graphs gs);
|
---|
| 288 |
|
---|
| 289 | /* Stuff defined in show.c */
|
---|
| 290 |
|
---|
| 291 | void show_graphs(Graphs gs);
|
---|
| 292 |
|
---|
| 293 | /* Stuff defined in draw.c */
|
---|
| 294 |
|
---|
| 295 | void draw_graphs(Graphs gs, int pp, int landscape);
|
---|