From: Kristaps Dzonsons Date: Tue, 30 Nov 2010 13:04:14 +0000 (+0000) Subject: mdoc_action.c is no more. Attic it and remove it from the Makefile. X-Git-Tag: VERSION_1_10_7~34 X-Git-Url: https://git.cameronkatri.com/mandoc.git/commitdiff_plain/d9ece81ad9ffdf688f6492fc9e8018bf7e91e603?ds=inline mdoc_action.c is no more. Attic it and remove it from the Makefile. Remove references to MDOC_ACTED (it was only assertions) and the pre- and post-action functions. --- diff --git a/Makefile b/Makefile index 76d69ab8..fea183b1 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/libmdoc.h b/libmdoc.h index eb917524..5a46d1cf 100644 --- a/libmdoc.h +++ b/libmdoc.h @@ -1,4 +1,4 @@ -/* $Id: libmdoc.h,v 1.62 2010/08/20 01:02:07 schwarze Exp $ */ +/* $Id: libmdoc.h,v 1.63 2010/11/30 13:04:14 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * @@ -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 *); diff --git a/mdoc.c b/mdoc.c index 103a8a88..930d2071 100644 --- a/mdoc.c +++ b/mdoc.c @@ -1,4 +1,4 @@ -/* $Id: mdoc.c,v 1.165 2010/09/27 23:03:44 schwarze Exp $ */ +/* $Id: mdoc.c,v 1.166 2010/11/30 13:04:14 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * Copyright (c) 2010 Ingo Schwarze @@ -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 4d0e9e9f..00000000 --- a/mdoc_action.c +++ /dev/null @@ -1,214 +0,0 @@ -/* $Id: mdoc_action.c,v 1.88 2010/11/30 12:59:20 kristaps Exp $ */ -/* - * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons - * - * 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 -#endif - -#include -#include -#include -#include -#include - -#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 37824f9e..3b696547 100644 --- a/mdoc_macro.c +++ b/mdoc_macro.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_macro.c,v 1.96 2010/11/29 13:02:47 kristaps Exp $ */ +/* $Id: mdoc_macro.c,v 1.97 2010/11/30 13:04:14 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * Copyright (c) 2010 Ingo Schwarze @@ -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,