te: prevent tbl from dropping the last character of a file
[troff.git] / grap / grap.h
blob65c7f83f28e078ac011e6ff63e9949b4620554ef
1 extern char errbuf[200];
2 #define ERROR sprintf(errbuf,
3 #define FATAL ), yyerror(errbuf), exit(1)
4 #define WARNING ), yyerror(errbuf)
6 #define dprintf if(dbg)printf
8 #define String 01
9 #define Macro 02
10 #define File 04
11 #define Char 010
12 #define Thru 020
13 #define Free 040
15 #define MARGIN 0.07 /* default margin around data */
16 #define SLOP 1.001 /* slop for limits of for loops */
17 #define FRAMEWID 3 /* default width for boxes and ellipses */
18 #define FRAMEHT 2 /* default height and line length */
19 #define TICKLEN 0.1
21 #define MAXNUM 200
23 #define XFLAG 01
24 #define YFLAG 02
26 #define INTICK 01
27 #define OUTICK 02
29 #define BOT 01
30 #define TOP 02
31 #define RIGHT 04
32 #define LEFT 010
34 #define RJUST 01
35 #define LJUST 02
36 #define ABOVE 04
37 #define BELOW 010
39 typedef struct infile {
40 FILE *fin;
41 char *fname;
42 int lineno;
43 } Infile;
45 typedef struct { /* input source */
46 int type; /* Macro, String, File */
47 char *sp; /* if String or Macro */
48 } Src;
50 extern Src src[], *srcp; /* input source stack */
52 #define MAXARGS 100
53 typedef struct { /* argument stack */
54 char *argstk[MAXARGS]; /* pointers to args */
55 char *argval; /* points to space containing args */
56 } Arg;
58 extern Infile infile[10];
59 extern Infile *curfile;
61 typedef struct {
62 struct obj *obj;
63 double x, y;
64 } Point;
66 typedef struct attr { /* e.g., DASH 1.1 or "..." rjust size *.5 */
67 int type;
68 double fval;
69 char *sval;
70 int just; /* justification, for STRING type */
71 int op; /* optional operator, ditto */
72 struct attr *next;
73 } Attr;
75 typedef struct obj { /* a name and its properties */
76 char *name;
77 char *val; /* body of define, etc. */
78 double fval; /* if a numeric variable */
79 Point pt; /* usually for max and min */
80 Point pt1;
81 int type; /* NAME, DEFNAME, ... */
82 int first; /* 1 after 1st item seen */
83 int coord; /* 1 if coord system specified for this name */
84 int log; /* x, y, or z (= x+y) */
85 Attr *attr; /* DASH, etc., for now */
86 struct obj *next;
87 } Obj;
89 typedef union { /* the yacc stack type */
90 int i;
91 char *p;
92 double f;
93 Point pt;
94 Obj *op;
95 Attr *ap;
96 } YYSTYPE;
98 extern YYSTYPE yylval, yyval;
100 extern int dbg;
102 extern int ntext;
103 extern double num[MAXNUM];
104 extern int nnum;
105 extern int ntick, tside;
107 extern char *tostring(char *);
108 extern char *grow(char *, char *, int, int);
110 extern int lineno;
111 extern int synerr;
112 extern int codegen;
113 extern char tempfile[];
114 extern FILE *tfd;
116 extern Point ptmin, ptmax;
118 extern char *dflt_coord;
119 extern char *curr_coord;
120 extern int ncoord;
121 extern int auto_x;
122 extern double margin;
123 extern int autoticks;
124 extern int pointsize, ps_set;
127 #define logit(x) (x) = log10(x)
128 #define Log10(x) errcheck(log10(x), "log")
129 #define Exp(x) errcheck(exp(x), "exp")
130 #define Sqrt(x) errcheck(sqrt(x), "sqrt")
132 #define min(x,y) (((x) <= (y)) ? (x) : (y))
133 #define max(x,y) (((x) >= (y)) ? (x) : (y))
135 extern void yyerror(char *);
136 extern void coord_x(Point);
137 extern void coord_y(Point);
138 extern void coordlog(int);
139 extern void coord(Obj *);
140 extern void resetcoord(Obj *);
141 extern void savenum(int, double);
142 extern void setjust(int);
143 extern void setsize(int, double);
144 extern void range(Point);
145 extern void halfrange(Obj *, int, double);
146 extern Obj *lookup(char *, int);
147 extern double getvar(Obj *);
148 extern double setvar(Obj *, double);
149 extern Point makepoint(Obj *, double, double);
150 extern Attr *makefattr(int, double);
151 extern Attr *makesattr(char *);
152 extern Attr *makeattr(int, double, char *, int, int);
153 extern Attr *addattr(Attr *, Attr *);
154 extern void freeattr(Attr *);
155 extern char *slprint(Attr *);
156 extern char *juststr(int);
157 extern char *sprntf(char *, Attr *);
158 extern void forloop(Obj *, double, double, int, double, char *);
159 extern void nextfor(void);
160 extern void endfor(void);
161 extern char *ifstat(double, char *, char *);
162 extern void frame(void);
163 extern void frameht(double);
164 extern void framewid(double);
165 extern void frameside(int, Attr *);
166 extern void pushsrc(int, char *);
167 extern void popsrc(void);
168 extern void definition(char *);
169 extern char *delimstr(char *);
170 extern int baldelim(int, char *);
171 extern void dodef(Obj *);
172 extern int getarg(char *);
173 extern int input(void);
174 extern int nextchar(void);
175 extern void do_thru(void);
176 extern int unput(int);
177 extern void pbstr(char *);
178 extern double errcheck(double, char *);
179 extern void yyerror(char *);
180 extern void eprint(void);
181 extern int yywrap(void);
182 extern void copyfile(char *);
183 extern void copydef(Obj *);
184 extern Obj *copythru(char *);
185 extern char *addnewline(char *);
186 extern void copyuntil(char *);
187 extern void copy(void);
188 extern void shell_init(void);
189 extern void shell_text(char *);
190 extern void shell_exec(void);
191 extern void labelwid(double);
192 extern void labelmove(int, double);
193 extern void label(int, Attr *);
194 extern void lab_adjust(void);
195 extern char *sizeit(Attr *);
196 extern void line(int, Point, Point, Attr *);
197 extern void circle(double, Point);
198 extern char *xyname(Point);
199 extern void pic(char *);
200 extern void numlist(void);
201 extern void plot(Attr *, Point);
202 extern void plotnum(double, char *, Point);
203 extern void drawdesc(int, Obj *, Attr *, char *);
204 extern void next(Obj *, Point, Attr *);
205 extern void print(void);
206 extern void endstat(void);
207 extern void graph(char *);
208 extern void setup(void);
209 extern void do_first(void);
210 extern void reset(void);
211 extern void opentemp(void);
212 extern void savetick(double, char *);
213 extern void dflt_tick(double);
214 extern void tickside(int);
215 extern void tickoff(int);
216 extern void gridtickoff(void);
217 extern void setlist(void);
218 extern void tickdir(int, double, int);
219 extern void ticks(void);
220 extern double modfloor(double, double);
221 extern double modceil(double, double);
222 extern void do_autoticks(Obj *);
223 extern void logtick(double, double, double);
224 extern Obj *setauto(void);
225 extern void autoside(Obj *, int);
226 extern void autolog(Obj *, int);
227 extern void iterator(double, double, int, double, char *);
228 extern void ticklist(Obj *, int);
229 extern void print_ticks(int, int, Obj *, char *, char *);
230 extern void maketick(int, char *, int, int, double, char *, char *, char *);
231 extern void griddesc(Attr *);
232 extern void gridlist(Obj *);
233 extern char *desc_str(Attr *);
234 extern int sidelog(int, int);
236 extern Obj *objlist;