=================================================================== RCS file: /cvs/mandoc/Attic/action.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -p -r1.6 -r1.7 --- mandoc/Attic/action.c 2009/01/09 14:45:44 1.6 +++ mandoc/Attic/action.c 2009/01/12 12:52:21 1.7 @@ -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 * @@ -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 *n 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)); }