source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Cleanup post_bl_head() to use enum mdoc_list (avoid traversing
@ 2010-05-31 23:40 kristaps
  0 siblings, 0 replies; only message in thread
From: kristaps @ 2010-05-31 23:40 UTC (permalink / raw)
  To: source

Log Message:
-----------
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.

Modified Files:
--------------
    mdocml:
        TODO
        main.c
        mandoc.h
        mdoc_validate.c

Revision Data
-------------
Index: mdoc_validate.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_validate.c,v
retrieving revision 1.89
retrieving revision 1.90
diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.89 -r1.90
--- mdoc_validate.c
+++ mdoc_validate.c
@@ -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))
Index: TODO
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/TODO,v
retrieving revision 1.12
retrieving revision 1.13
diff -LTODO -LTODO -u -p -r1.12 -r1.13
--- TODO
+++ 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
Index: mandoc.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandoc.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -Lmandoc.h -Lmandoc.h -u -p -r1.7 -r1.8
--- mandoc.h
+++ mandoc.h
@@ -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 */
Index: main.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/main.c,v
retrieving revision 1.79
retrieving revision 1.80
diff -Lmain.c -Lmain.c -u -p -r1.79 -r1.80
--- main.c
+++ main.c
@@ -102,7 +102,6 @@ static	const char * const	mandocerrs[MAN
 	"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[MAN
 	"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",
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-05-31 23:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-31 23:40 mdocml: Cleanup post_bl_head() to use enum mdoc_list (avoid traversing kristaps

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).