=================================================================== RCS file: /cvs/mandoc/mdoc_validate.c,v retrieving revision 1.284 retrieving revision 1.285 diff -u -p -r1.284 -r1.285 --- mandoc/mdoc_validate.c 2015/04/02 21:36:50 1.284 +++ mandoc/mdoc_validate.c 2015/04/02 22:48:17 1.285 @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.284 2015/04/02 21:36:50 schwarze Exp $ */ +/* $Id: mdoc_validate.c,v 1.285 2015/04/02 22:48:17 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2015 Ingo Schwarze @@ -40,7 +40,7 @@ /* FIXME: .Bl -diag can't have non-text children in HEAD. */ -#define PRE_ARGS struct mdoc *mdoc, struct mdoc_node *n +#define PRE_ARGS struct mdoc *mdoc, struct roff_node *n #define POST_ARGS struct mdoc *mdoc enum check_ineq { @@ -59,11 +59,11 @@ struct valids { static void check_text(struct mdoc *, int, int, char *); static void check_argv(struct mdoc *, - struct mdoc_node *, struct mdoc_argv *); -static void check_args(struct mdoc *, struct mdoc_node *); -static int child_an(const struct mdoc_node *); -static enum mdoc_sec a2sec(const char *); -static size_t macro2len(enum mdoct); + struct roff_node *, struct mdoc_argv *); +static void check_args(struct mdoc *, struct roff_node *); +static int child_an(const struct roff_node *); +static enum roff_sec a2sec(const char *); +static size_t macro2len(int); static void rewrite_macro2len(char **); static void post_an(POST_ARGS); @@ -248,7 +248,7 @@ static const struct valids mdoc_valids[MDOC_MAX] = { #define RSORD_MAX 14 /* Number of `Rs' blocks. */ -static const enum mdoct rsord[RSORD_MAX] = { +static const int rsord[RSORD_MAX] = { MDOC__A, MDOC__T, MDOC__B, @@ -293,7 +293,7 @@ static const char * const secnames[SEC__MAX] = { void -mdoc_valid_pre(struct mdoc *mdoc, struct mdoc_node *n) +mdoc_valid_pre(struct mdoc *mdoc, struct roff_node *n) { v_pre p; @@ -321,7 +321,7 @@ mdoc_valid_pre(struct mdoc *mdoc, struct mdoc_node *n) void mdoc_valid_post(struct mdoc *mdoc) { - struct mdoc_node *n; + struct roff_node *n; v_post p; n = mdoc->last; @@ -362,7 +362,7 @@ mdoc_valid_post(struct mdoc *mdoc) } static void -check_args(struct mdoc *mdoc, struct mdoc_node *n) +check_args(struct mdoc *mdoc, struct roff_node *n) { int i; @@ -375,7 +375,7 @@ check_args(struct mdoc *mdoc, struct mdoc_node *n) } static void -check_argv(struct mdoc *mdoc, struct mdoc_node *n, struct mdoc_argv *v) +check_argv(struct mdoc *mdoc, struct roff_node *n, struct mdoc_argv *v) { int i; @@ -399,7 +399,7 @@ check_text(struct mdoc *mdoc, int ln, int pos, char *p static void pre_display(PRE_ARGS) { - struct mdoc_node *node; + struct roff_node *node; if (n->type != ROFFT_BLOCK) return; @@ -769,7 +769,7 @@ pre_dd(PRE_ARGS) static void post_bf(POST_ARGS) { - struct mdoc_node *np, *nch; + struct roff_node *np, *nch; enum mdocargt arg; /* @@ -831,7 +831,7 @@ post_bf(POST_ARGS) static void post_lb(POST_ARGS) { - struct mdoc_node *n; + struct roff_node *n; const char *stdlibname; char *libname; @@ -851,7 +851,7 @@ post_lb(POST_ARGS) static void post_eoln(POST_ARGS) { - const struct mdoc_node *n; + const struct roff_node *n; n = mdoc->last; if (n->child) @@ -864,7 +864,7 @@ post_eoln(POST_ARGS) static void post_fname(POST_ARGS) { - const struct mdoc_node *n; + const struct roff_node *n; const char *cp; size_t pos; @@ -887,7 +887,7 @@ post_fn(POST_ARGS) static void post_fo(POST_ARGS) { - const struct mdoc_node *n; + const struct roff_node *n; n = mdoc->last; @@ -913,7 +913,7 @@ post_fo(POST_ARGS) static void post_fa(POST_ARGS) { - const struct mdoc_node *n; + const struct roff_node *n; const char *cp; for (n = mdoc->last->child; n != NULL; n = n->next) { @@ -934,7 +934,7 @@ post_fa(POST_ARGS) static void post_vt(POST_ARGS) { - const struct mdoc_node *n; + const struct roff_node *n; /* * The Vt macro comes in both ELEM and BLOCK form, both of which @@ -956,7 +956,7 @@ post_vt(POST_ARGS) static void post_nm(POST_ARGS) { - struct mdoc_node *n; + struct roff_node *n; n = mdoc->last; @@ -978,7 +978,7 @@ post_nm(POST_ARGS) static void post_nd(POST_ARGS) { - struct mdoc_node *n; + struct roff_node *n; n = mdoc->last; @@ -995,7 +995,7 @@ post_nd(POST_ARGS) static void post_d1(POST_ARGS) { - struct mdoc_node *n; + struct roff_node *n; n = mdoc->last; @@ -1012,7 +1012,7 @@ post_d1(POST_ARGS) static void post_literal(POST_ARGS) { - struct mdoc_node *n; + struct roff_node *n; n = mdoc->last; @@ -1034,7 +1034,7 @@ post_literal(POST_ARGS) static void post_defaults(POST_ARGS) { - struct mdoc_node *nn; + struct roff_node *nn; /* * The `Ar' defaults to "file ..." if no value is provided as an @@ -1068,7 +1068,7 @@ post_defaults(POST_ARGS) static void post_at(POST_ARGS) { - struct mdoc_node *n; + struct roff_node *n; const char *std_att; char *att; @@ -1102,7 +1102,7 @@ post_at(POST_ARGS) static void post_an(POST_ARGS) { - struct mdoc_node *np, *nch; + struct roff_node *np, *nch; np = mdoc->last; nch = np->child; @@ -1133,9 +1133,9 @@ post_es(POST_ARGS) static void post_it(POST_ARGS) { + struct roff_node *nbl, *nit, *nch; int i, cols; enum mdoc_list lt; - struct mdoc_node *nbl, *nit, *nch; nit = mdoc->last; if (nit->type != ROFFT_BLOCK) @@ -1201,7 +1201,7 @@ post_it(POST_ARGS) static void post_bl_block(POST_ARGS) { - struct mdoc_node *n, *ni, *nc; + struct roff_node *n, *ni, *nc; /* * These are fairly complicated, so we've broken them into two @@ -1262,7 +1262,7 @@ void rewrite_macro2len(char **arg) { size_t width; - enum mdoct tok; + int tok; if (*arg == NULL) return; @@ -1280,7 +1280,7 @@ rewrite_macro2len(char **arg) static void post_bl_block_tag(POST_ARGS) { - struct mdoc_node *n, *nn; + struct roff_node *n, *nn; size_t sz, ssz; int i; char buf[24]; @@ -1345,7 +1345,7 @@ post_bl_block_tag(POST_ARGS) static void post_bl_head(POST_ARGS) { - struct mdoc_node *nbl, *nh, *nch, *nnext; + struct roff_node *nbl, *nh, *nch, *nnext; struct mdoc_argv *argv; int i, j; @@ -1407,9 +1407,9 @@ post_bl_head(POST_ARGS) static void post_bl(POST_ARGS) { - struct mdoc_node *nparent, *nprev; /* of the Bl block */ - struct mdoc_node *nblock, *nbody; /* of the Bl */ - struct mdoc_node *nchild, *nnext; /* of the Bl body */ + struct roff_node *nparent, *nprev; /* of the Bl block */ + struct roff_node *nblock, *nbody; /* of the Bl */ + struct roff_node *nchild, *nnext; /* of the Bl body */ nbody = mdoc->last; switch (nbody->type) { @@ -1490,7 +1490,7 @@ post_bl(POST_ARGS) static void post_bk(POST_ARGS) { - struct mdoc_node *n; + struct roff_node *n; n = mdoc->last; @@ -1504,7 +1504,7 @@ post_bk(POST_ARGS) static void post_sm(struct mdoc *mdoc) { - struct mdoc_node *nch; + struct roff_node *nch; nch = mdoc->last->child; @@ -1534,7 +1534,7 @@ post_sm(struct mdoc *mdoc) static void post_root(POST_ARGS) { - struct mdoc_node *n; + struct roff_node *n; /* Add missing prologue data. */ @@ -1574,7 +1574,7 @@ post_root(POST_ARGS) static void post_st(POST_ARGS) { - struct mdoc_node *n, *nch; + struct roff_node *n, *nch; const char *p; n = mdoc->last; @@ -1595,7 +1595,7 @@ post_st(POST_ARGS) static void post_rs(POST_ARGS) { - struct mdoc_node *np, *nch, *next, *prev; + struct roff_node *np, *nch, *next, *prev; int i, j; np = mdoc->last; @@ -1689,7 +1689,7 @@ post_rs(POST_ARGS) static void post_hyph(POST_ARGS) { - struct mdoc_node *nch; + struct roff_node *nch; char *cp; for (nch = mdoc->last->child; nch != NULL; nch = nch->next) { @@ -1748,7 +1748,7 @@ post_sh(POST_ARGS) static void post_sh_name(POST_ARGS) { - struct mdoc_node *n; + struct roff_node *n; int hasnm, hasnd; hasnm = hasnd = 0; @@ -1786,7 +1786,7 @@ post_sh_name(POST_ARGS) static void post_sh_see_also(POST_ARGS) { - const struct mdoc_node *n; + const struct roff_node *n; const char *name, *sec; const char *lastname, *lastsec, *lastpunct; int cmp; @@ -1846,7 +1846,7 @@ post_sh_see_also(POST_ARGS) } static int -child_an(const struct mdoc_node *n) +child_an(const struct roff_node *n) { for (n = n->child; n != NULL; n = n->next) @@ -1867,10 +1867,10 @@ post_sh_authors(POST_ARGS) static void post_sh_head(POST_ARGS) { - struct mdoc_node *n; + struct roff_node *n; const char *goodsec; char *secname; - enum mdoc_sec sec; + enum roff_sec sec; /* * Process a new section. Sections are either "named" or @@ -1987,7 +1987,7 @@ post_sh_head(POST_ARGS) static void post_ignpar(POST_ARGS) { - struct mdoc_node *np; + struct roff_node *np; switch (mdoc->last->type) { case ROFFT_HEAD: @@ -2053,7 +2053,7 @@ pre_par(PRE_ARGS) static void post_par(POST_ARGS) { - struct mdoc_node *np; + struct roff_node *np; np = mdoc->last; @@ -2116,7 +2116,7 @@ pre_literal(PRE_ARGS) static void post_dd(POST_ARGS) { - struct mdoc_node *n; + struct roff_node *n; char *datestr; if (mdoc->meta.date) @@ -2145,7 +2145,7 @@ out: static void post_dt(POST_ARGS) { - struct mdoc_node *nn, *n; + struct roff_node *nn, *n; const char *cp; char *p; @@ -2230,7 +2230,7 @@ out: static void post_bx(POST_ARGS) { - struct mdoc_node *n; + struct roff_node *n; /* * Make `Bx's second argument always start with an uppercase @@ -2250,7 +2250,7 @@ post_os(POST_ARGS) struct utsname utsname; static char *defbuf; #endif - struct mdoc_node *n; + struct roff_node *n; n = mdoc->last; @@ -2300,7 +2300,7 @@ out: static void post_ex(POST_ARGS) { - struct mdoc_node *n; + struct roff_node *n; n = mdoc->last; @@ -2318,20 +2318,20 @@ post_ex(POST_ARGS) mdoc->last = n; } -static enum mdoc_sec +static enum roff_sec a2sec(const char *p) { int i; for (i = 0; i < (int)SEC__MAX; i++) if (secnames[i] && 0 == strcmp(p, secnames[i])) - return((enum mdoc_sec)i); + return((enum roff_sec)i); return(SEC_CUSTOM); } static size_t -macro2len(enum mdoct macro) +macro2len(int macro) { switch (macro) {