=================================================================== RCS file: /cvs/mandoc/mdoc_validate.c,v retrieving revision 1.108 retrieving revision 1.111 diff -u -p -r1.108 -r1.111 --- mandoc/mdoc_validate.c 2010/07/02 17:42:23 1.108 +++ mandoc/mdoc_validate.c 2010/07/19 11:11:54 1.111 @@ -1,6 +1,6 @@ -/* $Id: mdoc_validate.c,v 1.108 2010/07/02 17:42:23 schwarze Exp $ */ +/* $Id: mdoc_validate.c,v 1.111 2010/07/19 11:11:54 kristaps Exp $ */ /* - * Copyright (c) 2008, 2009 Kristaps Dzonsons + * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -32,7 +32,6 @@ #include "libmandoc.h" /* FIXME: .Bl -diag can't have non-text children in HEAD. */ -/* TODO: ignoring Pp (it's superfluous in some invocations). */ #define PRE_ARGS struct mdoc *mdoc, struct mdoc_node *n #define POST_ARGS struct mdoc *mdoc @@ -647,8 +646,16 @@ pre_bl(PRE_ARGS) /* Assign list type. */ - if (LIST__NONE != lt && n->data.Bl->type == LIST__NONE) + if (LIST__NONE != lt && n->data.Bl->type == LIST__NONE) { n->data.Bl->type = lt; + /* Set column information, too. */ + if (LIST_column == lt) { + n->data.Bl->ncols = + n->args->argv[i].sz; + n->data.Bl->cols = (const char **) + n->args->argv[i].value; + } + } /* The list type should come first. */ @@ -1150,14 +1157,8 @@ post_it(POST_ARGS) return(0); break; case (LIST_column): - cols = -1; - for (i = 0; i < (int)n->args->argc; i++) - if (MDOC_Column == n->args->argv[i].arg) { - cols = (int)n->args->argv[i].sz; - break; - } + cols = (int)n->data.Bl->ncols; - assert(-1 != cols); assert(NULL == mdoc->last->head->child); if (NULL == mdoc->last->body->child) @@ -1197,12 +1198,7 @@ post_bl_head(POST_ARGS) n = mdoc->last->parent; if (LIST_column == n->data.Bl->type) { - 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) { + if (n->data.Bl->ncols && mdoc->last->nchild) { mdoc_nmsg(mdoc, n, MANDOCERR_COLUMNS); return(0); }