[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.97 and 1.102

version 1.97, 2010/06/12 12:10:55 version 1.102, 2010/06/28 14:39:17
Line 107  static int  pre_ss(PRE_ARGS);
Line 107  static int  pre_ss(PRE_ARGS);
   
 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_bd[] = { hwarn_eq0, bwarn_ge1, NULL };  static  v_post   posts_bd_bk[] = { hwarn_eq0, bwarn_ge1, NULL };
 static  v_post   posts_bf[] = { hwarn_le1, post_bf, NULL };  static  v_post   posts_bf[] = { hwarn_le1, post_bf, NULL };
 static  v_post   posts_bl[] = { bwarn_ge1, post_bl, NULL };  static  v_post   posts_bl[] = { bwarn_ge1, post_bl, NULL };
 static  v_post   posts_bool[] = { eerr_eq1, ebool, NULL };  static  v_post   posts_bool[] = { eerr_eq1, ebool, NULL };
Line 154  const struct valids mdoc_valids[MDOC_MAX] = {
Line 154  const struct valids mdoc_valids[MDOC_MAX] = {
         { NULL, posts_notext },                 /* Pp */          { NULL, posts_notext },                 /* Pp */
         { pres_d1, posts_wline },               /* D1 */          { pres_d1, posts_wline },               /* D1 */
         { pres_d1, posts_wline },               /* Dl */          { pres_d1, posts_wline },               /* Dl */
         { pres_bd, posts_bd },                  /* Bd */          { pres_bd, posts_bd_bk },                       /* Bd */
         { NULL, NULL },                         /* Ed */          { NULL, NULL },                         /* Ed */
         { pres_bl, posts_bl },                  /* Bl */          { pres_bl, posts_bl },                  /* Bl */
         { NULL, NULL },                         /* El */          { NULL, NULL },                         /* El */
Line 245  const struct valids mdoc_valids[MDOC_MAX] = {
Line 245  const struct valids mdoc_valids[MDOC_MAX] = {
         { NULL, NULL },                         /* Fc */          { NULL, NULL },                         /* Fc */
         { NULL, NULL },                         /* Oo */          { NULL, NULL },                         /* Oo */
         { NULL, NULL },                         /* Oc */          { NULL, NULL },                         /* Oc */
         { NULL, posts_wline },                  /* Bk */          { NULL, posts_bd_bk },                  /* Bk */
         { NULL, NULL },                         /* Ek */          { NULL, NULL },                         /* Ek */
         { NULL, posts_eoln },                   /* Bt */          { NULL, posts_eoln },                   /* Bt */
         { NULL, NULL },                         /* Hf */          { NULL, NULL },                         /* Hf */
Line 458  check_text(struct mdoc *mdoc, int line, int pos, char 
Line 458  check_text(struct mdoc *mdoc, int line, int pos, char 
 {  {
         int              c;          int              c;
   
           /*
            * FIXME: we absolutely cannot let \b get through or it will
            * destroy some assumptions in terms of format.
            */
   
         for ( ; *p; p++, pos++) {          for ( ; *p; p++, pos++) {
                 if ('\t' == *p) {                  if ('\t' == *p) {
                         if ( ! (MDOC_LITERAL & mdoc->flags))                          if ( ! (MDOC_LITERAL & mdoc->flags))
Line 532  pre_display(PRE_ARGS)
Line 537  pre_display(PRE_ARGS)
 static int  static int
 pre_bl(PRE_ARGS)  pre_bl(PRE_ARGS)
 {  {
         int              i, width, offs, comp, dup;          int              i, comp, dup;
           const char      *offs, *width;
         enum mdoc_list   lt;          enum mdoc_list   lt;
   
         if (MDOC_BLOCK != n->type) {          if (MDOC_BLOCK != n->type) {
Line 552  pre_bl(PRE_ARGS)
Line 558  pre_bl(PRE_ARGS)
          */           */
   
         assert(LIST__NONE == n->data.Bl.type);          assert(LIST__NONE == n->data.Bl.type);
         offs = width = -1;  
   
         /* LINTED */          /* LINTED */
         for (i = 0; n->args && i < (int)n->args->argc; i++) {          for (i = 0; n->args && i < (int)n->args->argc; i++) {
                 lt = LIST__NONE;                  lt = LIST__NONE;
                 dup = comp = 0;                  dup = comp = 0;
                   width = offs = NULL;
                 switch (n->args->argv[i].arg) {                  switch (n->args->argv[i].arg) {
                 /* Set list types. */                  /* Set list types. */
                 case (MDOC_Bullet):                  case (MDOC_Bullet):
Line 599  pre_bl(PRE_ARGS)
Line 605  pre_bl(PRE_ARGS)
                         comp = 1;                          comp = 1;
                         break;                          break;
                 case (MDOC_Width):                  case (MDOC_Width):
                         if (width >= 0)                          dup = (NULL != n->data.Bl.width);
                                 dup++;                          width = n->args->argv[i].value[0];
                         width = i;  
                         break;                          break;
                 case (MDOC_Offset):                  case (MDOC_Offset):
                         if (offs >= 0)                          /* NB: this can be empty! */
                                 dup++;                          if (n->args->argv[i].sz) {
                         offs = i;                                  offs = n->args->argv[i].value[0];
                                   dup = (NULL != n->data.Bl.offs);
                                   break;
                           }
                           if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_IGNARGV))
                                   return(0);
                         break;                          break;
                 }                  }
   
Line 617  pre_bl(PRE_ARGS)
Line 627  pre_bl(PRE_ARGS)
   
                 if (comp && ! dup)                  if (comp && ! dup)
                         n->data.Bl.comp = comp;                          n->data.Bl.comp = comp;
                   if (offs && ! dup)
                           n->data.Bl.offs = offs;
                   if (width && ! dup)
                           n->data.Bl.width = width;
   
                 /* Check: multiple list types. */                  /* Check: multiple list types. */
   
Line 632  pre_bl(PRE_ARGS)
Line 646  pre_bl(PRE_ARGS)
                 /* The list type should come first. */                  /* The list type should come first. */
   
                 if (n->data.Bl.type == LIST__NONE)                  if (n->data.Bl.type == LIST__NONE)
                         if (width >= 0 || offs >= 0 || n->data.Bl.comp)                          if (n->data.Bl.width ||
                                           n->data.Bl.offs ||
                                           n->data.Bl.comp)
                                 if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_LISTFIRST))                                  if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_LISTFIRST))
                                         return(0);                                          return(0);
   
Line 655  pre_bl(PRE_ARGS)
Line 671  pre_bl(PRE_ARGS)
   
         switch (n->data.Bl.type) {          switch (n->data.Bl.type) {
         case (LIST_tag):          case (LIST_tag):
                 if (width >= 0)                  if (n->data.Bl.width)
                         break;                          break;
                 if (mdoc_nmsg(mdoc, n, MANDOCERR_NOWIDTHARG))                  if (mdoc_nmsg(mdoc, n, MANDOCERR_NOWIDTHARG))
                         break;                          break;
Line 669  pre_bl(PRE_ARGS)
Line 685  pre_bl(PRE_ARGS)
         case (LIST_inset):          case (LIST_inset):
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (LIST_item):          case (LIST_item):
                 if (width < 0)                  if (NULL == n->data.Bl.width)
                         break;                          break;
                 if (mdoc_nmsg(mdoc, n, MANDOCERR_WIDTHARG))                  if (mdoc_nmsg(mdoc, n, MANDOCERR_WIDTHARG))
                         break;                          break;
Line 795  pre_sh(PRE_ARGS)
Line 811  pre_sh(PRE_ARGS)
   
         if (MDOC_BLOCK != n->type)          if (MDOC_BLOCK != n->type)
                 return(1);                  return(1);
   
           mdoc->regs->regs[(int)REG_nS].set = 0;
         return(check_parent(mdoc, n, MDOC_MAX, MDOC_ROOT));          return(check_parent(mdoc, n, MDOC_MAX, MDOC_ROOT));
 }  }
   

Legend:
Removed from v.1.97  
changed lines
  Added in v.1.102

CVSweb