aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tbl.3
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-01-30 04:11:50 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-01-30 04:11:50 +0000
commit71fa4361c47e9ed2f3c6521e9273fabb41aadc20 (patch)
treeac472a0b2793a26633a7405d837eaa7fa648ea74 /tbl.3
parent8ea5dc6d40c942157256ddd510bd3fa16cb44303 (diff)
downloadmandoc-71fa4361c47e9ed2f3c6521e9273fabb41aadc20.tar.gz
mandoc-71fa4361c47e9ed2f3c6521e9273fabb41aadc20.tar.zst
mandoc-71fa4361c47e9ed2f3c6521e9273fabb41aadc20.zip
Abolish struct tbl_head and replace it by an "int col" member in
struct tbl_cell. No functional change, minus 40 lines of code.
Diffstat (limited to 'tbl.3')
-rw-r--r--tbl.3129
1 files changed, 94 insertions, 35 deletions
diff --git a/tbl.3 b/tbl.3
index 05e423fe..f3db622e 100644
--- a/tbl.3
+++ b/tbl.3
@@ -1,4 +1,4 @@
-.\" $Id: tbl.3,v 1.1 2013/06/01 05:44:39 schwarze Exp $
+.\" $Id: tbl.3,v 1.2 2015/01/30 04:11:50 schwarze Exp $
.\"
.\" Copyright (c) 2013 Ingo Schwarze <schwarze@openbsd.org>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: June 1 2013 $
+.Dd $Mdocdate: January 30 2015 $
.Dt TBL 3
.Os
.Sh NAME
@@ -79,12 +79,37 @@ It is defined in
created in
.Fn tbl_alloc ,
and stored in the members
-.Va first_tbl ,
-.Va last_tbl ,
+.Fa first_tbl ,
+.Fa last_tbl ,
and
-.Va tbl
+.Fa tbl
of
.Vt struct roff Bq Pa roff.c .
+.Pp
+The
+.Fa first_span ,
+.Fa current_span ,
+.Fa last_span ,
+and
+.Fa next
+members may be
+.Dv NULL .
+The
+.Fa first_row
+and
+.Fa last_row
+members may be
+.Dv NULL ,
+but if there is a span, the function
+.Fn tbl_layout
+guarantees that these pointers are not
+.Dv NULL .
+The function
+.Fn tbl_alloc
+guarantees that the
+.Fa parse
+member is not
+.Dv NULL .
.It Vt struct tbl_opts
This structure describes the options of one table.
It is used as a substructure of
@@ -92,26 +117,27 @@ It is used as a substructure of
and thus created and deleted together with it.
It is filled in
.Fn tbl_options .
-.It Vt struct tbl_head
-This structure describes one layout column in a table,
-in particular the vertical line to its left.
-It is allocated and filled in
-.Fn cell_alloc Bq Pa tbl_layout.c
-and referenced from the
-.Va first_head
-and
-.Va last_head
-members of
-.Vt struct tbl_node .
.It Vt struct tbl_row
This structure describes one layout line in a table
by maintaining a list of all the cells in that line.
It is allocated and filled in
.Fn row Bq Pa tbl_layout.c
and referenced from the
-.Va layout
+.Fa layout
member of
.Vt struct tbl_node .
+.Pp
+The
+.Fa next
+member may be
+.Dv NULL .
+The function
+.Fn tbl_layout
+guarantees that the
+.Fa first
+and
+.Fa last
+members are not NULL.
.It Vt struct tbl_cell
This structure describes one layout cell in a table,
in particular its alignment, membership in spans, and
@@ -119,11 +145,16 @@ usage for lines.
It is allocated and filled in
.Fn cell_alloc Bq Pa tbl_layout.c
and referenced from the
-.Va first
+.Fa first
and
-.Va last
+.Fa last
members of
.Vt struct tbl_row .
+.Pp
+The
+.Fa next
+member may be
+.Dv NULL .
.It Vt struct tbl_span
This structure describes one data line in a table
by maintaining a list of all data cells in that line
@@ -133,14 +164,14 @@ It is allocated and filled in
which is called from
.Fn tbl_data
and referenced from the
-.Va first_span ,
-.Va current_span ,
+.Fa first_span ,
+.Fa current_span ,
and
-.Va last_span
+.Fa last_span
members of
.Vt struct tbl_node ,
and from the
-.Va span
+.Fa span
members of
.Vt struct man_node
and
@@ -149,18 +180,48 @@ from
.In man.h
and
.In mdoc.h .
+.Pp
+The
+.Fa first ,
+.Fa last ,
+.Fa prev ,
+and
+.Fa next
+members may be
+.Dv NULL .
+The function
+.Fn newspan Bq Pa tbl_data.c
+guarantees that the
+.Fa opts
+and
+.Fa layout
+members are not
+.Dv NULL .
.It Vt struct tbl_dat
This structure describes one data cell in a table by specifying
whether it contains a line or data, whether it spans additional
layout cells, and by storing the data.
It is allocated and filled in
-.Fn data
+.Fn tbl_data
and referenced from the
-.Va first
+.Fa first
and
-.Va last
+.Fa last
members of
.Vt struct tbl_span .
+.Pp
+The
+.Fa string
+and
+.Fa next
+members may be
+.Dv NULL .
+The function
+.Fn getdata
+guarantees that the
+.Fa layout
+member is not
+.Dv NULL .
.El
.Ss Interface functions
The following functions are implemented in
@@ -185,7 +246,7 @@ Called from
.Fn roff_parseln .
.It Fn tbl_restart
Resets the
-.Va part
+.Fa part
member of
.Vt struct tbl_node
to
@@ -210,7 +271,7 @@ and
.It Fn tbl_free
Frees the specified
.Vt struct tbl_node
-and all the tbl_row, tbl_cell, tbl_span, tbl_dat and tbl_head structures
+and all the tbl_row, tbl_cell, tbl_span, and tbl_dat structures
referenced from it.
Called from
.Fn roff_free
@@ -228,10 +289,8 @@ called from
.Fn tbl_read .
.It Ft int Fn tbl_layout "struct tbl_node *tbl" "int ln" "const char *p"
Allocates and fills one
-.Vt struct tbl_head
-for each layout column, one
.Vt struct tbl_row
-for each layout line, and one
+for each layout line and one
.Vt struct tbl_cell
for each layout cell.
Implemented in
@@ -242,8 +301,8 @@ called from
Allocates one
.Vt struct tbl_span
for each data line and calls
-.Fn data
-on that line.
+.Fn getdata
+for each data cell.
Implemented in
.Pa tbl_data.c ,
called from
@@ -255,7 +314,7 @@ When finding
switches back to
.Dv TBL_PART_DATA
mode and calls
-.Fn data
+.Fn getdata
if there are more data cells on the line.
Otherwise, appends the data to the current data cell.
Implemented in
@@ -264,7 +323,7 @@ called from
.Fn tbl_read .
.It Xo
.Ft int
-.Fo data
+.Fo getdata
.Fa "struct tbl_node *tbl"
.Fa "struct tbl_span *dp"
.Fa "int ln"