]> git.cameronkatri.com Git - mandoc.git/blob - ml.h
1994ec327a0449078a6797a785c8f5ab9510eaa8
[mandoc.git] / ml.h
1 /* $Id: ml.h,v 1.6 2008/12/05 17:43:14 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 ML_H
20 #define ML_H
21
22 struct md_mlg;
23
24 enum md_ns {
25 MD_NS_BLOCK,
26 MD_NS_HEAD,
27 MD_NS_BODY,
28 MD_NS_INLINE,
29 MD_NS_DEFAULT,
30 };
31
32 typedef int (*ml_begin)(struct md_mbuf *, const struct md_args *,
33 const struct tm *, const char *, const char *,
34 const char *, const char *);
35 typedef int (*ml_end)(struct md_mbuf *,
36 const struct md_args *);
37 typedef ssize_t (*ml_endtag)(struct md_mbuf *, void *,
38 const struct md_args *, enum md_ns, int);
39 typedef ssize_t (*ml_begintag)(struct md_mbuf *, void *,
40 const struct md_args *, enum md_ns, int,
41 const int *, const char **);
42
43 __BEGIN_DECLS
44
45 int ml_putstring(struct md_mbuf *,
46 const char *, size_t *);
47 int ml_nputstring(struct md_mbuf *,
48 const char *, size_t, size_t *);
49 int ml_nputs(struct md_mbuf *,
50 const char *, size_t, size_t *);
51 int ml_puts(struct md_mbuf *, const char *, size_t *);
52 int ml_putchars(struct md_mbuf *,
53 char, size_t, size_t *);
54
55 struct md_mlg *mlg_alloc(const struct md_args *, void *,
56 const struct md_rbuf *, struct md_mbuf *,
57 ml_begintag, ml_endtag, ml_begin, ml_end);
58 int mlg_exit(struct md_mlg *, int);
59 int mlg_line(struct md_mlg *, char *);
60
61 __END_DECLS
62
63 #endif /*!ML_H*/