summaryrefslogtreecommitdiffstats
path: root/mdoc_macro.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-04-19 13:50:25 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-04-19 13:50:25 +0000
commit344327def21ee64357a9cdf57c5352f1c5575708 (patch)
tree9c1fa971d139df98f2c3890c5d8712eaf4436b86 /mdoc_macro.c
parentd4d5d006d52687c2882e89b913c70967626da0e1 (diff)
downloadmandoc-344327def21ee64357a9cdf57c5352f1c5575708.tar.gz
Unify node handling functions:
* node_alloc() for mdoc and man_node_alloc() -> roff_node_alloc() * node_append() for mdoc and man_node_append() -> roff_node_append() * mdoc_head_alloc() and man_head_alloc() -> roff_head_alloc() * mdoc_body_alloc() and man_body_alloc() -> roff_body_alloc() * mdoc_node_unlink() and man_node_unlink() -> roff_node_unlink() * mdoc_node_free() and man_node_free() -> roff_node_free() * mdoc_node_delete() and man_node_delete() -> roff_node_delete() Minus 130 lines of code, no functional change.
Diffstat (limited to 'mdoc_macro.c')
-rw-r--r--mdoc_macro.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/mdoc_macro.c b/mdoc_macro.c
index 360e6e64..e904a6eb 100644
--- a/mdoc_macro.c
+++ b/mdoc_macro.c
@@ -30,6 +30,7 @@
#include "roff.h"
#include "mdoc.h"
#include "libmandoc.h"
+#include "roff_int.h"
#include "libmdoc.h"
static void blk_full(MACRO_PROT_ARGS);
@@ -292,7 +293,7 @@ rew_pending(struct roff_man *mdoc, const struct roff_node *n)
switch (n->type) {
case ROFFT_HEAD:
- mdoc_body_alloc(mdoc, n->line, n->pos, n->tok);
+ roff_body_alloc(mdoc, n->line, n->pos, n->tok);
return;
case ROFFT_BLOCK:
break;
@@ -1022,9 +1023,9 @@ blk_full(MACRO_PROT_ARGS)
*/
if (tok == MDOC_Nd) {
- head = mdoc_head_alloc(mdoc, line, ppos, tok);
+ head = roff_head_alloc(mdoc, line, ppos, tok);
rew_last(mdoc, head);
- body = mdoc_body_alloc(mdoc, line, ppos, tok);
+ body = roff_body_alloc(mdoc, line, ppos, tok);
}
if (tok == MDOC_Bk)
@@ -1047,7 +1048,7 @@ blk_full(MACRO_PROT_ARGS)
*/
if (body != NULL)
rew_last(mdoc, body);
- body = mdoc_body_alloc(mdoc, line, ppos, tok);
+ body = roff_body_alloc(mdoc, line, ppos, tok);
break;
}
if (tok == MDOC_Bd || tok == MDOC_Bk) {
@@ -1082,7 +1083,7 @@ blk_full(MACRO_PROT_ARGS)
/* Open a head if one hasn't been opened. */
if (head == NULL)
- head = mdoc_head_alloc(mdoc, line, ppos, tok);
+ head = roff_head_alloc(mdoc, line, ppos, tok);
if (ac == ARGS_PHRASE ||
ac == ARGS_PEND ||
@@ -1094,7 +1095,7 @@ blk_full(MACRO_PROT_ARGS)
*/
rew_last(mdoc, body == NULL ? head : body);
- body = mdoc_body_alloc(mdoc, line, ppos, tok);
+ body = roff_body_alloc(mdoc, line, ppos, tok);
/*
* Process phrases: set whether we're in a
@@ -1118,7 +1119,7 @@ blk_full(MACRO_PROT_ARGS)
if (blk->flags & MDOC_VALID)
return;
if (head == NULL)
- head = mdoc_head_alloc(mdoc, line, ppos, tok);
+ head = roff_head_alloc(mdoc, line, ppos, tok);
if (nl && tok != MDOC_Bd && tok != MDOC_Bl && tok != MDOC_Rs)
append_delims(mdoc, line, pos, buf);
if (body != NULL)
@@ -1129,7 +1130,7 @@ blk_full(MACRO_PROT_ARGS)
/* Close out scopes to remain in a consistent state. */
rew_last(mdoc, head);
- body = mdoc_body_alloc(mdoc, line, ppos, tok);
+ body = roff_body_alloc(mdoc, line, ppos, tok);
out:
if (mdoc->flags & MDOC_FREECOL) {
rew_last(mdoc, body);
@@ -1160,7 +1161,7 @@ blk_part_imp(MACRO_PROT_ARGS)
*/
blk = mdoc_block_alloc(mdoc, line, ppos, tok, NULL);
- rew_last(mdoc, mdoc_head_alloc(mdoc, line, ppos, tok));
+ rew_last(mdoc, roff_head_alloc(mdoc, line, ppos, tok));
/*
* Open the body scope "on-demand", that is, after we've
@@ -1181,13 +1182,13 @@ blk_part_imp(MACRO_PROT_ARGS)
}
if (body == NULL)
- body = mdoc_body_alloc(mdoc, line, ppos, tok);
+ body = roff_body_alloc(mdoc, line, ppos, tok);
if (macro_or_word(mdoc, tok, line, la, pos, buf, 1))
break;
}
if (body == NULL)
- body = mdoc_body_alloc(mdoc, line, ppos, tok);
+ body = roff_body_alloc(mdoc, line, ppos, tok);
if (find_pending(mdoc, tok, line, ppos, body))
return;
@@ -1238,11 +1239,11 @@ blk_part_exp(MACRO_PROT_ARGS)
}
if (head == NULL) {
- head = mdoc_head_alloc(mdoc, line, ppos, tok);
+ head = roff_head_alloc(mdoc, line, ppos, tok);
if (tok == MDOC_Eo) /* Not parsed. */
dword(mdoc, line, la, p, DELIM_MAX, 0);
rew_last(mdoc, head);
- mdoc_body_alloc(mdoc, line, ppos, tok);
+ roff_body_alloc(mdoc, line, ppos, tok);
if (tok == MDOC_Eo)
continue;
}
@@ -1254,8 +1255,8 @@ blk_part_exp(MACRO_PROT_ARGS)
/* Clean-up to leave in a consistent state. */
if (head == NULL) {
- rew_last(mdoc, mdoc_head_alloc(mdoc, line, ppos, tok));
- mdoc_body_alloc(mdoc, line, ppos, tok);
+ rew_last(mdoc, roff_head_alloc(mdoc, line, ppos, tok));
+ roff_body_alloc(mdoc, line, ppos, tok);
}
if (nl)
append_delims(mdoc, line, pos, buf);
@@ -1471,6 +1472,6 @@ phrase_ta(MACRO_PROT_ARGS)
/* Advance to the next column. */
rew_last(mdoc, body);
- mdoc_body_alloc(mdoc, line, ppos, MDOC_It);
+ roff_body_alloc(mdoc, line, ppos, MDOC_It);
parse_rest(mdoc, MDOC_MAX, line, pos, buf);
}