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

Diff for /mandoc/mdoc_validate.c between version 1.104 and 1.107

version 1.104, 2010/07/01 22:56:17 version 1.107, 2010/07/02 15:03:14
Line 849  static int
Line 849  static int
 pre_an(PRE_ARGS)  pre_an(PRE_ARGS)
 {  {
   
         if (NULL == n->args || 1 == n->args->argc)          if (NULL == n->args)
                 return(1);                  return(1);
         mdoc_vmsg(mdoc, MANDOCERR_SYNTARGCOUNT,          if (n->args->argc > 1)
                                 n->line, n->pos,                  if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_ARGCOUNT))
                                 "line arguments == 1 (have %d)",                          return(0);
                                 n->args->argc);  
         return(0);          if (MDOC_Split == n->args->argv[0].arg)
                   n->data.An.auth = AUTH_split;
           else if (MDOC_Nosplit == n->args->argv[0].arg)
                   n->data.An.auth = AUTH_nosplit;
           else
                   abort();
   
           return(1);
 }  }
   
   
Line 931  pre_dd(PRE_ARGS)
Line 938  pre_dd(PRE_ARGS)
 static int  static int
 post_bf(POST_ARGS)  post_bf(POST_ARGS)
 {  {
         char             *p;          struct mdoc_node *np;
         struct mdoc_node *head;          int               arg;
   
         if (MDOC_BLOCK != mdoc->last->type)          /*
                 return(1);           * Unlike other data pointers, these are "housed" by the HEAD
            * element, which contains the goods.
            */
   
         head = mdoc->last->head;          if (MDOC_HEAD != mdoc->last->type) {
                   if (ENDBODY_NOT != mdoc->last->end) {
                           assert(mdoc->last->pending);
                           np = mdoc->last->pending->parent->head;
                   } else if (MDOC_BLOCK != mdoc->last->type) {
                           np = mdoc->last->parent->head;
                   } else
                           np = mdoc->last->head;
   
         if (mdoc->last->args && head->child) {                  assert(np);
                 /* FIXME: this should provide a default. */                  assert(MDOC_HEAD == np->type);
                 mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_SYNTARGVCOUNT);                  assert(MDOC_Bf == np->tok);
                 return(0);                  assert(np->data.Bf);
         } else if (mdoc->last->args)                  mdoc->last->data.Bf = np->data.Bf;
                 return(1);                  return(1);
           }
   
         if (NULL == head->child || MDOC_TEXT != head->child->type) {          np = mdoc->last;
                 /* FIXME: this should provide a default. */          assert(MDOC_BLOCK == np->parent->type);
                 mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_SYNTARGVCOUNT);          assert(MDOC_Bf == np->parent->tok);
           np->data.Bf = mandoc_calloc(1, sizeof(struct mdoc_bf));
   
           /*
            * Cannot have both argument and parameter.
            * If neither is specified, let it through with a warning.
            */
   
           if (np->parent->args && np->child) {
                   mdoc_nmsg(mdoc, np, MANDOCERR_SYNTARGVCOUNT);
                 return(0);                  return(0);
           } else if (NULL == np->parent->args && NULL == np->child)
                   return(mdoc_nmsg(mdoc, np, MANDOCERR_FONTTYPE));
   
           /* Extract argument into data. */
   
           if (np->parent->args) {
                   arg = np->parent->args->argv[0].arg;
                   if (MDOC_Emphasis == arg)
                           np->data.Bf->font = FONT_Em;
                   else if (MDOC_Literal == arg)
                           np->data.Bf->font = FONT_Li;
                   else if (MDOC_Symbolic == arg)
                           np->data.Bf->font = FONT_Sy;
                   else
                           abort();
                   return(1);
         }          }
   
         p = head->child->string;          /* Extract parameter into data. */
   
         if (0 == strcmp(p, "Em"))          if (0 == strcmp(np->child->string, "Em"))
                 return(1);                  np->data.Bf->font = FONT_Em;
         else if (0 == strcmp(p, "Li"))          else if (0 == strcmp(np->child->string, "Li"))
                 return(1);                  np->data.Bf->font = FONT_Li;
         else if (0 == strcmp(p, "Sy"))          else if (0 == strcmp(np->child->string, "Sy"))
                 return(1);                  np->data.Bf->font = FONT_Sy;
           else if ( ! mdoc_nmsg(mdoc, np, MANDOCERR_FONTTYPE))
                   return(0);
   
         mdoc_nmsg(mdoc, head, MANDOCERR_FONTTYPE);          return(1);
         return(0);  
 }  }
   
   
Line 1040  post_at(POST_ARGS)
Line 1083  post_at(POST_ARGS)
 static int  static int
 post_an(POST_ARGS)  post_an(POST_ARGS)
 {  {
           struct mdoc_node *np;
   
         if (mdoc->last->args) {          np = mdoc->last;
                 if (NULL == mdoc->last->child)          if (AUTH__NONE != np->data.An.auth && np->child)
                         return(1);                  return(mdoc_nmsg(mdoc, np, MANDOCERR_ARGCOUNT));
                 return(mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_ARGCOUNT));          if (AUTH__NONE != np->data.An.auth || np->child)
         }  
   
         if (mdoc->last->child)  
                 return(1);                  return(1);
         return(mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_NOARGS));          return(mdoc_nmsg(mdoc, np, MANDOCERR_NOARGS));
 }  }
   
   

Legend:
Removed from v.1.104  
changed lines
  Added in v.1.107

CVSweb