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

Diff for /mandoc/mdoc_macro.c between version 1.131 and 1.136

version 1.131, 2014/04/20 16:46:05 version 1.136, 2014/07/04 16:12:08
Line 48  static int  ctx_synopsis(MACRO_PROT_ARGS);
Line 48  static int  ctx_synopsis(MACRO_PROT_ARGS);
 static  int             in_line_eoln(MACRO_PROT_ARGS);  static  int             in_line_eoln(MACRO_PROT_ARGS);
 static  int             in_line_argn(MACRO_PROT_ARGS);  static  int             in_line_argn(MACRO_PROT_ARGS);
 static  int             in_line(MACRO_PROT_ARGS);  static  int             in_line(MACRO_PROT_ARGS);
 static  int             obsolete(MACRO_PROT_ARGS);  
 static  int             phrase_ta(MACRO_PROT_ARGS);  static  int             phrase_ta(MACRO_PROT_ARGS);
   
 static  int             dword(struct mdoc *, int, int, const char *,  static  int             dword(struct mdoc *, int, int, const char *,
Line 104  const struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
Line 103  const struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
         { blk_full, MDOC_JOIN }, /* Nd */          { blk_full, MDOC_JOIN }, /* Nd */
         { ctx_synopsis, MDOC_CALLABLE | MDOC_PARSED }, /* Nm */          { ctx_synopsis, MDOC_CALLABLE | MDOC_PARSED }, /* Nm */
         { blk_part_imp, MDOC_CALLABLE | MDOC_PARSED }, /* Op */          { blk_part_imp, MDOC_CALLABLE | MDOC_PARSED }, /* Op */
         { obsolete, 0 }, /* Ot */          { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Ot */
         { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Pa */          { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Pa */
         { in_line_eoln, 0 }, /* Rv */          { in_line_eoln, 0 }, /* Rv */
         { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* St */          { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* St */
Line 191  const struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
Line 190  const struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
         { blk_exp_close, MDOC_EXPLICIT | MDOC_JOIN }, /* Ek */          { blk_exp_close, MDOC_EXPLICIT | MDOC_JOIN }, /* Ek */
         { in_line_eoln, 0 }, /* Bt */          { in_line_eoln, 0 }, /* Bt */
         { in_line_eoln, 0 }, /* Hf */          { in_line_eoln, 0 }, /* Hf */
         { obsolete, 0 }, /* Fr */          { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Fr */
         { in_line_eoln, 0 }, /* Ud */          { in_line_eoln, 0 }, /* Ud */
         { in_line, 0 }, /* Lb */          { in_line, 0 }, /* Lb */
         { in_line_eoln, 0 }, /* Lp */          { in_line_eoln, 0 }, /* Lp */
Line 203  const struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
Line 202  const struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
         { blk_exp_close, MDOC_CALLABLE | MDOC_PARSED |          { blk_exp_close, MDOC_CALLABLE | MDOC_PARSED |
                          MDOC_EXPLICIT | MDOC_JOIN }, /* Brc */                           MDOC_EXPLICIT | MDOC_JOIN }, /* Brc */
         { in_line_eoln, MDOC_JOIN }, /* %C */          { in_line_eoln, MDOC_JOIN }, /* %C */
         { obsolete, 0 }, /* Es */          { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Es */
         { obsolete, 0 }, /* En */          { blk_part_imp, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* En */
         { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Dx */          { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Dx */
         { in_line_eoln, MDOC_JOIN }, /* %Q */          { in_line_eoln, MDOC_JOIN }, /* %Q */
         { in_line_eoln, 0 }, /* br */          { in_line_eoln, 0 }, /* br */
Line 529  make_pending(struct mdoc_node *broken, enum mdoct tok,
Line 528  make_pending(struct mdoc_node *broken, enum mdoct tok,
                         taker->pending = broken->pending;                          taker->pending = broken->pending;
                 }                  }
                 broken->pending = breaker;                  broken->pending = breaker;
                 mandoc_vmsg(MANDOCERR_SCOPENEST, mdoc->parse, line, ppos,                  mandoc_vmsg(MANDOCERR_BLOCK_NEST, mdoc->parse, line, ppos,
                     "%s breaks %s", mdoc_macronames[tok],                      "%s breaks %s", mdoc_macronames[tok],
                     mdoc_macronames[broken->tok]);                      mdoc_macronames[broken->tok]);
                 return(1);                  return(1);
Line 770  blk_exp_close(MACRO_PROT_ARGS)
Line 769  blk_exp_close(MACRO_PROT_ARGS)
                         later = n;                          later = n;
         }          }
   
         if ( ! (MDOC_CALLABLE & mdoc_macros[tok].flags)) {          if ( ! (MDOC_PARSED & mdoc_macros[tok].flags)) {
                 /* FIXME: do this in validate */                  if ('\0' != buf[*pos])
                 if (buf[*pos])                          mandoc_vmsg(MANDOCERR_ARG_SKIP,
                         mdoc_pmsg(mdoc, line, ppos, MANDOCERR_ARGSLOST);                              mdoc->parse, line, ppos,
                               "%s %s", mdoc_macronames[tok],
                               buf + *pos);
                 if ( ! rew_sub(MDOC_BODY, mdoc, tok, line, ppos))                  if ( ! rew_sub(MDOC_BODY, mdoc, tok, line, ppos))
                         return(0);                          return(0);
                 return(rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos));                  return(rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos));
Line 920  in_line(MACRO_PROT_ARGS)
Line 920  in_line(MACRO_PROT_ARGS)
                                         return(0);                                          return(0);
                         } else if ( ! nc && 0 == cnt) {                          } else if ( ! nc && 0 == cnt) {
                                 mdoc_argv_free(arg);                                  mdoc_argv_free(arg);
                                 mdoc_pmsg(mdoc, line, ppos,                                  mandoc_msg(MANDOCERR_MACRO_EMPTY,
                                     MANDOCERR_MACROEMPTY);                                      mdoc->parse, line, ppos,
                                       mdoc_macronames[tok]);
                         }                          }
   
                         if ( ! mdoc_macro(mdoc, ntok, line, la, pos, buf))                          if ( ! mdoc_macro(mdoc, ntok, line, la, pos, buf))
Line 1006  in_line(MACRO_PROT_ARGS)
Line 1007  in_line(MACRO_PROT_ARGS)
                         return(0);                          return(0);
         } else if ( ! nc && 0 == cnt) {          } else if ( ! nc && 0 == cnt) {
                 mdoc_argv_free(arg);                  mdoc_argv_free(arg);
                 mdoc_pmsg(mdoc, line, ppos, MANDOCERR_MACROEMPTY);                  mandoc_msg(MANDOCERR_MACRO_EMPTY, mdoc->parse,
                       line, ppos, mdoc_macronames[tok]);
         }          }
   
         if ( ! nl)          if ( ! nl)
Line 1355  blk_part_imp(MACRO_PROT_ARGS)
Line 1357  blk_part_imp(MACRO_PROT_ARGS)
                         return(1);                          return(1);
                 }                  }
         }          }
           assert(n == body);
   
         /*          if ( ! rew_sub(MDOC_BODY, mdoc, tok, line, ppos))
          * If we can't rewind to our body, then our scope has already  
          * been closed by another macro (like `Oc' closing `Op').  This  
          * is ugly behaviour nodding its head to OpenBSD's overwhelming  
          * crufty use of `Op' breakage.  
          */  
         if (n != body)  
                 mandoc_vmsg(MANDOCERR_SCOPENEST, mdoc->parse, line,  
                     ppos, "%s broken", mdoc_macronames[tok]);  
   
         if (n && ! rew_sub(MDOC_BODY, mdoc, tok, line, ppos))  
                 return(0);                  return(0);
   
         /* Standard appending of delimiters. */          /* Standard appending of delimiters. */
Line 1376  blk_part_imp(MACRO_PROT_ARGS)
Line 1369  blk_part_imp(MACRO_PROT_ARGS)
   
         /* Rewind scope, if applicable. */          /* Rewind scope, if applicable. */
   
         if (n && ! rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos))          if ( ! rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos))
                 return(0);                  return(0);
   
         /* Move trailing .Ns out of scope. */          /* Move trailing .Ns out of scope. */
Line 1528  in_line_argn(MACRO_PROT_ARGS)
Line 1521  in_line_argn(MACRO_PROT_ARGS)
                 break;                  break;
         case MDOC_Bx:          case MDOC_Bx:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
           case MDOC_Es:
                   /* FALLTHROUGH */
         case MDOC_Xr:          case MDOC_Xr:
                 maxargs = 2;                  maxargs = 2;
                 break;                  break;
Line 1572  in_line_argn(MACRO_PROT_ARGS)
Line 1567  in_line_argn(MACRO_PROT_ARGS)
                                 return(0);                                  return(0);
                         continue;                          continue;
                 } else if (0 == j)                  } else if (0 == j)
                        if ( ! mdoc_elem_alloc(mdoc, line, la, tok, arg))                         if ( ! mdoc_elem_alloc(mdoc, line, ppos, tok, arg))
                                return(0);                                 return(0);
   
                 if (j == maxargs && ! flushed) {                  if (j == maxargs && ! flushed) {
Line 1608  in_line_argn(MACRO_PROT_ARGS)
Line 1603  in_line_argn(MACRO_PROT_ARGS)
                 j++;                  j++;
         }          }
   
         if (0 == j && ! mdoc_elem_alloc(mdoc, line, la, tok, arg))          if (0 == j && ! mdoc_elem_alloc(mdoc, line, ppos, tok, arg))
                return(0);                 return(0);
   
         /* Close out in a consistent state. */          /* Close out in a consistent state. */
Line 1713  ctx_synopsis(MACRO_PROT_ARGS)
Line 1708  ctx_synopsis(MACRO_PROT_ARGS)
                 return(blk_full(mdoc, tok, line, ppos, pos, buf));                  return(blk_full(mdoc, tok, line, ppos, pos, buf));
         assert(MDOC_Vt == tok);          assert(MDOC_Vt == tok);
         return(blk_part_imp(mdoc, tok, line, ppos, pos, buf));          return(blk_part_imp(mdoc, tok, line, ppos, pos, buf));
 }  
   
 static int  
 obsolete(MACRO_PROT_ARGS)  
 {  
   
         mdoc_pmsg(mdoc, line, ppos, MANDOCERR_MACROOBS);  
         return(1);  
 }  }
   
 /*  /*

Legend:
Removed from v.1.131  
changed lines
  Added in v.1.136

CVSweb