[BACK]Return to validate.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/Attic/validate.c between version 1.71 and 1.83

version 1.71, 2009/03/08 11:41:22 version 1.83, 2009/03/13 13:56:13
Line 16 
Line 16 
  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR   * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  * PERFORMANCE OF THIS SOFTWARE.   * PERFORMANCE OF THIS SOFTWARE.
  */   */
   #include <sys/types.h>
   
 #include <assert.h>  #include <assert.h>
 #include <ctype.h>  #include <ctype.h>
 #include <stdarg.h>  #include <stdarg.h>
Line 135  static int bwarn_ge1(POST_ARGS);
Line 137  static int bwarn_ge1(POST_ARGS);
 static  int     hwarn_eq1(POST_ARGS);  static  int     hwarn_eq1(POST_ARGS);
 static  int     ewarn_ge1(POST_ARGS);  static  int     ewarn_ge1(POST_ARGS);
 static  int     ebool(POST_ARGS);  static  int     ebool(POST_ARGS);
   
 static  int     post_an(POST_ARGS);  static  int     post_an(POST_ARGS);
   static  int     post_args(POST_ARGS);
 static  int     post_at(POST_ARGS);  static  int     post_at(POST_ARGS);
 static  int     post_bf(POST_ARGS);  static  int     post_bf(POST_ARGS);
 static  int     post_bl(POST_ARGS);  static  int     post_bl(POST_ARGS);
 static  int     post_ex(POST_ARGS);  
 static  int     post_it(POST_ARGS);  static  int     post_it(POST_ARGS);
 static  int     post_nm(POST_ARGS);  static  int     post_nm(POST_ARGS);
 static  int     post_root(POST_ARGS);  static  int     post_root(POST_ARGS);
Line 179  static v_post posts_pf[] = { eerr_eq1, NULL };
Line 182  static v_post posts_pf[] = { eerr_eq1, NULL };
 static  v_post  posts_lb[] = { eerr_eq1, NULL };  static  v_post  posts_lb[] = { eerr_eq1, NULL };
 static  v_post  posts_st[] = { eerr_eq1, post_st, NULL };  static  v_post  posts_st[] = { eerr_eq1, post_st, NULL };
 static  v_post  posts_pp[] = { ewarn_eq0, NULL };  static  v_post  posts_pp[] = { ewarn_eq0, NULL };
 static  v_post  posts_ex[] = { eerr_eq0, post_ex, NULL };  static  v_post  posts_ex[] = { eerr_eq0, post_args, NULL };
   static  v_post  posts_rv[] = { eerr_eq0, post_args, NULL };
 static  v_post  posts_an[] = { post_an, NULL };  static  v_post  posts_an[] = { post_an, NULL };
 static  v_post  posts_at[] = { post_at, NULL };  static  v_post  posts_at[] = { post_at, NULL };
 static  v_post  posts_xr[] = { eerr_ge1, eerr_le2, NULL };  static  v_post  posts_xr[] = { eerr_ge1, eerr_le2, NULL };
Line 227  const struct valids mdoc_valids[MDOC_MAX] = {
Line 231  const struct valids mdoc_valids[MDOC_MAX] = {
         { NULL, posts_wline },                  /* Op */          { NULL, posts_wline },                  /* Op */
         { NULL, NULL },                         /* Ot */          { NULL, NULL },                         /* Ot */
         { NULL, NULL },                         /* Pa */          { NULL, NULL },                         /* Pa */
         { pres_rv, posts_notext },              /* Rv */          { pres_rv, posts_rv },                  /* Rv */
         { NULL, posts_st },                     /* St */          { NULL, posts_st },                     /* St */
         { NULL, posts_text },                   /* Va */          { NULL, posts_text },                   /* Va */
         { NULL, posts_text },                   /* Vt */          { NULL, posts_text },                   /* Vt */
Line 298  const struct valids mdoc_valids[MDOC_MAX] = {
Line 302  const struct valids mdoc_valids[MDOC_MAX] = {
         { NULL, NULL },                         /* Fr */          { NULL, NULL },                         /* Fr */
         { NULL, posts_notext },                 /* Ud */          { NULL, posts_notext },                 /* Ud */
         { pres_lb, posts_lb },                  /* Lb */          { pres_lb, posts_lb },                  /* Lb */
           { NULL, NULL },                         /* Ap */
           { NULL, posts_pp },                     /* Lp */
           { NULL, posts_text },                   /* Lk */
           { NULL, posts_text },                   /* Mt */
           { NULL, posts_wline },                  /* Brq */
           { NULL, NULL },                         /* Bro */
           { NULL, NULL },                         /* Brc */
           { NULL, posts_text },                   /* %C */
 };  };
   
   
Line 638  check_args(struct mdoc *m, const struct mdoc_node *n)
Line 650  check_args(struct mdoc *m, const struct mdoc_node *n)
         if (NULL == n->args)          if (NULL == n->args)
                 return(1);                  return(1);
   
           assert(n->args->argc);
         for (i = 0; i < (int)n->args->argc; i++)          for (i = 0; i < (int)n->args->argc; i++)
                 if ( ! check_argv(m, n, &n->args->argv[i]))                  if ( ! check_argv(m, n, &n->args->argv[i]))
                         return(0);                          return(0);
Line 656  check_argv(struct mdoc *m, const struct mdoc_node *n, 
Line 669  check_argv(struct mdoc *m, const struct mdoc_node *n, 
                 if ( ! check_text(m, v->line, v->pos, v->value[i]))                  if ( ! check_text(m, v->line, v->pos, v->value[i]))
                         return(0);                          return(0);
   
         if (MDOC_Std == v->arg && MDOC_Ex == n->tok) {          if (MDOC_Std == v->arg) {
                 /* `Nm' name must be set. */                  /* `Nm' name must be set. */
                 if (v->sz || m->meta.name)                  if (v->sz || m->meta.name)
                         return(1);                          return(1);
Line 684  check_text(struct mdoc *mdoc, int line, int pos, const
Line 697  check_text(struct mdoc *mdoc, int line, int pos, const
                         p += (int)c - 1;                          p += (int)c - 1;
                         continue;                          continue;
                 }                  }
                 return(mdoc_perr(mdoc, line, pos,                  if ( ! (MDOC_IGN_ESCAPE & mdoc->pflags))
                                 "invalid escape sequence"));                          return(mdoc_perr(mdoc, line, pos,
                                           "invalid escape sequence"));
                   if ( ! mdoc_pwarn(mdoc, line, pos, WARN_SYNTAX,
                                           "invalid escape sequence"))
                           return(0);
         }          }
   
         return(1);          return(1);
Line 891  static int
Line 908  static int
 pre_an(PRE_ARGS)  pre_an(PRE_ARGS)
 {  {
   
         if (n->args && 1 >= n->args->argc)          if (NULL == n->args || 1 == n->args->argc)
                 return(1);                  return(1);
         return(mdoc_nerr(mdoc, n, "only one argument allowed"));          return(mdoc_nerr(mdoc, n, "only one argument allowed"));
 }  }
Line 1067  post_an(POST_ARGS)
Line 1084  post_an(POST_ARGS)
   
   
 static int  static int
 post_ex(POST_ARGS)  post_args(POST_ARGS)
 {  {
   
         if (mdoc->last->args)          if (mdoc->last->args)
Line 1170  post_it(POST_ARGS)
Line 1187  post_it(POST_ARGS)
                 if (mdoc->last->body->child)                  if (mdoc->last->body->child)
                         if ( ! mwarn(mdoc, WNOMULTILINE))                          if ( ! mwarn(mdoc, WNOMULTILINE))
                                 return(0);                                  return(0);
                 c = mdoc->last->head->child;                  c = mdoc->last->child;
                 for (i = 0; c; c = c->next)                  for (i = 0; c && MDOC_HEAD == c->type; c = c->next)
                         i++;                          i++;
                 if (i == cols)                  if (i == cols)
                         break;                          break;
                 if ( ! mdoc_warn(mdoc, WARN_SYNTAX,                  return(mdoc_err(mdoc, "column mismatch (have "
                                         "column mismatch (have %d, want %d)", i, cols))                                          "%d, want %d)", i, cols));
                         return(0);  
                 break;  
         default:          default:
                 break;                  break;
         }          }

Legend:
Removed from v.1.71  
changed lines
  Added in v.1.83

CVSweb