summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/mdoc_macro.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/mandoc/mdoc_macro.c')
-rw-r--r--usr.bin/mandoc/mdoc_macro.c45
1 files changed, 6 insertions, 39 deletions
diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c
index 163f812eb74..5752729efbc 100644
--- a/usr.bin/mandoc/mdoc_macro.c
+++ b/usr.bin/mandoc/mdoc_macro.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_macro.c,v 1.9 2009/07/12 21:45:44 schwarze Exp $ */
+/* $Id: mdoc_macro.c,v 1.10 2009/07/12 22:35:08 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -22,13 +22,6 @@
#include "libmdoc.h"
-enum mwarn {
- WIGNE,
- WIMPBRK,
- WMACPARM,
- WOBS
-};
-
#define REWIND_REWIND (1 << 0)
#define REWIND_NOHALT (1 << 1)
#define REWIND_HALT (1 << 2)
@@ -55,7 +48,6 @@ static int rew_subblock(enum mdoc_type,
static int rew_last(struct mdoc *, struct mdoc_node *);
static int append_delims(struct mdoc *, int, int *, char *);
static int lookup(struct mdoc *, int, int, int, const char *);
-static int pwarn(struct mdoc *, int, int, enum mwarn);
static int swarn(struct mdoc *, enum mdoc_type, int, int,
const struct mdoc_node *);
@@ -186,31 +178,6 @@ const struct mdoc_macro * const mdoc_macros = __mdoc_macros;
static int
-pwarn(struct mdoc *mdoc, int line, int pos, enum mwarn type)
-{
- char *p;
-
- p = NULL;
- switch (type) {
- case (WIGNE):
- p = "ignoring empty element";
- break;
- case (WIMPBRK):
- p = "crufty end-of-line scope violation";
- break;
- case (WMACPARM):
- p = "macro-like parameter";
- break;
- case (WOBS):
- p = "macro marked obsolete";
- break;
- }
- assert(p);
- return(mdoc_pwarn(mdoc, line, pos, WARN_SYNTAX, p));
-}
-
-
-static int
swarn(struct mdoc *mdoc, enum mdoc_type type,
int line, int pos, const struct mdoc_node *p)
{
@@ -293,7 +260,7 @@ lookup(struct mdoc *mdoc, int line, int pos, int from, const char *p)
return(res);
if (MDOC_MAX == res)
return(res);
- if ( ! pwarn(mdoc, line, pos, WMACPARM))
+ if ( ! mdoc_pwarn(mdoc, line, pos, EMACPARM))
return(-1);
return(MDOC_MAX);
}
@@ -836,7 +803,7 @@ in_line(MACRO_PROT_ARGS)
return(0);
} else if ( ! nc && 0 == cnt) {
mdoc_argv_free(arg);
- if ( ! pwarn(mdoc, line, ppos, WIGNE))
+ if ( ! mdoc_pwarn(mdoc, line, ppos, EIGNE))
return(0);
}
c = mdoc_macro(mdoc, c, line, la, pos, buf);
@@ -892,7 +859,7 @@ in_line(MACRO_PROT_ARGS)
return(0);
} else if ( ! nc && 0 == cnt) {
mdoc_argv_free(arg);
- if ( ! pwarn(mdoc, line, ppos, WIGNE))
+ if ( ! mdoc_pwarn(mdoc, line, ppos, EIGNE))
return(0);
}
@@ -1076,7 +1043,7 @@ blk_part_imp(MACRO_PROT_ARGS)
if (body == n)
break;
- if (NULL == n && ! pwarn(mdoc, body->line, body->pos, WIMPBRK))
+ if (NULL == n && ! mdoc_nwarn(mdoc, body, EIMPBRK))
return(0);
if (n && ! rew_last(mdoc, body))
@@ -1379,7 +1346,7 @@ static int
obsolete(MACRO_PROT_ARGS)
{
- return(pwarn(mdoc, line, ppos, WOBS));
+ return(mdoc_pwarn(mdoc, line, ppos, EOBS));
}