[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.28 and 1.31

version 1.28, 2009/07/29 08:46:06 version 1.31, 2009/08/19 11:58:32
Line 45  static int   rew_impblock(struct mdoc *, int, int, int
Line 45  static int   rew_impblock(struct mdoc *, int, int, int
 static  int       rew_expblock(struct mdoc *, int, int, int);  static  int       rew_expblock(struct mdoc *, int, int, int);
 static  int       rew_subblock(enum mdoc_type,  static  int       rew_subblock(enum mdoc_type,
                         struct mdoc *, int, int, int);                          struct mdoc *, int, int, int);
 static  int       rew_last(struct mdoc *, struct mdoc_node *);  static  int       rew_last(struct mdoc *, struct mdoc_node *); /* FIXME: make const */
 static  int       append_delims(struct mdoc *, int, int *, char *);  static  int       append_delims(struct mdoc *, int, int *, char *);
 static  int       lookup(struct mdoc *, int, const char *);  static  int       lookup(struct mdoc *, int, const char *);
 static  int       lookup_raw(struct mdoc *, const char *);  static  int       lookup_raw(struct mdoc *, const char *);
Line 599  rew_expblock(struct mdoc *mdoc, int tok, int line, int
Line 599  rew_expblock(struct mdoc *mdoc, int tok, int line, int
 }  }
   
   
   /* FIXME: can this be merged with subblock? */
 static int  static int
 rew_impblock(struct mdoc *mdoc, int tok, int line, int ppos)  rew_impblock(struct mdoc *mdoc, int tok, int line, int ppos)
 {  {
Line 644  append_delims(struct mdoc *mdoc, int line, int *pos, c
Line 645  append_delims(struct mdoc *mdoc, int line, int *pos, c
                 assert(mdoc_isdelim(p));                  assert(mdoc_isdelim(p));
                 if ( ! mdoc_word_alloc(mdoc, line, lastarg, p))                  if ( ! mdoc_word_alloc(mdoc, line, lastarg, p))
                         return(0);                          return(0);
                 mdoc->next = MDOC_NEXT_SIBLING;  
         }          }
   
         return(1);          return(1);
Line 707  blk_exp_close(MACRO_PROT_ARGS)
Line 707  blk_exp_close(MACRO_PROT_ARGS)
                 if (ARGS_EOLN == c)                  if (ARGS_EOLN == c)
                         break;                          break;
   
                 if (-1 == (c = lookup(mdoc, tok, p)))                  if (MDOC_MAX != (c = lookup(mdoc, tok, p))) {
                         return(0);  
                 else if (MDOC_MAX != c) {  
                         if ( ! flushed) {                          if ( ! flushed) {
                                 if ( ! rew_expblock(mdoc, tok,                                  if ( ! rew_expblock(mdoc, tok,
                                                         line, ppos))                                                          line, ppos))
Line 723  blk_exp_close(MACRO_PROT_ARGS)
Line 721  blk_exp_close(MACRO_PROT_ARGS)
   
                 if ( ! mdoc_word_alloc(mdoc, line, lastarg, p))                  if ( ! mdoc_word_alloc(mdoc, line, lastarg, p))
                         return(0);                          return(0);
                 mdoc->next = MDOC_NEXT_SIBLING;  
         }          }
   
         if ( ! flushed && ! rew_expblock(mdoc, tok, line, ppos))          if ( ! flushed && ! rew_expblock(mdoc, tok, line, ppos))
Line 807  in_line(MACRO_PROT_ARGS)
Line 804  in_line(MACRO_PROT_ARGS)
                  * or raise a warning.                   * or raise a warning.
                  */                   */
   
                 if (MDOC_MAX != c && -1 != c) {                  if (MDOC_MAX != c) {
                         if (0 == lastpunct && ! rew_elem(mdoc, tok))                          if (0 == lastpunct && ! rew_elem(mdoc, tok))
                                 return(0);                                  return(0);
                         if (nc && 0 == cnt) {                          if (nc && 0 == cnt) {
Line 827  in_line(MACRO_PROT_ARGS)
Line 824  in_line(MACRO_PROT_ARGS)
                         if (ppos > 1)                          if (ppos > 1)
                                 return(1);                                  return(1);
                         return(append_delims(mdoc, line, pos, buf));                          return(append_delims(mdoc, line, pos, buf));
                 } else if (-1 == c)                  }
                         return(0);  
   
                 /*                  /*
                  * Non-quote-enclosed punctuation.  Set up our scope, if                   * Non-quote-enclosed punctuation.  Set up our scope, if
Line 854  in_line(MACRO_PROT_ARGS)
Line 850  in_line(MACRO_PROT_ARGS)
                         cnt++;                          cnt++;
                 if ( ! mdoc_word_alloc(mdoc, line, la, p))                  if ( ! mdoc_word_alloc(mdoc, line, la, p))
                         return(0);                          return(0);
                 mdoc->next = MDOC_NEXT_SIBLING;  
         }          }
   
         if (0 == lastpunct && ! rew_elem(mdoc, tok))          if (0 == lastpunct && ! rew_elem(mdoc, tok))
Line 995  blk_full(MACRO_PROT_ARGS)
Line 990  blk_full(MACRO_PROT_ARGS)
                         continue;                          continue;
                 }                  }
   
                 if (-1 == (c = lookup(mdoc, tok, p)))                  if (MDOC_MAX == (c = lookup(mdoc, tok, p))) {
                         return(0);  
   
                 if (MDOC_MAX == c) {  
                         if ( ! mdoc_word_alloc(mdoc, line, lastarg, p))                          if ( ! mdoc_word_alloc(mdoc, line, lastarg, p))
                                 return(0);                                  return(0);
                         mdoc->next = MDOC_NEXT_SIBLING;  
                         continue;                          continue;
                 }                  }
   
Line 1065  blk_part_imp(MACRO_PROT_ARGS)
Line 1056  blk_part_imp(MACRO_PROT_ARGS)
                 if (ARGS_EOLN == c)                  if (ARGS_EOLN == c)
                         break;                          break;
   
                 if (-1 == (c = lookup(mdoc, tok, p)))                  if (MDOC_MAX == (c = lookup(mdoc, tok, p))) {
                         return(0);  
                 else if (MDOC_MAX == c) {  
                         if ( ! mdoc_word_alloc(mdoc, line, lastarg, p))                          if ( ! mdoc_word_alloc(mdoc, line, lastarg, p))
                                 return(0);                                  return(0);
                         mdoc->next = MDOC_NEXT_SIBLING;  
                         continue;                          continue;
                 }                  }
   
Line 1169  blk_part_exp(MACRO_PROT_ARGS)
Line 1157  blk_part_exp(MACRO_PROT_ARGS)
                 if (ARGS_EOLN == c)                  if (ARGS_EOLN == c)
                         break;                          break;
   
                 if (-1 == (c = lookup(mdoc, tok, p)))                  if (MDOC_MAX != (c = lookup(mdoc, tok, p))) {
                         return(0);  
                 else if (MDOC_MAX != c) {  
                         if ( ! flushed) {                          if ( ! flushed) {
                                 if ( ! rew_subblock(MDOC_HEAD, mdoc,                                  if ( ! rew_subblock(MDOC_HEAD, mdoc,
                                                         tok, line, ppos))                                                          tok, line, ppos))
Line 1200  blk_part_exp(MACRO_PROT_ARGS)
Line 1186  blk_part_exp(MACRO_PROT_ARGS)
   
                 if ( ! mdoc_word_alloc(mdoc, line, lastarg, p))                  if ( ! mdoc_word_alloc(mdoc, line, lastarg, p))
                         return(0);                          return(0);
                 mdoc->next = MDOC_NEXT_SIBLING;  
         }          }
   
         if ( ! flushed) {          if ( ! flushed) {
Line 1289  in_line_argn(MACRO_PROT_ARGS)
Line 1274  in_line_argn(MACRO_PROT_ARGS)
                 if (ARGS_EOLN == c)                  if (ARGS_EOLN == c)
                         break;                          break;
   
                 if (-1 == (c = lookup(mdoc, tok, p)))                  if (MDOC_MAX != (c = lookup(mdoc, tok, p))) {
                         return(0);  
                 else if (MDOC_MAX != c) {  
                         if ( ! flushed && ! rew_elem(mdoc, tok))                          if ( ! flushed && ! rew_elem(mdoc, tok))
                                 return(0);                                  return(0);
                         flushed = 1;                          flushed = 1;
Line 1309  in_line_argn(MACRO_PROT_ARGS)
Line 1292  in_line_argn(MACRO_PROT_ARGS)
   
                 if ( ! mdoc_word_alloc(mdoc, line, lastarg, p))                  if ( ! mdoc_word_alloc(mdoc, line, lastarg, p))
                         return(0);                          return(0);
                 mdoc->next = MDOC_NEXT_SIBLING;  
         }          }
   
         if ( ! flushed && ! rew_elem(mdoc, tok))          if ( ! flushed && ! rew_elem(mdoc, tok))
Line 1369  in_line_eoln(MACRO_PROT_ARGS)
Line 1351  in_line_eoln(MACRO_PROT_ARGS)
   
                 c = ARGS_QWORD == w ? MDOC_MAX : lookup(mdoc, tok, p);                  c = ARGS_QWORD == w ? MDOC_MAX : lookup(mdoc, tok, p);
   
                 if (MDOC_MAX != c && -1 != c) {                  if (MDOC_MAX != c) {
                         if ( ! rew_elem(mdoc, tok))                          if ( ! rew_elem(mdoc, tok))
                                 return(0);                                  return(0);
                         return(mdoc_macro(mdoc, c, line, la, pos, buf));                          return(mdoc_macro(mdoc, c, line, la, pos, buf));
                 } else if (-1 == c)                  }
                         return(0);  
   
                 if ( ! mdoc_word_alloc(mdoc, line, la, p))                  if ( ! mdoc_word_alloc(mdoc, line, la, p))
                         return(0);                          return(0);
                 mdoc->next = MDOC_NEXT_SIBLING;  
         }          }
   
         return(rew_elem(mdoc, tok));          return(rew_elem(mdoc, tok));
Line 1416  phrase(struct mdoc *mdoc, int line, int ppos, char *bu
Line 1396  phrase(struct mdoc *mdoc, int line, int ppos, char *bu
                 if (ARGS_EOLN == w)                  if (ARGS_EOLN == w)
                         break;                          break;
   
                 c = ARGS_QWORD == w ? MDOC_MAX :                  c = ARGS_QWORD == w ? MDOC_MAX : lookup_raw(mdoc, p);
                         mdoc_hash_find(mdoc->htab, p);  
   
                 if (MDOC_MAX != c && -1 != c) {                  if (MDOC_MAX != c) {
                         if ( ! mdoc_macro(mdoc, c, line, la, &pos, buf))                          if ( ! mdoc_macro(mdoc, c, line, la, &pos, buf))
                                 return(0);                                  return(0);
                         return(append_delims(mdoc, line, &pos, buf));                          return(append_delims(mdoc, line, &pos, buf));
                 } else if (-1 == c)                  }
                         return(0);  
   
                 if ( ! mdoc_word_alloc(mdoc, line, la, p))                  if ( ! mdoc_word_alloc(mdoc, line, la, p))
                         return(0);                          return(0);
                 mdoc->next = MDOC_NEXT_SIBLING;  
         }          }
   
         return(1);          return(1);

Legend:
Removed from v.1.28  
changed lines
  Added in v.1.31

CVSweb