summaryrefslogtreecommitdiffstats
path: root/libmdoc.h
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-05-17 22:11:42 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-05-17 22:11:42 +0000
commitb11413460f4cfc6adeaaec03d30246715922f54d (patch)
tree4836abc5d313954c48af7a9145a26a861f309230 /libmdoc.h
parent4123a170dcf7bb0ee57516df099aa6efc10ef5e1 (diff)
downloadmandoc-b11413460f4cfc6adeaaec03d30246715922f54d.tar.gz
Enable the unified error/warning enumeration in mandoc.h that's
stringified in main.c. Allow `An' to handle an argument and child (with a warning). Allow `Rv' and `Ex' to work without a prior `Nm' as groff does (with a warning). Allow inconsistent column syntax to only raise a warning.
Diffstat (limited to 'libmdoc.h')
-rw-r--r--libmdoc.h21
1 files changed, 7 insertions, 14 deletions
diff --git a/libmdoc.h b/libmdoc.h
index 442eca64..d12240c4 100644
--- a/libmdoc.h
+++ b/libmdoc.h
@@ -26,7 +26,7 @@ enum mdoc_next {
struct mdoc {
void *data;
- struct mdoc_cb cb;
+ mandocmsg msg;
int flags;
#define MDOC_HALT (1 << 0) /* error in parse: halt */
#define MDOC_LITERAL (1 << 1) /* in a literal scope */
@@ -142,19 +142,12 @@ extern const struct mdoc_macro *const mdoc_macros;
__BEGIN_DECLS
-#define mdoc_perr(m, l, p, t) \
- mdoc_err((m), (l), (p), 1, (t))
-#define mdoc_pwarn(m, l, p, t) \
- mdoc_err((m), (l), (p), 0, (t))
-#define mdoc_nerr(m, n, t) \
- mdoc_err((m), (n)->line, (n)->pos, 1, (t))
-#define mdoc_nwarn(m, n, t) \
- mdoc_err((m), (n)->line, (n)->pos, 0, (t))
-
-int mdoc_err(struct mdoc *, int, int, int, enum merr);
-int mdoc_verr(struct mdoc *, int, int, const char *, ...);
-int mdoc_vwarn(struct mdoc *, int, int, const char *, ...);
-
+#define mdoc_pmsg(m, l, p, t) \
+ (*(m)->msg)((t), (m)->data, (l), (p), NULL)
+#define mdoc_nmsg(m, n, t) \
+ (*(m)->msg)((t), (m)->data, (n)->line, (n)->pos, NULL)
+int mdoc_vmsg(struct mdoc *, enum mandocerr,
+ int, int, const char *, ...);
int mdoc_macro(MACRO_PROT_ARGS);
int mdoc_word_alloc(struct mdoc *,
int, int, const char *);