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

Diff for /mandoc/Attic/validate.c between version 1.13 and 1.14

version 1.13, 2009/01/02 14:06:16 version 1.14, 2009/01/03 18:38:39
Line 24 
Line 24 
 /* FIXME: `.St' can only have one argument set. */  /* FIXME: `.St' can only have one argument set. */
   
 typedef int     (*v_args_sz)(struct mdoc *, int, int, int);  typedef int     (*v_args_sz)(struct mdoc *, int, int, int);
 typedef int     (*v_args)(struct mdoc *, int, int, int,  typedef int     (*v_args)(struct mdoc *, int, int,
                         const char *[], int, const struct mdoc_arg *);                          int, const char *[],
 typedef int     (*v_post)(struct mdoc *, int, int);                          int, const struct mdoc_arg *);
   typedef int     (*v_tree)(struct mdoc *, int, int);
   
 static  int       need_head_child(struct mdoc *, int, int);  
 static  int       no_head_child(struct mdoc *, int, int);  
   
   struct  valids {
           v_args_sz sz;
           v_args    args;
           v_tree    tree_pre;
           v_tree    tree_post;
   };
   
   
 static  int       assert_eq0(struct mdoc *, int, int, int);  static  int       assert_eq0(struct mdoc *, int, int, int);
 static  int       assert_le1(struct mdoc *, int, int, int);  static  int       assert_le1(struct mdoc *, int, int, int);
 static  int       need_eq0(struct mdoc *, int, int, int);  static  int       need_eq0(struct mdoc *, int, int, int);
Line 40  static int   need_le2(struct mdoc *, int, int, int);
Line 47  static int   need_le2(struct mdoc *, int, int, int);
 static  int       want_eq0(struct mdoc *, int, int, int);  static  int       want_eq0(struct mdoc *, int, int, int);
 static  int       want_ge1(struct mdoc *, int, int, int);  static  int       want_ge1(struct mdoc *, int, int, int);
   
 static  int       args_ref(struct mdoc *, int, int, int,  static  int       tree_pre_ref(struct mdoc *, int, int);
                         const char *[], int, const struct mdoc_arg *);  static  int       tree_pre_display(struct mdoc *, int, int);
 static  int       args_bool(struct mdoc *, int, int, int,  
                         const char *[], int, const struct mdoc_arg *);  
 static  int       args_Sh(struct mdoc *, int, int, int,  
                         const char *[], int, const struct mdoc_arg *);  
 static  int       args_blocknest(struct mdoc *, int, int, int,  
                         const char *[], int, const struct mdoc_arg *);  
 static  int       args_At(struct mdoc *, int, int, int,  
                         const char *[], int, const struct mdoc_arg *);  
 static  int       args_Xr(struct mdoc *, int, int, int,  
                         const char *[], int, const struct mdoc_arg *);  
   
 struct  valids {  static  int       tree_post_onlyhead(struct mdoc *, int, int);
         v_args_sz sz;  static  int       tree_post_onlybody(struct mdoc *, int, int);
         v_args    args;  static  int       tree_post_warnemptybody(struct mdoc *, int, int);
         v_post    post;  
 };  
   
   static  int       args_bool(struct mdoc *, int, int,
                           int, const char *[],
                           int, const struct mdoc_arg *);
   static  int       args_sh(struct mdoc *, int, int,
                           int, const char *[],
                           int, const struct mdoc_arg *);
   static  int       args_an(struct mdoc *, int, int,
                           int, const char *[],
                           int, const struct mdoc_arg *);
   static  int       args_nopunct(struct mdoc *, int, int,
                           int, const char *[],
                           int, const struct mdoc_arg *);
   static  int       args_xr(struct mdoc *, int, int,
                           int, const char *[],
                           int, const struct mdoc_arg *);
   
 /*  
  * FIXME: have arrays of function pointers in case we want multiple  
  * check callbacks per macro.  
  */  
   
 const   struct valids mdoc_valids[MDOC_MAX] = {  const   struct valids mdoc_valids[MDOC_MAX] = {
         { NULL, NULL, NULL }, /* \" */          { NULL, NULL, NULL, NULL }, /* \" */
         { NULL, NULL, NULL }, /* Dd */ /* TODO */          { NULL, NULL, NULL, NULL }, /* Dd */ /* TODO */
         { NULL, NULL, NULL }, /* Dt */ /* TODO */          { NULL, NULL, NULL, NULL }, /* Dt */ /* TODO */
         { NULL, NULL, NULL }, /* Os */ /* TODO */          { NULL, NULL, NULL, NULL }, /* Os */ /* TODO */
         { NULL, args_Sh, NULL }, /* Sh */          { want_ge1, args_sh, NULL, NULL }, /* Sh */
         { NULL, NULL, NULL }, /* Ss */          { want_ge1, NULL, NULL, NULL }, /* Ss */
         { want_eq0, NULL, NULL }, /* Pp */          { want_eq0, NULL, NULL, NULL }, /* Pp */
         { NULL, args_blocknest, need_head_child }, /* D1 */          { assert_eq0, NULL, tree_pre_display, tree_post_onlyhead }, /* D1 */
         { NULL, args_blocknest, need_head_child }, /* Dl */          { assert_eq0, NULL, tree_pre_display, tree_post_onlyhead }, /* Dl */
         { NULL, args_blocknest, NULL }, /* Bd */          { want_eq0, NULL, tree_pre_display, tree_post_warnemptybody }, /* Bd */
         { NULL, NULL, no_head_child }, /* Ed */          { assert_eq0, NULL, NULL, tree_post_onlybody }, /* Ed */
         { NULL, NULL, NULL }, /* Bl */          { want_eq0, NULL, NULL, NULL }, /* Bl */
         { NULL, NULL, no_head_child }, /* El */          { assert_eq0, NULL, NULL, tree_post_onlybody }, /* El */
         { NULL, NULL, NULL }, /* It */          { NULL, NULL, NULL, NULL }, /* It */
         { need_ge1, NULL, NULL }, /* Ad */          { need_ge1, NULL, NULL, NULL }, /* Ad */
         { NULL, NULL, NULL }, /* An */  /* FIXME: no args & argv. */          { NULL, args_an, NULL, NULL }, /* An */
         { NULL, NULL, NULL }, /* Ar */          { NULL, NULL, NULL, NULL }, /* Ar */
         { need_ge1, NULL, NULL }, /* Cd */          { need_ge1, NULL, NULL, NULL }, /* Cd */
         { NULL, NULL, NULL }, /* Cm */          { NULL, NULL, NULL, NULL }, /* Cm */
         { need_ge1, NULL, NULL }, /* Dv */          { need_ge1, NULL, NULL, NULL }, /* Dv */
         { need_ge1, NULL, NULL }, /* Er */          { need_ge1, NULL, NULL, NULL }, /* Er */
         { need_ge1, NULL, NULL }, /* Ev */          { need_ge1, NULL, NULL, NULL }, /* Ev */
         { NULL, NULL, NULL }, /* Ex */          { NULL, NULL, NULL, NULL }, /* Ex */
         { need_ge1, NULL, NULL }, /* Fa */          { need_ge1, NULL, NULL, NULL }, /* Fa */
         { NULL, NULL, NULL }, /* Fd */          { NULL, NULL, NULL, NULL }, /* Fd */
         { NULL, NULL, NULL }, /* Fl */          { NULL, NULL, NULL, NULL }, /* Fl */
         { need_ge1, NULL, NULL }, /* Fn */          { need_ge1, NULL, NULL, NULL }, /* Fn */
         { want_ge1, NULL, NULL }, /* Ft */          { want_ge1, NULL, NULL, NULL }, /* Ft */
         { need_ge1, NULL, NULL }, /* Ic */          { need_ge1, NULL, NULL, NULL }, /* Ic */
         { need_eq1, NULL, NULL }, /* In */          { need_eq1, NULL, NULL, NULL }, /* In */
         { want_ge1, NULL, NULL }, /* Li */          { want_ge1, NULL, NULL, NULL }, /* Li */
         { want_ge1, NULL, NULL }, /* Nd */          { want_ge1, NULL, NULL, NULL }, /* Nd */
         { NULL, NULL, NULL }, /* Nm */          { NULL, NULL, NULL, NULL }, /* Nm */
         { NULL, NULL, NULL }, /* Op */          { NULL, NULL, NULL, NULL }, /* Op */
         { NULL, NULL, NULL }, /* Ot */          { NULL, NULL, NULL, NULL }, /* Ot */
         { want_ge1, NULL, NULL }, /* Pa */          { want_ge1, NULL, NULL, NULL }, /* Pa */
         { NULL, NULL, NULL }, /* Rv */          { NULL, NULL, NULL, NULL }, /* Rv */
         { NULL, NULL, NULL }, /* St */          { NULL, NULL, NULL, NULL }, /* St */
         { need_ge1, NULL, NULL }, /* Va */          { need_ge1, NULL, NULL, NULL }, /* Va */
         { need_ge1, NULL, NULL }, /* Vt */          { need_ge1, NULL, NULL, NULL }, /* Vt */
         { need_le2, args_Xr, NULL }, /* Xr */          { need_le2, args_xr, NULL, NULL }, /* Xr */
         { need_ge1, args_ref, NULL }, /* %A */          { need_ge1, NULL, tree_pre_ref, NULL }, /* %A */
         { need_ge1, args_ref, NULL }, /* %B */          { need_ge1, NULL, tree_pre_ref, NULL }, /* %B */
         { need_ge1, args_ref, NULL }, /* %D */          { need_ge1, NULL, tree_pre_ref, NULL }, /* %D */
         { need_ge1, args_ref, NULL }, /* %I */          { need_ge1, NULL, tree_pre_ref, NULL }, /* %I */
         { need_ge1, args_ref, NULL }, /* %J */          { need_ge1, NULL, tree_pre_ref, NULL }, /* %J */
         { need_ge1, args_ref, NULL }, /* %N */          { need_ge1, NULL, tree_pre_ref, NULL }, /* %N */
         { need_ge1, args_ref, NULL }, /* %O */          { need_ge1, NULL, tree_pre_ref, NULL }, /* %O */
         { need_ge1, args_ref, NULL }, /* %P */          { need_ge1, NULL, tree_pre_ref, NULL }, /* %P */
         { need_ge1, args_ref, NULL }, /* %R */          { need_ge1, NULL, tree_pre_ref, NULL }, /* %R */
         { need_ge1, args_ref, NULL }, /* %T */          { need_ge1, NULL, tree_pre_ref, NULL }, /* %T */
         { need_ge1, args_ref, NULL }, /* %V */          { need_ge1, NULL, tree_pre_ref, NULL }, /* %V */
         { NULL, NULL, NULL }, /* Ac */          { NULL, NULL, NULL, NULL }, /* Ac */
         { NULL, NULL, NULL }, /* Ao */          { NULL, NULL, NULL, NULL }, /* Ao */
         { NULL, NULL, NULL }, /* Aq */          { NULL, NULL, NULL, NULL }, /* Aq */
         { need_le2, args_At, NULL }, /* At */          { need_le2, args_nopunct, NULL, NULL }, /* At */
         { NULL, NULL, NULL }, /* Bc */          { NULL, NULL, NULL, NULL }, /* Bc */
         { NULL, NULL, NULL }, /* Bf */          { NULL, NULL, NULL, NULL }, /* Bf */
         { NULL, NULL, NULL }, /* Bo */          { NULL, NULL, NULL, NULL }, /* Bo */
         { NULL, NULL, NULL }, /* Bq */          { NULL, NULL, NULL, NULL }, /* Bq */
         { assert_le1, NULL, NULL }, /* Bsx */          { assert_le1, NULL, NULL, NULL }, /* Bsx */
         { assert_le1, NULL, NULL }, /* Bx */          { assert_le1, NULL, NULL, NULL }, /* Bx */
         { need_eq1, args_bool, NULL }, /* Db */          { need_eq1, args_bool, NULL, NULL }, /* Db */
         { NULL, NULL, NULL }, /* Dc */          { NULL, NULL, NULL, NULL }, /* Dc */
         { NULL, NULL, NULL }, /* Do */          { NULL, NULL, NULL, NULL }, /* Do */
         { NULL, NULL, NULL }, /* Dq */          { NULL, NULL, NULL, NULL }, /* Dq */
         { NULL, NULL, NULL }, /* Ec */          { NULL, NULL, NULL, NULL }, /* Ec */
         { NULL, NULL, NULL }, /* Ef */ /* -symbolic, etc. */          { NULL, NULL, NULL, NULL }, /* Ef */ /* -symbolic, etc. */
         { need_ge1, NULL, NULL }, /* Em */          { need_ge1, NULL, NULL, NULL }, /* Em */
         { NULL, NULL, NULL }, /* Eo */          { NULL, NULL, NULL, NULL }, /* Eo */
         { assert_le1, NULL, NULL }, /* Fx */          { assert_le1, NULL, NULL, NULL }, /* Fx */
         { want_ge1, NULL, NULL }, /* Ms */          { want_ge1, NULL, NULL, NULL }, /* Ms */
         { NULL, NULL, NULL }, /* No */          { NULL, NULL, NULL, NULL }, /* No */
         { NULL, NULL, NULL }, /* Ns */          { NULL, NULL, NULL, NULL }, /* Ns */
         { assert_le1, NULL, NULL }, /* Nx */          { assert_le1, NULL, NULL, NULL }, /* Nx */
         { assert_le1, NULL, NULL }, /* Ox */          { assert_le1, NULL, NULL, NULL }, /* Ox */
         { NULL, NULL, NULL }, /* Pc */          { NULL, NULL, NULL, NULL }, /* Pc */
         { NULL, NULL, NULL }, /* Pf */ /* 2 or more arguments */          { NULL, NULL, NULL, NULL }, /* Pf */ /* 2 or more arguments */
         { NULL, NULL, NULL }, /* Po */          { NULL, NULL, NULL, NULL }, /* Po */
         { NULL, NULL, NULL }, /* Pq */          { NULL, NULL, NULL, NULL }, /* Pq */
         { NULL, NULL, NULL }, /* Qc */          { NULL, NULL, NULL, NULL }, /* Qc */
         { NULL, NULL, NULL }, /* Ql */          { NULL, NULL, NULL, NULL }, /* Ql */
         { NULL, NULL, NULL }, /* Qo */          { NULL, NULL, NULL, NULL }, /* Qo */
         { NULL, NULL, NULL }, /* Qq */          { NULL, NULL, NULL, NULL }, /* Qq */
         { NULL, NULL, NULL }, /* Re */          { NULL, NULL, NULL, NULL }, /* Re */
         { NULL, NULL, NULL }, /* Rs */          { NULL, NULL, NULL, NULL }, /* Rs */
         { NULL, NULL, NULL }, /* Sc */          { NULL, NULL, NULL, NULL }, /* Sc */
         { NULL, NULL, NULL }, /* So */          { NULL, NULL, NULL, NULL }, /* So */
         { NULL, NULL, NULL }, /* Sq */          { NULL, NULL, NULL, NULL }, /* Sq */
         { need_eq1, args_bool, NULL }, /* Sm */          { need_eq1, args_bool, NULL, NULL }, /* Sm */
         { need_ge1, NULL, NULL }, /* Sx */          { need_ge1, NULL, NULL, NULL }, /* Sx */
         { need_ge1, NULL, NULL }, /* Sy */          { need_ge1, NULL, NULL, NULL }, /* Sy */
         { want_ge1, NULL, NULL }, /* Tn */          { want_ge1, NULL, NULL, NULL }, /* Tn */
         { assert_eq0, NULL, NULL }, /* Ux */          { assert_eq0, NULL, NULL, NULL }, /* Ux */
         { NULL, NULL, NULL }, /* Xc */          { NULL, NULL, NULL, NULL }, /* Xc */
         { NULL, NULL, NULL }, /* Xo */          { NULL, NULL, NULL, NULL }, /* Xo */
         { NULL, NULL, NULL }, /* Fo */          { NULL, NULL, NULL, NULL }, /* Fo */
         { NULL, NULL, NULL }, /* Fc */          { NULL, NULL, NULL, NULL }, /* Fc */
         { NULL, NULL, NULL }, /* Oo */          { NULL, NULL, NULL, NULL }, /* Oo */
         { NULL, NULL, NULL }, /* Oc */          { NULL, NULL, NULL, NULL }, /* Oc */
         { NULL, NULL, NULL }, /* Bk */          { NULL, NULL, NULL, NULL }, /* Bk */
         { NULL, NULL, NULL }, /* Ek */          { NULL, NULL, NULL, NULL }, /* Ek */
         { need_eq0, NULL, NULL }, /* Bt */          { need_eq0, NULL, NULL, NULL }, /* Bt */
         { need_eq1, NULL, NULL }, /* Hf */          { need_eq1, NULL, NULL, NULL }, /* Hf */
         { NULL, NULL, NULL }, /* Fr */          { NULL, NULL, NULL, NULL }, /* Fr */
         { need_eq0, NULL, NULL }, /* Ud */          { need_eq0, NULL, NULL, NULL }, /* Ud */
 };  };
   
   
Line 248  need_ge1(struct mdoc *mdoc, int tok, int pos, int sz)
Line 254  need_ge1(struct mdoc *mdoc, int tok, int pos, int sz)
   
   
 static int  static int
 no_head_child(struct mdoc *mdoc, int tok, int pos)  tree_post_onlybody(struct mdoc *mdoc, int tok, int pos)
 {  {
           struct mdoc_node *n;
   
         /* TODO */          assert(mdoc->last);
         return(1);          n = mdoc->last;
   
           assert(MDOC_BLOCK == n->type);
           assert(n->child);
   
           if (MDOC_BODY == n->child->type) {
                   if (n->child->child)
                           return(1);
                   return(mdoc_err(mdoc, tok, pos, ERR_SYNTAX_EMPTYBODY));
           }
   
           return(mdoc_err(mdoc, tok, pos, ERR_SYNTAX_CHILDBODY));
 }  }
   
   
 static int  static int
 need_head_child(struct mdoc *mdoc, int tok, int pos)  tree_post_warnemptybody(struct mdoc *mdoc, int tok, int pos)
 {  {
         struct mdoc_node *n;          struct mdoc_node *n;
   
Line 267  need_head_child(struct mdoc *mdoc, int tok, int pos)
Line 285  need_head_child(struct mdoc *mdoc, int tok, int pos)
         assert(MDOC_BLOCK == n->type);          assert(MDOC_BLOCK == n->type);
         assert(n->child);          assert(n->child);
   
           for (n = n->child; n; n = n->next)
                   if (MDOC_BODY == n->type)
                           break;
   
           if (n && n->child)
                   return(1);
           return(mdoc_warn(mdoc, tok, pos, WARN_SYNTAX_EMPTYBODY));
   }
   
   
   static int
   tree_post_onlyhead(struct mdoc *mdoc, int tok, int pos)
   {
           struct mdoc_node *n;
   
           assert(mdoc->last);
           n = mdoc->last;
   
           assert(MDOC_BLOCK == n->type);
           assert(n->child);
   
         n = n->child;          n = n->child;
   
         if (MDOC_HEAD != n->type)          if (MDOC_HEAD != n->type)
                 return(mdoc_err(mdoc, tok, pos, ERR_CHILD_HEAD));                  return(mdoc_err(mdoc, tok, pos, ERR_SYNTAX_CHILDHEAD));
         if (n->child)          if (n->child)
                 return(1);                  return(1);
         return(mdoc_err(mdoc, tok, pos, ERR_CHILD_HEAD));          return(mdoc_err(mdoc, tok, pos, ERR_SYNTAX_EMPTYHEAD));
 }  }
   
   
 static int  static int
 args_Sh(struct mdoc *mdoc, int tok, int pos,  args_an(struct mdoc *mdoc, int tok, int pos,
                 int sz, const char *args[],                  int sz, const char *args[],
                 int argc, const struct mdoc_arg *argv)                  int argc, const struct mdoc_arg *argv)
 {  {
   
           printf("argc=%d, sz=%d\n", argc, sz);
           if (0 != argc && 0 != sz)
                   return(mdoc_warn(mdoc, tok, pos, WARN_ARGS_EQ0));
           return(1);
   }
   
   
   static int
   args_sh(struct mdoc *mdoc, int tok, int pos,
                   int sz, const char *args[],
                   int argc, const struct mdoc_arg *argv)
   {
         enum mdoc_sec    sec;          enum mdoc_sec    sec;
   
         sec = mdoc_atosec((size_t)sz, args);          sec = mdoc_atosec((size_t)sz, args);
Line 297  args_Sh(struct mdoc *mdoc, int tok, int pos, 
Line 349  args_Sh(struct mdoc *mdoc, int tok, int pos, 
   
 static int  static int
 args_bool(struct mdoc *mdoc, int tok, int pos,  args_bool(struct mdoc *mdoc, int tok, int pos,
                 int sz, const char *args[],                  int sz, const char *args[],
                 int argc, const struct mdoc_arg *argv)                  int argc, const struct mdoc_arg *argv)
 {  {
           int              i;
   
         assert(1 == sz);          for (i = 0; i < sz; i++) {
         if (xstrcmp(args[0], "on"))                  if (xstrcmp(args[i], "on"))
                 return(1);                          continue;
         if (xstrcmp(args[0], "off"))                  if (xstrcmp(args[i], "off"))
                 return(1);                          continue;
         return(mdoc_err(mdoc, tok, pos, ERR_SYNTAX_ARGBAD));                  return(mdoc_err(mdoc, tok, pos, ERR_SYNTAX_ARGBAD));
           }
           return(1);
 }  }
   
   
 static int  static int
 args_ref(struct mdoc *mdoc, int tok, int pos,  tree_pre_ref(struct mdoc *mdoc, int tok, int pos)
                 int sz, const char *args[],  
                 int argc, const struct mdoc_arg *argv)  
 {  {
         struct mdoc_node *n;          struct mdoc_node *n;
   
Line 331  args_ref(struct mdoc *mdoc, int tok, int pos, 
Line 384  args_ref(struct mdoc *mdoc, int tok, int pos, 
   
   
 static int  static int
 args_Xr(struct mdoc *mdoc, int tok, int pos,  args_xr(struct mdoc *mdoc, int tok, int pos,
                 int sz, const char *args[],                  int sz, const char *args[],
                 int argc, const struct mdoc_arg *argv)                  int argc, const struct mdoc_arg *argv)
 {  {
   
Line 340  args_Xr(struct mdoc *mdoc, int tok, int pos, 
Line 393  args_Xr(struct mdoc *mdoc, int tok, int pos, 
                 return(1);                  return(1);
         if (0 == sz)          if (0 == sz)
                 return(mdoc_err(mdoc, tok, pos, ERR_ARGS_GE1));                  return(mdoc_err(mdoc, tok, pos, ERR_ARGS_GE1));
   
         if (MSEC_DEFAULT == mdoc_atomsec(args[1]))          if (MSEC_DEFAULT == mdoc_atomsec(args[1]))
                 return(mdoc_err(mdoc, tok, pos, ERR_SYNTAX_ARGFORM));                  return(mdoc_err(mdoc, tok, pos, ERR_SYNTAX_ARGFORM));
         return(1);          return(1);
Line 348  args_Xr(struct mdoc *mdoc, int tok, int pos, 
Line 400  args_Xr(struct mdoc *mdoc, int tok, int pos, 
   
   
 static int  static int
 args_At(struct mdoc *mdoc, int tok, int pos,  args_nopunct(struct mdoc *mdoc, int tok, int pos,
                 int sz, const char *args[],                  int sz, const char *args[],
                 int argc, const struct mdoc_arg *argv)                  int argc, const struct mdoc_arg *argv)
 {  {
         int              i;          int              i;
Line 360  args_At(struct mdoc *mdoc, int tok, int pos, 
Line 412  args_At(struct mdoc *mdoc, int tok, int pos, 
         i = 0;          i = 0;
         if (ATT_DEFAULT == mdoc_atoatt(args[i]))          if (ATT_DEFAULT == mdoc_atoatt(args[i]))
                 i++;                  i++;
   
         for ( ; i < sz; i++) {          for ( ; i < sz; i++) {
                 if ( ! mdoc_isdelim(args[i]))                  if ( ! mdoc_isdelim(args[i]))
                         continue;                          continue;
Line 371  args_At(struct mdoc *mdoc, int tok, int pos, 
Line 422  args_At(struct mdoc *mdoc, int tok, int pos, 
   
   
 static int  static int
 args_blocknest(struct mdoc *mdoc, int tok, int pos,  tree_pre_display(struct mdoc *mdoc, int tok, int pos)
                 int sz, const char *args[],  
                 int argc, const struct mdoc_arg *argv)  
 {  {
         struct mdoc_node *node;          struct mdoc_node *node;
   
         /*  
          * We can't be nested within any other block displays (or really  
          * any other kind of display, although Bd is the only multi-line  
          * one that will show up).  
          */  
         assert(mdoc->last);          assert(mdoc->last);
   
           /* Displays may not be nested in other displays. */
   
         /* LINTED */          /* LINTED */
         for (node = mdoc->last; node; node = node->parent) {          for (node = mdoc->last; node; node = node->parent) {
                 if (node->type != MDOC_BLOCK)                  if (node->type != MDOC_BLOCK)
Line 408  mdoc_valid_pre(struct mdoc *mdoc, int tok, int pos, 
Line 454  mdoc_valid_pre(struct mdoc *mdoc, int tok, int pos, 
         if (mdoc_valids[tok].sz)          if (mdoc_valids[tok].sz)
                 if ( ! (*mdoc_valids[tok].sz)(mdoc, tok, pos, sz))                  if ( ! (*mdoc_valids[tok].sz)(mdoc, tok, pos, sz))
                         return(0);                          return(0);
           if (mdoc_valids[tok].args)
         if (NULL == mdoc_valids[tok].args)                  if ( ! (*mdoc_valids[tok].args)(mdoc, tok, pos,
                 return(1);                                          sz, args, argc, argv))
         return((*mdoc_valids[tok].args)(mdoc,                          return(0);
                         tok, pos, sz, args, argc, argv));          if (mdoc_valids[tok].tree_pre)
                   if ( ! (*mdoc_valids[tok].tree_pre)(mdoc, tok, pos))
                           return(0);
           return(1);
 }  }
   
   
Line 420  int
Line 469  int
 mdoc_valid_post(struct mdoc *mdoc, int tok, int pos)  mdoc_valid_post(struct mdoc *mdoc, int tok, int pos)
 {  {
   
         if (NULL == mdoc_valids[tok].post)          if (mdoc_valids[tok].tree_post)
                 return(1);                  return((*mdoc_valids[tok].tree_post)(mdoc, tok, pos));
         return((*mdoc_valids[tok].post)(mdoc, tok, pos));          return(1);
 }  }
   

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

CVSweb