aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/eqn/e.h
blob: 432f4eac390ca68860dab3d3af39f8d5cd89713c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <inttypes.h>

#undef sqrt
#define sqrt p9_sqrt
#define YYSTYPE uintptr_t  /* DEC v. GNU garbage */

enum charclass {
	OTHER, OLET, ILET, DIG, LPAR, RPAR, SLASH, PLUS, ILETF, ILETJ, VBAR,
	NONE, LAST
};
extern int class[LAST][LAST];

#define	dprintf		if (dbg) printf
#define	max(x,y)	(((x) >= (y)) ? (x) : (y))	/* beware of side effects */
#define	min(x,y)	(((x) <= (y)) ? (x) : (y))

extern	char	errbuf[200];
extern	char	*cmdname;
#define	ERROR	sprintf(errbuf,
#define	FATAL	), error(1, errbuf)
#define	WARNING	), error(0, errbuf)
#define	SYNTAX	), yyerror(errbuf)

#define	ROM	'1'
#define	ITAL	'2'
#define	BLD	'3'
#define	BDIT	'4'

#define	DEFGAP	-999	/* default gap in piles */

extern int	dbg;
extern int	ct;
extern int	lp[];
extern int	used[];		/* available registers */
extern int	ps;		/* dflt init pt size */
extern int	deltaps;	/* default change in ps */
extern int	dps_set;	/* 1 => -p option used */
extern int	gsize;		/* global size */
extern int	ft;		/* default font */
extern int	display;	/* 1 => inline, 0 => .EQ/.EN */
extern int	synerr;		/* 1 if syntax error in this eqn */

extern char	*typesetter;	/* typesetter name for -T... */
extern int	minsize;	/* min size it can print */
extern int	ttype;		/* actual type of typesetter: */

#define	DEVCAT	1
#define	DEV202	2
#define	DEVAPS	3
#define	DEVPOST	4

extern double	eht[];
extern double	ebase[];
extern int	lfont[];
extern int	rfont[];
extern int	lclass[];
extern int	rclass[];
extern YYSTYPE	yyval;   /* DEC cc wants long */
extern YYSTYPE  yylval;   /* DEC cc wants long */
extern int	eqnreg;
extern double	eqnht;
extern int	lefteq, righteq;
extern int	markline;	/* 1 if this EQ/EN contains mark or lineup */

#define	TBLSIZE	100

typedef struct s_tbl {
	char	*name;		/* e.g., "max" or "sum" */
	char	*cval;		/* e.g., "\\f1max\\fP" */
	int	ival;		/*    or SUM */
	struct s_tbl *next;
} tbl;

extern	char	*spaceval;	/* use in place of normal \x (for pic) */

#define	String	01
#define	Macro	02
#define	File	04
#define	Char	010
#define	Free	040

typedef struct infile {
	FILE	*fin;
	char	*fname;
	int	lineno;
} Infile;

typedef struct {	/* input source */
	int	type;	/* Macro, String, File */
	char	*sp;	/* if String or Macro */
} Src;

extern	Src	src[], *srcp;	/* input source stack */

#define	MAXARGS	20
typedef struct {	/* argument stack */
	char	*argstk[MAXARGS];	/* pointers to args */
	char	*argval;	/* points to space containing args */
} Arg;

typedef struct {	/* font number and name */
	int	ft;
	char	name[10];
} Font;

extern	Font	ftstack[];
extern	Font	*ftp;

extern	int	szstack[];
extern	int	nszstack;

extern	Infile	infile[10];
extern	Infile	*curfile;

extern	tbl	*lookup(tbl **tblp, char *name);
extern	void	install(tbl **tblp, char *name, char *cval, int ival);
extern	tbl	*keytbl[], *deftbl[], *restbl[], *ftunetbl[];

extern	int	salloc(void);
extern	void	sfree(int);
extern	void	nrwid(int, int, int);
extern	char	*ABSPS(int);
extern	char	*DPS(int, int);
extern	int	EFFPS(int);
extern	double	EM(double, int);
extern	double	REL(double, int);
extern	char	*pad(int);
extern	void	getstr(char *, int);
extern	char	*strsave(char *);

extern	int	input(void);
extern	int	unput(int);
extern	void	pbstr(char *);
extern	void	error(int, char *);
extern	void	yyerror(char *);

extern	void	diacrit(int, int);
extern	void	eqnbox(int, int, int);
extern	void	setfont(char *);
extern	void	font(int, int);
extern	void	globfont(void);
extern	void	fatbox(int);
extern	void	fromto(int, int, int);
extern	void	funny(int);
extern	void	integral(int, int, int);
extern	void	setintegral(void);
extern	void	pushsrc(int, char *);
extern	void	popsrc(void);
extern	void	putout(int);
extern	void	text(int, char *);
extern void subsup(int, int, int);
extern void bshiftb(int, int, int);
extern void shift2(int, int, int);
extern void setsize(char *);
extern void size(int, int);
extern void globsize(void);
extern void sqrt(int);
extern void text(int, char *);
extern void boverb(int, int);
extern void lineup(int);
extern void mark(int);
extern void paren(int, int, int);
extern void move(int, int, int);
extern void pile(int);
extern int startcol(int);
extern void column(int, int);
extern void matrix(int);