eqn_parse.h revision 1.1 1 1.1 christos /* Id: eqn_parse.h,v 1.3 2018/12/14 06:33:14 schwarze Exp */
2 1.1 christos /*
3 1.1 christos * Copyright (c) 2011 Kristaps Dzonsons <kristaps (at) bsd.lv>
4 1.1 christos * Copyright (c) 2014, 2017, 2018 Ingo Schwarze <schwarze (at) openbsd.org>
5 1.1 christos *
6 1.1 christos * Permission to use, copy, modify, and distribute this software for any
7 1.1 christos * purpose with or without fee is hereby granted, provided that the above
8 1.1 christos * copyright notice and this permission notice appear in all copies.
9 1.1 christos *
10 1.1 christos * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
11 1.1 christos * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 1.1 christos * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
13 1.1 christos * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 1.1 christos * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 1.1 christos * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 1.1 christos * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 1.1 christos *
18 1.1 christos * External interface of the eqn(7) parser.
19 1.1 christos * For use in the roff(7) and eqn(7) parsers only.
20 1.1 christos */
21 1.1 christos
22 1.1 christos struct roff_node;
23 1.1 christos struct eqn_box;
24 1.1 christos struct eqn_def;
25 1.1 christos
26 1.1 christos struct eqn_node {
27 1.1 christos struct roff_node *node; /* Syntax tree of this equation. */
28 1.1 christos struct eqn_def *defs; /* Array of definitions. */
29 1.1 christos char *data; /* Source code of this equation. */
30 1.1 christos char *start; /* First byte of the current token. */
31 1.1 christos char *end; /* First byte of the next token. */
32 1.1 christos size_t defsz; /* Number of definitions. */
33 1.1 christos size_t sz; /* Length of the source code. */
34 1.1 christos size_t toksz; /* Length of the current token. */
35 1.1 christos int gsize; /* Default point size. */
36 1.1 christos int delim; /* In-line delimiters enabled. */
37 1.1 christos char odelim; /* In-line opening delimiter. */
38 1.1 christos char cdelim; /* In-line closing delimiter. */
39 1.1 christos };
40 1.1 christos
41 1.1 christos
42 1.1 christos struct eqn_node *eqn_alloc(void);
43 1.1 christos struct eqn_box *eqn_box_new(void);
44 1.1 christos void eqn_box_free(struct eqn_box *);
45 1.1 christos void eqn_free(struct eqn_node *);
46 1.1 christos void eqn_parse(struct eqn_node *);
47 1.1 christos void eqn_read(struct eqn_node *, const char *);
48 1.1 christos void eqn_reset(struct eqn_node *);
49