Commit | Line | Data |
---|---|---|
b23405f0 DS |
1 | #include "tdef.h" |
2 | ||
3 | /* You may want to change these names */ | |
4 | ||
a4391633 DS |
5 | #ifndef FONTDIR |
6 | #define FONTDIR "/usr/lib/font" | |
7 | #endif | |
8 | ||
b23405f0 | 9 | #ifndef NROFF |
a4391633 DS |
10 | char termtab[NS] = FONTDIR; /* rest added in ptinit() */ |
11 | char fontfile[NS] = FONTDIR; /* rest added in casefp() */ | |
b23405f0 DS |
12 | char devname[10] = "va"; /* default typesetter */ |
13 | #endif | |
14 | char obuf[OBUFSZ]; /* characters collected here for actual typesetter output */ | |
15 | char *obufp = obuf; | |
16 | int r[NN] = { /* read-only number registers at beginning */ | |
17 | PAIR('%', 0), | |
18 | PAIR('n', 'l'), | |
19 | PAIR('y', 'r'), | |
20 | PAIR('h', 'p'), | |
21 | PAIR('c', 't'), | |
22 | PAIR('d', 'n'), | |
23 | PAIR('m', 'o'), | |
24 | PAIR('d', 'y'), | |
25 | PAIR('d', 'w'), | |
26 | PAIR('l', 'n'), | |
27 | PAIR('d', 'l'), | |
28 | PAIR('s', 't'), | |
29 | PAIR('s', 'b'), | |
30 | PAIR('c', '.'), | |
31 | PAIR('$', '$'), | |
32 | }; | |
33 | ||
34 | ||
35 | int pto = 10000; | |
36 | int pfrom = 1; | |
37 | int print = 1; | |
38 | char nextf[NS] = "/usr/lib/ditmac/tmac.xxxxx"; | |
39 | int nfi = 21; | |
40 | #ifdef NROFF | |
41 | char termtab[NS] = "/usr/lib/term/tab37"; | |
42 | #endif | |
43 | #ifndef NROFF | |
44 | int oldbits = -1; | |
45 | #endif | |
46 | int init = 1; | |
47 | int fc = IMP; /* field character */ | |
48 | int eschar = '\\'; | |
49 | #ifdef NROFF | |
50 | int pl = 11*INCH; | |
51 | int po = PO; | |
52 | #else | |
53 | int pl; | |
54 | int po; | |
55 | #endif | |
56 | int dfact = 1; | |
57 | int dfactd = 1; | |
58 | int res = 1; | |
b23405f0 DS |
59 | int ascii = ASCII; |
60 | int ptid = PTID; | |
61 | int lg = LG; | |
62 | int pnlist[NPN] = { | |
63 | -1}; | |
64 | ||
65 | ||
66 | int *pnp = pnlist; | |
67 | int npn = 1; | |
68 | int npnflg = 1; | |
69 | int xflg = 1; | |
70 | int dpn = -1; | |
71 | int totout = 1; | |
72 | int ulfont = FT + 1; | |
73 | int ulbit = 1 << 9; | |
74 | int tabch = TAB; | |
75 | int ldrch = LEADER; | |
76 | int xxx; | |
77 | extern caseds(), caseas(), casesp(), caseft(), caseps(), casevs(), | |
78 | casenr(), caseif(), casepo(), casetl(), casetm(), casebp(), casech(), | |
79 | casepn(), tbreak(), caseti(), casene(), casenf(), casece(), casefi(), | |
80 | casein(), casell(), casens(), casemk(), casert(), caseam(), | |
81 | casede(), casedi(), caseda(), casewh(), casedt(), caseit(), caserm(), | |
82 | casern(), casead(), casers(), casena(), casepl(), caseta(), casetr(), | |
83 | caseul(), caselt(), casenx(), caseso(), caseig(), casetc(), casefc(), | |
84 | caseec(), caseeo(), caselc(), caseev(), caserd(), caseab(), casefl(), | |
85 | done(), casess(), casefp(), casecs(), casebd(), caselg(), casehc(), | |
86 | casehy(), casenh(), casenm(), casenn(), casesv(), caseos(), casels(), | |
87 | casecc(), casec2(), caseem(), caseaf(), casehw(), casemc(), casepm(), | |
88 | casecu(), casepi(), caserr(), caseuf(), caseie(), caseel(), casepc(), | |
89 | caseht(), casecf(), casesy(); | |
90 | ||
91 | struct contab { | |
92 | int rq; | |
93 | /* | |
94 | union { | |
95 | */ | |
96 | int (*f)(); | |
97 | /* | |
98 | unsigned mx; | |
99 | }x; | |
100 | */ | |
101 | } contab[NM] = { | |
102 | PAIR('d', 's'), caseds, | |
103 | PAIR('a', 's'), caseas, | |
104 | PAIR('s', 'p'), casesp, | |
105 | PAIR('f', 't'), caseft, | |
106 | PAIR('p', 's'), caseps, | |
107 | PAIR('v', 's'), casevs, | |
108 | PAIR('n', 'r'), casenr, | |
109 | PAIR('i', 'f'), caseif, | |
110 | PAIR('i', 'e'), caseie, | |
111 | PAIR('e', 'l'), caseel, | |
112 | PAIR('p', 'o'), casepo, | |
113 | PAIR('t', 'l'), casetl, | |
114 | PAIR('t', 'm'), casetm, | |
115 | PAIR('b', 'p'), casebp, | |
116 | PAIR('c', 'h'), casech, | |
117 | PAIR('p', 'n'), casepn, | |
118 | PAIR('b', 'r'), tbreak, | |
119 | PAIR('t', 'i'), caseti, | |
120 | PAIR('n', 'e'), casene, | |
121 | PAIR('n', 'f'), casenf, | |
122 | PAIR('c', 'e'), casece, | |
123 | PAIR('f', 'i'), casefi, | |
124 | PAIR('i', 'n'), casein, | |
125 | PAIR('l', 'l'), casell, | |
126 | PAIR('n', 's'), casens, | |
127 | PAIR('m', 'k'), casemk, | |
128 | PAIR('r', 't'), casert, | |
129 | PAIR('a', 'm'), caseam, | |
130 | PAIR('d', 'e'), casede, | |
131 | PAIR('d', 'i'), casedi, | |
132 | PAIR('d', 'a'), caseda, | |
133 | PAIR('w', 'h'), casewh, | |
134 | PAIR('d', 't'), casedt, | |
135 | PAIR('i', 't'), caseit, | |
136 | PAIR('r', 'm'), caserm, | |
137 | PAIR('r', 'r'), caserr, | |
138 | PAIR('r', 'n'), casern, | |
139 | PAIR('a', 'd'), casead, | |
140 | PAIR('r', 's'), casers, | |
141 | PAIR('n', 'a'), casena, | |
142 | PAIR('p', 'l'), casepl, | |
143 | PAIR('t', 'a'), caseta, | |
144 | PAIR('t', 'r'), casetr, | |
145 | PAIR('u', 'l'), caseul, | |
146 | PAIR('c', 'u'), casecu, | |
147 | PAIR('l', 't'), caselt, | |
148 | PAIR('n', 'x'), casenx, | |
149 | PAIR('s', 'o'), caseso, | |
150 | PAIR('i', 'g'), caseig, | |
151 | PAIR('t', 'c'), casetc, | |
152 | PAIR('f', 'c'), casefc, | |
153 | PAIR('e', 'c'), caseec, | |
154 | PAIR('e', 'o'), caseeo, | |
155 | PAIR('l', 'c'), caselc, | |
156 | PAIR('e', 'v'), caseev, | |
157 | PAIR('r', 'd'), caserd, | |
158 | PAIR('a', 'b'), caseab, | |
159 | PAIR('f', 'l'), casefl, | |
160 | PAIR('e', 'x'), done, | |
161 | PAIR('s', 's'), casess, | |
162 | PAIR('f', 'p'), casefp, | |
163 | PAIR('c', 's'), casecs, | |
164 | PAIR('b', 'd'), casebd, | |
165 | PAIR('l', 'g'), caselg, | |
166 | PAIR('h', 'c'), casehc, | |
167 | PAIR('h', 'y'), casehy, | |
168 | PAIR('n', 'h'), casenh, | |
169 | PAIR('n', 'm'), casenm, | |
170 | PAIR('n', 'n'), casenn, | |
171 | PAIR('s', 'v'), casesv, | |
172 | PAIR('o', 's'), caseos, | |
173 | PAIR('l', 's'), casels, | |
174 | PAIR('c', 'c'), casecc, | |
175 | PAIR('c', '2'), casec2, | |
176 | PAIR('e', 'm'), caseem, | |
177 | PAIR('a', 'f'), caseaf, | |
178 | PAIR('h', 'w'), casehw, | |
179 | PAIR('m', 'c'), casemc, | |
180 | PAIR('p', 'm'), casepm, | |
181 | PAIR('p', 'i'), casepi, | |
182 | PAIR('u', 'f'), caseuf, | |
183 | PAIR('p', 'c'), casepc, | |
184 | PAIR('h', 't'), caseht, | |
185 | PAIR('c', 'f'), casecf, | |
186 | PAIR('s', 'y'), casesy, | |
187 | PAIR('!', 0), casesy, /* synonym for .sy */ | |
188 | }; | |
189 | ||
190 | ||
191 | tchar oline[LNSIZE+1]; | |
192 | ||
193 | /* | |
194 | troff environment block | |
195 | */ | |
196 | ||
197 | int block = 0; | |
198 | #ifdef NROFF | |
199 | /* these are initialized statically in nroff (so far) | |
200 | /* and dynamically in ptinit() in troff beacuse INCH | |
201 | /* is a variable | |
202 | */ | |
203 | int ics = ICS; /* space for insertion character */ | |
204 | int sps = SPS; | |
205 | int spacesz = SS; | |
206 | int lss = VS; | |
207 | int lss1 = VS; | |
208 | int ll = LL; | |
209 | int ll1 = LL; | |
210 | int lt = LL; | |
211 | int lt1 = LL; | |
212 | #else | |
213 | int ics = 0; | |
214 | int sps = 0; | |
215 | int spacesz = 0; | |
216 | int lss = 0; | |
217 | int lss1 = 0; | |
218 | int ll = 0; | |
219 | int ll1 = 0; | |
220 | int lt = 0; | |
221 | int lt1 = 0; | |
222 | #endif | |
223 | tchar ic = 0; /* insertion character (= margin character) */ | |
224 | int icf = 0; | |
225 | tchar chbits = 0; /* size+font bits for current character */ | |
226 | tchar spbits = 0; /* ditto for special font */ | |
227 | tchar nmbits = 0; | |
228 | int apts = PS; /* actual point size -- as requested by user */ | |
229 | int apts1 = PS; /* need not match an existent size */ | |
230 | int pts = PS; /* hence, this is the size that really exists */ | |
231 | int pts1 = PS; | |
232 | int font = FT; | |
233 | int font1 = FT; | |
234 | int ls = 1; | |
235 | int ls1 = 1; | |
236 | int ad = 1; | |
237 | int nms = 1; | |
238 | int ndf = 1; | |
239 | int fi = 1; | |
240 | int cc = '.'; | |
241 | int c2 = '\''; | |
242 | int ohc = OHC; | |
243 | int tdelim = IMP; | |
244 | int hyf = 1; | |
245 | int hyoff = 0; | |
246 | int un1 = -1; | |
247 | int tabc = 0; | |
248 | int dotc = '.'; | |
249 | int adsp = 0; | |
250 | int adrem = 0; | |
251 | int lastl = 0; | |
252 | int nel = 0; | |
253 | int admod = 0; | |
254 | tchar *wordp = 0; | |
255 | int spflg = 0; /* probably to indicate space after punctuation needed */ | |
256 | tchar *linep = 0; | |
257 | tchar *wdend = 0; | |
258 | tchar *wdstart = 0; | |
259 | int wne = 0; | |
260 | int ne = 0; | |
261 | int nc = 0; | |
262 | int nb = 0; | |
263 | int lnmod = 0; | |
264 | int nwd = 0; | |
265 | int nn = 0; | |
266 | int ni = 0; | |
267 | int ul = 0; | |
268 | int cu = 0; | |
269 | int ce = 0; | |
270 | int in = 0; | |
271 | int in1 = 0; | |
272 | int un = 0; | |
273 | int wch = 0; | |
274 | int pendt = 0; | |
275 | tchar *pendw = 0; | |
276 | int pendnf = 0; | |
277 | int spread = 0; | |
278 | int it = 0; | |
279 | int itmac = 0; | |
280 | int lnsize = LNSIZE; | |
281 | tchar *hyptr[NHYP] = { | |
282 | 0}; | |
283 | ||
284 | ||
285 | int tabtab[NTAB] = { | |
286 | 0}; | |
287 | ||
288 | ||
289 | tchar line[LNSIZE] = { | |
290 | 0}; | |
291 | ||
292 | ||
293 | tchar word[WDSIZE] = { | |
294 | 0}; | |
295 | ||
296 | ||
297 | char blockxxx[EVSPARE] = { | |
298 | 0}; | |
299 | ||
300 |