summaryrefslogtreecommitdiffstats
path: root/mdoc.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-04-19 14:25:41 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-04-19 14:25:41 +0000
commitb41835362693d09c3eff29cb37f2217b9dca8cc3 (patch)
tree304f88d63b2cc2aa84f33f3805156cd93c4f7cec /mdoc.c
parenteed5e7f1fb85805f1b324c5a4501ed30467ae2a0 (diff)
downloadmandoc-b41835362693d09c3eff29cb37f2217b9dca8cc3.tar.gz
Unify some node handling functions that use TOKEN_NONE.
* mdoc_word_alloc(), man_word_alloc() -> roff_word_alloc() * mdoc_word_append(), man_word_append() -> roff_word_append() * mdoc_addspan(), man_addspan() -> roff_addtbl() * mdoc_addeqn(), man_addeqn() -> roff_addeqn() Minus 50 lines of code, no functional change.
Diffstat (limited to 'mdoc.c')
-rw-r--r--mdoc.c54
1 files changed, 1 insertions, 53 deletions
diff --git a/mdoc.c b/mdoc.c
index fe257b00..1ca0cffb 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -96,31 +96,6 @@ mdoc_endparse(struct roff_man *mdoc)
mdoc_macroend(mdoc);
}
-void
-mdoc_addeqn(struct roff_man *mdoc, const struct eqn *ep)
-{
- struct roff_node *n;
-
- n = roff_node_alloc(mdoc, ep->ln, ep->pos, ROFFT_EQN, TOKEN_NONE);
- n->eqn = ep;
- if (ep->ln > mdoc->last->line)
- n->flags |= MDOC_LINE;
- roff_node_append(mdoc, n);
- mdoc->next = ROFF_NEXT_SIBLING;
-}
-
-void
-mdoc_addspan(struct roff_man *mdoc, const struct tbl_span *sp)
-{
- struct roff_node *n;
-
- n = roff_node_alloc(mdoc, sp->line, 0, ROFFT_TBL, TOKEN_NONE);
- n->span = sp;
- roff_node_append(mdoc, n);
- mdoc_valid_post(mdoc);
- mdoc->next = ROFF_NEXT_SIBLING;
-}
-
/*
* Main parse routine. Parses a single line -- really just hands off to
* the macro (mdoc_pmacro()) or text parser (mdoc_ptext()).
@@ -255,33 +230,6 @@ mdoc_elem_alloc(struct roff_man *mdoc, int line, int pos,
}
void
-mdoc_word_alloc(struct roff_man *mdoc, int line, int pos, const char *p)
-{
- struct roff_node *n;
-
- n = roff_node_alloc(mdoc, line, pos, ROFFT_TEXT, TOKEN_NONE);
- n->string = roff_strdup(mdoc->roff, p);
- roff_node_append(mdoc, n);
- mdoc_valid_post(mdoc);
- mdoc->next = ROFF_NEXT_SIBLING;
-}
-
-void
-mdoc_word_append(struct roff_man *mdoc, const char *p)
-{
- struct roff_node *n;
- char *addstr, *newstr;
-
- n = mdoc->last;
- addstr = roff_strdup(mdoc->roff, p);
- mandoc_asprintf(&newstr, "%s %s", n->string, addstr);
- free(addstr);
- free(n->string);
- n->string = newstr;
- mdoc->next = ROFF_NEXT_SIBLING;
-}
-
-void
mdoc_node_relink(struct roff_man *mdoc, struct roff_node *p)
{
@@ -387,7 +335,7 @@ mdoc_ptext(struct roff_man *mdoc, int line, char *buf, int offs)
return(1);
}
- mdoc_word_alloc(mdoc, line, offs, buf+offs);
+ roff_word_alloc(mdoc, line, offs, buf+offs);
if (mdoc->flags & MDOC_LITERAL)
return(1);