summaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_action.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-11-29 12:22:28 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-11-29 12:22:28 +0000
commit3242f86b1e29a933cc8ab3bd8022d2296d5c5d9b (patch)
tree2434682dbd98a59b47a20af96a126877f943724a /mdoc_action.c
parentd4c9c67277f746527056cd1983e7dbb9ea3af002 (diff)
downloadmandoc-3242f86b1e29a933cc8ab3bd8022d2296d5c5d9b.tar.gz
mandoc-3242f86b1e29a933cc8ab3bd8022d2296d5c5d9b.tar.zst
mandoc-3242f86b1e29a933cc8ab3bd8022d2296d5c5d9b.zip
Migrate action for `Rs' into mdoc_validate.c.
Remove superfluous in-line order_rs function. Merge `Rs' validations {BLOCK, BODY} -> {BODY}. Make invalid children of `Rs' raise an error but otherwise be allowed.
Diffstat (limited to 'mdoc_action.c')
-rw-r--r--mdoc_action.c70
1 files changed, 2 insertions, 68 deletions
diff --git a/mdoc_action.c b/mdoc_action.c
index 5bdc2fcd..d0b6411e 100644
--- a/mdoc_action.c
+++ b/mdoc_action.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_action.c,v 1.78 2010/07/30 17:14:09 joerg Exp $ */
+/* $Id: mdoc_action.c,v 1.79 2010/11/29 12:22:28 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -50,7 +50,6 @@ struct actions {
static int concat(struct mdoc *, char *,
const struct mdoc_node *, size_t);
-static inline int order_rs(enum mdoct);
static int post_ar(POST_ARGS);
static int post_at(POST_ARGS);
@@ -67,7 +66,6 @@ static int post_nm(POST_ARGS);
static int post_os(POST_ARGS);
static int post_pa(POST_ARGS);
static int post_prol(POST_ARGS);
-static int post_rs(POST_ARGS);
static int post_sh(POST_ARGS);
static int post_st(POST_ARGS);
static int post_std(POST_ARGS);
@@ -161,7 +159,7 @@ static const struct actions mdoc_actions[MDOC_MAX] = {
{ NULL, NULL }, /* Qo */
{ NULL, NULL }, /* Qq */
{ NULL, NULL }, /* Re */
- { NULL, post_rs }, /* Rs */
+ { NULL, NULL }, /* Rs */
{ NULL, NULL }, /* Sc */
{ NULL, NULL }, /* So */
{ NULL, NULL }, /* Sq */
@@ -986,67 +984,3 @@ post_display(POST_ARGS)
m->flags &= ~MDOC_LITERAL;
return(1);
}
-
-
-static inline int
-order_rs(enum mdoct t)
-{
- int i;
-
- for (i = 0; i < (int)RSORD_MAX; i++)
- if (rsord[i] == t)
- return(i);
-
- abort();
- /* NOTREACHED */
-}
-
-
-/* ARGSUSED */
-static int
-post_rs(POST_ARGS)
-{
- struct mdoc_node *nn, *next, *prev;
- int o;
-
- if (MDOC_BLOCK != n->type)
- return(1);
-
- assert(n->body->child);
- for (next = NULL, nn = n->body->child->next; nn; nn = next) {
- o = order_rs(nn->tok);
-
- /* Remove `nn' from the chain. */
- next = nn->next;
- if (next)
- next->prev = nn->prev;
-
- prev = nn->prev;
- if (prev)
- prev->next = nn->next;
-
- nn->prev = nn->next = NULL;
-
- /*
- * Scan back until we reach a node that's ordered before
- * us, then set ourselves as being the next.
- */
- for ( ; prev; prev = prev->prev)
- if (order_rs(prev->tok) <= o)
- break;
-
- nn->prev = prev;
- if (prev) {
- if (prev->next)
- prev->next->prev = nn;
- nn->next = prev->next;
- prev->next = nn;
- continue;
- }
-
- n->body->child->prev = nn;
- nn->next = n->body->child;
- n->body->child = nn;
- }
- return(1);
-}