diff options
-rw-r--r-- | libman.h | 3 | ||||
-rw-r--r-- | libmdoc.h | 4 | ||||
-rw-r--r-- | man.c | 11 | ||||
-rw-r--r-- | man_macro.c | 4 | ||||
-rw-r--r-- | man_validate.c | 6 | ||||
-rw-r--r-- | mdoc.c | 11 | ||||
-rw-r--r-- | mdoc_macro.c | 3 | ||||
-rw-r--r-- | mdoc_state.c | 10 | ||||
-rw-r--r-- | mdoc_validate.c | 6 | ||||
-rw-r--r-- | read.c | 3 | ||||
-rw-r--r-- | roff.c | 19 | ||||
-rw-r--r-- | roff_int.h | 3 |
12 files changed, 30 insertions, 53 deletions
@@ -1,4 +1,4 @@ -/* $Id: libman.h,v 1.84 2018/12/30 00:49:54 schwarze Exp $ */ +/* $Id: libman.h,v 1.85 2018/12/31 04:55:46 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2014, 2015, 2018 Ingo Schwarze <schwarze@openbsd.org> @@ -39,6 +39,5 @@ struct man_macro { const struct man_macro *man_macro(enum roff_tok); void man_descope(struct roff_man *, int, int, char *); -void man_node_validate(struct roff_man *); void man_state(struct roff_man *, struct roff_node *); void man_unscope(struct roff_man *, const struct roff_node *); @@ -1,4 +1,4 @@ -/* $Id: libmdoc.h,v 1.116 2018/12/30 00:49:54 schwarze Exp $ */ +/* $Id: libmdoc.h,v 1.117 2018/12/31 04:55:46 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2013,2014,2015,2017,2018 Ingo Schwarze <schwarze@openbsd.org> @@ -74,9 +74,7 @@ void mdoc_tail_alloc(struct roff_man *, int, int, enum roff_tok); struct roff_node *mdoc_endbody_alloc(struct roff_man *, int, int, enum roff_tok, struct roff_node *); -void mdoc_node_validate(struct roff_man *); void mdoc_state(struct roff_man *, struct roff_node *); -void mdoc_state_reset(struct roff_man *); const char *mdoc_a2arch(const char *); const char *mdoc_a2att(const char *); const char *mdoc_a2lib(const char *); @@ -1,4 +1,4 @@ -/* $Id: man.c,v 1.182 2018/12/30 00:49:55 schwarze Exp $ */ +/* $Id: man.c,v 1.183 2018/12/31 04:55:46 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2013,2014,2015,2017,2018 Ingo Schwarze <schwarze@openbsd.org> @@ -367,12 +367,3 @@ man_state(struct roff_man *man, struct roff_node *n) } man->last->flags |= NODE_VALID; } - -void -man_validate(struct roff_man *man) -{ - - man->last = man->meta.first; - man_node_validate(man); - man->flags &= ~MAN_LITERAL; -} diff --git a/man_macro.c b/man_macro.c index a08cdca6..30d3cfd9 100644 --- a/man_macro.c +++ b/man_macro.c @@ -1,4 +1,4 @@ -/* $Id: man_macro.c,v 1.138 2018/12/30 00:49:55 schwarze Exp $ */ +/* $Id: man_macro.c,v 1.139 2018/12/31 04:55:46 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2012-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org> @@ -445,9 +445,7 @@ in_line_eoln(MACRO_PROT_ARGS) void man_endparse(struct roff_man *man) { - man_unscope(man, man->meta.first); - man->flags &= ~MAN_LITERAL; } static int diff --git a/man_validate.c b/man_validate.c index cfe6bc8b..b6262599 100644 --- a/man_validate.c +++ b/man_validate.c @@ -1,4 +1,4 @@ -/* $Id: man_validate.c,v 1.142 2018/12/16 00:21:05 schwarze Exp $ */ +/* $Id: man_validate.c,v 1.143 2018/12/31 04:55:46 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012-2018 Ingo Schwarze <schwarze@openbsd.org> @@ -101,7 +101,7 @@ static const v_check man_valids[MAN_MAX - MAN_TH] = { /* Validate the subtree rooted at man->last. */ void -man_node_validate(struct roff_man *man) +man_validate(struct roff_man *man) { struct roff_node *n; const v_check *cp; @@ -128,7 +128,7 @@ man_node_validate(struct roff_man *man) man->last = man->last->child; while (man->last != NULL) { - man_node_validate(man); + man_validate(man); if (man->last == n) man->last = man->last->child; else @@ -1,4 +1,4 @@ -/* $Id: mdoc.c,v 1.272 2018/12/30 00:49:55 schwarze Exp $ */ +/* $Id: mdoc.c,v 1.273 2018/12/31 04:55:46 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012-2018 Ingo Schwarze <schwarze@openbsd.org> @@ -428,12 +428,3 @@ mdoc_isdelim(const char *p) return DELIM_NONE; } - -void -mdoc_validate(struct roff_man *mdoc) -{ - - mdoc->last = mdoc->meta.first; - mdoc_node_validate(mdoc); - mdoc_state_reset(mdoc); -} diff --git a/mdoc_macro.c b/mdoc_macro.c index a9343d67..11ca85c7 100644 --- a/mdoc_macro.c +++ b/mdoc_macro.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_macro.c,v 1.229 2018/12/30 00:49:55 schwarze Exp $ */ +/* $Id: mdoc_macro.c,v 1.230 2018/12/31 04:55:46 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012-2018 Ingo Schwarze <schwarze@openbsd.org> @@ -234,7 +234,6 @@ mdoc_endparse(struct roff_man *mdoc) /* Rewind to the first. */ rew_last(mdoc, mdoc->meta.first); - mdoc_state_reset(mdoc); } /* diff --git a/mdoc_state.c b/mdoc_state.c index e592dcce..5fd38f16 100644 --- a/mdoc_state.c +++ b/mdoc_state.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_state.c,v 1.12 2018/12/30 00:49:55 schwarze Exp $ */ +/* $Id: mdoc_state.c,v 1.13 2018/12/31 04:55:47 schwarze Exp $ */ /* * Copyright (c) 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org> * @@ -179,14 +179,6 @@ mdoc_state(struct roff_man *mdoc, struct roff_node *n) (*handler)(mdoc, n); } -void -mdoc_state_reset(struct roff_man *mdoc) -{ - - roff_setreg(mdoc->roff, "nS", 0, '='); - mdoc->flags = 0; -} - static void state_bd(STATE_ARGS) { diff --git a/mdoc_validate.c b/mdoc_validate.c index c0469e88..f4a7b748 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.366 2018/12/30 00:49:55 schwarze Exp $ */ +/* $Id: mdoc_validate.c,v 1.367 2018/12/31 04:55:47 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2018 Ingo Schwarze <schwarze@openbsd.org> @@ -288,7 +288,7 @@ static const char * const secnames[SEC__MAX] = { /* Validate the subtree rooted at mdoc->last. */ void -mdoc_node_validate(struct roff_man *mdoc) +mdoc_validate(struct roff_man *mdoc) { struct roff_node *n, *np; const v_post *p; @@ -319,7 +319,7 @@ mdoc_node_validate(struct roff_man *mdoc) mdoc->last = mdoc->last->child; while (mdoc->last != NULL) { - mdoc_node_validate(mdoc); + mdoc_validate(mdoc); if (mdoc->last == n) mdoc->last = mdoc->last->child; else @@ -1,4 +1,4 @@ -/* $Id: read.c,v 1.209 2018/12/30 00:49:55 schwarze Exp $ */ +/* $Id: read.c,v 1.210 2018/12/31 04:55:47 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2018 Ingo Schwarze <schwarze@openbsd.org> @@ -688,6 +688,7 @@ mparse_free(struct mparse *curp) struct roff_meta * mparse_result(struct mparse *curp) { + roff_state_reset(curp->man); if (curp->options & MPARSE_VALIDATE) { if (curp->man->meta.macroset == MACROSET_MDOC) mdoc_validate(curp->man); @@ -1,4 +1,4 @@ -/* $Id: roff.c,v 1.356 2018/12/30 00:49:56 schwarze Exp $ */ +/* $Id: roff.c,v 1.357 2018/12/31 04:55:47 schwarze Exp $ */ /* * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org> @@ -819,18 +819,25 @@ roff_man_free1(struct roff_man *man) free(man->meta.sodest); } +void +roff_state_reset(struct roff_man *man) +{ + man->last = man->meta.first; + man->last_es = NULL; + man->flags = 0; + man->lastsec = man->lastnamed = SEC_NONE; + man->next = ROFF_NEXT_CHILD; + roff_setreg(man->roff, "nS", 0, '='); +} + static void roff_man_alloc1(struct roff_man *man) { memset(&man->meta, 0, sizeof(man->meta)); man->meta.first = mandoc_calloc(1, sizeof(*man->meta.first)); man->meta.first->type = ROFFT_ROOT; - man->last = man->meta.first; - man->last_es = NULL; - man->flags = 0; man->meta.macroset = MACROSET_NONE; - man->lastsec = man->lastnamed = SEC_NONE; - man->next = ROFF_NEXT_CHILD; + roff_state_reset(man); } void @@ -1,4 +1,4 @@ -/* $Id: roff_int.h,v 1.12 2018/12/30 00:49:56 schwarze Exp $ */ +/* $Id: roff_int.h,v 1.13 2018/12/31 04:55:47 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2013,2014,2015,2017,2018 Ingo Schwarze <schwarze@openbsd.org> @@ -80,6 +80,7 @@ struct ohash *roffhash_alloc(enum roff_tok, enum roff_tok); enum roff_tok roffhash_find(struct ohash *, const char *, size_t); void roffhash_free(struct ohash *); +void roff_state_reset(struct roff_man *); void roff_validate(struct roff_man *); /* |