1cec8643Michal Nowak/*	$Id: roff.h,v 1.69 2019/03/04 13:01:57 schwarze Exp $	*/
2371584cYuri Pankov/*
3371584cYuri Pankov * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
4cec8643Michal Nowak * Copyright (c) 2013-2015, 2017-2019 Ingo Schwarze <schwarze@openbsd.org>
5371584cYuri Pankov *
6371584cYuri Pankov * Permission to use, copy, modify, and distribute this software for any
7371584cYuri Pankov * purpose with or without fee is hereby granted, provided that the above
8371584cYuri Pankov * copyright notice and this permission notice appear in all copies.
9371584cYuri Pankov *
10371584cYuri Pankov * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
11371584cYuri Pankov * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12371584cYuri Pankov * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
13371584cYuri Pankov * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14371584cYuri Pankov * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15371584cYuri Pankov * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16371584cYuri Pankov * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17cec8643Michal Nowak *
18cec8643Michal Nowak * Common data types for all syntax trees and related functions.
19371584cYuri Pankov */
20371584cYuri Pankov
21c66b804Yuri Pankovstruct	ohash;
22371584cYuri Pankovstruct	mdoc_arg;
23371584cYuri Pankovunion	mdoc_data;
24cec8643Michal Nowakstruct	tbl_span;
25cec8643Michal Nowakstruct	eqn_box;
26371584cYuri Pankov
27371584cYuri Pankovenum	roff_macroset {
28371584cYuri Pankov	MACROSET_NONE = 0,
29371584cYuri Pankov	MACROSET_MDOC,
30371584cYuri Pankov	MACROSET_MAN
31371584cYuri Pankov};
32371584cYuri Pankov
33371584cYuri Pankovenum	roff_sec {
34371584cYuri Pankov	SEC_NONE = 0,
35371584cYuri Pankov	SEC_NAME,
36371584cYuri Pankov	SEC_LIBRARY,
37371584cYuri Pankov	SEC_SYNOPSIS,
38371584cYuri Pankov	SEC_DESCRIPTION,
39371584cYuri Pankov	SEC_CONTEXT,
40371584cYuri Pankov	SEC_IMPLEMENTATION,	/* IMPLEMENTATION NOTES */
41371584cYuri Pankov	SEC_RETURN_VALUES,
42371584cYuri Pankov	SEC_ENVIRONMENT,
43371584cYuri Pankov	SEC_FILES,
44371584cYuri Pankov	SEC_EXIT_STATUS,
45371584cYuri Pankov	SEC_EXAMPLES,
46371584cYuri Pankov	SEC_DIAGNOSTICS,
47371584cYuri Pankov	SEC_COMPATIBILITY,
48371584cYuri Pankov	SEC_ERRORS,
49371584cYuri Pankov	SEC_SEE_ALSO,
50371584cYuri Pankov	SEC_STANDARDS,
51371584cYuri Pankov	SEC_HISTORY,
52371584cYuri Pankov	SEC_AUTHORS,
53371584cYuri Pankov	SEC_CAVEATS,
54371584cYuri Pankov	SEC_BUGS,
55371584cYuri Pankov	SEC_SECURITY,
56371584cYuri Pankov	SEC_CUSTOM,
57371584cYuri Pankov	SEC__MAX
58371584cYuri Pankov};
59371584cYuri Pankov
60371584cYuri Pankovenum	roff_type {
61371584cYuri Pankov	ROFFT_ROOT,
62371584cYuri Pankov	ROFFT_BLOCK,
63371584cYuri Pankov	ROFFT_HEAD,
64371584cYuri Pankov	ROFFT_BODY,
65371584cYuri Pankov	ROFFT_TAIL,
66371584cYuri Pankov	ROFFT_ELEM,
67371584cYuri Pankov	ROFFT_TEXT,
686640c13Yuri Pankov	ROFFT_COMMENT,
69371584cYuri Pankov	ROFFT_TBL,
70371584cYuri Pankov	ROFFT_EQN
71371584cYuri Pankov};
72371584cYuri Pankov
73c66b804Yuri Pankovenum	roff_tok {
74c66b804Yuri Pankov	ROFF_br = 0,
75c66b804Yuri Pankov	ROFF_ce,
76cec8643Michal Nowak	ROFF_fi,
77c66b804Yuri Pankov	ROFF_ft,
78c66b804Yuri Pankov	ROFF_ll,
79c66b804Yuri Pankov	ROFF_mc,
80cec8643Michal Nowak	ROFF_nf,
81c66b804Yuri Pankov	ROFF_po,
82c66b804Yuri Pankov	ROFF_rj,
83c66b804Yuri Pankov	ROFF_sp,
84c66b804Yuri Pankov	ROFF_ta,
85c66b804Yuri Pankov	ROFF_ti,
86c66b804Yuri Pankov	ROFF_MAX,
87c66b804Yuri Pankov	ROFF_ab,
88c66b804Yuri Pankov	ROFF_ad,
89c66b804Yuri Pankov	ROFF_af,
90c66b804Yuri Pankov	ROFF_aln,
91c66b804Yuri Pankov	ROFF_als,
92c66b804Yuri Pankov	ROFF_am,
93c66b804Yuri Pankov	ROFF_am1,
94c66b804Yuri Pankov	ROFF_ami,
95c66b804Yuri Pankov	ROFF_ami1,
96c66b804Yuri Pankov	ROFF_as,
97c66b804Yuri Pankov	ROFF_as1,
98c66b804Yuri Pankov	ROFF_asciify,
99c66b804Yuri Pankov	ROFF_backtrace,
100c66b804Yuri Pankov	ROFF_bd,
101c66b804Yuri Pankov	ROFF_bleedat,
102c66b804Yuri Pankov	ROFF_blm,
103c66b804Yuri Pankov	ROFF_box,
104c66b804Yuri Pankov	ROFF_boxa,
105c66b804Yuri Pankov	ROFF_bp,
106c66b804Yuri Pankov	ROFF_BP,
107c66b804Yuri Pankov	ROFF_break,
108c66b804Yuri Pankov	ROFF_breakchar,
109c66b804Yuri Pankov	ROFF_brnl,
110c66b804Yuri Pankov	ROFF_brp,
111c66b804Yuri Pankov	ROFF_brpnl,
112c66b804Yuri Pankov	ROFF_c2,
113c66b804Yuri Pankov	ROFF_cc,
114c66b804Yuri Pankov	ROFF_cf,
115c66b804Yuri Pankov	ROFF_cflags,
116c66b804Yuri Pankov	ROFF_ch,
117c66b804Yuri Pankov	ROFF_char,
118c66b804Yuri Pankov	ROFF_chop,
119c66b804Yuri Pankov	ROFF_class,
120c66b804Yuri Pankov	ROFF_close,
121c66b804Yuri Pankov	ROFF_CL,
122c66b804Yuri Pankov	ROFF_color,
123c66b804Yuri Pankov	ROFF_composite,
124c66b804Yuri Pankov	ROFF_continue,
125c66b804Yuri Pankov	ROFF_cp,
126c66b804Yuri Pankov	ROFF_cropat,
127c66b804Yuri Pankov	ROFF_cs,
128c66b804Yuri Pankov	ROFF_cu,
129c66b804Yuri Pankov	ROFF_da,
130c66b804Yuri Pankov	ROFF_dch,
131c66b804Yuri Pankov	ROFF_Dd,
132c66b804Yuri Pankov	ROFF_de,
133c66b804Yuri Pankov	ROFF_de1,
134c66b804Yuri Pankov	ROFF_defcolor,
135c66b804Yuri Pankov	ROFF_dei,
136c66b804Yuri Pankov	ROFF_dei1,
137c66b804Yuri Pankov	ROFF_device,
138c66b804Yuri Pankov	ROFF_devicem,
139c66b804Yuri Pankov	ROFF_di,
140c66b804Yuri Pankov	ROFF_do,
141c66b804Yuri Pankov	ROFF_ds,
142c66b804Yuri Pankov	ROFF_ds1,
143c66b804Yuri Pankov	ROFF_dwh,
144c66b804Yuri Pankov	ROFF_dt,
145c66b804Yuri Pankov	ROFF_ec,
146c66b804Yuri Pankov	ROFF_ecr,
147c66b804Yuri Pankov	ROFF_ecs,
148c66b804Yuri Pankov	ROFF_el,
149c66b804Yuri Pankov	ROFF_em,
150c66b804Yuri Pankov	ROFF_EN,
151c66b804Yuri Pankov	ROFF_eo,
152c66b804Yuri Pankov	ROFF_EP,
153c66b804Yuri Pankov	ROFF_EQ,
154c66b804Yuri Pankov	ROFF_errprint,
155c66b804Yuri Pankov	ROFF_ev,
156c66b804Yuri Pankov	ROFF_evc,
157c66b804Yuri Pankov	ROFF_ex,
158c66b804Yuri Pankov	ROFF_fallback,
159c66b804Yuri Pankov	ROFF_fam,
160c66b804Yuri Pankov	ROFF_fc,
161c66b804Yuri Pankov	ROFF_fchar,
162c66b804Yuri Pankov	ROFF_fcolor,
163c66b804Yuri Pankov	ROFF_fdeferlig,
164c66b804Yuri Pankov	ROFF_feature,
165c66b804Yuri Pankov	ROFF_fkern,
166c66b804Yuri Pankov	ROFF_fl,
167c66b804Yuri Pankov	ROFF_flig,
168c66b804Yuri Pankov	ROFF_fp,
169c66b804Yuri Pankov	ROFF_fps,
170c66b804Yuri Pankov	ROFF_fschar,
171c66b804Yuri Pankov	ROFF_fspacewidth,
172c66b804Yuri Pankov	ROFF_fspecial,
173c66b804Yuri Pankov	ROFF_ftr,
174c66b804Yuri Pankov	ROFF_fzoom,
175c66b804Yuri Pankov	ROFF_gcolor,
176c66b804Yuri Pankov	ROFF_hc,
177c66b804Yuri Pankov	ROFF_hcode,
178c66b804Yuri Pankov	ROFF_hidechar,
179c66b804Yuri Pankov	ROFF_hla,
180c66b804Yuri Pankov	ROFF_hlm,
181c66b804Yuri Pankov	ROFF_hpf,
182c66b804Yuri Pankov	ROFF_hpfa,
183c66b804Yuri Pankov	ROFF_hpfcode,
184c66b804Yuri Pankov	ROFF_hw,
185c66b804Yuri Pankov	ROFF_hy,
186c66b804Yuri Pankov	ROFF_hylang,
187c66b804Yuri Pankov	ROFF_hylen,
188c66b804Yuri Pankov	ROFF_hym,
189c66b804Yuri Pankov	ROFF_hypp,
190c66b804Yuri Pankov	ROFF_hys,
191c66b804Yuri Pankov	ROFF_ie,
192c66b804Yuri Pankov	ROFF_if,
193c66b804Yuri Pankov	ROFF_ig,
194c66b804Yuri Pankov	/* MAN_in; ignored in mdoc(7) */
195c66b804Yuri Pankov	ROFF_index,
196c66b804Yuri Pankov	ROFF_it,
197c66b804Yuri Pankov	ROFF_itc,
198c66b804Yuri Pankov	ROFF_IX,
199c66b804Yuri Pankov	ROFF_kern,
200c66b804Yuri Pankov	ROFF_kernafter,
201c66b804Yuri Pankov	ROFF_kernbefore,
202c66b804Yuri Pankov	ROFF_kernpair,
203c66b804Yuri Pankov	ROFF_lc,
204c66b804Yuri Pankov	ROFF_lc_ctype,
205c66b804Yuri Pankov	ROFF_lds,
206c66b804Yuri Pankov	ROFF_length,
207c66b804Yuri Pankov	ROFF_letadj,
208c66b804Yuri Pankov	ROFF_lf,
209c66b804Yuri Pankov	ROFF_lg,
210c66b804Yuri Pankov	ROFF_lhang,
211c66b804Yuri Pankov	ROFF_linetabs,
212c66b804Yuri Pankov	ROFF_lnr,
213c66b804Yuri Pankov	ROFF_lnrf,
214c66b804Yuri Pankov	ROFF_lpfx,
215c66b804Yuri Pankov	ROFF_ls,
216c66b804Yuri Pankov	ROFF_lsm,
217c66b804Yuri Pankov	ROFF_lt,
218c66b804Yuri Pankov	ROFF_mediasize,
219c66b804Yuri Pankov	ROFF_minss,
220c66b804Yuri Pankov	ROFF_mk,
221c66b804Yuri Pankov	ROFF_mso,
222c66b804Yuri Pankov	ROFF_na,
223c66b804Yuri Pankov	ROFF_ne,
224c66b804Yuri Pankov	ROFF_nh,
225c66b804Yuri Pankov	ROFF_nhychar,
226c66b804Yuri Pankov	ROFF_nm,
227c66b804Yuri Pankov	ROFF_nn,
228c66b804Yuri Pankov	ROFF_nop,
229c66b804Yuri Pankov	ROFF_nr,
230c66b804Yuri Pankov	ROFF_nrf,
231c66b804Yuri Pankov	ROFF_nroff,
232c66b804Yuri Pankov	ROFF_ns,
233c66b804Yuri Pankov	ROFF_nx,
234c66b804Yuri Pankov	ROFF_open,
235c66b804Yuri Pankov	ROFF_opena,
236c66b804Yuri Pankov	ROFF_os,
237c66b804Yuri Pankov	ROFF_output,
238c66b804Yuri Pankov	ROFF_padj,
239c66b804Yuri Pankov	ROFF_papersize,
240c66b804Yuri Pankov	ROFF_pc,
241c66b804Yuri Pankov	ROFF_pev,
242c66b804Yuri Pankov	ROFF_pi,
243c66b804Yuri Pankov	ROFF_PI,
244c66b804Yuri Pankov	ROFF_pl,
245c66b804Yuri Pankov	ROFF_pm,
246c66b804Yuri Pankov	ROFF_pn,
247c66b804Yuri Pankov	ROFF_pnr,
248c66b804Yuri Pankov	ROFF_ps,
249c66b804Yuri Pankov	ROFF_psbb,
250c66b804Yuri Pankov	ROFF_pshape,
251c66b804Yuri Pankov	ROFF_pso,
252c66b804Yuri Pankov	ROFF_ptr,
253c66b804Yuri Pankov	ROFF_pvs,
254c66b804Yuri Pankov	ROFF_rchar,
255c66b804Yuri Pankov	ROFF_rd,
256c66b804Yuri Pankov	ROFF_recursionlimit,
257c66b804Yuri Pankov	ROFF_return,
258c66b804Yuri Pankov	ROFF_rfschar,
259c66b804Yuri Pankov	ROFF_rhang,
260c66b804Yuri Pankov	ROFF_rm,
261c66b804Yuri Pankov	ROFF_rn,
262c66b804Yuri Pankov	ROFF_rnn,
263c66b804Yuri Pankov	ROFF_rr,
264c66b804Yuri Pankov	ROFF_rs,
265c66b804Yuri Pankov	ROFF_rt,
266c66b804Yuri Pankov	ROFF_schar,
267c66b804Yuri Pankov	ROFF_sentchar,
268c66b804Yuri Pankov	ROFF_shc,
269c66b804Yuri Pankov	ROFF_shift,
270c66b804Yuri Pankov	ROFF_sizes,
271c66b804Yuri Pankov	ROFF_so,
272c66b804Yuri Pankov	ROFF_spacewidth,
273c66b804Yuri Pankov	ROFF_special,
274c66b804Yuri Pankov	ROFF_spreadwarn,
275c66b804Yuri Pankov	ROFF_ss,
276c66b804Yuri Pankov	ROFF_sty,
277c66b804Yuri Pankov	ROFF_substring,
278c66b804Yuri Pankov	ROFF_sv,
279c66b804Yuri Pankov	ROFF_sy,
280c66b804Yuri Pankov	ROFF_T_,
281c66b804Yuri Pankov	ROFF_tc,
282c66b804Yuri Pankov	ROFF_TE,
283c66b804Yuri Pankov	ROFF_TH,
284c66b804Yuri Pankov	ROFF_tkf,
285c66b804Yuri Pankov	ROFF_tl,
286c66b804Yuri Pankov	ROFF_tm,
287c66b804Yuri Pankov	ROFF_tm1,
288c66b804Yuri Pankov	ROFF_tmc,
289c66b804Yuri Pankov	ROFF_tr,
290c66b804Yuri Pankov	ROFF_track,
291c66b804Yuri Pankov	ROFF_transchar,
292c66b804Yuri Pankov	ROFF_trf,
293c66b804Yuri Pankov	ROFF_trimat,
294c66b804Yuri Pankov	ROFF_trin,
295c66b804Yuri Pankov	ROFF_trnt,
296c66b804Yuri Pankov	ROFF_troff,
297c66b804Yuri Pankov	ROFF_TS,
298c66b804Yuri Pankov	ROFF_uf,
299c66b804Yuri Pankov	ROFF_ul,
300c66b804Yuri Pankov	ROFF_unformat,
301c66b804Yuri Pankov	ROFF_unwatch,
302c66b804Yuri Pankov	ROFF_unwatchn,
303c66b804Yuri Pankov	ROFF_vpt,
304c66b804Yuri Pankov	ROFF_vs,
305c66b804Yuri Pankov	ROFF_warn,
306c66b804Yuri Pankov	ROFF_warnscale,
307c66b804Yuri Pankov	ROFF_watch,
308c66b804Yuri Pankov	ROFF_watchlength,
309c66b804Yuri Pankov	ROFF_watchn,
310c66b804Yuri Pankov	ROFF_wh,
311c66b804Yuri Pankov	ROFF_while,
312c66b804Yuri Pankov	ROFF_write,
313c66b804Yuri Pankov	ROFF_writec,
314c66b804Yuri Pankov	ROFF_writem,
315c66b804Yuri Pankov	ROFF_xflag,
316c66b804Yuri Pankov	ROFF_cblock,
317c66b804Yuri Pankov	ROFF_RENAMED,
318c66b804Yuri Pankov	ROFF_USERDEF,
319c66b804Yuri Pankov	TOKEN_NONE,
320c66b804Yuri Pankov	MDOC_Dd,
321c66b804Yuri Pankov	MDOC_Dt,
322c66b804Yuri Pankov	MDOC_Os,
323c66b804Yuri Pankov	MDOC_Sh,
324c66b804Yuri Pankov	MDOC_Ss,
325c66b804Yuri Pankov	MDOC_Pp,
326c66b804Yuri Pankov	MDOC_D1,
327c66b804Yuri Pankov	MDOC_Dl,
328c66b804Yuri Pankov	MDOC_Bd,
329c66b804Yuri Pankov	MDOC_Ed,
330c66b804Yuri Pankov	MDOC_Bl,
331c66b804Yuri Pankov	MDOC_El,
332c66b804Yuri Pankov	MDOC_It,
333c66b804Yuri Pankov	MDOC_Ad,
334c66b804Yuri Pankov	MDOC_An,
335c66b804Yuri Pankov	MDOC_Ap,
336c66b804Yuri Pankov	MDOC_Ar,
337c66b804Yuri Pankov	MDOC_Cd,
338c66b804Yuri Pankov	MDOC_Cm,
339c66b804Yuri Pankov	MDOC_Dv,
340c66b804Yuri Pankov	MDOC_Er,
341c66b804Yuri Pankov	MDOC_Ev,
342c66b804Yuri Pankov	MDOC_Ex,
343c66b804Yuri Pankov	MDOC_Fa,
344c66b804Yuri Pankov	MDOC_Fd,
345c66b804Yuri Pankov	MDOC_Fl,
346c66b804Yuri Pankov	MDOC_Fn,
347c66b804Yuri Pankov	MDOC_Ft,
348c66b804Yuri Pankov	MDOC_Ic,
349c66b804Yuri Pankov	MDOC_In,
350c66b804Yuri Pankov	MDOC_Li,
351c66b804Yuri Pankov	MDOC_Nd,
352c66b804Yuri Pankov	MDOC_Nm,
353c66b804Yuri Pankov	MDOC_Op,
354c66b804Yuri Pankov	MDOC_Ot,
355c66b804Yuri Pankov	MDOC_Pa,
356c66b804Yuri Pankov	MDOC_Rv,
357c66b804Yuri Pankov	MDOC_St,
358c66b804Yuri Pankov	MDOC_Va,
359c66b804Yuri Pankov	MDOC_Vt,
360c66b804Yuri Pankov	MDOC_Xr,
361c66b804Yuri Pankov	MDOC__A,
362c66b804Yuri Pankov	MDOC__B,
363c66b804Yuri Pankov	MDOC__D,
364c66b804Yuri Pankov	MDOC__I,
365c66b804Yuri Pankov	MDOC__J,
366c66b804Yuri Pankov	MDOC__N,
367c66b804Yuri Pankov	MDOC__O,
368c66b804Yuri Pankov	MDOC__P,
369c66b804Yuri Pankov	MDOC__R,
370c66b804Yuri Pankov	MDOC__T,
371c66b804Yuri Pankov	MDOC__V,
372c66b804Yuri Pankov	MDOC_Ac,
373c66b804Yuri Pankov	MDOC_Ao,
374c66b804Yuri Pankov	MDOC_Aq,
375c66b804Yuri Pankov	MDOC_At,
376c66b804Yuri Pankov	MDOC_Bc,
377c66b804Yuri Pankov	MDOC_Bf,
378c66b804Yuri Pankov	MDOC_Bo,
379c66b804Yuri Pankov	MDOC_Bq,
380c66b804Yuri Pankov	MDOC_Bsx,
381c66b804Yuri Pankov	MDOC_Bx,
382c66b804Yuri Pankov	MDOC_Db,
383c66b804Yuri Pankov	MDOC_Dc,
384c66b804Yuri Pankov	MDOC_Do,
385c66b804Yuri Pankov	MDOC_Dq,
386c66b804Yuri Pankov	MDOC_Ec,
387c66b804Yuri Pankov	MDOC_Ef,
388c66b804Yuri Pankov	MDOC_Em,
389c66b804Yuri Pankov	MDOC_Eo,
390c66b804Yuri Pankov	MDOC_Fx,
391c66b804Yuri Pankov	MDOC_Ms,
392c66b804Yuri Pankov	MDOC_No,
393c66b804Yuri Pankov	MDOC_Ns,
394c66b804Yuri Pankov	MDOC_Nx,
395c66b804Yuri Pankov	MDOC_Ox,
396c66b804Yuri Pankov	MDOC_Pc,
397c66b804Yuri Pankov	MDOC_Pf,
398c66b804Yuri Pankov	MDOC_Po,
399c66b804Yuri Pankov	MDOC_Pq,
400c66b804Yuri Pankov	MDOC_Qc,
401c66b804Yuri Pankov	MDOC_Ql,
402c66b804Yuri Pankov	MDOC_Qo,
403c66b804Yuri Pankov	MDOC_Qq,
404c66b804Yuri Pankov	MDOC_Re,
405c66b804Yuri Pankov	MDOC_Rs,
406c66b804Yuri Pankov	MDOC_Sc,
407c66b804Yuri Pankov	MDOC_So,
408c66b804Yuri Pankov	MDOC_Sq,
409c66b804Yuri Pankov	MDOC_Sm,
410c66b804Yuri Pankov	MDOC_Sx,
411c66b804Yuri Pankov	MDOC_Sy,
412c66b804Yuri Pankov	MDOC_Tn,
413c66b804Yuri Pankov	MDOC_Ux,
414c66b804Yuri Pankov	MDOC_Xc,
415c66b804Yuri Pankov	MDOC_Xo,
416c66b804Yuri Pankov	MDOC_Fo,
417c66b804Yuri Pankov	MDOC_Fc,
418c66b804Yuri Pankov	MDOC_Oo,
419c66b804Yuri Pankov	MDOC_Oc,
420c66b804Yuri Pankov	MDOC_Bk,
421c66b804Yuri Pankov	MDOC_Ek,
422c66b804Yuri Pankov	MDOC_Bt,
423c66b804Yuri Pankov	MDOC_Hf,
424c66b804Yuri Pankov	MDOC_Fr,
425c66b804Yuri Pankov	MDOC_Ud,
426c66b804Yuri Pankov	MDOC_Lb,
427c66b804Yuri Pankov	MDOC_Lp,
428c66b804Yuri Pankov	MDOC_Lk,
429c66b804Yuri Pankov	MDOC_Mt,
430c66b804Yuri Pankov	MDOC_Brq,
431c66b804Yuri Pankov	MDOC_Bro,
432c66b804Yuri Pankov	MDOC_Brc,
433c66b804Yuri Pankov	MDOC__C,
434c66b804Yuri Pankov	MDOC_Es,
435c66b804Yuri Pankov	MDOC_En,
436c66b804Yuri Pankov	MDOC_Dx,
437c66b804Yuri Pankov	MDOC__Q,
438c66b804Yuri Pankov	MDOC__U,
439c66b804Yuri Pankov	MDOC_Ta,
440c66b804Yuri Pankov	MDOC_MAX,
441c66b804Yuri Pankov	MAN_TH,
442c66b804Yuri Pankov	MAN_SH,
443c66b804Yuri Pankov	MAN_SS,
444c66b804Yuri Pankov	MAN_TP,
445cec8643Michal Nowak	MAN_TQ,
446c66b804Yuri Pankov	MAN_LP,
447c66b804Yuri Pankov	MAN_PP,
448c66b804Yuri Pankov	MAN_P,
449c66b804Yuri Pankov	MAN_IP,
450c66b804Yuri Pankov	MAN_HP,
451c66b804Yuri Pankov	MAN_SM,
452c66b804Yuri Pankov	MAN_SB,
453c66b804Yuri Pankov	MAN_BI,
454c66b804Yuri Pankov	MAN_IB,
455c66b804Yuri Pankov	MAN_BR,
456c66b804Yuri Pankov	MAN_RB,
457c66b804Yuri Pankov	MAN_R,
458c66b804Yuri Pankov	MAN_B,
459c66b804Yuri Pankov	MAN_I,
460c66b804Yuri Pankov	MAN_IR,
461c66b804Yuri Pankov	MAN_RI,
462c66b804Yuri Pankov	MAN_RE,
463c66b804Yuri Pankov	MAN_RS,
464c66b804Yuri Pankov	MAN_DT,
465c66b804Yuri Pankov	MAN_UC,
466c66b804Yuri Pankov	MAN_PD,
467c66b804Yuri Pankov	MAN_AT,
468c66b804Yuri Pankov	MAN_in,
469cec8643Michal Nowak	MAN_SY,
470cec8643Michal Nowak	MAN_YS,
471c66b804Yuri Pankov	MAN_OP,
472c66b804Yuri Pankov	MAN_EX,
473c66b804Yuri Pankov	MAN_EE,
474c66b804Yuri Pankov	MAN_UR,
475c66b804Yuri Pankov	MAN_UE,
476c66b804Yuri Pankov	MAN_MT,
477c66b804Yuri Pankov	MAN_ME,
478c66b804Yuri Pankov	MAN_MAX
479c66b804Yuri Pankov};
480c66b804Yuri Pankov
481371584cYuri Pankov/*
482371584cYuri Pankov * Indicates that a BODY's formatting has ended, but
483371584cYuri Pankov * the scope is still open.  Used for badly nested blocks.
484371584cYuri Pankov */
485371584cYuri Pankovenum	mdoc_endbody {
486371584cYuri Pankov	ENDBODY_NOT = 0,
487a40ea1aYuri Pankov	ENDBODY_SPACE	/* Is broken: append a space. */
488371584cYuri Pankov};
489371584cYuri Pankov
490cec8643Michal Nowakenum	mandoc_os {
491cec8643Michal Nowak	MANDOC_OS_OTHER = 0,
492cec8643Michal Nowak	MANDOC_OS_NETBSD,
493cec8643Michal Nowak	MANDOC_OS_OPENBSD
494cec8643Michal Nowak};
495cec8643Michal Nowak
496371584cYuri Pankovstruct	roff_node {
497371584cYuri Pankov	struct roff_node *parent;  /* Parent AST node. */
498371584cYuri Pankov	struct roff_node *child;   /* First child AST node. */
499371584cYuri Pankov	struct roff_node *last;    /* Last child AST node. */
500371584cYuri Pankov	struct roff_node *next;    /* Sibling AST node. */
501371584cYuri Pankov	struct roff_node *prev;    /* Prior sibling AST node. */
502371584cYuri Pankov	struct roff_node *head;    /* BLOCK */
503371584cYuri Pankov	struct roff_node *body;    /* BLOCK/ENDBODY */
504371584cYuri Pankov	struct roff_node *tail;    /* BLOCK */
505371584cYuri Pankov	struct mdoc_arg	 *args;    /* BLOCK/ELEM */
506371584cYuri Pankov	union mdoc_data	 *norm;    /* Normalized arguments. */
507371584cYuri Pankov	char		 *string;  /* TEXT */
508cec8643Michal Nowak	struct tbl_span	 *span;    /* TBL */
509c66b804Yuri Pankov	struct eqn_box	 *eqn;     /* EQN */
510371584cYuri Pankov	int		  line;    /* Input file line number. */
511371584cYuri Pankov	int		  pos;     /* Input file column number. */
512371584cYuri Pankov	int		  flags;
513a40ea1aYuri Pankov#define	NODE_VALID	 (1 << 0)  /* Has been validated. */
514a40ea1aYuri Pankov#define	NODE_ENDED	 (1 << 1)  /* Gone past body end mark. */
515cec8643Michal Nowak#define	NODE_BROKEN	 (1 << 2)  /* Must validate parent when ending. */
516a40ea1aYuri Pankov#define	NODE_LINE	 (1 << 3)  /* First macro/text on line. */
517cec8643Michal Nowak#define	NODE_DELIMO	 (1 << 4)
518cec8643Michal Nowak#define	NODE_DELIMC	 (1 << 5)
519cec8643Michal Nowak#define	NODE_EOS	 (1 << 6)  /* At sentence boundary. */
520cec8643Michal Nowak#define	NODE_SYNPRETTY	 (1 << 7)  /* SYNOPSIS-style formatting. */
521cec8643Michal Nowak#define	NODE_NOFILL	 (1 << 8)  /* Fill mode switched off. */
522cec8643Michal Nowak#define	NODE_NOSRC	 (1 << 9)  /* Generated node, not in input file. */
523cec8643Michal Nowak#define	NODE_NOPRT	 (1 << 10) /* Shall not print anything. */
524371584cYuri Pankov	int		  prev_font; /* Before entering this node. */
525371584cYuri Pankov	int		  aux;     /* Decoded node data, type-dependent. */
526c66b804Yuri Pankov	enum roff_tok	  tok;     /* Request or macro ID. */
527371584cYuri Pankov	enum roff_type	  type;    /* AST node type. */
528371584cYuri Pankov	enum roff_sec	  sec;     /* Current named section. */
529371584cYuri Pankov	enum mdoc_endbody end;     /* BODY */
530371584cYuri Pankov};
531371584cYuri Pankov
532371584cYuri Pankovstruct	roff_meta {
533cec8643Michal Nowak	struct roff_node *first;   /* The first node parsed. */
534371584cYuri Pankov	char		 *msec;    /* Manual section, usually a digit. */
535371584cYuri Pankov	char		 *vol;     /* Manual volume title. */
536371584cYuri Pankov	char		 *os;      /* Operating system. */
537371584cYuri Pankov	char		 *arch;    /* Machine architecture. */
538371584cYuri Pankov	char		 *title;   /* Manual title, usually CAPS. */
539371584cYuri Pankov	char		 *name;    /* Leading manual name. */
540371584cYuri Pankov	char		 *date;    /* Normalized date. */
541cec8643Michal Nowak	char		 *sodest;  /* .so target file name or NULL. */
542371584cYuri Pankov	int		  hasbody; /* Document is not empty. */
543c66b804Yuri Pankov	int		  rcsids;  /* Bits indexed by enum mandoc_os. */
544c66b804Yuri Pankov	enum mandoc_os	  os_e;    /* Operating system. */
545371584cYuri Pankov	enum roff_macroset macroset; /* Kind of high-level macros used. */
546371584cYuri Pankov};
547371584cYuri Pankov
548c66b804Yuri Pankovextern	const char *const *roff_name;
549c66b804Yuri Pankov
550371584cYuri Pankov
551cec8643Michal Nowakint		 arch_valid(const char *, enum mandoc_os);
552371584cYuri Pankovvoid		 deroff(char **, const struct roff_node *);
553