summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-04-19 14:57:38 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-04-19 14:57:38 +0000
commitc599b29874a76cbd98a6af0d536d744e679bb1f5 (patch)
tree2b4131d196075429d0256ae87e29735403934586
parentb41835362693d09c3eff29cb37f2217b9dca8cc3 (diff)
downloadmandoc-c599b29874a76cbd98a6af0d536d744e679bb1f5.tar.gz
Unify trickier node handling functions.
* man_elem_alloc() -> roff_elem_alloc() * man_block_alloc() -> roff_block_alloc() The functions mdoc_elem_alloc() and mdoc_block_alloc() remain for now because they need to do mdoc(7)-specific argument processing.
-rw-r--r--libman.h2
-rw-r--r--man.c22
-rw-r--r--man_macro.c7
-rw-r--r--mdoc.c2
-rw-r--r--mdoc_macro.c6
-rw-r--r--roff.c21
-rw-r--r--roff_int.h2
7 files changed, 31 insertions, 31 deletions
diff --git a/libman.h b/libman.h
index 223d8ed5..6f8589e6 100644
--- a/libman.h
+++ b/libman.h
@@ -36,8 +36,6 @@ extern const struct man_macro *const man_macros;
__BEGIN_DECLS
-void man_block_alloc(struct roff_man *, int, int, int);
-void man_elem_alloc(struct roff_man *, int, int, int);
int man_hash_find(const char *);
void man_macroend(struct roff_man *);
void man_valid_post(struct roff_man *);
diff --git a/man.c b/man.c
index 38d0edf9..71d540f2 100644
--- a/man.c
+++ b/man.c
@@ -74,26 +74,6 @@ man_parseln(struct roff_man *man, int ln, char *buf, int offs)
man_ptext(man, ln, buf, offs));
}
-void
-man_elem_alloc(struct roff_man *man, int line, int pos, int tok)
-{
- struct roff_node *p;
-
- p = roff_node_alloc(man, line, pos, ROFFT_ELEM, tok);
- roff_node_append(man, p);
- man->next = ROFF_NEXT_CHILD;
-}
-
-void
-man_block_alloc(struct roff_man *man, int line, int pos, int tok)
-{
- struct roff_node *p;
-
- p = roff_node_alloc(man, line, pos, ROFFT_BLOCK, tok);
- roff_node_append(man, p);
- man->next = ROFF_NEXT_CHILD;
-}
-
static void
man_descope(struct roff_man *man, int line, int offs)
{
@@ -139,7 +119,7 @@ man_ptext(struct roff_man *man, int line, char *buf, int offs)
/* Allocate a blank entry. */
if (man->last->tok != MAN_SH &&
man->last->tok != MAN_SS) {
- man_elem_alloc(man, line, offs, MAN_sp);
+ roff_elem_alloc(man, line, offs, MAN_sp);
man->next = ROFF_NEXT_SIBLING;
}
return(1);
diff --git a/man_macro.c b/man_macro.c
index ab5e3ffc..d540fc4a 100644
--- a/man_macro.c
+++ b/man_macro.c
@@ -259,7 +259,7 @@ blk_exp(MACRO_PROT_ARGS)
int la;
rew_scope(man, tok);
- man_block_alloc(man, line, ppos, tok);
+ roff_block_alloc(man, line, ppos, tok);
head = roff_head_alloc(man, line, ppos, tok);
la = *pos;
@@ -289,8 +289,7 @@ blk_imp(MACRO_PROT_ARGS)
struct roff_node *n;
rew_scope(man, tok);
- man_block_alloc(man, line, ppos, tok);
- n = man->last;
+ n = roff_block_alloc(man, line, ppos, tok);
if (n->tok == MAN_SH || n->tok == MAN_SS)
man->flags &= ~MAN_LITERAL;
n = roff_head_alloc(man, line, ppos, tok);
@@ -329,7 +328,7 @@ in_line_eoln(MACRO_PROT_ARGS)
char *p;
struct roff_node *n;
- man_elem_alloc(man, line, ppos, tok);
+ roff_elem_alloc(man, line, ppos, tok);
n = man->last;
for (;;) {
diff --git a/mdoc.c b/mdoc.c
index 1ca0cffb..aed7218a 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -329,7 +329,7 @@ mdoc_ptext(struct roff_man *mdoc, int line, char *buf, int offs)
* blank lines aren't allowed, but enough manuals assume this
* behaviour that we want to work around it.
*/
- mdoc_elem_alloc(mdoc, line, offs, MDOC_sp, NULL);
+ roff_elem_alloc(mdoc, line, offs, MDOC_sp);
mdoc->next = ROFF_NEXT_SIBLING;
mdoc_valid_post(mdoc);
return(1);
diff --git a/mdoc_macro.c b/mdoc_macro.c
index cb06dcdc..f2c7d78e 100644
--- a/mdoc_macro.c
+++ b/mdoc_macro.c
@@ -646,7 +646,7 @@ blk_exp_close(MACRO_PROT_ARGS)
* Stray .Ec without previous .Eo:
* Break the output line, keep the arguments.
*/
- mdoc_elem_alloc(mdoc, line, ppos, MDOC_br, NULL);
+ roff_elem_alloc(mdoc, line, ppos, MDOC_br);
rew_elem(mdoc, MDOC_br);
}
} else if (endbody == NULL) {
@@ -990,7 +990,7 @@ blk_full(MACRO_PROT_ARGS)
if (tok == MDOC_It && (n == NULL || n->tok != MDOC_Bl)) {
mandoc_vmsg(MANDOCERR_IT_STRAY, mdoc->parse,
line, ppos, "It %s", buf + *pos);
- mdoc_elem_alloc(mdoc, line, ppos, MDOC_br, NULL);
+ roff_elem_alloc(mdoc, line, ppos, MDOC_br);
rew_elem(mdoc, MDOC_br);
return;
}
@@ -1223,7 +1223,7 @@ blk_part_exp(MACRO_PROT_ARGS)
* case of `Eo'); and a body that may be empty.
*/
- mdoc_block_alloc(mdoc, line, ppos, tok, NULL);
+ roff_block_alloc(mdoc, line, ppos, tok);
head = NULL;
for (;;) {
la = *pos;
diff --git a/roff.c b/roff.c
index 15189f27..b3f5752a 100644
--- a/roff.c
+++ b/roff.c
@@ -1096,6 +1096,27 @@ roff_word_append(struct roff_man *man, const char *word)
man->next = ROFF_NEXT_SIBLING;
}
+void
+roff_elem_alloc(struct roff_man *man, int line, int pos, int tok)
+{
+ struct roff_node *n;
+
+ n = roff_node_alloc(man, line, pos, ROFFT_ELEM, tok);
+ roff_node_append(man, n);
+ man->next = ROFF_NEXT_CHILD;
+}
+
+struct roff_node *
+roff_block_alloc(struct roff_man *man, int line, int pos, int tok)
+{
+ struct roff_node *n;
+
+ n = roff_node_alloc(man, line, pos, ROFFT_BLOCK, tok);
+ roff_node_append(man, n);
+ man->next = ROFF_NEXT_CHILD;
+ return(n);
+}
+
struct roff_node *
roff_head_alloc(struct roff_man *man, int line, int pos, int tok)
{
diff --git a/roff_int.h b/roff_int.h
index 41a38dd8..311f347a 100644
--- a/roff_int.h
+++ b/roff_int.h
@@ -23,6 +23,8 @@ struct roff_node *roff_node_alloc(struct roff_man *, int, int,
void roff_node_append(struct roff_man *, struct roff_node *);
void roff_word_alloc(struct roff_man *, int, int, const char *);
void roff_word_append(struct roff_man *, const char *);
+void roff_elem_alloc(struct roff_man *, int, int, int);
+struct roff_node *roff_block_alloc(struct roff_man *, int, int, int);
struct roff_node *roff_head_alloc(struct roff_man *, int, int, int);
struct roff_node *roff_body_alloc(struct roff_man *, int, int, int);
void roff_addeqn(struct roff_man *, const struct eqn *);