]> git.cameronkatri.com Git - mandoc.git/blob - libmdocml.h
*** empty log message ***
[mandoc.git] / libmdocml.h
1 /* $Id: libmdocml.h,v 1.12 2008/12/04 11:25:29 kristaps Exp $ */
2 /*
3 * Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
4 *
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
8 * copies.
9 *
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.
18 */
19 #ifndef LIBMDOCML_H
20 #define LIBMDOCML_H
21
22 #include <sys/types.h>
23
24 struct md_params_xml {
25 int dummy;
26 };
27
28 struct md_params_html {
29 char *css;
30 int flags;
31 #define HTML_CSS_EMBED (1 << 0)
32 };
33
34 union md_params {
35 struct md_params_xml xml;
36 struct md_params_html html;
37 };
38
39 enum md_type {
40 MD_XML, /* XML. */
41 MD_HTML /* HTML4.01-strict. */
42 };
43
44 struct md_args {
45 union md_params params;/* Parameters for parser. */
46 enum md_type type; /* Type of parser. */
47
48 int warnings;
49 #define MD_WARN_ALL (1 << 0)
50 int verbosity;
51 };
52
53 struct md_buf {
54 int fd; /* Open file descriptor. */
55 char *name; /* Name of file/socket/whatever. */
56 char *buf; /* Buffer for storing data. */
57 size_t bufsz; /* Size of buf. */
58 };
59
60 __BEGIN_DECLS
61
62 /* Run the parser over prepared input and output buffers. Returns -1 on
63 * failure and 0 on success.
64 */
65 int md_run(const struct md_args *,
66 const struct md_buf *, const struct md_buf *);
67
68 __END_DECLS
69
70 #endif /*!LIBMDOCML_H*/