diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2018-12-13 02:06:07 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2018-12-13 02:06:07 +0000 |
commit | 8778c0e49080778fd04dc5a3c1aac38addbfa5a4 (patch) | |
tree | 3f4e1c54b77a817844378231c2dc4a3aa04e9908 | |
parent | abe535d017ebcf70bf575e3048cb4ea11f75a600 (diff) | |
download | mandoc-8778c0e49080778fd04dc5a3c1aac38addbfa5a4.tar.gz mandoc-8778c0e49080778fd04dc5a3c1aac38addbfa5a4.tar.zst mandoc-8778c0e49080778fd04dc5a3c1aac38addbfa5a4.zip |
Cleanup, no functional change:
Move tbl(7)-specific parser internals out of libroff.h.
Move some tbl(7)-internal processing from roff.c to tbl.c.
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | libroff.h | 38 | ||||
-rw-r--r-- | mandoc_headers.3 | 71 | ||||
-rw-r--r-- | roff.c | 36 | ||||
-rw-r--r-- | roff.h | 4 | ||||
-rw-r--r-- | tbl.3 | 23 | ||||
-rw-r--r-- | tbl.c | 64 | ||||
-rw-r--r-- | tbl_data.c | 4 | ||||
-rw-r--r-- | tbl_int.h | 48 | ||||
-rw-r--r-- | tbl_layout.c | 4 | ||||
-rw-r--r-- | tbl_opts.c | 4 | ||||
-rw-r--r-- | tbl_parse.h | 31 |
12 files changed, 217 insertions, 114 deletions
@@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.521 2018/12/12 21:54:35 schwarze Exp $ +# $Id: Makefile,v 1.522 2018/12/13 02:06:07 schwarze Exp $ # # Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv> # Copyright (c) 2011, 2013-2018 Ingo Schwarze <schwarze@openbsd.org> @@ -203,6 +203,8 @@ DISTFILES = INSTALL \ tbl.3 \ tbl.7 \ tbl.h \ + tbl_int.h \ + tbl_parse.h \ term.h \ $(SRCS) \ $(TESTSRCS) @@ -1,7 +1,7 @@ -/* $Id: libroff.h,v 1.42 2017/07/08 17:52:49 schwarze Exp $ */ +/* $Id: libroff.h,v 1.43 2018/12/13 02:06:07 schwarze Exp $ */ /* - * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> - * Copyright (c) 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv> + * Copyright (c) 2014, 2017 Ingo Schwarze <schwarze@openbsd.org> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -16,27 +16,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -enum tbl_part { - TBL_PART_OPTS, /* in options (first line) */ - TBL_PART_LAYOUT, /* describing layout */ - TBL_PART_DATA, /* creating data rows */ - TBL_PART_CDATA /* continue previous row */ -}; - -struct tbl_node { - struct mparse *parse; /* parse point */ - int pos; /* invocation column */ - int line; /* invocation line */ - enum tbl_part part; - struct tbl_opts opts; - struct tbl_row *first_row; - struct tbl_row *last_row; - struct tbl_span *first_span; - struct tbl_span *current_span; - struct tbl_span *last_span; - struct tbl_node *next; -}; - struct eqn_node { struct mparse *parse; /* main parser, for error reporting */ struct roff_node *node; /* syntax tree of this equation */ @@ -61,17 +40,6 @@ struct eqn_def { }; -struct tbl_node *tbl_alloc(int, int, struct mparse *); -void tbl_restart(int, int, struct tbl_node *); -void tbl_free(struct tbl_node *); -void tbl_reset(struct tbl_node *); -void tbl_read(struct tbl_node *, int, const char *, int); -void tbl_option(struct tbl_node *, int, const char *, int *); -void tbl_layout(struct tbl_node *, int, const char *, int); -void tbl_data(struct tbl_node *, int, const char *, int); -void tbl_cdata(struct tbl_node *, int, const char *, int); -const struct tbl_span *tbl_span(struct tbl_node *); -int tbl_end(struct tbl_node *); struct eqn_node *eqn_alloc(struct mparse *); void eqn_box_free(struct eqn_box *); void eqn_free(struct eqn_node *); diff --git a/mandoc_headers.3 b/mandoc_headers.3 index e2c8f5a7..03b9d55d 100644 --- a/mandoc_headers.3 +++ b/mandoc_headers.3 @@ -1,4 +1,4 @@ -.Dd $Mdocdate: December 12 2018 $ +.Dd $Mdocdate: December 13 2018 $ .Dt MANDOC_HEADERS 3 .Os .Sh NAME @@ -257,7 +257,7 @@ or .Pa libroff.h . .El .Ss Parser internals -The following headers require inclusion of a parser interface header +Most of the following headers require inclusion of a parser interface header before they can be included. All parser interface headers should precede all parser internal headers. When any parser internal headers are included, the same file should @@ -388,20 +388,14 @@ for and .Qq Pa mandoc.h for -.Vt struct tbl_* -and .Vt struct eqn_box . .Pp Provides -.Vt enum tbl_part , -.Vt struct tbl_node , .Vt struct eqn_def , .Vt struct eqn_node , and many functions internal to the -.Xr tbl 7 -and .Xr eqn 7 -parsers. +parser. .Pp Uses the opaque type .Vt struct mparse @@ -414,6 +408,65 @@ When this header is included, the same file should not include .Pa libman.h , or .Pa libmdoc.h . +.It Qq Pa tbl_parse.h +External interface of the +.Xr tbl 7 +parser, for use in the +.Xr roff 7 +and +.Xr tbl 7 +parsers only. +.Pp +Provides the functions documented in +.Xr tbl 3 . +.Pp +Uses the opaque type +.Vt struct mparse +from +.Pa read.c . +Uses the types +.Vt struct tbl_span +from +.Pa tbl.h +and +.Vt struct tbl_node +from +.Pa tbl_int.h +as opaque types for function prototypes. +.Pp +When this header is included, the same file should not include +internals of a different parser. +.It Qq Pa tbl_int.h +Internal interfaces of the +.Xr tbl 7 +parser, for use inside the +.Xr tbl 7 +parser only. +.Pp +Requires +.Qq Pa tbl.h +for +.Vt struct tbl_opts . +.Pp +Provides +.Vt enum tbl_part , +.Vt struct tbl_node , +and the functions +.Fn tbl_option , +.Fn tbl_layout , +.Fn tbl_data , +.Fn tbl_cdata , +and +.Fn tbl_reset . +.Pp +Uses a pointer to the opaque type +.Vt struct mparse +from +.Pa read.c +as an opaque struct member. +.Pp +When this header is included, the same file should not include +interfaces of different parsers. .El .Ss Formatter interface These headers should be included after any parser interface headers. @@ -1,4 +1,4 @@ -/* $Id: roff.c,v 1.345 2018/12/12 21:54:35 schwarze Exp $ */ +/* $Id: roff.c,v 1.346 2018/12/13 02:06:07 schwarze Exp $ */ /* * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org> @@ -32,10 +32,10 @@ #include "mandoc_ohash.h" #include "mandoc.h" #include "roff.h" -#include "tbl.h" #include "libmandoc.h" #include "roff_int.h" #include "libroff.h" +#include "tbl_parse.h" /* Maximum number of string expansions per line, to break infinite loops. */ #define EXPAND_LIMIT 1000 @@ -168,7 +168,7 @@ static int roffnode_cleanscope(struct roff *); static int roffnode_pop(struct roff *); static void roffnode_push(struct roff *, enum roff_tok, const char *, int, int); -static void roff_addtbl(struct roff_man *, struct tbl_node *); +static void roff_addtbl(struct roff_man *, int, struct tbl_node *); static int roff_als(ROFF_ARGS); static int roff_block(ROFF_ARGS); static int roff_block_text(ROFF_ARGS); @@ -718,13 +718,9 @@ roffnode_push(struct roff *r, enum roff_tok tok, const char *name, static void roff_free1(struct roff *r) { - struct tbl_node *tbl; int i; - while (NULL != (tbl = r->first_tbl)) { - r->first_tbl = tbl->next; - tbl_free(tbl); - } + tbl_free(r->first_tbl); r->first_tbl = r->last_tbl = r->tbl = NULL; if (r->last_eqn != NULL) @@ -1014,15 +1010,15 @@ roff_body_alloc(struct roff_man *man, int line, int pos, int tok) } static void -roff_addtbl(struct roff_man *man, struct tbl_node *tbl) +roff_addtbl(struct roff_man *man, int line, struct tbl_node *tbl) { struct roff_node *n; - const struct tbl_span *span; + struct tbl_span *span; if (man->macroset == MACROSET_MAN) man_breakscope(man, ROFF_TS); while ((span = tbl_span(tbl)) != NULL) { - n = roff_node_alloc(man, tbl->line, 0, ROFFT_TBL, TOKEN_NONE); + n = roff_node_alloc(man, line, 0, ROFFT_TBL, TOKEN_NONE); n->span = span; roff_node_append(man, n); n->flags |= NODE_VALID | NODE_ENDED; @@ -1660,7 +1656,7 @@ roff_parseln(struct roff *r, int ln, struct buf *buf, int *offs) } if (r->tbl != NULL && (ctl == 0 || buf->buf[pos] == '\0')) { tbl_read(r->tbl, ln, buf->buf, ppos); - roff_addtbl(r->man, r->tbl); + roff_addtbl(r->man, ln, r->tbl); return e; } if ( ! ctl) @@ -1704,7 +1700,7 @@ roff_parseln(struct roff *r, int ln, struct buf *buf, int *offs) while (buf->buf[pos] == ' ') pos++; tbl_read(r->tbl, ln, buf->buf, pos); - roff_addtbl(r->man, r->tbl); + roff_addtbl(r->man, ln, r->tbl); return ROFF_IGN; } @@ -1767,9 +1763,7 @@ roff_endparse(struct roff *r) } if (r->tbl != NULL) { - mandoc_msg(MANDOCERR_BLK_NOEND, r->parse, - r->tbl->line, r->tbl->pos, "TS"); - tbl_end(r->tbl); + tbl_end(r->tbl, 1); r->tbl = NULL; } } @@ -3060,7 +3054,7 @@ roff_TE(ROFF_ARGS) ln, ppos, "TE"); return ROFF_IGN; } - if (tbl_end(r->tbl) == 0) { + if (tbl_end(r->tbl, 0) == 0) { r->tbl = NULL; free(buf->buf); buf->buf = mandoc_strdup(".sp"); @@ -3201,12 +3195,10 @@ roff_TS(ROFF_ARGS) if (r->tbl != NULL) { mandoc_msg(MANDOCERR_BLK_BROKEN, r->parse, ln, ppos, "TS breaks TS"); - tbl_end(r->tbl); + tbl_end(r->tbl, 0); } - r->tbl = tbl_alloc(ppos, ln, r->parse); - if (r->last_tbl) - r->last_tbl->next = r->tbl; - else + r->tbl = tbl_alloc(ppos, ln, r->parse, r->last_tbl); + if (r->last_tbl == NULL) r->first_tbl = r->tbl; r->last_tbl = r->tbl; return ROFF_IGN; @@ -1,4 +1,4 @@ -/* $Id: roff.h,v 1.61 2018/08/18 02:08:27 schwarze Exp $ */ +/* $Id: roff.h,v 1.62 2018/12/13 02:06:07 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2013,2014,2015,2017,2018 Ingo Schwarze <schwarze@openbsd.org> @@ -502,7 +502,7 @@ struct roff_node { struct mdoc_arg *args; /* BLOCK/ELEM */ union mdoc_data *norm; /* Normalized arguments. */ char *string; /* TEXT */ - const struct tbl_span *span; /* TBL */ + struct tbl_span *span; /* TBL */ struct eqn_box *eqn; /* EQN */ int line; /* Input file line number. */ int pos; /* Input file column number. */ @@ -1,6 +1,6 @@ -.\" $Id: tbl.3,v 1.4 2018/12/12 21:54:35 schwarze Exp $ +.\" $Id: tbl.3,v 1.5 2018/12/13 02:06:07 schwarze Exp $ .\" -.\" Copyright (c) 2013 Ingo Schwarze <schwarze@openbsd.org> +.\" Copyright (c) 2013, 2015, 2018 Ingo Schwarze <schwarze@openbsd.org> .\" .\" Permission to use, copy, modify, and distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above @@ -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: December 12 2018 $ +.Dd $Mdocdate: December 13 2018 $ .Dt TBL 3 .Os .Sh NAME @@ -26,10 +26,9 @@ .Nm tbl_free .Nd roff table parser library for mandoc .Sh SYNOPSIS -.In mandoc.h +.In sys/types.h .In tbl.h -.In libmandoc.h -.In libroff.h +.In tbl_parse.h .Ft struct tbl_node * .Fo tbl_alloc .Fa "int pos" @@ -68,15 +67,15 @@ utility and not designed for stand-alone use. The present manual is intended as a reference for developers working on .Xr mandoc 1 . .Ss Data structures -Unless otherwise noted, all of the following data structures are defined in -.In mandoc.h +Unless otherwise noted, all of the following data structures are declared in +.In tbl.h and are deleted in .Fn tbl_free . .Bl -tag -width Ds .It Vt struct tbl_node This structure describes a complete table. -It is defined in -.In libroff.h , +It is declared in +.In tbl_int.h , created in .Fn tbl_alloc , and stored in the members @@ -227,7 +226,7 @@ member is not .Ss Interface functions The following functions are implemented in .Pa tbl.c , -and all callers in +and all callers are in .Pa roff.c . .Bl -tag -width Ds .It Fn tbl_alloc @@ -280,6 +279,8 @@ and .Fn roff_reset . .El .Ss Private functions +The following functions are declared in +.In tbl_int.h . .Bl -tag -width Ds .It Ft int Fn tbl_options "struct tbl_node *tbl" "int ln" "const char *p" Parses the options line into @@ -1,4 +1,4 @@ -/* $Id: tbl.c,v 1.43 2018/12/12 21:54:35 schwarze Exp $ */ +/* $Id: tbl.c,v 1.44 2018/12/13 02:06:07 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011, 2015 Ingo Schwarze <schwarze@openbsd.org> @@ -29,7 +29,8 @@ #include "mandoc.h" #include "tbl.h" #include "libmandoc.h" -#include "libroff.h" +#include "tbl_parse.h" +#include "tbl_int.h" void @@ -87,11 +88,13 @@ tbl_read(struct tbl_node *tbl, int ln, const char *p, int pos) } struct tbl_node * -tbl_alloc(int pos, int line, struct mparse *parse) +tbl_alloc(int pos, int line, struct mparse *parse, struct tbl_node *last_tbl) { struct tbl_node *tbl; tbl = mandoc_calloc(1, sizeof(*tbl)); + if (last_tbl != NULL) + last_tbl->next = tbl; tbl->line = line; tbl->pos = pos; tbl->parse = parse; @@ -104,34 +107,37 @@ tbl_alloc(int pos, int line, struct mparse *parse) void tbl_free(struct tbl_node *tbl) { + struct tbl_node *old_tbl; struct tbl_row *rp; struct tbl_cell *cp; struct tbl_span *sp; struct tbl_dat *dp; - while ((rp = tbl->first_row) != NULL) { - tbl->first_row = rp->next; - while (rp->first != NULL) { - cp = rp->first; - rp->first = cp->next; - free(cp->wstr); - free(cp); + while (tbl != NULL) { + while ((rp = tbl->first_row) != NULL) { + tbl->first_row = rp->next; + while (rp->first != NULL) { + cp = rp->first; + rp->first = cp->next; + free(cp->wstr); + free(cp); + } + free(rp); } - free(rp); - } - - while ((sp = tbl->first_span) != NULL) { - tbl->first_span = sp->next; - while (sp->first != NULL) { - dp = sp->first; - sp->first = dp->next; - free(dp->string); - free(dp); + while ((sp = tbl->first_span) != NULL) { + tbl->first_span = sp->next; + while (sp->first != NULL) { + dp = sp->first; + sp->first = dp->next; + free(dp->string); + free(dp); + } + free(sp); } - free(sp); + old_tbl = tbl; + tbl = tbl->next; + free(old_tbl); } - - free(tbl); } void @@ -146,25 +152,27 @@ tbl_restart(int line, int pos, struct tbl_node *tbl) tbl->pos = pos; } -const struct tbl_span * +struct tbl_span * tbl_span(struct tbl_node *tbl) { struct tbl_span *span; - assert(tbl); span = tbl->current_span ? tbl->current_span->next : tbl->first_span; - if (span) + if (span != NULL) tbl->current_span = span; return span; } int -tbl_end(struct tbl_node *tbl) +tbl_end(struct tbl_node *tbl, int still_open) { struct tbl_span *sp; - if (tbl->part == TBL_PART_CDATA) + if (still_open) + mandoc_msg(MANDOCERR_BLK_NOEND, tbl->parse, + tbl->line, tbl->pos, "TS"); + else if (tbl->part == TBL_PART_CDATA) mandoc_msg(MANDOCERR_TBLDATA_BLK, tbl->parse, tbl->line, tbl->pos, "TE"); @@ -1,4 +1,4 @@ -/* $Id: tbl_data.c,v 1.48 2018/12/12 21:54:35 schwarze Exp $ */ +/* $Id: tbl_data.c,v 1.49 2018/12/13 02:06:07 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011, 2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org> @@ -29,7 +29,7 @@ #include "mandoc.h" #include "tbl.h" #include "libmandoc.h" -#include "libroff.h" +#include "tbl_int.h" static void getdata(struct tbl_node *, struct tbl_span *, int, const char *, int *); diff --git a/tbl_int.h b/tbl_int.h new file mode 100644 index 00000000..a9e74050 --- /dev/null +++ b/tbl_int.h @@ -0,0 +1,48 @@ +/* $Id: tbl_int.h,v 1.1 2018/12/13 02:06:07 schwarze Exp $ */ +/* + * Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> + * Copyright (c) 2011,2013,2015,2017,2018 Ingo Schwarze <schwarze@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Internal interfaces of the tbl(7) parser. + * For use inside the tbl(7) parser only. + */ + +enum tbl_part { + TBL_PART_OPTS, /* In the first line, ends with semicolon. */ + TBL_PART_LAYOUT, /* In the layout section, ends with full stop. */ + TBL_PART_DATA, /* In the data section, ends with TE. */ + TBL_PART_CDATA /* In a T{ block, ends with T} */ +}; + +struct tbl_node { + struct tbl_opts opts; /* Options for the whole table. */ + struct mparse *parse; /* For error reporting. */ + struct tbl_node *next; /* Next table. */ + struct tbl_row *first_row; /* First layout row. */ + struct tbl_row *last_row; /* Last layout row. */ + struct tbl_span *first_span; /* First data row. */ + struct tbl_span *current_span; /* Data row being parsed. */ + struct tbl_span *last_span; /* Last data row. */ + int line; /* Line number in input file. */ + int pos; /* Column number in input file. */ + enum tbl_part part; /* Table section being parsed. */ +}; + + +void tbl_option(struct tbl_node *, int, const char *, int *); +void tbl_layout(struct tbl_node *, int, const char *, int); +void tbl_data(struct tbl_node *, int, const char *, int); +void tbl_cdata(struct tbl_node *, int, const char *, int); +void tbl_reset(struct tbl_node *); diff --git a/tbl_layout.c b/tbl_layout.c index e0573ec1..0f7d5a79 100644 --- a/tbl_layout.c +++ b/tbl_layout.c @@ -1,4 +1,4 @@ -/* $Id: tbl_layout.c,v 1.45 2018/12/12 21:54:35 schwarze Exp $ */ +/* $Id: tbl_layout.c,v 1.46 2018/12/13 02:06:07 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2012, 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org> @@ -29,7 +29,7 @@ #include "mandoc.h" #include "tbl.h" #include "libmandoc.h" -#include "libroff.h" +#include "tbl_int.h" struct tbl_phrase { char name; @@ -1,4 +1,4 @@ -/* $Id: tbl_opts.c,v 1.22 2018/12/12 21:54:35 schwarze Exp $ */ +/* $Id: tbl_opts.c,v 1.23 2018/12/13 02:06:07 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2015 Ingo Schwarze <schwarze@openbsd.org> @@ -27,7 +27,7 @@ #include "mandoc.h" #include "tbl.h" #include "libmandoc.h" -#include "libroff.h" +#include "tbl_int.h" #define KEY_DPOINT 0 #define KEY_DELIM 1 diff --git a/tbl_parse.h b/tbl_parse.h new file mode 100644 index 00000000..b2fc8523 --- /dev/null +++ b/tbl_parse.h @@ -0,0 +1,31 @@ +/* $Id: tbl_parse.h,v 1.1 2018/12/13 02:06:07 schwarze Exp $ */ +/* + * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv> + * Copyright (c) 2011, 2017 Ingo Schwarze <schwarze@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * External interface of the tbl(7) parser. + * For use in the roff(7) and tbl(7) parsers only. + */ + +struct mparse; +struct tbl_node; +struct tbl_span; + +struct tbl_node *tbl_alloc(int, int, struct mparse *, struct tbl_node *); +int tbl_end(struct tbl_node *, int); +void tbl_free(struct tbl_node *); +void tbl_read(struct tbl_node *, int, const char *, int); +void tbl_restart(int, int, struct tbl_node *); +struct tbl_span *tbl_span(struct tbl_node *); |