1 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
2 /*	  All Rights Reserved  	*/
3 
4 
5 /*
6  * Copyright (c) 1980 Regents of the University of California.
7  * All rights reserved. The Berkeley software License Agreement
8  * specifies the terms and conditions for redistribution.
9  */
10 
11 /*
12  * Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc.
13  * All Rights Reserved.
14  */
15 
16 /*	from OpenSolaris "t..c	1.4	05/06/02 SMI"	 SVr4.0 1.1		*/
17 
18 /*
19  * Portions Copyright (c) 2005 Gunnar Ritter, Freiburg i. Br., Germany
20  *
21  * Sccsid @(#)t..c	1.19 (gritter) 9/11/06
22  */
23 
24 /* t..c : external declarations */
25 
26 # include <stdio.h>
27 # include <ctype.h>
28 # include <inttypes.h>
29 
30 # if defined (__GLIBC__) && defined (_IO_getc_unlocked)
31 # undef getc
32 # define getc(f) _IO_getc_unlocked(f)
33 # endif
34 
35 # define MAXCHS 2000
36 # define MAXSTR 1024
37 # define MAXRPT 100
38 # define CLLEN 100
39 # define SHORTLINE 4
40 # define BIGBUF 8192
41 extern int MAXLIN;
42 extern int MAXCOL;
43 extern int MAXHEAD;
44 extern int nlin, ncol, iline, nclin, nslin;
45 extern int **style;
46 extern int **ctop;
47 extern char ***font;
48 extern char ***csize;
49 extern char ***vsize;
50 extern char **cll;
51 extern int *xcol;
52 extern int *stynum;
53 extern int F1, F2;
54 extern int **lefline;
55 extern int *fullbot;
56 extern char **instead;
57 extern int expflg;
58 extern int xcolflg;
59 extern int ctrflg;
60 extern int evenflg;
61 extern int *evenup;
62 extern int boxflg;
63 extern int dboxflg;
64 extern int decimalpoint;
65 extern int linsize;
66 extern int tab;
67 extern int pr1403;
68 extern int graphics;
69 extern int Graphics;
70 extern int linsize, delim1, delim2;
71 extern int allflg;
72 extern int textflg;
73 extern int left1flg;
74 extern int rightl;
75 struct colstr {char *col, *rcol;};
76 extern struct colstr **table;
77 extern char *cspace, *cstore, *cbase;
78 extern char *exstore, *exlim;
79 extern int *sep;
80 extern int *used, *lused, *rused;
81 extern int *linestop;
82 extern char *leftover;
83 extern char *last, *ifile;
84 extern int *topat;
85 extern intptr_t texname;
86 extern int texct;
87 extern int texct2;
88 extern char texstr[];
89 extern int linstart;
90 extern int nokeep;
91 
92 extern const char *progname;
93 extern int utf8;
94 extern int tlp;
95 extern int nflm;
96 
97 extern FILE *tabin, *tabout;
98 # define CRIGHT 80
99 # define CLEFT 40
100 # define CMID 60
101 # define S1 31
102 # define S2 32
103 # define TMP 38
104 # define SF 35
105 # define SL 34
106 # define LSIZE 33
107 # define SIND 37
108 # define SVS 36
109 /* this refers to the relative position of lines */
110 # define LEFT 1
111 # define RIGHT 2
112 # define THRU 3
113 # define TOP 1
114 # define BOT 2
115 
116 /* t1.c */
117 int tbl(int, char *[]);
118 void setinp(int, char **);
119 int swapin(void);
120 /* t2.c */
121 void tableput(void);
122 /* t3.c */
123 int getcomm(void);
124 void backrest(char *);
125 /* t4.c */
126 int getspec(void);
127 int readspec(void);
128 /* t5.c */
129 int gettbl(void);
130 int nodata(int);
131 int oneh(int);
132 int permute(void);
133 int vspand(int, int, int);
134 int vspen(char *);
135 /* t6.c */
136 void maktab(void);
137 void wide(char *, char *, char *);
138 int filler(char *);
139 /* t7.c */
140 int runout(void);
141 void runtabs(int, int);
142 int ifline(char *);
143 void need(void);
144 void deftail(void);
145 /* t8.c */
146 void putline(int, int);
147 void puttext(char *, char *, char *);
148 void funnies(int, int);
149 void putfont(char *);
150 void putsize(char *);
151 /* t9.c */
152 int yetmore(void);
153 int domore(char *);
154 /* tb.c */
155 void checkuse(void);
156 int real(char *);
157 char *chspace(void);
158 void updspace(char *, char *, int);
159 struct colstr *alocv(int);
160 void release(void);
161 /* tc.c */
162 int choochar(void);
163 int point(int);
164 /* te.c */
165 int error(char *);
166 char *errmsg(int);
167 char *gets1(char **, char **, size_t *);
168 void un1getc(int);
169 int get1char(void);
170 /* tf.c */
171 void savefill(void);
172 void rstofill(void);
173 void endoff(void);
174 void ifdivert(void);
175 void saveline(void);
176 void restline(void);
177 void cleanfc(void);
178 void warnon(void);
179 void warnoff(void);
180 void svgraph(void);
181 /* tg.c */
182 char *get_text(char *, int, int, char *, char *);
183 void untext(void);
184 char *nreg(char *, size_t, const char *, int);
185 /* ti.c */
186 int interv(int, int);
187 int interh(int, int);
188 int up1(int);
189 /* tm.c */
190 char *maknew(char *);
191 int ineqn(char *, char *);
192 /* ts.c */
193 int match(char *, char *);
194 int prefix(char *, char *);
195 int cprefix(char *, char *);
196 int letter(int);
197 int numb(char *);
198 int digit(int);
199 int max(int, int);
200 void tcopy(char *, char *);
201 /* tt.c */
202 int ctype(int, int);
203 int min(int, int);
204 int fspan(int, int);
205 int lspan(int, int);
206 int ctspan(int, int);
207 void tohcol(int);
208 int allh(int);
209 int thish(int, int);
210 /* tu.c */
211 void makeline(int, int, int);
212 void fullwide(int, int);
213 void drawline(int, int, int, int, int, int);
214 void getstop(void);
215 int left(int, int, int *);
216 int lefdata(int, int);
217 int next(int);
218 int prev(int);
219 /* tv.c */
220 void drawvert(int, int, int, int);
221 int midbar(int, int);
222 int midbcol(int, int);
223 int barent(char *);
224