=================================================================== RCS file: /cvs/mandoc/mdoc_validate.c,v retrieving revision 1.14 retrieving revision 1.19 diff -u -p -r1.14 -r1.19 --- mandoc/mdoc_validate.c 2009/06/17 14:08:47 1.14 +++ mandoc/mdoc_validate.c 2009/07/04 10:41:29 1.19 @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.14 2009/06/17 14:08:47 kristaps Exp $ */ +/* $Id: mdoc_validate.c,v 1.19 2009/07/04 10:41:29 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -23,6 +23,7 @@ #include #include "libmdoc.h" +#include "libmandoc.h" /* FIXME: .Bl -diag can't have non-text children in HEAD. */ /* TODO: ignoring Pp (it's superfluous in some invocations). */ @@ -55,8 +56,6 @@ enum mwarn { WNOWIDTH, WMISSWIDTH, WESCAPE, - WDEPESC, - WDEPCOL, WWRONGMSEC, WSECOOO, WSECREP, @@ -99,7 +98,6 @@ static int err_child_gt(struct mdoc *, const char *, i static int warn_child_gt(struct mdoc *, const char *, int); static int err_child_eq(struct mdoc *, const char *, int); static int warn_child_eq(struct mdoc *, const char *, int); -static int count_child(struct mdoc *); static int warn_print(struct mdoc *, int, int); static int warn_count(struct mdoc *, const char *, int, const char *, int); @@ -471,10 +469,6 @@ pwarn(struct mdoc *m, int line, int pos, enum mwarn ty p = "prologue macros out-of-order"; c = WARN_COMPAT; break; - case (WDEPCOL): - p = "deprecated column argument syntax"; - c = WARN_COMPAT; - break; case (WNOWIDTH): p = "superfluous width argument"; break; @@ -487,9 +481,6 @@ pwarn(struct mdoc *m, int line, int pos, enum mwarn ty case (WESCAPE): p = "invalid escape sequence"; break; - case (WDEPESC): - p = "deprecated special-character escape"; - break; case (WNOLINE): p = "suggested no line arguments"; break; @@ -553,19 +544,6 @@ err_count(struct mdoc *m, const char *k, } -static inline int -count_child(struct mdoc *mdoc) -{ - int i; - struct mdoc_node *n; - - for (i = 0, n = mdoc->last->child; n; n = n->next, i++) - /* Do nothing */ ; - - return(i); -} - - /* * Build these up with macros because they're basically the same check * for different inequalities. Yes, this could be done with functions, @@ -576,10 +554,9 @@ count_child(struct mdoc *mdoc) static int \ lvl##_child_##name(struct mdoc *mdoc, const char *p, int sz) \ { \ - int i; \ - if ((i = count_child(mdoc)) ineq sz) \ + if (mdoc->last->nchild ineq sz) \ return(1); \ - return(lvl##_count(mdoc, #ineq, sz, p, i)); \ + return(lvl##_count(mdoc, #ineq, sz, p, mdoc->last->nchild)); \ } #define CHECK_BODY_DEFN(name, lvl, func, num) \ @@ -727,9 +704,9 @@ check_argv(struct mdoc *m, const struct mdoc_node *n, static int check_text(struct mdoc *mdoc, int line, int pos, const char *p) { - size_t c; + int c; - for ( ; *p; p++) { + for ( ; *p; p++, pos++) { if ('\t' == *p) { if ( ! (MDOC_LITERAL & mdoc->flags)) if ( ! warn_print(mdoc, line, pos)) @@ -741,13 +718,10 @@ check_text(struct mdoc *mdoc, int line, int pos, const if ('\\' != *p) continue; - c = mdoc_isescape(p); + c = mandoc_special(p); if (c) { - /* See if form is deprecated. */ - if ('*' == p[1]) - if ( ! pwarn(mdoc, line, pos, WDEPESC)) - return(0); - p += (int)c - 1; + p += c - 1; + pos += c - 1; continue; } if ( ! (MDOC_IGN_ESCAPE & mdoc->pflags)) @@ -802,7 +776,7 @@ pre_display(PRE_ARGS) static int pre_bl(PRE_ARGS) { - int pos, col, type, width, offset; + int pos, type, width, offset; if (MDOC_BLOCK != n->type) return(1); @@ -811,7 +785,7 @@ pre_bl(PRE_ARGS) /* Make sure that only one type of list is specified. */ - type = offset = width = col = -1; + type = offset = width = -1; /* LINTED */ for (pos = 0; pos < (int)n->args->argc; pos++) @@ -840,7 +814,6 @@ pre_bl(PRE_ARGS) if (-1 != type) return(nerr(mdoc, n, EMULTILIST)); type = n->args->argv[pos].arg; - col = pos; break; case (MDOC_Width): if (-1 != width)