]>
git.cameronkatri.com Git - mandoc.git/blob - private.h
1 /* $Id: private.h,v 1.56 2009/01/06 15:49:44 kristaps Exp $ */
3 * Copyright (c) 2008 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
7 * above copyright notice and this permission notice appear in all
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.
25 MDOC_NEXT_SIBLING
= 0,
35 struct mdoc_node
*last
;
36 struct mdoc_node
*first
;
37 struct mdoc_meta meta
;
38 enum mdoc_sec sec_lastn
;
39 enum mdoc_sec sec_last
;
43 int (*fp
)(struct mdoc
*, int, int, int *, char *);
45 #define MDOC_CALLABLE (1 << 0)
46 #define MDOC_PARSED (1 << 1)
47 #define MDOC_EXPLICIT (1 << 2)
48 #define MDOC_QUOTABLE (1 << 3)
49 #define MDOC_PROLOGUE (1 << 4)
50 #define MDOC_NESTED (1 << 5)
53 extern const struct mdoc_macro
*const mdoc_macros
;
55 #define MACRO_PROT_ARGS struct mdoc *mdoc, int tok, \
56 int ppos, int *pos, char *buf
60 int mdoc_err(struct mdoc
*, int, int, enum mdoc_err
);
61 int mdoc_warn(struct mdoc
*, int, int, enum mdoc_warn
);
62 void mdoc_msg(struct mdoc
*, int, const char *, ...);
63 int mdoc_macro(struct mdoc
*, int, int, int *, char *);
64 int mdoc_find(const struct mdoc
*, const char *);
65 void mdoc_word_alloc(struct mdoc
*, int, const char *);
66 void mdoc_elem_alloc(struct mdoc
*, int, int,
67 size_t, const struct mdoc_arg
*);
68 void mdoc_block_alloc(struct mdoc
*, int, int,
69 size_t, const struct mdoc_arg
*);
70 void mdoc_head_alloc(struct mdoc
*, int, int);
71 void mdoc_tail_alloc(struct mdoc
*, int, int);
72 void mdoc_body_alloc(struct mdoc
*, int, int);
73 void mdoc_node_free(struct mdoc_node
*);
74 void mdoc_sibling(struct mdoc
*, int, struct mdoc_node
**,
75 struct mdoc_node
**, struct mdoc_node
*);
76 void *mdoc_tokhash_alloc(void);
77 int mdoc_tokhash_find(const void *, const char *);
78 void mdoc_tokhash_free(void *);
79 int mdoc_isdelim(const char *);
80 int mdoc_iscdelim(char);
81 enum mdoc_sec
mdoc_atosec(size_t, const char **);
82 enum mdoc_msec
mdoc_atomsec(const char *);
83 enum mdoc_vol
mdoc_atovol(const char *);
84 enum mdoc_arch
mdoc_atoarch(const char *);
85 enum mdoc_att
mdoc_atoatt(const char *);
86 time_t mdoc_atotime(const char *);
88 int mdoc_valid_pre(struct mdoc
*, int, int,
89 int, const struct mdoc_arg
*);
90 int mdoc_valid_post(struct mdoc
*, int, int);
91 int mdoc_action(struct mdoc
*, int, int);
93 int mdoc_argv(struct mdoc
*, int,
94 struct mdoc_arg
*, int *, char *);
95 #define ARGV_ERROR (-1)
99 void mdoc_argv_free(int, struct mdoc_arg
*);
100 int mdoc_args(struct mdoc
*, int,
101 int *, char *, int, char **);
102 #define ARGS_ERROR (-1)
103 #define ARGS_EOLN (0)
104 #define ARGS_WORD (1)
105 #define ARGS_PUNCT (2)
107 #define ARGS_QUOTED (1 << 0)
108 #define ARGS_DELIM (1 << 1)
110 int xstrlcat(char *, const char *, size_t);
111 int xstrlcpy(char *, const char *, size_t);
112 int xstrcmp(const char *, const char *);
113 void *xcalloc(size_t, size_t);
114 char *xstrdup(const char *);
116 int macro_obsolete(MACRO_PROT_ARGS
);
117 int macro_constant(MACRO_PROT_ARGS
);
118 int macro_constant_scoped(MACRO_PROT_ARGS
);
119 int macro_constant_delimited(MACRO_PROT_ARGS
);
120 int macro_text(MACRO_PROT_ARGS
);
121 int macro_scoped(MACRO_PROT_ARGS
);
122 int macro_close_explicit(MACRO_PROT_ARGS
);
123 int macro_scoped_line(MACRO_PROT_ARGS
);
124 int macro_prologue(MACRO_PROT_ARGS
);
128 #endif /*!PRIVATE_H*/