1#define dprintf if(dbg)printf 2 3#define HEAD1 1 4#define HEAD2 2 5#define HEAD12 (HEAD1+HEAD2) 6#define INVIS 4 7#define CW_ARC 8 /* clockwise arc */ 8#define SHADEDOBJ 16 /* Object should be drawn shaded */ 9#define WHITEOBJ 32 /* Object should be whitened inside */ 10#define PI 3.141592654 11#define PI2 PI/2 12#define SCALE 1.0 /* default scale: units/inch */ 13#define WID 0.75 /* default width for boxes and ellipses */ 14#define WID2 0.375 15#define HT 0.5 /* default height and line length */ 16#define HT2 0.25 /* because no floating init exprs! */ 17#define HT5 0.1 18#define HT10 0.05 19 20#define MAXOBJ 1200 21#define MAXTEXT 1200 22#define SYMTAB 200 23#define DEV202 1 24#define DEVAPS 2 25#define DEVCAT 3 26#define DEV450 4 27#define DEVVER 5 28#define DEVCAN 6 29 30/* these have to be like so, so that we can write */ 31/* things like R & V, etc. */ 32#define H 0 33#define V 1 34#define R_DIR 0 35#define U_DIR 1 36#define L_DIR 2 37#define D_DIR 3 38#define ishor(n) (((n) & V) == 0) 39#define isvert(n) (((n) & V) != 0) 40#define isright(n) ((n) == R_DIR) 41#define isleft(n) ((n) == L_DIR) 42#define isdown(n) ((n) == D_DIR) 43#define isup(n) ((n) == U_DIR) 44 45typedef union { /* the yacc stack type */ 46 int i; 47 char *p; 48 struct obj *o; 49 float f; 50} YYSTYPE; 51 52extern YYSTYPE yylval, yyval; 53 54struct attr { /* attribute of an object */ 55 int a_type; 56 YYSTYPE a_val; 57}; 58 59struct obj { /* stores various things in variable length */ 60 int o_type; 61 int o_count; /* number of things */ 62 int o_nobj; /* index in objlist */ 63 int o_mode; /* hor or vert */ 64 float o_x; /* coord of "center" */ 65 float o_y; 66 int o_nt1; /* 1st index in text[] for this object */ 67 int o_nt2; /* 2nd; difference is #text strings */ 68 int o_attr; /* various attributes of interest */ 69 int o_dotdash; /* kludge in a dot/dash mode */ 70 float o_ddval; /* value of dot/dash expression */ 71 float o_val[1]; /* actually this will be > 1 in general */ 72 /* type is not always FLOAT!!!! */ 73}; 74 75struct symtab { 76 char *s_name; 77 int s_type; 78 YYSTYPE s_val; 79 struct symtab *s_next; 80}; 81 82struct text { 83 int t_type; 84 char *t_val; 85}; 86 87extern int dbg; 88extern struct obj *objlist[]; 89extern int nobj; 90extern struct attr attr[]; 91extern int nattr; 92extern struct text text[]; 93extern int ntext; 94extern int ntext1; 95extern float curx, cury; 96extern int hvmode; 97extern int codegen; 98extern char *malloc(), *tostring(); 99extern float getfval(), getcomp(); 100extern YYSTYPE *getvar(); 101extern struct symtab *lookup(), *makevar(); 102 103extern float deltx, delty; 104extern int lineno; 105extern int synerr; 106extern int crop; 107extern int res; 108 109extern float sxmin, sxmax, symin, symax; 110extern float xmin, ymin, xmax, ymax; 111extern struct obj *leftthing(), *boxgen(), *circgen(), *arcgen(); 112extern struct obj *linegen(), *splinegen(), *movegen(), *textgen(); 113extern struct obj *TeXgen(), *rightthing(), *blockgen(); 114extern struct obj *makenode(), *makepos(), *fixpos(), *makebetween(); 115extern struct obj *getpos(), *gethere(), *getfirst(), *getlast(), *getblock() 116; 117 118struct pushstack { 119 float p_x; 120 float p_y; 121 int p_hvmode; 122 float p_xmin; 123 float p_ymin; 124 float p_xmax; 125 float p_ymax; 126 struct symtab *p_symtab; 127}; 128extern struct pushstack stack[]; 129extern int nstack; 130 131extern float atof(); 132