=================================================================== RCS file: /cvs/mandoc/tbl_layout.c,v retrieving revision 1.14 retrieving revision 1.18 diff -u -p -r1.14 -r1.18 --- mandoc/tbl_layout.c 2011/01/10 14:40:30 1.14 +++ mandoc/tbl_layout.c 2011/04/04 23:04:38 1.18 @@ -1,4 +1,4 @@ -/* $Id: tbl_layout.c,v 1.14 2011/01/10 14:40:30 kristaps Exp $ */ +/* $Id: tbl_layout.c,v 1.18 2011/04/04 23:04:38 kristaps Exp $ */ /* * Copyright (c) 2009, 2010 Kristaps Dzonsons * @@ -14,6 +14,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include @@ -100,7 +104,8 @@ mod: (*pos)++; goto mod; } - TBL_MSG(tbl, MANDOCERR_TBLLAYOUT, ln, *pos); + mandoc_msg(MANDOCERR_TBLLAYOUT, + tbl->parse, ln, *pos, NULL); return(0); } @@ -117,12 +122,13 @@ mod: /* No greater than 4 digits. */ if (4 == i) { - TBL_MSG(tbl, MANDOCERR_TBLLAYOUT, ln, *pos); + mandoc_msg(MANDOCERR_TBLLAYOUT, tbl->parse, + ln, *pos, NULL); return(0); } *pos += i; - cp->spacing = atoi(buf); + cp->spacing = (size_t)atoi(buf); goto mod; /* NOTREACHED */ @@ -156,7 +162,8 @@ mod: (*pos)--; break; default: - TBL_MSG(tbl, MANDOCERR_TBLLAYOUT, ln, *pos - 1); + mandoc_msg(MANDOCERR_TBLLAYOUT, tbl->parse, + ln, *pos - 1, NULL); return(0); } @@ -171,7 +178,8 @@ mod: break; } - TBL_MSG(tbl, MANDOCERR_TBLLAYOUT, ln, *pos - 1); + mandoc_msg(MANDOCERR_TBLLAYOUT, tbl->parse, + ln, *pos - 1, NULL); return(0); } @@ -189,7 +197,8 @@ cell(struct tbl_node *tbl, struct tbl_row *rp, break; if (KEYS_MAX == i) { - TBL_MSG(tbl, MANDOCERR_TBLLAYOUT, ln, *pos); + mandoc_msg(MANDOCERR_TBLLAYOUT, tbl->parse, + ln, *pos, NULL); return(0); } @@ -205,7 +214,8 @@ cell(struct tbl_node *tbl, struct tbl_row *rp, if (TBL_CELL_SPAN == c) { if (NULL == rp->first) { - TBL_MSG(tbl, MANDOCERR_TBLLAYOUT, ln, *pos); + mandoc_msg(MANDOCERR_TBLLAYOUT, tbl->parse, + ln, *pos, NULL); return(0); } else if (rp->last) switch (rp->last->pos) { @@ -213,13 +223,24 @@ cell(struct tbl_node *tbl, struct tbl_row *rp, case (TBL_CELL_DVERT): case (TBL_CELL_HORIZ): case (TBL_CELL_DHORIZ): - TBL_MSG(tbl, MANDOCERR_TBLLAYOUT, ln, *pos); + mandoc_msg(MANDOCERR_TBLLAYOUT, tbl->parse, + ln, *pos, NULL); return(0); default: break; } } + /* + * If a vertical spanner is found, we may not be in the first + * row. + */ + + if (TBL_CELL_DOWN == c && rp == tbl->first_row) { + mandoc_msg(MANDOCERR_TBLLAYOUT, tbl->parse, ln, *pos, NULL); + return(0); + } + (*pos)++; /* Extra check for the double-vertical. */ @@ -234,7 +255,7 @@ cell(struct tbl_node *tbl, struct tbl_row *rp, if (rp->last && (TBL_CELL_VERT == c || TBL_CELL_DVERT == c) && (TBL_CELL_VERT == rp->last->pos || TBL_CELL_DVERT == rp->last->pos)) { - TBL_MSG(tbl, MANDOCERR_TBLLAYOUT, ln, *pos - 1); + mandoc_msg(MANDOCERR_TBLLAYOUT, tbl->parse, ln, *pos - 1, NULL); return(0); } @@ -275,7 +296,8 @@ cell: if ('.' == p[*pos]) { tbl->part = TBL_PART_DATA; if (NULL == tbl->first_row) - TBL_MSG(tbl, MANDOCERR_TBLNOLAYOUT, ln, *pos); + mandoc_msg(MANDOCERR_TBLNOLAYOUT, tbl->parse, + ln, *pos, NULL); (*pos)++; return; }