| TBL(3) | Library Functions Manual | TBL(3) |
tbl_alloc,
tbl_read, tbl_restart,
tbl_span, tbl_end,
tbl_free — roff table parser
library for mandoc
#include
<sys/types.h>
#include
<tbl.h>
#include
<tbl_parse.h>
struct tbl_node *
tbl_alloc(int pos,
int line);
void
tbl_read(struct tbl_node *tbl,
int ln, const char *p,
int offs);
void
tbl_restart(int line,
int pos, struct tbl_node
*tbl);
const struct tbl_span *
tbl_span(struct tbl_node
*tbl);
void
tbl_end(struct tbl_node
**tblp);
void
tbl_free(struct tbl_node
*tbl);
This library is tightly integrated into the mandoc(1) utility and not designed for stand-alone use. The present manual is intended as a reference for developers working on mandoc(1).
Unless otherwise noted, all of the following data structures are
declared in
<tbl.h>
and are deleted in
tbl_free().
<tbl_int.h>,
created in
tbl_alloc(),
and stored in the members first_tbl,
last_tbl, and tbl of
struct roff [roff.c].
The first_span,
current_span, last_span, and
next members may be NULL.
The first_row and last_row
members may be NULL, but if there is a span, the
function
tbl_layout()
guarantees that these pointers are not NULL.
tbl_options().row()
[tbl_layout.c] and referenced from the
layout member of struct
tbl_node.
The next member may be
NULL. The function
tbl_layout()
guarantees that the first and
last members are not NULL.
cell_alloc()
[tbl_layout.c] and referenced from the
first and last members of
struct tbl_row.
The next member may be
NULL.
newspan()
[tbl_data.c] which is called from
tbl_data()
and referenced from the first_span,
current_span, and last_span
members of struct tbl_node, and from the
span members of struct
man_node and struct mdoc_node from
<man.h>
and
<mdoc.h>.
The first,
last, prev, and
next members may be NULL.
The function
newspan()
[tbl_data.c] guarantees that the
opts and layout members are
not NULL.
tbl_data()
and referenced from the first and
last members of struct
tbl_span.
The string and
next members may be NULL.
The function
getdata()
guarantees that the layout member is not
NULL.
The following functions are implemented in tbl.c, and all callers are in roff.c.
tbl_alloc()roff_TS().tbl_read()tbl_option(),
tbl_layout(),
tbl_cdata(),
and tbl_data(), see below. Called from
roff_parseln().tbl_restart()TBL_PART_LAYOUT. Called from
roff_T_().tbl_span()NULL.
Called from
roff_span().tbl_end()TBL_SPAN_LAST and clears
the pointer passed as an argment. Called from
roff_TE()
and
roff_endparse().tbl_free()roff_free()
and
roff_reset().The following functions are declared in
<tbl_int.h>.
tbl_options(struct tbl_node
*tbl, int ln, const char
*p)tbl_read().tbl_layout(struct tbl_node
*tbl, int ln, const char
*p)tbl_read().tbl_data(struct tbl_node *tbl,
int ln, const char *p)getdata() for each data cell. Implemented in
tbl_data.c, called from
tbl_read().tbl_cdata(struct tbl_node
*tbl, int ln, const char
*p)TBL_PART_DATA mode and calls
getdata() if there are more data cells on the
line. Otherwise, appends the data to the current data cell. Implemented in
tbl_data.c, called from
tbl_read().getdata(struct tbl_node *tbl,
struct tbl_span *dp, int ln,
const char *p, int *pos);tbl_data() and
tbl_cdata().The tbl library was written by
Kristaps Dzonsons
<kristaps@bsd.lv> with
contributions from Ingo Schwarze
<schwarze@openbsd.org>.
| December 14, 2018 | OpenBSD 6.7 |