xref: /freebsd/contrib/mandoc/mandoc_parse.h (revision 7295610f5da64ab1818458ce007d9eb924496330)
1*7295610fSBaptiste Daroussin /*	$Id: mandoc_parse.h,v 1.4 2018/12/30 00:49:55 schwarze Exp $ */
2*7295610fSBaptiste Daroussin /*
3*7295610fSBaptiste Daroussin  * Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
4*7295610fSBaptiste Daroussin  * Copyright (c) 2014,2015,2016,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  * Top level parser interface.  For use in the main program
19*7295610fSBaptiste Daroussin  * and in the main parser, but not in formatters.
20*7295610fSBaptiste Daroussin  */
21*7295610fSBaptiste Daroussin 
22*7295610fSBaptiste Daroussin /*
23*7295610fSBaptiste Daroussin  * Parse options.
24*7295610fSBaptiste Daroussin  */
25*7295610fSBaptiste Daroussin #define	MPARSE_MDOC	(1 << 0)  /* assume -mdoc */
26*7295610fSBaptiste Daroussin #define	MPARSE_MAN	(1 << 1)  /* assume -man */
27*7295610fSBaptiste Daroussin #define	MPARSE_SO	(1 << 2)  /* honour .so requests */
28*7295610fSBaptiste Daroussin #define	MPARSE_QUICK	(1 << 3)  /* abort the parse early */
29*7295610fSBaptiste Daroussin #define	MPARSE_UTF8	(1 << 4)  /* accept UTF-8 input */
30*7295610fSBaptiste Daroussin #define	MPARSE_LATIN1	(1 << 5)  /* accept ISO-LATIN-1 input */
31*7295610fSBaptiste Daroussin #define	MPARSE_VALIDATE	(1 << 6)  /* call validation functions */
32*7295610fSBaptiste Daroussin 
33*7295610fSBaptiste Daroussin 
34*7295610fSBaptiste Daroussin struct	roff_meta;
35*7295610fSBaptiste Daroussin struct	mparse;
36*7295610fSBaptiste Daroussin 
37*7295610fSBaptiste Daroussin struct mparse	 *mparse_alloc(int, enum mandoc_os, const char *);
38*7295610fSBaptiste Daroussin void		  mparse_copy(const struct mparse *);
39*7295610fSBaptiste Daroussin void		  mparse_free(struct mparse *);
40*7295610fSBaptiste Daroussin int		  mparse_open(struct mparse *, const char *);
41*7295610fSBaptiste Daroussin void		  mparse_readfd(struct mparse *, int, const char *);
42*7295610fSBaptiste Daroussin void		  mparse_reset(struct mparse *);
43*7295610fSBaptiste Daroussin struct roff_meta *mparse_result(struct mparse *);
44