- /* XXX: throw away data for now. */
- if (NULL != (sp = tbl_data(tbl, ln, p))) {
- while (NULL != (dp = sp->first)) {
- sp->first = sp->first->next;
+ /*
+ * This only returns zero if the line is empty, so we ignore it
+ * and continue on.
+ */
+ return(tbl_data(tbl, ln, p) ? ROFF_TBL : ROFF_IGN);
+}
+
+struct tbl_node *
+tbl_alloc(int pos, int line, struct mparse *parse)
+{
+ struct tbl_node *p;
+
+ p = mandoc_calloc(1, sizeof(struct tbl_node));
+ p->line = line;
+ p->pos = pos;
+ p->parse = parse;
+ p->part = TBL_PART_OPTS;
+ p->opts.tab = '\t';
+ p->opts.linesize = 12;
+ p->opts.decimal = '.';
+ return(p);
+}
+
+void
+tbl_free(struct tbl_node *p)
+{
+ struct tbl_row *rp;
+ struct tbl_cell *cp;
+ struct tbl_span *sp;
+ struct tbl_dat *dp;
+ struct tbl_head *hp;
+
+ while (NULL != (rp = p->first_row)) {
+ p->first_row = rp->next;
+ while (rp->first) {
+ cp = rp->first;
+ rp->first = cp->next;
+ free(cp);
+ }
+ free(rp);
+ }
+
+ while (NULL != (sp = p->first_span)) {
+ p->first_span = sp->next;
+ while (sp->first) {
+ dp = sp->first;
+ sp->first = dp->next;