From 68183e3516ca405d803db497157cd8246b9b8bad Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sun, 30 Dec 2018 00:49:54 +0000 Subject: Cleanup, no functional change: The struct roff_man used to be a bad mixture of internal parser state and public parsing results. Move the public results to the parsing result struct roff_meta, which is already public. Move the rest of struct roff_man to the parser-internal header roff_int.h. Since the validators need access to the parser state, call them from the top level parser during mparse_result() rather than from the main programs, also reducing code duplication. This keeps parser internal state out of thee main programs (five in mandoc portable) and out of eight formatters. --- mandoc_parse.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'mandoc_parse.h') diff --git a/mandoc_parse.h b/mandoc_parse.h index 5ad0f07b..61341f0d 100644 --- a/mandoc_parse.h +++ b/mandoc_parse.h @@ -1,4 +1,4 @@ -/* $Id: mandoc_parse.h,v 1.3 2018/12/14 01:24:49 schwarze Exp $ */ +/* $Id: mandoc_parse.h,v 1.4 2018/12/30 00:49:55 schwarze Exp $ */ /* * Copyright (c) 2010, 2011 Kristaps Dzonsons * Copyright (c) 2014,2015,2016,2017,2018 Ingo Schwarze @@ -28,10 +28,11 @@ #define MPARSE_QUICK (1 << 3) /* abort the parse early */ #define MPARSE_UTF8 (1 << 4) /* accept UTF-8 input */ #define MPARSE_LATIN1 (1 << 5) /* accept ISO-LATIN-1 input */ +#define MPARSE_VALIDATE (1 << 6) /* call validation functions */ +struct roff_meta; struct mparse; -struct roff_man; struct mparse *mparse_alloc(int, enum mandoc_os, const char *); void mparse_copy(const struct mparse *); @@ -39,5 +40,4 @@ void mparse_free(struct mparse *); int mparse_open(struct mparse *, const char *); void mparse_readfd(struct mparse *, int, const char *); void mparse_reset(struct mparse *); -void mparse_result(struct mparse *, - struct roff_man **, char **); +struct roff_meta *mparse_result(struct mparse *); -- cgit v1.2.3