1 /* $Id: mdoc.h,v 1.16 2009/01/07 15:53:00 kristaps Exp $ */
3 * Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the
7 * above copyright notice and this permission notice appear in all
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
22 #define MDOC_LINEARG_MAX 12
133 #define MDOC_Nosplit 1
134 #define MDOC_Ragged 2
135 #define MDOC_Unfilled 3
136 #define MDOC_Literal 4
138 #define MDOC_Offset 6
139 #define MDOC_Bullet 7
141 #define MDOC_Hyphen 9
147 #define MDOC_Ohang 15
148 #define MDOC_Inset 16
149 #define MDOC_Column 17
150 #define MDOC_Width 18
151 #define MDOC_Compact 19
153 #define MDOC_p1003_1_88 21
154 #define MDOC_p1003_1_90 22
155 #define MDOC_p1003_1_96 23
156 #define MDOC_p1003_1_2001 24
157 #define MDOC_p1003_1_2004 25
158 #define MDOC_p1003_1 26
159 #define MDOC_p1003_1b 27
160 #define MDOC_p1003_1b_93 28
161 #define MDOC_p1003_1c_95 29
162 #define MDOC_p1003_1g_2000 30
163 #define MDOC_p1003_2_92 31
164 #define MDOC_p1387_2_95 32
165 #define MDOC_p1003_2 33
166 #define MDOC_p1387_2 34
167 #define MDOC_isoC_90 35
168 #define MDOC_isoC_amd1 36
169 #define MDOC_isoC_tcor1 37
170 #define MDOC_isoC_tcor2 38
171 #define MDOC_isoC_99 39
172 #define MDOC_ansiC 40
173 #define MDOC_ansiC_89 41
174 #define MDOC_ansiC_99 42
175 #define MDOC_ieee754 43
176 #define MDOC_iso8802_3 44
179 #define MDOC_xpg4_2 47
180 #define MDOC_xpg4_3 48
185 #define MDOC_xns5_2d2_0 53
186 #define MDOC_xcurses4_2 54
187 #define MDOC_susv2 55
188 #define MDOC_susv3 56
189 #define MDOC_svid4 57
190 #define MDOC_Filled 58
191 #define MDOC_Words 59
192 #define MDOC_Emphasis 60
193 #define MDOC_Symbolic 61
194 #define MDOC_ARG_MAX 62
197 ERR_SYNTAX_QUOTE
, /* NOTUSED */
214 ERR_SEC_PROLOGUE_REP
,
222 ERR_SYNTAX_CHILDHEAD
,
223 ERR_SYNTAX_CHILDBODY
,
224 ERR_SYNTAX_EMPTYBODY
,
225 ERR_SYNTAX_EMPTYHEAD
,
250 WARN_SYNTAX_EMPTYBODY
,
365 #define META_TITLE_SZ (64)
366 char title
[META_TITLE_SZ
];
367 #define META_OS_SZ (64)
378 struct mdoc_arg
*argv
;
398 struct mdoc_arg
*argv
;
402 struct mdoc_text text
;
403 struct mdoc_elem elem
;
404 struct mdoc_body body
;
405 struct mdoc_head head
;
406 struct mdoc_tail tail
;
407 struct mdoc_block block
;
411 struct mdoc_node
*parent
;
412 struct mdoc_node
*child
;
413 struct mdoc_node
*next
;
414 struct mdoc_node
*prev
;
418 union mdoc_data data
;
422 int (*mdoc_err
)(void *, int, int, enum mdoc_err
);
423 int (*mdoc_warn
)(void *, int, int, enum mdoc_warn
);
424 void (*mdoc_msg
)(void *, int, const char *);
427 extern const char *const *mdoc_macronames
;
428 extern const char *const *mdoc_argnames
;
434 void mdoc_free(struct mdoc
*);
435 struct mdoc
*mdoc_alloc(void *data
, const struct mdoc_cb
*);
436 int mdoc_parseln(struct mdoc
*, int, char *buf
);
437 const struct mdoc_node
438 *mdoc_result(struct mdoc
*);
439 int mdoc_endparse(struct mdoc
*);