1 #include <stdio.h>
2 
3 #define	dprintf		if (dbg) printf
4 #define	max(x,y)	(((x) >= (y)) ? (x) : (y))
5 
6 #define	FATAL	1
7 #define	ROM	'1'
8 #define	ITAL	'2'
9 #define	BLD	'3'
10 
11 #define	DEFGAP	-999	/* default gap in piles */
12 
13 extern int	dbg;
14 extern int	ct;
15 extern int	lp[];
16 extern int	used[];		/* available registers */
17 extern int	ps;		/* dflt init pt size */
18 extern int	deltaps;	/* default change in ps */
19 extern int	dps_set;	/* 1 => -p option used */
20 extern int	gsize;		/* global size */
21 extern int	ft;		/* default font */
22 extern int	display;	/* 1 => inline, 0 => .EQ/.EN */
23 extern int	synerr;		/* 1 if syntax error in this eqn */
24 
25 extern char	*typesetter;	/* typesetter name for -T... */
26 extern int	minsize;	/* min size it can print */
27 extern int	ttype;		/* actual type of typesetter: */
28 
29 #define	DEVCAT	1
30 #define	DEV202	2
31 #define	DEVAPS	3
32 #define DEVHAR	4
33 #define DEVVER	5
34 #define DEVPSC	6
35 
36 extern float	eht[];
37 extern float	ebase[];
38 extern int	eps[];
39 extern int	lfont[];
40 extern int	rfont[];
41 extern int	yyval;
42 extern int	yylval;
43 extern int	eqnreg;
44 extern float	eqnht;
45 extern int	lefteq, righteq;
46 extern int	markline;	/* 1 if this EQ/EN contains mark or lineup */
47 
48 typedef struct s_tbl {
49 	char	*name;
50 	char	*defn;
51 	struct s_tbl *next;
52 } tbl;
53 
54 extern	char	*spaceval;	/* use in place of normal \x (for pic) */
55 
56 #define	String	01
57 #define	Macro	02
58 #define	File	04
59 #define	Char	010
60 #define	Free	040
61 
62 typedef struct infile {
63 	FILE	*fin;
64 	char	*fname;
65 	int	lineno;
66 } Infile;
67 
68 typedef struct {	/* input source */
69 	int	type;	/* Macro, String, File */
70 	char	*sp;	/* if String or Macro */
71 } Src;
72 
73 extern	Src	src[], *srcp;	/* input source stack */
74 
75 #define	MAXARGS	20
76 typedef struct {	/* argument stack */
77 	char	*argstk[MAXARGS];	/* pointers to args */
78 	char	*argval;	/* points to space containing args */
79 } Arg;
80 
81 typedef struct {	/* font number and name */
82 	int	ft;
83 	char	name[10];
84 } Font;
85 
86 extern	Font	ftstack[];
87 extern	Font	*ftp;
88 
89 extern	int	szstack[];
90 extern	int	nszstack;
91 
92 extern	Infile	infile[10];
93 extern	Infile	*curfile;
94 extern	char	*grow(), *malloc(), *realloc(), *strsave();
95 extern	char	*DPS(), *ABSPS();
96 extern	double	EM(), REL();
97 extern	tbl	*lookup(), *keytbl[], *deftbl[], *restbl[];
98