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