summaryrefslogtreecommitdiffstatshomepage
path: root/mdoc.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-07-29 08:46:06 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-07-29 08:46:06 +0000
commit21ec3346fa05f739794d70ac162859e993391cc7 (patch)
treec8ceb0b38c8f3893e154a83b8025049055343d79 /mdoc.c
parent60e690efb5ba94b4f6129c87b27d1f9d9e0ce55c (diff)
downloadmandoc-21ec3346fa05f739794d70ac162859e993391cc7.tar.gz
mandoc-21ec3346fa05f739794d70ac162859e993391cc7.tar.zst
mandoc-21ec3346fa05f739794d70ac162859e993391cc7.zip
Moved CALLABLE check to lookup_raw().
Made PARSABLE check occur prior to lookup(). Non-PARSEABLE macros no longer warn against having macro-like parameters. Non-CALLABLE macros no longer produce an error, just display their symbols (as in groff) (pointed out by joerg@netbsd.org).
Diffstat (limited to 'mdoc.c')
-rw-r--r--mdoc.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/mdoc.c b/mdoc.c
index 86adead3..3cea98cf 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc.c,v 1.96 2009/07/27 19:43:02 kristaps Exp $ */
+/* $Id: mdoc.c,v 1.97 2009/07/29 08:46:06 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -29,7 +29,6 @@ const char *const __mdoc_merrnames[MERRMAX] = {
"unterminated quoted parameter", /* EQUOTTERM */
"system: malloc error", /* EMALLOC */
"argument parameter suggested", /* EARGVAL */
- "macro not callable", /* ENOCALL */
"macro disallowed in prologue", /* EBODYPROL */
"macro disallowed in body", /* EPROLBODY */
"text disallowed in prologue", /* ETEXTPROL */
@@ -70,7 +69,6 @@ const char *const __mdoc_merrnames[MERRMAX] = {
"superfluous width argument", /* ENOWIDTH */
"system: utsname error", /* EUTSNAME */
"obsolete macro", /* EOBS */
- "macro-like parameter", /* EMACPARM */
"end-of-line scope violation", /* EIMPBRK */
"empty macro ignored", /* EIGNE */
"unclosed explicit scope", /* EOPEN */
@@ -353,7 +351,10 @@ int
mdoc_macro(struct mdoc *m, int tok,
int ln, int pp, int *pos, char *buf)
{
-
+ /*
+ * If we're in the prologue, deny "body" macros. Similarly, if
+ * we're in the body, deny prologue calls.
+ */
if (MDOC_PROLOGUE & mdoc_macros[tok].flags &&
MDOC_PBODY & m->flags)
return(mdoc_perr(m, ln, pp, EPROLBODY));
@@ -361,9 +362,6 @@ mdoc_macro(struct mdoc *m, int tok,
! (MDOC_PBODY & m->flags))
return(mdoc_perr(m, ln, pp, EBODYPROL));
- if (1 != pp && ! (MDOC_CALLABLE & mdoc_macros[tok].flags))
- return(mdoc_perr(m, ln, pp, ENOCALL));
-
return((*mdoc_macros[tok].fp)(m, tok, ln, pp, pos, buf));
}