]> git.cameronkatri.com Git - mandoc.git/blob - ml.h
*** empty log message ***
[mandoc.git] / ml.h
1 /* $Id: ml.h,v 1.10 2008/12/08 12:46:28 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 struct ml_cbs {
33 int (*ml_begin)(struct md_mbuf *,
34 const struct md_args *,
35 const struct tm *,
36 const char *, const char *,
37 enum roffmsec, const char *);
38 int (*ml_end)(struct md_mbuf *,
39 const struct md_args *);
40 ssize_t (*ml_beginstring)(struct md_mbuf *,
41 const struct md_args *,
42 const char *, size_t);
43 ssize_t (*ml_endstring)(struct md_mbuf *,
44 const struct md_args *,
45 const char *, size_t);
46 ssize_t (*ml_endtag)(struct md_mbuf *,
47 void *, const struct md_args *,
48 enum md_ns, int);
49 ssize_t (*ml_begintag)(struct md_mbuf *,
50 void *, const struct md_args *,
51 enum md_ns, int,
52 const int *, const char **);
53 int (*ml_alloc)(void **);
54 void (*ml_free)(void *);
55 };
56
57 __BEGIN_DECLS
58
59 int ml_putstring(struct md_mbuf *,
60 const char *, size_t *);
61 int ml_nputstring(struct md_mbuf *,
62 const char *, size_t, size_t *);
63 int ml_nputs(struct md_mbuf *,
64 const char *, size_t, size_t *);
65 int ml_puts(struct md_mbuf *, const char *, size_t *);
66 int ml_putchars(struct md_mbuf *,
67 char, size_t, size_t *);
68 char *ml_literal(int, const int *,
69 const char **, const char **);
70 char *ml_section(enum roffmsec);
71
72 struct md_mlg *mlg_alloc(const struct md_args *,
73 const struct md_rbuf *, struct md_mbuf *,
74 const struct ml_cbs *);
75 int mlg_exit(struct md_mlg *, int);
76 int mlg_line(struct md_mlg *, char *);
77
78 __END_DECLS
79
80 #endif /*!ML_H*/