2 #define PI 3.1415926535897932384626433832795028841971693993751
5 #define MAXWID 8.5 /* default limits max picture to 8.5 x 11; */
6 #define MAXHT 11 /* change to taste without peril */
8 #define dprintf if(dbg)printf
10 extern void yyerror(char *);
12 extern char errbuf
[200];
13 #define ERROR sprintf(errbuf,
14 #define FATAL ), yyerror(errbuf), exit(1)
15 #define WARNING ), yyerror(errbuf)
21 #define HEAD12 (HEAD1+HEAD2)
23 #define CW_ARC 8 /* clockwise arc */
24 #define DOTBIT 16 /* line styles */
26 #define FILLBIT 64 /* gray-fill on boxes, etc. */
27 #define NOEDGEBIT 128 /* no edge on filled object */
29 #define CENTER 01 /* text attributes */
36 #define SCALE 1.0 /* default scale: units/inch */
37 #define WID 0.75 /* default width for boxes and ellipses */
39 #define HT 0.5 /* default height and line length */
44 /* these have to be like so, so that we can write */
45 /* things like R & V, etc. */
52 #define ishor(n) (((n) & V) == 0)
53 #define isvert(n) (((n) & V) != 0)
54 #define isright(n) ((n) == R_DIR)
55 #define isleft(n) ((n) == L_DIR)
56 #define isdown(n) ((n) == D_DIR)
57 #define isup(n) ((n) == U_DIR)
59 typedef float ofloat
; /* for o_val[] in obj; could be double */
61 typedef struct obj
{ /* stores various things in variable length */
63 int o_count
; /* number of things */
64 int o_nobj
; /* index in objlist */
65 int o_mode
; /* hor or vert */
66 float o_x
; /* coord of "center" */
68 int o_nt1
; /* 1st index in text[] for this object */
69 int o_nt2
; /* 2nd; difference is #text strings */
70 int o_attr
; /* HEAD, CW, INVIS, etc., go here */
71 int o_size
; /* linesize */
72 int o_nhead
; /* arrowhead style */
73 struct symtab
*o_symtab
; /* symtab for [...] */
74 float o_ddval
; /* value of dot/dash expression */
75 float o_fillval
; /* gray scale value */
76 ofloat o_val
[1]; /* actually this will be > 1 in general */
77 /* type is not always FLOAT!!!! */
80 typedef union { /* the yacc stack type */
88 extern YYSTYPE yylval
, yyval
;
94 struct symtab
*s_next
;
97 typedef struct { /* attribute of an object */
104 int t_type
; /* CENTER, LJUST, etc. */
105 char t_op
; /* optional sign for size changes */
106 char t_size
; /* size, abs or rel */
117 typedef struct { /* input source */
118 int type
; /* Macro, String, File */
119 char *sp
; /* if String or Macro */
122 extern Src src
[], *srcp
; /* input source stack */
130 extern Infile infile
[], *curfile
;
133 typedef struct { /* argument stack */
134 char *argstk
[MAXARGS
]; /* pointers to args */
135 char *argval
; /* points to space containing args */
139 extern obj
**objlist
;
140 extern int nobj
, nobjlist
;
142 extern int nattr
, nattrlist
;
144 extern int ntextlist
;
147 extern double curx
, cury
;
150 extern char *PEstring
;
152 char *tostring(char *);
153 char *grow(char *, char *, int, int);
154 double getfval(char *), getcomp(obj
*, int), getblkvar(obj
*, char *);
155 YYSTYPE
getvar(char *);
156 struct symtab
*lookup(char *), *makevar(char *, int, YYSTYPE
);
157 char *ifstat(double, char *, char *), *delimstr(char *), *sprintgen(char *);
158 void forloop(char *var
, double from
, double to
, int op
, double by
, char *_str
);
159 int setdir(int), curdir(void);
161 void checkscale(char *);
162 void pushsrc(int, char *);
164 void copyuntil(char *);
165 void copyfile(char *);
166 void copydef(struct symtab
*);
167 void definition(char *);
168 struct symtab
*copythru(char *);
171 void extreme(double, double);
173 extern double deltx
, delty
;
177 extern double xmin
, ymin
, xmax
, ymax
;
179 obj
*leftthing(int), *boxgen(void), *circgen(int), *arcgen(int);
180 obj
*linegen(int), *splinegen(void), *movegen(void);
181 obj
*textgen(void), *plotgen(void);
182 obj
*troffgen(char *), *rightthing(obj
*, int), *blockgen(obj
*, obj
*);
183 obj
*makenode(int, int), *makepos(double, double);
184 obj
*fixpos(obj
*, double, double);
185 obj
*addpos(obj
*, obj
*), *subpos(obj
*, obj
*);
186 obj
*makebetween(double, obj
*, obj
*);
187 obj
*getpos(obj
*, int), *gethere(void), *getfirst(int, int);
188 obj
*getlast(int, int), *getblock(obj
*, char *);
189 void savetext(int, char *);
190 void makeiattr(int, int);
191 void makevattr(char *);
192 void makefattr(int type
, int sub
, double f
);
193 void maketattr(int, char *);
194 void makeoattr(int, obj
*);
195 void makeattr(int type
, int sub
, YYSTYPE val
);
196 void printexpr(double);
197 void printpos(obj
*);
198 void exprsave(double);
200 void printlf(int, char *);
210 struct symtab
*p_symtab
;
212 extern struct pushstack stack
[];
216 extern double errcheck(double, char *);
217 #define Log10(x) errcheck(log10(x), "log")
218 #define Exp(x) errcheck(exp(x), "exp")
219 #define Sqrt(x) errcheck(sqrt(x), "sqrt")