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

Diff for /mandoc/man_macro.c between version 1.53 and 1.57

version 1.53, 2010/12/06 15:31:19 version 1.57, 2011/03/20 16:02:05
Line 24 
Line 24 
 #include <string.h>  #include <string.h>
   
 #include "mandoc.h"  #include "mandoc.h"
   #include "libmandoc.h"
 #include "libman.h"  #include "libman.h"
   
 enum    rew {  enum    rew {
Line 43  static enum rew  rew_dohalt(enum mant, enum man_type, 
Line 44  static enum rew  rew_dohalt(enum mant, enum man_type, 
                                 const struct man_node *);                                  const struct man_node *);
 static  enum rew         rew_block(enum mant, enum man_type,  static  enum rew         rew_block(enum mant, enum man_type,
                                 const struct man_node *);                                  const struct man_node *);
 static  int              rew_warn(struct man *,  static  void             rew_warn(struct man *,
                                 struct man_node *, enum mandocerr);                                  struct man_node *, enum mandocerr);
   
 const   struct man_macro __man_macros[MAN_MAX] = {  const   struct man_macro __man_macros[MAN_MAX] = {
Line 69  const struct man_macro __man_macros[MAN_MAX] = {
Line 70  const struct man_macro __man_macros[MAN_MAX] = {
         { in_line_eoln, 0 }, /* IR */          { in_line_eoln, 0 }, /* IR */
         { in_line_eoln, 0 }, /* RI */          { in_line_eoln, 0 }, /* RI */
         { in_line_eoln, MAN_NSCOPED }, /* na */          { in_line_eoln, MAN_NSCOPED }, /* na */
         { in_line_eoln, 0 }, /* i */  
         { in_line_eoln, MAN_NSCOPED }, /* sp */          { in_line_eoln, MAN_NSCOPED }, /* sp */
         { in_line_eoln, 0 }, /* nf */          { in_line_eoln, 0 }, /* nf */
         { in_line_eoln, 0 }, /* fi */          { in_line_eoln, 0 }, /* fi */
         { in_line_eoln, 0 }, /* r */  
         { blk_close, 0 }, /* RE */          { blk_close, 0 }, /* RE */
         { blk_exp, MAN_EXPLICIT }, /* RS */          { blk_exp, MAN_EXPLICIT }, /* RS */
         { in_line_eoln, 0 }, /* DT */          { in_line_eoln, 0 }, /* DT */
Line 90  const struct man_macro * const man_macros = __man_macr
Line 89  const struct man_macro * const man_macros = __man_macr
 /*  /*
  * Warn when "n" is an explicit non-roff macro.   * Warn when "n" is an explicit non-roff macro.
  */   */
 static int  static void
 rew_warn(struct man *m, struct man_node *n, enum mandocerr er)  rew_warn(struct man *m, struct man_node *n, enum mandocerr er)
 {  {
   
         if (er == MANDOCERR_MAX || MAN_BLOCK != n->type)          if (er == MANDOCERR_MAX || MAN_BLOCK != n->type)
                 return(1);                  return;
         if (MAN_VALID & n->flags)          if (MAN_VALID & n->flags)
                 return(1);                  return;
         if ( ! (MAN_EXPLICIT & man_macros[n->tok].flags))          if ( ! (MAN_EXPLICIT & man_macros[n->tok].flags))
                 return(1);                  return;
         return(man_nmsg(m, n, er));  
           assert(er < MANDOCERR_FATAL);
           man_nmsg(m, n, er);
 }  }
   
   
Line 109  rew_warn(struct man *m, struct man_node *n, enum mando
Line 110  rew_warn(struct man *m, struct man_node *n, enum mando
  * will be used if an explicit block scope is being closed out.   * will be used if an explicit block scope is being closed out.
  */   */
 int  int
 man_unscope(struct man *m, const struct man_node *n,  man_unscope(struct man *m, const struct man_node *to,
                 enum mandocerr er)                  enum mandocerr er)
 {  {
           struct man_node *n;
   
         assert(n);          assert(to);
   
         /* LINTED */          /* LINTED */
         while (m->last != n) {          while (m->last != to) {
                 if ( ! rew_warn(m, m->last, er))                  /*
                         return(0);                   * Save the parent here, because we may delete the
                    * m->last node in the post-validation phase and reset
                    * it to m->last->parent, causing a step in the closing
                    * out to be lost.
                    */
                   n = m->last->parent;
                   rew_warn(m, m->last, er);
                 if ( ! man_valid_post(m))                  if ( ! man_valid_post(m))
                         return(0);                          return(0);
                 m->last = m->last->parent;                  m->last = n;
                 assert(m->last);                  assert(m->last);
         }          }
   
         if ( ! rew_warn(m, m->last, er))          rew_warn(m, m->last, er);
                 return(0);  
         if ( ! man_valid_post(m))          if ( ! man_valid_post(m))
                 return(0);                  return(0);
   
Line 273  blk_close(MACRO_PROT_ARGS)
Line 280  blk_close(MACRO_PROT_ARGS)
                         break;                          break;
   
         if (NULL == nn)          if (NULL == nn)
                 if ( ! man_pmsg(m, line, ppos, MANDOCERR_NOSCOPE))                  man_pmsg(m, line, ppos, MANDOCERR_NOSCOPE);
                         return(0);  
   
         if ( ! rew_scope(MAN_BODY, m, ntok))          if ( ! rew_scope(MAN_BODY, m, ntok))
                 return(0);                  return(0);

Legend:
Removed from v.1.53  
changed lines
  Added in v.1.57

CVSweb