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