diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-05-17 22:11:42 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-05-17 22:11:42 +0000 |
commit | b11413460f4cfc6adeaaec03d30246715922f54d (patch) | |
tree | 4836abc5d313954c48af7a9145a26a861f309230 /man_macro.c | |
parent | 4123a170dcf7bb0ee57516df099aa6efc10ef5e1 (diff) | |
download | mandoc-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 'man_macro.c')
-rw-r--r-- | man_macro.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/man_macro.c b/man_macro.c index a3394a11..2c9c0e39 100644 --- a/man_macro.c +++ b/man_macro.c @@ -23,6 +23,7 @@ #include <stdlib.h> #include <string.h> +#include "mandoc.h" #include "libman.h" enum rew { @@ -43,7 +44,7 @@ static enum rew rew_dohalt(enum mant, enum man_type, static enum rew rew_block(enum mant, enum man_type, const struct man_node *); static int rew_warn(struct man *, - struct man_node *, enum merr); + struct man_node *, enum mandocerr); const struct man_macro __man_macros[MAN_MAX] = { { in_line_eoln, MAN_NSCOPED }, /* br */ @@ -91,25 +92,26 @@ const struct man_macro * const man_macros = __man_macros; * Warn when "n" is an explicit non-roff macro. */ static int -rew_warn(struct man *m, struct man_node *n, enum merr er) +rew_warn(struct man *m, struct man_node *n, enum mandocerr er) { - if (er == WERRMAX || MAN_BLOCK != n->type) + if (er == MANDOCERR_MAX || MAN_BLOCK != n->type) return(1); if (MAN_VALID & n->flags) return(1); if ( ! (MAN_EXPLICIT & man_macros[n->tok].flags)) return(1); - return(man_nwarn(m, n, er)); + return(man_nmsg(m, n, er)); } /* - * Rewind scope. If a code "er" != WERRMAX has been provided, it will - * be used if an explicit block scope is being closed out. + * Rewind scope. If a code "er" != MANDOCERR_MAX has been provided, it + * will be used if an explicit block scope is being closed out. */ int -man_unscope(struct man *m, const struct man_node *n, enum merr er) +man_unscope(struct man *m, const struct man_node *n, + enum mandocerr er) { assert(n); @@ -248,7 +250,7 @@ rew_scope(enum man_type type, struct man *m, enum mant tok) */ assert(n); - return(man_unscope(m, n, WERRMAX)); + return(man_unscope(m, n, MANDOCERR_MAX)); } @@ -276,7 +278,7 @@ blk_close(MACRO_PROT_ARGS) break; if (NULL == nn) - if ( ! man_pwarn(m, line, ppos, WNOSCOPE)) + if ( ! man_pmsg(m, line, ppos, MANDOCERR_NOSCOPE)) return(0); if ( ! rew_scope(MAN_BODY, m, ntok)) @@ -478,6 +480,6 @@ int man_macroend(struct man *m) { - return(man_unscope(m, m->first, WEXITSCOPE)); + return(man_unscope(m, m->first, MANDOCERR_SCOPEEXIT)); } |