summaryrefslogtreecommitdiffstatshomepage
path: root/man_macro.c
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
commit95356d6189f5e5d41011a7cb60176f147e1fff7d (patch)
treec923ce026d6b8f420d203f151868c8b858e4501d /man_macro.c
parent114426748445942cb51394e59f2c62ad79bd974c (diff)
downloadmandoc-95356d6189f5e5d41011a7cb60176f147e1fff7d.tar.gz
mandoc-95356d6189f5e5d41011a7cb60176f147e1fff7d.tar.zst
mandoc-95356d6189f5e5d41011a7cb60176f147e1fff7d.zip
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.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/man_macro.c b/man_macro.c
index 27213c36..da560812 100644
--- a/man_macro.c
+++ b/man_macro.c
@@ -1,4 +1,4 @@
-/* $Id: man_macro.c,v 1.45 2010/05/17 10:50:32 joerg Exp $ */
+/* $Id: man_macro.c,v 1.46 2010/05/17 22:11:42 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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));
}