]> git.cameronkatri.com Git - mandoc.git/blob - libmdocml.h
Fixed clarity in libmdocml.c.
[mandoc.git] / libmdocml.h
1 /* $Id: libmdocml.h,v 1.6 2008/11/23 23:12:47 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_dummy {
25 int dummy;
26 };
27
28 struct md_params_html4_strict {
29 int dummy;
30 };
31
32 union md_params {
33 struct md_params_dummy dummy;
34 struct md_params_html4_strict html4_strict;
35 };
36
37 enum md_type {
38 MD_DUMMY, /* Dummy type echoes input. */
39 MD_HTML4_STRICT /* HTML4.01-strict. */
40 };
41
42 struct md_args {
43 union md_params params;/* Parameters for parser. */
44 enum md_type type; /* Type of parser. */
45 int dbg; /* Debug level. */
46 #define MD_DBG_TREE 1
47 };
48
49 struct md_buf {
50 int fd; /* Open file descriptor. */
51 char *name; /* Name of file/socket/whatever. */
52 char *buf; /* Buffer for storing data. */
53 size_t bufsz; /* Size of buf. */
54 };
55
56 __BEGIN_DECLS
57
58 /* Run the parser over prepared input and output buffers. Returns -1 on
59 * failure and 0 on success.
60 */
61 int md_run(const struct md_args *,
62 const struct md_buf *, const struct md_buf *);
63
64 __END_DECLS
65
66 #endif /*!LIBMDOCML_H*/