diff options
-rw-r--r-- | Makefile | 8 | ||||
-rw-r--r-- | libmdoc.h | 3 | ||||
-rw-r--r-- | mdoc.c | 4 | ||||
-rw-r--r-- | mdoc_action.c | 214 | ||||
-rw-r--r-- | mdoc_macro.c | 12 |
5 files changed, 5 insertions, 236 deletions
@@ -43,15 +43,15 @@ MANDOCSRCS = mandoc.c MANDOCOBJS = mandoc.o MDOCLNS = mdoc_macro.ln mdoc.ln mdoc_hash.ln mdoc_strings.ln \ - mdoc_argv.ln mdoc_validate.ln mdoc_action.ln \ + mdoc_argv.ln mdoc_validate.ln \ lib.ln att.ln arch.ln vol.ln msec.ln st.ln MDOCOBJS = mdoc_macro.o mdoc.o mdoc_hash.o mdoc_strings.o \ - mdoc_argv.o mdoc_validate.o mdoc_action.o lib.o att.o \ + mdoc_argv.o mdoc_validate.o lib.o att.o \ arch.o vol.o msec.o st.o MDOCSRCS = mdoc_macro.c mdoc.c mdoc_hash.c mdoc_strings.c \ - mdoc_argv.c mdoc_validate.c mdoc_action.c lib.c att.c \ + mdoc_argv.c mdoc_validate.c lib.c att.c \ arch.c vol.c msec.c st.c MANLNS = man_macro.ln man.ln man_hash.ln man_validate.ln \ @@ -249,8 +249,6 @@ man_validate.ln man_validate.o: man_validate.c libman.h mdoc_validate.ln mdoc_validate.o: mdoc_validate.c libmdoc.h -mdoc_action.ln mdoc_action.o: mdoc_action.c libmdoc.h - libmdoc.h: mdoc.h ChangeLog.xml: @@ -128,9 +128,6 @@ const char *mdoc_a2vol(const char *); const char *mdoc_a2msec(const char *); int mdoc_valid_pre(struct mdoc *, struct mdoc_node *); int mdoc_valid_post(struct mdoc *); -int mdoc_action_pre(struct mdoc *, - struct mdoc_node *); -int mdoc_action_post(struct mdoc *); enum margverr mdoc_argv(struct mdoc *, int, enum mdoct, struct mdoc_arg **, int *, char *); void mdoc_argv_free(struct mdoc_arg *); @@ -328,8 +328,6 @@ node_append(struct mdoc *mdoc, struct mdoc_node *p) if ( ! mdoc_valid_pre(mdoc, p)) return(0); - if ( ! mdoc_action_pre(mdoc, p)) - return(0); switch (p->type) { case (MDOC_HEAD): @@ -356,8 +354,6 @@ node_append(struct mdoc *mdoc, struct mdoc_node *p) case (MDOC_TEXT): if ( ! mdoc_valid_post(mdoc)) return(0); - if ( ! mdoc_action_post(mdoc)) - return(0); break; default: break; diff --git a/mdoc_action.c b/mdoc_action.c deleted file mode 100644 index 24d7586b..00000000 --- a/mdoc_action.c +++ /dev/null @@ -1,214 +0,0 @@ -/* $Id$ */ -/* - * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv> - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#ifndef OSNAME -#include <sys/utsname.h> -#endif - -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <time.h> - -#include "mandoc.h" -#include "libmdoc.h" -#include "libmandoc.h" - -/* - * FIXME: this file is deprecated. All future "actions" should be - * pushed into mdoc_validate.c. - */ - -#define POST_ARGS struct mdoc *m, struct mdoc_node *n -#define PRE_ARGS struct mdoc *m, struct mdoc_node *n - -struct actions { - int (*pre)(PRE_ARGS); - int (*post)(POST_ARGS); -}; - -static const struct actions mdoc_actions[MDOC_MAX] = { - { NULL, NULL }, /* Ap */ - { NULL, NULL }, /* Dd */ - { NULL, NULL }, /* Dt */ - { NULL, NULL }, /* Os */ - { NULL, NULL }, /* Sh */ - { NULL, NULL }, /* Ss */ - { NULL, NULL }, /* Pp */ - { NULL, NULL }, /* D1 */ - { NULL, NULL }, /* Dl */ - { NULL, NULL }, /* Bd */ - { NULL, NULL }, /* Ed */ - { NULL, NULL }, /* Bl */ - { NULL, NULL }, /* El */ - { NULL, NULL }, /* It */ - { NULL, NULL }, /* Ad */ - { NULL, NULL }, /* An */ - { NULL, NULL }, /* Ar */ - { NULL, NULL }, /* Cd */ - { NULL, NULL }, /* Cm */ - { NULL, NULL }, /* Dv */ - { NULL, NULL }, /* Er */ - { NULL, NULL }, /* Ev */ - { NULL, NULL }, /* Ex */ - { NULL, NULL }, /* Fa */ - { NULL, NULL }, /* Fd */ - { NULL, NULL }, /* Fl */ - { NULL, NULL }, /* Fn */ - { NULL, NULL }, /* Ft */ - { NULL, NULL }, /* Ic */ - { NULL, NULL }, /* In */ - { NULL, NULL }, /* Li */ - { NULL, NULL }, /* Nd */ - { NULL, NULL }, /* Nm */ - { NULL, NULL }, /* Op */ - { NULL, NULL }, /* Ot */ - { NULL, NULL }, /* Pa */ - { NULL, NULL }, /* Rv */ - { NULL, NULL }, /* St */ - { NULL, NULL }, /* Va */ - { NULL, NULL }, /* Vt */ - { NULL, NULL }, /* Xr */ - { NULL, NULL }, /* %A */ - { NULL, NULL }, /* %B */ - { NULL, NULL }, /* %D */ - { NULL, NULL }, /* %I */ - { NULL, NULL }, /* %J */ - { NULL, NULL }, /* %N */ - { NULL, NULL }, /* %O */ - { NULL, NULL }, /* %P */ - { NULL, NULL }, /* %R */ - { NULL, NULL }, /* %T */ - { NULL, NULL }, /* %V */ - { NULL, NULL }, /* Ac */ - { NULL, NULL }, /* Ao */ - { NULL, NULL }, /* Aq */ - { NULL, NULL }, /* At */ - { NULL, NULL }, /* Bc */ - { NULL, NULL }, /* Bf */ - { NULL, NULL }, /* Bo */ - { NULL, NULL }, /* Bq */ - { NULL, NULL }, /* Bsx */ - { NULL, NULL }, /* Bx */ - { NULL, NULL }, /* Db */ - { NULL, NULL }, /* Dc */ - { NULL, NULL }, /* Do */ - { NULL, NULL }, /* Dq */ - { NULL, NULL }, /* Ec */ - { NULL, NULL }, /* Ef */ - { NULL, NULL }, /* Em */ - { NULL, NULL }, /* Eo */ - { NULL, NULL }, /* Fx */ - { NULL, NULL }, /* Ms */ - { NULL, NULL }, /* No */ - { NULL, NULL }, /* Ns */ - { NULL, NULL }, /* Nx */ - { NULL, NULL }, /* Ox */ - { NULL, NULL }, /* Pc */ - { NULL, NULL }, /* Pf */ - { NULL, NULL }, /* Po */ - { NULL, NULL }, /* Pq */ - { NULL, NULL }, /* Qc */ - { NULL, NULL }, /* Ql */ - { NULL, NULL }, /* Qo */ - { NULL, NULL }, /* Qq */ - { NULL, NULL }, /* Re */ - { NULL, NULL }, /* Rs */ - { NULL, NULL }, /* Sc */ - { NULL, NULL }, /* So */ - { NULL, NULL }, /* Sq */ - { NULL, NULL }, /* Sm */ - { NULL, NULL }, /* Sx */ - { NULL, NULL }, /* Sy */ - { NULL, NULL }, /* Tn */ - { NULL, NULL }, /* Ux */ - { NULL, NULL }, /* Xc */ - { NULL, NULL }, /* Xo */ - { NULL, NULL }, /* Fo */ - { NULL, NULL }, /* Fc */ - { NULL, NULL }, /* Oo */ - { NULL, NULL }, /* Oc */ - { NULL, NULL }, /* Bk */ - { NULL, NULL }, /* Ek */ - { NULL, NULL }, /* Bt */ - { NULL, NULL }, /* Hf */ - { NULL, NULL }, /* Fr */ - { NULL, NULL }, /* Ud */ - { NULL, NULL }, /* Lb */ - { NULL, NULL }, /* Lp */ - { NULL, NULL }, /* Lk */ - { NULL, NULL }, /* Mt */ - { NULL, NULL }, /* Brq */ - { NULL, NULL }, /* Bro */ - { NULL, NULL }, /* Brc */ - { NULL, NULL }, /* %C */ - { NULL, NULL }, /* Es */ - { NULL, NULL }, /* En */ - { NULL, NULL }, /* Dx */ - { NULL, NULL }, /* %Q */ - { NULL, NULL }, /* br */ - { NULL, NULL }, /* sp */ - { NULL, NULL }, /* %U */ - { NULL, NULL }, /* Ta */ -}; - - -int -mdoc_action_pre(struct mdoc *m, struct mdoc_node *n) -{ - - switch (n->type) { - case (MDOC_ROOT): - /* FALLTHROUGH */ - case (MDOC_TEXT): - return(1); - default: - break; - } - - if (NULL == mdoc_actions[n->tok].pre) - return(1); - return((*mdoc_actions[n->tok].pre)(m, n)); -} - - -int -mdoc_action_post(struct mdoc *m) -{ - - if (MDOC_ACTED & m->last->flags) - return(1); - m->last->flags |= MDOC_ACTED; - - switch (m->last->type) { - case (MDOC_TEXT): - /* FALLTHROUGH */ - case (MDOC_ROOT): - return(1); - default: - break; - } - - if (NULL == mdoc_actions[m->last->tok].post) - return(1); - return((*mdoc_actions[m->last->tok].post)(m, m->last)); -} - diff --git a/mdoc_macro.c b/mdoc_macro.c index 34ffd86b..ba1df2c1 100644 --- a/mdoc_macro.c +++ b/mdoc_macro.c @@ -259,15 +259,11 @@ rew_last(struct mdoc *mdoc, const struct mdoc_node *to) while (mdoc->last != to) { if ( ! mdoc_valid_post(mdoc)) return(0); - if ( ! mdoc_action_post(mdoc)) - return(0); mdoc->last = mdoc->last->parent; assert(mdoc->last); } - if ( ! mdoc_valid_post(mdoc)) - return(0); - return(mdoc_action_post(mdoc)); + return(mdoc_valid_post(mdoc)); } @@ -696,10 +692,8 @@ blk_exp_close(MACRO_PROT_ARGS) if (later && MDOC_EXPLICIT & mdoc_macros[later->tok].flags) continue; - if (MDOC_CALLABLE & mdoc_macros[n->tok].flags) { - assert( ! (MDOC_ACTED & n->flags)); + if (MDOC_CALLABLE & mdoc_macros[n->tok].flags) later = n; - } } if ( ! (MDOC_CALLABLE & mdoc_macros[tok].flags)) { @@ -1143,7 +1137,6 @@ blk_full(MACRO_PROT_ARGS) if (MDOC_BLOCK == n->type && MDOC_EXPLICIT & mdoc_macros[n->tok].flags && ! (MDOC_VALID & n->flags)) { - assert( ! (MDOC_ACTED & n->flags)); n->pending = head; return(1); } @@ -1281,7 +1274,6 @@ blk_part_imp(MACRO_PROT_ARGS) if (MDOC_BLOCK == n->type && MDOC_EXPLICIT & mdoc_macros[n->tok].flags && ! (MDOC_VALID & n->flags)) { - assert( ! (MDOC_ACTED & n->flags)); if ( ! make_pending(n, tok, m, line, ppos)) return(0); if ( ! mdoc_endbody_alloc(m, line, ppos, |