[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.67 and 1.68

version 1.67, 2010/05/15 08:54:04 version 1.68, 2010/05/17 22:11:42
Line 25 
Line 25 
 #include <string.h>  #include <string.h>
 #include <time.h>  #include <time.h>
   
   #include "mandoc.h"
 #include "libmdoc.h"  #include "libmdoc.h"
 #include "libmandoc.h"  #include "libmandoc.h"
   
Line 195  swarn(struct mdoc *mdoc, enum mdoc_type type, 
Line 196  swarn(struct mdoc *mdoc, enum mdoc_type type, 
                 int line, int pos, const struct mdoc_node *p)                  int line, int pos, const struct mdoc_node *p)
 {  {
         const char      *n, *t, *tt;          const char      *n, *t, *tt;
           int              rc;
   
         n = t = "<root>";          n = t = "<root>";
         tt = "block";          tt = "block";
Line 227  swarn(struct mdoc *mdoc, enum mdoc_type type, 
Line 229  swarn(struct mdoc *mdoc, enum mdoc_type type, 
                 break;                  break;
         }          }
   
         if ( ! (MDOC_IGN_SCOPE & mdoc->pflags))          rc = mdoc_vmsg(mdoc, MANDOCERR_SCOPE, line, pos,
                 return(mdoc_verr(mdoc, line, pos,                          "%s scope breaks %s of %s", tt, t, n);
                                 "%s scope breaks %s scope of %s",  
                                 tt, t, n));          /* FIXME: logic should be in driver. */
         return(mdoc_vwarn(mdoc, line, pos,          return(MDOC_IGN_SCOPE & mdoc->pflags ? rc : 0);
                                 "%s scope breaks %s scope of %s",  
                                 tt, t, n));  
 }  }
   
   
Line 256  mdoc_macroend(struct mdoc *m)
Line 256  mdoc_macroend(struct mdoc *m)
                         continue;                          continue;
                 if ( ! (MDOC_EXPLICIT & mdoc_macros[n->tok].flags))                  if ( ! (MDOC_EXPLICIT & mdoc_macros[n->tok].flags))
                         continue;                          continue;
                 return(mdoc_nerr(m, n, EOPEN));                  mdoc_nmsg(m, n, MANDOCERR_SYNTSCOPE);
                   return(0);
         }          }
   
         /* Rewind to the first. */          /* Rewind to the first. */
Line 588  rew_sub(enum mdoc_type t, struct mdoc *m, 
Line 589  rew_sub(enum mdoc_type t, struct mdoc *m, 
                                 return(1);                                  return(1);
                         if ( ! (MDOC_EXPLICIT & mdoc_macros[tok].flags))                          if ( ! (MDOC_EXPLICIT & mdoc_macros[tok].flags))
                                 return(1);                                  return(1);
                         return(mdoc_perr(m, line, ppos, ENOCTX));                          /* FIXME: shouldn't raise an error */
                           mdoc_pmsg(m, line, ppos, MANDOCERR_SYNTNOSCOPE);
                           return(0);
                 }                  }
                 if (REWIND_REWIND == c)                  if (REWIND_REWIND == c)
                         break;                          break;
Line 686  blk_exp_close(MACRO_PROT_ARGS)
Line 689  blk_exp_close(MACRO_PROT_ARGS)
         }          }
   
         if ( ! (MDOC_CALLABLE & mdoc_macros[tok].flags)) {          if ( ! (MDOC_CALLABLE & mdoc_macros[tok].flags)) {
                   /* FIXME: do this in validate */
                 if (buf[*pos])                  if (buf[*pos])
                         if ( ! mdoc_pwarn(m, line, ppos, ENOLINE))                          if ( ! mdoc_pmsg(m, line, ppos, MANDOCERR_ARGSLOST))
                                 return(0);                                  return(0);
   
                 if ( ! rew_sub(MDOC_BODY, m, tok, line, ppos))                  if ( ! rew_sub(MDOC_BODY, m, tok, line, ppos))
Line 831  in_line(MACRO_PROT_ARGS)
Line 835  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);
                                 if ( ! mdoc_pwarn(m, line, ppos, EIGNE))                                  if ( ! mdoc_pmsg(m, line, ppos, MANDOCERR_MACROEMPTY))
                                         return(0);                                          return(0);
                         }                          }
                         if ( ! mdoc_macro(m, ntok, line, la, pos, buf))                          if ( ! mdoc_macro(m, ntok, line, la, pos, buf))
Line 892  in_line(MACRO_PROT_ARGS)
Line 896  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);
                 if ( ! mdoc_pwarn(m, line, ppos, EIGNE))                  if ( ! mdoc_pmsg(m, line, ppos, MANDOCERR_MACROEMPTY))
                         return(0);                          return(0);
         }          }
   
Line 1198  blk_part_imp(MACRO_PROT_ARGS)
Line 1202  blk_part_imp(MACRO_PROT_ARGS)
                 if (body == n)                  if (body == n)
                         break;                          break;
   
         if (NULL == n && ! mdoc_nwarn(m, body, EIMPBRK))          if (NULL == n && ! mdoc_nmsg(m, body, MANDOCERR_SCOPE))
                 return(0);                  return(0);
   
         if (n && ! rew_last(m, body))          if (n && ! rew_last(m, body))
Line 1564  static int
Line 1568  static int
 obsolete(MACRO_PROT_ARGS)  obsolete(MACRO_PROT_ARGS)
 {  {
   
         return(mdoc_pwarn(m, line, ppos, EOBS));          return(mdoc_pmsg(m, line, ppos, MANDOCERR_MACROOBS));
 }  }
   
   

Legend:
Removed from v.1.67  
changed lines
  Added in v.1.68

CVSweb