|
|
1.1 root 1: #define dprintf if(dbg)printf
2:
3: #define DEFAULT 0
4:
5: #define HEAD1 1
6: #define HEAD2 2
7: #define HEAD12 (HEAD1+HEAD2)
8: #define INVIS 4
9: #define CW_ARC 8 /* clockwise arc */
10: #define DOTBIT 16
11: #define DASHBIT 32
12:
13: #define CENTER 01 /* text attributes */
14: #define LJUST 02
15: #define RJUST 04
16: #define ABOVE 010
17: #define BELOW 020
18: #define SPREAD 040
19: #define FILL 0100
20:
21: #define SCALE 1.0 /* default scale: units/inch */
22: #define WID 0.75 /* default width for boxes and ellipses */
23: #define WID2 0.375
24: #define HT 0.5 /* default height and line length */
25: #define HT2 0.25 /* because no floating init exprs! */
26: #define HT5 0.1
27: #define HT10 0.05
28:
29: /* these have to be like so, so that we can write */
30: /* things like R & V, etc. */
31: #define H 0
32: #define V 1
33: #define R_DIR 0
34: #define U_DIR 1
35: #define L_DIR 2
36: #define D_DIR 3
37: #define ishor(n) (((n) & V) == 0)
38: #define isvert(n) (((n) & V) != 0)
39: #define isright(n) ((n) == R_DIR)
40: #define isleft(n) ((n) == L_DIR)
41: #define isdown(n) ((n) == D_DIR)
42: #define isup(n) ((n) == U_DIR)
43:
44: typedef struct Point {
45: float x;
46: float y;
47: };
48:
49: typedef struct obj { /* stores various things in variable length */
50: int o_type;
51: int o_count; /* number of things */
52: int o_nobj; /* index in objlist */
53: int o_mode; /* hor or vert */
54: float o_x; /* coord of "center" */
55: float o_y;
56: int o_nt1; /* 1st index in text[] for this object */
57: int o_nt2; /* 2nd; difference is #text strings */
58: int o_attr; /* HEAD, CW, INVIS go here */
59: int o_size; /* linesize */
60: int o_nhead; /* arrowhead style */
61: struct symtab *o_symtab; /* symtab for [...] */
62: float o_ddval; /* value of dot/dash expression */
63: float o_val[1]; /* actually this will be > 1 in general */
64: /* type is not always FLOAT!!!! */
65: } obj;
66:
67: typedef union { /* the yacc stack type */
68: int i;
69: char *p;
70: obj *o;
71: float f;
72: } YYSTYPE;
73:
74: extern YYSTYPE yylval, yyval;
75:
76: struct symtab {
77: char *s_name;
78: int s_type;
79: YYSTYPE s_val;
80: struct symtab *s_next;
81: };
82:
83: typedef struct { /* attribute of an object */
84: int a_type;
85: int a_sub;
86: YYSTYPE a_val;
87: } Attr;
88:
89: typedef struct {
90: int t_type; /* CENTER, LJUST, etc. */
91: char t_op; /* optional sign for size changes */
92: char t_size; /* size, abs or rel */
93: char *t_val;
94: } Text;
95:
96: #define String 01
97: #define Macro 02
98: #define File 04
99: #define Char 010
100: #define Thru 020
101: #define Free 040
102:
103: typedef struct { /* input source */
104: int type; /* Macro, String, File */
105: char *sp; /* if String or Macro */
106: } Src;
107:
108: extern Src src[], *srcp; /* input source stack */
109:
110: typedef struct {
111: FILE *fin;
112: char *fname;
113: int lineno;
114: } Infile;
115:
116: extern Infile infile[], *curfile;
117:
118: #define MAXARGS 20
119: typedef struct { /* argument stack */
120: char *argstk[MAXARGS]; /* pointers to args */
121: char *argval; /* points to space containing args */
122: } Arg;
123:
124: extern int dbg;
125: extern obj **objlist;
126: extern int nobj, nobjlist;
127: extern Attr *attr;
128: extern int nattr, nattrlist;
129: extern Text *text;
130: extern int ntextlist;
131: extern int ntext;
132: extern int ntext1;
133: extern float curx, cury;
134: extern int hvmode;
135: extern int codegen;
136: extern char *malloc(), *realloc(), *tostring(), *grow();
137: extern float getfval(), getcomp(), getblkvar();
138: extern YYSTYPE getvar();
139: extern struct symtab *lookup(), *makevar();
140: extern char *ifstat(), *delimstr(), *sprintgen();
141:
142: extern float deltx, delty;
143: extern int lineno;
144: extern int synerr;
145:
146: extern float xmin, ymin, xmax, ymax;
147: extern obj *leftthing(), *boxgen(), *circgen(), *arcgen();
148: extern obj *linegen(), *splinegen(), *movegen(), *textgen(), *plotgen();
149: extern obj *troffgen(), *rightthing(), *blockgen();
150: extern obj *makenode(), *makepos(), *fixpos(), *addpos(), *subpos(), *makebetween();
151: extern obj *getpos(), *gethere(), *getfirst(), *getlast(), *getblock();
152:
153: struct pushstack {
154: float p_x;
155: float p_y;
156: int p_hvmode;
157: float p_xmin;
158: float p_ymin;
159: float p_xmax;
160: float p_ymax;
161: struct symtab *p_symtab;
162: };
163: extern struct pushstack stack[];
164: extern int nstack;
165: extern int cw;
166:
167: extern double errcheck();
168: #define Log10(x) errcheck(log10(x), "log")
169: #define Exp(x) errcheck(exp(x), "exp")
170: #define Sqrt(x) errcheck(sqrt(x), "sqrt")
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.