xref: /original-bsd/old/roff/common_source/ni.c (revision c0e889e7)
1 #ifndef lint
2 static char sccsid[] = "@(#)ni.c	4.1 06/07/82";
3 #endif lint
4 
5 #include "tdef.h"
6 char obuf[OBUFSZ];
7 char *obufp = obuf;
8 int r[NN] = {
9 	PAIR('%',0),
10 	PAIR('n','l'),
11 	PAIR('y','r'),
12 	PAIR('h','p'),
13 	PAIR('c','t'),
14 	PAIR('d','n'),
15 	PAIR('m','o'),
16 	PAIR('d','y'),
17 	PAIR('d','w'),
18 	PAIR('l','n'),
19 	PAIR('d','l'),
20 	PAIR('s','t'),
21 	PAIR('s','b'),
22 	PAIR('c','.')};
23 int pto = 10000;
24 int pfrom = 1;
25 int print = 1;
26 char nextf[NS] = "/usr/lib/tmac/tmac.xxxxx";
27 int nfi = 19;
28 #ifdef NROFF
29 char termtab[NS] = "/usr/lib/term/tab37";
30 int tti = 17;
31 #endif
32 #ifndef NROFF
33 int oldbits = -1;
34 #endif
35 int init = 1;
36 int fc = IMP;
37 int eschar = '\\';
38 int pl = 11*INCH;
39 int po = PO;
40 int dfact = 1;
41 int dfactd = 1;
42 int res = 1;
43 int smnt = 4;
44 int ascii = ASCII;
45 int ptid = PTID;
46 char ptname[] = "/dev/cat";
47 int lg = LG;
48 int pnlist[NPN] = {-1};
49 int *pnp = pnlist;
50 int npn = 1;
51 int npnflg = 1;
52 int xflg = 1;
53 int dpn = -1;
54 int totout = 1;
55 int ulfont = 1;
56 int ulbit = 1<<9;
57 int tabch = TAB;
58 int ldrch = LEADER;
59 int xxx;
60 extern caseds(), caseas(), casesp(), caseft(), caseps(), casevs(),
61 casenr(), caseif(), casepo(), casetl(), casetm(), casebp(), casech(),
62 casepn(), tbreak(), caseti(), casene(), casenf(), casece(), casefi(),
63 casein(), caseli(), casell(), casens(), casemk(), casert(), caseam(),
64 casede(), casedi(), caseda(), casewh(), casedt(), caseit(), caserm(),
65 casern(), casead(), casers(), casena(), casepl(), caseta(), casetr(),
66 caseul(), caselt(), casenx(), caseso(), caseig(), casetc(), casefc(),
67 caseec(), caseeo(), caselc(), caseev(), caserd(), caseab(), casefl(),
68 done(), casess(), casefp(), casecs(), casebd(), caselg(), casehc(),
69 casehy(), casenh(), casenm(), casenn(), casesv(), caseos(), casels(),
70 casecc(), casec2(), caseem(), caseaf(), casehw(), casemc(), casepm(),
71 casecu(), casepi(), caserr(), caseuf(), caseie(), caseel(), casepc(),
72 caseht();
73 #ifndef NROFF
74 extern casefz();
75 #endif
76 extern casecf();
77 struct contab {
78 	int rq;
79 /*
80 	union {
81  */
82 		int (*f)();
83 /*
84 		unsigned mx;
85 	}x;
86  */
87 }contab[NM]= {
88 	PAIR('d','s'),caseds,
89 	PAIR('a','s'),caseas,
90 	PAIR('s','p'),casesp,
91 	PAIR('f','t'),caseft,
92 	PAIR('p','s'),caseps,
93 	PAIR('v','s'),casevs,
94 	PAIR('n','r'),casenr,
95 	PAIR('i','f'),caseif,
96 	PAIR('i','e'),caseie,
97 	PAIR('e','l'),caseel,
98 	PAIR('p','o'),casepo,
99 	PAIR('t','l'),casetl,
100 	PAIR('t','m'),casetm,
101 	PAIR('b','p'),casebp,
102 	PAIR('c','h'),casech,
103 	PAIR('p','n'),casepn,
104 	PAIR('b','r'),tbreak,
105 	PAIR('t','i'),caseti,
106 	PAIR('n','e'),casene,
107 	PAIR('n','f'),casenf,
108 	PAIR('c','e'),casece,
109 	PAIR('f','i'),casefi,
110 	PAIR('i','n'),casein,
111 	PAIR('l','i'),caseli,
112 	PAIR('l','l'),casell,
113 	PAIR('n','s'),casens,
114 	PAIR('m','k'),casemk,
115 	PAIR('r','t'),casert,
116 	PAIR('a','m'),caseam,
117 	PAIR('d','e'),casede,
118 	PAIR('d','i'),casedi,
119 	PAIR('d','a'),caseda,
120 	PAIR('w','h'),casewh,
121 	PAIR('d','t'),casedt,
122 	PAIR('i','t'),caseit,
123 	PAIR('r','m'),caserm,
124 	PAIR('r','r'),caserr,
125 	PAIR('r','n'),casern,
126 	PAIR('a','d'),casead,
127 	PAIR('r','s'),casers,
128 	PAIR('n','a'),casena,
129 	PAIR('p','l'),casepl,
130 	PAIR('t','a'),caseta,
131 	PAIR('t','r'),casetr,
132 	PAIR('u','l'),caseul,
133 	PAIR('c','u'),casecu,
134 	PAIR('l','t'),caselt,
135 	PAIR('n','x'),casenx,
136 	PAIR('s','o'),caseso,
137 	PAIR('i','g'),caseig,
138 	PAIR('t','c'),casetc,
139 	PAIR('f','c'),casefc,
140 	PAIR('e','c'),caseec,
141 	PAIR('e','o'),caseeo,
142 	PAIR('l','c'),caselc,
143 	PAIR('e','v'),caseev,
144 	PAIR('r','d'),caserd,
145 	PAIR('a','b'),caseab,
146 	PAIR('f','l'),casefl,
147 	PAIR('e','x'),done,
148 	PAIR('s','s'),casess,
149 	PAIR('f','p'),casefp,
150 	PAIR('c','s'),casecs,
151 	PAIR('b','d'),casebd,
152 	PAIR('l','g'),caselg,
153 	PAIR('h','c'),casehc,
154 	PAIR('h','y'),casehy,
155 	PAIR('n','h'),casenh,
156 	PAIR('n','m'),casenm,
157 	PAIR('n','n'),casenn,
158 	PAIR('s','v'),casesv,
159 	PAIR('o','s'),caseos,
160 	PAIR('l','s'),casels,
161 	PAIR('c','c'),casecc,
162 	PAIR('c','2'),casec2,
163 	PAIR('e','m'),caseem,
164 	PAIR('a','f'),caseaf,
165 	PAIR('h','w'),casehw,
166 	PAIR('m','c'),casemc,
167 	PAIR('p','m'),casepm,
168 #ifdef NROFF
169 	PAIR('p','i'),casepi,
170 #endif
171 	PAIR('u','f'),caseuf,
172 	PAIR('p','c'),casepc,
173 	PAIR('h','t'),caseht,
174 #ifndef NROFF
175 	PAIR('f','z'),casefz,
176 #endif
177 	PAIR('c', 'f'),casecf,
178 };
179 
180 /*
181 troff environment block
182 */
183 
184 int block = 0;
185 int ics = ICS;
186 int ic = 0;
187 int icf = 0;
188 int chbits = 0;
189 int spbits = 0;
190 int nmbits = 0;
191 int apts = PS;
192 int apts1 = PS;
193 int pts = PS;
194 int pts1 = PS;
195 int font = FT;
196 int font1 = FT;
197 int sps = SPS;
198 int spacesz = SS;
199 int lss = VS;
200 int lss1 = VS;
201 int ls = 1;
202 int ls1 = 1;
203 int ll = LL;
204 int ll1 = LL;
205 int lt = LL;
206 int lt1 = LL;
207 int ad = 1;
208 int nms = 1;
209 int ndf = 1;
210 int fi = 1;
211 int cc = '.';
212 int c2 = '\'';
213 int ohc = OHC;
214 int tdelim = IMP;
215 int hyf = 1;
216 int hyoff = 0;
217 int un1 = -1;
218 int tabc = 0;
219 int dotc = '.';
220 int adsp = 0;
221 int adrem = 0;
222 int lastl = 0;
223 int nel = 0;
224 int admod = 0;
225 int *wordp = 0;
226 int spflg = 0;
227 int *linep = 0;
228 int *wdend = 0;
229 int *wdstart = 0;
230 int wne = 0;
231 int ne = 0;
232 int nc = 0;
233 int nb = 0;
234 int lnmod = 0;
235 int nwd = 0;
236 int nn = 0;
237 int ni = 0;
238 int ul = 0;
239 int cu = 0;
240 int ce = 0;
241 int in = 0;
242 int in1 = 0;
243 int un = 0;
244 int wch = 0;
245 int pendt = 0;
246 int *pendw = 0;
247 int pendnf = 0;
248 int spread = 0;
249 int it = 0;
250 int itmac = 0;
251 int lnsize = LNSIZE;
252 int *hyptr[NHYP] = {0};
253 int tabtab[NTAB] = {DTAB,DTAB*2,DTAB*3,DTAB*4,DTAB*5,DTAB*6,DTAB*7,DTAB*8,
254 	DTAB*9,DTAB*10,DTAB*11,DTAB*12,DTAB*13,DTAB*14,DTAB*15,0};
255 int line[LNSIZE] = {0};
256 int word[WDSIZE] = {0};
257 int blockxxx[EVS-68-NHYP-NTAB-WDSIZE-LNSIZE] = {0};
258 /*spare 5 words*/
259 int oline[LNSIZE+1];
260