1*698f87a4SGarrett D'Amore /* $Id: libmandoc.h,v 1.35 2013/12/15 21:23:52 schwarze Exp $ */ 295c635efSGarrett D'Amore /* 3*698f87a4SGarrett D'Amore * Copyright (c) 2009, 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv> 4*698f87a4SGarrett D'Amore * Copyright (c) 2013 Ingo Schwarze <schwarze@openbsd.org> 595c635efSGarrett D'Amore * 695c635efSGarrett D'Amore * Permission to use, copy, modify, and distribute this software for any 795c635efSGarrett D'Amore * purpose with or without fee is hereby granted, provided that the above 895c635efSGarrett D'Amore * copyright notice and this permission notice appear in all copies. 995c635efSGarrett D'Amore * 1095c635efSGarrett D'Amore * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 1195c635efSGarrett D'Amore * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 1295c635efSGarrett D'Amore * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 1395c635efSGarrett D'Amore * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 1495c635efSGarrett D'Amore * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 1595c635efSGarrett D'Amore * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 1695c635efSGarrett D'Amore * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 1795c635efSGarrett D'Amore */ 1895c635efSGarrett D'Amore #ifndef LIBMANDOC_H 1995c635efSGarrett D'Amore #define LIBMANDOC_H 2095c635efSGarrett D'Amore 2195c635efSGarrett D'Amore enum rofferr { 2295c635efSGarrett D'Amore ROFF_CONT, /* continue processing line */ 2395c635efSGarrett D'Amore ROFF_RERUN, /* re-run roff interpreter with offset */ 2495c635efSGarrett D'Amore ROFF_APPEND, /* re-run main parser, appending next line */ 2595c635efSGarrett D'Amore ROFF_REPARSE, /* re-run main parser on the result */ 2695c635efSGarrett D'Amore ROFF_SO, /* include another file */ 2795c635efSGarrett D'Amore ROFF_IGN, /* ignore current line */ 2895c635efSGarrett D'Amore ROFF_TBL, /* a table row was successfully parsed */ 2995c635efSGarrett D'Amore ROFF_EQN, /* an equation was successfully parsed */ 3095c635efSGarrett D'Amore ROFF_ERR /* badness: puke and stop */ 3195c635efSGarrett D'Amore }; 3295c635efSGarrett D'Amore 3395c635efSGarrett D'Amore __BEGIN_DECLS 3495c635efSGarrett D'Amore 3595c635efSGarrett D'Amore struct roff; 3695c635efSGarrett D'Amore struct mdoc; 3795c635efSGarrett D'Amore struct man; 3895c635efSGarrett D'Amore 3995c635efSGarrett D'Amore void mandoc_msg(enum mandocerr, struct mparse *, 4095c635efSGarrett D'Amore int, int, const char *); 4195c635efSGarrett D'Amore void mandoc_vmsg(enum mandocerr, struct mparse *, 4295c635efSGarrett D'Amore int, int, const char *, ...); 4395c635efSGarrett D'Amore char *mandoc_getarg(struct mparse *, char **, int, int *); 4495c635efSGarrett D'Amore char *mandoc_normdate(struct mparse *, char *, int, int); 4595c635efSGarrett D'Amore int mandoc_eos(const char *, size_t, int); 4695c635efSGarrett D'Amore int mandoc_strntoi(const char *, size_t, int); 4795c635efSGarrett D'Amore const char *mandoc_a2msec(const char*); 4895c635efSGarrett D'Amore 4995c635efSGarrett D'Amore void mdoc_free(struct mdoc *); 50*698f87a4SGarrett D'Amore struct mdoc *mdoc_alloc(struct roff *, struct mparse *, char *); 5195c635efSGarrett D'Amore void mdoc_reset(struct mdoc *); 5295c635efSGarrett D'Amore int mdoc_parseln(struct mdoc *, int, char *, int); 5395c635efSGarrett D'Amore int mdoc_endparse(struct mdoc *); 5495c635efSGarrett D'Amore int mdoc_addspan(struct mdoc *, const struct tbl_span *); 5595c635efSGarrett D'Amore int mdoc_addeqn(struct mdoc *, const struct eqn *); 5695c635efSGarrett D'Amore 5795c635efSGarrett D'Amore void man_free(struct man *); 5895c635efSGarrett D'Amore struct man *man_alloc(struct roff *, struct mparse *); 5995c635efSGarrett D'Amore void man_reset(struct man *); 6095c635efSGarrett D'Amore int man_parseln(struct man *, int, char *, int); 6195c635efSGarrett D'Amore int man_endparse(struct man *); 6295c635efSGarrett D'Amore int man_addspan(struct man *, const struct tbl_span *); 6395c635efSGarrett D'Amore int man_addeqn(struct man *, const struct eqn *); 6495c635efSGarrett D'Amore 6595c635efSGarrett D'Amore void roff_free(struct roff *); 66*698f87a4SGarrett D'Amore struct roff *roff_alloc(enum mparset, struct mparse *); 6795c635efSGarrett D'Amore void roff_reset(struct roff *); 6895c635efSGarrett D'Amore enum rofferr roff_parseln(struct roff *, int, 6995c635efSGarrett D'Amore char **, size_t *, int, int *); 7095c635efSGarrett D'Amore void roff_endparse(struct roff *); 71*698f87a4SGarrett D'Amore void roff_setreg(struct roff *, const char *, int, char sign); 72*698f87a4SGarrett D'Amore int roff_getreg(const struct roff *, const char *); 7395c635efSGarrett D'Amore char *roff_strdup(const struct roff *, const char *); 74*698f87a4SGarrett D'Amore int roff_getcontrol(const struct roff *, 75*698f87a4SGarrett D'Amore const char *, int *); 7695c635efSGarrett D'Amore #if 0 7795c635efSGarrett D'Amore char roff_eqndelim(const struct roff *); 7895c635efSGarrett D'Amore void roff_openeqn(struct roff *, const char *, 7995c635efSGarrett D'Amore int, int, const char *); 8095c635efSGarrett D'Amore int roff_closeeqn(struct roff *); 8195c635efSGarrett D'Amore #endif 8295c635efSGarrett D'Amore 8395c635efSGarrett D'Amore const struct tbl_span *roff_span(const struct roff *); 8495c635efSGarrett D'Amore const struct eqn *roff_eqn(const struct roff *); 8595c635efSGarrett D'Amore 8695c635efSGarrett D'Amore __END_DECLS 8795c635efSGarrett D'Amore 8895c635efSGarrett D'Amore #endif /*!LIBMANDOC_H*/ 89