]>
git.cameronkatri.com Git - mandoc.git/blob - mdoc.h
89f80d4973d28c7796a6199b78de2c90df71f5dd
1 /* $Id: mdoc.h,v 1.62 2009/07/06 09:21:24 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.
23 * This library implements a validating scanner/parser for ``mdoc'' roff
24 * macro documents, a.k.a. BSD manual page documents. The mdoc.c file
25 * drives the parser, while macro.c describes the macro ontologies.
26 * validate.c pre- and post-validates parsed macros, and action.c
27 * performs actions on parsed and validated macros.
30 /* What follows is a list of ALL possible macros. */
152 /* What follows is a list of ALL possible macro arguments. */
155 #define MDOC_Nosplit 1
156 #define MDOC_Ragged 2
157 #define MDOC_Unfilled 3
158 #define MDOC_Literal 4
160 #define MDOC_Offset 6
161 #define MDOC_Bullet 7
163 #define MDOC_Hyphen 9
169 #define MDOC_Ohang 15
170 #define MDOC_Inset 16
171 #define MDOC_Column 17
172 #define MDOC_Width 18
173 #define MDOC_Compact 19
175 #define MDOC_Filled 21
176 #define MDOC_Words 22
177 #define MDOC_Emphasis 23
178 #define MDOC_Symbolic 24
179 #define MDOC_Nested 25
180 #define MDOC_ARG_MAX 26
182 /* Type of a syntax node. */
193 /* Section (named/unnamed) of `Sh'. */
195 SEC_NONE
, /* No section, yet. */
214 SEC_CUSTOM
/* User-defined. */
217 /* Information from prologue. */
228 /* An argument to a macro (multiple values = `It -column'). */
239 struct mdoc_argv
*argv
;
245 struct mdoc_node
*parent
;
246 struct mdoc_node
*child
;
247 struct mdoc_node
*next
;
248 struct mdoc_node
*prev
;
254 #define MDOC_VALID (1 << 0)
255 #define MDOC_ACTED (1 << 1)
259 /* FIXME: union/struct this with #defines. */
260 struct mdoc_arg
*args
; /* BLOCK/ELEM */
261 struct mdoc_node
*head
; /* BLOCK */
262 struct mdoc_node
*body
; /* BLOCK */
263 struct mdoc_node
*tail
; /* BLOCK */
264 char *string
; /* TEXT */
267 #define MDOC_IGN_SCOPE (1 << 0) /* Ignore scope violations. */
268 #define MDOC_IGN_ESCAPE (1 << 1) /* Ignore bad escape sequences. */
269 #define MDOC_IGN_MACRO (1 << 2) /* Ignore unknown macros. */
270 #define MDOC_IGN_CHARS (1 << 3) /* Ignore disallowed chars. */
272 /* Call-backs for parse messages. */
273 /* FIXME: unify somehow with man_cb. */
275 int (*mdoc_err
)(void *, int, int, const char *);
276 int (*mdoc_warn
)(void *, int, int, const char *);
279 /* See mdoc.3 for documentation. */
281 extern const char *const *mdoc_macronames
;
282 extern const char *const *mdoc_argnames
;
288 /* See mdoc.3 for documentation. */
290 void mdoc_free(struct mdoc
*);
291 struct mdoc
*mdoc_alloc(void *, int, const struct mdoc_cb
*);
292 int mdoc_reset(struct mdoc
*);
293 int mdoc_parseln(struct mdoc
*, int, char *buf
);
294 const struct mdoc_node
*mdoc_node(const struct mdoc
*);
295 const struct mdoc_meta
*mdoc_meta(const struct mdoc
*);
296 int mdoc_endparse(struct mdoc
*);
298 const char *mdoc_a2att(const char *);
299 const char *mdoc_a2lib(const char *);
300 const char *mdoc_a2st(const char *);