diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2018-12-30 00:48:49 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2018-12-30 00:48:49 +0000 |
commit | 6b33e0a95d108068486691c6796a071893276f5b (patch) | |
tree | 82df7ddc258a743a95c0fa6698c17708565e3884 /usr.bin/mandoc/mdoc_term.c | |
parent | a8115538de1b74ab4231a9656e685f6edb7244fe (diff) |
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.
Diffstat (limited to 'usr.bin/mandoc/mdoc_term.c')
-rw-r--r-- | usr.bin/mandoc/mdoc_term.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c index 075c09a0b89..f5c26d5fbde 100644 --- a/usr.bin/mandoc/mdoc_term.c +++ b/usr.bin/mandoc/mdoc_term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_term.c,v 1.269 2018/12/13 11:55:14 schwarze Exp $ */ +/* $OpenBSD: mdoc_term.c,v 1.270 2018/12/30 00:48:48 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012-2018 Ingo Schwarze <schwarze@openbsd.org> @@ -249,7 +249,7 @@ static int fn_prio; void -terminal_mdoc(void *arg, const struct roff_man *mdoc) +terminal_mdoc(void *arg, const struct roff_meta *mdoc) { struct roff_node *n; struct termp *p; @@ -267,8 +267,7 @@ terminal_mdoc(void *arg, const struct roff_man *mdoc) if (n->tok == MDOC_Sh && n->sec == SEC_SYNOPSIS) { if (n->child->next->child != NULL) print_mdoc_nodelist(p, NULL, - &mdoc->meta, - n->child->next->child); + mdoc, n->child->next->child); term_newln(p); break; } @@ -278,8 +277,7 @@ terminal_mdoc(void *arg, const struct roff_man *mdoc) save_defindent = p->defindent; if (p->defindent == 0) p->defindent = 5; - term_begin(p, print_mdoc_head, print_mdoc_foot, - &mdoc->meta); + term_begin(p, print_mdoc_head, print_mdoc_foot, mdoc); while (n != NULL && (n->type == ROFFT_COMMENT || n->flags & NODE_NOPRT)) @@ -287,7 +285,7 @@ terminal_mdoc(void *arg, const struct roff_man *mdoc) if (n != NULL) { if (n->tok != MDOC_Sh) term_vspace(p); - print_mdoc_nodelist(p, NULL, &mdoc->meta, n); + print_mdoc_nodelist(p, NULL, mdoc, n); } term_end(p); p->defindent = save_defindent; |