summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/mandoc.h
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2012-05-26 20:03:35 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2012-05-26 20:03:35 +0000
commit149fd6bc0536e661f7082e1733980c38c237ad7a (patch)
treee860d0298f1d8ebc756df76bf3881f1e6fc51033 /usr.bin/mandoc/mandoc.h
parenta620e0445a55e8efca115d298e4f6ef6c8bb0845 (diff)
Do not handle vertical lines as additional tbl(7) columns,
instead save their properties with the following column. This simplifies layout parsing and saves a lot of code related to column handling. At output time, print all white space and vertical lines separating columns before printing the following column, and none after printing the preceding column, considerably simplifying white space handling and width calculations. No functional change, but it saves 150 lines of code, and it allows the next patch to tbl_term.c, tbl_literal().
Diffstat (limited to 'usr.bin/mandoc/mandoc.h')
-rw-r--r--usr.bin/mandoc/mandoc.h13
1 files changed, 3 insertions, 10 deletions
diff --git a/usr.bin/mandoc/mandoc.h b/usr.bin/mandoc/mandoc.h
index 5a87c80fb26..a66bb0d74ad 100644
--- a/usr.bin/mandoc/mandoc.h
+++ b/usr.bin/mandoc/mandoc.h
@@ -1,4 +1,4 @@
-/* $Id: mandoc.h,v 1.44 2012/05/24 23:33:23 schwarze Exp $ */
+/* $Id: mandoc.h,v 1.45 2012/05/26 20:03:34 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -175,20 +175,14 @@ struct tbl {
int cols; /* number of columns */
};
-enum tbl_headt {
- TBL_HEAD_DATA, /* plug in data from tbl_dat */
- TBL_HEAD_VERT, /* vertical spacer */
- TBL_HEAD_DVERT /* double-vertical spacer */
-};
-
/*
* The head of a table specifies all of its columns. When formatting a
* tbl_span, iterate over these and plug in data from the tbl_span when
* appropriate, using tbl_cell as a guide to placement.
*/
struct tbl_head {
- enum tbl_headt pos;
int ident; /* 0 <= unique id < cols */
+ int vert; /* width of preceding vertical line */
struct tbl_head *next;
struct tbl_head *prev;
};
@@ -203,8 +197,6 @@ enum tbl_cellt {
TBL_CELL_DOWN, /* ^ */
TBL_CELL_HORIZ, /* _, - */
TBL_CELL_DHORIZ, /* = */
- TBL_CELL_VERT, /* | */
- TBL_CELL_DVERT, /* || */
TBL_CELL_MAX
};
@@ -213,6 +205,7 @@ enum tbl_cellt {
*/
struct tbl_cell {
struct tbl_cell *next;
+ int vert; /* width of preceding vertical line */
enum tbl_cellt pos;
size_t spacing;
int flags;