+struct tbl_span *
+tbl_span(struct tbl_node *tbl)
+{
+ struct tbl_span *span;
+
+ span = tbl->current_span ? tbl->current_span->next
+ : tbl->first_span;
+ if (span != NULL)
+ tbl->current_span = span;
+ return span;
+}
+
+int
+tbl_end(struct tbl_node *tbl, int still_open)
+{
+ struct tbl_span *sp;
+
+ if (still_open)
+ mandoc_msg(MANDOCERR_BLK_NOEND, tbl->line, tbl->pos, "TS");
+ else if (tbl->part == TBL_PART_CDATA)
+ mandoc_msg(MANDOCERR_TBLDATA_BLK, tbl->line, tbl->pos, "TE");
+
+ sp = tbl->first_span;
+ while (sp != NULL && sp->first == NULL)
+ sp = sp->next;
+ if (sp == NULL) {
+ mandoc_msg(MANDOCERR_TBLDATA_NONE, tbl->line, tbl->pos, NULL);
+ return 0;
+ }
+ return 1;
+}