Annotation of mandoc/private.h, Revision 1.55
1.55 ! kristaps 1: /* $Id: private.h,v 1.54 2009/01/05 14:14:04 kristaps Exp $ */
1.1 kristaps 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 PRIVATE_H
20: #define PRIVATE_H
21:
1.41 kristaps 22: #include "mdoc.h"
1.27 kristaps 23:
1.52 kristaps 24: enum mdoc_next {
25: MDOC_NEXT_SIBLING = 0,
26: MDOC_NEXT_CHILD
27: };
28:
1.41 kristaps 29: struct mdoc {
30: void *data;
31: struct mdoc_cb cb;
32: void *htab;
1.52 kristaps 33: int flags;
34: enum mdoc_next next;
1.41 kristaps 35: struct mdoc_node *last;
36: struct mdoc_node *first;
1.43 kristaps 37: struct mdoc_meta meta;
1.42 kristaps 38: enum mdoc_sec sec_lastn;
39: enum mdoc_sec sec_last;
1.36 kristaps 40: };
41:
1.41 kristaps 42: struct mdoc_macro {
43: int (*fp)(struct mdoc *, int, int, int *, char *);
44: int flags;
45: #define MDOC_CALLABLE (1 << 0)
46: #define MDOC_EXPLICIT (1 << 1)
1.51 kristaps 47: #define MDOC_QUOTABLE (1 << 2)
1.52 kristaps 48: #define MDOC_PROLOGUE (1 << 3)
1.55 ! kristaps 49: #define MDOC_NESTED (1 << 4)
1.8 kristaps 50: };
1.5 kristaps 51:
1.41 kristaps 52: extern const struct mdoc_macro *const mdoc_macros;
1.24 kristaps 53:
1.43 kristaps 54: #define MACRO_PROT_ARGS struct mdoc *mdoc, int tok, \
55: int ppos, int *pos, char *buf
56:
1.1 kristaps 57: __BEGIN_DECLS
58:
1.41 kristaps 59: int mdoc_err(struct mdoc *, int, int, enum mdoc_err);
60: int mdoc_warn(struct mdoc *, int, int, enum mdoc_warn);
61: void mdoc_msg(struct mdoc *, int, const char *, ...);
62: int mdoc_macro(struct mdoc *, int, int, int *, char *);
63: int mdoc_find(const struct mdoc *, const char *);
64: void mdoc_word_alloc(struct mdoc *, int, const char *);
65: void mdoc_elem_alloc(struct mdoc *, int, int,
1.53 kristaps 66: size_t, const struct mdoc_arg *);
1.41 kristaps 67: void mdoc_block_alloc(struct mdoc *, int, int,
68: size_t, const struct mdoc_arg *);
1.52 kristaps 69: void mdoc_head_alloc(struct mdoc *, int, int);
1.55 ! kristaps 70: void mdoc_tail_alloc(struct mdoc *, int, int);
1.41 kristaps 71: void mdoc_body_alloc(struct mdoc *, int, int);
72: void mdoc_node_free(struct mdoc_node *);
73: void mdoc_sibling(struct mdoc *, int, struct mdoc_node **,
74: struct mdoc_node **, struct mdoc_node *);
1.44 kristaps 75: void *mdoc_tokhash_alloc(void);
76: int mdoc_tokhash_find(const void *, const char *);
77: void mdoc_tokhash_free(void *);
1.42 kristaps 78: int mdoc_isdelim(const char *);
1.45 kristaps 79: int mdoc_iscdelim(char);
1.43 kristaps 80: enum mdoc_sec mdoc_atosec(size_t, const char **);
81: enum mdoc_msec mdoc_atomsec(const char *);
82: enum mdoc_vol mdoc_atovol(const char *);
83: enum mdoc_arch mdoc_atoarch(const char *);
1.48 kristaps 84: enum mdoc_att mdoc_atoatt(const char *);
1.43 kristaps 85: time_t mdoc_atotime(const char *);
86:
1.52 kristaps 87: int mdoc_valid_pre(struct mdoc *, int, int,
1.50 kristaps 88: int, const struct mdoc_arg *);
1.53 kristaps 89: int mdoc_valid_post(struct mdoc *, int, int);
1.54 kristaps 90: int mdoc_action(struct mdoc *, int, int);
1.50 kristaps 91:
1.45 kristaps 92: int mdoc_argv(struct mdoc *, int,
93: struct mdoc_arg *, int *, char *);
1.52 kristaps 94: #define ARGV_ERROR (-1)
95: #define ARGV_EOLN (0)
96: #define ARGV_ARG (1)
97: #define ARGV_WORD (2)
1.44 kristaps 98: void mdoc_argv_free(int, struct mdoc_arg *);
1.45 kristaps 99: int mdoc_args(struct mdoc *, int,
100: int *, char *, int, char **);
101: #define ARGS_ERROR (-1)
102: #define ARGS_EOLN (0)
103: #define ARGS_WORD (1)
104: #define ARGS_PUNCT (2)
105:
106: #define ARGS_QUOTED (1 << 0)
107: #define ARGS_DELIM (1 << 1)
1.44 kristaps 108:
109: int xstrlcat(char *, const char *, size_t);
110: int xstrlcpy(char *, const char *, size_t);
111: int xstrcmp(const char *, const char *);
112: void *xcalloc(size_t, size_t);
113: char *xstrdup(const char *);
114:
1.51 kristaps 115: int macro_obsolete(MACRO_PROT_ARGS);
1.48 kristaps 116: int macro_constant(MACRO_PROT_ARGS);
1.55 ! kristaps 117: int macro_constant_scoped(MACRO_PROT_ARGS);
1.47 kristaps 118: int macro_constant_delimited(MACRO_PROT_ARGS);
1.43 kristaps 119: int macro_text(MACRO_PROT_ARGS);
1.52 kristaps 120: int macro_scoped(MACRO_PROT_ARGS);
121: int macro_close_explicit(MACRO_PROT_ARGS);
1.46 kristaps 122: int macro_scoped_line(MACRO_PROT_ARGS);
1.52 kristaps 123: int macro_prologue(MACRO_PROT_ARGS);
1.35 kristaps 124:
1.1 kristaps 125: __END_DECLS
126:
127: #endif /*!PRIVATE_H*/
CVSweb