Import mdocml-1.11.1
[dragonfly.git] / contrib / mdocml / libroff.h
CommitLineData
60e1e752 1/* $Id: libroff.h,v 1.20 2011/03/20 16:02:05 kristaps Exp $ */
80387638 2/*
60e1e752 3 * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
80387638
SW
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17#ifndef LIBROFF_H
18#define LIBROFF_H
19
20__BEGIN_DECLS
21
22enum tbl_part {
23 TBL_PART_OPTS, /* in options (first line) */
24 TBL_PART_LAYOUT, /* describing layout */
25 TBL_PART_DATA, /* creating data rows */
26 TBL_PART_CDATA /* continue previous row */
27};
28
29struct tbl_node {
60e1e752 30 struct mparse *parse; /* parse point */
80387638
SW
31 int pos; /* invocation column */
32 int line; /* invocation line */
33 enum tbl_part part;
34 struct tbl opts;
35 struct tbl_row *first_row;
36 struct tbl_row *last_row;
37 struct tbl_span *first_span;
60e1e752 38 struct tbl_span *current_span;
80387638
SW
39 struct tbl_span *last_span;
40 struct tbl_head *first_head;
41 struct tbl_head *last_head;
42 struct tbl_node *next;
43};
44
60e1e752
SW
45struct eqn_node {
46 struct eqn eqn;
47 struct eqn_node *next;
48};
80387638 49
60e1e752 50struct tbl_node *tbl_alloc(int, int, struct mparse *);
80387638
SW
51void tbl_restart(int, int, struct tbl_node *);
52void tbl_free(struct tbl_node *);
53void tbl_reset(struct tbl_node *);
54enum rofferr tbl_read(struct tbl_node *, int, const char *, int);
55int tbl_option(struct tbl_node *, int, const char *);
56int tbl_layout(struct tbl_node *, int, const char *);
57int tbl_data(struct tbl_node *, int, const char *);
58int tbl_cdata(struct tbl_node *, int, const char *);
60e1e752 59const struct tbl_span *tbl_span(struct tbl_node *);
80387638 60void tbl_end(struct tbl_node *);
60e1e752
SW
61struct eqn_node *eqn_alloc(int, int);
62void eqn_end(struct eqn_node *);
63void eqn_free(struct eqn_node *);
64enum rofferr eqn_read(struct eqn_node **, int, const char *, int);
80387638
SW
65
66__END_DECLS
67
68#endif /*LIBROFF_H*/