- const struct tbl_cell *cp, *cpn, *cpp;
- const struct roffcol *col;
- int cross, dvert, line, linewidth, uvert;
-
- cp = sp->layout->first;
- cpn = cpp = NULL;
- if (flags & HRULE_DATA) {
- linewidth = sp->pos == TBL_SPAN_DHORIZ ? 2 : 1;
- cpn = sp->next == NULL ? NULL : sp->next->layout->first;
- if (cpn == cp)
- cpn = NULL;
- } else
- linewidth = tp->enc == TERMENC_UTF8 &&
- sp->opts->opts & TBL_OPT_DBOX ? 2 : 1;
+ const struct tbl_cell *cpp; /* Layout cell above this line. */
+ const struct tbl_cell *cpn; /* Layout cell below this line. */
+ const struct tbl_dat *dpn; /* Data cell below this line. */
+ const struct roffcol *col; /* Contains width and spacing. */
+ int opts; /* For the table as a whole. */
+ int bw; /* Box line width. */
+ int hw; /* Horizontal line width. */
+ int lw, rw; /* Left and right line widths. */
+ int uw, dw; /* Vertical line widths. */
+
+ cpp = spp == NULL ? NULL : spp->layout->first;
+ cpn = spn == NULL ? NULL : spn->layout->first;
+ dpn = NULL;
+ if (spn != NULL) {
+ if (spn->pos == TBL_SPAN_DATA)
+ dpn = spn->first;
+ else if (spn->next != NULL)
+ dpn = spn->next->first;
+ }
+ opts = spn == NULL ? spp->opts->opts : spn->opts->opts;
+ bw = opts & TBL_OPT_DBOX ? (tp->enc == TERMENC_UTF8 ? 2 : 1) :
+ opts & (TBL_OPT_BOX | TBL_OPT_ALLBOX) ? 1 : 0;
+ hw = flags == TBL_OPT_DBOX || flags == TBL_OPT_BOX ? bw :
+ spn->pos == TBL_SPAN_DHORIZ ? 2 : 1;
+
+ /* Print the left end of the line. */
+