]>
git.cameronkatri.com Git - mandoc.git/blob - mdoc.h
1 /* $Id: mdoc.h,v 1.77 2010/05/12 16:01:01 kristaps Exp $ */
3 * Copyright (c) 2008, 2009 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 above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 * This library implements a validating scanner/parser for ``mdoc'' roff
22 * macro documents, a.k.a. BSD manual page documents. The mdoc.c file
23 * drives the parser, while macro.c describes the macro ontologies.
24 * validate.c pre- and post-validates parsed macros, and action.c
25 * performs actions on parsed and validated macros.
28 /* What follows is a list of ALL possible macros. */
155 /* What follows is a list of ALL possible macro arguments. */
158 #define MDOC_Nosplit 1
159 #define MDOC_Ragged 2
160 #define MDOC_Unfilled 3
161 #define MDOC_Literal 4
163 #define MDOC_Offset 6
164 #define MDOC_Bullet 7
166 #define MDOC_Hyphen 9
172 #define MDOC_Ohang 15
173 #define MDOC_Inset 16
174 #define MDOC_Column 17
175 #define MDOC_Width 18
176 #define MDOC_Compact 19
178 #define MDOC_Filled 21
179 #define MDOC_Words 22
180 #define MDOC_Emphasis 23
181 #define MDOC_Symbolic 24
182 #define MDOC_Nested 25
183 #define MDOC_Centred 26
184 #define MDOC_ARG_MAX 27
186 /* Type of a syntax node. */
197 /* Section (named/unnamed) of `Sh'. */
199 SEC_NONE
, /* No section, yet. */
220 SEC_CUSTOM
, /* User-defined. */
224 /* Information from prologue. */
235 /* An argument to a macro (multiple values = `It -column'). */
246 struct mdoc_argv
*argv
;
252 struct mdoc_node
*parent
;
253 struct mdoc_node
*child
;
254 struct mdoc_node
*next
;
255 struct mdoc_node
*prev
;
261 #define MDOC_VALID (1 << 0)
262 #define MDOC_ACTED (1 << 1)
263 #define MDOC_EOS (1 << 2)
267 struct mdoc_arg
*args
; /* BLOCK/ELEM */
269 struct mdoc_node
*pending
; /* BLOCK */
271 struct mdoc_node
*head
; /* BLOCK */
272 struct mdoc_node
*body
; /* BLOCK */
273 struct mdoc_node
*tail
; /* BLOCK */
274 char *string
; /* TEXT */
277 #define MDOC_IGN_SCOPE (1 << 0) /* Ignore scope violations. */
278 #define MDOC_IGN_ESCAPE (1 << 1) /* Ignore bad escape sequences. */
279 #define MDOC_IGN_MACRO (1 << 2) /* Ignore unknown macros. */
281 /* Call-backs for parse messages. */
284 int (*mdoc_err
)(void *, int, int, const char *);
285 int (*mdoc_warn
)(void *, int, int, const char *);
288 /* See mdoc.3 for documentation. */
290 extern const char *const *mdoc_macronames
;
291 extern const char *const *mdoc_argnames
;
297 /* See mdoc.3 for documentation. */
299 void mdoc_free(struct mdoc
*);
300 struct mdoc
*mdoc_alloc(void *, int, const struct mdoc_cb
*);
301 void mdoc_reset(struct mdoc
*);
302 int mdoc_parseln(struct mdoc
*, int, char *buf
);
303 const struct mdoc_node
*mdoc_node(const struct mdoc
*);
304 const struct mdoc_meta
*mdoc_meta(const struct mdoc
*);
305 int mdoc_endparse(struct mdoc
*);