Merge branch 'vendor/MDOCML'
[dragonfly.git] / contrib / mdocml / tbl_int.h
1 /*      $Id: tbl_int.h,v 1.2 2018/12/14 06:33:14 schwarze Exp $ */
2 /*
3  * Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
4  * Copyright (c) 2011,2013,2015,2017,2018 Ingo Schwarze <schwarze@openbsd.org>
5  *
6  * Permission to use, copy, modify, and distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  *
18  * Internal interfaces of the tbl(7) parser.
19  * For use inside the tbl(7) parser only.
20  */
21
22 enum    tbl_part {
23         TBL_PART_OPTS,    /* In the first line, ends with semicolon. */
24         TBL_PART_LAYOUT,  /* In the layout section, ends with full stop. */
25         TBL_PART_DATA,    /* In the data section, ends with TE. */
26         TBL_PART_CDATA    /* In a T{ block, ends with T} */
27 };
28
29 struct  tbl_node {
30         struct tbl_opts   opts;         /* Options for the whole table. */
31         struct tbl_node  *next;         /* Next table. */
32         struct tbl_row   *first_row;    /* First layout row. */
33         struct tbl_row   *last_row;     /* Last layout row. */
34         struct tbl_span  *first_span;   /* First data row. */
35         struct tbl_span  *current_span; /* Data row being parsed. */
36         struct tbl_span  *last_span;    /* Last data row. */
37         int               line;         /* Line number in input file. */
38         int               pos;          /* Column number in input file. */
39         enum tbl_part     part;         /* Table section being parsed. */
40 };
41
42
43 void             tbl_option(struct tbl_node *, int, const char *, int *);
44 void             tbl_layout(struct tbl_node *, int, const char *, int);
45 void             tbl_data(struct tbl_node *, int, const char *, int);
46 void             tbl_cdata(struct tbl_node *, int, const char *, int);
47 void             tbl_reset(struct tbl_node *);