8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / mandoc / mdoc.h
blobebe4391ef610bd56b1767da1425ceaad60d127af
1 /* $Id: mdoc.h,v 1.144 2015/11/07 14:01:16 schwarze Exp $ */
2 /*
3 * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
4 * Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 #define MDOC_Ap 0
20 #define MDOC_Dd 1
21 #define MDOC_Dt 2
22 #define MDOC_Os 3
23 #define MDOC_Sh 4
24 #define MDOC_Ss 5
25 #define MDOC_Pp 6
26 #define MDOC_D1 7
27 #define MDOC_Dl 8
28 #define MDOC_Bd 9
29 #define MDOC_Ed 10
30 #define MDOC_Bl 11
31 #define MDOC_El 12
32 #define MDOC_It 13
33 #define MDOC_Ad 14
34 #define MDOC_An 15
35 #define MDOC_Ar 16
36 #define MDOC_Cd 17
37 #define MDOC_Cm 18
38 #define MDOC_Dv 19
39 #define MDOC_Er 20
40 #define MDOC_Ev 21
41 #define MDOC_Ex 22
42 #define MDOC_Fa 23
43 #define MDOC_Fd 24
44 #define MDOC_Fl 25
45 #define MDOC_Fn 26
46 #define MDOC_Ft 27
47 #define MDOC_Ic 28
48 #define MDOC_In 29
49 #define MDOC_Li 30
50 #define MDOC_Nd 31
51 #define MDOC_Nm 32
52 #define MDOC_Op 33
53 #define MDOC_Ot 34
54 #define MDOC_Pa 35
55 #define MDOC_Rv 36
56 #define MDOC_St 37
57 #define MDOC_Va 38
58 #define MDOC_Vt 39
59 #define MDOC_Xr 40
60 #define MDOC__A 41
61 #define MDOC__B 42
62 #define MDOC__D 43
63 #define MDOC__I 44
64 #define MDOC__J 45
65 #define MDOC__N 46
66 #define MDOC__O 47
67 #define MDOC__P 48
68 #define MDOC__R 49
69 #define MDOC__T 50
70 #define MDOC__V 51
71 #define MDOC_Ac 52
72 #define MDOC_Ao 53
73 #define MDOC_Aq 54
74 #define MDOC_At 55
75 #define MDOC_Bc 56
76 #define MDOC_Bf 57
77 #define MDOC_Bo 58
78 #define MDOC_Bq 59
79 #define MDOC_Bsx 60
80 #define MDOC_Bx 61
81 #define MDOC_Db 62
82 #define MDOC_Dc 63
83 #define MDOC_Do 64
84 #define MDOC_Dq 65
85 #define MDOC_Ec 66
86 #define MDOC_Ef 67
87 #define MDOC_Em 68
88 #define MDOC_Eo 69
89 #define MDOC_Fx 70
90 #define MDOC_Ms 71
91 #define MDOC_No 72
92 #define MDOC_Ns 73
93 #define MDOC_Nx 74
94 #define MDOC_Ox 75
95 #define MDOC_Pc 76
96 #define MDOC_Pf 77
97 #define MDOC_Po 78
98 #define MDOC_Pq 79
99 #define MDOC_Qc 80
100 #define MDOC_Ql 81
101 #define MDOC_Qo 82
102 #define MDOC_Qq 83
103 #define MDOC_Re 84
104 #define MDOC_Rs 85
105 #define MDOC_Sc 86
106 #define MDOC_So 87
107 #define MDOC_Sq 88
108 #define MDOC_Sm 89
109 #define MDOC_Sx 90
110 #define MDOC_Sy 91
111 #define MDOC_Tn 92
112 #define MDOC_Ux 93
113 #define MDOC_Xc 94
114 #define MDOC_Xo 95
115 #define MDOC_Fo 96
116 #define MDOC_Fc 97
117 #define MDOC_Oo 98
118 #define MDOC_Oc 99
119 #define MDOC_Bk 100
120 #define MDOC_Ek 101
121 #define MDOC_Bt 102
122 #define MDOC_Hf 103
123 #define MDOC_Fr 104
124 #define MDOC_Ud 105
125 #define MDOC_Lb 106
126 #define MDOC_Lp 107
127 #define MDOC_Lk 108
128 #define MDOC_Mt 109
129 #define MDOC_Brq 110
130 #define MDOC_Bro 111
131 #define MDOC_Brc 112
132 #define MDOC__C 113
133 #define MDOC_Es 114
134 #define MDOC_En 115
135 #define MDOC_Dx 116
136 #define MDOC__Q 117
137 #define MDOC_br 118
138 #define MDOC_sp 119
139 #define MDOC__U 120
140 #define MDOC_Ta 121
141 #define MDOC_ll 122
142 #define MDOC_MAX 123
144 enum mdocargt {
145 MDOC_Split, /* -split */
146 MDOC_Nosplit, /* -nospli */
147 MDOC_Ragged, /* -ragged */
148 MDOC_Unfilled, /* -unfilled */
149 MDOC_Literal, /* -literal */
150 MDOC_File, /* -file */
151 MDOC_Offset, /* -offset */
152 MDOC_Bullet, /* -bullet */
153 MDOC_Dash, /* -dash */
154 MDOC_Hyphen, /* -hyphen */
155 MDOC_Item, /* -item */
156 MDOC_Enum, /* -enum */
157 MDOC_Tag, /* -tag */
158 MDOC_Diag, /* -diag */
159 MDOC_Hang, /* -hang */
160 MDOC_Ohang, /* -ohang */
161 MDOC_Inset, /* -inset */
162 MDOC_Column, /* -column */
163 MDOC_Width, /* -width */
164 MDOC_Compact, /* -compact */
165 MDOC_Std, /* -std */
166 MDOC_Filled, /* -filled */
167 MDOC_Words, /* -words */
168 MDOC_Emphasis, /* -emphasis */
169 MDOC_Symbolic, /* -symbolic */
170 MDOC_Nested, /* -nested */
171 MDOC_Centred, /* -centered */
172 MDOC_ARG_MAX
176 * An argument to a macro (multiple values = `-column xxx yyy').
178 struct mdoc_argv {
179 enum mdocargt arg; /* type of argument */
180 int line;
181 int pos;
182 size_t sz; /* elements in "value" */
183 char **value; /* argument strings */
187 * Reference-counted macro arguments. These are refcounted because
188 * blocks have multiple instances of the same arguments spread across
189 * the HEAD, BODY, TAIL, and BLOCK node types.
191 struct mdoc_arg {
192 size_t argc;
193 struct mdoc_argv *argv;
194 unsigned int refcnt;
197 enum mdoc_list {
198 LIST__NONE = 0,
199 LIST_bullet, /* -bullet */
200 LIST_column, /* -column */
201 LIST_dash, /* -dash */
202 LIST_diag, /* -diag */
203 LIST_enum, /* -enum */
204 LIST_hang, /* -hang */
205 LIST_hyphen, /* -hyphen */
206 LIST_inset, /* -inset */
207 LIST_item, /* -item */
208 LIST_ohang, /* -ohang */
209 LIST_tag, /* -tag */
210 LIST_MAX
213 enum mdoc_disp {
214 DISP__NONE = 0,
215 DISP_centered, /* -centered */
216 DISP_ragged, /* -ragged */
217 DISP_unfilled, /* -unfilled */
218 DISP_filled, /* -filled */
219 DISP_literal /* -literal */
222 enum mdoc_auth {
223 AUTH__NONE = 0,
224 AUTH_split, /* -split */
225 AUTH_nosplit /* -nosplit */
228 enum mdoc_font {
229 FONT__NONE = 0,
230 FONT_Em, /* Em, -emphasis */
231 FONT_Li, /* Li, -literal */
232 FONT_Sy /* Sy, -symbolic */
235 struct mdoc_bd {
236 const char *offs; /* -offset */
237 enum mdoc_disp type; /* -ragged, etc. */
238 int comp; /* -compact */
241 struct mdoc_bl {
242 const char *width; /* -width */
243 const char *offs; /* -offset */
244 enum mdoc_list type; /* -tag, -enum, etc. */
245 int comp; /* -compact */
246 size_t ncols; /* -column arg count */
247 const char **cols; /* -column val ptr */
248 int count; /* -enum counter */
251 struct mdoc_bf {
252 enum mdoc_font font; /* font */
255 struct mdoc_an {
256 enum mdoc_auth auth; /* -split, etc. */
259 struct mdoc_rs {
260 int quote_T; /* whether to quote %T */
264 * Consists of normalised node arguments. These should be used instead
265 * of iterating through the mdoc_arg pointers of a node: defaults are
266 * provided, etc.
268 union mdoc_data {
269 struct mdoc_an An;
270 struct mdoc_bd Bd;
271 struct mdoc_bf Bf;
272 struct mdoc_bl Bl;
273 struct roff_node *Es;
274 struct mdoc_rs Rs;
277 /* Names of macros. */
278 extern const char *const *mdoc_macronames;
280 /* Names of macro args. Index is enum mdocargt. */
281 extern const char *const *mdoc_argnames;
284 void mdoc_validate(struct roff_man *);