Lines Matching defs:tbl
1 /* $OpenBSD: tbl.c,v 1.28 2025/01/05 18:03:51 schwarze Exp $ */
28 #include "tbl.h"
35 tbl_read(struct tbl_node *tbl, int ln, const char *p, int pos)
46 if (tbl->part == TBL_PART_OPTS) {
47 tbl->part = TBL_PART_LAYOUT;
67 tbl_option(tbl, ln, p, &pos);
75 switch (tbl->part) {
77 tbl_layout(tbl, ln, p, pos);
80 tbl_cdata(tbl, ln, p, pos);
83 tbl_data(tbl, ln, p, pos);
91 struct tbl_node *tbl;
93 tbl = mandoc_calloc(1, sizeof(*tbl));
95 last_tbl->next = tbl;
96 tbl->line = line;
97 tbl->pos = pos;
98 tbl->part = TBL_PART_OPTS;
99 tbl->opts.tab = '\t';
100 tbl->opts.decimal = '.';
101 return tbl;
105 tbl_free(struct tbl_node *tbl)
113 while (tbl != NULL) {
114 while ((rp = tbl->first_row) != NULL) {
115 tbl->first_row = rp->next;
123 while ((sp = tbl->first_span) != NULL) {
124 tbl->first_span = sp->next;
133 old_tbl = tbl;
134 tbl = tbl->next;
140 tbl_restart(int line, int pos, struct tbl_node *tbl)
142 if (tbl->part == TBL_PART_CDATA)
145 tbl->part = TBL_PART_LAYOUT;
146 tbl->line = line;
147 tbl->pos = pos;
151 tbl_span(struct tbl_node *tbl)
155 span = tbl->current_span ? tbl->current_span->next
156 : tbl->first_span;
158 tbl->current_span = span;
163 tbl_end(struct tbl_node *tbl, int still_open)
168 mandoc_msg(MANDOCERR_BLK_NOEND, tbl->line, tbl->pos, "TS");
169 else if (tbl->part == TBL_PART_CDATA)
170 mandoc_msg(MANDOCERR_TBLDATA_BLK, tbl->line, tbl->pos, "TE");
172 sp = tbl->first_span;
176 mandoc_msg(MANDOCERR_TBLDATA_NONE, tbl->line, tbl->pos, NULL);