aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/tbl/t.h
blob: 9171287d93b0d00241ab1ae449b10e7cf5b5fd1f (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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
/* t..c : external declarations */

#include <u.h>
#include <libc.h>
#include <bio.h>
# include <ctype.h>

# define MAXLIN 250
# define MAXHEAD 44
# define MAXCOL 30
 /* Do NOT make MAXCOL bigger with adjusting nregs[] in tr.c */
# define MAXCHS 2000
#define MAXLINLEN 300
# define MAXRPT 100
# define CLLEN 10
# define SHORTLINE 4
extern int nlin, ncol, iline, nclin, nslin;

extern int (*style)[MAXHEAD];
extern char (*font)[MAXHEAD][2];
extern char (*csize)[MAXHEAD][4];
extern char (*vsize)[MAXHEAD][4];
extern char (*cll)[CLLEN];
extern int (*flags)[MAXHEAD];
# define ZEROW 001
# define HALFUP 002
# define CTOP 004
# define CDOWN 010
extern int stynum[];
extern int qcol;
extern int *doubled, *acase, *topat;
extern int F1, F2;
extern int (*lefline)[MAXHEAD];
extern int fullbot[];
extern char *instead[];
extern int expflg;
extern int ctrflg;
extern int evenflg;
extern int *evenup;
extern int boxflg;
extern int dboxflg;
extern int linsize;
extern int tab;
extern int pr1403;
extern int linsize, delim1, delim2;
extern int allflg;
extern int textflg;
extern int left1flg;
extern int rightl;
struct colstr {char *col, *rcol;};
extern struct colstr *table[];
extern char *cspace, *cstore;
extern char *exstore, *exlim, *exspace;
extern int *sep;
extern int *used, *lused, *rused;
extern int linestop[];
extern char *leftover;
extern char *last, *ifile;
extern int texname;
extern int texct, texmax;
extern char texstr[];
extern int linstart;


extern Biobuf *tabin, tabout;
# define CRIGHT 2
# define CLEFT 0
# define CMID 1
# define S1 31
# define S2 32
# define S3 33
# define TMP 38
#define S9 39
# define SF 35
# define SL 34
# define LSIZE 33
# define SIND 37
# define SVS 36
/* this refers to the relative position of lines */
# define LEFT 1
# define RIGHT 2
# define THRU 3
# define TOP 1
# define BOT 2

int tbl(int argc,char *argv[]);		/*t1.c*/
void setinp(int, char **);
int swapin(void);

void tableput(void);			/*t2.c*/

void getcomm(void);			/*t3.c*/
void backrest(char *);

void getspec(void);			/*t4.c*/
void readspec(void);
int findcol(void);
void garray(int);
char *getcore(int, int);
void freearr(void);

void gettbl(void);			/*t5.c*/
int nodata(int);
int oneh(int);
int vspand(int, int, int);
int vspen(char *);
void permute(void);

void maktab(void);			/*t6.c*/
void wide(char *, char *, char *);
int filler(char *);

void runout(void);			/*t7.c*/
void runtabs(int, int);
int ifline(char *);
void need(void);
void deftail(void);

void putline(int, int);			/*t8.c*/
void puttext(char *, char *, char *);
void funnies(int, int);
void putfont(char *);
void putsize(char *);

void yetmore(void);			/*t9.c*/
int domore(char *);

void checkuse(void);			/*tb.c*/
int real(char *);
char *chspace(void);
int *alocv(int);
void release(void);

void choochar(void);			/*tc.c*/
int point(char *);

void error(char *);			/*te.c*/
char *gets1(char *, int);
void un1getc(int);
int get1char(void);

void savefill(void);			/*tf.c*/
void rstofill(void);
void endoff(void);
void freearr(void);
void saveline(void);
void ifdivert(void);
void restline(void);
void cleanfc(void);

#define gettext tbl_gettext
int gettext(char *, int, int, char *, char *);		/*tg.c*/
void untext(void);

int interv(int, int);			/*ti.c*/
int interh(int, int);
int up1(int);

char *maknew(char *);			/*tm.c*/
int ineqn (char *, char *);

char *reg(int, int);			/*tr.c*/

int match (char *, char *);		/*ts.c*/
int prefix(char *, char *);
int letter (int);
int numb(char *);
int digit(int);
int max(int, int);
void tcopy (char *, char *);

int ctype(int, int);			/*tt.c*/
int min(int, int);
int fspan(int, int);
int lspan(int, int);
int ctspan(int, int);
void tohcol(int);
int allh(int);
int thish(int, int);

void makeline(int, int, int);		/*tu.c*/
void fullwide(int, int);
void drawline(int, int, int, int, int, int);
void getstop(void);
int left(int, int, int *);
int lefdata(int, int);
int next(int);
int prev(int);

void drawvert(int, int, int, int);			/*tv.c*/
int midbar(int, int);
int midbcol(int, int);
int barent(char *);