=================================================================== RCS file: /cvs/mandoc/tbl_data.c,v retrieving revision 1.5 retrieving revision 1.9 diff -u -p -r1.5 -r1.9 --- mandoc/tbl_data.c 2011/01/01 17:10:20 1.5 +++ mandoc/tbl_data.c 2011/01/02 12:04:23 1.9 @@ -1,4 +1,4 @@ -/* $Id: tbl_data.c,v 1.5 2011/01/01 17:10:20 kristaps Exp $ */ +/* $Id: tbl_data.c,v 1.9 2011/01/02 12:04:23 kristaps Exp $ */ /* * Copyright (c) 2009, 2010 Kristaps Dzonsons * @@ -18,16 +18,17 @@ #include #include #include +#include #include "mandoc.h" #include "libmandoc.h" #include "libroff.h" -static void data(struct tbl *, struct tbl_span *, +static void data(struct tbl_node *, struct tbl_span *, int, const char *, int *); void -data(struct tbl *tbl, struct tbl_span *dp, +data(struct tbl_node *tbl, struct tbl_span *dp, int ln, const char *p, int *pos) { struct tbl_dat *dat; @@ -51,6 +52,9 @@ data(struct tbl *tbl, struct tbl_span *dp, dat = mandoc_calloc(1, sizeof(struct tbl_dat)); dat->layout = cp; + if (NULL == dat->layout) + TBL_MSG(tbl, MANDOCERR_TBLEXTRADAT, ln, *pos); + if (dp->last) { dp->last->next = dat; dp->last = dat; @@ -58,7 +62,7 @@ data(struct tbl *tbl, struct tbl_span *dp, dp->last = dp->first = dat; sv = *pos; - while (p[*pos] && p[*pos] != tbl->tab) + while (p[*pos] && p[*pos] != tbl->opts.tab) (*pos)++; dat->string = mandoc_malloc(*pos - sv + 1); @@ -81,7 +85,7 @@ data(struct tbl *tbl, struct tbl_span *dp, } int -tbl_data(struct tbl *tbl, int ln, const char *p) +tbl_data(struct tbl_node *tbl, int ln, const char *p) { struct tbl_span *dp; struct tbl_row *rp; @@ -110,13 +114,17 @@ tbl_data(struct tbl *tbl, int ln, const char *p) rp = tbl->first_row; dp = mandoc_calloc(1, sizeof(struct tbl_span)); + dp->tbl = &tbl->opts; dp->layout = rp; + dp->head = tbl->first_head; if (tbl->last_span) { tbl->last_span->next = dp; tbl->last_span = dp; - } else + } else { tbl->last_span = tbl->first_span = dp; + dp->flags |= TBL_SPAN_FIRST; + } if ( ! strcmp(p, "_")) { dp->pos = TBL_SPAN_HORIZ;