summaryrefslogtreecommitdiffstatshomepage
path: root/action.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-01-12 12:52:21 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-01-12 12:52:21 +0000
commitb772d067401e789feb01542db6d402e98c357b68 (patch)
tree5d369f04aac5001670b7c6b2a7bece35ce4022e8 /action.c
parent569c276460dfd948ab28a199826274e234cf815c (diff)
downloadmandoc-b772d067401e789feb01542db6d402e98c357b68.tar.gz
mandoc-b772d067401e789feb01542db6d402e98c357b68.tar.zst
mandoc-b772d067401e789feb01542db6d402e98c357b68.zip
*** empty log message ***
Diffstat (limited to 'action.c')
-rw-r--r--action.c37
1 files changed, 12 insertions, 25 deletions
diff --git a/action.c b/action.c
index e11c7124..7f09a571 100644
--- a/action.c
+++ b/action.c
@@ -1,4 +1,4 @@
-/* $Id: action.c,v 1.6 2009/01/09 14:45:44 kristaps Exp $ */
+/* $Id: action.c,v 1.7 2009/01/12 12:52:21 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -159,7 +159,7 @@ post_sh(struct mdoc *mdoc)
if (MDOC_HEAD != mdoc->last->type)
return(1);
- assert(MDOC_Sh == mdoc->last->data.head.tok);
+ assert(MDOC_Sh == mdoc->last->tok);
n = mdoc->last->child;
assert(n);
@@ -189,7 +189,7 @@ post_dt(struct mdoc *mdoc)
struct mdoc_node *n;
assert(MDOC_ELEM == mdoc->last->type);
- assert(MDOC_Dt == mdoc->last->data.elem.tok);
+ assert(MDOC_Dt == mdoc->last->tok);
assert(0 == mdoc->meta.title[0]);
sz = META_TITLE_SZ;
@@ -236,7 +236,7 @@ post_os(struct mdoc *mdoc)
struct mdoc_node *n;
assert(MDOC_ELEM == mdoc->last->type);
- assert(MDOC_Os == mdoc->last->data.elem.tok);
+ assert(MDOC_Os == mdoc->last->tok);
assert(0 == mdoc->meta.os[0]);
sz = META_OS_SZ;
@@ -269,7 +269,7 @@ post_dd(struct mdoc *mdoc)
struct mdoc_node *n;
assert(MDOC_ELEM == mdoc->last->type);
- assert(MDOC_Dd == mdoc->last->data.elem.tok);
+ assert(MDOC_Dd == mdoc->last->tok);
n = mdoc->last->child;
assert(0 == mdoc->meta.date);
@@ -281,7 +281,7 @@ post_dd(struct mdoc *mdoc)
assert(MDOC_TEXT == n->type);
p = n->data.text.string;
- if (xstrcmp(p, "$Mdocdate: January 9 2009 $")) {
+ if (xstrcmp(p, "$Mdocdate: January 12 2009 $")) {
mdoc->meta.date = time(NULL);
continue;
} else if (xstrcmp(p, "$")) {
@@ -317,27 +317,14 @@ mdoc_action_pre(struct mdoc *mdoc, struct mdoc_node *node)
int
mdoc_action_post(struct mdoc *mdoc)
{
- int t;
-
- switch (mdoc->last->type) {
- case (MDOC_BODY):
- t = mdoc->last->data.body.tok;
- break;
- case (MDOC_ELEM):
- t = mdoc->last->data.elem.tok;
- break;
- case (MDOC_BLOCK):
- t = mdoc->last->data.block.tok;
- break;
- case (MDOC_HEAD):
- t = mdoc->last->data.head.tok;
- break;
- default:
+
+ if (MDOC_TEXT == mdoc->last->type)
+ return(1);
+ if (MDOC_ROOT == mdoc->last->type)
return(1);
- }
- if (NULL == mdoc_actions[t].post)
+ if (NULL == mdoc_actions[mdoc->last->tok].post)
return(1);
/* TODO: MDOC_Nm... ? */
- return((*mdoc_actions[t].post)(mdoc));
+ return((*mdoc_actions[mdoc->last->tok].post)(mdoc));
}