aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-05-31 23:40:25 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-05-31 23:40:25 +0000
commitcf92b022147d19cfe09cf470b887681b4174ff0e (patch)
treefeab9337392e6811c2492f8e5ebd071c53cf597f
parent5790a921156fab714a8d9a5804ad1603664e8c80 (diff)
downloadmandoc-cf92b022147d19cfe09cf470b887681b4174ff0e.tar.gz
mandoc-cf92b022147d19cfe09cf470b887681b4174ff0e.tar.zst
mandoc-cf92b022147d19cfe09cf470b887681b4174ff0e.zip
Cleanup post_bl_head() to use enum mdoc_list (avoid traversing that
list). Reverted MANDOC_COLUMNS to be a bad-bad syntax error: we don't, and apparently never have, allowed mixing of -column syntaxes. This would have segfaulted if encountered.
-rw-r--r--TODO2
-rw-r--r--main.c4
-rw-r--r--mandoc.h4
-rw-r--r--mdoc_validate.c25
4 files changed, 20 insertions, 15 deletions
diff --git a/TODO b/TODO
index 526b5366..b1ba9ef5 100644
--- a/TODO
+++ b/TODO
@@ -59,6 +59,8 @@
flags defined for struct mdoc_macro
- set a meaningful default if no `Bl' list type is assigned
+
+- have a blank `It' head for `Bl -tag' not puke
************************************************************************
* formatting issues: ugly output
diff --git a/main.c b/main.c
index af2e98a1..a0a563e7 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.79 2010/05/17 22:11:42 kristaps Exp $ */
+/* $Id: main.c,v 1.80 2010/05/31 23:40:25 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -102,7 +102,6 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
"out of order prologue",
"repeated prologue entry",
"list type must come first",
- "column syntax is inconsistent",
"bad standard",
"bad library",
"bad escape sequence",
@@ -144,6 +143,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
"no title in document",
"line argument(s) will be lost",
"body argument(s) will be lost",
+ "column syntax is inconsistent",
"missing font type",
"missing display type",
"missing list type",
diff --git a/mandoc.h b/mandoc.h
index f6203c5b..0a4737e7 100644
--- a/mandoc.h
+++ b/mandoc.h
@@ -1,4 +1,4 @@
-/* $Id: mandoc.h,v 1.7 2010/05/25 12:37:20 kristaps Exp $ */
+/* $Id: mandoc.h,v 1.8 2010/05/31 23:40:25 kristaps Exp $ */
/*
* Copyright (c) 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -31,7 +31,6 @@ enum mandocerr {
MANDOCERR_PROLOGOOO, /* out of order prologue */
MANDOCERR_PROLOGREP, /* repeated prologue entry */
MANDOCERR_LISTFIRST, /* list type must come first */
- MANDOCERR_COLUMNS, /* column syntax is inconsistent */
MANDOCERR_BADSTANDARD, /* bad standard */
MANDOCERR_BADLIB, /* bad library */
MANDOCERR_BADESCAPE, /* bad escape sequence */
@@ -78,6 +77,7 @@ enum mandocerr {
MANDOCERR_BODYLOST, /* body argument(s) will be lost */
#define MANDOCERR_ERROR MANDOCERR_BODYLOST
+ MANDOCERR_COLUMNS, /* column syntax is inconsistent */
/* FIXME: this should be a MANDOCERR_ERROR */
MANDOCERR_FONTTYPE, /* missing font type */
/* FIXME: this should be a MANDOCERR_ERROR */
diff --git a/mdoc_validate.c b/mdoc_validate.c
index fd9af9cd..48e000c7 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.89 2010/05/31 23:10:51 kristaps Exp $ */
+/* $Id: mdoc_validate.c,v 1.90 2010/05/31 23:40:25 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -1024,20 +1024,23 @@ post_it(POST_ARGS)
static int
post_bl_head(POST_ARGS)
{
- int i;
- const struct mdoc_node *n;
- const struct mdoc_argv *a;
+ int i;
+ struct mdoc_node *n;
+ assert(mdoc->last->parent);
n = mdoc->last->parent;
- assert(n->args);
- for (i = 0; i < (int)n->args->argc; i++) {
- a = &n->args->argv[i];
- if (a->arg == MDOC_Column) {
- if (a->sz && mdoc->last->nchild)
- return(mdoc_nmsg(mdoc, n, MANDOCERR_COLUMNS));
- return(1);
+ if (LIST_column == n->data.list) {
+ for (i = 0; i < (int)n->args->argc; i++)
+ if (MDOC_Column == n->args->argv[i].arg)
+ break;
+ assert(i < (int)n->args->argc);
+
+ if (n->args->argv[i].sz && mdoc->last->nchild) {
+ mdoc_nmsg(mdoc, n, MANDOCERR_COLUMNS);
+ return(0);
}
+ return(1);
}
if (0 == (i = mdoc->last->nchild))