aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2018-12-30 00:49:54 +0000
committerIngo Schwarze <schwarze@openbsd.org>2018-12-30 00:49:54 +0000
commit68183e3516ca405d803db497157cd8246b9b8bad (patch)
treed88411ec1f7435c594c8afcfc4b99cca3a0d5bdf /mdoc_term.c
parentb4f47224dd1036f4d89f641195a444eea00a55e8 (diff)
downloadmandoc-68183e3516ca405d803db497157cd8246b9b8bad.tar.gz
mandoc-68183e3516ca405d803db497157cd8246b9b8bad.tar.zst
mandoc-68183e3516ca405d803db497157cd8246b9b8bad.zip
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 'mdoc_term.c')
-rw-r--r--mdoc_term.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index 590a41ee..e06576a6 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.370 2018/12/13 11:55:47 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.371 2018/12/30 00:49:55 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -251,7 +251,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;
@@ -269,8 +269,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;
}
@@ -280,8 +279,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))
@@ -289,7 +287,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;