Annotation of mandoc/libroff.h, Revision 1.40
1.40 ! schwarze 1: /* $Id: libroff.h,v 1.39 2015/11/07 14:01:16 schwarze Exp $ */
1.1 kristaps 2: /*
1.17 schwarze 3: * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
1.36 schwarze 4: * Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
1.1 kristaps 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:
1.2 kristaps 19: enum tbl_part {
20: TBL_PART_OPTS, /* in options (first line) */
21: TBL_PART_LAYOUT, /* describing layout */
1.16 kristaps 22: TBL_PART_DATA, /* creating data rows */
23: TBL_PART_CDATA /* continue previous row */
1.2 kristaps 24: };
25:
1.15 kristaps 26: struct tbl_node {
1.20 kristaps 27: struct mparse *parse; /* parse point */
1.12 kristaps 28: int pos; /* invocation column */
29: int line; /* invocation line */
1.15 kristaps 30: enum tbl_part part;
1.28 schwarze 31: struct tbl_opts opts;
1.8 kristaps 32: struct tbl_row *first_row;
33: struct tbl_row *last_row;
34: struct tbl_span *first_span;
1.17 schwarze 35: struct tbl_span *current_span;
1.8 kristaps 36: struct tbl_span *last_span;
1.15 kristaps 37: struct tbl_node *next;
1.2 kristaps 38: };
1.1 kristaps 39:
1.18 kristaps 40: struct eqn_node {
1.30 schwarze 41: struct eqn eqn; /* syntax tree of this equation */
42: struct mparse *parse; /* main parser, for error reporting */
43: struct eqn_node *next; /* singly linked list of equations */
44: struct eqn_def *defs; /* array of definitions */
45: char *data; /* source code of this equation */
1.40 ! schwarze 46: char *start; /* first byte of the current token */
! 47: char *end; /* first byte of the next token */
1.30 schwarze 48: size_t defsz; /* number of definitions */
49: size_t sz; /* length of the source code */
1.40 ! schwarze 50: size_t toksz; /* length of the current token */
1.30 schwarze 51: int gsize; /* default point size */
52: int delim; /* in-line delimiters enabled */
53: char odelim; /* in-line opening delimiter */
54: char cdelim; /* in-line closing delimiter */
1.18 kristaps 55: };
56:
1.23 kristaps 57: struct eqn_def {
58: char *key;
59: size_t keysz;
60: char *val;
61: size_t valsz;
62: };
1.33 schwarze 63:
1.23 kristaps 64:
1.20 kristaps 65: struct tbl_node *tbl_alloc(int, int, struct mparse *);
1.15 kristaps 66: void tbl_restart(int, int, struct tbl_node *);
67: void tbl_free(struct tbl_node *);
68: void tbl_reset(struct tbl_node *);
1.29 schwarze 69: enum rofferr tbl_read(struct tbl_node *, int, const char *, int);
1.36 schwarze 70: void tbl_option(struct tbl_node *, int, const char *, int *);
71: void tbl_layout(struct tbl_node *, int, const char *, int);
72: void tbl_data(struct tbl_node *, int, const char *, int);
73: int tbl_cdata(struct tbl_node *, int, const char *, int);
1.17 schwarze 74: const struct tbl_span *tbl_span(struct tbl_node *);
1.37 schwarze 75: int tbl_end(struct tbl_node **);
1.31 schwarze 76: struct eqn_node *eqn_alloc(int, int, struct mparse *);
1.27 kristaps 77: enum rofferr eqn_end(struct eqn_node **);
1.18 kristaps 78: void eqn_free(struct eqn_node *);
1.29 schwarze 79: enum rofferr eqn_read(struct eqn_node **, int,
1.22 kristaps 80: const char *, int, int *);
CVSweb