=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/mdoc_validate.c,v retrieving revision 1.200 retrieving revision 1.201 diff -u -r1.200 -r1.201 --- src/usr.bin/mandoc/mdoc_validate.c 2015/04/02 21:03:18 1.200 +++ src/usr.bin/mandoc/mdoc_validate.c 2015/04/02 22:06:17 1.201 @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_validate.c,v 1.200 2015/04/02 21:03:18 schwarze Exp $ */ +/* $OpenBSD: mdoc_validate.c,v 1.201 2015/04/02 22:06:17 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2015 Ingo Schwarze @@ -38,7 +38,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 { @@ -57,11 +57,11 @@ 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); @@ -246,7 +246,7 @@ #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, @@ -291,7 +291,7 @@ void -mdoc_valid_pre(struct mdoc *mdoc, struct mdoc_node *n) +mdoc_valid_pre(struct mdoc *mdoc, struct roff_node *n) { v_pre p; @@ -319,7 +319,7 @@ void mdoc_valid_post(struct mdoc *mdoc) { - struct mdoc_node *n; + struct roff_node *n; v_post p; n = mdoc->last; @@ -360,7 +360,7 @@ } static void -check_args(struct mdoc *mdoc, struct mdoc_node *n) +check_args(struct mdoc *mdoc, struct roff_node *n) { int i; @@ -373,7 +373,7 @@ } 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; @@ -397,7 +397,7 @@ static void pre_display(PRE_ARGS) { - struct mdoc_node *node; + struct roff_node *node; if (n->type != ROFFT_BLOCK) return; @@ -767,7 +767,7 @@ static void post_bf(POST_ARGS) { - struct mdoc_node *np, *nch; + struct roff_node *np, *nch; enum mdocargt arg; /* @@ -829,7 +829,7 @@ static void post_lb(POST_ARGS) { - struct mdoc_node *n; + struct roff_node *n; char *libname; n = mdoc->last->child; @@ -842,7 +842,7 @@ static void post_eoln(POST_ARGS) { - const struct mdoc_node *n; + const struct roff_node *n; n = mdoc->last; if (n->child) @@ -855,7 +855,7 @@ static void post_fname(POST_ARGS) { - const struct mdoc_node *n; + const struct roff_node *n; const char *cp; size_t pos; @@ -878,7 +878,7 @@ static void post_fo(POST_ARGS) { - const struct mdoc_node *n; + const struct roff_node *n; n = mdoc->last; @@ -904,7 +904,7 @@ 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) { @@ -925,7 +925,7 @@ 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 @@ -947,7 +947,7 @@ static void post_nm(POST_ARGS) { - struct mdoc_node *n; + struct roff_node *n; n = mdoc->last; @@ -969,7 +969,7 @@ static void post_nd(POST_ARGS) { - struct mdoc_node *n; + struct roff_node *n; n = mdoc->last; @@ -986,7 +986,7 @@ static void post_d1(POST_ARGS) { - struct mdoc_node *n; + struct roff_node *n; n = mdoc->last; @@ -1003,7 +1003,7 @@ static void post_literal(POST_ARGS) { - struct mdoc_node *n; + struct roff_node *n; n = mdoc->last; @@ -1025,7 +1025,7 @@ 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 @@ -1059,7 +1059,7 @@ static void post_at(POST_ARGS) { - struct mdoc_node *n; + struct roff_node *n; const char *std_att; char *att; @@ -1093,7 +1093,7 @@ static void post_an(POST_ARGS) { - struct mdoc_node *np, *nch; + struct roff_node *np, *nch; np = mdoc->last; nch = np->child; @@ -1124,9 +1124,9 @@ 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) @@ -1192,7 +1192,7 @@ 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 @@ -1253,7 +1253,7 @@ rewrite_macro2len(char **arg) { size_t width; - enum mdoct tok; + int tok; if (*arg == NULL) return; @@ -1271,7 +1271,7 @@ 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]; @@ -1336,7 +1336,7 @@ 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; @@ -1398,9 +1398,9 @@ 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) { @@ -1481,7 +1481,7 @@ static void post_bk(POST_ARGS) { - struct mdoc_node *n; + struct roff_node *n; n = mdoc->last; @@ -1495,7 +1495,7 @@ static void post_sm(struct mdoc *mdoc) { - struct mdoc_node *nch; + struct roff_node *nch; nch = mdoc->last->child; @@ -1525,7 +1525,7 @@ static void post_root(POST_ARGS) { - struct mdoc_node *n; + struct roff_node *n; /* Add missing prologue data. */ @@ -1565,7 +1565,7 @@ static void post_st(POST_ARGS) { - struct mdoc_node *n, *nch; + struct roff_node *n, *nch; const char *p; n = mdoc->last; @@ -1586,7 +1586,7 @@ 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; @@ -1680,7 +1680,7 @@ 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) { @@ -1739,7 +1739,7 @@ static void post_sh_name(POST_ARGS) { - struct mdoc_node *n; + struct roff_node *n; int hasnm, hasnd; hasnm = hasnd = 0; @@ -1777,7 +1777,7 @@ 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; @@ -1837,7 +1837,7 @@ } 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) @@ -1858,10 +1858,10 @@ 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 @@ -1978,7 +1978,7 @@ static void post_ignpar(POST_ARGS) { - struct mdoc_node *np; + struct roff_node *np; switch (mdoc->last->type) { case ROFFT_HEAD: @@ -2044,7 +2044,7 @@ static void post_par(POST_ARGS) { - struct mdoc_node *np; + struct roff_node *np; np = mdoc->last; @@ -2107,7 +2107,7 @@ static void post_dd(POST_ARGS) { - struct mdoc_node *n; + struct roff_node *n; char *datestr; if (mdoc->meta.date) @@ -2136,7 +2136,7 @@ static void post_dt(POST_ARGS) { - struct mdoc_node *nn, *n; + struct roff_node *nn, *n; const char *cp; char *p; @@ -2221,7 +2221,7 @@ static void post_bx(POST_ARGS) { - struct mdoc_node *n; + struct roff_node *n; /* * Make `Bx's second argument always start with an uppercase @@ -2241,7 +2241,7 @@ struct utsname utsname; static char *defbuf; #endif - struct mdoc_node *n; + struct roff_node *n; n = mdoc->last; @@ -2291,7 +2291,7 @@ static void post_ex(POST_ARGS) { - struct mdoc_node *n; + struct roff_node *n; n = mdoc->last; @@ -2309,20 +2309,20 @@ 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) {