Cleanup, no functional change:
[mandoc.git] / libroff.h
1 /* $Id: libroff.h,v 1.43 2018/12/13 02:06:07 schwarze Exp $ */
2 /*
3 * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
4 * Copyright (c) 2014, 2017 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 AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR 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
19 struct eqn_node {
20 struct mparse *parse; /* main parser, for error reporting */
21 struct roff_node *node; /* syntax tree of this equation */
22 struct eqn_def *defs; /* array of definitions */
23 char *data; /* source code of this equation */
24 char *start; /* first byte of the current token */
25 char *end; /* first byte of the next token */
26 size_t defsz; /* number of definitions */
27 size_t sz; /* length of the source code */
28 size_t toksz; /* length of the current token */
29 int gsize; /* default point size */
30 int delim; /* in-line delimiters enabled */
31 char odelim; /* in-line opening delimiter */
32 char cdelim; /* in-line closing delimiter */
33 };
34
35 struct eqn_def {
36 char *key;
37 size_t keysz;
38 char *val;
39 size_t valsz;
40 };
41
42
43 struct eqn_node *eqn_alloc(struct mparse *);
44 void eqn_box_free(struct eqn_box *);
45 void eqn_free(struct eqn_node *);
46 void eqn_parse(struct eqn_node *);
47 void eqn_read(struct eqn_node *, const char *);
48 void eqn_reset(struct eqn_node *);